akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(){

    int n,m;
    scanf(" %d %d",&n,&m);
    int A[n][m],b[m];

    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            scanf(" %d",&A[i][j]);
        }
    }
    for(int j=0;j<m;j++){
        scanf(" %d",&b[j]);
    }

    int Ans[n];

    for(int i = 0;i<n;i++){
        Ans[i] = 0;
    }
    for(int i = 0;i<n;i++){
        for(int j=0;j<m;j++){
            Ans[i] += A[i][j]*b[j];
        }
    }
    for(int i = 0;i<n;i++){
        printf("%d\n",Ans[i]);
    }
    
    

    return 0;
}



Measured memory_bytes: 2784
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;

int n;

int main(){
    map<int, int> m;

    cin >> n;

    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        auto key = m.find(a);
        if (key != m.end()) {
            m[a]++;
        } else {
            m[a] = 1;
        }
    }

    int ans = 0;
    for (auto itr = m.begin(); itr != m.end(); ++itr) {
        int a = itr->first;
        int cnt = itr->second;
        //cout << a << ", " << cnt << ", " << abs(a - cnt) << endl;
        ans += cnt >= a ? cnt - a : cnt;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4736
#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 100005

ll N,M;
vector<ll> V;
ll ruiseki[SIZE];

bool isOK(ll num){

	if(V[0]*2 < num)return false;

	ll ret = 1;

	int left = 1,right = V.size()-1,mid = (left+right)/2;
	int R = 0;

	while(left <= right){

		if(V[0]+V[mid] >= num){

			R = mid;
			left = mid+1;
		}else{

			right = mid-1;
		}
		mid = (left+right)/2;
	}

	if(R == 0){

		return ret >= M;
	}
	ret += 2*R;

	for(int i = 1; i < N; i++){
		if(V[i]*2 < num)break;

		ret++;

		while(V[i]+V[R] < num)R--;

		if(R == i)break;

		ret += (R-i)*2;
	}

	return ret >= M;
}

int main(){

	scanf("%lld %lld",&N,&M);

	ll tmp;

	for(int i = 0; i < N; i++){
		scanf("%lld",&tmp);
		V.push_back(tmp);
	}

	sort(V.rbegin(),V.rend());

	ruiseki[0] = 0;

	for(int i = 0; i < V.size(); i++){
		ruiseki[i+1] = V[i];
		ruiseki[i+1] += ruiseki[i];
	}

	ll left = 0,right = 2*V[0],mid = (left+right)/2;
	ll base_num;

	while(left <= right){

		if(isOK(mid)){

			base_num = mid;
			left = mid+1;
		}else{

			right = mid-1;
		}
		mid = (left+right)/2;
	}

	ll ans = 0;
	ll num = 0;
	int R = V.size()-1;

	for(int i = 0; i < N; i++){
		if(V[i]*2 < base_num+1)break;

		ans += 2*V[i];
		num++;

		while(V[i]+V[R] < base_num+1)R--;
		if(R == i)break;

		ans += 2*(ruiseki[R+1]-ruiseki[i+1]);

		num += (R-i)*2;
		ans += (R-i)*2*V[i];
	}

	ans += base_num*(M-num);

	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 1908
#coding: UTF-8
import math
N=int(input())
def prime_list(k):
    lis=[True for i in range(1,k+1)]
    lis[0]=False
    for i in range(2,k+1):
        j=2
        while j*j<=i:
            if i%j==0:
                lis[i-1]=False
                break
            else:
                j+=1
    return lis
#    print(lis)
def p_fact(k,N,plist):
#    plist=prime_list(k)
    lis=[0]*N
    for i in range(0,k):
        n=0
        if plist[i]:
            while k%(i+1)==0:
                n+=1
                k=k/(i+1)
        lis[i]=n
    return lis
#    print(lis)
out_lis=[0]*N
plist=prime_list(N)
for i in range(1,N+1):
    input_lis=p_fact(i,N,plist)
    out_lis=[out_lis[j]+input_lis[j] for j in range(0,N)]
#print(out_lis)
out=1
for i in range(0,N):
    out=out*(out_lis[i]+1)
#print(out%1000000007)
print(out%(10**9+7))

Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
using namespace std;
 
int main (void) {
  int N,K;
  cin >> N >> K;
  int A[N]={0};
  for (int i=0; i<=N-1; i++) {
    int a;
    cin >> a;
    A[a-1]++;
  }
  sort(A, A+N);
  int n=0;
  for (int i=0; i<=N-1; i++) {
    if (A[i] > 0) {
      n=n+1;
    }
  }
  int ans=0;
  int l=0;
  while(K < n) {
    if (A[l] >0){
      ans= ans+ int(A[l]);
      n=n-1;
    }
    l=l+1;
  }
  cout << ans;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
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; }

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
	int K;
	string S;
	cin >> K;
	cin >> S;
	if (S.size() <= K) {
		cout << S << endl;
		return;
	}
	cout << S.substr(0, K) << "..." << endl;
}

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


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

const int64_t MOD = 1000000007;
typedef int64_t ll;
typedef uint64_t ull;

#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

/* 
  //エラトステネスのふるい
  int maxNum = 100000;
  char isNotPrime[maxNum+1] = {};
  isNotPrime[0]=isNotPrime[1]=1;
  for(int i=2;i<maxNum;i++){
    if(isNotPrime[i]==1) continue;
    int num = i+i;
    while(num<=maxNum){
      isNotPrime[num]=1;
      num += i;
    }
  }
*/
// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

// 降順ソート vector<int> v;
// sort(v.begin(),v.end(),greater<int>());

signed main() {
  string s;
  cin >> s;

  if('s'==s[s.length()-1]){
    cout << s << "es" << endl;
  }
  else{
    cout << s << "s" << endl;
  }

  return 0;
}



Measured memory_bytes: 3720
import Control.Monad
import Control.Applicative
import Data.List

matrixMul m1 m2 = map (\arow -> map (sum . zipWith (*) arow) (transpose m2)) m1

myPrint = mapM_ (putStrLn . unwords . map show)

main = do
    [n,m,l] <- map read . words <$> getLine :: IO [Int]
    m1 <- replicateM n $ map (read :: String->Int) . words <$> getLine :: IO [[Int]]
    m2 <- replicateM m $ map (read :: String->Int) . words <$> getLine :: IO [[Int]]
    myPrint $ matrixMul m1 m2

Measured memory_bytes: 12228
#define _USE_MATH_DEFINES

#include<iostream>
#include<string>
#include<math.h>
#include<stdio.h>

using namespace std;

int main()
{
    int a,b,C;
    cin>>a>>b>>C;

    double S,L,h;

    h = b * sin(M_PI* C /180);
    S = a*h/2;
    L = a + b + pow(pow(a,2) + pow(b,2) - 2*a*b*cos(M_PI*C/180),0.5);

    printf("%.4f\n", S);
    printf("%.4f\n", L);
    printf("%.4f\n", h);
    return 0;
}

Measured memory_bytes: 1268
// char と int の型のあれこれで面倒なことになってしまった
alias Tuple!(int, char) Pair;
void main(){
	int n, m;
	readf("%d %d\n", &n, &m);
	// 条件を保存
	Pair[] pair;
	foreach(i; 0..m){
		int s;
		char c;
		readf("%d %c\n", &s, &c);
		pair ~= Pair(s, c);
	}
	int ans = -1;
	foreach(i; 0..10^^3){
		if(i.to!string().length != n )continue;
		// 各条件に合うか調べていく
		bool isAcc = true;
		foreach(elm; pair){
			string tmp = i.to!string();
			if(tmp[elm[0]-1]!=elm[1].to!char()){
				isAcc = false;
				break;
				}
		}
		// 全ての条件に一致する
		if(isAcc){
			ans = i;
			break;
			}
	}
	ans.writeln();
}

import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math, std.typecons;

// 1要素のみの入力
T _scan(T= int)(){return to!(T)( readln().chomp() );}
// 1行に同一型の複数入力
T[] _scanln(T = int)(){
	T[] ln;
	foreach(string elm; readln().chomp().split()){
		ln ~= elm.to!T();
	}
	return ln;
}



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

#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
 
Int INF = 1e18;
int inf = 1e9;
Int mod = 1e9+7;

int main() {
    string s;
    cin >> s;
    cout << s.substr(0, 4) << " " << s.substr(4) << endl;
    return 0;
}

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

using namespace std;

const int maxn=1e7+10;
const int NIL=-1;

struct node{
    int location,l,r;
};

struct point{
    int id,x,y;
    friend bool operator <(const point &a,const point &b){
        return a.id<b.id;
    }
};

void print(point a)
{
    printf("%d\n",a.id);
}

int n,np;
point p[maxn];
node t[maxn];

bool lessx(const point p1,const point p2){return p1.x<p2.x;}
bool lessy(const point p1,const point p2){return p1.y<p2.y;}
//建造KDtree
int makekdtree(int l,int r,int depth)
{
    if(!(l<r)){
        return NIL;
    }
    int mid=(l+r)>>1;
    int T=np++;
    if(depth%2==0){
        sort(p+l,p+r,lessx);
    }else{
        sort(p+l,p+r,lessy);
    }
    t[T].location=mid;
    t[T].l=makekdtree(l,mid,depth+1);
    t[T].r=makekdtree(mid+1,r,depth+1);
    return T;
}

void find(int v,int sx,int tx,int sy,int ty,int depth,vector<point>&ans)
{
    int x=p[t[v].location].x;
    int y=p[t[v].location].y;
    if(sx<=x&&x<=tx&&sy<=y&&y<=ty){
        ans.push_back(p[t[v].location]);
    }
    if(depth%2==0){
        if(t[v].l!=NIL){
            if(sx<=x){
                find(t[v].l,sx,tx,sy,ty,depth+1,ans);
            }
        }
        if(t[v].r!=NIL){
            if(x<=tx){
                find(t[v].r,sx,tx,sy,ty,depth+1,ans);
            }
        }
    }else{
        if(t[v].l!=NIL){
            if(sy<=y){
                find(t[v].l,sx,tx,sy,ty,depth+1,ans);
            }
        }
        if(t[v].r!=NIL){
            if(y<=ty){
                find(t[v].r,sx,tx,sy,ty,depth+1,ans);
            }
        }
    }
}

int main()
{
    int x,y;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d%d",&x,&y);
        p[i].id=i;
        p[i].x=x;
        p[i].y=y;
        t[i].l=t[i].r=NIL;
    }
    np=0;
    int root=makekdtree(0,n,0);
    int q;
    scanf("%d",&q);
    int sx,tx,sy,ty;
    vector<point>ans;
    for(int i=0;i<q;i++){
        scanf("%d%d%d%d",&sx,&tx,&sy,&ty);
        ans.clear();
        find(root,sx,tx,sy,ty,0,ans);
        sort(ans.begin(),ans.end());
        for(int j=0;j<ans.size();j++){
            print(ans[j]);
        }
        printf("\n");
    }
    return 0;
}




