akhauriyash/Code-Regression huggingface dataset:
import std.container;
import std.range;
import std.algorithm;
import std.array;
import std.string;
import std.conv;
import std.stdio;
import std.container;

int de(string s, string t) {
	int c;
	foreach (i;0..t.length) {
		if (s[i] != t[i]) {
			++c;
		}
	}
	return c;
}

void main() {
	auto s = readln.chomp;
	auto t = readln.chomp;

	auto m = int.max;

	while (s.length >= t.length) {
		auto r = de(s[0..t.length], t);

		if (r < m) {
			m = r;
		}

		s = s[1..$];
	}

	writeln(m);
}


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

int main()
{
    int H, W, N;
    cin >> H >> W >> N;

    int m = H > W ? H : W;
    int ans = N / m;
    if (N % m != 0) ans++;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include"iostream"
#include"cmath"
#include"vector"
#include"algorithm"
#include"list"
#include"set"
#include"unordered_set"
#include"map"
#include"unordered_map"
#include"string"
#include"cstring"
#include"iomanip"
using namespace std;
typedef long long ll;
const ll maxn=1e5+5;
ll rec[maxn],a,b,n;
bool solve(ll k)
{
    ll te=k;
    for(int i=n-1;i>=0;--i)
    {
        if(rec[i]-k*b>0)
        {
            te-=(rec[i]-k*b+a-1)/a;
        }
        if(te<0)
            return false;
    }
    return true;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n>>a>>b;
    for(int i=0;i<n;++i)
        cin>>rec[i];
    sort(rec,rec+n);
    ll h=rec[n-1]/b+3;
    ll l=0;
    a-=b;
    while(l<h-1)
    {
        ll mid=(l+h)/2;
        if(solve(mid))
        {
            h=mid;
        }
        else
        {
            l=mid;
        }
    }
    if(solve(l))
        cout<<l<<'\n';
    else cout<<h<<'\n';
}

Measured memory_bytes: 1024
# Counting sort 計数ソート


def countingsort(A, B, k):
    n = len(A)
    C = [0 for i in range(0, k + 1)]
    for i in range(0, n):
        C[A[i]] += 1
    for i in range(0, k + 1):
        C[i] += C[i - 1]
    for i in range(n - 1, -1, -1):
        B[C[A[i]] - 1] = A[i]
        C[A[i]] -= 1


n = int(input())
A = [int(i) for i in input().split()]
B = [None for i in range(n)]
countingsort(A, B, 10000)
for i in range(0, n - 1):
    print(B[i], end=" ")
print(B[n - 1])



Measured memory_bytes: 224248
#include <stdio.h>
#include <string.h>
int main(){
	char a[100],b[100],c[100];
	scanf("%s %s %s",a,b,c);
	int l1,l2;
	l1 = strlen(a);
	l2 = strlen(b);
	if(a[l1-1]==b[0]&&b[l2-1]==c[0])
		printf("YES\n");
	else 
		printf("NO\n");

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define fi first
#define se second
#define endl '\n'
#define MAX INT_MAX
#define MIN INT_MIN
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mod 1000000007
#define pb push_back
#define sz(a) (int)((a).size())
#define all(a) a.begin(),a.end()
#define loopf(i,a,b) for(int i = a;i < b;i++)
#define loopb(i,a,b) for(int i = a;i >= b;i--)
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair< int,int > pii;


int32_t main()
{
    fast

   int test=1;
   //cin>>test;

  while(test--)
  {
  int n;
  cin>>n;
  int ans=0;
  ans+=(n/500)*1000;
  ans+=((n%500)/5)*5;
  cout<<ans;

  //while loop ending 
  }

return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <algorithm>
#include <functional>
#include <limits.h>
#include <bitset>

#include <tuple>
#include <unordered_map>

#define mp       make_pair
#define mt       make_tuple
#define pb       push_back
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

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

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int N;
int main(){
	cin >> N;
	vector<int> L(2 * N);
	for (auto &val : L){
		cin >> val;
	}
	sort(L.begin(), L.end());
	int sum = 0;
	for (int i = 0; i < 2 * N - 1; i += 2){
		sum += min(L[i], L[i + 1]);
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
struct Node{
  int depth;
  int p;//parent
  int l,r; 
} ;
struct Node *tree;
int main(){
  
  int i,j,n,d,id,c,a,x,y;
  
  scanf("%d",&n);
  tree = malloc(sizeof(struct Node)*n);
  
  for(i=0;i<n;i++){
    tree[i].p = tree[i].l = tree[i].r = -1;
  }
    for(i=0;i<n;i++){
    scanf("%d%d",&id,&d);
   
    for(j=0;j<d;j++){
      //printf("d = %d\n",d);
      scanf("%d",&c);
      if(j==0){
	//printf("fuck1\n");
	tree[id].l = c;
	tree[c].p = id;
	a = c;
      }else{
	tree[a].r = c;
	tree[c].p = id;
	//printf("fuck2 %d\n",tree[c].p);
	a = c;
      }
    }
  }
  
  for(i=0;i<n;i++){
    x=0;
    y=i;
    while(tree[y].p>-1){
      y = tree[y].p;
      x++;
      //printf("p = %d\n",tree[y].p);//
    }
    tree[i].depth = x; 
  }

  
  
  for(i=0;i<n;i++){
    printf("node %d: parent = %d, depth = %d, ",i,tree[i].p,tree[i].depth);
    if(tree[i].p == -1)printf("root, ");
    else if(tree[i].l == -1)printf("leaf, ");
    else printf("internal node, ");
    printf("[");
    if(tree[i].l != -1){
      printf("%d",tree[i].l);
      a = tree[i].l;
      while(1){
	if(tree[a].r == -1)break;
	printf(", %d",tree[a].r);
	a = tree[a].r;
      }
    }
    printf("]\n"); 
  }
  

  free(tree);
  
  
  return 0;
  }



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

int main()
{
    long long int n,k,a,x;
    cin >> n >> k;
    a = n%k;
    x = abs(a-k);
    a = min(a,x);
    cout << a << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,a,b;
	cin>>n;
	vector<long long>v;
	for(int i=0;i<n;i++)
	{
		cin>>a>>b;
		v.push_back(a+b);
	}
	cout<<*min_element(v.begin(),v.end());
return 0;

}


Measured memory_bytes: 1400
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)*}
    };
}

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, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

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

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

//
// # Examples
//
// # integers
// input! { n: i32, m: i32, ... }
//
// # array
// input! { n: i32, v: [i32; n], }
//
// # matrix
// input! { n: i32, m: i32, mat: [[]] }
//
// # string
// input! { s: chars }
//
// 3 4
// ####
// #..#
// .#.#
//
// input!{
//     h: i32,
//     w: i32,
//     board: [chars; h],
// }

// https://practice.contest.atcoder.jp/tasks/practice_1
//fn main() {
//    input!{
//        a: i32, b: i32, c: i32,
//        foo: chars,
//    }
//    let s: String = foo.into_iter().collect();
//    println!("{} {}", a+b+c, s);
//}
use std::cmp;
fn main() {
    // abc 072
    input! { x: i32, t: i32 }
    println!("{}", cmp::max(0, x-t));
}

Measured memory_bytes: 4352
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN = 100000;
const int BLOCK = 450;
struct edge{
	int to, dis, clr;
	edge *nxt;
}edges[2*MAXN + 5], *adj[MAXN + 5], *ecnt = &edges[0];
void addedge(int u, int v, int c, int d) {
	edge *p = (++ecnt);
	p->to = v, p->clr = c, p->dis = d;
	p->nxt = adj[u], adj[u] = p;
	p = (++ecnt);
	p->to = u, p->clr = c, p->dis = d;
	p->nxt = adj[v], adj[v] = p;
}
int clr[MAXN + 5], dis[MAXN + 5];
int fa[MAXN + 5][20], dep[MAXN + 5];
int dfn[2*MAXN + 5], fir[MAXN + 5], bac[MAXN + 5], dcnt = 0;
void dfs(int x, int pre) {
	dfn[++dcnt] = x, fir[x] = dcnt;
	fa[x][0] = pre, dep[x] = dep[pre] + 1;
	for(int i=1;i<20;i++)
		fa[x][i] = fa[fa[x][i-1]][i-1];
	for(edge *p=adj[x];p;p=p->nxt)
		if( p->to != pre ) {
			dfs(p->to, x);
			clr[p->to] = p->clr, dis[p->to] = p->dis;
		}
	dfn[++dcnt] = x, bac[x] = dcnt;
}
int lca(int u, int v) {
	if( dep[u] < dep[v] ) swap(u, v);
	for(int i=19;i>=0;i--)
		if( dep[fa[u][i]] >= dep[v] )
			u = fa[u][i];
	if( u == v ) return u;
	for(int i=19;i>=0;i--)
		if( fa[u][i] != fa[v][i] )
			u = fa[u][i], v = fa[v][i];
	return fa[u][0];
}
struct query{
	int le, ri, num;
	int x, y;
}qry[MAXN + 5];
bool operator < (query a, query b) {
	return (a.le/BLOCK == b.le/BLOCK) ? a.ri < b.ri : a.le < b.le;
}
int nwres, cnt[MAXN + 5], tag[MAXN + 5];
int sum[MAXN + 5], ans[MAXN + 5];
void update(int x) {
	int y = dfn[x];
	if( tag[y] )
		cnt[clr[y]]--, sum[clr[y]] -= dis[y], nwres -= dis[y];
	else cnt[clr[y]]++, sum[clr[y]] += dis[y], nwres += dis[y];
	tag[y] ^= 1;
}
int main() {
	int N, Q; scanf("%d%d", &N, &Q);
	for(int i=1;i<N;i++) {
		int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d);
		addedge(a, b, c, d);
	}
	dfs(1, 0);
	for(int i=1;i<=Q;i++) {
		int x, y, u, v; scanf("%d%d%d%d", &x, &y, &u, &v);
		int l = lca(u, v);
		if( l == u || l == v ) {
			if( l == v ) swap(u, v);
			qry[i].le = fir[u] + 1, qry[i].ri = fir[v];
		}
		else {
			if( fir[u] > fir[v] ) swap(u, v);
			qry[i].le = bac[u], qry[i].ri = fir[v];
		}
		qry[i].num = i, qry[i].x = x, qry[i].y = y;
	}
	sort(qry + 1, qry + Q + 1);
	int l = 1, r = 0;
	for(int i=1;i<=Q;i++) {
		while( l > qry[i].le ) update(--l);
		while( r < qry[i].ri ) update(++r);
		while( l < qry[i].le ) update(l++);
		while( r > qry[i].ri ) update(r--);
		ans[qry[i].num] = nwres - sum[qry[i].x] + cnt[qry[i].x]*qry[i].y;
	}
	for(int i=1;i<=Q;i++)
		printf("%d\n", ans[i]);
}

