akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  int a[n];
  for(int i=0;i<n;i++)cin >> a[i];
  sort(a,a+n);
  int d=0;
  for(int i=0;i<k;i++){
    d+=a[n-i-1];
  }
  cout << d;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n , k ; 
    string s ;
    //k文字目を小文字に書き換える　つまりk-1番目を小文字にする
    cin >> n >> k ;
    cin >>s ;
    if(s.at(k-1) =='A'){s.at(k-1)='a';}
    else if(s.at(k-1) =='B'){s.at(k-1)='b';}
    else if(s.at(k-1) =='C'){s.at(k-1)='c';}

        cout <<s <<endl; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef std::pair<int, int> P;

#define MAX 1000
#define LEN 10
#define INFTY 10001

char field[MAX][MAX];
P targets[LEN];
int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1};
int H, W, N;
char idxs[10] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};

int bfs(const int &sx, const int &sy, const int &idx) {

    std::queue<P> que;
    int d[H][W];
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            d[i][j] = INFTY;
        }
    }

    que.push(P(sx, sy));

    d[sx][sy] = 0;

    while (que.size()) {

        P p = que.front(); que.pop();;

        if (p.first == targets[idx].first && p.second == targets[idx].second) break;

        for (int i = 0; i < 4; i++) {

            int nx = p.first + dx[i]; int ny = p.second + dy[i];

            if (0 <= nx && nx < H && 0 <= ny && ny < W && (field[nx][ny] != 'X') && d[nx][ny] == INFTY) {
                que.push(P(nx, ny));
                d[nx][ny] = d[p.first][p.second] + 1;
            }
        }
    }

    return d[targets[idx].first][targets[idx].second];
}



int main()
{

    int sx, sy; //start point
    std::cin >> H >> W >> N;
    int idx;
    char tmp;
    int sum = 0;

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            std::cin >> tmp;
            field[i][j] = tmp;
            if (tmp != '.' && tmp != 'X') {
                idx = (int) tmp - '0';
                targets[idx] = std::make_pair(i, j);
            }
            if (tmp == 'S') {
                sx = i; sy = j;
            }
        }
    }

   sum += bfs(sx, sy, 1);
   for (int i = 1; i < N; i++) {
       sx = targets[i].first; sy = targets[i].second;
       sum += bfs(sx, sy, i+1);
   }
   std::cout << sum << std::endl;

    return 0;
}



Measured memory_bytes: 7976
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define P pair<int,int>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define endl '\n'
#define ll long long

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

    int cnt = 0;
    while(n){
        n /= k;
        cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
n,a,b=map(int, input().split()) 
total = 0
for i in range(1,n+1):
  m = i
  wa = 0
  while True:
    wa += m % 10
    m = m // 10
    if (m == 0):
      break
  if (wa >= a)and(wa <= b):
    total += i
print(total)

Measured memory_bytes: 3060
package main

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

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

func lcm(a, b int) int {
	return (a*b)/gcd(a,b)
}
func calc(arr []string, times int) {
	tmpLcm, _ := strconv.Atoi(arr[0])
	for i := 1; i < len(arr); i++ {
		b, _ := strconv.Atoi(arr[i])
		tmpLcm = lcm(tmpLcm, b)
	}
	count := 0
	for i := 0; i < len(arr); i++ {
		tmp, _ := strconv.Atoi(arr[i])
		count += tmpLcm/tmp
	}
	fmt.Println(float64(tmpLcm)/float64(count))
}

func main() {

	reader := bufio.NewReaderSize(os.Stdin, 1024*1024)
	times, _:= strconv.Atoi(readLine(reader))
	arr := strings.Split(readLine(reader), " ")
	calc(arr, times)
}

func readLine(reader *bufio.Reader) string {
	str, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}
	return strings.TrimRight(string(str), "\r\n")
}

Measured memory_bytes: 640
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] p = new int[n];
        int cnt = 0;

        for(int i = 0;i < n;i++){
            p[i] = sc.nextInt();
        }

        for(int i = 0;i < n;i++){
            if(p[i] != i+1)
            cnt++;
        }
        System.out.println(cnt == 0 || cnt == 2 ?"YES":"NO");
    }
}

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

int top = 0,S[1000];

void push(int x){
	S[++top] = x;
}

int pop(void){
	top--;
	return S[top+1];
}

int main(void){
	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));
		}
	}
	printf("%d\n",pop());
	
	return 0;
}




Measured memory_bytes: 2112
import copy

def main():

    N,T = map(int,input().split())
    targetList = [list(map(int,input().split())) for _ in range(N)]
    TLE=99999999    

    ans=min((i if j <= T else TLE for i,j in targetList))
    print(ans) if ans != TLE else print("TLE")

if __name__== "__main__":
    main() 


Measured memory_bytes: 3436
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp> 
//using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define f0(i,a,b) for(int i=a;i<b;i++)
#define f1(i,a,b) for(int i=a;i<=b;i++)
#define f2(i,a,b) for(int i=a;i>b;i--)
#define f3(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define int long long
#define fi first
#define se second
#define ncr(n,r) fact[n]*modInv(fact[r])*modInv(fact[n-r])
#define mod 1000000007
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define make_graph(k) int x,y; f0(i,0,k){cin>>x>>y; adj[x].pb(y); adj[y].pb(x);}
#define test int t;cin>>t;while(t--)

signed main()
{
    fast

    int n;
    cin>>n;

    int a = 0;
    int w = 0;
    int t = 0;
    int r = 0;

    string s;
    f0(i,0,n)
    {
        cin>>s;
        if(s=="AC") a++;
        else if(s=="WA") w++;
        else if(s=="TLE") t++;
        else if(s=="RE") r++;
    }

    cout<<"AC x "<<a<<'\n';
    cout<<"WA x "<<w<<'\n';
    cout<<"TLE x "<<t<<'\n';
    cout<<"RE x "<<r<<'\n';
}

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

