akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const int inf = 1e9+7;
const int mod = 1e9+7;

int main(){
    int x,n;
    cin>>x>>n;

    if(n==0){
        cout<<x<<endl;
        return 0;
    }

    vector<int>p(n);
    rep(i,n)cin>>p[i];

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

    int ans1=0,ans2=0;

    rep2(i,x,101){
        bool jdg=true;
        rep(j,n){
            if(p[j]==i){
                jdg=false;
                break;
            }
        }
        if(jdg){
            ans1=i;
            break;
        }

    }

    repr(i,x-1,-1){
        bool jdg=true;
        rep(j,n){
            if(p[j]==i){
                jdg=false;
                break;
            }
        }
        if(jdg){
            ans2=i;
            break;
        }
    }

    if(abs(x-ans1)<abs(x-ans2)){
        cout<<ans1<<endl;
    }
    else cout<<ans2<<endl;

}


Measured memory_bytes: 3624
#include<algorithm>
#include<iostream>
#include<string.h>
#include<stdio.h>
using namespace std;

typedef pair <int ,int> PII;
const int MAXN=100010;
int dp[MAXN],a[MAXN];
int main()
{
	int n;
	cin>>n;
	for(int i=0; i<n; i++)
		cin>>a[i];
	
	int ans=0,num=0;
	for(int i=1; i<n; i++)
	{
		if(a[i]<=a[i-1])
			num++;
		else
			num=0;
		
		ans=max(ans,num);
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 640
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
	ios::sync_with_stdio(false);
	int n; cin >> n;
	int res = 0;
	for (int x = 1; x <= n; x++)
	{
		int y = x, cnt = 0;
		while (y != 0)
		{
			cnt++;
			y /= 10;
		}
		if (cnt % 2 != 0)
			res++;
	}
	cout << res << endl;
}

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

MOD = 10 ** 9 + 7

N, M = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
A.append(0)
B.append(0)

ans, h, w = 1, 0, 0
for i in range(N * M, 0, -1):
    if A[h] == i:
        h += 1
        if B[w] == i:
            w += 1
        else:
            ans = ans * w % MOD
    elif B[w] == i:
        w += 1
        ans = ans * h % MOD
    else:
        ans = ans * (h * w - (N * M - i)) % MOD
    if ans == 0:
        break
print(ans)


Measured memory_bytes: 3188
N,K=map(int,input().split())
A=list(map(int,input().split()))
a=0
b=10**9+1
while a+1<b:
  mid=(a+b)//2
  ans=0
  for i in A:
    ans+=(i-1)//mid
  if K<ans:
    a=mid
  else:
    b=mid
print(b)

Measured memory_bytes: 31096
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
#define pb push_back

typedef long long ll;
typedef pair<int,int> pi;
const int MAXN = (int)1e6+7;

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

    ll n;
    cin >> n;
    ll sq = sqrt(n+0.5);
    ll num = n+1;
    rep(i,1,sq) {
        if (n%i==0) {
            num = min(i-1+n/i-1,num);
        }
    }
    cout << num << endl;
}


Measured memory_bytes: 256
A, B = map(int, input().split())