Measured memory_bytes: 23808
// memo version
#include<iostream>
#include<vector>
#include<functional>
template<typename T>
std::ostream &operator <<(std::ostream &os, const std::vector<T> &vs) {
    using namespace std;
    bool fst = true;
    for(auto &v : vs) {
      if(!fst) os << ",";
      os << v;
      fst = false;
    }
    return os;
}
using namespace std;
// next_combination:
// given an integer cur, next_combination returns an integer nxt s.t.
//   nxt has the same number of 1s as cur
//   nxt is bigger than cur
//   no integer between cur and nxt has the same number of 1s as cur (and nxt)
int next_combination(int cur){
  int r1 = cur & -cur;      // extracts the rightmost 1
  int moved1 = cur + r1;    // cancel the rightmost run of 1s and put 1 on its left
  int rm1s = cur & ~moved1; // extracts the rightmost run of 1s
  int reset = (rm1s / r1) >> 1; // the run of 1s moved to LSD and made its length decreased by 1
  int nxt = moved1 | reset; // new combination
  return nxt;
}
int memo[9][6*6*6*6*6*6*6*6*6];
int main(int argc, char *argv[])
{
  for(;;){
    int n; cin >> n;
    if(n == 0) break;

    vector<int> wons(n, 0); // wons
    vector<int> losts(n, 0); // losts
    int m; cin >> m;
    for(int k = 0; k < m; k++) {
      int i, j; cin >> i >> j;
      wons[i-1] |= (1 << (j-1));
      losts[j-1] |= (1 << (i-1));
    }
    for(int i = 2; i < n; i++) {
      unsigned int im = 1;
      for(int k = i; k < n; k++) {
        im *= 6;
      }
      for(unsigned int j = 0; j < im; j++) {
        memo[i-2][j] = -1;
      }
    }
    vector<int> ws(n, n/2); // # of to win
    function<int(int)> rec = [n,&rec,&wons,&losts,&ws](int i){
      if(i >= n) return 1;
      if(n - 1 - i < ws[i]) return 0;
      unsigned int idx = 0;
      for(int j = i; j < n; j++) {
        idx = idx*6 + ws[j];
      }
      if(i >= 2 && memo[i-2][idx]>=0) {
        return memo[i-2][idx];
      }
      int k = ws[i];
      int win = ((1<<k)-1) << (i+1);
      const int fin = win << (n-1-k-i);
      const int mask = (1<<n) - (1 << (i+1));
      const int won = wons[i] & mask;
      const int lost = losts[i];
      int cnt = 0;
      for(;;) {
        if(((won & win) == won) && (lost & win) == 0) {
          bool ok = true;
          for(int j = i + 1; j < n; j++) {
            if(((1<<j) & win) == 0) {
              if(ws[j] == 0) ok = false;
              ws[j]--;
            }
          }
          if(ok) cnt += rec(i+1);
          for(int j = i + 1; j < n; j++) {
            if(((1<<j) & win) == 0) {
              ws[j]++;
            }
          }
        }
        if(win == fin) break;
        win = next_combination(win);
      }
      if(i >= 2) {
        memo[i-2][idx] = cnt;
      }
      return cnt;
    };
    int ans = rec(0);
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 4432
#include <iostream>
#include <cstdio>
#include <string>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <vector>
#include <map>

using namespace std;

struct node{
    node(){
		parent=-1;
		depth=0;
	}
	void set(const int cLeaf){
		leaf.resize(cLeaf);
		for(int i=0;i<cLeaf;i++){
			cin>>leaf[i];
		}
	}
	int parent;
	int depth;
	vector<int> leaf;
};

int main()
{
	int N,id,k;
	queue<int> que;
	node dnode[100000];
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>id>>k;
		dnode[id].set(k);
	}
	for(int i=0;i<N;i++){
		for(int j=0;j<dnode[i].leaf.size();j++){
			dnode[dnode[i].leaf[j]].parent=i;
		}
	}
	for(int i=0;i<N;i++){
		if(dnode[i].parent==-1){
			for(que.push(i);!que.empty();que.pop()){
				for(int j=0;j<dnode[que.front()].leaf.size();j++){
					dnode[dnode[que.front()].leaf[j]].depth=dnode[que.front()].depth+1;
					if(dnode[dnode[que.front()].leaf[j]].leaf.size()){
						que.push(dnode[que.front()].leaf[j]);
					}
				}
			}
			break;
		}
	}
	for(int i=0;i<N;i++){
		cout<<"node "<<i<<": parent = "<<dnode[i].parent<<", depth = "<<dnode[i].depth;
		if(dnode[i].parent==-1){
			cout<<", root, [";
			for(int j=0;j<dnode[i].leaf.size();j++){
				if(j){
					cout<<", ";
				}
				cout<<dnode[i].leaf[j];
			}
		}else if(dnode[i].leaf.size()){
			cout<<", internal node, [";
			for(int j=0;j<dnode[i].leaf.size();j++){
				if(j){
					cout<<", ";
				}
				cout<<dnode[i].leaf[j];
			}
		}else{
			cout<<", leaf, [";
		}
		cout<<']'<<endl;
	}
}

Measured memory_bytes: 4840
Ss = readlines.drop(1).map(&:chomp)

@a = 'a'.ord
f = ->(s){s.codepoints.inject(0){|r, c| r + 10**(c - @a)}}
h = Ss.each_with_object(Hash.new{|h, k| h[k] = 0}){|s, o| o[f[s]] += 1}
puts h.values.inject(0){|r, v| r + (v*(v - 1))/2}

Measured memory_bytes: 23004
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    var x = sc.nextInt()
    var y = sc.nextInt()

    while (true) {
        if (x == 0 && y == 0) break
        if (x > y) println("$y $x")
        else println("$x $y")
        x = sc.nextInt()
        y = sc.nextInt()
    }
}


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

