akhauriyash/Code-Regression huggingface dataset:
//----------------------------おまじない
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")
//----------------------------
#define FOR(i,j,n) for (int i=(j);i<(n);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define REPN(i,n) for (int i=(n);i>0;i--)
#define I(n) scanf("%d", &(n))
#define LL(n) scanf("%lld", &(n))
#define pb(n) push_back((n))
#define mp(i,j) make_pair((i),(j))
#define eb(i,j) emplace_back((i),(j))
#include <bits/stdc++.h>
using namespace std;
//------------------------------typedef集
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef vector<vi> vvi;
typedef vector<vpi> vvpi;
typedef vector<vvi> vvvi;
typedef long long ll;
const int mod = 1000000009;


int k;
vector<pair<ll,double>> snuke;

double f(ll x){
    double ret = x;
    ll sx = 0;
    while(x){
        sx += x%10;
        x /= 10;
    }
    return ret/sx;
}
ll ten_d(int d){
    ll i = 1;
    while(d){
        i *= 10;
        d--;
    }
    return i;
}
int main(){
    cin >> k;
    for (int i=1; i<10; i++) snuke.emplace_back(i,1);

    for (int i=1; i<15; i++){
        int d = 1;
        for(; d<=i; d++){
            int sn = 1 + 9*d;
            ll n = ten_d(i)+ten_d(d)-1;
            if (n <= ten_d(d)*sn) break;
        }
        for(ll x=ten_d(i)+ten_d(d)-1; x<ten_d(i+1); x+=ten_d(d)){
            //cerr << x << " " << f(x) << endl;
            snuke.emplace_back(x,f(x));
        }
    }

    pair<ll,double> snuke_prev = snuke[810]; //適当な大きいf(n)
    for (auto snuke_candidate: snuke){
        if(snuke_candidate.second >= snuke_prev.second){
            cout << snuke_prev.first << endl;
            k--;
            if(!k) return 0;
        }
        snuke_prev = snuke_candidate;
    }
    if(k) cout << snuke_prev.first << endl;

}

Measured memory_bytes: 256
n,k=gets.split.map &:to_i
f=[1]
(1..1000).map{|i|f<<f[-1]*i}
c=->a,b{f[a]/f[b]/f[a-b]}
s=0
1.upto(k){|i|s=(s+(1-(k-i)%2*2)*c[k,i]%(10**9+7)*i**n%(10**9+7))%(10**9+7)}
p s



Measured memory_bytes: 12044
colors = [0 for i in range(9)]

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

for a in A:
    color = a // 400 if a < 3600 else 8
    colors[color] += 1

min_color = 0
for i in range(8):
    if colors[i] > 0:
        min_color += 1

if min_color > 0:
    print("{} {}".format(min_color, min_color + colors[8]))
else:
    print("{} {}".format(1, colors[8]))

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

const int N = 1e5;
long long n,m;

