akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> k(m), p(m);
  vector<vector<int>> s(m, vector<int>());

  for (int i = 0; i < m; i++) {
    cin >> k[i];
    for (int j = 0; j < k[i]; j++) {
      int a;
      cin >> a;
      s[i].push_back(a);
    }
  }

  for (int i = 0; i < m; i++) {
    cin >> p[i];
  }

  int sum = 0;

  for (int tmp = 0; tmp < (1 << n); tmp++) {
    bitset<10> bit(tmp);
    vector<int> on(m, 0);
    bool ok = true;
    for (int num = 0; num < n; num++) {
      if (bit.test(num)) {
        for (int i = 0; i < m; i++) {
          for (int j = 0; j < k[i]; j++) {
            if (s[i][j] == num + 1) {
              on[i]++;
            }
          }
        }
      }
    }
    for (int i = 0; i < m; i++) {
      if (on[i] % 2 != p[i]) {
        ok = false;
      }
    }
    if (ok) {
      sum++;
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
from sys import exit
import math
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n = input()

cnt = 0
for i in range(len(n)):
    cnt += int(n[i])

if cnt % 9 == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9284
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)

#define mod 1000000007

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int INF = (int)1e9;

char field[50][50];
int H, W;

bool dfs(int y, int x, int rensa) {
	for (int i = 0; i < 4; i++) {
		field[y][x] = '.';
		int nx = x + dx[i];
		int ny = y + dy[i];
		if (0 <= nx && nx < W && 0 <= ny && ny < H && field[ny][nx] == '#') {
			rensa++;
			dfs(ny, nx, rensa);
		}
	}
	if(rensa >= 2) return true;
	else return false;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> H >> W;
	rep(i, H) {
		rep(j, W) {
			cin >> field[i][j];
		}
	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (field[i][j] == '#') {
				if (!dfs(i, j, 1)) {
					cout << "No" << endl;
					return 0;
				}
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
#define INF 200000000000
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()

bool compare(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}
// 入力



int main() {
    ll N,M;
    cin >>N>>M;
    if(N==M){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    


    return 0;
    

}

Measured memory_bytes: 3624
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

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

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let (n,d) = get!(usize, usize);
    let xs = get!([isize]; n);
    let mut count = 0usize;
    for i in 0..n {
        for j in (i+1)..n {
            let y = &xs[i];
            let z = &xs[j];
            let mut sum = 0;
            for k in 0..d {
                sum += (y[k]-z[k])*(y[k]-z[k]);
            }
            let root = (sum as f64).sqrt() as isize;
            if root*root == sum {
                count += 1;
            }
        }
    }
    println!("{}", count);

}


Measured memory_bytes: 8572
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define SZ(x) ((int)x.size())
#define ALL(x) x.begin(),x.end()
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> T gcd(T a, T b){return !b?a:gcd(b,a%b);}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
mt19937 R(chrono::system_clock().now().time_since_epoch().count());


int main() {
	string s;cin>>s;
	rep(i,0,2)cout<<s[i];
	return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>x>>y;
	_P("%.12lf\n",x*y/(1.0*(x+y)));
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


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

using namespace std;

/* 文字列を入力後、
 正攻法ならば それぞれの値に3を足していくが、
 その場合、ABCが入力されたときだけに特殊な処理が必要になる。
 全ての値で同じ処理とするため、同等の結果となるように、
 23を足して26で割ることにする。
*/

char decode_caesar(char a) {

	return 'A' + ((a - 'A' + 23) % 26);
}

int main() {
	string str;
	cin >> str;
	for (auto& temp : str) {
		temp = decode_caesar(temp);
	}
	cout << str << endl;

}

Measured memory_bytes: 1188
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
//----------------------------------------------------------------

// int MOD = 998244353;
int MOD = 1000000007;

string s;
ll n;	

//----------------------------------------------------------------
signed main(){

	ll n,y;
	cin >> n >> y;

	rep(i,n+1){
		rep(j,n+1){
			ll k = n-i-j;
			if(k<0)continue;
			if(i*10000+j*5000+k*1000 == y){
				cout << i << " " << j << " " << k << endl;
				return 0;
			}
		}
	}
	cout << "-1 -1 -1"<< endl;

	

	return 0;
}

//----------------------------------------------------------------

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://ddcc2017-final.contest.atcoder.jp/tasks/ddcc2017_final_b
// rm -r -f test;oj dl https://abc141.contest.atcoder.jp/tasks/abc141_b

Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <math.h>
using namespace std;
int gcd(int a, int b);
int main(){
		int N,X,dgcd;
		scanf("%d %d",&N,&X);
		for(int i=0;i<N;i++){
				int x;
				scanf("%d",&x);
				if(i==0)dgcd=fabs(x-X);
				dgcd = fabs(gcd(dgcd,x-X));	
		}
		printf("%d\n",dgcd);
}


int gcd(int a, int b)
{
		    int c;

			    if (a < b) {
						        a+=b; b=a-b; a-=b;
								    }

				    while (b != 0) {
							        c = a % b;
									        a = b;
											        b = c;
													    }

					    return a;
}


Measured memory_bytes: 128
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
min_diff = float("inf")
min_idx = 0
for i in range(N):
    diff = abs(A - (T - H[i] * 0.006))
    if min_diff > diff:
        min_diff = diff
        min_idx = i
print(min_idx + 1)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int L, R;
    cin >> L >> R;
    if (R - L >= 2019) {
        cout << 0 << endl;
        return 0;
    }

    ll ans = 2019;
    FOR(i, L, R) FOR(j, i + 1, R + 1) {
        ans = min(ans, ((ll)i * j) % 2019);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#関数リスト
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def ruiseki(mydata):
    res = [0]*(len(mydata)+1)
    for i in range(len(mydata)):
        res[i+1] = res[i] + mydata[i]
    return res

n, k , m = MI()
a = ruiseki(LI())
b = ruiseki(LI())

result = 0
index = k
for i, ii in enumerate(a):
    if ii > m:
        break
    while b[index] + ii > m:
        index -= 1
    result = max(result, i+index)
print(result)


Measured memory_bytes: 113460
#include <bits/stdc++.h>
//登録しよう！→ https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define gre greater //sortを降順にする
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示

void solve(long long X){
  ll ans = 0;
  while(X >= 5){
    if(X >= 500){
      ans += 1000;
      X -= 500;
    }else{
      ans += 5;
      X -= 5;  
    }
  }
  cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long X;
    scanf("%lld",&X);
    solve(X);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int compare_int(const void *a, const void *b){
    return *(int*)a - *(int*)b;
}

int main(void){
	int n, k;
	int *p;
	int sum = 0;
	scanf("%d", &n);
	scanf("%d", &k);
	p = (int *)malloc(sizeof(int) * n);
	for(int i=0; i<n; i++){
		scanf("%d", &p[i]);
	}
	qsort(p, n, sizeof(int), compare_int);
	for(int j=0; j<k; j++){
		sum += p[j];
	}
	printf("%d\n", sum);
	return 0;
}

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

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

const int N = 2e5+10 , mod = 1e9+7;

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   map <string , int> mp;
   int n;
   cin >> n;
   for(int i = 0 ; i < n ; i++){
      string s;
      cin >> s;
      mp[s]++;
   }
   cout << "AC x " << mp["AC"] << endl;
   cout << "WA x " << mp["WA"] << endl;
   cout << "TLE x " << mp["TLE"] << endl;
   cout << "RE x " << mp["RE"] << endl;
   return 0;
}


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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

l = inputILs(6)

if l[0]+l[5]>=l[4]:
  print("Yay!")
else:
  print(":(")

Measured memory_bytes: 64364
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

#include "bits/stdc++.h"
using namespace std;

int main() {
	int N;
	cin >> N;
	long long int L[87];

	L[0] = 2;
	L[1] = 1;

	for(int i = 2; i < N + 1; i++) {
		L[i] = L[i - 1] + L[i - 2];
	}

	cout << L[N] << endl;

	return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.InputMismatchException;

public class Main {
	int f(int[] a, int fin) {
		int n = a.length;
		int sum = 0;
		for (int i = 0; i < fin; i++) {
			int k = a[i];
			if (i != 0) {
				k += 1;
				k %= 2;
			}
			sum += k;
		}
		for (int i = n - 1; fin < i; i--) {
			int k = a[i];
			if (i != n - 1) {
				k += 1;
				k %= 2;
			}
			sum += k;
		}
		if (fin == 0 && fin == n - 1) {
			sum += a[fin];
		} else if (fin == 0 || fin == n - 1) {
			sum += (a[fin] + 1) % 2;
		} else {
			sum += a[fin];
		}
		return sum;
	}

	void run() {
		MyScanner sc = new MyScanner();

		int h = sc.nextInt();
		int w = sc.nextInt();
		int[][] a = new int[h][w];
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				a[i][j] = sc.nextInt();
			}
		}
		for (int i = 1; i < h; i++) {
			for (int j = 0; j < w; j++) {
				a[i][j] = (a[i][j] + 1) % 2;
			}
		}

		int sum = 0;
		for (int i = 0; i < h; i++) {
			int max = 0;
			for (int j = 0; j < w; j++) {
				int k = f(a[i], j);
				max = Math.max(max, k);
			}
			sum += max;
		}
		System.out.println(sum);
	}

	public static void main(String[] args) {
		new Main().run();
	}

	public void mapDebug(int[][] a) {
		System.out.println("--------map display---------");
		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[i].length; j++) {
				System.out.printf("%3d ", a[i][j]);
			}
			System.out.println();
		}
		System.out.println("----------------------------" + '\n');
	}

	class MyScanner {
		int read() {
			try {
				return System.in.read();
			} catch (IOException e) {
				throw new InputMismatchException();
			}
		}

		boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

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

		int[] nextIntArray(int n) {
			int[] array = new int[n];
			for (int i = 0; i < n; i++)
				array[i] = nextInt();
			return array;
		}

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

		long[] nextLongArray(int n) {
			long[] array = new long[n];
			for (int i = 0; i < n; i++)
				array[i] = nextLong();
			return array;
		}

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

		double[] nextDoubleArray(int n) {
			double[] array = new double[n];
			for (int i = 0; i < n; i++)
				array[i] = nextDouble();
			return array;
		}

		String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		String[] nextStringArray(int n) {
			String[] array = new String[n];
			for (int i = 0; i < n; i++)
				array[i] = next();

			return array;
		}

		String nextLine() {
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}
	}
}

Measured memory_bytes: 24260
s = input()
ans = True
for i in range(len(s)):
  if (i+1)%2 == 0:
    if s[i] ==  'R':
      ans = False
  elif (i+1)%2 == 1:
    if s[i] ==  'L':
      ans = False
if ans:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 2940
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <utility>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define rep(i, n) for(int i=0; i<n; ++i)
#define rrep(i, m, n) for(int i=m; i<n; ++i)
typedef long long ll;

#define MAX_N 1000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100
#define MAX_Q 100000

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

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

//--------------------------



int main() {

  int n;
  double a, ans = 0;

  cin >> n;

  rep(i, n) {
    cin >> a;
    ans += 1/a;
  }

  ans = 1 / ans;

  cout << fixed;
  cout << setprecision(6) << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>  
#include<cstring>  
#include<algorithm>  
#include<iostream>  
#include<string>  
#include<vector>  
#include<stack>  
#include<bitset>  
#include<cstdlib>  
#include<cmath>  
#include<set>  
#include<list>  
#include<deque>  
#include<map>  
#include<queue>
using namespace std;
typedef long long ll;
const ll inf=1<<29;
const ll Maxn=1e6;

ll a[Maxn];

int main(){
	ll a,b,c;
	cin>>a>>b;
	c=a*b;
	if(c%2==1) printf("Odd\n");
	if(c%2==0) printf("Even\n");
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int a[10000], k, i, max, min;
	long long int sum = 0;
	scanf("%d", &k);
	for (i = 0; i < k; i++) {
		scanf("%d", &a[i]);
	}
	
	max = a[0];
	min = a[0];

	for (i = 0; i < k; i++) {
		if (max < a[i]) max = a[i];
		if (min > a[i]) min = a[i];
		sum += a[i];
	}

	printf("%d %d %lld\n", min, max, sum);
	return 0;
}



Measured memory_bytes: 2100
import collections

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

cnt = collections.defaultdict(lambda: 0)
for i in range(N):
    if a[i] <= 399:
        cnt['gray'] += 1
    elif a[i] <= 799:
        cnt['brown'] += 1
    elif a[i] <= 1199:
        cnt['green'] += 1
    elif a[i] <= 1599:
        cnt['sky'] += 1
    elif a[i] <= 1999:
        cnt['blue'] +=1
    elif a[i] <= 2399:
        cnt['yellow'] += 1
    elif a[i] <= 2799:
        cnt['orange'] +=1
    elif a[i] <= 3199:
        cnt['red'] += 1
    else:
        cnt['any'] += 1

key = cnt.keys()
if 'any' in key:
    color_type = len(key) - 1
else:
    color_type = len(key)
    
color_sum = 0

for each in key:
    if each != 'any':
        color_sum += cnt[each]
        
any_sum = N - color_sum

max_type = any_sum + color_type

if color_type == 0:
    min_type = 1
else:
    min_type = color_type

print(min_type, max_type)

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

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

int digitSum(int k) {
  int ret = 0;

  while (k != 0) {
    ret += k % 10;
    k /= 10;
  }

  return ret;
}

int main() {
  int N;

  cin >> N;

  int ans = int(1e9);

  for (int i = 1; i <= N / 2; ++i) {
    int A = i, B = N - i;
    int tmp = digitSum(A) + digitSum(B);
    ans = std::min(ans, tmp);
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <random>
#include <chrono>
#include <algorithm>
#define rep(i, x) for(ll i = 0; i < x; i++)
#define CONCAT_(x,y) x##y
#define CONCAT(x,y) CONCAT_(x,y)
#define _v1 CONCAT(qyw1, __LINE__) // unique name in same line (otherwise use __COUNTER__)
#define _v2 CONCAT(qyw2, __LINE__)
#define forbits(i, m) for (int _v1 = m, i = __builtin_ctz(_v1); _v1 != 0; _v1 ^= _v1 & -_v1, i = __builtin_ctz(_v1))
#define forsubm(s, m) for (int s = m; s >= 0; s = !s ? -1 : m & (s - 1))
int __nextXZW(int v){int t=v|(v-1);int w=(t+1)|(((~t&-~t)-1)>>(__builtin_ctz(v)+1));return w;}
#define ksets(i, n, k) for (int i = (1u << k) - 1, max = i << (n - k); i <= max; i = __nextXZW(i))
using namespace std;
typedef long long ll;
const ll MOD = (ll)1e9+7;
const ll N = 5e5+5, inf = 1e9+5000;
ll add(ll x, ll y) { x += y; if (x >= MOD) return x - MOD; return x; }
ll sub(ll x, ll y) { x -= y; if (x < 0) return x + MOD; return x; }
ll mult(ll x, ll y) { return (x * y) % MOD; }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int k; cin >> k;
  string ans;
  rep (i, k) ans += "ACL";
  cout << ans << '\n';
  
  return 0;
}

Measured memory_bytes: 3488
// なにもわからない...
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;

struct match{
    int num, use;
    bool operator<(const match other) const{
        if(use != other.use)    return use < other.use;
        else                    return num > other.num;
    }
};

string enc(int x){
    char c = '0'+x;
    string ret({c});
    return ret;
}

int a[10] = {0,2,5,5,4,5,6,3,7,6};
int n, m;
vector<int> ans;
vector<match> v;
string fin = "";
bool first = true;
int len = 0;

void dfs(int cur, int res){
    if(cur == v.size()){
        if(res != 0)    return;
        string ret = "";
        for(int i = 0; i < v.size(); i++){
            string s = enc(v[i].num);
            for(int j = 0; j < ans[i]; j++) ret += s;
        }
        sort(ret.begin(), ret.end());
        reverse(ret.begin(), ret.end());
        if(first){
            len = ret.length();
            first = false;
        }else{
            if(ret.length() < len){
                cout << fin << endl;
                exit(0);
            }
        }
        if(fin.length() < ret.length()) fin = ret;
        else if(fin.length()==ret.length() && fin < ret)    fin = ret;
        return;
    }

    for(int j = res/v[cur].use; j >= 0; j--){
        ans.push_back(j);
        dfs(cur+1, res-j*v[cur].use);
        ans.pop_back();
    }
}

// TLEしそう.
int main(){
    cin >> n >> m;
    map<int, match> ma;
    for(int i = 0; i < m; i++){
        int x;  cin >> x;
        match tmp({x, a[x]});
        if(ma.count(a[x])){
            if(x > ma[a[x]].num){
                ma[a[x]] = tmp;
            }
        }else{
            ma[a[x]] = tmp;
        }
    }

    for(auto p : ma){
        v.push_back(p.second);
    }

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

    dfs(0, n);

    cout << fin << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int H = sc.nextInt();
        int W = sc.nextInt();
        
        char[][] map = new char[H][W];
		for (int i = 0; i < H; i++) {
			map[i] = sc.next().toCharArray();
		}
		
		int[][] ans = new int[H][W];
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if (map[i][j] == '#') {
					ans[i][j] = -1;
					continue;
				}
				
				int count = 0;
				if (0 <= i-1 && 0 <= j-1) {
					count = map[i-1][j-1] == '#' ? count+1 : count;
				}
				
				if (0 <= i-1) {
					count = map[i-1][j] == '#' ? count+1 : count;
				}
				
				if (0 <= i-1 && j+1 < W) {
					count = map[i-1][j+1] == '#' ? count+1 : count;
				}
				
				if (0 <= j-1) {
					count = map[i][j-1] == '#' ? count+1 : count;
				}
				
				if (j+1 < W) {
					count = map[i][j+1] == '#' ? count+1 : count;
				}
				
				if (i+1 < H && 0 <= j-1) {
					count = map[i+1][j-1] == '#' ? count+1 : count;
				}
				
				if (i+1 < H) {
					count = map[i+1][j] == '#' ? count+1 : count;
				}
				
				if (i+1 < H && j+1 < W) {
					count = map[i+1][j+1] == '#' ? count+1 : count;
				}
				
				ans[i][j] = count;
			}
		}
		
		for(int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				System.out.print(ans[i][j] == -1 ? "#" : ans[i][j]);
			}
			System.out.println();
		}
		
    }
}




Measured memory_bytes: 23124
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <queue>
#include <vector>
#include <cmath>
#include <set>
#define Rep(i, x, y) for (int i = x; i <= y; i ++)
#define Dwn(i, x, y) for (int i = x; i >= y; i --)
#define RepE(i, x) for (int i = pos[x]; i; i = g[i].nex)
#define v g[i].y
using namespace std;
typedef long long ll;
typedef double db;
int a, b, c;
int main()
{
	cin >> a >> b >> c;
	puts((b * 10 + c) % 4 ? "NO" : "YES");

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
#define int long long
#define ld long double
#define fast ios_base::sync_with_stdio(false) ;cin.tie(NULL);cout.tie(NULL)
#define F(i,b) for(int i= 0; i<(int)(b);i++)
#define FI(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define RF(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define inp(a) for(auto& i : a) cin >> i;
#define out(a) for(auto i : a){cout << i << ' ';}cout << endl;
#define dbg(x) cerr << #x << " is " << x << endl;
#define ms(x,a) memset(x,(int)(a),sizeof(x))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pii pair<int,int>
#define vi vector<int >
#define pb push_back
#define endl '\n'
#define ff first
#define ss second
#define MOD 1000000007
const int N = 2e5+7 ;
string s ;

bool comp(pii a , pii b){
	if(a.ff > b.ff)
		return true ;
	return false ;
}

int32_t main(){fast ;
	int n,m ;
	cin >> n >> m ;
	vi a(n) ;
	inp(a) 
	vector<pii> b(m) ;
	F(i,m){
		cin >> b[i].ss >> b[i].ff ;
	}
	sort(all(b),comp) ;
	sort(all(a)) ;
	int k = 0 ;
	for(int j = 0 ; j < m ; j++){
		int x = b[j].ff , y = b[j].ss ;
		bool ok = true ;
		while(y--){
			if(a[k] < x){
				a[k] = x ;
				k++ ;
			}
			else{
				ok = false ;
				break ;
			}	
		}
		if(!ok)
			break ;
	}
	int sm = 0 ;
	for(int i : a){
		sm += i ;
	}
	
	cout << sm << endl ;
}





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

int main(){

 int a, b ;
 char op ;


 	while ( 1 ){
 	 cin >>a >> op >> b ;

		if( op == '?' ) break ;

		if ( op == '+' ){
		 cout<< a + b << endl;// 和
		 } else if ( op == '-' ){
		 cout<< a - b << endl;// 差
		 } else if ( op == '*' ){
		 cout<< a * b << endl;// 積
		 } else if ( op == '/' ){
		 cout<< a / b << endl;// 商
		 } else {
		 break; // 終了
		}


	}

 return 0;
 }


Measured memory_bytes: 3084
using System;
using System.Collections.Generic;
using System.Linq;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var r = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var H = r[0];
            var N = r[1];
            var r2 = Console.ReadLine().Split().Select(long.Parse).Sum();
            if (H > r2)
            {
                Console.WriteLine("No");
            }
            else
            {
                Console.WriteLine("Yes");
            }
        }
    }
}

