akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    s = S()
    a = s.count("-")
    b = s.count("+")
    print(b-a)
    return

#B
def B():
    n = S()
    num = sum(map(int, n))
    n = int("".join(n))
    print(["Yes", "No"][n % num > 0])
    return

#C
def C():
    n, k = LI()
    LI()
    print((n - k) // (k - 1) + 1 + bool((n - k) % (k - 1)))
    return

# D
# 解説AC
# 解説むずくね？これでわかる人いる？
# 順に理解していく
# 1) 桁数が上がるとx/S(x)が上昇するのは解説を見ればわかる
#
# 2) 下一桁が9であることを理解する
# xの下一桁が9でないとして
# x/S(x) - (x+1)/S(x+1) について S(x) =y として
# x/y - (x+1)/(y+1) = x/y - x/(y+1) - 1/(y+1)
#                   = x * (1/y - 1/(y+1)) - 1/(y+1)
#                   = x/y/(y+1) - 1/(y+1)
#                   = (x/y - 1)/(y+1) → (1)
# 今明らかにx/y >= 1なので (1) > 0 だから
# x/y > (x+1)/(y+1)
# よって下一桁は大きいほうがいいので9である
#
# 3)繰上りがない場合変化させる桁は
# できるだけ小さいほうがいいということを示す
# 元の数をxとしてi桁目とi+1桁目について変化させるとすると
# どう考えてもx/S(x)はS(x)は同等の上昇がみられる
# 対しi+1桁目のほうがxが上昇するためi桁目の
# ほうがよいことがわかる 
# 
# 4) 確定させた桁の数が変わらないことを示す
# つまり変化させられる桁(そこの桁をi桁目として10**(i-1)をxに足す
# と最小値がとりうると考えられる)がi桁目としてi-1桁目より小さな桁
# について変化させる意味がないことを示す 
# x/S(x) - (x+10^(i-1))/S(x+1) について上と同様にすれば
# = (x/y - 10**(i-1)) / y が言えるので 
# x/y が 10**(i-1) を上回っている場合
# その桁より小さい値を変化させてもx/S(x)が減少しないことがわかる
# x/S(x)がx以上の整数でx/S(x)を一番小さくできるのであるから、
# 一度上回った 10**(i-1) をx/S(x)が下回ることはあり得ない
# よって、変化させられる桁がi桁目としてi-1桁目より小さな桁
# について変化させる意味がないことがわかった
# 
# 4)このまま毎回x/yの値を計算してそれの桁数から足す10**(i-1)
# を計算してもよいが、変化させる桁目をi桁目としてi+1桁目を変化させた
# ほうがx/S(x)が小さくなるという状態は
# つまりx/yが10**(i-1)を上回ったという
# 意味になるためもっと計算量を落とした方法が本解法になる 
def D():
    K = II()
    ans = 1
    i = 0
    def Sunuke(a):
        return a / sum(map(int, str(a)))
    def Check(a, i):
        return Sunuke(a + 10 ** i) > Sunuke(ans + 10 ** (i + 1))
    while K:
        print(ans)
        K -= 1
        i += Check(ans, i)
        ans += 10 ** i
    return


#Solve
if __name__ == '__main__':
    D()

Measured memory_bytes: 40688
#include <iostream>
#include <vector>

int main(){
  using namespace std;
  int n;
  long hi_buffer;
  bool hi_down = false;
  cin >> n;
  cin >> hi_buffer;
  for(int i = 1;i < n;i++){
    long hi;
    cin >> hi;
    long hi_diff = hi - hi_buffer;
    if(hi_diff < 0){
      if(hi_diff == -1 && hi_down){
        cout << "No" << endl;
        return 0;
      }else if(hi_diff == -1){
        hi_down = true;
      }else{
        cout << "No" << endl;
        return 0;
      }
    }else if(hi_diff > 0){
      hi_down = false;
    }
    hi_buffer = hi;
  }
  cout << "Yes" << endl;
  return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const int mod = 1000000007;

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint &operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
mint c[4005][4005];
void init()
{
  c[0][0] = 1;
  for (int i = 0; i <= 4000; i++)
  {
    for (int j = 0; j <= i; j++)
    {
      c[i + 1][j] += c[i][j];
      c[i + 1][j + 1] += c[i][j];
    }
  }
}
mint comb(int n, int k)
{
  return c[n][k];
}
mint f2(int n, int k)
{
  return comb(n + k - 1, k - 1);
}
mint f(int n, int k)
{
  if (n < k)
    return 0;
  if (n == 0 && k == 0)
    return 1;
  if (k < 1)
    return 0;
  return f2(n - k, k);
}

int main()
{
  init();
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= k; i++)
  {
    mint blue = f(k, i);
    mint red = 0;
    {
      red += f(n - k, i - 1);
      red += f(n - k, i);
      red += f(n - k, i);
      red += f(n - k, i + 1);
    }
    mint ans = blue * red;
    printf("%lld\n", ans.x);
  }
  return 0;
}


Measured memory_bytes: 125696
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cmath>

#define REP(i,n) for(int (i) = 0;(i) < (n);(i)++)
using namespace std;
int P[31664];

int main(){
	P[0] = P[1] = 1;
	REP(i,180){
		if(P[i]==0){
			for(int j = i*i;j<31664;j+=i) P[j]=1;
		}
	}
	int n;
	cin >> n;cout << n <<":";
	REP(i,31664){
		if(P[i]==0 && n%i==0){
			while(n%i==0){
				cout << " " << i;
				n/=i;
			}
		}
		if(n==1)break;
	}
	if(n != 1) cout << " " << n;
	cout << endl;
}

Measured memory_bytes: 3172
from operator import mul
from functools import reduce


def cmb(_n, _r):
    _r = min(_n - _r, _r)
    if _r == 0:
        return 1
    return reduce(mul, range(_n, _n - _r, -1)) // reduce(mul, range(1, _r + 1))


n, m = map(int, input().split(' '))

count = 0
if n >= 2:
    count += cmb(n, 2)
if m > 2:
    count += cmb(m, 2)
print(count)


Measured memory_bytes: 3700
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=1<<30;
const int mod=1e9+7;
const int MOD=998244353;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;cin >> n >> m;
    vector<int> a(n),b(n),c(m),d(m);
    vector<int> t(n,inf),ans(n);
    for(int i=0;i<n;i++){
        cin >> a[i] >> b[i];
    }
    for(int i=0;i<m;i++){
        cin >> c[i] >> d[i];
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(abs(a[i]-c[j])+abs(b[i]-d[j])<t[i]){
                t[i]=abs(a[i]-c[j])+abs(b[i]-d[j]);
                ans[i]=j;
            }
        }
        cout << ans[i]+1 << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RFOR(i,a,b) for (int i=(a)-1;i>=(b);i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1e9;
const ll LL_INF = 1e18;
const int MOD = 1e9 + 7;

using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  pair<int, int> x[200005];
  REP(i,N){
    cin >> x[i].first;
    x[i].second = i;
  }
  sort(x, x + N);
  int f = x[N/2 - 1].first;
  int s = x[N/2].first;
  REP(i,N){
    if(i >= N/2){
      x[i].first = f;
    }else{
      x[i].first = s;
    }
  }
  sort(x, x + N, [](const pair<int, int>& a, const pair<int,int>& b){
      return a.second < b.second;});
  REP(i,N){
    cout << x[i].first << endl;
  }
  return 0;
}


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

#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define MOD 1000000007

using namespace std;

using ll = long long;

template <class T, T M>
class modulo {
public:
    T data;

    modulo(T data = 0) : data(data % M) {
    }

    modulo operator+(const modulo &x) const {
        return modulo(data + x.data);
    }

    modulo operator-(const modulo &x) const {
        return modulo(data + (M - x.data));
    }

    modulo operator*(const modulo &x) const {
        return modulo(data * x.data);
    }

    modulo operator/(const modulo &x) const {
        return modulo(data * x.inv().data);
    }

    modulo operator+=(const modulo &x) {
        data = (data + x.data) % M;
    }

    modulo operator-=(const modulo &x) {
        data = (data + (M - x.data)) % M;
    }

    modulo operator*=(const modulo &x) {
        data = (data * x.data) % M;
    }

    modulo operator/=(const modulo &x) {
        data = (data * x.inv().data) % M;
    }

    modulo inv() const {
        return _pow(M - 2);
    }

    template <class Integer>
    modulo operator^(Integer n) const {
        if (n >= 0) {
            return _pow(n);
        } else {
            return _pow(M - 1 - (-n) % (M - 1));
        }
    }

    friend std::ostream& operator<<(std::ostream &os, const modulo &x) {
        os << x.data;
        return os;
    }

private:
    template <class NonNegativeInteger>
    modulo _pow(NonNegativeInteger n) const {
        modulo result(1);
        modulo x(*this);
        while (n) {
            if (n & 1) {
                result *= x;
            }
            x *= x;
            n >>= 1;
        }
        return result;
    }
};

int main() {
    using Mo = modulo<ll, MOD>;

    int N, M;
    cin >> N >> M;
    int L = N + M;

    vector<Mo> factorial(L + 1);
    factorial[0] = 1;
    FOR(i, 1, L + 1) {
        factorial[i] = Mo(i) * factorial[i - 1];
    }

    Mo result;
    if (M == N) {
        result = factorial[M] * factorial[M] * Mo(2);
    } else if (abs(M - N) == 1) {
        result = factorial[M] * factorial[N];
    }
    cout << result << endl;

    return 0;
}

Measured memory_bytes: 1792
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<random>
#include<deque>
#include<cstdio>
#include<fstream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 2000100;
const int MOD = (int)pow(10, 9) + 7;
const ll INF = 1LL << 60;
#define rep(i,n) for(ll i=(ll)0;i<(ll)n;++i)
#define ALL(x) x.begin(),x.end()
#define pp pair<ll,ll>
#define ppp pair<ll,pp>
#define pps pair<string ,ll>
#define fi first
#define se second
#define pb push_back
#define fix(n) fixed<<setprecision(n)
#define itr vector<ll>::iterator
#define print(s) cout<<s<<endl
#define inp(s) cin>>s
string yn(bool b) { return (b ? "Yes" : "No"); }
string YN(bool b) { return (b ? "YES" : "NO"); }
ll gcd(ll a, ll b) {
	if (a%b == 0)return b;
	return gcd(b%a, a);
}
ll n, x, a,ans;
int main() {
	//cout << gcd(105, 49) << endl;
	cin >> n >> x;
	rep(i, n) {
		cin >> a;
		ans = (i==0?abs(a-x):gcd(ans, abs(a - x)));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
from collections import Counter
N = int(input())
factors = []
i = 2
while N > 1:
  if N < i * i:
    factors.append(N)
    break
  while N % i == 0:
    factors.append(i)
    N //= i
  i += 1

ans = 0
for count in Counter(factors).values():
  i = 1
  while count >= i:
    count -= i
    i += 1
    ans += 1
print(ans)


Measured memory_bytes: 9428
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   string s;
   cin >> s;
   for(auto &e : s) if(e == '?') e = 'D';
   cout << s << '\n';
   return 0;
}

Measured memory_bytes: 3732
def a():
    n, a, b = map(int, input().split())
    if (a > b) or ((a != b)and(n == 1)):
        print(0)
        return
    elif (a == b) and (n == 1):
        print(1)
        return
    else:
        min_sum = a * (n-1) + b
        max_sum = a + b * (n-1)
        num = max_sum - min_sum + 1
        print(num)
        return
    pass

a()


Measured memory_bytes: 3060
//url:
//problem name:

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
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;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long,long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long,long>>;

int main() {
    string S;
    cin >> S;
    for(auto c: S) {
        if(c == '7') {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 3596
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(lint)(n);i++)
#define REP(i,n) for(int i=1;i<=(lint)(n);i++)
#define all(V) V.begin(),V.end()
#define stackReplaceBegin(size)\
	void* p=malloc(size);\
	esp_new=(lint)p+size-1;\
	void * stack_extend_memory_ = malloc(size);\
	void * stack_extend_origin_memory_;\
	char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);\
	*stack_extend_dummy_memory_ = 0;\
	asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
typedef long long lint;
typedef unsigned long long ulint;
typedef std::pair<int, int> P;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = DBL_EPSILON;
constexpr double PI = 3.141592653589793238462643383279;
lint esp_new;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, unsigned int b) {
	T res(1),now(a);
	while(b){
		if(b&1)res*=now;
		b>>=1;
		now*=now;
	}
	return res;
}
lint modpow(lint a,unsigned int b,unsigned int mod){
	lint res(1),now(a%mod);
	while(b){
		if(b&1){
			res*=now;
			res%=mod;
		}
		b>>=1;
		now*=now;
		now%=mod;
	}
	return res;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, (int)vec.size() - 1)std::cout << vec[i] << " ";
	if(!vec.empty())std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
int main(){
	lint n;
	std::cin>>n;
	REP(i,n){
		if(n<=i*(i+1)/2){
			for(int j=i;j>=1;j--){
				if(j<=n){
					std::cout<<j<<std::endl;
					n-=j;
				}
			}
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3608
from math import floor
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


def main():
    N = int(input())
    x = floor(N / 1.08)
    if floor(x * 1.08) == N:
        print(x)
    elif floor((x + 1) * 1.08) == N:
        print(x+1)
    elif floor((x - 1) * 1.08) == N:
        print(x - 1)
    else:
        print(":(")


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))

using namespace std;

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

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  int n,z,w,a[2005];
  cin>>n>>z>>w;
  rep(i,n)cin>>a[i];
  if(n==1){
    cout<<abs(a[0]-w)<<endl;
  }else{
    cout<<max(abs(a[n-2]-a[n-1]),abs(a[n-1]-w))<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<stdio.h>
#include<map>
using namespace std;
struct wolf{
	int t[9];
	wolf(){}
};
int v[9];
int D[36][9]={
{2,0,0,0,0,0,0,1,0},
{1,1,0,0,0,0,1,0,0},
{3,0,0,0,0,0,1,0,0},
{1,0,1,0,0,1,0,0,0},
{0,2,0,0,0,1,0,0,0},
{2,1,0,0,0,1,0,0,0},
{4,0,0,0,0,1,0,0,0},
{1,0,0,1,1,0,0,0,0},
{0,1,1,0,1,0,0,0,0},
{2,0,1,0,1,0,0,0,0},
{1,2,0,0,1,0,0,0,0},
{3,1,0,0,1,0,0,0,0},
{5,0,0,0,1,0,0,0,0},
{0,1,0,2,0,0,0,0,0},
{0,0,2,1,0,0,0,0,0},
{2,0,0,2,0,0,0,0,0},
{1,1,1,1,0,0,0,0,0},
{0,3,0,1,0,0,0,0,0},
{3,0,1,1,0,0,0,0,0},
{2,2,0,1,0,0,0,0,0},
{4,1,0,1,0,0,0,0,0},
{6,0,0,1,0,0,0,0,0},
{1,0,3,0,0,0,0,0,0},
{0,2,2,0,0,0,0,0,0},
{2,1,2,0,0,0,0,0,0},
{4,0,2,0,0,0,0,0,0},
{1,3,1,0,0,0,0,0,0},
{3,2,1,0,0,0,0,0,0},
{5,1,1,0,0,0,0,0,0},
{7,0,1,0,0,0,0,0,0},
{0,5,0,0,0,0,0,0,0},
{2,4,0,0,0,0,0,0,0},
{4,3,0,0,0,0,0,0,0},
{6,2,0,0,0,0,0,0,0},
{8,1,0,0,0,0,0,0,0},
{10,0,0,0,0,0,0,0,0}
};
long long conv(wolf a){
	long long ret=0;
	for(int i=0;i<9;i++){
		ret*=128;
		ret+=a.t[i];
	}
	return ret;
}
map<long long,int> dp;
int solve(wolf a,int b){
	if((int)(dp.count(conv(a))))return dp[conv(a)];
	int ret=0;
	for(int i=b;i<36;i++){
		bool ok=true;
		for(int j=0;j<9;j++){
			if(a.t[j]<D[i][j]){
				ok=false;
				break;
			}
		}
		if(ok){
			for(int j=0;j<9;j++)a.t[j]-=D[i][j];
			ret=max(ret,solve(a,i)+1);
			for(int j=0;j<9;j++)a.t[j]+=D[i][j];
		}
	}
	return dp[conv(a)]=ret;
}
int main(){
	int a;
	while(scanf("%d",&a),a){
		dp.clear();
		for(int i=0;i<10;i++)v[i]=0;
		for(int i=0;i<a;i++){
			int b;
			scanf("%d",&b);
			b--;
			v[b]++;
		}
		int ret=0;
		for(int i=5;i<9;i++){
			int V=min(v[i],v[8-i]);
			ret+=V;
			v[i]-=V;
			v[8-i]-=V;
		}
		ret+=v[4]/2;
		v[4]%=2;
		wolf S;
		for(int i=0;i<9;i++)S.t[i]=v[i];
		printf("%d\n",ret+solve(S,0));
	}
}



Measured memory_bytes: 5928
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
#define ff first
#define ss second
#define setbits(x) __builtin_popcount(x)
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<db, db> pdd;
typedef vector<int> vi;
#define m1 make_pair
#define in insert
#define pb push_back
#define IOS                           \
    std::ios::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define endl "\n"
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

inline ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
inline ll power(ll a, ll n, ll m)
{
    if (n == 0)
        return 1;
    ll p = power(a, n / 2, m);
    p = (p * p) % m;
    if (n % 2)
        return (p * a) % m;
    else
        return p;
}
const ll MOD = 1000000007;
const int N = int(3e5) + 999;
#define int long long int

int32_t main(){
    IOS;
    int a,b;
    cin>>a>>b;
    int t1=0,t2=0;
    for(int i=1;i<=b;i++)
    	t1 = t1*10+a;
    for(int i=1;i<=a;i++)
    	t2 = t2*10+b;

    t1 = max(t1,t2);
    cout<<t1<<endl;

    return 0;
}

Measured memory_bytes: 256
// @author :: Amirul Islam 

#include <bits/stdc++.h>
using namespace std;
#define LLI long long int

const int mx = 1e5;
const double pi = acos(-1.0);

int main() {
    // freopen("in", "r", stdin);
    
    string s;
    map <char, int> m;
    while (cin >> s) {
        for (int i = 0; i < s.size(); i++) {
            char ch = tolower(s[i]);
            m[ch]++;
        }
    }
    for (char i = 'a'; i <= 'z'; i++) {
        cout << (char) i << " : " << m[i] << endl;
    }
}


Measured memory_bytes: 3164
#include<stdio.h>


int main(void)
{
    char o;
    
    scanf("%c",&o);
    
    if((o>='a')&&(o<='z')){
        printf("a");
    }else if((o>='A')&&(o<='Z')){
        printf("A");
    }
    
    return 0;
}

Measured memory_bytes: 1992
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
// #define int ll
using PII = pair<int, int>;
 
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
 
template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
 
template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) { 
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }
 
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) {is >> x;} return is;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}
 
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
ll MOD = 1000000007;

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

  ll x, y;
  cin >> x >> y;
  cout << x + y/2 << endl;

  return 0;
}


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