int main()
{
	scanf("%lld%lld",&n,&m);
	long long ans = 0ll;
	for(long long b=m+1ll; b<=n; b+=1ll)
	{
		long long r = n/b;
		ans += (b-m)*r;
		long long x = n-r*b;
		if(x>=m) ans += x-(m-1);
	}
	if(m==0) ans -= n;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 128
def power(x, y, mod):
    """
    https://qiita.com/Yaruki00/items/fd1fc269ff7fe40d09a6
    二分累乗法でx ** yを求める
    
    2 ** n = 4 ** (n//2) = 16 ** (n//4)
    みたいなことをする
    """

    if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return power(x, y//2, mod)**2 % mod
    else            : return power(x, y//2, mod)**2 * x % mod


def mul(a, b, mod):
    """
    https://qiita.com/Yaruki00/items/fd1fc269ff7fe40d09a6
    modを加味したかけ算を行う
    """
    return ((a % mod) * (b % mod)) % mod

def div(a, b, mod):
    """
    https://qiita.com/Yaruki00/items/fd1fc269ff7fe40d09a6
    modを加味した割り算を行う    
    """
    if a == b:
        return 1
    return mul(a, power(b, mod-2, mod), mod)


def factorial_part(start, last, mod):
    """
    startからlastまでのかけ算を行う
    
    factorial_part(2, 4, mod) = 2 * 3 * 4 = 24    
    """
    assert(start <= last)
    x = 1
    for k in range(start, last+1):
        x *= k
        x %= mod
    return x

def combination(n, a, mod):
    if a == 0:
        return 1
    nCa = div(factorial_part(n - a + 1, n, mod), factorial_part(1, a, mod), mod)
    return nCa

mod = int(1e9) + 7



x, y  = map(int, input().split())
s = x + y
if s % 3 != 0:
    print(0)
else:
    s = s // 3
    x -= s
    y -= s
    if x < 0:
        print(0)
    elif y < 0:
        print(0)
    else:
        print(combination(x + y, x, mod))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


int main(){
 int n,k;
 cin>>n>>k;
 int cnt=0;
 while( n != 0 ){
  cnt++;
  n/=k;
 }
 cout<<cnt<<endl;
    return 0;
}


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

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

signed main(void) {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int countw = 0;
	int countr = 0;
	int violate = 0;
	rep(i, n) {
		if (s[i] == 'W')countw++;
		else countr++;
	}
	rep(i, countr) {
		if (s[i] == 'W')violate++;
	}
	print(min({ countr,countw,violate }));
}

Measured memory_bytes: 3748
// BEGINNING WITH THE NAME OF ALMIGHTY GOD ALLAH
// AUTHOR:: MOHAMMAD FAISAL
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.flush();
	char c;
  	int price = 700;
    while(cin >> c)
      if(c=='o') price+=100;
  	
  	cout<<price;

	return 0;
	// BYE BYE
}


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

#define mod 1'000'000'007
typedef long long ll;

template <typename T>
void deb(initializer_list<T> l)
{
    for (auto &e : l)
        cout << e << ' ';
    cout << '\n';
}

void solve()
{
    int n, q;
    string s;
    cin >> n >> q >> s;
    vector<int> f(n, 0);
    for (int i = 0; i < n - 1; ++i)
        f[i] = s[i] == 'A' && s[i + 1] == 'C';
    for (int i = 1; i < n; ++i)
        f[i] += f[i - 1];
    while (q--)
    {
        int l, r;
        cin >> l >> r;
        --l;
        --r;
        cout << f[r - 1] - (l ? f[l - 1] : 0) << '\n';
    }
}

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

    int t { 1 };
 //   cin >> t;
    while (t--)
        solve();

    return 0;
}


Measured memory_bytes: 1488
#include<iostream>
#include<vector>
#include<algorithm>
#include<tuple>
#include<utility>
#include<queue>
#include<cmath>

using namespace std;

typedef long long int64;

int main(void){
    int64 N;
    cin>>N;
    int64 num=1;
    vector<char> name(1);
    int64 tmp=N;

    for (int64 i = 1; N>pow(26,i); i++)
    {
        N-=pow(26,i);
        num++;
    }
    // cout<<"N="<<N<<endl;
    N--;
    name[0]='x';
    for (int64 i = 0; i < num; i++)
    {
        name.push_back(static_cast<char>(N%26+static_cast<int>('a')));
        N/=26;
    }
    
    // while(N>=1){
    //     name.push_back(static_cast<char>(N%26+static_cast<int>('a')));
    //     if(N<=25) break;
    //     N/=26;
    // }
    reverse(name.begin(),name.end());

    name.pop_back();

    for (int64 i = 0; i < name.size(); i++)
    {
        cout<<name[i];
    }
    
    cout<<endl;
    // cout<<static_cast<char>('a'+25)<<endl;
    return 0;
}

Measured memory_bytes: 4104
import java.util.List;
import java.util.Scanner;

public class Main {

	static Scanner scanner;

	public static void main(String[] args) {
	    scanner = new Scanner(System.in);
	    //String s=gs();
	    String t=gs();
	    //int c=gi();

	   
	    //System.out.print(c*c*c);

        if (t.equals("Sunny")) {
        	System.out.print("Cloudy");
        }else if(t.equals("Cloudy")){
        	System.out.print("Rainy");
        } else {
        	System.out.print("Sunny");
        }


	}
	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 35612
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.System.exit;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static void solve() throws Exception {
		int n = scanInt();
		int p2[] = new int[n], p5[] = new int[n], minP2 = 0, maxP2 = 0, minP5 = 0, maxP5 = 0;
		long ans = 0;
		int zeros = 0;
		for (int i = 0; i < n; i++) {
			String a = scanString();
			int sub = 0;
			int pos = a.indexOf('.');
			if (pos >= 0) {
				a = a.substring(0, pos) + a.substring(pos + 1);
				sub = a.length() - pos;
			}
			long aa = parseLong(a);
			if (aa == 0) {
				p2[i] = Integer.MAX_VALUE;
				p5[i] = Integer.MAX_VALUE;
				++zeros;
				continue;
			}
			int cp2 = -sub, cp5 = -sub;
			while (aa % 2 == 0) {
				aa /= 2;
				++cp2;
			}
			while (aa % 5 == 0) {
				aa /= 5;
				++cp5;
			}
			p2[i] = cp2;
			p5[i] = cp5;
			minP2 = min(minP2, cp2);
			maxP2 = max(maxP2, cp2);
			minP5 = min(minP5, cp5);
			maxP5 = max(maxP5, cp5);
		}
		ans += (long) zeros * (2 * n - zeros);
		int ints = zeros;
		maxP2 = max(maxP2, -minP2);
		minP2 = -maxP2;
		maxP5 = max(maxP5, -minP5);
		minP5 = -maxP5;
		int cnts[][] = new int[maxP2 - minP2 + 1][maxP5 - minP5 + 1];
		for (int i = 0; i < n; i++) {
			if (p2[i] != Integer.MAX_VALUE) {
				++cnts[p2[i] - minP2][p5[i] - minP5];
				if (p2[i] >= 0 && p5[i] >= 0) {
					++ints;
				}
			}
		}
		int cntSums[][] = new int[maxP2 - minP2 + 1][maxP5 - minP5 + 1];
		for (int i = maxP2 - minP2; i >= 0; i--) {
			for (int j = maxP5 - minP5; j >= 0; j--) {
				cntSums[i][j] = cnts[i][j];
				if (i < maxP2 - minP2) {
					cntSums[i][j] += cntSums[i + 1][j];
					if (j < maxP5 - minP5) {
						cntSums[i][j] -= cntSums[i + 1][j + 1];
					}
				}
				if (j < maxP5 - minP5) {
					cntSums[i][j] += cntSums[i][j + 1];
				}
				int ii = -(i + minP2), jj = -(j + minP5);
				if (ii >= minP2 && ii <= maxP2 && jj >= minP5 && jj <= maxP5) {
					ans += (long) cnts[ii - minP2][jj - minP5] * cntSums[i][j];
				}
			}
		}
		out.print((ans - ints) / 2);
	}

	static int scanInt() throws IOException {
		return parseInt(scanString());
	}

	static long scanLong() throws IOException {
		return parseLong(scanString());
	}

	static String scanString() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}

Measured memory_bytes: 64256
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<numeric>
#include<string>
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const ll MOD = 1000000007;
 
using namespace std;

int main()
{
    int N, ans;  cin >> N;
    vector<int> v(N);
    for(int i=0; i<N; i++)  cin >> v[i];
    sort(all(v));
    ans = 0;
    for(int i=0; i<N-2; i++){
        for(int j=i+1; j<N-1; j++){
            for(int k=j+1; k<N; k++){
                if(v[i] + v[j] > v[k] && v[i] < v[j] && v[j] < v[k])  ans++;
            }
        }
    }
    cout << ans;
}

Measured memory_bytes: 3632
from collections import Counter

N = int(input())
A = list(input().split())
A = [int(A[i])for i in range(N)]
A_count = list(Counter(A).most_common())

rectangle = sorted([A_count[i][0] for i in range(len(A_count)) if A_count[i][1] >= 2],reverse=True)
square = sorted([A_count[i][0] for i in range(len(A_count)) if A_count[i][1] >= 4], reverse=True)

S_rec = (rectangle[0] * rectangle[1] if len(rectangle) >= 2 else 0)
S_squ = (square[0] ** 2 if len(square) >= 1 else 0)

print(max(S_rec, S_squ))


Measured memory_bytes: 21532
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N,C,K;
    cin>>N>>C>>K;
    vint t(N);
    REP(i,N) cin>>t[i];
    sort(ALL(t));

    int i,j,ans=0;
    for(i=0;i<N;){
        j=i+1;
        while(j<N and j-i+1<=C and t[j]<=t[i]+K) j++;
        ans++; i=j;
    }
    cout<<ans<<endl;

}


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