int main() {
  int n,v,cnt=0,free=0;
  cin >> n;
  vector<bool> color(8,false);
  vector<int> a(n);
  for (int i=0 ;i<n;i++) cin >> a.at(i);
    
  for (int i=0;i<n;i++) {
    if (a.at(i)<400) color.at(0)=true;
    else if (a.at(i)<800) color.at(1)=true;
    else if (a.at(i)<1200) color.at(2)=true;
    else if (a.at(i)<1600) color.at(3)=true;
    else if (a.at(i)<2000) color.at(4)=true;
    else if (a.at(i)<2400) color.at(5)=true;
    else if (a.at(i)<2800) color.at(6)=true;
    else if (a.at(i)<3200) color.at(7)=true;
    else if (3200<=a.at(i)) free++;
  }
  
  for (int i=0;i<8;i++) if (color.at(i)==true) cnt++;
  
  if (cnt==0) cout << 1 << ' ' << cnt + free << endl;
  if (cnt!=0) cout << cnt << ' ' << cnt + free << endl;
  
}



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

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 1LL << 60;
typedef pair<int, int> PR;

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define fr(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijo(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i <=n;i++){
    num*=yakusu[i];
  }
  return num;
}
 

//cout<<""<<endl;
int main(){
  ll w=1000000007;
  ll N;cin>>N;
  ll ans=0;
  ll a=1,b=1,c=1;
  for(ll i=1;i<=N;i++){
    a *=10;
    a%=w;
  }
  for(ll i=1;i<=N;i++){
    b *=9;
    b%=w;
  }
  for(ll i=1;i<=N;i++){
    c *=8;
    c%=w;
  }
  ans +=a;
  ans%=w;
  ans -=b;
  ans%=w;
  ans -=b;
  ans%=w;
  ans +=c;
  ans%=w;
  if(ans<0)ans+=w;
  cout<<ans<<endl;
  
}






