akhauriyash/Code-Regression huggingface dataset:
S = int(input())

f = S // 100
b = S % 100

if 1 <= f and f <= 12:
	if 1 <= b and b <= 12:
		print("AMBIGUOUS")
	else:
		print("MMYY")
else:
	if 1 <= b and b <= 12:
		print("YYMM")
	else:
		print("NA")

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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    int A, B, C, D, E, F; cin >> A >> B >> C >> D >> E >> F;
    const int MAX_NUM_A = 30 / A;
    const int MAX_NUM_B = 30 / B;
    const int MAX_NUM_C = 3000 / C;
    const int MAX_NUM_D = 3000 / D;
    vi water, sugar;

    for(int a = 0; a <= MAX_NUM_A; a++)
    {
        for(int b = 0; b <= MAX_NUM_B; b++)
        {
            water.push_back(100*A*a + 100*B*b);
        }
    }

    for(int c = 0; c <= MAX_NUM_C; c++)
    {
        for(int d = 0; d <= MAX_NUM_D; d++)
        {
            sugar.push_back(C*c + D*d);
        }
    }

    int ans[2] = {100*A, 0};
    float max = 0;
    for(int i = 0; i < water.size(); i++)
    {
        for(int j = 0; j < sugar.size(); j++)
        {
            int mass = water[i] + sugar[j];
            if(sugar[j] > water[i] / 100 * E) continue;
            if(mass > F || mass == 0) continue;
            float concentration = (float)sugar[j] / mass;
            if(max < concentration)
            {
                max = concentration;
                ans[0] = mass;
                ans[1] = sugar[j];
            }
        }
    }

    cout << ans[0] << " " << ans[1] << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    solve();

    return 0;
}

Measured memory_bytes: 34660
n = int(input())
a = [int(input()) for _ in range(n)]

total = {}
for i in a:
  if i in total:
    total[i] += 1
  else:
    total[i] = 1

ans = 0
for i in total.values():
  if i%2 :
    ans += 1

print(ans)

Measured memory_bytes: 16272
program prob3
    implicit none
    character(100005) :: s
    integer :: a, b, i, N
    read(*,*) s
    N = len_trim(s)
    a = 0
    b = 0
    do i = 1, N
        if(s(i:i) == '1')then
            a = a + 1
        else
            b = b + 1
        end if
    end do

    write(*,*) 2*min(a, b)
    stop
contains
end program prob3

Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define debug(...) cerr<<__LINE__<<" ["<<#__VA_ARGS__<<"]:",debug_out(__VA_ARGS__)
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec)
{ for (auto v : vec) os << v << ' '; os << '\n'; return os; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa)
{ os << '(' << pa.first << ',' << pa.second << ')'; return os; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T)
{ cerr << " " << H; debug_out(T...); }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

vector<ll> divs(ll n) {
    vector<ll> ret;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.emplace_back(i);
            if (i < n / i) ret.emplace_back(n / i);
        }
    }
    return ret;
}

void solve() {
    ll n;
    cin >> n;
    auto div = divs(n);
    ll ans = LINF;
    for(ll x: div) {
        chmin(ans, x + n / x);
    }
    cout << ans - 2 << endl;
}

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


Measured memory_bytes: 3680
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
 
	int n;
	cin >> n;
 
	ll m, v, p;
	cin >> m >> v >> p;
	
	vector<ll> as(n);
	for (int i = 0; i < n; ++i) cin >> as[i];
	sort(as.begin(), as.end());
	
	int low = 0;
	int high = n;
	while(low != high) {
		int mid = (low + high + 1) >> 1;
		int i = n-mid;

		ll x = as[i] + m;
		ll tar = m * max(0ll, v-(i+1)-(p-1));
		ll can = 0;
		bool fail = false;
		for (int j = i+1; j <= n-p; ++j) {
			if (as[j] > x) fail = true;
			else can += min(m, x - as[j]);
		}
		if (can >= tar && !fail) {
			low = mid;
		} else {
			high = mid - 1;
		}
		
	}
	cout << low << '\n';
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#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()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
int gcd(int a, int b) { return a ? gcd(b%a, a) : b; }
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/









int N, X, x[101010];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> X;
    rep(i, 0, N) cin >> x[i];

    int ans = 0;
    rep(i, 0, N) ans = gcd(ans, x[i] - X);
    cout << abs(ans) << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#define N 2010
#define M 2000001
#define ls i << 1
#define rs i << 1 | 1
#define inf 0x3f3f3f3f
#define inc(i) (++ (i))
#define dec(i) (-- (i))
// #define mid ((l + r) >> 1)
#define int long long
#define XRZ 998244353
#define debug() puts("XRZ TXDY");
#define n_ ((n >> 1) + 1)
#define mem(i, x) memset(i, x, sizeof(i));
#define Next(i, u) for(register int i = head[u]; i ; i = e[i].nxt)
#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout);
#define Rep(i, a, b) for(register int i = (a) , i##Limit = (b) ; i <= i##Limit ; inc(i))
#define Dep(i, a, b) for(register int i = (a) , i##Limit = (b) ; i >= i##Limit ; dec(i))
// const int dx[10] = {1, -1, 0, 0};
// const int dy[10] = {0, 0, 1, -1};
using namespace std;
inline int read() {
    register int x = 0, f = 1; register char c = getchar();
    while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
    return x * f;
}
void work() {}
signed main(void){
	int H,W;
	H=read(),W=read();
	int ans=H*W/2;
	if(H*W%2){
		++ans;
	}
	if(H==1||W==1){
		printf("1");
		return 0;
	}
	printf("%lld",ans);
	return 0;
}

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