Measured memory_bytes: 14464
//#include "stdafx.h"
#include "iostream"
#include "fstream"
#include "algorithm"
#include "iomanip"
#include "stack"
#include "queue"
#include "string"
#include "vector"
#include "map"
#include "set"
#include "list"
#include "deque"
#include "complex"
#include "bitset"
#include "cmath"
#include "unordered_set"
#include "unordered_map"
#include "iterator"
#include <ctime>
#include <cassert>
#include "numeric"
#include <cstdio>
#include "random"
#include "chrono"
#include "cstring"

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target_ans("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;

//#define f(i,n) for(int i=0; i<n;i++)
//#define rf(i, n) for(int i=n-1;i>=0;i--)
//#define forn(i, j, n) for(int i=j; i<n; i++)
//#define ff(i, j, n) f(i, n)f(j, n)
#define pb push_back
#define maxi(a,b) a = max(a, b);
#define mini(a,b) a = min(a, b);
#define endl '\n'

#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sqr(x) ((x) * (x))
#define SZ(a) ((int)(a.size()))
#define watch(x) cout << (#x) << " = " << x << endl;
//typedef long long ll;
typedef long double ld;

#define int long long
//#define int unsigned int
#define double ld
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<pii> vpii;
typedef vector<char> vc;
typedef vector<vi> vvi;

template<class T>
void show(const vector<T> &a)
{
	for (T x : a)
		cout << x << " ";
	cout << endl;
}

vi xx = { 0, 0, -1, 1 };
vi yy = { -1, 1, 0, 0 };
string dir = "LRUD";

const int N = 3e5 + 50, oo = 3e18 + 500;
const int mod = 998244353;
//const int mod = 1e9 + 7;
//const int mod = 1e9 + 9;
const double eps = 1e-9, PI = 2 * acos(0.0);
int n, m, k;
long long cnt = 0;
int lg = 18;
vi g[N];
vi rg[N];
vi visit(N, 0);



signed main()
{
	ios::sync_with_stdio(0);
	cout.tie(0); cin.tie(0);
	/*freopen("abbreviation.in", "r", stdin);
	freopen("abbreviation.out", "w", stdout);*/
	//ПРОВЕРЯЙ ДЕФАЙНЫ ТУПОЙ!!!

	
	double a, b, h, m;

	cin >> a >> b >> h >> m;

	double yh = 0, xh = a;
	double ym = 0, xm = b;

	h += m / 60;
	double val = fabs(h/12 - m/60);
	val = min(val, 1.0 - val);
	double gamma = 2 * PI * val;

	//cout << val * 360.0 << endl;

	double x = xm*cos(gamma);
	double y = xm*sin(gamma);

	xm = x;
	ym = y;

	double dist = sqrt(sqr(xm - xh) + sqr(ym - yh));
	cout << fixed << setprecision(12) << dist;
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    ll H; cin >> H;
	ll res = 0;
	int i=0;
	while(1){
		ll j=pow(2,i);
		if(j > H) break;
		res += j;
		i++;
	}

	cout << res << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 4352
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES {cout<<"YES"<<'\n';}
#define NO {cout<<"NO"<<'\n';}
#define Yes {cout<<"Yes"<<'\n';}
#define No {cout<<"No"<<'\n';}
#define yes {cout<<"yes"<<'\n';}
#define no {cout<<"no"<<'\n';}
void YN(bool flg){cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg){cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) {cout << n << '\n';}
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
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; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
int ABS(int a) {if(a<0) a = -a; return a;}
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n /= 2; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数の個数*/int divisor_number(int n){auto p = prime_factor(n); int res = 1; for(auto x:p)res*=(x.second+1); return res;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

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

    string s; cin >> s;
    cout << 2018 << s.substr(4,s.size()-3) << endl;

    return 0;
}

Measured memory_bytes: 256
// acdart
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <string>
#include <queue>
#include <vector>
#include <stack>
#include <set>
#include <map>
#include <cstdlib>
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define X first
#define Y second
#define F first
#define S second
#define MOD9 1000000009ll
#define MOD7 1000000007ll
#define MOD
#define INF  1023456789ll
#define INF16 10000000000000000ll
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define SZ(x) ((int)(x).size())
#define MAXN 10010
#define MAXM
#define ALL(x) ((x).begin()),((x).end())
#define RESET(a,b) memset(a,b, sizeof a)
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define LEN(X) strlen(X)
#define FI(a,b,c) for(int a=b; a<c; a++)
#define FD(a,b,c) for(int a=b; a>c; a--)
using namespace std;
typedef long long ll;
typedef long long LL;
typedef double db;
typedef double D;
typedef long double ld;
typedef long double LD;
/*********default*********/

int n, m, w[10][10] = {0}, ans = 0, vis[10] = {0};

void solve(int v, int s){
	if (s == n){
		ans++;
		return;
	}
	for (int i = 2; i <= n; i++){
		if (!vis[i] && w[v][i]){
			vis[i] = 1;
			solve(i, s + 1);
			vis[i] = 0;
		}
	}
}

int main()
{
	int x, y;
	
	scanf("%d%d", &n, &m);
	for (int i = 0; i < m; i++){
		scanf("%d%d", &x, &y);
		w[x][y] = w[y][x] = 1;
	}
	vis[1] = 1;
	solve(1, 1);
	printf("%d\n", ans);
}

Measured memory_bytes: 256
str1 = input()
n = len(str1)
m = int((n-1)/2)
o = int((n+3)/2)
str2 = str1[:m]
str3 = str1[(o-1):n]
if str1 != str1[::-1]:
	print("No")
else:
    if str2 != str2[::-1]:
	    print("No")
    else:   
        if str3 != str3[::-1]:
            print("No")
        else:
            print("Yes")

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i =(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPm(i,n) for(int i=(n)-1;i>=0;i--)
#define REP1(i,n) for(int i=1;i<=(n);i++)
#define mp make_pair
typedef long long ll;
int main(){
    int A,B,C,D;
    cin >> A >> B >> C >> D;
    cout << max(A*B,C*D) << endl;
    return 0;
}


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

typedef long long ll;
using namespace std;

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

	int x,y; cin >> x >> y;
	int a,b;
	for (int i = 1;i <= x;i++){
		for (int j = 1;j <= y;j++){
			if(x%i == 0 && y%j == 0 && x/i == y/j){
				cout << (x+1)+(y+1)-2 - ((x/i)-1) << endl;	
				return 0;	
			}
		}
	}

	cout << (x+1)+(y+1)-2 << endl;

	return 0;

}




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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	double d;
	cin >> n;
	cin >> d;
	int f=0;
	for(int i=1;i<=n;i++){
        double x,y;
	cin >> x;
	cin >> y;
	double t=sqrt(x*x+y*y);
	if (t<=d) {f=f+1;}
	}
	cout << f;
	return 0;
}



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

int main() {
	int n;
  	cin >>n;
  	long int p[n+1];
  	rep(i,n){
    	cin >>p[i]>>p[i+1];    
    }
  	long int dp[n+1][n+1];
  	for(int i=1;i<=n;i++){
    	dp[i][i]=0;
    }
  	
  	for(int l=1;l<=n-1;l++){
    	for(int i=1;i<=n-l;i++){
        	int j=i+l;
          	dp[i][j]=1000000000;
            for(int k=i;k<=j;k++){
              long int x=dp[i][k]+dp[k+1][j]+p[i-1]*p[k]*p[j];
             dp[i][j]=min(dp[i][j],x);    	
        	}             
            
        }
    }
  	cout<<dp[1][n]<<endl;
  
}





Measured memory_bytes: 3180
/*
#include <boost/multiprecision/cpp_int.hpp>
typedef boost::multiprecision::cpp_int mint; //*/
#include <bits/stdc++.h>
#define  re(i,j,n) for(li i=(j);i<(n);i++)
#define  rep(i,n) re(i,0,(n))
#define  red(i,n) for(li i=n-1;i>=0;i--)
#define  all(a) begin(a),end(a)
#define  pb(a) push_back(a)
using namespace std;
typedef long int li;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<li> vli;
typedef vector<string> vs;


int main()
{
    li n,a,b;
    cin>>n>>a>>b;
    cout<<max(b*(n-1)+a-(a*(n-1)+b-1),(li)0)<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<P> vp;

const int MAX_N = 100005;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string s,t;
    cin >> s >> t;
    rep(i,n){
        bool flag = true;
        srep(j,i,n){
            if(s[j] != t[j-i]){
                flag = false;
                break;
            }
        }
        if(flag){
            cout << n+i << endl;
            return 0;
        }
    }
    cout << 2*n << endl;
    return 0;
}


Measured memory_bytes: 256
import copy
n=int(input())
s=input()
ans=copy.deepcopy(s)
paren=0
for i in range(n):
    if(s[i] == '('):
        paren+=1
    elif(paren <= 0):
        ans = "(" + ans
    else:
        paren-=1

for i in range(paren):
    ans = ans + ")"

print(ans)

Measured memory_bytes: 3572
//----------------------------おまじない
#pragma GCC optimize ("Ofast")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")
//----------------------------
#define FOR(i,j,n) for (int i=(j);i<(n);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define REPN(i,n) for (int i=(n);i>0;i--)
#define I(n) scanf("%d", &(n))
#define LL(n) scanf("%lld", &(n))
#define pb(n) push_back((n))
#define mp(i,j) make_pair((i),(j))
#define eb(i,j) emplace_back((i),(j))
#include <bits/stdc++.h>
using namespace std;
//------------------------------typedef集
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef vector<vi> vvi;
typedef vector<vpi> vvpi;
typedef vector<vvi> vvvi;
typedef long long ll;
const int mod = 1000000009;

vi state;
int n,si,inp,pre,ret;

int solve(int k){
    map<int,int> keta;
    FOR(i,1,si){
        auto vi = state[i];
        keta[vi]++;
        keta.erase(keta.lower_bound(vi+1),keta.end());
        
        while (keta[vi] >= k && vi){
            keta[vi-1]++;
            keta[vi] = 0;
            vi--;
        }
        if (!vi) return 1;
    }
    return keta[0];
}


int main(){
    I(n);
    pre = INT_MAX;
    REP(i,n){
        I(inp);
        if(inp <= pre) state.pb(inp);
        pre = inp;
    }

    si = state.size();
    // cerr << si << endl;
    if (si == 1){
        cout << 1 << endl;
        return 0;
    }

    int lo = si;
    int hi = 1;
    int mid = (lo+hi)/2;
    while( abs(lo-hi) > 1){
        if ( solve(mid) ){
            hi = mid;
        } else {
            lo = mid;
        }
        mid = (lo+hi)/2;
    }

    cout << lo << endl;

}

Measured memory_bytes: 1400
#include<iostream>
#include<cstdio>
#include<algorithm>
#include <cstring>
using namespace std;
int main()
{
    int t=1,i=0,n,q,a[100005],N[100005]= {0},maxl=0,d;
    long long k;
    cin>>n>>k>>q;
    for(i=1; i<=q; i++)
    {
        cin>>a[i];
        N[a[i]]++;
    }
    for(i=1; i<=n; i++)
        if(N[i]>N[maxl])
            maxl=i;
    for(i=1; i<=q; i++)
        if(a[i]!=maxl)
            --k;
    for(i=1; i<=n; i++)
        if(N[i]+k-N[maxl]<=0)
            cout<<"No\n";
        else
            cout<<"Yes\n";
    return 0;
}



Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

double p[20];

int main() {
	p[0]=0.5;
	double n ,m;
	cin>>n>>m;
	for(int i=1;i<20;i++){
		p[i]=0.5*p[i-1];
	}
	double ans=0;
	for(int i=1;i<=n;i++){
		ll now=i;
		if(now>=m){
			ans+=1/n;
			continue;
		}
		for(int j=0;;j++){
			now*=2;
			if(now>=m){
				ans+=p[j]*(1/n);
				break;
			}
		}
	}
	printf("%.10f",ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

vector<vector<int>> g;
map<pii,int> ans;

void dfs(const int cnt,const int par) {
    int c = 1;
    int pc = -1;
    if (par != -1) pc = ans[{par,cnt}];
    for(auto item:g[cnt]) {
        if (item == par) continue;
        if (c == pc) c++;
        ans[{cnt,item}] = c;
        dfs(item,cnt);
        c++;
    }
}

int main(void)
{
    IOS
    int n; cin >> n;
    g.resize(n);
    vector<pii> p;
    REP(i,n-1) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
        p.push_back({a,b});
    }
    dfs(0,-1);

    int mx = 0;
    REP(i,n) mx = max(mx,static_cast<int>(g[i].size()));
    cout << mx << endl;
    REP(i,n-1) cout << ans[p[i]] << endl;


    return 0;
}

Measured memory_bytes: 14972
/*
    author: blue_matrix
*/
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
// # define M_PI           3.14159265358979323846
#define n_l '\n'
#define dbg(...) cout << "[" << #__VA_ARGS__ << "]: "; cout << to_string(__VA_ARGS__) << endl
template <typename T, size_t N> int SIZE(const T (&t)[N]){ return N; } template<typename T> int SIZE(const T &t){ return t.size(); } string to_string(const string s, int x1=0, int x2=1e9){ return '"' + ((x1 < s.size()) ? s.substr(x1, x2-x1+1) : "") + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(const bool b) { return (b ? "true" : "false"); } string to_string(const char c){ return string({c}); } template<size_t N> string to_string(const bitset<N> &b, int x1=0, int x2=1e9){ string t = ""; for(int __iii__ = min(x1,SIZE(b)),  __jjj__ = min(x2, SIZE(b)-1); __iii__ <= __jjj__; ++__iii__){ t += b[__iii__] + '0'; } return '"' + t + '"'; } template <typename A, typename... C> string to_string(const A (&v), int x1=0, int x2=1e9, C... coords); int l_v_l_v_l = 0, t_a_b_s = 0; template <typename A, typename B> string to_string(const pair<A, B> &p) { l_v_l_v_l++; string res = "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; l_v_l_v_l--; return res; } template <typename A, typename... C> string to_string(const A (&v), int x1, int x2, C... coords) { int rnk = rank<A>::value; string tab(t_a_b_s, ' '); string res = ""; bool first = true; if(l_v_l_v_l == 0) res += n_l; res += tab + "["; x1 = min(x1, SIZE(v)), x2 = min(x2, SIZE(v)); auto l = begin(v); advance(l, x1); auto r = l; advance(r, (x2-x1) + (x2 < SIZE(v))); for (auto e = l; e != r; e = next(e)) { if (!first) { res += ", "; } first = false; l_v_l_v_l++; if(e != l){ if(rnk > 1) { res += n_l; t_a_b_s = l_v_l_v_l; }; } else{ t_a_b_s = 0; } res += to_string(*e, coords...); l_v_l_v_l--; } res += "]"; if(l_v_l_v_l == 0) res += n_l; return res; } void dbgm(){;} template<typename Heads, typename... Tails> void dbgm(Heads H, Tails... T){ cout << to_string(H) << " | "; dbgm(T...); } 
#define dbgm(...) cout << "[" << #__VA_ARGS__ << "]: "; dbgm(__VA_ARGS__); cout << endl
#define ll long long

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

    ll n,d;
    cin>>n>>d;
    for(ll i=0;i<d;i++)
    {
        ll a;
        cin>>a;
        n-=a;
    }
    cout<<max((ll)-1,n);
    return 0;
}

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

int main() {
  int N,K;
  cin >> N >> K;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  for (int i = K; i < N; i++) {
    if(vec.at(i-K)<vec.at(i)){
      cout << "Yes" <<endl;
    }
    else{
      cout << "No" <<endl;
    }
  }
}

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

int main() {
    ll N; cin >> N;
    ll sum = 0;
    vector<ll> v(N); 
    for(int i = 0; i < N; ++i) {
        cin >> v[i];
        sum += v[i];
    }
    ll place1 =  floor(sum/N);
    ll place2 = place1 + 1;
    ll health1 = 0;
    ll health2 = 0;
    for (int i = 0; i < N; ++i) {
        health1 += pow(v[i]-place1, 2);
        health2 += pow(v[i]-place2, 2);
    }
    cout << min(health1, health2) << endl;
}

Measured memory_bytes: 256
from collections import deque
def bfs(G, n,visited):
    q = deque([(1,'fe'),(n,'su')])
    visited[1] = 'fe'
    visited[n] = 'su'
    while q:
        curr_node = q.popleft()
        for next_node in G[curr_node[0]]:
            if visited[next_node] != 'yet': continue
            visited[next_node] = curr_node[1]
            q.append((next_node,curr_node[1]))


n = int(input())
G = [ [] for _ in range(n+1)]
visited = ['yet'] * (n+1)
for i in range(n-1):
    a, b = map(int, input().split()) 
    G[a].append(b)
    G[b].append(a)
bfs(G, n, visited)

if visited.count('fe') > visited.count('su'):
    print('Fennec')
else:
    print('Snuke')

Measured memory_bytes: 59936
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl;
vector<int> i2g;
vector<vector<int> > g2i;
int w[100000];
void init(int n){
	i2g.resize(n);
	g2i.resize(n);
	rep(i,n){
		i2g[i]=i;
		g2i[i].assign(1,i);
		w[i]=0;
	}
}
void unite(int ia,int ib,int ww){
	int dif=ww+w[ia]-w[ib];
	if(g2i[i2g[ia]].size() < g2i[i2g[ib]].size()) swap(ia,ib),dif*=-1;
	int ga=i2g[ia],gb=i2g[ib];
	rep(i,g2i[gb].size()){
		i2g[g2i[gb][i]]=ga;
		w[g2i[gb][i]]+=dif;
	}
	g2i[ga].insert(g2i[ga].end(),all(g2i[gb]));
}
bool same(int ia,int ib){
	return i2g[ia]==i2g[ib];
}
int main(){
	while(true){
		int n,m;
		cin>>n>>m;
		if(n==0) break;
		init(n);
		rep(i,m){
			char c;
			cin>>c;
			if(c=='!'){
				int a,b,dif;
				cin>>a>>b>>dif;
				a--,b--;
				if(same(a,b)) continue;
				unite(a,b,dif);
			}else{
				int a,b;
				cin>>a>>b;
				a--,b--;
				if(same(a,b)){
					cout << w[b]-w[a]<<endl;
				}else{
					cout << "UNKNOWN\n";
				}
			}
		}
	}
}

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

using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)

const ll mod = 998244353;

class matrix {
public:
  ll d[2][2];
  matrix operator*(const matrix& m) {
    matrix r;
    rep(i, 2) {
      rep(j, 2) {
        r.d[i][j] = 0;
      }
    }
    rep(i, 2) {
      rep(j, 2) {
        rep(k, 2) {
          r.d[i][j] = (r.d[i][j] + d[i][k] * m.d[k][j]) % mod;
        }
      }
    }
    return r;
  }
};

ll fibo(ll n) {
  matrix r;
  rep(i, 2) {
    rep(j, 2) {
      if(i == j) {
        r.d[i][j] = 1;
      }
      else {
        r.d[i][j] = 0;
      }
    }
  }
  matrix m;
  m.d[0][0] = 1;
  m.d[0][1] = 1;
  m.d[1][0] = 1;
  m.d[1][1] = 0;
  while(n > 0) {
    if(n & 1) {
      r = r * m;
    }
    m = m * m;
    n >>= 1;
  }
  return r.d[1][0];
}

ll inv(ll n) {
  ll r = 1;
  ll w = mod - 2;
  while(w > 0) {
    if(w & 1) {
      r = (r * n) % mod;
    }
    n = (n * n) % mod;
    w >>= 1;
  }
  return r;
}

int main() {
  ll n, m;
  scanf("%lld%lld", &n, &m);
  ll a = fibo(m + (n - 1) * 2);
  ll now = 1;
  ll l = m + (n - 1) * 2 - 1;
  ll r = 0;
  for(int i = 2; i <= n; i++) {
    a = (a + mod - now) % mod;
    now = (now * ((l - r) % mod)) % mod;
    now = (now * ((l - r - 1) % mod)) % mod;
    now = (now * inv(l % mod)) % mod;
    now = (now * inv(r + 1)) % mod;
    l--;
    r++;
  }
  printf("%lld\n", a);
}


Measured memory_bytes: 256
import copy
s = input()

alpha_list = "abcdefghijklmnopqrstuvwxyz"

ans = 10**4
for alpha in alpha_list:
#    print(alpha)
    s_check = copy.deepcopy(s)

    mojisu_count = 0
    for i in range(len(s_check)):
        if(len(s_check) == s_check.count(alpha)):
            ans = min(ans, mojisu_count)
            break

        s_dash = ""
        for j in range(len(s_check) - 1):
            if(s_check[j] == alpha or s_check[j+1] == alpha):
                s_dash += alpha
            else:
                s_dash += s[j]

        mojisu_count += 1
        s_check = copy.deepcopy(s_dash)

print(ans)

Measured memory_bytes: 9260
#include <bits/stdc++.h>
using namespace std;
long long const int c=1000000007;
long long int power(long long int x,long long int y,long long int p)
{
        long long int res=1;
    while(y>0){
        if(y&1){
            res=(res*x)%p;
        }
        y=y>>1;
        x=(x*x)%p;
        
        
    }
    return res; 
}
long long int modinverse(long long int fact)
{

    return power(fact,(c-2),c);
}

int main() {
    
    long long int n,m,x,y,i,fact1=1,fact2=1,fact3=1;
    cin>>x>>y;
    n=(2*x)-y;
    m=(2*y)-x;
    if((n>=0)&&(n%3==0)&&(m>=0)&&(m%3==0))
    {
        n/=3;
        m/=3;
        for(i=1;i<=(m+n);i++)
        {
            fact1=(fact1*i)%c;
            
        }
        
        for(i=1;i<=n;i++)
        {
            fact2=(fact2*i)%c;
            
        }
        
        for(i=1;i<=m;i++)
        {
            fact3=(fact3*i)%c;
            
        }
        long long int k=((modinverse(fact2)%c)*(modinverse(fact3)%c))%c;

        cout<<((fact1*k)%c);
    }
    else
    {
    cout<<0;
    }

    
}
    


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
template<class T> ostream & operator<<(ostream & os, vector<T> const &);
template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){}
template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":" ") << get<n>(t); _ot<n+1>(os, t); }
template<class...T> ostream & operator<<(ostream & os, tuple<T...> const & t){ _ot<0>(os, t); return os; }
template<class T, class U> ostream & operator<<(ostream & os, pair<T,U> const & p){ return os << "(" << p.first << ", " << p.second << ") "; }
template<class T> ostream & operator<<(ostream & os, vector<T> const & v){ rep(i,v.size()) os << v[i] << (i+1==(int)v.size()?"":" "); return os; }
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<mt(__VA_ARGS__)<<" ["<<__LINE__<<"]"<<endl)
#else
#define dump(...)
#endif