cnt = 0

for i in range(N):
    if A[i] < 0:
        cnt += 1
if cnt % 2 == 0:
    ans = 0
    for a in A:
        ans += max(a, -a)
    print(ans)
else:
    ans = 0
    smallest = float("inf")
    for a in A:
        ans += max(a, -a)
        smallest = min(smallest, abs(a))
    
    ans -= 2 * smallest
    print(ans)

Measured memory_bytes: 14412
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <bitset>

using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<string> vs;

#define MAX(a,b) ((a)>(b) ? (a) : (b))
#define MIN(a,b) ((a)<(b) ? (a) : (b))
#define ABS(a) ((a)>0 ? (a) : (a * -1))



int main(){
	ll n, ans, cnt;
	cin >> n;
	ans = 0;
	vector<ll> a(n*3);

	for (ll i = 0; i < 3*n; i++) {
		cin >> a[i];
	}

	sort(a.begin(), a.end());

	cnt = a.size()-1;
	for (ll i = 0; i < n; i++) {
		a[i] = 0;
		a[cnt] = 0;
		cnt -= 2;
	}

	for (ll i = 0; i < n*3; i++) {
		ans += a[i];
	}

	cout << ans << endl;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
for(int x=0;x<50000;x++){
  if(n==floor(x*1.08)){
    cout<<x;
    return 0;
  }
  }
  cout<<":("<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int k,s,a=0;cin>>k>>s;
  for(int i=0;i<k+1;i++){
    if(s-i<=k*2&&s-i>=0){
      if(s-i>=k)a+=k*2-s+i+1;
      else a+=s-i+1;
    }
  }
  cout<<a<<endl;
}


Measured memory_bytes: 256
#define TEST_MODE true
 
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
 
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (a)-1; i >= (int)b; --i)
#define range(i, a, b, c) for (int i = a;		\
                               c > 0 ? i < b : i > b;	\
                               i += c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) begin(a), end(a)
#define ifnot(a) if (not(a))
#define int long long
 
#if TEST_MODE == true
const bool test = true;
#define dump(x) cerr << #x << " = " << (x) << " "
#define dumpl(x) cerr << #x << " = " << (x) << " " << endl;
#else
const bool test = false;
#define dump(x) 
#define dumpl(x) 
#endif
 
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
const int INF = (int)1 << 60;
const ll INFL = (ll)1 << 60;
ll mod_n = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real &r) { return (r > eps) - (r < -eps); }
int sgn(const Real &a, const Real &b) { return sgn(a - b); }
 
//.....................
const int MAX = (int)2e5 + 5;
 
vector<string> split(const string &str, char sep)
{
  vector<string> v;
  stringstream ss(str);
  string buffer;
  while (getline(ss, buffer, sep))
    {
      v.push_back(buffer);
    }
  return v;
}
 
template <class InputIterator>
int sum(InputIterator begin, InputIterator end)
{
  return accumulate(begin, end, 0ll);
}
 
template<typename T>
T gcd(T a, T b)
{
  T c;
  while (a != 0) {
    c = a; a = b%a;  b = c;
  }
  return b;
}
 
class Solver {
public:
  int a, b;

  void solve() {
    cin >> a >> b;
    if (a * b % 2 == 0) cout << "Even" << endl;
    else cout << "Odd" << endl;
  }
};
 
signed main()
{
  srand(time(NULL));
  cout << fixed << setprecision(20);
  auto ptr = new Solver();
  ptr->solve();
  delete ptr;
  // while (true) {    
  //     auto ptr = new Solver();
  //     ptr->solve();
  //     delete ptr;
  // }
  return 0;
}
 
// class Mycin {
// 	bool flag = true;
// public:
// 	Mycin& operator >> (int& a) {flag = scanf("%lld", &a) != EOF; return *this;}
// 	Mycin& operator >> (char& a) {flag = scanf("%c", &a) != EOF; return *this;}
// 	Mycin& operator >> (string& s) {flag = (bool)(cin >> s); return *this;}
// 	operator bool() {return flag;}
// } mycin;
 
// class Mycout {
// public:
// 	Mycout& operator << (const int& a) {printf("%lld", a); return *this;}
// 	Mycout& operator << (const char c) {printf("%c", c); return *this;}
// 	Mycout& operator << (const string& s) {printf("%s", s.c_str()); return *this;}
// } mycout;
 