l = [
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
    [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
    [0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0],
    [0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
    [0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
    [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
    [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
    [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
    [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]
]

if A == B:
    print("Draw")
elif l[A][B]:
    print("Alice")
else:
    print("Bob")

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ull = uint64_t;
const ll INF = 9e18;

ll edgeid(ll h, ll w, ll W) {
    return h * W + w;
}

struct edge {
    ll u;
    ll v;
    ll cost;
};
bool operator<=(const edge& lhs, const edge& rhs) {
    return lhs.cost <= rhs.cost;
}
bool operator<(const edge& lhs, const edge& rhs) {
    return lhs.cost < rhs.cost;
}
bool operator>=(const edge& lhs, const edge& rhs) {
    return lhs.cost >= rhs.cost;
}
bool operator>(const edge& lhs, const edge& rhs) {
    return lhs.cost > rhs.cost;
}
bool operator==(const edge& lhs, const edge& rhs) {
    return lhs.cost == rhs.cost;
}
bool operator!=(const edge& lhs, const edge& rhs) {
    return lhs.cost != rhs.cost;
}

void dijkstra(ll n, ll start, vector<vector<edge>>& edgemap, vector<ll>& min_cost) {
    vector<bool> done(n + 1);
    for (ll j = 0; j <= n; j++) {
        min_cost[j] = -1;
        done[j] = false;
    }
    priority_queue<edge, vector<edge>, greater<edge>> pq;

    pq.push(edge{u : -1, v : start, cost : 0});
    while (!pq.empty()) {
        edge e = pq.top();
        pq.pop();
        if (done[e.v]) {
            continue;
        }
        done[e.v] = true;
        min_cost[e.v] = e.cost;
        for (auto next_e : edgemap[e.v]) {
            if (!done[next_e.v]) {
                edge total_next_e = next_e;
                total_next_e.cost = min_cost[next_e.u] + next_e.cost;
                pq.push(total_next_e);
            }
        }
    }
}

int main() {
    ll H, W;
    cin >> H >> W;
    ll sh, sw, gh, gw;
    cin >> sh >> sw;
    cin >> gh >> gw;
    sh--;
    sw--;
    gh--;
    gw--;

    // 道の一覧
    vector<vector<bool>> roads(H, vector<bool>(W, false));
    for (ll h = 0; h < H; h++) {
        for (ll w = 0; w < W; w++) {
            char c;
            cin >> c;
            while (c != '.' && c != '#') {
                cin >> c;
            }
            if (c == '.') {
                roads[h][w] = true;
            }
        }
    }

    vector<vector<edge>> edgemap(H * W);
    for (ll h = 0; h < H; h++) {
        for (ll w = 0; w < W; w++) {
            for (ll y = h - 2; y <= h + 2; y++) {
                ll u = edgeid(h, w, W);
                for (ll x = w - 2; x <= w + 2; x++) {
                    if (y >= 0 && y < H && x >= 0 && x < W && roads[y][x]) {
                        ll v = edgeid(y, x, W);
                        if (y == h && x == w) {
                            continue;
                        } else if (abs(x - w) + abs(y - h) == 1) {
                            edgemap[u].push_back({u : u, v : v, cost : 0});
                        } else {
                            edgemap[u].push_back({u : u, v : v, cost : 1});
                        }
                    }
                }
            }
        }
    }
    vector<ll> min_cost(H * W);
    dijkstra(H * W, edgeid(sh, sw, W), edgemap, min_cost);
    cout << min_cost[edgeid(gh, gw, W)] << endl;
}


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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    string s; cin >> s;

    ll ans = 0;
    ll b_cnt = 0;

    for (ll i = 0; i < s.length(); ++i) {
        if (s[i] == 'W') {
            ans += b_cnt;
        } else {
            ++b_cnt;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);++i)
#define alrep(i,j,n) for(int i=0;i<(n);++i)for(int j=i+1;j<(n);++j
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
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 MOD=1e9+7;
const long long INF = 1LL << 60;
int gcd(int a,int b) { return b ? gcd(b,a%b) : a;}
int lcm(int a,int b) { return a/gcd(a,b)*b;}
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
void printb(unsigned int v) {
  unsigned int mask = (int)1 << (sizeof(v) * CHAR_BIT - 1);
  do putchar(mask & v ? '1' : '0');
  while (mask >>= 1);
}
void putb(unsigned int v) {putchar('0'), putchar('b'), printb(v), putchar('\n');}
#define ALL(W) (W).begin(),(W).end()



signed main(){
  int N;
  string S;
  cin >> N >> S;
  if(N%2==1){
    No
    return 0;
  }
  for(int i=0;i<N/2;i++){
    if(S[i]==S[i+N/2]);
    else{
      No
      return 0;
    }
  }
  Yes
  return 0;
}


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

int main() {

	int a,b,c,d,e,k;
	int L1,L2,L3,L4,L5,L6,L7,L8,L9,L10;

	cin >> a;
	cin >> b;
	cin >> c;
	cin >> d;
	cin >> e;
	cin >> k;

	L1 = b - a;
	L2 = c - a;
	L3 = d - a;
	L4 = e - a;
	L5 = b - c;
	L6 = b - d;
	L7 = b - e;
	L8 = c - d;
	L9 = c - e;
	L10 = d - e;

	if( k < std::abs(L1) || k < std::abs(L2) || k < std::abs(L3) || k < std::abs(L4) || k < std::abs(L5) || k < std::abs(L6) || k < std::abs(L7) || k < std::abs(L8) || k < std::abs(L9) || k < std::abs(L10) ){
		cout << ":(" << endl;
	}else{
		cout << "Yay!" << endl;
	}
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<algorithm>
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 chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 130000;
char cn[CM + 10], * ci = cn + 10, * owa = cn + CM;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	char c = ci[8];
	ci[8] = 0;
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci[8] = c;
	ci += (64 - dig >> 3) + 1;

	if (ci - owa > 0) {
		memcpy(cn, owa, 10);
		ci -= CM;
		fread(cn + 10, 1, CM, stdin);
	}
	return tmp;
}

char* di = cn;
const int MAX = 200000;
class shuturyoku_unko {
public:
	char C[MAX * 6 - 100000];
	int K[MAX + 10];
	constexpr shuturyoku_unko() : C(), K() {
		auto di = C + 1;
		C[0] = '0';
		K[1] = 1;
		rep1(i, MAX) {
			int X = i;
			int keta = 0;
			char c[10] = {};
			while (X) {
				*(c + keta) = '0' + X % 10;
				X /= 10;
				keta++;
			}
			for (int j = keta - 1; j >= 0; j--)* di++ = (*(c + j));
			K[i + 1] = K[i] + keta;
		}
	}
} f;
inline void putint(ll X) {
	int ue = X / 100000;
	if (ue) {
		memcpy(di, f.C + f.K[ue], f.K[ue + 1] - f.K[ue]);
		di += f.K[ue + 1] - f.K[ue];
		int sita = X - ue * 100000ll;
		rep(i, 5 - f.K[sita + 1] + f.K[sita])* di++ = '0';
		memcpy(di, f.C + f.K[sita], f.K[sita + 1] - f.K[sita]);
		di += f.K[sita + 1] - f.K[sita];
	}
	else {
		memcpy(di, f.C + f.K[X], f.K[X + 1] - f.K[X]);
		di += f.K[X + 1] - f.K[X];
	}
	*di++ = '\n';
}

int B[200001];

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


	fread(ci, 1, CM, stdin);

	int N = getint();
	ll kotae = 1;
	int A[200000];
	rep(i, N) kotae += B[(A[i] = getint())]++;
	int *a = A;
	
	int amari = N % 10800;
	int shou = N / 10800;
	rep(j, shou) {
		rep(k, 10800) putint(kotae - B[*a++]);
		fwrite(cn, 1, di - cn, stdout);
		di = cn;
	}
	rep(k, amari) putint(kotae - B[*a++]);
	fwrite(cn, 1, di - cn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 3712
#####segfunc#####
def segfunc(x, y):
    return x + y
#################

#####ide_ele#####
ide_ele = 0
#################

class SegTree:
    """
    init(init_val, ide_ele): 配列init_valで初期化 O(N)
    update(k, x): k番目の値をxに更新 O(N)
    query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)
    """
    def __init__(self, init_val, segfunc, ide_ele):
        """
        init_val: 配列の初期値
        segfunc: 区間にしたい操作
        ide_ele: 単位元
        n: 要素数
        num: n以上の最小の2のべき乗
        tree: セグメント木(1-index)
        """
        n = len(init_val)
        self.segfunc = segfunc
        self.ide_ele = ide_ele
        self.num = 1 << (n - 1).bit_length()
        self.tree = [ide_ele] * 2 * self.num
        # 配列の値を葉にセット
        for i in range(n):
            self.tree[self.num + i] = init_val[i]
        # 構築していく
        for i in range(self.num - 1, 0, -1):
            self.tree[i] = segfunc(self.tree[2 * i], self.tree[2 * i + 1])

    def update(self, k, x):
        """
        k番目の値をxに更新
        k: index(0-index)
        x: update value
        """
        k += self.num
        self.tree[k] = x
        while k > 1:
            self.tree[k >> 1] = segfunc(self.tree[k], self.tree[k ^ 1])
            k >>= 1

    def query(self, l, r):
        """
        [l, r)のsegfuncしたものを得る
        l: index(0-index)
        r: index(0-index)
        """
        res = self.ide_ele

        l += self.num
        r += self.num
        while l < r:
            if l & 1:
                res = segfunc(res, self.tree[l])
                l += 1
            if r & 1:
                res = segfunc(res, self.tree[r - 1])
            l >>= 1
            r >>= 1
        return res

n, q = [int(x) for x in input().split()]
seg = SegTree([0]*n, segfunc, ide_ele)
for _ in range(q):
    com, x, y = [int(x) for x in input().split()]
    if com:
        print(seg.query(x - 1, y))
    else:
        x -= 1
        y += seg.tree[seg.num + x]
        seg.update(x, y)


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

using namespace std;

signed main() {
	string week[7] = { "SUN","MON","TUE","WED","THU","FRI","SAT" };
	string s; cin >> s;
	for (int i = 0; i < 7; ++i)
		if (s == week[i])
			cout << (7 - i) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = (ll)(1e+9) + 7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
vector<int> G[1 << 17];
int d[1 << 17];
bool used[1 << 17];
int main() {
	int n, k; cin >> n;
	rep(i, n - 1) {
		int a, b; cin >> a >> b; a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	priority_queue<P> q;
	cin >> k;
	rep(i, k) {
		int v, p; cin >> v >> p; v--;
		used[v] = true; q.push({ p,v });
		d[v] = p;
	}
	bool valid = true;
	while (!q.empty()) {
		P x = q.top(); q.pop();
		int fr = x.second;
		rep(j, G[fr].size()) {
			int to = G[fr][j];
			if (!used[to]) {
				used[to] = true;
				d[to] = d[fr] - 1;
				q.push({ d[to],to });
			}
			else {
				if (abs(d[to] - d[fr]) != 1)valid = false;
			}
		}
	}
	if (!valid)cout << "No" << endl;
	else {
		cout << "Yes" << endl;
		rep(i, n) {
			cout << d[i] << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 8692
#include <stdio.h>

int main() {
	int N, K;
	int result;
	int i;

	scanf("%d", &N);
	scanf("%d", &K);

	result = 1;
	for (i=0; i<N; i++) {
		if (result + K > result * 2) {
			result = result * 2;
		} else {
			result = result + K;
		}
	}

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


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a % b);
}

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long 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 {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint operator^(const ll& t)const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return 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 {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

///////////////////////////

int main() {
	
	ll H, W, d;
	cin >> H >> W >> d;

	vector<vector<ll>> a(H, vector<ll>(W));

	if (d % 2 == 1) {
		rep(i, H)rep(j, W) {
			if ((i + j) % 2 == 0) { a[i][j] = 0; }
			else { a[i][j] = 1; }
		}
	}

	else {
		rep(i, H)rep(j, W) {
			ll t = i;
			if ((i + j) % 2 == 1) { t++; }

			ll x = (t + j) / 2;
			ll y = (t - j) / 2;
			a[i][j] = 0;
			if (x % d < d / 2) { a[i][j] += 1; }
			if ((y%d+d)%d < d / 2) { a[i][j] += 2; }
		}
	}

	rep(i, H){
		rep(j, W) {
			if (a[i][j] == 0) { cout << 'R'; }
			if (a[i][j] == 1) { cout << 'Y'; }
			if (a[i][j] == 2) { cout << 'G'; }
			if (a[i][j] == 3) { cout << 'B'; }

		}
		cout << endl;
	}

	system("PAUSE");
}


Measured memory_bytes: 2680
#include<bits/stdc++.h>
#define int long long
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define hell 1000000007
#define rep(i,a,b) for(int i=a;i<b;i++)
using namespace std;
bool prime[200005];
void sieve(){
    memset(prime, true, sizeof(prime)); 
    for (int p=2; p*p<200005; p++) 
    {
        if (prime[p] == true) 
        {
            for (int i=p*p; i<200005; i += p) 
                prime[i] = false; 
        } 
    }
}
int powmod(int x,int y,int mod){
    int res = 1;
    x = x%mod;
    while(y>0){
        if(y&1){
            res = (res*x)%mod;
        }
        y = y>>1;
        x = (x*x)%mod;
    }
    return res;
}
int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
}
vector<vector<int> >v;
int t;
int in[200005],out[200005],vis[200005];
int a[1000005];
void dfs(int src){
    vis[src] = 1;
    in[src] = t++;
    for(auto i : v[src]){
        if(!vis[i]){
            dfs(i);
        }
    }
    out[src] = t++;
}
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,m;
    cin>>n>>m;
    v.resize(n+1);
    int x,y;
    rep(i,0,n-1){
        cin>>x>>y;
        v[x].pb(y);
        v[y].pb(x);
    }
    memset(in,0,sizeof(in));
    memset(out,0,sizeof(out));
    memset(vis,0,sizeof(vis));
    memset(a,0,sizeof(a));
    t = 0;
    dfs(1);
    rep(i,0,m){
        cin>>x>>y;
        a[in[x]]+=y;
        a[out[x]+1]-=y;
    }
    rep(i,1,1000005){
        a[i] = a[i-1]+a[i];
    }
    rep(i,1,n+1){
        cout<<a[in[i]]<<" ";
    }
	return 0;
}

Measured memory_bytes: 32128
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;

void Main(){
  ll N,C;
  cin>>N>>C;

  ll x[N+2]={};
  ll v[N+2]={};
  x[N+1]=C;
  reps(i,1,N+1){
    cin>>x[i]>>v[i];
  }

  ll maxl[N+2]={};
  ll maxr[N+2]={};

  ll lsumm[N+2]={};
  ll rsumm[N+2]={};

  ll lsum=0; ll rsum=0;

  rep(i,N){
    lsum+=v[i+1]-x[i+1]+x[i];
    lsumm[i+1]=lsum;
    maxl[i+1]=max(maxl[i],lsum);

    rsum+=v[N-i]-(C-x[N-i])+(C-x[N-i+1]);
    rsumm[N-i]=rsum;
    maxr[N-i]=max(maxr[N-i+1],rsum);
  }

  ll ans=0;

  rep(i,N+1){
    ll temp=lsumm[i]-x[i]+maxr[i+1];
    maxi(ans,temp);
  }
  repr(i,N+1,1){
    ll temp=rsumm[i]-(C-x[i])+maxl[i-1];
    maxi(ans,temp);
  }

  cout<< ans <<"\n";

}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int n;
string s;
void ch(string t){
	for(int i=1;i<n-1;i++){
		char cl=(s[(i-1)%n]);
		char cr=(s[(i+1)%n]);
		if(s[i]=='o'){
			if(t[i]=='S'){
				t+=t[i-1];
			}
			else{
				if(t[i-1]=='S')t+='W';
				else t+='S';
			}
		}
		else{
			if(t[i]=='W'){
				t+=t[i-1];
			}
			else{
				if(t[i-1]=='S')t+='W';
				else t+='S';
			}
		}
	}
	r(i,n){
	if(t[i]=='S'){
		if(s[i]=='o'){
			if(t[(i+1)%n]!=t[(i-1+n)%n])return;
		}
		else{
			if(t[(i+1)%n]==t[(i-1+n)%n])return;
		}
	}
	else{
		if(s[i]=='x'){
			if(t[(i+1)%n]!=t[(i-1+n)%n])return;
		}
		else{
			if(t[(i+1)%n]==t[(i-1+n)%n])return;
		}
	}}
	cout<<t<<endl;
	exit(0);
}
int main(){
	cin>>n>>s;
	ch("SS");
	ch("SW");
	ch("WS");
	ch("WW");
	cout<<-1<<endl;
}


Measured memory_bytes: 640
#include<stdio.h>

int pallindrome(int n)
{
    int original = n;
    int reverse = 0;
    for(int i = n; i>0; i/=10)
    {
        reverse = reverse*10 + i%10;
    }

    if(reverse == original)
        return 1;
    else
        return 0;
}

int main()
{
    int a, b, count = 0;
    scanf("%d %d", &a, &b);
    for(int i= a; i<=b; i++)
        {
            if(pallindrome(i))
                count++;
        }
    printf("%d", count);
    return 0;
}

Measured memory_bytes: 1708
import           Control.Monad
import qualified Data.Vector.Unboxed           as V

main = do
    n  <- readLn
    as <- V.map pred . V.fromList <$> replicateM n readLn
    print $ solve as 0 0 n

solve as 1 i _ = i
solve as k i n
    | i==n = -1
    | otherwise = solve as (as V.! k) (succ i) n

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

int main() {
  int a,b,c,x;
  cin >> a >> b >> c >> x;
  
  int ans = 0;
  for(int i=0; i<a+1; i++){
    for(int j=0; j<b+1; j++){
      for(int k=0; k<c+1; k++){
        
        int sum;
        sum = i*500+j*100+k*50;
        
        if(sum==x){
          ans++;
        }

      }
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>; // グラフ型
typedef long long ll;
#define _GLIBCXX_DEBUG




int main() {
  ll N, A, B;
  cin >> N >> A >> B;
  

  ll tmp1, tmp2, ans;

  tmp1 = N / (A+B);
  tmp2 = N % (A+B);


  if(tmp2 < A ){
    ans = tmp1 * A + tmp2;
  }else{
    ans = tmp1 * A + A;
    
  }

  cout << ans <<endl;


  return 0;
}


Measured memory_bytes: 3596
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO.Pipes;
using System.Linq;
using System.Reflection.PortableExecutable;
using System.Runtime.InteropServices.ComTypes;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Security.Cryptography.X509Certificates;

namespace cswork
{
    class Program
    {
        class Scanner
        {
            string[] s;
            int i;

            char[] cs = new char[] { ' ' };

            public Scanner()
            {
                s = new string[0];
                i = 0;
            }

            public string next()
            {
                if (i < s.Length) return s[i++];
                string st = Console.ReadLine();
                while (st == "") st = Console.ReadLine();

                s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
                i = 0;
                return next();
            }

            public int nextInt()
            {
                return int.Parse(next());
            }

            public long nextLong()
            {
                return long.Parse(next());
            }

            public double nextDouble()
            {
                return double.Parse(next());
            }
        }

        public Program() { }

        static void Main(string[] args)
        {
            new Program().Omame();
        }

        Scanner cin;
        const int MAXIN = 1024;
        bool[] used = new bool[MAXIN];
        int[] perm = new int[MAXIN];

        List<int[]> permList = new List<int[]>();

        public void Permutation(int pos, int n, int length)
        {
            if (pos == n)
            {
                permList.Add((int[])perm.Clone());
            }

            for (int i = 0; i < n; i++)
            {
                if (!used[i])
                {
                    perm[pos] = i;
                    used[i] = true;
                    Permutation(pos + 1, n, length);
                    used[i] = false;
                }
            }
        }

        void Omame()
        {
            cin = new Scanner();
            int N = cin.nextInt();
            int M = cin.nextInt();
            long sum = 0;
            for (int i = 0; i < M; i++)
            {
                sum += cin.nextInt();
            }

            if(sum <= N)
            {
                Console.WriteLine(N - sum);
            }
            else
            {
                Console.WriteLine(-1);
            }
        }

    }
}


Measured memory_bytes: 28584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;


int main()
{	
	int n,t[105],u[105],ans=0;
	cin>>n;
	for(int i=1;i<=n-1;i++)
	{
		cin>>t[i];
	}
	t[0]=t[1];
	t[n]=t[n-1];
	for(int i=n;i>=1;i--)
	{
		u[i]=min(t[i],t[i-1]);
	}
	for(int i=1;i<=n;i++)
	{
		ans+=u[i];
	}
	cout<<ans<<endl;
}

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

int main() {
  int n;
  cin >> n;
  int sum = 0;

  for(int i = 0; i < n; i++){
      int a, b;
      cin >> a >> b;
      sum += b - a + 1;
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
N = int(input())
n = 0
if 81 < N:
    n = "No"
elif N <= 9:
    n = "Yes"
else:
    for a in range(2, 10):
        for b in range(2, 10):
            if a * b == N:
                n = "Yes"
                break
    if n is 0:
        n = "No"
print(n)

Measured memory_bytes: 2940
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;

int main()
{
	int n;
	double X, Y, R;
	double x[3];
	double y[3];

	cin >> n;

	while (n--)
	{
		for (int i = 0; i < 3; i++)
		{
			cin >> x[i] >> y[i];
		}

		double a = 2 * (x[1] - x[0]);
		double b = 2 * (y[1] - y[0]);
		double c = pow(x[0], 2) - pow(x[1], 2) + pow(y[0], 2) - pow(y[1], 2);
		double d = 2 * (x[2] - x[0]);
		double e = 2 * (y[2] - y[0]);
		double f = pow(x[0], 2) - pow(x[2], 2) + pow(y[0], 2) - pow(y[2], 2);

		X = (b*f - e*c) / (a*e - d*b);
		Y = (c*d - f*a) / (a*e - d*b);
		R = sqrt(pow(X - x[0], 2) + pow(Y - y[0], 2));

		printf("%.3lf %.3lf %.3lf\n", X, Y, R);
	}

	return 0;
}

Measured memory_bytes: 1244
#include <iostream>
using namespace std;
const int maN = 2e5+5;
int parent[maN];
int sz[maN];
void make_set(int v)
{
    parent[v] = v;
}
int find_set(int v)
{
    if(v == parent[v])
        return v;
    return parent[v] = find_set(parent[v]);
}

void union_sets(int a, int b)
{
    int u = find_set(a);
    int v = find_set(b);
    if(u!=v)
    {
        if(sz[u] < sz[v])
        {
            // swap(u, v);
            parent[u] = v;
            sz[v] += sz[u];
        }
        else
        {
            parent[v] = u;
            sz[u] += sz[v];
        }
    }
}

int main() {
    int n, m;
    cin >> n >> m;
    
    for(int i = 0; i <= n; ++i)
    {
        parent[i] = i;
        sz[i] = 1;
    }
    for(int i = 0; i < m; ++i)
    {
        int a, b;
        cin >> a >> b;
        --a, --b;
        union_sets(a, b);
    }
    int max_set = 1;
    for(int i = 0; i < n; ++i)
    {
        // cout << sz[i] << " ";
        if(max_set < sz[i])
            max_set = sz[i]; 
    }
    
    cout << max_set;

	return 0;
}


Measured memory_bytes: 5172
#include <stdio.h>

int main(void)
{
	int L,A,B,C,D,E,F,K;
	scanf("%d",&L);
	scanf("%d",&A);
	scanf("%d",&B);
	scanf("%d",&C);
	scanf("%d",&D);
	if(A%C==0){E=A/C;}
	else{E=1+A/C;}
	if(B%D==0){F=B/D;}
	else{F=1+B/D;}
	if(E<F){K=L-F;}
	else{K=L-E;}
	printf("%d\n",K);
	return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define ll long long
int main(){
    ll int h,n;
    cin>>h>>n;
    vector<ll int> a(n);
    for(auto &i:a){
        cin>>i;
    }
    ll int sum=0;
    for(auto &i:a){
        sum+=i;
        if(sum>=h){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include<bitset>
#include <utility>
using namespace std;
#define rank rankk
#define mp make_pair
#define pb push_back
#define xo(a,b) ((b)&1?(a):0)
//#define LL ll
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef long long ll;
typedef pair<ll,int> pli;
const int INF=0x3f3f3f3f;
const ll INFF=0x3f3f3f3f3f3f3f3fll;
//const ll M=1e9+7;
//const ll maxn=2e5+7;
//const int MAXN=1005;
const int MAX=2e5+5;
const int MAX_N=MAX;
//const int N=55;
const ll MOD=1000000007;
//const double eps=0.00000001;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
template<typename T>inline T abs(T a) {return a>0?a:-a;}
template<class T> inline
void read(T& num) {
    bool start=false,neg=false;
    char c;
    num=0;
    while((c=getchar())!=EOF) {
        if(c=='-') start=neg=true;
        else if(c>='0' && c<='9') {
            start=true;
            num=num*10+c-'0';
        } else if(start) break;
    }
    if(neg) num=-num;
}
inline ll powMM(ll a,ll b,ll M){
    ll ret=1;
    a%=M;
//    b%=M;
    while (b){
        if (b&1) ret=ret*a%M;
        b>>=1;
        a=a*a%M;
    }
    return ret;
}
void open()
{
    freopen("1009.in","r",stdin);
    freopen("out.txt","w",stdout);
}
char a[MAX];
map<char,ll>re;
ll an;
int main()
{
    scanf("%s",a);int len=strlen(a);
    for(int i=0;i<len;i++)
        ++re[a[i]];
    an=len*(len-1LL)/2LL;
    for(int i=0;i<26;i++)
    {
        ll num=re[i+'a'];
        if(num>=2)
            an-=num*(num-1)/2LL;
    }
    printf("%lld\n",an+1);
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

vector<ll> construct_suffix_array(const string &S) {
  ll n = S.length(), k = 1;
  vector<ll> sa(n + 1), rnk(n + 1), tmp(n + 1);

  auto compare_sa = [&](const ll& i, const ll& j) {
    if(rnk[i] != rnk[j]) return rnk[i] < rnk[j];
    ll ri = i + k <= n ? rnk[i + k] : -1;
    ll rj = j + k <= n ? rnk[j + k] : -1;
    return ri < rj;
  };

  REP(i, 0, n + 1) sa[i] = i;
  REP(i, 0, n + 1) rnk[i] = i < n ? S[i] : -1;

  for(; k <= n; k *= 2) {
    sort(sa.begin(), sa.end(), compare_sa);
    tmp[sa[0]] = 0;
    REP(i, 1, n + 1) tmp[sa[i]] = tmp[sa[i - 1]] + (compare_sa(sa[i - 1], sa[i]) ? 1 : 0);
    REP(i, 0, n + 1) rnk[i] = tmp[i];
  }

  return sa;
}

int main(void) {
  ll N, H;
  string S;
  cin >> N >> H >> S;

  vector<ll> a(N, 0);
  REP(i, 0, N - 1) if(S[i] == '0') a[i + 1] += a[i] + 1;

  vector<ll> imos(N + 2, 0);
  REP(i, 0, N) {
    if(S[i] != '0') {
      imos[1] += a[i] + 1;
      imos[N - i + 1] -= a[i] + 1;
    } else {
      imos[1] += a[i] + 1;
      imos[2] -= a[i] + 1;
    }
  }
  REP(i, 0, N + 1) imos[i + 1] += imos[i];

  ll x = 1, cnt = 1;
  while(1) {
    if(cnt <= H && H < cnt + imos[x]) break;
    cnt += imos[x];
    x++;
  }

  vector<ll> sa = construct_suffix_array(S);
  REP(i, 1, N + 1) {
    ll j = sa[i];
    if((x == 1 || S[j] != '0') && j + x <= N) {
      if(cnt <= H && H < cnt + a[j] + 1) {
        cout << S.substr(j, x) << endl;
        break;
      }
      cnt += a[j] + 1;
    }
  }
}



Measured memory_bytes: 6880
#include<iostream>
#include<bits/stdc++.h>
#include<algorithm>
#include<string>

using namespace std;

int main()
{
    long long int sum=0,count=0;
    int i;
    string s;
    cin >> s;
    for(i=s.size(); i>0; i--)
    {
        if(s[i-1]=='W')
            count++;
        if(s[i-1]=='B')
            sum+=count;
    }
    cout << sum;
    return 0;

}


Measured memory_bytes: 3752
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename A,typename B>istream&operator>>(istream&is,pair<A,B> &p){is>>p.fi>>p.se;return is;}
template<typename A,typename B>ostream&operator<<(ostream&os,const pair<A,B> &p){os<<"("<<p.fi<<","<<p.se<<")";return os;}
template<typename T>istream&operator>>(istream&is,vector<T> &t){REP(i,t.size())is>>t[i];return is;}
template<typename T>ostream&operator<<(ostream&os,const vector<T>&t){os<<"{";REP(i,t.size()){if(i)os<<",";os<<t[i];}cout<<"}";return os;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    int n;
    cin>>n;
    struct edge{
        int to,cost;
    };
    vector<vector<edge>> G(n);
    REP(i,n-1){
        int a,b,c;
        cin>>a>>b>>c;
        a--;b--;
        G[a].pb({b,c});
        G[b].pb({a,c});
    }
    queue<int> que;
    que.push(0);
    vl d(n,-1);
    d[0]=0;
    while(que.size()){
        int t=que.front();que.pop();
        REP(i,G[t].size()){
            int u=G[t][i].to;
            if(d[u]==-1){
                que.push(u);
                d[u]=d[t]+G[t][i].cost;
            }
        }
    }
    REP(i,n){
        cout<<d[i]%2<<endl;
    }
    return 0;
}

Measured memory_bytes: 7168
from collections import deque
import bisect
import sys

input = sys.stdin.readline
N = int(input())
A = [int(input()) for _ in range(N)]
A = A[::-1]

col = [A.pop()]
col = deque(col)

while A:
    a = A.pop()
    if a <= col[0]:
        col.appendleft(a)
    else:
        x = bisect.bisect_left(col, a)
        col[x - 1] = a

ans = len(col)
print(ans)


Measured memory_bytes: 8196
package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scan(&n)
	var sum int
	for i := 1; i <= n; i++ {
		if i%3 == 0 || i%5 == 0 {
			//FizzBuzz
			continue
		}
		sum += i
	}
	fmt.Println(sum)
}

//-------------------------------------------
// util tools

// abs 絶対値を返す
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// sliceInt []intをスライスする
func sliceInt(k int) []int {
	s := make([]int, getDigit(k))
	count := 0
	for k > 0 {
		i := k % 10
		s[len(s)-1-count] = i
		count++
		k = k / 10
	}
	return s
}

// sliceIntSum []intの合計を出す
func sliceIntSum(v []int) int {
	sum := 0
	for _, x := range v {
		sum += x
	}
	return sum
}

// reverse []intを反転
func reverse(s []int) []int {
	for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
		s[i], s[j] = s[j], s[i]
	}
	return s
}

// getDigit intの桁数を取得
func getDigit(num int) int {
	digit := 0
	for num != 0 {
		num /= 10
		digit++
	}
	return digit
}

// getSumDigit intの各位の和を返す
func getSumDigit(num int) int {
	sum := 0
	for num != 0 {
		t := num % 10
		num /= 10
		sum += t
	}
	return sum
}

// lastPrime 素数 エラトステネスの篩
func lastPrime(max int64) int64 {
	if max <= 1 {
		return 2
	}
	primes := make([]int64, 1, max)
	primesF := make([]float64, 1, max)
	primes[0] = 2
	primesF[0] = 2.0

	count := int64(1)
	for n := int64(3); ; n += 2 {
		flag := true
		f := float64(n)
		rf := math.Sqrt(f)
		for i := 1; i < len(primes); i++ {
			if primesF[i] > rf {
				break
			} else if (n % primes[i]) == 0 {
				flag = false
				break
			}
		}
		if flag {
			count++
			if count >= max {
				return n
			}
			primes = append(primes, n)
			primesF = append(primesF, f)
		}
	}
}


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

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

    if(K<10){
        cout<<K<<endl;
        return 0;
    }

    queue<ll> q;
    rep(i, 9){
        q.push(i+1);
    }
    ll num;
    rep(i, K){
        num=q.front();
        q.pop();
        if(num%10 != 0) q.push(10*num+num%10-1);
        q.push(10*num+num%10);
        if(num%10 != 9) q.push(10*num+num%10+1);
    }

    ll ans=num;
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 5136
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>

using namespace std;

int main() {
	char X, Y;
	cin >> X >> Y;
	if (X < Y) cout << "<" << endl;
	else if (X == Y) cout << "=" << endl;
	else cout << ">" << endl;
	return 0;
}

Measured memory_bytes: 3596
function main()
    n = parse(Int, readline())
    i = 0
    while true
        val = 4*i
        if val > n
            break
        end
        while val <= n
            if val == n
                println("Yes")
                return
            end
            val += 7
        end
        i += 1
    end
    println("No")
end

main()


Measured memory_bytes: 118460
using System;
using System.Collections.Generic;
using System.Linq;

public class Program {
    static Dictionary<int, List<int>> nodes;

    public static void Main() {
        Console.ReadLine();
        var tArr = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
        var m = int.Parse(Console.ReadLine());
        
        for(int i = 0; i< m; i++) {
            var drink = Console.ReadLine().Split(' ').Select(v => int.Parse(v)).ToArray();
            var score = tArr.Take(drink[0] - 1).Sum() + tArr.Skip(drink[0]).Sum() + drink[1];
            Console.WriteLine(score);
        }   
    }
}

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

int main() {
  int combi[100000][3] = {0},m=0;
  int input,price[100000] = {0},weight;
  int a,b,c,a1,b1,c1;

  while(cin >> input) {
    if(input == 0) break;
    for(int i=0;i<26;i++) {//generate combination of weight over input
      for(int j=0;j<17;j++) {
        for(int k=0;k<11;k++) {
          weight = 200*i + 300*j + 500*k;
          //cout << weight << " ";
          if(input == weight) {
            combi[m][0] = i;
            combi[m][1] = j;
            combi[m][2] = k;
            //cout << combi[m][0] << " " <<  combi[m][1] << " " << combi[m][2] << endl;
            m++;
          }
        }
      }
    }




    for(int i=0;i<m;i++) {//calculate price[i] from combi[i]
      a = combi[i][0] / 5;//sale
      a1 = combi[i][0] - a*5;//not sale
      b = combi[i][1] / 4;//sale
      b1 = combi[i][1] - b*4;//not sale
      c = combi[i][2] / 3;//sale
      c1 = combi[i][2] - c*3;//not sale
      price[i] = 1520 * a + 380 * a1 + 1870 * b + 550 * b1 + 2244 * c + 850 * c1;
      //      cout << price[i] << endl;
    }

    sort(price,price+m);

    cout << price[0] << endl;
    m=0;
    int price[100000] = {0};
  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

// http://noshi91.hatenablog.com/entry/2019/03/31/174006
template <std::uint_fast64_t Modulus> class modint {
  using u64 = std::uint_fast64_t;

public:
  u64 a;

  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs; }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};

ll modpow(ll a, ll n, ll p) {
  ll res = 1;
  while (n) {
    if (n&1) res = res * a % p;
    a = a * a % p;
    n >>= 1;
  }
  return res;
}

constexpr ll MOD = 1e9+7;

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

  ll n;
  cin >> n;
  vl a(n);
  rep(i, n) {
    cin >> a[i];
  }

  modint<MOD> ans = 0;

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

  rep(i, 60) {
    ll cnt = 0;
    rep(j, n) {
      if (a[j] & 1LL<<i) cnt++;
    }
    ans -= modpow(2, i+1, MOD)*(cnt*(cnt-1)/2);
  }

  cout << ans.a << endl;
}


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

int main(){
    vector<int> takasa(10);
    for(int i = 0; i < 10 ; ++i){
        cin >> takasa.at(i);
    }
    std::sort(takasa.begin(),takasa.end());
    std::sort(takasa.begin(),takasa.end(),std::greater<int>());
    for(int i=0;i<3;++i){
        cout<<takasa.at(i)<<endl;
    }
}


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

int main() {
    int K; cin >> K;
    string s; cin >> s;
    if(s.size()<=K){
        cout << s << endl;
    }
    else{
        for (int i = 0; i < K; i++)
        {
            cout << s[i];
        }
        cout << "..." << endl;
    }
}

Measured memory_bytes: 3628
using System;

class quiz
{
    long[] fac;
    long[] inv;
    long[] facinv;

    public long solve(int H, int W, int A, int B)
    {
        long ans = 0;
        fac = new long[H - 1 + W - 1 + 1];
        inv = new long[H - 1 + W - 1 + 1];
        facinv = new long[H - 1 + W - 1 + 1];
        
        fac[0] = 1;
        fac[1] = 1;
        inv[0] = 1;
        inv[1] = 1;
        facinv[0] = 1;
        facinv[1] = 1;

        for (int i = 2; i < fac.Length; i++)
        {
            fac[i] = (fac[i - 1] * i) % 1000000007;
            inv[i] = inv[i - 1000000007 % i] * (1000000007 + i - 1000000007 % i) / i % 1000000007;
            facinv[i] = facinv[i - 1] * inv[i] % 1000000007;
        }

        for (int i = 0; i < H - A; i++)
        {
            ans += (fac[B - 1 + i] * ((facinv[B - 1] * facinv[i]) % 1000000007))% 1000000007 * ((fac[W - B - 1 + H - i - 1] * ((facinv[W - B - 1] * facinv[H - i - 1]) % 1000000007)) % 1000000007)% 1000000007;
        }

        return (long)ans % 1000000007;
    }

    public int[] ParseIntBySpace(string str)
    {
        int[] array = new int[str.Length];
        int lastloc = 0, spaceloc = -1;

        for (int i = 0; i < str.Length; i++)
        {
            if (str[i] == ' ')
            {
                array[lastloc++] = int.Parse(str.Substring(spaceloc + 1, i - spaceloc - 1));
                spaceloc = i;
            }
            else if (i == str.Length - 1)
            {
                array[lastloc++] = int.Parse(str.Substring(spaceloc + 1, i - spaceloc));
            }
        }

        Array.Resize(ref array, lastloc);

        return array;
    }
}

class Example
{
    static void Main()
    {
        quiz ex = new quiz();

        int[] HWAB = ex.ParseIntBySpace(Console.ReadLine());

        Console.WriteLine(ex.solve(HWAB[0], HWAB[1], HWAB[2], HWAB[3]));
    }
}

Measured memory_bytes: 17632
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;

    if (r <= x && x <= W - r && r <= y && y <= H - r) {
        cout << "Yes" << endl;
    }

    else {
        cout << "No" << endl;
    }

    
}


Measured memory_bytes: 3096
while True:
    m,f,r = map(int,input().split())
    if m == -1 and f == -1 and r == -1:
        break
    elif m == -1 or f == -1:
        print("F")
    elif m + f >= 80:
        print("A")
    elif m + f < 80 and m + f >= 65:
        print("B")
    elif m + f < 65 and m + f >= 50:
        print("C")
    elif m + f < 50 and m + f >= 30:
        if r >= 50:
            print("C")
        else:
            print("D")
    elif m + f < 30:
        print("F")



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

using namespace std;

int n;

inline int dfs(int x) {
	int cnt = 0;
	for(int i = 1; i*i <= x; i += 2)
		if(x%i == 0) {
			if(i*i == x) cnt++;
			else cnt += 2;
		}
	return cnt;
}

int main() {
	scanf("%d", &n);
	int ans = 0;
	for(int i = 1; i <= n; i += 2)
		if(dfs(i) == 8) ans++;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256