akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
const int mod = 1000000007;
ll modpow(ll a, int b) { return b ? modpow(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& v) { rep(i, sz(v)) { if (i) os << " "; os << v[i]; } return os; }
template<class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
inline int add(int a, int b) { a += b; if (a >= mod) return a - mod; return a; }

void solve();

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

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

void solve() {
  int n, m;
  cin >> n >> m;
  map<char, int> mp;
  rep(i, n * m) { char c; cin >> c; mp[c]++; }

  // 条件厳しいのから見ていく
  rep(i, (n / 2) * (m / 2)) {
    for (auto e : mp) {
      if (e.S >= 4) {
        mp[e.F] -= 4;
        break;
      }
    }
  }
  rep(i, (n % 2 ? m / 2 : 0) + (m % 2 ? n / 2 : 0)) {
    for (auto e : mp) {
      if (e.S >= 2) {
        mp[e.F] -= 2;
        break;
      }
    }
  }
  rep(i, (n % 2 && m % 2)) {
    for (auto e : mp) {
      if (e.S) {
        mp[e.F]--;
        break;
      }
    }
  }

  for (auto e : mp) {
    if (e.S) {
      cout << "No" << endl;
      return;
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 256
s = input()
if 0 < int(s[:2]) <13 and 0< int(s[2:]) < 13:
    print("AMBIGUOUS")
elif 0 < int(s[:2]) < 13:
    print("MMYY")
elif 0 < int(s[2:]) < 13:
    print("YYMM")
else:
    print("NA")

Measured memory_bytes: 9036
#include <bits/stdc++.h>
 
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
#define debug cout << "Ok" << endl;

using namespace std;

int solve(int n){

	return ( (n-1) * n) /2;
}
 
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n,m;


	cin >> n >> m;

	cout << solve(n) + solve(m) << endl;	
	return 0;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
#define cinf(n,x) for(int i=0;i<(n);I++) cin >> x[i];

int main(){
  int A,B ;
  string op ;
  cin >> A >> op >> B ;
  if( op == "+")
    cout << A+B << endl;
  else
    cout << A-B << endl;
}


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

int main(){
    ll n,y;
    cin >> n >> y;

    for (ll man=0; man <= n; ++man) {
        for (ll gosen=0; gosen <= n; ++gosen) {
            ll sen_kingaku = y - man*10000 - gosen*5000;
            if (sen_kingaku%1000 != 0) {
                continue;
            }
            ll sen = sen_kingaku/1000;
            
            if (sen > n) {
                continue;
            }
            if (sen < 0) {
                continue;
            }
            if (sen + gosen + man == n) {
                cout << man << " " << gosen << " " << sen << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
}

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

int main(){
    int a,b,c,d;
   
    cin >> a >> b >> c >> d;


    while(a > 0 || c > 0){

        c-=b;
        if( c <=0){
            
            cout << "Yes" << endl;
            break;
        }
        a-=d;
       if( a <=0){
           
             cout << "No" << endl;
            break;
        }

    }

    
    return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
char s[100000005];
int main()
{   
	scanf("%s",s);
	int len=strlen(s);
	int m,a;
	m=0;
    for (int i=0;i<len;i++)
     {
     	a=s[i]-'0';
     	m+=a;
	 }
	if (m%9==0) 
	 cout<<"Yes";
	 else 
	  cout<<"No";
return 0;
}

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

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PI;

int main() {
	int a[3];
	for (int i = 0; i < 3; i++)
		cin >> a[i];
	sort(a, a + 3);
	cout << a[0] << " " << a[1] << " " << a[2] << endl;
	return 0;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;



int main() {
    string S,T;
    cin >> S >> T;
    ll maxc=S.size();
    for(ll a=0;a<S.size()-T.size()+1;a++){
        ll count=0;
        for(ll b=0;b<T.size();b++){
            if(S.at(a+b)!=T.at(b))count++;
            
            
        }
        
        maxc=min(count, maxc);
    }
    
    cout << maxc << endl;
}


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

using namespace std;

typedef long long int ll;

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

  string s;
  cin >> s;
  if(s == "ABC") cout << "ARC" << endl;
  else cout << "ABC" << endl;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int N,X;
    cin>>N>>X;
    vector<int> A(N);
    rep(n,0,N) cin>>A.at(n);

    sort(ToEnd(A));
    int ans=0;
    for(auto a:A){
        X-=a;
        ans++;
        if(X<0) break;
    }
    if(X!=0) ans--;

    cout<<ans<<endl;
}

Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.ascii;

void main(){
	auto ip1 = readln.chomp.to!int;
	auto ip2 = readln.chomp.to!int;
	auto ip3 = readln.chomp.to!int;
	auto ip4 = readln.chomp.to!int;
	(min(ip1, ip2) + min(ip3, ip4)).writeln;
}

Measured memory_bytes: 256
sixexp=[6**i for i in range(1,7)]
nineexp=[9**i for i in range(1,6)]
lis=[1]+sixexp+nineexp

n=int(input())

dp=[1000000 for i in range (n+1)]
dp[0]=0

for i in range(n):
    for j in lis:
        if i+j<=n:
            dp[i+j]=min(dp[i+j],dp[i]+1)

print(dp[n])

Measured memory_bytes: 45040
#include <iostream>
#include <string>
#include <vector>
#include<algorithm>
#include <stdio.h>
#include <bitset>
#include<math.h>
#include<list>
#include<map>
#include <queue>
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
#define PI 3.14159265358979323846  
typedef pair<int, int> P;



int main() {
	char a;
	cin >> a;
	if (a >= 'a' && a <= 'z') {
		cout << 'a' << endl;
	}
	else {
		cout << 'A' << endl;
	}

}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

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 (b<a) { a=b; return true; } return false; }

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

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

vector<pair<ll,ll>> factorize(ll n) {
    vector<pair<ll,ll>> res;
    for (ll i = 2; i*i <= n; ++i) {
        if (n%i) continue;
        res.emplace_back(i,0);
        while (n%i == 0) {
            n /= i;
            res.back().second++;
        }
    }
    if (n != 1) res.emplace_back(n,1);
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    ll n;
    cin>>n;
    ll ans=1;

    REP(i,2,n+1){
        vector<P> f = factorize(i);
        bool ok = true;
        if(f.size()==1){
            if(f[0].se==1){
                ok = false;
            }
        }else{
            Vec x;
            rep(j,(ll)f.size()){
                x.pb(f[j].se);
            }
            ll g = __gcd(x[1],x[0]);
            REP(i,1,f.size()){
                g = __gcd(x[i],x[i-1]);
            }
            if(g==1){
                ok = false;
            }
        }
        if(ok){
            chmax(ans,i);
        }
    }
    cout<<ans<<endl;
    return  0;
}


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

double sum_reverse(int* a, int size) {
    double sum = 0;
    for (int i = 0; i < size; i++) {
        sum += (1 / double(a[i]));
    }
    return double(1 / sum);
}

int main() {
    int N;
    cin >> N;
    int* a;
    a = new int[N];
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    
    cout << scientific << sum_reverse(a, N) << endl;
    delete[] a;
}

Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;

void main() {
  immutable n = readln.strip.to!long;
  ulong res;
  void check (long x) {
    --x;
    if (n / x == n % x) res += x;
  }
  for (int i = 2; i.to!long * i <= n; ++i) {
    check (i);
    long j = n / i;
    if (j != i) {
      check (n / i);
    }
  }
  if (n > 1) check (n);
  writeln (res);
}


Measured memory_bytes: 256
import sys
from collections import Counter

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

N = INT()
A = LIST()
MAX = max(A)

# 同値で何回もやらないようにsetにしておく
S = set(A)
ok = [1] * (MAX+1)
for a in S:
    # エラトステネスっぽく倍数の情報を更新
    for x in range(a+a, MAX+1, a):
        ok[x] = 0

# 同値が2つ以上ある場合もNGにする
C = Counter(A)
for k, v in C.items():
    if v >= 2:
        ok[k] = 0

# 全部チェックが済んだらあとは見るだけ
ans = 0
for a in A:
    if ok[a]:
        ans += 1
print(ans)


Measured memory_bytes: 54064
fn main() {
    let n: usize = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        buf.trim().parse().unwrap()
    };

    let mut wl: Vec<Work> = (0..n)
        .map(|_| {
            let mut buf = String::new();
            std::io::stdin().read_line(&mut buf).unwrap();
            let mut iter = buf.split_whitespace();
            Work {
                work_time: iter.next().unwrap().parse().unwrap(),
                end_time: iter.next().unwrap().parse().unwrap()
            }
        })
        .collect();

    wl.sort_by(|lw, rw| lw.end_time.cmp(&rw.end_time));
    let mut sum = 0;
    for work in &mut wl {
        sum = sum + work.work_time;
        if sum > work.end_time {
            print!("No");
            std::process::exit(0);
        };
    }
    print!("Yes");
}

struct Work {
    work_time: usize,
    end_time: usize,
}


Measured memory_bytes: 10492
N, K = map(int, input().split())
AA_list = list()

for _ in range(K):
    d = int(input())
    A_list = list(map(int, input().split()))
    AA_list.append(A_list)

#print(AA_list)

ihav_cnt = [0 for _ in range(N) ]
#print(ihav_cnt)

for d, A_list in enumerate(AA_list):
    for a, A in enumerate(A_list):
        ihav_cnt[A-1] = ihav_cnt[A-1]+1

# 0の人をカウント
cnt = 0
for ihav in ihav_cnt:
    if ihav == 0:
        cnt = cnt + 1

print(cnt)


Measured memory_bytes: 9176
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    vi a(5);
    rep(i,6){
        int x;
        cin>>x;
        a[x]++;
    }
    bool f=true;
    rep(i,5)f&=a[i]<3;
    YES(f);
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  static int p = 1000000007;
  
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
    int Y = sc.nextInt();
    if((2*X-Y)%3!=0||(2*Y-X)%3!=0){
      System.out.println(0);
      return;
    }
    int a = (2*Y-X)/3;
    int b = (2*X-Y)/3;
    if(a<0||b<0){
      System.out.println(0);
      return;
    }
    int max = 2000000;

    
    long fac[] = new long[max];
    long finv[] = new long[max];
    long inv[] = new long[max];

// テーブルを作る前処理
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < max; i++){
        fac[i] = fac[i - 1] * i % p;
        inv[i] = p - inv[p%i] * (p / i) % p;
        finv[i] = finv[i - 1] * inv[i] % p;
    }
    
    long answer = COM(a+b,a,fac,finv);
    System.out.println(answer);

    
  }
  // 二項係数計算
    public static long COM(int n, int k,long[] fac,long[] finv){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%p)%p;
}
  

  
}

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

int main() {
  int t=0;
long long int N;
  long long int D;
  cin>>N;
  cin>>D;
long long  b=D*D;
long long a;
vector<long long int>vec(N);  
  vector<long long int>vec2(N); 
  for(int j=0;j<N;j++){cin>>vec.at(j);
                       cin>>vec2.at(j);
a=vec.at(j)*vec.at(j)+vec2.at(j)*vec2.at(j);
if(a<=b){t++;}
}
  cout<<t<<endl;

}



Measured memory_bytes: 6420
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def MI(): return map(int, input().split())


def S(): return input()


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


def print_matrix(mat):
    for i in range(len(mat)):
        print(*mat[i])


YNL = {False: 'No', True: 'Yes'}
YNU = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
# sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']


# show_flg = True
show_flg = False


def main():
    N = I()
    F = []
    P = []

    for i in range(N):
        F.append(LI())

    for i in range(N):
        P.append(LI())

    M = 10
    ans = - (10 ** 19)

    for i in range(2 ** M):
        f = []
        for j in range(M):
            if ((i >> j) & 1):
                f.append(1)
            else:
                f.append(0)

        if not any(f):
            continue

        profit = 0
        for j in range(N):
            c = 0
            for k in range(10):
                if f[k] == 1 and F[j][k] == 1:
                    c += 1
            # print(c, P)
            profit += P[j][c]
        ans = max(ans, profit)
        # print(f)

    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 42604
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define vv vector
#define pp pair
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define fastio                    \
	ios_base::sync_with_stdio(0); \
	cin.tie(0);
typedef pair<ll, ll> pll;
typedef vv<ll> vll;
typedef vv<pll> vpll;
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
//adds two more functions to set
//(1)*(set.find_by_order(k))[kth element in the sorted set]
//(2)set.order_of_key(k)[count of elements strictly less than k]
#define LG(args...)                               \
	{                                             \
		string _s = #args;                        \
		replace(_s.begin(), _s.end(), ',', ' ');  \
		stringstream _ss(_s);                     \
		err(istream_iterator<string>(_ss), args); \
		cerr << endl;                             \
	}
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << "(" << *it << ":" << a << ") ";
	err(++it, args...);
}
//:::::::::::::::::::::::::::::::::::::::::::::
const ll INF = 9e18;
const ll MOD = 1e9 + 7;
// #define dbg

int main(){
	fastio;
	ll n;
	cin>>n;
	ll a[n][3];
	for(ll i=0; i<n; i++){
		cin>>a[i][0]>>a[i][1]>>a[i][2];
	}
	vv<vll> dp(n, vll(3, 0));
	dp[0] = {a[0][0], a[0][1], a[0][2]};
	for(ll i=1; i<n; i++){
		for(ll j=0; j<3; j++){
			dp[i][j] = max(dp[i-1][(j+1)%3] , dp[i-1][(j+2)%3]) + a[i][j];
		}
	}
	cout<<*max_element(all(dp[n-1]));
}

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

int main() {
  int A,B,C,X;
  cin >> A >> B >> C >> X;
  
  int count=0;
  for(int x=0; x<=A; x++){
    for(int y=0; y<=B; y++){
      for(int z=0; z<=C; z++){
        if((x*500 + y*100 + z*50) == X){
          count++;
        }
      }
    }
  }
  cout << count << endl;
}


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

int A[2000];
int n;

int solve(int i,int m){
  if(m==0) return 1;
  if(i>=n) return 0;

  int res=solve(i+1,m)||solve(i+1,m-A[i]);
  return res;
}

int main(void)
{
  int q;
  int M;
  scanf("%d",&n);
  for(int i=0;i<n;i++)scanf("%d",&A[i]);
  scanf("%d",&q);
  for(int i=0;i<q;i++){
    scanf("%d",&M);
    if(solve(0,M))printf("yes\n");
    else printf("no\n");
  }

  return 0;
}



Measured memory_bytes: 2080
#include <bits/stdc++.h>
//#include "Local_Debug.h"
using namespace std;
#define Endl endl
typedef long long ll;
const int MAXN = (int)2e5 + 5;
ll n, m, t, a[MAXN];
ll gcd(ll a, ll b)
{
	return b ? gcd(b, a%b) : a;
}
ll lcm(ll a, ll b)
{
	return a / gcd(a, b)*b;
}
int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	while (cin >> n)
	{
		for (ll i = 1; i <= n&&cin >> a[i]; ++i);
		ll g = a[1];
		for (ll i = 2; i <= n; ++i)
			g = lcm(g, a[i]);
		double fz = 0;
		for (ll i = 1; i <= n; ++i)
			fz += double(g) / double(a[i]);
		cout << double(g) / double(fz) << endl;
	}
}
/*
2
10 30

3
200 200 200

1
1000
*/

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, x;
    cin >> a >> b >> x;
    if(a > x) cout << "NO" << endl;
    else if(a + b >= x) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define numrep(i,n) for(int i=1;i<=n;i++)