Measured memory_bytes: 16608
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;
const int INF=1<<17;
int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

int main(){
    int N;
    cin >> N;
    LL a[N],cum[N];
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    sort(a,a+N);
    LL sum=0;
    for(int i=0;i<N;i++){
        sum+=a[i];
        cum[i]=sum;
    }
    int ans=1;
    for(int i=N-2;i>=0;i--){
        if(a[i+1]>2*cum[i]) break;
        ans++;
    }
    cout << ans << endl;
    return 0;
}


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

int main(){

  ll N,T;
  cin>>N>>T;

  ll t[N];
  rep(i,N){
    cin>>t[i];
  }
  
  ll sum=0;
  
  rep(i,N){

    if(i==N-1){sum+=T; break;}
    if(t[i+1]-t[i]<T)sum+=(t[i+1]-t[i]);
    else sum+=T;
    
  }

  
  cout<<sum<<endl;
}

Measured memory_bytes: 1792
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
import java.util.List;

/*


*/

public class Main {
    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        List<Integer> A = new ArrayList<>();
        List<Integer> B = new ArrayList<>();
        List<Integer> C = new ArrayList<>();       

        for (int i = 0; i < a; i ++) {
            A.add(-sc.nextInt());
        }
        for (int i = 0; i < b; i ++) {
            B.add(-sc.nextInt());
        }
        for (int i = 0; i < c; i ++) {
            C.add( -sc.nextInt());
        }