#define int ll

int range(int l, int r, int len){
    int fizz = r/3 - l/3;
    int buzz = r/5 - l/5;
    int fizzbuzz = r/15 - l/15;
    int res = 0;
    res += (r - l - fizz - buzz + fizzbuzz) * len;
    res += (fizz + buzz - 2*fizzbuzz) * 4;
    res += fizzbuzz * 8;
    return res;
}

int len(int n){
    int res = 0;
    int cnt = 1;
    int p = 1;
    while(p * 10 <= n){
        res += range(p-1, p*10-1, cnt);
        p *= 10;
        cnt += 1;
    }
    res += range(p-1,n-1,cnt);
    return res;
}

string solve(int n){
    int l = 0, r = 1000000000000000000LL;
    while(l + 1 < r){
        int m = (r+l)/2;
        if(len(m) < n) l = m;
        else r = m;
    }
    int rest = n - len(l);
    string s;
    for(int i=l; (int)s.size()<rest+30; i++){
        if(i%15==0) s += "FizzBuzz";
        else if(i%3==0) s += "Fizz";
        else if(i%5==0) s += "Buzz";
        else s += to_string(i);
    }
    return s.substr(rest-1, 20);
}

signed main(){
    int n; cin >> n;
    cout << solve(n) << endl;
}

