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

typedef long long ll;
typedef int64_t i6;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define Sort(x) sort(x.begin(), x.end())
#define Sort_rev(x) sort(x.begin(), x.end(), greater<int>())
#define ALL(v) (v).begin(), (v).end()

//π M_PI
//deg = rad*180/M_PI

int main() {
    ll h, n;
    cin >> h >> n;
    ll a[n];
    ll ans = 0;
    rep(i, n) {
        cin >> a[i];
        ans += a[i];
    }

    cout << (ans >= h ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int, int> pii;
#define MAX 99999999
int main(){
    int n;cin>>n;
    char c; scanf("%c",&c);
    rep(p,n){
        string s;
    getline(cin,s);
        rep(i,s.length()){
        int b=(int)s.find("Hoshino",i);
        if(b!=-1){s.replace(b,7,"Hoshina");i+=6;}
    }
        cout<<s<<endl;
    }
}

Measured memory_bytes: 3220
#pragma GCC optimize "-O3"
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define F first
#define S second
#define pb push_back
#define pp pop_back
#define VI vector<int>

using namespace std;

VI pr[1010101];
int tk[1010101];

int main(){

	cin.tie(0);
	ios_base::sync_with_stdio(0);

	int n;
	cin >> n;
	VI a(n);
	for(int i=0; i<n; i++){
		cin >> a[i];
		tk[a[i]]++;
	}
	for(int i=2; i<=1000000; i++){
		if(!tk[i]) continue;
		for(int j=2*i; j<=1000000; j+=i) pr[j].pb(i);
	}
	sort(a.begin(), a.end());

	int ans = 0;
	for(int i=0; i<n; i++){
		if(tk[a[i]] > 0) tk[a[i]] = -tk[a[i]];
		if(abs(tk[a[i]]) > 1 || tk[1]) continue;
		bool ok = 1;
		for(int j : pr[a[i]]){
			if(tk[j] < 0) ok = 0;
		}
		if(ok) ans++;
	}

	tk[1] = abs(tk[1]);
	if(tk[1] == 1) ans = 1;
	if(tk[1] > 1) ans = 0;
	
	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 112360
#include <cstdio>
#include <iostream>
#include <algorithm>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

bool isOK(int n) {
  REP(i, n) {
    int rest = n - 4*i;
    if(rest >= 0 && rest % 7 == 0) {
      return true;
    }
  }
  return false;
}

int main(void) {
  int N;
  cin >> N;
  bool ok = isOK(N);
  cout << (ok ? "Yes" : "No") << endl;
  return 0;
}


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

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define Return(expr) { Cout(expr); return 0; }
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, a, b, c, d);
    Cout((a+b+c <= 21) ? "win" : "bust");
}

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

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  sort(a.begin(), a.end());
  cout << a[n / 2] - a[(n / 2) - 1] << '\n';
}


Measured memory_bytes: 640
#include <stdio.h>
#include <iostream>
#include <cassert>
#include <algorithm>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <deque>

#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define irep(i,a,b) for(int i=(a);i>=(b);i--)

using namespace std;
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;



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

  int P, Q, R;

  cin >>  P >> Q >> R;


  int ans = P + Q;
  ans = min(ans, Q+R);
  ans = min(ans, P+R);

  cout << ans << endl;


}


Measured memory_bytes: 256
// We only fail when we stop trying
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()

const int N = 1e5 + 5;

int n, m;
vector<int> g[N];
int dp[N];

int dfs(int u) {
  int& r = dp[u];
  if(r != -1) return r;
  r = 0;
  for(int v : g[u]) {
    r = max(r, 1 + dfs(v));
  }
  return r;
}

int main()
{
  cin >> n >> m;
  for(int i = 0 ; i < m ; i++) {
    int x, y;
    cin >> x >> y;
    --x, --y;
    g[x].pb(y);
  }
  memset(dp, -1, sizeof dp);
  int best = 0;
  for(int i = 0 ; i < n ; i++)
    best = max(best, dfs(i));
  cout << best << endl;
  return 0;
}


Measured memory_bytes: 7424
<?php
// {{{ get input module
// debug input file name
define('DEBUG_FILENAME', 'input.txt');
/* first module start (setup $input) */
if(file_exists(DEBUG_FILENAME)) 
{
    $inputs = explode("\n---\n", file_get_contents(DEBUG_FILENAME));
    define('DEBUG', TRUE);
} else 
{
    $inputs = array(file_get_contents('php://stdin'));
    define('DEBUG', FALSE);
}
foreach ($inputs as $i => $input) {
    if (DEBUG) {
        echo "\n----- {$i} -----\n";
        $time_start = microtime(true);
    }
    solve($input);
    if (DEBUG) {
        $time_end = microtime(true);
        $time = $time_end - $time_start;
        echo sprintf("\n[%.5fms]", $time * 1000);
    }
}
// }}} -end

function solve($input) {
    echo ($input * $input * $input) . PHP_EOL;
}

Measured memory_bytes: 6600
N = int(input())
a = list(map(int, input().split(" ")))
b = list(map(int, input().split(" ")))
a_cnt, b_cnt = 0, 0

