akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>

using namespace std;

typedef long long int lli;

int gcd(int a, int b){
	return b != 0 ? gcd(b, a%b) : a;
}

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

#define N_MAX 310
#define MOD 1000000007

void solv()
{
	lli A, B, K; scanf("%lld%lld%lld", &A, &B, &K);

	//if (K < A){
	//	printf("%lld %lld", A - K, B);
	//}
	//else if (A <= K && K < A + B){
	//	printf("0 %lld", B - (K - A));
	//}
	//else{
	//	printf("0 0");
	//}

	if (K < A){
		printf("%lld %lld\n", A - K, B);
		return;
	}

	if (K >= A + B){
		printf("0 0\n");
		return;
	}
	else{
		B = B - (K - A);

		printf("0 %lld\n", B);
		return;
	}



	return;
}

int main()
{
	FILE *fin = NULL, *fout = NULL;
	//fin = freopen("input.txt", "r", stdin);
	//fout = freopen("output.txt", "w", stdout);

	solv();

	//finalize
	if (NULL != fin) fclose(fin);
	if (NULL != fout) fclose(fout);

	return 0;
}

Measured memory_bytes: 128
n = int(input())
a = list(map(int, input().split()))

dp = [10**9+1]*n
dp[0] = 0
dp[1] = dp[0] + abs(a[1]-a[0])

for i in range(2, n):
    dp[i] = min([dp[i-1]+abs(a[i]-a[i-1]), dp[i-2]+abs(a[i]-a[i-2])])

print(dp[n-1])

Measured memory_bytes: 13928
from collections import defaultdict
N = int(input())
A = [int(a) for a in input().split()]

series = [0] * (N + 1)
for i in range(1, N+1):
    series[i] = series[i-1] + i
sumDict = defaultdict(int)
sumDict[0] = 1
sum = 0
for a in A:
    sum += a
    sumDict[sum] += 1

total = 0
for key in sumDict:
    total += series[sumDict[key] - 1]
print(total)

Measured memory_bytes: 48128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.function.BiConsumer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			String s = in.next();
			String ans = "Yes";
			if (s.equals("AAA") || s.equals("BBB")) {
				ans = "No";
			}
			out.println(ans);
		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

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

		public char nextChar() {
			return next().charAt(0);
		}

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

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

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

	}
}


Measured memory_bytes: 22228
import java.util.Scanner;
class Main{
    int W,H,x,y,r;
    public void Germany() {
        Scanner sc = new Scanner(System.in);
        W = sc.nextInt();
        H = sc.nextInt();
        x = sc.nextInt();
        y = sc.nextInt();
        r = sc.nextInt();
        if(W > x && H > y){
        	if(r <= x && r <= y){
        	System.out.println("Yes");
        	}else{
        	System.out.println("No");
        	}
        }else{
        	System.out.println("No");
        }
        }
    public static void main(String[] args) {
        new Main().Germany();
    }
}

Measured memory_bytes: 17320
#include<bits/stdc++.h>
using namespace std;
typedef long long llint;
const llint MOD = 1e9 + 7;
int main() {
    llint N;
    cin >> N;
    vector<llint> a(N), b(N), c(N-1);
    for(auto& e: a)
        cin >> e;
    for(auto& e: b)
        cin >> e;
    for(auto& e: c) 
        cin >> e;
    llint sum = 0;
    for(int i = 0; i < N; i++) {
        sum += b[a[i] - 1];
        if(i != 0 && a[i - 1] + 1 == a[i]) {
            sum += c[a[i - 1] - 1];
        }
    }
    cout << sum;
}

Measured memory_bytes: 256
c = []
for i in range(3):
	c.append( list(map(int,input().split())) )

n1 = max(c[0])
n2 = max(c[1])
n3 = max(c[2])
ans = 'No'

for a1 in range(n1+1):
	for a2 in range(n2+1):
		for a3 in range(n3+1):
			if c[0][0] - a1 == c[1][0] - a2 == c[2][0] - a3 :
				if c[0][1] - a1 == c[1][1] - a2 == c[2][1] - a3 :
					if c[0][2] - a1 == c[1][2] - a2 == c[2][2] - a3 :
						ans = 'Yes'
						break


print(ans)


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

int main(){
  int a, b; cin >> a >> b;
  const char* odd = "Odd";
  const char* even = "Even";
  if(a*b%2 == 1){
    printf("%s", odd);
  }else{
    printf("%s", even);
  }
  return 0;
}

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

int main()
{
    long long n;
    cin>>n;
    long long a=0;
    long long cnt=((n+1)/2);
    if(n>a)
    {
        cout<<fixed<<setprecision(10)<<(float)cnt/n<<endl;
    }


}












Measured memory_bytes: 3776
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
using namespace std;

