akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
typedef long long ll;

ll h[100005],n,a,b,l,r,m,c,t,ans=2e9;

int main()
{
    scanf("%lld%lld%lld",&n,&a,&b),a-=b;
    for(int i=1;i<=n;++i)scanf("%lld",&h[i]);
    
    l=0,r=2e9/b;
    while(l+1<r)
    {
	m=(l+r)>>1,t=0,c=0;
	for(int i=1;i<=n;++i)
	    if(h[i]-m*b>0)t+=(h[i]-m*b-1)/a+1,++c;
	if(c==1&&t>m)
	    for(int i=1;i<=n;++i)
		if(h[i]-m*b-m*a>0)t=m+(h[i]-m*b-m*a-1)/(a+b)+1,++c;
	ans=std::min(ans,std::max(m,t));
	if(m>t)r=m;else l=m;
    }
    m=l,t=0,c=0;
    for(int i=1;i<=n;++i)
	if(h[i]-m*b>0)t+=(h[i]-m*b-1)/a+1,++c;
    if(c==1&&t>m)
	for(int i=1;i<=n;++i)
	    if(h[i]-m*b-m*a>0)t=m+(h[i]-m*b-m*a-1)/(a+b)+1,++c;
    ans=std::min(ans,std::max(m,t));
    m=r,t=0,c=0;
    for(int i=1;i<=n;++i)
	if(h[i]-m*b>0)t+=(h[i]-m*b-1)/a+1,++c;
    if(c==1&&t>m)
	for(int i=1;i<=n;++i)
	    if(h[i]-m*b-m*a>0)t=m+(h[i]-m*b-m*a-1)/(a+b)+1,++c;
    ans=std::min(ans,std::max(m,t));
    printf("%lld\n",ans);
    
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
    return os << "(" << P.first << "," << P.second << ")";}

// #define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
typedef long long ll;
typedef double ld;
#define pll pair<ll,ll>
#define pii pair<int, int>
#define pb push_back
#define mp(x, y) make_pair((x), (y))
#define F first
#define S second
#define I insert
#define vi vector<int>
#define vll vector<ll>
#define vpll vector<pll>
#define all(x) (x).begin(), (x).end()
#define sz(x) (ll)(x).size()
   
const ll Mod = 1e9 + 7;
const int N = 1e5 + 7;
vector<int> G[N];

int dis[N][3];

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
    int n , m , u , v;
    cin >> n >> m;
    for(int i = 0 ;i < m ; i++){
        cin >> u >> v;
        G[u].pb(v);
        
    }
    int s , t;
    cin >> s >> t;

    for(int i = 0 ;i < N ; i++){
        for(int j = 0 ;j < 3 ; j++)
            dis[i][j] = -1;
    }
    queue<pii> Q;
    set<pii> visit;
    dis[s][0] = 0;
    Q.push(mp(s , 0));
    visit.insert(mp(s , 0));

    while(Q.size()){
        pii p = Q.front();
        Q.pop();
        for(auto it : G[p.F]){
            if(visit.find(mp(it , (p.S+1)%3 )) == visit.end()){
                visit.insert(mp(it , (p.S+1)%3));
                Q.push(mp(it , (p.S+1)%3));
                dis[it][(p.S+1)%3] = dis[p.F][p.S] + 1;
                
            }
        }
    }
    if(dis[t][0] != -1)
        cout << dis[t][0]/3 << endl;
    else
        cout << dis[t][0] << endl;

    return 0;
}

Measured memory_bytes: 20992
import numpy as np

n = int(input())
heights = np.array(list(map(int, input().split())))

idx = list()
counts = list()


def div(vec):
    if len(vec) <= 0:
        return
    a_min = np.argmin(vec)
    count = vec[a_min]

    counts.append(count)
    idx.append(a_min)

    vec -= count
    div(vec[:a_min])
    div(vec[a_min + 1:])


div(heights)
print(np.sum(counts))

