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

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define F first
#define S second
#define MSET(m,v) memset((m),(v),sizeof(m))
#define UB(c,v) (upper_bound((c).begin(),(c).end(),(v)))
#define LB(c,v) (lower_bound((c).begin(),(c).end(),(v)))
#define INREP int TC;cin>>TC;while(TC--)
#define CPPIO ios::sync_with_stdio(false);cin.tie(NULL);
#define PC(x) fixed<<setprecision(x)
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1<<" | ";
  __f(comma+1, args...);
}
#else
#define trace(...)
#endif

typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef pair <int,int> pii;
typedef pair <ll,ll> pll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;

// SOLUTION

int main () {
	CPPIO;
  int n;
  cin >> n;
  int k = 0;
  int p = n;
  while (p) {
    k += p % 10;
    p /= 10;
  }
  if (n % k == 0) cout << "Yes";
  else cout << "No";
	return 0;
}


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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const ll INF = 1LL<<60;
const int mINF = 1e9;
const int MOD = 1e9+7;

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

template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

template<typename T>//文字列の置換/Boost:replace_all()
T replace_str(T str, string target, string str_to) {
    string::size_type pos = 0;
    while (pos = str.find(target, pos), pos != string::npos) {
        str.replace(pos, target.length(), str_to);
        pos += str_to.length();
    }
    return str;
}

int main(){
    int n;cin >> n;
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            if(i*j==n){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
//using System.Text;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;
//using pair = Pair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
    void chmax<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? b : a; }
    void chmin<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? a : b; }

    void solve()
    {
        int a = cin.nextint;
        int b = cin.nextint;
        if (b < a)
        {
            WriteLine(a - 1);
        }
        else
        {
            WriteLine(a);
        }
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 11092
#include <stdio.h>
#include <bitset>

int n;
char ch[2005][2048];

// bs1 is inclusive, bs2 is exclusive
std::bitset<2048> bs1[2005],bs2[2005];

void stuff(int i,int j)
{
    if ((bs2[i]&bs1[j]).any()) {
        //printf("%d %d with %c\n",i,j,ch[j][i]);
        // they overlap
        if (ch[j][i]=='0') {
            // i wins, j loses
            //printf("%d wins, %d loses\n",i,j);
            bs2[i]|=bs2[j];
        }
        else {
            // i loses, j wins
            //printf("%d loses, %d wins\n",i,j);
            bs1[j]|=bs1[i];
        }
    }
}

int ans=0;

int main()
{
    #ifdef NOT_DMOJ
    freopen("data.txt","r",stdin);
    #endif // NOT_DMOJ
    scanf("%d",&n);
    for (int i=1; i<n; i++) {
        for (int j=0; j<i; j++) {
            scanf(" %c",&ch[i][j]);
        }
    }
    for (int i=0; i<n; i++) {
        bs1[i][i]=1;
        bs2[i][i+1]=1;
    }
    // cheese this part
    for (int i=0; i<11; i++)
    for (int d=1; d<n; d++) {
        for (int i=0; i+d<n; i++) {
            stuff(i,i+d);
        }
    }
    for (int i=0; i<n; i++) {
        if (bs1[i][0] && bs2[i][n]) ans++;
    }
    printf("%d\n",ans);
}


Measured memory_bytes: 5248
#include <stdio.h>

int k[3]={1,0,-1};
int l[3]={1,0,-1};
int a[51][51],h,w;

void dps(int y,int x){
    int i,j;
    if(x==-1 || y==-1 || x==w || y==h)
        return;
    
    a[y][x]=0;
    for(i=0;i<3;i++){
        for (j=0; j<3; j++){
           if(a[y+k[i]][x+l[j]]==1)
               dps(y+k[i],x+l[j]);
        }
    }
}

int main(void){
    int i,j,count=0;
    while(1){
    i=0;j=0;w=0;h=0;count=0;
    scanf("%d %d",&w,&h);
        if(w==0)break;
    for(i=0;i<h;i++)
        for (j=0; j<w; j++) {
            scanf("%d",&a[i][j]);
        }
    for(i=0;i<h;i++)
        for (j=0; j<w; j++)
            if(a[i][j]==1){
                dps(i,j);
                count++;
            }
    printf("%d\n",count);
    }
    return 0;
}

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

int main(){
    int k, a, b, i;
    int flag = 0;
    cin >> k;
    cin >> a >> b;
    for(i=a;i<=b;i++){
        if(i%k == 0){
            flag = 1;
            break;
        }
    }

    if(flag == 1){
        cout << "OK" << endl;
    }else{
        cout << "NG" << endl;
    }
    return 0;
}

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

typedef struct abcd
{
    int a;
    int b;
    int c;
    int d;
};

void generate(vector<vector<int>> &patterns, vector<int> p, int initial, int loopCount, int M)
{
    if (loopCount == 0)
    {
        patterns.emplace_back(p);
        return;
    }

    for (int i = initial; i <= M; i++)
    {
        p.emplace_back(i);
        generate(patterns, p, i, loopCount - 1, M);
        p.pop_back();
    }
}

void solve(std::istream &ist, std::ostream &ost)
{
    /* ------- 宣言と入力 ------- */

    int N, M, Q;
    ist >> N >> M >> Q;

    vector<struct abcd> ABCD;

    for (int i = 0; i < Q; i++)
    {
        int a, b, c, d;
        ist >> a >> b >> c >> d;

        struct abcd new_abcd;
        ABCD.emplace_back(new_abcd);
        ABCD[i].a = a;
        ABCD[i].b = b;
        ABCD[i].c = c;
        ABCD[i].d = d;
    }

    /* ------- 計算 ------- */

    vector<vector<int>> patterns;
    vector<int> prefix;
    generate(patterns, prefix, 1, N, M);

    long long max_score = 0;

    for (auto A : patterns)
    {
        long long score = 0;
        for (int q = 0; q < Q; q++)
        {
            if (A[ABCD[q].b - 1] - A[ABCD[q].a - 1] == ABCD[q].c)
            {
                score += ABCD[q].d;
            }
        }
        max_score = max(max_score, score);
    }

    ost << max_score << endl;
}

#ifndef WOMAIN
int main()
{
    solve(std::cin, std::cout);
    return 0;
}
#endif


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

int main() {
  int K, N;
  cin >> K >> N;
  int data[N];
  for (int i = 0; i < N; i++) {
    cin >> data[i];
  }
  int count =  0;
  int countMax;
  for (int s = N - 1; s > 0; s--) {
    int tmp = data[s] - data[s - 1];
    count += tmp;
    if (s == N - 1) {
      countMax = tmp;
    } else {
      countMax = max(tmp, countMax);
    }
  }

  int tmp = (K - data[N - 1]) + data[0];
  count += tmp;
  countMax = max(tmp, countMax);
  count -= countMax;
  cout << count << endl;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());

		for (int p = 1; p <= 1000; ++p) {
			int tax8 = p * 8 / 100;
			if (tax8 != a) {
				continue;
			}

			int tax10 = p * 10 / 100;
			if (tax10 != b) {
				continue;
			}

			System.out.println(p);
			return;
		}

		System.out.println(-1);
	}

}


