akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ub              upper_bound
#define lb              lower_bound
#define isrt            insert
#define clr             clear
#define rsz             resize
#define ff              first
#define ss              second
#define lli             long long int
#define pb              push_back
#define pf              push_front
#define mkp              make_pair
#define pii             pair<lli,lli>
#define vi              vector<int>
#define mii             map<lli,lli>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define INF             1e9
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(v)          v.begin(),v.end()
#define endl            "\n"
const double PI = acos(-1);

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

lli maxm(lli a, lli b)
{
    return (a >= b ? a : b);
}


lli minm(lli a, lli b)
{
    return (a <= b ? a : b);
}

lli power(lli x, lli y, lli p)
{
    lli res = 1;

    x = x % p;
    if (x == 0)
        return 0;

    while (y > 0)
    {

        if (y & 1)
            res = (res * x) % p;


        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

lli nCrmodp(lli n, lli r, lli p)
{
    if (r == 0)
        return 1;
    if (r == 1)
        return n;


    lli pro = 1, k = n;
    while (k > r)
    {
        pro *= k;
        pro %= p;
        --k;
    }

    k = 2;
    while (k <= (n - r))
    {
        pro *= power(k, (p - 2), p);
        pro %= p;
        ++k;
    }

    return pro;
}


lli str_num(string str, lli k)
{

    lli n = str.length(), ans = 0;

    for (lli i = 0; i < n; ++i)
        ans = (k * ans + str[i] - '0');


    return ans;
}


lli first_big(lli n, lli k, vector<lli> arr)
{
    lli l, r, ans = n;
    l = 0;
    r = n - 1;

    while (l <= r) {
        lli m = l + (r - l) / 2;

        if (arr[m] > k) {
            ans = m;
            r = m - 1;
        }

        else
            l = m + 1;
    }

    return ans;
}

lli last_small(lli n, lli k, vector<lli> arr)
{
    lli l, r, ans = -1;
    l = 0;
    r = n - 1;

    while (l <= r)
    {
        lli mid = (l + r) / 2;

        if (arr[mid] <= k)
        {
            ans = mid;
            l = mid + 1;
        }
        else
            r = mid - 1;
    }

    return ans;
}

void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int main()
{
    c_p_c();

    lli d, s, t;

    cin >> d >> t >> s;

    if (s * t >= d)
        cout << "Yes\n";
    else
        cout << "No\n";
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define LLMAX (1ll << 60) - 1
#define INTMAX (1 << 30) - 1
#define MOD 1000000007 
#define NMAX 1000*100+1

#define numberOfSetBits(S) __builtin_popcount(S) // __builtin_popcountl(S) __builtin_popcountll(S)
#define MSET(x,y) memset(x,y,sizeof(x))
#define gcd(a,b) __gcd(a,b)
#define all(x)  x.begin(),x.end()
#define isOn(S, j) (S & (1 << j))
#define endl '\n'
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
#define print(x)    for(auto it:x) cout<<it<<' '; cout<<endl;
#define printii(x)  for(auto it:x) cout<<it.F<<' '<<it.S<<'\t';  cout<<endl;
#define in(x,n)   for(int e=0;e<n;e++){ll y;cin>>y;x.pb(y);}

#define vi vector<ll>
#define vvi vector<vi>
#define ii pair<ll,ll>
#define pll pair<ll,ll>
#define vii vector<ii>
#define vvii vector<vii>
#define viii vector<pair<ii,ll>>
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define mc(a,b,c) mp(mp(a,b),c)


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,x,t,m,y,z;
    cin>>t;
    cout<<t+t*t+t*t*t;    

    return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

string S;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>S;
	cout<<S[0]<<S.size()-2<<S.back()<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();
        int L = in.i();
        int sum = L * N + N * (N - 1) / 2;
        int min = Integer.MAX_VALUE;
        int ans = 0;
        for (int i = 0; i < N; i++) {
            if (Math.abs(L + i) < min) {
                min = Math.abs(L + i);
                ans = sum - L - i;
            }
        }
        System.out.println(ans);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    int i() {
        int k = next() - '0';
        boolean minus = k == -3;
        int n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        int k = next() - '0';
        boolean minus = k == -3;
        long n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    char[] s(final int N) {
        char[] s = new char[N];
        for (int i = 0; i < N; i++) {
            s[i] = next();
        }
        next();
        return s;
    }

    public int read(char[] cbuf) {
        int i;
        char c;
        for (i = 0; (c = next()) != ' ' && c != '\n'; i++) cbuf[i] = c;
        return i;
    }

    public String readLine() {
        try {
            return super.readLine();
        } catch (IOException e) {
            return null;
        }
    }
}


Measured memory_bytes: 32596
move = [[1,4],[0,2,5],[1,3,6],[2,7],[0,5],[4,1,6],[5,2,7],[6,3]]
ans = {"01234567":0}
q = [["01234567",0]]
while q:
    p,c = q.pop(0)
    a = p.find("0")
    for b in move[a]:
        x,y = min(a,b),max(a,b)
        tmp = p[:x]+p[y]+p[x+1:y]+p[x]+p[y+1:]
        if tmp not in ans:
            ans[tmp] = c+1
            q.append([tmp,c+1])

while 1:
    try:
        print ans[raw_input().replace(" ","")]
    except:
        break

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

const int maxn = 1e5 + 10;
vector<int> G[maxn];
bool vis[maxn];

vector<int> bfs(int n, int start) {
	memset(vis, false, sizeof(vis));
	vector<int> d(n);
	queue<int> q;
	q.push(start);
	vis[start] = true;
	d[start] = 0;
	while (!q.empty()) {
		int front = q.front();
		q.pop();
		for (int i = 0; i < G[front].size(); i++) {
			if (!vis[G[front][i]]) {
				vis[G[front][i]] = true;
				d[G[front][i]] = d[front] + 1;
				q.push(G[front][i]);
			}
		}
	}
	return d;
}

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n - 1; i++) {
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	vector<int> d1 = bfs(n, 0);
	vector<int> dn = bfs(n, n - 1);
	int count1 = 0, count2 = 0;
	for (int i = 0; i < n; i++) {
		if (d1[i] <= dn[i]) {
			count1++;
		} else {
			count2++;
		}
	}
	cout << (count1 > count2 ? "Fennec" : "Snuke") << endl;
	return 0;
}

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

using ll = long long;
#define repi(n) for (int i = 0; i < (n); i++)
#define repj(n) for (int j = 0; j < (n); j++)
#define repk(n) for (int k = 0; j < (n); k++)
#define rep(i, n) for (int i = 0; (i) < (n); i++)
#define repr(i, a, b) for (auto i = (a); i < (b); i++)
#define repv(itr) for (auto&& v : (itr))
#define updatemax(t, v) (t = max((t), (v)))
#define updatemin(t, v) (t = min((t), (v)))
const int dx[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, -1, 1, -1, 1};
template <typename T>
T minptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i < *re) re = i;
  }
  return re;
}
template <typename T>
T maxptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i > *re) re = i;
  }
  return re;
}
int __vmax(int x) {
  return INT_MAX;
}
double __vmax(double x) {
  return 1e+300;
}
ll __vmax(ll x) {
  return LLONG_MAX;
}
int __vmin(int x) {
  return INT_MIN;
}
double __vmin(double x) {
  return -1e+300;
}
ll __vmin(ll x) {
  return LLONG_MIN;
}
template <typename T>
vector<T> lis(T begin, T end, bool allowequal = false, bool lds = false) {
  using V = typename iterator_traits<T>::value_type;
  int n = end - begin;
  vector<V> a(n, lds ? __vmin(*begin) : __vmax(*begin));
  vector<int> id(n);
  if (lds && allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (lower_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (lds) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (upper_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = upper_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  } else {
    for (int i = 0; i < n; i++) {
      id[i] = lower_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  }
  int m = *maxptr(id.begin(), id.end());
  vector<T> re(m + 1);
  for (int i = n - 1; i >= 0; i--) {
    if (id[i] == m) re[m--] = begin + i;
  }
  return re;
}

int main() {
  int k, x;
  cin >> k >> x;
  cout << x - k + 1;
  repr(i, x - k + 2, x + k) cout << " " << i;
  cout << endl;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
  val X = readLong()
  for (a in 0L until 10000000000L) {
    val a2 = a * a
    val a5 = a2 * a2 * a
    val d = Math.abs(X - a5)
    val b = Math.round(Math.pow(Math.E, Math.log(d.toDouble()) / 5))
    val b2 = b * b
    val b5 = b2 * b2 * b
    val p = a5 + b5
    val n = a5 - b5
//    println("$X, $a $b, $a5 + $b5 = $p, $a5 - $b5 = $n")
    if (p == X) {
      println(if (b == 0L) "$a $b" else "$a -$b")
      break
    }
    if (n == X) {
      println("$a $b")
      break
    }
  }
}

fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readLong() = readString().toLong()
fun readInts() = readStrings().map { it.toInt() }
fun readLongs() = readStrings().map { it.toLong() }


Measured memory_bytes: 34392
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<int>vec;
int main(){
	int n;cin>>n;
	rep(i,n){
		int a; cin>>a; vec.pb(a);
	}
	SORT(vec);
	int sum = 0,val=vec[n-1];
	rep(i,n-1)sum+=vec[i];
	puts(sum<=val?"No":"Yes");
}

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

using namespace std;

#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define INF (1 << 29)
#define LLINF (1LL << 60)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

using Pi = pair<int, int>;
using ll = long long;

string to_string(string s) { return s; }

template <class S, class T>
string to_string(pair<S, T> p) {
  return "{" + to_string(p.first) + "," + to_string(p.second) + "}";
}

template <class S>
string to_string(unordered_set<S> s) {
  string ret = "{";
  for (S x : s) ret += to_string(x) + ",";
  return ret + "}";
}

template <class S, class T>
string to_string(map<S, T> m) {
  string ret = "{";
  for (pair<S, T> x : m) ret += to_string(x) + ",";
  return ret + "}";
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  for (int i = 0; i < (int)v.size() - 1; ++i) {
    ret += to_string(v[i]) + ",";
  }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() { cerr << endl; }

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() { cout << endl; }

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

int main() {
  cin.tie(0);
  int N;
  cin >> N;
  print((N - 1) / 2);
  return 0;
}

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

void	init(int *array, int len, int val)
{
	for (int i = 0; i < len; ++i)
		array[i] = val;
}

void	copy(int *dst, int *src, int len)
{
	for (int i = 0; i < len; ++i)
		dst[i] = src[i];
}

void	add(int *lhs, int *rhs, int len)
{
	for (int i = 0; i < len; ++i)
		lhs[i] += rhs[i];
}

int	get_max(int *array, int len)
{
	return *max_element(array, array + len);
}

void	make_map(int H, bitset<9> h_split, int *row_to_layer)
{
	row_to_layer[0] = 0;
	for (int j = 0; j < H - 1; ++j) {
		if (h_split.test(j))
			row_to_layer[j + 1] = row_to_layer[j] + 1;
		else
			row_to_layer[j + 1] = row_to_layer[j];
	}
}

int	main()
{
	int	H, W, K;
	cin >> H >> W >> K;
	vector<string>	table(H);
	for (int i = 0; i < H; ++i)
		cin >> table.at(i);
	int	min_split = H * W + 1;
	for (int i = 0; i < (1 << (H - 1)); ++i) {
		bitset<9>	h_split(i);
		int	num_layer = h_split.count() + 1;
		if (min_split < num_layer)
			continue;
		int	cnt_1layer[10] = {0};
		int	cnt_1layer_1col[10] = {0};
		int	num_split = 0;
		int	num_v_split = 0;
		int	row_to_layer[10] = {0};
		bool	is_feasible = true;
		make_map(H, h_split, row_to_layer);
		for (int j = 0; j < W; ++j) {
			init(cnt_1layer_1col, num_layer, 0);
			for (int k = 0; k < H; ++k) {
				if (table.at(k).at(j) == '1')
					cnt_1layer_1col[row_to_layer[k]] += 1;	
			}
			if (get_max(cnt_1layer_1col, num_layer) > K) {
				is_feasible = false;
				break;
			}
			add(cnt_1layer, cnt_1layer_1col, num_layer);
			if (get_max(cnt_1layer, num_layer) > K) {
				++num_v_split;
				copy(cnt_1layer, cnt_1layer_1col, num_layer);
			}
		}
		if (!is_feasible)
			continue;
		num_split = num_layer - 1 + num_v_split;
		if (min_split > num_split) min_split = num_split;
	}
	cout << min_split << endl;
}


Measured memory_bytes: 256
def c_forbidden_list():
    X, N = [int(i) for i in input().split()]
    P = set([int(i) for i in input().split()]) if N != 0 else []

    if not P:
        return X

    minimum = float('inf')
    ans = -float('inf')
    for t in range(102):
        if (not t in P) and (abs(X - t) < minimum):
            minimum = abs(X - t)
            ans = t
    return ans

print(c_forbidden_list())

Measured memory_bytes: 9204
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define elif else if
int a,b=0,c;
string s;
signed main()
{
	cin>>a>>s;
	rep(i,a){
		if(s[i]=='.'){
			b++;
		}
	}
	c=b;
	rep(i,a){
		if(s[i]=='#'){
			b++;
		}else{
			b--;
		}
		if(c>b){
			c=b;
		}
	}
	cout<<c;
}

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

namespace _2019nic1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] inp = Console.ReadLine().Split(' ');

            int N = int.Parse(inp[0]);
            int A = int.Parse(inp[1]);
            int B = int.Parse(inp[2]);

            int syou;
            int dai;

            syou = A + B - N;
            if(syou < 0)
            {
                syou = 0;
            }else if(syou > N)
            {
                syou = N;
            }

            if(A > B)
            {
                dai = B;
            }
            else
            {
                dai = A;
            }

            if(dai > N)
            {
                dai = N;
            }

            Console.WriteLine(dai + " " + syou);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N,A,B;
  cin >> N;
  vector<int> S(N);
  for(int i=0;i<N;i++) cin >> S[i];
  sort(S.begin(), S.end(), greater<int>());
  for(int i=0;i<N;i+=2){
    A+=S[i], B+=S[i+1];
  }
  cout << A-B << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long int X,temp;
  long int hp=0,hp2=0;
  cin>>X;
  temp=X;
  while(temp-500>=0)
  {
    hp++;
    temp=temp-500;
  }
  hp*=1000;
  while(temp-5>=0)
  {
    hp2++;
    temp-=5;
  }
  hp2*=5;
  cout<<(hp+hp2);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef _DEBUG
#include "_DEBUG.hpp"
#endif
#define int long long
using namespace std;
using P = pair<int, int>;
const int inf = 2e18;
const int mod = 1e9 + 7;

template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (T &in : v) is >> in;
  return is;
}

template <class T>
vector<T> make_vec(size_t a) {
  return vector<T>(a);
}

template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template <class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
  t = v;
}

template <class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v) {
  for (auto &e : t) fill(e, v);
}