Measured memory_bytes: 3680
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  bool alphabet[26] = {};
  for(int i = 0;i < s.size();i++){
    int j = s[i]-'a';
    alphabet[j] = true;
  }
  for(int i = 0;i <= 26;i++){
    if(i == 26) cout << "None" << endl;
    else if(alphabet[i] == false){
      char answer = 'a'+ i;
      cout << answer << endl;
      break;
    }
  }
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
	using namespace std;
	 
	typedef long long ll; 
	typedef unsigned long long	llu;
	typedef long double			ld;
	typedef vector< int > 		vi;
	typedef pair<int, int> 		pii;
	 
	#define int ll
	#define pb push_back
	#define sq(a) a*a
	#define endl '\n'
	#define iyas_salah ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#define all(n)	v.begin(),v.end()
	#define rall(n) n.rbegin(), n.rend()
	#define rep(i,s,n) for(int i=s;i<int(n);i++)
	#define debug(x) cout<<"[" << #x << " is: " << x << "] "<<endl;
	 
	const int MAXN = 1e9 + 3;
	int32_t main() 
	{	iyas_salah
		#ifndef ONLINE_JUDGE
		freopen("in.txt","r",stdin);
		#endif
		/* ---code--- */ 	    	
		int a;cin >> a;
		cout << a + ( a * a) + (a * a * a) << endl;	
		/* ---------- */
		return 0;		
	}

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

typedef long long ll;
const int INF = 1e9;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	double n;
	cout.precision(10);
	cin>>n;
	cout<<(n/3)*(n/3)*(n/3)<<'\n';
	return 0;
}

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

const int N = 1e6 + 100;

