akhauriyash/Code-Regression huggingface dataset:
//By Don4ick
#include <bits/stdc++.h>

const int N = (int)105;

using namespace std;

string s;

int main()
{
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);

	cin >> s;    
	int ans = (int)s.size();
	for (int letter = 'a'; letter <= 'z'; letter++)
	{
		int last = (int)s.size(), res = 0;
		for (int i = (int)s.size() - 1; i >= 0; i--)
		{
			if (s[i] == letter)
				last = i;
			res = max(res, last - i);			
		}
		ans = min(ans, res);
	}	
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,M[N][N];
int color[N],d[N],f[N],tt;

void dfs_visit(int u)
{
  int v;

  color[u] = GRAY;
  d[u] = ++tt;
  for(v = 0; v < n; v++)
    {
      if(M[u][v] == 0) continue;
      if(color[v] == WHITE)
	dfs_visit(v);
    }
  color[u] = BLACK;
  f[u] = ++tt;
};

void dfs()
{
  int u;
  for(u = 0; u < n; u++)
    color[u] =WHITE;
  tt = 0;

  for(u = 0; u < n; u++)
    if(color[u] == WHITE)
      dfs_visit(u);
  for(u = 0; u < n; u++)
    printf("%d %d %d\n",u+1,d[u],f[u]);
};

int main()
{
  int i,j;
  int u,k,v;

  scanf("%d",&n);
  for(i = 0; i < n; i++)
    for(j = 0; j < n; j++)
      M[i][j] = 0;

  for(i = 0; i < n; i++)
    {
      scanf("%d %d",&u,&k);
      u--;
      for(j = 0; j < k; j++)
	{
	  scanf("%d",&v);
	  v--;
	  M[u][v] = 1;
	}
    }

  dfs();
  
  return 0;
}



Measured memory_bytes: 2112
#include <iostream>
#include <algorithm>
#include <stack>
#include <string>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <list>
using namespace std;

int main() {
	list<int> v;
	int q, x;
	scanf("%d", &q);
	char com[20];
	for(int i = 0; i < q; i++) {
		scanf("%s", com);
		if(com[0] == 'i') {
			scanf("%d", &x);
			v.push_front(x);
		} else if(com[6] == 'F') {
			v.pop_front();
		} else if(com[6] == 'L') {
			v.pop_back();
		} else if(com[0] == 'd') {
			scanf("%d", &x);
			for( list<int>::iterator it = v.begin(); it != v.end(); it++) {
				if( *it == x ) {
					v.erase(it);
					break;
				}
			}
		}
	}
	int i = 0;
	for( list<int>::iterator it = v.begin(); it != v.end(); it++) {
		if( i++ ) printf(" ");
		printf("%d", *it);
	}
	printf("\n");

	return 0;
}

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

using namespace std;

#define FOR(i,s,e) for((i)=(s);(i)<(int)(e);(i)++)
#define REP(i,e) FOR(i,0,e)

#define all(o) (o).begin(), (o).end()
#define psb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))

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

const double EPS = 1e-10;

const int M = 2;
int a[M][M], b[M][M], w[M][M];
int n;

void multiple_mat_ab_b() {
  int i, j, k;
  memset(w, 0, sizeof(w));
  for (i=0; i<M; i++)
    for (j=0; j<M; j++)
      for (k=0; k<M; k++)
        w[i][j] += a[i][k]*b[k][j];

  for (i=0; i<M; i++)
    for (j=0; j<M; j++)
        b[i][j] = w[i][j];
}

void multiple_mat_aa_a() {
  int i, j, k;
  memset(w, 0, sizeof(w));
  for (i=0; i<M; i++)
    for (j=0; j<M; j++)
      for (k=0; k<M; k++)
        w[i][j] += a[i][k]*a[k][j];

  for (i=0; i<M; i++)
    for (j=0; j<M; j++)
        a[i][j] = w[i][j];
}

void pow_mat_a(int k) {
  a[0][0] = a[0][1] = a[1][0] = 1;
  a[1][1] = 0;

  b[0][0] = b[1][1] = 1;
  b[0][1] = b[1][0] = 0;

  //?????´???a???k????????????
  for (int i=0; i<k; i++)
    multiple_mat_ab_b();

}

int main() {
  scanf("%d ", &n);
  pow_mat_a(n);
  printf("%d\n", b[1][0]+b[1][1]);

	return 0;
}

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

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;

#define rep(idx, N) for (u64 idx = 0; idx < N; idx++)


