akhauriyash/Code-Regression huggingface dataset:
#[derive(Default)]
//NOTE
//declare variables to reduce the number of parameters for dp and dfs etc.
struct Solver {}

impl Solver {
    fn solve(&mut self) {
        let stdin = std::io::stdin();
        let mut scn = Scanner {
            stdin: stdin.lock(),
        };
        let n: usize = scn.read();
        let k: usize = scn.read();
        let a: Vec<usize> = scn.vec(n);
        let result = (n - 2) / (k - 1) + 1;
        println!("{}", result);
    }
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| {
            let mut solver = Solver::default();
            solver.solve()
        })
        .unwrap()
        .join()
        .unwrap();
}
pub mod utils {
    const DYX: [(isize, isize); 8] = [
        (0, 1),   //right
        (1, 0),   //down
        (0, -1),  //left
        (-1, 0),  //top
        (1, 1),   //down right
        (-1, 1),  //top right
        (1, -1),  //down left
        (-1, -1), //top left
    ];

    pub fn try_adj(y: usize, x: usize, dir: usize, h: usize, w: usize) -> Option<(usize, usize)> {
        let ny = y as isize + DYX[dir].0;
        let nx = x as isize + DYX[dir].1;
        if ny >= 0 && nx >= 0 {
            let ny = ny as usize;
            let nx = nx as usize;
            if ny < h && nx < w {
                Some((ny, nx))
            } else {
                None
            }
        } else {
            None
        }
    }
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

#define ALL(a) (a).begin(), (a).end()
#define ll long long

using namespace std;

signed main(){
	int n; cin >> n;
	vector<int> a(2*n*n-2*n),b(2*n*n-2*n),c(n*n, -1), d(n*n, -1);
	vector<vector<int> > e(n*n);
	for(int i = 0; i < a.size(); i++){
		cin >> a[i] >> b[i];
		a[i]--;
		b[i]--;
		e[a[i]].push_back(b[i]);
		e[b[i]].push_back(a[i]);
	}
	for(int i = 0; i < e.size(); i++){
		if(e[i].size() == 2){
			d[i] = 0;
			queue<pair<int, int> > q;
			q.push(make_pair(i, 0));
			while(!q.empty()){
				auto tmp = q.front();
				q.pop();
				for(auto v : e[tmp.first]){
					if(d[v] == -1){
						d[v] = tmp.second+1;
						assert(0 <= d[v] && d[v] < 2*n);
						q.push(make_pair(v,tmp.second+1));
					}
				}
			}
			break;
		}
	}
	for(int i = 0; i < n*n; i++){
		if(d[i] == n-1 && e[i].size() == 2){
			c[i] = 0;
			queue<pair<int, int> > q;
			q.push(make_pair(i, 0));
			while(!q.empty()){
				auto tmp = q.front();
				q.pop();
				for(auto v : e[tmp.first]){
					if(c[v] == -1){
						c[v] = tmp.second+1;
						assert(0 <= c[v] && c[v] < 2*n);
						q.push(make_pair(v,tmp.second+1));
					}
				}
			}
			break;
		}
	}
	//cerr << "kkk" << endl;
	//vector<vector<int> > m(n, vector<int>(n));
	map<pair<int, int>, int> m;
	for(int i = 0; i < c.size(); i++){
		m[make_pair(d[i], c[i])] = i;
	}
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			int p1 = i+j;
			int p2 = i + n - j - 1;
			cout << m[make_pair(p1, p2)]+1;
			if(j != n-1)cout << " ";
		}
		cout << endl;
	}
	/*
	for(int i = 0; i < d.size(); i++){
		int r = (d[i] - c[i] + n)/2;
		int C = (c[i] + d[i])/2 - 1;
		assert(0 <= r && r < n);
		assert(0 <= C && C < n);
		m[r][C] = i;
	}
	for(int i = 0; i < n; i++){
		cout << (m[i][0]+1);
		for(int j = 1; j < n; j++){
			cout << " " << (m[i][j]+1);
		}
		cout << endl;
	}
	*/

	return 0;
}




Measured memory_bytes: 4196
import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    auto N = readln.chomp.to!long;
    writeln(
        cartesianProduct(iota(10), iota(10))
        .find!(t => t[0] * t[1] == N)
        .empty ? "No" : "Yes");
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  long long a, b, c, k, result;
  cin >> a >> b >> c >> k;
  
  if (a >= b && b >= c) {
    result = (a << k) + b + c;
  } else if (a >= c && c >= b) {
    result = (a << k) + b + c;    
  } else if (b >= a && a >= c) {
    result = (b << k) + a + c;
  } else if (b >= c && c >= a) {
    result = (b << k) + a + c;    
  } else if (c >= a && a >= b) {
    result = (c << k) + a + b;
  } else {
    result = (c << k) + a + b;
  }
  cout << result << endl;
  return(0);
}


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