int main() {
    // freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);

    int A, B, M;
    cin >> A >> B >> M;
    vector<int> a(A), b(B);
    for(int i = 0; i < A; i++) {
        cin >> a[i];
    }
    for(int i = 0; i < B; i++) {
        cin >> b[i];
    }
    int ans = 1e9;
    for(int i = 0; i < M; i++) {
        int x, y, c;
        cin >> x >> y >> c;
        x--, y--;
        ans = min(ans, a[x]+b[y]-c);
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    ans = min(ans, a[0] + b[0]);
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  string n;
  cin >> n;

  if (n.at(0) == '7' || n.at(1) == '7' || n.at(2) == '7') cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
//---------------------------------------------------------------------------------------------------
typedef pair<int,int> P;

int main(void){
    // Your code here!
    int n,m; cin >> n >> m;
    vector<ll> a(n),b(n),c(m),d(m);
    rep(i,n) cin >>a[i] >> b[i];
    rep(i,m) cin >> c[i] >> d[i];
    rep(i,n) {
        int ans = -1;
        int dis = INF;
        FOR(j,0,m-1) {
            if (dis > abs(a[i]-c[j]) + abs(b[i]-d[j])){
                dis = abs(a[i]-c[j]) + abs(b[i]-d[j]);
                ans = j;
            }
        }
        cout << ans + 1 << endl;
    }
}


Measured memory_bytes: 3636
#include <cstdio>
#include <algorithm>

const int MN = 100005;

int N, A[MN];

int main() {
	scanf("%d", &N);
	for (int i = 1; i <= N; ++i) scanf("%d", &A[i]);
	if (N == 1) return puts("Second"), 0;
	for (int o = 0; ; o ^= 1) {
		int Cnt = 0;
		for (int i = 1; i <= N; ++i) if (A[i] & 1) ++Cnt;
		if ((N - Cnt) & 1) return puts(o ? "Second" : "First"), 0;
		if (Cnt > 1) return puts(o ? "First" : "Second"), 0;
		for (int i = 1; i <= N; ++i) if (A[i] == 1) return puts(o ? "First" : "Second"), 0;
		int x = 0;
		for (int i = 1; i <= N; ++i) x = std::__gcd(x, A[i] & -2);
		for (int i = 1; i <= N; ++i) A[i] /= x;
	}
	return 0;
}

Measured memory_bytes: 2052
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#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 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;


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




int main() {
    ll n, m;
    cin >> n >> m;
    ll sum = 0;
    REP(i, m) {
        int a;
        cin >> a;
        sum += a;
    }
    if(sum > n) {
        cout << -1 << endl;
    }
    else {
        cout << n - sum << endl;
    }

}


Measured memory_bytes: 3632
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    if (N == M) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


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

typedef long long ll;

const int N = 1 * 1e5 + 10;
const ll inf = 1e18;

ll res;
ll a[N];
ll dp[N];

ll go(ll idx, ll k, ll n){
	if(idx == n)	return 0;
	if(dp[idx] != -1)	return dp[idx];
	ll mn = inf;
	for (int i = idx + 1; i <= min(n, idx + k); ++i){
		mn = min(abs(a[idx] - a[i]) + go(i, k, n), mn);
	}
	return dp[idx] = mn;
}

void solve() {
	ll n, k;
	cin >> n >> k;
	for (int i = 1; i <= n ; ++i){
		cin >> a[i];
	}
	memset(dp, -1, sizeof(dp));
	cout << go(1, k, n);
}

int main(int argc, char const *argv[]){
  ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
  ll t = 1;
  //cin >> t;
  while(t--){
    solve();
  }
    return 0;
}

Measured memory_bytes: 9600
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <functional>
#include <algorithm>
using namespace std;

char in[33];
int n, deg[26];
bool v[26];
vector<int> e[26];

void dfs(int c)
{
    v[c] = 1;
    for(vector<int>::iterator i = e[c].begin(); i < e[c].end(); i++) 
        if(!v[*i])
            dfs(*i);
}

int main()
{
    while(scanf("%d", &n), n) {
        for(int i = 0; i < 26; i++) {
            e[i].clear();
            deg[i] = 0;
            v[i] = 1;
        }
        int a,b;
        for(int i = 0; i < n; i++) {
            scanf("%s", in);
            a = in[0] - 'a'; b = in[strlen(in) - 1] - 'a';
            e[a].push_back(b);
            deg[a]++;
            deg[b]--;
            v[a] = v[b] = 0;
        }
        dfs(a);
        bool flag = true;
        for(int i = 0; i < 26; i++) {
            if(!v[i] || deg[i] != 0) {
                flag = false;
                break;
            }
        }
        printf("%s\n", (flag ? "OK" : "NG"));
    }
}

Measured memory_bytes: 0
using System;
class Mainclass 
{
    static void Main()
    {
        int[] num = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);
        int L = num[0];
        string[] s = new string[L];
        for (int i = 0; i < L; i++)
        {
            s[i] = Console.ReadLine();
        }
        Array.Sort(s);
        Console.WriteLine(string.Join("",s));
    }
}

Measured memory_bytes: 27748
#include "bits/stdc++.h"

using namespace std;

void Main() {
    long long N;
    cin >> N;
    long long power = 1;
    for (long long i = 0; i < N; ++i) {
        power *= (i + 1);
        power %= 1000000007;
    }
    cout << power << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3612
w,h,n = map(int, input().split())

x1,x2,y1,y2 = 0,w,0,h
for _ in range(n):
    x,y,a = map(int, input().split())
    if a==1:
        x1 = max(x1,x)
    elif a==2:
        x2 = min(x2,x)
    elif a==3:
        y1 = max(y1,y)
    else:
        y2 = min(y2,y)

if x1>=x2:
    print(0)
    exit()
if y1>=y2:
    print(0)
    exit()

print((x2-x1)*(y2-y1))

Measured memory_bytes: 3064
import math
N,M=map(int,input().split())
if N<=1 and M<=1:
    print(0)
elif N<=1 and M>1:
    Mn = math.factorial(M)/(math.factorial(2)*math.factorial(M-2))
    print(int(Mn))
elif M<=1 and N>1:
    Nn = math.factorial(N)/(math.factorial(2)*math.factorial(N-2))
    print(int(Nn))
else:
    Nn = math.factorial(N)/(math.factorial(2)*math.factorial(N-2))
    Mn = math.factorial(M)/(math.factorial(2)*math.factorial(M-2))
    print(int(Nn+Mn))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long
int MOD = (int)1e9 + 7;
int INF = (int)2e18;
// Comment out below and program paste

// #include "UnionFind.hpp"
// #include "power.hpp"

signed main() {
    int n;
    cin >> n;
    vector<double> x(n), y(n);
    for (int i = 0; i < n; i++) cin >> x[i];
    for (int i = 0; i < n; i++) cin >> y[i];
    vector<double> ans(n);
    for (int i = 0; i < n; i++) ans[i] = x[i] - y[i];
    double answer = 0;
    for (int i = 0; i < n; i++) answer += abs(ans[i]);
    cout << fixed << setprecision(10) << answer << endl;
    answer = 0;
    for (int i = 0; i < n; i++) answer += abs(pow(ans[i], 2));
    cout << fixed << setprecision(10) << sqrt(answer) << endl;
    answer = 0;
    for (int i = 0; i < n; i++) answer += abs(pow(ans[i], 3));
    cout << fixed << setprecision(10) << cbrt(answer) << endl;
    answer = 0;
    for (int i = 0; i < n; i++) answer = max(answer, abs(ans[i]));
    cout << fixed << setprecision(10) << answer << endl;

}



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

using namespace std;

typedef long long ll;

inline ll read(){
	char ch=getchar();ll x=0,f=1;
    while(ch<'0' || ch>'9') {
       if(ch=='-') f=-1;
	  	  ch=getchar();
	}
    while(ch<='9' && ch>='0') {
	   x=x*10+ch-'0';
	   ch=getchar();
	}
    return x*f;
}

int s[101010];

map<int,int> fr;

ll ans;

int main(){
	ll n=read(),m=read();
	for(int i=1;i<=n;i++){
		ll d=read();
		s[i]=s[i-1]+d;
		s[i]%=m;
	}
	int sum=0;
	sort(s,s+n+1);
	int k=-1;
	for(int i=0;i<=n;i++){
		if(s[i]!=k){
			k=s[i];
			sum=1;
		}
		else {
			ans+=sum;
			sum++;
		}
	} 
	cout<<ans;
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <random>
#include <deque>

#define INF_LL 1e18
#define INF 1e9

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

using namespace std;

using ll = long long;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;

const ll MOD = 1e9+7;

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

template<typename T>
void chmax(T &a, T b){
	a = max(a, b);
}

template<typename T>
void chmin(T &a, T b){
	a = min(a, b);
}

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

	int find(int x){
		if(par[x] == x){
			return x;
		}else{
			return par[x] = find(par[x]);
		}
	}

	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;

		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}
};

class RMQ{
	int n;
	vector<int> dat;
public:
	RMQ(int n_){
		n = 1;
		while(n < n_) n *= 2;
		REP(i, n*2-1){
			dat.push_back(INF);
		}
	}

	void update(int x, int i){
		i += n-1;
		dat[i] = x;
		while(i > 0){
			i = (i-1)/2;
			dat[i] = min(dat[i*2+1], dat[i*2+2]);
		}
	}

	int query(int a, int b, int l, int r, int x){
		if(a <= l && r <= b) return dat[x];
		if(r <= a || b <= l) return INF;

		int res = INF;
		res = min(query(a, b, l, (l+r)/2, x*2+1), query(a, b, (l+r)/2, r, x*2+2));
		return res;
	}
	int query(int a, int b){
		return query(a, b, 0, n, 0);
	}
};

const ll mod = 1e9+7;

int main(void){
	string s,t;
cin >> s >> t;
vector<int> s1(s.size()+1,0),s2(t.size()+1,0);
REP(i,s.size()) {
s1[i+1]=s1[i]+s[i]-'A'+1;
}
REP(i,t.size()){
s2[i+1]=s2[i]+t[i]-'A'+1;}
int Q;
cin>>Q;
REP(q,Q){
int a,b,c,d;
cin>> a >> b >> c >> d;
if((s1[b]-s1[a-1])%3==(s2[d]-s2[c-1])%3)
cout<< "YES" << endl;
else
cout << "NO" << endl; 
}
}


Measured memory_bytes: 1664
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

K, X = MAP()

for i in range(X - K + 1 , X + K):
	if i < -1000000:
		continue
	if i > 1000000:
		continue
	print(i, "", end="")

Measured memory_bytes: 5192
#include <iostream>
#include <math.h>
using namespace std;

int main()
{
    int i, n, m, a, home = 0, day;

    cin >> n >> m;

    for (i = 0; i < m; i++)
    {
        /* code */
        cin >> a;
        home += a;
    }
    day = n - home;

    if (day < 0)
    {
        cout << -1;
    }
    else
    {
        cout << day;
    }
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define pii pair<ll, ll> 
#define pb push_back
#define mod (1e9+7)
#define debug(x) cerr<< #x << " is " <<x<<endl;
#define debug2(x) cerr<<#x<< " is\n"; for (auto &i:x) {cout<<i<<' '; } cout<<endl;
#define f first
#define s second
using namespace std;

const int inf = 1e9+5;

int main(){
    ios::sync_with_stdio(false); cin.tie(0);
    int n; cin>>n;
    int k; cin>>k;
    vector<int> a(n);
    for (int i=0; i<n; i++){
    	cin>>a[i];
    }
    vector<int> dp(n+2,inf);
    dp[0]=0;
    for (int i=0; i<n; i++){
    	for (int j=1+i; j<=i+k; j++){
    		dp[j]=min(dp[j],dp[i]+abs(a[j]-a[i]));
    	}
    }
    cout<<dp[n-1]<<endl;
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

int main(){
    cin.sync_with_stdio(false);
    string s;
    cin >> s;

    int cnt = 0;
    repl(i, 1, s.size()) {
        if (s[i] != s[i - 1]) cnt++;
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <string>
using namespace std;


int main() {

    int N;
    cin >> N;

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

    string answer = "APPROVED";

    for( int i = 0; i < N; i++){
        if (A[i]%2!=0){
            continue;
        }
        if (A[i]%3==0){
            continue;
        }
        if (A[i]%5==0){
            continue;
        }
        answer = "DENIED";
        break;
    }

    cout << answer << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<utility>
#include<string>
#include<stack>
#include<queue>
#include<set>
#include<math.h>
#include <map>
using namespace std;
typedef long long int ll;
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define all(u) u.begin(),u.end()
#define pl pair<ll,ll>
#define fi first
#define se second
#define inf 1000000007
#define mp(a,b) make_pair(a,b)

ll N,M;
ll L[200010];
ll R[200010];
ll D[200010];
vector<pl>g[100010];
vector<ll> visited(100010,0);
vector<ll> position(100010);
set<ll> S;
ll check = 0;

void dfs(ll cur, ll x){
    S.erase(cur);
    visited[cur] = 1;
    position[cur] = x;
    rep(i,g[cur].size()){
        if (!visited[g[cur][i].fi]){
            dfs(g[cur][i].fi,x+g[cur][i].se);
        }
    }
    return;
}


int main() {
    cin >> N >> M;
    rep(i,M) {
        cin >> L[i] >> R[i] >> D[i];
        g[L[i]-1].push_back(mp(R[i]-1,D[i]));
        g[R[i]-1].push_back(mp(L[i]-1,-D[i]));
    }
    rep(i,N) S.insert(i);
    while(!S.empty()){
        dfs(*S.begin(),0);
    }
    rep(i,M){
        if (position[R[i]-1] - position[L[i]-1] != D[i]){
            check = 1;
            break;
        }
        if (position[L[i]-1] - position[R[i]-1] != -D[i]){
            check = 1;
            break;
        }
    }
    if (check) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 26112
#include <bits/stdc++.h>
#include <ext/hash_map>
#include <ext/numeric>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define REP(i,n) for( (i)=0 ; (i)<(n) ; (i)++ )
#define rep(i,x,n) for( (i)=(x) ; (i)<(n) ; (i)++ )
#define REV(i,n) for( (i)=(n) ; (i)>=0 ; (i)-- )
#define FORIT(it,x) for( (it)=(x).begin() ; (it)!=(x).end() ; (it)++ )
#define foreach(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define rforeach(it,c) for(__typeof((c).rbegin()) it=(c).rbegin();it!=(c).rend();++it)
#define foreach2d(i, j, v) foreach(i,v) foreach(j,*i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define SZ(x) ((int)(x).size())
#define MMS(x,n) memset(x,n,sizeof(x))
#define mms(x,n,s) memset(x,n,sizeof(x)*s)
#define pb push_back
#define mp make_pair
#define NX next_permutation
#define UN(x) sort(all(x)),x.erase(unique(all(x)),x.end())
#define CV(x,n) count(all(x),(n))
#define FIND(x,n) find(all(x),(n))-(x).begin()
#define ACC(x) accumulate(all(x),0)
#define PPC(x) __builtin_popcountll(x)
#define LZ(x) __builtin_clz(x)
#define TZ(x) __builtin_ctz(x)
#define mxe(x) *max_element(all(x))
#define mne(x) *min_element(all(x))
#define low(x,i) lower_bound(all(x),i)
#define upp(x,i) upper_bound(all(x),i)
#define NXPOW2(x) (1ll << ((int)log2(x)+1))
#define PR(x) cout << #x << " = " << (x) << endl ;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<int, int> pii;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int OO = (int) 2e9;
const double eps = 1e-9;

const int N = 2e5 + 5;

int n, k;
int a[N];

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
//	freopen("in.txt", "rt", stdin);
//	freopen("out.txt", "wt", stdout);
#endif
	cin >> n >> k;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = k; i < n; i++) {
		if (a[i] > a[i - k])
			puts("Yes");
		else
			puts("No");
	}
	return 0;
}


Measured memory_bytes: 4448
#include <stdio.h>
int dp[9999][9999];
int main(void){
	int n,m,i,j,k,ans;
	scanf("%d %d",&n,&m);
	int dis[n+1],tem[m+1];
	for(i=1;i<=n;i++){
		scanf("%d",&dis[i]);
	}
	for(i=1;i<=m;i++){
		scanf("%d",&tem[i]);
	}
	for(i=0;i<=m;i++){
		for(j=0;j<=n;j++){
			dp[i][j]=999999999;
		}
	}
	dp[0][0]=0;
//????????????
	
	for(i=0;i<=m-1;i++){
		for(j=0;j<=n;j++){
			if(dp[i+1][j]>dp[i][j])dp[i+1][j]=dp[i][j];
			if(dp[i+1][j+1]>dp[i][j]+dis[j+1]*tem[i+1])dp[i+1][j+1]=dp[i][j]+dis[j+1]*tem[i+1];
		}
	}
	printf("%d\n",dp[m][n]);
	return 0;
}

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

void fnInput(int& rnMaxNum, int& rnTrgNum)
{
  cin >> rnMaxNum >> rnTrgNum;
}

int fnCaseCount(int nMaxNum, int nTrgNum)
{
  int nAllDiff = 0;
  int nSameTwo = 0;
  int nAllSame = 0;

  for (int i = 0; i <= nMaxNum; i++)
    for (int j = 0; j <= i; j++)
      for (int k = 0; k <= j; k++)
        if        (i + j + k == nTrgNum)
          if      (i == j && j == k)           nAllSame++;
          else if (i == j || j == k || k == i) nSameTwo++;
          else                                 nAllDiff++;

  return (nAllDiff * 6 + nSameTwo * 3 + nAllSame);
}

int main()
{
  int nMaxNum, nTrgNum;

  fnInput(nMaxNum, nTrgNum);
  cout << fnCaseCount(nMaxNum, nTrgNum) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define REP(i,n) for (int i=0;i<(n);i++)
const int N = 30000;
using namespace std;
bool a[N];
vector<int> prime;
void erast(){
	fill(a,a + N,true);
	a[0] = a[1] = false;
	for(int i = 2; i*i <= N;++i){
		if(a[i] == false)continue;
		for(int j = i*i; j<=N;j += i){
			a[j] = false;
		}
	}
	REP(i,N){
		if(a[i] == false)continue;
		prime.push_back(i);
	}
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
	erast();
	int m,a,b;
	while(cin>>m>>a>>b,m){
		int maxpq = 0,maxp = 0,maxq = 0;
		REP(i,prime.size()){
			if(prime[i] > m)break;
			for(int j = i;j < prime.size();j++){
				int p = prime[i],q = prime[j];
				if(p <= q && p * q <= m && a*q <= b*p){
					if(maxpq <= p*q){
					maxpq = p*q;
					maxp = p;
					maxq = q;
					}
				}else break;
			}
		}
		cout << maxp << ' ' << maxq << endl;
	}
  return 0;
}

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

using namespace std;

#define int long long

main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int a, b, c;
    cin >> a >> b >> c;
    if(a + b + c >= 22) puts("bust");
    else puts("win");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long N, A, B; 
	cin >> N >> A >> B; 
	long long q = N / (A + B);
	long long r = N % (A + B);  
	long long ans = q * A + min(r, A);
	cout << ans << endl;  
}

Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
#define ll long long
using namespace std;
//ll a[2000000],b[200000],c[200000];
ll a[20000];
ll b[20000];
ll abb(ll x)
{
    if(x<0)
    {
        return -1*x;
    }
    return x;
}
int main()
{
    ll z,w,n,x,y,i,m,j,k1=-1,k2=100000000,l1,l2;
    scanf("%lld %lld %lld",&n,&z,&w);
    for(i=1; i<=n; i++)
    {
        scanf("%lld",&a[i]);
        b[i]=a[i];
    }
    if(n==1)
    {
        printf("%lld\n",abs(w-a[1]));
    }
    else
    {
        printf("%lld",max(abs(a[n]-a[n-1]),abs(a[n]-w)));
    }

   // printf("%lld",abb(w-z));
    return 0;
}


Measured memory_bytes: 384
#include <cstdio>

void swap(int z[], int a, int b) {
    int tmp = z[a];
    z[a] = z[b];
    z[b] = tmp;
}

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

    int swp = 0;
    for (int i=0; i<n-1; i++) {
        int mini = i;
        for (int j=i+1; j<n; j++) {
            if (A[j] < A[mini]) mini = j;
        }

        if (i != mini) {
            swp++;
            swap(A, i, mini);
        }
    }

    for (int i=0; i<n; i++) {
        printf("%d", A[i]);
        if (i == n-1) {
            printf("\n");
        } else {
            printf(" ");
        }
    }
    printf("%d\n", swp);
}

Measured memory_bytes: 1032
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cstring>

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef pair<ll, ll> P;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)

const ll mod = 1000000007;

// 変数定義start(vectorはresizeしようね)
ll N, W;
vl p, c;
// 変数定義end

void solve(){
	cin >> N >> W;
	p.resize(N);
	c.resize(N);
	ll dp[N+1][W+1];
	memset(dp,0, sizeof(dp));
	REP(i, N){
		cin >> p[i] >> c[i];
	}
	REP(i, N){
		REP(w, W+1){
			if(w >= c[i]){
				dp[i+1][w] = max(dp[i][w-c[i]] + p[i], dp[i][w]);
			} else {
				dp[i+1][w] = dp[i][w];
			}
		}
	}

	cout << dp[N][W] << endl;

}

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


Measured memory_bytes: 11108
#include<stdio.h>
#include<math.h>

int main(){
    int n,i,j,cnt=0,check,num;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&num);
        if(num%2==0 && num!=2)continue;
        check=0;
        for(j=2;j<=sqrt(num);j++){
            if(num%j==0)check++;
        }
        if(check==0)cnt++;
    }
printf("%d\n",cnt);
    return 0;
}



Measured memory_bytes: 2712
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

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

  ll n;
  cin >> n;
  vl a(n);
  ll m = 0;
  rep(i, n) {
    cin >> a[i];
    cmax(m, a[i]);
  }
  int cnt = 0;
  ll m2 = 0;
  rep(i, n) {
    if (a[i] == m) cnt++;
    else cmax(m2, a[i]);
  }

  if( cnt == 1) {
    rep(i, n) {
      if (m == a[i]) cout << m2 << endl;
      else cout << m << endl;
    }
  } else {
    rep(i, n) {
      cout << m << endl;
    }
  }
}