int main() {
    i32 x;
    cin >> x;

    if(x>=30) cout << "Yes";
    else cout << "No";

  return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef map<ll,ll>::iterator itll;
typedef long double ld;
typedef map<ll,ll> mapll;
typedef map<string,ll> mapstl;
#define con continue
#define pb push_back
#define fi first
#define se second
#define fr front()
#define one 1.0
#define inf 1000000000000000000
#define all(vl) vl.begin(),vl.end()
#define m_p make_pair 
#define sz(a) sizeof(a)
#define forn(mp,it) for(it = mp.begin();it!=mp.end();it++)
int main()
{
	ll n;
	cin>>n;
	vector<ll> vl(n);
	vector<ll> len;
	for(int i=0;i<n;i++)cin>>vl[i];
	ll tmp = vl[0];
	ll tlen = 1;
	for(int i=1;i<n;i++)
	{
		if(vl[i] <= tmp)
		{
			tmp = vl[i];
			tlen++;
		}
		else
		{
			len.push_back(tlen-1);tlen = 1;tmp = vl[i];
		}
	 } 
	if(tmp != -1)
	{
		len.push_back(tlen-1);
	}
	sort(all(len));
	cout<<len[len.size()-1]<<endl;
	return 0;
}

Measured memory_bytes: 5036
#include<stdio.h>

#define N 100

int main() {
  int data[N][N];
  int i,j,x,a,b,c;

  scanf("%d",&x);
  for(i = 0; i < x; i++) {
    for(j = 0; j < x; j++) {
      data[i][j] = 0;
    }
  }

  for(i = 0; i < x; i++) {
    scanf("%d%d",&a,&b);
    a--;
    for(j = 0; j < b; j++) {
      scanf("%d",&c);
      c--;
      data[a][c] = 1;
    }
  }

  for(i = 0; i < x; i++) {
    for(j = 0; j < x - 1; j++) {
      printf("%d ",data[i][j]);
    }
    printf("%d\n",data[i][j]);
  }

  return 0;
}
   
    



Measured memory_bytes: 2104
#include <iostream>
#include <stdio.h>

using namespace std;

int main()
{
    double r, l , s;
    cin >> r;
    double pi = 3.141592653589;

    l = 2 * pi * r;
    s = pi * r *r;

    printf("%.6lf", s);
    cout << " ";
    printf("%.6lf\n", l);

    return 0;
}


Measured memory_bytes: 3296
#include<bits/stdc++.h>
#define LL long long
#define fr(i,x,y) for(int i=(x);i<=(y);i++)
#define rf(i,x,y) for(int i=(x);i>=(y);i--)
#define frl(i,x,y) for(int i=(x);i<(y);i++)
using namespace std;
const int N=3000002;
const int p=998244353;
int n,m;
LL mul[N],inv[N];
LL ans;

void read(int &x){ scanf("%d",&x); }
void read(LL &x){ scanf("%lld",&x); }

LL qpow(LL a,int n){
	LL ans=1;
	for(LL sum=a;n;n>>=1,sum=sum*sum%p) if (n&1) ans=ans*sum%p;
	return ans;
}

void init(){
	mul[0]=1;
	frl(i,1,N) mul[i]=mul[i-1]*i%p;
	inv[N-1]=qpow(mul[N-1],p-2);
	rf(i,N-2,0) inv[i]=inv[i+1]*(i+1)%p;
}

LL C(int n,int m){
	if (n<0||m<0||n-m<0) return 0;
	return mul[n]*inv[m]%p*inv[n-m]%p;
}

void Add(LL &x,LL y){
	x+=y;
	while(x<0) x+=p;
	while(x>=p) x-=p;
}

int main(){
	read(n);read(m);
	init();
	fr(i,0,m)
	 if ((3*m-i)%2==0) Add(ans,C(n,i)*C((3*m-i)/2+n-1,n-1)%p);
	fr(i,0,m)
	 if ((m-i)%2==0) Add(ans,-C(n,i)*C((m-i)/2+n-1,n-1)%p*n%p);
	fr(i,0,m)
	 if ((m-i)%2==0) Add(ans,C(n-1,i)*C((m-i)/2+n-2,n-2)%p*n%p);
	cout<<ans<<endl;
	return 0;
}

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

int main() {
    int a, b;
    cin >> a >> b;
    string s;
    cin >> s;
    string nums = "0123456789";
    string ans = "Yes";
    rep(i,a) if (nums.find(s[i]) == string::npos) ans = "No";
    if (s[a] != '-') ans = "No";
    rep(i,b) if (nums.find(s[a+1+i]) == string::npos) ans = "No";
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int P = sc.nextInt();
		System.out.println((A*3+P)/2);
	}

}


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

typedef long long ll;

using namespace std;

