akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<unordered_map>
#include<stdio.h>
using namespace std;
typedef long long ll;
ll mod = 998244353;
int m = 0;
vector<int> V(50);
	vector<int> C(50);
int N;

void rec(int i, int nowV, int nowC){
	if(i == N)return;
	m = max((nowV + V[i]) - (nowC + C[i]), m);
	rec(i + 1, nowV, nowC);
	rec(i + 1, nowV + V[i], nowC + C[i]);
}
int main(){
	cin>>N;
	
	for(int i = 0; i < N; i++){
		cin>>V[i];
	}for(int i = 0; i < N; i++){
		cin>>C[i];
	}
	rec(0, 0, 0);
	cout<<m<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int n;
    scanf("%d", &n);
    int a[200001];
    long long int count[200001] = {0};
    for (int i = 0; i < n;i++){
        scanf("%d", &a[i]);
        count[a[i]]++;
    }
    long long int sum = 0;
    for (int i = 1; i <= n; i++){
        if(count[i]<2)
            continue;
        sum = sum + count[i] * (count[i] - 1) / 2;
    }
    for (int i = 0; i < n; i++){
        printf("%lld\n", sum - count[a[i]] + 1);
    }
    return 0;
}

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

int N;
string S;

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

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

		for (char c = 'a'; c <= 'z'; ++c) {
			bool l = false, r = false;

			for (int j = 0; j < i; ++j) if (S[j] == c) l = true;
			for (int j = i; j < N; ++j) if (S[j] == c) r = true;
			if (l && r) ++cnt;
		}
		if (ans < cnt) ans = cnt;
	}
	printf("%d", ans);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(){
  double x, h, s;
  while(1){
    scanf("%lf%lf", &x, &h);
    if(!x && !h) break;
    printf("%.6f\n", (x * x) + 2 * x * sqrt((x / 2) * (x / 2) + h * h));
  }
  return 0;
}

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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> void chmax(t&a,u b){if(a<b)a=b;};
template<class t, class u> void chmin(t&a,u b){if(a>b)a=b;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll M1, D1, M2, D2;
  IN(M1,D1,M2,D2);

  if(D2==1){
    OUT(1);
  }else{
    OUT(0);
  }

  return 0;
}

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

using namespace std;
typedef long long ll;
const int N = 1e5 + 5;

int n, s[N][3];
ll dp[N][4];

ll solve(int i, int t) {
    if(i == n) return 0;
    ll& res = dp[i][t];
    if(~res) return res;
    res = 0;
    if(t != 0) res = max(res, solve(i+1, 0) + s[i][0]);
    if(t != 1) res = max(res, solve(i+1, 1) + s[i][1]);
    if(t != 2) res = max(res, solve(i+1, 2) + s[i][2]);
    return res;
}

int main() {
    memset(dp, -1, sizeof(dp));
    scanf("%d", &n);
    for(int i=0; i<n; i++)
        scanf("%d%d%d", &s[i][0], &s[i][1], &s[i][2]);
    printf("%I64d\n", solve(0, 3));
    return 0;
}


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

int main() {
  int N, H;
  cin >> N >> H;
  vector<int> a(N), b(N);
  rep(i, 0, N) cin >> a[i] >> b[i];
  int mx = *max_element(a.begin(), a.end());
  sort(b.begin(), b.end(), greater<int>());
  int ans = 0;
  rep(i, 0, N) {
    if(b[i] < mx || H <= 0) break;
    ans++;
    H -= b[i];
  }
  if(H > 0) ans += (H + mx - 1) / mx;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>

int main(void){
int n,a[200005];
scanf("%d",&n);

for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
}

int k=1;
int breake=0;
for(int i=0;i<n;i++){
    if(a[i]==k){k++;}
    else{breake++;}
}
if(breake==n){printf("-1");return 0;}
printf("%d",breake);
}





Measured memory_bytes: 896
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	static int MOD = 100000;

	public static void main(String[] args) {
		while (true) {
			int N = sc.nextInt();
			N *= N;
			int M = sc.nextInt();
			int S = sc.nextInt();
			if (N == 0) break;
			int[][] dp = new int[S + 1][N + 1];
			dp[0][0] = 1;
			for (int i = 1; i <= M; ++i) {
				for (int j = S - i; j >= 0; --j) {
					for (int k = N - 1; k >= 0; --k) {
						dp[j + i][k + 1] += dp[j][k];
						if (dp[j + i][k + 1] >= MOD) dp[j + i][k + 1] -= MOD;
					}
				}
			}
			System.out.println(dp[S][N]);
		}
	}
}

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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

clock_t time_p = clock();

void rtime() {
    time_p = clock() - time_p;
    cerr << "Time Taken : " << (float) 1000 * (time_p) / CLOCKS_PER_SEC << "\n";
}

#define int long long
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

const int INF=1e15;
const int MOD=1e9+7;
const int N=2e5+10;

signed main() {
//#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
//#endif
    IOS;
    int t = 1;
//    cin >> t;
    while (t--) {
        string s,t;
        cin>>s>>t;
        if(s.size()+1==t.size()) {
            string str=t.substr(0,s.size());
            if(str==s) {
                cout<<"Yes\n";
            } else {
                cout<<"No\n";
            }
        } else {
            cout<<"No\n";
        }
    }
    return 0;
}