// (1) ??¢??????????????????????????°???????´??????????????????°count???????????????
// (2) ??????????????????????????????
// (3) ??????????????????????????????????????°?????????1??????????????\?????????????????????
	// (4.1) ????±???¨??????1?????????Char??????????????????
		// (4.1.1)??¢???????????????????????°???????????\?????????????????????
			// (4.1.1.1) ??????????????????????´?????????¢????????????????????¨
            //		     ????±???¨??????1?????????ASCII?????????????????´????????´????????\?????????????????????
				// (4.1.1.1.1) ?????°count?????°???????¢???????
			// (4.1.1.2) ?????????????±???¨??????1???????????§???????????´????????\?????????????????????
				// (4.1.1.2.1) ?°??????????????????????
					// (4.1.1.2.1.1) ??????????°??????????????????????????????¨
                    //               ????±???¨??????1?????????ASCII?????????????????´????????´?????\?????????????????????
						// (4.1.1.2.1.1.1) count?????°???????¢???????
		// (4.1.2) ??¢???????????????????????°????????\?????????????????????
			// (4.1.2.1) ??¢????????????????????¨count??????????????¨?????????

public class Main {

	public static void main(String[] args) throws IOException {
		final char ASCII_CODE_BASE = 97;

		int counts[] = new int[26];


		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str;
		while((str = br.readLine()) != null) {

			for (int i = 0; i < str.length(); i++) {
				char c = str.charAt(i);
				if(Character.isAlphabetic(c)) {
					char lowerChar = Character.toLowerCase(c);
					counts[lowerChar - ASCII_CODE_BASE]++;
				}
			}
		}

		for (int i = 0; i < counts.length; i++) {
			System.out.println((char)(i+ASCII_CODE_BASE) + " : " + counts[i]);
		}
	}
}

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl

int main(){
    int h,w;
    cin >> h >> w;
    string cham[50];
    REP(i,h){
        cin >> cham[i];
    }
    
    const int dx[8] = {1,0,-1,0};
    const int dy[8] = {0,1,0,-1};

    bool flag = true;
    REP(i,h){
        REP(j,w){
            if(cham[i][j]=='.')continue;
            int num = 0;
            for(int d=0;d<4;d++){
                const int ny = i + dy[d];
                const int nx = j + dx[d];
                //場外アウト
                if(ny<0||h<=ny){
                    num++;
                    continue;
                }
                if(nx<0||w<=nx){
                    num++;
                    continue;
                }
                //移動先が'#'
                if(cham[ny][nx]=='.')num++;
            }
            if(num==4)flag = false;
        }
    }
    if(flag)COUT("Yes");
    else COUT("No");
    return 0;
}
  

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

ll A[500005];
ll dp[500005];

void I_m_Beast()
{	
	int n;
	cin>>n;
	assert(1<=n && n<=500000);
	string s;
	cin>>s;
	for(int i=1;i<=n;i++) {
		// cin>>A[i];
		A[i]=s[i-1]-'0';
		assert(0<=A[i] && A[i]<=1000000);
	}
	A[0]=-1;
	ll cum[n+1],idx[n+1];
	cum[0]=idx[0]=0;

	for(int i=1;i<=n;i++) {
		if(A[i]==0)
			idx[i]=i;
		else
			idx[i]=idx[i-1];
		cum[i]=cum[i-1]+A[i];
		dp[i]=0;
	}
	dp[0]=0;
	for(int i=3;i<=n;i++) {
		dp[i]=dp[i-1];
		if(A[i]!=0) {
			if(A[i-1]==0 && A[i-2]!=0) {
				int x=idx[i-2];
				dp[i]=max(dp[i],dp[x]+cum[i-3]-cum[x]+max(A[i],A[i-2]));
				if(x+1!=i-2)
				dp[i]=max(dp[i],dp[x+1]+cum[i-3]-cum[x+1]+max(A[i],A[i-2]));
			}
			else if(A[i-1]!=0) {
				int x=idx[i];
				if(x>1 && A[x-1]!=0)
				dp[i]=max(dp[i],dp[x-2]+cum[i]-cum[x+1]+max(A[x-1],A[x+1]));
			}
		}
	}
	cout<<dp[n]<<endl;
	return ;
}

int main()
{
	fastio;
	int t=1;
	// cin>>t;
	assert(1<=t && t<=1000);
	while(t--)
	{
		I_m_Beast();
	}	
	return 0;	
}


Measured memory_bytes: 19556
#include <iostream>