Measured memory_bytes: 1232
import math

a,b,c=map(float, input().split(" "))

S=a*b*math.sin(c*math.pi/180.0)/2.0
print(S)
L=a+b+math.sqrt(a*a+b*b-2*a*b*math.cos(c*math.pi/180.0))
print(L)
h=b*math.sin(c*math.pi/180.0)
print(h)



Measured memory_bytes: 5696
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main(){

    input!{
        r: usize,
        d: usize,
        x: usize,
    }
    let mut x_tmp = x;
    for _i in 0..10 {
        x_tmp = r*x_tmp - d;
        println!("{}", x_tmp);
    }

}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main(){
int arr[1000];
for(int i=0;i<3;i++){
  cin>>arr[i];
}
sort(arr,arr+3);
for(int i=0;i<2;i++){
  cout<<arr[i]<<" ";
}
cout<<arr[2]<<endl;
}



Measured memory_bytes: 3108
#include<iostream>
#include<vector>
#include<stdlib.h>
using namespace std;


struct bal{
	int time,loc;
};

int n;
int m_depth;
int res=100000000;
vector<bal> V;

void dfs(int depth,int k,int total){
	m_depth=max(m_depth,depth);
	if(total>=res)
		return;
	if(depth==n){
		total+=V[n-1].loc;
		res=min(res,total);
		return;
	}
	int n_loc=0;
	int room=V[0].time;
	if(depth!=0){
		n_loc=V[depth-1].loc;
		room=V[depth].time-V[depth-1].time;
	}

	int cost=0;
	if(k!=0){
		cost+=n_loc*(k+1);
		cost+=V[depth].loc*1;
		if(cost<=room)
			dfs(depth+1,1,total+n_loc+V[depth].loc);
	}
	cost=0;
	if(k!=3){
		cost+=(abs(V[depth].loc-n_loc))*(k+1);
		if(cost<=room)
			dfs(depth+1,k+1,total+abs(V[depth].loc-n_loc));
	}

}