#define bitrep(n) for(int bit=0;bit<(1<<n);bit++)
#define ll int64_t
#define all(v) v.begin(), v.end()

const int MOD = 1000000007;

int main() {

ll N; cin>>N;

vector<int> h(N+2);

rep(i,N) cin >> h[i] ;//input

ll ans=0;

rep(i,N){
  while(h[i]>0){
  int j=0,x=100;
    while(h[i+j]>0){
      if(i+j>=N) break;
      x=min(x,h[i+j]);
      j++;
    }
  for(int k=i;k<=i+j;k++){
    h[k]-=x;
  }
  ans+=x;
  }
}
  
cout << ans << endl;

return 0;
}

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

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

using namespace std;
using ll = long long;

void solve();

int main(void){
    ll N, P;
    cin >> N >> P;
    //g**N % P = 0 なる最大のg
    //gはどこまで調べるか: g**N >= P -> log g >= (log p)/N -> g >= a**(log p)/N a = 10として, N <= 4までは自力でやりたい
    if(N == 1) cout << P << endl;
    else{
        int ans = 1;
        int g = 2;
        int flg = 1;
        while(flg == 1){
            ll val = 1;
            //g**Nを作る
            rep(i, N){
                val *= g;
                if(val > P){
                    flg = 0;
                    break;
                }
            }
            if(flg == 1 && (P % val) == 0){
                ans = g;
            }
            g++;
        }
        cout << ans << endl;
    }
    return 0;
}

