akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
string s;
int len;
int main()
{
	cin>>s;
	len=s.size();
	for(int i=0;i<len;i++)
	{
		if(s[i]=='C')
		{
			for(int j=i+1;j<=len;j++)
			{
				if(s[j]=='F')
				{
					cout<<"Yes";
					return 0;
				}
			}
		}
	}
	cout<<"No";
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
constexpr double EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max()/2;
constexpr int MOD = 1e9+7;

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

    int n;cin>>n;
    ll res=0;
    for(int i=0;i<n;i++){
        ll a;cin>>a;
        res += a-1;
    }
    cout<<res<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define MAXN 200005
#define eps 1e-12
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
        if(c == '-') f = -1;
        c = getchar();
    }
    while(c >= '0' && c <= '9') {
        res = res * 10 + c - '0';
        c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
        out(x / 10);
    }
    putchar('0' + x % 10);
}
char a[MAXN];
int nxt[MAXN][26],N,dis[MAXN];
string ans = "";
void Solve() {
    scanf("%s",a + 1);
    N = strlen(a + 1);
    for(int i = 0 ; i < 26 ; ++i) nxt[N][i] = N + 1;
    for(int i = N - 1 ; i >= 0 ; --i) {
        for(int j = 0 ; j < 26 ; ++j) nxt[i][j] = nxt[i + 1][j];
        nxt[i][a[i + 1] - 'a'] = i + 1;
    }
    dis[N + 1] = 0;
    for(int i = N ; i >= 0 ; --i) {
        dis[i] = N + 1;
        for(int j = 0 ; j < 26 ; ++j) dis[i] = min(dis[nxt[i][j]] + 1,dis[i]);
    }
    int pos = 0;
    while(pos != N + 1) {
        for(int i = 0 ; i < 26 ; ++i) {
            if(dis[nxt[pos][i]] + 1 == dis[pos]) {
                ans += (i + 'a');
                pos = nxt[pos][i];
                break;
            }
        }
    }
    cout << ans << endl;
}
int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
    Solve();
}


Measured memory_bytes: 21504
input=input()
tmp=input.split()
X=int(tmp[0])
Y=int(tmp[1])
if (Y%2==1):
    print('No')
else:
    Y=Y/2
    x=2*X-Y
    y=Y-X
    if(x<0 or y<0):
        print('No')
    else:
        print('Yes')

Measured memory_bytes: 9120
#include <iostream>
#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <limits>
#include <map>
#include <set>
#include <iomanip>
#include <cmath>

using namespace std;

typedef long long int ll;
typedef std::numeric_limits<double> dbl;
const long long int LL_INF=1LL<<60;

vector<string> split(const string& input, char delimiter)
{
    stringstream stream(input);
    
    string field;
    vector<string> result;
    while (getline(stream, field, delimiter)) {
        result.push_back(field);
    }
    return result;
}

//#define DEBUG

ll A, B, M, N, D, K, Q, W, H, T, X, Y;