template <class T>
struct SegmentTree{
  using F = function<T(T, T)>;
  F f;
  T inf;
  int n;
  vector<T> node;

  SegmentTree(){}
  SegmentTree(vector<T> v, T inf, F f) : inf(inf), f(f){
    n = 1; while(n < v.size()) n *= 2;
    node.resize(2*n-1, inf);
    for(int i = 0; i < v.size(); i++) node[i+n-1] = v[i];
    for(int i = n-2; i >= 0; i--) node[i] = f(node[2*i+1], node[2*i+2]);
  }

  void update(int k, T val){
    k += n-1;
    node[k] = val;
    while(k > 0){
      k = (k-1) / 2;
      node[k] = f(node[2*k+1], node[2*k+2]);
    }
  }

  void add(int k, T val){
    k += n-1;
    node[k] += val;
    while(k > 0){
      k = (k-1) / 2;
      node[k] = f(node[2*k+1], node[2*k+2]);
    }
  }

  //区間[a, b)の値を返す
  T operator[](int x){ return getval(x, x + 1); }
  T getval(int a, int b){ return getval(a, b, 0, 0, n); }
  T getval(int a, int b, int k, int l, int r){
    if(r <= a || b <= l) return inf;
    if(a <= l && r <= b) return node[k];
    T vl = getval(a, b, 2*k+1, l, (l+r)/2);
    T vr = getval(a, b, 2*k+2, (l+r)/2, r);
    return f(vl, vr);
  }