namespace AtCoder_solve
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] data1 = Console.ReadLine().Split(' ');
            string[] data = Console.ReadLine().Split(' ');
            long n = long.Parse(data1[0]);
            long k = long.Parse(data1[1]);
            long[] d = new long[n];
            long ans = 0;

            for(long i = 0; i < n; i++)
            {
                d[i] = long.Parse(data[i]);
        
            }

            Array.Sort(d);

            for (long i = 0; i < n-k; i++)
            {
                ans += d[i];
            }

                Console.WriteLine(ans);
            
        }
    }
}


Measured memory_bytes: 35584
# include <bits/stdc++.h>
using namespace std;
long long C[2001][2001];
const long long mod = 1e9 + 7;
int main(){
	long long n , k , R , B;
	cin >> n >> k;
	B = k , R = n - k;
	for(int i = 0; i <= n; i ++){
		C[i][0] = 1;
		for(int j = 1; j <= i; j ++)
			C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;
	}
	for(int i = 1; i <= k; i ++)
		cout << C[R + 1][i] * C[B - 1][i - 1] % mod << "\n";
}

Measured memory_bytes: 30080
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int a, b, c;
  cin >> a >> b >> c;
  if (a <= c && b >= c)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
var h, dp: array[0..100010] of longint;
    n, i: longint;
begin
    readln(n);
    for i:=1 to n do
        read(h[i]);
    h[0]:=h[1];
    dp[1]:=0;
    for i:=2 to n do
    begin
        if (dp[i-1]+abs(h[i]-h[i-1]))>(dp[i-2]+abs(h[i]-h[i-2])) then
            dp[i]:=dp[i-2]+abs(h[i]-h[i-2])
        else
            dp[i]:=dp[i-1]+abs(h[i]-h[i-1]);
    end;
    writeln(dp[n]);
end.

Measured memory_bytes: 896
#include <stdio.h>

int main(){
	int a,b;
	int flag  = 1;
	scanf("%d %d",&a,&b);		
	char s[a+b+5];
	scanf("%s",s);
	//s[a] != '-' ? flag = 0 : flag  = 1;
	if(s[a]!= '-'){
		flag = 0;
	}
		for(int i=0;s[i]!='\0';i++){
			if(i!=a){
				if(s[i]<'0' || s[i]>'9'){
					flag = 0;
				}
			
			}
		}
		flag==1 ? puts("Yes") : puts("No");
 	return 0;
}

Measured memory_bytes: 2092
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    ll n,m,ans=0,sum=0; cin>>n>>m;
    vector<ll> x(n,0),y(m,0),xs(n,0),ys(m,0);
    rep(i,n) cin>>x[i];
    rep(i,m) cin>>y[i];
    rep(i,n){
        sum+=x[i];
        xs[i]=sum%MOD;
    }
    sum=0;
    rep(i,m){
        sum+=y[i];
        ys[i]=sum%MOD;
    }
    ll X=0,Y=0;
    rep(i,n){
        X=(X+(x[n-1-i]*(n-1-2*i))%MOD)%MOD;
        X=(X+MOD)%MOD;
    }
    rep(i,m){
        Y=(Y+(y[m-1-i]*(m-1-2*i))%MOD)%MOD;
        Y=(Y+MOD)%MOD;
    }
    cout<<(X*Y+MOD*3)%MOD<<endl;
}

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

#define ll long long
#define pb push_back
#define endl '\n'
#define fcin ios::sync_with_stdio(false); cin.tie(nullptr);
#define inf 0x3f3f3f3f

const int W = 1e5+5;
const int N = 101;
ll w[N], v[N];
int n, maxw;
ll dp[W];

int main(){
    fcin;
    cin >> n >> maxw;
    for(int i = 0; i < n; i++) cin >> w[i] >> v[i];
    for(int i = 0; i < n; i++){
        for(int wi = maxw - w[i]; wi >= 0; wi--){
            dp[wi+w[i]] = max(dp[wi+w[i]], dp[wi]+v[i]);
        }
    }
    ll ans = 0;
    for(int i = 0; i <= maxw; i++)
        ans = max(ans, dp[i]);

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

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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define what_is(x) cerr << #x << " is " << x << endl;

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	int a;
	int save = 0, total = 0;
	for (int i = 0; i < 5; i++) {
		cin >> a;
		total += a/10 * 10;
		if (a % 10) {
			total += 10;
			save = max(save, 10 - (a % 10));
		}
	}
	printf("%d\n", total - save);
}


Measured memory_bytes: 256
package main

import (
  "fmt"
  "sort"
)