for i in range(N):
    # aiをbiに近づける
    if a[i] < b[i]:
        num = (b[i] - a[i] + 1) // 2
        a_cnt += num
        a[i] += 2 * num

for i in range(N):
    # biをaiに近づける
    if b[i] < a[i]:
        b_cnt += (a[i] - b[i])

if a_cnt >= b_cnt:
    print("Yes")
else:
    print('No')

Measured memory_bytes: 4600
#include<iostream>
#include<cmath>
#include<complex>
#include<cstdlib>
#include<algorithm>
#include<functional>
using namespace std;
typedef unsigned long long ull;
ull kai(int);

int main() {
    int n,m;
    cin>>n>>m;
    if(n==m){
        cout<<(kai(n)*kai(m)*(ull)2)%1000000007<<endl;
    }else if(abs(n-m)==1){
        cout<<(kai(n)*kai(m))%1000000007<<endl;
    }else{
        cout<<0<<endl;
    }
    return 0;
}
ull kai(int x){
    ull ans=1;
    for(int i=x;i>1;i--){
        ans*=i;
        ans%=1000000007;
    }
    return ans;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, k, r, s, p;
  string t;
  cin >> n >> k >> r >> s >> p >> t;
  
  int ans = 0;
  vector<char> x(t.size());
  for(int i = 0; i < t.size(); i++){
    if(i < k){
      if(t[i] == 'r'){
        x.at(i) = 'p';
        ans += p;
      }
      else if(t[i] == 's'){
        x.at(i) = 'r';
        ans += r;
      }
      else{
        x.at(i) = 's';
        ans += s;
      }
    }
    else{
      if((t[i] == 'r' && x.at(i - k) == 'p') || (t[i] == 's' && x.at(i - k) == 'r') || (t[i] == 'p' && x.at(i - k) == 's')){
        x.at(i) = 'a';
      }
      else{
        if(t[i] == 'r'){
          x.at(i) = 'p';
          ans += p;
        }
        else if(t[i] == 's'){
          x.at(i) = 'r';
          ans += r;
        }
        else{
          x.at(i) = 's';
          ans += s;
        }
      }
    }
  }
  
  cout << ans << '\n';
}

Measured memory_bytes: 512
S = input()
n = len(S)
x = 10 ** 9 + 7
a = [1,0,0,0,0,0,0,0,0,0,0,0,0]

c = [1, -3, -4, -1, 3, 4]
for i in range(n):
    b = [0] * 13
    p = i % 6
    if S[n - i - 1] == "?":
        for j in range(13):
            for k in range(10):
                b[j] += a[(j - c[p] * k) % 13]
            b[j] = b[j] % x
        a = b
    else:
        s = int(S[n - i - 1])
        for j in range(13):
            b[j] = a[(j - c[p] * s) % 13]
        a = b
print(a[5])

Measured memory_bytes: 43244
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end())
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 1e5;
int n, a[N];

main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  FOR(i, 0, n){
    cin >> a[i];
    a[i]--;
  }
  int ans = 0;
  FOR(i, 0, n) if(a[a[i]] == i) ans++;
  cout << ans/2 << endl;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0;}
template<class T>bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0;}

using ll = long long;
using R = long double;
const R EPS = 1e-9; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r) {return (r > EPS) - (r < -EPS);}
inline R sq(R x) {return sqrt(max<R>(x, 0.0));}

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

// Problem Specific Parameter:
template <int depth>  struct Segment_tree {
	const static int h = depth;
	const static int n = 1 << h;

	using T = long long;
	T data[2 * n];
	const T out = 0LL;

	inline T vmerge(T l, T r) {return l + r;}

	void init() {
		fill_n(data, 2 * n, out);
	}

	void update(int p, T x) { // set value at position p
		for (data[p += n] += x; p > 1; p >>= 1) {
			data[p >> 1] = vmerge(data[p], data[p ^ 1]);
		}
	}

	T query(int l, int r) {  // sum on interval [l, r)
		T resl = out, resr = out;
		for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
			if (l & 1) resl = vmerge(data[l++], resl);
			if (r & 1) resr = vmerge(resr, data[--r]);
		}
		return vmerge(resl, resr);
	}
};

Segment_tree<17> rsq;

int main(void) {
	int n, q;
	cin >> n >> q;

	rsq.init();

	rep(loop, q) {
		int com, x, y;
		cin >> com >> x >> y;
		if (com)
			cout << rsq.query(x, y + 1) << endl;
		else
			rsq.update(x, y);
	}
	return 0;
}

Measured memory_bytes: 5140
import java.io.*;
import java.util.*;
 
public class Main {
 
    public static void main(String[] arg) throws NumberFormatException, IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer strToke;
        String line;
        long gcd; // ?????§??¬?´???°
        long lcm; // ????°???¬?????°
 
        // ab = gcd * lcm
        while ((line = in.readLine()) != null) {
            strToke = new StringTokenizer(line);
            long a = Integer.parseInt(strToke.nextToken());
            long b = Integer.parseInt(strToke.nextToken());
            long aStock = new Long(a).longValue();
            long bStock = new Long(b).longValue();
            int c;
            while (a != b) {
                if (a > b) {
                    a = a - b;
                } else {
                    b = b - a;
                }
            }
            gcd = a;
            lcm = (aStock * bStock) / gcd;
 
            System.out.println(gcd + " " + lcm);
        }
    }
}