int main()
{
	int n, m;
	cin >> n >> m;
	vector<pair<int,char>> input;
	input.reserve(m);
	for (int i=0;i<m; i++)
	{
		int s;
		char c;
		cin >> s >> c;
		input.push_back( make_pair(s, c) );
	}

	for (int num=0; num < 1000;num++ )
	{
			string snum = to_string(num);
			if (snum.size() != n) continue;

			int cnt=0;
			for (auto term: input)
			{
				if (snum.at( term.first-1 ) == term.second ) cnt++;
			}
			if (cnt == m)
			{
				cout << snum << endl;
				return 0;
			}
	}
	cout << -1 << endl;
}

Measured memory_bytes: 256
program abc129a
  implicit none
  integer :: p, q, r
  integer :: flight_time(3)

  read(*,*) p, q, r

  flight_time(1) = p + q  ! A->B->C
  flight_time(2) = r + q  ! A->C->B
  flight_time(3) = p + r  ! B->A->C

  print *, minval(flight_time(:), 1)

end program abc129a


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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 30;

// 0-indexの有向グラフの隣接リストを渡すと、頂点の順番が入ったvectorが返されます
vector<int> topologicalsort(const vector<vector<int> > &G) {
  const int V = G.size();      // V…頂点の数
  vector<int> indegree(V, 0);  // それぞれの頂点の入次数
  stack<int> S;                // 入次数0を突っ込むstack

  for (auto &edges : G)  // 全ての頂点の入次数を計算する
    for (auto &v : edges)
      indegree[v]++;

  for (int i = 0; i < V; i++)  // もし入次数0なら、Sに追加
    if (!indegree[i])
      S.push(i);

  vector<int> res;  // トポロジカル順に頂点を並べる
  while (S.size()) {
    int r = S.top();  // 根の番号をrに突っ込む
    res.push_back(r);
    S.pop();
    for (auto &v : G[r]) {  // rからの矢印を無かったことにする
      indegree[v]--;
      if (indegree[v] == 0)  // 入次数が0なら追加
        S.push(v);
    }
  }
  return res;
}

// ====================================================================

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int> > v;
  v.resize(n);

  int s, t;
  for (int i = 0; i < m; i++) {
    cin >> s >> t;
    s--;  // 0-indexedに合わせる
    t--;
    v[s].push_back(t);
  }

  vector<int> topo(n);
  topo = topologicalsort(v);

  vector<int> dp(n, -1);  // 頂点iから葉への最長
  dp[n - 1] = 0;
  for (int i = n - 1; i >= 0; i--) {
    int now = topo[i];
    if (v[now].size() == 0) {  // 葉だったら
      dp[now] = 0;
    }
    for (int j = 0; j < v[topo[i]].size(); j++) {
      dp[now] = max(dp[now], dp[v[now][j]] + 1);
    }
  }

  cout << *max_element(dp.begin(), dp.end()) << endl;
}


Measured memory_bytes: 7164
#include <iostream>
#include <vector>

using namespace std;
constexpr int64_t MOD = 1'000'000'007;
constexpr int     MAX =         1'005;

int64_t fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

int main(void) {
    int N, A, B, C, D;
    cin >> N >> A >> B >> C >> D;
    COMinit();

    vector<int64_t> v(N+1);
    v[N] = fac[N];
    for(int i=B; i>=A; i--) {
        for(int j=0; j<=N; j++) {
            int64_t tmp = 1;
            for(int k=1; k<=D; k++) {
                int next = j - k*i;
                tmp *= finv[i];
                tmp %= MOD;
                if(next < 0) break;
                if(k < C) continue;
                v[next] += (v[j] * tmp) % MOD * finv[k] % MOD;
                v[next] %= MOD;
            }
        }
    }

    cout << v[0] << endl;
    return 0;
}


Measured memory_bytes: 256
A = list(input())
import math
B = []
C = []
count = 0
for i in range(math.ceil(len(A) / 2)):
    B.append(A[count])
    count += 2
count = 1
for i in range(math.floor(len(A) / 2)):
    C.append(A[count])
    count += 2
if "L" not in B and "R" not in C:
    print("Yes")
else:
    print("No")

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

int64_t gcd(int64_t, int64_t);
int main() {
    int64_t a,b;
    cin>>a>>b;

    int64_t z = gcd(a,b);
    int ans = 1;
  
    if(z%2==0) {
        while(z%2==0) z = z/2;
        ans++;
    }

    int64_t div = 3;
    while(z>1 && div*div<=gcd(a,b)) {
        if(z%div == 0) {
            while(z%div==0) {
                z = z/div;
            }
            ans++;
        } 
        div += 2;
    }
  if(z>1) ans++;
    cout<<ans<<endl;

}