// #define cin mycin
// #define cout mycout
// #define endl '\n'


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
#define fi first
#define se second
void read(int &x){
	char ch=getchar();x=0;
	for (;ch==' '||ch=='\n';ch=getchar());
	for (;ch!=' '&&ch!='\n';x=x*10+ch-'0',ch=getchar());
}
void write(int x){
	if (x>9) write(x/10);
	putchar(x%10+'0');
}
int n;
pii a[100004];
bool cmp(pii A,pii B){
	return A.fi+A.se<B.fi+B.se;
}
int dp[5003];
int main(){
	read(n);
	for (int i=1;i<=n;i++) read(a[i].fi),read(a[i].se);
	sort (a+1,a+1+n,cmp);
	for (int i=1;i<5003;i++) dp[i]=2000000001;
	for (int i=1;i<=n;i++)
		for (int j=i-1;j>=0;j--)
			if (dp[j]<=a[i].fi) dp[j+1]=min(dp[j+1],dp[j]+a[i].se);
	for (int i=5002;i>=0;i--)
		if (dp[i]!=2000000001){
			write(i);break;
		}
}

Measured memory_bytes: 256
/* 
chirag11032000
Chirag Thakur
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;

template < typename T > using OrderedSet = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std::endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}
#else
#define trace(...)
#endif

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

const db PI = acos(-1);
const ll LINF = LLONG_MAX;
const int INF = INT_MAX, MOD = 1e9 + 7, N = 1e5 + 10;

void test_case();

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	test_case();
	cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
	return 0;
}

void test_case() {
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	vector < int > cnt;
	if (s[0] == '0') {
		cnt.eb(0);
	}
	int z = 0;
	for (int i = 0; i < n; ) {
		int t = 0, st = i;
		while (i < n && s[i] == s[st]) {
			++t, ++i;
		}
		z += (s[st] == '0');
		cnt.eb(t);
	}
	if (s.back() == '0') {
		cnt.eb(0);
	}
	if (z <= k) {
		cout << accumulate(all(cnt), 0) << "\n";
	} else {
		int sum = cnt[0];
		for (int i = 1, rem = k; i < cnt.size() && rem > 0; i += 2, --rem) {
			sum += cnt[i] + cnt[i + 1];
		}
		int ans = sum;
		for (int i = 2 * k + 1; i < cnt.size(); i += 2) {
			sum += cnt[i] + cnt[i + 1];
			int prv = i - 2 * k;
			sum -= cnt[prv] + cnt[prv - 1];
			ans = max(ans, sum);
		}
		cout << ans << "\n";
	}
}

Measured memory_bytes: 1020
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int main(){
  int n;
  int s,i,h;
  int cnt = 0;

  scanf("%d %d", &h, &n);

  for(i = 0;i < n;i++){
    scanf("%d", &s);
    cnt += s;
  }

  if(h <= cnt) printf("Yes\n");

  else printf("No\n");

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
 
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pb push_back
//#define INF  (1<<30)
#define INFL (1LL<<60)
#define EPS ((ld)(1e-9))
 
#define sz(x) ((int)(x).size())
#define setz(x) memset(x, 0, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define rep(i, e) for (int i = 0, _##i = (e); i < _##i; i++)
#define repp(i, s, e) for (int i = (s), _##i = (e); i <= _##i; i++)
#define repr(i, s, e) for (int i = (s), _##i = (e); i >= _##i; i--)
#define repi(i, x) for (auto &i : (x))
#define ARR(...) vector<int>({__VA_ARGS__})
#define ARS(...) vector<string>({__VA_ARGS__})
 
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef complex<double> base;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
 
template<typename T, typename V>
ostream &operator<<(ostream &os, const pair<T, V> pai) { 
    return os << '(' << pai.first << ' ' << pai.second << ')';
}
 
template<typename T>
ostream &operator<<(ostream &os, const vector<T> v) {
    os << '[';
    for (auto p : v) os << p << ",";
    os << "]";
    return os;
}
 
template<typename T, typename V>
ostream &operator<<(ostream &os, const set<T, V> v) {
    os << "{";
    for (auto p : v) os << p << ",";
    os << "}";
    return os;
}

template<typename T, typename V>
ostream &operator<<(ostream &os, const multiset<T, V> &v) {
    os << "{";
    for (auto p : v) os << p << ",";
    os << "}";
    return os;
}
 
template<typename T, typename V>
ostream &operator<<(ostream &os, const map<T, V> v) {
    os << "{";
    for (auto p : v) os << p << ",";
    os << "}";
    return os;
}
 
ostream& operator<<(ostream &os, tuple<int, int, int> t) {
    os << "<" << get<0>(t) << "," << get<1>(t) << "," << get<2>(t) << ">";
    return os;
}
 
#ifdef ONLINE_JUDGE
#define debug(...) 0
#define endl '\n'
#else
#define debug(...) cout << " [-] ", _dbg(#__VA_ARGS__, __VA_ARGS__)
template<class TH> void _dbg(const char *sdbg, TH h){ cout << sdbg << '=' << h << endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
    while(*sdbg != ',') cout << *sdbg++;
    cout << '=' << (h) << ','; 
    _dbg(sdbg+1, a...);
}
#endif
 
auto x = []{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    return 0;
}();

template<typename T> void get_max(T &a, T b) {a = max(a, b);}
template<typename T> void get_min(T &a, T b) {a = min(a, b);}

int main(void) { 
    int H, N; cin >> H >> N;
    cout << (H-1)/N+1;
}




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

int N, a[4];
double dp[301][301][301];
bool visited[301][301][301];

double solve(int one, int two, int three)
{
    if (!one && !two && !three) return 0.0;
    if (one < 0 || two < 0 || three < 0) return 0.0;
    if (!visited[one][two][three])
    {
        dp[one][two][three] = (one * solve(one - 1, two, three) + two * solve(one + 1, two - 1, three) + three * solve(one, two + 1, three - 1) + (double) N) / (double) (one + two + three);
        visited[one][two][three] = 1;
    }
    return dp[one][two][three];
}

int main()
{
    scanf("%d", &N);
    for (int i = 1; i <= N; i++)
    {
        int tmp;
        scanf("%d", &tmp);
        a[tmp]++;
    }
    printf("%.10lf\n", solve(a[1], a[2], a[3]));
    return 0;
}


Measured memory_bytes: 239872
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <iostream>
#include <numeric>
#define rep(i,n) for (int i = 0;i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
int INF = 1e9;


int main(){
	int n;cin >> n;
	ll x=1,y=1;
	rep(i,n){
		ll t,a;cin >> t >> a;
		ll mult = max((x+t-1)/t,(y+a-1)/a);
		x = mult*t;
		y = mult*a;
	}
	cout << x+y << endl;

} 


Measured memory_bytes: 3568
import math
import numpy as np

def main():
    N, K, Q = list(map(int, input().split()))
    points = [K-Q for _ in range(N)]
    for i in range(Q):
        A= int(input())
        points[A-1] += 1

    for i in range(N):
        if points[i] > 0:
            print('Yes')
        else:
            print('No')

if __name__ == '__main__':
    main()

Measured memory_bytes: 18888
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n; cin >> n;
	vector<pi> p;
	rep(i, n){
		int a; cin >> a;
		p.emplace_back(a, i + 1);
	}
	sort(all(p));
	rep(i, n) cout << p[i].second << (i==n-1?"\n":" ");
	
	return 0;
}

Measured memory_bytes: 1780
# -*- coding: utf-8 -*-

N, K = map(int, raw_input().split())

_k = 0
_count = 0
_ans = 0

for i in range(1,N+1):
    _k = i
    _count = 0
    while _k < K:
        _k *= 2
        _count += 1

    _ans += float(1)/N*float(1)/2**_count

print _ans

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

namespace ABC172_A
{
    class Program
    {
        static void Main(string[] args)
        {
            int A = int.Parse(Console.ReadLine());

            int ans = A + (int)Math.Pow(A, 2) + (int)Math.Pow(A, 3);

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 27868
#include <stdio.h>
int main() {
  int a,b;
  scanf("%d %d",&a,&b);
  if (a<=0&&b>=0) {
    printf("Zero\n");
  } else if ((b-a)%2==0&&b<0) {
    printf("Negative\n");
  } else {
    printf("Positive\n");
  }
  return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		String N = sc.next();
		
		if (N.toCharArray()[0] == N.toCharArray()[2]) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 21844
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

const int MAX = 1000000;

int top, S[100];

void push(int x){
    // topを加算してからその位置へ挿入
    top++;
    S[top] = x;
}

int pop(){
    top--;
    // topが指していた要素を返す
    return S[top+1];
}

int main(){
    int a, b;
    top = 0;
    char s[100];
    
    while(scanf("%s", s) != EOF){
        if(s[0] == '+'){
            a = pop();
            b = pop();
            push(a + b);
        } else if(s[0] == '-'){
            b = pop();
            a = pop();
            push(a - b);
        } else if(s[0] == '*'){
            a = pop();
            b = pop();
            push(a * b);
        } else {
            push (atoi(s));  // 文字列を数字に変える関数atoi
        }
    }

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

	return 0;
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;


int main() { 
    int N,Q;
    cin >> N >> Q;
    string S;
    cin >> S;
    vector<int>l(Q),r(Q);
    REP(i,Q){
        cin >> l.at(i) >> r.at(i);
    }
    int ans = 0;
    vector<int> log;
    log.push_back(0);
    REP(i,N-1){
        char s = S.at(i);
        if(s == 'A'){
            if(S.at(i+1) == 'C'){
                ans += 1;
            }
        }
        log.push_back(ans);
    }
    
    
    REP(i,Q){
        cout << log.at(r.at(i)-1) - log.at(l.at(i)-1) << endl;
    }
    /*
   REP(i,N){
       cout << log.at(i) << endl;
   }
   */
}


