akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

std::string solve(const std::string& s)
{
  return s[2] == s[3] && s[4] == s[5] ? "Yes" : "No";
}

int main()
{
  std::string s;
  std::cin >> s;

  std::cout << std::setprecision(20);
  std::cout << solve(s) << std::endl;
}


Measured memory_bytes: 256
// lcmとかはg++ -std=c++17 default.cppみたいなかんじで
//vector<vector<ll>> piyo(tate,vector<ll> (yoko));

#include <bits/stdc++.h>
#define mod 1000000007
#define INF 1000000000
#define ll long long
#define ln cout<<endl;
#define Yes cout<<"Yes"<<endl;
#define No cout<<"No"<<endl;
#define double long double
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
using namespace std;

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

    ll a,b,c,d,m,n,maxi=0,f=0,mini=INF,sum=0;
    string str1,str2;
    cin>>n>>m;
    vector<ll> v(n);
    rep(i,n)   cin >> v[i];
    rep(i,n) sum+=min(v[i]*2,(m-v[i])*2);
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
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;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;
// const int MOD = 998244353;

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

   int a, b, h, m;
   cin >> a >> b >> h >> m;

   double radm, radh, rad;
   radm = M_PI / 30 * m;
   radh = M_PI / 6 * h + M_PI / 360 * m;
   if (radh >= radm) {
      rad = radh - radm;
   } else {
      rad = radm - radh;
   }
   double ans = a * a + b * b - 2 * a * b * cos(rad);
   printf("%0.10f\n", sqrt(ans));
   return 0;
}

Measured memory_bytes: 4216
#include <bits/stdc++.h>
#define ll long long
#define REP(i, n) for (ll (i) = 0; (i) < (n); (i)++)
#define REPI(i, a, b) for (ll (i) = (a); (i) < (b); (i)++)
#define int long long
using namespace std;
using II = pair<int, int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
const int MOD = 1e9 + 7;
 
signed main() {
  int N; cin >> N;
  if (N == 1) {
    cout << "Hello World" << endl;
  } else {
    int a, b; cin >> a >> b;
    cout << a + b << endl;
  }
}


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

