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

#define en "\n"
#define INF (int) 9e18
#define HELL (int) (1e9 + 7)
#define int long long
#define double long double
#define uint unsigned long long
#define pii pair<int, int>
#define pb push_back
#define fs first
#define sc second
#define size(a) (int) a.size()
#define deb(x) cerr << #x << " => " << x << en
#define deba(x) cerr << #x << en; for (auto a : x) cerr << a << " "; cerr << en;
#define debp(x) cerr << #x << en; for (auto a : x)cerr<<"("<<a.fs<<", "<<a.sc<<") "; cerr << en;
#define debm(x) cerr << #x << en; for (auto a : x){for(auto b : a) cerr << b << " "; cerr << en;}
#define getMat(x, n, m, val) vector<vector<int>> x(n, vector<int> (m, val))
#define fastio ios_base :: sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define pout cout << fixed << setprecision(10)
int fastpow(int a, int b, int m = HELL) { int res = 1; a %= m;
while (b > 0) { if (b & 1) res = (res * a) % m; a = (a * a) % m; b >>= 1; } return res;}
#define inv(a) fastpow(a, HELL - 2)
#define mul(a, b) ((a % HELL) * (b % HELL)) % HELL

int32_t main() { fastio;
	int n, m;
	cin >> n >> m;
	int arr[n + 1];
	for (int i = 1; i <= n; i++) {
		cin >> arr[i];
	}
	vector<int> adj[n + 1];
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		adj[u].pb(v);
		adj[v].pb(u);
	}
	int count = 0;
	for (int i = 1; i <= n; i++) {
		// if (size(adj[i]) == 0) {
		// 	count--;
		// } 
		// else {
			bool found = true;
			for (auto x : adj[i]) {
				if (arr[x] >= arr[i]) {
					found = false;
					break;
				}
			}
			// if (found) deb(i);
			count += found;
		// }
	}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 10276
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;

struct cake_i {
    ll x;
    ll y;
    ll z;
};

inline ll value(const cake_i &w, const cake_i &c) {
    return w.x * c.x + w.y * c.y + w.z * c.z;
}

cake_i wl(int i) {
    cake_i r;
    r.x = ((i) & 1) * 2 - 1;
    r.y = ((i>>1) & 1) * 2 - 1;
    r.z = ((i>>2) & 1) * 2 - 1;
    return r;
}

ll calc(int m, int w_t, vector<cake_i> &cs) {
    cake_i w = wl(w_t);
    auto cmpr = [&](const cake_i &a, const cake_i &b){ return value(w, a) > value(w, b); };
    sort(cs.begin(), cs.end(), cmpr);
    ll res = 0;
    for(int i=0; i<m; i++) res += value(w, cs[i]);
    return res;
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<cake_i> cs(n);
    for(int i=0; i<n; i++) cin >> cs[i].x >> cs[i].y >> cs[i].z;
    ll res = 0;
    for(int i=0; i<8; i++) res = max(res, calc(m, i, cs));
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;
using ll = long long;

int visit[1000010];
int main() {
	int s;
	scanf("%d", &s);
	for (int i = 1; true; i++) {
		if (visit[s]) {
			printf("%d\n", i);
			return 0;
		}
		visit[s] = true;
		if (s & 1)
			s = s * 3 + 1;
		else
			s = s / 2;
	}
}

Measured memory_bytes: 128
n,m = map(int,input().split())
h = list(map(int,input().split()))
a = [0] * m
b = [0] * m
for i in range(m):
    a[i], b[i]= map(int, input().split())

cnt = 0
d = {}
for i in range(n):
    d[i] = 1
for i in range(m):
    if h[a[i]-1] > h[b[i]-1]:
        d[b[i]-1] = 0
    elif h[a[i]-1] < h[b[i]-1]:
        d[a[i]-1] = 0
    else:
        d[a[i]-1] = 0
        d[b[i]-1] = 0

for i in range(n):
    if d[i] == 1:
        cnt += 1

print(cnt)

Measured memory_bytes: 32288
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        long base = x/11;
        long left = x%11;
        long remain = 0;
        if(left>0&&left<=6) remain = 1;
        if(left>=7) remain = 2;
        System.out.println(2*base+remain);
    }
}


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

const int inf = 1<<25;

typedef struct node {
  int to;
  int cost;
  struct node* prev;
  struct node* next;
} list;

typedef struct {
  list* head;
  list* tail;
} Graph;
Graph graph[100001];

list* newnode(int to, int cost) {
  list* res = (list*)malloc(sizeof(list));
  res->to = to;
  res->cost = cost;
  res->prev = NULL;
  res->next = NULL;
  return res;
}
void deletenode(list* p) {
  p->prev->next = p->next;
  p->next->prev = p->prev;
  free(p);
}
void init_graph(Graph* g) {
  g->head = newnode(-1, -1);
  g->tail = newnode(-1, -1);
  g->head->next = g->tail;
  g->tail->prev = g->head;
}
void insert(Graph* g, int to, int cost) {
  list* p = newnode(to, cost);
  p->next = g->head->next;
  p->prev = g->head;
  g->head->next->prev = p;
  g->head->next = p;
}
void clear_graph(Graph* g) {
  while(g->head->next != g->tail) {
    deletenode(g->head->next);
  }
  free(g->head);
  free(g->tail);
}

typedef struct {
  int first;
  int second;
} Pair;

void swap(Pair* a, Pair* b) {
  Pair tmp = *a;
  *a = *b;
  *b = tmp;
}

int less(Pair p, Pair q) {
  return p.first != q.first ? p.first < q.first : p.second < q.second;
}

#define MAX_H 5000000

int H;
Pair Q[MAX_H];

void minHeapify(int idx) {
  int l = 2*idx+1;
  int r = 2*idx+2;
  int mni = idx;
  if(l < H && less(Q[l], Q[mni])) mni = l;
  if(r < H && less(Q[r], Q[mni])) mni = r;
  if(mni != idx) {
    swap(Q+idx, Q+mni);
    minHeapify(mni);
  }
}