void solve(){}

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

const int ms = 100100;

int freq[ms];
int a[ms];

int main()
{
	int n;
	std::cin >> n;
	for(int i = 0; i < n; i++)
	{
		std::cin >> a[i];
		freq[a[i]]++;
	}
	std::sort(a, a + n);
	bool valid = false;
	if(a[0] == a[n - 1])
	{
		if(a[0] ==  n - 1)
			valid = true;
		else if(a[0] > n / 2)
			valid = false;
		else
			valid = true;
	}
	else if(a[0] + 1 != a[n - 1])
	{
		valid = false;
	}
	else
	{
		freq[0] = a[0] - freq[a[0]] + 1;
		n -= freq[a[0]];
		//std::cout << "freq is now " << freq[0] << '\n';
		//std::cout << "n is now " << n << '\n';
		if(n <= 1)
			valid = false;
		else if(freq[0] > n / 2 || freq[0] <= 0)
			valid = false;
		else
			valid = true;
	}
	if(valid)
		std::cout << "Yes\n";
	else
		std::cout << "No\n";
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <sstream>
#include <cmath>
#include <set>
#include <map>
#include <stack>
using namespace std; 

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define len(x) ((int)(x).size())
#define tmax(a,b,c) max((a),max((b),(c)))
#define tmin(a,b,c) min((a),min((b),(c)))
#define debug(x) cerr << #x << " is " << x << endl;
#define debug2(x,y) cerr << #x << " is " << x << " " << #y << " is " << y << endl;
#define debugg(g,h,w) rep(i,0,h) { rep(j,0,w) cout << g[i][j] << " "; cout << endl;}
#define debugv(v) for(auto&& x : v){cout << x << " ";} cout << endl;

typedef pair<int, int> Pii;
typedef map<int, int> Mii;
typedef vector<int> Vi;
typedef vector<vector<int> > VVi;
typedef long long ll;
const int inf = 2e9;
const ll ll_inf = 1e17;
const int mod = 1e9 + 7;
const long double eps = 1e-10;
typedef pair<ll, ll> Pll; 

bool opt(pair<double, string>  &lhs, pair<double, string>  &rhs) 
{
	if (lhs.first == rhs.first) return lhs.second < rhs.second;
	else return lhs.first > rhs.first;
} 

int main()
{
	int n;
	while (cin >> n && n) {
		vector<pair<double, string> > v(n);
		rep(i,0,n) {
			string l;
			int a,b,c,d,e,f,s,m,p;
			cin >> l >> p >> a >> b >> c >> d >> e >> f >> s >> m;
			double x = f*m * s - p;
			//printf("price = %lf, time = %d\n",x, (a+b+c)+m*(d+e));
			x /= (a+b+c) + m*(d+e);
			v[i] = mp(x,l);
			//printf("%s = %lf\n",l.c_str(),x);
		}
		sort(all(v), opt);
		rep(i,0,n) cout << v[i].second << endl;
		cout << "#" << endl;
	}

	return 0;
}

Measured memory_bytes: 3040
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int main(void){
	int k,a,b;
	scanf("%d %d %d",&k,&a,&b);
	if(b-a+1>=k||b%k<a%k||b%k==0||a%k==0){
		printf("OK");
	}else{
		printf("NG");
	}
}

Measured memory_bytes: 1712
/*
THINGS TO DO
1) Check integer overflows
2) Check corner cases
3) Compile and run once on terminal
4) Code smart, not quick
*/

#ifndef ONLINE_JUDGE
	#define _GLIBCXX_DEBUG
	#include "debug.cpp"
#endif

#include <bits/stdc++.h>
using namespace std;

void dfs(vector<int> graph[], int visited[], int v){
	visited[v] = 1;
	for(auto x: graph[v]){
		if(visited[x] == 0)
			dfs(graph, visited, x);
	}
}


int32_t main(){
	int n, m, i, j;
	cin >> n >> m;
	vector<int> graph[n];
	for(i=0; i<m; i++){
		int u, v;
		cin >> u >> v;
		u--; v--;
		graph[u].push_back(v);
		graph[v].push_back(u);
	}

	int ans = -1;
	int visited[n] = {0};
	for(i=0; i<n; i++){
		if(visited[i] == 1)
			continue;
		dfs(graph, visited, i);
		ans++;
	}

	cout << ans << "\n";


}

//Read the stuff at the top

Measured memory_bytes: 10380
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
ll dx[4] = { 0, 1, 0, -1 };
ll dy[4] = { 1, 0, -1, 0 };
const ll INF = LLONG_MAX;
const ll MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll a, b;
    cin >> a >> b;
    int ans = (a - b * 2 > 0) ? a - b * 2 : 0;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

long long gcd(long long a, long long b) {
	if(a < b) {
		long long tmp = a;
		a = b;
		b = tmp;
	}
	while(a % b) {
		/* a = n*b + r */
		/* a -> b, b -> r */
		long long r = a % b;
		a = b;
		b = r;
	}
	
	return b;
}
int main() {
	int N;
	cin >> N;
	long long lcd = 1;
	for(int i = 0; i < N; i++) {
		long long T;
		cin >> T;
		lcd = T / gcd(lcd, T) * lcd;
	}
	cout << lcd << endl;
	return 0;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#include <iomanip>  //setprecision(桁)
using namespace std;
#define pb push_back
#define ll long long int
#define rep(i,n) for(int i = 0;i < n;i++)
#define INF 1e+9
const ll MOD = 1000000007;

struct edge {
    int to;
    ll cost;
};

// <最短距離, 頂点の番号>
using P = pair<double, int>;

int V;
const int ci = 2e5+ 5;
vector<edge> G[ci];
double d[ci];

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d+V, INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;
        for (int i=0; i<G[v].size(); i++) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    COMinit();
    int n, k; cin >> n >> k;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end());

    ll ans = 0;
    for(int i = 0; i < n - k + 1; i++){
        ll c = COM(n - 1 - i, k - 1);
        ll A = (a[n-1-i] - a[i]) % MOD;
        ans += (c * A) % MOD;
    }
    cout << ans % MOD << endl;
}


