akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;

int N;
int A[20];
int x[20][20];
int y[20][20];
 
void solve() {
    cin >> N;
    rep(i, 0, N){
        cin >> A[i];
        rep(j, 0, A[i]){
            cin >> x[i][j] >> y[i][j];
        }
    }

    int ans = 0;
    for(int bits = 1; bits < (1 << N); bits++){
        bitset<15> s(bits);
        int an = 0;
        bool ok = true;
        an = s.count();
        rep(i, 0, N){
            if(s.test(i)){
                rep(j, 0, A[i]){
                    if(y[i][j] != s.test(x[i][j]-1)) ok = false;
                }
            }
        }
        if(ok) ans = max(ans, an);
    }

    cout << ans << endl;
}

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

    solve();
    return 0;
}
 


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;




int main() {
//    cout << fixed << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


    ll n, m, v, p;
    cin >> n >> m >> v >> p;
    ll a[n], b[n];
    for (ll i = 0; i < n; i++) cin >> a[i];
    sort(a, a + n, greater<>());


    ll ans = 0;
    ll l = 0, r = n - 1, mid;
    while (l <= r) {
        ll done[n];
        mid = (l + r) / 2;
        done[mid] = m;
        copy(a, a + n, b);
        ll rem = m * v - m;
        b[mid] += m;
        for (ll i = 0; i < n; i++) {
            if (i == mid) continue;
            if (b[i] > b[mid]) {
                ll here = min((ll) m, rem);
                b[i] += here;
                rem -= here;
                done[i] = here;
            }

            else {
                ll here = min({rem, (ll) m, (ll) b[mid] - b[i]});
                rem -= here;
                done[i] = here;
                b[i] += here;
            }
        }

        for (ll i = 0; i < n; i++) {
            if (rem && done[i] < m) {
                ll here = min(rem, (ll) m - done[i]);
                rem -= here;
                b[i] += here;
            }
        }

        ll here = b[mid];
        sort(b, b + n, greater<>());
        if (here >= b[p - 1]) {
            ans = mid;
            l = mid + 1;
        }

        else {
            r = mid - 1;
        }
    }

    cout << ans + 1;

}


Measured memory_bytes: 2560
a=int(input())
b=int(input())
c=int(input())
x=int(input())

ans=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i+100*j+50*k == x:
                ans+=1
print(ans)

Measured memory_bytes: 3060
import scala.io.Source

object Main extends App {
  val lines: Iterator[String] = Source.stdin.getLines()
  val arr = lines.next.split(" ").map(_.toInt)
  val (a, b, c, x, y) = arr.toList match {
    case a1 :: b1 :: c1 :: x1 :: y1 :: Nil => (a1, b1, c1, x1, y1)
    case _ => throw new IllegalArgumentException("")
  }

  val result =
    List(
      c * x.max(y) * 2,
      c * x.min(y) * 2 + (if (x > y) (x - y) * a else (y - x) * b),
      a * x + b * y
    ).min

  println(result)
}


Measured memory_bytes: 25660
#include<stdio.h>

int main(){
  int a,i;
  scanf("%d",&a);
  if(a==1){printf("4");return 0;}
  if(a==2){printf("4");return 0;}
  for(i=2;a>1;i++){
    if(a%2==0){
      a=a/2;
    }else{
      a=3*a+1;
    }
  }
  printf("%d",i);
  return 0;
}


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

int main() {
  int N, K;
  cin >> N >> K;
  int mx = (N - 1) * (N - 2) / 2;
  if (K > mx) return cout << -1 << "\n", 0;
  int cnt = mx - K;
  cout << N - 1 + cnt << "\n";
  for (int i = 2; i <= N; i++) cout << 1 << " " << i << "\n";
  for (int i = 2; i < N; i++) {
    for (int j = i + 1; j <= N; j++, cnt--) {
      if (cnt > 0) cout << i << " " << j << "\n";
    }
  }
}

Measured memory_bytes: 3544
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, 1000000007)
	sc.Split(bufio.ScanWords)
	x := intScanner()
	n := 100
	for i := 1; ; i++ {
		n += n / 100
		if n >= x {
			fmt.Println(i)
			break
		}
	}
}


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

int main(){
    int num;

    cin >> num;

    int a, b, c, d;

    a = num / 1000;
    b = (num / 100) % 10;
    c = (num / 10) % 10;
    d = num % 10;

    // printf("%d %d %d %d \n", a, b, c, d);

    if(a == b || b == c || c == d ){
        printf("Bad");
    }
    else{
        printf("Good");
    }

    return 0; 
}

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