Measured memory_bytes: 3652
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main
{
	public static void main(String[] args) {
		new Thread(null, new Runnable() {
			public void run() {
                solve();
            }
        }, "1", 1 << 26).start();
	}
	static void solve () {
		FastReader fr =new FastReader();	PrintWriter op =new PrintWriter(System.out);
 
 		int n =fr.nextInt() ,i ;	long vl[][] =new long[n][2] ,dp[][] =new long[n+2][n+2] ;
 		for (i =0 ; i<n ; ++i)	{	vl[i][0] =fr.nextLong() ;	vl[i][1] =i+1 ;		}
 		sort (vl,0,n-1) ;	int j ,k ,l ,r ;	long dm ,id ,sl =0 ;

 		for (i =1 ; i<=n ; ++i) {
 			j =0 ;	k =i-1 ;
 			for ( ; j<i ; ++j, --k) {
 				l =0+j ;	r =n+1-k ;	id =vl[i-1][1] ;
 				dm =vl[i-1][0] * Math.abs(l+1l - id) ;	dm += dp[l][r] ;
 				dp[l+1][r] =Math.max(dp[l+1][r] , dm) ;
 				
 				dm =vl[i-1][0] * Math.abs(r-1l - id) ;	dm += dp[l][r] ;
 				dp[l][r-1] =Math.max(dp[l][r-1] , dm) ;
 			}
 		}
 		for (i =0 ; i<=n ; ++i)	sl =Math.max(sl , dp[i][1+i]) ;	op.println(sl) ;
		op.flush();	op.close();
	}
	public static void sort(long[][] arr , int l , int u)
	{
		int m ;
 
		if(l < u){
			m =(l + u)/2 ;
 
			sort(arr , l , m);	sort(arr , m + 1 , u);
 
			merge(arr , l , m , u);
		}
	} 
	public static void merge(long[][]arr , int l , int m , int u)
	{
		long[][] low = new long[m - l + 1][2];
 
		long[][] upr = new long[u - m][2];
 
		int i ,j =0 ,k =0 ;
 
		for(i =l;i<=m;i++){
			low[i - l][0] =arr[i][0];
			low[i - l][1] =arr[i][1];
		}
 
		for(i =m + 1;i<=u;i++){
			upr[i - m - 1][0] =arr[i][0];
			upr[i - m - 1][1] =arr[i][1];
		}
 
		i =l;
 
		while((j < low.length) && (k < upr.length))
		{
			if(low[j][0] > upr[k][0])
			{
				arr[i][0] =low[j][0];
				arr[i++][1] =low[j++][1];
			}
			else
			{
				if(low[j][0] < upr[k][0])
				{
					arr[i][0] =upr[k][0];
					arr[i++][1] =upr[k++][1];
				}
				else
				{
					if(low[j][1] < upr[k][1])
					{
						arr[i][0] =low[j][0];
						arr[i++][1] =low[j++][1];
					}
					else
					{
						arr[i][0] =upr[k][0];
						arr[i++][1] =upr[k++][1];
					}
				}
			}
		}
 
		while(j < low.length)
		{
			arr[i][0] =low[j][0];
			arr[i++][1] =low[j++][1];
		}
 
		while(k < upr.length)
		{
			arr[i][0] =upr[k][0];
			arr[i++][1] =upr[k++][1];
		}
	}
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br =new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st==null || (!st.hasMoreElements())) 
			{
				try
				{
					st =new StringTokenizer(br.readLine());
				}
				catch(IOException e)
				{
					e.printStackTrace();
				}
				
			}
			return st.nextToken();
		}

		String nextLine() {
			String str ="";

			try
			{
				str =br.readLine();
			}
			catch(IOException e)
			{
				e.printStackTrace();
			}

			return str;
		}

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

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

Measured memory_bytes: 83576
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <queue>
#include <climits>
#include <stack>
#include <string>
#include <set>
#include <cmath>
#include <map>
#include <numeric>
#include <random>
#include <memory>
#include <chrono>
#include <iterator>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
#define mp make_pair
#define pb push_back
#define sz(x) int((x).size())


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int S = 2e5 + 7;
const int inf = INT_MAX / 3;
const ll INF = LLONG_MAX / 3;
const int MOD = 1e9 + 7;


signed main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	cout << fixed << setprecision(9);
	ios::sync_with_stdio(false);
	cin.tie();
	cout.tie();

	int n, l, ans = inf, s = 0;
	cin >> n >> l;

	for (int i = 1; i <= n; i++) {
		if (abs(l + i - 1) < abs(ans)) {
			ans = l + i - 1;
		}
		s += l + i - 1;
	}
	cout << s - ans;
	
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
# D - Knapsack 1
from collections import defaultdict


def main():
    N, W, *WV = map(int, open(0).read().split())
    dp = defaultdict(int)
    dp[0] = 0
    for w, v in zip(*[iter(WV)] * 2):
        for cur_w, cur_v in tuple(dp.items()):
            if w + cur_w <= W:
                dp[w + cur_w] = max(dp[w + cur_w], v + cur_v)
    print(max(dp.values()))


if __name__ == "__main__":
    main()


Measured memory_bytes: 127672
#include <stdio.h>