Measured memory_bytes: 24044
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <utility>
using namespace std;
const int inf = 1e9;

vector<bool> used;
vector<string> op;
vector<vector<int> > adj;
int minmax(int cur, int depth, int val, int x, int y){
	int ret = (depth%2==0)? -inf: inf;
	for(int i=0; i<(int)adj[cur].size(); i++){
		int next = adj[cur][i];
		if(used[next]) continue;
		
		int xy = (op[next][4] == 'X')? x: y;
		int nval;
		if(op[next][3]=='&') nval = val & xy;
		if(op[next][3]=='|') nval = val | xy;
		if(op[next][3]=='^') nval = val ^ xy;
		
		used[cur] = true;
		if(depth%2==0){
			ret = max(ret, minmax(next, depth+1, nval, x, y));
		}else{
			ret = min(ret, minmax(next, depth+1, nval, x, y));
		}
		used[cur] = false;
	}
	if(ret==inf || ret==-inf) ret = val;
	return ret;
}
	
int main(){
	int n,m;
	cin >> n >> m;
	op.resize(n);
	adj.resize(n);
	for(int i=1; i<n; i++) cin >> op[i];
	for(int i=0; i<n-1; i++){
		int u,v;
		cin >> u >> v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	
	used = vector<bool>(n, false);
	map<pair<int, int>, int> opt;
	for(int i=0; i<7; i++){
		for(int j=0; j<7; j++){
			opt[make_pair(i, j)] = minmax(0, 0, 0, i, j);
		}
	}
	
	for(int i=0; i<m; i++){
		int x,y;
		cin >> x >> y;
		vector<pair<int,int> > mxy(3);
		mxy[0].first = x -(x&y);
		mxy[1].first = y -(x&y);
		mxy[2].first = x&y;
		for(int j=0; j<3; j++) mxy[j].second = j;
		sort(mxy.begin(), mxy.end());
		
		int nx=0, ny=0;
		for(int j=0; j<3; j++){
			if(mxy[j].second == 0) nx |= 1<<j;
			if(mxy[j].second == 1) ny |= 1<<j;
			if(mxy[j].second == 2){
				nx |= 1<<j;
				ny |= 1<<j;
			}
		}
		int ret = opt[make_pair(nx, ny)];
		
		int ans = 0;
		for(int j=0; j<3; j++){
			if((ret&(1<<j)) != 0) ans |= mxy[j].first;
		}
		cout << ans << endl;
	}
	return 0;
}

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

signed main(){
  int N;
  cin>>N;
  int ans=1;
  while(ans*ans<=N)ans+=1;
  ans-=1;
  cout<<ans*ans<<endl;
  return 0;
}

Measured memory_bytes: 3644
'use strict'

function main(input) {
  const parsed = parseInput(input);
  printPossibility(canReachGoal(parsed.ships, parsed.goal));
}

function parseInput(input) {
  const inputLines = input.split('\n');
  const goal = inputLines.shift().split(' ')[0];
  const ships = inputLines.map(line => line.split(' '));
  return {goal, ships};
}
  
function canReachGoal(ships, goal) {
  const reachableIslandMap = {};
  const oneStepIslands = [];
  ships.forEach(ship => {
    if (ship[0] === '1') {
      oneStepIslands.push(ship[1]);
    }
    if (ship[1] === goal) {
      reachableIslandMap[ship[0]] = true;
    }
  });
  return oneStepIslands.some(island => reachableIslandMap[island]);
}

function printPossibility(isPossible) {
  console.log(isPossible ? 'POSSIBLE' : 'IMPOSSIBLE');
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 84944
#include<bits/stdc++.h>
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) << " "

int main(){
    int n,k;cin>>n>>k;
    vector<int> v(n,0);
    rep(i,k){
        int c;cin>>c;
        rep(i,c){
            int tmp;cin>>tmp;
            v[tmp-1]++;
        }
    }
    int ans =0;
    for(auto i=v.begin();i!=v.end();i++){
        if(*i==0)ans++;
    }
    co(ans);
}

Measured memory_bytes: 3592
import math
n = int(input())

A = []
def koch(d, p1, p2):
    rot = math.radians(60)
    if d == 0:
        return 0
    else:
        s = ((2.0 * p1[0] + p2[0]) / 3.0, (2.0 * p1[1] + p2[1]) / 3.0)
        t = ((2.0 * p2[0] + p1[0]) / 3.0, (2.0 * p2[1] + p1[1]) / 3.0)
        ux = (t[0] - s[0]) * math.cos(rot) - (t[1] - s[1]) * math.sin(rot) + s[0]
        uy = (t[0] - s[0]) * math.sin(rot) + (t[1] - s[1]) * math.cos(rot) + s[1]
        u = (ux, uy)
        koch(d-1, p1, s) 
        print(s[0], s[1])
        koch(d-1, s, u)
        print(u[0], u[1])
        koch(d-1, u, t)
        print(t[0], t[1])
        koch(d-1, t, p2)

p1 = (0.0, 0.0)
p2 = (100.0, 0.0)
print(p1[0], p1[1])
koch(n, p1, p2)
print(p2[0], p2[1])


Measured memory_bytes: 5784
import java.util.*;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] arr = new int[n][2];
        for (int i = 0; i < n; i++) {
            arr[i] = new int[]{i, sc.nextInt()};
        }

        Arrays.sort(arr, (a1, a2) -> a2[1] - a1[1]);