Measured memory_bytes: 21512
import java.io.*;
import java.util.Scanner;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		String[] w = {"Sunny", "Cloudy", "Rainy"};
		String s = sc.next();
		
		if (s.equals(w[0])) {
			pr.println(w[1]);
		} else if (s.equals(w[1])) {
			pr.println(w[2]);
		} else {
			pr.println(w[0]);
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 21588
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <functional>
#include <numeric>
#include <limits>
#include <iomanip>
#include <queue>
#include <cmath>
#include <math.h>
#include <string>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const long long INF = 1LL << 60;
using pll = pair<long long, long long>;
typedef long long ll;
#define min(a, b) ((a) < (b) ? (a) : (b))
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数
long long gcd(long long a, long long b)
{
	if (a % b == 0) {
		return(b);
	}
	else {
		return(gcd(b, a % b));
	}
}

int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	// cout << std::fixed << std::setprecision(15);

	long long X, Y;
	cin >> X >> Y;
	long long count = 0;
	long long tmp1 = X;
	while (true) {
		if (Y < tmp1) {
			break;
		}
		tmp1 = tmp1 *  2;
		++count;
	}

	cout << count << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<cstdlib>
using namespace std;
#define REP(i,a,n) for(int i = a ; i < n ; i++)
#define rep(i,n) REP(i,0,n)

typedef long long ll;

int mergecount(vector<int> &a){
  int count = 0;
  int n = a.size();
  if(n > 1){
    vector<int> b(a.begin(),a.begin() + n/2);
    vector<int> c(a.begin() + n/2, a.end());
    count += mergecount(b);
    count += mergecount(c);
    for(int i=0,j=0,k=0;i<n;i++){
      if(k == c.size()) a[i] = b[j++];
      else if(j == b.size()) a[i] = c[k++];
      else if(b[j] <= c[k]) a[i] = b[j++];
      else {a[i] = c[k++]; count += n/2 - j;}
    }
  }
  return count;
}

int main(){
  int n;
  while(cin>>n,n){
    vector<int> v(n);
    rep(i,n)cin>>v[i];
    cout<<mergecount(v)<<endl;
  }
}

Measured memory_bytes: 0
import numpy as np
from numba import njit


n, k = map(int, input().split())
a = np.array(list(map(int, input().split())))
@njit('(i8[::1]),', cache=True)
def update(a):
    b = np.zeros_like(a)
    for i, x in enumerate(a):
        l = max(0, i - x)
        r = min(n - 1, i + x)
        b[l] += 1
        if r + 1 < n:
            b[r + 1] -= 1
    b = np.cumsum(b)
    return b
k = min(k, 100)
for i in range(k):
    a = update(a)
print(' '.join(a.astype(str)))


Measured memory_bytes: 154396
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <cassert>

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

using namespace std;
typedef long long int ll;
const ll INF = 1000000000000000000;
const double PI = acos(-1);

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

    ll ans = 0;
    if (x >= 500) {
        ans += 1000 * (x / 500);
        x %= 500;
    }
    if (x >= 5) {
        ans += 5 * (x / 5);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3596
#include<stdio.h>
#define N 1000000
#define NIL -1

struct Node{
  int p,
    l, 
    r;
};

struct Node T[N];
int a,f[N];

int getDepth(int b){
  int count = 0,i ;
  while(T[b].p!=NIL){
    b = T[b].p;
    count++;
  }
  return count;
}


void printChild(int u){
  int c;
  c = T[u].l;
  while(c != NIL){
    printf("%d, ",u);
    c = T[c].r;
  }
}


void print(int u){
  int i,c;
  printf("node %d: parent = %d, depth = %d, ",u,T[u].p,getDepth(u));
  if(T[u].p == NIL)printf("root, ");
  else if(T[u].l == NIL)printf("leaf, ");
  else printf("internal node, ");
  printf("[");
  for(i=0,c = T[u].l; c!=NIL;i++,c = T[c].r){ 
    if(i) printf(", ");   
    printf("%d",c);
  }
  printf("]");
}




int main(){
  int i,j,a,b,c,d,k=0,l,n,r;
  scanf("%d",&a);
 for(i=0;i<a;i++){
   T[i].p = T[i].l = T[i].r = NIL;
 }
  for(i=0;i<a;i++){
    scanf("%d %d",&c,&d);

    for(j=0;j<d;j++){
      scanf("%d",&b);
      if(j==0)T[c].l = b;
      else T[k].r = b;
	k=b;
	T[b].p = c;
    }
  }
  for(i=0;i<n;i++){
    if(T[i].p == NIL) r = i;
  }
  for(i=0;i<a;i++){
    print(i);
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 1776
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
function permutation(a,n)
	ans = Array{Int,1}[copy(a)]
	c = ones(Int,n)
	i = 1
	while i<=n
		if c[i]<i
			if i%2==1
				tmp = a[1]
				a[1] = a[i]
				a[i] = tmp
			else
				tmp = a[c[i]]
				a[c[i]] = a[i]
				a[i] = tmp
			end
			c[i] += 1
			i = 1
			push!(ans,copy(a))
		else
			c[i] = 1
			i += 1
		end
	end
	ans
end

function main()
    n,m,rn = readline() |> split |> parseMap
    r = readline() |> split |> parseMap
    d = 10^18*ones(Int,n,n)
    for i in 1:n
        d[i,i] = 0
    end
    for i in 1:m
        a,b,c = readline() |> split |> parseMap
        d[a,b] = c
        d[b,a] = c
    end
    for i in 1:n
        for k in 1:n
            for j in 1:n
                d[i,j] = min(d[i,j],d[i,k]+d[k,j])
            end
        end
    end
    for k in 1:n
        for j in 1:n
            for i in 1:n
                d[i,j] = min(d[i,j],d[i,k]+d[k,j])
            end
        end
    end

    prm = permutation(r,rn)
    minim = 10^18
    for i in 1:length(prm)
        x = 0
        for j in 2:rn
            x += d[prm[i][j-1],prm[i][j]]
        end
        minim = min(minim,x)
    end
    println(minim)
end
main()

Measured memory_bytes: 136480
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
const int maxn = 103;
const int inf = 10000000 + 3;
set <pair<int, int>> edg;
map <pair<int, int>, int> val;
vector <int> adj[maxn];
int dis[maxn][maxn];
vector <int> par[maxn][maxn];
int cur;
set <pair <int, int>> s[maxn];

void dij(int u)
{
    for(auto v : adj[u])
    {
        if(dis[cur][v] > dis[cur][u] + val[{u, v}])
        {
            s[cur].erase({dis[cur][v], v});
            dis[cur][v] = dis[cur][u] + val[{u, v}];
            s[cur].insert({dis[cur][v], v});
            par[cur][v].clear();
            par[cur][v].pb(u);

        }
        if(dis[cur][v] == dis[cur][u] + val[{u, v}])
        {
            par[cur][v].pb(u);
        }
    }
    if(!s[cur].size())
        return;
    auto it = s[cur].begin();
    int minn = it->second;
    s[cur].erase(it);
    for(auto z : par[cur][minn])
    {
        edg.erase({minn, z});
        edg.erase({z, minn});
    }
    dij(minn);
}

int main(){
    int n, m;
    cin >> n >> m;
    for(int i = 0 ; i<m ; i++)
    {
        int u, v, w;
        cin >> u >> v >> w;
        val[{u, v}] = w;
        val[{v, u}] = w;
        edg.insert({u, v});
        edg.insert({v, u});
        adj[u].pb(v);
        adj[v].pb(u);
    }
    for(int i = 1 ; i <= n ;i++)
        fill(dis[i]+1, dis[i]+1+n, inf);
    for(int i = 1 ; i <= n ; i++)
        dis[i][i] = 0;
    for(int i = 1 ; i <= n ; i++)
    {
        for(int j = 1 ; j <= n ; j++)
        {
            s[i].insert({inf, j});
        }
    }
    for(int i = 1 ; i <= n;i++)
    {
        cur = i;
        dij(i);
    }
    cout << (edg.size()/2);
//    for(int i = 1 ; i <= n ; i++)
//    {
//        for(int j = 1 ; j <= n ; j++)
//        {
//            cout << "Dis[" << i << "][" << j << "] = " <<dis[i][j] << "\n";
//        }
//    }
    return 0;

}



Measured memory_bytes: 4572
#include <iostream>
#include <stack>
#include <queue>
#include <map>
#include <vector>
#include <cstdio>
#include <string>
#include <climits>
#include <cmath>
#include <cstring>
#include <iomanip>

using namespace std;

int main(){
    string s;
    cin>>s;
    int a[26] = {0};
    for(size_t i = 0; i < s.size(); i++){
        a[s[i] - 'a']++;
    }
    for(int i = 0; i < 26; i++){
        if(a[i] == 0){
            cout<<char(i + 'a')<<endl;
            return 0;
        }
    }
    cout<<"None"<<endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

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

    vector<int> count(n);
    vector<vector<int>> graph(n);
    for (int i = 0; i < m; i++) {
        int from, to;
        cin >> from >> to;
        from--;
        to--;
        count[to]++;
        graph[from].push_back(to);
    }

    queue<int> que;
    for (int i = 0; i < n; i++) {
        if (count[i] == 0)que.push(i);
    }

    vector<int> dp(n, 0);
    while (!que.empty()) {
        int now = que.front();
        que.pop();
        for (auto next:graph[now]) {
            dp[next] = max(dp[next], dp[now] + 1);
            count[next]--;
            if (count[next] == 0)que.push(next);
        }
    }

    int ret = 0;
    for (auto x:dp)ret = max(ret, x);
    cout << ret << endl;
    return 0;
}

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

int main(){
	int a,b,c;
	cin >> a >> b >> c;
	if(a==b&&b!=c||a==c&&b!=c||b==c&&a!=b){
		cout << "Yes" <<endl;
	}
	else{
		cout << "No" <<endl;
	}
}

Measured memory_bytes: 256
'use strict';

const main = input => {
  // console.log(input, '\n---'); // for debug
  const n = Number(input);
  const p1 = {
    x: 0,
    y: 0,
  };
  const p2 = {
    x: 100,
    y: 0,
  };
  console.log(p1.x, p1.y);
  koch(n, p1, p2);
  console.log(p2.x, p2.y);
};

function koch(n, p1, p2) {
  if (n === 0) {
    return;
  }
  const r = toRadians(60);

  const s = { x: (2 * p1.x + 1 * p2.x) / 3, y: (2 * p1.y + 1 * p2.y) / 3 };
  const t = { x: (1 * p1.x + 2 * p2.x) / 3, y: (1 * p1.y + 2 * p2.y) / 3 };
  const u = {
    x: (t.x - s.x) * Math.cos(r) - (t.y - s.y) * Math.sin(r) + s.x,
    y: (t.x - s.x) * Math.sin(r) + (t.y - s.y) * Math.cos(r) + s.y,
  };
  koch(n - 1, p1, s);
  console.log(s.x, s.y);
  koch(n - 1, s, u);
  console.log(u.x, u.y);
  koch(n - 1, u, t);
  console.log(t.x, t.y);
  koch(n - 1, t, p2);
}

function toRadians(deg) {
  return deg * (Math.PI / 180);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));



Measured memory_bytes: 21804
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

#if 1
#define DEBUG(x) do{cerr << #x << "=" << x << endl;}while(0);
#else
#define DEBUG
#endif

int main(){
	int n,a,b;
	cin >> n >> a >> b;


	int x,y;
	x = n*a;
	y = b;
	cout << (x > y ? y : x) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int k, l;
char s[105];
int main()
{
	scanf("%d%s",&k,s);
	l = strlen(s);
	if(l <= k) printf("%s", s);
	else{
		for(int i=0; i<k; i++) printf("%c", s[i]);
		printf("...");
	}
	return 0;
}

Measured memory_bytes: 1736
r1,c1,r2,c2 = map(int, input().split())
mod = 10 ** 9 + 7
n = 4 * (10 ** 6)

fact = [1]*(n+1)
rfact = [1]*(n+1)
r = 1
for i in range(1, n+1):
  fact[i] = r = r * i % mod
rfact[n] = r = pow(fact[n], mod-2, mod)
for i in range(n, 0, -1):
  rfact[i-1] = r = r * i % mod

def comb(n, k):
  return fact[n] * rfact[k] * rfact[n-k] % mod

ans = 0
for r in range(r1,r2+1):
  mini = (((c2+1) * comb(r + c2 + 1, r) - c1 * comb(c1+r,r)) * pow(r+1,mod-2,mod)) % mod
  ans = (ans + mini) % mod
print(ans % mod)

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

typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define pb push_back
#define popb pop_back()
#define pf push_front
#define popf pop_front()
#define si size()
#define be begin()
#define en end()
#define all(v) v.be, v.en
#define le length()
#define mp make_pair
#define mt make_tuple
#define acc(v) accumulate(all(v), 0)
#define F first
#define S second
#define INF lli(1e19)

#define forz(i, n) for (lli i = 0; i < n; i++)
#define fore(i, m, n) for (lli i = m; i < n; i++)
#define rforz(i, n) for (lli i = n - 1; i >= 0; i--)
#define rfore(i, m, n) for (lli i = n - 1; i >= m; i--)
#define deci(n) fixed << setprecision(n)
#define high(n) __builtin_popcount(n)
#define highll(n) __builtin_popcountll(n)
#define parity(n) __builtin_parity(n)
#define ctz(n) __builtin_ctz(n)
#define lb lower_bound
#define ub upper_bound
#define er equal_range
#define maxe *max_element
#define mine *min_element
#define mod 1000000007
#define mod2 998244353
#define gcd __gcd
#define kira ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define newline cout<<endl;
//#define endl "\n"



inline lli power(lli x, lli y, lli p = mod)
{
    lli res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

inline lli modadd(lli a, lli b, lli m = mod)
{
    a += b;
    if (a >= m)
        a -= m;
    return a;
}

inline lli modmul(lli a, lli b, lli m = mod)
{
    return ((a % m) * (b % m)) % m;
}

inline lli modi(lli a, lli m = mod) { return power(a, m - 2, m); }
inline lli md(lli x) {if(x>=0)return x; return -x;}
///////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////
lli n,m,k,r;
//lli u, v;
//bool vis[3030];
//vector<lli> adj[3030];
//void init()
//{
//    forz(i,n) vis[i]=0, adj[i].clear();
//}


int32_t main()
{
    kira;

    lli T=1;
    //cin>>T;

    while(T--)
    {
        string s;
        cin>>s;
        k = 0;
        for(int i = 0; i<s.size(); i++) k = k + s[i]-'0', k = k%9;
        if(!k) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;

    }

    return 0;

}


Measured memory_bytes: 3748
N = int(input())
if N == 1:
    a = int(input())
    print(a)
else:
    a = list(map(int, input().split()))
    a.sort(reverse=True)
    alice = 0
    bob = 0
    for i in range(N):
        if i%2==0:
            alice += a[i]
        else:
            bob += a[i]
    print(alice-bob)
            

Measured memory_bytes: 61572
n, k = map(int, input().split())
dices = list(map(int, input().split()))

exp_value = (sum(dices[:k]) + k) / 2
max_exp_value = exp_value

for i in range(n - k):
  exp_value += (dices[i + k] - dices[i]) / 2
  if exp_value > max_exp_value:
    max_exp_value = exp_value

print(max_exp_value)

Measured memory_bytes: 25060
#include <iostream>
#include <algorithm>
#include <limits>
#include <vector>
#include <map>
#define ll long long int
#define rep(i,n) for(int i = 0;i < n;i++)
#define pb push_back
#define mp make_pair

using namespace std;

int main(){
    
    ll x;
    cin >> x;
    ll tmp = x/11;
    ll tmp1 = x%11;

    if(tmp1 > 6){
        cout << 2 * tmp + 2 << endl;
    }
    else if(tmp1 == 0){
        cout << 2 * tmp << endl;
    }
    else{
        cout << 2 * tmp + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#define INF 100000000000000
using namespace std;

int main(){

  int n, m;
  int t[500000];
  int c[21];

  cin >> n >> m;
  for(int i = 0; i < m; i++) cin >> c[i];
  fill(t, t+500000, INF);
  t[0] = 0;
  for(int i = 0; i < m; i++){
    for(int j = 0; j + c[i] <= n; j++){
      t[j + c[i]] = min(t[j + c[i]], t[j] + 1);
    }
  }
  cout << t[n] << endl;
  return 0;
}


Measured memory_bytes: 5068
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <queue>
#include <random>
#include <cstdint>
#include <bitset>
#include <iomanip>
#include <utility>
#include<map>
#include<functional>
#include<climits>
#include<regex>
#include<numeric>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main() {
	int n;
	bool flg[2];
	cin >> n;
	flg[0] = (n % 100 == 0 || n % 100 > 12);
	flg[1] = (n / 100 == 0 || n / 100 > 12);
	if (flg[0] && flg[1])cout << "NA" << endl;
	if ((!flg[0]) && flg[1])cout << "YYMM" << endl;
	if (flg[0] && (!flg[1]))cout << "MMYY" << endl;
	if (!(flg[0]) && !(flg[1]))cout << "AMBIGUOUS" << endl;

}



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

int main() {
    int h, w, m; cin >> h >> w >> m;
    set<array<int, 2>> field;
    vector<int> rows(h, 0), cols(w, 0);
    for (int i = 0; i < m; ++i) {
        int y, x; cin >> y >> x; --y; --x;
        field.insert({ y, x });
        ++rows[y]; ++cols[x];
    }

    int rmax = -1, cmax = -1;
    vector<int> rmaxes, cmaxes;

    for (int i = 0; i < h; ++i) {
        if (rmax <= rows[i]) {
            if (rmax < rows[i]) {
                rmaxes.clear();
                rmax = rows[i];
            }
            rmaxes.push_back(i);
        }
    }
    for (int i = 0; i < w; ++i) {
        if (cmax <= cols[i]) {
            if (cmax < cols[i]) {
                cmaxes.clear();
                cmax = cols[i];
            }
            cmaxes.push_back(i);
        }
    }

    for (auto y : rmaxes) {
        for (auto x : cmaxes) {
            if (field.find({ y, x }) == field.end()) {
                cout << rmax + cmax << endl;
                return 0;
            }
        }
    }

    cout << rmax + cmax - 1 << endl;
}



Measured memory_bytes: 23880
N = int(input())
Pn = list(map(int, input().split()))

MIn, MAn = [float("inf")] * N, [-float("inf")] * N
mi, ma = float("inf"), -float("inf")
for i in range(N):
    mi = min(mi, Pn[i])
    ma = max(ma, Pn[i])

    MIn[i], MAn[i] = mi, ma

ans = 1
for i in range(N):
    if Pn[i] == MIn[i] and Pn[i] < MAn[i]:
        ans += 1

print(ans)

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

using ll = long long;
using vint = vector<int>;
using vll = vector<ll>;
constexpr ll LLINF = 1ll << 60;

template<typename T>
struct SegmentTree {
	T id;
	function<T(T, T)> op;
	vector<T> dat;
	int size;

	SegmentTree(int n, T id, function<T(T, T)> op) : id(id), op(op) {
		size = 1;
		while (size < n) size <<= 1;
		dat.assign(size * 2 + 10, id);
	}

	void update(int k, T x) {
		k += size; dat[k] = x;
		while (k > 1) k >>= 1, dat[k] = op(dat[k<<1], dat[(k<<1)|1]);
	}

	void merge(int k, T x) { update(k, op(x, dat[k+size])); }

	T query(int a, int b) {
		T tl = id, tr = id;
		for (int l = a + size, r = b + size; l < r; l >>= 1, r >>= 1) {
			if (l & 1) tl = op(tl, dat[l++]);
			if (r & 1) tr = op(tr, dat[--r]);
		}
		return (op(tl, tr));
	}
};

int main() {
	int N; cin >> N;
	SegmentTree<ll> seg(N, -LLINF, [](ll a, ll b) { return (max(a, b)); } );

	vll A(N);
	for (auto &v : A) cin >> v;

	for (int i = 0; i < N; i++) {
		seg.update(i, 0ll);
	}

	for (int i = 0; i < N; i++) {
		ll dat = seg.query(0, A[i]);
		//cout << dat << " ";
		seg.update(A[i]-1, dat + A[i]);
		//cout << seg.query(A[i]-1, A[i]) << endl;
	}

	cout << (ll)N*(N+1)/2 - seg.query(0, N) << endl;
}



Measured memory_bytes: 5752
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n, m;
  cin >> n >> m;
  vector<P> v(m);
  rep(i, 0, m) {
    int a, b;
    cin >> a >> b;
    v[i] = make_pair(b, a);
  }
  sort(v.begin(), v.end());

  int broke = -1, ans = 0;
  rep(i, 0, m) {
    if (broke != -1 && broke >= v[i].second && broke <= v[i].first)
      continue;
    else {
      broke = v[i].first - 1;
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;

int main() {
  int N; cin >> N;
  string S; cin >> S;
  int ans = 0;
  for(int i = 0; i < 1000; i++) {
    string s; s = "00" + to_string(i);
    s = s.substr(s.size() - 3);
    bool found = true;
    for(int j = 0; j < 3; j++) {
      int pos;
      if(j == 0) pos = S.find(s[j]);
      else pos = S.find(s[j], pos+1);
      if(pos == string::npos) {
        found = false;
        continue;
      }
    }
    if(found) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define pll pair<ll,ll>
#define v vector<ll>
#define st stack<ll>
#define pq  priority_queue <int>
#define q queue<ll>
#define mod 1000000005
using namespace std;
 char ch[1000000];
int main(){
      

      /* ios::sync_with_stdio(0);
        cin.tie(0),cout.tie(0);*/
        /* char ch[10000];*/
         cin>>ch;
         
         	 if(ch[0]=='Y' && ch[1]=='A' && ch[2]=='K'&& ch[3]=='I'){
         	 	 cout<<"Yes"<<endl;
         	 	 //break;
         	 	 return 0;
         	 }
         
         cout<<"No"<<endl;
	return 0;
}

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

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

  std::string s;

  std::cin >> s;

  if (s[2] == s[3] && s[4] == s[5]) {
    std::cout << "Yes" << std::endl;
  } else {
    std::cout << "No" << std::endl;
  }

  return 0;
}


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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

class modint {
  private:
    ll m_val;
    ll m_mod;
  public:
    constexpr modint() : m_val(0), m_mod() { m_mod = MOD; }
    constexpr modint(const ll x) : m_val(0), m_mod(0) { m_mod = MOD; m_val = x % m_mod; }
    constexpr modint(const ll x, const ll mod) : m_val(0), m_mod(0) { m_mod = mod; m_val = x % m_mod; }
    constexpr ll val() const { return m_val; }
    constexpr modint operator+(const modint &rhs) const { return modint(*this) += rhs; }
    constexpr modint operator-(const modint &rhs) const { return modint(*this) -= rhs; }
    constexpr modint operator*(const modint &rhs) const { return modint(*this) *= rhs; }
    constexpr modint operator/(const modint &rhs) const { return modint(*this) /= rhs; }
    constexpr modint &operator+=(const modint &rhs) {
      m_val += rhs.m_val;
      if (m_val >= m_mod) m_val -= m_mod;
      return *this;
    }
    constexpr modint &operator-=(const modint &rhs) {
      if (m_val < rhs.m_val) m_val += m_mod;
      m_val -= rhs.m_val;
      return *this;
    }
    constexpr modint &operator*=(const modint &rhs) {
      m_val = m_val * rhs.m_val % m_mod;
      return *this;
    }
    constexpr modint &operator/=(const modint &rhs) {
      *this *= rhs.pow(m_mod - 2);
      return *this;
    }
    constexpr modint pow(ll n) const {
      if (n == 0) return 1;
      modint o = pow(n >> 1);
      o *= o;
      if (n & 1) o *= *this;
      return o;
    }
    friend ostream& operator<<(ostream& os, const modint &a) { os << a.val(); return os; }
};

vector<ll> prime_sieve(ll a, ll b) { // [a, b)
  vector<bool> is_prime_small(sqrt(b)+1, true);
  vector<bool> is_prime(b-a, true);
  for (ll i = 2; i*i < b; ++i) {
    if (is_prime_small[i]) {
      for (ll j = 2*i; j*j < b; j += i) is_prime_small[j] = false;
      for (ll j = max(2LL, (a+i-1)/i)*i; j < b; j += i) is_prime[j-a] = false;
    }
  }
  vector<ll> res;
  for (ll i = 0; i < b-a; ++i) {
    if (is_prime[i] && a+i >= 2) {
      res.push_back(a+i);
    }
  }
  return res;
}

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

  auto primes = prime_sieve(2, 1001);

  modint ans(1);
  each (p, primes) {
    if (n < p) break;
    ll cnt = 0;
    for (ll i = p; i <= n; i*=p) {
      cnt += n/i;
    }
    ans *= cnt+1;
  }

  cout << ans.val() << endl;
  
  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
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 INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int kurai(int a,int b){
  int m=pow(10,b),n=pow(10,b-1);
  return (a%m)/n;
}
int ketawa(int a){
  int k=0;
  rep(i,keta(a)){
  k+=kurai(a,i+1);
  }
  return k;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
int mid(int a,int b,int c){
  vector<int> k(3);
  k[0]=a;k[1]=b;k[2]=c;
  sort(all(k));
  return k[1];
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
 if(!b)return 1; if(b&1)return modpow(a,b-1,m)*a%m;
 int memo = modpow(a,b>>1,m);
 return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  int a;
  cin>>a;
  YesNo(30<=a);
}

Measured memory_bytes: 3792
h,n=map(int,input().split())
a=input().split()
a=list(map(int,a))
a.sort(reverse=True)
flag=0
ans=0
for i in range(n):
    ans+=a[i]
    if ans>=h:
        flag=1
        break
if flag==1:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 13964
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
using ui = unsigned int;
using ul = unsigned long;
#pragma GCC optimize("Ofast")
#define loop(i, n) for (ui i = 0; i < n; i++)
ul bit[550001];
struct BIT
{
    ui n;
    inline ul sum(ui x)
    {
        ul ret = 0;
        while (x > 0)
        {
            ret += bit[x];
            x -= x & -x;
        }
        return ret;
    }
    BIT(ui n0) : n(n0) {}
    inline ul sum(ui l, ui r)
    {
        return sum(r + 1) - sum(l);
    }
    inline void add(ui i, ul x)
    {
        i++;
        while (i <= n)
        {
            bit[i] += x;
            i += i & -i;
        }
    }
};
class FastIO
{
    static const int rdata_sz = (1 << 25), wdata_sz = (1 << 25);
    char rdata[rdata_sz], wdata[wdata_sz], *rb, *wb;
    char tmp_s[20];

public:
    FastIO()
    {
        fread(rdata, 1, rdata_sz, stdin);
        rb = rdata;
        wb = wdata;
    }
    ~FastIO()
    {
        fwrite(wdata, 1, wb - wdata, stdout);
    }

    template <typename T>
    inline void read(T &x)
    {
        bool neg = false;
        x = 0;
        while ((*rb < '0' || *rb > '9') && *rb != '-')
            ++rb;
        if (*rb == '-')
        {
            neg = true;
            ++rb;
        }
        while ('0' <= *rb && *rb <= '9')
        {
            x = 10 * x + (*rb - '0');
            ++rb;
        }
        if (neg)
            x = -x;
    }

#define pc(x) *(wb++) = x
    template <typename T>
    inline void write(T x)
    {
        if (x == 0)
        {
            pc('0');
            pc('\n');
            return;
        }
        if (x < 0)
        {
            pc('-');
            x = -x;
        }
        char *t = tmp_s;
        while (x)
        {
            T y = x / 10;
            *(t++) = (x - y * 10) + '0';
            x = y;
        }
        while (t != tmp_s)
            pc(*(--t));
        pc('\n');
    }
#undef pc
};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    FastIO io;
    ui N, Q;
    io.read(N);
    io.read(Q);
    BIT data(N);
    loop(i, N)
    {
        ul A;
        io.read(A);
        bit[i + 1] = A;
    }
    for (ui i = 1; i < N; i++)
        bit[i + (i & -i)] += bit[i];
    loop(i, Q)
    {
        ui a, b, c;
        io.read(a);
        io.read(b);
        io.read(c);
        if (a == 0)
            data.add(b, c);
        else
            io.write(data.sum(b, c - 1));
    }
    return 0;
}

Measured memory_bytes: 25276
def prime_factorization(n):
    arr = []
    tmp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if tmp % i == 0:
            while tmp % i == 0:
                arr.append(i)
                tmp //= i
    if(tmp != 1):
        arr.append(tmp)
    if not arr:
        arr.append(n)
    return arr 

n = int(input())

ans = str(n) + ": " + " ".join(map(str, prime_factorization(n)))
print(ans)


Measured memory_bytes: 5644
N = int(input())
X = list(map(int, input().split()))
MOD = 10 ** 9 + 7

ctr = [0, 0, 0]
ans = 1
for a in X:
    ptn = sum(a == v for v in ctr)
    ans = ans * ptn % MOD

    if ans == 0:
        break

    for i in range(3):
        if ctr[i] == a:
            ctr[i] += 1
            break

print(ans)


Measured memory_bytes: 84136
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int n,k,x,y;
  cin>>n>>k>>x>>y;
  if(n<=k){
    cout<<x*n<<endl;
  }else{
    int ans=x*k+(n-k)*y;
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
const int INFTY =2147483647;
int main(){
    ll n,k,a;
    cin>>n>>k;
    a=n%k;
    cout<<(ll)min(n,(ll)min(a,(ll)abs(a-k)))<<endl;;

}

Measured memory_bytes: 256
package main

import (
  "fmt"
  "math"
)

func maxInt(a ...int) int {m := a[0]; for _, x := range a {if x > m {m = x}}; return m}
func minInt(a ...int) int {m := a[0]; for _, x := range a {if x < m {m = x}}; return m}

func pow(args ...int) int {
  x, y := args[0], args[1]
  res := 1
  if len(args) == 3 {
    mod := args[2]
    for y != 0 {
      if y & 1 == 1 {res = res * x % mod}
      y >>= 1
      x = x * x % mod
    }
  }  else {
    for y != 0 {
      if y & 1 == 1 {res *= x}
      y >>= 1
      x *= x
    }
  }
  return res
}

func main() {
  var x int 
  fmt.Scan(&x)
  y := int(math.Sqrt(float64(x)))
  res := 1
  for b := 2; b < y + 1; b++ {
    for p := 2; ; p++ {
      if pow(b, p) > x {
        res = maxInt(res, pow(b, p - 1))
        break
      }
    }
  }
  fmt.Println(res)
}

Measured memory_bytes: 512
N, M = map(int, input().split())
X = list(map(int, input().split()))

X = sorted(X)
dis_X = []
for i in range(len(X)-1):
    dis_X.append(X[i+1] - X[i])

dis_X = sorted(dis_X, reverse=True)
ans = 0
for i in range(N-1, len(dis_X)):
    ans += dis_X[i]

print(ans)

Measured memory_bytes: 13968
#include <cstdio>
#include <cstring>
#include <cstdlib>

typedef struct tree_{
    int value;
    struct tree_ *left;
    struct tree_ *right;
}tree;

void preorder(tree *p){
    if(p==NULL)return;
    printf(" %d",p->value);
    preorder(p->left);
    preorder(p->right);
}

void inorder(tree *p){
    if(p==NULL)return;
    inorder(p->left);
    printf(" %d",p->value);
    inorder(p->right);
}

tree *insert(tree *p, int x){
    if(p==NULL){
        p = (tree *)malloc(sizeof(tree));
        p->value = x;
        p->left = NULL;
        p->right = NULL;
    }else{
        if(p->value>x)p->left = insert(p->left, x);
        else if(p->value<x)p->right = insert(p->right, x);
    }
    return p;
}

bool find(tree *p, int x){
    bool ans;
    if(p==NULL)ans = false;
    else if(p->value>x)ans = find(p->left, x);
    else if(p->value<x)ans = find(p->right, x);
    else ans = true;
    return ans;
}

int main(){
    int i, n, x;
    char cmd[7];
    tree *root = NULL;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s",cmd);
        if(strcmp(cmd,"insert")==0){
            scanf("%d",&x);
            root = insert(root, x);
        }else if(strcmp(cmd,"print")==0){
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }else if(strcmp(cmd,"find")==0){
            scanf("%d",&x);
            if(find(root, x))printf("yes\n");
            else printf("no\n");
        }else return -1;
    }
    return 0;
}



Measured memory_bytes: 15044
num, choice = map(int, input().split())
tmp = input().split()
product_list = [int(s) for s in tmp]
product_list.sort(reverse=True)
sum = 0
for i in range(num):
    sum += product_list[i]
if product_list[choice-1] >= sum/(choice*4):
    print("Yes")
else:
    print("No")


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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define mp make_pair
#define ll long long
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define pdd pair< double, double >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 100010
#define inf 1e9

int main()
{

    ll a, b;
    cin >> a >> b;
    ll ans = 0;
    ll num = 1;
    while(num < b)
    {

        ans++;
        num += a-1;
    }
    cout << ans;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n=5;
ll a[6];
int main(){
	ios::sync_with_stdio(false);
	ll mx=0;
	for(int i=1; i<=n ;i++){
		cin >> a[i];
		mx=max(mx,(10-(a[i])%10)%10);
		a[i]=a[i]+(10-(a[i])%10)%10;
		
		//cout << (10-(a[i])%10)%10 << endl;
		
	}
	//cout << mx << endl;
	ll ans=0;
	for(int i=1; i<=n ;i++){
		ans+=a[i];
	}
	cout << ans-mx << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    int n;
    cin>>n;
  string s,s1;
  cin>>s>>s1;
  for(int i=0;i<n;i++)
  {
      cout<<s[i]<<s1[i];
  }


    return 0;
}










Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int a, b, temp, i;
    for(i=1; i<=3000; i++)
    {
    cin >> a >> b;
    
    if( a<1 && b<1 )
        break;
        
        if(a > b)
        {
            temp = a;
            a = b;
            b = temp;
        }
    

 

    cout << a << " " << b << endl;
    }
} 


Measured memory_bytes: 3040
N = int(input())
A = [list(map(int,input().split())) for _ in range(2)]

dp = [[0] * N for _ in range(3)]

for i in range(1,3):
    for j in range(N):
        if j == 0:
            dp[i][j] = dp[i-1][j] + A[i-1][j] 
        else:
            dp[i][j] = max(dp[i-1][j], dp[i][j-1]) + A[i-1][j]

print(dp[-1][-1])

Measured memory_bytes: 3064
#include <bits/stdc++.h>	
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ld long double
#define pii pair <int, int>
#define sz(a) (int)(a.size()) 
#define resize(v) v.resize(unique(all(v)) - v.begin()); 
#define all(a) a.begin(), a.end()
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it ++)

// random_device rd; mt19937 g(rd());    
                                        	
using namespace std;
using namespace __gnu_pbds;
 
void Fast_Read_Out()
{
    ios_base::sync_with_stdio(0);
    cin.tie(), cout.tie();
}
 
void Random()
{
    unsigned int seed;                                                                        
    asm("rdtsc" : "=A" (seed));
    srand(seed);        
}
 
unsigned int Time()
{
     unsigned int time = clock() / 1000.00;                           
     return time;
}

template <typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>; 
 
const int mod = (int)1e9 + 7;
const int N = (int)2e5 + 123;

int a[N];
 
int main ()
{
	#ifdef JUDGE
		freopen("input.txt", "r", stdin);
	#endif		
	Fast_Read_Out();
	Random();   
	int n, k;
	cin >> n >> k;
	for(int i = 1; i <= n; i++) cin >> a[i];
	sort(a + 1, a + n + 1);
	reverse(a + 1, a + n + 1);
	long long sum = 0;
	for(int i = k + 1; i <= n; i++) sum += a[i];
	cout << sum;
}                                

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

typedef long long ll;

using namespace std;


int d,n,t[200],a[200],b[200],c[200],dp[201][200],ans;

int main(){
    scanf("%d%d",&d,&n);
    
    for(int i=0;i<d;i++)
        scanf("%d",&t[i]);
    
    for(int i=0;i<n;i++)
        scanf("%d%d%d",&a[i],&b[i],&c[i]);
    
    for(int i=0;i<d-1;i++){
        for(int j=0;j<n;j++){
            if(a[j]<=t[i] && t[i]<=b[j]){
                for(int k=0;k<n;k++){
                    dp[i+1][k]=max(dp[i+1][k],dp[i][j]+abs(c[j]-c[k]));
                }
            }
        }
    }
    
    for(int i=0;i<n;i++)
        if(a[i]<=t[d-1] && t[d-1]<=b[i])
            ans=max(ans,dp[d-1][i]);
    
    printf("%d\n",ans);
    
    
    return 0;
}

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

int main() {
  long long N;
  string S;
  cin >> N >> S;
  
  long long ans = 0;
  
  for (int i=0; i<N-2; i++) {
    if (S[i] == 'A' && S[i+1] == 'B' && S[i+2] == 'C') {
      ans++;
    }
  }
  
  cout << ans << endl;
} 

Measured memory_bytes: 256
x,y  = map(int, input().split())


def modconb(n,k,mod):
    # テーブルを作る
    fac = [0]*(n+1)
    finv = [0]*(n+1)
    inv = [0]*(n+1)  

    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1

    for i in range(2,n+1):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod%i] * (mod//i) % mod
        finv[i] = finv[i-1] * inv[i] %mod
    # 計算
    if n<k: return 0
    if n<0 or k<0: return 0
    return(fac[n]*(finv[k]*finv[n-k]%mod)%mod)
    
mod = 10**9 + 7 
if (x+y) % 3 != 0:
    print(0)
    exit()
i = (x+y)//3
j = (x-i)
print(modconb(i,j,mod))

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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
#define chmax(x, v)                                                            \
  do {                                                                         \
    x = max(x, v);                                                             \
  } while (0)
#define chmin(x, v)                                                            \
  do {                                                                         \
    x = min(x, v);                                                             \
  } while (0)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

// 答えf(x,y) はx,yについて上に凸なので
// x, y で3分探索をネストさせればよい
ll N;
vector<double> px,py; // 0 <= px, py <= 1000

double f(double x, double y) {
  double ans = 0;
  rep(i, N) {
    double t = (x-px[i]) * (x-px[i]) + (y-py[i]) * (y-py[i]);
    t = sqrt(t);
    chmax(ans, t);
  } 
  return ans;
}

double g(double x) {
  double y0 = 0, y3 = 1000;
  rep(i,200) {
    double y1 = y0 + (y3-y0)/3;
    double y2 = y0 + (y3-y0)*2/3;
    // printf("%.1f %.1f %.1f %.1f\n", y0, y1, y2, y3);
    if (f(x, y1) < f(x, y2)) {
      y3 = y2;
    } else {
      y0 = y1;
    }
  }
  return f(x, y0);
}

signed main() {
  cin >> N;
  px.resize(N);
  py.resize(N);
  rep(i,N) {
    cin >> px[i] >> py[i];
  }
  double x0 = 0, x3 = 1000;
  rep(i, 200) {
    double x1 = x0 + (x3-x0)/3;
    double x2 = x0 + (x3-x0)*2/3;
    // printf("%.1f %.1f %.1f %.1f\n", x0, x1, x2, x3);
    if (g(x1) < g(x2)) {
      x3 = x2;
    } else {
      x0 = x1;
    }
  }
  printf("%.10f\n", g(x0));
  return 0;
}


Measured memory_bytes: 256
h, w = map(int,input().split())
s = [[0]*(w+2) for _ in range(h+2)]
## 外堀を作っておく


for i in range(1,h+1):   ## コロンが抜けてたｗ
    array = list(input())   
        # マス目はスペースで区切られてないから、input split ではだめ
        # list関数を使わないといけない
        #  

    for j in range(1,w+1):
        s[i][j] = array[j-1]    



for i in range(1,h+1):
    for j in range(1,w+1):
        count = 0
        if s[i][j] == '.':
            if s[i-1][j-1] == '#':
                count += 1
            if s[i-1][j] == '#':
                count += 1
            if s[i-1][j+1] == '#':
                count += 1
            if s[i][j-1] == '#':
                count += 1
            if s[i][j+1] == '#':
                count += 1
            if s[i+1][j-1] == '#':
                count += 1
            if s[i+1][j] == '#':
                count += 1
            if s[i+1][j+1] == '#':
                count += 1

            s[i][j] = count

            

for i in range(1,h+1):
    text = ''
    for j in range(1,w+1):
        text += str(s[i][j])
    print(text)







Measured memory_bytes: 41328
/*

  "With age, comes wisdom. With travel, comes understanding.
   Remember that happiness is a way of travel – not a destination"

*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int            long long int
#define F              first
#define S              second
#define pb             push_back
#define si             set <int>
#define vi             vector <int>
#define pii            pair <int, int>
#define vpi            vector <pii>
#define vpp            vector <pair<int, pii>>
#define mii            map <int, int>
#define mpi            map <pii, int>
#define spi            set <pii>
#define endl           "\n"
#define sz(x)          ((int) x.size())
#define all(p)         p.begin(), p.end()
#define double         long double
#define que_max        priority_queue <int>
#define que_min        priority_queue <int, vi, greater<int>>
#define bug(...)       __f (#__VA_ARGS__, __VA_ARGS__)
#define print(a)       for(auto x : a) cout << x << " "; cout << endl
#define print1(a)      for(auto x : a) cout << x.F << " " << x.S << endl
#define print2(a,x,y)  for(int i = x; i < y; i++) cout<< a[i]<< " "; cout << endl

inline int power(int a, int b)
{
     int x = 1;
     while (b)
     {
          if (b & 1) x *= a;
          a *= a;
          b >>= 1;
     }
     return x;
}

typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> Set;

template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

const int N = 200005;
int a[N], b[N], n, m, k;

void solve()
{
     cin >> n >> m >> k;
     for (int i = 0; i < n; i++)
          cin >> a[i];
     for (int i = 0; i < m; i++)
          cin >> b[i];

     int ans = *min_element(a, a + n) + *min_element(b, b + m);
     for (int i = 0; i < k; i++)
     {
          int x, y, w; cin >> x >> y >> w;
          ans = min(ans, a[x - 1] + b[y - 1] - w);
     }
     cout << ans;

}

int32_t main()
{
     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

     cout << setprecision(9) << fixed;
     clock_t z = clock();
     solve();
     cerr << "Run Time : " << ((double)(clock() - z) / CLOCKS_PER_SEC);

     return 0;
}

Measured memory_bytes: 1792