akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStream;

import java.io.InputStreamReader;

import java.util.Arrays;

import java.util.Collections;

import java.util.Comparator;

import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws IOException {
        Reader.init(System.in);

        int[][] arr = new int[3][3];
        int row1 =0;
        int row2=0;
        int row3=0;int col1=0;int col2=0;int col3=0;
        int all=0;
        for(int i=0;i<3;i++){
            for(int j=0;j<3;j++){
                arr[i][j] = Reader.nextInt();
                all+= arr[i][j];
            }
        }

        int tem = arr[0][0] + arr[1][1] + arr[2][2];
        if((arr[0][0] + arr[1][1] + arr[2][2] == arr[0][2] + arr[1][1] + arr[2][0]) && ((double)all)/3 == (double)tem){
            System.out.println("Yes");
        }
        else{System.out.println("No");}
    }
}

class Reader {

    static BufferedReader reader;

    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */

    static void init(InputStream input) {

        reader = new BufferedReader(

                new InputStreamReader(input) );



        tokenizer = new StringTokenizer("");

    }



    static String nextToken() {

        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {

                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {

                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    /** get next word */

    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                    reader.readLine() );
        }
        return tokenizer.nextToken();
    }
    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }



    static double nextDouble() throws IOException {

        return Double.parseDouble( next() );

    }



    static long nextLong() {

        return Long.parseLong(nextToken());

    }


}


Measured memory_bytes: 22612
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#include <fstream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#define MAGIC cin.tie(NULL); ios_base::sync_with_stdio(false)
#define endl '\n'
//#define ll long long
#define mod (1000000007)
//#define NCONS 100001
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
//#define MCONS 2001
//#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0
#define toRadian(degree) ((degree) * (M_PI / 180.))
#define toDegree(radian) ((radian) * (180. / M_PI))
#define int long long
//#define double long double
using namespace std;
struct Point{int x; int y;};
struct PPoint{Point x; Point y;};
typedef long long ll;

int gcd(int a, int b) { if(a < b) swap(a, b); if(b <= 0) return a; return gcd(b, a % b); }

#define YYYY cout << "YES" << endl
#define NNNN cout << "NO" << endl
#define yyyy cout << "Yes" << endl
#define nnnn cout << "No" << endl
int dx[]{0, 1, 0, -1};
int dy[]{1, 0, -1, 0};

const int NCONS = 100001;
bool check[NCONS];
int penalty[NCONS];

int32_t main()
{
    MAGIC;
 //   fill(first_time, first_time + NCONS, INT_MAX);
    
    int N, M; cin >> N >> M;
    int ans = 0, pen = 0;
    
    while(M--)
    {
        int p; string s; cin >> p >> s;
        if(s == "AC")
        {
            if(!check[p])
            {
                ans += 1;
                pen += penalty[p];
            }
            check[p] = true;
        }
        else
        {
            penalty[p] += 1;
        }
    }
    
    
    cout << ans << " " << pen << endl;
    return 0;
}



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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n; cin >> n;
	vector<string> a(n);
	vl c(n);
	FOR(i,0,n) cin >> a[i] >> c[i];
	
	map<pair<string,string>, ll> dist;
	set<pair<ll, pair<string,string>>> q;

	dist[{"",""}] = 0;
	q.insert({0,{"",""}});
	
	ll res = oo;
	while (sz(q)) {
		string u, v;
		ll d = begin(q)->xx;
		tie(u,v) = begin(q)->yy;
//		cerr << u << " " << v << endl;
		q.erase(begin(q));

		FOR(i,0,n) {
			string nu, nv;
			if (sz(u) == 0) {
				nu = a[i], nv = v;
			} else {
				nu = u, nv = a[i];
			}
			ll k = min(sz(nu), sz(nv));
			string pre = nu.substr(0,k);
			reverse(all(pre));
			if (pre != nv.substr(sz(nv)-k)) continue;
			nu = nu.substr(k), nv = nv.substr(0, sz(nv)-k);

			if (is_palin(nu+nv)) res = min(res, d+c[i]); 
			
			pair<string,string> p(nu,nv);
			if (dist.count(p) && dist[p] <= d+c[i]) continue;
			q.erase(mp(dist[p],p));
			dist[p] = d+c[i];
			q.insert(mp(dist[p],p));
		}
	}
	if (res == oo) res = -1;
	cout << res << endl;
}



Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const long long INF = 1e18+10;

/*--------------------------------------------------------------------*/
bool isprime(int n){
	for(int i=2;i*i<=n;i++){
		if(n%i==0)return false;
	}
	return true;
}

signed main(){	
	int n,p;
	cin>>n>>p;

	vi prime;
	for(int i=2;i<=min((int)(1e6+3e5),p);i++){
		if(isprime(i)){
			prime.pb(i);
		}
	}

	vector<pii> sosuu;

	rep(i,prime.size()){

		int cnt=0;
		while(p%prime[i]==0){
			cnt++;
			p/=prime[i];
		}
		if(cnt>0)sosuu.pb(make_pair(prime[i],cnt));

		if(p==1){
			break;
		}
	}
	if(isprime(p)){
		sosuu.pb(make_pair(p,1));
		p/=p;
	}

	assert(p==1);

	int ans=1;
	for(auto p:sosuu){
		ans*=pow(p.first,p.second/n);

	}
	cout<<ans<<endl;
	// for(pii p:sosuu){
	// 	cout<<p.first<<' '<<p.second<<endl;
	// }
	return 0;
}


