akhauriyash/Code-Regression huggingface dataset:
class Page:
    def __init__(self, name, buttons):
        self.name = name
        self.buttons = buttons


class Button:
    def __init__(self, line):
        self.x1 = int(line[0])
        self.y1 = int(line[1])
        self.x2 = int(line[2])
        self.y2 = int(line[3])
        self.link = line[4]


class Buffer:
    def __init__(self, page):
        self.pointer = 0
        self.length = 0
        self.contents = [page]
        self.pages = {}

    def click(self, x, y):
        page = self.contents[self.pointer]
        for button in page.buttons:
            if button.x1 <= x <= button.x2 and button.y1 <= y <= button.y2:
                link = button.link
                self.contents = self.contents[:self.pointer+1]
                self.contents.append(self.pages[link])
                self.pointer += 1
                self.length = self.pointer

    def back(self):
        self.pointer = max(0, self.pointer - 1)

    def forward(self):
        self.pointer = min(self.length, self.pointer + 1)

    def show(self):
        print(self.contents[self.pointer].name)


def page_detail():
    name, bi = input().split()
    buttons = []
    for _ in range(int(bi)):
        buttons.append(Button(input().split()))
    page = Page(name, buttons)
    return page, name


while True:
    n = int(input())
    if n == 0:
        break
    input()
    pages = {}
    for i in range(n):
        page, name = page_detail()
        pages[name] = page
        if i == 0:
            buffer = Buffer(page)

    buffer.pages = pages

    m = int(input())
    for _ in range(m):
        s = input()
        if s == "show":
            buffer.show()
        elif s == "back":
            buffer.back()
        elif s == "forward":
            buffer.forward()
        else:
            _, x, y = s.split()
            buffer.click(int(x), int(y))




Measured memory_bytes: 5688
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N, K;
    int ans = 0;
    cin >> N >> K;
    vector<int> A(N);
    for(int i = 0; i < N; i++){
        cin >> A.at(i);
    }
    
    vector<int> B(N, 0);
    
    for(int i = 0; i < N; i++){
        B.at(A.at(i)-1)++;
    }
    
    sort(B.begin(), B.end());
    reverse(B.begin(), B.end());
    
    
    for (int  j = K; j < N; j++){
        ans += B.at(j);
    }
    
    cout << ans << endl;
    
}

Measured memory_bytes: 1792
n, k = gets.chomp.split(' ').map{|i| i.to_i }
now = 0
count = 0
visited = Array.new(n, false)
visitTime = Array.new(n, -1)
isEnd = false

a = gets.chomp.split(' ').map{|i| i.to_i - 1 }
while !visited[now]
  visited[now] = true
  visitTime[now] = count
  count += 1
  now = a[now]
  if count == k
    isEnd = true
    break
  end
end

if !isEnd
  prefix = visitTime[now]
  loop_count = count - prefix

  rest = k - prefix
  amari = rest % loop_count

  amari.times{|j|
    now = a[now]
  }
end

puts now + 1



Measured memory_bytes: 31760
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
//#pragma GCC optimize("Ofast")
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
//#define int ll
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define invar(typ, var) typ var; cin >> var;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX / 2;
const ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
const double EPS = 1e-9;

signed main(void) {
  cin.tie(0); ios::sync_with_stdio(false);
  
  int D, N;
  cin >> D >> N;
  
  int s = 1;
  rep(i, D) {
    s *= 100;
  }
  
  if((s * N) % (s * 100) == 0) {
    fin(s * (N + 1));  
  } else {
    fin(s * N);
  }
  
  
}

Measured memory_bytes: 256
N = gets.to_i
words = []
N.times do
  words << gets.chomp
end
for i in 0..N-2
  if words[i][words[i].length-1] != words[i+1][0] then puts "No" ; exit end
  for j in 0...N
    if words[i] == words[j] && i != j then puts "No" ; exit end
  end
end
puts "Yes"


Measured memory_bytes: 1788
#include <iostream>

using namespace std;

int main(void)
{
  int stones_cnt;
  string stones;
  
  cin >> stones_cnt;
  cin >> stones;
  
  int left_white = 0;
  int right_red = stones_cnt - 1;
  int swap_cnt = 0;
  
  while(left_white < right_red){
    if(stones[left_white] == 'W' && stones[right_red] == 'R'){
      swap_cnt += 1;
      left_white += 1;
      right_red -= 1;
    }
    
    while(stones[left_white] != 'W' && left_white < stones_cnt - 1){
      left_white += 1;
    }
    while(stones[right_red] != 'R' && right_red > 0){
      right_red -= 1;
    }
  }
  
  cout << swap_cnt << endl;
  
  return 0;
}