int64_t gcd(int64_t a, int64_t b) {
    if(a>b) {
        int64_t c = a;
        a = b;
        b = c;
    }

    if(b%a==0) return a;
    else {
        int64_t c = b%a;
        return gcd(a,c);
    }
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;
#define int long long
signed main(){
  int a,b,c;
  int x,y;
  cin>>a>>b>>c;
  cin>>x>>y;
  int ans=0;
  int ans2=0;
  int ans3=0;

    int z=min(x,y);
    ans+=c*2*(z);
    dump(ans);
    ans+=(x-z)*a;
    ans+=(y-z)*b;

    ans2+=x*a;
    ans2+=y*b;

    ans3+=c*2*max(x,y);

  cout<<min(ans,min(ans2,ans3))<<endl;


}


Measured memory_bytes: 256
implicit none
integer(8) :: a,b,c,d
character(3) :: s
read(*,*) s

if ( s(1:1)/=s(2:2) .and. s(2:2)/=s(3:3) .and. s(3:3)/=s(1:1) ) then
    write(*,*)  "Yes"
else
    write(*,*) "No"
endif

end

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <queue>
#include <vector>

#define pb push_back

using namespace std;

typedef long long ll;

int main()
{
        vector<int> height(10);
        for(int i=0; i<10; ++i) cin >> height[i];
        sort(height.begin(), height.end(), greater<int>());
        for(int i=0; i<3; ++i) cout << height[i] << endl;

        return 0;
}


Measured memory_bytes: 3088
import scala.annotation.tailrec
import scala.math._

object Main extends App {

  val YES = "YES"
  val Yes = "Yes"
  val NO = "NO"
  val No = "No"

  val input: Array[Array[Int]] = Array.ofDim(6, 6000000)
  ///////////////////////////////////////////

  val sc = new java.util.Scanner(System.in)
  val a, b = sc.nextInt
//  val b = sc.nextInt
//  val discs = List.fill(m)(sc.nextInt)
//  val b = List.fill(m)(sc.nextInt)

  val r = a to b
  val ans = r.foldLeft(0){ (acc, n) =>
    if (n.toString == n.toString.reverse)
      acc + 1
    else
      acc
  }

  println(ans)

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

  def bigIterator(start: BigInt, end: BigInt, step: BigInt = 1) =
    Iterator.iterate(start)(_ + step).takeWhile(_ <= end)

  def lcm(a :Int, b :Int): Int =
    a / gcd(a, b) * b

  def lcm(a :Long, b :Long): Long =
    a / gcd(a, b) * b

  def gcd(a: Int, b: Int): Int =
    if (b == 0) a else gcd(b, a % b)

  def gcd(a: Long, b: Long): Long =
    if (b == 0) a else gcd(b, a % b)

  def setOrUpdated[A, B](a: Map[A, B], key: A, value: B, f: (B, B) => B) =
    a.get(key) match {
      case Some(v) => a.updated(key, f(value, v))
      case _ => a + (key -> value)
    }

  // https://stackoverflow.com/questions/10199171/matcherror-when-match-receives-an-indexedseq-but-not-a-linearseq/10199441#10199441
  object +: {
    def unapply[T](s: Seq[T]) =
      s.headOption.map(head => (head, s.tail))
  }

  @tailrec
  def foldLeftWithNext[A, B](seq: Seq[A])(z: B)(op: (B, A, A) => B)(tailOp: (B, A) => B): B = {
    seq match {
      case Nil => z
      case a +: Nil => tailOp(z, a)
      case a +: next +: tail => foldLeftWithNext(next +: tail)(op(z, a, next))(op)(tailOp)
    }
  }
}

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

public class CSharp{
    public static void Main(){
        Kyopuro chokudai = new Kyopuro();
	    chokudai.AtCoder();
	}
}

public class Kyopuro{
    public void AtCoder(){
        long[] p = new long[62];
        p[0] = 1;
        for(int i=1; i<62; i++) p[i] = p[i-1] * 2;
        long a = long.Parse(Console.ReadLine());
        long b = long.Parse(Console.ReadLine());
        if(a == b) {
            Console.WriteLine(1);
            return;
        }
        long la = 0; long lb = 0;
        int ia = 0; while(p[ia] <= a) ia++;
        int ib = 0; while(p[ib] <= b) ib++;
        la = p[--ia];
        lb = p[--ib];
        while(la == lb){
            if(a == la) break;
            a -= la;
            b -= lb;
            while(p[ia] > a) ia--;
            while(p[ib] > b) ib--;
            la = p[ia]; lb = p[ib];
        }
        long c = b - lb;
        long lc = 0;
        if(c != 0){
            lc = (long)Math.Pow(2,1+(long)Math.Log(c, 2)) - 1;
        }
        Console.WriteLine(lb-a+1+Math.Min(lc + lb - a, lb-1));
    }
    
    public static void DebugWL(object x){ System.Diagnostics.Debug.WriteLine(x); }
}

Measured memory_bytes: 13140
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    cout << a * b / 2 << endl;
    
    return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <math.h>
#include <array>
#include <list>
#include <set>
#define MOD 1000000007
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef tuple<ll,int,int> p;
set <int> st;
int c[3][3];


int main(int argc,char const* argv[])
{
  for(int i=0;i<3;i++)
    {
      for(int j=0;j<3;j++)
	{
	  cin >> c[i][j];
	}
    }
  for(int i=0;i<2;i++)
    {
      for(int j=0;j<2;j++)
	{
	  if(c[i][j]-c[i][j+1]!=c[i+1][j]-c[i+1][j+1])
	    {
	      cout << "No" << endl;
	      return 0;
	    }
	  else if(c[i][j]-c[i+1][j]!=c[i][j+1]-c[i+1][j+1])
	    {
	      cout << "No" << endl;
	      return 0;
	    }
	}
    }
  cout << "Yes" << endl;
  return 0;

}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(long long i=0;i<(long long)(n);i++)
#define N 200000

int main() {
	long long x, y, z;
	long long n, m, d, h;
	long long s, ans;
	queue<long long>q;
	scanf("%lld %lld %lld", &n, &h, &d);
	x = 1;
	s = 0;
	for (long long i = 1; i <= n; i++) {
		x = (x*i) % MOD;
		s = (s + x) % MOD;
	}
	m = s;
	f(i, d - 1)q.push(0);
	q.push(x);
	s = x;
	for (long long i = 1; i <= h - 1; i++) {
		x = (s*m) % MOD;
		q.push(x);
		s = (s + x) % MOD;
		x = q.front();
		q.pop();
		s = (s + MOD - x) % MOD;
	}
	ans = 0;
	while (!q.empty()) {
		x = q.front();
		q.pop();
		ans = (ans + x) % MOD;
	}

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


	return 0;
}

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


int main() {
    string s;
    cin>>s;
    char num[s.length()];
    for (int i = 0; i < s.length(); ++i) {
        num[i]=s[i];
    }
    sort(num,num+s.length());
    for (int j = 0; j < s.length();) {
        char t=num[j];
        int count=1;
        while(num[j+count]==t){
            count++;
        }
        if(count%2==1){
            cout<<"No"<<endl;
            return 0;
        }
        j+=count;
    }
    cout<<"Yes"<<endl;
    return 0;
}

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

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

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

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

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

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

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

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


fn main() {
    input!{
        n: usize,
        k: usize,
    }
    println!("{}", n - k + 1);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int f(int a,int b,int n){
	return a*a+b*b+n*n+a*b+a*n+b*n;
}
int main() {
	int n,x[10002];
	cin>>n;
	for(int i=1;i<=n;i++)x[i]=0;
	for(int a=1;a<=100;a++){
		for(int i=1;i<=100;i++)
			for(int j=1;j<=100;j++)
				if(f(i,j,a)<=n)x[f(i,j,a)]++;
	}
	for(int i=1;i<=n;i++)cout<<x[i]<<'\n';
	return 0;
}

Measured memory_bytes: 3632
import java.util.*;


public class Main {
    
    public static int math(int a,int b){
        if(a <= b){
            return a;
        }else{
            return a-1;
        }
    }
    
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        int month = sc.nextInt();
        int day = sc.nextInt();
        System.out.println(math(month,day));
    }
}

Measured memory_bytes: 23124
import sys
import bisect
input=sys.stdin.readline

N, Q = map(int, input().split(' '))

construction = [list(map(int, input().split(' '))) for _ in range(N)]
D = [int(input()) for _ in range(Q)]
construction = sorted(construction, key=lambda x: x[2])

dist = [-1] * Q
jump = [-1] * Q
indices = list(range(Q))
for s, t, x in construction:
    i1 = bisect.bisect_left(D, s-x)
    i2 = bisect.bisect_left(D, t-x)
    i = i1
    while i < i2:
        k = jump[i]
        if k != -1:
            i = k
        else:
            jump[i] = i2
            dist[i] = x
            i += 1
    
for d in dist:
    print(d)
    

Measured memory_bytes: 114528
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8


void mainmain(){
	int r, g, b;
	cin >> r >> g >> b;
	puts((g * 10 + b) % 4 ? "NO" : "YES");
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){}


Measured memory_bytes: 256
N = int(input())
words = []
for i in range(N) :
	words.append(input())

first_word = words[0][0]
last_word = ""
is_okay = True

tmp_words = list(set(words))
if (len(tmp_words) != len(words)) :
	is_okay = False

for s in words :
	if (first_word != s[0]) :
		is_okay = False
		break
	
	first_word = s[-1]


if(is_okay) :
	print("Yes")
else :
	print("No")

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

int main()
{
    int k,i,l;
    string s;
    cin>>k>>s;
    l=s.size();
    if(l<=k)
        cout<<s<<endl;
    else
    {
        for(i=0;i<k;i++)
        {
            cout<<s[i];
        }
        cout<<"..."<<endl;
    }
	return 0;
}



Measured memory_bytes: 3624
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
#include <stack>
#include <array>
#include <algorithm>
#include <numeric>
#include <limits>
#include <string>
#include <regex>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    double ans = 0.0;
    for (int i = 1; i <= n; i++) {
        int a = i;
        int s = 0;
        while (a < k) {
            a <<= 1;
            s += 1;
        }
        ans += 1.0 / n / pow(2.0, s);
    }
    printf("%.12f\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>
#include <cstdlib>
#include <set>
#include <map>
#define INT long long
#define MOD 1000000007
#define oo 1987654321

using namespace std;
bool cmp(int a, int b){ return a>b; }
int k, t, p[100], ans;

int main()
{
    cin>>k>>t;
    for(int i = 0, x ; i < t ; i++ )
        cin>>p[i];
    while( k )
    {
       sort(p, p+t, cmp);
       p[0]--, k--;
       if( t-1 == 0 and ans ) ans++;
       if( k > 0 )
       {
           p[t-1]--, k--;
           if( t-1 == 0 ) ans++;
       }
       if( p[t-1] == 0 ) t--;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		int min,max,ans;
		if(b <= c) {
			System.out.println(0);
		}else {
			if(a < c) {
				min = c;
			}else {
				min = a;
			}
			if(b < d) {
				max = b;
			}else {
				max = d;
			}
			if(0 > max - min) {
				ans = 0;
			}else {
				ans = max -min;
			}
			System.out.println(ans);
		}
	}

}

Measured memory_bytes: 23252
// abc129d.cpp : Lamp
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;

#define up(i,s,e,d) for(int i=(s);i<(e);i+=(d))
#define dw(i,s,e,d) for(int i=(s);i>(e);i-=(d))

int main(){
	int h,w; cin>>h>>w;

	vector<string> s(h);
	vvi U(h,vi(w));
	vvi D(h,vi(w));
	vvi L(h,vi(w));
	vvi R(h,vi(w));

	up(i,0,h,1){
		cin>>s[i];
		up(j,0,w,1){
			if(i>0 && s[i][j]=='.' && s[i-1][j]=='.'){ // U
				U[i][j] = U[i-1][j] + 1;
			}
			if(j>0 && s[i][j]=='.' && s[i][j-1]=='.'){ // L
				L[i][j] = L[i][j-1] + 1;
			}
		}
	}

	dw(i,h-1,-1,1){
		dw(j,w-1,-1,1){
			if(i<h-1 && s[i][j]=='.' && s[i+1][j]=='.'){ // D
				D[i][j] = D[i+1][j] + 1;
			}
			if(j<w-1 && s[i][j]=='.' && s[i][j+1]=='.'){ // R
				R[i][j] = R[i][j+1] + 1;
			}
		}

	}

	int ans = 0;
	up(i,0,h,1){
		up(j,0,w,1){
			if(s[i][j]=='.'){
				int s = U[i][j] + D[i][j] + L[i][j] + R[i][j] + 1;
				if(ans<s) ans = s;
			}
		}
	}

	cout<< ans <<endl;
}

Measured memory_bytes: 67200
import numpy as np
from copy import copy

N, M, X = map(lambda x: int(x), input().split(" "))

Ms = [[0] * (M+1)]
Ms = np.array(Ms)
for _ in range(N):
    n = list(map(lambda x: int(x), input().split(" ")))
    temp_Ms = copy(Ms)
    for m in Ms:
        temp_Ms = np.append(temp_Ms, np.array([m+n]), axis=0)
    Ms = temp_Ms

Cs = Ms[:, 0]
Ms = np.delete(Ms, 0, 1)
result = float("inf")

for i in range(len(Ms)):
    if np.all(Ms[i] >= X):
        result = min(result, Cs[i])

if result == float("inf"):
    result = -1
print(result)


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

int main() {
	int N;
  	cin >> N;
  
  	vector<int> vec(N);
  
  	for(int i = 0; i < N; i++) {
    	cin >> vec.at(i);
    }
  
  	sort(vec.begin(),vec.end());
  	int ans = abs(vec.at(0) - vec.at(N - 1));
  
  	cout << ans << endl;
}

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

int const MAXN = 3;

int digit[MAXN+1], N, M;

int main() {
  std::cin >> N >> M;
  std::fill_n(digit, N+1, -1);
  for(int i = 0; i < M; ++i) {
    int s, c; std::cin >> s >> c;
    if(s == 1 && c == 0 && N > 1) {
      std::cout << "-1" << std::endl;
      return 0;
    }
    if(digit[s] < 0) digit[s] = c;
    else if(digit[s] != c) {
      std::cout << "-1" << std::endl;
      return 0;
    }
  }
  if(digit[1] < 0) digit[1] = (N>1)? 1: 0;
  for(int i = 2; i <= N; ++i) if(digit[i] < 0) digit[i] = 0;
  int ans = digit[1];
  for(int i = 2; i <= N; ++i) ans = ans*10+digit[i];
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
typedef long long LL;
int n, pri_cnt = 0;
LL a[N], p1[N], p2[N], pri[N];
void pre_pri() {
    for (int i = 2; i < N; i++) {
        if (pri[i]) continue;
        pri[++pri_cnt] = i;
        for (int j = i + i; j < N; j += i) pri[i] = 1;
    }
}
void cal(LL x, int id) {
    p1[id] = p2[id] = 1;
    for (int i = 1; pri[i] * pri[i] * pri[i] <= x; i++) {
        int t = 0;
        while (x % pri[i] == 0) x /= pri[i], t++;
        t %= 3;
        for (int j = 0; j < t; j++) p1[id] *= pri[i];
        t = (3 - t) % 3;
        for (int j = 0; j < t; j++) p2[id] *= pri[i];
    }
    if (x) {
        LL t = sqrt(x);
        if (t * t == x)
            p1[id] *= x, p2[id] *= t;
        else
            p1[id] *= x, p2[id] *= x * x;
    }
}
map<LL, int> mp;
int main() {
    pre_pri();
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%lld", &a[i]);
        cal(a[i], i);
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) mp[p1[i]]++;
    for (int i = 1; i <= n; i++) {
    	if (mp[p1[i]] == 0) continue;
        if (p1[i] == p2[i]) {
            ans++;
            mp[p1[i]] = 0;
            continue;
        }
        ans += max(mp[p1[i]], mp[p2[i]]);
        mp[p1[i]] = mp[p2[i]] = 0;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 15872
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int maxn =2e5+10;
const int mod=1e9+7;
ll n,k;
ll p[5005];
ll c[5005];
int vis[5005];

ll kk;
ll kk22;

ll ans=-1e18;
ll temp=0;
vector<ll>cnt;

void dfs(int u)
{
    if(kk22==0)
        return;
    int de=p[u];
    if(vis[de])
    {
        return;
    }
    kk22--;
    temp+=c[de];
    cnt.pb(c[de]);
    vis[de]=1;
    ans=max(ans,temp);
    dfs(de);
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
        cin>>p[i];
    }
    for(int i=1;i<=n;i++)
    {
        cin>>c[i];
    }
    for(int i=1;i<=n;i++)
    {
        memset(vis,0,sizeof(vis));
        temp=0;
        kk=k;
        kk22=k;
        cnt.clear();
        dfs(i);
        //cout<<temp<<'\n';
        //cout<<kk22<<'\n';

        ll sum=0;
        for(auto &v:cnt)
            sum+=v;
        ll ci=kk/cnt.size();
        if(ci<1)
            continue;
        ci--;
        ll temp2=ci*sum;
        for(auto &v:cnt)
        {
            temp2+=v;
            ans=max(ans,temp2);
        }
        ll shu=kk%cnt.size();
        for(int j=0;j<shu;j++)
        {
            temp2+=cnt[j];
            ans=max(ans,temp2);
        }
    }
    cout<<ans<<'\n';


}


Measured memory_bytes: 3820
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>
#include<queue>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define dump(a) cout << a << endl;


//UnionFind群
class UnionFind {
protected:
    vector<int> par;
    vector<int> data;
    int cnt;
public:
    UnionFind() : par(1), data(1), cnt(1) {};

    UnionFind(int N);

    int root(int x);

    int marge(int x, int y);

    bool same(int x, int y);

    int add();

    int add(int x);

    inline int getSize(int x) { return data.at(root(x)); };

    int allroot();

    inline bool isroot(int x) { return (par.at(x) == -1); };
};

UnionFind::UnionFind(int N) : par(N), data(N), cnt(N) {
    for (int i = 0; i < N; i++) {
        par.at(i) = -1;
        data.at(i) = 1;
    }
}


int UnionFind::root(int x) {
    if (par.at(x) == -1) return x;
    return par.at(x) = root(par.at(x)); // 経路圧縮
}

int UnionFind::marge(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    if (rx == ry) return rx;
    else { // ノード数の少ない方に接続
        if (data.at(rx) < data.at(ry)) swap(rx, ry);
        par.at(ry) = rx;
        data.at(rx) += data.at(ry);
        return rx;
    }
}

bool UnionFind::same(int x, int y) {
    return root(x) == root(y);
}

int UnionFind::add() {
    par.push_back(cnt);
    cnt++;
    return cnt - 1;
}

int UnionFind::add(int x) {
    par.push_back(cnt);
    cnt++;
    return marge(x, cnt);
}

int UnionFind::allroot() {
    int cnt = 0;
    for (const auto it : par) {
        if (it == -1) cnt++;
    }
    return cnt;
}

struct UF {
    vector<int> par;

    UF(int N) : par(N) {
        for (int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) {
        if (par[x] == x) return x;
        else {
            return par[x] = root(par[x]);
        }
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        else {
            par[rx] = ry;
            return;
        }
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int ansYes(bool y) {
    if (y) cout << "Yes" << endl; else cout << "No" << endl;
}

//約数の数を数える
int yakusu(int n) {
    int cnt = 0;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            cnt++;
            if (i * i != n) cnt++;
        }
    }
    return cnt;
}


int main() {
    vector<int> a(500);
    for (int i = 0; i <= 25 ; i++){
        for (int j = 0 ; j <= 15; j++){
            a.at(i*4 + j*7) = 1;
        }
    }
    int n;
    cin >> n;
    ansYes(a.at(n));
}



Measured memory_bytes: 256
using System;

class Challenge
{
  static void Main()
  {
    var input = Console.ReadLine().Split();
    var r = int.Parse(input[0]);
    var g = int.Parse(input[1]);
    var b = int.Parse(input[2]);
    var result = r*100 + g*10 + b;
    var str = (result % 4 == 0) ? "YES" : "NO";
    Console.WriteLine(str);
  }
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define dbgmint(n,arr) rep(i,n){cerr<<arr[i].x<<" ";}cerr<<endl;
#define out(a) cout<<a<<endl
#define out2(a,b) cout<<a<<" "<<b<<endl
#define vout(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

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

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,v.size())i>>v[j];return i;}

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

ll dp[105][MAX+10];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    ll n,W;
    cin>>n>>W;
    Vec w(n);
    Vec v(n);
    rep(i,n){
        cin>>w[i]>>v[i];
    }
    rep(i,n+1)rep(j,MAX)dp[i][j]=INF;
    dp[0][0] = 0;
    //dp[i][j] 価値vを達成するのに最小の重さ
    rep(i,n){
        rep(j,MAX){
            chmin(dp[i+1][j],dp[i][j]);
            if(j-v[i]<0)continue;
            chmin(dp[i+1][j],dp[i][j-v[i]]+w[i]);
        }
    }
    ll ans=0;
//    dbgarr(7,50,dp);
    rep(i,MAX){
        if(dp[n][i]<=W){
            chmax(ans,i);
        }
    }
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 80128
// 2011/09/22 Tazoe

#include <iostream>
using namespace std;

void DFS(char B[2010][2010], const int Ny, const int Nx, int y, int x, const char c)
{
	if(B[y][x]!='-')
		return;

	B[y][x] = c;

	if(y-1>=0)
		DFS(B, Ny, Nx, y-1, x, c);
	if(y+1<=Ny-2)
		DFS(B, Ny, Nx, y+1, x, c);
	if(x-1>=0)
		DFS(B, Ny, Nx, y, x-1, c);
	if(x+1<=Nx-2)
		DFS(B, Ny, Nx, y, x+1, c);
}

int main()
{
	while(true){
		int w, h;
		cin >> w >> h;
		if(w==0&&h==0)
			break;

		char B[2010][2010];
		int X[2010];
		int Y[2010];
		int Nx;
		int Ny;

		B[0][0] = '-';
		B[0][1] = '-';
		B[1][0] = '-';
		B[1][1] = '-';
		X[0] = 0;
		X[1] = w;
		Y[0] = 0;
		Y[1] = h;
		Nx = 2;
		Ny = 2;

		int n;
		cin >> n;

		for(int i=0; i<n; i++){
			int x1, y1, x2, y2;
			cin >> x1 >> y1 >> x2 >> y2;

			int X1 = 0;
			while(X[X1]<x1)
				X1++;

			if(X[X1]>x1){
				for(int x=Nx; x>=X1; x--){
					for(int y=0; y<Ny; y++)
						B[y][x] = B[y][x-1];
					X[x] = X[x-1];
				}
				X[X1] = x1;
				Nx++;
			}

			int X2 = X1;
			while(X[X2]<x2)
				X2++;

			if(X[X2]>x2){
				for(int x=Nx; x>=X2; x--){
					for(int y=0; y<Ny; y++)
						B[y][x] = B[y][x-1];
					X[x] = X[x-1];
				}
				X[X2] = x2;
				Nx++;
			}

			int Y1 = 0;
			while(Y[Y1]<y1)
				Y1++;

			if(Y[Y1]>y1){
				for(int y=Ny; y>=Y1; y--){
					for(int x=0; x<Nx; x++)
						B[y][x] = B[y-1][x];
					Y[y] = Y[y-1];
				}
				Y[Y1] = y1;
				Ny++;
			}

			int Y2 = Y1;
			while(Y[Y2]<y2)
				Y2++;

			if(Y[Y2]>y2){
				for(int y=Ny; y>=Y2; y--){
					for(int x=0; x<Nx; x++)
						B[y][x] = B[y-1][x];
					Y[y] = Y[y-1];
				}
				Y[Y2] = y2;
				Ny++;
			}

			for(int y=Y1; y<Y2; y++)
				for(int x=X1; x<X2; x++)
					B[y][x] = '*';
		}
/*
		for(int y=Ny-2; y>=0; y--){
			for(int x=0; x<Nx-1; x++)
				cout << B[y][x];
			cout << endl;
		}
*/
		int cnt = 0;

		for(int y=0; y<Ny-1; y++)
			for(int x=0; x<Nx-1; x++)
				if(B[y][x]=='-'){
					cnt++;
					DFS(B, Ny, Nx, y, x, '/');
				}

		cout << cnt << endl;
/*
		for(int y=Ny-2; y>=0; y--){
			for(int x=0; x<Nx-1; x++)
				cout << B[y][x];
			cout << endl;
		}
*/
	}

	return 0;
}

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

int main(){
	long n;
	long r[200000];
	
	scanf(" %ld", &n);
	for(long i=0; i<n; ++i) scanf(" %ld", &r[i]);
	
	long maxv=-2000000000;
	long minv=r[0];
	for(long i=1; i<n; ++i){
		maxv=max(maxv, r[i]-minv);
		minv=min(minv, r[i]);	
	}
	
	printf("%ld\n", maxv);
return 0;
}


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main() {
  string alpha = "abcdefghijklmnopqrstuvwxyz";
  string w; cin >> w;
  int ans[26] = {0};
  for(int i = 0; i < alpha.length(); i++) {
    for(int j = 0; j < w.length(); j++) {
      if(w[j] == alpha[i]) ans[i]++;
    }
  }
  for(int i = 0; i < alpha.length(); i++) {
    if(ans[i] % 2 != 0) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 256
n = input().split()

num = [int(z) for z in n ] 
f = num[0]
s = num[1]

words = []
for i in range(f):
  word = input()
  words.append(word)

s_words = sorted(words)

j_s_words = "".join(s_words)
print(j_s_words)




Measured memory_bytes: 3060
def kruskal(v_count: int, edges: list) -> int:
    """
    :param v_count: 頂点数
    :param edges: [(weight, from, to), ... ]
    """
    from itertools import islice
    tree = [-1]*v_count

    def get_root(x) -> int:
        if tree[x] < 0:
            return x
        tree[x] = get_root(tree[x])
        return tree[x]

    def unite(a) -> bool:
        x, y = get_root(a[1]), get_root(a[2])
        if x != y:
            big, small = (x, y) if tree[x] < tree[y] else (y, x)
            tree[big] += tree[small]
            tree[small] = big
        return x != y

    cost = 0
    for w, _s, _t in islice(filter(unite, sorted(edges)), v_count-1):
        cost += w
    return cost

import sys
from operator import itemgetter
N = int(input())
#a = [[i]+list(map(int, l.split())) for i, l in enumerate(sys.stdin)]
a = []
for i in range(N):
  ta,tb =map(int,input().split())
  a.append([i,ta,tb])

x_sorted, y_sorted = sorted(a, key=itemgetter(1)), sorted(a, key=itemgetter(2))
edges = []
append = edges.append
for (i, x1, y1), (j, x2, y2) in zip(x_sorted, x_sorted[1:]):
    append((x2-x1, i, j))
for (i, x1, y1), (j, x2, y2) in zip(y_sorted, y_sorted[1:]):
    append((y2-y1, i, j))
#print(edges)
print(kruskal(N, edges))


Measured memory_bytes: 50720
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.IntStream;
import java.util.stream.Stream;
import java.io.*;
//import java.util.stream.IntStream;
import java.nio.charset.Charset;


public class Main {
    static int[][] T;
    static int[][] G;
    static int INFTY = Integer.MAX_VALUE;
    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
      //  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));


     //   try{

            int n = sc.nextInt();
            int w = sc.nextInt();

            // 商品構成を記録するなら二次元配列Gがあったほうが楽？
            T = new int[n+1][w+1];
            G = new int[n+1][w+1];
            Item[] items = new Item[n+1];

            for(int i=1;i<n+1;i++){
                items[i] = new Item();
                items[i].v = sc.nextInt();
                items[i].w = sc.nextInt();
            }
            for(int i=1;i<=n;i++){
                if(items[i].w>w){continue;}

                for (int j = 0; j < items[i].w; j++) {
                    T[i][j] = T[i-1][j];
                }
                for(int j=items[i].w;j<=w;j++){
                    T[i][j] = Math.max(T[i-1][j], T[i-1][j-items[i].w] + items[i].v);
                    // Gに重さjのときの商品構成を記録(逆のほうが出力の時楽じゃない？)。この問題では必要ない。
                    G[i][j] = 1;
                }
            }

            System.out.println(T[n][w]);
    }

}

class Item{
    int v;
    int w;
}


Measured memory_bytes: 35572
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <map>
#include <cmath>
#include <string>
#include <math.h>
using namespace std;

#define rep(i, o) for (int i = 1; i <= (o); ++i)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)

typedef long long ll;


ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }

int main() {
  int n, a, b;
  cin >> n >> a >> b;
  
  int sum = 0;
  rep (i, n) {
    //   cout << s[i] << endl;
      string str = to_string(i);
      int digits = 0;
      rep (j, str.size()) {
          digits += str[j-1] - '0';
      }
      if (digits >= a && digits <= b) sum += i;
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define mp make_pair
#define pi pair<int,int>
#define pl pair<long long int,long long int>
#define pb push_back
#define fi first
#define se second
#define len(a) (int)(a).length()
#define sz(a) (int)(a).size()

typedef long long int ll;
typedef long double ld;

using namespace std;

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

// order_of_key (k) : Number of items strictly smaller than k, basically 0-based index of k
// find_by_order(k) : K-th element in a set (counting from zero)

ll n, m;
ll c[100003] = {}, pn[100003] = {};

int main ()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	ll ac = 0, pen = 0;
	cin >> n >> m;
	for (int i=0; i<m; ++i) {
		int p; string s;
		cin >> p >> s;
		if (s == "AC")
			c[p] = 1;
		else if (!c[p]) ++pn[p];
	}
	for (int i=1; i<=n; ++i) {
		if (c[i]) {
			++ac;
			pen += pn[i];
		}
	}
	cout << ac << " " << pen << endl;
	return 0;
}


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

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

    int x, sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> x;
        if (x <= k - x) {
            sum += x;
        } else {
            sum += k - x;
        }
    }

    cout << sum * 2 << endl;

    return 0;
}


Measured memory_bytes: 3532
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <list>

using namespace std;

struct Pair {
	Pair(int a, int b): min(a), max(b){}
	int min, max;
//	bool operator<(const Pair &x){ return max<x.max; }
};

bool operator<(const Pair &l, const Pair &r){ return l.max<r.max; }

int main()
{
	int n;
	int x, l;

	vector<Pair> robot;
	
	cin>>n;
	
	for(int i=0 ; i<n ; i++) {
		cin>>x>>l;
		robot.push_back(Pair(x-l, x+l));
	}
	
	sort(robot.begin(), robot.end());

	auto itr = robot.begin();

	int area_max=itr->max;
	int remain=1;

	itr++;
	
	while(itr != robot.end()) {
//		cout<<area_max<<" "<<itr->min<<" "<<itr->max<<endl;
		if(area_max <= itr->min) {
			remain++;
			area_max = itr->max;
		}
		itr++;
	}

	cout<<remain<<endl;

}


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

int n, m, c;
vector<int> B;
vector<vector <int>> A;

bool process_n (int x){
	int w = 0;
	for(int i = 0; i < m; i++){
		w += A[x][i] * B[i];
	}
	cerr << w << " " << c << "\n";
	if(w + c > 0) return true;
	else return false;
}

int main() {
	cin >> n >> m >> c;
	B = vector<int> (m);
	for(int &i : B) cin >> i;
	A = vector<vector<int>>(n);
	for(int i = 0; i < n; i++){
		A[i] = vector<int> (m);
		for(int &j : A[i]) cin >> j;
	}
	int res = 0;
	for(int i = 0; i < n; i++){
		if(process_n(i)){
			res++;
		}
	}
	cout << res << "\n";
	return 0;
}


Measured memory_bytes: 256