int main(){

    int n, k;
    cin >> n >> k;

    int ans = 0;

    rep(i,n){
        int tmp;
        cin >> tmp;

        if(tmp >= k) ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pop pop_back
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
//#define min min<int>
//#define max max<int>
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
/*template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}*/
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int n){
	par= vector<int>(n, -1);
  }
  int find(int x){
    if(par[x]<0)
      return x;
    else
      return par[x]=find(par[x]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
/*struct aa{
	vector<int> gt;
  aa(int n){
	gt= vector<int>(n, 1);
  }
	void c(V<int> d,int b){
	if(d[b]==0){
		gt[d[b]-1]++;
		gt[gt.sz-1]++;
	}
	else{
		gt[d[b]-1]++;
		c(d,d[d[b]]-1);
	}
}
void cok(int a){
	cout<<gt[a-1]<<endl;
	fo(i,a-1)
	cout<<gt[i]<<endl;
}
};
*/
signed main(){
	int a,b,c;
	cin>>a>>b>>c;
	cout<<b*(c/a)<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define LL long long
const int inf=1e9;
const LL mod=998244353;
#define mem(a,b) memset(a,b,sizeof(a))
int max(int a,int b) {return a>b?a:b;}
LL a[100055];
LL b[100055];
LL c[100055];
int vis[100005];
struct node{
    int id;
    LL  cost;
}mp[100005];
int cmp(node a,node  b)
{
    return a.cost>b.cost;
}
int main()
{
    int n;
    LL ans1=0,ans2=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
        c[i]=a[i];
        ans1+=a[i];
    }
    for(int i=0;i<n;i++)
    {
        scanf("%lld",&b[i]);
        ans2+=b[i];
    }
    if(ans2>ans1)
    {
        printf("-1\n");
        return 0;
    }
    int cun=0;
    for(int i=0;i<n;i++)
    {
        if(b[i]>a[i])
        {
            vis[cun++]=i;
        }
    }
    int cot=0;
    for(int i=0;i<n;i++)
    {
        if(b[i]<a[i])
        {
            mp[cot].cost=a[i]-b[i];
            mp[cot++].id=i;
        }
    }
    sort(mp,mp+cot,cmp);
    int j=0;
    for(int i=0;i<cun;i++)
    {
        if(mp[j].cost>=b[vis[i]]-a[vis[i]])
        {
            mp[j].cost-=b[vis[i]]-a[vis[i]];
            c[mp[j].id]-=b[vis[i]]-a[vis[i]];
            c[vis[i]]=b[vis[i]];
        }
        else{
            while(mp[j].cost<b[vis[i]]-c[vis[i]])
            {
                c[vis[i]]+=mp[j].cost;
                mp[j].cost=0;
                c[mp[j].id]=b[mp[j].id];
                j++;
            }
            mp[j].cost-=b[vis[i]]-c[vis[i]];
            c[mp[j].id]-=b[vis[i]]-c[vis[i]];
            c[vis[i]]=b[vis[i]];
        }
    }
    int ans=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]!=c[i]) ans++;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 3584
N = gets.to_i
As = [nil] + gets.split.map(&:to_i)
UVs = readlines.map{_1.split.map(&:to_i)}
INF = 10**10

@g = UVs.each_with_object(Array.new(N + 1){[]}){|(u, v), g| g[u] << v; g[v] << u}
@dp = Array.new(N + 1, INF)
@r, @ans = 0, []

def dfs(i, i0)
  j = @dp.bsearch_index{As[i] <= _1}
  mem, @dp[j] = @dp[j], As[i]
  @r += 1 if j == @r
  @ans[i] = @r
  @g[i].each do |k|
    next if k == i0
    dfs(k, i)
  end
  @dp[j] = mem
  @r -= 1 if mem == INF
end

dfs(1, 0)
puts @ans.drop(1)

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

ifstream fin("input.in");
int h, w, n;

int main() {
  cin >> h >> w >> n;
  h = max(h,w);
  if(n%h == 0){
    cout << n/h << endl;
  }else{
    cout << n/h+1 << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

int main()
{
  int i,j;
  int a,b,c;


  cin>>a>>b>>c;

  set<int> st;
  st.insert(a);
  st.insert(b);
  st.insert(c);

  cout<<st.size()<<endl;

}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=2e5+50;
const int mod=1e9+7;
using namespace std;
int n,i,a[nmax];
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>n;
	for(i=1;i<=n;i++)cin>>a[i];
	sort(a+1,a+n+1);
	for(i=2;i<=n;i++)if(a[i]==a[i-1])rc("NO");
	cout<<"YES"<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
//PRAY :DOLPHINGARLIC: orz orz orz orz orz 
//PRAY :DORI: orz orz orz orz orz orz orz 
//PRAY :SAHIL KUCHLOUS: orz orz orz orz orz
//pray :stefan: orz orz orz orz orz orz orz
//pray :foshy: orz orz orz orz orz orz orz
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define Int long long
#define elif else if
#define test Int t; cin>>t; while(t--)

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(0);
	string s;cin>>s; 
	if(s[s.size()-1]!='s') s += 's';
	else s += "es";
	cout << s << endl;
    return 0;
}

Measured memory_bytes: 3672
A, B =  [float(i) for i in input().split(' ')]

B1 = int(B /0.1)
B2 = int((B+1) / 0.1)
flag = 0
for i in range(B1, B2):
    if int(i * 0.08) == A :
        print(i)
        flag = 1
        break
if flag == 0:
    print(-1)

Measured memory_bytes: 3060
# 君指先跃动の光は、私の一生不変の信仰に、唯私の超电磁炮永生き！
from sys import stdin, stdout
import math
import bisect
from collections import defaultdict
import datetime
import random

# n = int(stdin.readline().strip())
# arr = list(map(int, stdin.readline().strip().split()))

n, m = map(int, stdin.readline().strip().split())

if m == 1:
    stdout.writelines('1 2\n')
else:
    m1 = m // 2
    m2 = m - m1
    a = m2
    b = a + 1
    for i in range(m2):
        stdout.writelines('%d %d\n' % (a, b))
        a -= 1
        b += 1
    a = b
    b = a + m1 * 2
    for i in range(m1):
        stdout.writelines('%d %d\n' % (a, b))
        a += 1
        b -= 1


Measured memory_bytes: 108100
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll s(ll a) {
	stringstream ss;
	ss << a;
	string s;
	ss >> s;
	return s.size();
}
ll f(ll a, ll b) {
	return max(s(a), s(b));
}
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	ll n;
	cin >> n;
	ll ans = 1e18;
	for (ll i = 1; i * i <= n; i++) {
		if (n % i == 0) ans = min(ans, f(i, n / i));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b , a % b);
}

ll mod(ll a){
  return (a % 1000000007);
}

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

ll nCr(ll n,ll r){
  if(r == 1) return n;
  else if(r == 0) return 1;
  else return nCr(n-1,r-1)*n/r;
}

int main(){
  ll n,t; cin >> n >> t; ll ans = t;
  vl time(n);
  
  rep(i,n) cin >> time[i];
  
  for(ll i=0; i < n-1; i++){
    ans += min(t,time[i+1]-time[i]);
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define until(x) while(!(x))
#define unless(x) if(!(x))
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pc __builtin_popcount

int32_t main(){
	int n;
	cin>>n;
	int cur = 0;
	set<int> se;
	for(int i=1;cur<n;i++){
		cur += i;
		se.insert(i);
	}
	if(se.count(cur-n)){
		se.erase(cur-n);
	}
	for(auto x: se){
		cout<<x<<"\n";
	}
}


Measured memory_bytes: 512
s = input()
l = []

for i in range(len(s)):
    if s[i] == '0':
        l.append(0)
    elif s[i] == '1':
        l.append(1)
    elif s[i] == 'B':
        if len(l) > 0:
            l.pop()

print(''.join(map(str, l)))

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

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		double r = Double.parseDouble(br.readLine());
		double surface = r * r * Math.PI;
		double length = 2 * r * Math.PI;
		System.out.printf("%.6f %.6f", surface, length);
	}

}

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

int n;

int main() {
	cin >> n;
	if(n == 1 || n == 2 || n == 3 || n == 5 || n == 6 || n == 9 || n == 10 || n == 13 || n == 17) {
		cout<<"No"<<endl;
	}
	else{
		cout<<"Yes"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var n = cin.nextLong();
            var k = cin.nextLong();

            var ans = n;
            ans = Math.Min(n % k, ans);
            ans = Math.Min(ans, Math.Abs(ans - k));

            Console.WriteLine(ans);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


Measured memory_bytes: 13140
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<set>
#include<vector>
#include<queue>
#include<ctime>
#include<map>
#define ll long long
#define pr(x) cerr<<#x<<"="<<x<<endl
using namespace std;
#define N 2000010
int n,m,i,j,dis[N],to[N],tp[N],tq[N],size,cnt,g[N],vis[N],o,p,q;
vector<int> col[N];
#define pa pair<int,int>
map<pair<int,int>,int>mp;
struct node
{
	int to,next,v;
}e[N*2];
void add(int o,int p,int q)
{
	e[++size].to=p;
	e[size].next=g[o];
	g[o]=size;
	e[size].v=q;
}
void dij()
{
	for (i=1;i<=cnt;i++)dis[i]=100000000;
	priority_queue<pa,vector<pa>,greater<pa> >que;
	dis[1]=0;
	que.push(make_pair(0,1));
	while (!que.empty())
	{
		int x=que.top().second;
		que.pop();
		if (vis[x]) continue;
		vis[x]=1;
		for (int k=g[x];k;k=e[k].next)
		{
			int y=e[k].to;
			if (dis[x]+e[k].v<dis[y])
			{
				dis[y]=dis[x]+e[k].v;
				que.push(make_pair(dis[y],y));
			}
		}
	}
}
int main()                   
{
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	scanf("%d %d",&n,&m);
	for (i=1;i<=m;i++)
	{
		scanf("%d %d %d",&o,&p,&q);
		col[o].push_back(q);
		col[p].push_back(q);
		to[i]=o,tp[i]=p,tq[i]=q;
	}
	cnt=n;
	for (i=1;i<=n;i++)
	{
		for (j=0;j<(int)col[i].size();j++)
		{
			if (mp[make_pair(i,col[i][j])]==0)
			{
				mp[make_pair(i,col[i][j])]=++cnt;
				//printf("point %d color %d --> %d\n",i,col[i][j],cnt);
				add(cnt,i,1);
				add(i,cnt,1);
			}
		}
	}
	for (i=1;i<=m;i++)
	{
		int tmpa=mp[make_pair(to[i],tq[i])],tmpb=mp[make_pair(tp[i],tq[i])];
		add(tmpa,tmpb,0);
		add(tmpb,tmpa,0);
	}
	//for (i=1;i<=size;i+=2)printf("%d--%d %d\n",e[i].to,e[i+1].to,e[i].v);
	dij();
	if (dis[n]==100000000)
	printf("-1\n");
	else 
	printf("%d\n",dis[n]/2);
	return 0;
}

Measured memory_bytes: 110456
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("trapv")
#pragma GCC target("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define deb(x) cout << #x << " is " << x << "\n"
#define int long long
#define mod 1000000007LL
#define PI acosl(-1)

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void solve()
{
	int n;
	cin >> n;
	vector<vector<int>> arr(n, vector<int>(n));
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			cin >> arr[i][j];
		}
	}
	vector<int> dp(1LL << n);
	dp[0] = 1;
	for (int mask = 0; mask < (1LL << n) - 1; mask++)
	{
		int a = __builtin_popcount(mask);
		for (int b = 0; b < n; b++)
		{
			if (arr[a][b] == 1 && (mask & (1LL << b)) == 0)
			{
				int newmask = mask ^ (1LL << b);
				dp[newmask] = (dp[newmask] + dp[mask]) % mod;
			}
		}
	}
	cout << dp[(1LL << n) - 1];
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
	return 0;
}

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

int n, m;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n >> m;
	if(n > m) swap(n, m);
	cout << ((n == 1 && m > 1) ? (m - 2) : (long long)(n - 2) * (m - 2)) << "\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
  int a,b;
  char op;
  cin >> a >> op >> b;
  while(op!='?'){
    int c;
    if(op=='+') c=a+b;
    if(op=='-') c=a-b;
    if(op=='*') c=a*b;
    if(op=='/') c=a/b;
    cout << c << endl;
    cin >> a >> op >> b;
  }
  return 0;
}



Measured memory_bytes: 3100
#include<iostream>
#include<map>
#include<list>
using namespace std;
class graph
{
    map<int,list<int>>mp;
    map<int,bool>visit;
    long long c=0,ma=0;
public:
    void addedge(int x,int y)
    {
        mp[x].push_back(y);
        mp[y].push_back(x);
    }
    void dfs_helper(int src)
    {
        visit[src]=true;
        for(auto i:mp[src])
        {
            //c++;
            if(!visit[i])
            {
                c++;
                dfs_helper(i);
            }
        }
    }
    void dfs()
    {
        for(auto i:mp)
        {
            visit[i.first]=false;
        }
        for(auto i:mp)
        {
            if(!visit[i.first])
            {
                c=0;
                dfs_helper(i.first);
                //ma=max(ma,c);
            }
            ma=max(ma,c);
        }
        cout<<max(ma,c)+1<<endl;
    }
};
int main()
{
    graph g;
    int n,q;
    cin>>n>>q;
    while(q--)
    {
        long long a,b;
        cin>>a>>b;
        g.addedge(a,b);
    }
    g.dfs();
    return 0;
}


Measured memory_bytes: 59684
#include<iostream>

using namespace std;

int main(){
  int N, M;
  cin >> N >> M;
  int L=0, R=N+1;
  for (int i = 0; i < M; i++){
    int Li, Ri;
    cin >> Li >> Ri;
    if(Li > L) L = Li;
    if(Ri < R) R = Ri;
  }

  if(L <= R){
    printf("%d\n", R - L + 1);
  }else
  {
    printf("0\n");
  }
  
  
}


Measured memory_bytes: 3776
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
ll a[100010];
ll two[100010];
ll one[100010];
ll cnt[100010];
ll ok[100010];
ll ans;
int n;
int main() {
    cin >> n;
    for (int i = 0; i <= n; i++) cin >> a[i];
    if (n == 0) {
        if (a[0] == 0) cout << 0 << endl;
        else if (a[0] == 1) cout << 1 << endl;
        else cout << -1 << endl;
        return 0;
    }
    if (a[0] != 0) {
        cout << -1 << endl;
        return 0;
    }
    ll cc = 0;
    for (int i = n; i >= 0; i--) {
        two[i] = cc / 2;
        one[i] = (cc & 1);
        cc = (cc + 1) / 2;
        cc += a[i];
        cnt[i] = cc;
        ans += cc;
    }
    if (cnt[0] != 1) {
        cout << -1 << endl;
        return 0;
    }
    // for (int i = 0; i <= n; i++) cout << two[i] << " \n"[i==n];
    // for (int i = 0; i <= n; i++) cout << one[i] << " \n"[i==n];
    int now = n-1;
    ll pls = 0;
    ll num = 1;
    for (int i = 0; i <= n; i++) {
        if (now <= i) break;
        // cout << i << " " << two[i] << " " << one[i] << " " << pls << " " << now << endl;
        ll lft = one[i] + pls;
        // cout << lft << endl;
        while (lft > 0) {
            ll link = min(two[now], lft);
            pls += link;
            two[now] -= link;
            one[now] += link;
            lft -= link;
            ans += (now - i) * link;
            // cout << "add " << now - i << "*" << link << endl;
            while (two[now] == 0) {
                now--;
                if (now <= i) {
                    break;
                }
            }
            if (now <= i) break;
        }
        if (now <= i) break;
    }
    // for (int i = 0; i <= n; i++) cout << a[i] << " \n"[i == n];
    // for (int i = 0; i <= n; i++) cout << cnt[i] << " \n"[i==n];
    // for (int i = 0; i <= n; i++) cout << ok[i] << " \n"[i==n];

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

Measured memory_bytes: 6724
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;

public class Main {

	private static BufferedReader brStdin = new BufferedReader(new InputStreamReader(System.in));
	private static String[] readBuf = null;
	private static int readPtr = 0;
	private static String getString() throws IOException {
		while ( readBuf == null || readPtr >= readBuf.length ) {
			readBuf = brStdin.readLine().split(" ");
		}
		return readBuf[readPtr++];
	}
	private static long getLong() throws IOException {
		return Long.parseLong(getString());
	}
	private static BigDecimal getBD() throws IOException {
		return new BigDecimal(getString());
	}
	@SuppressWarnings("unused")
	private static String[] getStringArray(int size) throws IOException {
		String stringArray[] = new String[size];
		for (int i = 0; i < stringArray.length; i++) {
			stringArray[i] = getString();
		}
		return stringArray;
	}
	@SuppressWarnings("unused")
	private static long[] getLongArray(int size) throws IOException {
		long longArray[] = new long[size];
		for (int i = 0; i < longArray.length; i++) {
			longArray[i] = getLong();
		}
		return longArray;
	}
	@SuppressWarnings("unused")
	private static BigDecimal[] getBDArray(int size) throws IOException {
		BigDecimal bdArray[] = new BigDecimal[size];
		for (int i = 0; i < bdArray.length; i++) {
			bdArray[i] = getBD();
		}
		return bdArray;
	}
	
	public static void main(String args[]) throws IOException {
		char c[] = getString().toCharArray();
		
		if ( c[0]==c[1] || c[1]==c[2] || c[2]==c[3] ) {
			System.out.println("Bad");
		} else {
			System.out.println("Good");
		}
	}
}


Measured memory_bytes: 21332
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
static const int INF = 1000010000;
static const int MOD = 1000000007;
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue

//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

int main(){
    int a, b;
    cin >> a >> b;
    if(a > 8 || b > 8){
        cout << ":(" << endl;
    }else{
        cout << "Yay!" << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
#include <iomanip>
using namespace std;
 
#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
  int H,W;
  cin >> H >> W;
  vector<vector<string>> S(H,vector<string>(W));
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin >> S.at(i).at(j);
      if(S.at(i).at(j)=="snuke"){
        char A='A'+j;
        cout << A << i+1 << endl;
      }
    }
  }
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define	foreach( gg,itit )	for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define	mp make_pair
#define	pb push_back
#define sz(a) int((a).size())
#define all(a)  a.begin(), a.end()
#define	debug(ccc)	cout << #ccc << " = " << ccc << endl;
#define present(c,x) ((c).find(x) != (c).end())
const double eps = 1e-8;
#define EQ(a,b) (fabs((a)-(b))<eps)
inline int max(int a,int b){return a<b?b:a;}
inline int min(int a,int b){return a>b?b:a;}
inline ll max(ll a,ll b){return a<b?b:a;}
inline ll min(ll a,ll b){return a>b?b:a;}
const int mod = 1e9+7;
const int N = 1e5+10;
const ll inf = 1e18;

ll power(ll a,ll n){
	if(n==0){
		return 1;
	}
	ll b = power(a,n/2);
	b = b*b%mod;
	if(n%2) b= b*a%mod;
	return b;
}

int add(int a,int b){ return (a+b)%mod;}
int mul(int a,int b){ return (ll)a*b%mod;}

vector < int > G[N];
vector < pair< pii , int > > Q;
int C[N];
bool vis[N][11];

void bfs(int p,int d,int c){
	if(vis[p][d]) return;
	queue < pii > Q;
	if(!C[p]) C[p]=c;
	Q.push(mp(p,d));
	while(!Q.empty()){
		pii a = Q.front(); Q.pop();
		if(a.Y==0) continue;
		REP(i,G[a.X].size()){
			if(vis[G[a.X][i]][a.Y-1]) continue;
			vis[G[a.X][i]][a.Y-1]=1;
			if(!C[G[a.X][i]])C[G[a.X][i]]=c;
			Q.push(mp(G[a.X][i],a.Y-1));
		}
	}
}

int main(){
 // 	freopen("nice.in","r",stdin);
 // freopen("nice.out","w",stdout);
	int n,m,q; scanf("%d %d",&n,&m);
	REP(i,m){
		int a,b; scanf("%d %d",&a,&b); a--,b--;
		G[a].pb(b); G[b].pb(a);
	}
	scanf("%d",&q);
		// printf("hi\n");

	REP(i,q){
		int v,d,c; scanf("%d%d%d",&v,&d,&c); v--;
		Q.pb(mp(mp(v,d),c));
		// printf("hi\n");
	}
	reverse(all(Q));
	REP(i,q){
		bfs(Q[i].X.X,Q[i].X.Y,Q[i].Y);
	}
	REP(i,n) printf("%d\n",C[i]);
	return 0;
}




Measured memory_bytes: 9968
#include <stdio.h>

int main(){
    long long int a,soma=0;

    scanf("%lld",&a);

    for(int i =1;i<=a;++i){
        if((i%3!=0) && (i%5!=0)){

            soma = soma + i;
    }
}

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


    return 0;

}


Measured memory_bytes: 1732
#include<cstdio>
using namespace std;
int main(void)
{
	int n,a,b,cnt,i;
	scanf("%d %d",&n,&a);
	cnt=0;
	for(i=0;i<n;i++){
		scanf("%d",&b);
		if(a<=b){
			cnt++;
		}
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
#include <iomanip>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#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++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int main()
{
	string a, b;
	while(cin >> a >> b && a != "0")
	{
		int blow = 0, hit = 0;
		rep(i, 4)
		{
			if(a[i] == b[i])
				hit++;
			else
				blow += (0 < count(ALL(b), a[i]));
		}

		cout << hit << " " << blow << endl;
	}
}

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

namespace kyopro
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] nx = Console.ReadLine().Split();
            int n = int.Parse(nx[0]);
            int x = int.Parse(nx[1]);
            string[] ln = Console.ReadLine().Split();
            int zahyou = 0;
            int kaisuu = 0;
            Boolean han = false;
            while (zahyou <= x)
            {
                if(kaisuu >= n)
                {
                    han = true;
                    break;
                }
                zahyou = zahyou + int.Parse(ln[kaisuu]);
                kaisuu = kaisuu + 1;
            }
            if (han)
            {
                Console.WriteLine(kaisuu + 1);
            }
            else
            {
                Console.WriteLine(kaisuu);
            }
        }
    }
}