Measured memory_bytes: 23892
def resolve():
    n=int(input())
    a=list(map(int,input().split()))
    q=int(input())
    m=list(map(int,input().split()))
    sa=[0]*100000
    for i in range(2**n):
        s=0
        for j in range(n):
            if i>>j&1:
                s+=a[j]
        sa[s]=1
    for i in m:
        if sa[i]==0:
            print('no')
        else:
            print('yes')

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 6248
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,P> PP;
const ll MOD=998244353;
const ll MAX_N=500010;
const ll INF=100100100100100;
string ts[]={"maerd","remaerd","esare","resare"};
bool equal(string t, string s, int i){
    int m=t.length();
    for(int j=0;j<m;j++){
        if(t[j]!=s[i+j]) return false;
    }
    return true;
}

int main(){
    string s;
    cin>>s;
    int n=s.length();
    bool f=true;
    reverse(s.begin(), s.end());
    for(int i=0;i<n;){
        bool g=false;
        int m=0;
        for(int j=0;j<4;j++){
            string t=ts[j];
            m=t.length();
            if(i+m>n) continue;
            if(equal(t,s,i)){
                g=true;
                break;
            }
        }
        if(g){
            i+=m;
        }else{
            cout<<"NO"<<endl;
            return 0;
        }
        //cout<<i<<endl;
    }
    cout<<"YES"<<endl;
}

Measured memory_bytes: 3172
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <array>
using namespace std;

#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=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int n, k;
    cin >> n >> k;
    VI c(n);
    REP(i,n){
        int x;
        scanf("%d", &x);
        c[x-1]++;
    }
    sort(ALL(c));
    int ans = 0;
    REP(i,n-k) ans += c[i];
    cout << ans << endl;

    return 0;
}

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

int N, M;
vector<pair<long int, int> > AB;