void solve(){
	res=100000000;
	V.clear();
	m_depth=0;
	for(int i=0;i<n;i++){
		bal now;
		cin>>now.loc>>now.time;
		V.push_back(now);
	}
	m_depth;
	dfs(0,0,0);
	if(m_depth!=n)
		cout<<"NG "<<m_depth+1<<endl;
	else cout<<"OK "<<res<<endl;
}


int main()
{
	while(cin>>n){
		if(n==0) break;
		solve();
	}
	return 0;
}

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

int main(){
  int N;
  cin >>N;
  int temp;
  temp=N;
  int sum=0;
  while(temp>0){
    sum=sum+temp%10;
    temp=temp/10;
  }
  if (N%sum==0){
    cout<<"Yes"<<endl;
    return 0;
  }
  cout<<"No"<<endl;
  return 0;
}

    

Measured memory_bytes: 256
import java.util.Scanner;

public class Main
{

    public static void main(String[] args)
    {
        Scanner scan = new Scanner(System.in);
        int D = scan.nextInt();
        int L = scan.nextInt();
        if (D % L == 0) {
            System.out.println(D / L);

        } else {
            System.out.println(D / L + D % L);
        }

    }

}



Measured memory_bytes: 26188
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int V = 1e5;

vector<int> G[V * 2];
vector<bool> visited(V * 2);
vector<ll> cnt;