int main() {
	string s;
	cin >> s;
	sort(s.begin(), s.end());
	
	string t;
	cin >> t;
	sort(t.begin(), t.end());
	reverse(t.begin(), t.end());
	
	if (s < t) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include<iostream>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<set>
#include<string>
#include <sstream>
#include<bitset>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
const int INF = 0x7fffffff;
using lll = long long;
using ull = unsigned long long;
using namespace std;


int main(){
  lll ii,jj,kk;
  vector<int> ret;

  double n;

  cin >> n;

  cout << (int)(n/2+0.5d) << endl;

  return 0;
}


Measured memory_bytes: 3724
#include <stdio.h>

int main() {
	int helt;
	int atk;
	scanf("%d%d", &helt, &atk);
	int nmbr = helt%atk;
	nmbr >0 ? printf("%d\n", helt/atk + 1) : printf("%d\n", helt/atk);
	
	return 0;
}

Measured memory_bytes: 1700
#include <string>
#include <set>
#include <iostream>
using namespace std;

int main(){
  int a,now;
  set<string> agg;
  string s;
  cin>>a;
  for(int i=0;i<a;i++){
    cin>>s;
    agg.insert(s);
  }
  cin>>a;
  now=1;
  for(int i=0;i<a;i++){
    cin >>s;
    if(agg.count(s)==0)cout <<"Unknown "<<s<<endl;
    else if(now==1){
      cout <<"Opened by "<<s<<endl;
      now=0;
    }else if(now==0){
      cout <<"Closed by "<<s<<endl;
      now=1;
    }
  }
  return 0;
}

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

int main(){
  int h[5];
  int g,c,p;
  int a[5];

  while(1){
    cin >> h[0];
    if(!h[0])break;

    for(int i=1;i<5;i++)cin >> h[i];
    g = 0;
    c = 0;
    p = 0;
    for(int i=0;i<5;i++){
      if(h[i] == 1)g++;
      if(h[i] == 2)c++;
      if(h[i] == 3)p++;
    }

    if(g>0 && c>0 && p>0){
      for(int i=0;i<5;i++)a[i] = 3;
    }else if(g==5 || c==5 || p==5){
      for(int i=0;i<5;i++)a[i] = 3;
    }else{
      if(g>0 && c>0){
	for(int i=0;i<5;i++){
	  if(h[i] == 1)a[i] = 1;
	  if(h[i] == 2)a[i] = 2;
	}
      }
      if(c>0 && p>0){
	for(int i=0;i<5;i++){
	  if(h[i] == 2)a[i] = 1;
	  if(h[i] == 3)a[i] = 2;
	}
      }
      if(p>0 && g>0){
	for(int i=0;i<5;i++){
	  if(h[i] == 3)a[i] = 1;
	  if(h[i] == 1)a[i] = 2;
	}
      }
    }
    for(int i=0;i<5;i++)cout << a[i] <<endl;
  }
}

Measured memory_bytes: 0
<?php

class Scanner
{
    private $arr = [];
    private $count = 0;
    private $pointer = 0;

    public function next()
    {
        if ($this->pointer >= $this->count) {
            $str = trim(fgets(STDIN));
            $this->arr = explode(' ', $str);
            $this->count = count($this->arr);
            $this->pointer = 0;
        }
        $result = $this->arr[$this->pointer];
        ++$this->pointer;

        return $result;
    }

    public function hasNext()
    {
        return $this->pointer < $this->count;
    }

    public function nextInt()
    {
        return (int) $this->next();
    }

    public function nextDouble()
    {
        return (float) $this->next();
    }
}

$sc = new Scanner();
$n = $sc->nextInt();
$tall = [];
for($i=0;$i<$n;$i++){
    $tall[$i] = $sc->nextInt();
}

$sum = 0;
$max_tall = $tall[0];

for($i=1;$i<$n;$i++){
    if($tall[$i]<$max_tall){
        $sum += $max_tall - $tall[$i];
    }
    if($tall[$i] > $max_tall){
        $max_tall = $tall[$i];
    }
}

echo $sum.PHP_EOL;


Measured memory_bytes: 39028
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit
#include <cstdio>	// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>	// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define DEBUG 0

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
string FILE_NAME = "testcase.dart";
string NAME;
string itos (int n )
{
	stringstream ss;
	ss << n;

	return ss.str();
}

/*
	解法３ O(n^2log(n))
	
	3本の矢を投げて、残りの矢を２分探索する
*/
int n, m, k;
int p[1005];
int s[1005*1005];

bool check (int c, int sum )
{
	return (sum + s[c] <= m );
}

int solve (int sum )
{
	int lo = 0;
	int hi = k;
	int res = -1;

	while(lo <= hi ){
		int mid = (lo + hi)/2;
		if (check (mid, sum ) ){
			res = sum + s[mid];
			lo = mid + 1;
		}else{
			hi = mid - 1;
		} // end if
	} // end while

	return res;
}

int main()
{
//	cut here before submit 
#if DEBUG
	NAME = FILE_NAME;
	int CNT = 1;
	NAME += itos (CNT );
	while (freopen (NAME.c_str() , "r", stdin ) != NULL ) {
#endif
	while (scanf ("%d %d", &n, &m ), n, m ){
		memset (p, 0, sizeof (p ) );
		memset (s, 0, sizeof (s ) );
		for (int i = 1; i <= n; i++ )	scanf ("%d", &p[i] );
		sort (p, p+n+1 );
		k = 0;
		for (int a = 0; a <= n; a++ ){
			for (int b = a; b <= n; b++ ){
				if (p[a] + p[b] > m ) continue;
				s[k++] = p[a] + p[b];
			} // end for
		} // end for

		sort (s, s+k );

		int res = 0;
		rep (i, k ){
			int curr = solve (s[i] );	
			res = max (res, curr );
		} // end rep

		printf ("%d\n", res );
	} // end while
#if DEBUG
	CNT++;	// cut here before submit
	NAME = FILE_NAME;
	NAME += itos (CNT );
	} // end loop; cut here before submit
#endif			
	return 0;
}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e9 + 7;


// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, m, k, u, v;
string s, t;

// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
	ll a,b,c;
	cin>>a>>b>>c;
	cout<<min(b/a,c);
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}

Measured memory_bytes: 3620
#include <iostream>
using namespace std;
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    int d = 0;
    for(int i=a;i <= b;i++){
        if(c % i == 0){
            d++;
        }
    }
    cout << d << endl;
    return 0;
    
}