//        debug(arr);

        long[][] dp = new long[n + 1][n + 1];
        for (long[] x : dp) {
            Arrays.fill(x, -1);
        }
        dp[0][0] = 0;
        // dp[i][j] ... 左からi人、右からj人並べた場合のうれしさの最大値

        for (int k = 0; k < n; k++) {
            int x = arr[k][0];
            long a = (long) arr[k][1];
            for (int i = 0; i <= k; i++) {
                int j = k - i;
                if (dp[i][j] == -1) continue;
                dp[i + 1][j] = Math.max(dp[i + 1][j], dp[i][j] + a * Math.abs(x - i));
                dp[i][j + 1] = Math.max(dp[i][j + 1], dp[i][j] + a * Math.abs((n - 1 - j) - x));
            }
//            debug(dp);
        }
//        debug(dp);
        long ans = -1;
        for (int i = 0; i <= n; i++) {
            ans = Math.max(ans, dp[i][n - i]);
        }
        System.out.println(ans);
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


Measured memory_bytes: 77440
/* Bismillahirrahmanirrahim */
/* Author : Jehian Norman Saviero (@Reiva5) */
#include <bits/stdc++.h>

/* MACROS SAMPAH */
#define Jehian using
#define Norman namespace
#define Saviero std
#define cepet {ios_base::sync_with_stdio(0);cin.tie(0);}

Jehian Norman Saviero;

/* MACROS FOR TYPE */
typedef long l;
typedef long double ld;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<l,l> pl;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pld;

/* MACROS FOR PRINT */
#define nl printf("\n")
#define sp printf(" ")

/* MACROS FOR FUNCTION AND METHOD */
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define eb emplace_back
#define RESET(x) memset((x), 0, sizeof(x))
#define SET(x,y) for(int _je = sizeof(x)/sizeof(x[0]); _je--;) x[_je] = y
#define SQR(x) (x)*(x)
#define CUBE(x) SQR(x)*(x)
#define ALL(x) (x).begin(), (x).end()
#define ALLSIZE(x,n) (x), (x)+(n)

/* MACROS FOR ATTRIBUTE */
#define fi first
#define se second

/* MACROS FOR SCAN */
#define scc(x) scanf("%c", &x)
#define scd(x) scanf("%Lf", &x)
#define scf(x) scanf("%f", &x)
#define sci(x) scanf("%d", &x)
#define scl(x) scanf("%ld", &x)
#define scll(x) scanf("%lld", &x)
#define scld(x) scanf("%Lf", &x)
#define scui(x) sci(x)
#define scul(x) scl(x)
#define scull(x) scll(x)

typedef pair<ll,pll> special;

int main(){
	ll N;
	scll(N);
	ll M[2][N];
	for (ll i = 0; i < 2; ++i){
		for (ll j = 0; j < N; ++j){
			scll(M[i][j]);
		}
	}
	ll dp[2][N];
	RESET(dp);
	dp[0][0] = M[0][0];
	for (ll i = 1; i < N; ++i){
		dp[0][i] = dp[0][i-1] + M[0][i];
	}
	dp[1][N-1] = M[1][N-1];
	for (ll i = N-2; i >= 0; --i){
		dp[1][i] = dp[1][i+1] + M[1][i];
	}
	for (ll i = 0; i < 2; ++i){
		for (ll j = 0; j < N; ++j){
			cerr << dp[i][j] << " ";
		}
		cerr << endl;
	}
	ll MAX = dp[0][0] + dp[1][0];
	for (ll i = 0; i < N; ++i){
		MAX = max(MAX,dp[0][i] + dp[1][i]);
	}
	cout << MAX << endl;
	return 0;
}

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

#define TRUE 1
#define FALSE 0

/* int isPrime(int n){ */
/*     int i; */
/*     if(n==1) return FALSE; */
/*     for(i=2; i<(n/2)+1; i++){ */
/*         if (n % i == 0){ */
/*             return FALSE; */
/*         } */
/*     } */
/*     return TRUE; */
/* } */

int isPrime(int x){
    if (x == 2) return TRUE;
    if(x<2 || x%2 == 0) return FALSE;
    int i = 3;
    while (i<=sqrt(x)){
        if(x%i==0) return FALSE;
        i = i + 2;
    }
    return TRUE;
}

int main(){
    int i, n, s, cnt=0;
    int data[10000];
    scanf("%d", &n);
    for(i=0;i<n;i++) scanf("%d", &data[i]);
    for(i=0;i<n;i++){
        if(isPrime(data[i])) cnt++;
    }
    printf("%d\n", cnt);
    return 0;
}

