akhauriyash/Code-Regression huggingface dataset:
import sys
input=sys.stdin.readline
from random import seed, randint

def calc(d,C,S,T):
    Last=[0]*26
    score=0
    for day,t in enumerate(T):
        t-=1
        Last[t]=day+1
        score+=S[day][t]
        for i,c in enumerate(C):
            score-=c*(day+1-Last[i])
    return score

def main():
    d=int(input())
    C=tuple(map(int,input().split()))
    S=[tuple(map(int,input().split())) for _ in range(d)]
    Ans=[0]*d
    Last=[0]*26
    
    #貪欲法
    for day in range(d):
        ans=0
        score=-float('inf')
        for t in range(26):
            TmpList=Last[:]
            tmp_score=S[day][t]
            TmpList[t]=day+1
            for i,c in enumerate(C):
                tmp_score-=c*(day+1-TmpList[i])
            if tmp_score>score:
                score=tmp_score
                ans=t+1
        Ans[day]=ans
        Last[ans-1]=day
    
    score=calc(d,C,S,Ans)
    #print(Ans)
    #print(score)
    
    #局所探索法
    m=10000
    for i in range(m):
        T=Ans[:]
        seed(i)
        d_idx=randint(0,d-1)
        q=randint(1,26)
        #print(d_idx,q)
        T[d_idx]=q
        tmp=calc(d,C,S,T)
        if tmp>score:
            score=tmp
            Ans=T[:]
    #print(Ans)
    #print(score)
    
    print(*Ans,sep='\n')
    
if __name__=='__main__':
    main()

Measured memory_bytes: 83968
N = int(input())
S = [input() for i in range(N)]
a1 = str(S.count("AC"))
a2 = str(S.count("WA"))
a3 = str(S.count("TLE"))
a4 = str(S.count("RE"))
print("AC x " + a1)
print("WA x " + a2)
print("TLE x " + a3)
print("RE x " + a4)

Measured memory_bytes: 16188
// AOJ ALDS1_14_B String Search
// 2018.4.27 bal4u

#include <stdio.h>
#include <stdlib.h>

#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif

char text[1000005];
char pattern[10005];
int  next[10005], skip[258];

char *bmMatch(char *text, int len, char *pattern, int patlen,
              int *skip, int *next)
{
    int i, j;

    i = patlen - 1;
    while (i < len) {
        j = patlen - 1;
        while (j >= 0 && text[i] == pattern[j]) {
            i--;
            j--;
        }
        if (j < 0) return text + i + 1;
        if (skip[text[i]] >= next[j]) i += skip[text[i]];
        else i += next[j];
    }
    return NULL;
}

int bmSkip(int *skip, int slen, char *pattern, int patlen)
{
    int j;

    if (slen < 256) return -1;
    for (j = 0; j < 256; j++) skip[j] = patlen;
    for (j = 0; j < patlen - 1; j++)
        skip[pattern[j]] = patlen-1-j;
    return 0;
}

int bmNext(int *next, int nlen, char *pattern, int patlen)
{
    int  j, k, s;
    int  *g;

    g = malloc(sizeof(int)*patlen);
    for (j = 0; j < patlen; j++) next[j] = 2*patlen - 1 - j;
    j = patlen;
    for (k = patlen - 1; k >= 0; k--) {
        g[k] = j;
        while (j != patlen && pattern[j] != pattern[k]) {
            next[j] = (next[j] <= patlen-1-k) ? next[j] : patlen-1-k;
            j = g[j];
        }
        j--;
    }
    s = j;
    for (j = 0; j < patlen; j++) {
        next[j] = (next[j] <= s+patlen-j) ? next[j] : s+patlen-j;
        if (j >= s) s = g[s];
    }
    free(g);
    return 0;
}

char buf[20]; int w;
void mypr(int n)
{
	w = 0;
	while (n) buf[w++] = n%10 + '0', n/=10;
	while (w--) pc(buf[w]);
}

void corner(int tlen, int plen)
{
	int i = 0;

	if (tlen >= plen) pc('0'), pc('\n');
	while (--tlen >= plen) mypr(++i), pc('\n');
}

int main()
{
	int c, tlen, plen, len;
	int a, fa, b, fb;
	char *pos;

	fa = 1, a = -1, pos = text; while (1) {
		if ((c = gc()) <= ' ') break;
		*pos++ = c;
		if (a < 0) a = c;
		else if (a != c) fa = 0;
	}
	*pos = 0; tlen = pos-text;

	fb = 1, b = -1, pos = pattern; while (1) {
		if ((c = gc()) <= ' ') break;
		*pos++ = c;
		if (b < 0) b = c;
		else if (b != c) fb = 0;
	}
	*pos = 0; plen = pos-pattern;

	if (fa && fb && a == b) { corner(tlen, plen); return 0; }

    bmSkip(skip, 256, pattern, plen);
    bmNext(next, plen, pattern, plen);
	pos = text, len = tlen;
	while (1) {
	    pos = bmMatch(pos, len-(pos-text), pattern, plen, skip, next);
		if (pos == NULL) break;
		printf("%d\n", pos-text);
		pos++;
	}
	return 0;
}


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

int main(){
	int n, a[100], b[100], t;cin >> n;
	double d1=0, d2=0, d3=0, dl=0;
	for(int i = 0;i < n;i++)scanf("%d", &a[i]);
	for(int i = 0;i < n;i++)scanf("%d", &b[i]);
	
	for(int i = 0;i < n;i++){
		t = fabs(a[i] - b[i]);
		d1 += t;
		d2 += pow(t, 2);
		d3 += pow(t, 3);
		if(dl < t)dl = t;
	}
	d2 = pow(d2, 1./2);
	d3 = pow(d3, 1./3);
	printf("%.6f\n%.6f\n%.6f\n%.6f\n", d1, d2, d3, dl);
	return 0;
}