int main()
{
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    
    int w = tx - sx;
    int h = ty - sy;
    for (int i = 0; i < w; ++i)
        cout << 'R';
    for (int i = 0; i < h; ++i)
        cout << 'U';
    for (int i = 0; i < w; ++i)
        cout << 'L';
    for (int i = 0; i < h; ++i)
        cout << 'D';
    cout << 'D';
    for (int i = 0; i < w+1; ++i)
        cout << 'R';
    for (int i = 0; i < h+1; ++i)
        cout << 'U';
    cout << "LU";
    for (int i = 0; i < w+1; ++i)
        cout << 'L';
    for (int i = 0; i < h+1; ++i)
        cout << 'D';
    cout << 'R';
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
# Fast IO (only use in integer input)

import os,io
input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline

a,b,c = map(int,input().split())
k = int(input())
minMagic = 0
while a >= b:
    b *= 2
    minMagic += 1
while b >= c:
    c *= 2
    minMagic += 1
if minMagic <= k:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 61940
function main(input) {
  input=input.trim();
  const r = parseInt(input.split(" ")[0], 10);
  const g = parseInt(input.split(" ")[1], 10);
  const b = parseInt(input.split(" ")[2], 10);
  if((100*r+10*g+b)%4==0){
    console.log("YES");
  }else{
    console.log("NO");
  }
}


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


Measured memory_bytes: 7372
#include <iostream>

using namespace std;

int main()
{
	long long H, W;
	cin >> H >> W;

	if (H == 1 || W == 1) {
		cout << 1 << endl;
	}
	else if (H * W % 2 == 0) {
		cout << H * W / 2 << endl;
	}
	else {
		cout << ((H * W - 1) / 2) + 1 << endl;
	}
}




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

double distance(std::vector<int> &v1, std::vector<int> &v2){
  double total = 0;
  for(int i=0; i<v1.size(); i++){
    total += (v1[i]-v2[i])*(v1[i]-v2[i]);
  }

  return std::sqrt(total);
}

int main(void){
  int n, d;
  std::cin >> n >> d;

  std::vector<std::vector<int> > X(n, std::vector<int>(d, 0));
  for(int i=0; i<n; i++){
    for(int j=0; j<d; j++){
      std::cin >> X[i][j];
    }
  }

  int count = 0;
  for(int i=0; i<n; i++){
    for(int j=i+1; j<n; j++){
      double dist = distance(X[i], X[j]);
      if(std::abs(dist - std::floor(dist)) < 1e-6){
        count++;
      }
    }
  }

  std::cout << count << std::endl;


  return 0;
}

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

typedef long long ll;
const ll INF = 1LL << 60;

int N, W;
vector<ll> w, v;
ll dp[110][(int)1e5 + 10];

int main() {
    cin >> N >> W;
    w.resize(N);
    v.resize(N);
    rep(i, N) cin >> w[i] >> v[i];

    rep(i, N) {
        for (int j = 0; j <= W; j++) {
            if (j < w[i]) {
                dp[i + 1][j] = dp[i][j];
            } else {
                // dp[i + 1][] = max(dp)
                dp[i + 1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i]);
            }
        }
    }

    cout << dp[N][W] << endl;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUG_VEC(v)                               \
  cerr << #v << ": ";                              \
  REP(__i, (v).size()) cerr << ((v)[__i]) << ", "; \
  cerr << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(), x.end()
#define MM << " " <<
int main() {
  int N;
  cin >> N;
  string s;
  cin >> s;
  int wnum, rnum;
  wnum, rnum = 0;
  for (int i = 0; i < N; i++) {
    if (s[i] == 'W')
      wnum++;
    else
      rnum++;
  }

  int wnum_right, rnum_right;
  wnum_right = wnum;
  rnum_right = rnum;

  int target_wnum, target_rnum;
  int min_ans = N;
  for (int i = 0; i < N + 1; i++) {
    target_wnum = N - i;
    target_rnum = i;

    int diff_wnum = target_wnum - wnum_right;
    int diff_rnum = target_rnum - (rnum - rnum_right);
    min_ans = min(min_ans, max(diff_wnum, diff_rnum));
    if (i != N && s[i] == 'W') wnum_right -= 1;
    if (i != N && s[i] == 'R') rnum_right -= 1;
  }

  cout << min_ans << endl;
}


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

using namespace std;

int main()
{
    int n, k;
    string s;
    cin >> n;
    cin >> s;
    cin >> k;

    char thes = s[k - 1];

    for (int i = 0; i < n; i++)
    {
        /* code */
        if (s[i] != thes)
        {
            s[i] = '*';
        }
    }
    cout << s << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool Finish_read;
template<class T>inline void read(T &x){Finish_read=0;x=0;int f=1;char ch=getchar();while(!isdigit(ch)){if(ch=='-')f=-1;if(ch==EOF)return;ch=getchar();}while(isdigit(ch))x=x*10+ch-'0',ch=getchar();x*=f;Finish_read=1;}
template<class T>inline void print(T x){if(x/10!=0)print(x/10);putchar(x%10+'0');}
template<class T>inline void writeln(T x){if(x<0)putchar('-');x=abs(x);print(x);putchar('\n');}
template<class T>inline void write(T x){if(x<0)putchar('-');x=abs(x);print(x);}
/*================Header Template==============*/
#define int long long
const int maxn=100005;
int val[maxn],sum[maxn],n,k,ans=1e18;
signed main() {
	read(n),read(k);
	for(int i=1;i<=n;++i)
		read(val[i]);
	for(int i=2;i<=n;++i)
		sum[i]=sum[i-1]+(val[i]-val[i-1]);
//	for(int i=1;i<=n;++i)
//		printf("%lld ",sum[i]);
//	cout<<endl;
	for(int i=1;i+k-1<=n;++i) {
		int tmp=sum[i+k-1]-sum[i];
		ans=min(ans,abs(val[i])+tmp);
		ans=min(ans,abs(val[i+k-1])+tmp);
	}
	writeln(ans);
}

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

using namespace std;

typedef long long ll;
typedef double db;

#define dbg(x) cout<<#x<<" is "<<x<<endl

int main() {
    int k;
    scanf("%d", &k);
    int n = 0;
    for (int i = 1; i <= k; i++) {
        n = (n * 10 + 7) % k;
        if (n == 0) {
            printf("%d\n", i);
            return 0;
        }
    }
    printf("-1\n");
    return 0;
}

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

#define ll          long long
#define pb          push_back
using namespace std;

int main(){
    int a[101];
    memset(a,0,sizeof(a));
    for(int i=1;i<10;i++)
        for(int j = 1;j<10;j++) a[i*j] = 1;
    int n;
    cin>>n;
    if(a[n]) cout<<"Yes";
    else cout<<"No";
    
}

Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

using namespace std;
using llong = long long;
using ullong = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection)  (collection).begin(), (collection).end()
#define loop(i, times) for (llong i = 0; i < times; i++)
#define rloop(i, times) for (llong i = times -1; 0 <= i; i--)

std::chrono::system_clock::time_point  start;

void TimeStart(void)
{
	start = std::chrono::system_clock::now();
}

void TimeEnd(void)
{
	auto time = std::chrono::system_clock::now() - start;
	auto msec = std::chrono::duration_cast<std::chrono::milliseconds>(time).count();
	cerr << endl << msec << " msec " << endl;
}

#endif

class ABC125D
{
public:
	ABC125D()
	{
		cin >> n_;

		a_.resize(n_);
		loop(i, n_)
			cin >> a_[i];
	}
	void Run(void)
	{
		llong negative = 0;
		for (auto& e : a_)
		{
			if (e < 0)
			{
				e = -e;
				negative++;
			}
		}

		sort(all(a_));
		if (a_[0] == 0 || negative % 2 == 0)
			cout << accumulate(all(a_), 0LL);
		else
			cout << accumulate(all(a_), 0LL) - a_[0] * 2;
	}
private:
	llong n_;
	vector<llong> a_;	
};

int main(void)
{
//	ABC125C abc125c;
//	abc125c.Run();

	ABC125D abc125d;
	abc125d.Run();

	return 0;
}

Measured memory_bytes: 1024
import sys

s = input()
t = input()

for i in range(len(s)-len(t)+1):
  if i == 0:
    sub = s[-i-len(t):]
  else:
    sub = s[-i-len(t):-i]
  for j in range(len(t)):
    if sub[j]!=t[j] and sub[j]!="?":
      break
  else:
    if i == 0:
      s = s[:-i-len(t)]+t
    else:
      s = s[:-i-len(t)]+t+s[-i:]
    s = s.replace("?","a")
    print(s)
    sys.exit()
  continue
    
print("UNRESTORABLE")

Measured memory_bytes: 3188
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n;
    cin >> n;
    VI a(n);
    REP(i,n) a[i] = in();
    int s = 0;
    REP(i,n) s += a[i];
    int ans = 0;
    REP(i,n) ans += a[i] * (s - a[i]);
    ans /= 2;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import sys

import numpy as np


class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i


n, k = map(int, input().split())
aaa = np.fromiter(sys.stdin, dtype=np.int64)
aaa = np.insert(aaa, 0, 0)
acc = np.add.accumulate(aaa) - np.arange(0, k * n + 1, k)
dct = {v: i for i, v in enumerate(np.unique(acc), start=1)}
bit = Bit(len(dct))
ans = 0
for d in acc:
    i = dct[d]
    ans += bit.sum(i)
    bit.add(i, 1)
print(ans)


Measured memory_bytes: 46052
#include <functional>
#include <iostream>
#include <queue>
#include <tuple>
#include <vector>

using namespace std;

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

    int n = 100;

    vector<vector<vector<int>>> dp(n + 1, vector<vector<int>>(n + 1, vector<int>(n + 1, 1000000000)));
    dp[a][b][c] = 0;

    priority_queue<tuple<int, int, int, int>,
            vector<tuple<int, int, int, int>>,
            greater<tuple<int, int, int, int>>> que;
    que.push(make_tuple(0, a, b, c));
    while (!que.empty()) {
        tuple<int, int, int, int> t = que.top();
        que.pop();

        int t_a = get<1>(t), t_b = get<2>(t), t_c = get<3>(t);

        if (t_a == t_b && t_b == t_c) {
            cout << dp[t_a][t_b][t_c] << endl;
            break;
        }

        if (t_a + 1 <= n && t_b + 1 <= n && dp[t_a + 1][t_b + 1][t_c] > dp[t_a][t_b][t_c] + 1) {
            dp[t_a + 1][t_b + 1][t_c] = dp[t_a][t_b][t_c] + 1;
            que.push(make_tuple(dp[t_a + 1][t_b + 1][t_c], t_a + 1, t_b + 1, t_c));
        }

        if (t_b + 1 <= n && t_c + 1 <= n && dp[t_a][t_b + 1][t_c + 1] > dp[t_a][t_b][t_c] + 1) {
            dp[t_a][t_b + 1][t_c + 1] = dp[t_a][t_b][t_c] + 1;
            que.push(make_tuple(dp[t_a][t_b + 1][t_c + 1], t_a, t_b + 1, t_c + 1));
        }

        if (t_c + 1 <= n && t_a + 1 <= n && dp[t_a + 1][t_b][t_c + 1] > dp[t_a][t_b][t_c] + 1) {
            dp[t_a + 1][t_b][t_c + 1] = dp[t_a][t_b][t_c] + 1;
            que.push(make_tuple(dp[t_a + 1][t_b][t_c + 1], t_a + 1, t_b, t_c + 1));
        }

        if (t_a + 2 <= n && dp[t_a + 2][t_b][t_c] > dp[t_a][t_b][t_c] + 1) {
            dp[t_a + 2][t_b][t_c] = dp[t_a][t_b][t_c] + 1;
            que.push(make_tuple(dp[t_a + 2][t_b][t_c], t_a + 2, t_b, t_c));
        }

        if (t_b + 2 <= n && dp[t_a][t_b + 2][t_c] > dp[t_a][t_b][t_c] + 1) {
            dp[t_a][t_b + 2][t_c] = dp[t_a][t_b][t_c] + 1;
            que.push(make_tuple(dp[t_a][t_b + 2][t_c], t_a, t_b + 2, t_c));
        }

        if (t_c + 2 <= n && dp[t_a][t_b][t_c + 2] > dp[t_a][t_b][t_c] + 1) {
            dp[t_a][t_b][t_c + 2] = dp[t_a][t_b][t_c] + 1;
            que.push(make_tuple(dp[t_a][t_b][t_c + 2], t_a, t_b, t_c + 2));
        }
    }
}