int main(){
    cin >> N >> M;
    for (int i =0; i < N; i++){
        long int a;
        int b;
        cin >> a >> b;
        AB.push_back(make_pair(a, b));
    }
    sort(AB.begin(), AB.end());
    int num = 0;
    long int sum_money = 0;
    for (int i = 0; i < N; i++){
        // buy
        int buy_num = min(num + AB[i].second, M) - num;
        num += buy_num;
        long int money = buy_num * AB[i].first;
        sum_money += money;
        if (num == M){
            break;
        }
    }
    cout << sum_money << endl;

    return 0;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
using i64 = long long;

i64 dp[100010][13];

int main() {
    constexpr i64 mod = 1000000007;
    std::string s;
    std::cin >> s;
    int n = s.size();

    i64 t = 1;
    dp[0][0] = 1;
    for (int i = 1; i <= n; i++) {
        if (s[n - i] == '?') {
            for (int j = 0; j < 13; j++) for (int d = 0; d < 10; d++) {
                dp[i][(j + t * d) % 13] += dp[i - 1][j];
                dp[i][(j + t * d) % 13] %= mod;
            }
        } else {
            int d = s[n - i] - '0';
            for (int j = 0; j < 13; j++) {
                dp[i][(j + t * d) % 13] += dp[i - 1][j];
                dp[i][(j + t * d) % 13] %= mod;
            }
        }
        t = t * 10 % 13;
    }

    std::cout << dp[n][5] << std::endl;

    return 0;
}



Measured memory_bytes: 10624
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

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

    map <long long, int> M;
    vector <long long> V2, V4;

    int v2 = 0, v4 = 0;
    for (int i = 0; i < N; i++){
        long long A;
        cin >> A;
        M[A] ++;

        if (M[A] == 2){
            V2.push_back(A);
            v2 ++;
        }
        if (M[A] == 4){
            V4.push_back(A);
            v4 ++;
        }
    }

    long long ans = 0;
    if (v4 > 0){
        sort(V4.begin(), V4.end(), greater<long long>());
        long long sum = V4[0] * V4[0];
        if (sum > ans){
            ans = sum;
        }
    }
    if (v2 > 1){
        sort(V2.begin(), V2.end(), greater<long long>());
        long long sum = V2[0] * V2[1];
        if (sum > ans){
            ans = sum;
        }
    }
    

    cout << ans << endl;


    

    return 0;
}

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