Measured memory_bytes: 19200
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String[] arr = reader.readLine().split(" ");
        int H = Integer.parseInt(arr[0]);
        int A = Integer.parseInt(arr[1]);
        System.out.println(H % A != 0 ? H / A + 1 : H / A);
    }
}

Measured memory_bytes: 21332
#include <bits/stdc++.h>
#define ll long long
#define REP(i, n) for (ll i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (ll i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define fi first
#define se second
#define pb push_back
#define debug(x) cerr << #x << ": " << (x) << endl
#define int long long
using namespace std;
using II = pair<int, int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
template <class T = int> inline T in() { T x; cin >> x; return x; }
template <class T = int> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <class T = int> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template <class T> ostream& operator<<(ostream &s, const vector<T>& d) { int n = d.size(); REP (i, n) s << d[i] << " "; return s; }
template <class T> ostream& operator<<(ostream &s, const vector<vector<T>>& dd) { for (vector<T> d: dd) s << d << endl; return s; }
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); } } fast;
const int MOD = 1e9 + 7;
const int MAX_I = 33;

signed main() {
  int N = in();
  VI xs(N), ys(N);
  VI Xs(N), Ys(N);
  REP (i, N) {
    int x, y; cin >> x >> y;
    xs[i] = x; ys[i] = y;
    Xs[i] = x + y; Ys[i] = x - y;
  }
  REP (i, N - 1) {
    if ((Xs[i] - Xs[i + 1]) % 2) {
      cout << -1 << endl; return 0;
    }
  }
  VI ds;
  for (int i = MAX_I; i >= 0; i--) {
    ds.push_back(1ll << i);
  }

  auto type = [&](bool X, bool Y) {
    if (X && Y) return 'R';
    if (X && !Y) return 'U';
    if (!X && Y) return 'D';
    if (!X && !Y) return 'L';
    assert(0);
  };
  vector<string> anss;
  REP (i, N) {
    string ans;
    int tmp_x = Xs[i] + ((1ll << MAX_I + 1) - 1);
    int tmp_y = Ys[i] + ((1ll << MAX_I + 1) - 1);
    for (int d: ds) {
      ans += type(tmp_x >= 2 * d, tmp_y >= 2 * d);
      if (tmp_x >= 2 * d) tmp_x -= 2 * d;
      if (tmp_y >= 2 * d) tmp_y -= 2 * d;
    }
    if (Xs[0] % 2 == 0) {
      ans += "R";
    }
    anss.push_back(ans);
  }
  if (Xs[0] % 2 == 0) {
    ds.push_back(1);
  }
  cout << ds.size() << endl;
  for (int d: ds) {
    cout << d << ' ';
  }
  cout << endl;
  REP (i, anss.size()) {
    string ans = anss[i];
    int x = 0, y = 0;
    REP (i, ans.size()) {
      if (ans[i] == 'R') x += ds[i];
      if (ans[i] == 'L') x -= ds[i];
      if (ans[i] == 'U') y += ds[i];
      if (ans[i] == 'D') y -= ds[i];
    }
    assert(x == xs[i]);
    assert(y == ys[i]);
    assert(ans.size() == ds.size());
    cout << ans << endl;
  }
}