Measured memory_bytes: 2296
fun main() {
    val digits = readLine()!!.map { it.toString().toInt() }

    var ans = 0
    var map = IntArray(2019)
    for (i in 0..digits.size - 1) {
        val d = digits[i]

        // map * 10 + d
        var cpy = IntArray(2019)
        for ((i, cnt) in map.withIndex()) {
            cpy[(10 * i + d) % 2019] = cnt
        }
        ans += cpy[0]
        cpy[d]++
        map = cpy
    }

    print(ans)
}


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

int main(){
  int i,j,cnt=0;
  int n;
  cin>>n;
  int L[2*n];
  for(i=0;i<2*n;i++)cin>>L[i];
  sort(L,L+2*n);
  for(i=0;i<n;i++)cnt+=L[2*i];
  cout<<cnt<<endl;
}

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

typedef long long ll;

using namespace std;

int dist(int dim, int* p, int* q){
	int dist = 0;
	for (int i = 0; i < dim; i++) {
		dist += (p[i] - q[i]) * (p[i] - q[i]);
	}

	return dist;
}

bool checkSqrtInt(int sq, int max) {
	for (int i = 1; i <= max; i++) {
		if (sq == i * i) return true;
	}
	return false;
}

int main(){
    int N, D;
    cin >> N >> D;
    int X[N][D];
    int ans = 0;
    for (int i = 0; i < N; i++) {
    	for (int j = 0; j < D; j++) {
    		cin >> X[i][j];
    	}
    }

    int distance = 0;
    for (int i = 0; i < N - 1; i++) {
    	for (int j = i + 1; j < N; j++) {
    		distance = dist(D, X[i], X[j]);
    		if (checkSqrtInt(distance, 127)) ans++;
    	}
    }

    cout << ans << endl;

}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main() {
    input! {
        a: String,
    }
    let s = a
        .chars()
        .map(|c| c.to_digit(10).unwrap() as i32)
        .sum::<i32>() as i32;

    println!("{}", s);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
const int INF= 1e9+5;
typedef long long ll;
int main(){
  int n;
  cin>>n;
  if(n==1){
    cout<<"Yes"<<endl;
    return 0;
  }
  vector<ll>h(n);
  bool ans=true;
  for(int i=0;i<n;i++)cin>>h[i];
  int x;
  int y;
  for(int i=n-1;i>=1;i--){
    x=h[i];
    y=h[i-1];
    if(y<=x)continue;
    else if(y-1==x)h[i-1]--;
    else if(y-1>x){
      ans=false;
      break;
    }
  }
  if(ans)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  //for(int i=0;i<n;i++)cout<<h[i]<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define i64 long long
#define all(x) x.begin(), x.end()
#define LB(x,v) lower_bound(all(x),v) - x.begin()
#define maxn (int)(1e5)
using namespace std;
int freq[maxn+2] = {0}, freqUpto[maxn+2];
int main() {
	// your code goes here
	
	int n,val,maxVal = 0, minVal = INT_MAX; 
	cin>>n;

	//vector<int>d(n);
	for(int i=0;i<n;i++) {
		cin>>val;
		freq[val]++;
		//d.push_back(val);
		maxVal = max(maxVal,val);
		minVal = min(minVal,val);
	}
	
	//sort(all(d));
	//for(int i=0;i<n;i++) printf("%d ",d[i]);
	//printf("%d\n",(int)(sum/(i64)n));
	
	for(val=minVal; val<=maxVal; val++) {
		freqUpto[val] = freq[val];
		if(val > minVal) freqUpto[val] += freqUpto[val-1];
	}
	
	int ans = 0;
	for(val=maxVal; val>=minVal; val--){
		int cnt = freqUpto[val];
		//printf("%d %d %d\n", val, cnt, n-cnt);
		if(cnt == n-cnt) ans++;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 1024
from __future__ import print_function

import sys
sys.setrecursionlimit(500000)

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

# from fractions import gcd
# from math import gcd

# def lcm(n, m):
#     return int(n * m / gcd(n, m))


# def coprimize(p, q):
#     common = gcd(p, q)
#     return (p // common, q // common)


# def find_gcd(list_l):
#     x = reduce(gcd, list_l)
#     return x


# def combinations_count(n, r):
#     r = min(r, n - r)
#     numer = reduce(mul, range(n, n - r, -1), 1)
#     denom = reduce(mul, range(1, r + 1), 1)
#     return numer // denom


# mod=1000000007
# def combinations_count_mod(n, r):
#     r = min(r, n - r)
#     numer = reduce(lambda x,y: x*y%mod, range(n, n - r, -1), 1)
#     denom = pow( reduce(lambda x,y: x*y%mod, range(1, r + 1), 1) , mod-2, mod)
#     return numer * denom % mod

def is_ok(p,n,k,w):
    #
    i_track = 0
    i_w = 0

    # トラックに積めるギリギリ(p)まで積んでいくことを繰り返していって，
    # i_w(w_index) を0 ~ n-1 まで全部積めたら嬉しいねぇ
    # 積載量pが小さすぎるゴミみてぇなトラックだったら先にトラックの数が尽きてしまって悲しいことになります
    # 積載量pが十分大きい素敵なトラックだったら i_w(w_index) = n - 1 まで到達できてとっても嬉しくなれます
    while i_track < k and i_w < n : # トラック全部
        temp=0
        while i_w < n and temp + w[i_w] <= p: #  一時積載tempがpを超えないギリギリを目指していけ
            temp += w[i_w]
            i_w+=1
        # ギリギリまで ，背番号i_trackのトラック ，つまり今見ているトラックに積載したら
        i_track += 1 #次のトラックに進みましょうね〜〜〜

    return i_w == n

def solve(n,k,w):
    # 
    ok = 10000 * 100000  # solve(ok)は解が存在すると分かっているような整数ok
    ng = -1                # solve(ng)は解が存在しない(と分かっているような整数ng
    ans = ok

    # abs(ok-ng) つまり ok と ng の絶対差ですね，これが1未満つまりokとngが等しいということになったらですね，終了するんですね
    while abs( ok - ng ) > 1: #abs(ok-ng) <= 1 というのはokとngがもうなんかね，アレなんですよ
        mid = (ok + ng) // 2
        # 
        if is_ok(mid,n,k,w):
            ok = mid
            ans = ok
        else:
            ng = mid
    return ans

def main():
    n,k  = map(int,input().strip().split())
    w=[]
    for i in range(n):
        w.append(int(input().strip()))
    print(solve(n,k,w))

if __name__ == '__main__':
    main()


Measured memory_bytes: 13128
#include <bits/stdc++.h> 
using namespace std; 
  
typedef long long int ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef pair<string, string> pss; 
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef vector<pii> vii; 
typedef vector<ll> vl; 
typedef vector<vl> vvl; 
  
double EPS = 1e-9; 
long long INF = 1000000000000000005ll; 
double PI = acos(-1); 
#define M 1000000007ll
#define D 998244353ll
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define oset tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound  
#define SQR(x) ((LL)(x) * (x)) 
#define RESET(a, b) memset(a, b, sizeof(a))
#define GCD(a,b) __gcd(a,b)
#define setbits(x)   __builtin_popcountll(x)
#define zerobits(x)  __builtin_ctzll(x) 
#define ps(x,y)  fixed<<setprecision(y)<<x
#define endl '\n'
#define ff first 
#define ss second 
#define mp make_pair  
#define ALL(v) v.begin(), v.end() 
#define ALLA(arr, sz) arr, arr + sz 
#define SIZE(v) (int)v.size() 
#define SORT(v) sort(ALL(v)) 
#define REVERSE(v) reverse(ALL(v)) 
#define SORTA(arr, sz) sort(ALLA(arr, sz)) 
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz)) 
#define PERMUTE next_permutation 
  
inline string IntToString(ll a) 
{ 
    char x[100]; 
    sprintf(x, "%lld", a); 
    string s = x; 
    return s; 
} 
  
inline ll StringToInt(string a) 
{ 
    char x[100]; 
    ll res; 
    strcpy(x, a.c_str()); 
    sscanf(x, "%lld", &res); 
    return res; 
} 
  
 
inline string uppercase(string s) 
{ 
    int n = SIZE(s); 
    for(ll i=0;i<n;i++) 
    if (s[i] >= 'a' && s[i] <= 'z') 
        s[i] = s[i] - 'a' + 'A'; 
    return s; 
} 
  
inline string lowercase(string s) 
{ 
    int n = SIZE(s); 
    for(ll i=0;i<n;i++) 
    if (s[i] >= 'A' && s[i] <= 'Z') 
        s[i] = s[i] - 'A' + 'a'; 
    return s; 
}
 
bool sortcol( const vector<ll>& v1, 
               const vector<ll>& v2 ) { 
 return v1[0] > v2[0]; 
} 
 
bool isPrime(ll n) 
{ 
    // Corner cases 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
  
    // This is checked so that we can skip  
    // middle five numbers in below loop 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
 
int main() {
    FAST
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ll k;
    cin>>k;
    ll sum=0;
    for(ll i=1;i<=k;i++){
    	for(ll j=1;j<=k;j++){
    		for(ll q=1;q<=k;q++){
    			sum+=GCD(GCD(i,j),q);
    		}
    	}
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 3620
# 1 "b.cpp"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "b.cpp"
# 1 "/home/tysm/dev/cpplib/bin/../include/cpplib/stdinc.hpp" 1
       
# 11 "/home/tysm/dev/cpplib/bin/../include/cpplib/stdinc.hpp"
# 1 "/home/tysm/dev/cpplib/bin/../stdlib/bits/stdc++.h" 1
 #include<bits/stdc++.h>
# 12 "/home/tysm/dev/cpplib/bin/../include/cpplib/stdinc.hpp" 2
# 1 "/home/tysm/dev/cpplib/bin/../stdlib/ext/pb_ds/assoc_container.hpp" 1
 #include<ext/pb_ds/assoc_container.hpp>
# 13 "/home/tysm/dev/cpplib/bin/../include/cpplib/stdinc.hpp" 2
# 1 "/home/tysm/dev/cpplib/bin/../stdlib/ext/pb_ds/tree_policy.hpp" 1
 #include<ext/pb_ds/tree_policy.hpp>
# 14 "/home/tysm/dev/cpplib/bin/../include/cpplib/stdinc.hpp" 2
# 23 "/home/tysm/dev/cpplib/bin/../include/cpplib/stdinc.hpp"
using namespace std;
using namespace __gnu_pbds;

using ii = pair<int64_t, int64_t>;
using tt = tuple<int64_t, int64_t, int64_t>;

using vi = vector<int64_t>;
using vd = vector<double>;
using vb = vector<bool>;
using vii = vector<ii>;
using vtt = vector<tt>;

using vvi = vector<vi>;
using vvd = vector<vd>;
using vvb = vector<vb>;
using vvii = vector<vii>;
using vvtt = vector<vtt>;
# 60 "/home/tysm/dev/cpplib/bin/../include/cpplib/stdinc.hpp"
template<typename T>
ostream &operator<<(ostream &lhs, const vector<T> &rhs)
{
    if(is_floating_point<T>::value)
        lhs << fixed << setprecision(10);
    for(size_t i = 0; i < rhs.size(); ++i) {
        if(i)
            lhs << ' ';
        lhs << rhs[i];
    }
    return lhs;
}

template<typename T, size_t N>
ostream &operator<<(ostream &lhs, const array<T, N> &rhs)
{
    if(is_floating_point<T>::value)
        lhs << fixed << setprecision(10);
    for(size_t i = 0; i < rhs.size(); ++i) {
        if(i)
            lhs << ' ';
        lhs << rhs[i];
    }
    return lhs;
}
# 2 "b.cpp" 2

int32_t main(){
    (ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL));
    string s, t;
    cin >> s >> t;

    int64_t n = s.size(), m = t.size();

    int64_t ans = ((int64_t)2e9 + 1);
    for(int64_t i=0; i+m-1<n; ++i){
        int64_t acc = 0;
        for(int64_t j=0; j<m; ++j)
            acc += (s[i+j] != t[j]);
        ans = min(ans, acc);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3612
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math
MOD = 10**9+7
# MOD = 998244353

n, k = map(int, input().split())
A = list(map(int, input().split()))

visited = dict()
rvs = dict()
cur = 0
num = 0
while True:
    if cur in visited:
        # print(visited)
        # print(rvs)
        s = visited[cur]
        roop = num - s
        kk = (k-s)%roop
        # print(s, roop, kk, kk+s)
        print(rvs[kk+s]+1)
        exit()
    if num == k:
        print(cur+1)
        exit()
    else:
        visited[cur] = num
        rvs[num] = cur
        cur = A[cur]-1
        num += 1



Measured memory_bytes: 130424
#include <iostream>
#include <algorithm>
#include <cctype>

using namespace std;

string puzzle[9];
int pl2id[9], pl2rot[9];

bool check(char a, char b) {
  return toupper(a) == toupper(b) && a != b;
}

int dfs(int k, bool *used) {
  if(k == 9) return 1;
  
  int ret = 0;
  for(int id=0; id<9; id++) {
    if(used[id]) continue;

    for(int rot=0; rot<4; rot++) {
      // 0: left 1: up 2: right 3: down
      bool ok = true;
      // テ、ツクツ甘」ツ?ィテ、ツクツ?ィツ?エ
      if(k > 2) ok &= check(puzzle[id][(rot+1)%4], puzzle[pl2id[k-3]][(pl2rot[k-3]+3)%4]);
      // テ・ツキツヲテ」ツ?ィテ、ツクツ?ィツ?エ
      if(k % 3) ok &= check(puzzle[id][rot], puzzle[pl2id[k-1]][(pl2rot[k-1]+2)%4]);
      
      if(ok) {
	pl2id[k] = id;
	pl2rot[k] = rot;
	used[id] = true;
	ret += dfs(k+1, used);
	used[id] = false;
      }
    }
  }
  
  return ret;
}

int main() {
  int n;
  cin >> n;
  while(n--) {
    for(int i=0; i<9; i++) {
      cin >> puzzle[i];
    }
    
    bool used[9] = {};
    cout << dfs(0, used) << endl;
  }
  
  return 0;
}

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

int main() {
	int n;
	cin >> n;
	vector<int> h(n);
	rep(i, n)cin >> h[i];

	int ans = 0;
	int H = 0;
	rep(i, n-1) {
		if (h[i] >= h[i + 1]) {
			H++;
		}
		else {
			H = 0;
		}
		ans = max(H, ans);
	}
	cout << ans << endl;
}

Measured memory_bytes: 640
main = do
  n <- readLn
  putStrLn .show $ solve n

solve:: Int -> Int
solve n
  | n < 2 = 1
  | n < 4 = 2
  | n < 8 = 4
  | n < 16 = 8
  | n < 32 = 16
  | n < 64 = 32
  | otherwise = 64

Measured memory_bytes: 508
while True:
	try:
		a,b,c,d,e,f = map(int,input().split())
	except:
		break
	y = (c * d - a * f) / (b * d - a * e)
	x = (c - b * y) / a
	xs = str(round(x,3))
	ys = str(round(y,3))
	while xs[::-1].find(".") < 3:
		xs += "0"
	while ys[::-1].find(".") < 3:
		ys += "0"
	print(xs,ys)

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

int main()
{
    string s;
    cin >> s;
    int ans = 0;
    bool lb = s[0] == 'B';
    for (int i = 1; i < (int)s.size(); i++)
    {
        if ((s[i] == 'B') != lb)
        {
            ans++;
            lb = !lb;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3700
S = input()
tmp = S
ans = "AKIHABARA"
count = 0
tmp_count = 0

for c in ans:
    if c == S[count]:
        count+=1
        tmp_count+=1
    else:
        tmp = tmp[:tmp_count]+"A"+tmp[tmp_count:]
        tmp_count+=1
    if len(S) == count:
        break

if tmp == ans or tmp == "AKIHABAR":
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define F first
#define S second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <ll> vl;

const int N = 1e5 + 123;
ll n, a[N], d[N];

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	cin >> n;
	ll s = 0;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		s += a[i];
	}
	if (n == 1) {
		cout << "YES";
		return 0;
	}
	ll step = n * (n + 1) / 2;
	if (s % step) {
		cout << "NO";
		return 0;
	}
	s /= step;
	for (int i = 1; i <= n; i++) {
		a[i] -= s * i;
	}
	for (int i = 1; i <= n; i++) {
		d[i] = a[i] - a[i - 1];
	}
	for (int i = 2; i <= n; i++) {
		if (d[i] > 0 || (-d[i]) % n) {
			cout << "NO";
			return 0;
		}
		ll num = (-d[i]) / n;
		d[1] -= num * (n - (i - 1));
	}
	if (d[1] == 0) {
		cout << "YES";
	}	else {
		cout << "NO";
	}
}


Measured memory_bytes: 1920
//by Top1
#include <bits/stdc++.h>
     
#define f first
#define s second
#define int long long
#define ld long double
#define ull unsigned long long
#define pii pair <int, int>
#define pll pair <long, long>
#define mp make_pair
#define pb push_back
#define pf push_front
#define pp pop_back
#define rev reverse
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define forn(i, a, b) for (int i = a; i <= b; i++)
#define boost ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0);
#define nxtp next_permutation
#define pvtp prev_permutation
#define KZ return 
#define x1 x21212121
#define y1 y21212121
#define sqr(x) x * x 
 
const int inf = (1e9) + 1;
const int mod = 1e9 + 7;
const int maxn = 4e6 + 111;
     
using namespace std;

int n, q, dp[maxn], a[25][25];

void solve(){  
	cin >> n;

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

	dp[0] = 1;

	for (int mask = 0; mask < (1 << n); mask++){
		int k = __builtin_popcount(mask);
		//cout << k << endl;
		for (int i = 0; i < n; i++)
			if (a[k][i] == 1 && (mask & (1 << i)) == 0){
				dp[mask | (1 << i)] += dp[mask];
				dp[mask | (1 << i)] %= mod;
			}
	}

	cout << dp[(1 << n) - 1];
}

main(){
    boost;
	    
	q = 1;

	while (q--){
		solve();
	}
}

Measured memory_bytes: 18688
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

ll gcd(ll a, ll b) {return (!b ? a : gcd(b, a % b));}

const ll mod = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;
const ld pi = 3.141592653589793;

void solve(){
   int n;
   cin >> n;
   cout << fixed << setprecision(10);
   if(n%2){
     double t = n/2+1;
     cout << t/n;
   }
   else{
    double t = n/2;
    cout <<t/n;
   }
   return;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}

Measured memory_bytes: 3800