Measured memory_bytes: 3712
/*Whose woods these are I think I know.
His house is in the village though;
He will not see me stopping here
To watch his woods fill up with snow.

My little horse must think it queer
To stop without a farmhouse near
Between the woods and frozen lake
The darkest evening of the year.

He gives his harness bells a shake
To ask if there is some mistake.
The only other sound’s the sweep
Of easy wind and downy flake.

The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/

#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007
const int maxn= 100010;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout<<setprecision(30);
    cout<<fixed;
    int a=0,b=0,h=0,m=0;
    cin>>a>>b>>h>>m;
    double pi=atan(1)*4;
    	double ah=0.5*(h*60+m);
    	double am=6*m;
    	double theta=abs(ah-am);
    	if(theta>180.0)
    		theta=360.0-theta;
    	cout<<sqrt((double)a*a+(double)b*b-(double)2*a*b*cos((theta*pi)/(double)180));
    cout<<endl;
}

Measured memory_bytes: 4208
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define PB push_back
#define MP make_pair
#define all(x) x.begin(),x.end()

int N, C[20], V[20];
int main(){
	cin >> N;
	for(int i=0; i<N; i++) cin >> V[i];
	for(int i=0; i<N; i++) cin >> C[i];
	int ans = 0;
	for(int i=0; i<N; i++){
		if(V[i]-C[i] > 0) ans += V[i]-C[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
//09
#include<iostream>
#include<algorithm>
#include<map>

using namespace std;

int main(){
  for(int n;cin>>n,n;){
    map<int,int> m;
    for(int i=0;i<n;i++){
      int s;
      cin>>s;
      m[s]++;
    }
    map<int,int>::iterator it;
    for(it=m.begin();it!=m.end();it++){
      if(it->second>n/2){
	cout<<it->first<<endl;
	break;
      }
    }
    if(it==m.end()){
      cout<<"NO COLOR"<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 2732
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(long long i = 0; i < (long long)(N); i++)
#define repr(i,N) for(long long i = (long long)(N) - 1; i >= 0; i--)
#define rep1(i,N) for(long long i = 1; i <= (long long)(N) ; i++)
#define repr1(i,N) for(long long i = (N) ; (long long)(i) > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; template<class T = ll> using V = vector<T>;
using vi = V<int>; using vl = V<>; using vvi = V< V<int> >;
constexpr int inf = 1001001001; constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);} while(0)
  #define trcc(v) do { cerr << "name : " << #v << "\n"; int cnt = 0; each(x , v){cerr << (cnt++) << " : "; trc(x); } } while(0)
#else
  #define trc(...)
  #define trca(...)
  #define trcc(...)
  int main(){solve();}
#endif

#define inc(...) char __VA_ARGS__; in(__VA_ARGS__)
#define in2(s,t)   rep(i,sz(s)){in(s[i] , t[i]);}
#define in3(s,t,u) rep(i,sz(s)){in(s[i] , t[i] , u[i]);}
using vd = V<double>; using vs = V<string>; using vvl = V< V<> >;
template<typename T,typename U>ll ceil(T a,U b){return (a + b - 1) / b;}

using P = pair<ll,ll>; using vp = V<P>;
constexpr int MOD = /**/ 1000000007; //*/ 998244353;
//////////////////

void solve(){
  ini(N);
  rep(i , N){
    inl(a);
    if(a % 2 == 0 && a % 3 != 0 && a % 5 != 0){
      die("DENIED");
    }
  }
  out("APPROVED");
}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	int n;
	cin >> n;
	bool all_same=true;
	ll s=0, m=LLONG_MAX;
	for(int i=0; i<n; i++){
		ll a, b;
		cin >> a >> b;
		if(a!=b) all_same=false;
		s+=a;
		if(a>b) m=min(m, b);
	}

	if(all_same) cout << 0 << endl;
	else cout << s-m << endl;
	return 0;
}

Measured memory_bytes: 256
S = input()
N = len(S)
l, r, flg = 0, N-1, 1
while l < r:
    if S[l] != S[r]:
        flg = 0
        break
    l += 1
    r -= 1
if flg == 0:
    print("No")
    exit()
l, r = 0, (N-1)//2-1
while l < r:
    if S[l] != S[r]:
        flg = 0
        break
    l += 1
    r -= 1
if flg == 0:
    print("No")
    exit()
l, r = (N+3)//2-1, N-1
while l < r:
    if S[l] != S[r]:
        flg = 0
        break
    l += 1
    r -= 1
if flg == 0:
    print("No")
else:
    print("Yes")


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

#ifdef NON_SUBMIT
#define TEST(n) (n)
#define tout cerr
#else
#define TEST(n) ((void)0)
#define tout cin
#endif

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt","r",stdin));
	TEST(freopen("output.txt","w",stdout));
	TEST(freopen("debug.txt","w",stderr));
	int H, A;
	cin>>H>>A;
	cout<<(H+A-1)/A<<'\n';
	return 0;
}

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

using namespace std;

#define F first
#define S second
#define modulo ll (1e9 + 7)

typedef long long ll;
typedef pair<int,int> pii;

void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}

const int N = 2e5 + 9, M = 1e6, OO = 0x3f3f3f3f;
const ll llOO = 0x3f3f3f3f3f3f3f3f;



ll power(ll b, ll p){
    if(p == 0)return 1;
    ll res = power(b,p/2);
    res *= res;
    res %= modulo;
    if(p & 1)res *= b;
    return res % modulo;
}

int main(){
    init();

    int n;  cin >> n;
    int fr[n] = {0};
    for(int i = 0;i < n;i++){
        int a;  cin >> a;
        fr[a]++;
    }

    for(int i = n - 1;i >= 0;i -= 2)
        if((i == 0 && fr[i] != 1) || i != 0 && (fr[i] != 2))
                return cout << 0, 0;

    cout << power(2, n / 2);
}

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

typedef long long ll;
const ll InF = 1e15;