func main() {
  var N, K int
  fmt.Scan(&N, &K)
//fmt.Println(N, K)
  x   := make([]int, N)
  y   := make([]int, N)
  sox := make([]int, N)
  soy := make([]int, N)
  for i:=0; i < N; i++ {
    fmt.Scan(&x[i], &y[i])
  }
  copy(sox, x)
  copy(soy, y)
  // sort
  sort.Sort(sort.IntSlice(sox))
  sort.Sort(sort.IntSlice(soy))

  // initial max
  ans := (sox[N-1]-sox[0]) * (soy[N-1]-soy[0])

  // check
  for x1:=0; x1 < N; x1++ {
    for x2:=x1+1; x2 < N; x2++ {
      for y1:=0; y1 < N; y1++ {
        for y2 := y1 + 1; y2 < N; y2++ {
			smlx := sox[x1]
            bigx := sox[x2]
            smly := soy[y1]
            bigy := soy[y2]
            count := 0
            for i:=0; i < N; i++ {
              if x[i]>=smlx && x[i]<=bigx && y[i]>=smly && y[i]<=bigy {
                count++
              }
            }
            if count >= K {
				area := (bigx-smlx) * (bigy-smly)
                if ans > area {
                    ans = area
                }
            }
        }
      }
	}
  }

  fmt.Println(ans)
}


Measured memory_bytes: 512
#pragma GCC optimize("Ofast")   //Comment optimisations for interactive problems (use endl)
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define  foo(i,a,n)     for(ll i = (a); i <= n; i++)
#define  frr(i,a,n)     for(ll i = (a); i >= n; i--)
#define  fo(i,n)        for(ll i = 0; i < n; i++)
#define  all(x)         (x).begin(),(x).end()
#define  mset(x,val)    memset(x,val,sizeof(x))
#define  newl           cout<<"\n"
#define  pb             push_back
#define  mp             make_pair
#define  s              second
#define  f              first
#define  dline          cerr<<"///REACHED///\n";
#define  deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define  deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define  deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;

const ll   MOD   =  1e+9+7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const ll   MAXN  =  1e+5+7;

vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

//<<-----Declare Variable Here------->>//
int t=1;
ll n;
//<<-----Implemen;t Functions Here---->>//
void solve(ll n)
{
	vll v;
	while(n>0)
	{
		n--;
		v.pb(n%26);
		n/=26;
	}
	reverse(all(v));ll len = v.size();
	for(ll i=0;i<len;i++)cout<<char('a'+v[i]);
}

//<<-----Start of Main--------------->>//
void MAIN(){
		cin>>n;
		solve(n);

}

int main(){
	fastio;randomINIT;

	//cin>>t;
	while(t--){
		MAIN();
	}

    #ifndef ONLINE_JUDGE
    cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    #endif
}

Measured memory_bytes: 5988
import sys
from collections import deque
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]

def main():
    N, Q = MI()
    #木
    tree = [[] for i in range(N)]
    for i in range(N-1):
        a,b = MI()
        tree[a-1].append(b-1)
        tree[b-1].append(a-1)
    #カウンター保存用、初期化
    counter = [0]* N
    score = [0]* N
    dq = deque()
    dq.append([0,-1])
    for i in range(Q):
        p, x = MI()
        counter[p-1] += x
    score[0] = counter[0]
    #score[tree[0][0]] = counter[tree[0][0]]
    while dq:
        temp, past = dq.pop()
        for num in tree[temp]:
            if num != past:
                score[num] = score[temp]+counter[num]
                dq.append([num,temp])
    score = [str(i) for i in score]
    print(" ".join(score))
    return None

if __name__ == "__main__":
    main()