int main() {
    int n; cin >> n;
    int A[n];
    for (int i = 0; i < n; i++) cin >> A[i];

    long long ans = 0;
    map<int, int> m;
    for (int i = 0; i < n; i++) {
        ans += m[i - A[i]];
        m[i + A[i]]++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 21260
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,i,dt,dl;
  cin>>n;
  vector<int> t(n+1),x(n+1),y(n+1);
  for(i=1;i<=n;i++){
    cin>>t.at(i)>>x.at(i)>>y.at(i);
    dt=t.at(i)-t.at(i-1);
    dl=abs(x.at(i)-x.at(i-1))+abs(y.at(i)-y.at(i-1));
    if(dl<=dt&&(dl-dt)%2==0) continue;
    else{
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
}

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

int main()
{
    int n;
    long long int k;
    cin >> n >> k;
    int a[n + 1];
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    int isvis[n + 1] = {0};
    int j = a[1];
    isvis[1] = 1;
    vector<int> ls;
    ls.push_back(0);
    ls.push_back(1);
    while (!isvis[j])
    {
        isvis[j] = 1;
        ls.push_back(j);
        j = a[j];
    }
    long long int st = 1;
    while (st<(long long)ls.size()&&ls[st] != j)
        st++;
    // cout<<j<<" "<<st<<" ";
    if (k <= st)
        cout << ls[k+1];
    else
    {
        k -= st-1;
        long long int cyclen = (long long)ls.size() - st;
        // cout<<cyclen<<" ";
        k = k % cyclen;
        // cout<<k<<" ";
        cout<<ls[st+k];
    }
}

Measured memory_bytes: 5880
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using P = pair<ll,ll>;
#define fl cout<<flush;
#define endl '\n'
template <typename T> inline void prt(T v){cout<<v<<'\n';}
template <typename T> inline bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> inline bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1e9+7;
const ll MOD2=998244353;
const ld pi=3.14159265358979323846;
const ld eps=1e-10;


signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    vector<string> S(3);
    for(ll i=0;i<3;++i)cin>>S[i];
    sort(S.begin(), S.end(),[](string l, string r){return l.size()<r.size();});
    string a=S[0],b=S[1],c=S[2];
    ll na=a.size(),nb=b.size(),nc=c.size();
    string BIG=string(na+nb,'?')+c+string(na+nb,'?');
    vector<int> dpa(100000,-1);
    vector<int> dpb(100000,-1);
    auto Fa = [&](ll A){
        if(dpa[A]!=-1)return dpa[A];
        for(ll i=A;i<A+na;++i){
            if(BIG[i]!='?'&&a[i-A]!='?'&&BIG[i]!=a[i-A])return dpa[A]=0;
        }
        return dpa[A]=1;
    };
    auto Fb = [&](ll B){
        if(dpb[B]!=-1)return dpb[B];
        for(ll i=B;i<B+nb;++i){
            if(BIG[i]!='?'&&b[i-B]!='?'&&BIG[i]!=b[i-B])return dpb[B]=0;
        }
        return dpb[B]=1;
    };
    vector<int> dpab(200001,-1);
    auto Fab = [&](ll A,ll B){
        if(dpab[A-B+100000]!=-1)return dpab[A-B+100000];
        for(ll i=A;i<A+na;++i){
            if(i>=B&&i<B+nb&&a[i-A]!='?'&&b[i-B]!='?'&&a[i-A]!=b[i-B]){return dpab[A-B+100000]=0;}
        }
        return dpab[A-B+100000]=1;
    };
    ll ans=INF;
    for(ll i=0;i<=na+2*nb+nc;++i)
        for(ll j=0;j<=2*na+nb+nc;++j){
            if(Fa(i)&&Fb(j)&&Fab(i,j)){chmin(ans,max({na+nb+nc,i+na,j+nb})-min({na+nb,i,j}));}
        }
    prt(ans);

    return 0;
}



Measured memory_bytes: 4792
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using ld = long double;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)


int N;
int A,B,C,D;

i64 nCr[1010][1010];

i64 MOD = 1e9 + 7;

i64 inv_mod(i64 a, i64 m = MOD) {
    i64 b, x, u, q, abs_m, tmp;

    abs_m = (m < 0) ? -m : m;
    b = m;
    x = 1;
    u = 0;
    while (b > 0) {
        q = a / b;
        tmp = u;
        u = x - q * u;
        x = tmp;
        tmp = b;
        b = a - q * b;
        a = tmp;
    }

    return (x < 0) ? abs_m + x : x;
}


int main(){
    cin >> N >> A >> B >> C >> D;
    rep(i,0,1009) rep(j,0,i){
        if(j == 0 || j == i) nCr[i][j] = 1;
        else nCr[i][j] = (nCr[i - 1][j - 1] + nCr[i - 1][j]) % MOD;
    }
    vector<i64> fact(1010);
    fact[0] = 1;
    rep(i,1,1010 - 1) fact[i] = (fact[i - 1] * i) % MOD;
    rep(i,1,1010 - 1) fact[i] = inv_mod(fact[i]);

    vector<vector<i64>> dp(B + 1,vector<i64>(N + 1,0));
    dp[A - 1][0] = 1;

    rep(i,A,B){
        rep(j,0,N){
            dp[i][j] = dp[i - 1][j];
            i64 now = 1;
            rep(k,1,j / i){
                now = (now * nCr[N - j + i * k][i]) % MOD;
                if(C <= k && k <= D)
                    dp[i][j] = (dp[i][j] + dp[i - 1][j - i * k] * now  % MOD * fact[k]) % MOD;
            }
        }
    }

    cout << dp[B][N] % MOD << endl;
}


Measured memory_bytes: 15360
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int n,k;
int main()
{
	cin>>n>>k;
	int ans=1;
	for (int i=1;i<=n;++i)
	{
		ans+=min(ans,k);
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
int main() {
	int a, b, c, k;
	scanf("%d %d %d %d", &a, &b, &c, &k);
	int ok = 0;
	while (k--) {
		if (b > a) {
			if (c > b)
				ok = 1;
			else {
				c *= 2;
				if (c > b)
					ok = 1;
			}
		}
		else {
			b *= 2;
			if (a < b && b < c)
				ok = 1;
		}
	}
	if (ok)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 3168
-- https://github.com/minoki/my-atcoder-solutions
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}
import Data.Char (isSpace)
import Data.Int (Int64)
import Data.List (unfoldr, sort)
import Control.Monad
import qualified Data.Vector.Unboxed as U
import qualified Data.ByteString.Char8 as BS
import Data.Monoid

sub :: (Int, Int) -> (Int, Int) -> (Int, Int)
sub (x,y) (x',y') = (x-x',y-y')

main = do
  n <- readLn
  xs <- fmap sort $ replicateM n $ do
    [x,y] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
    return (atan2 (fromIntegral y) (fromIntegral x) :: Double, x, y)
  let xs' = U.fromListN n xs
  let (neg, pos) = U.span (\(a,_,_) -> a <= 0) xs'
  let xs'' = xs' <> U.map (\(a,x,y) -> (a + 2 * pi, x, y)) neg
  let ys = U.scanl' (\(sx,sy) (_,x,y) -> (sx+x,sy+y)) (0,0) xs''
  let result = [ (ys U.! (j+1)) `sub` (ys U.! i) | i <- [0..n-1], j <- [i..min (i+n-1) (U.length xs''-1)]]
  print $ maximum $ map (\(x,y) -> sqrt ((fromIntegral x)^2 + (fromIntegral y)^2)) result


Measured memory_bytes: 1020
#include <stdio.h>
#include <stdlib.h>
typedef long long ll;

const ll mod = (ll)(1e9) + 7ll;

ll n;
ll sum[100005];

int main()
{
	ll ans = 1;
	ll a;

	scanf("%lld", &n);
	for (ll i = 0; i < n; i++) {
		scanf("%lld", &a);

		sum[a]++;
	}

	for (ll i = 1; i <= n && ans; i++) {
		
		ans = ans * sum[llabs((n - i) - (i - 1))];

		sum[llabs((n - i) - (i - 1))]--;

		ans = ans % mod;
	}

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

	return 0;
}


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

int main()
{
  string S;
  cin >> S;
  for(int i=0; i<S.size(); ++i)
  {
    if(S[i]=='1') cout << '9';
    if(S[i]=='9') cout << '1';
  }
  
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
/********************************************************************
 * Ejercicio: Knapsack 2                                            *
 * Url: https://atcoder.jp/contests/dp/tasks/dp_e                   *
 * Lenguaje: c++                                                    *
 * Autor: Sebastian Vega                                            *
 * Fecha: 02-09-2020                                                *
 *******************************************************************/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define forn(i, a, b) for (int i = a; i < b; ++i)
#define SZ(x) int(x.size())
#define pb push_back
#define F first
#define S second
void dbg_out() { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cerr << ' ' << H;
  dbg_out(T...);
}

const int MAX_N = 101, MAX_W = 1e5 + 1;
const ll INF = 1e15;
ll N, W, w[MAX_N], v[MAX_N], dp[MAX_N][MAX_W];

int main() {
#ifdef LOCAL
  freopen("in.txt", "r", stdin);
// freopen("main.txt", "w", stdout);
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
  ios::sync_with_stdio(0);
  cin.tie(0);
#define endl '\n'
#define dbg(...) 18
#endif
  cin >> N >> W;
  for (int i = 0; i < N; i++) cin >> w[i] >> v[i];
  for (int i = 0; i <= 100000; i++) {
    dp[0][i] = INF;
  }
  for (int i = 0; i <= N; i++) {
    dp[i][0] = 0;
  }
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= 100000; j++) {
      if (j >= v[i - 1])
        dp[i][j] = min(dp[i - 1][j], dp[i - 1][j - v[i - 1]] + w[i - 1]);
      else
        dp[i][j] = dp[i - 1][j];
    }
  }
  for (int i = 100000; i >= 0; i--) {
    if (dp[N][i] <= W) {
      cout << i << endl;
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 82416
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()

int main(){
    long n;
    cin >> n;
    long ans = 0;
    for(long i=1;i<=n;i++){
        if(i % 3 != 0 && i % 5 != 0){
            ans += i;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> pll;
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define pb push_back
const double PI = acos(-1);
const long long INF = (1LL << 60);
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}

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

  ll n;
  cin >> n;
  map<string, ll> mp;
  
  ll ans = 0;
  for(ll i = 0; i < n; i++){
    string s;
    cin >> s;
    sort(all(s));
    ans += mp[s]++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 11264
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<cctype>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    ll N;
    cin >> N;
    ll A[N];
    ll B[N+1];
    ll i;
    B[0]=0;
    for(i=0;i<N;i++){
        cin >> A[i];
        B[i+1]=0;
    }
    ll t=0;
    for(i=0;i<N;i++){
        B[A[i]]=B[A[i]-1]+1;
        t=max(t,B[A[i]]);
    }
    cout << N-t;
    return 0;
}


Measured memory_bytes: 3328
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

struct state {
	int h;
	int w;
	long long ans1 = 2;
	long long ans2 = 0;
	
	state() {}
	state(int h, int w) : h(h), w(w) {}
};

int m = 1000000007;
int h[100];

long long powmod(long long x, long long y) {
	long long ans = 1;
	
	while (y > 0) {
		if (y & 1) ans = ans * x % m;
		x = x * x % m;
		y >>= 1;
	}
	
	return ans;
}

long long mod_inverse(long long a, long long m) {
    long long b = m, x = 1, y = 0;
    
    while (b) {
        long long t = a / b;
        
        a -= t * b;
        x -= t * y;
        
        swap(a, b);
        swap(x, y);
    }
    
    return (m + x % m) % m;
}

long long solve(int l, int r) {
	int i, j;
	long long ans = 1;
	vector <state> v;
	
	if (l == r) return 1;
	
	v.push_back(state(0, 1));
	
	for (i = l; i < r; i++) {
		v.push_back(state(h[i], 1));
	}
	
	v.push_back(state(0, 1));
	
	while (v.size() > 3) {
		int x = 0;
		
		for (i = 0; i < v.size(); i++) {
			if (v[i].h > v[x].h) x = i;
		}
		
		if (v[x].h == v[x + 1].h) {
			long long tmp1, tmp2;
			
			tmp1 = v[x].ans1 * v[x + 1].ans1 % m * mod_inverse(2, m) % m;
			tmp2 = ((v[x].ans1 + v[x].ans2) * (v[x + 1].ans1 + v[x + 1].ans2) - tmp1 + m) % m;
			
			v[x].ans1 = tmp1;
			v[x].ans2 = tmp2;
			v[x].w += v[x + 1].w;
			v.erase(v.begin() + x + 1);
		} else {
			int h = v[x].h - max(v[x - 1].h, v[x + 1].h);
			
			if (v[x].w == 1) {
				ans = ans * powmod(2, h) % m;
			} else {
				v[x].ans1 = v[x].ans1 * powmod(2, h) % m;
			}
			
			v[x].h -= h;
		}
	}
	
	return ans * (v[1].ans1 * powmod(2, v[1].h - 1) % m + v[1].ans2) % m;
}

int main() {
	int n, x = 0, i;
	long long ans = 1;
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++) scanf("%d", &h[i]);
	
	for (i = 0; i < n; i++) {
		if (h[i] == 1) {
			ans = ans * solve(x, i) * 2 % m;
			x = i + 1;
		}
	}
	
	ans = ans * solve(x, n) % m;
	
	printf("%lld\n", ans);
	
	return 0;
}


Measured memory_bytes: 256
ans = 0
s = []
for i in range(int(input())):
  a,b = map(int,input().split())
  if a==b:
    ans += 1
    s.append(ans)
  else:
    ans = 0
if len(s)!=0 and max(s)>=3:
  print('Yes')
elif len(s)==0:
  print('No')
else:
  print('No')

Measured memory_bytes: 62368
N = int(input())

w = ["a"]
l = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]

for i in range(N - 1):
  w_init = w
  w = []
  for j in range(len(w_init)):
    for k in range(i + 2):
      if max(w_init[j]) == l[k]:
        for m in range(k + 2):
          w.append(w_init[j] + l[m])

for i in range(len(w)):
  print(w[i])


Measured memory_bytes: 61532
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := intScanner()
	add := 0
	ans := 0
	as := make([]int, n)
	bs := make([]int, n)
	for i := 0; i < n; i++ {
		as[i] = intScanner()
		bs[i] = intScanner()
	}
	for i := n - 1; i >= 0; i-- {
		a, b := as[i], bs[i]
		if (a+add)%b != 0 {
			ans += b - (a+add)%b
			add += b - (a+add)%b
		}
	}
	fmt.Println(ans)
}


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

const int INF =1e9;
const int MOD =1e9+7;

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

#define ALL(x) (x).begin(), (x).end()

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

int main()
{
double l;
cin>>l;
printf("%.8lf\n",(l/3)*(l/3)*(l/3));
}

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

const double PI = 3.14159265358979;

int main()
{
    int a, b, h, m;
    double xm, ym, xh, yh, mrad, hrad; 
    cin >> a >> b >> h >> m;
    mrad = (m * 6) * PI / 180;
    hrad = ((h * 60 + m) * 0.5) * PI / 180;
    xm = a * cos(mrad); ym = a * sin(mrad);
    xh = b * cos(hrad); yh = b * sin(hrad);
    printf("%.15f\n", sqrt((xm - xh) * (xm - xh) + (ym - yh) * (ym - yh)));
    return 0;
}


Measured memory_bytes: 4128
// Atcoder144 - B
function main(input) {
  const inputs = input.split('¥n');
  const n = parseInt(inputs[0], 10);

  var answers = [];
  for (var i = 0; i < 10; i++) {
    for (var j = 0; j < 10; j++) {
      answers.push(i * j);
    }
  }
  console.log(answers.indexOf(n) >= 0 ? 'Yes' : 'No');
}

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


Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define M 1000000007
typedef long long ll;
int main() { 
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    if(d==1)
    cout<<"1";
    else
    cout<<"0";
    return 0;
}

Measured memory_bytes: 256
local s=io.read()
local daydream={"dream","dreamer","erase","eraser"}

while true do
    local flag=false
    for j=1,4 do
        local l=#s-#daydream[j]
        if s:sub(l+1)==daydream[j] then
            s=s:sub(1,l)
            flag=true
        end
    end
    if not flag then
        print("NO")
        break
    elseif s=="" then
        print("YES")
        break
    end
end

Measured memory_bytes: 908
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>

using namespace std;

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

typedef vector<int> vi;

int main()
{
	double v;
	while(scanf("%lf", &v) != EOF){
		double x = v*v/19.6;
		printf("%d\n", (int)ceil(x/5.0)+1);
	}

	return 0;
}

Measured memory_bytes: 0
N = int(input())
L = list(map(int,input().split()))

ans = 0
for i in range(N):
    for j in range(N):
        for k in range(N):
            tmp = [L[i],L[j],L[k]]
            if len(set(tmp)) == 3 and max(tmp) < sum(tmp)/2:
                ans += 1

print(ans//6)


Measured memory_bytes: 9128
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<stdio.h>
#include<map>
#include<queue>
#include<vector>
using namespace std;
const int maxn=1e4;
const int mod=1e9+7;

typedef long long ll;

int q[maxn];

int main(){
	int n;cin>>n;
	q[0]=1;
	for(int i=3;i<=n;i++){
		q[i]=(q[i-1]+q[i-3])%mod;
	}
	cout<<q[n];
	return 0;
}

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

int n,c,k,x[111111],ans=1;
int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> n >> c >> k;
    for(int i=1;i<=n;++i)
    {
    	cin >> x[i];	
    }
    sort(x+1,x+1+n);
    int cap=1,cur=x[1];
    for(int i=2;i<=n;++i)
    {
    	if(cap<c && x[i]-cur<=k)
    	{
    		cap+=1;
    	} else
    	{
    		cap=1;
    		cur=x[i];
    		++ans;
    	}	
    }
    cout << ans << "\n";
}


Measured memory_bytes: 640
def myAnswer(N:int,S:list) -> int:
   
   ans = 0
   x = 0
   for i in  S:
      if(i == "I"):
         x +=1
      elif(i == "D"):
         x -= 1
      ans = max(ans,x)
   return ans


def modelAnswer():
   tmp=1
def main():
   N = int(input())
   S = list(input())
   print(myAnswer(N,S[:]))

if __name__ == '__main__':
   main()

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int x = sc.nextInt();

        if (x < 30) {
            System.out.println("No");
        } else {
         System.out.println("Yes");
        }
        
    }
}

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

int main() {
  int N;
  cin >> N;
  int f = 0;
  int N_copy = N;
  for (int i = 8; i >= 0; i--){
    int q = N_copy / pow(10,i);
    f += q;
    N_copy -= q * pow(10,i);
  }
  
  if (N % f == 0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


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

int selectionSort(int A[], int N) {
  int sw = 0;
  for (int i = 0; i < N; ++i) {
    int minj = i;
    for (int j = i + 1; j < N; ++j) {
      if (A[j] < A[minj]) minj = j;
    }
    
    if (minj != i) {
      swap(A[i], A[minj]);
      ++sw;
    }
  }
  return sw;
}

int main() {
  int A[100], N, sw;
  cin >> N;
  for (int i = 0; i < N; ++i) cin >> A[i];
  
  sw = selectionSort(A, N);
  
  for (int i= 0; i < N; ++i) {
    if (i) cout << " ";
    cout << A[i];
  }
  cout << endl;
  cout << sw << endl;
  
  return 0;
}

Measured memory_bytes: 3068
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    loop {
        let v = read_vec::<usize>();
        let (n, m) = (v[0], v[1]);
        if n == 0 && m == 0 {
            return;
        }
        let mut c = vec![0; m];
        for i in 0..m {
            c[i] = read::<i64>();
        }
        let mut x = vec![0; n];
        for i in 0..n {
            x[i] = read::<i64>();
        }

        let mut dp = vec![vec![std::i64::MAX; 256]; n + 1];
        dp[0][128] = 0;
        for i in 0..n {
            for prev_y in 0..256 {
                if dp[i][prev_y] == std::i64::MAX {
                    continue;
                }
                for &cnum in c.iter() {
                    let cur_y = min(max(prev_y as i64 + cnum, 0), 255) as usize;
                    dp[i + 1][cur_y] = min(
                        dp[i + 1][cur_y],
                        dp[i][prev_y] + (cur_y as i64 - x[i]) * (cur_y as i64 - x[i]),
                    );
                }
            }
        }
        println!("{}", dp[n].iter().min().unwrap());
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}



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

int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	ll sum = 0;
	cin >> n;
	for(int i = 1; i<=n; i++){
		for(int j = 1; j<=n; j++){
			int gcd = __gcd(i,j);
			for(int k =1; k <=n;k++){
				sum+= __gcd(gcd,k);
			}

		}
	}
	cout << sum;
}

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

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

# define int(x) int x; scanf("%d",&x);
# define vint(v,n) vector<int> v(n); REP(i,n) scanf("%d", &v[i]);
# define string(x) string x; cin >> x;

using namespace std;

namespace utils{
  template <typename T> void print(vector<vector<T>> mat) {
    REP (i, mat.size()) {
      REP (j, mat[0].size()) cout << mat[i][j] << ' ';
      cout << endl;
    }
  }

  template <typename T> void print(vector<T> v) {
    REP (i, v.size())
      if (i >= v.size()-1)
	cout << v[i];
      else
	cout << v[i] << ' ';
    
    cout << endl;
  }

  template <typename T> pair<T, T> shape(vector<vector<T>> mat) {
    int d1, d2;

    d1 = mat.size();
    if (d1 > 0) d2 = mat[0].size();
    else int d2 = 0;
    cout << "(" << d1 << ", " << d2 << ")" << endl;
    return make_pair(0, 0);
  }

  template <typename T> vector<vector<T>> empty(int n, int m) {
    vector<vector<T>> mat(n, vector<T>(m));
    return mat;
  }
}

int main() {
  int(n);
  vint(A,n);

  int cnt = 0;
  REP(i,n){
    if(A[i] % 10 == 0)
      cnt++;
  }
  if(cnt == n){
    cout << 0 << endl;
    return 0;
  }
  sort(A.begin(),A.end());

  int ans = 0;
  for(int i = 0; i< n; i++){
    ans += A[i];
  }
  if(ans % 10 == 0){
    for(int i = 0; i < n; i++){
      if(A[i] % 10 == 0){
      }else{
	ans -= A[i];
	cout << ans << endl;
	return 0;
      }
    }
  }else{
    cout << ans << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(obj) (obj).begin(), (obj).end()
using P = pair<int, int>;
const int inf = 1e9;
const ll INF = 1e18;
const ll MOD = 1e9+7;
const ll MAX = 1e9+7;
template<typename T> T factorial(T n){
    if(n==1) return 1;
    else return n*factorial(n-1)%MOD;
}
template<typename T> T Pow(T x, T n, T m){
    if(n == 0) return 1;
    if(n % 2 == 0) return Pow(x * x % m, n / 2, m);
    else return x * Pow(x, n - 1, m) % m;
}
template<typename T> T combination(T n, T k, T m){
    return factorial<T>(n) * Pow<T>(factorial(k), m-2, m) % m * Pow<T>(factorial(n-k), m-2, m) % m;
}
struct edge{
    int to; // 辺の行き先
    int weight; // 辺の重み
    edge(int t, int w) : to(t), weight(w) { }
};
using graph = vector<vector<edge>>;
using Graph = vector<vector<int>>;

int main(){
    int n; cin >> n;
    vector<int> a;
    vector<int> b(n, 0);
    int tmp;
    ll basic_ans = 0;
    rep(i, n){
        cin >> tmp;
        a.push_back(tmp);
        b[tmp-1] += 1;
    }
    rep(i, n){
        if(b[i] >= 2) basic_ans += (ll)b[i]*(b[i]-1)/2;
    }
    rep(i, n){
        if(b[a[i]-1] >= 2){
            cout << basic_ans - b[a[i]-1] + 1 << endl;
        }else{
            cout << basic_ans << endl;
        }
    }
    return 0;
}

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

int main()
{
	string x;
	getline(cin,x);
	while(x.find("apple")!=-1)
		x.replace(x.find("apple"), 5,"-----");
	while(x.find("peach")!=-1)
		x.replace(x.find("peach"), 5,"+++++");
	while(x.find("-----")!=-1)
		x.replace(x.find("-----"), 5,"peach");
	while(x.find("+++++")!=-1)
		x.replace(x.find("+++++"), 5,"apple");	
	cout << x << endl;
}

Measured memory_bytes: 0
import java.util.Scanner;

//https://atcoder.jp/contests/dp/tasks/dp_m
/**
 * Created by Harry on 3/30/20.
 */
public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int[] A = new int[n];
        for(int i=0; i<n; i++){
            A[i] = scanner.nextInt();
        }
        System.out.println(calc(n,k,A));
    }

    public static int calc(int n, int k, int[] A){
        int mod = 1000000007;
        int[] dp = new int[k+1];
        dp[0] = 1;
        for(int i=0; i<n; i++){
            for(int j=k; j>=0; j--){
                dp[j] = (dp[j]-(j-A[i]-1>=0 ? dp[j-A[i]-1] : 0)+mod)%mod;
            }
            for(int j=1; j<=k; j++){
                dp[j] = (dp[j]+dp[j-1])%mod;
            }
        }
        return dp[k];
    }

    //O(N^2*K)
//    public static int calc(int n, int k, int[] A){
//        int mod = 1000000007;
//        int[] dp = new int[k+1];
//        dp[0] = 1;
//        for(int i=0; i<n; i++){
//            for(int j=k; j>=0; j--){
//                int curRes = 0;
//                for(int l=0; l<=A[i]; l++){
//                    if(j-l<0){
//                        break;
//                    }
//                    curRes = (curRes + dp[j-l])%mod;
//                }
//                dp[j] = curRes;
//            }
//        }
//        return dp[k];
//    }
}


Measured memory_bytes: 22228
#include <iostream>

using namespace std;
int main(){
  int a[3] = {};
  int b[3] = {};
  for(int i=0;i<3;i++){
    cin >> a[i] >> b[i];
  }
  int iCnt[5] = {};

  for(int i=0;i<3;i++){
    for(int j=1;j<=4;j++){
      if(a[i]==j || b[i]==j)iCnt[j]++;
    }
  }
  int ans = 1;
  for(int i=1;i<=4;i++){
    ans *= iCnt[i];
  }
  bool ansFlg = false;
  if(ans==4)ansFlg=true;

  if(ansFlg){
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}

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


int main(){


    int r , D , x_2000; std::cin >> r >> D >> x_2000;

    int x[10];
    x[0] = r * x_2000 - D;

    std::cout << x[0] << std::endl;

    for(int i = 1; i < 10; i++){
        x[i] = r * x[i - 1] - D;
        std::cout << x[i] << std::endl;
    }
    
    system("pause");

    return 0;

}

Measured memory_bytes: 504
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let a: Vec<usize> = (0..n)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();

    let mut memo: Vec<usize> = vec![0; 100010];
    let mut ans = 0;
    let mut minus1 = 0;
    for &i in a.iter() {
        memo[i + 1] += 1;
        memo[i] += 1;
        if i == 0 {
            minus1 += 1;
        } else {
            memo[i - 1] += 1;
        }
    }

    for i in 0..100010 {
        ans = std::cmp::max(ans, memo[i]);
    }
    ans = std::cmp::max(ans, minus1);
    println!("{}", ans);
}


Measured memory_bytes: 6396
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>

#define FOR(i, a, b) for(decltype(b) i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;

using namespace std;

#ifdef INPUT
#include <sstream>
stringstream input(R"(
2 2
)");
#define cin input
#endif

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

	cout << (a * b % 2 ? "Yes" : "No") << endl;

	return 0;
}


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

using namespace std;

#define MAX_H 550
#define MAX_W 550
#define MAX_D 4
#define INF 1e9

struct State{
  int d,x,y;
  State(int d,int x,int y) :
    d(d),x(x),y(y) {}
  
  bool operator > (const State &s)const{
    return d > s.d;
  }
};

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

struct TroddenCable{
  int H,W,N,sx,sy,gx,gy;
  int cost[MAX_H][MAX_W][MAX_D];
  int d[MAX_H][MAX_W];

  TroddenCable(){
    for(int i = 0 ; i < MAX_H ; i++){
      for(int j = 0 ; j < MAX_W ; j++){
        d[i][j] = INF;
        for(int k = 0 ; k < MAX_D ; k++){
          cost[i][j][k] = 0;
        }
      }
    }
  }

  int getDir(char x){
    if(x == 'L'){ return 0; }
    if(x == 'U'){ return 1; }
    if(x == 'R'){ return 2; }
    if(x == 'D'){ return 3; }
    return -1;
  }

  void input(){
    int x,y,T;
    string S;
    cin >> W >> H >> N;
    cin >> sx >> sy >> gx >> gy;
    for(int i = 0 ; i < N ; i++){
      cin >> x >> y >> T;
      cin >> S;
      for(int j = 0 ; j < T ; j++){
        for(int k = 0 ; k < (int)S.size() ; k++){
          int _dir = getDir(S[k]);
          int nx = x + dx[_dir], ny = y + dy[_dir];
          if(0 > nx || nx >= W || 0 > ny || ny >= H){
            continue;
          }
          if(x == nx){
            cost[max(y,ny)][x][2]++;
            cost[max(y,ny)][x+1][0]++;
          }else if(y == ny){
            cost[y][max(x,nx)][3]++;
            cost[y+1][max(x,nx)][1]++;
          }
          x = nx; y = ny;
        }
      }
    }
  }

  int solve(){
    priority_queue<State,vector<State>,greater<State> > Q;
    Q.push(State(0,sx,sy));
    d[sy][sx] = 0;
    while(!Q.empty()){
      State s = Q.top(); Q.pop();
      int x = s.x,y = s.y;
      if(d[y][x] < s.d){ continue; }
      if(x == gx && y == gy){ return d[y][x]; }
      for(int i = 0 ; i < 4 ; i++){
        int nx = x + dx[i], ny = y + dy[i];
        if(0 > nx || nx > W || 0 > ny || ny > H){ continue; }
        if(d[y][x] + cost[y][x][i] < d[ny][nx]){
          d[ny][nx] = d[y][x] + cost[y][x][i];
          Q.push(State(d[ny][nx],nx,ny));
        }
      }
    }
    return -1;
  }

  void run(){
    input();
    cout << solve() << endl;
  }
};

int main(){
  TroddenCable tc;
  tc.run();
  return 0;
}

Measured memory_bytes: 10076
#include<bits/stdc++.h>
#include<string>
#define rep(i,a,b) for(long long int i=(a);i<(b);i++)
#define se(a) a.begin(),a.end()
#define ll long long int
#define mll map<ll,ll>
#define pll pair<ll, ll>
#define pii pair<int,int>
#define pb push_back
#define mk make_pair
#define F first
#define S second
#define mod 1000000007
#define maxn 100005
#define inf 1e16
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
long double dp[305][305][305];
long double solve(ll cnt1,ll cnt2,ll cnt3,ll n)
{
	if(cnt1<0||cnt2<0||cnt3<0)
	return 0;
	if(cnt1==0&&cnt2==0&&cnt3==0)
	return 1;
	if(dp[cnt1][cnt2][cnt3]!=-1.0)
	return dp[cnt1][cnt2][cnt3];
	long double k=cnt1+cnt2+cnt3;
	return dp[cnt1][cnt2][cnt3]=((long double)n/(long double)k)+solve(cnt1-1,cnt2,cnt3,n)*((long double)cnt1/(long double)k)+solve(cnt1+1,cnt2-1,cnt3,n)*((long double)cnt2/(long double)k)+solve(cnt1,cnt2+1,cnt3-1,n)*((long double)cnt3/(long double)k);
}
int main()
{
	boost;
	ll n;
	cin>>n;
	ll cnt1=0,cnt2=0,cnt3=0;
	rep(i,0,n)
	{
		ll x;
		cin>>x;
		if(x==1)
		cnt1++;
		else if(x==2)
		cnt2++;
		else
		cnt3++;
	}
	rep(i,0,305)
	rep(j,0,305)
	rep(k,0,305)
	dp[i][j][k]=-1.0;
	long double ans = solve(cnt1,cnt2,cnt3,n)-1.0;
	cout<<fixed<<setprecision(10)<<ans<<endl;
}

Measured memory_bytes: 443776
/*
Author:- zenwraight
*/
#include <bits/stdc++.h>

using namespace std;

#define MAX 100005
#define MOD 1000000007
#define lli long long int

lli fact(int n)
{
  lli prod = 1;
  for(lli i=2; i<=n; i++)
  {
    prod = (prod%MOD * i%MOD)%MOD;
  }
  return prod;
}

int main()
{
  int n,m;
  cin>>n>>m;
  if(n==m)
  {
    cout<<(fact(n)%MOD*fact(m)%MOD*2)%MOD<<endl;
  }
  else if(abs(n-m)==1)
  {
    cout<<(fact(n)%MOD*fact(m)%MOD)%MOD<<endl;
  }
  else
  {
    cout<<0<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>



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

  int n;
  cin>>n;

  vector<int> a(n+1);
  rep(i,n+1){
    cin>>a[i];
  }
  vector<int> b(n);
  rep(i,n){
    cin>>b[i];
  }

  int ans=0;
  int r=0;

  rep(i,n+1){
   // cout<<ans<<endl;
    ans+=min(r,a[i]);
    a[i]-=r;
    a[i]=max(0LL,a[i]);
    if(i==n) break;
    int c=min(a[i],b[i]);
    ans+=c;
    r=b[i]-c;
  }

  cout<<ans<<endl;
}


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

#define ll long long
#define pb push_back

const int maxn = 1e5 + 20;

int a[maxn] , b[maxn] , ind[maxn];

bool cmp(int x , int y)
{
	return a[x] + b[x] < a[y] + b[y];
}

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

	int n;
	cin >> n;

	for(int i = 0; i < n; i++)
		cin >> a[i] >> b[i] , ind[i] = i;

	sort(ind , ind + n , cmp);
	reverse(ind , ind + n);

	ll res = 0;
	for(int i = 0; i < n; i++)
	{
		if(i&1)
			res -= b[ind[i]];
		else
			res += a[ind[i]];
	}

	cout << res << endl;
}










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

using namespace std;

void ReplaceAll(string &str, char old_char, char new_char)
{
    auto pos = str.find(old_char);
    while (pos != string::npos) {
        str.replace(pos, 1, 1, new_char);
        pos = str.find(old_char, pos + 1);
    }
}

int main()
{
    string str;
    getline(cin, str);

    ReplaceAll(str, ',', ' ');
    cout << str << "\n";;

    return 0;
}


Measured memory_bytes: 256
H, W, K = list(map(int, input().split()))
 
c = [list(input()) for i in range(H)]
 
cnt = 0
for i in range(2**H):
    for j in range(2**W):
        cnt_black = 0
        for k in range(H):
            if (i >> k) & 1:
                continue
            for l in range(W):
                if (j >> l) & 1:
                    continue
                if c[k][l] == '#':
                    cnt_black += 1
        if cnt_black == K:
            cnt += 1
 
print(cnt)

Measured memory_bytes: 9124
#include <iostream>
#include <locale>
#include <string>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
using namespace std;

int main() {
	int n;
	
	
	cin >> n;
	while ( n != 0) {
		double sum=0;
		double ave,sigma;
		double s[n];
	
		for(int i =0; i<n; i++) {
			cin >> s[i];
			sum += s[i];
		}
		ave = sum / n * 1.0;

		double Sum = 0;
		for(int i =0; i<n; i++) {
			Sum += (s[i] - ave)*(s[i] - ave);
		}
		sigma = sqrt(Sum/n);
 		cout << fixed << setprecision(8) << sigma << endl;
	
		cin >> n;
	}
	
	return 0;
}


Measured memory_bytes: 3208
import collections

n = int(input())
a = list(map(int,input().split()))
q = int(input())
b,c = [0]*q, [0]*q
for i in range(q):
    b[i],c[i] = map(int,input().split())
counter = collections.Counter(a)

s = sum(a)
for i in range(q):
    s += (c[i]-b[i])*counter[b[i]]
    print(s)
    counter[c[i]] = counter[c[i]] + counter[b[i]]
    counter[b[i]] = 0


Measured memory_bytes: 30108
N = int(input())
if N < 10 :
	print(N)
elif N < 100 :
	print(9)
elif N < 1000 :
	print(9 + (N - 100 + 1))
elif N < 10000 :
	print(9 + 900)
elif N < 100000 :
	print(9 + 900 + (N - 10000 + 1))
else :
	print(9 + 900 + 90000)


Measured memory_bytes: 2940
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef std::int_fast64_t i64;
typedef std::uint_fast64_t u64;
typedef std::int_fast32_t i32;
typedef std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(std::vector<T>& vector, const typename std::vector<T>::size_type size) {
    vector.reserve(size);
    std::copy_n(std::istream_iterator<T>(std::cin), size, std::back_inserter(vector));
  }

  template <typename T, std::size_t N>
  void read(std::array<T, N>& array) {
    std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
  }
}

#endif

// main.cpp

class alloy {
public:
  i64 height, width;
};

namespace std {
  std::istream& operator>>(std::istream& is, alloy& self) {
    return is >> self.height >> self.width;
  }
}

int main() {
  i64 N, H, W;
  std::cin >> N >> H >> W;
  std::vector<alloy> alloys;
  tools::read(alloys, N);

  std::cout << std::count_if(alloys.begin(), alloys.end(), [&H, &W](const alloy& alloy) {
    return W <= alloy.width && H <= alloy.height;
  }) << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll ac, ad, bc, bd, max;
    ac = a * c;
    ad = a * d;
    bc = b * c;
    bd = b * d;
    max = -1000000000000000000;
    if (ac>=max) {
        max = ac;
    }
    if (ad>=max) {
        max = ad;
    }
    if (bc>=max) {
        max = bc;
    }
    if (bd>=max) {
        max = bd;
    }
    cout << max << endl;
}

Measured memory_bytes: 3628
n = int(input())
data = []
for i in range(n):
    data_ = input().split()
    data.append(data_)

otoshidama = 0

for i in range(n):
    if data[i][1] == "JPY":
        nedan = float(data[i][0])
    if data[i][1] == "BTC":
        nedan = float(data[i][0]) * 380000
    otoshidama = otoshidama + nedan

print(otoshidama)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,c=0;
cin>>n;
string s;
cin>>s;
for(int i=0;i<n;i++){
 if(s[i]!=s[i+1]){
   c++;
 }

}
if(c>0){
  cout<<c<<endl;
}
else if(c==0){
  cout<<"1"<<endl;
}
}