Measured memory_bytes: 512
while True:
    n = int(input())
    if n == 0: break

    *s,= list(map(int, input().split()))
    m = sum(s) / n
    v = 0
    for i in s:
        v += (i - m) ** 2
    ans = (v / n) ** (1/2)
    print(ans)


Measured memory_bytes: 5660
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())

string s, t;

void solve() {
  VI a[50];
  cin >> s >> t;
  REP(i, SZ(s)) a[s[i]-'a'].push_back(i);
  LL now = 0;
  LL rep = 0;
  REP(i, SZ(t)) {
    if (SZ(a[t[i]-'a']) == 0) {
      cout << -1 << endl;
      return;
    }
    int next_index = lower_bound(ALL(a[t[i]-'a']), now) - a[t[i]-'a'].begin();
    if (next_index >= SZ(a[t[i]-'a'])) {
      now = 0;
      rep++;
      next_index = 0;
      // REP(j, 50) next_use[j] = 0;
    }
    now = a[t[i]-'a'][next_index]+1;
  }
  cout << SZ(s)*rep + now<< endl;
}

int main() {
	solve();
	return 0;
}


Measured memory_bytes: 1148
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 200005


ll fact[SIZE],inv_fact[SIZE];

ll mod_pow(ll x,ll count, ll mod){

	if(count == 0)return 1;
	ll ret = mod_pow((x*x)%mod,count/2,mod);
	if(count%2 == 1){

		ret = (ret*x)%mod;
	}
	return ret;
}