int main(void)
{
	int n,m,i,j,k,l,check;
	scanf("%d%d",&n,&m);
	char a[n][n+1],b[m][m+1];
	for(i=0;i<=n-1;i++)
			{scanf("%s",a[i]);}
		
	i=0;
	for(i;i<=m-1;i++)
			{scanf("%s",b[i]);}

	fprintf(stderr,"\nA is  below\n");	/* check A */
	i=0;
	for(i;i<=n-1;i++)
		{
		fprintf(stderr,"%s",a[i]);
		fprintf(stderr,"\n");
		}
	fprintf(stderr,"\nB is  below\n");	/* check B*/
	i=0;
	for(i;i<=m-1;i++)
		{
		fprintf(stderr,"%s",b[i]);
		fprintf(stderr,"\n");
		}
						/* search */
	for(i=0;i<=n-m;i++)
		{
		for(j=0;j<=n-m;j++)
			{
			check=1;
			for(l=0;l<=m-1;l++)
				{
				for(k=0;k<=m-1;k++)
					{
					if(a[i+k][j+l] != b[k][l])
						{check=0;break;}
					}
					if(check==0){break;}
				}
			if(check==1){break;}
			}
		if(check==1){break;}
		}
	
	if(check==1)
		{printf("Yes\n");}
	else
		{printf("No\n");}
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <fstream>
#include <iomanip>
#include <math.h>
#include <limits.h>
#include <algorithm>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <string>
#include <string.h>
#include <sstream>
#include <ctime>

using namespace std;

#define eps 1e-12
#define pi 3.14159265358979323846
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define bgn begin
#define ll long long
#define ld long double
#define ull unsigned long long
#define ii pair<ll,ll>











ll n,l[110];



void solve()
{
	cin>>n;
	l[0]=2;
	l[1]=1;
	for(int i=2;i<=n;i++)l[i]=l[i-1]+l[i-2];
	cout<<l[n]<<"\n";
}

int main()
{
	std::ios::sync_with_stdio(0);
	cin.tie(0);
#ifdef localProject
	freopen("in.txt","r",stdin);
#endif
	solve();
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#define _USE_MATH_DEFINES
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
vector<vector<int>> path;
vector<bool> visited;

void dfs(int a,int b,int v, int p = -1) {
	visited[v] = true;
	for (int u : path[v]) {
		if (u == p)continue;
		if (visited[u])continue;
		if (v == a && u == b)continue;
		if (v == b && u == a)continue;
		dfs(a, b, u, v);
	}
}
int main(){
	int n, m;
	cin >> n >> m;
	visited.resize(n);
	path.resize(n);
	int a, b;
	int aandb[2][50];
	rep(i, m) {
		cin >> a >> b;
		a--; b--;
		aandb[0][i] = a;
		aandb[1][i] = b;
		path[a].push_back(b);
		path[b].push_back(a);
	}
	int ans = 0;
	rep(i, m) {
		rep(j, n)visited[j] = false;
		a = aandb[0][i];
		b = aandb[1][i];
		visited[0] = true;
		dfs(a,b,0);
		bool visitall = true;
		rep(j, n) {
			if (!visited[j])visitall = false;
		}
		if (!visitall) {
			ans++;
		}
	}
	cout << ans << endl;
}

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

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

	int q;
	cin >> q;

	long long l = 0, r = 0;
	for(int i = 0; i < q; ++i) {
		int p, n;
		char c;
		cin >> p >> c >> n;

		if(c == '(')
			l += n;
		else
			r += n;

		cout << (l == r ? "Yes" : "No") << endl;		
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
#define PI 3.14159265359
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
const ll INF=1e9+7;
void input(ll *a,ll n){
    for(ll i=1;i<=n;i++)
        cin>>a[i];
}
ll lcm(ll a,ll b)
{
    return (a*b)/__gcd(a,b);
}
bool isprime(ll n){
    if(n==1){
        return false;
    }
    if(n==2 || n==3){
        return true;
    }
    for(ll i=2;i<=sqrt(n);i++){
        if(n%i==0)
            return false;
    }
    return true;
}

//ll x[100001]={0};
//ll p[100001]={0};
ll a[200001]={0};
//vector<pair<ll,ll> > adj[100001];
//ll dist[100001]={0};


void sieve(ll n,bool *a)
{
    for (ll p=2; p*p<=n; p++){
        if (!a[p]){
            for (ll i=p*p;i<=n;i+=p)
                a[i]=true;
        }
    }
}

ll fact(ll n){
    ll res=1;
    for(ll i=1;i<=n;i++)
        res*=i;
    return res;
}

/*ll distance(ll x1,ll y1,ll x2,ll y2){
    return (ll)ceil(sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)));
}*/

/*void dfs(ll curr,ll prev,ll weight,bool found){

    if(weight>n)
        return;

    for(u:adj[curr]){
        if(u.first!=prev){
            if(u.second==d || found)
                dfs(u.first,curr,weight+u.second,true);
            else
                dfs(u.first,curr,weight+u.second,false);
        }
    }
    cout<<weight<<" "<<found<<endl;
    if(weight==n && found){
        ans+=1;
        ans=ans%INF;
    }
}*/

void solve(){
    /*ll n,k;
    cin>>n>>k;
    input(a,n);
    vector<ll> v;
    ll j=1;
    v.push_back(1);
    for(ll i=0;i<n;i++){
        j=a[j];
        v.push_back(j);
    }

    for(x:v){
        cout<<x<<" ";
    }
    //cout<<v[k%v.size()];
    */

    ll n,m,x;
    cin>>n>>m>>x;
    vector<vector<ll> >v;
    for(ll i=0;i<n;i++){
        vector<ll> temp(m+1);
        for(ll i=0;i<=m;i++)
            cin>>temp[i];
        v.push_back(temp);
    }
    ll Min=INF;

    for(ll i=0;i<(1<<n);i++){
        bitset<15> b(i);
        ll cost=0;
        vector<ll> skill(m);
        bool flag=true;
        for(ll j=0;j<n;j++){
            if(b.test(j)){
                cost+=v[j][0];

                for(ll u=0;u<m;u++)
                    skill[u]+=v[j][u+1];
            }
        }
        for(ll u=0;u<m;u++){
            if(skill[u]<x){
                flag=false;
                break;
            }
        }
        if(flag)
            Min=min(Min,cost);
    }
    if(Min==INF){
        cout<<-1;
    }
    else{
        cout<<Min;
    }
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //sieve(100001,c);
    ll t=1;
    //cin>>t;
    for(ll i=0;i<t;i++){
        solve();
    }
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define mod 1000000007
using ll = long long;
using namespace std; 
const double pi = acos(-1);

int main(){
    int x,y; cin >> x >> y;
    for (int i=0;i<=x;i++){
        if (2*i+4*(x-i)==y){
            cout << "Yes" << "\n";
            return 0;
        }
    }
    cout << "No" << "\n";
}



Measured memory_bytes: 3636
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()
if S[2] == S[3] and S[4] == S[5]:
	print("Yes")
else:
	print("No")


Measured memory_bytes: 6100
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
#list = map(int, input().split())
list = input().split()

sort = []
for i in list:
    sort.append(i)

sort.sort()
print(abs(int(sort[1]) - int(sort[0])) + abs(int(sort[2]) - int(sort[1])))

Measured memory_bytes: 2940
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main {
	public static void main(String[] args)throws IOException {
		FastReader sc = new FastReader();
		PrintWriter pw = new PrintWriter(System.out);
		int arr[] = new int[5];
		int ans = 0;
		for (int i = 0; i < 5; i++) {
			arr[i] = sc.nextInt();
			if (arr[i] == 0)
				ans = i;
		}
		System.out.println(ans + 1);

	}
}





class FastReader {
	BufferedReader br;
	StringTokenizer st;

	public FastReader() {
		br = new BufferedReader(new
		                        InputStreamReader(System.in));
	}

	String next() {
		while (st == null || !st.hasMoreElements()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException  e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

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

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

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

	String nextLine() {
		String str = "";
		try {
			str = br.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return str;
	}
}

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

using namespace std;
typedef long long Int;

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

void ok(){
  cout << "POSSIBLE" << endl;
  exit(0);
}

void ng(){
  cout << "IMPOSSIBLE" << endl;
  exit(0);
}
Int n, k, a[108000];
int main(){
  cin >> n >> k;
  int x = 0;
  for(int i = 0;i < n;i++){
    cin >> a[i];
    x = gcd(x, a[i]);
  }
  
  for(int i = 0;i < n;i++){
    if(a[i] < k)continue;
    if((a[i] - k) % x == 0)ok();
  }
  ng();
  return 0;
}

Measured memory_bytes: 1024
N, K = map(int, input().split())
ans = 0
DP = [0] * K
ans = 0
for i in range(1, N + 1):
    c = 0
    tmp = i
    while K > tmp:
        tmp = tmp * 2
        c += 1
    ans += (1 / N) * 0.5 ** c

print(ans)

Measured memory_bytes: 3828
#include<iostream>
#include<vector>
#include<functional>
#include<algorithm>
#include<string>
#include<map>
#include<queue>

using namespace std;

int main(void){

    int n;
    cin >> n;
    int odd = 0;
    int flag = 1;
    vector<int> a(n);
    vector<int> tmp;
    for(int i = 0;i < n;i++) cin >> a[i];

    for(int i = 0;i < n;i++){
        if(a[i] % 2 == 0){
            tmp.push_back(a[i]);
        }
    }
    
    for(int i = 0;i < tmp.size();i++){
        if(!(tmp[i] % 3 == 0 || tmp[i] % 5 == 0)) {
            flag = 0;
        }
    }

    if(flag == 1) {
        cout << "APPROVED" << endl;
    }else {
        cout << "DENIED" << endl;
    }

    return 0;
}

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

using namespace std;
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define all(vr) vr.begin(),vr.end()
#define pi pair<int,int>

typedef long long ll;
namespace myrand
{
    mt19937 mt(chrono::system_clock::now().time_since_epoch() / chrono::microseconds(1));
    ll Int(ll l,ll r) { return uniform_int_distribution<ll> (l,r)(mt); }
}
using namespace myrand;
auto ss=chrono::system_clock::now();
double remain_time()
{
    auto en=chrono::system_clock::now();
    return (chrono::duration_cast<chrono::nanoseconds>(en-ss).count()*1e-9);
}
double L;
int main()
{
   ios_base::sync_with_stdio(0);
   cin.tie(0);cout.tie(0);
   cin >> L;
   cout << setprecision(9) << fixed;
   cout << double(L/3)*double(L/3)*double(L/3) << endl;
   return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	p := make([]int, m)
	s := make([]string, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&p[i], &s[i])
	}

	ac, wa := 0, 0
	clear := make(map[int]int, 0)

	for i := 0; i < m; i++ {
		number := p[i] - 1
		if clear[number] == -1 {
			continue
		}
		if s[i] == "AC" {
			ac++
			wa += clear[number]
			clear[number] = -1
		} else if s[i] == "WA" {
			clear[number]++
		}
	}
	fmt.Printf("%v %v\n", ac, wa)
}


Measured memory_bytes: 10368
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define repp(i, m, n) for(int i = m; i < n; i++)
#define reps(i, n) for(int i = 1; i <= n; i++)
const int    INF = 100000000;
const double EPS = 1e-10;
const int    MOD = 1000000007;
using namespace std;
typedef long long ll;
typedef pair<int, int> pai;
typedef pair<ll,ll> pal;



int main()
{
	ll n;
	cin >> n;
	int deru[100010]={};
	ll x, y, a;
	reps(i, n+1)
	{
		cin >> x;
		if(deru[x]!=0)
		{
			a=deru[x]-1+(n+1-i);
			break;
		}
		deru[x]=i;
	}
	n++;

	ll inv[100010];
	inv[1] = 1;
	for (int i=2; i<=n; i++) inv[i]=MOD-(MOD/i)*inv[MOD%i]%MOD;
	x=n;
	y=1;
	cout << (x-y+MOD)%MOD << endl;
	reps(i, n-1)
	{
		x*=(n-i);
		x%=MOD;
		x*=inv[i+1];
		x%=MOD;
		if(i>a) y=0;
		else
		{
			y*=(a-i+1);
			y%=MOD;
			y*=inv[i];
			y%=MOD;
		}
		cout << (x-y+MOD)%MOD << endl;
	}
	return 0;
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
// using namespace __gnu_pbds;
using namespace std;
 
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long ll;
typedef long double ld;
typedef pair <long long,long long> ii;
// typedef complex<long double> point;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll n;
	cin >> n;
	ll ans = LLONG_MAX;
	for (int z=1;z<=sqrtl(n);z++){
		if (n % z == 0){
			ans = min(ans,z+(n/z)-2);
		}
	}
	cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using Int = int64_t;
using UInt = uint64_t;
using C = std::complex<double>;
#define rep(i, n) for(Int i = 0; i < (Int)(n); ++i)
#define rep2(i, l, r) for(Int i = (Int)(l); i < (Int)(r); ++i)
#define guard(x) if( not (x) ) continue;
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif

template<typename T>
using RQ = std::priority_queue<T, std::vector<T>, std::greater<T>>;

int main() {
   Int v, e, f;
   std::cin >> v >> e >> f;
   std::vector<Int> ss(e+1), ts(e+1), cs(e+1), fs(e+1), bs(e+1);
   rep2(i,1,e+1) {
      Int a, b, c, d;
      std::cin >> a >> b >> c >> d;
      ss[i] = a, ts[i] = b, cs[i] = d, fs[i] = 0, bs[i] = c;
   }
   std::vector<std::vector<Int>> es(v);
   rep2(i,1,e+1) {
       Int s = ss[i], t = ts[i];
      es[s].emplace_back(i);
      es[t].emplace_back(-i);
   }
   Int res = 0;
   Int source = 0, sink = v-1;
   std::vector<Int> hs(v);
   while( f > 0 ) {
      RQ<std::pair<Int,Int>> q;
      q.emplace(0, source);
      std::vector<Int> ps(v, -1), xs(v, -1), ys(v);
      xs[source] = 0;
      ys[source] = f;
      std::vector<bool> visited(v);
      while( not q.empty() ) {
         Int d, s; std::tie(d, s) = q.top(); q.pop();
         guard( d == xs[s] );
         assert( not visited[s] );
         visited[s] = true;
         for(Int i : es[s]) {
            Int k = std::abs(i);
            Int t = i > 0 ? ts[k] : ss[k];
            Int tf = i > 0 ? bs[k] : fs[k];
            guard( tf > 0 );
            Int nd = d + (i>0?cs[k]:-cs[k]) + hs[s] - hs[t];
            guard( xs[t] == -1 or xs[t] > nd );
            assert( nd >= 0 );
            xs[t] = nd;
            ps[t] = i;
            ys[t] = std::min(ys[s], tf);
            assert( not visited[t] );
            q.emplace(nd, t);
         }
      }
      Int tf = ys[sink];
      fprintf(stderr, "tf = %ld\n", tf);
      f -= tf;
      if( f > 0 and tf == 0 ) {
         res = -1;
         break;
      }
      rep(i, v) hs[i] += xs[i];
      for(Int i=sink, k=ps[i]; i!=source; i=(k>0?ss[k]:ts[-k]), k=ps[i]) {
         Int ak = std::abs(k);
         fprintf(stderr, "i=%ld, k=%ld\n", i, k);
         if( k > 0 ) {
            fs[ak] += tf;
            bs[ak] -= tf;
         }
         else {
            fs[ak] -= tf;
            bs[ak] += tf;
         }
      }
      res += tf * hs[sink];
      if( f == 0 ) break;
      rep2(i,1,e+1) {
         fprintf(stderr, "%ld -> %ld : cost=%ld : ->=%ld : <-=%ld\n", ss[i], ts[i], cs[i], fs[i], bs[i]);
      }
   }
   printf("%ld\n", res);
}



Measured memory_bytes: 3344
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        mut a: [i64; n],
    }
    a.sort();
    let mut pre = 0;
    let mut ans = Vec::new();
    for i in (0..a.len()).rev() {
        if pre == a[i] {
            ans.push(a[i]);
            pre = 0;
        } else {
            pre = a[i];
        }
    }

    println!("{}", if ans.len() < 2 { 0 } else { ans[0] * ans[1] });
}


Measured memory_bytes: 4392
#include <iostream>
using namespace std;
int main()
{
    int n = 0;
    int k = 0;
    
    cin >> n >> k;

    if(n % k == 0)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << 1 << endl;
    }
    
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;

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

  sort(d.begin(), d.end());
  ll i = n / 2 - 1;
  ll j = n / 2;
  if (d[i] == d[j]) {
    cout << 0 << endl;
    return 0;
  }
  cout << d[j] - d[i] << endl;
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
 
int main(){
  int x,i;
  i = 1;
  
  cin >> x;
  while (x > 0){
      cout << "Case " << i << ": " << x << endl;
      i = i+1;
      cin >> x;
  }
  
      

  return 0;		 
}
		   


Measured memory_bytes: 3052
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>

using namespace std;

int main()
{int N;
 cin >> N;
 vector<int> H(N);

 
 for(int i = 0; i < N; i++)
 {cin >> H[i];}
 //入力完了
 
 int diff = H[0];
 if(N == 1){cout << diff <<endl;}
 else{
 for(int i = 0;i < N-1 ;i++)
 {if(H[i+1] > H[i]){diff += H[i+1] - H[i];}}
 
 cout << diff <<endl;}

 return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>

using namespace std;
#define int long long
int R;
int G;

signed main()
{
    scanf("%lld", &R);
    scanf("%lld", &G);

    printf("%lld\n", 2 * G - R);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll inf = numeric_limits<ll>::max()/3;
const ll mod = 998244353;

ll dp[310][100100];
ll dp2[310][100100];

int main(void){
  int n;
  cin >> n;
  ll s = 0;
  fill(dp[0],dp[0] + 310 * 100100,0);
  dp[0][0] = 1;
  fill(dp2[0],dp2[0] + 310 * 100100,0);
  dp2[0][0] = 1;
  for(int i = 0;i < n;++i){
    ll a;
    cin >> a;
    s += a;
    for(int j = 0;j < 100100;++j){
      dp[i+1][j+a] += dp[i][j];
      dp[i+1][j+a] %= mod;
      dp2[i+1][j+a] += dp2[i][j];
      dp2[i+1][j+a] %= mod;
      dp[i+1][j] += dp[i][j]*2;
      dp[i+1][j] %= mod;
      dp2[i+1][j] += dp2[i][j];
      dp2[i+1][j] %= mod;
    }
  }

  ll res = 1LL;
  for(int i = 0;i < n;++i){
    res *= 3;
    res %= mod;
  }

  ll cnt = 0;
  for(int i = (s+1)/2;i <= s;++i){
    cnt += dp[n][i] * 3;
    cnt %= mod;
  }
  if(s % 2 == 0){
    ll d = (dp2[n][s/2] * 3) % mod;
    cnt = (cnt + mod - d) % mod;
  }
  res = (res + mod - cnt) % mod;
  cout << res << endl;
}


Measured memory_bytes: 485120
#include <stdio.h>

typedef enum {false, true} bool;


int main(void)
{
    char c, temp = '\n';
    int ctr = 0;
    bool flag = true;
    
    
    scanf("%c", &c);
    
    while(c != '\n')
    {
        if(c != temp)
        {
            if(flag)
            {
                temp = c;
            }
            else
            {
                flag = true;
            }
            
            ctr++;
        }
        else
        {
            temp = '\n';
            
            flag = false;
        }
        
        scanf("%c", &c);
    }
    
    
    printf("%d\n", ctr);
    
    
    //system("pause");
    
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
using namespace std;
  
int main() {
  int d[3]; for (int i =0; i<3; i++) cin >> d[i];
  sort(d,d+3);
  
  if (d[0] + d[1] == d[2]) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll h, w, n, a, b;
  map<pair< ll, ll >, ll > m;

  cin >> h >> w >> n;

  rep(i, n) {
    cin >> a >> b;
    rep(j, 3) {
      rep(k, 3) {
        if (a - j >= 1 && b - k >= 1 && a + 2 - j <= h && b + 2 - k <= w) {
          m[make_pair(a - j, b - k)]++;
        }
      }
    }
  }

  vector<int> ans(10, 0);
  for(auto it = m.begin(); it != m.end(); it++) ans[it->second]++;
  ans[0] = (h - 2) * (w - 2) - m.size();
  rep(i, 10) cout << ans[i] << endl;

	return 0;
}

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

//create arrays outside of main()

int quotients[100];

int main(){

    int a;
    int b;
    int k;
    int index=0;

    cin >> a >> b >> k;

    for(int i=1; i<b+2; i++){
        if(a%i==0 && b%i==0){
            quotients[index] = i;
            index += 1;
        } 
    }

    cout << quotients[index-k];


    return 0;
}

Measured memory_bytes: 256
/*  
    Talkin' to myself and feelin' old
    Sometimes I'd like to quit, nothin' ever seems to fit
    Hangin' around, nothin' to do but frown
    Rainy days and Mondays always get me down
    _________________________
    _________________________
    936 Hours of Solitude
    Quarantine_Day : 39
*/

#include<bits/stdc++.h>

using namespace std;

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

#define pb(n)           push_back(n)
#define GSORT(v)        sort(v.begin(), v.end(), greater<int>())
#define SORT(v)         sort(v.begin(), v.end());
#define REV(v)          reverse(v.begin(), v.end());
#define db(a)           cout<<#a<<" = "<<a<<endl;
#define FIN             freopen("in.txt","r",stdin);
#define FOUT            freopen("out.txt","w",stdout);
#define REP(i,n)        for(int i = (int)(0); i < (int)(n); i++)
#define FOR(i, a, b)    for(int i = (int)a; i <= (int)b; i++)    

#define MAX 90

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

    int n; cin>>n;
    set<int>st;
    while(n--){
        int a; cin>>a;
        st.insert(a);
    }
    cout<<st.size()<<"\n";
    return 0;
}


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

int main(){
    long long a,b,c,d;
    long long x,y,z,v, ans=LLONG_MIN;
    cin>>a>>b>>c>>d;
    x = a*c;
    y = a*d;
    z = b*c;
    v = b*d;
    if(ans<x) ans = x;
    if(ans<y) ans = y;
    if(ans<z) ans = z;
    if(ans<v) ans = v;
    cout<<ans<<endl;
    return 0;
}


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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    int N, K; cin >> N >> K;
    int sum = 0;
    int A[N]; rep(i, N){ cin >> A[i]; sum += A[i]; }

    vector<int> yakusuu;
    int lim = sqrt(sum);
    for(int i = 1; i <= lim; i++){
        if(sum % i == 0){
            yakusuu.push_back(i);
            yakusuu.push_back(sum/i);
        }
    }

    int ans = 1;
    rep(i, yakusuu.size()){
        int md = yakusuu[i];
        if(md <= ans) continue;

        int work_add[N];
        int work_sub[N];
        rep(j, N){
            work_add[j] = A[j] % md;
            work_sub[j] = md - work_add[j];
        }
        sort(work_add, work_add+N);
        sort(work_sub, work_sub+N);

        int acc_add = 0, acc_sub = 0;
        int idx_add = 0, idx_sub = 0;
        while(idx_add + idx_sub < N){
            if(acc_add <= acc_sub){
                acc_add += work_add[idx_add++];
            }
            else acc_sub += work_sub[idx_sub++];
        }
        if(acc_add <= K){
            ans = md;
            //cout << md << " is okay: " << acc_add << endl;
        }
    }
    cout << ans << endl;
    return 0;
}

//1 7 5 6 8 2 6 5
//5で割れるか
//1 2 0 1 3 2 1 0 -> 0 0 1 1 1 2 2 3
//                   2 3 3 4 4 4 5 5
//8で割れるか
//1 7 5 6 0 2 6 5 -> 0 1 2 5 5 6 6 7
//                   0 7 6 3 3 2 2 1

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

int main() {
  int n;
  cin >> n;
  int cake = n/4, don = n/7;
  rep(i, cake+1){
  	rep(j, don+1){
    	if((i*4 + j*7) == n){
        	cout << "Yes" << endl;
          	return 0;
        }
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
typedef long long ll;
#define MODSIZE 1000000007
 
int main(){
  int h,w;
  char s[106][106];
 
  scanf("%d %d", &h, &w);
 
  int i;
  for(i = 0;i < h;i++) scanf("%s", s[i]);
 
  for(i = 0;i < h;i++){
    printf("%s\n", s[i]);
    printf("%s\n", s[i]);
  }
 
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
 
#define mod 998244353
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define long long long
inline int rei(){int x;cin>>x;return x;}
inline long rel(){long x;cin>>x;return x;}
inline string res(){string x;cin>>x;return x;}
//------------------------------------------------------- 
long DP[4001*4001];
void Calc(){
	string S = res();
	int N = S.length();
	int r = 0;
	int b = 0;
	DP[0] = 1;
	for(int i=0;i<2*N;i++){
		if(i < N){
			if(S[i] == '0'){
				r += 2;
			}
			else if(S[i] == '1'){
				r++;
				b++;
			}
			else{
				b += 2;
			}
		}
		for(int j=0;j<=4000;j++){
			if(r >= j && b >= i+1-j){
				if(j != 0){
					DP[i*4001+4001+j] += DP[i*4001+j-1];
				}
				DP[i*4001+4001+j] += DP[i*4001+j];
				DP[i*4001+4001+j] %= mod;
			}
		}
	}
	long ans = 0;
	for(int i=0;i<=4000;i++){
		ans += DP[2*N*4001+i];
	}
	ans %= mod;
	cout << ans << endl;
}
int main(int argc,char** argv){
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0); Calc(); return 0;
}

Measured memory_bytes: 123520
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;
    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
        //MyDebugger.Test(process, "../TextFile2.txt");
        //MyDebugger.MakeTestCase("../TextFile2.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 k     = int.Parse(spl[1]);

        var pers = new long[k];

        for(int i=1; i<=n; i++) {
            var p = i % k;
            pers[p]++;
        }

        long c = 0;
        c += pers[0] * pers[0] * pers[0];

        if(k % 2 == 0) {
            c += pers[k / 2] * pers[k / 2] * pers[k / 2];
        }

        return c;
    }
}

Measured memory_bytes: 11176
#include <stdio.h>


int main(void) {
    long long int i, n, a, b, min = 1000000000001;
    scanf("%lld", &n);

    for (i = 1; i <= 1000000; i++) {
        if (n % i == 0) {
            a = i;
            b = n/i;
            if (min > a+b-2) {
                min = a+b-2;
            }
        }
    }
    printf("%lld\n", min);

    return 0;
}


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

b1 = [0]
b2 = [0]

for i in range(n):
    b1.append(b1[-1] + a1[i])
    b2.append(b2[-1] + a2[i])

ans = 0

for i in range(n):
    tmp = b1[i+1] + b2[-1] - b2[i]
    ans = max(ans, tmp)

print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <limits>
#include <cmath>

using namespace std;

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

  int result = 0;
  for (int i = 0; i < n; i++) {
    if (i==0 || s[i-1] != s[i]) {
      result++;
    }
  }
  
  cout << result << endl;
}

Measured memory_bytes: 512
import sys
sys.setrecursionlimit(10**8)
stdin = sys.stdin


def ni(): return int(ns())


def na(): return list(map(int, stdin.readline().split()))


def naa(N): return [na() for _ in range(N)]


def ns(): return stdin.readline().rstrip()  # ignore trailing spaces


N = ni()
S = ns()
red_cnt = 0
for s in S:
    if s == "R":
        red_cnt += 1
ans = 0
for s in S[:red_cnt]:
    if s == "W":
        ans += 1

print(ans)


Measured memory_bytes: 68056
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n;
  cin >> n;
  long long a[n],b[n],c[n];
  for(int i=0;i<n;i++){
    cin >> a[i] >> b[i] >> c[i];
  }
  long long dp[n+5][5]={};
  for(int i=0;i<n;i++){
    for(int j=0;j<3;j++){
      if(j==0){
        dp[i+1][j]=max(dp[i+1][j], max(dp[i][1]+a[i], dp[i][2]+a[i]));
      }else if(j==1){
        dp[i+1][j]=max(dp[i+1][j], max(dp[i][0]+b[i], dp[i][2]+b[i]));
      }else{
        dp[i+1][j]=max(dp[i+1][j], max(dp[i][0]+c[i], dp[i][1]+c[i]));
      }
    }
  }
  cout << max(dp[n][0], max(dp[n][1], dp[n][2])) << endl;
  return 0;
}


Measured memory_bytes: 6528
function Main(input) {
  const inputs = input.split("\n");
  const nums = inputs[1].split(" ");
  const result = 1 / nums.map(num => 1 / parseInt(num, 10))
    .reduce((acc, value) => acc + value);
  console.log(result);
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 21192
from collections import deque


a = deque()
n = int(input())
for i in range(n):
    command = input().split()
    com = command[0]
    if com == "insert":
        a.appendleft(command[1])
    elif com == "delete":
        if command[1] in a:
            a.remove(command[1])
    elif com == "deleteFirst":
        a.popleft()
    elif com == "deleteLast":
        a.pop()
print(" ".join(map(str, a)))


Measured memory_bytes: 69724
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
    int num = 0;
    int n = -1;
    while (scanf("%d", &n) != 0 && n != 0)
    {
        printf("Case %d: %d\n", ++num, n);
    }
    return 0;
}


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  auto c = a;
  sort(c.rbegin(), c.rend());
  for (int i = 0; i < n; i++) {
    if (c[0] == a[i]) {
      cout << c[1] << endl;
    } else {
      cout << c[0] << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 4736
#include <string>
#include <cstdio>
#include <iostream>

using namespace std;

int main()
{
	int n;
	string *u;
	double *x;
	double out = 0;

	scanf("%d", &n);

	u = new string[n];
	x = new double[n];

	for (int i = 0; i < n; i++)
	{
		cin >> x[i] >> u[i];
		if (u[i] == "JPY") out += x[i];
		else if (u[i] == "BTC") out += x[i] * 380000;
	}

	printf("%f\n", out);

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

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

    //入力
    vector<int> t(N+1), x(N+1), y(N+1);
    t.at(0)=0;
    x.at(0)=0;
    y.at(0)=0;
    for (int i = 1; i <= N; i++) {
        cin >> t.at(i) >> x.at(i) >> y.at(i);
    }

    int no_counter=0;

    for (int i = 1; i <= N; i++){
        if((abs(x[i]-x[i-1])+abs(y[i]-y[i-1]))>t[i]-t[i-1]){
            no_counter++;
        }
        else{
            if((t[i]-t[i-1])%2 == 0){ //偶数
                if((abs(x[i]-x[i-1])+abs(y[i]-y[i-1]))%2==1){
                    no_counter++;
                }
            }else{ //奇数
                if((abs(x[i]-x[i-1])+abs(y[i]-y[i-1]))%2==0){
                    no_counter++;
                }
            }
        }
    }

    if(no_counter>0){
        cout << "No";
    }else{
        cout << "Yes";
    }


    return 0;
}

Measured memory_bytes: 1408
n=int(input())
#a,b=map(int,input().split())
pl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
ans=0
for i in range(1,n-1):
    templ=pl[i-1:i+2]
    templ.sort()
    if templ[1]==pl[i]:
        ans+=1
print(ans)


Measured memory_bytes: 3060
import java.util.*;

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

        if (a1 + a2 + a3 >= 22)
            System.out.println("bust");
        else 
            System.out.println("win");
        
    }
}

Measured memory_bytes: 21716
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char c[] = sc.nextLine().toCharArray();
		sc.close();
		int n = c.length + 1;
		long sum = 0;
		int l=0,s=0;
		int start = 0;
		if(c[0]=='>') {
			for(int i=0; i<n-1 ;i++) {
				if(c[i]=='>') {
					start ++;
				}else {
					break;
				}
			}
		}
		sum += calc(start);

		for(int i=start; i<n-1; ) {
			l=0;
			s=0;
			while(i<n-1 && c[i]=='<') {
				s++;
				i++;
			}
			while(i<n-1 && c[i]=='>') {
				l++;
				i++;
			}
			sum += calc(s,l);
		}
		System.out.println(sum);
	}

	public static long calc(long a, long b) {
		if(a <= b) {
			return b*(b+1)/2 + a*(a-1)/2;
		}else {
			return a*(a+1)/2 + b*(b-1)/2;
		}
	}
	public static long calc(long a) {
		return a*(a+1)/2;
	}

}


Measured memory_bytes: 32892
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] x = new int[4];
        int[] y = new int[4];
        int hit, blow;

        while (sc.hasNextInt()) {
            for(int i = 0;i < 4;i++){
            	x[i] = sc.nextInt();
            }
            for(int i = 0;i < 4;i++){
            	y[i] = sc.nextInt();
            }

            hit = blow = 0;

            for (int i = 0; i < 4; i++) {
                for (int j = 0; j < 4; j++) {
                    if (x[i] == y[j]) {
                    	if(i == j){
                    		hit++;
                    	}else {
                    		blow++;
                    	}
                    }
                }
            }
            System.out.println(hit + " " + blow);
        }
    }
}

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

int dp[50];

int main(){
    int n;
    cin>>n;
    for(int i=0; i<50; ++i)dp[i]=0;
    dp[0]=dp[1]=1;
    for(int i=2; i<=n; ++i){
        dp[i]=dp[i-2]+dp[i-1];
    }
    cout<<dp[n]<<endl;
}


Measured memory_bytes: 3112
#include<iostream>
using namespace std;
int main(){
   int a,b,c;
   cin>>a>>b>>c;
   if(a+c==b){
    cout<<"Yes";
   }
   else if (b+c==a){
    cout<<"Yes";
   }
   else if (a+b==c){
    cout<<"Yes";
   }
   else cout <<"No";
   return 0 ;
}


Measured memory_bytes: 256
from math import ceil
mod=10**9+7
fac=[1]
for i in range(2002):
	fac.append(fac[i]*(i+1))
def comb(a,b):
	if a<b:
		return 0
	r=pow(fac[b]*fac[a-b]%mod,mod-2,mod)
	return fac[a]*r%mod
n,k=map(int,input().split())
for i in range(1,k+1):
	q=comb(n-k+1,i)
	qq=comb(k-i+i-1,i-1)
	print(q*qq%mod)



Measured memory_bytes: 5748