int main()
{
	int N,i,j, size;
	int a[100];

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

	//バブルソート

	int tmp;
	for (i = 0 ; i < N; i++) {
		for (j = N-1 ; j > i ; j-- ) {
			if (a[j] > a[j-1]) {
				tmp = a[j-1];
				a[j - 1] = a[j];
				a[j] = tmp;
			}
		}
	}

  	//printf("\n");
	int A, B;
	A = 0;
	B = 0;
	for (i = 0; i < N; i++) {
      
      	//printf("%d ",a[i]);
		if (i%2 == 0) {
			A += a[i];
		}
		else {
			B += a[i];
		}
	}

	printf("%d", A - B);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long cc;

cc N, K, Ans, i, j, k, a[200000], sub = 0;
cc judge[200000][35], kai[35], A = 0;

string S;


int main() {
	for (i = 0; i <= 30; i++)
		kai[i] = pow(2, i);
	
	cin >> N;
	for (i = 0; i < N; i++) {
		cin >> a[i];
		for (j = 0; j <= 30; j++) {
			if (kai[30 - j] <= a[i]) {
				judge[i][30 - j] = 1;
				a[i] -= kai[30 - j];
			}
			else
				judge[i][30 - j] = 0;
		}
	}
	
	for (j = 0; j <= 30; j++) {
		for (i = 0; i < N; i++) {
			if (judge[i][30 - j] == 1)
				sub += 1;
		}
		if (sub % 2 == 1) {
			A = 1;
			break;
		}
		sub = 0;
	}

	if (A == 0)
		cout << "Yes";
	else
		cout << "No";
	cout << endl;
	return 0;
}

Measured memory_bytes: 31232
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#define ll long long
//vector<int> g1;
//g1.push_back(i);

using namespace std;

int main()
{
	ll a,b,temp;
	cin >> a >> b;
	ll a1 = a;
	ll b1 = b;
	while(b!=0)
	{
		a = a%b;
		temp = a;
		a = b;
		b = temp;
	}
	b = a1*b1/a;
	cout << b;
	
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <iostream>

int main(void) {
	int N, T, A;
	std::cin >> N >> T >> A;
	int loc, x;
	double dif;
	loc = 1;
	dif = 10000000;
	for (int i = 0; i < N; i++) {
		std::cin >> x;
		double H = (T - x * 0.006);
		double _dif = H > A ? H - A : A - H;
		if (_dif < dif) {
			dif = _dif;
			loc = i + 1;
		}
	}
	std::cout << loc;
	return EXIT_SUCCESS;
}


Measured memory_bytes: 256
const INF = 10**9
var lines=[];
var reader = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout
});
reader.on('line', function (line) {
    lines.push(line);
});
reader.on('close', function () {
    const N = +lines[0];
    const h = lines[1].split(" ").map(x => +x);
    let dp = [];
    for (let i= 0; i < N; i++) {
        dp.push(INF);
    }
    dp[0] = 0;

    for (let i=1; i < h.length; i++) {
        dp[i] = Math.min(dp[i], dp[i - 1] + Math.abs(h[i - 1] - h[i]));
        if (i > 1) {
            dp[i] = Math.min(dp[i], dp[i - 2] + Math.abs(h[i - 2] - h[i]));
        }
    }
    console.log(dp[N - 1])
});

Measured memory_bytes: 41988
#include <iostream>
using namespace std;
int main() {
    int INF = 1ll << 29;
    int N, T; cin >> N >> T;
    int c[N], t[N]; for (int i = 0; i < N; ++i) cin >> c[i] >> t[i];
    int res = INF;
    for (int i = 0; i < N; ++i) {
        if (t[i] <= T) res = min(res, c[i]);
    }
    if (res != INF) cout << res << endl;
    else cout << "TLE" << endl;
}


Measured memory_bytes: 256
#include <iostream>

int main() {
    long long int k,n,tmp,one;
    std::cin >> n >> k;
    for (long long int i = 0; i < n; i++) {
        std::cin >> tmp;
        if (tmp == 1) one = i;
    }

    long long int ret = 0, ret2 = 0;
    if (one > 0) {
        ret += one / (k - 1) + ((one % (k - 1) > 0) ? 1 : 0);
    }
    if (one != n - 1) {
        ret += (n - one - 1) / (k - 1) + (((n - one - 1) % (k - 1) > 0) ? 1 : 0);
    }

    if (one > 0 && one < n - 1) {
        ret2 = (n - 1) / (k - 1) + (((n - 1) % (k - 1) > 0) ? 1 : 0);
    } else {
        ret2 = ret + 1;
    }

    
    std::cout << ((ret<ret2) ? ret : ret2) << std::endl;

    return 0;
}

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

const int maxhplusw = 2e5 + 5, MOD = 1e9 + 7;

int h, w, a, b, fact[maxhplusw], invfact[maxhplusw];

int mod_expo(int x, int p)
{
    if(!p)
        return 1;
    long long res = mod_expo(x, p / 2);
    res *= res;
    res %= MOD;
    if(p & 1)
        res *= x;
    return res % MOD;
}

int mod_inv(int x)
{
    return mod_expo(x, MOD - 2);
}

int nCr_mod(int n, int r)
{
    if(n < r)
        return 0;
    int num = fact[n];
    int invdenom = (invfact[r] * 1ll * invfact[n - r]) % MOD;
    return (num * 1ll * invdenom) % MOD;
}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    fact[0] = invfact[0] = 1;
    for(int i = 1; i < maxhplusw; i++)
    {
        fact[i] = (fact[i - 1] * 1ll * i) % MOD;
        invfact[i] = mod_inv(fact[i]);
    }
    cin >> h >> w >> a >> b;
    long long ans = 0;
    int up = h - a - 1; // Number of steps down to just above blocked area
    int down = a - 1;   // Number of steps down from row at top of blocked area
    for(int i = b + 1; i <= w; i++)
    {
        int upper = nCr_mod(up + (i - 1), up);
        int lower = nCr_mod(down + (w - i), down);
        ans += (upper * 1ll * lower) % MOD;
        ans %= MOD;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 5212
//#if 1
//#include"pch.h"
//#define _CRT_SECURE_NO_WARNINGS
//#endif
#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;
int main() {
	int a, b, c;
  cin>>a>>b>>c;
	if (a + b >= c)puts("Yes");
	else puts("No");

	return(0);
}

Measured memory_bytes: 256
import scala.io.StdIn.{readInt, readLine}
object Main {
    def main(args: Array[String]): Unit = {
        readInt
        val arr = readLine.split(" ").map(_.toInt)
        val (ret, cnt) = selectionSort(arr)
        println(ret.mkString(" "))
        println(cnt)
    }
    
    def selectionSort(arr: Array[Int]): (Array[Int], Int) = {
        def min(arr: Array[Int], ptr: Int): Int = {
            if ((arr.length - 1) == ptr) return ptr
            min(arr, ptr + 1) match {
                case m if arr(m) < arr(ptr) => m
                case _ => ptr
            }
        }
        def swap(arr: Array[Int], a: Int, b: Int): Unit = {
            val tmp = arr(a)
            arr(a) = arr(b)
            arr(b) = tmp
        }
        var cnt = 0
        val copy = new Array[Int](arr.length)
        arr.copyToArray(copy)
        (0 until copy.length).foreach {i =>
            val m = min(copy, i)
            if (m != i) {swap(copy, m, i); cnt += 1}
        }
        (copy, cnt)
    }
}


Measured memory_bytes: 43968
n, a, b = map(int, input().split())
mi = 1000000
ma = -5
for x in range(0, n + 1):
    if not 0 <= x <= a:continue
    if not 0 <= x <= b:continue
    if not 0 <= n - a - b + x <= n - a: continue
    if not 0 <= n - a - b + x <= n - b: continue
    mi = min(mi, x)
    ma = max(ma, x)
print(ma, mi)


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

#define x first
#define y second
#define ndl '\n'
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)x.size()
#define bit __builtin_popcount
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;
using namespace __gnu_pbds;