  void print(int n){
    for(int i = 0; i < n; i++){
      cout << getval(i, i+1) << " ";
    }
    cout << endl;
  }
};

signed main() {
  
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  cin >> a;

  SegmentTree<int> seg(vector<int>(4e5 + 1, 0), -inf, [&](int x, int y){ return max(x, y); });
  for (int i = 0; i < n; i++) {
    int l = max(0ll, a[i] - k);
    int r = min((int)4e5, a[i] + k);
    seg.update(a[i], seg.getval(l, r + 1) + 1);
  }
  int ans = seg.getval(0, 4e5);
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 16884
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}
// modint: mod 計算を int を扱うように扱える構造体
template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) v += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr istream& operator >> (istream &is, Fp<MOD>& x) noexcept {
        return is >> x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};
const int MOD = 1000000007;
using mint = Fp<MOD>;
const int INF = 1<<30;

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

mint dp[100005][2];

int main(){
  string s; cin >> s;
  int n = s.size();
  dp[0][0] = 1;
  rep(i,n){
    if(s[i] == '0'){
      dp[i+1][0] = dp[i][0];
      dp[i+1][1] = dp[i][1];
    }else{
      dp[i+1][1] = dp[i][0] + dp[i][1];
    }
    if(s[i] == '0'){
      dp[i+1][1] += dp[i][1] * 2;
    }else{
      dp[i+1][0] += dp[i][0] * 2;
      dp[i+1][1] += dp[i][1] * 2;
    }
  }
  mint ans = dp[n][0]+dp[n][1];
  cout << ans << endl;
  return 0;
}

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