Measured memory_bytes: 512
#include<stdio.h>
#define N 2000

int A[N];

int solve(int n,int m,int l)
{
  int res;
  if(m==0) return 1;
  if(l>=n) return 0;

  res=solve(n,m,l+1) || solve(n,m-A[l],l+1);
  return res;
}

int main(){
  int n,m,q,i;
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&A[i]);

  scanf("%d",&q);
for(i=0;i<q;i++){
    scanf("%d",&m);
    if(solve(n,m,0)) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}

Measured memory_bytes: 2592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=100010;
bool vis[maxn] = {0};
int book[maxn] = {0};
int main()
{
    vis[0] = vis[1] = true;
    for (int i=2; i<=100005; i++){
        if (!vis[i]){
            for (int j=2*i; j<=100005; j+=i)
                vis[j] = true;
        }
    }
    for (int i=1; i<=100005; i++){
        if (vis[i])  book[i] = book[i-1];
        else{
            if (!vis[(i+1)/2])  book[i] = book[i-1] + 1;
            else   book[i] = book[i-1];
        }
    }

    int cas;
    scanf("%d", &cas);
    while (cas -- ){
        int n , m;
        scanf("%d%d", &n, &m);
        printf("%d\n", book[m] - book[n-1]);
    }
    return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
*/
#define ll long long                   
#define f first 
#define s second 
#define pb push_back               
#define mp make_pair 
#define IOS ios_base::sync_with_stdio(0);

using namespace std;                    

const int maxn=2e5+123,inf=1e9,mod=1e9+7;
ll n,x,a[maxn],col[maxn];

ll get(ll k){
	ll res = 0;
	for(int i=n,j=2,q=k;i>=0;i--){
		if(q==0)
			q=k,j++;
		col[i]=j;
		q--;
	}
	for(int i=1;i<=n;i++)
		if(col[i]==2)
			res += a[i]*2;
	for(int i=n;i>=1;i--)
		res += a[i] * ( col[i]*col[i] - (col[i] - 1) * (col[i] - 1) );	
	return res + x*(k+n) ;
}

int main(){
    cin>>n>>x;
    for(int i=1;i<=n;i++)
    	cin>>a[i];
	ll res = 1e18;
	int l = 1 , r = n;
	for(int i = 0; i < 50; i++){
		l = max( 1, l);
		r = min( n, 0ll + r);
		int m1 = l + (r-l)/3;
		int m2 = r - (r-l)/3;
		if( get(m1) > get(m2) )
			l = m1 - 1;
		else
			r = m2 + 1;			
	}
    for(int i=max(1,l-50);i<=min(n,r+50ll);i++)
		res = min(res ,get(i));
	cout<< res ;
	return 0;
}


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

#define PI 3.1415926535897932

vector<int>group[100009]; long long G[100009], val[100009]; bool flag = false;
 
void unite(int a, int b, int c) {
	if (G[a] == G[b]) {
		if (val[b] - val[a] != c) { flag = true; }
		return;
	}
	long long SA = (val[b] - val[a]) - c; SA *= -1;
	a = G[a]; b = G[b];
	if (group[a].size() < group[b].size()) { swap(a, b); SA *= -1; }
 
	for (int i = 0; i < group[b].size(); i++) {
		int to = group[b][i];
		G[to] = a; val[to] += SA; group[a].push_back(to);
	}
	group[b].clear();
}
 
long long n, m, l, r, x;
 
int main() {
	cin >> n >> m;
	for (int i = 0; i <= n; i++) { G[i] = i; group[i].push_back(i); }
	for (int i = 0; i < m; i++) {
		cin >> l >> r >> x;
		unite(l, r, x);
	}
	if (flag == true) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 11004
import numpy as np
n = int(input())
target = 1
List = list(map(int,input().split()))
if 0 in List:
  print(0)
  exit()
for i in range(len(List)):
  target*=List[i]
  if target>10**18 :
    print(-1)
    exit()
print(target)

Measured memory_bytes: 40172
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
      
      //変数入力
      int x1 = sc.nextInt();
      int x2 = sc.nextInt();
      int x3 = sc.nextInt();
      int x4 = sc.nextInt();
      int x5 = sc.nextInt();
      
      
      //何番目に０があるか探す
     
       if(x1==0){
        System.out.println("1");
       }
       else if(x2==0){
        System.out.println("2");
       }
        else if(x3==0){
        System.out.println("3");
       } 
       else if(x4==0){
        System.out.println("4");
       }
       else if(x5==0){
        System.out.println("5");
       }
    }
}

Measured memory_bytes: 35740
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main () {
    while (true) {
        //input
        string init_str;
        cin >> init_str;
        if (init_str == "-") break;
        
        int times;
        cin >> times;

        string result = init_str;
        for (int i=0; i<times; i++) {
            int num = 0;
            cin >> num;

            // think
            int strlen = init_str.size();
            result
                = result.substr(num,strlen-num) 
                + result.substr(0,num);
        }
        //output
        cout << result << endl;
    }
}


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

int main() {
  vector<int> s(3);
  for(int i = 0; i < 3; i++) cin >> s.at(i);
  
  sort(s.begin(), s.end());
  
  bool can = true;
  if(s.at(0) != 5) can = false;
  if(s.at(1) != 5) can = false;
  if(s.at(2) != 7) can = false;
  
  if(can) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))#モンスター数
b=list(map(int,input().split()))#勇者キャパ
sm=0
c=0
for i in range(n):
  if c >=a[i]:
    sm+=a[i]
    c=b[i]
  elif b[i]+c>=a[i]:
    sm+=a[i]
    c=-a[i]+c+b[i]
  else:
    sm+=b[i]+c
    c=0
sm+=min(c,a[-1])
print(sm)
  


Measured memory_bytes: 82020