int solve (int a, int k) {
    int n = 1;
    int m = k - 1;
    int ret = m * n + 1;
    while (ret < a) {
        n++;
        ret = m * n + 1;
    }
    return n;
}

int main() {
    int n,k;
    cin>>n>>k;
    for (int i = 0; i < n; i++) {
        int a;
        cin>>a;
    }
    int ans = solve(n,k);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int y = sc.nextInt();
    int total = 0;
    for(int i = 0;i<=n;i++){
      for(int j = 0;j<=n-i;j++){
        for(int k = 0;k<=n-i-j;k++){
          total = 10000 * i + 5000 * j + 1000 * k;
          if(total == y && n == i + j + k){
            System.out.println(i + " " + j + " " + k);
            return;
          }
        }
      }
    }
    System.out.println("-1 -1 -1");
  }
}


Measured memory_bytes: 23892
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char f[7];int ans=0;
int main()
{
	scanf("%s",f);
	if(f[0]=='1')ans++;
	if(f[1]=='1')ans++;
	if(f[2]=='1')ans++;
	if(f[3]=='1')ans++;
	if(f[4]=='1')ans++;
	if(f[5]=='1')ans++;cout<<ans;
	return 0;
 } 

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>
#include <random>
using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef map<int, int> mii;
typedef map<string, int> msi;
typedef map<int, string> mis;
typedef pair<int, ii> edge;


#define sc(x)  scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mem(arr,val) memset(arr,val,sizeof arr)
#define sz(v) (int)v.size()
#define rsz(v) v.resize
#define clr(v) v.clear()
#define rev(v) reverse(all(v))
#define lop(i,end) for(int i=0; i<end; i++)
#define rlop(i,start) for(int i=start-1; i>=0; i--)
#define loop(i,start,end) for(int i=start; i<end; i++)
#define rloop(i,start,end) for(int i=start-1; i>=end; i--)
#define PB push_back
#define pb pop_back
#define mP make_pair
#define f first
#define s second

const ll OO = (ll)(4e18) + 9;
const int MOD = (int)(1e9) + 7;
const int oo = 2147483647;
const double EPS = 1e-8;
const double PI = acos(-1.0);

//enum dir { d, r, u, l , dr, ur, dl, ul };
int dx[] = { 1, 0, -1, 0, 1, -1, 1, -1 };
int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

string abc = "abcdefghijklmnopqrstuvwxyz";
string vowels = "aeiouy"; //and sometimes "aeiouy"

template<typename X, typename Y> bool ckmin(X& a, Y b) { return a > b ? a = b, true : false; }
template<typename X, typename Y> bool ckmax(X& a, Y b) { return a < b ? a = b, true : false; }

int dcmp(ld d1, ld d2) { return fabs(d1 - d2) <= EPS ? 0 : d1 > d2 ? 1 : -1; } //Compare Double Numbers
ll gcd(ll x, ll y) { return !y ? x : gcd(y, x%y); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
//convert index from 2D array to 1D array. (Zero-indexed)
int conv_2_1(int r, int c, int nCol) { return (nCol*r) + c + 1; }
//convert index from 1D array to 2D array. (Zero-indexed)
ii conv_1_2(int n, int nCol) {
	int r = n / nCol, c = n % nCol;
	return ii(r, c);
}

void inter(string s) {
	cout << s << endl;
	fflush(stdout);
}


ll power(ll base, ll exp) {
	ll ans = 1;
	base %= MOD;
	while (exp > 0) {
		if (exp & 1) ans = (ans * base) % MOD;
		exp >>= 1;
		base = (base * base) % MOD;
	}
	return ans;
}

const int NN = 2e6 + 10;
ll fact[NN];

void init() {
	fact[0] = 1;
	for (int i = 1; i < NN; ++i) fact[i] = (fact[i - 1] * 1LL * i) % MOD;
}

ll nCr(ll n, ll r) {
	auto modInverse = [](ll a) { 
		return power(a, MOD - 2); 
	};
	return (fact[n] * modInverse(fact[r] * 1LL * fact[n - r])) % MOD;
}



int main()
{
#ifndef ONLINE_JUDGE

#else
	//freopen("pyramid.in", "r", stdin);
#endif
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, zz = 0;
	cin >> n;
	vll v(n);
	ll sum = 1, N = 1e18;
	lop(i, n) cin >> v[i], zz += not v[i];
	if (zz) return cout << 0 << endl, 0;
	lop(i, n) {
		if (v[i] <= N / sum) sum *= v[i];
		else return cout<<-1<<endl, 0;
	}
	cout << sum << endl;
	



	return 0;
}


Measured memory_bytes: 3936
#include<iostream>
#include<stdio.h>
#include<vector>

using namespace std;
const int MAX = 2 * 100000 + 10;
int A[MAX] = {0};
int minv[MAX] = {MAX};

int main(){
    int N;
    scanf("%d",&N);
    int ans = 1;
    int a = 0;
    cin >> A[0];
    minv[0] = A[0];
    for (int i = 1; i < N; i++)
    {
        scanf("%d",&A[i]);
        minv[i] = min(minv[i - 1], A[i]);
        if(minv[i]>=A[i])
        {
            ans++;
        }
    }
    printf("%d", ans);
    return 0;
}

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

int main() {
    // input
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }

    // solve
    int ans = 0;
    bool flag = true;
    while (flag) {
        for (int i = 0; i < A.size(); ++i) {
            if (A[i] % 2 != 0) flag = false;
        }
        for (int i = 0; i < A.size(); ++i) {
            A[i] = A[i] / 2;
        }
        if (flag) ans++;
    }

    // output
    cout << ans << endl;

    return 0;
}


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