#define  ll  long long
#define  pii pair<int,int>
#define  pll pair<ll , ll>
#define  debug cout << "this far" << endl;
#define  For(i, n) for(int i = 0; i < (n); ++i)
#define  lsb(x) ((x) & (-x))
#define  PI acos(-1)
#define  line cout << endl;
#define  getbit(n, i) (((n) & (1LL << (i))) != 0)
#define  resetbit(n, i) ((n) & (~(1LL << (i))))
#define  setbit(n, i) ((n) | (1LL << (i)))
#define  togglebit(n, i) ((n) ^ (1LL << (i)))
#define  gap " "
using namespace std;
const int N = 3e5 + 10;
multiset<int> row[N], col[N];
int mnus[N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;
    cin >> n >> m;
    int target;
    cin >> target;
    set<int> sr, sc;
    for (int i = 0; i < target; ++i) {
        int x, y;
        cin >> x >> y;
        sr.insert(x);
        sc.insert(y);
        row[x].insert(y);
        col[y].insert(x);
    }
    int mx_row_size = 0, mx_col_size = 0;
    for (auto i : sr) mx_row_size = max(mx_row_size, (int) row[i].size());
    for (auto i : sc) mx_col_size = max(mx_col_size, (int) col[i].size());
    set<int> mxrows, mxcols;
    for (auto i : sr) {
        if (row[i].size() == mx_row_size) mxrows.insert(i);
    }
    for (auto i : sc) {
        if (col[i].size() == mx_col_size) mxcols.insert(i);
    }
    int M = mxcols.size();
    for (auto i  : mxcols) {
        for (auto j : col[i]) mnus[j]++;
    }
    int ans = 0;
    for (auto i  : sr) {
        //cout << i << gap << mnus[i] << endl;
        if (mnus[i] == M) ans = max(ans, (int) row[i].size() + mx_col_size - 1);
        else ans = max(ans, mx_col_size + (int) row[i].size());
    }
    cout << ans;
}

Measured memory_bytes: 117228
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>

using namespace std;
using ll=long long int;

int main() {
    int n;
    cin >> n;
    vector<int> l(n);
    for (auto &e: l) cin >> e;

    int m = *max_element(l.begin(), l.end());
    int acc = accumulate(l.begin(), l.end(), 0);

    if (m < acc - m) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }



    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int a[100];