template<typename T> using indexed_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<int, ull> piu;
typedef vector<vector<int>> matrix;

const ll INF = 1e18 + 123;
const ld EPS = 1e-9;
const int inf = 1e9 + 123;
const int MOD = 1e9 + 7;
const int N = 5e5 + 123;
const int M = 1e6 + 123;
const double pi = acos(-1.0);
const int dx[] = {0, 0, 1, -1};
const int dy[] = {1, -1, 0, 0};

bool check(ll n, ll d){
    while (n % d == 0) n /= d;
    return n % d == 1;
}

void solve(){
    ll n;
    cin >> n;
    set<ll> s;
    for (ll i = 1; i*i <= n; i++){
        if (n % i == 0){
            if (i > 1 && check(n, i)) s.insert(i);
        }
    }
    s.insert(n);
    n--;
    for (ll i = 1; i*i <= n; i++){
        if (n % i == 0){
            s.insert(i);
            s.insert(n/i);
        }
    }
    s.erase(1);
    cout << sz(s);
}

int main(){
    #ifdef KAZAKH
        freopen("input.txt", "r", stdin);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    //cin >> t;
    for (int i = 1; i <= t; i++){
        //cout << "case #" << i << ": ";
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0;}

int main() {
    int n,k;
    cin >> n >> k;
    string s;
    cin >> s;
    //0の個数と1の個数をカウントして配列に保存
    vector<int>nums;
    if(s[0] == '1') nums.push_back(0);
    int cur = 1;
    rep(i,n-1) {
        if(s[i] == s[i+1]) cur++;
        else {
            nums.push_back(cur);
            cur = 1;
        }
    }
    nums.push_back(cur);
    //累積和をとる
    int m = nums.size();
    vector<int>sum(m+1);
    sum[0] = 0;
    rep(i,m) sum[i+1] = sum[i] + nums[i];
    //区間の最大値を計算
    int ans = 0;
    for(int left = 0;left<m;left += 2) {
        int right = min(m-1,left+2*k-1);
        int tmp = sum[right+1] - sum[left-1];
        ans = max(ans,tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 4188
from collections import deque
n = int(input())

if n % 2 == 1:
    print(0)
    exit()
# 10のべき乗の数を数えましょうという問題
divider = 10
keta_count = []
while True:
    count = n // divider
    divider *= 5
    keta_count.append(count)
    if (count == 0):
        break
print(sum(keta_count))


Measured memory_bytes: 3316
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::{Cell, Ref, RefCell, RefMut};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    let (a, b): (usize, usize) = read!(usize, usize);

    let mut ans = 0;
    for x in a..(b + 1) {
        let s = x.to_string().chars().collect::<Vec<char>>();
        let mut s_cp = s.clone();
        s_cp.reverse();
        if s.into_iter().collect::<String>() == s_cp.into_iter().collect::<String>() {
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
N = int(input())
P = list(map(int, input().split()))

ans = 0

for i in range(N):
    if P[i] == i + 1:
        if i + 1 < N:
            P[i], P[i + 1] = P[i + 1], P[i]
        ans += 1
print(ans)


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

using namespace std;

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

const long long MOD = 1e9 + 7;
const int INF = 1e9;
const double EPS = 1e-9;

int main() {
  int N;
  cin >> N;
  vector<int> H(N);
  for (int i = 0; i < N; ++i) cin >> H[i];
  bool ok = true;
  for (int i = 0; i < N - 1; ++i) {
    if (H[i] - 1 > H[i + 1]) {
      ok = false;
      break;
    }
    if (i == 0) H[i]--;
    else {
      if (H[i] - 1 >= H[i - 1]) H[i]--;
      if (H[i] < H[i - 1] || H[i] > H[i + 1]) {
        ok = false;
        break;
      }
    }
  }
  cout << (ok ? "Yes" : "No") << endl;
}

Measured memory_bytes: 640
import java.util.Scanner;

/**
 *
 * @author C0117306
 */
public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String x = sc.next();
        int cx=0,cy=0;
        String y=sc.next();
        String[] hai={"A","B","C","D","E","F"};
        for (int i = 0; i < hai.length; i++) {
            if (x.equals(hai[i])) {
               cx=i;
            }
            if (y.equals(hai[i])) {
                cy=i;
            }
        }
        if(cx<cy){
            System.out.println("<");
        }else if(cx>cy){
            System.out.println(">");
        }else{
            System.out.println("=");
        }
       
    }
    
}


Measured memory_bytes: 21588
s = []
2.times do
  s << gets.chomp
end
s[0] = s[0].split(//).sort.join
s[1] = s[1].split(//).sort.reverse.join
if s.uniq.size != 1
  puts s.sort == s ? 'Yes' : 'No'
else
  puts 'No'
end

Measured memory_bytes: 1788
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int T = sc.nextInt();
		int[] c = new int[n];
		int[] t = new int[n];
		for(int i = 0; i < n; i++) {
			c[i] = sc.nextInt();
			t[i] = sc.nextInt();
		}
		int minCost = 1001;
		for(int i = 0; i < n; i++) {
			if(t[i] <= T && c[i] < minCost) {
				minCost = c[i];
			}
		}
		if(minCost == 1001) {
			System.out.println("TLE");
		} else {
			System.out.println(minCost);
		}
	}
}

Measured memory_bytes: 22100
def cmb(n, r, p):
	if (r<0) or (n<r):
		return 0
	r=min(r, n-r)
	return fact[n]*factinv[r]*factinv[n-r]%p

p=10**9+7
N=10**6
fact=[1,1]
factinv=[1,1]
inv=[0,1]

for i in range(2, N+1):
	fact.append((fact[-1]*i)%p)
	inv.append((-inv[p%i]*(p//i)%p))
	factinv.append((factinv[-1]*inv[-1])%p)


N=int(input())
A=list(map(int,input().split()))
index=[-1]*N
for i,a in enumerate(A):
    if index[a-1]!=-1:
        dup_first,dup_second=index[a-1],i
        break
    index[a-1]=i

mod=10**9+7
n=dup_first
m=N-dup_second
l=n+m
for k in range(1,N+2):
    if k==1:
        print(N)
        continue
    ans=(cmb(N+1,k,mod)-cmb(l,k-1,mod))%mod
    print(ans)

Measured memory_bytes: 132708
#include <iostream>
#include <float.h>
#include <math.h>
using namespace std;
int main() {
   double X,M;
  int i;
  M=100.000000000000000000;
  cin>>X;
  for(i=1;;i++){
  M+=floor(M/100);
    if(M>=X){break;}
  }
  cout<<i;
}


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

typedef long long ll;
const int MOD = 1000000007;

int main() {
    ll n, k;
    cin >> n >> k;

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

    ll sw = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (a[i] > a[j]) {
                sw += k * (k + 1) / 2; 
                sw %= MOD;
            } else if (a[i] < a[j]) {
                sw += k * (k - 1) / 2;
                sw %= MOD;
            }
        }
    }

    cout << sw << endl;

    return 0;
}

Measured memory_bytes: 256
def dist(p1,p2)
	Math.sqrt((p1[0]-p2[0])**2+(p1[1]-p2[1])**2)
end

n=gets.to_i
n.times{
	input=gets.chomp.split(" ").map{|s| s.to_f}
	d=dist([input[0],input[1]],[input[3],input[4]])
	if d>input[2]+input[5] then
		puts 0
	elsif input[5]>d+input[2] then
		puts -2
	elsif input[2]>d+input[5] then
		puts 2
	else
		puts 1
	end
}


Measured memory_bytes: 6868
# AtCoder Beginner Contest 100
# C - *3 or /2
def f(N,c):
    if N%2==0:
        n=N//2
        c+=1
        return f(n,c)
    else:
        return c



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

count=0

for a in A:
    count+= f(a,0)

print(count)
    

Measured memory_bytes: 10132
while True:
    n, x = map(int, input().split())
    if n == 0 and x == 0:
        break

    ans = 0
    for a in range(1, n-1):
        for b in range(a+1, n):
            for c in range(b+1, n+1):
                if a+b+c == x:
                    ans +=1
                    
    print(ans)


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

using namespace std;

const int INF = 1 << 30;

int main()
{
  int D, N, T[200], A[200], B[200], C[200];

  cin >> D >> N;
  for(int i = 0; i < D; i++) cin >> T[i];
  for(int i = 0; i < N; i++) cin >> A[i] >> B[i] >> C[i];

  vector< int > curr(N, -INF);
  for(int i = 0; i < N; i++) {
    if(A[i] <= T[0] && T[0] <= B[i]) curr[i] = 0;
  }
  for(int i = 1; i < D; i++) {
    vector< int > next(N, -INF);
    for(int j = 0; j < N; j++) {
      for(int k = 0; k < N; k++) {
        if(A[k] <= T[i] && T[i] <= B[k]) {
          next[k] = max(next[k], curr[j] + abs(C[j] - C[k]));
        }
      }
    }
    curr.swap(next);
  }
  cout << *max_element(begin(curr), end(curr)) << endl;
}

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

int main() {
    ll x;
    cin >> x;

    for (ll a = -120; a < 120; a++) {
        for (ll b = -120; b < 120; b++) {
            if (pow(a, 5) - pow(b, 5) == x) {
                cout << a << ' ' << b << endl;
                return 0;
            }
        }
    }

    return 0;
}


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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define all(x) begin(x), end(x)
typedef long long ll;
typedef pair<int, int> pii;
const int inf=1010001000;
const ll  INF=1001000100010001000;
const int mod=998244353;//(int)1e9+7;


vector<long long> fact, fact_inv, inv;   //fact[i]=i!   
void init_nCk(int SIZE) {                //inv[i]=i^(-1)           
    fact.resize(SIZE + 5);               //fact_inv[i]=inv[i]の累積積
    fact_inv.resize(SIZE + 5);
    inv.resize(SIZE + 5);
    fact[0] = fact[1] = 1;                          
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < SIZE + 5; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}
 
/*  nCk :MODでの二項係数を求める(前処理 int_nCk が必要)
    計算量:O(1)
*/
long long nCk(int n, int k) {
    assert(!(n < k));
    assert(!(n < 0 || k < 0));
    return fact[n] * (fact_inv[k] * fact_inv[n - k] % mod) % mod;
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main(){
    int n,m,k;
    cin>>n>>m>>k;
    vector<ll>v(n),sum(n+1,0);
    init_nCk(n);
    rep(i,0,n){
        v.at(i)=m*modpow((m-1),n-1-i,mod)%mod*nCk(n-1,i)%mod;
    }
    rep(i,0,k+1){
        sum.at(i+1)=(sum.at(i)+v.at(i))%mod;
    }
    cout<<sum.at(k+1)<<endl;
return 0;
}

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

int main(){
  int N,M;
  cin >> N >> M;
  vector<vector<char>> A(N,vector<char>(N));
  vector<vector<char>> B(M,vector<char>(M));
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      cin >> A.at(i).at(j);
    }
  }
  for(int i=0;i<M;i++){
    for(int j=0;j<M;j++){
      cin >> B.at(i).at(j);
    }
  }
  for(int i=0;i<N-M+1;i++){
    for(int j=0;j<N-M+1;j++){
      bool a=true;
      for(int k=i;k<M+i;k++){
        for(int l=j;l<M+j;l++){
          if(A.at(k).at(l)!=B.at(k-i).at(l-j)){
            a=false;
          }
        }
      }
      if(a){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}

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

#[fastout]
fn main() {
    input! {
        n: i32,
    }

    let f = |x, y, z| x * x + y * y + z * z + x * y + y * z + z * x;
    let mut ans = vec![0; (n + 1) as usize];
    for x in 1..101 {
        for y in 1..101 {
            for z in 1..101 {
                let w = f(x, y, z);
                if w <= n {
                    ans[w as usize] += 1;
                }
            }
        }
    }

    for i in 1..n + 1 {
        println!("{}", ans[i as usize]);
    }
}


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

typedef long long ll;
typedef long long llong;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;

/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

const ll MOD = 1e9 + 7;
const int MAXN = 210000;

int n;
pair<int, int> xx[MAXN];
vector<int> v2;
int a[MAXN];
int rmq1[MAXN * 4];
ll rmq[MAXN * 4];
int lb[MAXN];
int rb[MAXN];
vector<pair<int, int> > vv;
vector<pair<int, int> > st;

void build1(int v, int tl, int tr) {
	rmq1[v] = MAXN;
	if (tl + 1 == tr)
		return;
	int m = (tl + tr) >> 1;
	build1(v * 2 + 1, tl, m);
	build1(v * 2 + 2, m, tr);
}

void upd1(int v, int tl, int tr, int x, int y) {
	rmq1[v] = min(rmq1[v], y);
	if (tl + 1 == tr)
		return;
	int m = (tl + tr) >> 1;
	if (x < m)
		upd1(v * 2 + 1, tl, m, x, y);
	else
		upd1(v * 2 + 2, m, tr, x, y);
}

int get1(int v, int tl, int tr, int l, int r) {
	if (r <= tl || tr <= l)
		return MAXN;
	if (l <= tl && tr <= r)
		return rmq1[v];
	int m = (tl + tr) >> 1;
	return min(get1(v * 2 + 1, tl, m, l, r), get1(v * 2 + 2, m, tr, l, r));
}


void add(int v, int tl, int tr, int x, ll y) {
	rmq[v] = (rmq[v] + y) % MOD;
	if (tl + 1 == tr)
		return;
	int m = (tl + tr) >> 1;
	if (x < m)
		add(v * 2 + 1, tl, m, x, y);
	else
		add(v * 2 + 2, m, tr, x, y);
}

ll get(int v, int tl, int tr, int l, int r) {
	if (r <= tl || tr <= l)
		return 0;
	if (l <= tl && tr <= r)
		return rmq[v];
	int m = (tl + tr) >> 1;
	return (get(v * 2 + 1, tl, m, l, r) + get(v * 2 + 2, m, tr, l, r)) % MOD;
}


int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d%d", &xx[i].first, &xx[i].second);
		v2.push_back(xx[i].second);
	}
	sort(v2.begin(), v2.end());
	sort(xx, xx + n);
	for (int i = 0; i < n; ++i) {
		a[i] = lower_bound(v2.begin(), v2.end(), xx[i].second) - v2.begin();
	}
	build1(0, 0, n);
	for (int i = 0; i < n; ++i) {
		upd1(0, 0, n, a[i], i);
		lb[i] = get1(0, 0, n, a[i], n);
	}
	build1(0, 0, n);
	for (int i = n - 1; i >= 0; --i) {
		upd1(0, 0, n, a[i], -i);
		rb[i] = -get1(0, 0, n, 0, a[i] + 1);
	}
	for (int i = 0; i < n; ++i)
		vv.push_back(make_pair(lb[i], rb[i]));
	sort(vv.begin(), vv.end());
	for (int i = 0; i < vv.size(); ++i) {
		if (!st.empty() && st.back().first == vv[i].first)
			continue;
		while (!st.empty() && st.back().second >= vv[i].second)
			st.pop_back();
		st.push_back(vv[i]);
	}
	vv = st;
	int c = -1;
	for (int i = 0; i < n; ++i) {
		while (c + 1 < st.size() && st[c + 1].first <= i)
			++c;
		rb[i] = c;
	}
	c = 0;
	for (int i = 0; i < n; ++i) {
		while (c < st.size() && st[c].second < i)
			++c;
		lb[i] = c;
	}
	int sz = st.size() + 1;
	add(0, 0, sz, 0, 1);
	int cnt = 0;
	for (int i = 0; i < n; ++i) {
		if (lb[i] > rb[i]) {
			++cnt;
			continue;
		}
		add(0, 0, sz, rb[i] + 1, get(0, 0, sz, lb[i], sz));
	}
	ll ans = get(0, 0, sz, sz - 1, sz);
	for (int i = 0; i < cnt; ++i)
		ans = (ans * 2) % MOD;
	cout << ans << "\n";
	return 0;
}




Measured memory_bytes: 16368
#include <bits/stdc++.h>
#define rep(i,n1) for(int i=0;i<n1;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<'YES'<<endl;}else{cout<<'NO'<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
#define PI 3.141592653589793
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
typedef pair<int,ll> Pil;
typedef pair<ll,ll> Pll;
typedef pair<string,int> Psi;
typedef pair<Psi,int> Psii;

const ll inf=1000000007;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

vector<Pii> v[100001];
int dp[100001]={};
int dp2[100001]={};

int main() {
	int n;
	cin>>n;
	rep(i,n-1){
		int a,b;
		cin>>a>>b;
		v[a].push_back(Pii(b,i));
		v[b].push_back(Pii(a,i));		
	}
	int k=1;
	queue<int> que;
	que.push(1);
	while(!que.empty()){
		int p = que.front();que.pop();
		int c=1;
		rep(i,v[p].size()){
			int p2=v[p][i].first;
			int r2=v[p][i].second;
			if(p2>1&&dp2[p2]==0){
				if(c==dp2[p])c++;
				dp2[p2]=c;
				dp[r2]=c;
				que.push(p2);
				c++;
			}
		}
		k=max(k,c-1);
	}
	cout<<k<<endl;
	rep(i,n-1){
		cout<<dp[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 7296
import sys
sys.setrecursionlimit(10**6)

n = int(input())
V = list(map(int, input().split()))

V.sort()
ans = 0

for i,v in enumerate(V):
    if i == 0:
        ans += v/(2**(n-i-1))
    else:
        ans += v/(2**(n-i))

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define LINF 1e18
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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


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

int H,W;
string A[101];
string solve(){
    map<char,int> cnt;
    REP(i,H) REP(j,W) cnt[A[i][j]]++;
    if(H%2==0 && W%2==0){
        for(auto p:cnt) if(p.second%4) return "No";
        return "Yes";
    }
    if(H%2 && W%2){
        map<int,int> c;
        for(auto p:cnt) c[p.second%4]++;
        if(c[3]) return "No";
        if(c[1]!=1) return "No";
        if(c[2]>(H-1)/2 + (W-1)/2) return "No";
        return "Yes";
    }
    if(W%2) swap(H,W);

    map<int,int> c;
    for(auto p:cnt) c[p.second%4]++;
    if(c[1]||c[3]) return "No";
    if(c[2]>W/2) return "No";
    return "Yes";
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>H>>W;
    REP(i,H) cin>>A[i];
    cout<<solve()<<endl;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn main(){
    let n: usize = read();
    let x: i64 = read();
    let a: Vec<i64> = (0..n).map(|_| read::<i64>()).collect();

    let inf: i64 = 1_i64 << 50;
    let mut vec: Vec<Vec<i64>> = vec![vec![inf; n]; n];
    for i in 0..n {
        for j in 0..n {
            vec[i][j] = a[(i + n - j) % n];
            if j == 0 { continue; }
            vec[i][j] = std::cmp::min(vec[i][j], vec[i][j-1]);
        }
    }
    let mut ans: i64 = inf;
    for k in 0..n {
        let mut sum: i64 = x * k as i64;
        for i in 0..n {
            sum += vec[i][k];
        }
        ans = std::cmp::min(ans, sum);
    }
    println!("{}", ans);
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) (a).begin(),(a).end()

using ll = long long;
constexpr ll INF = 10000000000;

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

using namespace std;

//fixed << setprecision(10)

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

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

	cout << r * r << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
#include <set>
#include <queue>
#include <utility>
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    int x = 0;
    cin >> s;
    for( int i = 0 ; i < 3 ; i++ ) {
        if( s[i] == 'o' ) x++;
    }
    cout << 700 + x * 100;
}

Measured memory_bytes: 3588
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author alireza_kaviani
 */

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

using namespace std;
using namespace __gnu_pbds;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define sep                         ' '
#define endl                        '\n'
#define SZ(x)                       ll(x.size())

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

const ll MAXN = 1e5 + 10;
const ll LOG = 22;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9;

ll n , k , ans , pw[MAXN] , cnt[MAXN] , bad[MAXN];

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

    for(int i = 2 ; i < MAXN ; i++){
        if(cnt[i])  continue;
        for(int j = i ; j < MAXN ; j += i){
            cnt[j]++;
            if(j % (i * i) == 0)    bad[j] = 1;
        }
    }

    cin >> n >> k;
    for(ll i = 1 ; i <= k ; i++)    pw[i] = poww(i , n , MOD);
    for(ll i = 1 ; i <= k ; i++){
        ll c = 0;
        for(ll j = 1 ; j <= k / i ; j++){
            if(bad[j])  continue;
            c += (cnt[j] % 2 == 0 ? 1 : -1) * pw[k / (i * j)];
        }
        c = (c % MOD + MOD) % MOD;
        ans += c * i;
    }
    cout << ans % MOD << endl;

    return 0;
}
/*

*/


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

int main(void){
    int i = 1;
    int j = 1;

    for(i = 1;i<=9;i++){
        for(j = 1;j<=9;j++){
            cout << i << "x" << j << "=" << i*j << endl;
        }
    }

    return(0);
}

Measured memory_bytes: 3044
N,K = map(int, input().split())
A = [int(a) for a in input().split()]

P = []
M = []
z = 0
for a in A:
    if a < 0:
        M.append(a)
    elif a > 0:
        P.append(a)
    else:
        z += 1

P.sort()
M.sort()

def f(n): #積がn以下になるペアはいくつあるか
    if n < 0:
        res = 0
        p = 0
        for m in range(len(M)):
            while p < len(P) and P[p]*M[m] > n:
                p += 1
            res += len(P)-p
    elif n == 0:
        res = len(P)*len(M)+z*(N-z)+z*(z-1)//2
    else:
        res = len(P)*len(M)+z*(N-z)+z*(z-1)//2
        pr = len(P)-1
        for pl in range(len(P)):
            while pr > pl and P[pl]*P[pr] > n:
                pr -= 1
            res += max(0, pr-pl)
        ml = 0
        for mr in range(len(M)-1, -1, -1):
            while mr > ml and M[ml]*M[mr] > n:
                ml += 1
            res += max(0, mr-ml)
    return res

l = -10**18
r = 10**18
while True:
    num = (l+r)//2
    if f(num) < K:
        l = num
    else:
        r = num
    if r-l <= 1:
        print(r)
        break

Measured memory_bytes: 105872
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<deque>
#include<bitset>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<int,int> P;
template<class T> inline bool chmax(T&a , T b){ if(a<b){ a=b; return true; } else{ return false; } }
template<class T> inline bool chmin(T&a , T b){ if(a>b){ a=b; return true; } else{ return false; } } 

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main(){
    int x,y,a,b,c;
    cin >> x >> y >> a >> b >> c;
    vector<int> p(a),q(b),r(c);
    rep(i,a) cin >> p[i];
    rep(i,b) cin >> q[i];
    rep(i,c) cin >> r[i];
    sort(p.begin(),p.end());
    reverse(p.begin(),p.end());
    sort(q.begin(),q.end());
    reverse(q.begin(),q.end());
    vector<int> tot;
    rep(i,x) tot.push_back(p[i]);
    rep(i,y) tot.push_back(q[i]);
    rep(i,c) tot.push_back(r[i]);
    sort(tot.begin(),tot.end());
    reverse(tot.begin(),tot.end());

    ll ans = 0;
    rep(i,x+y){
        ans += tot[i];
    }
    cout << ans << endl;

}

Measured memory_bytes: 3572
#include <functional>
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

int main() {
    long long n;
    long long m;
    long long l;
 
   cin >> n >> m >> l;
  
// int sum = 0;
   
   
   long long  ans = (n-1)/l+1;
  
  if(n==0){
     ans = 0;
   }
  
   long long ans2 = m/l+1;
   
            
   cout << ans2 - ans << endl;
 
  
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
 
        int n = sc.nextInt();
        int k = sc.nextInt();
  
        int array[] = new int[n + 1];
 
        for (int i = 0; i < n; i++) {
            array[sc.nextInt()]++;
        }

        List<Integer> list = new ArrayList<Integer>();
 
        for (int i = 0; i < n + 1; i++) {
            if (array[i] != 0) {
                list.add(array[i]);
            }
        }

        Collections.sort(list);

        long ans = 0;

        for (int i = 0; i < list.size() - k; i++) {
            ans += list.get(i);
        }
 
        System.out.println(ans);
 
        sc.close();
 
        }
 
    }


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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...)
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

#define MAX 3005

template<int MOD>
struct ModInt {
    long long v;
    ModInt(long long _v = 0) {v = (-MOD < _v && _v < MOD) ? _v : _v % MOD; if (v < 0) v += MOD;}
    ModInt& operator += (const ModInt &other) {v += other.v; if (v >= MOD) v -= MOD; return *this;}
    ModInt& operator -= (const ModInt &other) {v -= other.v; if (v < 0) v += MOD; return *this;}
    ModInt& operator *= (const ModInt &other) {v = v * other.v % MOD; return *this;}
    ModInt& operator /= (const ModInt &other) {return *this *= inverse(other);}
    bool operator == (const ModInt &other) const {return v == other.v;}
    bool operator != (const ModInt &other) const {return v != other.v;}
    friend ModInt operator + (ModInt a, const ModInt &b) {return a += b;}
    friend ModInt operator - (ModInt a, const ModInt &b) {return a -= b;}
    friend ModInt operator * (ModInt a, const ModInt &b) {return a *= b;}
    friend ModInt operator / (ModInt a, const ModInt &b) {return a /= b;}
    friend ModInt operator - (const ModInt &a) {return 0 - a;}
    friend ModInt power(ModInt a, long long b) {ModInt ret(1); while (b > 0) {if (b & 1) ret *= a; a *= a; b >>= 1;} return ret;}
    friend ModInt inverse(ModInt a) {return power(a, MOD - 2);}
    friend ostream& operator << (ostream &os, const ModInt &m) {return os << m.v;}
};
typedef ModInt<998244353> M;

M dp[MAX][MAX];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n, s;
    cin >> n >> s;

    dp[0][0] = power(M(2), n);
    M inv2 = inverse(M(2));
    for (int i=0; i<n; i++) {
        int a;
        cin >> a;

        for (int j=0; j<MAX; j++) {
            dp[i+1][j] += dp[i][j];
            if (j + a < MAX)
                dp[i+1][j+a] += dp[i][j] * inv2;
        }
    }

    cout << dp[n][s] << "\n";

    return 0;
}


Measured memory_bytes: 74140