Measured memory_bytes: 13140
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

long long getint(string str) {
	long long ret = 0;

	for (int i = 0; i < str.size(); i++) {
		ret = (long long)ret * 10 + (long long)(str[i] - '0');
	}

	return ret;
}

int main() {

	string s; cin >> s;

	if (s.size() == 1) {
		cout << s << endl;
		return 0;
	}
	
	int l = s.size()-1;

	long long ans = 0;

	reverse(s.begin(), s.end());

	for (int bit = 0; bit < (1 << l); bit++) {
		
		string tmp ="";
		tmp += s[0];
		
		for (int i = 0; i < l; i++) {
			if ((bit >> i) & 1) {
				ans += getint(tmp);
				tmp = s[i+1];
			}
			else {
				tmp= s[i+1]+tmp;
			}

			if (i == l - 1) {
				ans += getint(tmp);
			}
		}
	}

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

Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = LI()
    a.sort()
    a, b, c = a
    print(int(str(c)+str(b))+a)
    return

#B
def B():
    _, _, X, Y = LI()
    x = LI()
    y = LI()
    x.append(X)
    y.append(Y)
    x.sort()
    y.sort()
    print("No " * (x[-1] < y[0]) + "War")
    return

#C
def C():
    s = S()
    t = S()
    ds = defaultdict(int)
    dt = defaultdict(int)
    for i in range(len(s)):
        if ds[s[i]]:
            if ds[s[i]] == ord(t[i]):
                continue
            print("No")
            return
        if dt[t[i]]:
            if dt[t[i]] == ord(s[i]):
                continue
            print("No")
            return
        ds[s[i]] = ord(t[i])
        dt[t[i]] = ord(s[i])
    print("Yes")
    return

#D
def D():
    n, m = LI()
    if m == 1:
        print(1)
        return
    def combination_mod(n, k, mod):
        """ powを用いて(nCk) mod p を求める """ 
        """ nCk = n!/((n-k)!k!)を使用 """
        a = factorial[n]
        b = factorial[k] 
        c = factorial[n - k]
        return (a * pow(b, mod - 2, mod) * pow(c, mod - 2, mod)) % mod

    factorial = [None for i in range(200001)]
    factorial[0] = 1
    for i in range(1, 200001):
        factorial[i] = factorial[i - 1] * i
        if factorial[i] >= mod:
            factorial[i] %= mod
    def factorize(n):
        if n < 4:
            return {n:1}
        lis = {}
        i = 2   
        m = n
        while i**2 <= m:
            if m%i == 0:
                lis[i] = 0
                while m%i == 0:
                    m //= i
                    lis[i] += 1
            i += 1
        if m != 1:
            lis[m] = 1
        return lis
    d = factorize(m)
    ans = 1
    for a in d.values():
        ans *= combination_mod(a + n - 1, a, mod)
        if ans >= mod:
            ans %= mod
    print(ans)

    return

#Solve
if __name__ == '__main__':
    D()


Measured memory_bytes: 54128
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define f first
#define s second
#define int long long
int z[1919][1919];
pair<int,int> a[114514];
signed main(){
	ic(n)		
	rep(0,i,n)cin>>a[i].f;
	rep(0,i,n)a[i].s=i+1;
	sort(a,a+n);
	rep(0,i,n)cout<<a[i].s<<" ";
}	

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

const int MAX_N = 200010;
int _par[MAX_N];
int _size[MAX_N];
int _rank[MAX_N];

void init(int n){
    for (int i = 0; i < n; i++){
        _par[i] = i;
        _size[i] = 1;
        _rank[i] = 0;
    }
}

int getRoot(int x){
    if (_par[x] == x){
        return x;
    }else{
        return _par[x] = getRoot(_par[x]);
    }
}

void unite(int x, int y){
    x = getRoot(x);
    y = getRoot(y);
    if (x == y) return;
    if (_rank[x] == _rank[y]) {
        _par[y] = x;
        _size[x] = _size[x] + _size[y];
        _rank[x]++;  
    }else if (_rank[x] < _rank[y]) {
        _par[x] = y;
        _size[y] = _size[x] + _size[y];
    }else if (_rank[x] > _rank[y]) {
        _par[y] = x;
        _size[x] = _size[x] + _size[y];
    }
}

int getSize(int x){
    return _size[getRoot(x)];
}

bool isSame(int x, int y){
    return getRoot(x) == getRoot(y);
}


int main(){

    int N, M;
    cin >> N >> M;
    init(N);
    for (int i = 0; i < M; ++i){
        int a, b;
        cin >> a >> b;
        unite(a-1, b-1);
    }

    int res = 1;
    for (int i = 0; i < M; ++i){
        res = max(res, getSize(i));
    }
    cout << res << endl;
}


Measured memory_bytes: 5900
#include <stdio.h>
#include <string.h>
#define LINE_MAX 1001

int main(void){
	int len,c,lf,i,outc;
	int out[LINE_MAX];
	char str[LINE_MAX];
	while(1){
		i = 0;
		lf = 0;
		outc = 0;
		while(1){
			len = 0;
			while(1){
				c = getchar();
				str[i] = c == '\n' ? '\0' : c ;
				i++;
				if(c == ' '){
					out[outc] = len;
					outc++;
					break;
				}else if(c == '\n'){
					out[outc] = len;
					outc++;
					lf = 1;
					break;
				}else{
					len++;
				}
			}
			if(lf){break;}
		}
		if(!strcmp(str,"END OF INPUT")){
			break;
		}else{
			for(i = 0; i < outc; i++){
				printf("%d",out[i]);
			}
			putchar('\n');
		}
	}


	return 0;
}

Measured memory_bytes: 0
program abc129e;
var
  L: string;
  I, T, Result: Int64;
begin
  Read(L);

  Result := 1;
  T := 1;
  for I := Length(L) downto 1 do
  begin
    if L[i] = '1' then
    begin
      Result := Result * 2 + t;
      Result := Result mod 1000000007;
    end;
    T := T * 3;
    T := T mod 1000000007;
  end;
  WriteLn(Result);
end.

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

int main(){

  int N, M; cin >> N >> M;

  bool graph[N][N];
  for (int i = 0; i < N; i++){
    for (int j = 0; j < N; j++){
      graph[i][j] = false;
    }
  }

  for (int i = 0; i < M; i++){
    int a, b; cin >> a >> b;
    a--; b--;
    graph[a][b] = true;
    graph[b][a] = true;
  }
  
  int array[N - 1];
  for (int i = 0; i < N - 1; i++){
    array[i] = i + 1;
  }

  int ans = 0;
  do{
    bool all_visit = true;

    for (int i = 0; i < N - 1; i++){
      if (i == 0){
        if (graph[0][array[i]] == false){
          all_visit = false;
          break;
        }
      }else{
        if (graph[array[i - 1]][array[i]] == false){
          all_visit = false;
          break;
        }
      }
    }
    if (all_visit == true){
      ans++;
    }
  }while(next_permutation(array, array + N - 1));

  cout << ans << endl;

  return 0;
}


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

class Pair implements Comparable<Pair>{
  long a;
  int cnt;
  public Pair(long i, int j){
    this.a = i;
    this.cnt = j;
  }
  public int compareTo(Pair p){
    if(this.cnt>=2 && p.cnt >=2 && this.a<p.a) return -1;
    if(this.cnt<2 && p.cnt>=2) return -1;
    return 1;
  }
}

class Main{
  public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int N = Integer.parseInt(sc.next());
      HashMap<Long,Pair> map = new HashMap<>();
      ArrayList<Pair> l = new ArrayList<>();
      for(int i = 0; i<N; i++){
        long c = Long.parseLong(sc.next());
        if(!map.containsKey(c)){
           Pair p = new Pair(c,1);
           map.put(c, p);
           l.add(p);
        }else{
          Pair p = map.get(c);
          p.cnt++;
        }
      }
      Collections.sort(l);
      int size = l.size();
      Pair p1 = l.get(size-1);
      Pair p2 = l.get(size-2);
      long res = 0;
      if(p1.cnt>=4) res = p1.a*p1.a;
      else if(p1.cnt >= 2 && p2.cnt>=2) res = p1.a*p2.a;
      System.out.println(res);
  }
}

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

int N, K;

int main(){
    int x;
    scanf("%d", &N);
    scanf("%d", &K);
    int sum=0;
    for(int i=0; i<N; i++){
        scanf("%d", &x);
        sum += min(x, K-x) * 2;
    }
    printf("%d", sum);
    return 0;
}


Measured memory_bytes: 256