Measured memory_bytes: 3380
#include <cstdio>

int main(){
    char S[20];
    scanf("%s", S);
    int max = 0;
    int now = 0;
    for(int i=0; S[i]!='\0'; i++){
        if(S[i]=='A' || S[i]=='T' || S[i]=='G' || S[i]=='C'){
            now++;
        }
        else{
            max = (max > now) ? max : now;
            now = 0;
        }
    }
    max = (max > now) ? max : now;
    printf("%d", max);
    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void){
	int a, b;
	scanf("%d %d", &a, &b);

	if (a == b) {
		printf("a == b\n");
	} else if (a < b) {
		printf("a < b\n");
	} else {
		printf("a > b\n");
	}

	return 0;
}

Measured memory_bytes: 2572
import java.io.*;

class Main
{
    public static void main(String args[])throws Exception
    {
        BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb=new StringBuilder();
        int a=Integer.parseInt(bu.readLine());
        System.out.print(a+a*a+a*a*a);
    }
}


Measured memory_bytes: 32564
package main

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

func main() {
	N := nextInt()
	A := nextInt()
	B := nextInt()
	hs := make([]int, N)
	for i := 0; i < N; i++ {
		hs[i] = nextInt()
	}
	var under int
	upper := 1000000000
	for under+1 < upper {
		mid := (under + upper) / 2
		var cnt int
		for i := 0; i < N; i++ {
			if B*mid < hs[i] {
				cnt += int(math.Ceil(float64(hs[i]-B*mid) / float64(A-B)))
			}
		}
		if cnt <= mid {
			upper = mid
		} else {
			under = mid
		}
	}
	fmt.Println(upper)
}

// Input. ----------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
}

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

	return i
}

func nextString() string {
	sc.Scan()
	if err := sc.Err(); err != nil {
		panic(err)
	}

	return sc.Text()
}

// ---------- Input.

// Util. ----------

func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}

// ---------- Util.


Measured memory_bytes: 3072
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k, cnt = 0;
  cin >> n >> k;
  REP(i,n) {
    int h;
    cin >> h;
    if(h >= k) cnt++;
  }
  cout << cnt << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const int INF = 1 << 28;
const ll MOD = 1000000007;
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;
}
template <typename T = int>
struct StarrySkyTree {
    int size;
    vector<T> data;
    vector<T> lazy;
    vector<T> width;

    StarrySkyTree(int n) {
        size = 1;
        while (size < n)
            size <<= 1;
        data.resize(size * 2, 0);
        lazy.resize(size * 2, 0);
        width.resize(size * 2, 1);
        for (int i = size - 2; i >= 0; i--) {
            width[i] = width[i * 2 + 1] + width[i * 2 + 2];
        }
    }

    void lazy_propagate(int p) {
        data[p] += lazy[p];
        if (p < size - 1) {
            lazy[p * 2 + 1] += lazy[p];
            lazy[p * 2 + 2] += lazy[p];
        }
        lazy[p] = 0;
    }

    void add(int wishl, int wishr, T x) { add(wishl, wishr, 0, size, 0, x); }
    void add(int wishl, int wishr, int watchl, int watchr, int k, T x) {
        if (wishr <= watchl || watchr <= wishl) {
            lazy_propagate(k);
            return;
        }
        if (wishl <= watchl && watchr <= wishr) {
            lazy[k] += x;
            lazy_propagate(k);
            return;
        }

        int mid = (watchl + watchr) / 2;
        lazy_propagate(k);
        add(wishl, wishr, watchl, mid, k * 2 + 1, x);
        add(wishl, wishr, mid, watchr, k * 2 + 2, x);
        data[k] = max(data[k * 2 + 1], data[k * 2 + 2]);
    }

    T getMax(int wishl, int wishr) { return getMax(wishl, wishr, 0, size, 0); }
    T getMax(int wishl, int wishr, int watchl, int watchr, int k) {
        if (wishr <= watchl || watchr <= wishl)
            return 0;
        if (wishl <= watchl && watchr <= wishr) {
            lazy_propagate(k);
            return data[k];
        }

        int mid = (watchl + watchr) / 2;
        T L = getMax(wishl, wishr, watchl, mid, k * 2 + 1);
        T R = getMax(wishl, wishr, mid, watchr, k * 2 + 2);
        return max(L, R);
    }
};

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<pll>> ints(n + 1);
    for (int i = 0; i < m; ++i) {
        ll l, r, a;
        cin >> l >> r >> a;
        ints[r].emplace_back(l, a);
    }
    StarrySkyTree<ll> dp(n + 1);
    for (int i = 1; i <= n; ++i) {
        ll maxi = dp.getMax(0, i);
        dp.add(i, i + 1, maxi);
        for (auto &p : ints[i]) {
            dp.add(p.first, i + 1, p.second);
        }
    }
    cout << dp.getMax(0, n + 1) << "\n";

    return 0;
}

Measured memory_bytes: 23424
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;

void main() {
    int[char] aa = ['J':0, 'O':1, 'I':2];
    int N = readln.chomp.to!int;
    string str = readln.chomp;
    int[] dp = new int[2^^3];
    dp[1] = 1;
    foreach(char c; str) {
        int[] _dp = dp.dup;
        dp[] = 0;
        foreach(int i; 0..2^^3) foreach(int j; 0..2^^3) {
            if ((i&j)!=0 && (j&1<<aa[c])!=0) {
                dp[j] = (_dp[i]+dp[j])%10007;
            }
        }
    }
    reduce!("(a+b)%10007")(0, dp).writeln;
}