ll extgcd(ll a,ll b,ll &x,ll &y){
	ll d = a;
	if(b != 0){
		d = extgcd(b,a%b,y,x);
		y -= (a/b)*x;
	}else{
		x = 1;
		y = 0;
	}
	return d;
}

ll mod_inverse(ll a,ll m){
    ll x,y;
    extgcd(a,m,x,y);
    return (m+x%m)%m;
}

ll nCk(ll n,ll k){

	ll ret = fact[n]*inv_fact[k];
	ret %= MOD;
	ret *= inv_fact[n-k];

	return ret%MOD;
}



int main(){

	fact[0] = 1;
	for(ll i = 1; i < SIZE; i++){
		fact[i] = i*fact[i-1];
		fact[i] %= MOD;
	}
	inv_fact[SIZE-1] = mod_inverse(fact[SIZE-1],MOD);
	for(ll i = SIZE-1; i >= 1; i--){

		inv_fact[i-1] = inv_fact[i]*i;
		inv_fact[i-1] %= MOD;
	}

	ll N,K;
	scanf("%lld %lld",&N,&K);

	ll R = N-K;

	for(ll i = 1; i <= K; i++){

		if(R < (i-1)){
			printf("0\n");
			continue;
		}

		ll blue = nCk(K-1,i-1);
		ll red = nCk(R+1,i);

		printf("%lld\n",(blue*red)%MOD);
	}

	return 0;
}