map<ll, ll> primeFactor(ll n) {
    map<ll, ll> ret;
    for(ll i = 2; i * i <= n; i++) {
        while(n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if(n != 1) ret[n] = 1;
    return ret;
}
 
 
int main() {
    ll n;
    cin >> n;
    vector<int> num = {1, 3, 6, 10, 15, 21, 28, 36, 45, 55};
    auto mp = primeFactor(n);
    ll ans = 0;
    for (auto p : mp) {
        int t = 0;
        if (binary_search(num.begin(), num.end(), p.second)) t = 1;
        ans += lower_bound(num.begin(), num.end(), p.second) - num.begin() + t;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll ans = 0, N;
    cin >> N;
    vl A(N);
    rep(i, N) cin >> A[i];

    rep(i,N){
        if (i % 2) continue;
        if (A[i] % 2) ans++;
    }

    cout << ans << endl;
}

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

int main(){
	int n;
	string taro, hanako;
	int t = 0, h = 0;

	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> taro >> hanako;
		if (taro == hanako){
			t++; h++;
		}
		else if (taro < hanako) h += 3;
		else if (taro > hanako) t += 3;
	}

	cout << t << " " << h << endl;

	return 0;
}



Measured memory_bytes: 3172
#include<stdio.h>
#include<string.h>
int main(){
  char s1[11],s2[11],s3[11];
  scanf("%s%s%s",s1,s2,s3);
  printf("%c",s1[0]-32);
  printf("%c",s2[0]-32);
  printf("%c",s3[0]-32);
  return 0;
}



Measured memory_bytes: 128
void main()
{
    long n = rdElem;
    long[] a = rdRow;

    long[long] list;
    foreach (i, x; a)
    {
        ++list[i-x];
    }

    long result;
    foreach (i, x; a)
    {
        --list[i-x];
        if (i + x in list)
        {
            result += list[i+x];
        }
    }

    result.writeln;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;
enum double eps = 1.0e-9;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

Measured memory_bytes: 23412
#include<iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <string>
#include<limits>
#include<cstdlib>
#include<functional>
#include<cassert>
#include <cstdio>
#include <stack>
#include <queue>
using namespace std;
int N;
int L;
int P;
const int MAX_N = 100000;
const int MAX_W = 100000;


int A[MAX_N+1];
int B[MAX_N+1];

void solve() {
	
	string s;



	cin >> s;

	bool isgood = false;
	sort(s.begin(),s.end());


	if (s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) {
		isgood = true;
	}

	if (isgood == true) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


int main()
{
	solve();

	int a;//止める用
	cin >> a;
	return 0;
}

Measured memory_bytes: 256
//Author : Siriuslight
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
#define FIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0),cout<<setprecision(10)<<fixed;
#define int long long
#define F first
#define S second

using namespace std;
using namespace __gnu_pbds;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

typedef long long ll;
typedef long double ld;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

const ll inf = 1e9+100, N = 2e2+5;
const ll INF = 1e18+100, MOD = 1e9+7;

ll powmod(ll a,ll b,ll m=MOD){ll r=1;while(b>0){if(b&1)r=r*a%m;a=a*a%m;b>>=1;}return r;}
ll power(ll a,ll b){ll r=1;while(b>0){if(b&1)r=r*a;a=a*a;b>>=1;}return r;}
ll gcd(ll a,ll b){if(!b)return a;return gcd(b,a%b);}
ll inv(ll a, ll m = MOD){return powmod(a,m-2,m);}
ll lcm(ll a,ll b){return(a*b)/gcd(a,b);}

//ordered_set X;
//X.insert(3);
//X.order_of_key(3) no of elements less than 3
//*X.find_by_order(n) nth greatest element(0-indexed)

int n, a, b, p[N], ans = inf, h[N];
int32_t main(){
    FIO;
    cin >> n >> a >> b;
    for(int i = 1; i <= n; ++i){
        cin >> p[i];
        h[p[i]]++;
    }
    for(int i = 1; i <= 20; ++i) h[i] += h[i - 1];
    ans = min(ans, h[a]);
    ans = min(ans, h[b] - h[a]);
    ans = min(ans, h[20] - h[b]);
    cout << ans;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
bool judge(string s){
    string m;
    m=s;
    reverse(m.begin(),m.end());
    if(m==s) return 1;
    else return 0;
}

int main(){
    string s;
    cin>>s;
    int n;
    n=s.size();
    bool a,b;
    a=judge(s);
    b=judge(s.substr(0,n/2));
    if(a && b) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int N;
  	cin >> N;
  	if(N%2==0)
    {
  		cout << (double)1/2;
    }
  	else
    {
    	cout << (int(N/2)+1)/(double)N;
    }
  	return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    int ans = 0;
    cin >> n;
    vector<int> a(n), b(n), c(n - 1);
    rep (i, n) {
        cin >> a[i];
    }
    rep (i, n) {
        cin >> b[i];
    }
    rep (i, n - 1) {
        cin >> c[i];
    }
    int pre = -Inf;
    rep (i, n) {
        ans += b[a[i] - 1];
        if (a[i] - pre == 1) ans += c[a[i] - 2];
        pre = a[i];
    }
    cout << ans << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long int ll;

int main()
{
    int n,a,b;
	int c;
	int d[100];
	cin >> n >> a >> b >> c;
	for(int i=0;i<n;i++)cin >> d[i];
	sort(d,d+n);
	int ans=c/a;
	int co=c;
	int price=a;
	for(int i=n-1;i>=0;i--){
		co+=d[i];
		price+=b;
		ans=max(ans,co/price);
		//printf("%d\n",ans);
	}
	printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
#define vll vector<ll>
constexpr ll INF = 1e9 + 7;
constexpr ll MOD = 1e9 + 7;

template <typename T>
void vecin(vector<T> &v, int n = 0)
{
    if (n == 0)
        n = v.size();
    for (int i = 0; i < n; ++i)
    {
        cin >> v[i];
    }
}
template <typename T>
void vecout(vector<T> &v, int n = 0)
{
    if (n == 0)
        n = v.size();
    for (int i = 0; i < n - 1; ++i)
    {
        cout << v[i] << " ";
    }
    cout << v[n - 1] << endl;
}
void print(string s)
{
    cout << s << endl;
}

int main()
{
    ciosup;
    int n;
    cin >> n;
    vector<vint> a(n, vint(n - 1));
    queue<pint> que;
    REP(i, n)
    {
        vecin(a[i]);
        REP(j, n - 1)
        {
            a[i][j]--;
        }
    }
    REP(i, n)
    {
        if(a[i][0] > i && a[a[i][0]][0] == i)
        {
            que.emplace(make_pair(i, a[i][0]));
        }
    }
    vint now(n,0);
    vector<bool> used(n,false);
    ll ans = 1;
    while (que.size())
    {
        pint cd = que.front();
        if (used[cd.FI] || used[cd.SE]){
            ++ans;
            fill(used.begin(),used.end(), false);
            continue;
        }
        que.pop();
        ++now[cd.FI];
        ++now[cd.SE];
        used[cd.FI] = used[cd.SE] = true;
        if (now[cd.FI] < n-1){
            int k = a[cd.FI][now[cd.FI]];
            if (now[k] < n - 1 && a[k][now[k]] == cd.FI) que.emplace(make_pair(cd.FI,k));
        }
        if (now[cd.SE] < n - 1)
        {
            int k = a[cd.SE][now[cd.SE]];
            if (now[k] < n - 1 && a[k][now[k]] == cd.SE)
                que.emplace(make_pair(cd.SE, k));
        }
    }
    bool flag = false;
    REP(i, n)
    {
        if (now[i] != n - 1){
            flag = true;
            break;
        }
    }
    if (flag)
        ans = -1;
    cout << ans << endl;
}


Measured memory_bytes: 4224
roomsOfBuilding = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]

n = int(input())
for l in range(n):
    # b棟f階のr番目の部屋にv人
    b, f, r, v = map(int, input().split())
    roomsOfBuilding[b - 1][f - 1][r - 1] += v
counter = 0
for building in roomsOfBuilding:
    counter += 1
    for rooms in building:
        for room in rooms:
            print(' ' + str(room), end='')
        print('')
    if counter < 4:
        print('#' * 20)



Measured memory_bytes: 5624
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
typedef pair<ll,mp> mmp;
ll inf =  1e9;


int main(){
 ll n,m,k;
 ll a,b,c;
 cin>>n>>m>>k;
 cin>>a>>b>>c;
 ll t;
 cin>>t;
 vector<ll> s(m);
 for(ll i=0;i<m;i++)cin>>s[i];

 ll rest = -1;
 priority_queue<mmp> q;//残り個数，残り時間
 for(ll i=0;i<m;i++){
  ll time = t-(s[i]-s[0])*b;
  
  if( time >= 0 ) rest++;
  else break;

  if( i == m-1 ) break;

  ll cnt = time/a;
  ll next = s[i] + cnt + 1;
  if( next >= s[i+1] ){
   rest += s[i+1]-s[i] - 1;
   continue;
  }else{
   rest += cnt;
  }

 // cout<<i<<' '<<rest<<endl;
  ll rest_time = time - c*(next-s[i]);
  // 次の個数　，　残り時間　，　本当の残り個数
  if( rest_time < 0 ) continue;
  //cout<<i<<' '<<min(rest_time/a, s[i+1]-next)<<' '<<next<<' '<< rest_time<< ' '<<s[i+1]-next<<endl;
  //cout<<cnt<<' '<<time<<' '<<rest_time<<' '<<rest_time/a<<endl;
  ll add = min( rest_time/a + 1 , s[i+1]-next );
  //rest_time -= c*add;
  //if( rest_time < 0 ) continue;
  ll rest_point = s[i+1]-next - add;
  if( rest_point <  0 )  continue;
  
  q.push( mmp( add , mp(rest_time , rest_point ) ) );
  //q.push( mmp( min( rest_time/a+1 , s[i+1]-next ),  mp( rest_time , s[i+1]- next - min( rest_time/a+1 , s[i+1]-next) ) )  );
 }
 //cout<<rest<<endl;
 k-=m;
 while( k>0 && !q.empty() ){
  mmp now = q.top();
  q.pop();
  
  mp nn = now.second;
  if( now.first < 0 ) break;
  ll next_time = nn.first - c*( now.first );
 // if( next_time < 0 ) continue;
  // cout<<now.first<<endl;
  rest += now.first;
  k--;
  ll add = min( max( 1ll , next_time/a +1   ) , nn.second );
  ll rest_point = nn.second - add;
  if( next_time > 0 )
  q.push( mmp( add , mp( next_time , rest_point) ) );
  //if( min(nn.first/a , nn.second ) > 0 )
  //q.push( mmp( min( nn.first/a + 1  , nn.second) , mp( nn.first -c*(nn.first/a+1) , nn.second - nn.first/a -1  ) ) );
  //else if( nn.first >= c ){
   //q.push( mmp( 1 ,mp( nn.first - c , nn.second-1 ) ) );
  //}
 }
 

 cout<<rest<<endl;
    return 0;
}



Measured memory_bytes: 3208
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits.h>
#include <climits>
#include <map>
#include <unordered_map>
#include <cmath>
#include <set>
#include <unordered_set>
#include <iterator>
#include <deque>
#include <assert.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
ull min(ull x, ull y){ if (x<y) return x; return y;}
ull max(ull x, ull y){ if (x<y) return y; return x;}
ll min(ll x, ll y){ if (x<y) return x; return y;}
ll max(ll x, ll y){ if (x<y) return y; return x;}
double min(double x, double y){ if (x<y) return x; return y;}
double max(double x, double y){ if (x<y) return y; return x;}
ull gcd(ull x, ull y){
    if (!x) return y;
    if (!y) return x;
    if (x>y) swap(x,y);
    return gcd(x, y%x);
}
ull inv(ull a, ull c){ // a,c are coprime and a<c
    if (a==1){
        return 1;
    }
    return ((c-(c/a))*inv(c%a,c))%c;
}


int main(){
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


    int a, b, c;
    cin>>a>>b>>c;
    cout<<c<<" "<<a<<" "<<b<<"\n";

    return 0;
    
}



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

using namespace std;

#define int long long
#define sz(x) (int)x.size()
#define yes cout << "Yes\n"
#define  no cout << "No\n"
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define ft first
#define sd second
#define FOR(i, b, n) for(int i=b;i<n;i++)
#define REP(i, n) FOR(i, 0, n)
using pii = pair<int, int>;
using ld = long double;
using vi = vector<int>;
using vb = vector<bool>;
using vd = vector<double>;
mt19937_64 rnd(time(0));

void start() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(10);
    // cerr << fixed << setprecision(10);
#ifdef MY
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
}

signed main() {
    start();
    int a=0;
    string s, t;
    cin >> s >> t;
    for (int i = 0; i < min(sz(s), sz(t)); ++i){
        a+=s[i]!=t[i];
    }
    cout << a+abs(sz(s)-sz(t));




}








Measured memory_bytes: 3788
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<math.h>

int main() {
	int N;
	std::cin >> N;
	std::vector<double> v(N);
	double numerator = 0;
	double denominator = 0;
	for (int i = 0; i < N; i++) {
		std::cin >> v.at(i);
	}
	std::sort(v.begin(), v.end());
	numerator += v.at(0) + v.at(1);
	denominator = pow(2, N - 1);
	for (int i = 2; i < N; i++) {
		numerator += pow(2, i - 1) * v.at(i);
	}
	std::cout << std::fixed << std::setprecision(5) << numerator / denominator << std::endl;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
//#pragma GCC optimize(2)
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<cstring>
#include<bitset>
#include<stack>
#include<time.h>



#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define ALL(x) x.begin(),x.end()
#define sz(a) ((int)a.size())
#define getmid ((l+r)>>1)
#define mst(var,val) memset(var,val,sizeof(var))
#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define lowbit(x) x&(-x)
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
//#define ls rt<<1
//#define rs rt<<1|1
using namespace std;
#ifdef local
#define dbg(args...) cout << #args << " -> ", err(args);
void err(){ cout << endl; }
template<typename T, typename... Args>
void err(T a, Args... args){ cout << a << ' '; err(args...); }
#else
#define dbg(args...)
#endif // local

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <double, double> pdd;
const int inf=0x3f3f3f3f;
const long long INF=0x3f3f3f3f3f3f3f3fLL;
const double PI=acos(-1.0);
const long double eps=1e-8;
const int mod=1e9+7;
const int maxn=3e5+100;
const int N=2e5+100;
const int M=500+10;
const ll mm=(1LL<<32);

template <class T>
inline void read(T &x)
{
    x = 0;
    char c = getchar();
    bool f = 0;
    for (; !isdigit(c); c = getchar())
        f ^= c == '-';
    for (; isdigit(c); c = getchar())
        x = x * 10 + (c ^ 48);
    x = f ? -x : x;
}

template <class T>
inline void write(T x)
{
    if (x < 0)
    {
        putchar('-');
        x = -x;
    }
    T y = 1;
    int len = 1;
    for (; y <= x / 10; y *= 10)
        ++len;
    for (; len; --len, x %= y, y /= 10)
        putchar(x / y + 48);
}
ll qpow(ll a,ll b,ll mod)
{
    ll ans=1;
    while(b)
    {
        if(b&1)
            ans=(ans*a)%mod;
        b>>=1;
        a=(a*a)%mod;
    }
    return ans;
}


int main()
{
#ifdef local
    freopen("in.txt","r",stdin);
#endif // local
    IOS;//cout.tie(0);
    int n;ll d;
    cin>>n>>d;
    int ans=0;
    rep1(i,n)
    {
        ll x,y;cin>>x>>y;
        if(x*x+y*y<=d*d) ans++;
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();
		sc.close();
		long[] array = {a,b,c};

		if(a%2!=0||b%2!=0||c%2!=0){
			System.out.println(0);
			return;
		}

		if(a==b&&b==c){
			System.out.println(-1);
			return;
		}

		long ans = 1L;

		while(true) {
			long aa = array[0]/2L;
			long bb = array[1]/2L;
			long cc = array[2]/2L;

			array[0]= bb+cc;
			array[1]= aa+cc;
			array[2]= aa+bb;
			if(array[0]%2==0&&array[1]%2==0&&array[2]%2==0) {
				ans++;
			}else {
				System.out.println(ans);
				return;
			}
		}
	}
}

Measured memory_bytes: 35660
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define dump(x) cout << #x << " = " << (x) << endl

using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int n;
    cin >> n;
    vector<vector<int>> G(n);
    vector<P> E_in;

    rep(i, n-1) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
        E_in.push_back({a, b});
    }

    queue<int> q;
    vector<bool> used(n, false);
    vector<int> parent(n, 0);
    int max_color = 0;
    map<P, int> E_num;
    q.push(0);
    used[0] = true;

    while (q.size() != 0) {
        int state = q.front();
        q.pop();

        int color_num = 0;
        for (auto next: G[state]) {
            if (!used[next]) {
                color_num++;
                used[next] = true;
                if (color_num == parent[state]) color_num++;
                E_num[{state, next}] = color_num;
                parent[next] = color_num;
                q.push(next);
            }
        }
        max_color = max(max_color, color_num);
    }

    cout << max_color << endl;
    for (auto i: E_in) {
        cout << E_num[i] << endl;
    }
}

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

int main() {
	int n,a,b,c,d,ans=1000000007;
	cin>>n>>a>>b>>c>>d;
	a--;b--;c--;d--;
	for(int i=1;i<n;i++)ans=min(ans,abs(a/i-b/i)+abs(a%i-b%i)+abs(c/i-d/i)+abs(c%i-d%i));
	cout<<ans<<endl;
	return 0;
}


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

const long mod=1000000007;

int main(){
  int N;cin>>N;
  vector<long> A(N);
  for(int i=0;i<N;i++) cin>>A.at(i);
  long count=0;
  //N*Nから同じもの2乗を引いて2で割りたいけど、modは割り算に向いてない
  //逆から。
  queue<long> G;
  long allm=0;
  
  for(int i=N;i>1;i--){
    allm+=A.at(i-1);
    allm%=mod;
    G.push(allm);
  }
  for(int j=N-1;j>0;j--){
    long F=G.front();
    G.pop();
    F*=A.at(j-1);
    F %=mod;
    count+= F;
    count%=mod;
  }
  cout<<count<<endl;
    
}

Measured memory_bytes: 6356
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const int inf = 1e5;
//typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

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

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
map<ll,ll> ma;
ll solve(ll n){
  ll cnt = 0;
  for(ll i=2 ; i*i<=n ; i++){
    if(n%i==0){
      while(n%i==0){
        ma[i]++;
        n /= i;
        cnt++;
      }
    }
  }
  if(n!=1){
    ma[n]++;
    cnt++;
  }
  return cnt;
}
int main(){
  int n;  cin >> n;
  ll ans = 1;
  rep(i,2,n+1){
    solve(i);
  }
  for(auto ite : ma){
    ans *= (ite.se+1) % mod;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
n = input()
arr_c = [input() for i in range(int(n))]

dic = {}

for elem in arr_c:
  if elem in dic:
    dic[elem] += 1
  else:
    dic[elem] = 1

freq = max(dic.values())

sorted_dic = sorted(dic.items(), key=lambda x: x[0])

for tup in sorted_dic:
  if tup[1] == freq:
    print(tup[0])

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

const double EPS = 1e-10;
const ll INF = 100000000;
const ll MOD = 1000000007;

int n, k;
int a[100000];
vector<int> b[100000];
bool saw[100000];
int ans = 0;
int dist[100000];

void dfs(int v) {
    if(saw[v]) return;
    if(b[v].size() == 0) {
        dist[v] = 0;
        return;
    }
    dist[v] = MOD;
    rep(i,b[v].size()) {
        dfs(b[v][i]);
    }
    rep(i,b[v].size()) {
        dist[v] = min(dist[v], dist[b[v][i]]+1);
    }
}

int main(){
    cin >> n >> k;
    rep(i,n) {
        cin >> a[i];
        a[i]--;
        if(a[i] == -1) continue;
        b[a[i]].push_back(i);
    }
    rep(i,n) {
        if(a[i] == -1) {
            dfs(i);
        }
    }
    rep(i,n) {
        if(dist[i] < k || a[i] == -1) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 12480
#include <iostream>
#include <string>
#include <iomanip>
#include <math.h>
#include <vector>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

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

  long long H_before;
  int count = 0, count_max = 0;
  for (int i = 0; i < N; ++i)
  {
    long long h;
    cin >> h;
   
    if (i == 0)
    {
      H_before = h;
      continue;
    }

    if (H_before >= h) ++count;
    else
    {
      if (count_max < count) count_max = count;
      count = 0;
    }
    H_before = h;
  }
  if (count_max < count) count_max = count;
  cout << count_max << endl;
}

Measured memory_bytes: 256
#ifdef __APPLE__
#include <iostream>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <iomanip>
#include <cmath>
#include <ctgmath>
#include <math.h>
#else
#include <bits/stdc++.h>
#endif

using namespace std;
#define io ios_base::sync_with_stdio(false), cin.tie(NULL)
#define GFOR(i,a,n) for (i=a;i<n;i++)
#define FOR(i,a,n) for (int i=a;i<n;i++)
#define RFOR(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define tc(t) for (int tc=1; tc<=t; tc++)
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<long long int> VLL;
typedef vector<pair<int, int> > VPI;
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<ll, ll> PLL;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll modInverse (ll a) {ll p = mod - 2; return powmod(a, p);}
// head

int main() {
    io;
    ll n;
    VI freq;
    cin >> n;
    for (ll i = 2; i*i <= n; i++) {
        int c = 0;
        while (n%i == 0)
            c++, n/= i;
        if (c)
            freq.pb(c);
    }

    if (n > 1)
        freq.pb(1);

    int ans = 0;
    for (auto x : freq) {
        int sum = 0, i = 0;
        GFOR (i, 1, 400) {
            sum += i;
            if (sum > x)
                break;
        }
        ans += (i-1);
    }
    cout << ans << "\n";
}



Measured memory_bytes: 3668
#include "iostream"
#include "string"
#include "cctype"

int main()
{
	char a;
	std::string str, temp;
	int i = 0, sum = 0;
	int ABC[26] = { 0 };

	while (!std::cin.eof()) {
		getline(std::cin, temp);
		str += temp;
	}
		for (int i = 0; i < str.length(); i++)
			if (isupper(str[i]))
				str[i] = tolower(str[i]);
		for (int i = 0; i < str.length(); i++)
			for (int j = 0; j < 26; j++)
				if (str[i] == 'a' + j)
					ABC[j]++;

	for (int j = 0; j < 26; j++) {
		a = 'a' + j;
		std::cout << a << " : " << ABC[j] << std::endl;
	}

	return 0;
}

Measured memory_bytes: 3168
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int n;

  vector<bool> prime(10005,true);
  for(i=2;i<10005;i++)if(prime[i])
    for(j=2;i*j<10005;j++)
      prime[i*j]=false;
  prime[0]=prime[1]=false;

  while(1){
    cin>>n;
    if(n==0)break;
    for(;n>0;n--)
      if(prime[n]&&prime[n-2]){
        cout<<n-2<<" "<<n<<endl;
        break;
      }
  }
}

Measured memory_bytes: 3048
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int y[100], x[100];

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  int n;
  cin >> n;
  
  vector<pair<double, int>> v;
  for(int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    v.emplace_back(atan2(y[i], x[i]), i);
  }
  

  ll X = 0, Y = 0;
  ll ans = 0;

  auto check = [&]() {
    ans = max(ans, X * X + Y * Y);
  };

  auto now = [&]() {
    return (X * X + Y * Y);
  };

  auto add = [&](int i) {
    X += x[i];
    Y += y[i];
    check();
  };

  auto rem = [&](int i) {
    X -= x[i];
    Y -= y[i];
    check();
  };

  sort(begin(v), end(v));
  add(v.back().second);
  int r = 0;
  for(int i = 0; i < n; i++) {
    int j = (n + i - 1) % n;
    int id = v[i].second;
    rem(v[j].second);
    if(i == r) add(id), (++r) %= n;

    ll z = now();
    while(i != r) {
      int rid = v[r].second;
      add(rid);
      ll z2 = now();
      if(z > z2) {
        rem(rid);
        break;
      } else {
        (++r) %= n;
        z = z2;
      }
    }
  }
  cout << fixed << setprecision(11);
  cout << sqrt(ans) << endl;
  return 0;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

fn n_positional(n: u32, k: u32) -> u32 {
    if n <= k {
        return 1
    }
    let mut cnt = 1;
    let mut ans = n;
    loop {
        ans = ans / k;
        if ans < k {
            break;
        }
        cnt = cnt + 1;
    }
    cnt + 1
}

fn main() {
    input!{n: u32, k: u32,}
    println!("{}", n_positional(n, k));
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
LL read(){
	LL x=0,f=1;
	char ch=getchar();
	while (!isdigit(ch)&&ch!='-')
		ch=getchar();
	if (ch=='-')
		f=0,ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?x:-x;
}
const int N=305;
int n,m;
int a[N][N];
int vis[N];
int p[N];
vector <int> s[N];
int q[N],head,tail;
int check(int x){
	for (int i=1;i<=n;i++)
		p[i]=1;
	for (int i=1;i<=m;i++)
		s[i].clear();
	for (int i=1;i<=n;i++)
		s[a[i][p[i]]].push_back(i);
	memset(vis,0,sizeof vis);
	head=tail=0;
	for (int i=1;i<=m;i++)
		if (x<(int)s[i].size())
			q[++tail]=i,vis[i]=1;
	while (head<tail){
		int v=q[++head];
		for (auto i : s[v]){
			while (p[i]<=m&&vis[a[i][p[i]]])
				p[i]++;
			if (p[i]>m)
				return 0;
			s[a[i][p[i]]].push_back(i);
			if (x<(int)s[a[i][p[i]]].size())
				q[++tail]=a[i][p[i]],vis[a[i][p[i]]]=1;
		}
	}
	return 1;
}
int main(){
	n=read(),m=read();
	for (int i=1;i<=n;i++)
		for (int j=1;j<=m;j++)
			a[i][j]=read();
	for (int i=1;i<=n;i++)
		if (check(i))
			return printf("%d",i),0;
	return 0;
}

Measured memory_bytes: 1280
#C
import heapq

N, K = map(int, input().split())
H = list(map(int, input().split()))
H = list(map(lambda x: x*(-1), H))
heapq.heapify(H)

if K >= N:
    print(0)
else:
    for _ in range(K):
        heapq.heappop(H)
    print(-sum(H))

Measured memory_bytes: 25768
from operator import mul
from functools import reduce
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
N,K=map(int,input().split())
if K%2==0:
    print((N//K)**3+(((N-K//2)//K+1)**3))
else:
    print((N//K)**3)

Measured memory_bytes: 3572