akhauriyash/Code-Regression huggingface dataset:
def dfs(people, sports, use_sports, answer):
    rank = [0 for n in range(sports)]
    for p in range(people):
        for s in (preference[p]):
            if s in use_sports:
                rank[s] += 1
                break
            will_delete = []
    max_p = max(rank)
    exclude = rank.index(max_p)
    if len(use_sports) > 1:
        answer = min(answer, dfs(people, sports, use_sports - {exclude}, answer))
    answer = min(answer, max_p)
    return answer

people, sports = (int(n) for n in input().split(" "))
preference = []
for _ in range(people):
    pre = [int(n) - 1 for n in input().split(" ")]
    preference.append(pre)
answer = float("inf")
use_sports = {n for n in range(sports)}
print(dfs(people, sports, use_sports, answer))


Measured memory_bytes: 7284
import heapq
A=[]
heapq.heapify(A)
while(True):
    com = input().split()
    if com[0] == "insert":
        heapq.heappush(A, -int(com[1]))
    elif com[0] == "extract":
        tmp = heapq.heappop(A)
        print(-tmp)
    else:
        break


Measured memory_bytes: 45308
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
    using pii = pair<int, int>;
    int x1, y1, x2, y2;
    int N;
    cin >> x1 >> y1 >> x2 >> y2 >> N;
 
    int sx = min(x1, x2), tx = max(x1, x2);
    int sy = min(y1, y2), ty = max(y1, y2);
    
    vector<pii> v;
    vector<int> X(N), Y(N);
    for (int i = 0; i < N; i++) {
        cin >> X[i] >> Y[i];
        if (sx <= X[i] && X[i] <= tx && sy <= Y[i] && Y[i] <= ty) {
            v.emplace_back(X[i], Y[i]);
        }
    }
 
    int n = v.size();
    if (x1 > x2) {
        swap(x1, x2);
        for (int i = 0; i < n; i++) {
            v[i].first *= -1;
        }
    }
 
    if (y1 > y2) {
        swap(y1, y2);
        for (int i = 0; i < n; i++) {
            v[i].second *= -1;
        }
    }
    sort(v.begin(), v.end());
 
    constexpr int INF = 1145141919;
 
    vector<int> dp(n, INF);
    for (int i = 0; i < n; i++) {
        int c = v[i].second;
        *lower_bound(dp.begin(), dp.end(), c) = c;
    }
 
    constexpr double PI = acos(-1);
    int m = lower_bound(dp.begin(), dp.end(), INF) - dp.begin();
    double ans = (tx - sx + ty - sy) * 100.0 - (20.0 - 5.0 * PI) * m;
    if (min(tx - sx, ty - sy) + 1 == m) {
        ans += 5 * PI;
    }
    printf("%.15f\n", ans);    
    return 0;
}

Measured memory_bytes: 4208
#include <stdio.h>

int main(void) {
	int r, g, b;
	int x;
	scanf("%d%d%d", &r, &g, &b);
	x = r*100+g*10+b;
	if(x%4 == 0)
		printf("YES\n");
	else printf("NO\n");
	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define sz(x) (ll)(x).size()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;
typedef vector<ll> vl;
typedef vector<P> vp;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

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

  ll n;
  cin >> n;
  vector<ll> a(n),b(n),c(n);
  rep(i,n) {
    cin >> a[i];
  }
  rep(i,n) {
    cin >> b[i];
  }
  rep(i,n) {
    cin >> c[i];
  }
  sort(all(a));
  sort(all(b));
  sort(all(c));
  ll ans = 0;
  rep(i,n) {
    ll m = b[i];
    ll l = lower_bound(all(a),m) - a.begin(); // left count. smaller.
    ll r = n - (upper_bound(all(c),m) - c.begin()); // right count. larger.

    ll now = l*r;
    ans += now;
  }
  cout << ans << endl;
}


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

const long long MOD = 1000000007;

void solve(long long N, long long M, std::vector<long long> S, std::vector<long long> T){
    vector<vector<long long>> A(N+1, vector<long long>(M+1));
    vector<vector<long long>> B(N+1, vector<long long>(M+1));
    vector<vector<long long>> C(N+1, vector<long long>(M+1));
    A[0][0]=1;
    for(int j=0;j<=M;++j)B[0][j]=1;
    for(int i=0;i<N;++i)for(int j=0;j<=M;++j)C[i][j]=1;
    for(int i=0;i<N;++i){
        for(int j=0;j<M;++j){
            if(S[i]==T[j]){
                A[i+1][j+1] = C[i][j];
                A[i+1][j+1] %= MOD;
            }
            B[i+1][j+1] = B[i+1][j] + A[i+1][j+1];
            B[i+1][j+1] %= MOD;
        }
        for(int j=-1;j<M;++j){
            C[i+1][j+1] = C[i][j+1] + B[i+1][j+1];
            C[i+1][j+1] %= MOD;
        }
    }
    cout<<C[N][M]<<endl;
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> S(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&S[i]);
    }
    std::vector<long long> T(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&T[i]);
    }
    solve(N, M, std::move(S), std::move(T));
    return 0;
}


Measured memory_bytes: 94336
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPR(i, n) for(int i = (n);i >= 0;i--)
#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define FORR(i, m, n) for(int i = (m);i >= (n);i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());

typedef long long ll;
typedef unsigned long long ull;

const int INF = 99999999;
const ll LINF = 9999999999999;

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
constexpr int dx[] ={1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

void solve() {
  ll n,m;
  vector<LP> ab(100000);
  cin>>n>>m;
  REP(i,n){
    cin >> ab[i].first>>ab[i].second;
  }
  VSORT(ab);
  ll idx = 0;
  ll money=0;
  ll drink=0;
  while(true){
    if(ab[idx].second>0){
      money += ab[idx].first;
      ab[idx].second--;
      drink++;
    }else{
      idx++;
    }
    if(drink==m) break;
  }
  cout << money <<endl;
 }

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(16);
  solve();
  return 0;
}