Measured memory_bytes: 3328
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#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 ll mod = 100000000000000003;
int ne[200001], he[10001];
char C[1200100];

ll num[524300];
int kazu[524300];
const int ma = (1 << 19) - 1;
int query(ll n) {
	int n2 = (n & ma) + 1;
	while (num[n2]) {
		if (num[n2] == n + 1) return kazu[n2];
		n2 = n2 * 61 + 1 & ma;
	}
	return 0;
}
void add(ll n, int b) {
	int n2 = (n & ma) + 1;
	while (num[n2]) {
		if (num[n2] == n + 1) {
			kazu[n2] |= b;
			return;
		}
		n2 = n2 * 61 + 1 & ma;
	}
	num[n2] = n + 1;
	kazu[n2] = b;
}

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


	fread(C, 1, 1200100, stdin);
	char* ci = C, c;
	int N = 0;
	while ((c = *ci++) >= '0') N = N * 10 + c - '0';

	ll dekai[100];
	int d = 0;
	char* s[200001];
	rep1(i, N) {
		s[i] = ci;
		while (*ci++ >= '0');
		int n = ci - s[i] - 1;	
		if (n <= 100000) {
			ne[i] = he[n];
			he[n] = i;
		}
		else {
			dekai[d++] = (ll(n) << 30) + s[i] - C;
		}
	}

	ll kotae = 0;

	for (int M = 1; M <= 10000; M++) {
		for (int p = he[M]; p; p = ne[p]) {
			auto S = s[p];
			int k[26] = {};
			ll are = 0;
			for (int i = M - 1; i >= 1; i--) {
				int tmp = query(are);
				if (tmp) {
					rep(j, 26) if ((tmp >> j & 1)) {
						k[j]++;
					}
				}
				kotae += k[S[i] - 'a'];
				k[S[i] - 'a'] = 0;
				are = (are * 30 + S[i] - 'a' + 1) % mod;
			}

			kotae += k[S[0] - 'a'];
			k[S[0] - 'a'] = 0;

			add(are, 1 << (S[0] - 'a'));
		}
	}
	sort(dekai, dekai + d);
	rep(p, d) {
		auto S = C + (dekai[p] & (1 << 21) - 1);
		int k[26] = {};
		ll are = 0;
		for (int i = (dekai[p] >> 30) - 1; i >= 1; i--) {
			int tmp = query(are);
			if (tmp) {
				rep(j, 26) if ((tmp >> j & 1)) {
					k[j]++;
				}
			}
			kotae += k[S[i] - 'a'];
			k[S[i] - 'a'] = 0;
			are = (are * 30 + S[i] - 'a' + 1) % mod;
		}

		kotae += k[S[0] - 'a'];
		k[S[0] - 'a'] = 0;

		add(are, 1 << (S[0] - 'a'));
	}
	printf("%lld\n", kotae);


	Would you please return 0;
}

Measured memory_bytes: 11116
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}



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

  string S; cin >> S;
  string T; 
  
  rep(i, S.size()){
    if(S[i] == 'd'){
      if((S[i+5] == 'e') && (S[i+7] != 'a')){
	i+=6;
	T+= "dreamer";
      }
      else{
	i+=4;
	T+="dream";
      }
    }
    else if (S[i] == 'e' ) {
      if(S[i+5] == 'r'){
	i+=5;
	T+="eraser";
      }
      else{
	i+=4;
	T+="erase";
      }
    }
    else{
      cout << "NO" << endl;
      return 0;
    }
  }
  
  if(T==S) cout << "YES" << endl;
  else cout << "NO" << endl;
  
  //cout << fixed << setprecision(16) << ans << endl;
  return 0;
}