int main(){
	int N;
	cin>>N;
	int a[100000];
	for(int i=0;i<N;i++){
		cin>>a[i];
		a[i]--;
	}

	int res = 0;
	for(int i=0;i<N;i++){
		if(a[a[i]] == i){
			res++;
		}
	}
	cout<<res/2<<endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <cstdlib>
#include <algorithm>

using namespace std;

int main() {
    string s;
    cin >> s;
    for (char tmp : s) {
        cout << "x";
    }
    cout << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000

void solve_abc_d() {
	ll n, m;
	ll a, b;
	//ll x, y;
	ll h, w;
	ll k;
	ll l_ans = 0;

	cin >> n;

	V len(n);
	rep(i, n) cin >> len[i];

	sort(ALL(len));

	ll idx1, idx2;
	ll cnt;
	rep(a, n) {
		rep2(b, a + 1, n) {
			auto itr1 = upper_bound(ALL(len), len[b] - len[a]);
			idx1 = itr1 - len.begin();
			auto itr2 = lower_bound(ALL(len), len[a] + len[b]);
			idx2 = itr2 - len.begin();

			cnt = max(0LL, (ll)(idx2 - b - 1));
			l_ans += cnt;
		}
	}

	cout << l_ans << "\n";

	return;
}

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

	solve_abc_d();

	return 0;
}


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

int main() {
	int a, b;
	cin >> a >> b;
	if(a <= 0 && b >= 0){
		cout << "Zero" << endl;
	}else{
		if(a < 0 && b < 0){
			if((b - a) % 2 == 0){
				cout << "Negative" << endl;
				return 0;
			}
		}
		cout << "Positive" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
using llong = long long;

const llong mod = (llong)1e9 + 7;
llong N, K;
llong a[105];
llong dp[105][100005];

int main() {
    cin >> N >> K;
    for (int i = 1; i <= N; i++) {
        cin >> a[i];
    }

    dp[0][0] = 1;
    for (int i = 1; i <= N; i++) {
        for (int j = 0; j <= K; j++) {
            dp[i][j] += (dp[i - 1][max(0ll, j - a[i])] - dp[i - 1][j + 1] + mod) % mod;
            dp[i][j] %= mod;
        }

        dp[i][K + 1] = 0;
        for (int j = K; j >= 0; j--) {
            dp[i][j] += dp[i][j + 1];
            dp[i][j] %= mod;
        }
    }

    cout << dp[N][K] << endl;

    return 0;
}


Measured memory_bytes: 79360
#include <iostream>
#include<algorithm>
#include <vector>
#include <iomanip>

int main()
{
    long N,L;
    std::cin >>N >> L;
    std::vector<long> A;;
    int sum=0;
    int flag=0;
    for(int i=0; i<N; i++){
        sum+=(L+i);
        A.push_back(abs(L+i));
        if(L+i<0){
            flag=1;
        }
    }
    
    std::sort(A.begin(),A.end());
    if(flag==0){
        sum-=A[0];
    }else{
        sum+=A[0];
    }
    std::cout << sum << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdint>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <valarray>
#include <vector>

#if __has_include(<string_view>)
#include <string_view>
#endif
#if __has_include(<optional>)
#include <optional>

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

using namespace std;

template <class T>
constexpr const T& max(const T& a, const std::optional<T>& b)
{
    return b ? max(a, *b) : a;
}

template <class T>
constexpr const T& max(const std::optional<T>& a, const T& b)
{
    return a ? max(*a, b) : b;
}

template <class T>
constexpr const std::optional<T>& max(const std::optional<T>& a, const std::optional<T>& b)
{
    if (a && b)
        return *a > *b ? a : b;
    else if (a)
        return a;
    else
        return b;
}

template <class T>
constexpr const T& min(const T& a, const std::optional<T>& b)
{
    return b ? min(a, *b) : a;
}

template <class T>
constexpr const T& min(const std::optional<T>& a, const T& b)
{
    return a ? min(*a, b) : b;
}

template <class T>
constexpr const std::optional<T>& min(const std::optional<T>& a, const std::optional<T>& b)
{
    if (a && b)
        return *a < *b ? a : b;
    else if (a)
        return a;
    else
        return b;
}

#endif
#if __has_include(<any>)
#include <any>
#endif

template <class T, class U>
istream& operator>>(istream& is, pair<T, U>& pair)
{
    is >> pair.first >> pair.second;
    return is;
}

template <class T>
istream& operator>>(istream& is, vector<T>& collection)
{
    for (auto& item : collection)
        is >> item;
    return is;
}

template <class T>
istream& operator>>(istream& is, valarray<T>& collection)
{
    for (auto& item : collection)
        is >> item;
    return is;
}

template <class T>
T peak_and_pop(std::queue<T>& q)
{
    assert(!q.empty());
    T t = move(q.front());
    q.pop();
    return t;
}

template <class T>
T peak_and_pop(std::priority_queue<T>& q)
{
    assert(!q.empty());
    T t = move(q.top());
    q.pop();
    return t;
}

template <class T>
T peak_and_pop(std::stack<T>& q)
{
    assert(!q.empty());
    T t = move(q.top());
    q.pop();
    return t;
}

void solution()
{
    int n,x,t;
    cin >> n >> x >> t;
    int tt = 0;
    while(n > 0){
        tt += t;
        n -= x;
    }
    cout << tt << '\n';
}

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


Measured memory_bytes: 3688
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
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;
}

const int INF=1e18;
const int MOD=1e9+7;

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

Measured memory_bytes: 3588
n = int(input())
b = list(map(int, input().split()))
a = [b[0]]
for i in range(1, n):
    if a[-1] != b[i]:
        a.append(b[i])

ans = 1
inc = a[0] < a[min(1, n-1)]

n = len(a)
i = 1
while i < n:
    if (a[i-1] < a[i]) ^ inc:
        ans += 1
        inc = a[i] < a[min(i+1, n-1)]
        i += 2
    else:
        i += 1
print(ans)

Measured memory_bytes: 14224
#include <iostream>
#include <vector>
#include <string>
#include <unordered_set>
using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<string> s(n);
	unordered_set<string> ki;
	bool f = true;
	for (int i = 0; i < n; i++) {
		cin >> s[i];
		if (ki.find(s[i]) != ki.end()) {
			f = false;
			break;
		}
		else {
			ki.insert(s[i]);
		}
	}
	for (int i = 1; i < n; i++) {
		int m = s[i - 1].size();
		if (s[i - 1][m - 1] != s[i][0]) {
			f = false;
			break;
		}
	}
	if (f) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
using System.Collections.Generic;
using System;
using System.Text;

public class Change
{
    public string before { get; set; }
    public string after { get; set; }
}

public class hello
{
    public static void Main()
    {
        var changes = new List<Change>();
        string line;
        for (; (line = Console.ReadLine()) != null;)
        {
            var s = line.Trim();
            for (int i = 0; i < s.Length; i++)
            {
                if (s.Substring(i,1) == "@")
                {
                    var s3 = s.Substring(i, 3);
                    var ctime = int.Parse(s3[1].ToString());
                    var after = new string(s3[2], ctime);
                    changes.Add (new Change { before = s3, after = after });
                }
            }
            var sb = new StringBuilder(s);
            foreach (var x in changes)
                sb.Replace(x.before, x.after);
            var result = sb.ToString();
            Console.WriteLine(result);
        }
    }
}

Measured memory_bytes: 8880
N, M = map(int, input().split())
H = list(map(int, input().split()))
ma = [0 for i in range(N)]
A, B = [], []
ans = 0

for i in range(M):
    a, b = map(int, input().split())
    ma[a-1] = max(ma[a-1], H[b-1])
    ma[b-1] = max(ma[b-1], H[a-1])

for j in range(N):
    if H[j] > ma[j]:
        ans += 1

print(ans)


Measured memory_bytes: 19932
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#include <thread>
#include <atomic>
#include <mutex>
#include <future>
#define int long long
#define endre getchar();getchar();return 0
#define INF 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define input() for(int i=0;i<n;i++)cin>>a[i];
#define P pair<int,int>
#define prique priority_queue<int,vector<int>,greater<int>>
using namespace std;
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return (y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int n) {
	if (n == 0)return 1;
	return (kai(n - 1)*n) % INF;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int mystoi(string s) {
	int cnt = 0;
	for (int i = 0; i < s.size(); i++) {
		cnt += (int)(s[i] - '0') * pow(10, s.size() - i - 1);
	}
	return cnt;
}
int n, a[100005], b[100005], c[100005];
int dp[100005][10];
signed main() {
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i] >> b[i] >> c[i];
	}
	dp[0][0] = 0, dp[0][1] = 0, dp[0][2] = 0;
	for (int i = 1; i <= n; i++) {
		if (i == 1) {
			dp[1][0] = a[1];
			dp[1][1] = b[1];
			dp[1][2] = c[1];
		}
		else {
			dp[i][0] = max(dp[i - 1][1] + a[i], dp[i - 1][2] + a[i]);
			dp[i][1] = max(dp[i - 1][0] + b[i], dp[i - 1][2] + b[i]);
			dp[i][2] = max(dp[i - 1][1] + c[i], dp[i - 1][0] + c[i]);
		}
	}
	cout << max({ dp[n][0],dp[n][1],dp[n][2] }) << endl;
	endre;
}

Measured memory_bytes: 10368
#include<iostream>
#include<string>


using namespace std;

int main() {
	string a, b, c;
	cin >> a >> b >> c;
	char f = 'a';
	int x = 0, y = 0, z = 0;
	while (1) {
		if (f == 'a') {

			if (a.size() == x ) {
				cout << 'A' << endl;
				return 0;
			}
			f = a[x];
			x++;
		}
		else if (f == 'b') {	
			if (b.size() == y) {
				cout << 'B' << endl;
				return 0;
			}
			f = b[y];
			y++;
		}
		else {

			if (c.size() == z) {
				cout << 'C' << endl;
				return 0;
			}
			f = c[z];
			z++;
		}
		
	}	
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>

using namespace std;

namespace Solver {

    int N;
    vector<string> a, b;
    inline void Read() {
        cin >> N;
        a.resize(N);
        b.resize(N);
        for (int i = 0; i < N; i++) cin >> a[i] >> b[i];
    }

    const vector<char> units = {'m', 'c', 'x', 'i'};

    inline int mcxi2int(string str) {
        int ret = 0;
        for (int i = 0; i < units.size(); i++) {
            for (int j = 0; j < str.length(); j++) {
                if (units[i] == str[j]) {
                    if (j == 0 || find(units.begin(), units.end(), str[j - 1]) != units.end()) {
                        ret += (int)pow(10.0, (double)(3 - i));
                    } else {
                        ret += (int)((str[j - 1] - '0') * pow(10.0, (double)(3 - i)));
                    }
                }
            }
        }

        return ret;
    }

    inline string int2mcxi(int v) {
        string ret = "";
        for (int i = 0; i < 4; i++) {
            int c = (int)pow(10.0, (double)(3 - i));
            int a = v / c;
            if (a == 0) continue;
            else if (a == 1) ret += string(1, units[i]);
            else ret += string(1, '0' + a) + string(1, units[i]);

            v -= a * c;
        }

        return ret;
    }


    inline void Work() {
        for (int i = 0; i < N; i++) cout << int2mcxi(mcxi2int(a[i]) + mcxi2int(b[i])) << endl;
    }



    inline void Solve() {
        Read();
        Work();
    }
}

int main() {
    Solver::Solve();
}

Measured memory_bytes: 1460
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MOD 1000000007
using Graph=vector<vector<int>>;

int main(){
  int N;
  cin>>N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin>>A.at(i);
  }
  map<int,ll> m;
  for(int i=0;i<N;i++){
    if(m.count(A.at(i))==0){
      m[A.at(i)]=0;
    }
    m[A.at(i)]++;
  }

  ll ans=0;
  for(auto x: m){
    ans+=x.second*(x.second-1)/2;
  }

  for(int i=0;i<N;i++){
    ll x=m[A.at(i)];
    cout<<ans-x*(x-1)/2+(x-1)*(x-2)/2<<endl;
  }
}


Measured memory_bytes: 11264
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();

        String S = sc.next();

        int cnt = 0;
        int ans =0;

        for (int i = 0; i < n; i++) {
            if (S.charAt(i) == 'R') {
                cnt++;
            }
        }

        for (int i = 0; i < cnt; i++) {
            if (S.charAt(i) == 'W') {
                ans++;
            }

        }


        System.out.println(ans);

        sc.close();

        }

    }