Measured memory_bytes: 141648
#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void RI(T &x)
{
    x=0;bool f=0;char c=getchar();
    while(c<'0'||c>'9'){f|=(c=='-');c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    if(f) x=-x;
}
char A[1000005],B[1000005];
int N;

int main()
{
    scanf("%s",A);N=strlen(A);
    for(int i=0;i<N;++i)
        B[i]=A[N-i-1];
    for(int i=0;i<N;++i)
    {
        if(B[i]=='b') B[i]='d';
        else if(B[i]=='d') B[i]='b';
        else if(B[i]=='p') B[i]='q';
        else if(B[i]=='q') B[i]='p';
    }
    bool f=1;
    for(int i=0;i<N;++i)
        f&=A[i]==B[i];
    if(f) printf("Yes\n");
    else printf("No\n");
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include<map>
using namespace std;


int main() {
	int needA, haveB, repeatSE;
	cin >> needA >> haveB >> repeatSE;

	int canRead = haveB / needA;

	int result = min(canRead, repeatSE);
	cout << result;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
# coding: utf-8
# Your code here!
N=int(input())
A=list(map(int,input().split()))

for i in range(N):
    A[i]-=(i+1)

A.sort()

temp1=A[N//2]
temp2=A[N//2-1]

ans1=0
for i in range(N):
    ans1+=abs((A[i])-temp1)

ans2=0
for i in range(N):
    ans2+=abs((A[i])-temp2)
    
print(min(ans1,ans2))

Measured memory_bytes: 25744
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 50;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
using namespace std;

void solve(){
    string s;
    cin>>s;
    int n=s.size();
    ll ans=0;
    for(int i=0;i<(1<<(n-1));++i){
        ll sum=s[0]-'0';
        rep(j,n-1){
            if(1<<j&i){
                ans+=sum;
                sum=s[j+1]-'0';
            }
            else {
                sum*=10;
                sum+=s[j+1]-'0';
            }
        }
        ans+=sum;
    }
    cout<<ans<<"\n";
}
 
signed main(){
	ios::sync_with_stdio(false);
    cin.tie(0);
	cout<<fixed<<setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
typedef struct pair<ll,ll> P;

//1. dp,変数
int n,m;
ll c;
//2. 道（辺）と都市（頂点）
vector<P> road[100001];
ll d[200001]={};
ll dp[100001]={};
ll dp2[100001]={};


int main() {
	//3. 入力
	int k,s;
	cin>>k>>s;
	int total=0;
	for(int x=0;x<k+1;++x){
		for(int y=0;y<k+1;++y){
			if(((x+y)<=s)&&((x+y)>=(s-k)))total++;
		}
	}
	cout <<total<< endl;
	return 0;
}


Measured memory_bytes: 3712
n, m  = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
if(n>=m):
    print(0)
    exit()
dis = []
for i in range(len(x)-1):
    dis.append(x[i+1] - x[i])
dis.sort(reverse=True)
long_len = 0
for i in range(n-1):
    long_len += dis[i]
print(sum(dis)-long_len)


Measured memory_bytes: 13968
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define fast_io(); std::ios_base::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);

int main(){
    ll k,a,b;
    std::cin >> k >> a >> b;

    //A枚以下のとき1回の操作で1枚増える
    //A枚以上ある時2回の操作でB-A枚増える
    if(b-a>1 && k-a>-1) std::cout << (b-a)*((k-(a-1))/2) + (k-(a-1))%2 + a << "\n";
    else std::cout << k+1 << "\n";
    return 0;
}


Measured memory_bytes: 3604
#include "bits/stdc++.h"
using namespace std;

using ll = long long int;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

#define pi 3.14159265358979323846

template<class T>bool ch1000000(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; }





int main() {
  int H, W, K;
  cin >> H >> W >> K;

  vector<vector<char>> mass(H, vector<char>(W));
  vector<int> h(H, 0), w(W, 0);

  int black = 0;

  rep(i, 0, H){
    rep(j, 0, W){
      char c;
      cin >> c;
      mass[i][j] = c;
      if(c == '#') {
        h[i]++;
        w[j]++;
        black++;
      }
    }
  }

  if(black < K){
    cout << 0 << endl;
    return 0;
  }

  ll sum = 0, cnt = 0;
  for(int i = 0; i < (1 << H); i++){
    

    for(int j = 0; j < (1 << W); j++){
      vector<vector<char>> mass_i = mass;


      for(int k = 0; k < H; k++){
        for(int l = 0; l < W; l++){
          if(i & (1 << k)){
            for(int m = 0; m < W; m++){
              mass_i[k][m] = '.';
            }
          }
          if(j & (1 << l)){
            for(int n = 0; n < H; n++){
              mass_i[n][l] = '.';
            }
          }
        }
      }

      int ans = 0;
      rep(k, 0, H){
        rep(l, 0, W){
          if(mass_i[k][l] == '#'){
            ans++;
          }
        }
      }
      
      if(ans == K){
        sum++;
      }


    }
  }

  cout << sum << endl;


  // cout << setprecision(8) << ans << endl;  // For double
}



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

int main()
{
  int n;
  cin>>n;
  pair<int64_t,int64_t> lim;
  cin>>lim.first>>lim.second;
  
  for (int i = 1; i < n; ++i)
  {
    int64_t a,b;
    cin>>a>>b;
    int64_t maga=lim.first/a;
    int64_t magb=lim.second/b;
    if(lim.first%a!=0) maga++;
    if(lim.second%b!=0) magb++;
    pair<int64_t,int64_t> ansa,ansb;
    ansa.first=a*maga;
    ansa.second=b*maga;
    ansb.first=a*magb;
    ansb.second=b*magb;
    if(ansa.first>=lim.first&&ansa.second>=lim.second&&ansb.first>=lim.first&&ansb.second>=lim.second){
      if(ansb.first+ansb.second>=ansa.first+ansa.second){
        lim=ansa;
      }
      else lim=ansb;
    }
    else if(ansb.first>=lim.first&&ansb.second>=lim.second){
        lim=ansb;
      }
    else lim=ansa;
  }

  cout<<lim.first+lim.second;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        int r = scan.nextInt();
        int d = scan.nextInt();
        int x = scan.nextInt();
        System.out.println(r * x - d);
        System.out.println(r * r * x - r * d - d);
        System.out.println(r * r * r * x - r * r * d - r * d - d);
        System.out.println((int)(Math.pow(r, 4) * x - r * r * r * d - r * r * d - r * d - d));
        System.out.println((int)(Math.pow(r, 5) * x - Math.pow(r, 4) * d - r * r * r * d - r * r * d - r * d - d));
        System.out.println((int)(Math.pow(r, 6) * x - Math.pow(r, 5) * d - Math.pow(r, 4) * d - r * r * r * d - r * r * d - r * d - d));
        System.out.println((int)(Math.pow(r, 7) * x - Math.pow(r, 6) * d - Math.pow(r, 5) * d - Math.pow(r, 4) * d - r * r * r * d - r * r * d - r * d - d));
        System.out.println((int)(Math.pow(r, 8) * x - Math.pow(r, 7) * d - Math.pow(r, 6) * d - Math.pow(r, 5) * d - Math.pow(r, 4) * d - r * r * r * d - r * r * d - r * d - d));
        System.out.println((int)(Math.pow(r, 9) * x - Math.pow(r, 8) * d - Math.pow(r, 7) * d - Math.pow(r, 6) * d - Math.pow(r, 5) * d - Math.pow(r, 4) * d - r * r * r * d - r * r * d - r * d - d));
        System.out.println((int)(Math.pow(r, 10) * x - Math.pow(r, 9) * d - Math.pow(r, 8) * d - Math.pow(r, 7) * d - Math.pow(r, 6) * d- Math.pow(r, 5) * d - Math.pow(r, 4) * d - r * r * r * d - r * r * d - r * d - d));
    }
}

Measured memory_bytes: 21844
// luogu-judger-enable-o2
#pragma GCC optimize(2)

#include <bits/stdc++.h>

using namespace std;
#define rg register
typedef long long ll;

template<typename T>
bool read(T &n) {
    T ans = 0, flag = 1;
    char ch;
    while ((ch = getchar()) < '0' || ch > '9') if (ch == '-') flag = -1; else if (ch == EOF) return false;
    ans = ch - '0';
    while ((ch = getchar()) >= '0' && ch <= '9') ans = ans * 10 + ch - '0';
    n = ans * flag;
    return true;
}

template<typename T>
T read() {
    T ans = 0, flag = 1;
    char ch;
    while ((ch = getchar()) < '0' || ch > '9') if (ch == '-') flag = -1; else if (ch == EOF) return false;
    ans = ch - '0';
    while ((ch = getchar()) >= '0' && ch <= '9') ans = ans * 10 + ch - '0';
    return ans * flag;
};
struct QUE {
    int l, r, id;
} que[500004];
int sz, belong[500004], n, m, pre[500004],cnt[500004];
ll fz[500004], fm[500004],ans;

bool cmp(QUE a, QUE b) {
    return belong[a.l] == belong[b.l] ? (belong[a.l] % 2 ? a.r < b.r : a.r > b.r) : belong[a.l] < belong[b.l];
}

int main() {
    read(n), read(m);
    sz = sqrt(n);
    for (int i = 1; i <= n; i++) read(pre[i]);
    for (int i = 1; i <= m; i++) read(que[i].l), read(que[i].r), que[i].id = i, belong[i] = (i - 1) / sz + 1;
    sort(que + 1, que + m + 1, cmp);
    int nl=que[1].l,nr=que[1].l;
    cnt[pre[nl]]++;ans=1;
    for (int i = 1; i <= m; i++) {
        while (nl<que[i].l) {
        	if(cnt[pre[nl]]==1) ans--;
        	cnt[pre[nl]]--,nl++;
        }
        while (nr>que[i].r) {
        	if(cnt[pre[nr]]==1) ans--;
        	cnt[pre[nr]]--,nr--;
        }
        while (nl>que[i].l) {
        	nl--;
        	if(cnt[pre[nl]]==0) ans++;
        	cnt[pre[nl]]++;
        }
        while (nr<que[i].r) {
        	nr++;
        	if(cnt[pre[nr]]==0) ans++;
        	cnt[pre[nr]]++;
        }
        fz[que[i].id]=ans;
    }
    for(int i=1;i<=m;i++){
        printf("%lld\n",fz[i]);
    }
    return 0;
}

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

int solve(long long N, std::vector<long long> a){
    ll res = 0;
    for (auto v : a) {
        while (v % 2 == 0) {
            res++;
            v /= 2;
        }
    }
    return res;
}

// Generated by 1.1.4 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 N;
    scanf("%lld",&N);
    std::vector<long long> a(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&a[i]);
    }
    cout << solve(N, std::move(a)) << endl;
    return 0;
}


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

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> to(n);
  vector<vector<int>> ot(n);
  rep(i,m) {
    int s, t;
    cin >> s >> t;
    --s; --t;
    to[s].push_back(t);
    ot[t].push_back(s);
  }

  vector<double> dp(n);
  dp[n-1] = 0;
  for (int v = n-2; v >= 0; --v) {
    int deg = to[v].size();
    for (int u : to[v]) dp[v] += (dp[u]+1)/deg;
  }

  vector<double> p1(n);
  p1[0] = 1;
  for (int v = 1; v < n; ++v) {
    for (int u : ot[v]) {
      p1[v] += p1[u]/to[u].size();
    }
  }

  double ans = dp[0];
  for (int v = 0; v <= n-2; ++v) {
    int deg = to[v].size();
    if (deg == 1) continue;
    double x = dp[v]*deg/(deg-1);
    for (int u : to[v]) {
      double nx = x - (dp[u]+1)/(deg-1);
      ans = min(ans, dp[0] + p1[v]*(nx-dp[v]));
    }
  }

  printf("%.10f\n", ans);
  return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define PP pair<P,P>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;
template<class T> inline void chmax(T& a, T b) { a = max(a, b); }
template<class T> inline void chmin(T& a, T b) { a = min(a, b); }

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
int get_rand(int MIN, int MAX) {
	random_device rnd;
	mt19937_64 mt64(rnd());
	uniform_int_distribution<int>engine(MIN, MAX);
	return engine(mt64);
}
/*--------Library Zone!--------*/



int n, a[114514];
signed main() {
	cin >> n;
	int cnt = 0;
	rep(i, n)cin >> a[i];
	int ma = 0;
	REP(i, n) {
		if (a[i] <= a[i - 1])cnt++;
		else {
			chmax(ma, cnt); cnt = 0;
		}
	}
	chmax(ma, cnt);
	cout << ma << endl;
}


Measured memory_bytes: 1024
//Ruthless Coding 
#include <bits/stdc++.h>

#define uni(x)      (x).resize(unique(ALL(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

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

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

const int N = 2e5 + 5;
ll gc(ll a, ll b){
    if(b == 0) return a;
    return gc(b, a % b);
}
ll lcm(ll a, ll b){
    return (a * b) / gc(a, b);
}
string s, t;
bool check(ll len){
    ll n = s.size();
    ll m = t.size();
    map<ll, char> mp;
    for(ll i = 0; i < n; i++){
        ll idx = i * (len / n) + 1;
        mp[idx] = s.at(i);
    }
    for(ll i = 0; i < m; i++){
        ll idx = i * (len / m) + 1;
        if(!mp.count(idx)){
            mp[idx] = t.at(i);
        }else{
            if(mp[idx] != t[i]){
                return false;
            }
        }
    }
    return true;
}
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    ll n, m;
    cin >> n >> m;
    cin >> s >> t;
    ll d = lcm(n, m);
    ll lo = 0, hi = 1e10;
    while(hi - lo > 1){
        ll mid = lo + hi >> 1;
        if(check(mid * d)) hi = mid;
        else lo = mid;
    }
    if(hi == 1e10){
        cout << -1;
    }else{
        cout << hi * d;
    }
    return 0;
}
/*
    *** Most Impo.. -> check base case always
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

Measured memory_bytes: 13692
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

// Data :
type Data struct {
	f, t int
}

// Datas :
type Datas []Data

func (p Datas) Len() int {
	return len(p)
}

func (p Datas) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Datas) Less(i, j int) bool {
	return p[i].f < p[j].f
}

func main() {
	sc.Split(bufio.ScanWords)
	_, M := getInt(), getInt()
	p := make(Datas, M)
	for i := 0; i < M; i++ {
		a, b := getInt(), getInt()
		p[i] = Data{a, b}
	}
	sort.Sort(p)
	// out(p, N)
	l := p[0].f
	r := p[0].t
	ans := 0
	for i := 1; i < M; i++ {
		if r <= p[i].f {
			l = p[i].f
			r = p[i].t
			// out("cut")
			ans++
		} else {
			l = max(l, p[i].f)
			r = min(r, p[i].t)
		}
		// out(l, r)
	}
	if l != r {
		ans++
	}
	out(ans)
}


Measured memory_bytes: 3456
#include<cstdio>
#include<iostream>
using namespace std;
int gcd(int ,int );
int main(){
    int x,y;
    cin>>x>>y;
    cout<<gcd(x,y)<<endl;
    
    return 0;
}
int gcd(int x,int y)
{
    if(x % y == 0) return y;
    else return gcd(y, x % y);
}




Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
   /* #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
    ll r;
    cin>>r;
    double d=22/double(7);
    ///cout<<d<<endl;
    cout<<2*r*d<<endl;
}
return 0;
}

Measured memory_bytes: 3808
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{ll n,c=0;
cin>>n;
ll d;
cin>>d;
while(n--){
    ll x,y;
    cin>>x;
    cin>>y;
    ll sq=pow(x,2)+pow(y,2);
    if(sqrt(sq)<=d){
        c++;
    }
    
}
cout<<c;
      return 0;
}



Measured memory_bytes: 3672
import java.io.*;
import java.util.*;
public class Main {
	
	public static void main(String[] args) {
	
		MyScanner sc = new MyScanner();
		long a=sc.nextLong();
		long b=sc.nextLong();
	
		System.out.println(a%b==0?"-1":a);
	}
	
	public static PrintWriter out;

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

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

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

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

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

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

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

	}
	

}





Measured memory_bytes: 21588
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int remain[200005];

int main() {
  // 素数が2,5に注意、ApplePen、余りの状態数を持ったdp
  // 余りの累積和を保持
  ll N, P;
  cin >> N >> P;
  string S;
  cin >> S;
  if (P == 2 || P == 5) {
    ll ans = 0;
    for (int i = 0; i < N; i++) {
      int cur = S[i] - '0';
      if (cur%P == 0) ans += i+1;
    }
    cout << ans << '\n';
    return 0;
  }
  reverse(S.begin(), S.end());
  ll power = 1;
  ll temp = 0;
  remain[0] = 1;
  for (int i = 0; i < N; i++) {
    ll cur = S[i] - '0';
    temp += cur * power;
    temp %= P;
    remain[temp]++;
    power *= 10; power %= P;
  }
  ll ans = 0;
  for (int i = 0; i < P; i++) {
    ll r = remain[i];
    if (r > 1) ans += r * (r-1) / 2;
  }
  cout << ans << '\n';
  return 0;
}

// 20


Measured memory_bytes: 3780
// はは〜ん！！この問題Pythonで解かせる気無いな〜
// 無知だからC++のコンパイラのインストールから初めて大変だったんだぞ〜

#include <iostream>
#include <string>
#include <bitset>

using namespace std;

const int SIZE = 2000;
bitset<SIZE> A[SIZE];
bitset<SIZE> dpl[SIZE];
bitset<SIZE> dpr[SIZE];

int main() {
    int N;
    cin >> N;
    for (int i = 0; i < N; i++) {
        dpl[i][i] = 1;
        dpr[i][i] = 1;
    }

    for (int i = 1; i < N; i++) {
        string a;
        cin >> a;
        for (int j = 0; j < i; j++) {
            if (a[j] == '1') {
                A[i][j] = 1;
            } else {
                A[j][i] = 1;
            }
        }
    }

    for (int dist = 1; dist < N; dist++) {
        for (int i = 0; i < N - dist; i++) {
            int j = i + dist;
            if ((A[i] & dpl[i+1] & dpr[j]).any()) {
                dpr[j][i] = 1;
            }
            if ((A[j] & dpl[i] & dpr[j-1]).any()) {
                dpl[i][j] = 1;
            }
        }
    }

    int ret = (dpl[0] & dpr[N-1]).count();
    cout << ret << endl;
}

Measured memory_bytes: 1792
#include <iostream>
using namespace std;
int N;
int A, B;
int sum(int x)
{
    int ret = 0;
    while(x > 0)
    {
        ret += x % 10;
        x /= 10;
    }
    return ret;
}
int main()
{
    cin >> N;
    int ans = 1000000005;
    for(int i = 1; i < N; i++)
    {
        int a = sum(i), b = sum(N - i);
        ans = min(ans, a + b);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
typedef long long ll;
typedef pair<int,int> P;
int main() {
    int N,M;
    map<ll, ll>D;
    map<ll, ll>T;
    cin >> N;
    rep(i, 0, N){
        ll tmp;
        cin >> tmp;
        D[tmp]++;
    }
    cin >> M;
    rep(i, 0, M){
        ll tmp;
        cin >> tmp;
        T[tmp]++;
    }
    for (auto &p : T){
        ll index = p.first;
        if(D[index]<p.second){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 28456
import math

def wa(n):
    S = 0
    while n > 0:
        S += n % 10
        n = math.floor(n / 10)
    return S

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

ans = 0
for i in range(1, N+1):
    S = wa(i)
    if A <= S & S <= B:
       ans += i

print(ans)

Measured memory_bytes: 3060
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
ans=0
for i in range(N):
    if B[i]<=A[i]:
        ans+=B[i]
    else:
        ans+=A[i]
        B[i]-=A[i]
        ans+=min(B[i],A[i+1])
        A[i+1]-=min(B[i],A[i+1])
print(ans)

Measured memory_bytes: 18476
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using ll = long long;
using namespace std;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

string S;

bool judge(int a){
    if(a > 0 && a <= 12) return true;
    else return false;
}

int main(){
    cin >> S;
    int a = stoi(S.substr(0,2));
    int b = stoi(S.substr(2,2));
    
    if(judge(a)&&judge(b)) cout << "AMBIGUOUS" << '\n';
    else if(judge(a)) cout << "MMYY" << '\n';
    else if(judge(b)) cout << "YYMM" << '\n';
    else cout << "NA" << '\n';
    
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <vector>
#include <random>
using namespace std;

/////////////////////////////////////////////////////////////////////////////////////////////
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

int main()
{
    double n; cin >> n;
    cout << (double)2 * n * 3.141592 << endl;
    return 0;
}



Measured memory_bytes: 3800
N,W = map(int,input().split())
li = [list(map(int,input().split())) for i in range(N)]

dp = [[0 for i in range(W+1)] for j in range(N+1)]

for i in range(N):
    for sum_w in range(W+1):
        if sum_w >= li[i][0]:
            dp[i+1][sum_w] = max(dp[i][sum_w-li[i][0]]+li[i][1],dp[i][sum_w])
        else:
            dp[i+1][sum_w] = dp[i][sum_w]

print(dp[N][W])


Measured memory_bytes: 173576
#include <cstdint>
#include <iostream>

using namespace std;

int main() {
  int64_t N, Y;
  cin >> N >> Y;
  for (int i = 0, size_i = max(Y / 10000, N); i <= size_i; ++i) {
    if (i * 10000 == Y && i == N) {
      cout << i << " 0 0" << endl;
      return 0;
    }
    for (int j = 0, size_j = max(Y / 5000, N); j <= size_j; ++j) {
      int sum2 = i * 10000 + j * 5000;
      if (sum2 == Y && N == i + j) {
        cout << i << " " << j << " 0" << endl;
        return 0;
      }
      int rest = (Y - sum2) / 1000;
      if (0 <= rest && rest + (i + j) == N) {
        cout << i << " " << j << " " << rest << endl;
        return 0;
      }
    }
  }
  cout << "-1 -1 -1" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <math.h>

int main (void)
{
    intmax_t L, R;
    intmax_t ans = 2019;

    scanf("%jd%jd", &L, &R);

    if ((R - L) >= 2018) {
        puts("0");
        return 0;
    }

    L %= 2019;
    R %= 2019;

    if (R <= L) {
        ans = 0;
    } else {
        for (intmax_t i = L; i <= R; i++) {
            for (intmax_t j = (i + 1); j <= R; j++) {
                if (((i * j) % 2019) < ans) ans = (i * j) % 2019;
            }
        }
    }

    printf("%jd\n", ans);

    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const int INF=1000000001;
const double PI=3.141592653589;


int main(){
  string s; cin>>s;
  int ans=0;
  rep(i,3){
    if(s[i]=='1')
    ans++;
  }
  cout<<ans<<endl;

  return 0;
}


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

public class Main {
  public static void main(String[] args) throws NumberFormatException, IOException {
    BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

    while (input.ready()) {
      String[] dataA = input.readLine().split(" ");
      String[] dataB = input.readLine().split(" ");
      System.out.println(getHitCount(dataA, dataB) + " " + getBlowCount(dataA, dataB));
    }
  }

  private static int getHitCount(String[] a, String[] b) {
    int ret = 0;
    for (int i = 0; i < a.length; i++) {
      if (a[i].equals(b[i])) {
        ret++;
      }
    }
    return ret;
  }

  private static int getBlowCount(String[] a, String[] b) {
    int ret = 0;
    for (int i = 0; i < a.length; i++) {
      for (int j = 0; j < b.length; j++) {
        if (i == j) {
          continue;
        }
        if (a[i].equals(b[j])) {
          ret++;
        }
      }
    }
    return ret;
  }
}

Measured memory_bytes: 24204
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
static const ll maxLL = (ll)1 << 62;
long long int a[333],b[333],c[333],d[333];

int main(){
    string s,t;
    cin>>s>>t;
    reverse(s.begin(),s.end());
    reverse(t.begin(),t.end());
    bool can;
    repe(i,0,s.size()-t.size()){
        if(s.size()<t.size())break;
        can=true;
        rep(j,0,t.size()){
            if(!(s[i+j]==t[j] || s[i+j]=='?'))can=false;
        }
        if(can)rep(j,0,t.size())s[i+j]=t[j];
        if(can)break;
    }
    if(can){
        for(int i=s.size()-1;i>=0;i--){
        if(s[i]=='?')s[i]='a';
        cout<<s[i];
    }}else{
        cout<<"UNRESTORABLE";
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep2(i,x,n) for(int i=x;i<n;++i)

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

    int ans = 0;
    rep2(i,1,n+1)
    {
        int digits = 0;
        int j = i;
        while(j > 0)
        {
            ++digits;
            j /= 10;
        }

        if(digits%2 == 1)
            ++ans;
    }

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

Measured memory_bytes: 256