Measured memory_bytes: 632
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ai = [-1] * n
bi = [-1] * n
r = [-1] * n
ai[0]=a[0]
bi[-1]=b[-1]
for i in range(1,n):
  if a[i] > a[i-1]:
    ai[i] = a[i]
for i in range(n-2,-1,-1):
  if b[i] > b[i+1]:
    bi[i] = b[i]
ret = 1
r = [0] * n
for i in range(n):
  if ai[i]!=bi[i] and ai[i]!=-1 and bi[i]!=-1:
    print(0)
    exit()
  elif ai[i]==-1 and bi[i]==-1:
    ret *= min(a[i], b[i])
    ret %= 10**9+7
  else:
    r[i]=max(ai[i], bi[i])
x = 0
for i in range(n):
  x = max(x, r[i])
  if x!=a[i]:
    print(0)
    exit()
x = 0
for i in range(n-1, -1, -1):
  x = max(x, r[i])
  if x!=b[i]:
    print(0)
    exit()
print(ret)

Measured memory_bytes: 25368
import java.util.*;

/**
 * Problem C: Brave Princess Revisited
 */
public class Main {

	static final int INF = 1 << 29;

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		while (sc.hasNext()) {

			int N, M, L;
			N = sc.nextInt();
			M = sc.nextInt();
			L = sc.nextInt();
			if ((N | M | L) == 0) break;

			Map<Integer, List<Edge>> G = new HashMap<>();

			for (int i = 0; i < M; i++) {
				int A, B, D, E;
				A = sc.nextInt();
				B = sc.nextInt();
				D = sc.nextInt();
				E = sc.nextInt();
				G.putIfAbsent(A, new ArrayList<>());
				G.putIfAbsent(B, new ArrayList<>());
				G.get(A).add(new Edge(B, D, E));
				G.get(B).add(new Edge(A, D, E));
			}

			//???????????¨ -> [?????´][????????????]
			int[][] D = new int[N + 1][L + 1];
			Queue<int[]> pq = new PriorityQueue<>((x, y) -> Integer.compare(x[2], y[2]));

			for (int i = 0; i < D.length; i++) Arrays.fill(D[i], INF);
			D[1][L] = 0;
			pq.offer(new int[]{1, L, 0});

			while (!pq.isEmpty()) {

				int s, l, min;
				s = pq.peek()[0];
				l = pq.peek()[1];
				min = pq.peek()[2];
				pq.poll();

				if (D[s][l] < min) continue;

				outer:
				for (Edge e : G.get(s)) {
					for (int i = 0; i <= L; i++) {
						if (D[e.to][i] > D[s][i] + e.enemy) {
							D[e.to][i] = D[s][i] + e.enemy;
							pq.offer(new int[]{e.to, i, D[e.to][i]});
						}
						if (i >= e.distance) {
							if (D[e.to][i - e.distance] > D[s][i]) {
								D[e.to][i - e.distance] = D[s][i];
								pq.offer(new int[]{e.to, i - e.distance, D[e.to][i - e.distance]});
							}
						}
					}
				}
			}

			int min = INF;

			for (int i = 0; i <= L; i++) {
				min = Math.min(min, D[N][i]);
			}

			System.out.println(min);
		}
	}
}

class Edge {

	int to, distance, enemy;

	public Edge(int to, int distance, int enemy) {
		this.to = to;
		this.distance = distance;
		this.enemy = enemy;
	}
}

Measured memory_bytes: 83960
#include<bits/stdc++.h>
#define rep(i,k,n)     for (ll i = k; i < n; ++i)
#define repr(i,k,n)    for (ll i = k; i >= n; --i)
#define repp(p,a)      for (p=a.begin();p!=a.end();++p)
#define all(a)         a.begin(),a.end()
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define reppn(p,a,n)    for (p=a.begin();(p+n)!=a.end();++p)
#define F              first
#define S              second
#define ll             long long
#define hell           1000000007
#define god            LLONG_MAX
#define lb             lower_bound
#define ub             upper_bound
#define pb             push_back
#define ct             continue
#define endl           '\n'
#define setprecision(n) sp(n)
#define srt(a)         sort(all(a))
#define srtd(a)        sort(a.rbegin(),a.rend())
#define sz(a)          ll((a).size())
#define sum(a)         accumulate(all(a),(ll) 0)
#define pdt(a)         accumulate(all(a),double(1),multiplies<double> ())
#define dotpdt(a,b)    inner_product(all(a),b.begin(),0)
#define mkp(a,b)       make_pair(a,b)
#define REP(x,s)       for (auto x : s)
using namespace std;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ll t=1;
  //cin>>t;
  while(t--)
  {
     string s;
     cin>>s;
     rep(i,0,s.size())
     {
         cout<<"x";
     }
  }      
 
 
 return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <numeric>




typedef long long ll;
#define PI 3.14159265359
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define _GLIBCXX_DEBAC
#include <functional>
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/
//copy(v1.begin(), v1.end(), back_inserter(v2));
using namespace std;

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

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

int sort_greater(int m,int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(),greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
		return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t,sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}