        Collections.sort(A);
        Collections.sort(B);

        for (int i= 0; i < x; i++) {
            C.add(A.get(i));
        }
        for (int i= 0; i < y; i++) {
        	C.add(B.get(i));
        }

        long ans = 0;
        Collections.sort(C);

        for (int i = 0; i < x + y; i++) {
            ans -= C.get(i);
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 97712
using System;
using System.Collections.Generic;

class IDONTKNOWCSHARP
{
    public static void Main()
    {
        int num=int.Parse(Console.ReadLine());
        int[] array=new int[4];
        array[0]=0;
        array[1]=0;
        array[2]=0;
        array[3]=0;

        for(int i = 0; i < num; i++)
        {
            switch (Console.ReadLine())
            {
                case "AC":array[0]++;break;
                case "WA":array[1]++;break;
                case "TLE":array[2]++;break;
                case "RE":array[3]++;break;
            }
        }

        Console.WriteLine($"AC x {array[0]}\r\n" +
            $"WA x {array[1]}\r\n" +
            $"TLE x {array[2]}\r\n" +
            $"RE x {array[3]}");
      //  Console.ReadKey();

    }

}

Measured memory_bytes: 30376
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
T[] RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[][] RDA2(T = long)(size_t n, T[] fix = []) { auto r = new T[][](n); foreach (i; 0..n) { r[i] = readln.chomp.split.to!(T[]); foreach (j, e; fix) r[i][j] += e; } return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto S = RD!string;
	auto N = S.length;
	auto T = new long[](N);
	foreach (i; 1..N)
	{
		if (S[i-1] =='R' && S[i] == 'L')
		{
			T[i] = 2;
			T[i-1] = 1;
		}
	}

	auto ans = new long[](N);
	long cnt, cnt2, lastPos;
	foreach (i; 0..N)
	{
		if (S[i] == 'R')
		{
			++cnt;
			if (cnt2 != 0)
			{
				ans[lastPos] += cnt2 / 2 + (cnt2 % 2 != 0 ? 1 : 0);
				ans[lastPos+1] += cnt2 / 2;
				cnt2 = 0;
			}
		}
		else if (cnt != 0)
		{
			ans[i] += cnt / 2 + 1;
			ans[i-1] += cnt / 2 + (cnt % 2 != 0 ? 1 : 0);
			cnt = 0;
			lastPos = i - 1;
		}
		else
		{
			++cnt2;
		}
	}
	if (cnt2 != 0)
	{
		ans[lastPos] += cnt2 / 2 + (cnt2 % 2 != 0 ? 1 : 0);
		ans[lastPos+1] += cnt2 / 2;
		cnt2 = 0;
	}

	ans.map!(to!string).join(" ").writeln();
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 5400
#include <bits/stdc++.h>
#define fastio() ios_base::sync_with_stdio(false);
using namespace std;
typedef long long ll;
typedef long double ld;


int main(){
	string s; cin >> s;
	for(char &c: s) c = 'x';
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.ArrayDeque;
import java.util.Scanner;
import java.util.function.LongSupplier;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main{
	static final Scanner s=new Scanner(System.in);
	static final long[] fal_rnd(long[] ar,LongSupplier sp){
		int l=-1,r=ar.length;
		while(l+1!=r)
			ar[Math.random()<0.5?++l:--r]=sp.getAsLong();
		return ar;
	}
	static final IntStream REPS(int v){return IntStream.range(0, v);};
	public static void main(String[] __){
		cases:
		while (true) {
			final int n=s.nextInt(),a=s.nextInt(),b=s.nextInt(),c=s.nextInt(),x=s.nextInt();
			if(n+a+b+c+x==0) return;
			final ArrayDeque<Integer> in=REPS(n).mapToObj(v->s.nextInt()).collect(Collectors.toCollection(ArrayDeque<Integer>::new));
			final int[]rnd=IntStream.iterate(x,v->(a*v+b)%c).limit(10001).toArray();
			for(int i=0;i<=10000;i++){
				if(in.peekFirst()==rnd[i])
					in.pollFirst();
				if(in.isEmpty()) {
					System.out.println(i);
					continue cases;
				}
			}
			System.out.println(-1);
		}
	}
}

Measured memory_bytes: 69028
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <string.h>
#include <algorithm>
#define N_MAX 100005
using namespace std;
typedef long long ll;
int C[N_MAX];
int N,M;
int A[N_MAX];
int dp[N_MAX];
char ANS[N_MAX];

int rec(int i){
  	int res = -100005;
  	if(i == 0) return 0;
  	if(i < 0) return -100005;
	if(dp[i] >= 0) return dp[i];
  	for(int j = 0; j < M; j++){
      	if(rec(i-C[j]) >= 0){
    		res = max(res, rec(i-C[j])+1);
        }
    }
    return dp[i] = res;
}

int main()
{
  	cin >> N >> M;
  	int B[9] = {2, 5, 5, 4, 5, 6, 3, 7, 6};
  	for(int i = 0; i < M; i++){
    	cin >> A[i];
    }
  	sort(A, A+M);
  	for(int i = 0; i < M; i++){
    	C[i] = B[A[i]-1];
    }
  	memset(dp, -1, sizeof(dp));
  	int num = N;
  	int s = 0;
  	while(num > 0){
        for(int i = M-1; i >= 0; i--){
            if(rec(num) == rec(num-C[i])+1){
                num -= C[i];
              	cout << A[i];
                break;
            }
        }
    }
  	cout << endl;
}

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

int main(){
    int n,m; cin >> n >> m;
    vector<bool> accepted(n);
    rep(i,n) accepted[i]=false;
    vector<int> ac(n),wa(n);
    rep(i,n){
        ac[i]=0;
        wa[i]=0;
    }
    rep(i,m){
        int p; string s;
        cin >> p >> s;
        --p;
        if(!accepted[p]){
            if(s=="AC"){
                ac[p]++;
                accepted[p]=true;
            }
            else{
                wa[p]++;
            }
        }
    }
    int ans_ac=0, ans_wa=0;
    rep(i,n){
        ans_ac += ac[i];
        if(accepted[i]) ans_wa += wa[i];
    }
    printf("%d %d\n",ans_ac,ans_wa);
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include<iomanip>
#include<tuple>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    int D, G, p[11], c[11];
    cin >> D >> G;
    
    for(int i = 0; i < D; i++){
        cin >> p[i] >> c[i];
    }
    int ans=1e9;
    for(int mask=0;mask<(1 << D);mask++){
        int num=0,s=0,rest_max=-1;
        for(int i=0;i<D;i++){
            if(mask>> i & 1){
            s+=100*(i+1)*p[i]+c[i];
            num+=p[i];        
            }
            else{
                rest_max=i;
            }   
        }
        if(G>s){
            int s1=100*(rest_max+1);
            int need=(G-s+s1-1)/s1;
            if(need>=p[rest_max]){
                continue;
            }
            num+=need;
        }
        ans=min(ans,num);

    }
    cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;

int main() {
    string N;
    cin >> N;
    int K;
    cin >> K;
    ll n = (ll)N.size();

    vector<int> keta, val;
    REP(i, n) {
        if (N[i] != '0') {
            keta.push_back(n - i - 1);
            val.push_back((int)(N[i] - '0'));
        }
    }
    REP(i, 3) {
        keta.push_back(0);
        val.push_back(0);
    }

    ll ans = 0;
    REP(i, n - 1) {  // 1~n-1 桁の数について
        if (K == 1) {
            ans += 9;
        } else if (K == 2) {
            ans += 9 * 9 * i;
        } else if (K == 3) {
            ans += 9 * 9 * 9 * (i * (i - 1) / 2);
        }
    }

    // n 桁の数について
    if (K == 1) {
        ans += val[0];  // 先頭は 1~val[0]通り
    } else if (K == 2) {
        ans += (val[0] - 1) * 9 * (n - 1);  // 先頭を 1~(val[0]-1) のどれかにする時
        ans += val[1];                      // 先頭を val[0] にして、2つ目を keta[1]+1 桁目で使う時
        ans += 9 * keta[1];  // 先頭を val[0] にして、2つ目を 1~keta[1] 桁目のどこかで使う時
    } else if (K == 3) {
        ans += (val[0] - 1) * 9 * 9 * (n - 1) * (n - 2) / 2;  // 先頭を 1~(val[0]-1) にする時
        ans += (val[1] - 1) * 9
               * (keta[1]);  // 先頭をval[0]にして、2つ目を keta[1]+1 桁目で1~(val[1]-1) のどれかにする時
        ans += val[2];  // 先頭をval[0]、2つ目を keta[1]+1 桁目で val[1] にして、3つ目を keta[2]+1 桁目で使う時
        ans += 9 * keta[2];  // 先頭をval[0]、2つ目を keta[1]+1 桁目で val[1] にして、3つ目を 1~keta[2]
                             // 桁目のどこかで使う時
        ans += 9 * 9 * (keta[1]) * ((keta[1]) - 1) / 2;  // 先頭をval[0]、2つ目を keta[2]+1 桁目で使う時
    }

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


Measured memory_bytes: 256
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>
#include <cassert>
#include <bitset>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define EL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int n;
	std::cin >> n;
	std::set<std::string> set;
	char e;
	rep(i,n) {
		std::string s;
		std::cin >> s;
		if(i==0) {
			e=s[s.size()-1];
			set.emplace(s);
		} else {
			if(!set.emplace(s).second || e!=s[0]) {
				print("No");
				return 0;
			}
			e=s[s.size()-1];
		}
	}
	print("Yes");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const string EMP = " ";
const ll INF = 1LL<<60;
const ll MOD = 1000000007;

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


int main(){
  int n; cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  vector<int> left(n+1, 0), right(n+1, 0);
  for(int i = 0; i < n; i++) left[i+1] = gcd(left[i], a[i]);
  for(int i = n-1; i >= 0; i--) right[i] = gcd(right[i+1], a[i]);

  int ans = 0;

  for(int i = 0; i < n; i++){
    int l = left[i];
    int r = right[i+1];
    int now = gcd(l,r);
    ans = max(ans, now);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <map>
#include <vector>

using namespace std;
int main()
{
	int x, y;
	cin >> x >> y;
	if (x + y < 10)
	{
		cout << x + y << endl;
	}
	else
	{
		cout << "error" << endl;
	}
    return 0;
}



Measured memory_bytes: 256
/*我是菜鸡
╭╮＿＿╭╭╭╭╭＿＿╭╮
│　　　　　　　　　　　│　
│　　　　　　　　　　　│　
│　●　╭———╮　●　│　
│≡　　│●　●│　　≡│
│　　  ╰———╯　　　│
╰——┬○————┬—○╯
*/
#include<bits/stdc++.h>
#define _for(i,a,b) for(int i = (a);i<(b);++i)
#define cci ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn = 2e5+5;
int a[maxn],b[maxn];
int main() {
	cci;
	//ifstream cin("E:\\acm dream\\in.txt");
	//ofstream cout("E:\\acm dream\\out.txt");
	int n;
	while (cin >> n) {
		int ans = 0, t = INT_MAX, x;
		_for(i, 0, n) { 
			cin >> x;
			t = min(x, t);
			if (x <= t)ans++;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
n = int(input())

ans = [0 for _ in range(n)]

for x in range(1, 101):
    if x*x > n:
        break
    for y in range(1, 101):
        if x*x + y*y + x*y > n:
            break
        for z in range(1, 101):
            a = x*x + y*y + z * z + x*y + y*z + z*x
            if a > n:
                break
            ans[a-1] += 1

for a in ans:
    print(a)


Measured memory_bytes: 9136
N, A = map(int, input().split())
X = list(map(int, input().split()))
dp = [[0]*2501 for _ in range(N+1)] # dp[n][k] := カードn枚で合計kにする選び方の数
dp[0][0] = 1

for i, x in enumerate(X):
  for n in range(i+1, 0, -1):
    for k in range(x, 2501):
      dp[n][k] += dp[n-1][k-x]

ans = 0
for n in range(1, N+1):
  ans += dp[n][A*n]
print(ans)

Measured memory_bytes: 4596
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<28;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-10;
const ll mod=1e9+7;
const vi emp;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,-0};
const int DX[8]={-1,-1,-1,0,0,1,1,1},DY[8]={1,0,-1,1,-1,1,0,-1};

int a,b,c,d,e;

int main(){
	cin>>a>>b>>c>>d>>e;
	int m=max((b+d-1)/d,(c+e-1)/e);
	cout<<a-m<<endl;
}

Measured memory_bytes: 3088
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#define int long long
using namespace std;
signed main() {
	int n; cin >> n;
	set<int>s;
	for (int i = 0; i < n; i++) {
		int a; cin >> a;
		s.insert(a);
	}
	for (auto i = s.begin(); i != s.end(); i++) {
		if (i != s.begin())cout << ' ';
		cout << *i;
	}cout << endl;
}


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

using namespace std;

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

	int n;
	cin >> n;
	map<int, int> mp;
	for(int i =1; i<=100; ++i) {
		for(int j =1; j<=100; ++j) {
			for(int k =1; k<=100; ++k) {
				mp[i * i + j * j + k * k + i * j + i * k + j * k]++;
			}
		}
	}
	for(int i =1; i<=n; ++i) cout << mp[i] << '\n';
}

Measured memory_bytes: 5420
/*
    問題をよく読もう！
    論理的に考えよう！
    サンプルを確認しよう!
    絶対に諦めるな！
    工夫をしろ！

    Twitterは終わるまでログアウト！
    （間違えて解法をツイートしてはいけないから）

*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cctype>
using namespace std;
#define rep(i, n) for(int i=0; i<n; ++i)
typedef long long ll;
//必要な宣言

int main() {
  string s[3];
  rep(i, 3) cin >> s[i];

  cout << (char)toupper(s[0][0]) << (char)toupper(s[1][0]) <<
          (char)toupper(s[2][0]) << endl;

  return 0;
}

Measured memory_bytes: 256