Measured memory_bytes: 40912
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	long long a,b;
	cin>>a>>b;
	if( ((a&1) ^ (b&1)) ){
		cout<<"IMPOSSIBLE"<<endl;
		return 0;
	}
	cout<< (min(a,b)+(abs(a-b)>>1))<<endl;
	
	return 0;
} 

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


#define ARRAY_MAX 100005
const ll INF = (1LL << 31) - 1;
const ll MOD = 1e9 + 7;

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


/******************************************************************************************/



int main() {

	int n, a, b, c, d;
	cin >> n >> a >> b >> c >> d;
	a--;
	b--;
	c--;
	d--;

	string s;
	cin >> s;
	s.push_back('@');
	s.push_back('@');
	s.push_back('@');
	s.push_back('@');
	
	auto check = [&](int st, int ed) {

		for (int i = st; i < ed; i++)
		{
			if (s[i] == '#' && s[i + 1] == '#')return false;
		}
		return true;
	};

	if (!check(a, c) || !check(b, d)) {
		cout << "No" << endl;
		return 0;
	}


	if (c > d) {

		bool flag = false;
		for (int i = b; i <= d; i++)
		{
			if (s[i - 1] == '.' && s[i] == '.' && s[i + 1] == '.') {
				flag = true;
			}
		}
		if (!flag) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;






	return 0;
}

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

int main(){
	int a,b,m,ans=1e9;
	cin>>a>>b>>m;
	vector<int>aa(a),bb(b);
	for(int i=0;i<a;++i)cin>>aa.at(i);
	for(int i=0;i<b;++i)cin>>bb.at(i);
	for(int i=0,pa,pb,minus;i<m;++i){
		cin>>pa>>pb>>minus;
		ans=min(ans,aa.at(pa-1)+bb.at(pb-1)-minus);
	}
	sort(aa.begin(),aa.end());
	sort(bb.begin(),bb.end());
	ans=min(ans,aa.at(0)+bb.at(0));
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
    int a,b;
    char op;
    cin >> a >> op >> b;
    while(op!='?')
    {
        int c;
        if(op=='+')
            c=a+b;
        if(op=='-')
            c=a-b;
        if(op=='*')
            c=a*b;
        if(op=='/')
            c=a/b;
        cout << c << endl;
        cin >> a >> op >> b;
    }
    return 0;
}



Measured memory_bytes: 3092
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;

long long x, y;

long long gcd(long long x, long long y) {
	if (x < y) swap(x, y);
	return (y ? gcd(y, x%y) : x);
}
int main() {
	cin.tie(NULL); cout.tie(NULL);
	ios::sync_with_stdio(false);
	cin >> x >> y;
	long long tmp = gcd(x, y);
	if (x == y || tmp == y) {
		cout << -1;
	}
	else {
		if (x < y) cout << x;
		cout << x;
	}

}

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

const int MAX_N = 100005;
const int MAX = 2000000000;
int mem[MAX_N];
int hs[MAX_N];
int N, K;

int dp(int n) {
  if (n > N) return MAX;
  if (n == N) return 0;
  if (mem[n] != -1) return mem[n];
  mem[n] = MAX;
  for (int k = 1; k <= K; ++k) {
    if (n + k > N) break;
    mem[n] = std::min(mem[n], dp(n + k) +
      std::abs(hs[n] - hs[n + k]));
  }
  return mem[n];
}

int main() {
  scanf("%d %d", &N, &K);
  memset(mem, -1, sizeof(mem));
  for (int i = 0; i < N; ++i) {
    scanf("%d", hs + i + 1);
  }
  printf("%d\n", dp(1));
}


Measured memory_bytes: 10744
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		if(S.substring(2, 3).equals(S.substring(3, 4)) && S.substring(4, 5).equals(S.substring(5, 6))) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 21204
if __name__ == '__main__':
    N = int(input())
    A = []
    ret = []
    for i in range(N):
        A.append(int(input()))

    B = sorted(A)
    for n in A:
        if B[-1] != n:
            print(B[-1])
        else:
            print(B[-2])

Measured memory_bytes: 14112
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;

void main() {
	string[] inputs = split(readln());
	int a = to!int(inputs[0]);
	int b = to!int(inputs[1]);
	int c = to!int(inputs[2]);
	if(a + b == c || b + c == a || c + a == b) "Yes".writeln;
	else "No".writeln;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

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

    int ans[26] = {};
    REP(i, 0, N) {
        string s; cin >> s;
        if (i == 0) {
            REP(j, 0, s.size()) {
                ans[s[j] - 'a']++;
            }
        } else {
            int tmp[26] = {};
            REP(j, 0, s.size()) {
                tmp[s[j] - 'a']++;
            }
            REP(j, 0, 26) {
                ans[j] = min(ans[j], tmp[j]);
            }
        }
    }

    REP(i, 0, 26) {
        REP(j, 0, ans[i]) {
            cout << char(i + 'a');
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	k := nextLine()
	s := nextLine()
	if k == s[0:len(k)] {
		fmt.Println("Yes")
	} else {
		fmt.Printf("No")
	}
}


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

int main() {
	string s; cin >> s;
	if (s == "Sunny") cout << "Cloudy";
	if (s == "Cloudy") cout << "Rainy";
	if (s == "Rainy") cout << "Sunny";
	cout << '\n';
}


Measured memory_bytes: 3580
// Problem : B - Crane and Turtle
// Contest : AtCoder - AtCoder Beginner Contest 170
// URL : https://atcoder.jp/contests/abc170/tasks/abc170_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define int long long
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define vi vector<int>
#define vstr vector<string>
#define vdb vector<double>
#define vbool vector<bool>
#define vvi vector<vector<int> >
#define mii map<int,int>
#define pb push_back
#define pii pair<int,int>
#define vpair vector<pii > 
#define mkp make_pair
#define scan(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) {cout<<a[i]<<' ';}cout<<'\n'
#define mem(a,v) memset(a,v,sizeof(a))
#define loop(i,a,b) for (int i = a; i < b; i++)
#define loope(i,a,b) for (int i = a; i <= b; i++)
#define bloop(i,a,b) for(int i = a;i>=b;i--)
#define FastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PRECISION std::cout.unsetf ( std::ios::fixed );std::cout.precision(9)
#define PI 3.14159265
#define S second
#define F first
#define CHECK cout<<"CHEDEDWB"<<endl
#define CHECK1(a) cout<<a<<endl
#define CHECK2(a,b) cout<<a<<' '<<b<<endl;
#define br '\n'
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(),x.end()
using namespace std;
int mod = 1e9+7;
int inf = 1e18;
int m_inf = INT_MIN;
// int extendedgcd(int a,int b,int &x,int &y){
	// if(a == 0){
		// x = 0; y = 1;
		// return b;
	// }
	// int x1,y1;
	// int d = extendedgcd(b%a,a,x1,y1);
	// x = y1 - (b/a)*x1;y = x1;
	// return d;
// }
// int expmod(int a,int b) {
// 	if(b == 1) return a;
// 	if(b == 0) return 1;
// 	int m1 = expmod(a,b/2)%mod;
// 	if(b%2) return ((m1*m1)%mod*a%mod)%mod;
// 	return (m1*m1)%mod;
// }
// int power(int a,int b) {
// 	if(b == 1) return a;
// 	if(b == 0) return 1;
// 	int m1 = power(a,b/2);
// 	if(b%2) return m1*m1*a;
// 	return m1*m1;
// }
// int logn(int n, int r) 
// { 
//     return (n > r - 1) ? 1 + logn(n / r, r) : 0; 
// } 

// int nCr(int n,int r)
// {
	// r = min(r,n-r);
	// if(r<0)
		// return 0;
	// if(r == 0)
		// return 1;
	// int ans = 1;
	// for(int i = 1;i<=r;i++)
	// {
		// ans = ans*(n-i+1)/i;
	// }
	// return ans;
// 		
// }
// vi factmod(int n)
// {
	// vi ans(n+1);
	// ans[0] = 1;
	// loop(i,1,n+1)
	// {
		// ans[i] = (ans[i-1]*i)%mod;
	// }
	// return ans;
// }
// int nCrmod(int n,int r,vi &fact)
// {
	// int x1,y1;
	// extendedgcd(fact[r],mod,x1,y1);
	// int x2,y2;
	// extendedgcd(fact[n-r],mod,x2,y2);
	// int ans = (fact[n]*((x1+mod)%mod))%mod;
	// ans = (ans*((x2+mod)%mod))%mod;
	// return ans;
// }

// void dfs(vector<vector<int> > &adj,int root,vbool &vis)
// {
// 	vis[root] = true;
// 	for(int i = 0;i<adj[root].size();i++){
// 		int v = adj[root][i];
// 		if(!vis[v])		
// 			dfs(adj,v,vis);
// 	}
// }

int32_t main() 
{
	FastIO; PRECISION;
	int t = 1;
	// cin>>t;
	while(t--)
	{
		int x,y;
		cin>>x>>y;
		if(y%2 == 0 && 2*x<=y && 4*x-y>=0)
		{
			cout<<"Yes\n";
		}
		else
			cout<<"No\n";
	}
}

Measured memory_bytes: 3648