for (int i=0;i<n;i++) cin>>a[i];
for(int i=0;i<n-1-i;i++)swap(a[i],a[n-1-i]);
for(int i=0;i<n;i++){
if(i) cout<<" ";
cout<<a[i];
}
cout<<endl;
return 0;
}


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

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		static int num[40];
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (*num = 0; x; x /= 10) {
			num[++*num] = x % 10;
		}
		while (*num){
			putchar(num[*num] ^ '0');
			--*num;
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

const int N = 5005, P = 1000000007;

int n, m;
int f[N][N];

int main() {
	read(n), read(m);
	for (int i = 1; i <= m; ++i) {
		f[0][i] = 1;
	}
	for (int i = 1; i <= n; ++i) {
		int s = 0;
		for (int j = 1; j <= m; ++j) {
			f[i][j] = (1ll * (j + 1) * f[i - 1][j] + s) % P;
			s = (2ll * s + 1ll * j * f[i - 1][j]) % P;
		}
	}
	print(f[n][m]);
}


Measured memory_bytes: 101348
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define Fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mod 1000000007
#define F first
#define S second
#define all(v) (v).begin(), (v).end()
#define sz(v) (v).size()
#define pb push_back
#define mp make_pair
#define mt make_tuple

const int N = 1e5+8;
int a[N], freq[N];

int main(){
	Fio;
	int t=1;
	//cin >> t;
	while(t--) {
		ll n, ans = 0;
		cin >> n;
		for(int i=0; i<n; ++i)
			cin >> a[i], freq[a[i]]++, ans += a[i];

		int q;
		cin >> q;
		while(q--) {
			ll b, c;
			cin >> b >> c;
			ans -= (ll)freq[b]*b;
			ans += (ll)freq[b]*c;
			freq[c] += freq[b];
			freq[b] = 0;
			cout << ans << '\n';
		}
	}

	return 0;
}

Measured memory_bytes: 4436
#include<cstdio>
#include<vector>
#include<algorithm>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<climits>
using namespace std;
struct maxSegTree{
    int n;
    vector<int>dat;
    void init(int n_){
        n=1;
        while(n<n_)n*=2;
        dat.resize(n*2-1,INT_MIN);
    }
    maxSegTree(int n_){
        init(n_);
    }
    void update(int x,int val){
        x+=n-1;
        dat[x]=val;
        while(x){
            x=(x-1)/2;
            dat[x]=max(dat[x*2+1],dat[x*2+2]);
        }
    }
    int getMax(int a,int b,int k=0,int l=0,int r=-1){
        if(r==-1)r=n;
        if(a<=l&&b>=r)return dat[k];
        if(a>=r||b<=l)return INT_MIN;
        int v1=getMax(a,b,k*2+1,l,(l+r)/2);
        int v2=getMax(a,b,k*2+2,(l+r)/2,r);
        return max(v1,v2);
    }
};
struct minSegTree{
    int n;
    vector<int>dat;
    void init(int n_){
        n=1;
        while(n<n_)n*=2;
        dat.resize(n*2-1,INT_MAX);
    }
    minSegTree(int n_){
        init(n_);
    }
    void update(int x,int val){
        x+=n-1;
        dat[x]=val;
        while(x){
            x=(x-1)/2;
            dat[x]=min(dat[x*2+1],dat[x*2+2]);
        }
    }
    int getMin(int a,int b,int k=0,int l=0,int r=-1){
        if(r==-1)r=n;
        if(a<=l&&b>=r)return dat[k];
        if(a>=r||b<=l)return INT_MAX;
        int v1=getMin(a,b,k*2+1,l,(l+r)/2);
        int v2=getMin(a,b,k*2+2,(l+r)/2,r);
        return min(v1,v2);
    }
};
int main(){
    int n,d;
    scanf("%d%d",&n,&d);
    vector<pair<int,pair<int,int> > >V(n);
    vector<int>D(n);
    for(int i=0;i<n;i++){
        scanf("%d%d%d",&V[i].second.first,&V[i].second.second,&V[i].first);
        D[i]=V[i].first;
    }
    sort(V.begin(),V.end());
    sort(D.begin(),D.end());
    maxSegTree ma(n*2);
    minSegTree mi(n*2);
    long long mav=INT_MIN;
    for(int i=0;i<n;i++){
        pair<int,pair<int,int> >p=V[i];
        int x=p.second.first,y=p.second.second,b=p.first;
        ma.update(i,x);ma.update(i+n,y);
        mi.update(i,x);mi.update(i+n,y);
    }

    for(int i=0;i<n;i++){
        pair<int,pair<int,int> >p=V[i];
        int b=D[i];
        int pos=upper_bound(D.begin(),D.end(),b+d)-D.begin();
        long long  mx=ma.getMax(i,pos),my=ma.getMax(i+n,pos+n);
        long long  mix=mi.getMin(i,pos),miy=mi.getMin(i+n,pos+n);
        long long m2=(mx-mix)*(my-miy);
        mav=max(mav,m2);
        //cout<<i<<" "<<pos<<" "<<m2<<"**"<<mx<<" "<<my<<" "<<mix<<" "<<miy<<endl;
    }
    printf("%lld\n",mav);
    return 0;
}

Measured memory_bytes: 12480
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <numeric>
#include <string>
#include <bitset>
#include <functional>

using ld = long double;
using vld = std::vector<ld>;
using vvld = std::vector<vld>;
using vvvld = std::vector<vvld>;
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
using pll = std::pair<ll, ll>;
using vpll = std::vector<pll>;
using str = std::string;
using vstr = std::vector<str>;

template<typename T> bool chmin(T a, T &b) { return a < b ? b = a, true : false; }
template<typename T> bool chmax(T a, T &b) { return a > b ? b = a, true : false; }

constexpr ld PI = 3.141592653589793L;
constexpr ld EPS = std::numeric_limits<ld>::epsilon();

ll gcd(ll n, ll m) { return m ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }
bool isprime(ll n) {
    if (n < 2) return false;
    for (ll i = 2; i * i <= n; i++)
        if (n % i == 0) return false;
    return true;
}
ll rpow(ll x, ll n) {
    if (n == 0) return 1;
    ll k = 1;
    for (; n > 1; n /= 2) {
        if (n & 1) k *= x;
        x *= x;
    }
    return k * x;
}
ll modpow(ll x, ll n, ll mod) {
    if (n == 0) return 1;
    ll k = 1;
    for (; n > 1; n /= 2) {
        if (n & 1) (k *= x) %= mod;
        (x *= x) %= mod;
    }
    return k * x % mod;
}
ll modcomb(ll n, ll r, ll mod) {
    if (r < 0 || n < r) return 0;
    chmin(n - r, r);
    ll mul = 1, div = 1;
    for (ll i = 0; i < r; i++) {
        (mul *= n - i) %= mod;
        (div *= i + 1) %= mod;
    }
    return mul * modpow(div, mod - 2, mod) % mod;
}

/*------------------------------------------------------------------------*/

constexpr ll MOD = 1e9 + 7;

void solve();

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15);

    solve();
}
void solve() {
    ll n;
    std::cin >> n;

    auto sieve = [](ll n) -> vll {
        str flg = str(n + 1, '1');
        for (ll i = 2; i * i <= n; i++) if (flg[i] ^ '0')
            for (ll j = i * i; j <= n; j += i)
                flg[j] = '0';

        vll res;
        for (ll i = 2; i <= n; i++)
            if (flg[i] ^ '0') res.push_back(i);

        return res;
    };

    auto legendre = [&](ll n, ll p) -> ll {
        ll res = 0;
        for (ll i = p; i <= n; i *= p)
            res += n / i;

        return res;
    };

    ll ans = 1;
    for (ll p : sieve(n))
        (ans *= legendre(n, p) + 1) %= MOD;

    std::cout << ans << '\n';
}


Measured memory_bytes: 3612
package main
import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)

func Inverse(N int) []int {
  Inv := make([]int, N + 1)
  Inv[0] = 1
  Inv[1] = 1
  for i := 2; i < N + 1; i++ {
    Inv[i] = p - Inv[p % i] * (p / i) % p
  }
  return Inv
}

const p = 998244353

func Solve() {
  var N int
  var A []int
  NextInt(&N)
  NextIntVec(&A)
  V := MaxInt(A...)
  Inv := Inverse(V)
  W := make([]int, V + 1)
  for w := 1; w <= V; w++ {
    W[w] += Inv[w]
    W[w] %= p
    for x := 2 * w; x <= V; x += w {
      W[x] -= W[w]
      if W[x] < 0 { W[x] += p }
    }
  }
  S := 0
  C := make([]int, V + 1)
  for _, a := range A {
    C[a] += a
    S -= a
    if S < 0 { S += p }
  }
  var c int
  for d := 1; d <= V; d++ {
    c = 0
    for m := d; m <= V; m += d {
      c += C[m]
    }
    if c == 0 { continue }
    c %= p
    S = (S + c * c % p * W[d]) % p
  }
  Write(S * Inv[2] % p)
}