Measured memory_bytes: 1792
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "functional"
#include "ctime"

using namespace std;

//constexpr long long int MOD = 1000000007;
constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;



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

	cin >> N;
	cout << N * N*N << endl;
}

Measured memory_bytes: 256
#include <cstdlib>
#include <iterator>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cctype>
#include <functional>
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    cout << ((a + b) % 2 == 0 ? (a + b) / 2 : (a + b) / 2 + 1) << endl;
}


Measured memory_bytes: 256
while True:
	n = int(raw_input())
	if n == 0: break
	m = int(raw_input())
	s = [map(int, raw_input().split(",")) for i in range(m)]
	s = sorted(s, key=lambda x:x[2])
	ls = range(n)
	ref = ls[:]
	ans = 0
	while s:
	    x,y,d = s.pop(0)
	    a,b = ref[x],ref[y]
	    if a != b:
	        for j in ls:
	            if ref[j] == a: ref[j] = b
	        ans += d/100 - 1
	print ans 

Measured memory_bytes: 4992
from collections import *
n=int(input())
l=list(map(int,input().split()))
d=defaultdict(int)
for i in l:
    d[i]+=1
c=0
for i in d:
    if(i!=d[i]):
        if(d[i]>i):
            c+=d[i]-i
        else:
            c+=d[i]
print(c)


Measured memory_bytes: 101664
#include<cstdio>
int gcd_euclid(int u, int v) {
  int r;
  while (0 != v) {
    r = u % v; u = v; v = r; /* swap */
  }
  return u;
}
int main(){
	int N, M;
	scanf("%d %d\n", &N, &M);
	char S[N + 1], T[M + 1];
	scanf("%s", S);
	scanf("%s", T);
	int gcd = gcd_euclid(N, M);
	long long answer = (long long)N/gcd*M;
	int a = N/gcd, b = M/gcd;
	for (int i = 0; i < gcd; ++i){
		if(S[a*i] != T[b*i]){
			printf("-1\n");
			return 0;
		}
	}
	printf("%lld\n", answer);
	return 0;
}

Measured memory_bytes: 256
from sys import stdin


def main() -> None:
    n, m, x = [int(s) for s in input().split()]
    up = down = 0
    for i in range(m):
        ai = int(next_str())
        if ai < x:
            down += 1
        else:
            up += 1

    print(min(up, down))


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct node{
	unsigned int key;
	struct node *next;
	struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
	NodePointer cur = nil->next;
	while(1){
		if ( cur == nil ) break;
		if (cur->key == key) return cur;
		cur = cur->next;
	}
	return nil;
}

void init(){
	nil = (NodePointer) malloc(sizeof(struct node));
	nil->next = nil;
	nil->prev = nil;
}

void printList(){
	NodePointer cur = nil->next;
	int isf = 1;
	while(1){
		if ( cur == nil ) break;
		if ( isf == 0)	printf(" ");
		printf("%d", cur->key);
		cur = cur->next;
		isf = 0;
	}
	printf("\n");
}

void deleteNode(NodePointer t){
	if (t == nil) return;
	t->prev->next = t->next;
	t->next->prev = t->prev;
	free(t);
}

void deleteFirst(){
	NodePointer t = nil->next;
	if ( t == nil ) return;
	deleteNode(t);
}

void deleteLast(){
	NodePointer t = nil->prev;
	if ( t == nil ) return;
	deleteNode(t);
}

void delete(int key){
	NodePointer t = listSearch(key);
	deleteNode(t);
}


void insert(int key){
	NodePointer x;
	x = malloc(sizeof(struct node));
	x->key = key;
	x->next = nil->next;
	x->prev = nil;
	if (nil->prev == nil) {
		nil->prev = x;
	}

	nil->next->prev = x;
	nil->next = x;
}

int main(){
	int key, n, i;
	int size = 0;
	char com[20];
	int np = 0, nd = 0;
	scanf("%d", &n);
	init();
	for ( i = 0; i < n; i++ ){
		scanf("%s%d", com, &key);
		if ( com[0] == 'i' ) {insert(key); np++; size++;}
		else if ( com[0] == 'd' ) {
			if (strlen(com) > 6){
				if ( com[6] == 'F' ) deleteFirst();
				else if ( com[6] == 'L' ) deleteLast();
			} else {
				delete(key); nd++; 
			}
			size--;
		}
	}
	printList();
	return 0;
}



Measured memory_bytes: 32956
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = long long;
using PAIR = pair<int64, int64>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 3e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

signed main() {
  INIT;
  VAR(int,n,k);
  if (k==1) {
    OUT(0)BR;
    return 0;
  }
  OUT(n-k)BR;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
#define pb(a) push_back(a)
#define rd(a) cin>>(a)
#define RD(a,b) cin>>(a)>>(b)
#define pr(a) cout<<(a)<<endl
#define PR(a,b) cout<<(a)<<" "<<(b)<<endl
#define F first
#define S second
#define ll long long
bool check(int n,int m,int x,int y){return (x<0||x>=n||y<0||y>=m)?false:true;}
const ll MAX=1000000007,MAXL=1LL<<60,dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
typedef pair<int,int> P;

int solve(int n, int m) {
  if(n==1) return 0;
  return (solve(n-1,m)+m)%n;
}

int main() {
  int n,m,k;
  while(cin >> n >> m >> k && n) {
    pr((solve(n-1,m)+k)%n+1);
  }
  return 0;
}


Measured memory_bytes: 1468
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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 int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
ll N;

map<ll, ll> prime_factor(ll n)
{
    map<ll, ll> res;
    for (ll i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            res[i]++;
            n /= i;
        }
    }
    if (n != 1) {
        res[n]++;
    }
    return res;
}