bool is_prime(int x) {
	if (x <= 1) return false;
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

const ll mod = 1000000007;


map<string, int> memo;

using P=pair<int, int>;




/*void dfs(int v, int p = -1) {
	for (int u : to[v]) {
		if (u == p) continue;
		ans[u] += ans[v];
		dfs(u, v);
	}
}*/

ll nCr(ll n, ll r) {
	ll a = 1;
	for (ll i = n; i > n - r; --i) {
		a = a * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		a = a / i;
	}
	return a;
}

void comb(vector<vector <long long int> >& v) {
	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
		}
	}
}


int main() {
	ll n, t, a;
	cin >> n >> t >> a ;
	ll ans=0,b=1e8;
	for (ll i = 1; i <= n; i++) {
		ll x;
		cin >> x;
		ll c = abs(t*1000 - x * 6 - a * 1000);
		if (b > c) {
			b = c; ans = i;
		}
	}
	cout << ans << endl;
	return 0;
}













Measured memory_bytes: 256
import std.stdio;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;
 
void main() {
    int N;
    char[][] F;
    bool input() {
        scanf("%d\n", &N);
        if (N == 0) return false;
        F = new char[][N];
        foreach (i; 0 .. N) F[i] = cast(char[])(readln.chomp);
        return true;
    }
    void solve() {
        foreach (i; 1 .. N) {
            auto level = F[i].countUntil!("a != '.'");
            F[i][level - 1] = '+';
            for (long j = i - 1; j >= 0 && F[j][level - 1] == '.'; j--) {
                F[j][level - 1] = '|';
            }
        }
        foreach (i; 0 .. N) {
            foreach (ref c; F[i]) {
                if (c == '.') c = ' ';
            }
        }
        foreach (ref L; F) L.writeln;
    }
    while (input) solve;
}

Measured memory_bytes: 2280
#include <bits/stdc++.h>
using namespace std;
using Int = long long unsigned int;
typedef pair<int,int> P;
Int const MOD=100000000007;

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    
    Int n,wm; cin>>n>>wm; Int w[n],v[n],dp[n+1][100001];
    fill(dp[0],dp[n+1],MOD); dp[0][0]=0;
    for (int i = 0; i < n; i++)cin>>w[i]>>v[i];
    for (int i = 0; i < n; i++){
        for (int j = 0; j <= 100000; j++){
            if(j<v[i])dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
            else dp[i+1][j]=min(dp[i+1][j],min(dp[i][j],dp[i][j-v[i]]+w[i]));
        }
    }
    for (int i = 100000; i >= 0; i--){
        if(dp[n][i]<=wm){cout<<i<<'\n'; break;}
    }
}

Measured memory_bytes: 79232
#include<iostream>
#include<math.h>
#include<stdio.h>
#include<map>
using namespace std;
int main() {
	int A;
	int B;
	cin >> A >> B;
	if (A+B==3)
		cout << "3" << endl;
	if (A + B == 4)
		cout << "2" << endl;
	if (A + B == 5)
		cout << "1" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i < (n+1); ++i)
const double PI  =3.141592653589793238463;
using namespace std;
using ll = long long;
const ll INF = +10010010000;
typedef pair<int,int> P;
const int mod = 1e9+7;

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

    // for prime mod
    mint inv() const {
      return pow(mod-2);
    }
    mint& operator/=(const mint a){
      return (*this) *= a.inv();
    }
    mint operator/(const mint a)const{
      mint res(*this);
      return res/=a;
    }
};

struct combination{
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1){
    fact[0] = 1;
    for(int i = 1; i<n;++i)fact[i] = fact[i-1] * i;
    ifact[n] = fact[n].inv();
    for(int i = n; i>=1;--i) ifact[i-1] = ifact[i] * i;
  }
  mint operator()(int n, int k){
    if(k<0 || k>n)return 0;
    return fact[n] * ifact[k] + ifact[n-k]; 
  }
};

int main(){
    string s;
    cin >> s;
    cout << s[0]<<s[1]<<s[2]<<endl;
    return 0;
}

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

int main(){
  int N;
  cin >> N;
  if(N==1){
    cout << "Hello World" << endl;
    return 0;
  }else{
    int a,b;
    cin >> a >> b;
    int ans = a+b;
    cout << ans << endl;
    return 0;
  }
  return 0;
}


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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define ALL(c) (c).begin(), (c).end()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;

int main() {
    ll n, t;
    cin >> n >> t;
    ll ans = 0;
    ll m;
    ll p;
    cin >> p;
    REP(i, n - 1) {
        cin >> m;
        if (m - p < t) {
            ans += m - p;
        } else {
            ans += t;
        }
        p = m;
    }
    cout << ans + t << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

    public String next() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int k = sc.nextInt();
    while (b <= a) {
      b *= 2;
      k--;
    }
    while (c <= b) {
      c *= 2;
      k--;
    }
    if (k >= 0) System.out.println("Yes");
    else System.out.println("No");
  }
}