Measured memory_bytes: 592
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;

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

    double ans = 0;
    rep(i, 0, n)
    {
        int a;
        cin >> a;
        ans += (double) 1/ a;
    }

    ans = (double) 1 / ans;
    printf("%.10f\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl

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

    vector<int> p(n);
    for(int i = 0; i < n; i++){
        cin >> p[i];
    }

    vector<int> diff(n,0);
    int ans = 1;
    for(int i = 0; i < n-1; i++){
        if(p[i+1]-p[i]>0){
            diff[i+1] = diff[i]+1;
        }else{
            diff[i+1] = 0;
        }
        if(diff[i+1]>=k-1){
            ans = 2;
        }
    }
    if(diff[k-1] == k-1){
        ans--;
    }

    set<int> st;
    for(int i = 0; i < k; i++){
        st.insert(p[i]);
    }
    int kmin = *st.begin();
    int kmax = *(--st.end());\
    for(int i = 0; i < n-k+1-1; i++){
        if(p[i] != kmin || p[i+k] < kmax){
            if(diff[i+k]<k-1){
                ans++;
            }
        }
        st.erase(p[i]);
        st.insert(p[i+k]);
        kmin = *st.begin();
        kmax = *(--st.end());
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 11136
#include <stdio.h>
#define TEAM_MAX 300

int main() {
  int n;
  int i, j;
  struct team {
    int I;
    int U;
    int A;
    int P;
  } t[TEAM_MAX], ttemp;
  int senbatsu[1001];
  int senbatsuAll;

  while(1) {
    scanf("%d", &n);
    if(n == 0) break;
    for(i = 0; i < n; i++) {
      scanf("%d %d %d %d", &t[i].I, &t[i].U, &t[i].A, &t[i].P);
    }

    for(i = n-1; i > 0; i--) {
      for(j = 0; j < i; j++) {
	if(t[j+1].I < t[j].I) {
	  ttemp = t[j+1];
	  t[j+1] = t[j];
	  t[j] = ttemp;
	}
      }
    }
    for(i = n-1; i > 0; i--) {
      for(j = 0; j < i; j++) {
	if(t[j+1].P < t[j].P) {
	  ttemp = t[j+1];
	  t[j+1] = t[j];
	  t[j] = ttemp;
	}
      }
    }
    for(i = n-1; i > 0; i--) {
      for(j = 0; j < i; j++) {
	if(t[j+1].A > t[j].A) {
	  ttemp = t[j+1];
	  t[j+1] = t[j];
	  t[j] = ttemp;
	}
      }
    }

    for(i = 0; i < 1001; i++) senbatsu[i] = 0;
    senbatsuAll = 0;
    for(i = 0; i < n; i++) {
      if((senbatsuAll < 10 && senbatsu[t[i].U] < 3) ||
	 (senbatsuAll < 20 && senbatsu[t[i].U] < 2) ||
         (senbatsuAll < 26 && senbatsu[t[i].U] == 0)) {
	printf("%d\n", t[i].I);
	senbatsuAll++;
	senbatsu[t[i].U]++;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 0
s = int(input())
l = 10**9+7
list_1 = [0, 1, 1, 1]
list_2 = [0, 1, 2]
for i in range(3, s):
  list_2.append((list_2[i-1] + list_1[i])%l)
  list_1.append(list_2[i-2])
if s == 1 or s == 2:
  print(0)
else:
  print(list_1[s-1])



Measured memory_bytes: 9188
import java.util.*;

class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String input = sc.nextLine();
String ajitama =  String.valueOf(input.charAt(0));
String chashu = String.valueOf(input.charAt(1));
String negi = String.valueOf(input.charAt(2));
int price = 0;

if(ajitama.equals("o")){
price += 100;
}
if(chashu.equals("o")){
price += 100;
}
if(negi.equals("o")){
price += 100;
}
price += 700;

System.out.println(price);
}
}

Measured memory_bytes: 23636
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <stack>
#include <set>
#include <algorithm>
#include <sstream>
#include <map>
#include <unordered_map>
using namespace std;


using vc = vector<char>;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

void process(const string& t) {
}

int main() {
  string s;
  int x, y;
  int k;
  long long n;
  while (cin >> n) {
    string ans;
    while (n) {
      ans += (n-1)%26 + 'a';
      n = (n-1) / 26;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
  }
  return 0;
}


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

using namespace std;

typedef long long ll;

int main(){

	int v[4];
	
	for(int i=0; i<3; i++) scanf("%d", &v[i]);
	
	sort(v, v+3);
	int ans=0;
	for(int i=1; i<3; i++) ans+=v[i]-v[i-1];
	printf("%d\n", ans);


}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>
#include <list>
#include <stdio.h>
#include <sstream>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define _upgrade ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const ll mod = 1e9 + 7;
const ll inf = 1<<29;
const long double pi = 3.14159265358979323846;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

// ****************************************CODE***************************************//


int n;
ll h[100010];
ll dp[100010];

ll rec(int num){
    if(dp[num] < inf) return dp[num];

    if(num == 0) return 0;

    ll res = inf;
    res = min(res, rec(num-1) + abs(h[num] - h[num-1]));
    if(num>1) res = min(res, rec(num-2) + abs(h[num] - h[num-2]));

    return dp[num] = res;
}

int main() {
    int n;
    cin >> n;
    for(int i = 0; i < n; i++) cin >> h[i];

    for(int i = 0; i < 100010; i++) dp[i] = inf;

    cout << rec(n-1) << endl;
}

Measured memory_bytes: 4992
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define endl "\n"
typedef long long ll;
#define traceV(v) for(auto x:v)cout<<x<<" ";cout<<endl
#define traceM(mp) for(auto x:mp)cout<<x.first<<" "<<x.second<<endl

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

  ll N; cin>>N;

  ll res = 11;
  for(ll i=1; i*i<=N; i++) {
    if(N%i != 0) continue;

    ll v = max(i, N/i);
    ll cnt = 0;
    while(v) {
      v/=10;
      ++cnt;
    }

    res = min(res, cnt);
  }

  cout << res <<endl;

  return 0;
}


Measured memory_bytes: 256