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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())

lli data[100100];

signed main(){

	lli n,k;
	lli q;

	cin>>n>>k>>q;
	
	REP(i,0,100100)data[i]=k-q;

	REP(i,0,q){
		lli tmp;
		cin>>tmp;
		tmp--;
		data[tmp]++;
	}

	REP(i,0,n){
		if(data[i]>0)cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}



	return 0;
}

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

using namespace std;

using ll = long long;

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

    int a, b, c;
    cin >> a >> b >> c;
    if (b - a == c - b) cout << "YES\n";
    else cout << "NO\n";

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Security.Cryptography;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var spl = input.ReadLine().Split(' ');
        var n = int.Parse(spl[0]);
        var x = int.Parse(spl[1]);
        var ary = ToIntArray(input.ReadLine(), n);

        long c = 0;

        for(int i=1; i<n; i++) {
            long sum = ary[i-1] + ary[i];
            if(sum > x) {
                var co = sum-x;
                if(ary[i] > co) {
                    ary[i] -= co;
                } else {
                    co -= ary[i];
                    ary[i] = 0;
                    ary[i-1] -= co;
                }
                c += sum-x;
            }
        }

        return c;
    }

    static long[] ToIntArray(string strs, int n) {
        var ret = new long[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = long.Parse(spl[i]);
        return ret;
    }
}