ll divs[2010101];

int main()
{
    cin >> N;
    ll ans = 1;

    auto res = prime_factor(N - 1);
    for (auto e : res) {
        auto k = e.first;
        auto v = e.second;
        ans *= v + 1;
    }
    ans--;

    ll cnt = 0;
    for (ll i = 2; i * i <= N; i++) {
        if (N % i == 0) {
            divs[cnt] = i;
            cnt++;
        }
    }

    for (int i = 0; i < cnt; i++) {
        ll d = divs[i];
        ll nn = N;
        while (nn % d == 0) {
            nn /= d;
        }
        if ((nn - 1) % d == 0) {
            ans++;
        }
    }

    ans++;

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main()
{
	string S;
	cin >> S;
	const int N = S.size();
	vector<int> dst(N, -1);
	vector<int> ans(N, 0);

	for (int i = 0; i + 1 < N; ++i) {
		if (S[i] == 'R' && S[i + 1] == 'L') {
			dst[i] = i;
			dst[i + 1] = i + 1;
		}
	}
	for (int i = 0; i < N; ++i) {
		if (dst[i] < 0 && S[i] == 'L') {
			dst[i] = dst[i - 2];
		}
	}
	for (int i = N - 1; i >= 0; --i) {
		if (dst[i] < 0 && S[i] == 'R') {
			dst[i] = dst[i + 2];
		}
	}

	for (int i = 0; i < N; ++i) {
		++ans[dst[i]];
	}
	for (auto x : ans) {
		cout << x << " ";
	}
	cout << endl;
}


Measured memory_bytes: 1408
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  int a, b; cin >> a >> b;
  printf("%.10lf\n", (double)a * b / (a + b) );
  return 0;
}

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

#define rep(i, from, to) for(int i = from; i < to; ++i)
#define REP(i, from, to) for(int i = from; i <= to; ++i)

#ifdef MyDebug
#define debug(x) cerr << #x << " : "<< x << endl;
#else
#define debug(x)
#endif
struct edge {
	int to, cap, rev;
};

using namespace std;
const int MAX_V = 1002;
const int INF = (int)1e9;
//a < b
vector<edge> g[MAX_V];
bool used[MAX_V];


void add_edge(int from, int to, int cap) {
	g[from].push_back((edge){to, cap, (int)g[to].size()});
	g[to].push_back((edge){from, 0, (int)(g[from].size() - 1)});
}