func main() {
  Solve()
  Output()
}

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt(A ...*int) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.Atoi(L[i])
  }
}
func NextIntVec(A *[]int) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]int, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.Atoi(l)
  }
}
func NextFloat(A ...*float64) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.ParseFloat(L[i], 64)
  }
}
func NextFloatVec(A *[]float64) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]float64, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.ParseFloat(l, 64)
  }
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}
func MaxInt(A ...int) int {
  max := A[0]
  for _, a := range A {
    if max < a { max = a }
  }
  return max
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}
func SumInt(A ...int) int {
  sum := 0
  for _, a := range A {
    sum += a
  }
  return sum
}
func AbsInt(x int) int {
  if x < 0 { x = -x }
  return x
}

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

using namespace std;
using ll = long long;

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << #x << ": " << x << endl;
#define popcnt __builtin_popcount


int main() {
    int n, m, c;
    cin >> n >> m >> c;
    vector<int> b(m);
    for(int i=0;i<m;i++)cin>>b[i];
    vector<vector<int>> a(n, vector<int>(m));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            cin >> a[i][j];
        }
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        int t = 0;
        for (int j = 0; j < m; ++j) {
            t += a[i][j] * b[j];
        }
        t += c;
        if (t > 0)ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
N, T = map(int, input().split())
t = list(map(int, input().split()))
ans = N * T
dt = []
for i in range(1, N):
    dt.append(t[i] - t[i-1])
for d_t in dt:
    if d_t < T:
        los = T - d_t
        ans -= los
print(ans)


Measured memory_bytes: 105476
#include <stdio.h>
int main()
{
    int a, b, c;
  
    scanf("%d %d %d", &a, &b, &c);
  
    if (a < b && b < c){
        printf("Yes\n");
    } else {
        printf("No\n");
    }
  
    return 0;
}

Measured memory_bytes: 1712
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>

using namespace std;

const static int NONE  = 0x00;
const static int BLACK = 0x01;
const static int WHITE = 0x10;
const static int BOTH  = 0x11;

string getDummyLine( int w ) {
  string line = "";
  for( int c = 0; c < w + 2; c++ ) {
    line += "V";
  }
  return line;
}

int visit( vector<string>& island, int i, int j, int &counter ) {
  if( island[ i ][ j ] != '.' ) {
    if( island[ i ][ j ] == 'B' ) { return BLACK; }
    if( island[ i ][ j ] == 'W' ) { return WHITE; }
    return NONE;
  }

  counter++;
  island[ i ][ j ] = 'V';
  
  return (
      visit( island, i - 1, j     , counter ) |
      visit( island, i    , j - 1 , counter ) |
      visit( island, i + 1, j     , counter ) |
      visit( island, i    , j + 1, counter  ) 
  );
}

int main() {
  while( 1 ) {
    int w, h;
    vector<string> island;
    cin >> w >> h;
    if( !w && !h ) { return EXIT_SUCCESS; }

    string dummyLine = getDummyLine( w );
    island.push_back( dummyLine );
    for( int r = 1; r <= h; r++ ) {
      string line;
      cin >> line;
      island.push_back( 'V' + line + 'V' );
    }
    island.push_back( dummyLine );
    int blackNum = 0, whiteNum = 0;
    for( int r = 1; r <= h; r++ ) {
      for( int c = 1; c <= w; c++ ) {
        int size = 0;
        int type = visit( island, r, c, size );
        if( type == BLACK ) {
          blackNum += size;
        } else if( type == WHITE ) {
          whiteNum += size;
        }
      }
    }

    cout << blackNum << " " << whiteNum << endl;
  }
}

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

using namespace std;

#define LL long long
#define DD double
#define Pb push_back
#define Bp pop_back
#define Pf push_front
#define Fp pop_front
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define X first
#define Y second
#define mx1 10
#define mx2 110
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

typedef vector<LL> Vl;
typedef vector<DD> Vd;
typedef vector<bool> Vb;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef pair<DD, DD> Pdd;
typedef vector<Pll> Vpl;
typedef vector<Pdd> Vpd;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
typedef deque<LL> Dl;

LL _set(LL N, LL pos) {return N = N | (1 << pos);}
LL _reset(LL N, LL pos) {return N = N & ~(1 << pos);}
bool _check(LL N, LL pos) {return (bool)(N & (1 << pos));}
bool _upper(char a) {return a >= 'A' && a <= 'Z';}
bool _lower(char a) {return a >= 'a' && a <= 'z';}
bool _digit(char a) {return a >= '0' && a <= '9';}

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

///**************************DONE****************************///

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

    DD nn = sqrt(n);
    LL x = nn + 1;

    LL a, b;
    for(LL i = x; i; i--){
        if(n % i == 0){
            a = i, b = n / i;
            break;
        }
    }

    int A = 0, B = 0;
    while(a)
        A++, a /= 10;
    while(b)
        B++, b /= 10;

    cout << max(A, B) << '\n';
    return 0;
}


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

int main(){
    int N; cin >> N;
    int ans=0;
    rep(i,N){
        int cnt=0;
        int a; cin >> a;
        while(a%2==0){
            a/=2;
            cnt++;
        }
        ans+=cnt;
    }
    cout << ans;
}

Measured memory_bytes: 256
import heapq

n = int(input())
g = [[] for i in range(n)]
for i in range(n-1):
    a, b, c = map(int, input().split())
    g[a-1].append((b-1, c))
    g[b-1].append((a-1, c))