Measured memory_bytes: 3200
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < A.length; ++i) {
            A[i] = sc.nextInt();
        }

        System.out.println(solve(A));

        sc.close();
    }

    static long solve(int[] A) {
        int[] regulated = IntStream.range(0, A.length).map(i -> A[i] - i - 1).sorted().toArray();

        return IntStream.range(0, A.length / 2).map(i -> regulated[A.length - 1 - i] - regulated[i]).asLongStream()
                .sum();
    }
}

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

int main(void) {
    int N;
    cin >> N;
    int a = N % 10;
    if (a == 3) {
        cout << "bon" << endl;
    } else if ((a == 0) || (a == 1) || (a == 6) || (a == 8)) {
        cout << "pon" << endl;
    } else {
        cout << "hon" << endl;
    }

    return 0;

}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;

bool IsPrime(ll x){
    rep(i,2,sqrt(x)){
        if(x%i==0) return false;
    }
    return true;
}

int main(){
    ll x;
    cin>>x;
    ll ans = 0;
    bool flag = false;
    while(1){
        flag = IsPrime(x);
        if(flag){
            ans = x;
            break;
        }  
        else x++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 760
n = int(input())
A = [int(input()) for _ in range(n)]

first = 0
second = 1
if A[first] < A[second]:
    first, second = second, first
for i in range(2, n):
    if A[first] < A[i]:
        second = first
        first = i
    elif A[second] < A[i]:
        second = i

print(*[A[first] if i != first else A[second] for i in range(n)], sep='\n')


Measured memory_bytes: 15636
n = int(input())

def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n // i)
  return divisors

ans = 0
for i in range(1, n+1, 2):
  divisors = make_divisors(i)
  if len(divisors) == 8:
    ans += 1
print(ans)

Measured memory_bytes: 38640