Measured memory_bytes: 2444
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>

using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

int main() {

    ll N;
    cin >> N;
    ll W[N];
    ll S1 = 0;
    ll S2 = 0;
    rep(i,N){
        cin >> W[i];
        S2 += W[i];
    }
    ll out = 100;
    rep(i,N){
        S1 += W[i];
        S2 -= W[i];
        if(abs(S1-S2)<out) out = abs(S1-S2);
    }
    cout << out << endl;
    return 0;
}


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

using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  priority_queue<long long int> que;

  for (int i = 0; i < N; i++) {
    long long int A;
    cin >> A;
    que.push(A);
  }
  for (int j = 0; j < M; j++) {
    long long int highest = que.top();
    que.pop();
    que.push(highest / 2);
  }

  long long int total_price = 0;

  for (int i = 0; i < N; i++) {
    total_price += que.top();
    que.pop();
  }
  cout << total_price << endl;

  return 0;
}

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

int main() {
	cin.tie(0)->sync_with_stdio(false);

	int d, t, s; cin >> d >> t >> s;

	double T = (double)d / (double)s;
	if (T <= (double)t)
		cout << "Yes" << '\n';
	else
		cout << "No" << '\n';
	return 0;
}

Measured memory_bytes: 3648
a = input().split(" ")
start = a[0]
start = list(map(int, start))
end = a[1]
end = list(map(int, end))

if (end[0] - start[0]) != 0:
    ans = (end[0] - start[0]  - 1) * 100 + end[1] * 10 + end[2] + 1 + (9 - start[1]) * 10 + (10 - start[2])
    if (start[1]*10 + start[0])  < (start[3] * 10 + start[4]) :
        ans -=   1
    if (end[1] * 10 + end[0]) > (end[3] * 10 + end[4]):
        ans -= 1

else:
    if (end[1] - start[1]) != 0:
        ans = (end[1] - start[1] - 1)  * 10 + end[2] + (10 - start[2])
        if (start[1]*10 + start[0])  < (start[3] * 10 + start[4]) :
            ans -=  1
        if (end[1] * 10 + end[0]) > (end[3] * 10 + end[4]):
            ans -= 1
                

        
    else:
        ans = end[2] - start[2] + 1
        if (start[1]*10 + start[0])  < (start[3] * 10 + start[4]) :
            ans -= 1
        if (end[1] * 10 + end[0]) > (end[3] * 10 + end[4]):
            ans -= 1

print(ans)

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

int main() {
  string s;
  cin >> s;
  int a=0;
  for(int i=0;i<s.size();i++){
    if(s.at(i) == '1'){
      a++;
    }
  }
  
  cout << a << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};

int x,y,z;

void solve(){
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y << endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
typedef long long int ll;
typedef long double ld;
using namespace std;

//-------------------------------------------------------------------
const int MAX_V = 100001;
vvi G = vv(MAX_V, 0, 0, int);
struct edge{ll to, color, cost;};
vector<vector<edge>> T(100001);
int root;
int parent[30][MAX_V];
vector<int> depth(MAX_V);

void dfs(int v, int p, int d){
  parent[0][v] = p, depth[v] = d;
  for(int i=0;i<G[v].size();i++) if(G[v][i] != p) dfs(G[v][i], v, d+1);
}
void init(int V){
  dfs(root, -1, 0);
  for(int k=0;k+1<30;k++){
    for(int v=0;v<V;v++){
      if(parent[k][v]<0) parent[k+1][v] = -1;
      else parent[k+1][v] = parent[k][parent[k][v]];
    }
  }
}
int lca(int u, int v){
  if(depth[u]>depth[v]) swap(u, v);
  for(int k=0;k<30;k++)if((depth[v]-depth[u])>>k & 1) v = parent[k][v];
  if(u==v) return u;
  for(int k=30-1;k>=0;k--){
    if(parent[k][u] != parent[k][v]){
      u = parent[k][u];
      v = parent[k][v];
    }
  }
  return parent[0][u];
}
//-------------------------------------------------------------------
vector<ll> c_count(100001, 0), d_count(100001, 0);
std::vector<ll> D(100001, 0);
vvl ans = vv(100001, 10, 0, ll);
vvl que = vv(0, 4, 0, ll);
void fs(ll now, ll from, ll d){
  D[now] = d;
  auto itr = lower_bound(que.begin(), que.end(), vll{now, 0, 0, 0});
  auto ed = upper_bound(que.begin(), que.end(), vll{now+1, 0, 0, 0});
  for(;itr!=ed;itr++){
    vll t = *itr;
    //std::cout << t[0] << " " << t[1] << '\n';
    ans[t[2]][t[3]*3] = c_count[t[1]];
    ans[t[2]][t[3]*3+1] = d_count[t[1]];
    ans[t[2]][t[3]*3+2] = D[now];
  }
  for(int i=0;i<T[now].size();i++){
    if(T[now][i].to==from) continue;
    c_count[T[now][i].color]++;
    d_count[T[now][i].color]+=T[now][i].cost;
    fs(T[now][i].to, now, d+T[now][i].cost);
    c_count[T[now][i].color]--;
    d_count[T[now][i].color]-=T[now][i].cost;
  }
}
int main(int argc, char const *argv[]) {
  ll n, q;std::cin >> n >> q;
  ll a, b, c, d;
  for(int i=0;i<n-1;i++){
    std::cin >> a >> b >> c >> d;
    G[a].push_back(b);
    G[b].push_back(a);
    T[a].push_back(edge{b, c, d});
    T[b].push_back(edge{a, c, d});
  }
  root = 1;
  init(n+1);
  for(int i=0;i<q;i++){
    std::cin >> c >> d >> a >> b;
    ans[i][9] = d;
    que.push_back(vll{a, c, i, 0});
    que.push_back(vll{b, c, i, 1});
    que.push_back(vll{lca(a, b), c, i, 2});
  }
  sort(que.begin(), que.end());
  fs(root, -1, 0);
  for(int i=0;i<q;i++){
    ll a_cost = ans[i][2] + ans[i][0]*ans[i][9] - ans[i][1];
    ll b_cost = ans[i][5] + ans[i][3]*ans[i][9] - ans[i][4];
    ll c_cost = ans[i][8] + ans[i][6]*ans[i][9] - ans[i][7];
    std::cout << a_cost + b_cost - 2*c_cost << '\n';
  }

  return 0;
}


Measured memory_bytes: 71592
/*
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
typedef mp::cpp_int mint; //*/
#include <bits/stdc++.h>
#define  re(i,j,n) for(li i=(j);i<(n);i++)
#define  rep(i,n) re(i,0,(n))
#define  red(i,n) for(li i=n-1;i>=0;i--)
#define  all(a) begin(a),end(a)
#define  pb(a) push_back(a)
using namespace std;
typedef long int li;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<li> vli;
typedef vector<string> vs;


int main()
{
    int a,n,x[8]={0},y=0,ans=0;
    cin>>n;
    rep(i,n){
        cin>>a;
        rep(j,8) if(a>=j*400 && a<(j+1)*400 && x[j]==0) x[j]=1,ans++;
        if(a>=3200) y++;    
    }
    cout<<ans+(ans==0)<<" "<<ans+y<<endl;

    return 0;
}


Measured memory_bytes: 256
def main():
    N = int(input())
    double_count = 0
    for _ in range(N):
        n1, n2 = [int(s) for s in input().split()]
        if n1 == n2:
            double_count += 1
        else:
            double_count = 0
        if double_count == 3:
            print('Yes')
            return
    print('No')

main()

Measured memory_bytes: 62476
import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import java.util.HashSet;

public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            final String s = reader.readLine();

            HashSet<Integer> hs = new HashSet<Integer>();

            final String[] sl = s.split(" ");

            hs.add(Integer.parseInt(sl[0]));
            hs.add(Integer.parseInt(sl[1]));
            hs.add(Integer.parseInt(sl[2]));

            System.out.println(hs.size());
        }
    }
}