q, k = map(int, input().split())
qs = [tuple(map(int, input().split())) for i in range(q)]

INF = float('inf')
dist = [INF for i in range(n)]
dist[k-1] = 0
hq = [(0, k-1)]
while hq:
    cost, node = heapq.heappop(hq)

    # heapqにすでに入った要素で、その要素よりも短い距離で更新されたものは
    # 最短距離になり得ないので候補から外す (今回は木なので関係なし)
    if cost > dist[node]:
        continue

    for n_node, n_cost in g[node]:
        d = dist[node] + n_cost
        if d < dist[n_node]:
            dist[n_node] = d
            heapq.heappush(hq, (dist[n_node], n_node))

for i in range(q):
    print(dist[qs[i][0]-1] + dist[qs[i][1]-1])

Measured memory_bytes: 61756
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [n,m,x] <- getIntList
    (cs:ass) <- transpose <$> replicateM n getIntList
    let tfs = replicateM n [1,0]
    let ans = [sum (zipWith (*) tf cs)| tf <- tfs, all (>= x) (map (\as -> sum (zipWith (*) tf as)) ass)]
    print $ if null ans then -1 else minimum ans

Measured memory_bytes: 4968
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
  int a;
  cin >> a;
  string s;
  cin >> s;
  if(a>=3200){
    cout << s << endl;
  }else{
    cout << "red" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
/*
 * atcoder/abc092/c.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

const int MAX = 100100;
int N;
vector<int> A;
ll acc_l[MAX] = {0}, acc_r[MAX] = {0};
void solve() {
  cin >> N;
  int a;
  A.push_back(0);
  loop(n,0,N) {
    cin >> a;
    A.push_back(a);
  }
  A.push_back(0);
  N += 2;

  loop(n,1,N) {
    acc_l[n] = acc_l[n-1] + abs(A[n] - A[n-1]);
  }
  for (int n=N-1; n>=1; n--) acc_r[n-1] = acc_r[n] + abs(A[n] - A[n-1]);
  // loop(n,0,N) cout << acc_l[n] << " "; cout << endl;
  // loop(n,0,N) cout << acc_r[n] << " "; cout << endl;

  loop(k,1,N-1) {
    cout << acc_l[k-1] + abs(A[k+1]-A[k-1]) + acc_r[k+1] << endl;
  }
}
int main() {
  // cout.precision(15); cout << fixed;

  solve();

  return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main(int argc, char *argv[]) {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    vector<int> n(4);
    rep(i, 4) cin >> n[i];
    sort(all(n));
    if (n[0] == 1 && n[1] == 4 && n[2] == 7 && n[3] == 9)
        cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

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

string s;

int main(void){
  cin >> s;
  int ans = 0;
  for(int k = 1; k <= s.size(); k++){
      for(int i = 0; i < s.size(); i++){
      string si = s.substr(i, k);
      bool f = true;
      for(int j = 0; j < si.size(); j++){
        if(si[j] != 'A' && si[j] != 'C' && si[j] != 'G' && si[j] != 'T') f = false;
      }
      if(f) ans = max(ans, (int)si.size());
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define MOD 1000000007

int main(){
  int n;
  cin >> n;
  vector<int> p(n);
  rep(i,n) cin >> p.at(i);
  int ans = 0;
  rep(i,n){
    if(p.at(i) == i+1){
        ans++;
        i++;
      
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
using System;
using System.Collections.Generic;
namespace tst
{
    class Program
    {
        public static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            string In = Console.ReadLine();
            char[] S = new char[n];
            for(int i=0; i<n; i++)
            {
                S[i] = In[i];
            }
            List<char> X = new List<char>();
            X.Add(S[0]);
            for(int i=0; i<n; i++)
            {
                if(S[i] == X[X.Count-1])
                {
                    continue;
                }
                else
                {
                    X.Add(S[i]);
                }  
            }
            Console.Write(X.Count);
        }
    }
}

Measured memory_bytes: 12000
#include<iostream>
using namespace std;
int main(){
  int D;
  cin >>D;
  if(D == 22) cout <<"Christmas" <<" " <<"Eve" <<" " <<"Eve" <<" " <<"Eve" <<endl;
  if(D == 23) cout <<"Christmas" <<" " <<"Eve" <<" " <<"Eve" <<endl;
  if(D == 24) cout <<"Christmas" <<" " <<"Eve" <<" " <<endl;  
  if(D == 25) cout <<"Christmas" <<endl;
  
   return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
	int h = sc.nextInt();
    int n = sc.nextInt();
    int a[] = new int[n];
    for(int i = 0; i < n; i++){
      h -= sc.nextInt();
    }
    //char[] a = sc.nextLine().toCharArray();
    if(h <= 0){
      System.out.println("Yes");
    }else{
      System.out.println("No"); 
    }
  }
}

Measured memory_bytes: 49256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  
  cin >> N;
  
  if (N%1111 == 0) {
    cout << "Yes" << endl;
  }
  
  else if (N%1110 < 10) {
    cout << "Yes" << endl;
  }
  else if (N%1000%111 == 0) {
    cout << "Yes" << endl;
  }
  
  else{
    cout << "No" << endl;
  }
 
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main{
	public static void main(String args[]){
		try{
			new Main();
		}catch(IOException err){
			err.printStackTrace();
		}
	}

	public Main() throws IOException{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		List<String[]> ans = new ArrayList<String[]>();

		String line;
		while((line = in.readLine()) != null){
			String[] dst = line.split(" ");
			double h = Double.parseDouble(dst[0]);
			double w = Double.parseDouble(dst[1]);
			double d = Double.parseDouble(dst[2]);
			double R = 0.0;

			if(h == 0.0 && w == 0.0 && d == 0.0){
				break;
			}

			if(h > w){
				R += w*w;
				if(h > d){
					R += d*d;
				}else{
					R += h*h;
				}
			}else{
				R += h*h;
				if(w > d){
					R += d*d;
				}else{
					R += w*w;
				}
			}

			R = Math.sqrt(R);

			line = in.readLine();
			int data_size = Integer.parseInt(line);
			String[] res = new String[data_size];

			for(int i=0; i<data_size; i++){
				line = in.readLine();
				double hall_size = Double.parseDouble(line);

				if(R < 2.0 * hall_size){
					res[i] = "OK";
				}else{
					res[i] = "NA";
				}
			}
			ans.add(res);
		}

		for(int i=0; i<ans.size(); i++){
			String[] dst = ans.get(i);
			for(int j=0; j<dst.length; j++){
				System.out.println(dst[j]);
			}
		}
	}
}

Measured memory_bytes: 9768
#include<stdio.h>

int main(void){
    int gram[1000]={0};
    int n,x;
    
    scanf("%d",&n);
    scanf("%d",&x);

    int i;
    for(i=0;i<=n;i++){
        scanf("%d",&gram[i]);
    }
    
    int min=gram[0];
    for(i=0;i<n;i++){
        if(min>gram[i]){
            min = gram[i];
        }
        x=x-gram[i];
    }
    
    
    
    x=n+x/min;
    
    printf("%d\n",x);
    
    return 0;
}

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

vector<int> C,V;

int main(void){
  int N;
  cin >> N;
  int ans=0;
  C = vector<int>(N);
  V = vector<int>(N);
  for(int i=0;i<N;i++) cin >> V[i];
  for(int i=0;i<N;i++) cin >> C[i];

  for(int i=0;i<N;i++){
    ans += max(V[i]-C[i],0);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
/**
*    author:  Taichicchi
*    created: 07.09.2020 00:30:52
**/

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {

    string N;

    cin >> N;

    for(int i=0;i<3;++i){
        if(N[i] == '7'){
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;

    return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < static_cast<int>(n); ++i)
#define per(i, n) for(int i = static_cast<int>(n)-1; i >= 0; --i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);
#define ppp(a) (cout << (a) << endl); 
#define cop(a) for(auto x:(a)){cout << x << endl;}

using ll = long long;

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

constexpr char sp = ' ';
constexpr ll MOD = 1e9+7;
constexpr ll Mod = 998244353;
constexpr int INF = 1e9;
constexpr ll LINF = 1e18;
constexpr double phi = (1+sqrt(5))/2;
constexpr double pi = 3.14159265358979323846264338327950288;
inline ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
inline ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
inline ll inverse(ll n, ll m=MOD){ll a=n,b=m,x=1,y=0;while(b){ll t=a/b;a-=t*b;swap(a,b);x-=t*y;swap(x,y);}return (a%m+m)%m;}
inline void Yes(){puts("Yes");}
inline void No(){puts("No");}
inline void Judge(bool b){b?Yes():No();}
inline void YES(){puts("YES");}
inline void NO(){puts("NO");}
inline void JUDGE(bool b){b?YES():NO();}
inline ll powmod(ll b, ll e, ll m=MOD){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
inline double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));}
inline double d2r(double d){return d*pi/180;}
inline double r2d(double r){return r*180/pi;}

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; }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    s<<'[';for(size_t i=0;i<v.size();++i){s << v[i];if(i < v.size()-1) s << ", ";}s<<']';return s;
}
struct __{ __(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15); } };