Measured memory_bytes: 32776
import java.util.*;
import static java.lang.Math.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        double a = scan.nextInt();
        double b = scan.nextInt();
        double h = scan.nextInt();
        double m = scan.nextInt();
        double ans;
        
        //角速度（分針）
        //System.out.println(Math.PI);
        //double m1 = 2*(Math.PI)/3600;
        
        //角速度（時針）
        //double h1 = 2*(Math.PI)/43200;
        
        //分針と時針が作る角度
        //角速度（時針）

        double k = Math.abs(5.500000000000000000000000000*m-30.000000000000000000000000000*h);
        //System.out.println(k);
        if(k>180 && k!=360){
            //k=k-180;
            ans= Math.sqrt(a*a+b*b-2*a*b*(Math.cos(Math.toRadians(k))));
        }else if(k<180){
            ans= Math.sqrt(a*a+b*b-2*a*b*(Math.cos(Math.toRadians(k))));
        }else if(k==180){
            ans=a+b;
        }else{
             ans = Math.abs(a-b);
        }
        System.out.println(ans);
    }
}
        

Measured memory_bytes: 36040
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

template<typename type> vector<type> divisor(type n)
{
    vector<type> res;
    for(type i = 1; i * i <= n; i++)
    {
        if(n % i == 0)
        {
            res.push_back(i);
            if(i * i != n) res.push_back(n / i);
        }
    }
    sort(res.begin(), res.end());
    return res;
}
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> A(n + 1);
    for(int i = 1; i <= n; i++) cin >> A[i];

    vector<int> sum(n + 1, 0), cnt(n + 1, 0);
    for(int i = n; i >= 1; i--)
    {
        if(sum[i] % 2 == A[i]) continue;
        cnt[i] = 1;
        vector<int> divisors = divisor(i);
        for(int j = 0; j < divisors.size(); j++) sum[divisors[j]]++;
    }

    vector<int> check(n + 1, 0);
    for(int i = 1; i <= n; i++)
    {
        check[i] = sum[i] % 2;
    }
    if(check != A)
    {
        cout << -1 << endl;
        return 0;
    }

    vector<int> ans;
    for(int i = 1; i < cnt.size(); i++)
    {
        if(cnt[i]) ans.push_back(i);
    }

    cout << ans.size() << endl;
    if(ans.size() > 0)
    {
        for(int i = 0; i < ans.size(); i++) cout << ans[i] << " "; cout << endl;
    }
    return 0;
}



Measured memory_bytes: 4600
#include<iostream>
using namespace std;
int N,A,B;
string s;
main()
{
	cin>>N>>A>>B>>s;
	int ca=0,cb=0;
	for(int i=0;i<N;i++)
	{
		if(s[i]=='a')
		{
			if(ca<A+B)
			{
				ca++;
				cout<<"Yes"<<endl;
			}
			else
			{
				cout<<"No"<<endl;
			}
		}
		else if(s[i]=='b')
		{
			if(ca<A+B&&cb<B)
			{
				ca++;cb++;
				cout<<"Yes"<<endl;
			}
			else
			{
				cout<<"No"<<endl;
			}
		}
		else
		{
			cout<<"No"<<endl;
		}
	}
}


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

int main(){
    int N;
    std::cin >> N;
    bool ans = 0;
    for(auto i = 100; i > 0; i /= 10){
        int tmp = N / i;
        if(tmp == 7){
            ans = 1;
            break;
        }
        N %= i;
    }

    std::string S = ans ? "Yes" : "No";
    std::cout << S << std::endl;

    return 0;
}


Measured memory_bytes: 3592
#include <stdio.h>
int main(void){
    // Your code here!
    char S[5];
    scanf("%s",S);
    if(S[0]==S[1] && S[2]==S[3] && S[0]!=S[3])
    {
        printf("Yes\n");
    }
    else if(S[0]==S[2] && S[1]==S[3] && S[0]!=S[3])
    {
        printf("Yes\n");
    }
    else if(S[0]==S[3] && S[1]==S[2] && S[0]!=S[2])
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
}


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

import sys
from math import gcd

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

K = INT()

ans = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        ij = gcd(i, j)
        for k in range(1, K+1):
            ans += gcd(ij, k)
print(ans)


Measured memory_bytes: 67736
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) {
    
    new Main().run();
  }

  public void run() {

    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      String op;
      String[] words;
      Tree tree = new Tree();

      for(int i=0,k=0; i<n; i++,k=0){
        words = br.readLine().split(" ");
        op  = words[k++];
        if ( op.equals("insert") ) { 
          tree.insert(Integer.parseInt(words[k++]));
        }
        else {
          tree.dispRoundPath();
        }
      }

    }
    catch(IOException e) {
      System.out.println("IOException!");
    }
  }
}

class Tree {

  static final BTreeNode NIL = new BTreeNode(-1);
  BTreeNode root;
  StringBuilder buf;

  public Tree() {
    root = NIL;
    buf = new StringBuilder();
  }

  public void insert(int val) {
    BTreeNode y = NIL;
    BTreeNode x = root;
    BTreeNode z = new BTreeNode(val);

    while( !x.equals(NIL) ) {
      y = x;
      if( z.key < x.key )
        x = x.left;
      else
        x = x.right;
    }
    z.parent = y;

    if( y.equals(NIL) ){
      root = z;
    }
    else if( z.key < y.key )
      y.left = z;
    else
      y.right = z;
  } 
  void preParse(BTreeNode u) {
    if( !u.equals(NIL) ) {
      buf.append(" ").append(u.key);
      preParse(u.left);
      preParse(u.right);
    }
  }
  void inParse(BTreeNode u) {
    if( !u.equals(NIL) ) {
      inParse(u.left);
      buf.append(" ").append(u.key);
      inParse(u.right);
    }
  }