void buildMinHeap() {
  int i;
  for(i = H/2; i >= 0; i--) minHeapify(i);
}

Pair heapMin() {
  return Q[0];
}

Pair extractMin() {
  if(H < 1) return (Pair){inf, inf};
  Pair mn = heapMin();
  Q[0] = Q[H-1];
  H--;
  minHeapify(0);
  return mn;
}

void heapIncreaseKey(int idx, Pair key) {
  if(less(Q[idx], key)) return;
  Q[idx] = key;
  while(idx > 0 && less(Q[idx], Q[(idx-1)/2])) {
    swap(Q+(idx-1)/2, Q+idx);
    idx = (idx-1)/2;
  }
}

void minHeapInsert(Pair key) {
  H++;
  Q[H-1] = (Pair){inf, inf};
  heapIncreaseKey(H-1, key);
}

int IsHeapEmpty() {
  return H==0;
}

void initHeap() {
  int i;
  for(i = 0; i < MAX_H; i++) Q[i] = (Pair){inf, inf};
}

#define MAX_N 100000

int n;
int mincost[MAX_N];

int main() {

  int i, j;

  scanf("%d", &n);

  for(i = 0; i < n; i++) init_graph(&graph[i]);

  for(i = 0; i < n; i++) {
    int u, k;
    scanf("%d %d", &u, &k);
    for(j = 0; j < k; j++) {
      int v, c;
      scanf("%d %d", &v, &c);
      insert(&graph[u], v, c);
    }
  }

  for(i = 0; i < n; i++) mincost[i] = inf;
  mincost[0] = 0;
  initHeap();
  minHeapInsert((Pair){0, 0});
  while(!IsHeapEmpty()) {
    list* ptr;
    Pair p = extractMin();
    int u = p.second;
    //printf("%d: %d, %d\n", H, p.first, p.second);
    if(mincost[u] < p.first) continue;
    for(ptr = graph[u].head->next; ptr != graph[u].tail; ptr = ptr->next) {
      int v = ptr->to, cost = ptr->cost;
      if(mincost[u]+cost < mincost[v]) {
	mincost[v] = mincost[u]+cost;
	minHeapInsert((Pair){mincost[v], v});
      }
    }
  }

  for(i = 0; i < n; i++) printf("%d %d\n", i, mincost[i]);

  for(i = 0; i < n; i++) clear_graph(&graph[i]);

  return 0;
}

Measured memory_bytes: 57216
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using vi = vector<int64_t>;
using vvi = vector<vi>;
int64_t INF = 1000000007;

int main() {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t n,init_x;
    cin >> n >> init_x;
    vi x(n);
    rep(i,n) cin >> x.at(i);
    x.push_back(init_x);
    sort(x.begin(), x.end());
    vi dx;
    rep(i,n){
        if(x.at(i) != x.at(i+1));
        dx.push_back(x.at(i+1) - x.at(i));
    }
    int64_t gcd = dx.at(0);
    for(int64_t i=1; i<dx.size(); i++){
        gcd = __gcd(gcd, dx.at(i));
    }
    cout << gcd << endl;
}

Measured memory_bytes: 2928
N, A, B = (int(i) for i in input().split())

all_num = 0

for i in range(1, N + 1):

    str_i = str(i)

    total_i = list(map(int, str_i))

    x = sum(total_i)

    if A <= x <= B:
        all_num += i

print(all_num)

Measured memory_bytes: 3060
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

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

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

#[allow(unused_imports)]
use std::cmp::{min, max};
use std::collections::HashMap;