Measured memory_bytes: 3104
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rel register ll
#define rec register char
#define gc getchar
//#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<23,stdin),p1==p2)?-1:*p1++)
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
char buf[1<<23],*p1=buf,*p2=buf;
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return 0&pc(48);
  if (x<0) pc('-'),x=-x;
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
const int aoi=3058;
int a[aoi][aoi];ll dp[aoi][aoi][4];
int main() {
  int n,m,k,i,j,v;
  cin>>n>>m>>k;
  for (;k--;) cin>>i>>j>>v,a[i][j]=v;
  for (i=1;i<=n;++i) {
    for (j=1;j<=m;++j) {
      for (k=1;k<4;++k) {
        dp[i][j][k]=max(dp[i-1][j][3]+a[i][j],max(dp[i][j-1][k-1]+a[i][j],dp[i][j-1][k]));
        ***dp=max(***dp,dp[i][j][k]);
      }   
    }
  }
  cout<<***dp<<"\n";
}

Measured memory_bytes: 326164
n = int(input())
alpha = "zabcdefghijklmnopqrstuvwxyz"
ans = ""
i = 1
while n!= 0:
    flag = False
    ans += alpha[n%26]
    if n%26 == 0:
        flag = True
    n //= 26 
    n -= flag
print(ans[::-1])

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