struct query
{
    int c;
    int s;
    int f;
};

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

    int n = 0;
    cin >> n;

    int i = 0;
    int c = 0;
    int s = 0;
    int f = 0;
    array<query, 500> queries = {};

    while (i < n - 1 && cin >> c >> s >> f)
    {
        queries[i] = {c, s, f};
        ++i;
    }

    long long sum = 0;
    for (int j = 0; j < n - 1; ++j)
    {
        sum = queries[j].s + queries[j].c;
        for (int k = j + 1; k < n - 1; ++k)
        {
            if (queries[k].s >= sum)
            {
                sum = queries[k].s;
            }
            else if ((sum - queries[k].s) % queries[k].f > 0)
            {
                sum += queries[k].f - ((sum - queries[k].s) % queries[k].f);
            }
            sum += queries[k].c;
        }
        cout << sum << endl;
    }

    cout << '0' << endl;

    return 0;
}


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

using namespace std;
#define int long long
int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n,a,b;
    cin>>n>>a>>b;
    if(a%2==b%2)
    {
        cout<<(b-a)/2;
        return 0;
    }
    else
    {
        if(b<=a)
        {
            swap(a,b);
        }
        cout<<min(a+(b-1-a)/2,(n+1-b)+((n+1-a)-1-(n+1-b))/2);
        return 0;
    }
    return 0;
}


Measured memory_bytes: 256
import numpy as np

n,m = map(int, input().split())
h_list = list(map(int, input().split()))

map_ = {str(i):[] for i in range(n)}

for _ in range(m):
  a, b = map(int, input().split())
  map_[str(a-1)].append(b-1)
  map_[str(b-1)].append(a-1)
  
cnt=0
for i in range(n):
  tmp = [h_list[i]] + [h_list[j] for j in map_[str(i)]]
  hiest = max(tmp)
  if tmp.count(hiest)==1:
    if tmp.index(max(tmp))==0:
      cnt+=1
print(cnt)
  

Measured memory_bytes: 59468
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#define mod 1000000007
#define inf 0x3f3f3f3f
#define lowb(x) (x & (-x))
#define lson (id << 1)
#define rson (id << 1 | 1)
#define maxm 
#define maxn 100010
int a[maxn], b[maxn];
int main()
{
	int n, x;
	
	scanf("%d", &n);
	map<int, int> mp;
	int cc = 1;
	for (int i = 0; i < n; i++) {
		scanf("%d", &x);
		if (mp[x] == 0) {
			mp[x] = cc++;
			b[mp[x]] = x;
		}
		a[mp[x]]++;
	}
	int ans = 0;
	for (int i = 1; i < cc; i++) {
		if (a[i] >= b[i]) {
			ans += a[i] - b[i];
		} else {
			ans += a[i];
		}
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define rfor(i,a,b) for(ll (i) = (a); (i) > (b); --(i))
#define ll long long
#define mod (1000000007)
#define pf(x) cout << (x) << endl;
#define all(x) (x).begin(),(x).end()

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

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll factorial(ll n){
    ll t = 1;
    rep1(i, n)t *= i;
    return t;
}

ll combinations(ll n, ll k) {
    ll r = 1;
    rep1(i, k)r = r * n-- / i;
    return r;
}

int main()
{
    vector<bool> check(1e6 + 1,true);
    check[0] = false;check[1] = false;
    nfor(i, 2, 1e6)if(check[i])for (ll j = 2; j * i <= 1e6; ++j)check[i * j] = false;
    ll x;
    cin >> x;
    nfor(i, x, 1e6)if(check[i]){pf(i);break;}
    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>

int main(){
  int n,i,temp,cnt=0;
  int a[100];
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&a[i]);

  int flag=1;
  while(flag){
    flag=0;
    for(i=n-1;i>0;i--){
      if(a[i]<a[i-1]){
	temp=a[i];
	a[i]=a[i-1];
	a[i-1]=temp;
	flag=1;
	cnt++;
      }
    }
  }
  for(i=0;i<n;i++){
    if(i==n-1)printf("%d\n",a[i]);
    else printf("%d ",a[i]);
  }
  printf("%d\n",cnt);
  return 0;
}
	
    



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

using namespace std;
#define ll long long

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

    int n,m,k;
    cin>>n>>m>>k;

    int rows = pow(2,n);
    int cols = pow(2,m);

    vector<string> mat(n);

    for(int i=0;i<n;i++)
        cin>>mat[i];
    
    int count = 0;
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
            if(mat[i][j] == '#')
                count++;

    int res = 0;
    for(int r = 0; r < rows; r++)
        for(int c = 0 ; c < cols; c++)
        {
            int psum = 0;
            vector<bool> r_cnt(n,false);
            vector<bool> c_cnt(m,false);

            int p = r, i=0;

            while(i <n)
            {
                r_cnt[i++] = ((p%2) == 0) ? false: true;
                p = p/2;
            }
            p = c;
            i=0;

            while(i<m){
                c_cnt[i++] = ((p%2) == 0) ? false: true;
                p = p/2;
            }

            for(int i=0;i<n;i++)
                for(int j = 0;j<m;j++)
                {
                    if((r_cnt[i] || c_cnt[j]) && (mat[i][j] == '#'))
                        psum++;
                }

            if((count - psum) == k)
            {
                //cout<<r<<" "<<c<<endl;
                res++;
            }
        }

    cout<<res<<endl;

    return 0;
}


Measured memory_bytes: 4060
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
    int n,i;
    long long c,a,b;
    cin>>n;
    a=2;
    b=1;
    if(n>=2){
        for(i=1;i<n;i++){
            c=a+b;
            a=b;
            b=c;
        }
        cout<<c<<endl;
    }
    else{
        cout<<1<<endl;
    }
    return 0;

}

Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
    var N = input[0].split(" ")[0]-0;
    var M = input[0].split(" ")[1]-0;
    var list = input.filter((v,i)=>i>0).map(v=>v.split(" ").map(v=>v-0));
    var ans = -1;
    start:for(var i=0;i<=999;i++){
        var str = i.toString();
        if(str.length != N) continue;
        for(var j=0;j<M;j++){
            var s = list[j][0];
            var c = list[j][1];
            if(str[s-1] != c) continue start;
        }
        ans = i;
        break;
    }
    console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n"));

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

