akhauriyash/Code-Regression huggingface dataset:
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := intScanner()
	ans := make([]int, 0)
	for {
		x := n % 26
		if x == 0 {
			x = 26
		}
		n = (n - x) / 26
		ans = append(ans, x-1)
		if n == 0 {
			break
		}
	}
	for i := len(ans) - 1; i >= 0; i-- {
		fmt.Print(string(rune(ans[i] + 97)))
	}
	fmt.Println("")
}


Measured memory_bytes: 1776
#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>;

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

const long long INF = 1LL << 60;


int main(void){
	int n;cin >> n;
	int k;cin >> k;
	vector<int> s(210000,0);
	vector<int> b;
	for(int i=0;i<n;i++){
		int a;
		cin >> a;
		s[a]++;
	}
	for(int i=0;i<200010;i++){
		if(s[i]==0) continue;
		b.push_back(s[i]);
	}
	sort(b.begin(),b.end());
	if(b.size()<=k){cout << 0 << endl;return 0;}
	int ans=0;
	for(int i=0;i<b.size()-k;i++){
		ans += b[i];
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 2168
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    string s;
    cin >> s;
    int n = s.size();
    ll bc_cnt = 0;
    ll a_cnt = 0;
    ll ans = 0;
    bool flg = false;
    rep(i, n) {
        if (s[i] == 'A') ++a_cnt;
        else if (s[i] == 'B') {
            if (i+1 < n && s[i+1] == 'C') {
                ans += a_cnt;
                ++i;
            }
            else {
                a_cnt = 0;
            }
        }
        else {
            a_cnt = 0;
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

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

#define fi first
#define se second
#define mp make_pair

const int MOD = (int)1e9 + 7;

int pow(int x, int k){
  if(k==0) return 1;
  int p = pow(x,k/2);
  p = (p * 1ll * p) % MOD;
  if(k % 2) p = (p * 1ll * x) % MOD;
  return p;
}

pii solve(vector<int> hh){
  int low = (int)1e9;
  for(auto x : hh)
    low = min(low, x);
  vector<int> cur;
  vector<pii> sols;
  int emp = 0;
  for(int i = 0 ; i < hh.size(); i ++ ){
    hh[i] -= low;
    emp += (hh[i] == 0);
    if(hh[i] != 0) cur.push_back(hh[i]);
    if(hh[i] == 0 || i + 1 == hh.size()){
      if(!cur.empty()) sols.push_back(solve(cur));
      cur.clear();
    }
  }
  ll a1 = 1;
  for(auto x : sols)
    a1 = (a1 * 1ll * x.fi) % MOD;
  a1 = (a1 * 1ll * pow(2,low)) % MOD;
  ll a2 = pow(2,emp);
  ll a3 = (pow(2,low) - 2);
  for(auto x : sols){
    a2 = (a2 * 1ll * (x.fi + x.se)) % MOD;
    a3 = (a3 * 1ll * x.fi) % MOD;
  }
  return mp(a1, (a2+a3)%MOD);
}

int main(){
  int n;
  cin >> n;
  vector<int> sol;
  int a;
  for(int i = 1; i <= n; i ++ ){
    cin >> a;
    sol.push_back(a);
  }
  pii res = solve(sol);
  cout << res.se << "\n";
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;

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;}

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
int main( ){
    int n,k;
    cin>>n>>k;
    int x[n];
    rep(i,n)cin>>x[i];
    ll res=INF;
    rep(i,n-k+1)chmin(res,(ll)abs(x[i])+abs(x[i+k-1]-x[i]));
    for(int i=n-1;i-k+1>=0;i--)chmin(res,(ll)abs(x[i])+abs(x[i]-x[i-k+1]));
    cout<<res<<endl;
}




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

typedef long long ll;

using namespace std;

int main() {
	int n;
	cin >> n;
	ll sum = 0;
	for (int i = 1; i <= n; i++) {
		if (!(i % 3 == 0 || i % 5 == 0)) {
			sum += i;
		}
	}
	cout << sum << '\n';
}


Measured memory_bytes: 3616
import sys
 
sys.setrecursionlimit(10000)

N,K,L = map(int, input().split())

#print(N,K,L,D,T)

class UnionFind:
    def __init__(self, n: int) -> None:
        self.par = [i for i in range(n)]
        self.rank = [0] * n

    def find(self, x: int) -> int:
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def unite(self, x: int, y: int) -> None:
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
        
    # 同じ集合に属するか判定
    #def same_check(self, x, y):
    #    return self.find(x) == self.find(y)

def uniteOne(num, uf):
    for _ in range(num):
        d0, d1 = map(int, input().split())
        d0 = d0 - 1
        d1 = d1 - 1
        uf.unite(d0, d1)

uf_D = UnionFind(N)
uf_T = UnionFind(N)

uniteOne(K, uf_D)
uniteOne(L, uf_T)


pairs = []
for i in range(N):
    pairs.append((uf_D.find(i), uf_T.find(i)))

pairs_count = {}
for p in pairs:
    if not p in pairs_count:
        pairs_count[p] = 1
    else:
        pairs_count[p] += 1

res = [0] * N
for i in range(N):
    res[i] = pairs_count[pairs[i]]
#print(*(res[i] for i in range(N)))
print(" ".join([str(i) for i in res]))

Measured memory_bytes: 66712
# C - Typical Stairs

n, m = map(int, input().split())
mod = 10**9 + 7
dp = [1]*(n+1)

for _ in range(m):
    a = int(input())
    dp[a] = 0

for i in range(2, n+1):
    if dp[i]>0:
        dp[i] = (dp[i-1]+dp[i-2])%mod

print(dp[n])

Measured memory_bytes: 6900
#include<algorithm>
#include<cstdio>
#include<cstring>

const int MOD = 998244353, Maxv = 300005; 
long long fac[Maxv], inv[Maxv], n, a, b, k, ans, tmp;

long long read(){
    long long x = 0, f = 1; 
    char ch = getchar(); 
    while (ch < '0' || ch > '9') {
        if (ch == '-') {
            f = -1; 
        }
        ch = getchar(); 
    }
    while (ch >= '0' && ch <= '9') {
        x = (x << 3) + (x << 1) + ch - '0'; 
        ch = getchar(); 
    }
    return x * f; 
}

long long Pow(long long m, int n) {
	long long res = 1;
	while (n) {
		if (n & 1) {
			res = res * m % MOD;
        }
		m = m * m % MOD;
		n >>= 1;
	}
	return res;
}

long long C(int m, int n) {
	return fac[m] * inv[n] % MOD * inv[m - n] % MOD;
}

int main() {	
	n = read(); 
    a = read(); 
    b = read(); 
    k = read(); 
	fac[0] = inv[0] = 1; 
	for (int i = 1; i < Maxv; i++) {
        fac[i] = fac[i - 1] * i % MOD; 
		inv[i] = Pow(fac[i], MOD - 2);
    }
	for (int i = 0; i * a <= k && i <= n; i++) {
		tmp = k - i * a;
		if (tmp % b == 0) {
			tmp /= b;
			if (tmp <= n) {
				ans = (ans + C(n, i) * C(n, tmp)) % MOD;
            }
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 4864
#include "bits/stdc++.h"
using namespace std;
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    string s;
    cin >>s;

    int cnt=0;
    int mx=0;

    for(char i : s){
        if(i=='R')cnt++;
        else cnt=0;
        mx=max(mx,cnt);
    }
    cout<<mx<<endl;
}



Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		 //sort(all(vi S)) sort(all(string S))
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;
int main() {
    int N;
    cin>>N;
    vector<ll> H(N+1);
    rep(i,N)cin>>H[i];
    H[N] = INF+1;
    ll ans = 0;
    ll cnt = 0;
    rep(i,N){
        if(H[i] >= H[i+1]){
            cnt++;
        }
        else{
            ans = max(ans,cnt);
            cnt = 0;
        }
    }
    cout<<ans<<endl;

}

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

using namespace std;

#define pi acos(-1)

int main()
{
    int n,m,s = 0,a;

    cin >> n >> m;

    for(int i = 1; i <= m; i++){
        cin >> a;
        s += a;
    }

    cout << ((n-s >= 0)? n-s : -1);

    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<iomanip>
#include<cmath>

int main() {
	int n;
	std::cin >> n;
	double rax, ray, rbx, rby, rcx, rcy;
	for (int i = 0; i < n; i++) {
		double ax, ay, bx, by, cx, cy, aa, bb, cc, a, b, c, d, e, f, rx, ry, rr;
		std::cin >> rax >> ray >> rbx >> rby >> rcx >> rcy;
		ax = rbx - rax; ay = rby - ray;
		bx = rcx - rbx; by = rcy - rby;
		cx = rax - rcx; cy = ray - rcy;
		aa = ax * ax + ay * ay;
		bb = bx * bx + by * by;
		cc = cx * cx + cy * cy;
		a = std::sqrt(aa);
		b = std::sqrt(bb);
		c = std::sqrt(cc);
		d = aa * (bb + cc - aa);
		e = bb * (cc + aa - bb);
		f = cc * (aa + bb - cc);
		rx = ((d * rcx) + (e * rax) + (f * rbx)) / (d + e + f);
		ry = ((d * rcy) + (e * ray) + (f * rby)) / (d + e + f);
		rr = (a * b * c) / std::sqrt((a + b + c)*(-a + b + c)*(a - b + c)*(a + b - c));
		std::cout << std::fixed;
		std::cout << std::setprecision(3) << rx << " " << ry << " " << rr << std::endl;
	}

	return 0;
}

Measured memory_bytes: 3228
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
using namespace std;

typedef long long int ll;




int main(void){
	string s; cin >> s;
	if (s.substr(0,4)=="YAKI") cout << "Yes" << endl; else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef long double ld;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(20);
    int n; cin >> n;
    vector<int> h(n);
    for (int &x : h) {
        cin >> x;
    }
    int res = 0;
    for (int i = 0; i < n; i++) {
        int x = h[i];
        if (x) {
            int nextZero = n;
            for (int j = i + 1; j < n; j++) {
                if (h[j] == 0) {
                    nextZero = j;
                    break;
                }
            }
            int mn = x;
            for (int j = i + 1; j < nextZero; j++) {
                mn = min(mn, h[j]);
            }
            for (int j = i; j < nextZero; j++) {
                h[j] -= mn;
            }
            res += mn;
            if (h[i]) {
                i--;
            }
        }
    }
    cout << res << "\n";
}


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

#ifdef ONLINE_JUDGE
#define endl "\n"
#endif
using namespace std;
typedef unsigned long long int lu;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> v;
typedef vector<v> vv;
typedef vector<ld> vld;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
const ll MOD = 1e9 + 7;
const v dx = {1, -1, 0, 0};
const v dy = {0, 0, 1, -1};
#define yes cout << "YES\n";
#define no cout << "NO\n";
#define yesno(f) \
    if (f)       \
        yes else no;
#define noo \
    { no return; }
#define amax(x, y) \
    if (y > x)     \
        x = y;
#define amin(x, y) \
    if (y < x)     \
        x = y;
#define sz(x) (ll) x.size()
#define sq(x) ((x) * (x))

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

template<typename T = ll>
vector<T> ga(ll n, bool oneIndexed = false) {
    vector<T> a = vector<T>(n + oneIndexed);

    for (ll i = 0; i < n; i++) {
        T p;
        cin >> p;
        a[i + oneIndexed] = p;
    }

    return move(a);
}

template<typename T, typename A>
void pa(vector<T, A> const &a, ll begin = 0, ll end = -1) {
    if (end == -1)
        end = sz(a) - 1;
    for (ll i = begin; i <= end; i++) {
        cout << a[i] << " ";
    }
    cout << endl;
}

ll C;

void solve() {
    ll n, k;
    cin >> n >> k >> C;
    string s;
    cin >> s;

    v dp(n, 0);
    dp[n - 1] = s[n - 1] == 'o';

    for (ll day = n - 2; day >= 0; day--) {
        ll nxt = day + C + 1;
        ll use = nxt < n ? dp[nxt] : 0;
        ll add = s[day] == 'o';
        amax(dp[day], use + add);
        amax(dp[day], dp[day + 1]);
    }

    if (dp[0] > k) {
        return;
    }

    ll curr = 0;
    v res;
    ll cnt = 0;

    while (cnt < k) {
        while (s[curr] == 'x')curr++;

        if (curr == n - 1 || dp[curr] > dp[curr + 1]) {
            res.push_back(curr);
        }

        curr += C + 1;
        cnt++;
    }
    for (auto x: res)cout << x + 1 << "\n";
}

int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    // ll t;cin >> t;while(t--)
    solve();
    return 0;
}

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

int main(){
  int n;
  string s;
  cin>>n>>s;
  bool r=false;
  rep(i,0,4){
    bool p[n];
    if(i%2==0) p[0]=false;
    else p[0]=true;
    if(i/2%2==0) p[1]=false;
    else p[1]=true;
    rep(j,2,n){
      if(s[j-1]=='o'){
        if(p[j-1]) p[j]=p[j-2];
        else p[j]=!p[j-2];
      }
      else{
        if(p[j-1]) p[j]=!p[j-2];
        else p[j]=p[j-2];
      }
    }
    bool q=true;
    if(s[n-1]=='o'){
      if(p[n-1]){
        if(p[n-2]!=p[0]) q=false;
      }
      else{
        if(p[n-2]==p[0]) q=false;
      }
    }
    else{
      if(p[n-1]){
        if(p[n-2]==p[0]) q=false;
      }
      else{
        if(p[n-2]!=p[0]) q=false;
      }
    }
    if(s[0]=='o'){
      if(p[0]){
        if(p[n-1]!=p[1]) q=false;
      }
      else{
        if(p[n-1]==p[1]) q=false;
      }
    }
    else{
      if(p[0]){
        if(p[n-1]==p[1]) q=false;
      }
      else{
        if(p[n-1]!=p[1]) q=false;
      }
    }
    if(q){
      rep(i,0,n){
        if(p[i]) cout<<'S';
        else cout<<'W';
      }
      r=true;
      break;
    }
  }
  if(!r) cout<<-1<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;
int main(int argc, char const *argv[])
{
    int a, b;
    cin >> a >> b;
    cout << max(0, a - 2 * b) << endl;

    return 0;
}


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

using namespace std;
using ll = long long;

int main() {
#ifdef LOCAL
    freopen("in1.txt", "r", stdin);
    freopen("out1.txt", "w", stdout);
#endif


    int n;
    cin>>n;
    string s;
    cin>>s;
    string t;
    int w = 0;
    int r = 0;
    for(int i=0;i<n;i++) if(s[i]=='W') w++;else r++;

    while(r--){
        t.push_back('R');
    }
    while (w--) t.push_back('W');
    for(int i=0;i<n;i++){
        if(s[i]=='W' and t[i]=='R') w++;
        else if(s[i]=='R' and t[i]=='W') r++;
    }
    cout<<max(w,r)+1<<endl;

    return 0;
}

Measured memory_bytes: 3896
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
#define INF 1000000

int main() {
    while (true) {
        int W, H; cin >> W >> H;
        
        if (W==0 && H==0) {
            break;
        }
    
        char c[H][W];
        vector<P> pos[7];
        int sx, sy, gx, gy;
    
        for (int i=0; i<H; i++) {
            for (int j=0; j<W; j++) {
                cin >> c[i][j];
            
                if (c[i][j]=='S') {
                    sx=i, sy=j;
                    pos[0].push_back(P(i, j));
                }
                else if (c[i][j]=='G') {
                    gx=i, gy=j;
                    pos[6].push_back(P(i, j));
                }
                else if (c[i][j]!='.') {
                    pos[c[i][j]-'0'].push_back(P(i, j));
                }
            }
        }
    
        int dp[6][H][W];
    
        for (int i=0; i<6; i++) {
            for (int j=0; j<H; j++) {
                for (int k=0; k<W; k++) {
                    dp[i][j][k] = INF;
                }
            }
        }
    
        dp[0][sx][sy] = 0;
        int ans0;
        int ans1 = INF;
    
        for (int i=1; i<=5; i++) {
            int now = 0;

            for (int j=1; j<=5; j++) {
                int next;
            
                if (j==5) {
                    next = 6;
                }
                else if (i+j==5) {
                    next = 5;
                }
                else {
                    next = (i+j)%5;
                }
                
                for (int k=0; k<pos[now].size(); k++) {
                    for (int l=0; l<pos[next].size(); l++) {
                        int x1=pos[now][k].first, y1=pos[now][k].second;
                        int x2=pos[next][l].first, y2=pos[next][l].second;
                    
                        dp[j][x2][y2] = min(dp[j][x2][y2], dp[j-1][x1][y1]+abs(x1-x2)+abs(y1-y2));
                    }
                }
            
                now = next;
            }

            if (ans1>dp[5][gx][gy]) {
                ans0 = i;
                ans1 = dp[5][gx][gy];
            }
        }
        
        if (ans1==INF) {
            cout << "NA" << endl;
        }
        else {
            cout << ans0 << " " << ans1 << endl;
        }
    }
}


Measured memory_bytes: 27556
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
constexpr int MOD=1000000007;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;

int main(void){
    int A,B,C,D;
    cin >> A >> B >> C >> D;
    int cnt=0;
    while(A>0 && C>0){
        if(cnt%2==0) C-=B,cnt++;
        else A-=D,cnt++;
    }
    if(cnt%2==1) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3664
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;

int main() {
    ll Q, A, B;
    
    cin >> Q;
    while(Q--){
        cin >> A >> B;
        if (A > B) swap(A, B);
        ll res=2*(A-1);

        ll num=0;
        for(int i=29; i>=0; i--){
            num += 1<<i;
            if (A+num > B) {
                num -= 1<<i;
                continue;
            }
            int ng=0;
            for(int x=num/2-2; x<=num/2+2; x++){
                if(x <= 0 || x>num) continue;
                if((A+x)*(A+num-x)>=A*B) ng=1;
            }
            if(ng) num -= 1<<i;
        }
        res += num;
        cout << res << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define INF = 1001001001
#define pi = acos(-1)
using namespace std;
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }

int main(){
    string s, t; cin>>s>>t;
    int ans = 0;

    for (int i = 0; i < s.size(); ++i) {
        if(s[i] != t[i]) ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3916
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus >= 201703L
#        pragma GCC target("avx2")
#    else
#        pragma GCC target("avx")
#    endif

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

int Gcd(int a, int b) {
    if (b == 0) {
        return a;
    } else {
        return Gcd(b, a % b);
    }
}

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

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

    sort(x.begin(), x.end());
    vector<int> dif(n);
    for (int i = 0; i < n; i++) {
        dif[i] = x[i + 1] - x[i];
    }

    int ans = dif[0];
    for (int i = 0; i < n; i++) {
        ans = Gcd(ans, dif[i]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
s = input()
  
while len(s) > 4:
  if s[-5:] == "dream":
    s = s[:-5]
    continue
  elif s[-7:] == "dreamer":
    s = s[:-7]
    continue
  elif s[-5:] == "erase":
    s = s[:-5]
    continue
  elif s[-6:] == "eraser":
    s = s[:-6]
    continue
  else:
    break
    
if s:
  print("NO")
else:
  print("YES")

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void dump(vector<T> v) { for (auto& x : v) cerr << x << " "; cerr << endl; }
template<class T> inline void dump(vector<pair<T, T>> v) { for (auto& p : v) cerr << p.first << " " << p.second << endl; }
template<class T> inline void dump(vector<vector<T>> vv) { for (auto& v : vv) {for (auto& x : v) cerr << x << " "; cerr << endl;} }

constexpr int INF = 1e9 + 5;
constexpr long long INFLL = 1LL << 60;
constexpr double eps = (1e-9);

constexpr ll mod = 1000000007;

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

  int n, m;
  cin >> n >> m;
  set<int> a;
  rep(i, m) {
    int tmp;
    cin >> tmp;
    a.insert(tmp);
  }

  vector<ll> dp(n + 2, 0);
  dp[0] = 1;

  for (int i = 0; i < n; i++) {
    if (a.count(i) > 0) continue;   // i is broken
    dp[i+1] += dp[i];
    dp[i+1] %= mod;
    dp[i+2] += dp[i];
    dp[i+2] %= mod;
  }

  cout << dp[n] << endl;

  return 0;
}


Measured memory_bytes: 8660
import java.util.*;

class Main{
    static Scanner sc = new Scanner(System.in);
    public static void main(String args[]){
        int N=sc.nextInt(),a[]=new int[N];
        boolean F[]=new boolean[N];
        Arrays.fill(F,false);
        for(int i=0;i<N;i++){
            a[i]=(sc.nextInt()-1);
        }
        int t=0,c=0;
        while(true){
            if(F[t]||F[1]){
                break;
            }
            c++;
            F[t]=true;
            t=a[t];
        }
        System.out.println(F[1]?c-1:-1);
    }
}


Measured memory_bytes: 59136
n = int(input())
if n == 1:
    print(1, 1, 1)
    exit()
for i in range(1, 3500 + 1):
    for j in range(1, 3500 + 1):
        if 4 * i * j - n * i - n * j == 0:
            continue
        w = n * i * j / (4 * i * j - n * i - n * j)
        if w % 1 == 0 and w > 0:
            print(i, j, int(w))
            exit()

Measured memory_bytes: 40812
local MOD=1000000007
local function add(a,b)return (a+b)%MOD end
local function sub(a,b)return (a-b)%MOD end
local function mul_(a,b)
	local ret=0
	while(b>0)do
		if(b%2==1)then ret=(ret+a)%MOD end
		a=(a+a)%MOD
		b=math.floor(b*.5)
	end
	return ret
end
local function mul(a,b)
	return a<b and mul_(b,a)or mul_(a,b)
end
local function pow(a,b)
	local ret=1
	while(b>0)do
		if(b%2==1)then ret=mul(ret,a)end
		a=mul(a,a)
		b=math.floor(b*.5)
	end
	return ret
end
local function inv(x)
	local a=x
	local b,u,v=MOD,1,0
	repeat
		local t=math.floor(a/b)
		a,b=b,a-t*b
		u,v=v,u-t*v
	until(b==0)
	return u%MOD
end
local function div(a,b)return mul(a,inv(b))end
local function C(n,k)
	if(n<k)then return 0 end
	local ret=1
	for i=n,n-k+1,-1 do
		ret=mul(ret,i)
	end
	for i=2,k do
		ret=div(ret,i)
	end
	return ret
end

n=io.read"*n"
a=io.read"*n"
b=io.read"*n"
print(sub(sub(sub(pow(2,n),C(n,a)),C(n,b)),1))

Measured memory_bytes: 256
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

#[fastout]
fn main() {
    input! {//
        n:usize,k:usize,
        a:[usize;n],
    }
    let mut sm = a.iter().fold(0, |sum, x| sum + x);
    let mut dvs = divisor(sm);

    dvs.sort_by_key(|&x| -(x as i64));

    for &d in dvs.iter() {
        let mut nms = vec![];
        for &x in a.iter() {
            nms.push(x % d);
        }
        nms.sort();
        let mut c1 = 0;
        let mut c2 = 0;
        let mut r = n - 1;
        for l in 0..n {
            c1 += nms[l];
            while c1 > c2 {
                c2 += d - nms[r];
                r -= 1;
            }
            if l >= r {
                break;
            }
        }
        if c1 <= k {
            println!("{}", d);
            return;
        }
    }
}
pub fn divisor(n: usize) -> Vec<usize> {
    let mut res = Vec::new();
    for i in (1..).take_while(|x| x * x <= n) {
        if n % i == 0 {
            res.push(i);
            if i != n / i {
                res.push(n / i);
            }
        }
    }
    res.sort();
    res
}


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

int main() {
	int p;
	int c[6]={500,100,50,10,5,1};
	while(1){
		cin >>p;
		if(p==0){return 0;}
		int n=0;
		int ch=1000-p;
		for(int i=0;i<6;i++){
			n+=ch/c[i];
			ch=ch%c[i];
		}
		cout << n << endl;
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define RREPALL(i,v) for (int i = v.size()-1; i >= 0; i--)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

vector<ll> s, t, x;
const ll INFINF = 1e11;

ll ans(ll x)
{
    ll ans = 1e11;
    int j = lower_bound(s.begin(), s.end(), x) - s.begin();
    int k = lower_bound(t.begin(), t.end(), x) - t.begin();

    ans = min(ans, abs(x - s[j]) + abs(s[j] - t[k]));
    ans = min(ans, abs(x - s[j - 1]) + abs(s[j - 1] - t[k]));
    ans = min(ans, abs(x - s[j]) + abs(s[j] - t[k - 1]));
    ans = min(ans, abs(x - s[j - 1]) + abs(s[j - 1] - t[k - 1]));
    ans = min(ans, abs(x - t[k]) + abs(s[j] - t[k]));
    ans = min(ans, abs(x - t[k]) + abs(s[j - 1] - t[k]));
    ans = min(ans, abs(x - t[k - 1]) + abs(s[j] - t[k - 1]));
    ans = min(ans, abs(x - t[k - 1]) + abs(s[j - 1] - t[k - 1]));

    return ans;
}

int main()
{
    int a, b, q;
    cin>>a>>b>>q;
    s.push_back(-INFINF);
    REP(i,a) {
        ll tmp;
        cin>>tmp;
        s.push_back(tmp);
    }
    s.push_back(INFINF);
    t.push_back(-INFINF);
    REP(i,b) {
        ll tmp;
        cin>>tmp;
        t.push_back(tmp);
    }
    t.push_back(INFINF);
    REP(i,q) {
        ll tmp;
        cin>>tmp;
        x.push_back(tmp);
    }

    REP(i,q) {
        cout<<ans(x[i])<<endl;
    }

    return 0;
}


Measured memory_bytes: 3828
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define divceil(A, B) ((A + (B - 1)) / B)
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define CERR if(false) cerr

using namespace std;

int main(){

    int h,w;
    cin >> h >> w;

    vector<string> s;

    rep(i,h){
        string tmps;
        cin >> tmps;
        s.pback(tmps);
    }

    rep(i,h){
        rep(j,w){
            if(s[i][j] == '#') continue;
            int count = 0;
            
            rep(k,8){
                int x = j + round(cos(0.25 * PI * k));
                int y = i + round(sin(0.25 * PI * k));

                if(0 <= x && x <= w - 1 && 0 <= y && y <= h - 1){
                    if(s[y][x] == '#') count++;
                }
            }

            s[i][j] = '0' + count;
            
        }

        cout << s[i] << endl;
    }
    return 0;

}


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

int main()
{
	int k,s;
	cin>>k>>s;
	
	int v=0;
	for(int x=0;x<=min(k,s);x++){
		for(int y=0;y<=min(k,s-x);y++){
			int z=s-x-y;
			if(0<=z&&z<=k) v++;
		}
	}
	
	cout<<v<<endl;
	return 0;
}


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

using namespace std;

#define int long long
#define ll long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES puts("YES\n")
#define Yes puts("Yes\n")
#define NO  puts("NO\n")
#define No  puts("No\n")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }



signed main() {

	int N;
	cin >> N;
	vector<int> A(N), B(N);
	rep(i, N) cin >> A[i];
	rep(i, N) cin >> B[i];

	int ans = 0;
	while (true) {
		priority_queue<P> q;

		rep(i, N) {
			int diff = B[i] - A[i];
			q.push({ diff,i });

		}

		if (q.top().first == 0) break;
		if (q.top().first < 0) { cout << -1 << endl; return 0; }

		bool f = false;
		while (!q.empty()) {
			pair<int, int> t = q.top();
			q.pop();

			int idx = t.second;
			int d = t.first;

			int div = (B[idx] - A[idx]) / (B[(idx - 1 + N) % N] + B[(idx + 1) % N]);
			if (div != 0) f = true;
			B[idx] -= (B[(idx - 1 + N) % N] + B[(idx + 1) % N]) * div;
			ans += div;
//			rep(i, N) cerr << B[i] << " ";
//			cerr << endl;
		}
		if (f == false) { cout << -1 << endl; return 0; }
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 11688
//  Be name khoda
// "Khodaya, be man "Tagwaye setiz" biamooz ta
//  dar anbuh masuliat nalaghzam ..." -Shariati
#include <bits/stdc++.h>
using namespace std;

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

#define F first
#define S second
#define MP make_pair

const int MAX = 1e5+9;
const ll MOD = 1e9+7;

stack <char> st;

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	string s;
	cin >> s;
	for (int i = 0; i < s.length(); i++) {
		char c = s[i];
		if (st.empty())
			st.push(c);
		else
		if (st.top() == 'S' && c == 'T')
			st.pop();
		else
			st.push(c);
	}
	cout << st.size() << "\n";
}



Measured memory_bytes: 720
#include <bits/stdc++.h>
#define ll long long
#define PB push_back
#define MP make_pair
#define pri 1000000007
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
using namespace std;
void run(){
ll n;cin>>n;
ll c=0;
for(ll i=0;i<n;i++){
	ll x;cin>>x;
	if(x!=i+1)c++;
}
if(c==0||c==2)cout<<"YES";
else cout<<"NO";
	
}
int main() {
	ll t=1;
	//cin>>t;
	for(ll i=0;i<t;i++)run();
	// your code goes here
	return 0;
}

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

using namespace std;
int main()
{
	int a = 100000;
	int s;
	cin >> s;
	for (int i = 0; i < s; i++)
	{
		a *= 1.05;
		if (a % 1000 == 0) {
			a = a - (a % 1000);
		}
		else { a = a - (a % 1000) + 1000; }
	}
	cout << a << endl;
	return 0;
}

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

using namespace std;
typedef long long ll;

int main() {
  int n;
  cin >> n;
  n--;
  ll c, s, f;
  vector<ll> res(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> c >> s >> f;
    res[i] = s + c;
    for (int j = 0; j < i; j++) { 
      res[j] = max(res[j], s);
      ll y = res[j]%f;
      if (y != 0) res[j] += f - y;
      res[j] += c;
    }
  }
  for (int i = 0; i < n; i++) {
    cout << res[i] << "\n";
  }
  cout << 0 << endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
#define pb push_back
#define ff first 
#define ss second  
typedef pair<int,int> pp;
bool com(pp x,pp y){
    return x.ff<y.ff;
} 
int N=1e5+9;
vector<vector<int>> vtx;
vector<bool> vis;
void dfs(int u,int &k){
    k++;
    vis[u]=1;
    for(auto v:vtx[u])
        if(!vis[v]) dfs(v,k);
}
int main() {
	// your code goes here
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n,m;
	cin>>n>>m;
	vis.resize(n+1);
	vtx.resize(n+1);
	for(int i=0,u,v;i<m;i++){
	    cin>>u>>v;
	    vtx[u].pb(v);
	    vtx[v].pb(u);
	}
	int ans=0;
	for(int i=1;i<=n;i++){
	    if(!vis[i]){
	        int k=0;
	        dfs(i,k);
	        ans=max(ans,k);
	    }
	}
	cout<<ans;
	return 0; 
	
}


Measured memory_bytes: 23444
'use strict'
const lines = require('fs').readFileSync(0, 'utf8').split('\n')
const N = parseInt(lines[0], 10)
const dp = {a:[],b:[],c:[]}
for (let i=1;i <= N;i++) {
  const abc = lines[i].split(' ')
  dp.a[i-1] = parseInt(abc[0], 10) + (i>1 ? Math.max(dp.b[i-2], dp.c[i-2]) : 0)
  dp.b[i-1] = parseInt(abc[1], 10) + (i>1 ? Math.max(dp.a[i-2], dp.c[i-2]) : 0)
  dp.c[i-1] = parseInt(abc[2], 10) + (i>1 ? Math.max(dp.b[i-2], dp.a[i-2]) : 0)
}
console.log(Math.max(dp.a[N-1], dp.b[N-1], dp.c[N-1]))

Measured memory_bytes: 29648
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int x;
  cin>>x;x--;
  cout<<a[x]<<"\n";
  return  0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld double
#define F first
#define S second

using namespace std;

const int MAXN = 1e6 + 5;
const int inf = 1e9 + 7;
const int INF = 1e18;

int a[7], mn = inf;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> a[1] >> a[2] >> a[3] >> a[4] >> a[5];
    int tt = 120;
    while (tt--) {
        int sum = 0;
        for (int i = 1; i < 5; i++) {
            sum += a[i];
            while (sum % 10 != 0) sum++;
        }
        sum += a[5];
        mn = min(mn, sum);
        next_permutation(a + 1, a + 6);
    }
    cout << mn;
    return 0;
}


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

#define ll long long
using vt = ll; //ここで数値の型を変えられる
#define rep(i, n) for (vt i = 0; i < (vt)(n); i++)
#define reps(i, s, n) for(vt i = (vt) (s); i < (vt) (n); i++) 
#define all(v) v.begin(), v.end()
#define P pair<ll, ll>
const ll  MOD = 1000000007;

int main() {
	ll a, b;
	cin >> a >> b;
	if (a < 6) cout << 0;
	else if (a < 13) cout << b / 2;
	else cout << b;
	return 0;
}

Measured memory_bytes: 256
H, W, K = map(int, input().split())
cake = [input() for _ in range(H)]
ans = []
counter = 1
strawberry = 0
for i, S in enumerate(cake):
    if '#' not in S and i == 0:
        ans.append(['*'] * W)
    elif '#' not in S:
        ans.append(ans[-1])
    else:
        temp = [1 if S[j] == '#' else 0 for j in range(W)]
        if sum(temp) == 1:
            ans.append([counter] * W)
            strawberry += 1
        else:
            strawberry += sum(temp)
            for j in range(W):
                if temp[j] == 1:
                    temp[j] = counter
                    counter = min(counter + 1, strawberry)
                else:
                    temp[j] = counter
            ans.append(temp)
        counter += 1
temp = 1
for a in ans:
    if '*' in a:
        temp += 1
    else:
        for _ in range(temp):
            print(*a)
        temp = 1

Measured memory_bytes: 7568
fun main(args: Array<String>) {
	val r = readLine()!!.toInt()
	var ans: String

	if (r < 1200) {
		ans = "ABC"
	} else if (r < 2800) {
		ans = "ARC"
	} else {
		ans = "AGC"
	}
	println(ans)
}


Measured memory_bytes: 31716
#include<iostream>
#include<string>
#include<map>

int main(){
  std::string A, B, C;
  std::cin >> A >> B >> C;
  std::map<char, std::string> card;
  card['a'] = A;
  card['b'] = B;
  card['c'] = C;
  char nowTurn = 'a';
  char nextTurn;
  while(true){
    if(card[nowTurn].size() == 0) break;
    nextTurn = card[nowTurn].at(0);
    card[nowTurn].erase(card[nowTurn].begin());
    nowTurn = nextTurn;
  }
  if(nowTurn == 'a') std::cout << 'A' << std::endl;
  else if(nowTurn == 'b') std::cout << 'B' << std::endl;
  else std::cout << 'C' << std::endl;
}

Measured memory_bytes: 256
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.IOException;

public class Main {

    public static void main(String[] args) throws IOException{
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter writer = new PrintWriter(System.out);
        
        int N = Integer.parseInt(reader.readLine()),
            time = 0, //経過時間
            nowx = 0,
            nowy = 0;
        
        String ans = "Yes";
        
        for(int i = 0; i < N; i++){
            String[] line = reader.readLine().split(" ");
            int t = Integer.parseInt(line[0]),
                x = Integer.parseInt(line[1]),
                y = Integer.parseInt(line[2]);
            
            if(Math.abs(x-nowx) + Math.abs(y-nowy) > t - time){
                ans = "No";
                break;
            }else if (Math.abs(x-nowx) + Math.abs(y-nowy) < t - time){
                int distance = (t - time) - (Math.abs(x-nowx) + Math.abs(y-nowy));
                
                if(distance != 0 && distance % 2 == 1 ){
                    ans = "No";
                    break;
                }
            }
            
            time = t;
            nowx = x;
            nowy = y;
            
        }
    
    writer.println(ans);
        
    reader.close();
    writer.close();
    }
}

Measured memory_bytes: 44664
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using ll = long long;
using namespace std;

int main() {
    string s;
    cin >> s;
    for (int i = 0; i < (1<<3); i++) {
        int cur = s[0] - '0';
        string v;
        v += s[0];
        for (int j = 1; j < 4; j++) {
            if ((i >> (j - 1)) & 1) {
                cur += s[j] - '0';
                v += "+";
                v += s[j];
            } else {
                cur -= s[j] - '0';
                v += "-";
                v += s[j];
            }
        }
        if (cur == 7) {
            cout << v << "=7" << endl;
            return 0;
        }
    }
}

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

namespace ABC_073A
{
    class Program
    {
        static void Main(string[] args)
        {
            string n;
            n = Console.ReadLine();
            if (n[0] == '9' || n[1] == '9')
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");

            Console.ReadKey();
        }
    }
}


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

int main () {
  int count = 0;
  char prev = 'S';
  string S;
  cin >> S;
  for (int i = 0; i < (int)S.size(); i++) {
    char current = S.at(i);
    if (current == 'R') {
      if (prev == 'R') {
        count++;
      } else {
        count = 1;
      }
    }
    prev = current;
  }
  cout << count << endl;
}

Measured memory_bytes: 3560
let () = Scanf.scanf "%d %d\n" @@ fun h n ->
  let list = List.init n @@ fun _ -> Scanf.scanf " %d" Fun.id in
  Printf.printf "%s\n" @@
  let sum = List.fold_left ( + ) 0 list in
  if sum >= h
  then "Yes"
  else "No"

Measured memory_bytes: 9788
#n = int(input())
a,b,c=map(int,input().split("/")) #横並び
#x=[int(input()) for i in range(3)] #縦に並んだのを配列に
#y=list(map(int,input().split())) #横に並んだのを配列に
if b<4 :print("Heisei")
elif b==4 and c<=30 :print("Heisei")
else :print("TBD")
#print('YNEOS'[1::2])


Measured memory_bytes: 3316
//
// Created by 李青坪 on 2018/10/28.
//

#include <cstdio>
#include <algorithm>
#define MAXN 50
#define NIL -1
using namespace std;

int value[MAXN];

int fibonacci(int n){
    if (n == 0 || n == 1) {
        value[n] = 1;
        return 1;
    }
    if (value[n] != NIL) return value[n];
    value[n] = fibonacci(n-1) + fibonacci(n-2);
    return value[n];
}

int main(){
    fill(value, value+MAXN, NIL);
    int n;
    scanf("%d", &n);
    printf("%d\n", fibonacci(n));
}


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

int collatz(int n) {
    if(n%2)
        n = 3*n +1;
    else
        n /= 2;
    return n;
}

int main(){
    int s; cin>>s;
    int count = 1;
    while(true){
        if (s == 4 or s == 2 or s == 1) {
            break;
        }
        s = collatz(s);
        count++;
    }
    
    cout<<count+3<<endl;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
///////////////////////////

ll po(ll i,ll p){
    if(p==0)return 1;
    else{
        i=mod(i);
        if(p==1)return i;
        if(p%2==0)return po(mod(i*i),p/2);
        return mod(i*po(i,p-1));
    }
}
ll bunbo(ll n){
    return po(n,i_5);
}

#define N 100005
int main(){fastio
    ll n;cin>>n;
    ll x[n];rep(i,0,n-1)cin>>x[i];
    ll bun[N];
    rep(i,1,N-1)bun[i]=bunbo(i);
    ll bunsum[N];
    bunsum[1]=bun[1];
    rep(i,2,N-1)bunsum[i]=bunsum[i-1]+bun[i];
    ll ans=0;
    rep(i,0,n-2){
        ll dis=x[i+1]-x[i];
        Add(ans,dis*bunsum[i+1]);
    }
    rep(i,1,n-1){
        ans=mod(ans*i);
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 2560
import scala.collection.immutable.Queue;
import scala.io.StdIn.{readInt, readLine};
object Main {
    def main(args: Array[String]): Unit = {
        val n = readInt;
        val ig = new IntGraph(n);
        (1 to n).foreach { src => readLine.split(" ").drop(2).map(_.toInt).foreach { dst => ig.add(src, dst)}}
        val ret = ig.bSearch();
        (1 to n).foreach { i => println("%d %d".format(i, ret(i)))}
    }
}

class IntGraph(n: Int) {
    val size = n + 1;
    val matrix = Array.ofDim[Int](size, size);
    def add(src: Int, dst: Int): Unit = matrix(src)(dst) = 1;
    def bSearch(): Array[Int] = {
        val status = new Array[Int](size).map( e => -1);
        def _bSearch(que: Queue[Int]): Queue[Int] = {
            que.dequeueOption match {
                case None => que;
                case Some((src, restQue)) => {
                    val newQue = (1 until size).foldLeft(restQue) { (tmpQue, dst) =>
                        if (matrix(src)(dst) == 1 && status(dst) == -1) {
                            status(dst) = status(src) + 1
                            tmpQue.enqueue(dst);
                        } else {
                            tmpQue;
                        } 
                    }
                    _bSearch(newQue);
                }
            }
        }
        status(1) = 0;
        _bSearch(Queue[Int](1));
        status;
    }
}


Measured memory_bytes: 44920
program main
implicit none
integer(8) :: a, b, c, d, e, i
integer(8) :: k, l, m, n

read(*,*) a, b, c, d

n = b-a+1
k = 0
l = 0
m = 0

e = c*d/gcd( c, d )
if( mod( a, c) == 0 ) then
   k = b/c -a/c +1
else
   k = b/c - a/c
end if
if( mod( a, d) == 0 ) then
   l = b/d -a/d +1
else
   l = b/d - a/d
end if
if( mod( a, e) == 0 ) then
   m = b/e -a/e +1
else
   m = b/e - a/e
end if
write(*,'(i0)') n - k - l + m
 stop
contains
  integer function gcd(a, b)
    implicit none
    integer(8), intent(IN) :: a, b
    integer(8) :: l, m, n
    m = a
    n = b
    do
      l = mod(m, n)
      if (l == 0) exit
      m = n
      n = l
    end do
    gcd = n
    return
  end function gcd
end program main


Measured memory_bytes: 256