Measured memory_bytes: 22356
#include<bits/stdc++.h>
#define X first
#define Y second
#define pb push_back
#define eb pb
#define rep(X,Y) for(int X=0;X<(Y);++X)
#define all(X) (X).begin(),(X).end()

using namespace std;
using ll=long long;

int main(){
	int n,m;
	cin>>n>>m;
	vector<int> usd(n);
	rep(i,m){
		int x;
		cin>>x; --x;
		usd[x]=1;
	}
	int cnt=0;
	while(1){
		int i=n-1;
		while(!usd[i]) --i;
		if(i==m-1) break;
		++cnt;
		int j=0;
		while(usd[j]) ++j;
		swap(usd[i],usd[j]);
	}
	cout<<cnt<<endl;
}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
main(){
vector<int>n;
int a,cou=0;
for(int i=0;;i++){
  cin>>a;
  if(!a)break;
  n.push_back(a);
  cou++;
}
for(int i=0;i<cou;i++){
  cout<<"Case "<<i+1<<": "<<n[i]<<endl;
}
  return 0;
}



Measured memory_bytes: 3140
n=int(input())
# a=[[0]*2]*n
a=[[0 for i in range(2)] for j in range(n)]
for i in range(n):
    a[i][1],a[i][0]=map(int,input().split())
b=sorted(a)
c=[b[i][1] for i in range(n)]
ans="Yes"
d=0
for i in range(n):
    d+=c[i]
    if b[i][0]<d:
        ans="No"
        break
print(ans)

Measured memory_bytes: 41748
n = int(input())
a = list(map(int, input().split()))
x = [0]*(n+1)
tmp = [0]*(n+1)
for i in a:
    x[i] += 1
ans = 0
for i in range(1, n+1):
    tmp[i] = (x[i] * (x[i]-1))//2
    ans += tmp[i]