using namespace std;

int main() {
  int n, m, c;
  cin >> n >> m >> c;
  int ans = 0;
  vector<int> b(m);
  for (int i = 0; i < m; ++i) cin >> b[i];
  for (int i = 0; i < n; ++i) {
    int sum = c;
    for (int j = 0; j < m; ++j) {
      int a;
      cin >> a;
      sum += a * b[j];
    }
    if (sum > 0) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include <map>  
#include <string.h>
#include <math.h>

using namespace std;




int main()
{

	int n, r;

	cin >> n;
	r = (int)pow((double)n, 0.5);

	cout << (int)pow(r, 2) << endl;

	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>

typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
#define rep_r(i,s,n)for(ll i = n;i>s;i--)
#define rep_re(i,s,n)for(ll i = n;i>=s;i--)
using namespace std;
static const ll MOD = 1e9 + 7;
static const ll INF = 999;// 1e25;
static const ll MAX_N = 100001;

int main() {
	string s; cin >> s;
	rep(i, 0, s.size()) {
		if (!(i & 1)) {
			if (s[i] == 'L') {
				cout << "No" << endl;
				return 0;
			}
		}
		else {
			if (s[i] == 'R') {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;

	return 0;
}

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

const int MAXN = 6.1e5;
int N;
string S;
int A[MAXN];

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> S;
	N = int(S.size()) + 1;
	for (int i = 1; i < N; i++) {
		if (S[i-1] == '<') {
			A[i] = max(A[i], A[i-1]+1);
		}
	}
	for (int i = N-2; i >= 0; i--) {
		if (S[i] == '>') {
			A[i] = max(A[i], A[i+1]+1);
		}
	}
	long long ans = 0;
	for (int i = 0; i < N; i++) {
		ans += A[i];
	}
	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 2844
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);
typedef unordered_map<ll, ll> ump;
typedef pair<ll, ll> P;

ump mp;

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
        mp = ump();
#pragma clang diagnostic pop
#endif
        ll n;
        double ans = 0;
        cin >> n;
        rep(i, n) {
            double x;
            string u;
            cin >> x >> u;
            if (u == "BTC") ans += x * 380000;
            else ans += x;
        }
        cout << fixed << ans << endl;


#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 256
import sys
# sys.setrecursionlimit(100000)


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


def input_int():
    return int(input())


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


def main():
    n = input_int()
    for a in range(1, 3501):
        for b in range(1, 3501):
            if 4 * a * b - n * b - n * a == 0:
                continue
            c = (n * a * b) // (4 * a * b - n * b - n * a)
            if c < 1:
                continue
            if 4 * a * b * c == n * (a * b + b * c + c * a):
                print(a, b, c)
                return
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 65220
#include<stdio.h>
int main()
{
    int a,b,c,d,e,k,count=0;
    scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&k);

    if(b-a>k)
        count++;
    else if(c-a>k)
        count++;
    else if(d-a>k)
        count++;
        else if(e-a>k)
        count++;
        else if(c-b>k)
        count++;
        else if(d-b>k)
        count++;
        else if(e-b>k)
        count++;
        else if(d-c>k)
        count++;
        else if(e-c>k)
        count++;
        else if(d-e>k)
        count++;

        if(count)
            printf(":(");
        else
            printf("Yay!");
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;

#define SZ(x) ((int)x.size())

const int N = (int)2e5+5;
int n, m, n2, b[N];
ii a[N];
priority_queue<int, vector<int>, greater<int> > pq;

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; ++i) scanf("%d%d", &a[i].first, &a[i].second);
	sort(a + 1, a + n + 1);
	int res = 0;
	for (int i = 1; i <= n; ++i) {
		pq.push(a[i].second);
		while (SZ(pq) > a[i].first) b[++n2] = pq.top(), pq.pop();
	}
	res += SZ(pq);
	while (SZ(pq)) pq.pop();
	sort(b + 1, b + n2 + 1);
	int lo = res + 1;
	for (int i = n2; i >= 1; --i) {
		pq.push(-b[i]);
		while (SZ(pq) > m - max(b[i], lo) + 1) pq.pop();
	}
	res += SZ(pq);
	printf("%d", n - res);
	return 0;
}


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

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

int a, b, k[30][30], ans = inf, cou;
int main() {
	cin >> a >> b;
	for (int i = 0; i < a; ++i) {
		for (int j = 0; j < b; ++j) {
			cin >> k[i][j];
		}
	}

	for (int i = 0; i < a; ++i) {
		for (int j = 0; j < b; ++j) {
			cou = 0;
			//calc
			for (int ii = 0; ii < a; ++ii) {
				for (int jj = 0; jj < b; ++jj) {
					cou += min(k[ii][jj] * (abs(ii - i)), k[ii][jj] * (abs(jj - j)));
				}
			}
			ans = min(ans, cou);
		}
	}
	cout << ans << endl;
}



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

int main(){
	int n;
	cin >> n;
	LL a[n];
	LL ans = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		if(i > 0 && a[i] == a[i-1]){
			ans++;
			a[i] = -1000;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int out = 0;
		
		int n = scan.nextInt();
		int time = scan.nextInt();
		
		for(int i = 0; i < n; i++) {
			int c = scan.nextInt();
			int t = scan.nextInt();
			
			if(t > time) {
				continue;
			}
			if(out==0) {
				out = c;
			} else {
				if(c < out) {
					out = c;
				}
			}
		}
		if(out==0) {
			System.out.println("TLE");
		}else {
		System.out.println(out);
		}
	}
}


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

#define ll long long int
#define pii pair<int,int>
#define PII pair<ll,ll>

const ll sz=1e5+100;

int main()
{
    string str;
    cin>>str;

    ll sum=0;
    for(ll i=0;str[i];i++) sum+=(str[i]-'0');
    if(sum % 9ll==0 ) cout<<"Yes\n";
    else cout<<"No\n";
}


Measured memory_bytes: 3708
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;
int main(){
  long long h;
  cin >> h;
  long long n=0;
  if(h==1) {cout << "1"; exit(0);}
  while(h>0){
    h/=2;
    n++;
  }
  cout << (long long)pow(2, n)-1;
  return 0;
}

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

int main(){
  int n,wa[41],flag[5];
  char s[40][20];
  while(1){
    cin>>n;
    if(n==0)
      break;
    wa[0]=0;
    for(int i=0;i<n;i++){
      scanf("%s",s[i]);
      wa[i+1]=strlen(s[i])+wa[i];
    }
    for(int i=0;i<n-1;i++){
      for(int j=0;j<5;j++)
        flag[j]=0;
      for(int k=i;k<=n;k++){
        if(wa[k]-wa[i]==5)
          flag[0]=1;
        else if(wa[k]-wa[i]==12)
          flag[1]=1;
        else if(wa[k]-wa[i]==17)
          flag[2]=1;
        else if(wa[k]-wa[i]==24)
          flag[3]=1;
        else if(wa[k]-wa[i]==31)
          flag[4]=1;
      }
      if(flag[0]==1&&flag[1]==1&&flag[2]==1&&flag[3]==1&&flag[4]==1){
        cout<<i+1<<endl;
        break;
      }
    }
  }
}


Measured memory_bytes: 3164
#include <iostream>

using namespace std;

int main (void) {
  int K, S;
  cin >> K >> S;
  int ans = 0;

  for (int x = 0; x <= K; x++) {
    for (int y = 0; y <= K; y++) {
      int z = S - x - y;
      if (0 <= z and z <= K) {
        ans += 1;
      }
    }
  }

  cout << ans << endl;
  return 0;
}


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

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		Scanner sc = new Scanner(br.readLine());
		int a=sc.nextInt();
		int b=sc.nextInt();
		int c=sc.nextInt();
		shou(a,b,c);
	}
	static void shou(int...is ){int tmp=0;
		int l=is.length;
		for(int i=0;i<l-1;i++){
			for(int n=i+1;n<l;n++){
				if(is[i]>is[n]){
					tmp=is[i];
					is[i]=is[n];
					is[n]=tmp;
				}
			}
			}System.out.println(is[0]+" "+is[1]+" "+is[2]);
		}}
	

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

using namespace std;

using ll = long long;

void dfs(int cur, int par, const vector< vector<int> >& g, vector<int>& d) {
    for (int nex : g[cur]) {
        if (nex == par) continue;
        d[nex] = d[cur] + 1;
        dfs(nex, cur, g, d);
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, u, v;
    cin >> n >> u >> v;
    --u; --v;

    vector< vector<int> > g(n);
    for (int i = 1; i < n; ++i) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    vector<int> du(n, 0), dv(n, 0);
    dfs(u, -1, g, du);
    dfs(v, -1, g, dv);

    int ans = 0;
    for (int i = 0; i < n; ++i) {
        if (du[i] >= dv[i]) {
            ans = max(ans, dv[u] / 2);
        } else {
            ans = max(ans, du[i] + max(dv[i] - du[i] - 1, 0));
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 12928
def dfs(i, cnt):
    D[i] = cnt
    cnt += 1
    for c in v[i]:
        if D[c-1] == -1:
            cnt = dfs(c-1, cnt)
    F[i] = cnt
    cnt += 1
    return cnt


N = int(input())
g = [0]*N
k = [0]*N
v = [[] for _ in range(N)]
for i in range(N):
    tmp = list(map(int, input().split()))
    g[i] = tmp[0]
    k[i] = tmp[1]
    if k[i] != 0:
        v[i] = sorted(tmp[2:])

D = [-1] * N
F = [-1] * N
cnt = 1
for i in range(N):
    if D[i] == -1:
        cnt = dfs(i, cnt)

for i, (d, f) in enumerate(zip(D, F)):
    print(i+1, d, f)



Measured memory_bytes: 5716
H,W=map(int,input().split())

a=[list(map(int,input().split())) for i in range(H)]
ans=[]
for i in range(H):
    for j in range(W-1):
        if a[i][j]%2==1:
            a[i][j+1]+=1
            ans.append(str(i+1)+" "+str(j+1)+" "+str(i+1)+" "+str(j+2))

for i in range(H-1):
    if a[i][W-1]%2==1:
        a[i+1][W-1]+=1
        ans.append(str(i+1)+" "+str(W)+" "+str(i+2)+" "+str(W))    



n=len(ans)
print(n)
for i in range(n):
    print(ans[i])

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

l = inputIL()

if max(l) == sum(l)/2:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 63980
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <stdio.h>
#include <string.h>
using ll = long long;

//LLONG_MAX
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
using namespace std;

int N, M;
int A[9];

struct P
{
	int num;
	int honsu;

	bool operator < (const P &p) const
	{
		return p.num < num;
	}
};

vector<P> m;

int min_n = INT_MAX;
int min_hon = INT_MAX;

int cnt;
int ans[10000];

int max_depth = 0;
int max_n = 0;
int max_ans[10000];

void end()
{
	vector<int> a;
	for (int i = 0; i < cnt; i++)
	{
		a.push_back(min_n);
	}
	for(int i=0;;i++)
	{
		if (max_ans[i] == 0)
		{
			break;
		}
		a.push_back(max_ans[i]);
	}

	SORT(a);

	for(int i=a.size() - 1; i >= 0; i--)
	{
		cout << a[i];
	}
	cout << endl;

	exit(0);
}

void func(int depth, int rest)
{
	if (rest < 0)
	{
		return;
	}

	if (rest == 0)
	{
		int maxn = 0;
		for (int i = 0; i < depth; i++)
		{
			maxn = MAX(maxn, ans[i]);
		}

		if (depth > max_depth)
		{
			max_depth = depth;
			max_n = maxn;
			memcpy(max_ans, ans, sizeof(ans));
		}
		if (depth == max_depth && maxn > max_n)
		{
			max_n = maxn;
			memcpy(max_ans, ans, sizeof(ans));
		}
		return;
	}

	for (int i = 0; i < m.size(); i++)
	{
		ans[depth] = m[i].num;
		func(depth + 1, rest - m[i].honsu);
		ans[depth] = 0;
	}
}

signed main()
{
	cin >> N >> M;
	REP(i, M)
	{
		cin >> A[i];
	}

	ARY_SORT(A, M);

	bool flg[10] = {};
	int su[] = { 0,2,5,5,4,5,6,3,7,6 };
	for (int i = M - 1; i >= 0; i--)
	{
		if (!flg[su[A[i]]])
		{
			flg[su[A[i]]] = true;
			P p;
			p.num = A[i];
			p.honsu = su[A[i]];
			m.push_back(p);
		}
	}

	SORT(m);

	for (P& p : m)
	{
		if(p.honsu < min_hon)
		{
			min_hon = p.honsu;
			min_n = p.num;
		}
	}

	cnt = MAX(0, N / min_hon - 12);
	while(true)
	{
		int rest = N - (cnt * min_hon);
		func(0, rest);

		if (max_depth > 0)
		{
			end();
		}

		cnt--;
	}
}









Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int solve(string& s, int i, vector<bool>& check, set<string>& front, set<string>& back)
{
    if(i == s.size()){
        front.insert(s);
        back.insert(s);
        if(front.size() > 5){
            front.erase(--front.end());
            back.erase(back.begin());
        }

        return 1;
    }

    int ret = 0;
    if(s[i] == 'a' || check[s[i]])
        ret += solve(s, i + 1, check, front, back);
    if(s[i] != 'z' && !check[s[i]+1]){
        ++ s[i];
        check[s[i]] = true;
        ret += solve(s, i + 1, check, front, back);
        check[s[i]] = false;
        -- s[i];
    }

    return ret;
}

int main()
{
    for(;;){
        string s;
        cin >> s;
        if(s == "#")
            return 0;

        vector<bool> check(128, false);
        set<string> front, back;
        int n = solve(s, 0, check, front, back);
        cout << n << endl;

        while(front.size() + back.size() > n)
            back.erase(back.begin());
        for(const auto& t : front)
            cout << t << endl;
        for(const auto& t : back)
            cout << t << endl;
    }
}

Measured memory_bytes: 1200
import numpy as np
import math

ABHM=np.array(input().split(" "),dtype=np.int32)

A=ABHM[0]
B=ABHM[1]
H=ABHM[2]
M=ABHM[3]

minutes=H*60+M
long_angle=6*minutes%360
small_angle=0.5*minutes%360

angle=0
if(long_angle>small_angle):
    angle=long_angle-small_angle
else:
    angle=small_angle-long_angle

if(angle==180):
    S=A+B
else:
    S=np.sqrt(pow(A,2)+pow(B,2)-2*A*B*np.cos(np.radians(angle)))
print(S)

Measured memory_bytes: 27204
#include <bits/stdc++.h>
typedef long long ll;
#define mod 1000000007
using namespace std;
ll power(ll a, ll b){
    if(b == 0 || a == 1)
        return 1;
    ll so = power(a, b / 2);
    so = (so * so) % mod;
    if(b % 2 == 1)
    so = (so * a) % mod;
    return so;
}
int main() {
    ll n, k;
    cin >> n >> k;
    ll fact[n+5];
    fact[0] = 1;
    for(ll i = 1; i <= n + 4; i++)
        fact[i] = (fact[i-1] * i) % mod;
    ll inv[n+5];
    inv[0] = 1;
    inv[1] = 1;
    for(ll i = 2; i <= n + 4; i++)
        inv[i] = (inv[i-1] * power(i, mod - 2)) % mod;
    ll b = k, r = n - k;
    for(int i = 1; i <= k; i++){
        if(r + 1 < i){
            cout << 0 << endl;
            continue;
        }
        ll ans = (fact[r+1] * fact[b-1]) % mod;
        ans = (ans * inv[i]) % mod;
        ans = (ans * inv[r+1-i]) % mod;
        ans = (ans * inv[i-1]) % mod;
        ans = (ans * inv[b-i]) % mod;
        cout << ans << endl;
        
    }
    
    return 0;
}

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

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

	cin >> a >> b >> c >> d;

	if (abs(a - c) <= d || abs(a - b) <= d && abs(b - c) <= d)cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a[4][4],x,y,z,m,i,j;
	for(i=0;i<3;i++)
	{
		for(j=0;j<3;j++)
			scanf("%lld",&a[i][j]);
	}
	
	m=0;
	for(i=1;i<3;i++)
	{
		x=a[i][0]-a[i-1][0];
		y=a[i][1]-a[i-1][1];
		z=a[i][2]-a[i-1][2];
		if(x!=y||y!=z||x!=z)
		{
			m=1;break;
		}
	}
	if(m==1)
	{
		printf("No\n");
	}
	else
	{
		m=0;
		for(j=1;j<3;j++)
		{
			x=a[0][j]-a[0][j-1];
			y=a[1][j]-a[1][j-1];
			z=a[2][j]-a[2][j-1];
			if(x!=y||y!=z||x!=z)
			{
				m=1;break;
			}
		}
		if(m==0)
		printf("Yes\n");
		else
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char w;
  cin >> w;
  if (w == 'a' || w == 'e' || w == 'i' || w == 'o' || w == 'u'){
    cout << "vowel" << endl;
  }else{
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
using namespace std;
ll INF = 1000000007;
using Graph = vector<vector<ll>>;

// 0 false, 1 true 
// stringの数字をint型にしてアスキーコードになったら -48する

ll n, m;

//通ったか通ってないかを判定する配列(mainでfalseに初期化)
vector<bool> seen;
vector<bool> in_seen;

ll ans = 0;

void dfs(const Graph &G, ll v, vector<bool> in_seen)
{
    in_seen[v] = true;

    bool all_visit_flag = true;
    for(int i = 0; i < n; i++){
        if(in_seen[i] == false){
            all_visit_flag = false;
        }
    }

    if(all_visit_flag){
        ans++;
    }

    for(ll next_node : G[v]){
        if(in_seen[next_node]){
            continue;
        }else{
            ///////
            //今見てるnodeに対する処理
            ///////
            dfs(G, next_node, in_seen);
        }
    }

}


int main() {
    //n:頂点の数, m:辺の数

    cin >> n >> m;

    Graph G(n);
    for (ll i = 0; i < m; ++i) {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;

        //有向グラフ
        //G[a].push_back(b);

        //無向グラフ
        G[a].push_back(b); G[b].push_back(a);

    }


    seen.assign(n,false);
    in_seen.assign(n,false);
    dfs(G, 0, in_seen);

    cout << ans << endl;


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
long long a[3005];
long long dp[3005][3005];
long long k[2];

int main(){
	scanf("%d",&n);
	k[0]=-1,k[1]=1;
	for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
	for(int i=1;i<=n;i++) dp[i][i]+=k[n&1]*a[i];
	for(int len=2;len<=n;len++){
		for(int l=1;l<=n-len+1;l++){
			int r=l+len-1;
			if((n-len+1)&1) dp[l][r]=max(dp[l+1][r]+a[l],dp[l][r-1]+a[r]);
			else dp[l][r]=min(dp[l+1][r]-a[l],dp[l][r-1]-a[r]);
		}
	}
	printf("%lld\n",dp[1][n]);
	
	return 0;
}   

Measured memory_bytes: 70016
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) noexcept {
  return std::vector<T>(n, std::forward<T>(val));
}

template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) noexcept {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}

template<class T, class Cond>
struct chain {
  Cond cond; chain(Cond cond) : cond(cond) {}
  bool operator()(T& a, const T& b) const {
    if(cond(a, b)) { a = b; return true; }
    return false;
  }
};
template<class T, class Cond>
chain<T, Cond> make_chain(Cond cond) { return chain<T, Cond>(cond); }

#include <vector>
#include <queue>

/*
 * delta(V v, fn (V t, W weight))
 * index(V v) -> int
 */
template<class V, class W, class Delta, class Index>
std::vector<W> dijkstra(std::size_t N, W inf, V s, Delta delta, Index index) {
  std::vector<W> dist(N, inf);
  using P = std::pair<W, V>;
  std::priority_queue<P, std::vector<P>, std::greater<P>> que;
  que.push({ dist[index(s)] = W(), s });
  while(!que.empty()) {
    W d = que.top().first;
    V v = que.top().second;
    que.pop();
    if(dist[index(v)] < d) continue;
    delta(v, [&](V t, W weight) {
        if(dist[index(t)] > dist[index(v)] + weight) {
          que.push({ dist[index(t)] = dist[index(v)] + weight, t });
        }
    });
  }
  return dist;
}

int main() {
  i64 N, M, S;
  cin >> N >> M >> S;
  S = std::min(S, 2500ll);

  struct edge {
    i64 to;
    i64 a;
    i64 b;
  };

  vector<vector<edge>> G(N);
  rep(i,0,M) {
    i64 u, v, a, b;
    cin >> u >> v >> a >> b;
    u--;
    v--;
    G[u].push_back({ v, a, b });
    G[v].push_back({ u, a, b });
  }

  vector<i64> C(N);
  vector<i64> D(N);
  rep(i,0,N) {
    cin >> C[i] >> D[i];
  }

  using P = std::pair<i64, i64>;
  auto index = [&](P p) { return p.first * 2501 + p.second; };
  auto delta = [&](P vv, auto func) {
    i64 v = vv.first;
    i64 c = vv.second;
    func(P(v, std::min(c + C[v], 2500ll)), D[v]);
    for(auto e: G[v]) {
      if(e.a <= c) {
        func(P(e.to, c - e.a), e.b);
      }
    }
  };
  auto res = dijkstra(N * 2501, (i64)(1e17), P(0, S), delta, index);
  rep(i,1,N) {
    i64 ans = res[index(P(i, 0))];
    rep(j,0,2501) {
      ans = std::min(ans, res[index(P(i, j))]);
    }
    cout << ans << "\n";
  }
}


Measured memory_bytes: 7340