void dfs(int v) {
  if (visited[v]) return;
  visited[v] = true;
  cnt[v / V]++;
  for (int u: G[v]) {
    dfs(u);
  }
}

int main() {
  int n;
  cin >> n;
  rep(i, n) {
    int x, y;
    cin >> x >> y;
    G[x - 1].push_back(y + V - 1);
    G[y + V - 1].push_back(x - 1);
  }

  ll ans = 0;
  rep(v, V * 2) {
    if (visited[v]) continue;
    cnt = vector<ll>(2, 0);
    dfs(v);
    ans += cnt[0] * cnt[1];
  }
  ans -= n;
  cout << ans << endl;




  
  return 0;
}

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

int main(void){
    char a;
    cin >> a;
    
    char ans;
    if (a < 97){
        ans = 'A';
    } else {
        ans = 'a';
    }

    cout << ans << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

map<int,int> mp;

// s > t かどうか
bool large(string &s, string &t) {
    if (s.length()>t.length()) return true;
    else if (s.length()==t.length()) {
        rep(i,s.length()) {
            if (s[i]>t[i]) return true;
            else if (s[i]<t[i]) return false;
        }
    }
    return false;
}

int main(int argc, char const *argv[]) {

    mp[1]=2,mp[2]=5,mp[3]=5,mp[4]=4,mp[5]=5,
    mp[6]=6,mp[7]=3,mp[8]=7,mp[9]=6;
    
    int n,m;cin>>n>>m;
    vector<int> a(m);
    int st=INF;
    rep(i,m) cin>>a[i],st=min(st,a[i]);

    vector<string> dp(n+100,"0");

    dp[0]="";

    rep(i,n) {
        if (dp[i]=="0") continue;
        for (auto &&j: a) {
            int dx=mp[j];
            string tmp=dp[i];
            tmp.push_back(j+'0');
            if (large(tmp,dp[i+dx])) dp[i+dx]=tmp;
        }
    }

    cout << dp[n] << endl;
    return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

vector<int> g[100000];
int d1[100000] = {};
int dn[100000] = {};

void dfs(int s, int d[])
{
    rep(i, g[s].size())
    {
        int v = g[s][i];
        if (d[v] != -1)
            continue;

        d[v] = d[s] + 1;
        dfs(v, d);
    }
}

int main()
{
    rep(i, 100000)
    {
        d1[i] = -1;
        dn[i] = -1;
    }
    int n;
    cin >> n;
    rep(i, n - 1)
    {
        int a, b;
        cin >> a >> b;
        --a, --b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    d1[0] = 0;
    dn[n - 1] = 0;
    dfs(0, d1);
    dfs(n - 1, dn);

    int cnt = 0;

    rep(i, n) if (d1[i] <= dn[i]) cnt++;

    if (cnt > n - cnt)
        OP("Fennec");
    else
        OP("Snuke");

    return 0;
}

Measured memory_bytes: 11136