using namespace std;

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

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const int INF=1e9;
const int MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbgmap(mp) for (auto i = mp.begin(); i != mp.end(); ++i) { cout << i->first <<":"<<i->second << endl;}
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

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


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

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

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

//O(√N)
vector<ll> divisor(ll n) {
    vector<ll> ret;
    for(ll i = 1; i * i <= n; i++) {
        if(n % i == 0) {
            ret.push_back(i);
            if(i * i != n) ret.push_back(n / i);
        }
    }
    sort(begin(ret), end(ret));
    return (ret);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll ans = n-1;

    vector<ll> div = divisor(n);
    for (ll i = 1; i < (div.size()+1)/2; i++) {
        chmin(ans,div[i]+div[div.size()-1-i]-2);
    }

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


Measured memory_bytes: 384
#include <stdio.h>

int max(int a, int b);

int main(void)
{
	int n;
	int i;
	int max_score;
	int num, score;
	int scores[21];

	scanf("%d", &n);
	for (i = 0; i < n; i++){
		scanf("%d %d", &num, &score);
		scores[num] = score;
		max_score = max(max_score, score);
	}

	for (i = 1; i <= n; i++){
		if (scores[i] == max_score){
			printf("%d %d\n", i, max_score);
			break;
		}
	}

	return (0);
}

int max(int a, int b)
{
	if (a >= b){
		return (a);
	}
	else {
		return (b);
	}
}

Measured memory_bytes: 600
n,x=map(int,input().split())
a=[1]#層の数 a[n]はレベルnのときの層の数
p=[1]#パテの数　p[n]はレベルnのときのパテの数
for i in range(n):
    a.append(2*a[-1]+3)
    p.append(a[-1]//2 +1)
#print(a,p)
def f(n,x):
    #print(n,x)
    if n==0:
        if x>=1:
            return 1
        else:
            return 0
    elif x==1:
        return 0
    elif x==a[n]:#レベルn全部取る場合
        return p[n]
    elif x==a[n-1]+2:#レベルnの真ん中まで取る場合
        return p[n-1]+1
    elif 1<x<a[n-1]+2:
        return f(n-1,x-1)#再帰関数。行列の2番目～真ん中の1個手前まで、つまりレベルn-1バーガーに移行。レベルnバーガーの最初は飛ばすので、xも-1する。
    else:
        return p[n-1]+1+f(n-1,x-a[n-1]-2)#再帰関数。行列真ん中の次～ラストの手前まで
print(f(n,x))

Measured memory_bytes: 9020
n, m = list(map(int, input().split(' ')))
aaa = [0] * (n + 3)
for i in range(m):
    aaa[int(input())] = True

dp = [1] * (n + 3)
for i in range(1, n+1):  # 1e5
    if not aaa[i]:
        dp[i]  = dp[i-1]
        if i >= 2:
            dp[i] += dp[i-2]
        dp[i] = dp[i] % int(1e9 + 7)
    else:
        dp[i] = 0
print(dp[n])

Measured memory_bytes: 7668
char buf[250000];sz;
char out[50505];outsz;
char tmp[10];tmpsz;
int d[5000];
long S[5001];
main()
{
	read(0,buf,250000);
	int k=0,q=0;
	for(;;)
	{
		char c=buf[sz++];
		if(c<'0')break;
		k=k*10+c-'0';
	}
	for(;;)
	{
		char c=buf[sz++];
		if(c<'0')break;
		q=q*10+c-'0';
	}
	for(int i=0;i<k;i++)
	{
		int D=0;
		for(;;)
		{
			char c=buf[sz++];
			if(c<'0')break;
			D=D*10+c-'0';
		}
		d[i]=D;
	}
	for(;q--;)
	{
		int N=0,X=0,M=0;
		for(;;)
		{
			char c=buf[sz++];
			if(c<'0')break;
			N=N*10+c-'0';
		}
		for(;;)
		{
			char c=buf[sz++];
			if(c<'0')break;
			X=X*10+c-'0';
		}
		for(;;)
		{
			char c=buf[sz++];
			if(c<'0')break;
			M=M*10+c-'0';
		}
		S[0]=0;
		for(int i=0;i<k;i++)S[i+1]=S[i]+(d[i]%M?:M);
		int ans=N-1-((N-1)/k*S[k]+S[(N-1)%k]+X%M)/M;
		tmpsz=10;
		do{
			tmp[--tmpsz]=ans%10+'0';
		}while(ans/=10);
		for(;tmpsz<10;)out[outsz++]=tmp[tmpsz++];
		out[outsz++]='\n';
	}
	write(1,out,outsz);
}

Measured memory_bytes: 512
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 1e9+7;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int R,G;cin>>R>>G;
  cout << 2*G-R<<endl;
  return 0;
}


Measured memory_bytes: 256
W = raw_input().lower()
s = []
while True:
    T = map(str, raw_input().split())
    if(T[0] == "END_OF_TEXT"):
        break
    else:
        for i in range(len(T)):
            s.append(T[i].lower())
ans = 0
for i in range(len(s)):
    if(s[i] == W):
        ans += 1
print(ans)

Measured memory_bytes: 4220
N,M = [int(x) for x in input().split()]

t = [0 for i in range(M)]

for i in range(N):
    A = [int(x) for x in input().split()]
    K = A[0]
    for j in range(1,K+1):
        t[A[j]-1] += 1

ans = 0
for a in t:
    if a == N:
        ans += 1

print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a),i##_end=(b);i<=i##_end;i++)
#define per(i,b,a) for(int i=(b),i##_st=(a);i>=i##_st;i--)
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define debug(x) cerr<<#x" = "<<x<<endl
#define Debug(...) fprintf(stderr, __VA_ARGS__)
#define Es(x,i) for(Edge *i=G[x];i;i=i->nex)
typedef pair<int,int> pii;
typedef long long ll;
const int inf=~0u>>1,MOD=1e9+7;/*
char *TT,*mo,but[(1<<15)+2];
#define getchar() ((TT==mo&&(mo=(TT=but)+fread(but,1,1<<15,stdin),TT==mo))?-1:*TT++)//*/
inline int rd() {
	int x=0,c=0,f=1;
	for(; c<'0'||c>'9'; c=getchar())f=c!='-';
	for(; c>='0'&&c<='9'; c=getchar())x=x*10+c-'0';
	return f?x:-x;
}
const int N=1e5+11;