Measured memory_bytes: 4736
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long LL;
#define maxn 101000

int main()
{
	int n;
	scanf("%d",&n);
	if (n&1)
	{
		printf("%d\n",(n/2)*(n/2+1));
	}else printf("%d\n",(n/2)*(n/2));
	return 0;
}
//135 246

Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000
typedef pair<ll, ll> pll;

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

    int X;
    cin >> X;
    if (X >= 30){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3652
#include<iostream>
#include<climits>
#include<cstring>
#define ll long long
using namespace std;
int h[ 100000 ];
ll sum[ 100000 ];
ll fun( int index, int size );
int main(){
    int N;
    cin >> N;
    for( int i = 0; i < N; i++ ){
        cin >> h[ i ];
    }
    memset( sum, -1, sizeof( sum ) );
    ll answer = fun( 0, N );
    cout << answer << "\n";
    return 0;
}
ll fun( int index, int size ){
    if( index == size - 1 ){
        return 0;
    }
    if( index > size ){
        return INT_MAX;
    }
    if( sum[ index ] != -1 ){
        return sum[ index ];
    }
    ll left = abs( h[ index ] - h[ index + 1] ) + fun( index + 1, size );
    ll right = INT_MAX;
    if( index < size - 2 )
        right = abs( h[ index ] - h[ index + 2] ) + fun( index + 2, size );
    sum[ index ] = min( left, right );    
    return sum[ index ];
}

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

int main(){
	string strA,strB,strC;
	cin >> strA >> strB >> strC;
	auto itrA = strA.begin();
	auto itrB = strB.begin();
	auto itrC = strC.begin();
	char next = 'a';
	char ans;
	while(true){
		if(next == 'a'){
			if(itrA == strA.end()){
				ans = 'A';
				break;
			}
			next = *itrA;
			itrA++;
		} else if(next == 'b'){
			if(itrB == strB.end()){
				ans = 'B';
				break;
			}
			next = *itrB;
			itrB++;
		}else{
			if(itrC == strC.end()){
				ans = 'C';
				break;
			}
			next = *itrC;
			itrC++;
		}
	}
	cout << ans << endl;
	return 0;
}


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

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

    int n = -1;
    int rule[] = {5, 7, 5, 7, 7};
    for(;;){
        cin >> n;
        if(n == 0) break;
        int len[n];
        string str;
        for(int i = 0; i<n; i++){
                cin >> str;
                len[i] = str.length();
        }
        for(int start = 0; start < n; start++){
            int j = 0;
            int count = 0;
            for(int i = start; i<n; i++){
                count += len[i];
                if(count == rule[j]){
                    j++;
                    count = 0;
                    if(j == 5){
                        cout << start+1 << "\n";
                        start = 114514; // go to next set
                    }
                }else if(count > rule[j]){
                    i = 114514; // go to next start
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3176
#include <cstdio>
using namespace std;

int main() {
    char C[6];
    scanf("%s\n%s", &C, &C[3]);

    if (C[0] == C[5] && C[1] == C[4] && C[2] == C[3]) {
        printf("YES\n");
    } else {
        printf("NO\n");
    }
    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		b[0]=0;
		
		for(int i = 0; i<n; i++){
			a[i] = sc.nextInt();
		}
		b[1]=Math.abs(a[0]-a[1]);
		for(int i = 2; i<n; i++){
			b[i]=Math.min((Math.abs(a[i-2]-a[i])+b[i-2]),(Math.abs(a[i-1]-a[i])+b[i-1]));
			
		}
		System.out.println(b[n-1]);
	}
}

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

    int n;
    cin >> n;
    vector<int> x(n+2);
    x[0] = 0;
    int distance = 0;
    rep(i, n){
        cin >> x[i+1];
        distance += abs(x[i+1]-x[i]);
    }
    x[n+1] = 0;
    distance += abs(x[n+1] - x[n]);

    rep(i, n) {
        int ans = distance;
        ans -= (abs(x[i+1]-x[i]) + abs(x[i+2]-x[i+1]));
        ans += abs(x[i+2]-x[i]);
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 1664
#include <iostream>

using namespace std;

constexpr int Q = 998244353;

int rev(int x)
{
    int arr[3][3] = { {0, 1, Q}, {1, 0, x}, {-1, -1, -1} };
    while(arr[1][2])
    {
        int r = arr[0][2] / arr[1][2];
        for(int i = 0; i < 3; ++i)
            arr[2][i] = arr[0][i] - r * arr[1][i];
        for(int j = 0; j < 2; ++j)
        for(int i = 0; i < 3; ++i)
            arr[j][i] = arr[j + 1][i];
    }
    int ret = arr[0][0];
    if(ret < 0) ret += Q;
    return ret;
}

struct modInt
{
    int n;

    modInt(void) : n(0) {}
    modInt(int x) : n(x) {}

    operator int& (void) {return n;}

    modInt& operator= (int x) { n = x % Q; return *this; }
    modInt& operator+= (int x) { n += x; if(n >= Q) n -= Q; return *this; }
    modInt& operator-= (int x) { n -= x; if(n < 0) n += Q; return *this; }
    modInt& operator*= (int x) { n = (long long)n * x % Q; return *this; }
    modInt& operator/= (int x) { return *this *= rev(x); }
    modInt operator- (void) { modInt ret = Q - n; return ret; }
    modInt operator+ (int x) { modInt ret = n; return ret += x; }
    modInt operator- (int x) { modInt ret = n; return ret -= x; }
    modInt operator* (int x) { modInt ret = n; return ret *= x; }
    modInt operator/ (int x) { modInt ret = n; return ret /= x; }
};

modInt fact[2020202];

void iniFact(void)
{
    fact[0] = 1;
    for(int i = 1; i < 2020202; ++i)
        fact[i] = fact[i - 1] * i;
}

modInt comb(modInt n, modInt r)
{
    if(n < r) return 0;
    return fact[n] / (fact[n - r] * fact[r]);
}

int main()
{
    iniFact();

    modInt n, m; cin >> n >> m;

    modInt ans = 0;
    for(modInt t = 0; t * 2 <= m; t += 1)
    {
        modInt s = m - t * 2;
        modInt u = m + t;
        ans += (comb(n + u - 1, u) - comb(n + t - 1, t) * n) * comb(n, s)
               + comb(n + t - 2, t) * n * comb(n - 1, s);
    }

    cout << ans;

    return 0;
}


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

int main(){
  int N,M; cin >> N >> M;
  int A=0;
  for(int i=0; i<M; i++){
    int a; cin >> a;
    A+=a;
  }
  cout << (N<A?-1:N-A) << endl;
}

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

using namespace std;

int main(){
	long n,m;
	cin >> n >> m;
	long an = n > 0? n: -n;
	long am = m > 0? m: -m;
	long d = an > am? an-am: am-an;
	long ans = 0;
	if( n * m > 0){
		if( n > m)ans += 2;
	}
	else if( n * m < 0){
		ans++;
	}
	else{
		if( n > m){
			ans ++;
		}
	}
	ans += d;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using static System.Console;
using static ConsoleApp.Util;
using static System.Math;
namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {	
            var arr = ReadLine().Split().Select(long.Parse).ToArray();
            long n = arr[0];
            long m = arr[1];

            long[] p = new long[m];
            string[] s = new string[m];
            for(int i =0 ;i < m;i++){
                var a = ReadLine().Split();
                p[i] = long.Parse(a[0]);
                s[i] = a[1];
            }
            
            long[] pena = new long[n];
            int[] flag = new int[n];
			for(int i= 0;i < m;i++){
                if(flag[p[i]-1] == 0 && s[i] == "AC")
                    flag[p[i]-1] = 1;
                if(flag[p[i]-1] == 0 && s[i] == "WA")
                    pena[p[i]-1] ++;

            }
            
            long cor  =  flag.Sum();
            long penac = 0;
            for(int i = 0;i < n;i++){
                if(flag[i] == 0)continue;
                else penac += pena[i];
                
            }
            WriteLine(cor +" "+penac);
        }

    }


    static class Util{
        public static void ChMin(ref long a,long b){
            
            if(a > b){
                a = b;
            }
        }

        public static void ChMax(ref long a,long b){
            if(a < b){
                a = b;
            }
        }



		
    }
}



Measured memory_bytes: 24528
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    long long L,R,ans=INT64_MAX;
    cin>>L>>R;
    for(long long i=L;i<=R-1;i++){
        long long cl;
        for(long long y=i+1;y<=R;y++){
            cl = (i*y)%2019;
            if(cl==0){
                cout<<cl<<endl;
                return 0;
            } else ans=min(ans,cl);
        }
    }
    cout<<ans<<endl;
}

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

int main() {
  
  int N,R;
  
  cin >> N >> R;
  
  if(N<=10) {
    R+=100*(10-N) ;
   cout << R << endl;
  }
  
  else {
    cout << R << endl;
  }
}

Measured memory_bytes: 256
from fractions import gcd

n=int(input())
A=list(map(int,input().split()))
left=[0]*n
right=[0]*n

left[0]=A[0]
for i in range(1,n-1):
    left[i]=gcd(left[i-1],A[i])

right[-1]=A[-1]
for i in range(1,n-1)[::-1]:
    right[i]=gcd(right[i+1],A[i])

ans=max(left[-2],right[1])
for i in range(1,n-1):
    ans=max(ans,gcd(left[i-1],right[i+1]))
print(ans)

Measured memory_bytes: 89580
#include <iostream>
using namespace std;
int main(){
  int n;
  cin >>n;
  while(n!=0){
    int h[n+1];
    for(int i=0;i<n+1;i++){
      cin >>h[i];
    }
    int sub1=h[1]-h[0];
    int sub2=h[2]-h[1];
    int sub3=h[3]-h[2];
    int sub4=h[4]-h[3];
    int sub;
    int iti=true;
    for(int i=0;i<1;i++){
      if(sub1==sub4){
        sub=sub1;
        break;
      }
      if((sub1==sub2)&&(sub2==sub3)){
        sub=sub1;
        break;
      }
      if((sub2==sub3)&&(sub3==sub4)){
        sub=sub4;
        iti=false;
        break;
      }
      if((sub1==sub2)&&(sub1==sub3+sub4)){
        sub=sub1;
        break;
      }
      if((sub4==sub3)&&(sub4==sub1+sub2)){
        sub=sub4;
        break;
      }
    }
    for(int i=0;i<n+1;i++){
      if((h[i+1]-h[i]!=sub)&&(iti==true)){
        cout <<h[i+1]<<endl;
        break;
      }
    }
    if(iti==false)cout <<h[0]<<endl;
    cin >>n;
  }
  return 0;
}

Measured memory_bytes: 3116
#include<iostream>
#include<algorithm>
using namespace std;
int T, N, K, X[100000+10], A[100000+10];
int main(){
  cin >> T;
  for (int t=0; t<T; t++){
    cin >> N >> K;
    for (int i=0; i<N; i++) cin >> X[i];
    for (int i=0; i<N-1; i++) A[i] = X[i+1] - X[i];
    sort(A, A+N-1);
    int ans = 0;
    for (int i=0; i<N-K; i++) ans += A[i];
    cout << ans <<endl;
  }
}

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

using namespace std;

int main() {
    string s;

    cin >> s;

    for (int i = 0; i < s.size()-1; i++) {
        if (s[i] == s[i+1]) {
            cout << i+1 << ' ' << i+2 << endl;
            return 0;
        }
    }

    for (int i = 0; i < s.size()-2; i++) {
        if (s[i] == s[i+2]) {
            cout << i+1 << ' ' << i+3 << endl;
            return 0;
        }
    }

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


Measured memory_bytes: 512
import sys
sys.setrecursionlimit(200000)
input = sys.stdin.readline

S = list(input().strip())

m = {
    "g": 0,
    "p": 0,
}

for v in S:
    m[v] += 1

ans = -10 ** 18
p = len(S)
for g in range(p + 1):
    if g >= p - g:
        ans = max(ans, m["g"] - g)

print(ans)

Measured memory_bytes: 3956
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		var t=sc.S+"X";
		long ans=0;
		int[] h=new int[2];
		for(int i = 1;i<=s[0];i++) {
			if(t[i]==t[i-1]){ans++;}
		}
		Console.WriteLine("{0}",Min(ans+s[1]*2,s[0]-1));
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 13536
import java.util.Scanner;
//import java.math.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int h = sc.nextInt();
		int m = sc.nextInt();

		// calculate angle
		double diff = Math.abs(h * 30 + m * 0.5 - m * 6);
		double angle = 0;
		if (diff == 180) {
			System.out.println(a + b);
		} else if (diff < 180) {
			angle = Math.toRadians(diff);
			// calculate distance
			double ans = Math.pow(a, 2) + Math.pow(b, 2) - 2 * a * b * Math.cos(angle);
			System.out.println(Math.sqrt(ans));
			sc.close();
		} else {
			angle = Math.toRadians(360 - diff);
			// calculate distance
			double ans = Math.pow(a, 2) + Math.pow(b, 2) - 2 * a * b * Math.cos(angle);
			System.out.println(Math.sqrt(ans));
			sc.close();
		}

	}

}


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

int main() {

int N ; cin >> N ;
int P ; P = 0;  
  for (int i ; i < N ; i++ ){
    string A ; cin >> A ;
    if (A == "Y"){
      cout << "Four" << endl;
      P = 1 ;
      break ;
    }
  }
 if (P != 1){
   cout << "Three" << endl;
 }
}

Measured memory_bytes: 3624
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>

using namespace std;



int main()
{
	string s;
	while (cin >> s)
	{
		int length = s.length();
		int Max;
		for (int i = length - 2; i >= 1; i--)
		{
			if ((i + 1) % 2 == 1) continue;
			int len = (i + 1) / 2;
			bool flag = true;
			for (int j = 0; j <= i / 2; j++)
			{
				if (s[j] != s[j + len])
				{
					flag = false;
					break;
				}
			}
			if (flag)
			{
				Max = i + 1;
				break;
			}
		}
		printf("%d\n", Max);
	}
	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include<stdio.h>

int main(){
  int a,b ,c,i=0;
  scanf("%d %d %d",&a,&b,&c);
  if(a==b)i++;
  if(b==c)i++;
  if(c==a)i++;
  if(i==1){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
  return 0;

}

Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <cstdlib>
#include <stack>
#include <queue>
#include <cmath>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define repp(i,j,k) for(int i=j;i>=k;i--)
#define Sort(x) sort(x.begin(),x.end()); 
#define ll long long
int mod=1e9+7;
const int INF = 1e9;

using namespace std;



int main(void) {
	string s;
	int a, b, c, d;
	cin >> s;
	a = (int)(s[0] - '0');
	b = (int)(s[1] - '0');
	c = (int)(s[2] - '0');
	d = (int)(s[3] - '0');
	int sum = 0;
	char cc[3];
	sum = a;
	rep(i, 0, 2) {
		rep(j, 0, 2) {
			rep(k, 0, 2) {
				int summ = sum;
				if (i == 0)summ += b;
				else summ -= b;

				if (j == 0)summ += c;
				else summ -= c;

				if (k == 0)summ += d;
				else summ -= d;

				if (summ == 7) {
					if (i == 0)cc[0] = '+';
					else cc[0] = '-';

					if (j == 0)cc[1] = '+';
					else cc[1] = '-';
					if (k == 0)cc[2] = '+';
					else cc[2] = '-';

					
				}
			}
		}
	}

	cout << a << cc[0] << b << cc[1] << c <<cc[2] << d << "=7" << endl;

	return 0;
}

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

#define rep(i,n,m) for(ll (i)=(n);(i)<(m);(i)++)
#define rrep(i,n,m) for(ll (i)=(n);(i)>(m);(i)--)
using ll = long long;
const ll mod = 998244353;

ll absll(ll x){
    if (x >= 0){
        return x;
    }else{
        return ((-1) * x);
    }
}

ll retm(ll n){

    if (n >= 0){
        return (n % mod);
    }else{
        return (mod - (absll(n) % mod));
    }
}

int main(){

    ll N;
    cin >> N;

    vector<ll> a(N,0);
    rep(i,0,N) cin >> a.at(i);
    ll asum = 0;
    rep(i,0,N) asum += a.at(i);
    vector<ll> lis(asum+1,0);
    lis.at(0) = 1;

    rep(i,0,N){

        vector<ll> nlis(asum+1,0);
        rep(j,0,asum+1){

            nlis.at(j) += (lis.at(j) * 2);
            nlis.at(j) = retm(nlis.at(j));
            if ((j+a.at(i)) <= asum){
              nlis.at(j+a.at(i)) += lis.at(j);
              nlis.at(j+a.at(i)) = retm(nlis.at(j+a.at(i)));
            }
        }

        lis = nlis;
    }
  
  //rep(i,0,N) cout << lis[i] << endl;

    ll ans = 1;
    rep(i,0,N){
        ans *= 3;
        ans = retm(ans);
    }


    if ((asum % 2) != 0){
        rep(i,((asum/2)+1),(asum+1)){
            ans -= (lis.at(i)*3);
            ans = retm(ans);
        }

        cout << ans << endl;

    }else{

        rep(i,(asum/2),(asum+1)){
            ans -= (lis.at(i)*3);
            ans = retm(ans);
        }

        vector<ll> lisT(asum+1,0);
        lisT.at(0)= 1;

        rep(i,0,N){
            rrep(j,asum-a.at(i),-1){

                lisT.at(j+a.at(i)) += lisT.at(j);
                lisT.at(j+a.at(i)) = retm(lisT.at(j+a.at(i)));
            }
        }

        ans += (lisT.at((asum/2))*3);
        ans = retm(ans);
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 1664
import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
x = math.ceil(a / 10)
x += math.ceil(b / 10)
x += math.ceil(c / 10)
x += math.ceil(d / 10)
x += math.ceil(e / 10)
rems = [r for r in [a%10, b%10, c%10, d%10, e%10] if r != 0]
if len(rems) > 0:
    ans = 10*(x-1) + min(rems)
else:
    ans = 10*x
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
using namespace std ;
using ll = long long;

int main(){
    ll n;
    cin >> n;
    ll l[87];
    l[0] = 2;
    l[1] = 1;
    for(ll i=2; i<=86; i++){
        l[i]=l[i-1]+l[i-2];
    }
    cout << l[n] << endl;
    return 0 ;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <algorithm>
#include <queue>
#include <iterator>
#include <functional>
#include <numeric>
#include <cmath>
#include <stack>
#include <limits>
#include <ctime>

using namespace std;

#define ll long long
#define sc(n) static_cast<ll>(n)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int main() {
	IO;
#ifdef _DEBUG
	ifstream cin("In.txt");
#endif	
	ll n, k, mod = 1000000007;
	cin >> n >> k;
	ll ans = 0;
	if (k > n) {
		cout << 1 << endl;
		return 0;
	}
	vector<ll>pref(n + 2), suf(n + 2);
	for (int i = 1; i <= n; i++) {
		pref[i] = pref[i - 1] + i;
		suf[n-i+1] = suf[n-i + 2] + n-i+1;
	}
	suf[0] = suf[1];
	for (int i = k; i <= n+1; i++) {
		ll mn = pref[i-1];
		ll mx = suf[n-i+1];
		ans += mx-mn + 1;
		ans %= mod;
	}
	cout << max(ans,sc(1)) << endl;
	return 0;
}

Measured memory_bytes: 6396
#include <bits/stdc++.h>
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define P 1000000007
#define in(x, a, b) (a <= x && x < b)

using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
const ll inf = 1000000001, INF = (ll)1e18 + 1;

void solve() {
	int n;
	cin >> n;
	vi a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	
	ll money = 1000;
	for(int i = 0; i < n - 1; i++) {
		if(a[i + 1] > a[i]) {
			ll c = money / a[i];
			money += c * (a[i + 1] - a[i]);
		}
	}
	
	cout << money << endl;
}

int main(){
	ios_base::sync_with_stdio(false);
	solve();
    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
 
int main()
{
    int n;
    int d, min, max;
    long long sum;
 
    scanf("%d%d", &n, &d);
    sum = min = max = d;
    while (--n > 0) {
        scanf("%d", &d);
        if (d < min) min = d;
        if (d > max) max = d;
        sum += d;
    }
    printf("%d %d %lld\n", min, max, sum);
    return 0;
}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define y_n(ans) cout<<(ans?"YES":"NO")<<endl;
const double pi = acos(-1);

int main() {
    int a, b, x;
    cin >> a >> b >> x;
    double x2 = x / (double)a;
    double half = a*b / 2.0;
    double theta;
    if (x2 <= half) {
        theta = atan((b*b) / (2*x2));
    } else {
        x2 = a*b - x2;
        theta = atan(2*x2 / (a*a));
    }
    theta = theta * (180 / pi);
    printf("%.15lf\n", theta);
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	double arr[n+1];
	for (int i=1;i<=n;i++){
		cin>>arr[i];
	}
	double dp[n+1][n+1];
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n;j++){
			dp[i][j]=0;
		}
	}
	
	dp[1][0]=1.0-arr[1];
	for(int i=2;i<n+1;i++){
		dp[i][0]=(1.0-arr[i])*dp[i-1][0];
	}
	dp[1][1]=arr[1];
	for(int i=2;i<n+1;i++){
		dp[i][i]=arr[i]*dp[i-1][i-1];
	}
	for (int i=1;i<=n;i++){
		for(int j=1;j<i;j++){
			dp[i][j]=arr[i]*dp[i-1][j-1]+(1.0-arr[i])*dp[i-1][j];	
		}
	}
	double s;
	for(int i=n/2+1;i<n+1;i++){
		s+=dp[n][i];
	}
	cout<<fixed<<setprecision(10)<<s<<endl;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(void){
    int N;
    cin >> N;
    vector<int> A(N);
    vector<int> B(N);
    vector<int> C(N);

    rep(i, N) cin >> A.at(i);
    rep(i, N) cin >> B.at(i);
    rep(i, N) cin >> C.at(i);

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());

    long long sum{0};
    rep(i, N){
        auto num_a = distance(A.begin(), lower_bound(A.begin(), A.end(), B.at(i)));
        auto num_c = N - distance(C.begin(), upper_bound(C.begin(), C.end(), B.at(i)));
        sum += num_a * num_c;
    }

    cout << sum << endl;
}


Measured memory_bytes: 4516
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <utility>
#define REP(i,A) for(int i=0;i<A;i++)

using namespace std;
using ll = long long int;
using ld = long double;
using vl = vector<ll>;
using vd = vector<ld>;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);

    int N;string s;
    cin >> N >> s;
    int r=0,b=0;
    for(int i=0;i<N;i++){
        if(s[i]=='R'){
            r++;
        }else{
            b++;
        }
    }
    
    if(r>b){
        cout << "Yes";
    }else{
        cout <<"No";
    }
	return 0;
}

Measured memory_bytes: 256
my $s = <STDIN>;
my @dat = split(//,$s);


for($i = 0;$i <=$#dat;$i=$i+2){
  if( $dat[$i] eq "L"){
    print "No";
    exit;
  }
}
for($i = 1;$i <=$#dat;$i=$i+2){
  if( $dat[$i] eq "R"){
    print "No";
    exit;
  }
}


print "Yes";


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

typedef int64_t ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);


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

  int n;
  cin >> n;
  int x = 0;
  int ans = 0;
  rep(i, n) {
    int tmp;
    cin >> tmp;
    if (i+1 == tmp) {
      x++;
    } else {
      ans += (x+1)/2;
      x = 0;
    }
  }
  ans += (x+1)/2;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
S = input()
N = len(S)+1
a = [0] * N
for i in range(N-1):
	if S[i] == '<':
		a[i+1] = max(a[i+1], a[i]+1)
for i in range(N-2, -1, -1):
  if S[i] == '>':
    a[i] = max(a[i], a[i+1]+1)
      
print(sum(a))


Measured memory_bytes: 23336
#define _CRT_SECURE_NO_WARNINGS

#include<stdio.h>

int main(void)
{
	int W, H, x, y, r;

	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);

	if ((x - r < 0 || x + r > W) || (y - r < 0 || y + r >H))
		puts("No");
	else
		puts("Yes");

	return 0;
		
}


Measured memory_bytes: 2704
#include <iostream>
using namespace std;
int main(void){
    // Your coe here!
    int a,b,m=0;
    int c[101][101]={};
    int r[101]={};
    cin>>a>>b;
    for(int y=1;y<=a;y++){
        for(int o=1;o<=b;o++){
            cin>>c[y][o];   
        }
    }
    for(int u=0;u<a;u++){
        for(int p=0;p<=b;p++){
            if(p+1>b){
                for(int i=1;i<=b;i++){
                    m+=c[u+1][i];
                }
                cout<<m<<endl;
                r[p+1]+=m;
                m=0;
            }else{
                r[p+1]+=c[u+1][p+1];
                cout<<c[u+1][p+1]<<" ";
            }
        }
    }
    for(int q=1;q<=b;q++){
        cout<<r[q]<<" ";
    }
    cout<<r[b+1] << endl;
}


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

typedef long long ll;
typedef long double ld;

const int inf = 1e9;

int n, x, y, res;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin>>n;
	res = 0;
	bool ok = false;
	for(int i = 0; i < n; ++i){
		cin>>x>>y;
		if(x == y)res++;
		else res = 0;
		if(res >= 3){ ok = true;}
	}
	if(ok)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;	
	return 0;
}


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

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

    while (1){
        c -= b;
        if (c <= 0){
            cout << "Yes" << endl;
            break;
        }
        a -= d;
        if (a <= 0){
            cout << "No" << endl;
            break;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<algorithm>
#include<numeric>
#include<vector>
#include<math.h>
#include<set>
#include<iomanip>
#include<stdio.h>
#include<deque>
#include<stack>
#include<map>
#include<queue>
#include<cstring>
#define M 1000000007
#define pb push_back
#define mp make_pair
#define int long long
using namespace std;
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n;cin>>n;
	double o=n/2+n%2;
	o=o/n;
	printf("%.12lf\n",o);
}

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

int main() {
    int N;
    string S;
    cin >> N >> S;
    int ans = 1;
    for(int i = 0; i < N-1; i++){
        if (S.at(i) != S.at(i+1)) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#pragma region include

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
//////////////

bool cal(int n) {
	int cnt = 0;
	for (int i = 1; i <= n; ++i) {
		if ( (n % i) == 0 ) {
			cnt++;
		}
	}
	if (cnt == 8) {
		return true;
	}
	return false;
}

void solve() {
	int N;
	cin >> N;
	int ans = 0;
	for (int i = 3; i <= N; i+=2) {
		if (cal(i)) {
			ans++;
		}
	}
	cout << ans << endl;
}

#pragma region main
signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 256
'''
ITP-1_8-B
 ??°?????????
?????????????????°???????????????????¨??????????????????°?????????????????????????????????
???Input
?????°??????????????????????????\?????¨??????????????????????????????????????????????????????????????´??° x ?????????????????§?????????????????????
x ??? 1000 ?????\????????´??°??§??????
x ??? 0 ?????¨?????\?????????????????¨??????????????????????????????????????????????????????????????£????????????????????????
???Output
????????????????????????????????????x ???????????????????????????????????????????????????
'''
while True:
    # inputData
    inputData = input()
    if inputData == '0':
        break

    # outputData
    outputData = 0
    for cnt0 in inputData:
        outputData += int(cnt0)
    print(outputData)

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

int n,x;
int li[105];
int ps[105];

int main(){
	scanf("%d%d",&n,&x);
	for(int i=1;i<=n;i++){
		scanf("%d",&li[i]);
		ps[i] = ps[i-1] + li[i];
		if(ps[i] > x) {
			printf("%d\n",i);
			return 0;
		}
	}
	printf("%d\n",n+1);
	return 0;
}

Measured memory_bytes: 256