Measured memory_bytes: 25440
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int a[6];
    for(int i=1;i<=5;i++)cin>>a[i];
    for(int i=1;i<=5;i++){
        if(a[i]==0){
            cout<<i<<endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3636
N,K = map(int,input().split())
A = list(map(int,input().split()))
# def search(A):
#     for i in range(N):
#         if A[i] == 1:
#             return i
# n = search(A)
#
# print(-(-n//(K-1)) + -(-(N-1-n)//(K-1)))
print(-((-N+1) // (K-1)))

Measured memory_bytes: 13880
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#define Max 100001
#define inf 1000000000000000
using namespace std;
int n,m,flag;
int first[Max * 2],nextv[Max * 2],u[Max * 2],v[Max * 2],s[Max * 2];
long long rela[2][Max],l = 0,r = inf,ans;
void dfs(int from,int tag,long long va) {
    if(flag)return;
    int k = first[from];
    while(k != -1) {
        if(flag)return;
        int vtag = (tag == 1);
        int to = v[k];
        long long lva = s[k] - va;
        if(rela[vtag][to] != inf) {
            if(rela[vtag][to] == lva) {
                k = nextv[k];
                continue;
            }
            else {
                flag = 1;
                return;
            }
        }
        rela[vtag][to] = lva;
        if(vtag)r = min(r,lva);
        else l = max(l,-lva);
        if(r - l <= 1){///范围冲突 没有解
            flag = 1;
            return;
        }
        dfs(to,-tag,lva);
        k = nextv[k];
    }
}
int main() {
    scanf("%d%d",&n,&m);
    memset(first,-1,sizeof(first));
    for(int i = 1;i <= n;i ++) {
        rela[0][i] = rela[1][i] = inf;
    }
    for(int i = 0;i < m;i ++) {
        scanf("%d%d%d",&u[i],&v[i],&s[i]);
        u[i + m] = v[i];
        v[i + m] = u[i];
        s[i + m] = s[i];
        nextv[i] = first[u[i]];
        first[u[i]] = i;
        nextv[i + m] = first[u[i + m]];
        first[u[i + m]] = i + m;
    }
    dfs(1,1,0);///dfs遍历所有点和第一个点的关系，如果有冲突flag为1 冲突就是说得到于同一点的同一关系的值不同比如a1 + a2 = 3 和 a1 + a2 = 4
    if(!flag) {///遍历后无冲突
        long long temp = -1;
        for(int i = 1;i <= n;i ++) {
            if(rela[0][i] != inf && rela[1][i] != inf) { ///可以确定a1
                long long d = rela[1][i] - rela[0][i];
                if(d % 2)flag = 1;
                else temp = d / 2;
                break;
            }
        }
        if(!flag) {
            if(temp != -1) {///确定a1 解唯一
                ans = 1;
            }
            else ans = r - l - 1;
        }
    }
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 15872
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;


/*
           1) long long vs int overflow
           2) read question carefully
*/

#define eprintf(...)   fprintf(stderr, __VA_ARGS__)
#define umapii unordered_map < int , int >
#define umapll unordered_map<ll,ll>
#define mapll map<ll,ll>
#define mapii map<int,int>
#define ll long long
#define pi pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define vs vector<string>
#define vi vector<int>
#define vll vector<ll>
#define vpi vector<pi>
#define vpll vector<pll>
#define vvi vector<vi>
#define vvll vector<vll>
#define all(v) (v).begin(),(v).end()
#define FOR(i,a,b) for(int i = a;i <= b; i++)

#define debug(x)       cerr<< #x <<" : "<< x << endl;
#define debuga(A,N)    cerr<< #A <<" : [";for(int i = 0; i<N;i++) cerr<<A[i]<<" "; cerr<<"]\n";
#define debuga2(A,N,M) cerr<< #A << " : \n"; for(int i=0;i<N;i++){cerr<<"[";for(int j=0;j<M;++j) cerr<<A[i][j]<<" ";cerr<<"]\n";}
#define debugp(p)      cerr<< #p <<" : "<<"("<<(p).first<<","<<(p).second<<")\n";
#define debugv(v)      cerr<< #v <<" : "<<"[";for(int i = 0; i< (v).size(); i++) cerr<<v[i]<<" "; cerr<<"]\n";
#define debugv2(v)     cerr<< #v << " : \n"; for(int i=0;i<v.size();i++){cerr<<"[";for(int j=0;j<(v[0].size());++j) cerr<<v[i][j]<<" ";cerr<<"]\n";}
#define debugs(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin(); itr!=m.end();itr++) cerr<<*itr<<" "; cerr<<"]\n";
#define debugm(m)      cerr<< #m <<" : [ "; for(auto itr = m.begin();itr!=m.end(); itr++) cerr<<"("<<itr->first<<","<<itr->second<<") ";cerr<<"]\n";

const ll mod = 1000000007;
/*STL:
       (1) PRIORITY_QUEUE pq:
       -> priority_queue < int > pq; // max_heap
       -> priority_queue < int , vector < int > , greater < int > > pq; // min_heap 
       -> pq.top()   --> returns the maximum or minimum element
       -> pq.push()  --> push element into the queue
       -> pq.pop()   --> remove top most element
       -> pq.empty() --> checks whether queue is empty or not

*/
ll modexp(ll x, ll ex) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x) % mod;
        ex >>= 1ll;
        x = (x * x) % mod;
    }
    return ans;
}

const int inf = 1e9 + 7;
ll over(ll a , ll b){
    return (b - a) / 2;
}
int main(){
    ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll n , a, b;
    cin >> n >> a >> b;
    if((b - a) % 2 == 0){
        cout << over(a , b) << '\n'; 
    } else{
        ll c1 = 1 , c2 = b - (a - 1);
        ll lef , rt;
        if((c2 - c1) % 2 == 0) lef =  over(c1 , c2) + (a - 1);
        else{
            c2--;
            lef = over(c1 , c2) + a; 
        }
        c2 = n; c1 = a + n - b;
        if((c2 - c1) % 2 == 0) rt = over(c1 , c2);
        else{
            c1++;
            rt = over(c1 , c2) + 1 + n - b;
        }
        cout << min(rt , lef) << '\n';
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    int weight;
    edge(int f,int t,int w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

template <class T>
inline bool chmin(T &a, T b){
    if (a > b){
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmax(T &a, T b){
    if (a < b){
        a = b;
        return true;
    }
    return false;
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

bool isPalindrome(string s){
    string t = s;
    reverse(all(t));
    return s==t;
}

constexpr ll LNF = 1e18+7;

constexpr int INF = 1e9+7;

vector<int> dx = {-1,0,1,0,-1,1,-1,1};
vector<int> dy = {0,-1,0,1,1,-1,-1,1};

/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int a,b; cin >> a >> b;
    rep(i,0,to_string(b).size()){
        a*=10;
    }
    int c = a+b;
    int d = sqrt(c);
    if(c==d*d) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
# def makelist(n, m):
# 	return [[0 for i in range(m)] for j in range(n)]

# n = int(input())
# a, b = map(int, input().split())
# s = input()



N, A, B = map(int, input().split())

if A > B:
	print(0)
elif A == B:
	print(1)
elif N == 1:
	if A != B:
		print(0)
	else:
		print(1)
elif N == 2:
	print(1)
else:
	N -= 2
	ans = B*N - A*N + 1
	print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    int N;
    cin >> N;
    ll a = 2, b = 1, c = a;
    for (int i = 0; i < N; ++i){
        a = b;
        b += c;
        c = a;
    }
    cout << a << "\n";
    
    return 0;
}

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

int n;
int ans[100][100];

bool WithinRange(int y, int x) {
  if (y >= n) return false;
  if (y < 0) return false;
  if (x >= n) return false;
  if (x < 0) return false;
  return true;
}

int main() {
  while (1) {
    scanf("%d", &n);
    if (n == 0) return 0;

    for (int i=0; i<n; i++) {
      for (int j=0; j<n; j++) {
        ans[i][j] = 0;
      }
    }

    int cnt = 0;
    int y = n/2+1;
    int x = n/2;
    while (cnt < n*n) {
      cnt++;

      if (!WithinRange(y, x) || ans[y][x]) {
        y--;
        x++;
        do {
          y++;
          x--;
          if (y >= n) y %= n;
          if (y < 0) y += n;
          if (x >= n) x %= n;
          if (x < 0) x += n;
        } while (!WithinRange(y, x) || ans[y][x]);
      }

      ans[y][x] = cnt;
      y++;
      x++;
    }

    for (int i=0; i<n; i++) {
      for (int j=0; j<n; j++) {
        printf("%4d", ans[i][j]);
      }
      puts("");
    }
  }
}

Measured memory_bytes: 2624
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int a[100][100], n;
ll mem[1<<17], b[1<<17];
bool l[1<<17];
ll dp(int msk){
    if(msk==(1<<n)-1){
        return 0;
    }
    if(l[msk]){
        return mem[msk];
    }
    vector <int> v;
    for(int i=0; i<n; ++i){
        if(!((1<<i)&msk)){
            v.push_back(i);
        }
    }
    ll res=-1e12;
    for(int i=1; i<(1<<(int)(v.size())); ++i){
        int msk1=0;
        for(int j=0; j<v.size(); ++j){
            if((i&(1<<j))){
                msk1|=(1<<v[j]);
            }
        }
        res=max(res, b[msk1]+dp(msk|msk1));
    }
    l[msk]=1;
    mem[msk]=res;
    return res;
}
int main(){
    while(cin>>n){
        ll ans=0;
        for(int i=0; i<n; ++i){
            for(int j=0; j<n; ++j){
                scanf("%d",&a[i][j]);
            }
        }
        for(int i=0; i<(1<<n); ++i){
            for(int j=0; j<n; ++j){
                if(!(i&(1<<j)))
                    continue;
                for(int k=j+1; k<n; ++k){
                    if(i&(1<<k)){
                        b[i]+=a[j][k];
                    }
                }
            }
        }
        memset(l, 0, sizeof l);
        ans=dp(0);
        cout<<ans<<endl;
    }
  return 0;
}




Measured memory_bytes: 1408
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

int make_divisors(int N){
    int i = 1, res = 0;
    for (; i * i < N; ++i){
        if (N % i == 0){
            res += 2;
        }
    }
    if (i * i == N) res += 1;
    return res;
}

int main(){
    int N;
    cin >> N;

    int ans = 0;
    for (int i = 1; i < N; ++i){
        ans += make_divisors(i);
    }

    cout << ans << endl;
}

Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)


int main(){
    int n,m;
    cin >> n >> m;
    int ans =0;
    if(n==1){
        cout << m << endl;
        return 0;
    }
    for(int i=1;i<=m/n;i++){
        if(m%i==0&&m/i>=n){
            ans = i;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main(int argc, char** argv) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    if (argc == 2 && atoi(argv[1]) == 123456789)
        freopen("d:\\code\\cpp\\stdin", "r", stdin);

   int n,m,x,y;
   cin >> n >> m >> x >> y;

   vector<int> xs(n), ys(m);
   int mx = -1000, my = 1000;
   for(int i=0; i<n; i++){
       cin >> xs[i];
       mx = max(mx, xs[i]);
   }

    for(int i=0; i<m; i++){
        cin >> ys[i];
        my = min(my, ys[i]);
    }

    int ia = max(x, mx);
    int ib = min(y, my);
    if (ia < ib)
        cout << "No War";
   else
       cout << "War";

    return 0;
}

Measured memory_bytes: 256
<?php
while(1){
  list($n,$x)=explode(' ',trim(fgets(STDIN)));

  if(!$n&&!$x) break;

  $ok=0;
  for($i=1;$i<=$n;$i++){
    for($j=$i+1;$j<=$n;$j++){
      for($k=$j+1;$k<=$n;$k++){
        if(($i+$j+$k)==$x) ++$ok;
      }
    }
  }

  echo $ok,PHP_EOL;
}

Measured memory_bytes: 15436
#include <bits/stdc++.h>
using namespace std;
signed main(void){
	int n,m;
	cin>>n>>m;
	int a[n+1];
	memset(a,-1,sizeof(a));
	bool flag=false;
	for(int i=1;i<=m;i++){
		int c,b;
		cin>>c>>b;
		if(a[c]!=-1&&a[c]!=b) flag=true;
		else a[c]=b;
	}
	if(m==0){
		if(n==1) cout<<0;
		else{
			cout<<1;
			for(int i=1;i<=n-1;i++) cout<<0;
		}
		return 0;
	}
	if((a[1]==0&&n!=1)||flag){
		cout<<-1;
		return 0;
	}
	if(a[1]==-1){if(n!=1) a[1]=1; else a[1]=0;}
	for(int i=1;i<=n;i++){
		if(a[i]==-1) cout<<0;
		else cout<<a[i];
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int a[] = {0, 6000, 4000, 3000, 2000};
    for (int i = 0; i < 4; ++i) {
        int t, n;
        cin >> t >> n;
        cout << a[t]*n << "\n";
    }
    return 0;
}


Measured memory_bytes: 3108
N = int(input())
S = [input() for _ in range(N)]

d = {}
for s in S:
    s = "".join(sorted(s))
    if s in d:
        d[s] += 1
    else:
        d[s] = 1
ans = 0
for v in d.values():
    if v > 1:
        ans += v * (v - 1) // 2
print(ans)

Measured memory_bytes: 24980
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(){
  int i;
  int c,n,si,ei,ni;
  double ca,ba,mina;
  for(;;){
    scanf("%d",&n);
    if(n==0)
      break;
    int f[n];
    double x[n],y[n];
    memset(f,0,sizeof(f));
    si=0;
    ei=0;
    for(i=0;i<n;i++){
      scanf("%lf,%lf",&x[i],&y[i]);
      if(y[i]>y[si]){
	si=i;
	ei=i;
      }else if(y[i]==y[si]){
	if(x[i]<x[si])
	  si=i;
	if(x[i]>x[ei])
	  ei=i;
      }
    }
    c=n;
    ba=-M_PI;
    for(;;){
      mina=M_PI;
      for(i=0;i<n;i++){
	if(i!=si&&f[i]==0){
	  ca=atan2(y[i]-y[si],x[i]-x[si]);
	  if(ba<ca&&mina>ca){
	    mina=ca;
	    ni=i;
	  }
	}
      }
      if(si!=ei){
	f[si]=1;
	c--;
      }
      ba=mina;
      si=ni;
      if(si==ei){
	c--;
	break;
      }
    }
    printf("%d\n",c);
  }
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef pair<int, int>P;
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
typedef vector<vector<ll>> mat;
typedef vector<int> vec;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
const ll mod = 1000000007;
const ll INF = mod * mod;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll qp(ll a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

void solve() {
    ll a,b,c,n;
    string s, t;
    double ans;
    string text;

    cin  >> n;

    // ll sum = 1;
    // ll bunbo = 0;
    // ll k[100];
    double sum=0;

    rep(i, n){
        double a;
        cin >> a;
        // sum *= a;
        // k[i] = a;
        sum += 1/a;
    }

    // rep(i, n){
    //     bunbo += sum/k[i];
    // }


    ans = 1/((double)sum);

    std::cout << ans << endl; 
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    solve();
    // stop
        return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

#define endl "\n"
#define int ll
#define ll long long
#define pb emplace_back
#define fi first
#define se second
#define pll pair<ll, ll>
#define ull unsigned long long
#define ld long double

#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;

#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=n-1; i>=0; i--)
#define repa(i,a,b) for(ll i=(a);i<=(b);i++)
#define all(x) (x).begin(), (x).end()
#define ordered_set tree<int , null_type, less<int> , rb_tree_tag, tree_order_statistics_node_update>
/*
 Ordered set docs:
 order_of_key (k) : Number of items strictly smaller than k .
 find_by_order(k) : K-th element in a set (counting from zero).
*/
#define blc boost::lexical_cast<long long>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
using namespace __gnu_pbds;
const int MOD = 1e9+7;
const ll INF = 1e18;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

ll add(ll x, ll y) {ll res=x+y; return(res>=MOD?res-MOD:res);}

ll sub(ll x, ll y) {ll res=x-y; return(res<0?res+MOD:res);}

ll lcm(ll x, ll y) {ll res=(x*y)/__gcd(x,y); return res;}

ll powerLL(ll x, ll n, ll mod) 
{ 
    ll result = 1; 
    while (n) { if (n & 1) result = (result%mod * x%mod) % mod; n = n / 2; x = (x%mod * x%mod) % mod; } return result; 
} 

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

const int N = 3005;
double dp[N][N];
double pro[N];
void solve()
{
    ll n, k;
    cin>>n;
    rep(i,n)
    	cin >> pro[i];
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    for(ll i = 1; i<=n; i++)
    	dp[0][i] = 0;
    for(ll i = 1; i<=n; i++)
    	dp[i][0] = dp[i-1][0] * (1 - pro[i-1]);
    for(ll i =1; i<=n; i++)
    {
    	for(ll j = 1; j<=i; j++)
    		dp[i][j] = dp[i-1][j] * (1 - pro[i-1]) + dp[i-1][j-1] * (pro[i-1]);
    }
    double res = 0;
    for(ll i = n; i > n/2; i--)
    	res += dp[n][i];
    cout << fixed << setprecision(10) << res << endl;	
}
int32_t main()
{
    fast;
    int t;
    t=1;
    //cin>>t;
    while(t--)
        solve();
    return 0; 
}

Measured memory_bytes: 74296
PROGRAM Triangles
      IMPLICIT NONE
      INTEGER :: N
      INTEGER,ALLOCATABLE :: L(:)
      INTEGER(8) :: ans
      INTEGER :: a,b,c, cmin,cEnd
      read*,N
      ALLOCATE( L(1:N) )
      read*,L(:)
      
      CALL bubbleSort( L,N )
      
      ans = 0
      DO a = 1,N-2
        DO b = a+1,N-1
        cmin = L(a) - L(b)
        cEnd = b
          DO c = N,b+1,-1
            IF( L(c)>cmin )THEN
              cEnd = c
              EXIT
            END IF
          END DO
          ans = ans + (cEnd-(b+1)+1)
        END DO
      END DO
      
      print*,ans
      
      
      END PROGRAM
      
      SUBROUTINE bubbleSort( array,N )
        IMPLICIT NONE
        INTEGER,INTENT(INOUT) :: array(1:N)
        INTEGER :: N
        INTEGER :: a,b,buffer
        
        N = size( array )
        DO a = 1,N-1
          DO b = a+1,N
            !left will be BIG
            IF( array(a)<array(b) )THEN
              buffer   = array(a)
              array(a) = array(b)
              array(b) = buffer
            END IF
          END DO
        END DO
      END SUBROUTINE bubbleSort

Measured memory_bytes: 384
n,a,b,c = map(int,input().split())

l = []

for i in range(n):
    ll = int(input())
    l.append(ll)

bit = {}
bitlen = {}

for i in range(1<<n):
    cnt = 0
    leng = 0
    for j in range(n):
        if((1<<j) & i): 
            cnt += 1
            leng += l[j]
    bit[i] = cnt
    bitlen[i] = leng


ans = float('inf')

for i in range(1,1<<n):
    for j in range(1,1<<n):
        if(i&j):continue
        for k in range(1,1<<n):
            if(i&k):continue
            if(j&k):continue
            
            t = 0
            t += (bit[i]-1)*10
            t += (bit[j]-1)*10
            t += (bit[k]-1)*10
            t += abs(bitlen[i]-a)
            t += abs(bitlen[j]-b)
            t += abs(bitlen[k]-c)
            if(ans > t):ans = t

print(ans)

Measured memory_bytes: 44396
#include <bits/stdc++.h>
#include <string>
#include <cmath>
#include <sstream>
//#include <unordered_map>
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORD(i, a, b) for(int i = (a-1); i >= (b); i--)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
typedef long long int ll;
using namespace std;
//ll mod=1000000007;
//ll mod=67280421310721;
ll mod=998244353;
ll INF=1e18;
ll po(ll a,ll b)
{
	ll re=1;
	while(b)
	{
		if(b%2==1)
		{
			re=(re*a);
			re%=mod;
		}
		a=(a*a);
		a%=mod;
		b>>=1;
	}
	return re;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int test=1;
//	cin>>test;
	while(test--)
	{
		string s,a="ARC";
		cin>>s;
		if(s[1]=='R')
		a[1]='B';
		cout<<a;
	}
	return 0;
}


Measured memory_bytes: 3608
W, H, x, y, r = list(map(int, input().split()))

x_right = x + r
x_left = x - r
y_up = y + r
y_down = y - r

if x_right <= W and x_left >= 0 and y_up <= H and y_down >= 0:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 5596
#include <bits/stdc++.h>
#define inf 0x3f3f3f3f

using namespace std;

typedef long long ll;

vector <int> e[55];
int num[55];

int val[55],w[55],up[55];

void dfs(int x,int fa) {
  val[x]=1;w[x]=num[x];
  for(int i=0;i<e[x].size();i++)
    if (e[x][i]!=fa) {
    	int u=e[x][i];
    	dfs(u,x);
    	val[x]+=val[u];
    	w[x]=min(w[x]+w[u],inf);
	}
}

bool cmp(int x,int y) {
  return (ll)w[x]*val[y]<(ll)w[y]*val[x];
}

int id[55];

ll f[2][150005],g[150005];
int q[150005];

int main() {
  int n,m,D;
  scanf("%d%d%d",&n,&m,&D);
  up[1]=inf;
  for(int i=2;i<=n;i++) up[i]=D;
  scanf("%d",&num[1]);
  for(int i=2;i<=n;i++) {
  	int x;
  	scanf("%d%d",&num[i],&x);
  	e[x].push_back(i);
  }
  dfs(1,0);
  for(int i=1;i<=n;i++) id[i]=i;
  sort(id+1,id+n+1,cmp);
  int cur=0;
  memset(f[cur],0x3f,sizeof(f[cur]));
  f[cur][0]=0;
  int sz=0;
  for(int i=1;i<=n;i++) {
  	int x=id[i],d=min(n,up[x]);
  	up[x]-=d;
  	cur^=1;
  	memset(f[cur],0x3f,sizeof(f[cur]));
  	sz+=d*val[x];
  	for(int j=0;j<val[x];j++) {
  		int l=1,r=0;
  		for(int k=0;k*val[x]+j<=sz;k++) {
  			int u=k*val[x]+j;
  			while (l<=r&&k-q[l]>d) l++;
  			while (l<=r&&g[r]+(ll)(k-q[r])*w[x]>=f[cur^1][u]) r--;
  			q[++r]=k;g[r]=f[cur^1][u];
  			f[cur][u]=min(f[cur][u],g[l]+(ll)(k-q[l])*w[x]);
		  }
	  }
  }
  int ans=0;
  for(int i=0;i<=sz;i++) 
    if (f[cur][i]<=m) {
  	  ll s1=0,s2=0;
  	  for(int j=1;j<=n;j++) {
  		  int x=id[j];
  		  ans=max((ll)ans,s1+i+min((ll)up[x],(m-f[cur][i]-s2)/w[x])*val[x]);
  		  s1+=(ll)up[x]*val[x];s2+=(ll)up[x]*w[x];
  	  	  if (s2+f[cur][i]>m) break;
	    }
    }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 2688
def e():
    n, m, p = map(int, input().split())

    edges = []
    for i in range(m):
        edges.append(tuple(map(int, input().split())))

    edges.sort(key=lambda x: x[1])
    dist = [float('inf') for i in range(n)]
    dist[0] = 0

    for i in range(n):
        for e in edges:
            if dist[e[1]-1] > dist[e[0]-1] - (e[2] - p):
                dist[e[1]-1] = dist[e[0]-1] - (e[2] - p)

    for i in range(n):
        for e in edges:
            if dist[e[1] - 1] > dist[e[0] - 1] - (e[2] - p):
                dist[e[1]-1] = float('-inf')

    if dist[n-1] == float('-inf'):
        print(-1)
    else:
        print(-dist[n-1] if -dist[n-1] >= 0 else 0)


if __name__ == '__main__':
    e()


Measured memory_bytes: 49672
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string { sc.Scan(); return sc.Text() }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }
	return res
}

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1000000)

	n := scanInt()
	a := scanInts(n)

	c := make(map[int]int, 0)

	for _, e := range a {
		c[e]++
	}

	odd := 0
	for i := range c {
		if c[i]%2 == 1 {
			odd++
		}
	}

	// fmt.Println(odd,len(c)-odd)

	eve := len(c)-odd
	
	if eve%2 == 0 {
		fmt.Println(len(c))
	} else {
		fmt.Println(len(c)-1)
	}

}

Measured memory_bytes: 7424
#include <bits/stdc++.h>
using namespace std; 
long long A;
int res=0,ans[1000004];
int main(){
	cin>>A;
	ans[1]=1;
	for(int i=1;i<=1e6;i++){
		ans[i]=max(ans[i],ans[i-1]);
		if(i+ans[i]+1<=1e6)ans[i+ans[i]+1]=ans[i]+1;
	}
	for(int i=2;1ll*i*i<=A;i++){
		int cnt=0;
		while(A%i==0)cnt++,A/=i;
		res+=ans[cnt];
	}
	if(A>1){
		res++;
	}
	cout<<res;
}

Measured memory_bytes: 7536
#!/usr/bin/env python3
import sys


def solve(N: int):
    # 素数は全部奇数
    ## ほとんど条件満たしそう

    def sieve(n):
        is_prime = [True for _ in range(n+1)]
        is_prime[0] = False

        for i in range(2, n+1):
            if is_prime[i-1]:
                j = 2 * i
                while j <= n:
                    is_prime[j-1] = False
                    j += i
        table = [i for i in range(1, n+1) if is_prime[i-1]]
        return table
    
    primes = sieve(55555)
    mod_primes = [p for p in primes if p%5==1]
    print(*mod_primes[:N])
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3736
import java.util.Scanner;
class Main
{
    public static void main(String args[])
    {
	Scanner scan=new Scanner(System.in);
	while(scan.hasNext())
	    {
	double a=scan.nextDouble();
	double b[]=new double[10];
	b[0]=a;
	double sum=0;
	for(int i=0;i<10;i++)
	    {
		if(i%2!=0 && i!=0)
		    {
			b[i]=b[i-1]*2;
		    }
		if(i%2==0 && i!=0)
		    {
			b[i]=b[i-1]/3;
		    }
		sum+=b[i];
	    }
	System.out.printf("%.8f\n",sum);
	    }
    }
}

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

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define rep(i,a,n)    for(int i=a; i<=n; ++i)
#define rep1(i,a,n)   for(int i=a; i>=n; --i)
#define pb            push_back
#define mp            make_pair
#define int           long long
#define fr            first
#define sc            second
#define vc            vector
#define sz(v)         (int)v.size()
#define all(x)        (x).begin(),(x).end()
#define rall(x)       (x).rbegin(),(x).rend()
#define N             (int)(1e6+5)
#define M             1000000007
#define MM            998244353
#define PI            3.14159265358979
#define INF           1000000000000000

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mii;

int n,m,ans; string str;

int solve(){
    cin>>n>>m;
    cout<<(n+m-1)/m;
    return 0;
}

signed main() {
    ios::sync_with_stdio(0);
    //std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm> 
#include <cstdlib>
using namespace std;
int main(){
    int n,ans=0;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    for(int i=0;i<n;i++){
        if(a[i]==a[i+1]){
            a[i+1]=i+80;
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;



class Main {
	public static void main (String args[]){
		 Scanner scan = new Scanner(System.in);
		 int N = scan.nextInt();
		 
		 if(N==1){
			 System.out.println("Hello World");
		 }
		 
		 if(N==2){
			 int A = scan.nextInt();
			 int B = scan.nextInt();
			 
			 System.out.println(A+B);
		 }
	 }
}


Measured memory_bytes: 23124
h,w = map(int, input().split())
x = [list(input()) for _ in range(h)]
y = [[0]*(w+2) for _ in range(h+2)]

for i in range(h):
    for j in range(w):
        if x[i][j] == '.':
            y[i+1][j+1] = 0
        else:
            y[i+1][j+1] = 1

for i in range(h):
    for j in range(w):
        if x[i][j] == '.':
            x[i][j] = str(sum(y[i][j:j+3])+sum(y[i+1][j:j+3])+sum(y[i+2][j:j+3]))
    print(''.join(x[i]))

Measured memory_bytes: 3188
#include<iostream>
#include<algorithm>

using namespace std;

int main() {
  int l, a,b,c,d,i,j;
  i = j = 0;
  cin >> l >> a >> b >> c >> d;
  while(a>0){
    a-=c;i++;
  }
  while(b>0){
    b-=d;j++;
  }
  
  cout <<  l -  max(i, j)  << endl;

  return 0;
}

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

using namespace std;

void Main() {
    int N;
    cin >> N;
    int sqrtN = (int)sqrt((double)N);
    cout << (sqrtN * sqrtN) << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
#include <math.h>
#include <ostream>
#include <stdio.h>
using namespace std;

int main(void) {
  string S, T;
  cin >> S >> T;
  for (int i = 0; i < (int)S.length(); i++) {
    if (S[i] != T[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


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

int main(){
  int N;
  string S,T;
  cin >> N >> S;
  if(N%2)
  cout << "No" << endl;
  else {
    for(int i = 0; i < N/2; i++){
      T += S.at(i);
    }
    if(S == T + T)
    cout << "Yes" << endl;
    else
    cout << "No" << endl;
  }
  
}

Measured memory_bytes: 256
/*　　　　　　　{:i:i:|i:i:/l/l--　 　 　--l/li:i:i|i:i:i:i}
　　　　　　 　 {:rx|:i:i ィi芥ミ 　 　 .ィi芥ミｉ:ｉ|ﾍ:i:i:}
.　　　 　 　 　 ｛ﾏ|ｉ:  {::’:} 　 　 　{:‘::} :ｉ:i:|〉｝:/
　　 　 　 　 　 乂|:i:| ｀¨¨¨¨´ 　 　　｀¨¨¨´  :i:ｉ:|ｼ/
　 　 　 　 　 　 ﾉ:|:i|　　　　　　′　　　 　   |:i:i:|ﾂ
　　　　　　　　/:/|:i:| ､　　　 　_ _ 　　　　  |:i:i:|
　 　 　　 　 /:/ .|:i:|/ ＼　　　 　 　     ｨ〔|:i:/
　　 　 　  　 〈;/ く刈＿ 个 　   -   　＜}　./|/_〉
　　     　　 r-っ'~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ~ﾞ|___
　　 　     /／ニつ　　　　　　 ､　　　　　　　ノﾆﾆ　＼
.　　　     |　　ニ⊃ 　./　/　 ──   /　/　　..⊆ﾆﾆ　　:|
.　　　     |　　丁´　 /|￣|￣  ─‐ /|￣|￣ 　 .￣|丁 　|
.　　　     |　　ﾉ.  　 |￣|￣  ─‐  |￣|￣ 　 　.|八 　|
.　　　     |　　||. 　 |￣|￣ |￣| |￣|￣ 　   .|　|
.　 　 　   |  　||   　￣￣￣　￣ 　￣￣￣　　  .|　|  |
.　 　 　  　    ||＿＿＿＿＿＿＿＿＿＿＿＿______|__　　 ',
　 　      ,′　 | ７ﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆ}  ,′
.　　     {　　　|/　}ﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆﾆ{/ 　 　
*/
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

using namespace std;

#define rep(a) _rep(0,int(a))
#define _rep(a,b) for(int i=int(a);i<int(b);i++)
#define ll long long
#define fst first
#define snd second
#define pf(b) printf("%.12f\n",(double)b)

//factorial
int fact(int n) {
	int a = 1;
	for (int i = 1;i <= n;i++) a *= i;
	return a;
}
int l;
int main() {
	cin >> l;
	pf(l*l*l/27);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {

  int H,W;
  cin>>H>>W;
  vector<vector<char>> a(H,vector<char>(W));
  for(int i=0; i<H;i++){
    for(int j=0;j<W;j++){
      cin>>a.at(i).at(j);}}
  

  for(int i=0; i<H;i++){
    for(int k=0; k<2;k++){
    for(int j=0;j<W;j++){
      cout<<a.at(i).at(j);
    if(j==W-1){cout<<endl;}}}}
}



Measured memory_bytes: 256
from collections import deque
k = int(input())
s = deque([1,2,3,4,5,6,7,8,9])
for i in range(k):
    c = s.popleft()
    d = int(str(c)[-1])
    for j in range(max(0,d-1),min(10,d+2)):
        s.append(int(str(c)+str(j)))
print(c)

Measured memory_bytes: 10916
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define INF 0x3f3f3f3f
using namespace std;
int a,b,ans;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>a>>b;
  int maxx=max(a,b);
  int minn=min(a,b);
  ans+=maxx;
  --maxx;
  ans+=max(maxx,minn);
  cout<<ans;
	return 0;
}

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

using namespace std;

const int MAXN = 1e6 + 5;
using ll = long long;

ll n,c;
ll v[MAXN];
ll dp[MAXN];


struct parabola{
    ll b;
    ll c;
    parabola(){b = c = 1e9;}
    parabola(int j){
        b = -2*v[j];
        c = dp[j] + v[j]*v[j];
    }

    ll operator()(ll x){
        return x*x + b*x + c;
    }
};



parabola tree[4*MAXN];


void add_line(parabola par,int id = 1,int l = 0,int r = MAXN){

    int m = (l+r)/2;
    bool lef = par(l) < tree[id](l);
    bool mid = par(m) < tree[id](m);

    if(mid) swap(tree[id],par);
    if(r - l == 1) return ;
    if(lef != mid) add_line(par, 2 * id,l,m);
    else add_line(par,2*id+1,m,r);
}

ll get_line(int x,int id = 1,int l = 0,int r = MAXN){
    int m = (l+r)/2;
    if(r - l == 1) return tree[id](x);
    if(x < m) return min(tree[id](x),get_line(x,2*id,l,m));

    return min(tree[id](x),get_line(x,2*id+1,m,r));
}






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

    cin>>n>>c;
    memset(dp,0x66,sizeof(dp));

    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    dp[0] = 0;
    add_line(parabola(0));

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

        dp[i] = get_line(v[i]) + c;
        add_line(parabola(i));
        //cout<<i<<": "<<dp[i]<<endl;
    }
    cout<<dp[n-1]<<'\n';



    return 0;
}


Measured memory_bytes: 73984
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <functional>
#include <initializer_list>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail)
{
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}

int main()
{
  string s;
  cin >> s;
  int apos = 0, zpos = 0;
  bool sw = 1;
  REP(i, 0, s.length())
  {
    if (sw &&s[i] == 'A')
    {
      apos = i;
      sw = 0;
    }
    if(s[i]=='Z')
      zpos = i;
  }
  cout << zpos - apos+1 << endl;
  

  return 0;
}


Measured memory_bytes: 640
#include "stdio.h"
#include "math.h"
int main() {

    int i,n;
    scanf("%d",&n);
    if (n==0) {
        printf("%d\n",100000);
        return 0;
    }
    double result=100000;
    for (i = 0; i < n; i++) {
        result=result*1.05;
        result=1000*ceil(result/1000);
    }
    printf("%d\n",(int)result);
    return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>


int main(){
  int N, K; cin >> N >> K;

  double retval = 0;
  for (int d=1;d<=N;d++){
    int p = d;
    double prob = 1.0/N;
    while (p<K){
      p *= 2;
      prob *= 0.5;
    }
    retval += prob;

  }
  
  cout << fixed << setprecision(10);
  
  cout << retval << endl;
  return 0;
}



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

namespace AtCoder
{
    class Program
    {
        static Stack<int> p;
        static Stack<int> q;
        static Stack<int> r;

        static void Main(string[] args)
        {
            //[summary]E - Red and Green Apples
            var line = ReadLine();
            var X = line[0];
            var Y = line[1];
            var A = line[2];
            var B = line[3];
            var C = line[4];

            var p = GetApples();
            var q = GetApples();
            var r = GetApples();

            var red = 0;
            var green = 0;

            long ans = 0;

            for (int i = 0; i < X + Y; i++)
            {
                var pi = Peek(p, X, red);
                var qi = Peek(q, Y, green);
                var ri = Peek(r, C);

                if (ri > pi && ri > qi)
                {
                    ans += ri;
                    r.Pop();
                }
                else if (pi > qi)
                {
                    ans += pi;
                    red++;
                    p.Pop();
                }
                else
                {
                    ans += qi;
                    green++;
                    q.Pop();
                }
            }

            Console.WriteLine(ans);
        }

        static int Peek(Stack<int> apples, int upper = 0, int count = 0)
        {
            if (apples.Count > 0 && count < upper)
            {
                return apples.Peek();
            }
            else
            {
                return 0;
            }
        }

        static Stack<int> GetApples()
        {
            var apples = ReadLine();

            Array.Sort(apples);

            return new Stack<int>(apples);
        }

        static int[] ReadLine()
        {
            var line = Console.ReadLine();
            var arr = line.Split(' ');

            return arr.Select(x => int.Parse(x)).ToArray();
        }
    }
}


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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;


int main() {
    string s;
    cin >> s;
    cout << s.substr(0, sz(s) - 8) << endl;


    return 0;
}

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

monsall = 0
monsnext = a[0]

for i in range(n):
    if monsnext >= b[i]:
        monsall += b[i]
        monsnext = a[i+1]
    else:
        if a[i+1] > b[i] - monsnext:
            monsall += b[i]
            monsnext = a[i+1] - b[i] + monsnext
        else:
            monsall += a[i+1] + monsnext
            monsnext = 0

print(monsall)

Measured memory_bytes: 81892
#include <bits/stdc++.h>
using namespace std;
char s[5]="ATCG",b[2];
int main(void) {
    scanf("%s",b);
    for (int i=0;i<4;i++) if (b[0]==s[i]) printf("%c\n",s[i^1]);
    return 0;
}


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

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

    int n;
    cin >> n;
    unordered_map<int, bool> mp;
    REP(i, n){
        int a;
        cin >> a;
        mp[a] = !mp[a];
    }

    int cnt = 0;
    for(auto x : mp){
        cnt += x.second;
    }

    cout << cnt << endl;

    return 0;
}

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

int main()
{
    int a,b;
    int tmp=-1;
    cin>>a>>b;
    for (int i=1;i<=1009;i++)
    {
        int x=i*0.08;
        int y=i*0.1;
        if(x==a&&y==b)
        {
            tmp=i;
            break;
        }
    }
    cout<<tmp<<endl;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T3;
const int INF = 1000000000;

const double PI = 3.1415926535;
int main(){
	double r;
	cin >> r;
	printf("%.14lf\n",2*r*PI);
}


Measured memory_bytes: 3740
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <math.h>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n,m;
	while(1){
		cin >> n >> m;
		if(n==0&&m==0)break;
		pair<int,int> p[100];
		vector<string> s(n);
		for(int i=0;i<n;i++){
			cin >> s[i];
		}
		string t; cin >> t;
		// 座圧パート
		vector<char> v;
		for(int i=0;i<t.size();i++){
			v.push_back(t[i]);
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				if(s[i][j]!='_')v.push_back(s[i][j]);
			}
		}
		sort(v.begin(),v.end());
		v.erase(unique(v.begin(),v.end()),v.end());
		// 座圧終了
		vector<int> a(t.size());
		for(int i=0;i<t.size();i++){
			a[i]=(lower_bound(v.begin(),v.end(),t[i])-v.begin());
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				if(s[i][j]!='_'){
					p[lower_bound(v.begin(),v.end(),s[i][j])-v.begin()]=make_pair(i,j);
				}
			}
		}
		int ans=p[a[0]].first+p[a[0]].second+1;
		for(int i=1;i<t.size();i++){
			ans+=abs(p[a[i]].first-p[a[i-1]].first)+abs(p[a[i-1]].second-p[a[i]].second)+1;
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 3164