bool mark[N];
int n,A[N];

int main(){
	n=rd();
	int mx=-inf,mi=inf;
	rep(i,1,n){
		A[i]=rd();
		mx=max(mx,A[i]);
		mi=min(mi,A[i]);
	}
	if(mx>mi+1){
		puts("No");
		return 0;
	}
	else if(mx==mi){
		puts((mx==n-1||mx*2<=n)?"Yes":"No");
		return 0;
	}
	
	int t1=0,t2=0;
	rep(i,1,n)if(mx==A[i])t2++;else t1++;
	if(mx>=t1+1&&mx<=t1+t2/2)puts("Yes");
	else puts("No");
}

Measured memory_bytes: 640
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	static void solve(){//Here is the main function
		for(int i = 0; i < 10000; i++){
			myout(-1);
		}
	}
	//Method addition frame start



	//Method addition frame end

	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
}


Measured memory_bytes: 37888
#include "iostream"
using namespace std;

int main()
{
	int N, X, m[1000],a;
	cin >> N;
	cin >> X;
	a = 0;
	for (int i = 0; i < N; i++) {
		cin >> m[i];
		X -= m[i];
		if (a == 0)a = m[0];
		if (a > m[i])a = m[i];
	}

	cout << N + X / a << endl;
	
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <functional>
#include <algorithm>
using namespace std;
int main(){
    int N, M;
    int a[1000];
    int sum = 0;
    cin >> N >> M;
    for(int i=0; i<N; i++)cin >> a[i];
    for(int i=0; i<N; i++)sum += a[i];
    double c = 1.0 / (4*M);
    sort(a, a+N, greater<int>());
    if(sum*c > a[M-1]){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int n; cin >> n;
	vector<ll> a(n), b(n), c(n);
	rep(i, 0, n - 1)cin >> a[i];
	rep(i, 0, n - 1)cin >> b[i];
	rep(i, 0, n - 1)cin >> c[i];
	sort(all(a));
	sort(all(c));
	ll res = 0;
	for (ll x : b)
	{
		ll u = lower_bound(all(a), x) - a.begin();
		ll l = c.end() - upper_bound(all(c), x);
		res += u * l;
	}
	cout << res << endl;
}

Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
#include<complex>
using namespace std;
int main(){
	long long ans;
	int n;
	while(cin>>n){
		ans=0;
		for(int i=0;i<=n;i++){
			if(i<=2000&&n-i<=2000){
			int s1,s2;
			s1=1001-abs(1000-i);
			s2=1001-abs(1000-n+i);
			ans+=s1*s2;
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

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


int main(){
    int a, b, c, d, e, k;
    cin>> a>> b>> c>> d>> e>> k;

    if((e-a) > k){
        cout << ":(" << endl;
    }else{
        cout << "Yay!" << endl;
    }

    return 0;
}


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9

using namespace std;
typedef long long int lli;
typedef long long ll;

int main() {
    int a,b,c,d;
    cin >> a >> b >> c >> d;

    int ans = (a<b ? a:b) + (c<d ? c:d);
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main (String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		String [] a = new String [n];
		String [] b = new String [m];
		for (int i = 0 ; i < n ; i++)  a [i] = scanner.next();
		for (int i = 0 ; i < m ; i++)  b [i] = scanner.next();
		
		for (int i = 0 ; i < n - m +1 ; i++) {
			 for (int j = 0 ; j < n - m +1 ; j++){
			 	int count = 0 ;
			 	for (int k = 0 ; k < m ; k++) {
			 		for (int l = 0 ; l < m ; l++){
			 			if (a[k + j].charAt(l + i) == b[k].charAt(l)){
			 				count++;
			 			}
			 		}
			 	}
			 	if (m * m == count) {
			 		System.out.println("Yes");
			 		return;
			 	}
			 }
		}
		System.out.println("No");
	}
} 

Measured memory_bytes: 21972
#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#undef min
#undef max
#else
#define NDEBUG
#include <bits/stdc++.h>
#endif

using namespace std;
using large = long long;
constexpr auto mod = 1'000'000'007;

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

    auto p = vector<int>(N);

    //       i   j   k
    static large dp[64][64][2600] = {};
    dp[0][0][0] = 1;

    for (auto i = 0; i < N; ++i) {
        for (auto j = 0; j <= i; ++j) {
            for (auto k = 0; k <= K; ++k) {

                // AiとAjをつなぐ
                {
                    int nj = j;
                    dp[i + 1][nj][k + 2 * nj] += dp[i][j][k];
                    dp[i + 1][nj][k + 2 * nj] %= mod;
                }

                // AiとAjを保留する
                {
                    int nj = j + 1;
                    dp[i + 1][nj][k + 2 * nj] += dp[i][j][k];
                    dp[i + 1][nj][k + 2 * nj] %= mod;
                }

                // Aiと保留されていたぶんをつなぐ
                {
                    int nj = j;
                    int cases = 2 * j % mod;
                    dp[i + 1][nj][k + 2 * nj] += dp[i][j][k] * cases % mod;
                    dp[i + 1][nj][k + 2 * nj] %= mod;
                }

                // 両方つなぐ
                if (j >= 1) {
                    int nj = j - 1;
                    int cases = j * j % mod;
                    dp[i + 1][nj][k + 2 * nj] += dp[i][j][k] * cases % mod;
                    dp[i + 1][nj][k + 2 * nj] %= mod;
                }
            }
        }
    }

    cout << dp[N][0][K] << endl;
    return 0;
}


Measured memory_bytes: 30620
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll INF=1e18;

int main()
{
    string s;
    cin >> s;
    ll n=s.length();
    bool ok=true;
    if(s[0]!='A') ok=false;
    ll cnt1=0;
    for(ll i=2;i<=n-2;i++){
        if(s[i]=='C') cnt1++;
    }
    ll cnt2=0;
    rep(i,n){
        if((ll)(s[i]-'A')<=30) cnt2++;
    }
    if(ok && cnt1==1 && cnt2==2) cout << "AC" << endl;
    else cout << "WA" << endl;
    return 0;
} 

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

int main() {
	string S;
	int COUNT = 0;
	cin >> S;
	int C[26] = {};
	for (int i = 0; i < 4; i++) C[S[i] - 'A']++;
	for (int i = 0; i < 26; i++) if (C[i] == 2) COUNT++;
	if (COUNT == 2) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 764
#include <iostream>
#define mod 1000000007
using namespace std;
const long long int INF=1e18L;
int n;
long long int dp[401][401],a[401],prefix[401];
int main() {
	scanf("%d",&n);
	for(int i=0;i<n;i+=1){
	    scanf("%lld",&a[i]);
	    prefix[i]=prefix[i-1]+a[i];
	}
	for(int i=0;i<n;i+=1){
	    for(int j=0;j+i<n;j+=1){
	        //dp[j][j+i];
	        if(j==(i+j)){
	            dp[j][i+j]=0;
	            continue;
	        }
	        long long int sum=prefix[i+j];
	        if(j!=0){
	            sum-=prefix[j-1];
	        }
	        dp[j][j+i]=INF;
	        for(int k=j;k<i+j;k+=1){
	            dp[j][j+i]=min(dp[j][j+i],dp[j][k]+dp[k+1][j+i]+sum);
	        }
	    }
	}
	printf("%lld",dp[0][n-1]);
	return 0;
}


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

int n;
int h, m;
int main() {
  while (cin >> n) {
	for (int CA = 0; CA < n; ++CA) {
	  scanf("%d:%d", &h, &m);
	  int degh = 300*h+5*m;
	  int degm = 60*m;
	  int deg = min(abs(degh-degm), 3600-abs(degh-degm));
	  if (deg < 300) puts("alert");
	  else if (deg >= 900) puts("safe");
	  else puts("warning");
	}
  }
}
			 



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

int main(void){
	int a,b,c,ans;
	ans = 0;
	cin >> a >> b >> c;
	for (int i = a; i <= b; i++){
		if(c % i == 0)ans++;
	}
	cout << ans << "\n";
	return 0;

}


Measured memory_bytes: 3096
A, B, C, D = map(int, input().split())

d1 = A // D + 1
if A % D == 0:
  d1 -= 1

d2 = C // B + 1
if C % B == 0:
  d2 -= 1

  
if d1 >= d2:
  print ("Yes")
else:
  print ("No")

Measured memory_bytes: 61816
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
using namespace std;

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

ll nCr[60][60];
void initPascal() {
  nCr[0][0] = 1;
  for(int i=0; i<55; i++) {
    for(int j=0; j<=i; j++) {
      nCr[i+1][j] += nCr[i][j];
      nCr[i+1][j+1] += nCr[i][j];
    }
  }
}

int main() {
  initPascal();
  ll N, P;
  cin >> N >> P;
  vector<int> A(N);
  rep(i, N) cin >> A[i];
  int parity[2] = {};
  rep(i, N) parity[A[i]%2]++;
  ll ans = 0;
  for(int i=P; i<=parity[1]; i+=2) {
    for(int j=0; j<=parity[0]; j++) {
      ans += nCr[parity[1]][i]*nCr[parity[0]][j];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
using namespace std;

struct Info{

	Info(){
		left = right = 'X';
		index = 0;
	}

	Info(char arg_left,char arg_right,int arg_index){
		left = arg_left;
		right = arg_right;
		index = arg_index;
	}
	char left,right;
	int index;
};

bool check[10000];
vector<Info> V[26];

void dfs(char left){
	for(int i = 0; i < V[left - 'a'].size(); i++){
		if(check[V[left - 'a'][i].index] == false){
			check[V[left - 'a'][i].index] = true;
			dfs(V[left - 'a'][i].right);
		}
	}
}

int main(){

	int N,num_left[26],num_right[26];

	bool FLG;

	char buf[33],last,final_start;

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		FLG = true;

		for(int i = 0; i < 26; i++){
			V[i].clear();
			num_left[i] = 0;
			num_right[i] = 0;
		}
		for(int i = 0; i < N; i++)check[i] = false;

		for(int i = 0; i < N; i++){
			scanf("%s",buf);
			num_left[buf[0] - 'a']++;
			for(int k = 0; buf[k] != '\0'; k++)last = buf[k];
			num_right[last - 'a']++;
			V[buf[0]-'a'].push_back(Info(buf[0],last,i));
			final_start = buf[0];
		}

		for(int i = 0; i < 26; i++){
			if(num_left[i] != num_right[i]){
				printf("NG\n");
				FLG = false;
				break;
			}
		}

		if(!FLG)continue;

		check[V[final_start - 'a'][0].index] = true;
		dfs(V[final_start - 'a'][0].right);

		for(int i = 0; i < N; i++){
			if(check[i] == false){
				printf("NG\n");
				FLG = false;
				break;
			}
		}

		if(!FLG)continue;

		printf("OK\n");

	}

    return 0;
}

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

const int Mod = 1e9 + 7;
const int N = 9e5 + 10;

int n, m, k;
long long fac[N], vfac[N];

long long mpow( long long a, int b ) {
	long long rt;
	for( rt = 1; b; b >>= 1, a = (a * a) % Mod )
		if( b & 1 ) rt = (rt * a) % Mod;
	return rt;
}
void init( int n ) {
	fac[0] = 1;
	for( int i = 1; i <= n; i++ )
		fac[i] = (fac[i-1] * i) % Mod;
	vfac[n]  = mpow( fac[n], Mod - 2 );
	for( int i = n - 1; i >= 0; i-- )
		vfac[i] = vfac[i+1] * (i + 1) % Mod;
}
long long comb( int n, int m ) {
	return fac[n] * vfac[n-m] % Mod * vfac[m] % Mod;
}
int main() {
	scanf( "%d%d%d", &n, &m, &k );
	if( m < k )
	   	swap( m, k );
	init( m + k + n );
	long long sum = 0;
	long long ans = 0;
	for( int s = 0; s <= m + k; s++ ) {
		if( s == 0 ) 
			sum = 1;
		else if( s <= k ) 
			sum = (sum<<1) % Mod;
		else if( s <= m ) 
			sum = ((sum<<1) + Mod - comb(s-1,s-k-1)) % Mod;
		else 
			sum = ((sum<<1) + Mod - comb(s-1,s-k-1) + Mod - comb(s-1,m)) % Mod;
		long long sub = sum * comb(n-1+s,n-1) % Mod * mpow(3,m+k-s) % Mod;
		ans = (ans + sub) % Mod;
	}
	cout << ans << endl;
}



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

public class Main {

    public static void main(String[] args) {
        try {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] strArray = br.readLine().split("\\s");
        Integer[] intArray = new Integer[2];
        for (int i = 0; i < strArray.length; i++) {
            intArray[i] = Integer.valueOf(strArray[i]);
        }
        switch (intArray[0].compareTo(intArray[1])) {
            case 1:
                System.out.println("a > b");
                break;
            case -1:
                System.out.println("a < b");
                break;
            case 0:
                System.out.println("a == b");
                break;
        }
        
                } catch(IOException e) {
            System.err.println(e);
        }

    }
}

Measured memory_bytes: 17088
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

public static class P
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        for (int i = 360; true; i += 360)
        {
            if (i % n == 0)
            {
                Console.WriteLine(i / n);
                return;
            }
        }
    }
}


Measured memory_bytes: 27536