  void dispRoundPath() {

    inParse(root);
    buf.append("\n");
    preParse(root);
    buf.append("\n");

    System.out.print(buf);
    buf.setLength(0);
  }
}

class BTreeNode {
  int key;
  BTreeNode parent,left,right;

  public BTreeNode(int key) {
    this.key = key;
    this.parent =
    this.left =
    this.right = Tree.NIL;
  }

  @Override
  public boolean equals(Object o) {
    if(o == this) return true;
    if(o == null) return false;
    if(!(o instanceof BTreeNode)) return false;

    BTreeNode node = (BTreeNode)o;
    if(!(this.key == node.key)) return false;

    return true;
  }
}


Measured memory_bytes: 125836
import Data.Char

c s = (tail s) ++ [head s]
j s = (last s):(init s)
e s =
  let l = length s
      n = l `div` 2
      h = take n s
      t = drop (l-n) s
  in
    if odd l
    then t ++ (s!!n):h
    else t ++ h
      
a = reverse
p [] = []
p (s:r) =
  let s' = if isDigit s
           then intToDigit $ (\x -> mod (x-1) 10) $ digitToInt s
           else s
  in
    s':(p r)

m [] = []
m (s:r) =
  let s' = if isDigit s
           then intToDigit $ (\x -> mod (x+1) 10 ) $ digitToInt s
           else s
  in
    s':(m r)

c2f [] = []
c2f (x:y) = f:(c2f y)
  where 
    f = case x of
      'J' -> j
      'C' -> c
      'E' -> e
      'A' -> a
      'P' -> p
      'M' -> m

exe s [] = s
exe s (f:fs) = exe (f s) fs

ans' c s =
  let f = c2f $ reverse c
  in
    exe s f

ans [] = []
ans (c:s:r) =
  let a = ans' c s
  in
    a:(ans r)

main = do
  _ <- getLine
  c <- getContents
  let i = lines c
      o = ans i
  mapM_ putStrLn o



Measured memory_bytes: 3720
#include <stdio.h>

int countUp(int *a, int d, int n) {
	int i,count=0; 
	for (i = 0; i < n; i++) {
		if (a[i] == d)
			count++;
	}
	return count;
}

int main(void) {

	int a[100], b[50];
	int n = 0, temp;
	int maxCount = 1,count;
	int i, j, k=0;

	while (scanf("%d", &a[n]) != EOF) {
		n++;
	}

	for (i = 0; i < n-1; i++) {
		for (j = i+1; j < n; j++) {
			if (a[i] >= a[j]) {
				temp = a[i];
				a[i] = a[j];
				a[j] = temp;
			}
		}
	}

	for (i = 0; i < n; i++) {

		if (a[i] != a[i + 1]) {

			count = countUp(a,a[i],n);
			if (count >= maxCount) {
				maxCount = count;
			}
		}
	}


	for (i = 0; i < n; i++) {
		if (a[i] != a[i + 1]) {
			if (countUp(a, a[i], n) == maxCount) {
				b[k] = a[i];
				k++;
			}
		}
	}

	
	for (i = 0; i < k; i++) {
		printf("%d\n",b[i]);
	}

	return 0;
}

Measured memory_bytes: 596
day = ['Wednesday','Thursday', 'Friday', 'Saturday', 'Sunday', 'Monday', 'Tuesday', 'Wednesday']
month = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]


m, d = [int(i) for i in input().split()]
while m != 0:
    sum = 0
    for i in range(0, m - 1):
        sum += month[i]
    sum += d
    print(day[sum % 7])
    m, d = [int(i) for i in input().split()]

Measured memory_bytes: 7716
//
// Created by moono on 2018/10/27.
//

#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;



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


    unsigned long long power = 1, threshold = 1000000007;
    for (int i = 1; i <= N; ++i) {
        power *= i;
        if(power > threshold){
            power = power % threshold;
        }

//        cout << i << " - " << power << endl;
    }

    cout << power % threshold << endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def solve(string):
    string = string.split("\n")
    n, m = map(int, string[0].split())
    ans = {i + 1 for i in range(m)}
    for loves in string[1:]:
        ans &= set(map(int, loves.split()[1:]))
    return str(len(ans))


if __name__ == '__main__':
    base = input()
    n, m = map(int, base.split())
    tmp = [base]
    for _ in range(n):
        tmp.append(input())
    print(solve('\n'.join(tmp)))


Measured memory_bytes: 38384
S = input()
K = 'keyence'

if S.startswith(K) or S.endswith(K):
    print('YES')
    exit()

l = 0
r = -1

while True:
    break_flag = False

    if S[l] == K[l]:
        l += 1
    else:
        break_flag = True

    if S[r] == K[r]:
        r -= 1
    elif break_flag:
        print('NO')
        break

    if l > 7 + r:
        print('YES')
        break


Measured memory_bytes: 3060