vector<vector<pair<int, int>>> G;
vector<int> path;
bool dfs(int i, int dest, int p=-1){
    if(i == dest){
        path = vector<int>();
        return true;
    }
    for(auto edge : G[i]){
        int ni, id;
        tie(ni, id) = edge;
        if(ni == p) continue;
        if(dfs(ni, dest, i)){
            path.emplace_back(id);
            return true;
        }
    }
    return false;
}
int main(){
    int n;
    cin >> n;
    G.resize(n, vector<pair<int, int>>());

    for(int i = 0; i < n-1; ++i){
        int a, b;
        cin >> a >> b;
        --a; --b;
        G[a].emplace_back(b, i);
        G[b].emplace_back(a, i);
    }

    int m; cin >> m;
    vector<ll> cst(m);
    for(int i = 0; i < m; ++i){
        int u, v; cin >> u >> v;
        --u; --v;
        dfs(u, v);
        for(int x : path)  cst[i] |= 1LL<<x;
    }

    ll ans = 0;
    for(int bits = 0; bits < (1<<m); ++bits){
        ll mask = 0;
        for(int i = 0; i < m; ++i)
            if(bits>>i&1) mask |= cst[i];
        int num = __builtin_popcountll(mask);
        if(__builtin_popcountll(bits)&1) ans -= 1LL << n-1-num;
        else ans += 1LL << n-1-num;
    }
    cout << ans << '\n';


    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include <cmath>
using namespace std;
using ll = long long;

int main(){
	int N, Z, W;
	scanf("%d %d %d", &N, &Z, &W);
	int a[N + 1];
	a[0] = W;
	for (int i = 1; i <= N; ++i) scanf("%d", a + i);
	int dp[4][N];
	dp[0][N - 1] = 0;
	dp[2][N - 1] = 1000000000;
	dp[1][N - 1] = dp[3][N - 1] = abs(a[N] - a[N - 1]);
	for (int i = N - 2; i >= 0; --i){
		dp[0][i] = max(dp[0][i + 1], dp[3][i + 1]);
		dp[1][i] = max(dp[0][i], abs(a[N] - a[i]));
		dp[2][i] = min(dp[2][i + 1], dp[1][i + 1]);
		dp[3][i] = min(dp[2][i], abs(a[N] - a[i]));
	}
	printf("%d\n", dp[1][0]);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef unsigned long long u64;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  u64 pow = 1;
  for (int i = 1; i <= n; ++i) {
    pow = pow * i % (1000000007);
  }
  cout << pow << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define REP(i, n) for (signed long long i = 0; i < (n); i++)
#define MOD 1000000007
#define INF 98765431219876543
#define bitcnt(a) (ll) __builtin_popcount((a))
#define lb(a, b) lower_bound((a).begin(), (a).end(), (b))
#define ub(a, b) upper_bound((a).begin(), (a).end(), (b))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<string, string> PS;

ll n;

ll nxt(ll i) {
  if (i == n - 1)
    return 0;
  return i + 1;
}

int main() {
  vector<ll> v;
  cin >> n;
  ll all = 0;
  ll cnt = 0;
  REP(i, n) {
    ll p;
    cin >> p;
    v.pb(p);
    all += p;
  }
  ll ans = 0;
  bool bef = 0;
  ll i = 0;

  while (all != cnt) {
    // cout << cnt << endl;

    if (v[i] > 0) {
      v[i]--;
      cnt++;
      bef = 1;
      if (i == n - 1) {
        ans++;
        bef = 0;
      }
    } else if (bef == 1) {
      ans++;
      bef = 0;
    }
    i = nxt(i);
  }
  if (bef)
    ans++;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int main()
{
    int n;scanf("%d",&n);
    int ans=1,x,t=0;scanf("%d",&x);
    for (int i=1;i<n;i++)
    {
        int y;scanf("%d",&y);
        if (t>0&&x>y)
            {ans++;t=0;}
        else
            if (t<0&&x<y)
            {
                ans++;t=0;
            }
            else
            {
                if (x<y) t=1;
                if (x>y) t=-1;
            }
        x=y;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 128
import math
import queue
from collections import defaultdict
 
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def printQueue(q):
	r=q
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)

N = readInt()
ans = 0

for i in range(1,N+1):
	if i%3*i%5!=0:
		ans+=i

print(ans)

Measured memory_bytes: 9696
n, a, b = map(int, input().split(' '))
S = input()
acc = 0
acc_b = 0
ans = ''
i = 0
for s0 in S:
    if acc >= (a+b) or s0 == 'c':
        ans += 'No\n'
    elif s0 == 'a':
        ans += 'Yes\n'
        acc += 1
    elif acc_b < b:
        ans += 'Yes\n'
        acc += 1
        acc_b += 1
    else:
        ans += 'No\n'
print(ans)

Measured memory_bytes: 4340
#include<iostream>
using namespace std;
int main(){
   int A,B,ans;
   cin>>A>>B;
   for(int i=0;i<2;i++){
      if(A>=B){
         ans+=A;
         A--;
      }
      else{
         ans+=B;
         B--;
      }
   }
   cout<<ans<<endl;
}

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

typedef long long ll;
const ll MOD = 1e9+7;

ll power(ll, ll);
int main(){
  ll n, m;
  cin >> m >> n;

  ll ans = power(m, n);
  cout << ans << endl;

  return 0;
}

ll power(ll m, ll n){
  ll ans=1LL, tmp=m;
  while(n){
    if(n&1){
      ans *= tmp;
      ans %= MOD;
    }
    tmp *= tmp;
    tmp %= MOD;
    n >>= 1;
  }
  return ans;
}



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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(i,s,n) for(int i = (s); i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) v.begin(),v.end()
const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    string s;
    map<char,ll> mp;
    while(getline(cin,s)){
        rep(i,s.size()) mp[tolower(s[i])]++;
    }
    rep(i,26){
        cout<<(char)('a'+i)<<" : "<<mp['a'+i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 3164
import java.lang.reflect.Array;
import java.util.*;

/**
 * Created by Santa.
 */
public class Main {

  static int N;
  static int K;
  static long Q;
  static int A;
  static int B;
  static long C;
  static double min = 9999999;
  static long ans = 0;




  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int A = scanner.nextInt();

    int B = scanner.nextInt();

    int C = scanner.nextInt();


    if(A * C <= B){
      System.out.println(C);
    }
    else{
      System.out.println(B / A);
    }




  }

  static public boolean retAns(){
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();








    return true;
  }

}


Measured memory_bytes: 23124
import java.util.*;

@SuppressWarnings("unused")
public class Main {

  private static void solve() {
    int n = ni();
    int[][] p = ntable(n, 2);

    long[][] q = new long[n][2];
    for (int i = 0; i < n; i ++) {
      q[i][0] = p[i][0] + p[i][1];
      q[i][1] = p[i][0] - p[i][1];
    }

    Arrays.sort(q, (o1, o2) -> Long.signum(o1[0] - o2[0]));
    long x = Math.abs(q[0][0] - q[n-1][0]);
    Arrays.sort(q, (o1, o2) -> Long.signum(o1[1] - o2[1]));
    long y = Math.abs(q[0][1] - q[n-1][1]);

    System.out.println(Math.max(x, y));
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


Measured memory_bytes: 65304
#include <iostream>/*{{{*/
#include <iomanip>
#include <string>
#include <map>
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#include <vector>
#include <set>
#include <queue>
#include <sstream>
#include <stack>
#include <deque>
#include <memory.h>
#include <exception>
#include <ctime>
#include <climits>
#include <list>
#include <bitset>
#include <cassert>
using namespace std;
#define rep_n(i, a, b) for (int i=(a); i<(b); i++)
#define rep(i, n) rep_n(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define ci1(a) cin>>a 
#define ci2(a, b) cin>>a>>b
#define ci3(a, b, c) cin>>a>>b>>c
#define ci4(a, b, c, d) cin>>a>>b>>c>>d
#define co1(a) cout<<a<<endl;
#define co2(a, b) cout<<a<<" "<<b<<endl;
#define co3(a, b, c) cout<<a<<" "<<b<<" "<<c<<endl;
#define co4(a, b, c, d) cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
typedef long long ll;/*}}}*/

int main() {
    int n, y;
    ci2(n, y);

    int a100, a50, a10, flag=0;

    for (a100=0; a100<=n; a100++) {
    for (a50=0;  a50<=(n-a100);  a50++)  {
    for (a10=0;  a10<=(n-a100-a50);  a10++)  {
        if (a100+a50+a10==n) {
            if (y==10000*a100 + 5000*a50 + 1000*a10) {
                printf("%d %d %d\n", a100, a50, a10), flag=1;
                goto LABEL;
            }
        }
    }}}
    LABEL:if (flag==0) printf("-1 -1 -1");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,a[55];
int main(){
	int minid = 1, maxid = 1;
	scanf("%d",&n);
	for(int i=1; i<=n; i++){
		scanf("%d",&a[i]);
		if(a[i] > a[maxid])maxid = i;
		if(a[i] < a[minid])minid = i;
	}
	printf("%d\n",2*n-2);
	if(a[minid] + a[maxid] >= 0){
		for(int i=1; i<=n; i++)if(i!=maxid)printf("%d %d\n",maxid, i);
		for(int i=1; i<n; i++)printf("%d %d\n",i,i+1);
	}else{
		for(int i=1; i<=n; i++)if(i!=minid)printf("%d %d\n",minid, i);
		for(int i=n; i>1; i--)printf("%d %d\n",i,i-1);
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn=2e5+10;
int main()
{
    int n;
    scanf("%d",&n);
    int x=n%1000;
    if(x==0){
        printf("0\n");
    }
    else{
        printf("%d\n",1000-x);
    }
    return 0;
}


Measured memory_bytes: 3824
#include <stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,G[N][N];
int color[N],d[N],f[N],t;

void _dfs(int u){
  int v;
  color[u] = GRAY;
  d[u] = ++t;
  for(v=0;v<n;v++){
    if(G[u][v] == 0)continue;
    if(color[v] == WHITE){
      _dfs(v);
    }
  }
  color[u] = BLACK;
  f[u] = ++t;
}

void dfs(){
  int u;
  for(u=0;u<n;u++){
    color[u] = WHITE;
    t = 0;
  }

  for(u=0;u<n;u++){
    if(color[u] == WHITE)_dfs(u);
  }
  
  for(u=0;u<n;u++){
    printf("%d %d %d\n",u+1,d[u],f[u]);
      }
}

int main(){
  int u,v,k,i,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++)G[i][j]=0;
  }

  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      G[u][v] = 1;
    }
    
  }
  dfs();

  return 0;
  
}



Measured memory_bytes: 2148
using System;
using System.Collections.Generic;
using System.Linq;
public class Hello{
    public Hello(){}
    public static void Main(){
       new Hello().Calc();
    }
    void Calc(){
        var inputs = InputValues;
        foreach(var i in inputs){
            Console.WriteLine(i);
        }
    }
    List<int> InputValues{
        get{
            var inputs = new List<int>();
            while(true){
                var a = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);
                var N = a[0];
                var X = a[1];
                var count = 0;
                if(N == 0 && X == 0){
                    break;
                }
                for(var x = 1;x <= N - 2;x++){
                    for(var y = x + 1;y <= N - 1;y++){
                        for(var z = y + 1;z <= N;z++){
                            if(x + y + z == X){
                               count++;  
                            }
                        }
                    }
                }
                inputs.Add(count);
            }
            return inputs;
        }
    }
    
}



Measured memory_bytes: 7856
#include<stdio.h>

int main(){
  int n,tmp=0,stock=0,goods[10000];
  scanf("%d",&n);
  for(int i = 0;i<n;i++) scanf("%d",&goods[i]);
  for(int i = 0;i<n;i++){
    if(goods[i] > tmp){
      tmp = goods[i];
    }
    stock += goods[i];
  }
  printf("%d",stock-tmp/2);
  return 0;
}

Measured memory_bytes: 128