fn main() {
    input!{
        s: chars
    }
    let mut map = HashMap::new();
    for &c in &s {
        *map.entry(c).or_insert(0) += 1;
    }
    if map.values().all(|&x| x % 2 == 0) {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
N = int(input())
ans = 0
happy = [[0]*3 for _ in range(N)]
dp = [[0]*3 for _ in range(N+1)]
for i in range(N):
    happy[i][0], happy[i][1], happy[i][2] = map(int, input().split())

for i in range(1, N+1):
    for place in range(3):
        for yes in range(3):
            if place == yes:
                continue
            dp[i][place] = max(dp[i][place], dp[i-1][yes] + happy[i-1][place])

ans = max(dp[N])
print(ans)


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

typedef long long ll;
 
const int INF= 1001001001;
const ll LINF= 1e18;

const long double PI = (acos(-1));
const long double EPS = 0.0000000001;

int main(){
    string s;
    cin >> s;
    int n = s.size();
    vector<int> a(n+1);
    for(int i = 0; i < n; i++){
        if(s[i]=='<'){
            a[i+1] = max(a[i+1],a[i] + 1);
        }
    }
    for(int i = n-1; i >= 0; i--){
        if(s[i] == '>'){
            a[i] = max(a[i],a[i+1] + 1);
        }
    }
    ll ans = 0;
    for(int i = 0; i <= n; i++){
        ans += a[i];
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 2820
#include<bits/stdc++.h>
using namespace std;
long long arr[1000000];
int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);   
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    long long n,i,j,k,x,y,z,M;
    M=1e9+7;
    cin>>n;
    x=1;
    for (i=0;i<n;i++)
    {
    	x=(x*10)%M;
	}
	y=1;
    for (i=0;i<n;i++)
    {
    	y=(y*8)%M;
	}
	z=1;
    for (i=0;i<n;i++)
    {
    	z=(z*9)%M;
	}
	z=z-y;
	if (z<0)
	{
		z=z+M;
	}		
	z=(z*2)%M;
	y=(y+z)%M;
	x=x-y;
	if (x<0)
	{
		x=x+M;
	}
	cout<<x<<endl;
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define eb emplace_back
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 233;
int main()
{
	int n,k,s;
	cin>>n>>k>>s;
	if(k==n){
		for(int i=1;i<=n;i++)
			printf("%d ",s);
		return 0;
	}
	if(s==1){
		for(int i=1;i<=n;i++){
			if(i<=k)printf("1 ");
			else printf("2 ");
		}
		return 0;
	}
	if(s==1000000000){
		for(int i=1;i<=n;i++){
			if(i<=k)printf("1000000000 ");
			else printf("1 ");
		}
		return 0;
	}
	for(int i=1;i<=k+1;i++){
		if(i%2)printf("%d ",s-1);
		else printf("%d ",1);
	}
	for(int i=k+2;i<=n;i++)printf("1000000000 ");
	return 0;
}


Measured memory_bytes: 1280
import numpy as np
primes = np.array([  2,   3,   5,   7,  11,  13,  17,  19,  23,  29,  31,  37,  41,
        43,  47,  53,  59,  61,  67,  71,  73,  79,  83,  89,  97, 101,
       103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167,
       173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239,
       241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313,
       317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397,
       401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467,
       479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569,
       571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643,
       647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733,
       739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823,
       827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911,
       919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997],dtype = np.int64)
n = int(input())
div = primes[primes <= n]
mod = 10**9 + 7
def divide(p,n):
    if n < p:
        return 0
    return divide(p,n//p) + n//p
ans = 1
for p in div:
    ans *= (divide(p,n) + 1) 
    ans %= mod
print(ans)

Measured memory_bytes: 12596
n, k = map(int, input().split())
dp = {}

dp[(0, 0, 0)] = 1

def perm(i, j, k):
  if (i, j, k) in dp:
    return dp[(i, j, k)]
  if i == 0:
      if k == 0 and j == 0:
          return 1
      else:
          return 0
  elif k < 0 or j < 0 or i < j:
      return 0
  else:
    dp[(i, j, k)] = ((j+j+1)*perm(i-1, j, k-2*j)\
                  + (j+1)*(j+1)*perm(i-1, j+1, k-2*j)\
                  +  1*perm(i-1, j-1, k-2*j))%(10**9+7)
    return dp[(i, j, k)]

print(perm(n, 0, k))

Measured memory_bytes: 23792
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
#define endl "\n"
inline bool EQ(double a, double b)
{
    return fabs(a - b) < 1e-9;
}
const int INF = 1 << 29;
typedef long long int ll;
inline int two(int n) { return 1 << n; }

inline int test(int n, int b) { return (n >> b) & 1; }
inline void set_bit(int &n, int b) { n |= two(b); }
inline void unset_bit(int &n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n)
{
    int res = 0;
    while (n && ++res)
        n -= n & (-n);
    return res;
}
template <class T>
void chmax(T &a, const T &b) { a = max(a, b); }
template <class T>
void chmin(T &a, const T &b) { a = min(a, b); }

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

    int n, m, k;
    cin >> n >> m >> k;
    string s[n], t[n];
    REP(i, n)
    {
        cin >> s[i];
        t[i] = "";
        REP(j, m)
        t[i] += 'a';
    }
    int n2 = 1, m2 = 1, nt = n, mt = m;
    REP(i, n)
    n2 = 2 * n2;
    REP(i, m)
    m2 = 2 * m2;
    int ans = 0;
    REP(i, n2)
    {
        REP(j, m2)
        {
            int t1 = i, t2 = j;
            int pos[n], pos2[m];
            REP(p, n)
            {
                if (t1 % 2 == 0)
                {
                    pos[p] = 0;
                }
                else
                    pos[p] = 1;
                t1 /= 2;
            }
            REP(p, m)
            {
                if (t2 % 2 == 0)
                    pos2[p] = 0;
                else
                    pos2[p] = 1;
                t2 /= 2;
            }
            int n_t = 0;
            REP(x, n)
            {
                REP(y, m)
                {
                    if (pos[x] == 1 || pos2[y] == 1)
                        t[x][y] = 'r';
                    else
                    {
                        t[x][y] = s[x][y];
                        if (s[x][y] == '#')
                            n_t++;
                    }
                }
            }
            // REP()
            // cout << i << " " << j << " " << n_t << endl;
            if (n_t == k)
            {
                ans++;
                // cout << i << " " << j << " " << endl;

                // REP(r, n)
                // cout << t[r] << endl;
            }
        }
    }
    cout << ans << endl;

    return 0;
}

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

int main(){
int i, j, x, y, N, M; cin >> N >> M; string A[N], B[M];
for(i=0; i<N; i++){ cin >> A[i]; }
for(i=0; i<M; i++){ cin >> B[i]; }
int d=N-M;
for(x=0; x<=d; x++){for(y=0; y<=d; y++){
for(i=0; i<M; i++){for(j=0; j<M; j++){ if(A[i+x][j+y]!=B[i][j]){i=M+1; break;} }}
if(i==M){ cout << "Yes\n"; return 0; }
}}
cout << "No\n";
}

Measured memory_bytes: 256
#include<stdio.h>
#pragma GCC optimize("O2")
#pragma GCC optimize("O3")
#pragma GCC target("avx")
#define rep(i,N) for(int i=0;i<(int)N;i++)
const int MOD=1e9+7,MAX=1e6;
static inline int IN(void)
{
  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}
  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;
}
typedef struct{int SPF[1000001];int Primes[1000001];int sz;}Template;
struct T{int fact[1000001],inv[1000001];};
Template P;struct T MODINV;
static inline int MPow(int a,int b){return b?1l*MPow(1l*a*a%MOD,b>>1)*(b&1?a:1)%MOD:1;}
static inline void ready(void)
{
  *P.SPF=1,*P.Primes=2,P.sz=1;
  rep(i,MAX/2)P.SPF[2*(i+1)]=2,P.SPF[2*(i+1)-1]=2*(i+1)-1;
  rep(i,MAX/2-1)
  {
    int x=2*(i+1)+1;if(P.SPF[x]==x)P.Primes[P.sz++]=x;
    rep(j,P.sz){if(P.Primes[j]<=P.SPF[x]&&x*P.Primes[j]<=MAX)P.SPF[x*P.Primes[j]]=P.Primes[j];else break;}
  }
}
static inline void init(void)
{
  MODINV.fact[0]=1;rep(i,MAX)MODINV.fact[i+1]=1l*MODINV.fact[i]*(i+1)%MOD;
  MODINV.inv[MAX]=MPow(MODINV.fact[MAX],MOD-2);
  rep(i,MAX)MODINV.inv[MAX-1-i]=1l*MODINV.inv[MAX-i]*(MAX-i)%MOD;
}
int main(void)
{
  int N=IN(),A=0,flag=1,invsum=0,k=0,lcm=1,x=0,temp[10000],box[168]={};ready();init();
  rep(i,N)
  {
    A=IN();invsum=(invsum+1l*MODINV.fact[A-1]*MODINV.inv[A]%MOD)%MOD;
    rep(j,168){x=0;while(A%P.Primes[j]==0){A/=P.Primes[j];if(box[j]<++x)box[j]=x;}}
    if(A!=1){rep(j,k){if(temp[j]==A)flag=0;}if(flag)temp[k++]=A;}flag=1;
  }
  rep(i,168){rep(j,box[i]){lcm=1l*lcm*P.Primes[i]%MOD;}}
  x=-1;rep(i,k){if(temp[i]>1){lcm=1l*lcm*temp[i]%MOD;x=temp[i];}}
  x=1l*lcm*invsum%MOD;return printf("%d\n",x),0;
}

Measured memory_bytes: 13640
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXCOL=1000;
const int MAXDIM=500;

int ncol;

int dim;
int g[2*MAXDIM][2*MAXDIM];

void solve() {
	if(ncol==1) { dim=1; g[0][0]=0; return; }
	int nbase=(ncol+3)/4*2;
	dim=nbase;
	REP(i,dim) REP(j,dim) g[i][j]=(i+j)%nbase;
	for(int i=1;i<dim;i+=2) REP(j,dim) if(g[i][j]<ncol-nbase) g[i][j]+=nbase;
}

void verify() {
	assert(dim>=1&&dim<=MAXDIM);
	REP(i,dim) REP(j,dim) assert(g[i][j]>=0&&g[i][j]<ncol);
	vector<vector<int>> want(ncol);
	REP(i,dim) REP(j,dim) {
		vector<int> cur;
		FORE(di,-1,+1) FORE(dj,-1,+1) if(di*di+dj*dj==1) { int ni=(i+di+dim)%dim,nj=(j+dj+dim)%dim; cur.PB(g[ni][nj]); }
		sort(cur.begin(),cur.end());
		int col=g[i][j]; if(SZ(want[col])==0) want[col]=cur; assert(want[col]==cur);
	}
	REP(i,ncol) assert(SZ(want[i])!=0);
}

void run() {
	scanf("%d",&ncol);
	solve();
	verify();
	printf("%d\n",dim);
	REP(i,dim) { REP(j,dim) { if(j!=0) printf(" "); printf("%d",g[i][j]+1); } puts(""); }
}

void stress() {
	for(ncol=1;ncol<=MAXCOL;++ncol) {
		printf("%d:\n",ncol);
		solve();
		verify();
	}
}

int main() {
	run();
	//stress();
	return 0;
}


Measured memory_bytes: 3200
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
#include <stack>
using ll = long long;
using uint = unsigned int;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
ll MOD7 = 1000000007;
ll MOD9 = 1000000009;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
    return A;
}
vector<vector<char>> InputVec2dStr(ll H,ll W){
    vector<vector<char>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<char>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        string S;
        cin >> S;
        for (int xi = 0; xi < W; ++xi) {
            A[yi][xi] = S[xi];
        }
    }
    return A;
}
void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
graph InputGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    return G;
}
graph InputDGraph(ll N,ll M){
    graph G(N);
    for (int i = 0; i < M; ++i) {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
    }
    return G;
}
void OutputGraph(graph G){
    for (int i = 0; i < G.size(); ++i) {
        cout << i << ":";
        for (int j = 0; j < G[i].size(); ++j) {
            cout << G[i][j]<< ",";
        }
        cout << endl;
    }
}
void OutputAnswerBool(bool b,bool isUpperCase = false){
    if(b){
        if(isUpperCase){
            cout << "YES" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }else{
        if(isUpperCase){
            cout << "NO" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

int main() {
    ll N,K,Q;
    cin >> N >> K >> Q;
    auto A=InputVec(Q);
    vector<ll> p(N);
    for (int i = 0; i < N; ++i) {
        p[i] = K;
    }
    for (int i = 0; i < Q; ++i) {
        p[A[i]-1]++;
    }
    for (int i = 0; i < N; ++i) {
        if(p[i] >Q){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}


Measured memory_bytes: 2176
/* Author : Aaryan Srivastava ^__^ */ 
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define pb push_back
#define popb pop_back
#define mt make_tuple 
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second 
#define ull unsigned long long  
#define pii pair<int, int>
#define piii pair<int,pii>
#define beg begin
#define rep(i,n) for(int (i) = 0 ; i < (n) ; i++)
#define repA(i,x,y) for(int i = (x) ; i <= (y) ; i++)
#define repD(i,x,y) for(int i = (x) ; i >= (y) ; i--)
#define all(c) (c).begin(),(c).end()
#define fill(a,val) memset(a,val,sizeof(a))
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define int ll
using ll = long long;
const int N = 3*1e5 +5 ;
const int mod = 1e9 + 7 ;
const int inf = 1e18 ;
const int SZ = 101 ;
const double eps = 1e-9 ;
using namespace __gnu_pbds;
using namespace std;
using ordered_set =  tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ;

#ifdef AaryanS
#define mycout cout
#define mycerr cerr 
#endif

#ifndef AaryanS
#define mycout if(false) cout
#define mycerr if(false) cerr
#endif


int dp[ (1<<20) + 5]; 

void solve()
{
	int n,m;
	cin >> n >> m;
	int a[m],b[m],c[m];
	rep(i,m){
		cin >> a[i] >> b[i];
		int tmp = 0;
		rep(j,b[i]){
			int x;
			cin >> x;
			x--;
			tmp += (1LL<<x);
		}
		c[i] = tmp; 
	}
	rep(msk,(1<<n)) dp[msk] = inf ;
	dp[0] = 0; 
	rep(msk , (1<<n)){
		rep(i,m){
			if((msk|c[i]) == msk) continue; // no use;
			dp[msk|c[i]] = min(dp[msk] + a[i], dp[msk|c[i]]);
		}
	}
	// rep(msk,(1<<n)) cout << msk << " " << (dp[msk] == inf ? -1 : dp[msk]) << endl; 
	cout << (dp[(1<<n)-1] == inf ? -1 : dp[(1<<n) - 1]); 
}   

     
int32_t main(int32_t argc, char *argv[])
{
    double t1 = clock() ;
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    int TC = 1, t = 0;
    //cin >> TC ;
    while(t++ < TC)
    {
        //cout << "Case #" << t << ": " ;
        solve();
        //cout << endl ;
    }
    mycerr << "Time : " << 1000 *(clock() - t1)/CLOCKS_PER_SEC << " ms\n" ;
    return 0;
}

Measured memory_bytes: 256
ABCD = input()
for i in range(2**3):
    bi = bin(i)[2:].zfill(3)
    tmp = int(ABCD[0])
    ops = []
    for j in range(3):
        if bi[j]=='1':
            tmp += int(ABCD[j+1])
            ops.append('+')
        else:
            tmp -= int(ABCD[j+1])
            ops.append('-')
    if tmp==7:
        print(ABCD[0]+ops[0]+ABCD[1]+ops[1]+ABCD[2]+ops[2]+ABCD[3] + '=7')
        break

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll to;
	ll d;
};


///////////////////////////

ll k(ll n) {
	if (n < 10) { return 1; }
	return k(n / 10) + 1;
}



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

	ll ans = 0;
	repn(i, N) {
		if (k(i) % 2 == 1) { ans++; }
	}

	cout << ans;

	system("PAUSE");
}

Measured memory_bytes: 504
#include<bits/stdc++.h>
#define ll long long
#define s string
#define d double
using namespace std;
int main()
{
  ios_base::sync_with_stdio (false);
  cin.tie (NULL);
  int x;
  cin>>x;
  int a[x],sum=0;
  for(int i=1; i<=x; i++)
  {
      cin>>a[i];
  }
  /*sort(a,a+x);
  a[0]={0};
  if(a[1]==0)
  {
  for(int i=2; i<x; i++)
  {
      for(int j=i+1; j<=x; j++)
      {
          sum = sum + (a[i] * a[j]);
      }
  }
    cout<<sum<<endl;
  }*/
      for(int i=1; i<x; i++)
    {
      for(int j=i+1; j<=x; j++)
      {
          sum = sum + (a[i] * a[j]);
      }
  }
  cout<<sum<<endl;
  return 0;
}



Measured memory_bytes: 256
X, Y = map(int, input().split())
mod = 10**9 + 7

if (X + Y) % 3 != 0 or X > 2*Y or Y > 2*X:
    print(0)
else:
    n2x = (2*X - Y) // 3
    n1x = (2*Y - X) // 3
    n = n2x + n1x

    # nCn2xを求める
    def combs(n,n2x):
        invs = [1] * (n+1)
        nfac = 1
        for i in range(1, n+1):
            nfac = nfac * i % mod
            invs[i] = pow(nfac, mod-2, mod)
        return nfac * invs[n2x] * invs[n-n2x] % mod

    print(combs(n, n2x))


Measured memory_bytes: 43760
N, K = list(map(int, input().split()))
cnt = {i: 0 for i in range(1, N+1)}
for _ in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        cnt[a] += 1
res = len([k for k, v in cnt.items() if v == 0])
print(res)

Measured memory_bytes: 67740
#include <bits/stdc++.h>
#define ll long long
#define MAX 200005

using namespace std;

ll a[MAX];

int main()
{
//    ios_base::sync_with_stdio(false);
//    cin.tie(0);
	string s;
	cin >> s;
	ll i,j,t,k;
	ll ca=0,cb=0;
	for(i=0;i<s.size();i++){
		if(s[i]=='A'){
			ca++;
		}
		else if(s[i]=='B'){
			cb++;
		}
	}
	if(ca!=0&&cb!=0){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
    return 0;
}


Measured memory_bytes: 256
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

H, W, K = map(int, input().split())
masu = []
for _ in range(H):
    line = list(input())
    masu.append(line)


ANS = []
def dfs(l):
    if len(l) == H + W:
        h = l[:H]
        w = l[-W:]
        # print("l: {}".format(l))
        # print("h: {}".format(h))
        # print("w: {}".format(w))
        # quit()
        cnt = 0
        for y in range(H):
            for x in range(W):
                if h[y] or w[x]:
                    continue
                if masu[y][x] == "#":
                    cnt += 1
        # print(cnt)
        if cnt == K:
            # print("l: {}".format(l))
            # print("h: {}".format(h))
            # print("w: {}".format(w))
            # print("----------=")
            ANS.append(1)
        return
    for b in [0, 1]:
        l.append(b)
        dfs(l)
        l.pop()
    
dfs([])
ans = len(ANS)
print(ans)

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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;
using Graph = vector<vector<int>>;

static long long INF = (1LL<<62);

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	string S;
	cin >> S;

	int rain = 0;
	int max_rain= 0;
	for(int i=0; i<S.size(); i++){
		if(S[i] == 'S'){
			if(max_rain < rain){
				max_rain = rain;
			}
			rain = 0;
		}
		else{
			rain++;
			if(max_rain < rain){
				max_rain = rain;
			}
		}
	}
	printf("%d\n", max_rain);
	return 0;
}


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

int gcd(int m, int n){
  if (m % n == 0){
    return n;
  }
  else{
    m = m % n;
    return gcd(n, m);
  }
}

int main(){
  int A, B, C, d;
  cin >> A >> B >> C;
  d = gcd(max(A, B), min(A, B));
  if (C % d != 0){
    cout << "NO" << endl;
  }
  else{
    cout << "YES" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>
using namespace std;
using ll = long long;

typedef pair <int, int> pii;

int main()
{

	ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	ll n;
	ll x[100005] = {};
	ll y[100005] = {};
	ll z[100005] = {};
	cin >> n;
	for (int i = 0; i < n - 1; i++)
	{
		cin >> x[i];
		cin >> y[i];
		cin >> z[i];
	}
	z[n - 1] = 1;
	for (int i = 0; i < n; i++)
	{
		a = 0;

		for (int j = i; j < n; j++)
		{
			if (a <= y[j])
			{
				a = y[j] + x[j];
				//cout << a << endl;

			}
			else
			{
				//cout << a << endl;

				if (z[j] != 0 && a%z[j] == 0)
				{
					a = a + x[j];
				}
				else
				{
					a = a + x[j] + z[j] - (a%z[j]);
				}
			}
		}
		cout << a << endl;

	}



	return 0;


	//cout << ans << endl;

	////std::cout << std::fixed;
	//cout << std::setprecision(20) << << endl;
	//cout << d+1 << endl;
	//cout << "" << endl;

	return 0;
}
//char型の文字数字は、-'0'で数値に変換できる
//accumulate(x, x + a, 0);//int型までの配列の合計
//memcpy(x, visited, sizeof(ll)*n);
//void kansuu(ll num, ll visited[10]) {}
//kansuu(1, zz);
//cout << setprecision(15) << v << endl;
//cout << char(z - 'a');
//log10(i) + 1 //10進数の桁数を取得

//int temp;
//for (int i = 0; i < n - 1; i++) {
//	for (int j = n - 1; j > i; j--) {
//		if (w[j - 1] < w[j]) {  /* 前の要素の方が大きかったら */
//			temp = w[j];        /* 交換する */
//			w[j] = w[j - 1];
//			w[j - 1] = temp;
//		}
//	}
//}

//最小公倍数
//ll x = a * b;
//ll tmp;
///* 自然数 a > b を確認・入替 */
//if (a<b) {
//	tmp = a;
//	a = b;
//	b = tmp;
//}
///* ユークリッドの互除法 */
//ll r = a % b;
//while (r != 0) {
//	a = b;
//	b = r;
//	r = a % b;
//}
//a = x / b;//答え

Measured memory_bytes: 2560
def show (nums):
    for i in range(len(nums)):
        if i!=len(nums)-1:
            print(nums[i],end=' ')
        else:
            print(nums[i])

def insertionSort(A,n,g):
    global cnt
    for i in range(g,n):
        v = A[i]
        j = i - g
        while(j >= 0 and A[j] > v):
            A[j+g] = A[j]
            j = j - g
            cnt += 1
        A[j+g] = v

def shellSort(A,n):
    global cnt
    cnt = 0
    g = []
    h = 1
    while h <= n:
        g.append(h)
        h = 3*h+1
    g.reverse()
    m = len(g)
    for i in range(0,m):
        insertionSort(A,n,g[i])

    #出力
    print(m)
    show(g)
    print(cnt)
    for i in range(n):
        print(A[i])

#main
n = int(input())
A = []
for i in range(n):
    A.append(int(input()))

shellSort(A,n)




Measured memory_bytes: 45516
a = str(input())
b = len(a)
c = int((b-1)/2)
d = int((b+3)/2)

g = a[:c]
h = a[d-1: ]
R = list(reversed(a))
P = ''.join(R)
C = []

for i in range(int(len(g)+1)):
    if i!=0:
        G = g[int(-i)]
        C.append(G)
    


W = []

for I in range(int(len(h)+1)):
    if I!=0:
        H = h[int(-I)]
        W.append(H)
N = ''.join(C)
M = ''.join(W)
if N ==g  and M ==h and a == P :
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

const int N=105;
vector<int> b;
int ans[N],n;

int main(){
	read(n);
	b.resize(n+1);
	rep(i,1,n)read(b[i]);
	per(i,n,1){
		int k=0;
		per(j,i,1)
			if(b[j]==j){k=j;break;}
		if(!k){
			puts("-1");
			return 0;
		}
		ans[i]=k;
		b.erase(b.begin()+k);
	}
	rep(i,1,n)printf("%d\n",ans[i]);

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
main(){
  int i,d,s;
  while(scanf("%d",&d)!=EOF){
    s=0;
    for(i=0;i<600/d;i++){
      s+=(d*((d*i)*(d*i)));
    }
    printf("%d\n",s);
  }
  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int main()
{
	fast;
	ll n;
	cin>>n;
	if(n%10==1||n%10==0||n%10==6||n%10==8)
		cout<<"pon";
	else if(n%10==2||n%10==4||n%10==5||n%10==7||n%10==9)
		cout<<"hon";
	else
		cout<<"bon";
	return 0;
}










Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    string S;
    cin >> S;
    int Q;
    cin >> Q;

    bool inv = false;
    int count = 0;
    string front, back;
    for(int i=0;i<Q;i++){
        int T;
        cin >> T;

        if(T == 1){
            if(inv)
                inv = false;
            else
                inv = true;
            count++;
        }else{
            int F;
            cin >> F;
            char C;
            cin >> C;
            if(F == 1){ // 先頭に追加
                if(inv)
                    back.push_back(C);
                else
                    front.push_back(C);
            }else{  // 末尾に追加
                if(inv)
                    front.push_back(C);
                else
                    back.push_back(C);
            }
        }
    }

    if(!inv){
        for(int i=front.size()-1;i>=0;i--)
            cout << front[i];
        cout << S << back << endl;
    }else{
        for(int i=back.size()-1;i>=0;i--)
            cout << back[i];
        for(int i=S.size()-1;i>=0;i--)
            cout << S[i];
        cout << front << endl;
    }

}

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

int main() {
    using namespace std;
    constexpr unsigned long size = 600000;
    unsigned long H, W;
    cin >> H >> W;
    vector<vector<unsigned long>> p(H, vector<unsigned long>(W));
    for(auto& i : p)for(auto& j : i)cin >> j;
    for(auto& i : p)for(auto& j : i){
        unsigned long b;
        cin >> b;
        j = max(j, b) - min(j, b);
    }
    vector<vector<bitset<2 * size + 1>>> dp(H, vector<bitset<2 * size + 1>>(W));
    dp[0][0][size - p[0][0]] = true;
    dp[0][0][size + p[0][0]] = true;
    for(unsigned long i = 0; i < H; ++i){
        if(i)dp[i][0] = dp[i - 1][0] << p[i][0] | dp[i - 1][0] >> p[i][0];
        for(unsigned long j = 1; j < W; ++j){
            dp[i][j] = dp[i][j - 1] << p[i][j] | dp[i][j - 1] >> p[i][j];
            if(i)dp[i][j] |= dp[i - 1][j] << p[i][j] | dp[i - 1][j] >> p[i][j];
        }
    }
    unsigned long ans{numeric_limits<unsigned long>::max()};
    for(unsigned long i = 0; i < 2 * size + 1; ++i){
        if(dp.back().back()[i])ans = min(ans, max(size, i) - min(size, i));
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main(void){
    int x1, x2;
    cin >> x1 >> x2;

    int n = x2 - x1 - 1;

    int h = n*(n+1)/2;
    cout << h - x1;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int H,W=1;
  int i,j;
  scanf("%d%d",&H,&W);
  while(H!=0||W!=0){
    for(i=0;i<H;i++){
      for(j=0;j<W;j++){
	printf("#");}
        printf("\n");}
    printf("\n");
    scanf("%d%d",&H,&W);}
  
  return 0;
}

Measured memory_bytes: 572
input_numbers = []

input_numbers = [int(i) for i in input().split()]

min = input_numbers[0]
x = 1
if input_numbers[1] < min:
    min =input_numbers[1]
    x = 2
if input_numbers[2] < min:
    min = input_numbers[2]
    x = 3
if input_numbers[3] < min:
    min = input_numbers[3]
    x = 4
if input_numbers[4] < min:
    min = input_numbers[4]
    x = 5

print(x)

Measured memory_bytes: 9052
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

struct bit {
    vector<ll> v; // 部分和をbitで管理 仮想配列はa[1...n]
    bit(int n){ // bit(int n) : v(n + 1) {}
        v.resize(n + 1);
    }
    
    ll sum(int i){ // 仮想配列a[1]~a[i]の和を求める
        ll ret = 0;
        for(; i > 0; i -= i & -i){ // i & -i: iの1が立っている最高位bitをの2^を返す
            ret += v[i];
        }
        return ret;
    }
    
    void add(int i, ll w) { // index:iにwを加える
        for (; i < v.size(); i += i & -i) {
            v[i] += w;
        }
    }
};

ll swaps(vector<int> &A){
    int N = (int)A.size();
    bit B(2 * N + 2);
    B.add(N + 1, 1);
    ll ans = 0;
    rep(i, N){
        ans += B.sum(A[i] + N + 1);
        B.add(A[i] + N + 1, 1);
    }
    return ans;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    ll num = N * (N + 1) / 2;
    
    ll l = 1, r = inf;
    while(r - l > 1) {
        ll m = (l + r) / 2;
        vector<int> B(N);
        rep(i, N) {
            if(A[i] >= m) B[i] = 1;
            else B[i] = -1;
        }
        rep(i, N - 1) {
            B[i + 1] += B[i];
        }
//        cout << m << ":" << swaps(B) << endl;
        
        if(swaps(B) >= (num - 1) / 2 + 1) {
            l = m;
        }
        else r = m;
    }
    
    
    output(l);
    
    return 0;
}


Measured memory_bytes: 3044
#include <stdio.h>
#include <stdlib.h>
#define max 150000
int c(const void *v1,const void *v2){
    return *(int *)v1-*(int *)v2;
}
int prime[max];
void setprime(void){
    int i,j;
    prime[0]=1;prime[1]=1;
    for(i=4;i<=max;i+=2){
        prime[i]=1;
    }
    for(i=3;i*i<=max;i+=2){
        if(!prime[i]){
            for(j=i*2;j<=max;j+=i)
                prime[j]=1;
        }
    }
}
int main(void){
    int n,p,i,o,map[10000],t,r,s;
    setprime();
    for(;scanf("%d %d",&n,&p),p!=-1;){
        for(s=0,r=0,i=n+1;s!=100;i++){
            if(!prime[i]){
                s++;
                for(t=0,o=i;t!=100;o++)
                    if(!prime[o]){
                        t++;
                        map[r++]=i+o;
                    }
            }
        }
        qsort(map,10000,sizeof(int),c);
        printf("%d\n",map[p-1]);
    }
    return 0;
}

Measured memory_bytes: 1292
import math
while True:
    N = int(input())
    if N == 0:
        break
    elif N == 1:
        print("deficient number")
    else:
        sum = 1
        for i in range(2, int(math.sqrt(N)) + 1):
            if N % i == 0 and i**2 !=N:
               sum += N / i + i
            elif i**2 ==N:
                sum += i
        if sum == N:
            print("perfect number")
        elif sum > N:
            print("abundant number")
        else:
            print("deficient number")



Measured memory_bytes: 5652
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String input = sc.nextLine();
        int length = input.length();
        char[] S = new char[length];
        for (int i = 0; i < length; i++) {
            S[i] = input.charAt(i);
        }

        int count1 = countToZeroFirst(S);
        int count2 = countToOneFirst(S);

        if (count1 < count2) {
            System.out.println(count1);
        }
        else {
            System.out.println(count2);
        }
    }

    private  static int countToZeroFirst(final char[] S) {
        int changeCount = 0;
        for (int i = 0; i < S.length; i++) {
            if (i % 2 == 0) {
                if (S[i] == '1') {
                    changeCount++;
                }
            }
            else {
                if (S[i] == '0') {
                    changeCount++;
                }
            }
        }
        return changeCount;
    }
    private  static int countToOneFirst(final char[] S) {
        int changeCount = 0;
        for (int i = 0; i < S.length; i++) {
            if (i % 2 == 0) {
                if (S[i] == '0') {
                    changeCount++;
                }
            }
            else {
                if (S[i] == '1') {
                    changeCount++;
                }
            }
        }
        return changeCount;
    }
}


Measured memory_bytes: 26300
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	sc.Scan()
	var inputs []int
	for _, v := range strings.Split(sc.Text(), " ") {
		tmp, _ := strconv.Atoi(v)
		inputs = append(inputs, tmp)
	}

	var count int
	for i := range inputs {
		minj := i
		for j := i; j < len(inputs); j++ {
			if inputs[j] < inputs[minj] {
				minj = j
			}
		}
		if i != minj {
			tmp := inputs[i]
			inputs[i] = inputs[minj]
			inputs[minj] = tmp
			count++
		}
	}

	fmt.Printf("%d", inputs[0])
	for _, v := range inputs[1:] {
		fmt.Printf(" %d", v)
	}
	fmt.Printf("\n%d\n", count)
}



Measured memory_bytes: 1100
#include <bits/stdc++.h>
using namespace std;
#include <algorithm>
 
int main() {
 
  int long long t=0,i=0,j=0,N;
  string ans="APPROVED";
  
  cin >> N;

  vector<int> A(N);

  for ( i = 0; i < N; i++)
  {
    cin>>A[i];
    if (A[i]%2==0)
    {
      if (A[i]%3!=0&&A[i]%5!=0)
      {
        ans="DENIED";
        break;
      }
      
    }
    
  }

  //printf ("%lld\n",ans);
  cout <<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
     
#define pll pair <long long,long long>
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define vll vector <ll>
#define NFS ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl '\n'
#define M 1000000007   
using namespace std;

void solve()
{
	int n;
	cin>>n;
	int a[4];
	for(int i=0;i<4;i++)a[i]=0;
	for(int i=0;i<n;i++)
	{
		string s;
		cin>>s;
		if(s.compare("AC")==0)
			a[0]++;
		else if(s.compare("WA")==0)
			a[1]++;
		else if(s.compare("TLE")==0)
			a[2]++;
		else
			a[3]++;
	}
	cout<<"AC x "<<a[0]<<endl;
	cout<<"WA x "<<a[1]<<endl;
	cout<<"TLE x "<<a[2]<<endl;
	cout<<"RE x "<<a[3]; 
}
 
int main()
{
    NFS
 	int t=1;
 	//cin>>t;
 	while(t--)
 	{
 		solve();
 	}
    return 0;
}

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

using namespace std;

#define fi first
#define se second
#define pb push_back
#define fil(a,b) memset((a),(b),sizeof(a))
#define sz(x) ((int)(x).size())
#define rep(i,a,b) for (int i=(a); i <= int(b); i++)
#define per(i,a,b) for (int i=(a); i >= int(b); i--)
#define foreach(it,c) for (auto it=(c).begin(); it != (c).end(); it++)

template<typename T>
void _R( T &x ) { cin>>x; }
void _R( int &x ) { scanf("%d",&x); }
void _R( long long &x ) { cin>>x; }
void _R( double &x ) { scanf("%lf",&x); }
void _R( char &x ) { scanf(" %c",&x); }
void _R( char *x ) { scanf("%s",x); }

void R() {}
template<typename T, typename... U>
void R( T& head, U&... tail ) {
    _R(head);
    R(tail...);
}

template<typename T>
void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
template<typename T>
void _W(const vector<T> &x) {
    for (auto i = x.cbegin(); i != x.cend(); i++) {
        if (i != x.cbegin()) putchar(' ');
        _W(*i);
    }
}

void W() {}
template<typename T, typename... U> void W(const T& head, const U&... tail) {
    _W(head);
    putchar(sizeof...(tail) ? ' ' : '\n');
    W(tail...);
}

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long ll;
typedef double db;

const int inf = 0x3f3f3f3f;
// const ll inf = 0x3f3f3f3f3f3f3f3f;
const db pi = 3.14159265358979323846264338327950288L;
const db eps = 1e-6;
const int mo = 1e9+7;

char grid[805][805];
bool vis[805][805];
int dr[4] = {1,0,-1,0};
int dc[4] = {0,1,0,-1};

int h,w,si,sj;
double k;

int reach(int i, int j) {
    return min(ceil(min(i,h-i-1)/k), ceil(min(j,w-j-1)/k));
}

int toSrc(int i, int j) {
    return abs(si-i) + abs(sj-j);
}

bool hasExit(int i, int j) {
    return i == 0 || i == (h-1) || j == 0 || j == (w-1);
}

int main() {
    R(h,w,k);
    rep(i,0,h-1) rep(j,0,w-1) {
        R(grid[i][j]);
        if (grid[i][j] == 'S') si = i, sj = j;
    }
    int ans = inf;
    queue<ii> q; q.push(ii(si,sj));
    vector<ii> v; v.pb(ii(si,sj));
    memset(vis, false, sizeof vis); vis[si][sj] = true;
    while (!q.empty()) {
        ii p = q.front(); q.pop();
        rep(it,0,3) {
            int ni = p.fi + dr[it], nj = p.se + dc[it];
            if (!vis[ni][nj] && grid[ni][nj] == '.' && toSrc(ni,nj) <= k) {
                q.push(ii(ni,nj));
                v.pb(ii(ni,nj));
                vis[ni][nj] = true;
            }
        }
    }
    rep(i,0,sz(v)-1) {
        ii p = v[i];
        if (hasExit(p.fi,p.se)) ans = 1;
        else ans = min(ans, 1+reach(p.fi,p.se));
    }
    W(ans);
    return 0;
}

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

int main(){
  string S;
  cin>>S;
  for(int i=0;i<3;i++){
    if(S[i]==S[i+1]){
      cout<<"Bad"<<endl;
      return 0;
    }
  }
  cout<<"Good"<<endl;
  return 0;
}

  


Measured memory_bytes: 256