using namespace std;
using ll = long long;
int main() {
    int arr[3][3], mark[3][3];
    int i,j,k;
    for(i=0;i<3;i++)
        for(j=0;j<3;j++)
            cin >> arr[i][j], mark[i][j] = 0;
    int n;
    cin >> n;
    for(i=0;i<n;i++)
    {
        int x;
        cin >> x;
        for(j=0;j<3;j++)
            for(k=0;k<3;k++)
                if(arr[j][k] == x)
                    mark[j][k] = 1;
    }
    int ans = 0;
    ans = ans | (mark[0][0] == 1 && mark[0][1] == 1 && mark[0][2] == 1);
    ans = ans | (mark[1][0] == 1 && mark[1][1] == 1 && mark[1][2] == 1);
    ans = ans | (mark[2][0] == 1 && mark[2][1] == 1 && mark[2][2] == 1);
    ans = ans | (mark[0][0] == 1 && mark[1][0] == 1 && mark[2][0] == 1);
    ans = ans | (mark[0][1] == 1 && mark[1][1] == 1 && mark[2][1] == 1);
    ans = ans | (mark[0][2] == 1 && mark[1][2] == 1 && mark[2][2] == 1);
    ans = ans | (mark[0][0] == 1 && mark[1][1] == 1 && mark[2][2] == 1);
   // cout << (mark[0][0] == 1 && mark[1][1] == 1 && mark[2][2] == 1) << endl;
    ans = ans | (mark[0][2] == 1 && mark[1][1] == 1 && mark[2][0] == 1);
    if(ans) 
        cout << "Yes" << '\n';
    else
        cout << "No" << '\n';
        
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, A[20], X[20][20], Y[20][20];
int ans = 0;
bool now[20];

int Judge(int num){
  for (int i = 0; i < N; i++){
    if (num % 2 == 0) now[i] = false;
    else now[i] = true;
    num /= 2;
  }
  return 0;
}

int Solve(int num){
  Judge(num);

  for (int i = 0; i < N; i++){
    if (!now[i]) continue;
    for (int j = 0; j < A[i]; j++){
      int next = X[i][j];
      bool a = Y[i][j];
      if (now[next] != a) return 0;
    }
  }

  int cnt = 0;
  for (int i = 0; i < N; i++){
    if (now[i]) cnt++;
  }
  ans = max(ans, cnt);

  return 0;
}

int main(){
  cin >> N;
  for (int i = 0; i < N; i++){
    cin >> A[i];
    for (int j = 0; j < A[i]; j++){
      cin >> X[i][j] >> Y[i][j];
      X[i][j]--;
    }
  }

  for (int i = 0; i < (1<<N); i++){
    Solve(i);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3588
#include<bits/stdc++.h>
#define N 10005
#define LL long long
#define inf 1<<29
#define eps 1e-7
using namespace std;
long long n,a,b,c,d;

int main(){
    int flag=0;
    cin>>n>>a>>b>>c>>d;
    for(int i=0;i<n;i++){
        if(c*(n-1-i)-d*i<=abs(b-a)&&-1*c*(i)+(n-1-i)*d>=abs(b-a)){
            flag=1;
        }
    }
    if(flag==1){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const ll MOD2=998244353;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

int main() {
  string x;
  cin >> x;
  ll n=x.size();
  string k="";
  rep(i,n){
    k+=x[i];
    ll a=k.size();
    if(a>=2&&k[a-1]=='T'&&k[a-2]=='S'){
      k.pop_back();
      k.pop_back();
    }
  }
  cout << k.size() << endl;
}

Measured memory_bytes: 776
import sys
N = int(input())
lst = [str(input()) for _ in range(N)]


if len(set(lst)) != N:
    print('No')
    sys.exit()

for i in range(len(lst)-1):
    if lst[i][-1] != lst[i+1][0]:
        print('No')
        sys.exit()
print('Yes')

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

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

#define rep(i,n) for(int (i)=0,temp=(int)(n);(i)<temp;++(i))
#define repi(i,start,end) for(int (i)=(start),temp=(int)(end);i<(end);++(i))
#define rfor(x,v) for(const auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort((v), (v)+(n))
#define vsort(v) sort((v).begin(), (v).end())
#define vfsort(v,lambda) sort(all((v)),(lambda))
#define vint vector<int>
#define vvint vector<vector<int>> //vvint v(n,vint(n))
#define vin(v) rep(i,(v).size()) {cin >> (v)[i];}
#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
//lambda: [&](int x, int y){return x<y;}


signed main(void){
    string s;cin>>s;
    int ans=0,n=s.length();
    
    rep(tmp,1<<n-1){
        int t=s[0]-'0';
        rep(i,n-1){
            if(tmp&(1<<i)){
                ans+=t;
                t=s[i+1]-'0';
            }else{
                t*=10;
                t+=s[i+1]-'0';
            }
        }
        ans+=t;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")


def a(x, y):
    if x <= y:
        return y - x
    return INF


def main():
    x, y = map(int, input().split())

    ans = INF
    ans = min(ans, a(x, y))
    ans = min(ans, 1 + a(-x, y))
    ans = min(ans, 1 + a(x, -y))
    ans = min(ans, 2 + a(-x, -y))

    print(ans)


if __name__ == '__main__':
    main()



Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
 
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;i<n;i++)
#define ll long long
 
#define pi pair < ll , ll >
#define pb push_back
#define mp make_pair
#define F first
#define S second
 
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
 
#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
using namespace std;

const ll mod = 1e9+7;

void solve() {
    ll a, b, c, d;
    cin>>a>>b>>c>>d;
    string winner = "No";
    ll i = 0;
    while(1) {
        if(a<=0 or c<=0)break;
        if(i%2==0){c-=b;winner="Yes";}
        else {a-=d;winner="No";}
        i++;
    }
    cout<<winner;
}

int main()
{
    fastIO;ll t=1;
    // cin>>t;
    while(t--)solve();
}


Measured memory_bytes: 3652
def examA():
    T, X = LI()
    ans = T/X
    print(ans)
    return

def examB():
    N = I()
    L = LI()
    ans = "Yes"
    if max(L)*2>=sum(L):
        ans = "No"
    print(ans)
    return

def examC():
    N, M = LI()
    X = LI(); X.sort()
    x = []
    for i in range(M-1):
        x.append(X[i+1]-X[i])
    x.sort()
    ans = 0
    if N>=M:
        ans = 0
    else:
        for i in range(M-N):
            ans += x[i]
    print(ans)
    return

def examD():
    N, K = LI()
    A = LI()
    d = defaultdict(int)
    maxl = len(bin(K)) -2
    for a in A:
        for j in range(maxl):
            if a&1==1:
                d[j] +=1
            a >>=1
            if a==0:
                break
#    print(d)
    X = 0
    cur = []
    for i in range(maxl):
        c = (2**i)*(N-d[i]*2)
        cur.append([c,i])
    cur.sort()
    ans = sum(A)
#    print(maxl,X)
    ansC = 0
    for i in cur:
        if i[1]!=maxl:
            ansC +=max(i[0],0)
    ans +=ansC

    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examC()


Measured memory_bytes: 56172
S = input()
T = input()
if len(S) < len(T):
    print("UNRESTORABLE")
    exit()
for i in range(len(S) - len(T), -1, -1):
    for s, t in zip(S[i:i+len(T)], T):
        if s != "?" and s != t:
            break
    else:
        S = list(S)
        S[i:i+len(T)] = list(T)
        S = "".join(S).replace("?", "a")
        print(S)
        exit()
print("UNRESTORABLE")

Measured memory_bytes: 3064
s = input()
max_count = 0
count = 0
acgt = ['A', 'C', 'G', 'T']
for i, c in enumerate(s) :
    if c in acgt :
        count += 1
        if i == len(s) - 1 and max_count < count :
            max_count = count
    else :
        if count != 0 and max_count < count :
            max_count = count
        count = 0
print(max_count)

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define dep(i,a,b) for(int i = a; i >= b; i--) 
#define Rep(i,a) for(int i = 0; i < a; i++)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ab(x) ((x) < 0 ? -(x) : (x))
using namespace std;
typedef long long LL;
typedef map<int, int>::iterator mit;
typedef set<int>::iterator sit;
int main() {
	LL a, b, c, d, e, f, g; cin >>a>>b>>c>>d>>e>>f>>g;
	LL ans = b + (d - d % 2) + (e - e % 2) + (a - a % 2);
	if (d && e && a) ans = max(ans, b + ((d - 1) - (d - 1) % 2) + ((e - 1) - (e - 1) % 2) + ((a - 1) - (a - 1) % 2) + 3);
	cout <<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
class dice{
    public:
    int number[6];
    dice(int a,int b,int c,int d,int e,int f){
        number[0]=a;
        number[1]=b;
        number[2]=c;
        number[3]=d;
        number[4]=e;
        number[5]=f;
        
    }
 void roll(char news){
    int p;
    if(news=='E'){
      p=number[0];
      number[0]=number[3];
      number[3]=number[5];
      number[5]=number[2];
      number[2]=p;
    }
    if(news=='W'){
      p=number[0];
      number[0]=number[2];
      number[2]=number[5];
      number[5]=number[3];
      number[3]=p;
    }
    if(news=='N'){
      p=number[0];
      number[0]=number[1];
      number[1]=number[5];
      number[5]=number[4];
      number[4]=p;
    }
    if(news=='S'){
      p=number[0];
      number[0]=number[4];
      number[4]=number[5];
      number[5]=number[1];
      number[1]=p;
    }
  }
  int top() {
    return number[0];
  }
};

int main(){
    int a,b,c,d,e,f,top;
    cin>>a>>b>>c>>d>>e>>f;
    dice d1(a,b,c,d,e,f);
     string s;
     cin >> s;
  for(int i=0;i<s.size();i++) {
      d1.roll(s[i]);
  }
    top=d1.number[0];
    cout<<d1.top()<<endl;
    return 0;
}




Measured memory_bytes: 3220
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <tuple>
#include <cassert>
using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define mp(a,b) make_pair((a), (b))
#define mt(a,b,c) make_tuple((a),(b),(c))
#define DEBUGM(d,n,m,i,j) printf("DEBUGM :\n"); rep(i,n){ rep(j,m) if(inf==d[i][j]) printf("inf "); else printf("%d ", d[i][j]); printf("\n");} printf("DEBUGM END LINE\n")

typedef vector<vector<pair<int,int> > > graph;
typedef long long ll;

const ll INF =1LL << 62;
const int inf =1 << 29;

#define MAX_VER 205

int d[MAX_VER][MAX_VER];

void init(){
    rep(i,MAX_VER) rep(j,MAX_VER)d[i][j] = i==j ? 0 : inf;
}

void make(graph &adl){
    rep(i, adl.size()) rep(j,adl[i].size()){
        int v = i, u = adl[i][j].first,c = adl[i][j].second;
        u--;
        d[v][u] = c; d[u][v] = c; 
    }
}

void warshall_floyd(int v){
    rep(k,v){ 
        rep(i,v){ 
            rep(j,v){
                d[i][j] = min(d[i][j], d[i][k]+d[k][j]);
            }
        }
    }
}

int main(){
   int n,m,R;
   cin >> n >> m >> R;
   vector<int> r(R);
   rep(i,R) cin >> r[i];
   graph g(n);

   rep(i,m){
       int a,b,c;
       cin >> a >> b >> c;
        g[a-1].push_back(mp(b,c));
        g[b-1].push_back(mp(a,c));
   }
   init();
   make(g);
   warshall_floyd(n);
   sort(all(r));
   int ans = inf;
    do{
        int sum=0;
        rep(i,R-1){
            sum += d[r[i]-1][r[i+1]-1];
        }
        ans = min(ans, sum);
    }while(next_permutation(all(r)));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 896
while True:
    a,b=map(int, input().split())
    if a==0 and b==0:
        break
    else:
        b_even=""
        b_odd=""
        for j in range(b):
            if j%2==0:
                b_even=b_even+"."
            else:
                b_even=b_even+"#"
                
        for j in range(b):
            if j%2==0:
                b_odd=b_odd+"#"
            else:
                b_odd=b_odd+"."
        
        for i in range(a):
            if i%2==0:
                print(b_odd)
            else:
                print(b_even)
        print("")


Measured memory_bytes: 5608
#ifndef POINT_RADIAN_H
#define POINT_RADIAN_H

#include <iostream>
#include <cmath>

using namespace std;

static const double PI = 3.141592;


class Point{
public:
    double x, y;
    Point(double x=0, double y=0): x(x),y(y){}

    Point operator + (Point p) {return Point(x+p.x, y+p.y);}
    Point operator - (Point p) {return Point(x-p.x, y-p.y);}
    Point operator * (double a) {return Point(a*x, a*y);}
    Point operator / (double a) {return Point(x/a, y/a);}

};

int main(){
    int d, a;
    int degree(0);
    Point p;
    double radian = 0;
    
    while (scanf("%d,%d",&d, &a)){
        if(d == 0 && a == 0){
            break;
        }
        radian = degree * (PI/180);
        p.x = p.x + d * cos(radian);
        p.y = p.y + d * sin(radian);
        degree += a;

    }
    cout << static_cast<int>(p.y) << "\n";
    cout << static_cast<int>(p.x) << "\n";


}


#endif // POINT_RADIAN_H

Measured memory_bytes: 3380
#include <stdio.h>

int main(){
 int a,b,c;
 scanf("%d %d %d",&a,&b,&c);
 if(a < b){
	 if(b < c){
		 printf("Yes\n");
	 }else{
		 printf("No\n");
	 }
 }else{
	 printf("No\n");
 }
}


Measured memory_bytes: 2052
#include "bits/stdc++.h"
using namespace std;
#define long int64_t

int main() {
	ios_base::sync_with_stdio( false );

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

	vector<pair<int, int>> sc( M );
	for( int i = 0; i < M; ++i ) { cin >> sc[i].first >> sc[i].second; }

	for( int i = 0; i < (int)pow( 10, N ); ++i ) {
		string s = to_string( i );
		if( s.size() != N ) { continue; }

		bool ok = true;
		for( int j = 0; j < M; ++j ) {
			if( s[sc[j].first-1] != sc[j].second+'0' ) {
				ok = false;
				break;
			}
		}

		if( ok ) {
			cout << s << endl;
			return 0;
		}
	}

	cout << -1 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int n;
int cnt;
int ans;
long long int a[100005];

int f(int x, int i) {
  for (int d = 1; i + d <= n; d++) {
    if (a[i + d]) {
      a[i] = a[i + d];
      a[i + d] = x;
      return d;
    }
  }
  for (int d = 1; i - d >= 0; d++) {
    if (a[i - d]) {
      a[i] = a[i - d];
      a[i - d] = x;
      return d;
    }
  }
}

int main(void) {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) {
    if (a[i] == i) {
      ans += f(a[i], i);
    }
  }

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

  return 0;
}


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

int INF=0x3f3f3f3f;
//memset(a,0x3f,sizeof(a));


int main(){
	ios_base::sync_with_stdio(false);
	int a,b,c;
	cin>>a>>b>>c;
	int sum=0;
	sum+=a+b+c;
	sum-=max(a,max(b,c));
	cout<<sum<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a)  (a).begin(),(a).end()
#define P pair<int, int>
#define ll long long
const int MOD = 1000000007;
//bitset<64>(x).count()
//fixed << setprecision(15) << 

  char in[120];
  pair<pair<string,int>,int> p[110];
  int main(){
    int a;scanf("%d",&a);
    for(int i=0;i<a;i++){
      int t;scanf("%s%d",in,&t);
      string tmp=in;
      p[i]=make_pair(make_pair(in,-t),i);
    }
    std::sort(p,p+a);
    for(int i=0;i<a;i++)printf("%d\n",p[i].second+1);
  }



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

int main(){
    int x;
    int y;
    bool r=false;
    cin>>x;
    cin>>y;

    if(2*x<=y){
        if(4*x>=y){
            r=true;
        }
    }

    if(y%2!=0){
        r=false;
    }

    if(r){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    return 0;
}

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

ll comb[2020][2020];

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

	for(int i=0;i<=n;i++){
		comb[i][0]=1;
	}
	ll mod=1e9+7;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=i;j++){
			comb[i][j]=comb[i-1][j]+comb[i-1][j-1];
			comb[i][j]%=mod;
		}
	}
	for(int i=1;i<=k;i++){
		ll x=comb[n-k+1][i]*comb[k-1][i-1];
		x%=mod;
		cout<<x<<"\n";
	}
	return 0;
}


Measured memory_bytes: 30336
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define printall(n,array) {for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<int, PI> V;
typedef vector<int> VE;
const ll mod = 10000000007; //10^9+7

int main(){
  double a,b;
  cin>>a>>b;
  int ans=ceil((a+b)/2);
  print(ans);
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <vector>
#define MOD 1000000007
using namespace std;
typedef long long ll;
ll kai[200001], inv[200001];
int n, k;
ll mod_pow(ll x, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) {
      res = res * x % mod;
    }
    x = x * x % mod;
    n /= 2;
  }
  return res;
}
void init() {
  kai[0] = 1LL;
  for (ll i = 1LL; i <= 200000; i++) {
    kai[i] = kai[i - 1] * i;
    kai[i] %= MOD;
  }
  inv[200000] = mod_pow(kai[200000], MOD - 2LL, MOD);
  for (ll i = 199999; i >= 0; i--) {
    inv[i] = inv[i + 1] * (i + 1);
    inv[i] %= MOD;
  }
}

ll comb(ll r, ll c) {
  ll res;
  res = kai[r];
  res *= inv[c];
  res %= MOD;
  res *= inv[r - c];
  res %= MOD;
  return res;
}
int main() {
  ll N, a, b;
  scanf("%lld%lld%lld", &N, &a, &b);
  n = 200000;
  init();
  ll ans = mod_pow(2LL, N, MOD);
  ans--;
  ll x = 1LL, y = 1LL;
  for (ll i = 0LL; i < a; i++) {
    x *= (N - i);
    x %= MOD;
  }
  x *= inv[a];
  x %= MOD;
  for (ll i = 0; i < b; i++) {
    y *= (N - i);
    y %= MOD;
  }
  y *= inv[b];
  y %= MOD;
  ans -= x;
  if (ans < 0) {
    ans += 10LL * MOD;
  }
  ans -= y;
  if (ans < 0) {
    ans += 10LL * MOD;
  }
  ans %= MOD;
  printf("%lld\n", ans);
}

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

class FordFulkerson {
public:
  struct Edge { int to, cap, rev; };

  FordFulkerson(int V, int S, int T): V(V), S(S), T(T), G(V, vector<Edge>(0)), used(V, false) {}

  void addEdge(int from, int to, int cap) {
    G[from].push_back({ to, cap, (int)G[to].size() });
    G[to].push_back({ from, 0, (int)G[from].size()-1 });
  }

  int maxFlow() {
    int flow = 0;
    for (;;) {
      resetUsed();
      int f = dfs(S, INFTY);
      if (f == 0) return flow;
      flow += f;
    }
  }

private:
  const int INFTY = (1 << 21);
  int V, S, T;
  vector<vector<Edge> > G;
  vector<bool> used;

  int dfs(int v, int f) {
    if (v == T) return f;
    used.at(v) = true;
    for (auto &edge: G.at(v)) {
      if (used.at(edge.to)) continue;
      if (edge.cap <= 0) continue;
      int d = dfs(edge.to, min(f, edge.cap));
      if (d <= 0) continue;
      edge.cap -= d;
      G.at(edge.to).at(edge.rev).cap += d;
      return d;
    }

    return 0;
  }

  void resetUsed() {
    fill(used.begin(), used.end(), false);
  }
};

#define MAX_E 1001
int N, E, S[MAX_E], T[MAX_E], C[MAX_E];

void input() {
  cin >> N >> E;
  for (int e = 0; e < E; e++) {
    cin >> S[e] >> T[e] >> C[e];
  }
}

void solve() {
  FordFulkerson ff(N, 0, N-1);
  for (int e = 0; e < E; e++) ff.addEdge(S[e], T[e], C[e]);
  cout << ff.maxFlow() << endl;
}

int main() {
  input();
  solve();
}



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

int main(void){
    int n,tmp;
    cin>>n;
    bool array[100];
    for(int i=0;i<100;i++){
        array[i]=false;
    }
    int ans=0;
    for(int i=0;i<n;i++){
        cin>>tmp;
        if(array[tmp] != true){
            ans++;
            array[tmp]=true;
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(){
  long int N,M;
  cin >>N>>M;
  long int A;
  long int ans=0;
  for(int i=0;i<M;i++){
  	cin >>A;
  	ans+=A;
  }
  if(ans>N){cout<<"-1";}
  else{cout <<N-ans<<endl;}
  
  
}


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

int *L, *R, *H;  // left(child), right(child), height.

int height(int i)
{
    if(i < 0) return -1;
    if(H[i] >= 0){ return H[i]; }  // already determined.
    else{
        H[i] = max(height(L[i]), height(R[i])) + 1;
        return H[i];
    }
}

int main()
{
    int *P;  // parent.
    int i, n, l, r, d, p;
    cin >> n;
    P = new int [n]; L = new int [n]; R = new int [n]; H = new int [n];
    if(P == NULL || L == NULL || R == NULL || H == NULL) exit(EXIT_FAILURE);

    // initialize.
    for(i = 0; i < n; i++){ P[i] = H[i] = -1; }
    // input.
    while(cin >> i >> l >> r){
        L[i] = l; R[i] = r;
        if(l >= 0) P[l] = i;
        if(r >= 0) P[r] = i;
    };

    for(i = 0; i < n; i++){
        cout << "node " << i << ": parent = " << P[i] << ", sibling = ";

        if(P[i] < 0){ cout << -1; }
        else if(L[P[i]] < 0 || R[P[i]] < 0){ cout << -1; }
        else{ cout << L[P[i]] + R[P[i]] - i; }

        cout << ", degree = ";
        if(L[i] < 0 && R[i] < 0){ cout << 0; }
        else if(L[i] < 0 || R[i] < 0){ cout << 1; }
        else{ cout << 2; }

        cout << ", depth = ";
        d = 0; p = i;
        while(P[p] >= 0){ p = P[p]; d++; };

        cout << d << ", height = " << height(i) << ", ";
        if(P[i] < 0){
            cout << "root";
        }else if(L[i] < 0 && R[i] < 0){
            cout << "leaf";
        }else{
            cout << "internal node";
        }
        cout << endl;
    }
    delete [] P; delete [] L; delete [] R; delete [] H;
    return 0;
}

Measured memory_bytes: 1204
#include <iostream>

using namespace std;
using ll = long long;
using ld = long double;

#define ALL(x) begin(x), end(x)
#define REP(i, n) for (size_t i = 0, i##_len = (n); i < i##_len; ++i)

void solve(ll x) {
  cout << (x < 1200 ? "ABC" : "ARC") << endl;
}

int main() {
  ll x;
  cin >> x;
  solve(x);
  return 0;
}


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

bool check(int a, int b, int c){
    if(a < b && b < c) return true;
    if(c < b && b < a) return true;
    return false;
}

int main(){
    int N, A[20];
    cin >> N;
    for(int i=0; i<N; i++) cin >> A[i];
    int ans = 0;
    for(int i=0; i<N-2; i++) if(check(A[i], A[i+1], A[i+2])) ans++;
    cout << ans << endl;
    return 0;
}


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

using namespace std;

const int MAXN = 3500;

long double dp[MAXN][MAXN];

int main()
{
    int n;
    scanf("%i", &n);
    long double p;
    dp[0][0] = 1;
    for (int x = 1; x <= n; x++)
    {
        scanf("%Lf", &p);
        for (int y = 0; y <= n; y++)
        {
            dp[x][y] = (1-p) * dp[x-1][y];
            if (y > 0)
                dp[x][y] += p*dp[x-1][y-1];
        }
    }
    long double cnt = 1;
    for (int x = 0; x <= n/2; x++)
        cnt -= dp[n][x];
    printf("%.20Lf\n", cnt);
}


Measured memory_bytes: 165888
#include <stdio.h>

long long int ans[22] ;

void init ( ) ;

int main ( )
{
	long long int s ;
	init ( ) ;
	while ( scanf ( "%lld" , &s ) == 1 ) {
		printf ( "%lld\n" , ans[s] ) ;
	}
	return 0 ;
}

void init ( )
{
	ans[0] = 0 ;
	ans[1] = 1 ;
	for ( long long int i = 2 ; i <= 20 ; i++ ) {
		ans[i] = ans[i-1] * i ;
	}
}

Measured memory_bytes: 1020
#include <bits/stdc++.h>
using namespace std;
string O, E;
int main() {
    cin >> O >> E;
    int olen = O.length();
    int elen = E.length();
    int slen = olen + elen;
    for(int i = 0; i < slen; ++i) {
        if((i+1) % 2 != 0) {
            cout << O.at((i+1) / 2);
        }else {
            cout << E.at((i+1) / 2 - 1);
        }
    }
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
   int a,b,i,j;
   while(1){
       scanf("%d %d",&a,&b);
       if(a==0&&b==0) return 0;
       for(i = 0;i<a;i++){
           for(j = 0;j<b;j++){
               printf("#");
           }
           printf("\n");
       }
       printf("\n");
   }
}

Measured memory_bytes: 1808
#include<iostream>

using namespace std;

int N[31250000];
int main(){
  int n,a;
  bool flag = true;
  cin >> n;
  for(int i = 0;i < n;i++){
    cin >> a;
    if((N[a/32]&(1<<(a%32)))!=0){flag = false;break;}
    N[a/32] |= (1<<(a%32));
  }
  cout << (flag?"YES":"NO") << endl;
  return 0;
}

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

using namespace std;

using ll = long long;

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

    string o, e;
    cin >> o >> e;
    const int size = e.size();
    for (int i = 0; i < size; ++i)
        cout << o[i] << e[i];
    if (o.size() != size) cout << o.back();
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n, m;
    cin >> n >> m;
    
    if ((2 * n) == m) {
        cout << n << endl;
    }
    else if ((2 * n) > m) {
        cout << (m / 2) << endl;
    }
    else {
        ll ans = n + ((m - 2 * n) / 4);
        cout << ans << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LLI long long int
#define ULTRA 2134567890
using namespace std;

int a[407];
LLI dp[407][407] = {};
LLI pre[407] = {};

LLI sum( int l, int r) {
	return pre[r] - pre[l-1];
}

int main() {
	
	int i,j;
	int N;
	
	cin >> N;
	for( i=1; i<=N; i++)
		cin >> a[i];
	for( i=1; i<=N; i++) {
		pre[i] = pre[i-1] + a[i];
	}
	for( i=2; i<=N; i++) {
		for( j=1; j+i-1 <= N; j++) {
			dp[j][j+i-1] = (LLI) ULTRA * ULTRA;
			for( int k=j; k < j+i-1; k++) {
				dp[j][j+i-1] = min( dp[j][j+i-1], dp[j][k] + dp[k+1][j+i-1] + sum( j, j+i-1));
			}
		}
	}
	printf("%lld\n", dp[1][N]);
	return 0;
}

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

int main()
{
  int n;

  cin >> n;

  int ans = 0;

  int keta = 0;

  for (int i = 1; i <= n; i++)
  {

    string moji;

    moji = to_string(i);
    if ( moji.length() % 2 == 1)
    {
      ans++;
    }
  }

  cout << ans;
}


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

int combination(int least,int n,int s)
{
	int sum = 0;
	if(n==1)
		return (least < s&&s<=9)?1:0;
	else
	{
		int sum  = 0;
		for(int i = least+1;i<=8;i++)sum +=combination(i,n-1,s-i);
		return sum;
	}
};

int main()
{
	while(true)
	{
	int n,s;
	cin >> n;
	cin >> s;
	if(n==0&&s==0)break;
	else cout << combination(-1,n,s) << endl;
	}
	return 0;
}

Measured memory_bytes: 0
import math
A,B = (int(x) for x in input().split())
A1 = math.ceil(A/0.08)
if float((A+1)/0.08).is_integer() == True:
    A2 = math.floor((A+1)/0.08)
else:
    A2 = math.floor((A+1)/0.08) + 1
B1 = math.ceil(B/0.1)
if float((B+1)/0.1).is_integer() == True:
    B2 = math.floor((B+1)/0.1)
else:
    B2 = math.floor((B+1)/0.1) + 1
a = range(A1, A2)
b = range(B1, B2)
c = set(a) & set(b)
if len(c) == 0:
          print(-1)
else:
          print(min(c))

Measured memory_bytes: 3064
n,a,b=map(int,input().split())
MOD=10**9+7
afac=1
for i in range(1,a+1):
  afac=(i*afac)%MOD
afac=pow(afac,MOD-2,MOD)
bfac=1
for i in range(1,b+1):
  bfac=(i*bfac)%MOD
bfac=pow(bfac,MOD-2,MOD)
thing1=1
for i in range(n,n-a,-1):
  thing1=(i*thing1)%MOD
thing2=1
for i in range(n,n-b,-1):
  thing2=(i*thing2)%MOD
print((pow(2,n,MOD)-1-thing1*afac-thing2*bfac)%MOD)

Measured memory_bytes: 65088
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main()
{
  int N;
  cin >> N;
  string c;
  cin >> c;
  int ans = 0;
  for (int i = 0; i < N; ++i)
  {
    if (c[i] == 'W')
      ans++;
  }
  int cnt = 0;
  int left = 0, right = N - 1;
  while (left < right)
  {
    while (c[left] == 'R' && left < right)
      left++;
    while (c[right] == 'W' && left < right)
      right--;
    if (left < right)
    {
      c[left] = 'R';
      c[right] = 'W';
      left++;
      right--;
      cnt++;
    }
  }
  ans = min({ans, N - ans, cnt});
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3756
str_n, str_k = input().split()
n = int(str_n)
k = int(str_k)
str_a = input().split()
a = [int(str) for str in str_a]

for i, num in enumerate(a):
    if num == 1:
        fir = i

left = fir
right = n - fir - 1

if k == 2:
    print(n - 1)
elif n == k:
    print(1)
else:
    print((n+k-3)//(k-1))

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

int main(){
    int n;
    cin >> n;
    set<int> st;
    rep(i,n){
        int a;
        cin >> a;
        st.insert(a);
    }
    if(st.size() == n) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

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

#define REPI(x) for(int i=0;i<x;i++)
#define REPJ(x) for(int j=0;j<x;j++)

#define REPISE (s,e) for(int i=s,i<e;i++)
#define REPJSE (s,e) for(int j=s,j<e;j++)

using namespace std;

int main ()
{
  int N,cp,cn;
  bool counted;
  long long b,res;
  vector<long long> A;

  cin >> N;

  REPI(N)
  {
    cin >> b;
    A.push_back (b);
  }

  sort(A.begin (),A.end (),greater<long long> ());
    
  cn = 0;
  res = 0;
  cp = 0;
  
  cn++;

  counted = true;

  while (cn < N)
  {
    res+= A[cp];

    if (counted)
      cp++;
    
    counted = !counted;
    
    cn++;
  }

  cout << res << endl;
  

  return 0;
}

Measured memory_bytes: 5372
from collections import deque

def count(s, t1, t2):
    n = len(s)
    k1 = len(t1)
    k2 = len(t2)
    dp = [[0]*(k1+1) for i in range(n+1)]
    dp[0][0] = 1
    for i in range(n):
        for j in range(k1+1):
            # 次にt1を見るときは t1[j] を見る
            # 次にt2を見るときは t2[i-j]を見る
            if j+1 < k1+1 and t1[j] == s[i]:
                dp[i+1][j+1] += dp[i][j]
            if 0 <= i-j and i-j < k2 and  t2[i-j] == s[i]:
                dp[i+1][j] += dp[i][j]
    return dp[n][k1]

n = int(input())
s = input()
ss = s[n:]

m = 1 << n
ans = 0

for bit_state in range(m):
    red = []
    blue = []
    for i in range(n):
        if 1 << i & bit_state:
            red.append(s[i])
        else:
            blue.append(s[i])

    red = red[::-1]
    blue = blue[::-1]
    ans += count(ss, red, blue)
print(ans)

Measured memory_bytes: 55388