int dfs(int v, int t, int f) {
	if (v == t) return f;
	used[v] = true;
	rep(i, 0, (int)g[v].size()) {
		edge &e = g[v][i];
		if (!used[e.to] && e.cap > 0) {
			int d = dfs(e.to, t, min(f, e.cap));
			if (d > 0) {
				e.cap -= d;
				g[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

int max_flow(int s, int t) {
	int flow = 0;
	while(true) {
		fill(used, used + MAX_V, false);
		int f = dfs(s, t, INF);
		if (f == 0) return flow;
		flow += f;
	}
}

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

void init() {
	rep(i, 0, MAX_V) {
		g[i] = vector<edge>();
	}
}

int m, n;
int b[500], r[500];
void solve() {
	while(cin >> m >> n, m != 0 || n != 0) {
		init();
		rep (i, 0, m) {
			cin >> b[i];
		}
		rep (i, 0, n) {
			cin >> r[i];
		}
		int s = m + n;
		int t = s + 1;
		rep (i, 0, m) add_edge(s, i, 1);
		rep (i, m, m + n) add_edge(i, t, 1);
		rep (i, 0, m) {
			rep (j, 0, n) {
				int tmp = gcd(b[i], r[j]);
				if (tmp != 1) {
					add_edge(i, m + j, 1);
				}
			}
		}
		cout << max_flow(s, t) << endl;
	}
}

void test() {
	cerr << gcd(92, 20) << endl;
}

int main() {
	solve();
	//test();
	return 0;
}

Measured memory_bytes: 9388
func readArrayInt() -> [Int] {
    readLine()!.split(separator: " ").map({Int($0)!})
}

// input
var line = readArrayInt()
let (N, M, X) = (line[0], line[1], line[2])
var C: [Int] = []
var A: [[Int]] = []
(1...N).forEach({ _ in
    line = readArrayInt()
    C.append(line[0])
    A.append(Array(line[1...M]))
})

// main
func allAchived(_ bits: Int) -> Bool {
    var achieved = Array(repeating: 0, count: M)
    (0..<N).forEach({ place in
        if ((1 << place & bits) > 0) {
            for (i, value) in A[place].enumerated() {
                achieved[i] += value
            }
        }
    })
    return !achieved.contains(where: {$0 < X})
}

func cost(_ bits: Int) -> Int {
    var cost = 0
    (0..<N).forEach({ i in
        if ((1 << i & bits) > 0) {
            cost += C[i]
        }
    })
    return cost
}

var ans = -1
(1..<(1 << N)).forEach { bits in
    if (allAchived(bits)) {
        ans = ans < 0 ? cost(bits) : min(cost(bits), ans)
    }
}

print(ans)


Measured memory_bytes: 8292
#include <stdio.h>

int main()
{
    int n,k;scanf("%d%d",&n,&k);
    int ans=0;
    for (int i=0;i<n;i++)
    {
        int t;scanf("%d",&t);
        if (t>=k) ans++;
       // printf("%d ",ans);
    }
    printf("%d\n",ans);


}



Measured memory_bytes: 128
#include<vector>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

const int MOD = 1000000007;

int main() {
	int n;
	scanf("%d", &n);
	int cur = 0, ans = 1;
	for (int i = 0; i < n; ++i) {
		int x, pos = cur * 2 + 1;
		scanf("%d", &x);
		if (x >= pos) {
			++cur;
		} else {
			ans = (long long)ans * (cur + 1) % MOD;
		}
	}
	while (cur) {
		ans = (long long)ans * cur % MOD;
		--cur;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

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

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

int main(void) {
	string s;
	int count = 0;
	int size = 0;

	cin >> s;

	size = s.size();

	FOR(i, 0, size - 1) {
		if (s[i] == 'o') {
			count++;
		}
	}

	size = 15 - size;

	if (size + count >= 8) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	

	return 0;
}

Measured memory_bytes: 256
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")

#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

using namespace std;

typedef pair <int, int> pii;
typedef pair <long long, long long> pll;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector <vector <ll>> matrix;

#define endl "\n"
#define mt make_tuple
#define mp make_pair

template <typename T1, typename T2>
bool umax(T1 &a, const T2&b) { return a < b ? a = b, 1 : 0;}
template <typename T1, typename T2> 
bool umin(T1 &a, const T2 &b) {return a > b ? a = b, 1 : 0;}
template <typename T>
T sqr(T a) {return a * a;}
const int mod = 1000000007;
template <typename T1, typename T2>
void modadd(T1 &a, const T2 &b) {
    a += b;
    
    if (a >= mod)
        a -= mod;
}

mt19937 rng(20010709);
const int INF = 1000000001;
const int N = 1 << 21;

int d;
string K;
vector <int> k;
int dp[100005][105][2];

int f(vector <int> n);

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

    cin >> K >> d;

    for (int i = K.size() - 1; i > -1; i--)
        k.push_back(K[i] - '0');

    cout << f(k) << endl;

    return 0;
}

int f(vector <int> n) {
    fill(dp[0][0], dp[n.size()][d - 1] + 2, 0);

    for (int i = 1; i < n.back(); i++) {
        modadd(dp[n.size() - 1][i % d][0], 1);
    }

    modadd(dp[n.size() - 1][n.back() % d][1], 1);

    for (int i = n.size() - 2; i > -1; i--) {
        for (int cur = 1; cur < 10; cur++)
            modadd(dp[i][cur % d][0], 1);

        for (int cur = 0; cur < 10; cur++) {
            for (int pr = 0; pr < d; pr++)
                modadd(dp[i][(cur + pr) % d][0], dp[i + 1][pr][0]);
        }

        for (int pr = 0; pr < d; pr++) {
            modadd(dp[i][(pr + n[i]) % d][1], dp[i + 1][pr][1]);

            for (int cur = 0; cur < n[i]; cur++)
                modadd(dp[i][(cur + pr) % d][0], dp[i + 1][pr][1]);
        }
    }

    int result = 0;
    modadd(result, dp[0][0][0]);
    modadd(result, dp[0][0][1]);

    return result;
}

Measured memory_bytes: 10624
#ifdef _MSC_VER
#include "stdc++.h"
#endif
#ifdef __GNUC__
#include<bits/stdc++.h>
#endif
using namespace std;

using ll = long long;

//constant
const double EPS = 1e-10;
ll MOD = 1000000007;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// vector
//template<typename T> vector<vector<T>> vv(ll H, ll W, T v) { return vector<vector<T>> vec(H, vector<T>(W, v)); }

// view vector
template<typename T> void view(T e) { cout << e << endl; }
template<typename T> void view(const vector<T>& v) { for (const auto& e : v) { cout << e << " "; } cout << endl; }
template<typename T> void view(const vector<vector<T> >& vv) { for (const auto& v : vv) { view(v); } }
template<typename T> void view2d(const vector<T>& v) { for (const auto& e : v) { cout << e << " "; } cout << endl; }

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

// ***************************************

int main(void) {

	ll N, W;
	cin >> N >> W;

	vector<pair<ll, ll>> item(N);
	ll V = 0;
	for (auto& x : item) {
		cin >> x.first >> x.second;
		V += x.second;
	}

	vector<vector<ll>> dp(N + 1, vector<ll>(V + 1, 1e13));
	for (auto& x : dp) {
		x[0] = 0;
	}

	REP(i, N) {
		ll w = item[i].first;
		ll v = item[i].second;
		FOR(j, 1, V + 1) {
			if (j - v >= 0) {
				chmin(dp[i + 1][j], dp[i][j - v] + w);
				//DEBUG(dp[i + 1][j]);
			}
			chmin(dp[i + 1][j], dp[i][j]);
		}
	}

	for (ll x = V; x >= 0; x--) {
		if (dp[N][x] <= W) {
			cout << x << endl;
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 80256
#include <stdio.h>
#include <math.h>
int main()
{
    int n,m,i,g=1,max=0;
    scanf("%d%d",&n,&m);
    for(i=1; i<=sqrt(m); i++)
    {
        if(m%i == 0)
        {
            if(m/i >=n)
                g = i;
            if(i >= n)
                g = m / i;
        }
        if(g > max)
            max = g;

    }
    printf("%d",max);
}


Measured memory_bytes: 128
#include<stdio.h>
#define ll long long
const int maxn=1300;
const int inf=-0x3f3f3f;

ll gcd(int a,int b){return b==0?a:gcd(b,a%b);}
ll lcm(int a,int b){return gcd(a,b)/a*b;}


int main()
{
	ll n,k,s;
	scanf("%lld%lld%lld",&n,&k,&s);
	for(int i=1; i<=k; i++) printf("%lld ",s);
	
	if(s ==1e9)
	 for(int i=1; i<=n-k; i++) printf("5 ");
	else
	 for(int i=1; i<=n-k; i++) printf("%lld ",s+1);
	return 0;
 } 

Measured memory_bytes: 1280
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container, std.range;

enum P = 10L^^9+7;

void main()
{
    auto nm = readln.split.to!(int[]);
    auto N = nm[0];
    auto M = nm[1];

    auto ab = new bool[][](2, N*M);
    foreach (a; readln.split.to!(int[])) {
        if (ab[0][a-1]) {
            writeln(0);
            return;
        }
        ab[0][a-1] = true;
    }
    foreach (b; readln.split.to!(int[])) {
        if (ab[1][b-1]) {
            writeln(0);
            return;
        }
        ab[1][b-1] = true;
    }

    long n, m, b, r = 1;
    foreach_reverse (i; 0..N*M) {
        if (ab[0][i] && ab[1][i]) {
            n += 1;
            m += 1;
        } else if (ab[0][i]) {
            n += 1;
            (r *= m) %= P;
        } else if (ab[1][i]) {
            m += 1;
            (r *= n) %= P;
        } else {
            (r *= (m*n-b)) %= P;
        }
        b += 1;
    }
    writeln(r);
}

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

#define rep(X,N) for(ll X = 0LL; X < (N); X++)
#define ALL(V) (V).begin(),(V).end()
#define endl "\n"

using namespace std;
typedef long long ll;

const double PI = 3.1415926535897932384626;
const ll MODN = 1000000007;
const ll MODN2 = 998244353;
const double EPS = 1e-10;

int main(){

    ll s;
    cin >> s;

    ll x2 = s / 1000000000;
    ll y2 = s % 1000000000;

    if(y2 != 0){
        y2 = 1000000000 - y2;
        x2++;
    }

    cout << "0 0 1 1000000000 " << x2 << " " << y2;

    return 0;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
// #include <boost/lexical_cast.hpp>
using namespace std;


#define ll long long int
#define vll vector<ll>
#define vllv vector<vector<ll>> 
#define sz size()
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

ll ceil1(ll n,ll m){if(n%m==0){return n/m;}return n/m +1;}
vll factor(ll n){
    vll ans;
    if(n>0)ans.pb(1);if(n==2)ans.pb(2);
    for(ll i=2;i*i<=n;i++){if(n%i==0){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}if(n>2)ans.pb(n);
    return ans;
}
ll fact(ll n){
	
    ll res = 1; 
    for (ll i = 2; i <= n; i++) 
        res = res * i; 
    return res; 
} 
  
int nCr(ll n, ll r) 
{ 
    return fact(n) / (fact(r) * fact(n - r)); 
} 
  
void dfs(vllv &v,ll k,vll &par,vll &dis,ll p)
{
 
    par[k]=p;
    dis[k]=dis[p]+1;
    for(ll i=0;i<v[k].sz;i++){
        if(v[k][i]!=p){
            dfs(v,v[k][i],par,dis,k);
        }
    }
}
bool sortbysec(const pair<string,int> &a,const pair<string,int> &b){return (a.second<b.second);} 


ll ston(string s) 
{ 
    stringstream geek(s); 
    ll x = 0; 
    geek >> x; 
    
  
    return x; 
}
ll pow2(ll n,ll k){ll ans=1;
    while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;}
bool prime(int n){
    int i,j;
    for(i=2;i<=sqrt(n);i++){
        if(n%i==0){
            return false;
        }
    }
    return true;
}
bool bserch(vector<string> a, string s){
	
	ll l=0,r=a.sz-1,mid;
	while(l<=r){
		mid=(l+r)/2;
		if(a[mid]==s)return true;
		if(a[mid]<s){
			l=mid+1;
		}else{
			r=mid-1;
		}
	}
	return false;
}

bool sortcol( const vector<int>& v1, 
               const vector<int>& v2 ) { 
 return v1[0] < v2[0]; 
} 

 ll degit(ll n)
 {
 	ll t=0;
 	while(n>0)
 	{
 		t++;
 		n/=10; 	}
 		return t;
 }
 

void solve()
{
	ll n;
	cin>>n;
	cout<<n*n*n;
	return;	
}

int main()
{
	fast;
    ll q;
    q=1;
    // cin>>q;
    while(q--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
from collections import Counter
def main():
    mod = 10**9+7
    n = int(input())
    a = list(map(int,input().split(' ')))
    c = Counter(a)
    ans = 1
    if n%2 != 0:
        for key,i in c.items():
            if key%2 != 0 or (key==0 and i != 1) or (key != 0 and i != 2):
                ans = 0
                break
            elif i ==2:
                ans *=2
                ans %= mod
    else:
        for key,i in c.items():
            if key%2 ==0 or i !=2:
                ans = 0
                break
            elif i ==2:
                ans *=2
                ans %= mod
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 14812
#include <iostream>

using namespace std;

int main(){
    int A,B,C;
    cin >> A >> B >> C;
    if(A == B && B != C){
        cout << "Yes" << endl;
    }else if(A == C && A != B){
        cout << "Yes" << endl;
    }else if(B == C && A != B){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

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

const int N = 200005, mo = 1000000007;

typedef long long LL;
int n;
int a[N];

int main() {
	cin >> n;
	for (int i = 1; i <= n; ++i) cin >> a[i];
	int d = 0, p = 0;
	LL ans = 1;
	for (int i = 1; i <= n; ++i){
		d = max(i - ((a[i - 1] + 1) >> 1) - 1, d);
		(ans *= 1ll * (i - d)) %= mo;
	}
	cout << ans << endl;
	return 0;
}


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

#define ll long long

ll mod = 1e9 + 7;

int main(){
  ll n;
  cin>>n;
  ll count = 1%mod;
  for (ll i=2;i<=n;++i){
    count=count*i%mod;
  }
  cout<<count;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

struct UnionFind{
    vint v;
    UnionFind(int n){ v.assign(n,-1); }
    int  find(int x){ return v[x]<0? x:v[x]=find(v[x]); }
    void unite(int x,int y){
        x=find(x),y=find(y); if(x==y) return;
        if(v[x]>v[y]) swap(x,y); v[x]+=v[y],v[y]=x;
    }
    int  size(int x){ return -v[find(x)]; }
    bool same(int x,int y){ return find(x)==find(y); }
    bool root(int x){ return v[x]<0; }
};

struct edge{
    int u,v,cost;
    bool operator<(const edge& e){
        return cost<e.cost;
    }
};

int V,E;
vector<edge> es;

int kruskal()
{
    sort(ALL(es));
    UnionFind tree(V);
    int res=0;
    for(edge e:es){
        if(!tree.same(e.u,e.v)){
            tree.unite(e.u,e.v);
            res+=e.cost;
        }
    }
    return res;
}

signed main()
{
    cin>>V>>E;
    REP(i,E){
        int a,b,c; cin>>a>>b>>c;
        es.push_back((edge){a,b,c});
    }
    cout<<kruskal()<<endl;
}



Measured memory_bytes: 5988
#include <iostream>
#include <vector>
#include <utility>
#include <numeric>
#include <functional>
#include <stdio.h>
#include <math.h>
#include <string>
#include <algorithm>
#include <deque>
#include <queue>

#define rep(i, m, n) for (int (i)(m); (i)<(n); ++(i))
#define repv(i, v) for (unsigned (i)(0); (i)<(v.size()); ++(i))
#define all(v) (v).begin(), (v).end()
#define sortv(v) sort(all(v))
#define sortgi(v) sort(all(v), greater<int>())
#define sortgd(v) sort(all(v), greater<double>())
#define sortgll(v) sort(all(v), greater<ll>())
#define debug(x) cerr << #x << ": " << x << '\n'

using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using ll = long long;
using pllll = pair<ll, ll>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using pqi = priority_queue<int>;
using pqd = priority_queue<double>;
using pqll = priority_queue<ll>;
using pqvi = priority_queue<vi>;
using pqvll = priority_queue<vll>;

ll GCD(ll a, ll b) {
	ll c = max(a, b);
	ll d = min(a, b);
	while (c%d != 0) {
		ll t = d;
		d = c % d;
		c = t;
	}
	return d;
}

int main(){
	int T;
	cin >> T;
	vvll v;
	rep(i, 0, T) { 
		ll a, b, c, d;
		cin >> a >> b >> c >> d;
		v.push_back({a,b,c,d});
	}
	repv(i, v) {
		ll a = v[i][0], b = v[i][1], c = v[i][2], d = v[i][3];
		if (a < b || b > d) {
			cout << "No" << endl;
			continue;
		}
		else if (a%b == 0 && d%b == 1) {
			 if (b - 1 > c) {
				 cout << "No" << endl;
				 continue;
			 }
		}
		else if (d%b == 0) {
			if (a%b > c) {
				cout << "No" << endl;
				continue;

			} 
		}
		else {
			ll G =GCD(b, d%b); 
			if (b%G == 0) {
				if (b - G > c) {
					cout << "No" << endl;
					continue;
				}
			}
			else if (b - (b - a%b)%G > c ) {
				cout << "No" << endl;
				continue;
			}
		}
		cout << "Yes" << endl;
	}
}


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

int main(){
    int t,i;
    string b;

    cin >> t;

	for(i=1;i<1000;i++){
		if ((360*i)%t==0){
			cout << (360*i)/t ;
			break;
		}
	}
       
        		
        }
    


    





Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define rep0(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep1(i,n) for(long long i=1;i<=(long long)(n);i++)
#define all(v) v.begin(),v.end()
#define Sort(v) sort(all(v))
#define Reverse(v) reverse(all(v))
#define Rsort(v) sort(all(v),greater)
#define pub(v) push_back(v)
#define pob(v) pop_back(v)
typedef long long ll;
typedef vector<ll> vel;
typedef vector<vector<ll>> vel2d;
typedef string str;
typedef pair<ll,ll> pal;
typedef vector<str> ves;
typedef vector<char> vech;


int main() {
    ll A,B,C,K;
    cin>>A>>B>>C>>K;
    if(K%2==1&&abs(A-B)<=1000000000000000000){
        cout<<B-A<<endl; return 0;
    }
    if(abs(A-B)>1000000000000000000){
        cout<<"Unfair"<<endl; return 0;
    }
    else if(K%2==0){
        cout<<A-B<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define maxN 5200005
#define inf (int) 1e9 + 50
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define REP(i, a, b) for(int i = a; i >= b; i--)

using namespace std;

int n, q;
int u[maxN], v[maxN];
int a[maxN], b[maxN], c[maxN], ans[maxN];
vector <int> g[maxN], gid[maxN];

void update(int u, int v) {
    while(u <= n) {
        b[u] += v;
        u += u & -u;
    }
}

int get(int u) {
    int ans = 0;
    while(u) {
        ans += b[u];
        u -= u & -u;
    }
    return ans;
}

int s(int u, int v) {
    return get(v) - get(u - 1);
}

void enter() {
    cin >> n >> q;
    FOR(i, 1, n) cin >> a[i];
    FOR(i, 1, q) {
        cin >> u[i] >> v[i];
        g[v[i]].push_back(u[i]);
        gid[v[i]].push_back(i);
    }
}

void solve() {
    FOR(i, 1, n) {
        if(c[a[i]]) update(c[a[i]], -1);
        update(i, 1);
        c[a[i]] = i;
        int siz = g[i].size() - 1;
        FOR(k, 0, siz) {
            int id = gid[i][k], u = g[i][k];
            ans[id] = s(u, i);
        }
    }
    FOR(i, 1, q) cout << ans[i] << endl;
}

int main() {
    //freopen("main.inp", "r", stdin);
    enter();
    solve();
}


Measured memory_bytes: 277664
#include <iostream>
#include <algorithm>
#include <math.h>
#include <cstdio>
using namespace std;
typedef long long ll;
 
int main() {
	ios_base::sync_with_stdio(false);
	ll n;
	cin>>n;
	int a1,a2,a3,a4;
	a1=n%10;
	a2=(n%100-a1)/10;
	a3=(n%1000-a2-a1)/100;
	a4=(n-a3-a2-a1)/1000;
	if(a1+a2+a3+a4==7){
		cout<<a4<<"+"<<a3<<"+"<<a2<<"+"<<a1<<"=7";
		return 0;
	}
	if(a4+a3+a2-a1==7){
		cout<<a4<<"+"<<a3<<"+"<<a2<<"-"<<a1<<"=7";
		return 0;
	}
	if(a4+a3-a2+a1==7){
		cout<<a4<<"+"<<a3<<"-"<<a2<<"+"<<a1<<"=7";
		return 0;
	}
	if(a4+a3-a2-a1==7){
		cout<<a4<<"+"<<a3<<"-"<<a2<<"-"<<a1<<"=7";
		return 0;
	}
	if(a4-a3+a2+a1==7){
		cout<<a4<<"-"<<a3<<"+"<<a2<<"+"<<a1<<"=7";
		return 0;
		
	}
	if(a4-a3+a2-a1==7){
		cout<<a4<<"-"<<a3<<"+"<<a2<<"-"<<a1<<"=7";
		return 0;
	}
	if(a4-a3-a2+a1==7){
		cout<<a4<<"-"<<a3<<"-"<<a2<<"+"<<a1<<"=7";
		return 0;
	}
	if(a4-a3-a2-a1==7){
		cout<<a4<<"-"<<a3<<"-"<<a2<<"-"<<a1<<"=7";
	
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define fast  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define mod 1000000007  
int32_t main()
{
	fast;
	int a[3][3];
	map<int ,pair<int ,int > > m;
	for(int i=0;i<3;i++)
	{
		for(int j=0;j<3;j++)
		{
			cin>>a[i][j];
			m[a[i][j]]={i,j};
		}
	}
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
		{
			int x;
			cin>>x;
			if(m.find(x)!=m.end())
			{
				a[m[x].first][m[x].second]=-1;
			}
		}
		if(a[0][0]==-1 and a[0][1]==-1 and a[0][2]==-1)
			cout<<"Yes";
		else if(a[1][0]==-1 and a[1][1]==-1 and a[1][2]==-1)
			cout<<"Yes";
		else if(a[2][0]==-1 and a[2][1]==-1 and a[2][2]==-1)
			cout<<"Yes";
		else if(a[0][0]==-1 and a[1][0]==-1 and a[2][0]==-1)
			cout<<"Yes";
		else if(a[0][1]==-1 and a[1][1]==-1 and a[2][1]==-1)
			cout<<"Yes";
		else if(a[0][2]==-1 and a[1][2]==-1 and a[2][2]==-1)
			cout<<"Yes";
		else if(a[0][0]==-1 and a[1][1]==-1 and a[2][2]==-1)
			cout<<"Yes";
		else if(a[0][2]==-1 and a[1][1]==-1 and a[2][0]==-1)
			cout<<"Yes";
		else 
			cout<<"No";
	
}

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

int main() {
	double N;
	cin >> N;
	double ans = N / 1.08;
	int tmp = (int)ans;
	if (tmp * 1.08 == N) {
		cout << tmp << endl;
	} else if ((int)((tmp + 1) * 1.08) == N){
		cout << tmp + 1 << endl;
	} else {
		cout << ":(" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin() , v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)


int main() {
	int n, h, w; cin >> n >> h >> w;
	int cnt = 0;
	rep(i, n) rep(j, n) {
		if (i + w <= n && j + h <= n) cnt++;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc092/tasks/arc093_a

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

ll N, a, la = 0, A[100001], sum = 0;

int main()
{
  cin >> N;
  A[0] = 0;
  REP(i, N)
  {
    cin >> a;
    A[i + 1] = a;
    sum += abs(la - a);
    la = a;
  }
  A[N + 1] = 0;
  sum += abs(A[N]);

  REP(i, N)
  {
    ll c = sum - (abs(A[i] - A[i + 1]) + abs(A[i + 1] - A[i + 2])) + abs(A[i] - A[i + 2]);
    cout << c << '\n';
  }

  return 0;
}


Measured memory_bytes: 2048
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
using namespace std;


int main()
{
    
    while(true){
        int n;
        cin >> n;
        if(n == 0){
            break;
        }
        vector<double> S(n);
        double Sum = 0;
        for(int i = 0; i < n; ++i){
            cin >> S[i];
            Sum += S[i];
        }
        double m = Sum / n;
        double aa = 0;
        for(int i = 0; i < n; ++i){
            aa += pow(S[i] - m, 2);
        }
        double a = sqrt(aa/n);
        cout << fixed << setprecision(4) << a << endl;
    }
    return 0;
}

Measured memory_bytes: 3200
#include<stdio.h>
#include<algorithm>
#include<functional>
#include<cmath>
using namespace std;
long long  mod = 1000000007;
int main()
{
	int N, A;
	scanf("%d%d", &N, &A);
	int m = N % 500;
	if (A >= m) {
		printf("Yes");
	}
	else {
		printf("No");
	}
	return 0;
}

Measured memory_bytes: 128
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
cd = [list(map(int, input().split())) for _ in range(m)]

for i in range(n):
    mn = 10 ** 9
    ans = 0
    for j in range(m):
        diff = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1])
        if diff < mn:
            mn = diff
            ans = j + 1
    print(ans)


Measured memory_bytes: 3316
<?php
  $n = trim(fgets(STDIN)) ;
  $height = explode(' ',trim(fgets(STDIN))) ;
  $height[-1] = 0 ;
$c = 0 ;
$k = 0 ;
for($i=0;$i<$n;$i++){
if($height[$i] > $height[$i-1]){
$ans[$k] = $c ;
  $c = 0 ;
  $k++ ;
  continue ;
}
  $c++ ;
}
$ans[$k] = $c ;
echo max($ans) ;

Measured memory_bytes: 35308
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b / gcd(a,b);}

int main() {
    int a,b,c,d,e,k;
    cin >> a >> b >> c >> d >> e >> k;
    if (e-a <= k) {
        cout << "Yay!" << "\n";
    } else {
        cout << ":(" << "\n";
    }
}


Measured memory_bytes: 256
#include<stdio.h>
int main() {
	int n, i, a, b, c;
	scanf("%d", &n);
	for (i = 0;i < n;i++) {
		scanf("%d %d %d", &a, &b, &c);
		if ((a*a + b*b == c*c) || (a*a + c*c == b*b) || (b*b + c*c == a*a)) {
			printf("YES\n");
		}
		else {
			printf("NO\n");
		}
	}
	return 0;
}

Measured memory_bytes: 580
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n = in.nextInt();
		int k = in.nextInt();
		int[] a = getIntArr(in, n);
		boolean r = solve(n, k, a);
		System.out.println(r ? "First" : "Second");
		in.close();
	}

	private static boolean solve(int n, int k, int[] a) {
		boolean[] dp = new boolean[k + 1];
		for (int i = 1; i <= k; i++) {
			for (int j = 0; j < a.length; j++) {
				if (i >= a[j] && !dp[i - a[j]]) {
					dp[i] = true;
					break;
				} else if (i < a[j]) {
					break;
				}
			}
		}

		return dp[k];
	}

	static String str(int[] a) {
		String[] str = new String[a.length];
		for (int i = 0; i < a.length; i++) {
			str[i] = a[i] + "";
		}
		return String.join(" ", str);
	}

	static int[] getIntArr(Scanner in, int size) {
		int[] arr = new int[size];
		for (int i = 0; i < size; i++) {
			arr[i] = in.nextInt();
		}
		return arr;
	}

	static int[][] getIntArr(Scanner in, int row, int col) {
		int[][] arr = new int[row][];
		for (int i = 0; i < row; i++) {
			arr[i] = getIntArr(in, col);
		}
		return arr;
	}

	static char[] getCharArr(Scanner in, int size) {
		char[] arr = in.next().toCharArray();
		return arr;
	}

	static String[] getStringArr(Scanner in, int size) {
		String[] arr = new String[size];
		for (int i = 0; i < size; i++) {
			arr[i] = in.next();
		}
		return arr;
	}

	static Map<Integer, List<Integer>> getEdges(Scanner in, int size, boolean directed) {
		Map<Integer, List<Integer>> edges = new HashMap<>();
		for (int i = 0; i < size; i++) {
			int from = in.nextInt();
			int to = in.nextInt();
			if (!edges.containsKey(from)) {
				edges.put(from, new ArrayList<Integer>());
			}
			edges.get(from).add(to);
			if (!directed) {
				if (!edges.containsKey(to)) {
					edges.put(to, new ArrayList<Integer>());
				}
				edges.get(to).add(from);
			}

		}
		return edges;
	}
}


Measured memory_bytes: 24020
#include<bits/stdc++.h>
#define mod 1000000007
#define MOD(x) ((x)%mod)
#define pii pair<int,int>
#define mp(a,b) make_pair(a,b)
using namespace std;
int n,m;
int b[30];
int a[30][30];
int now,last;
long long dp[2][4000005];
void dfs(int x,int s,int num)
{
	if(num==m)
	{
		for(int i=1;i<=n;i++)
			if((s&b[i])&&(a[m][i]))
				dp[now][s]=MOD(dp[now][s]+dp[last][s^b[i]]);
		return;
	}
	for(int i=x;i<=n;i++)
		dfs(i+1,s|b[i],num+1);
}
int main()
{
	scanf("%d",&n);
	b[1]=1;
	int all=1;
	for(int i=2;i<=n;i++)
	{
		b[i]=(b[i-1]<<1);
		all|=b[i];
	}
	memset(dp,0,sizeof dp);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			scanf("%d",&a[i][j]);
	dp[now][0]=1;
	for(int i=1;i<=n;i++)
	{
		last=now;
		now=!last;
		memset(dp[now],0,sizeof dp[now]);
		m=i;
		dfs(1,0,0);
	}
	printf("%lld",dp[now][all]);
	return 0;
}



Measured memory_bytes: 62720
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using itn = int;
using ld = long double;
template<class T>
using vec = vector<T>;

#define FOR(i,a,b) for(int i=((int)(a));i<((int)(b));i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define all(x) (x).begin(),(x).end()


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

  int ans=0;
  if(a >= 13){
    ans = b;
  }else if(a >= 6 && a <= 12){
    ans = b/2;
  }else{
    ans = 0;
  }

  cout <<ans <<endl;
}


Measured memory_bytes: 256
<?php 

fscanf(STDIN,"%d",$n);
$s_li = array();
for($i=0;$i<$n;$i++){
  $s_li[] = trim(fgets(STDIN));
}
$common = array();
$char_count = array();
foreach($s_li as $k=>$s){
  for($i=0;$i<strlen($s);$i++){
    $char_count[$k][$s[$i]]++;
  }  
}

$common = $char_count[0];
for($i=1;$i<count($char_count);$i++){
    foreach($char_count[$i] as $char=>$count){
      if(!isset($common[$char])){
        continue;
      }elseif($common[$char]>$count){
        $common[$char] = $count;
      }
    }
    foreach($common as $k=>$v){
      if(!isset($char_count[$i][$k])){
        $common[$k] = 0;
      }
    }
}
        
ksort($common);
//print_r($common);

foreach($common as $char => $c){
  for($i=0;$i<$c;$i++){
    echo $char;
  }
}


Measured memory_bytes: 4604