for i in range(1, n+1):
    print(ans - tmp[a[i-1]] + (x[a[i-1]]-1)*(x[a[i-1]]-2)//2)


Measured memory_bytes: 26140
#include <bits/stdc++.h>
using namespace std;
const int maxn=2e5+5;
int dp[3][3000];
char str[maxn];
int main()
{
    scanf("%s", str);
    int i, j, mod=0, x, n=strlen(str);
    long long ans=0;
    for(i=0; i<n; i++)
    {
        x=str[i]-'0';
        for(j=0; j<=2019; j++)
        {
            dp[1][(j*10+x)%2019]+=dp[0][j];
        }
        dp[1][x]++;
        for(j=0; j<=2019; j++)
        {
            dp[0][j]=dp[1][j];
            dp[1][j]=0;
        }
        ans+=dp[0][0];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3972
#include <cstdio>
#include <utility>
#include <queue>
#include <vector>
#include <functional>
#include <cstring>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef pair<int,int> mp;
typedef pair<int,mp> mmp;
#define min(a,b) (((a)>(b))?(b):(a))
#define MAX (100000005)
int dir[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
int R;

int eans[2][250005];
int emap[2][505][505];
class evh{
public:
	int sx,sy,w,h;
	evh(int* ans,int map[][505]){
		scanf("%d%d%d%d",&w,&h,&sx,&sy);
		sx--;sy--;
		rep(y,h)
			rep(x,w)scanf("%d",&(map[x][y]));
		
		int no=1;
		ans[0]=0;
		priority_queue<mmp,vector<mmp>,greater<mmp> > que;
		que.push( mmp(1,mp(sx,sy)) );
		while(!que.empty()){
			int nl=que.top().first;
			
			while(!que.empty() && que.top().first<=nl){
				int nx=que.top().second.first,
					ny=que.top().second.second;
				que.pop();
				
				if(map[nx][ny]==-1)continue;
				map[nx][ny]=-1;
				ans[no]=nl;
				//printf("kek  %d %d\n",no,ans[no]);
				no++;
				
				rep(i,4){
					int dx=nx+dir[i][0],dy=ny+dir[i][1];
					//printf("pus %d %d\n",dx,dy);
					if(dx<0 || dx>=w || dy<0 || dy>=h || map[dx][dy]==-1)continue;
					que.push( mmp(map[dx][dy],mp(dx,dy)));
				}
			}
		}
	}
};

int main(void){
	while(true){
		scanf("%d",&R);
		if(R==0)break;
		memset(eans,-1,sizeof(eans));
		evh evh1(eans[0],emap[0]);
		evh evh2(eans[1],emap[1]);
		int ans=MAX;
		rep(i,R+1){
			//printf("res  %d %d %d\n",i,eans[0][i],eans[1][i]);
			if(eans[0][R-i]!=-1 && eans[1][i]!=-1){
				ans=min(ans,eans[0][R-i]+eans[1][i]);
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 6100
INF = float("inf") #const
MOD = 10**9+7 #const
MAX = 510000 #const

def main():
    a = [int(input()) for i in range(2)]
    if 1 not in a:
        print(1)
    elif 2 not in a:
        print(2)
    elif 3 not in a:
        print(3)


if __name__ == "__main__":
    main()


Measured memory_bytes: 38384
#include <iostream>
#include <vector>
 
long long N;
long long mod = 1000000007;
long long zero_bit[60];
long long one_bit[60];
 
int main() {
    std::cin >> N;
 
    std::vector<long long> A(N);
    for (long long i = 0; i < N; i++) {
        std::cin >> A[i];
        for (long long bit = 0; bit < 60; bit++) {
            ((A[i] >> bit) & 1) ? one_bit[bit]++ : zero_bit[bit]++;
        }
    }
 
    long long result = 0;
    for (long long bit = 0; bit < 60; bit++) {
        long long tmp = 1;
        tmp *= (1LL << bit) % mod;
        tmp *= (one_bit[bit]*zero_bit[bit])%mod;
        result += tmp;
        result %= mod;
    }
 
    std::cout << result << std::endl;
    return 0;
}


Measured memory_bytes: 2560
#include<stdio.h>
int main(void)
{
	int N,i,c;
	int *k,*kk;
	while(1){
		scanf("%d",&N);
		if(N==0) break;
		k = new int [N];
		kk = new int [N];
		for(i=0;i<N;i++)
			kk[i] = 0;
		for(i=0;i<N;i++)
			scanf("%d",&k[i]);
		
		i=0,c=0;
		while(1){
			if(k[i%N] > 0){
				k[i%N]--;
				kk[i%N]++;
				c++;
			}
			if(kk[i%N] == 2){
				printf("%d\n",c);
				break;
			}
			if(i > N * 2){
				printf("NA\n");
				break;
			}
			i++;
		}
	}
	return 0;
}

Measured memory_bytes: 5228
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL MOD=100000004987;
const int p=1e4+7,M=3e5+1;
map<LL,vector<int> > Mp;
int n;
string a;
vector<LL> tmp;
bool check(int x){
    int f=a.length();
    LL cur=1;
    LL t=0,h;
    for(int i=f-x;i<f;i++){
        h=cur;
        t=(t+(cur*(LL)a[i])%MOD)%MOD;
        cur=(cur*(LL)p)%MOD;
    }
    LL dbg[100];
    dbg[f-x]=t;
    LL u=h;
    tmp.push_back(t);
    Mp[t].push_back(f-x);
    for(int i=f-x-1;i>=0;i--){
        LL oo=((LL)a[i+x]*u)%MOD;
        t-=oo;
        if(t<0) t+=MOD;
        t=(t*(LL)p)%MOD;
        t=(t+(LL)a[i])%MOD;
        dbg[i]=t;
        tmp.push_back(t);
        Mp[t].push_back(i);
    }
    int ok=0;
    for(int i=0;i<tmp.size();i++){
        if(Mp[tmp[i]].size()>1){
            if(Mp[tmp[i]][0]-Mp[tmp[i]].back()>=x)
                ok=1;
            Mp[tmp[i]].clear();
        }
        Mp[tmp[i]].clear();

    }
    tmp.clear();
    return ok;
}
int main()
{
    cin>>n;
    cin>>a;
    int l=1,r=n;
    while(r-l>1){
        int mid=(l+r)/2;
        if(check(mid))  l=mid;
        else
            r=mid;
    }
    if(check(r))    printf("%d",r);
    else{
        if(check(l))
            printf("%d",l);
        else
            printf("0");
    }
    return 0;
}


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en "\n"

constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007; // 998244353;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

void Main(){
    int N; cin >> N;
    VI A(N+1); REP(i,N+1) cin >> A[i];

    REP(i,N+1){
        if((1<<i) > 1000000000) break;
        if(A[i] > (1<<i)){
            cout << -1 << en;
            return;
        }
        if(A[i] == (1<<i)){
            if(N!=i){
                cout << -1 << en;
                return;
            }
            REP(j,i){
                if(A[j] != 0){
                    cout << -1 << en;
                    return;
                }
            }
            cout << (1<<(i+1))-1 << en;
            return;
        }
    }

    VL n(N+1,0); n[N] = A[N];
    RREP(i,N){
        n[i] = n[i+1] + A[i];
        if(i<=60){
            chmin(n[i], 1LL<<i);
        }
    }

    REP(i,N){
        if((n[i]-A[i])*2 < n[i+1]){
            chmin(n[i+1], (n[i]-A[i])*2);
        }
    }

    REP(i,N+1){
        if(n[i] < A[i]){
            cout << -1 << en;
            return;
        }
    }

    ll ans = 0; REP(i,N+1) ans += n[i];
    cout << ans << en;
    return;
}

int main(void){
    cin.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t){
        Main();
    }
    return 0;
}

Measured memory_bytes: 4520
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define mod 1000000007
using namespace std;

int main(){
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);cout.tie(NULL);
	int n,k;
	cin>>n>>k;
	vector<int>a(n),dp(k+1,0);
	
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
	}
	for(int i=0;i<=k;++i){
		for(auto j: a){
			if(i>=j && !dp[i-j])
				dp[i] = 1;
		}
	}
	if(dp[k])
		cout<<"First";
	else
		cout<<"Second";
	// cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
	return 0;
}

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

int main()
{
	string s , t;
	cin >> s >> t;
	int n = s.length();
	int count = 0;
	for(int i = 0 ; i < n ; ++i)
	{
		if(s[i] != t[i])
			count++;
	}
	cout << count;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// cout<<setprecision(10)<<fixed;
	int n, a[252525];
	cin>>n;
	int ma=0;
	REP(i, n){
		cin>>a[i];
		CHMAX(ma, a[i]);
	}
	int cnt=0;
	REP(i, n){
		if(a[i]==ma){
			++cnt;
		}
	}
	if(cnt>=2){
		REP(i, n){
			cout<<ma<<'\n';
		}
	}
	else{
		int b[252525];
		REP(i, n){
			b[i]=a[i];
		}
		sort(b, b+n);
		REP(i, n){
			if(a[i]==ma){
				cout<<b[n-2]<<'\n';
			}
			else{
				cout<<ma<<'\n';
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3200
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
int main(){
  string a;
  cin >> a;
  int aa = 0;
  int bb = 0;
  for(int i = 0;i <= 2;i++){
    if(a[i] == 'A'){
      aa = 1;
    }
    else{
      bb = 1;
    }
  }
  if(aa == 1 && bb == 1){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  return 0;
}

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

int main() {
    int N, M;
    cin >> N >> M;
    int L[M], R[M];
    bool id[N];
    int ans = 0;
    int i,k;
    /*
    for (i = 0; i < N; i++)
    {
        id[i] = true;
    }
    */
    int max1 = 0, min2 = 1000000000;
    for (i = 0; i < M; i++)
    {
        cin >> L[i] >> R[i];
        if (L[i] > max1)
        {
            max1 = L[i];
        }
        if (R[i] < min2)
        {
            min2 = R[i];
        }        
    }
    if (max1 > min2)
    {
        ans = 0;
    } else {
        ans = min2 - max1 + 1;
    }

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


Measured memory_bytes: 1024
import java.util.PriorityQueue;
import java.util.Scanner;

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

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

		PriorityQueue<Def> pq = new PriorityQueue<>();
		for(int i = 0; i < n; i++) {
			pq.add(new Def(sc.nextLong(), sc.nextInt()));
		}

		long ans = 0;
		while(true) {
			Def d = pq.poll();
			if(d.num >= m) {
				ans += d.price * m;
				break;
			}else {
				ans += d.price * d.num;
				m -= d.num;
			}
		}

		System.out.println(ans);
	}
}

class Def implements Comparable<Def> {
	long price;
	int num;

	Def(long price, int num) {
		this.price = price;
		this.num = num;
	}

	@Override
	public int compareTo(Def d) {
		if(price < d.price) return -1;
		if(price == d.price) return 0;
		return 1;
	}
}


Measured memory_bytes: 83512
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
long long ord(long long n, long long p) {
	if (n%p != 0) {
		return 0;
	}
	else {
		return 1 + ord(n / p , p);
	}
}
long long rui(long long p,long long x) {
	if (x == 0) {
		return 1;
	}
	else {
		return p * rui(p, x - 1);
	}
}
int main(){
	int n;
	cin >> n;
	string ans = "second";
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		if (a % 2 == 1) {
			ans = "first";
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s, t;
  cin >> s >> t;
  for(int i = 0; i < 200; i++){
  	char f = s[0];
    s = s.substr(1);
    s.push_back(f);
    if(s == t){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#include <bitset>
#include <complex>
#define ll long long
#define INF 1000000000000000001
#define MOD 1000000007
using namespace std;



int main(){
    ll A,B, N;
    cin >> A >> B >> N;

    if(N>=B-1){
        cout<<(A*(B-1))/B<<endl;
    }else{
        cout<<(A*N)/B<<endl;
    }
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	int x, y;
	cin >> x >> y;
	cout << x+y/2 << endl;
	return 0;
}

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

hon_list = [2,4,5,7,9]
pon_list = [0,1,6,8]
bon_list = [3]

if N%10 in hon_list:
    print('hon')
elif N%10 in pon_list:
    print('pon')
elif N%10 in bon_list:
    print('bon')


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

using namespace std;

///dir array for Queen int dxq[10] = {-1,-1,-1,1,1,1,0,0};
///dir array for Queen int dyq[10] = {-1,0,1,-1,0,1,-1,1};
///dir array for knight int dxk[10] = {-2,-2,-1,-1,1,1,2,2};
///dir array for knight int dyk[10] = {1,-1,-2,2,-2,2,-1,1};

int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int K, start, finish, cnt, value;

    while(cin>>K>>value){
        int i,j,k;

        int c1 = value - K;
        int c2 = value + K;

        start = min(c1,c2);
        finish = max(c1,c2);

        for(i = start+1; i<finish; i++){
            if(i == start + 1)cout<<start+1;
            else{
                cout<<" "<<i;
            }
        }
        cout<<endl;


    }


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=100000000000000000;


int main() {
   ll a,b;
   cin >> a >> b;
   ll n=__gcd(a,b);
   int ans=1;
   ll num=n;
   rep(i,sqrt(n)){
       if (num%(i+2)==0){
           ans++;
           while (num%(i+2)==0) num/=(i+2);
       }
   }
   if (num!=1) ans++;
   cout << ans << endl;
}


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

using namespace std;
#define inputInt(a) int a; cin >> a; 
#define inputInt2(a,b) int a; int b; cin >> a >> b; 
#define inputInt3(a,b,c) int a; int b; int c; cin >> a >> b >> c;
#define inputLong(a) long a;cin >> a; 
#define inputIntArray(a,N) int a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputLongArray(a,N) long a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputIntArray2(a,b,N) int a[N]; int b[N]; for(int i=0;i<N;i++){cin >> a[i] >> b[i];}
#define output(answer) cout << answer << endl;
#define fN(i,N)    for(int i=0; i<N; i++)
#define fSE(i,s,e) for(int i=s; i<=e; i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main()
{
  //input
  int N, K;
  cin >> N >>K;
  //main
  
  // output
  cout << (N+K-3)/(K-1) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = (ll)(1e9 + 7);
int main()
{
    ll n;
    ll k;
    cin >> n >> k;
    vector<ll> a(n);
    ll sum = 0, sum2 = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (a[i] > a[j])
                sum++;
        }
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            if (a[i] > a[j])
                sum2++;
        }
    }
    ll cnt = 0;
    ll cntkmin1 = (k * (k - 1) / 2) % MOD;
    ll cntkmin2 = k % MOD;
    cnt = (sum2 * k % MOD + sum * cntkmin1 % MOD);
    cout << cnt % MOD << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int a,b;
	cin >> a >> b;
	int rmd = 1 , ans = 0;
	while(rmd < b) {
		rmd--;
		rmd += a;
		ans ++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define Rep(i,n) for(ll i=1;i<=n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
#define prique priority_queue<ll>
const int mod = 1000000007;
const int mod2 = 998244353;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
long nCr(int n, int r) {
	int ans = 1;
	for (ll i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
struct union_find {
	int par[200010], size_[200010];
	void init(int x) {
		rep(i, x) { par[i] = i; size_[i] = 1; }
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (size_[x] < size_[y]) {
			par[x] = y;
			size_[y] += size_[x];
		}
		else {
			par[y] = x;
			size_[x] += size_[y];
		}
	}
};

signed main() {
	int n;
	cin >> n;
	if (n % 2 != 0)cout << 0 << endl;
	else {
		int ans = 0;
		int num = 10;
		while (num <= n) {
			ans += n / num;
			num *= 5;
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 256
from sys import stdin

n, a, b = [int(x) for x in stdin.readline().rstrip().split()]

s = 0
for i in range(n+1):
    pp = 0
    m = i
    for j in range(5):
        p = m % 10
        pp = pp + p
        m = m//10
    if pp >= a and pp <= b: s = s + i

print (s)





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

int main() {
	char wea[10];
	int c = 0;
	cin >> wea;
	if (wea[0] == 'R') {
		c = 1;
	}
	else {
		c = 0;
	}
	for (int i = 1; i <= 2; i++) {
		if (wea[i] == 'R' and wea[i - 1] == 'R') {
			c += 1;
		}
		else if (wea[i] == 'R' and wea[i - 1] == 'S') {
			c = 1;
		}
	}
	cout << c;
	return 0;
}

Measured memory_bytes: 3176
#include <iostream>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <list>
#include <math.h>
#include <map>
using namespace std;
#define REP(i, k, n) for(int i = k;i < n; i++)
#define rep(i, n) REP(i,0,n)
#define ll long long int
int dx[4] = {0,-1,1,0};
int dy[4] = {-1,0,0,1};
#define eps 10e-6
#define mod 1000000007
int main(void){
	int N;
	ll x[200001];
	ll tmp[200001];
	cin >> N;
	rep(i,N){
		cin >> x[i];
		tmp[i] = x[i];
	}
	sort(x,x+N);
	int med = ((N-1)/2)+1;
	rep(i,N){
		cout << ((x[med]<=tmp[i])?x[med-1]:x[med]) << endl;
	}
	return 0;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
 
#define rep(i, n) for (ll i=0;i<(n); i++)
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; }
#define ALL(x) (x).begin(),(x).end()
 
using namespace std;
//using ll=long long;
typedef long long ll;
typedef pair<ll, ll> pi;

ll h,w;
ll ans;
//vector<char> masu;




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

  ll tmp, ans;
  map<ll, ll> m;

  priority_queue<ll> p;
  vector<ll> v;

  m[0]++;

  rep(i,n){
    cin>>tmp;
    m[tmp]++;
  }

  ll b=0;
  ll j;
  if(m[0]>1){
    ans = 0;
    cout << ans <<endl;
    return 0;
  }
  else {p.push(0);
    p.push(24);
  }
  if(m[12]>1){
    ans = 0;
    cout << ans <<endl;
    return 0;
  }
  else if(m[12]==1) p.push(12);

  
  rep(i, 11){
    ll j = i+1;
    if(m[j]>2){
      ans = 0;
      cout << ans <<endl;
      return 0;
    }
    else if(m[j]==2){
      p.push(j);
      p.push(24-j);
      m[j] = 0;
    }
    else if(m[j]==1){
      b++;
      v.push_back(j);
    }
  }

  //cout <<b<<endl;
  ans = 0;
  rep(i, 1<<b){
    //cout << i<<endl;
    priority_queue<ll> p_tmp = p;

    rep(j, b){
      if(i>>j&1) p_tmp.push(24-v[j]);
      else p_tmp.push(v[j]);	
    }
    
    ll min_tmp = 999999999999;
    ll tmp_p;
    
    //cout<<" "<<p_tmp.size()<<endl;
    ll N = p_tmp.size()-1;
    rep(k, N){

      tmp_p = p_tmp.top();
      p_tmp.pop();
      
      //cout <<i<<" "<< tmp_p<<" " <<p_tmp.top()<<endl;

      if(tmp_p-p_tmp.top()<min_tmp){
	min_tmp = tmp_p-p_tmp.top();
      }
    }
    ans = max(ans, min_tmp);
  }
  
  cout << ans<<endl;

  
  
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
    ost<<"{"<<p.first<<","<<p.second<<"}";
    return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
    ost<<"{";
    for(int i=0;i<v.size();i++){
        if(i)ost<<",";
        ost<<v[i];
    }
    ost<<"}";
    return ost;
}
template<uint32_t mod>
struct ModInt{
    uint32_t a;
    ModInt& s(uint32_t vv){
        a=vv<mod?vv:vv-mod;
        return *this;
    }

    ModInt(int64_t x=0){s(x%mod+mod);}

    ModInt& operator+=(const ModInt &x){return s(a+x.a);}
    ModInt& operator-=(const ModInt &x){return s(a+mod-x.a);}
    ModInt& operator*=(const ModInt &x){
        a=uint64_t(a)*x.a%mod;
        return *this;
    }
    ModInt& operator/=(const ModInt &x){
        *this*=x.inv();
        return *this;
    }

    ModInt operator+(const ModInt &x)const{return ModInt(*this)+=x;}
    ModInt operator-(const ModInt &x)const{return ModInt(*this)-=x;}
    ModInt operator*(const ModInt &x)const{return ModInt(*this)*=x;}
    ModInt operator/(const ModInt &x)const{return ModInt(*this)/=x;}
    bool operator==(const ModInt &x)const{return a==x.a;}
    bool operator!=(const ModInt &x)const{return a!=x.a;}
    bool operator<(const ModInt &x)const{return a<x.a;}

    ModInt operator-()const{return ModInt()-*this;}
    ModInt pow(int64_t n)const{
        ModInt res(1),x(*this);
        while(n){
            if(n&1)res*=x;
            x*=x;
            n>>=1;
        }
        return res;
    }

    ModInt inv()const{return pow(mod-2);}
};

template<uint32_t mod>
istream& operator>>(istream& in,ModInt<mod>& a){
    return (in>>a.a);
}
template<uint32_t mod>
ostream& operator<<(ostream& out,const ModInt<mod>& a){
    return (out<<a.a);
}
using mint=ModInt<998244353>;
signed main(){
    int N;cin>>N;
    vint D(N);rep(i,N)cin>>D[i];
    if(D[0]!=0){
        cout<<0<<endl;
        return 0;
    }

    vint cnt(N);
    rep(i,N)cnt[D[i]]++;
    if(cnt[0]!=1){
        cout<<0<<endl;
        return 0;
    }
    mint ans=1;
    for(int i=1;i<N;i++){
        if(cnt[i]==0)continue;
        ans*=mint(cnt[i-1]).pow(cnt[i]);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1792
using System;
using System.Linq;

public class Problem_C
{
  public static void Main()
  {
    var inputs = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
    int N = inputs[0], M = inputs[1];

    var from = new int[M];
    var to = new int[M];
    var matrix = new int[N, N];
    for (var i = 0; i < M; i++)
    {
      var edge = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
      from[i] = edge[0] - 1;
      to[i] = edge[1] - 1;
      matrix[from[i], to[i]] = matrix[to[i], from[i]] = 1;
    }

    var count = 0;
    for (var i = 0; i < M; i++)
    {
      // Check how it works when each edge is removed
      matrix[from[i], to[i]] = matrix[to[i], from[i]] = 0;

      var visited = new bool[N];
      Dfs(N, 0, matrix, visited);
      if (visited.Contains(false)) count++;

      // Resume original state
      matrix[from[i], to[i]] = matrix[to[i], from[i]] = 1;
    }
    Console.WriteLine($"{count}");
  }

  private static void Dfs(int nodeNum, int v, int[,] matrix, bool[] visited)
  {
    visited[v] = true;
    for (var i = 0; i < nodeNum; i++)
    {
      if (matrix[v, i] == 0) continue;
      if (visited[i]) continue;
      Dfs(nodeNum, i, matrix, visited);
    }
  }
}


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

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int ans = 0;
    if(a > b) ans += b;
    else ans += a;
    if(c > d) ans += d;
    else ans += c;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
a = input().split()
a_int = list(map((lambda x: int(x)), a))
num = 0

con = sum(a_int) / (4 * m)

for i in range(n):
  if a_int[i] >= con:
    num += 1

if num >= m:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9180