Measured memory_bytes: 4328
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		long A = sc.nextLong();
		long B = sc.nextLong();

		long gcd=gcd(A,B);
		long max=(long) (Math.sqrt(gcd)) + 1;
//		System.out.println(max);

		int ans=1;

		if(gcd%2==0) {ans++;}
		while (gcd%2==0) {
			gcd = gcd/2;
		}

		for(long i=3;i<=max;i+=2) {
			if(gcd%i==0) {ans++;}
			while (gcd%i==0) {gcd = gcd/i;}
		}
		if(gcd>max) {ans++;}

		System.out.println(ans);
	}

	public static long gcd(long m,long n) {
		long t;
		while (m % n != 0) {
			t = n;
			n = m%n;
			m = t;
		}
		return n;
	}

}


Measured memory_bytes: 22868
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    long long N, A, B;
    cin >> N >> A >> B;
    
    
    long blue_Count = (N / (A + B)) * A;
    
    if(N % (A + B) <= A){
        blue_Count += N % (A + B);
    }
    else{
        blue_Count += A;
    }
    
    cout << blue_Count << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
  long a, b, x;
  long double PPII=3.1415926535897932384626433832795028841971;
  long double d180=180.0;
  cin >> a>>b>>x;
  if(2*x>=a*a*b){
    long double K=(2.0*(long double)(a*a*b-x))/((long double)(a*a*a));
    if(K>2.41421356237){
      cout<<std::setprecision(12)<<(PPII/2-atan(1/K))*d180/PPII;
    }else{
      cout <<std::setprecision(12)<< (PPII/4+atan((K-1)/(K+1)))*d180/PPII;
    }
  }else{
    long double K=((long double)(a*b*b))/(2.0*(long double)(x));
    if(K>2.41421356237){
      cout<<std::setprecision(12)<<(PPII/2-atan(1/K))*d180/PPII;
    }else{
      cout << std::setprecision(12)<<(PPII/4+atan((K-1)/(K+1)))*d180/PPII;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

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


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

  ll g = gcd(c, d);
  ll l = c * d / g;

  ll ans = b - a + 1;
  ans -= b / c;
  ans += (a - 1) / c;
  ans -= b / d;
  ans += (a - 1) / d;
  ans += b / l;
  ans -= (a - 1) / l;

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int
main(int argc, char *argv[])
{
  long long x, y, ans;
  scanf("%lld %lld", &x, &y);
  
  if(x % y == 0) ans = -1;
  else ans = x * (y - 1);
  
  printf("%lld\n", ans);
  
  return 0;
}


Measured memory_bytes: 128
module Main where

import Numeric
import Data.Functor

main :: IO ()
main = do
  { [a,b] <- getInts
  ; let (q,r) = divMod a b
  ; let s = fromIntegral a / fromIntegral b
  ; putStrLn . unwords $ [show q, show r, showFFloat Nothing s ""]
  }

getInts :: IO [Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO ()
putInts = putStrLn . unwords . map show

done :: IO ()
done = return ()

Measured memory_bytes: 3972
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <istream>
#include <sstream>
using namespace std;

int main()
{
	int N,n,ANS=0;
	vector<int> V;
	vector<int> C;

	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> n;
		V.push_back(n);
	}
	for (int i = 0; i < N; i++)
	{
		cin >> n;
		C.push_back(n);
	}
	for (int i = 0; i < N; i++)
	{
		if (V[i] - C[i] > 0)
		{
			ANS = ANS + V[i] - C[i];
		}
	}
	cout << ANS << endl;
}

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

int main() {
    int n; cin >> n;
    for (int i = 1; i <= 9; i++) {
        for (int j = 1; j <= 9; j++) {
            if (n == i*j) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
D,G = map(int,input().split())
G = G/100
P = []; C = []
for i in range(D):
  p,c = map(int,input().split())
  P.append(p)
  C.append(c/100)
m = 10**3
for k in range(2**D):
  R = list(range(D))[::-1]
  point = G
  prob = 0
  for d in range(D):
    if k & 1<<d:
      p = P[d]; c = C[d]
      point -= (d+1)*p + c
      prob += p
      R.remove(d)
  for r in R:
    if point > 0:
      p = P[r]
      if point/(r+1) <= p:
        prob += -(-point//(r+1))
        point = 0
      else:
        point -= (r+1)*p + C[r]
        prob += p
  if m >= prob:
    m = prob
print(int(m))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
    enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
    ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
typedef long long ll;

void solve()
{
	ll mxn = 1e18;
	int n;
	cin>>n;
	ll ans = 1;
	vector<ll> a(n);
	bool zero= false;
	for (int i=0; i<n; i++) {
		cin>>a[i];
		if (a[i]==0) {
			zero = true;
		}
	}
	if (zero) {
		cout << "0\n";
		return;
	}
	for (int i=0; i<n; i++) {
		if (a[i] > mxn/ans) {
			ans = -1;
		}
		if (ans!=-1) {
			ans *= a[i];
		}
	}
	cout << ans << "\n";
}	

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

Measured memory_bytes: 4028
'use strict';

function main(stdin) {
  const input = stdin.trim().split('\n').map(v => parseInt(v, 10));
  const N = input.shift();

  let first, second;
  first = second = -1;

  input.forEach(a => {
    if (a >= first) {
      second = first;
      first = a;
    } else if (a > second) {
      second = a;
    }
  });

  input.forEach(a => {
    if (a === first) console.log(second);
    else console.log(first);    
  });
}

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

Measured memory_bytes: 39788
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int vy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int vx[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main() {
    int h, w; cin >> h >> w;
    vector<string> vc;
    for (int i = 0; i < h; ++i) {
        string str; cin >> str;
        vc.push_back(str);
    }

    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if (vc[i][j] == '#') cout << '#';
            else {
                int cnt = 0;
                for (int k = 0; k < 8; ++k) {
                    if (i - vy[k] < 0 || i - vy[k] >= h) continue;
                    if (j + vx[k] < 0 || j + vx[k] >= w) continue;
                    if (vc[i - vy[k]][j + vx[k]] == '#') ++cnt;
                }
                cout << cnt;
            }
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

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

using namespace std;

int n, q;
int t[100001];

void add(int i, int x){
	while(i <= n){
		t[i] += x;
		i += i & -i;
	}
}

int sum(int i){
	int s = 0;
	while(i > 0){
		s += t[i];
		i -= i & -i;
	}
	return s;
}

int main(){
	scanf("%d%d", &n, &q);
	rep(i, q){
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		if(a == 0){
			add(b, c);
		}
		else{
			printf("%d\n", sum(c) - sum(b - 1));
		}
	}
	return 0;
}

Measured memory_bytes: 1416
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstdio>
using namespace std;

const int A = 2 * 3600; 

void show( int s ) {

  int a = s / 3600;
  int b = s / 60 % 60;
  int c = s % 60;
  
  printf("%02d:%02d:%02d\n", (int)a, (int)b, (int)c);
}

int main() {
  int h, m, s;
  while(cin >> h >> m >> s && h >= 0 ) {
    int a = h*3600 + m*60 + s;
    int aa = A - a;

    show( aa );
    show( aa*3 );
  }
  
  return 0;
}

Measured memory_bytes: 1156
#include <iostream>

using namespace std;

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

  int cnt = 0;
  for (int i = 1; i <= n; ++i) {
    int cnt2 = 1;
    int m = i;
    while (m /= 10) {
      ++cnt2;
    }
    if (cnt2 % 2 == 1)
      ++cnt;
  }
  cout << cnt << endl;

}

Measured memory_bytes: 256
//{{{By oToToT
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <bitset>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <random>
#include <utility>
#include <stack>
#include <sstream>
#include <functional>
#include <deque>
#include <cassert>
using namespace std;
/* include everything for Kotori~ <3 */

using lld = int64_t;
using llu = uint64_t;
using llf = long double;
using PII = pair<int,int>;
using PIL = pair<int,lld>;
using PLI = pair<lld,int>;
using PLL = pair<lld,lld>;
template<typename T>
using maxHeap = priority_queue<T,vector<T>,less<T>>;
template<typename T>
using minHeap = priority_queue<T,vector<T>,greater<T>>;
/* define some types for Ruby! */

#define FF first
#define SS second
#define SZ(x) (int)((x).size())
#define ALL(x) begin(x), end(x)
#define PB push_back
#define WC(x) while(x--)
/* make code shorter for Di~a~ */

template<typename Iter>
ostream& _out(ostream &s, Iter b, Iter e) {
	s<<"[";
	for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
	s<<"]";
	return s;
}
template<typename A, typename B>
ostream& operator <<( ostream &s, const pair<A,B> &p ) { return s<<"("<<p.FF<<","<<p.SS<<")"; }
template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) { return _out(s,ALL(c)); }
/* make output easier for Ainyan~n~ */

bool debug = 0;
#define DUMP(x) if(debug) cerr<<__PRETTY_FUNCTION__<<":"<<__LINE__<<" - "<<(#x)<<"="<<(x)<<'\n'
template<typename T>
void DEBUG(const T& x){if(debug) cerr<<x;}
template<typename T, typename... Args>
void DEBUG(const T& head,const Args& ...tail){
	if(debug){cerr<<head; DEBUG(tail...);}
}
/* Let's debug with Nico~Nico~Ni */
//}}}
const int N = 200000 + 5;

int64_t cnt[ N ];

int main(int argc, char* argv[]){
	if(argc>1 and string(argv[1])=="-D") debug=1;
	if(!debug){ios_base::sync_with_stdio(0);cin.tie(0);}
	int n, k; cin >> n >> k;
	for ( int i = 1 ; i <= n ; ++ i ) {
		if ( ( i + i ) % k == 0 )
			cnt[ i % k ]++;
	}
	int64_t ans = 0;
	for ( int i = 0 ; i < k ; ++ i )
		ans += cnt[ i ] * cnt[ i ] * cnt[ i ];
	cout << ans << '\n';
	return 0;
}
/*
(a+b)%k==0
(b+c)%k==0
(c+a)%k==0
----------
a = -b (mod k)
b = -c (mod k)
c = -a (mod k)
a = -a
*/

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

# dp[n][k]: nは現在使っている個数、kは左から詰めた個数
dp = [[0 for _ in range(N + 1)] for _ in range(N + 1)]

p = [(a, i) for i, a in enumerate(A)]
p.sort(reverse=True)

for i in range(N):
    pi = p[i][1]

    for l in range(i + 1):
        # add to left
        dp[i + 1][l + 1] = max(dp[i + 1][l + 1], dp[i][l] + (pi - l) * A[pi])

        r = i - l
        # add to right
        dp[i + 1][l] = max(dp[i + 1][l], dp[i][l] + ((N - r - 1) - pi) * A[pi])

print(max(dp[N]))


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

int main(void)
{
	double a, x1, x2, y1, y2;

	scanf("%lf%lf%lf%lf", &x1, &x2, &y1, &y2);

	a = sqrt((y1 - x1)*(y1 - x1) + (y2 - x2)*(y2 - x2));
	
	printf("%f\n", a);

	return 0;
}


Measured memory_bytes: 2112
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);
#define l  long
#define ll  long long
int main()
{
    fast
     int x,y,z,temp;cin>>x>>y>>z;
     swap(x,y);
     swap(x,z);
     cout<<x<<" "<<y<<" "<<z;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
typedef long long int ll;
static const ll n = 3e14;
using namespace std;

int main() {
	ll x;
	cin >> x;
	ll ans = 2 * x / 11+1;
	if (2 * x % 11 == 0||2*x%11==1)ans--;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
long long int  gcd(long long int a,long long int b)
{
return b==0?a:gcd(b,a%b);
}
int main()
{
	int t;
	long long int k,l;
	scanf("%d",&t);
	scanf("%lld",&k);
	t=t-1;
	while(t--)
	{
		scanf("%lld",&l);
		k=k/gcd(l,k)*l;
	}
	printf("%lld\n",k);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {
    string s;
    cin>>s;
    int o=0;
    rep(i,s.size()){
        if(s[i]=='o')o++;
    }
    if(o>=8){cout<<"YES"<<endl;}else{
        int k=8-o;
        if(15-s.size()>=k)cout<<"YES"<<endl;
        else{cout<<"NO"<<endl;}
    }


    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <list>
#include <algorithm>
using namespace std;
typedef long long int ll;

int main() {
    string S, T;

    cin >> S >> T;

    bool flag = true;
    for(int i = 0; i < S.length(); i++){
        if (S[i] != T[i]) flag = false;
    }

    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3636
# Date [ 2020-09-26 21:09:39 ]
# Problem [ c.py ]
# Author Koki_tkg

import sys

def read_str(): return sys.stdin.readline().strip()
def read_int(): return int(sys.stdin.readline().strip())
def read_ints(): return map(int, sys.stdin.readline().strip().split())
def read_str_split(): return list(sys.stdin.readline().strip())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))

class dsu:
    def __init__(self, n: int):
        self._n = n
        self.parent_or_size = [-1] * self._n

    def merge(self, a: int, b: int) -> int:
        assert 0 <= a and a < self._n
        assert 0 <= b and a < self._n
        x = self.leader(a); y = self.leader(b)
        if x == y: return x
        if -self.parent_or_size[x] < -self.parent_or_size[y]: x, y = y, x
        self.parent_or_size[x] += self.parent_or_size[y]
        self.parent_or_size[y] = x
        return x

    def same(self, a: int, b: int) -> bool:
        assert 0 <= a and a < self._n
        assert 0 <= b and a < self._n
        return self.leader(a) == self.leader(b)

    def leader(self, a: int) -> int:
        assert 0 <= a and a < self._n
        if self.parent_or_size[a] < 0: return a
        self.parent_or_size[a] = self.leader(self.parent_or_size[a])
        return self.parent_or_size[a]

    def size(self, a: int) -> int:
        assert 0 <= a and a < self._n
        return -self.parent_or_size[self.leader(a)]

    def groups(self):
        leader_buf = [0] * self._n; group_size = [0] * self._n
        for i in range(self._n):
            leader_buf[i] = self.leader(i)
            group_size[leader_buf[i]] += 1
        result = [[] for _ in range(self._n)]
        for i in range(self._n):
            result[leader_buf[i]].append(i)
        result = [v for v in result if v]
        return result

def Main():
    n, m = read_ints()
    uf = dsu(n)
    for _ in range(m):
        a, b = read_ints()
        uf.merge(~-a, ~-b)
    ans = len(uf.groups())
    print(ans-1)

if __name__ == '__main__':
    Main()


Measured memory_bytes: 25752
#define _GLIBCXX_DEBUG //提出時に消す
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
using pis = pair<int, string>;
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 1000000007LL

int main() {
  int x;
  cin >> x;
  cout << ((x < 30) ? "No" : "Yes") << endl;
}

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

int main() {
  int N;
  cin >> N;
  
  vector<int64_t> v(N+1);
  v[0] = 2;
  v[1] = 1;
  for (int i = 2; i <= N; i++) {
    v[i] = v[i-1] + v[i-2];
  }
  cout << v[N] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

const int N=2010;
int n,sd,u,v,cnt[N],sdep[N],gao[N];
char s[N];
VI e[N];

void dfs(int u,int f,int d) {
	if (s[u]=='1') {
//		printf("ff %d %d\n",u,d);
		sd+=d;
	}
	for (auto v:e[u]) if (v!=f)
		dfs(v,u,d+1);
}

void dfs2(int u,int f) {
	cnt[u]=s[u]=='1';
	sdep[u]=0;
	gao[u]=0;
	vector<PII> p;
	for (auto v:e[u]) {
		if (v==f) continue;
		dfs2(v,u);
		cnt[u]+=cnt[v];
		sdep[v]+=cnt[v];
		sdep[u]+=sdep[v];
		p.pb(mp(sdep[v],v));
	}
	sort(all(p));
	if (sdep[u]==0) return;
	int v=p.back().se;
	if (p.back().fi*2<=sdep[u]) gao[u]=sdep[u]/2;
	else if ((sdep[v]-2*gao[v])*2<=sdep[u]-2*gao[v]) gao[u]=sdep[u]/2;
	else {
		gao[u]=gao[v]+(sdep[u]-sdep[v]);
	}
}

int main() {
	scanf("%d",&n);
	scanf("%s",s+1);
	rep(i,1,n) {
		scanf("%d%d",&u,&v);
		e[u].pb(v);
		e[v].pb(u);
	}
	int ans=1e9;
	rep(i,1,n+1) {
		vector<PII> ss;
		for (auto j:e[i]) {
			sd=0;
			dfs(j,i,1);
			ss.pb(mp(sd,j));
		}
		sort(all(ss));
		int sdis=0;
		for (auto p:ss) sdis+=p.fi;
//		printf("%d %d\n",i,sdis);
		if (sdis%2!=0) continue;
		if (ss.back().fi*2<=sdis) {
			ans=min(ans,sdis/2);
			continue;
		}
		int v=ss.back().se;
		dfs2(v,i);
		sdep[v]+=cnt[v];
		if ((sdep[v]-2*gao[v])*2<=sdis-2*gao[v]) ans=min(ans,sdis/2);
	}
	if (ans<1000000000) printf("%d\n",ans);
	else puts("-1");
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define MAXN 4000005
using namespace std;

int n,a[MAXN],b[MAXN],ok,js = 0,maxl = 0;
int vis[MAXN],prime[MAXN],tot,judge[MAXN];

void init(){
	memset(vis , -1 , sizeof(vis));
	tot = 0;
	for(int i = 2 ; i <= 2000000 ; i++){
		if(vis[i] == (-1)){tot++;prime[tot] = i;}
		for(int j = 1 ; j <= tot && prime[j] * i <= 2000000 ; j++){
			vis[prime[j] * i] = 1;
			if(i % prime[j] == 0)break;
		}
	}

}

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

int cmp(int x , int y){
	return x < y;
}

int main(){
	init();
	ok = 0;
	cin>>n;
	for(int i = 1 ; i <= n ; i++){
		scanf("%d" , &a[i]);	
		maxl = max(maxl , a[i]);
		b[i] = a[i];
	}
	while(prime[js] * prime[js] <= maxl)js++;
	int cnt;
	for(int j = 1 ; j <= js ; j++){
		cnt = 0;
		for(int i = 1 ; i <= n ; i++){
			if(a[i] % prime[j] == 0){
				cnt++;
				while(a[i] % prime[j] == 0)a[i] /= prime[j];
			}	
		}	
		if(cnt > 1){
			ok = 1;
			break;
		}
	}
	sort(a + 1 , a + 1 + n , cmp);
	for(int i = 1 ; i < n ; i++){
		if(a[i] == 1)continue;
		if(a[i] == a[i + 1]){
			ok = 1;
			break;
		}
	}
	for(int i = 1 ; i <= n ; i++){
		a[i] = b[i];
	}
	if(ok == 1){
		ok = 0;
		int zz = gcd(a[1] , a[2]);
		for(int i = 1 ; i <= n ; i++)zz = gcd(zz , a[i]);
		if(zz == 1)cout<<"setwise coprime"<<endl;
		else cout<<"not coprime"<<endl;
	}
	else{
		cout<<"pairwise coprime"<<endl;
		exit(0);
	}
}


Measured memory_bytes: 27660
program main
 implicit none

 integer N,K,i
 character*80 S,e
 read(*,*) N,S,K
 e(1:1) = S(K:K)
 do i=1,N
  if(S(i:i) /= e(1:1)) then
   S(i:i) = '*'
  end if
 end do

 write(*,*) S   
end program main

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

#define UPPER_BOUND 100000
#define UPPER_BOUND_INDEX 12
#define POW_BOUND 7+1

typedef enum { false, true } bool;

int change[UPPER_BOUND_INDEX];

int min = 100000;
bool flag = true;

void change_array(void)
{
    int i, index6, index9, pow6[POW_BOUND], pow9[POW_BOUND];
    
    
    index6 = index9 = 0;
    
    
    for(i=0; i<POW_BOUND; i++)
    {
        pow6[i] = pow(6, i);
        pow9[i] = pow(9, i);
    }
    
    for(i=0; pow6[index6]<=UPPER_BOUND || pow9[index9]<=UPPER_BOUND; i++)
    {
        if(pow6[index6] < pow9[index9])
        {
            change[i] = pow6[index6];
            
            index6++;
                
            continue;
        }
        if(pow6[index6] > pow9[index9])
        {
            change[i] = pow9[index9];
            
            index9++;
            
            continue;
        }
        if(pow6[index6] == pow9[index9])
        {
            change[i] = pow6[index6];
            
            index6++;
            index9++;
            
            continue;
        }
    }
    /*for(i=0; i<UPPER_BOUND_INDEX; i++)
    {
        printf("%d\n", change[i]);
    }*/
}

int change_index(int N)
{
    int i;
    
    
    for(i=UPPER_BOUND_INDEX-1; i>=0; i--)
    {
        if(change[i] <= N)
            break;;
    }
    
    return i;
}

void DIV(int R, int index, int num)
{
    int i;
    
    
    if(num >= min)
    {
        flag = false;
        
        return;
    }
    else if(index == 0)
    {
        if(min > num + R)
            min = num + R;
            
        return;
    }
    else
    {
        if(R >= change[index])
        {
            for(i=R/change[index]; i>=0; i--)
            {
                DIV(R-change[index]*i, index-1, num+i);
                
                if(!flag)
                {
                    flag = true;
                    
                    return;
                }
            }
        }
        else
        {
            DIV(R, index-1, num);
        }
    }
}

int main(void)
{
    int N;
  
  
    scanf("%d", &N);


    change_array();

    DIV(N, change_index(N), 0);


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


    //system("pause");
    return 0;
}


Measured memory_bytes: 128
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize, l: u64,
        a: [u64; n],
    }
    let mut cur = n+1;

    for i in 0..n-1 {
        if a[i]+a[i+1] >= l {
            cur = i;
            break;
        }
    }
    if cur == n+1 {
        println!("Impossible");
    } else {
        println!("Possible");
        for i in 0..cur {
            println!("{}", i+1);
        }
        for i in (cur+1..n-1).rev() {
            println!("{}", i+1);
        }
        println!("{}", cur+1);
    }
}


Measured memory_bytes: 4860
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

template<class U, class V>
ostream& operator <<(ostream& out, pair<U, V>& p) {
    return out << p.first << " " << p.second;
}

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int N;
    cin >> N;
    set<int> S;
    FOR(i, 0, N) {
        int t;
        cin >> t;
        S.insert(t);
    }

    cout << (S.size() == N ? "YES" : "NO") << endl;
    return 0;
};

Measured memory_bytes: 9600
package main

import (
	"fmt"
)

func main() {
	var N int
	fmt.Scan(&N)
	var ans, a int
	for i := 0; i < N; i++ {
		fmt.Scan(&a)
		ans = gcd(ans, a)
	}
	fmt.Println(ans)
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}


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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    int n; cin >> n;
    vector<int> a(n+1,0);
    rep(i,2,n+1){
        int tmp; cin >> tmp;
        a[tmp]++;
    }
    rep(i,1,n+1){
        cout << a[i] << endl;
    }
}

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

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

  string s; cin >> s;
  for (int i = 0; i < s.size() - 1; i++) {
    if (s[i] == s[i + 1]) {
      cout << (i + 1) << ' ' << (i + 2) << '\n';
      return 0;
    }
  }
  for (int i = 0; i < s.size() - 2; i++) {
    if (s[i] == s[i + 2]) {
      cout << (i + 1) << ' ' << (i + 3) << '\n';
      return 0;
    }
  }
  cout << "-1 -1" << '\n';
  return 0;
}

Measured memory_bytes: 512
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

public static class P
{
    public static void Main()
    {
        int n = NextInt;
        int last = 0;
        int cur = 0;
        int max = 0;
        for (int i = 0; i < n; i++)
        {
            var h = NextInt;
            if (last >= h)
            {
                cur++;
                max = Max(max, cur);
            }
            else
            {
                cur = 0;
            }
            last = h;
        }
        Console.WriteLine(max);
    }

    static readonly TextReader In = Console.In;
    static int NextInt
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get
        {
            int res = 0;
            int next = In.Read();
            while (48 <= next && next <= 57)
            {
                res = res * 10 + next - 48;
                next = In.Read();
            }
            return res;
        }
    }
}


Measured memory_bytes: 13140
//ABC150 A

#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = s; i < (int)(n); i++)
const lint mod = 1000000007;


lint ans = 0;
lint K,X;



int main() {
  cin >> K >> X;
  
  if(K*500 >= X){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }

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


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

ll calc(ll l,ll r,ll n){
  l = ((l-1)/n+1)*n;
  if(l>r) return 0;
  return (r-l)/n+1;
}

ll calc(ll x){
  ll len=0,num = 1,cnt=1;
  while(num<=x){
    ll nx = min(x+1,num*10);
    ll d3 = calc(num,nx-1,3);
    ll d5 = calc(num,nx-1,5);
    ll d15= calc(num,nx-1,15);
    ll d  = d3+d5-d15;
    len+= ((nx-num) - d)*cnt;
    len+= (d3+d5)*4;
    num = nx;
    cnt++;
  }
  return len;
}

ll search(){
  ll L=0,M,R=1LL<<60;
  while(L<R){
    M = (L+R)/2;
    if(calc(M)>=n)R = M;
    else L = M+1;
  }
  return L-1;
}

string ItoS(ll a){
  if(a==0) return "0";
  string res;
  while(a)res=(char)(a%10+'0')+res,a/=10;
  return res;
}

int main(){
  cin>>n;
  ll num = search()+1;
  ll len = calc(num-1);
  string ans;
  while(ans.size()<100){
    if(num%3==0) ans+="Fizz";
    if(num%5==0) ans+="Buzz";
    if(num%3&&num%5) ans+=ItoS(num);
    num++;
  }
  for(int i=0;i<20;i++)cout<<ans[n-len-1+i];
  cout<<endl;
  
  return 0;
}

Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, K;
  cin >> N >> K;
  vector<int> count(N, 0);
  for (int i = 0; i < K; i++){
    int d;
    cin >> d;
    for (int j = 0; j < d; j++){
      int A;
      cin >> A;
      count[A - 1]++;
    }
  }
  int ans = 0;
  for (int i = 0; i < N; i++){
    if (count[i] == 0){
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3600
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i>b;i--)
#define vint vector<int> 
#define vvint vector<vint>
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
#define ct(a) cout<<a<<endl
static const double pi = 3.141592653589793;
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int INF = 1e9+7;
const int mod= 1e9 + 7;

ll mod_pow(ll x, ll n) {
	if (n == 0) return 1;
	ll res = mod_pow(x*x % mod, n / 2);
	if (n & 1) res = res * x % mod;
	return res;
}

ll comb(ll n, ll x) {
	ll ret = 1, k = 1;
	FOR(i, 0, x)ret = (ret * (n - i)) % mod;
	FOR(i, 1, x + 1)k = (k*i + mod) % mod;
	k = mod_pow(k, mod - 2);
	ret = (ret*k + mod) % mod;
	return ret;
}

int main(){
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	
	ll N,A,B;
	cin >> N>>A>>B;
	
	ll ans = 1;

	ans = mod_pow(2LL, N);

	ll a = comb(N,A);
	ll b = comb(N, B);
	
	cout << (ans-a-b+2*mod-1)%mod << endl;

	return 0;
}


Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<climits>

/*
#include<boost/multiprecision/cpp_long long.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Blong long = mp::cpp_long long;
*/

using namespace std;

#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007

int main(){
    string s;
    int K;
    cin>>s>>K;
    for(int i=0;i<(int)s.size();i++){
        if(s[i]!='a'&&'z'-s[i]+1<=K){
            K-='z'-s[i]+1;
            s[i]='a';
        }
    }
    K%=26;
    while(K>0){
        s[s.size()-1]++;
        K--;
    }
    cout<<s<<endl;
}


Measured memory_bytes: 3248
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;

int main(){
    ll n ,k ; cin >> n >> k;
    string s; cin >> s;
    ll ss = s.size();

    vector<ll> renzoku(0);

    bool hidari = s.at(0) - '0';
    if(!hidari) renzoku.push_back(0);
    
    ll cur = hidari;
    ll cnt = 1;
    for(int i=1;i<ss;i++){
        if(s.at(i) - '0' ==cur){
            cnt++;
        }else{
            renzoku.push_back(cnt);
            cnt = 1;
            cur = s.at(i) - '0' ;
        }       
    }
    renzoku.push_back(cnt);

    ll rens = renzoku.size();
  
    //rep(i,rens) cout << renzoku.at(i) << " " ;
    //cout << endl;

    ll ans = 0;

    for(int i=0;i<min(2*k+1,rens);i++){
        ans += renzoku.at(i);
        //cout << ans << endl;
    }
    ll hikaku = ans;
    for(int i=0;i<rens;i+=2){
        hikaku -= renzoku.at(i);
        if(i+1<rens) hikaku -= renzoku.at(i+1);
        if(i+(2*k+1)<rens) hikaku += renzoku.at(i+(2*k+1));
        if(i+(2*k+2)<rens) hikaku += renzoku.at(i+(2*k+2));
        ans = max(ans,hikaku);
        //cout << ans << endl;
    }

    cout << ans << endl;

}

Measured memory_bytes: 1528
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9+5;
const ll INFLL = 1e18l+5;

int main(){
    int n;
    cin>>n;
    vector<double> dp(n+1); //dp[i] is probability of getting i heads
    dp[0]=1;
    for(int coin=0; coin<n; ++coin){
        double phead;
        cin>>phead;
        for(int i=coin+1; i>=0; --i){
            if(i==0) dp[i]= dp[i]*(1-phead);
            else if(i==coin+1) dp[i]=dp[i-1]*phead;
            else dp[i]=dp[i-1]*phead+dp[i]*(1-phead);
        }
    }
    double ans=0;
    int i = n%2==0 ? n/2 : n/2+1;
    for(i=i; i<=n; ++i){
        ans+=dp[i];
    }

    printf("%.9f",ans);

    


}

Measured memory_bytes: 3824
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TEMPAtCoder2
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = System.Console.ReadLine();
            string[] s1 = s.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);

            int N = int.Parse(s1[0]);

            s = System.Console.ReadLine();
            s1 = s.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            int currentH = 0;
            int canviewcnt = 0;
            for(int i = 0; i < N; ++i)
            {
                if(i == 0)
                {
                    currentH = int.Parse(s1[i]);
                    canviewcnt++;
                }
                else 
                {
                    int h = int.Parse(s1[i]);
                    if(h >= currentH)
                    {
                        currentH = h;
                        canviewcnt++;
                    }
                }
            }


            System.Console.WriteLine(canviewcnt);               
                            

        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
using namespace std;
int main(void){
	while(true){
    int H,W;
    int i,j;
    cin >> H;
    cin >> W;
    if( H == 0 && W == 0 ){
    	break;
    }
    for(i = 0; i < H; i++){
        for(j = 0; j < W; j++){
            if(i==0||i==H-1||j==0||j==W-1){
                   cout << "#";
            }else{
                   cout << ".";
            }
        }
        cout << endl;
    }
    cout << endl;
	}
    return 0;
}



Measured memory_bytes: 3108
S = input()

if S == "SUN":
    print(7)
elif S == "MON":
    print(6)
elif S == "TUE":
    print(5)
elif S == "WED":
    print(4)
elif S == "THU":
    print(3)
elif S == "FRI":
    print(2)
else:
    print(1)


Measured memory_bytes: 8968
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

n=int(input())
l=[]
l=make_divisors(n)
ans=0

for i in range(len(l)):
    if l[i]-1 > n//l[i]:
        ans+=l[i]-1
print(ans)

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

int main() {
	long long N,M;
  	cin >> N >> M;

  	if(N == 1 && M == 1) {
    	cout << 1 << endl;
    }else if(N == 1){
      cout << M - 2 << endl;
    }else if(M == 1) {
      cout << N - 2 << endl;
    }else  {
      cout << (N - 2) * (M - 2) << endl;
    }
}


	


Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef DEMETRIO
#define deb(...) fprintf(stderr,__VA_ARGS__)
#define deb1(x) cerr << #x << " = " << x << endl
#else
#define deb(...) 0
#define deb1(x) 0
#endif
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ThxDem=b;i<ThxDem;++i)
#define SZ(x) ((int)(x).size())
#define mset(a,v) memset(a,v,sizeof(a))
#define mcopy(a,b) memcpy(a,b,sizeof(a))
using namespace std;
typedef long long ll;

void perdi(){puts("-1");exit(0);}

int n,a,b,r[300005];

int main(){
	scanf("%d%d%d",&n,&a,&b);
	if(a==1&&b!=n||b==1&&a!=n||a+b-1>n||a>n||b>n)perdi();
	bool asd=false;
	fore(_,0,2){
		int bb=0;
		for(int i=0;i<n;i+=a){
			fore(j,i,min(i+a,n))r[j]=max(n-i-a,0)+j-i;
			bb++;
		}
		//fore(i,0,n)printf("%d%c",r[i]+1," \n"[i==n-1]);
		if(b<bb){asd=true;swap(a,b);continue;}
		bb=b-bb;
		for(int i=a;i<n;i+=a){
			reverse(r+i,r+i+min(a,bb+1));
			bb-=min(a,bb+1)-1;
		}
		if(bb){asd=true;swap(a,b);continue;}
		if(asd)reverse(r,r+n);
		fore(i,0,n)printf("%d%c",r[i]+1," \n"[i==n-1]);
		return 0;
	}
	perdi();
	return 0;
}

Measured memory_bytes: 3328
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args)throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		while(true){
			String line[] = br.readLine().split(" ");
			int n = Integer.parseInt(line[0]);
			if(n==0){break;}

			run(n,n,"");
		}
	}

	static void run(int n, int limit, String ans){
		for(int i=limit;i>0; i--){
			if(n == i){
				System.out.println(ans+i);
			}else{
				int newlimit = Math.min(n-i, i);
				run(n-i,newlimit,ans+i+" ");
			}
		}
	}
}

Measured memory_bytes: 43328
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt(),B=sc.nextInt(),K=sc.nextInt();
		int min = Math.min(A, B);
		int count=0;
		for(; min>0; min--) {
			if(A%min==0 && B%min==0) {
				count++;
				if(count==K)break;
			}
		}
		System.out.println(min);
	}
}


Measured memory_bytes: 21972