akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int a, b;
    cin >> a >> b;
    int sum = a+b;
    
    if (sum % 2 == 0)
        cout << sum / 2 << endl;
    else
        cout << sum / 2 + 1 << endl;
}

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

#define MAX 10

char trump[4] = {'S', 'H', 'C', 'D'};

int toNum(char c)
{
    int ret;

    switch(c) {
     case 'S': ret = 0; break;
     case 'H': ret = 1; break;
     case 'C': ret = 2; break;
     case 'D': ret = 3; break;
     default : ret = -1; break;
    }

    return ret;
}

char toTrump(int n)
{
    return trump[n];
}

int main(void)
{
    int i, j, n;
    int lank, mark;
    char str[MAX];
    char *t, *l;
    unsigned int data[] = {0,0,0,0};

    scanf("%d%*c", &n);

    for(i=0;i<n;i++) {
        fgets(str,MAX, stdin);
        t = strtok(str, " \n\0");
        mark = toNum(*t);
        l = strtok(NULL, " \n\0");
        lank = atoi(l);
        data[mark] |= (1<<(lank-1));
    }

    for(i=0;i<4;i++) {
        for(j=0;j<13;j++) {
            if((data[i] & (1<<j)) == 0) {
                printf("%c %d\n", toTrump(i), (j+1));
            }
        }
    }

    return 0;
}

Measured memory_bytes: 604
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>


using namespace std;


int main()
{
	int n,ans;
	
	cin >> n;
	
	vector<int> v(n);
	
	for(int i=0;i<n;i++){
		cin >> v[i];
	}
	
	sort(v.begin(),v.end());
	
	ans = v[(n/2)] - v[(n/2)-1];
	
	
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef int64_t  ll;

int main () {
  int x;
  int counter = 1;
  while (true) {
    cin >> x;
    if (x == 0) break;
    cout << "Case " << counter << ": " << x << endl;
    counter++;
  }
  return 0;
}


Measured memory_bytes: 3068
/*
Cerberus97
Hanit Banga
*/

#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

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

const int N = 1e5 + 10;

int main() {
	int a, b;
	cin >> a >> b;
	if (a + b == 15) {
		cout << "+";
	} else if (a * b == 15) {
		cout << "*";
	} else {
		cout << "x";
	}
	cout << endl;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(n); ++i)


int main() {
  string a, b, c;
  cin >> a >> b >> c;  
  cout << a[0] << b[1] << c[2] << endl;
  return 0;
  
}

Measured memory_bytes: 256
D,N = input().split()
D = int(D)
N = int(N)

# D 割る回数
# N 小さい順からN番目
i = 0
count = 0
while(True):
    i = i + 100**D
    if i % 100**D == 0 and i % 100**(D+1) != 0:
        count = count + 1
    if count >= N:
        break
    
print(i)

Measured memory_bytes: 3060
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 2;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const ld PI = acos(-1.0);
const ld EPS = 1e-11;

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#pragma endregion

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);

  int k;
  cin >> k;
  queue<ll> que;
  for (int i = 1; i <= 9; ++i)
    que.push(i);

  rep(i, k)
  {
    ll q = que.front();
    if (i == k - 1)
    {
      cout << q << endl;
      return 0;
    }
    que.pop();
    int t = q % 10;
    if (t != 0)
      que.push(10 * q + t - 1);
    que.push(10 * q + t);
    if (t != 9)
      que.push(10 * q + t + 1);
  }

  return 0;
}


Measured memory_bytes: 1792
while 1:
    n = input()
    if n == 0: break
    A = sorted(map(int,raw_input().split()))
    c,l = A[0],0
    for i in A:
        if i == c:
            l += 1
            if l > n/2:
                print c
                break
        else:
            c = i
            l = 1
    else:
        print "NO COLOR"

Measured memory_bytes: 104256
import java.util.Collections

fun main(args: Array<String>) {
    val n = readInputLine().toInt()

    val list = mutableListOf<Int>()

    list.add(readInputLine().toInt())

    for (i in 2..n) {
        val a = readInputLine().toInt()
        val index = findIndex(list, a)
        if (index >= list.size) {
            list.add(a)
        } else {
            list[index] = a
        }
    }

    println(list.size)
}

fun readInputLine(): String {
    return readLine()!!
}

fun <T: Comparable<T>> findIndex(list: List<T>, value: T): Int {
    return Collections.binarySearch(list, value, {x, y -> if (x < y) 1 else -1}).inv()
}


Measured memory_bytes: 39092
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
	int N; cin >> N;
	ll A,B; cin >> A >> B;
	vector<ll> X(N);
	rep(i,N) cin >> X[i];
	ll ans = 0;
	rep(i,N-1){
		ans += min(A*(X[i+1]-X[i]),B);
	}
	cout << ans << endl;
	


}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
using namespace std;
#define int long long
#define fr(i,n) for (int i = 0; i < n; i++)
#define fro(i,m,n) for (int i = m; i < n; i++)
#define pb push_back
#define iter ::iterator
#define fi first
#define se second


void io(){
  #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  #endif
}

void solve(){
  //io();
  int n;
  cin>>n;
  int a[n][3];
  fr(i,n){
    cin>>a[i][0]>>a[i][1]>>a[i][2];
  }
  int dp[n+1][3];
  fr(i,3)dp[0][i]=0;
  fro(i,1,n+1){
    fr(j,3){
      dp[i][j]=a[i-1][j]+max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3]);
    }
  }
  std::cout << max(max(dp[n][0],dp[n][1]),dp[n][2]) << '\n';
}



int32_t main(){
  std::ios::sync_with_stdio(false);
  solve();
  return 0;
}


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

int main()
{
    char arr[50];
    scanf("%s",arr);
    int i,c=1;
     if(((arr[0]==arr[1])&&(arr[0]==arr[2]))||((arr[1]==arr[2])&&(arr[1]==arr[3])))printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;

int main() {
    string s;
    cin >> s;
    int n = s.size();
    vector<int> ans(n,0);
    rep(x,2) {
        int counter = 0;
        rep(i,n) {
            if(s[i] == 'R') {
                counter++;
            } else {
                ans[i] += counter / 2;
                ans[i-1] += (counter+1) / 2;
                counter = 0;
            }
        }
        reverse(ans.begin(),ans.end());
        reverse(s.begin(),s.end());
        rep(i,n) {
            if(s[i] == 'R') {
                s[i] = 'L';
            } else {
                s[i] = 'R';
            }
        }
    }
    rep(i,n) {
        cout << ans[i] << " ";
    }
    cout << "\n";
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

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

int main() {
  int n, m;
  cin >> n >> m;
  int ans = -1;
  rep(i, 1000000) {
    if (int(i * 0.08) == n) {
      if (int(i * 0.1) == m) {
        ans = i;
        break;
      }
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
class dsu:
    def __init__(self, n):
        self._n = n
        self.parent_or_size = [-1] * n

    def merge(self, a, b):
        assert 0 <= a and a < self._n
        assert 0 <= b and b < self._n
        x = self.leader(a)
        y = self.leader(b)
        if x == y:
            return x
        if -self.parent_or_size[x] < -self.parent_or_size[y]:
            x, y = y, x
        self.parent_or_size[x] += self.parent_or_size[y]
        self.parent_or_size[y] = x
        return x

    def same(self, a, b):
        assert 0 <= a and a < self._n
        assert 0 <= b and b < self._n
        return self.leader(a) == self.leader(b)

    def leader(self, a):
        assert 0 <= a and a < self._n
        if self.parent_or_size[a] < 0:
            return a
        else:
            self.parent_or_size[a] = self.leader(self.parent_or_size[a])
        return self.parent_or_size[a]

    def size(self, a):
        assert 0 <= a and a < self._n
        return -self.parent_or_size[self.leader(a)]

    def groups(self):
        leader_buf = [0] * self._n
        group_size = [0] * self._n
        for i in range(self._n):
            leader_buf[i] = self.leader(i)
            group_size[leader_buf[i]] += 1
        result = [[] for _ in range(self._n)]
        for i in range(self._n):
            result[leader_buf[i]].append(i)
        return [result[i] for i in range(self._n) if len(result[i]) > 0]


N, Q = map(int, input().split())
d = dsu(N)
ans = []
for _ in range(Q):
    t, u, v = map(int, input().split())
    if t:
        ans.append(int(d.same(u, v)))
    else:
        d.merge(u, v)

for val in ans:
    print(val)


Measured memory_bytes: 12464
use std::collections::HashSet;

use proconio::input;

fn main() {
    input! {
        n: usize,
        k: usize,
    }

    let mut snukes = HashSet::new();
    for _ in 0..k {
        input! {
            d: usize,
            a: [i32; d]
        }

        for x in a {
            snukes.insert(x);
        }
    }

    println!("{}", n - snukes.len());
}


Measured memory_bytes: 2132
use proconio::input;

fn main() {
    input!(k: usize);
    let mut t = 1;
    let mut now = 7 % k;
    let mut ckd = vec![false; k];
    let ans;
    loop {
        if now == 0 {
            ans = t;
            break;
        } else if ckd[now] {
            ans = -1;
            break;
        }
        ckd[now] = true;
        now = (now * 10 + 7) % k;
        t += 1;
    }
    println!("{}", ans);
}


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

int main(){
  int64_t a,b, n;
  cin >> a >> b >> n;
  int64_t i;
  
  if (a <= n){
    i = n - a;
    if(b <= i){
      i = i - b;
      cout << 0 << ' ' << 0;
    }else{
      i = b - i;
      cout << 0 << ' ' << i;
    }
  }else{
    i = a - n;
    cout << i << ' ' << b << endl;
  }
}
  

Measured memory_bytes: 256
n, T = map(int, raw_input().split())
arr = map(int, raw_input().split())
estimeted = arr[0] + T
start = arr[0]
total = 0
for i in range(1, n):
    if arr[i] > estimeted:
        total += estimeted - start
        start = arr[i]
    estimeted = arr[i] + T

total += estimeted - start
print total

Measured memory_bytes: 56388
#include <stdio.h>
#include <string.h>

#define MAX 2000000
#define NIL -1

int size, A[MAX+1];

void maxHeapify(int i){
  int l, r, largest, t;
  l = 2*i;
  r = 2*i+1;
  if ( l <= size && A[l] > A[i] ) largest = l;
  else largest = i;
  if ( r <= size && A[r] > A[largest] ) largest = r;
  if ( largest != i ){
    t = A[i]; A[i] = A[largest]; A[largest] = t;
    maxHeapify(largest);
  }
}

int extract(){
  int maxv;

  if ( size < 1 ) return NIL;
  maxv = A[1];
  A[1] = A[size--];
  maxHeapify(1);
  return maxv;
}

void increaseKey(int i, int key){
  int tmp;

  if ( key < A[i] ) return;
  A[i] = key;
  while ( i > 1 && A[i/2] < A[i] ){
    tmp = A[i];
    A[i] = A[i/2];
    A[i/2] = tmp;
    i = i/2;
  }
}

void insert(int key){
  size++;
  A[size] = -1000000001;
  increaseKey(size, key);
}

int main(){
  int key;
  char com[20];

  while(1){
    scanf("%s", com);
    if ( com[0] == 'i' ){
      scanf("%d", &key);
      insert(key);
    } else if (strcmp(com,"extract") == 0){
      printf("%d\n", extract());
    } else if (strcmp(com,"end")==0) break;
  }
  
  return 0;
}



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

const int MOD = 1000000007;
int dp[200010];
vector<int> before(200010, -1); // ある色の直前の位置

int main() {
  int n;
  cin >> n;
  vector<int> lc(n);
  for (int i = 0; i < n; ++i) {
    cin >> lc[i];
  }
  dp[0] = 1;
  for (int i = 0; i < n; ++i) {
    int c = lc[i];
    int bi = before[c];
    // cout << i << " " << lc[i] << " " << bi << endl;
    dp[i+1] = dp[i]; // 反転させない場合の数
    before[c] = i;
    if (bi == -1 || bi == i-1) continue;
    dp[i+1] += dp[bi+1]; // 反転させる場合の数
    dp[i+1] %= MOD;
  }
  cout << dp[n] << endl;
}



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

using namespace std;

int main(){
	int n,k,r,s,p;
	long res = 0;
	cin >> n >> k >> r >> s >> p;
	string t;
	cin >> t;
	vector<bool> win(n);
	for(int i=0;i<n;++i){
		if(t[i] == 'r'){
			if(i < k||t[i-k]!='r'||win[i-k]==false){
				res += p;
				win[i] = true;
			}else{
				win[i] = false;
			}
		}else if(t[i] == 's'){
			if(i < k||t[i-k]!='s'||win[i-k]==false){
				res += r;
				win[i] = true;
			}else{
				win[i] = false;
			}
		}else{
			if(i < k||t[i-k]!='p'||win[i-k]==false){
				res += s;
				win[i] = true;
			}else{
				win[i] = false;
			}
		}
	}
	cout << res << "\n";
}

Measured memory_bytes: 512
import heapq
from collections import defaultdict

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

graph_y = defaultdict(dict)
graph_s = defaultdict(dict)

for i in range(m):
	u, v, a, b = list(map(int, input().split()))
	graph_y[u - 1][v - 1] = a
	graph_y[v - 1][u - 1] = a
	graph_s[u - 1][v - 1] = b
	graph_s[v - 1][u - 1] = b

dist_node_ys = defaultdict(lambda: float("inf"))
dist_node_ys[s - 1] = 0

Q = []
heapq.heappush(Q, (dist_node_ys[s - 1], s - 1))

while Q: 
	dis, v = heapq.heappop(Q)
	if dist_node_ys[v] < dis:
		continue
	for i in graph_y[v]:
		u = i
		w = graph_y[v][i]
		alt = dis + w
		if dist_node_ys[u] > alt:
			dist_node_ys[u] = alt
			heapq.heappush(Q, (alt, u))


dist_node_st = defaultdict(lambda: float("inf"))
dist_node_st[t - 1] = 0

Q = []
heapq.heappush(Q, (dist_node_st[t - 1], t - 1))

while Q: 
	dis, v = heapq.heappop(Q)
	if dist_node_st[v] < dis:
		continue
	for i in graph_s[v]:
		u = i
		w = graph_s[v][i]
		alt = dis + w
		if dist_node_st[u] > alt:
			dist_node_st[u] = alt
			heapq.heappush(Q, (alt, u))

ansL = []
X = []
for i in range(n):
	heapq.heappush(X, dist_node_ys[n - 1 - i] + dist_node_st[n - 1 - i])
	ansL.append(X[0])

for i in range(1, n + 1):
	print(1000000000000000 - ansL[- i])


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


#define f(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define char_f(i,a) for(int i=(int)(a);(char)s[i]!='\0';i++)
#define rf(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define llf(i,a,b) for(long long int i=(long long int)(a);i<=(long long int)(b);i++)
#define llrf(i,a,b) for(long long int i=(long long int)(a);i>=(long long int)(b);i--)



#define ll long long
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define mem(ara) memset((ara),0,sizeof(ara))
#define memn(ara) memset((ara),-1,sizeof(ara))
#define bb begin()
#define ee end()
#define em emplace
#define eb emplace_back





#define si set<int>
#define sd set<double>
#define sll set<long long int>
#define ss set<string>
#define sc set<char>

#define pii pair<int,int>
#define pli pair<long long int,int>
#define pil pair<int,long long int>
#define pll pair<long long int,long long int>
#define pci pair<char,int>
#define pic pair<int,char>
#define pcl pair<char,long long int>
#define plc pair<long long int,char>

#define pss pair<string,string>
#define pcc pair<char,char>

#define pis pair<int,string>
#define psi pair<string,int>
#define pls pair<long long int,string>
#define psl pair<string,long long int>
#define pdd pair<double,double>
#define pcs pair<char,string>
#define psc pair<string,char>



#define vi  vector<int>
#define vll vector<long long int>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vii vector<pii>



#define mod 1000000007
#define mx (1<<30)-1
#define llmx (1ll<<62)
#define n_size 100005
#define g_size 10000005
double PI=acos(-1);
#define eps 1e-9



///unsigned int uMAX=4294967295;
///unsigned ll int ullMAX=18446744073709551615;





int arr[g_size];



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

	int n,m,T,res;

	int maxi=-mx,mini=mx,count=0;

	int i,j,k;

	bool flag;

	string s1,s2;

	char s[100000];

	int ara[n_size],ara2[n_size];

	cin>>ara[0]>>ara[1]>>ara[2];

	sort(ara,ara+3);

	cin>>k;

	int a=ara[0];
	int b=ara[1];
	int c=ara[2];

	int sum=a+b;
	sum+=((1<<k)*c);

	cout<<sum<<endl;


}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
//合成数xはx**0.5以下の約数を持つ
int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int ans; //ans=1なら後者の負け
    while(true){
        c-=b;
        if (c<=0){
            ans=1;
            break;
        }
        a-=d;
        if (a<=0){
            ans=0;
            break;
        }
    }
    if (ans==1){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3636
INF = 10000000000
a=[0 for i in range(int(1e5))]
b=[0 for i in range(int(1e5))]
ans = [INF for i in range(int(1e5))]

def main():
    h,n = map(int,input().split())
    for i in range(n):
        tmp = list(map(int,input().split()))
        a[i] = tmp[0]
        b[i] = tmp[1]
        index = min(h,a[i])
        if b[i] < ans[index]:
            ans[index] = b[i]
    
    
    for i in range(h):
        if ans[i]!=INF:
            for j in range(n):
                index = min(h,a[j]+i)
                if ans[i]+b[j] < ans[index]:
                    ans[index] = ans[i]+b[j]
    print(ans[h])
if __name__=="__main__":
    main()
    

Measured memory_bytes: 47412
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
fac = [0] * N
def ini():
  fac[0] = 1 % mod
  for i in range(1,N):
    fac[i] = fac[i-1] * i % mod"""

"""mod = 1e9+7
N = 10000000
pw = [0] * N
def ini(c):
  pw[0] = 1 % mod
  for i in range(1,N):
    pw[i] = pw[i-1] * c % mod"""

"""
def YEILD():
  yield 'one'
  yield 'two'
  yield 'three'
generator = YEILD()
print(next(generator))
print(next(generator))
print(next(generator))
"""
"""def gcd_(a,b):
  if b == 0:#結局はc,0の最大公約数はcなのに
    return a
  return gcd_(a,a % b) # a = p * b + q"""
"""def extgcd(a,b,x,y):
  d = a
  if b!=0:
    d = extgcd(b,a%b,y,x)
    y -= (a//b) * x
    print(x,y)
  else:
    x = 1
    y = 0
  return d"""


def readInts():
  return list(map(int,input().split()))
mod = 10**9 + 7
#def main():
n,m = readInts()
a = [0] * m
b = [0] * m

graph = [[False for i in range(n)] for j in range(n)]

for i in range(m):
  a[i],b[i] = map(int,input().split())
  a[i] -=1
  b[i] -=1
  graph[a[i]][b[i]] = True
  graph[b[i]][a[i]] = True

cnt = 0
now = [0] * n

def dfs(pos,nya):
  global cnt
  if pos == n:
    if now[0] == 0:
      for i in range(n-1):
        if graph[now[i]][now[i+1]] == False:
          break
        if i == n-2:
          cnt += 1
    return
  for i in range(n):
    if nya & (1 << i):
      now[pos] = i
      dfs(pos+1,nya^(1<<i))
dfs(0,(1<<n)-1)
print(cnt)
  
#if __name__ == '__main__':
#  main()

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(int argc, char const *argv[]) {
  int n;
  cin>>n;
  int max=0,count=0,tmp,ans;
  for(int i=1;i<=n;i++){
    tmp=i;
    while(1){
      if(n==1){
        cout <<1 <<endl;
        return 0;
      }
      if(tmp%2==0){
        count++;
        tmp=tmp/2;
      }
      if(tmp%2!=0){
        if(count>max){
          ans=i;
          max=count;
        }
        count=0;
        break;
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i = a;i < n;i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;

int main(){
    double memo = 0,a,b;
    int n,t;
    cin >> n >> t;
    
    rep(i,0,n){
        cin >> a >> b;
        if(memo < (double)b / (double)a){
            memo = (double)b/(double)a;
        }
    }
    
    cout << setprecision(10) << t*memo << endl;
    
    return 0;
}


Measured memory_bytes: 3272
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define ss second
#define ff first
#define Mem(x,val) memset(x,val,sizeof x)
#define pb push_back
#define all(v) v.begin(),v.end()
#define unik(v)  v.erase(unique(v.begin(),v.end()),v.end())
#define cerr(x) cerr << __LINE__ << " th Line : " << #x << " = " << x << "\n"
#define debug(a,b) cerr << #a<<" = "<<a<<"   |   "<<#b<<" = "<<b<<'\n'
#define endl '\n'
#define SZ(a) ((int)a.size())
using namespace std;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const ll mod = 1e9 + 7;
const int MX = 100+10;

int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
   
   int h,w,k;
   cin>>h>>w>>k;
   vector<vector<char>>grid(h,vector<char>(w));
   for(int i=0;i<h;i++){
	   for(int j=0;j<w;j++)cin>>grid[i][j];
   }
   int ans=0;
   for(int maskR=0;maskR < (1<<h); maskR++){
	   for(int maskC = 0; maskC < (1<<w); maskC++){
		   int black=0;
		   for(int i=0;i<h;i++){
			   for(int j=0;j<w;j++){
				if(((maskR >> i) % 2) == 0 && ((maskC >> j) % 2) == 0 && grid[i][j]=='#')black++;   
			   }
		   }
		   if(black==k) ans++;
	   }
   }
   cout<<ans<<endl;
   
   return 0;
}


Measured memory_bytes: 3636
/*  ex5_3
    Rikuta  */

#include <stdio.h>

int main(void){
    int height,width,flag;
    scanf("%d %d\n",&height,&width);
    char matrix_given[height][width+1];
    int on_off_matrix[height][width+1];
    for (int i = 0; i < height; i++)
    {
        for (int j = 0; j < width+1; j++)
        {
            on_off_matrix[i][j]=0;
        }
        
    }
    
    for (int i = 0; i < height; i++)
    {
        for (int j = 0; j < width+1; j++)
        {
            scanf("%c",&matrix_given[i][j]);
        }
        
    }
    for (int i = 0; i < height; i++)
    {   
        flag=1;
        for (int j = 0; j < width; j++)
        {
            if (matrix_given[i][j]=='#')
            {
                flag=0;
            }
            
        }
        if (flag)
        {
            for (int j = 0; j < width+1; j++)
            {
                on_off_matrix[i][j]=1;
            }
            
        }
    }
    for (int i = 0; i < width; i++)
    {
        flag=1;
        for (int j = 0; j < height; j++)
        {
            if (matrix_given[j][i]=='#')
            {
                flag=0;
            }
            
        }
        if (flag)
        {
            for (int j = 0; j < height; j++)
            {
                on_off_matrix[j][i]=1;
            }
            
        }
        
        
    }
    for (int i = 0; i < height; i++)
    {
        for (int j = 0; j < width+1; j++)
        {
            if (!on_off_matrix[i][j])
            {
                printf("%c",matrix_given[i][j]);
            }
            
        }
        
    }
    
    return 0;
}

Measured memory_bytes: 256
/* imports all std modules {{{*/
import
  std.algorithm,
  std.array,
  std.ascii,
  std.base64,
  std.bigint,
  std.bitmanip,
  std.compiler,
  std.complex,
  std.concurrency,
  std.container,
  std.conv,
  std.csv,
  std.datetime,
  std.demangle,
  std.encoding,
  std.exception,
  std.file,
  std.format,
  std.functional,
  std.getopt,
  std.json,
  std.math,
  std.mathspecial,
  std.meta,
  std.mmfile,
  std.net.curl,
  std.net.isemail,
  std.numeric,
  std.parallelism,
  std.path,
  std.process,
  std.random,
  std.range,
  std.regex,
  std.signals,
  std.socket,
  std.stdint,
  std.stdio,
  std.string,
  std.system,
  std.traits,
  std.typecons,
  std.uni,
  std.uri,
  std.utf,
  std.uuid,
  std.variant,
  std.zip,
  std.zlib;
/*}}}*/

/+---test
2
10 30
---+/
/+---test
3
200 200 200
---+/

void main(string[] args) {
  readln;

  double ans = 0;
  foreach (a; readln.split.map!(to!long)) {
    ans += 1./a;
  }
  "%.10f".writefln(1./ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

const int MAX_N = (int)1e5 + 5;
const ll MOD = (ll)1e9 + 7LL;

ll f[MAX_N];

ll mod_pow(ll a, ll n){
	ll x = a;
	ll res = 1LL;
	while(n > 0LL){
		if (n & 1LL){
			res = (res * x) % MOD;
		} // end if
		x = (x * x) % MOD;
		n >>= 1LL;
	} // end while
	return res;
}

ll nCr(ll n, ll r){
	if (n < r){
		return 0LL;
	} // end if

	if (r > n / 2LL){
		r = n - r;
	} // end if

	ll res = (f[n] * mod_pow(f[n-r], MOD - 2LL)) % MOD;
	res = (res * mod_pow(f[r], MOD - 2LL)) % MOD;
	
	return res;
}

void initComb(void){
	memset(f, 0LL, sizeof(f));
	f[0] = 1LL;
	for (int i = 1; i < MAX_N; ++i){
		f[i] = ((ll)i * f[i-1]) % MOD;
	} // end for
}

int main()
{
	initComb();
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll n; cin >> n;
	vector<int> a((int)n+1, 0);
	set<int> same; same.clear();
	ll l = -1LL, r = -1LL;
	rep (i, (int)n + 1){
		cin >> a[i];
		if (!same.count(a[i])){
			same.insert(a[i]);
		}else{
			r = (ll)i;
		} // end if
	} // end rep

	rep (i, (int)n + 1){
		if (a[i] == a[r]){
			l = (ll)i;
			break;
		} // end if
	} // end rep

	for (ll k = 1LL; k <= (ll)n + 1LL; ++k){
		ll res = (nCr(n + 1LL, k) - nCr(l + n - r, k - 1LL) + MOD) % MOD;
		cout << res << endl;
	} // end for	

	return 0;
}

Measured memory_bytes: 7040
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>


using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int INF = 1050000000;
const long long LINF = 1LL << 60;
const ll MOD = 1e9 + 7;
const int MINF = -1050000000;

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


int main() {
	
	string s;
	cin >> s;
	if (s[3] == s[2] && s[5] == s[4]) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
f = []
f[0] = 0
f[1] = 1
2.upto(100005) do |i|
  f[i] = f[i-2] + f[i-1]
end

n, m = gets.chomp.split.map(&:to_i)
if m == 0
  puts f[n+1] % 1000000007
  exit
end

a = []
a[0] = -1
s = []
1.upto(m) do |i|
  a[i] = gets.chomp.to_i
  s[i] = a[i] - a[i-1] - 1
  if s[i] == 0
    puts 0
    exit
  end
end
s[m+1] = n - a[m]

ans = 1
1.upto(m+1) do |i|
  ans *= f[s[i]]
  ans %= 1000000007
end
puts ans

Measured memory_bytes: 436988
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>  
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
	while (true) {
		int n, m;
		cin >> n >> m;
		if (n == 0) return 0;
		vector<int> geko;
		REP(i, n) {
			int tmp;
			cin >> tmp;
			geko.push_back(tmp);
		}
		int ans = -1;
		for (int i = 0; i < n; ++i) {
			for (int q = i + 1; q < n; ++q) {
				if (geko[i] + geko[q] <= m) {
					ans = max(ans, geko[i] + geko[q]);
				}
			}
		}
		if (ans == -1) {
			cout << "NONE" << endl;
		}
		else cout << ans << endl;
	}
}



Measured memory_bytes: 3168
#include <iostream>
#include<math.h>

using namespace std;


int main() {

    int A, B;

    cin >> A >> B;

    int amari = 16 - A - B;
    int sa = abs(A - B);

    if (sa > amari) {
        cout << ":(" << endl;
    } else {
        cout << "Yay!" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
const lineList = require('fs').readFileSync('/dev/stdin','utf8').trim().split('\n')

const n = parseInt(lineList[0])
const a = lineList[1].split(' ').map(e => parseInt(e) - 1)
const b = lineList[2].split(' ').map(e => parseInt(e))
const c = lineList[3].split(' ').map(e => parseInt(e))

var scores = 0
var lastTimeMenu = 19 // init value is except (-1 <= lastTimeMenu <= 18)
for(var i=0;i<a.length;i++) {
  scores += b[a[i]]

  if(lastTimeMenu+1 === a[i]) {
    scores += c[lastTimeMenu]
  }

  lastTimeMenu = a[i]
}

console.log(scores)


Measured memory_bytes: 21064
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;

namespace atcorder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] strArray = Console.ReadLine().Split(' ').ToArray();
            string S = strArray[0];
            string T = strArray[1];
            Console.WriteLine(T + S);
        }
    }
}

//文字配列の取得
//string[] strArray = Console.ReadLine().Split(' ').ToArray();
//string S = strArray[0];
//string T = strArray[1];

//文字列の取得
//string s = Console.ReadLine();

//数字配列の取得
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];

//数字の取得
//int N = int.Parse(Console.ReadLine());

//リスト型(int)の取得
//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());

//出力
//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.WriteLine(cnt);



Measured memory_bytes: 26164
//
//  main.cpp
//
 
#include <algorithm>
#include <array>
#include <assert.h>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
using namespace std;
 
using ll = long long;
using ull = unsigned long long;
 
template<typename T>
vector<T> make_vec_nd(T init, size_t size) {
	return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, size_t size, Args... rest) {
	auto inner = make_vec_nd(init, rest...);
	return vector<decltype(inner)>(size, inner);
}

#define rep(i,a,b) for(ll i=(a);i<(b);i++)
#define rrep(i,a,b) for(ll i=(a)-1;i>=(b);i--)

int main() {
	ll N;
	cin >> N;
	struct Info {
		ll x;
		ll y;
		ll h;
	};
	vector<Info> infos(N);
	rep(i,0,N) {
		cin >> infos[i].x >> infos[i].y >> infos[i].h;
	}
	ll nonzero = -1;
	rep(i,0,N) {
		if (infos[i].h > 0) {
			nonzero = i;
		}
	}
	rep(x,0,101) {
		rep(y,0,101) {
			ll dist = abs(infos[nonzero].x-x) + abs(infos[nonzero].y-y);
			ll H = infos[nonzero].h + dist;
			bool fail = false;
			rep(i,0,N) {
				ll h = max((ll)0, H - abs(infos[i].x-x) - abs(infos[i].y-y));
				if (h != infos[i].h) {
					fail = true;
					break;
				}
			}
			if (!fail) {
				cout << x << " " << y << " " << H << endl;
				return 0;
			}
		}
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;

#define loop(i,a,b) for(ll i=a;i<b;i++)
#define all(v) v.begin(), v.end() 

#define print(stuff) cout << stuff << endl
#define printc(stuff) for(auto x: stuff) cout << x << " "; cout << endl;
#define printPrec(stuff) cout << fixed << setprecision(15) << stuff << endl;
#define debug(stuff) cout << #stuff << ": " << stuff <<endl
#define debugc(stuff) cout << #stuff << ": "; for(auto x: stuff) cout << x << " "; cout << endl;
#define len length
#define ret0 return 0
#define ret return 

#define ll long long
#define ld long double
#define fi first
#define endl '\n'
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fill(ar, x) memset(ar, x, sizeof ar)

#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define pq priority_queue<ll>

// typedef tree<ll,null_type,less<ll>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;

#define inf (long long int) 1e18
#define eps 0.000001
#define mod 1000000007
#define mod1 998244353
#define MAXN (ll)1e5+5


ll f(ll a[], ll n){
    bool b = 1;
    loop(i,0,n-1){
        if(a[i] > a[i+1]){
            ret 0;
        }
    }
    ret 1;
}
void solve(){
    ll n;
    cin>>n;
    ll p[n];
    loop(i,0,n){
        cin>>p[i];
    }
    if(f(p, n)){
        print("YES");
    }
    else {
        ll b[n];
        loop(i,0,n){
            loop(j,i+1, n){
                loop(k,0,n){
                    b[k] = p[k];
                }
                swap(b[i], b[j]);
                if(f(b, n)){
                    // debugc(b);
                    // print(i<<" "<<j);
                    print("YES");
                    ret;
                }
            }
        }
        print("NO");
    }
}

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

    ll t = 1;
    // cin>>t;
    while(t--){
        solve();
    }
   
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;

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

	string str;
	cin >> str;
	int n = str.size();

	ll act = 0;
	ll res = 0;
	for (int i = n-1; i >= 0; --i) {
		if (str[i] == 'A') res += act;
		else if (str[i] == 'C' && i> 0 && str[i-1] == 'B') {
			++act;
			--i;
		} else act = 0;
	}
	cout << res << '\n';
}


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

using namespace std;

//int dirs[4][2]={{-1,0},{1,0},{0,-1},{0,1}};
//int dirs[8][2]={{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};


int main()
{
    ios::sync_with_stdio(false);
    //freopen("inp.in","r",stdin);
    //freopen("outp.out","w",stdout);
    int X;
    cin >> X;
    int ans=0;
    for(int amountItems=1; amountItems*100<=X; amountItems++)
    {
        int lo=amountItems*100;
        int hi=lo+amountItems*5;
        if(lo<=X && X<=hi) ans=1;
    }
    cout << ans << endl;
    return 0;
}


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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main()
{
    lol result{1};
    lol n; cin >> n;
    lol k;
    /*
    vector<int> a(n);
    REP(i, n)
    {
        cin >> a[i];
    }
    */

   bool check = false;

    REP(i, n)
    {
        cin >> k;
        if(k == 0)
        {
            result = 0;
            break;
        }
        //cout << k << endl;
        if(check || (k > 1000000000000000000 / result) || result*k > 1000000000000000000)
        {
            result = -1;
            //cout << "true" << endl;
            check = true;
        }
        else
        {
            result *= k;
        }
        //cout << result << endl;
    }

    cout << result << endl;
    return 0;
}

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

using namespace std;

#define sz(v)           ((int)((v).size()))
#define clr(v, d)       memset(v, d, sizeof(v))
#define rep(i, v)       for(int i=0; i<sz(v); ++i)
#define lp(i, n)        for(int i=0; i<(int)(n); ++i)
#define lpi(i, j, n)    for(int i=(j); i<(int)(n); ++i)
#define lpd(i, j, n)    for(int i=(j); i>=(int)(n); --i)
#define INF             1000000000

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

void init(){
	std::ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}

int main()
{
	init();
	int h, n, a;
	cin >> h >> n;
	for(int i = 0; i < n; ++i){
		cin >> a;
		h -= a;
		if(h <= 0){
			cout << "Yes";
			return 0;
		}
	}
	cout << "No";
	return 0;
}



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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define forn(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define ford(i, a, n) for (int i = (int)(n - 1); i >= (int)(a); --i)
#define fore(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
    for (auto i : a) cerr << i << ' ';\
    cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

template<typename T>
inline void setmax(T& a, T b) {
    if (a < b) a = b;
}

template<typename T>
inline void setmin(T& a, T b) {
    if (a > b) a = b;
}

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

const int SZ = 26;
const int N = 2e5 + 10;
int nxt[N][SZ];
int dp[N];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int n = s.length();
    vector<int> tmp(SZ, n);
    ford(i, 0, n) {
        forn(j, 0, SZ) nxt[i][j] = tmp[j];
        tmp[s[i] - 'a'] = i;
    }
    dp[n] = 0;
    ford(i, 0, n) {
        dp[i] = INF;
        forn(j, 0, SZ) setmin(dp[i], dp[nxt[i][j]] + 1);
    }
    int opt = 0;
    forn(i, 0, SZ)
        if (dp[tmp[i]] < dp[tmp[opt]]) {
            opt = i;
        }
    cout << char('a' + opt);
    int pos = tmp[opt];
    while (pos < n) {
        forn(j, 0, SZ) {
            if (dp[pos] == 1 + dp[nxt[pos][j]]) {
                cout << char('a' + j);
                pos = nxt[pos][j];
                break;
            }
        }
    }
    cout << '\n';
}


Measured memory_bytes: 21652
n,k = map(int,input().split())
a = list(map(int,input().split()))
tmp = 0
c = 0
ls = [100]
for i in range(k):
    tmp += a[i]
ls[0] = tmp
for i in range(n-k):
    tmp -= a[i]
    tmp += a[i+k]
    if ls[0] >= tmp:
        print("No")
    else:
        print("Yes")
    ls[0] = tmp
    #print(ls,tmp)

Measured memory_bytes: 94180
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S,T="";
  cin >> S;
  //S.size();
  
  for(int i=0; i < S.size(); i++){
    if(S[i] == 'B'){
      if(T.size() == 0) continue;
      T.pop_back();
    }
    else T.push_back (S[i]);
  }
  cout << T << endl;
    
    return 0;
}


Measured memory_bytes: 3636
'''
.append(要素) リストに要素を追加
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前

sort()
sorted(reverse=true)

配列の初期化
配列名=[a]*n+[b]*m

Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
from functools import reduce
from operator import mul
from collections import Counter
import itertools

num = int(stdin.readline().rstrip())

count = 0
for el in range(num + 1):
    if el % 3 != 0 and el % 5 != 0:
        count += el
print(count)


Measured memory_bytes: 68368
/*
	0521:Change
*/
#include	<iostream>

using namespace std;

int main(void) {
	while(1) {
		int m, change, coin = 0;
		cin >> m;
		if(m == 0) { break; }
		
		change = 1000 - m;
		while(change >= 500) {
			change -= 500;
			coin++;
		}
		while(change >= 100) {
			change -= 100;
			coin++;
		}
		while(change >= 50) {
			change -= 50;
			coin++;
		}
		while(change >= 10) {
			change -= 10;
			coin++;
		}
		while(change >= 5) {
			change -= 5;
			coin++;
		}
		coin += change;
		
		cout << coin << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main( void ){
	char*p,s[99];for(;~scanf(" %[^\n]",s);)for(;strstr(s,"the")||strstr(s,"that")||strstr(s,"this")?!~puts(s):1;)for(p=s;*p;p++)islower(*p)?*p=(*p-96)%26+97:0;
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;

void main_()
{
    ll n;
    cin >> n;

    string r;
    cin >> r;
    sort(begin(r), end(r));
    for (ll i = 1; i < n; ++i) {
        string S;
        cin >> S;
        sort(begin(S), end(S));
        string w;
        set_intersection(begin(S), end(S), begin(r), end(r), back_inserter(w));
        r = move(w);
    }
    cout << r << endl;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int ans=-1e8;
	int a,b;
	cin>>a>>b;
	ans=a-b;
	if(a+b>ans)	ans=a+b;
	if(a*b>ans)	ans=a*b;
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 256
l = []

a = list(input())
a.sort()
a = ''.join(a)
l.append([a,'a'])
b = list(input())
b.sort(reverse=True)
b = ''.join(b)
l.append([b,'b'])

l.sort()

if a != b:
  if l[0][1] == 'a':
    print('Yes')
  else:
    print('No')
else :
  print('No')

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
typedef long long ll;
typedef unsigned long long ull;

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

	return 0;
}


Measured memory_bytes: 256
(n, m) = [int(i) for i in input().split()]
 
A = []
b = []
 
for i in range(n):
    A.append([int(j) for j in input().split()])
 
for i in range(m):
    b.append(int(input()))
 
 
for i in range(n):
    c = 0 
    for j in range(m):
         c += A[i][j] * b[j]
    print(c)

Measured memory_bytes: 7016
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

int main()
{
	int h,w;
	cin >> h >> w;
	vector<string> S(h);
	rep(i,h)cin >> S[i];
	vector<vector<int>> mp1(h,vector<int>(w)),mp2(h,vector<int>(w));;

	int now = 0;
	for(int i = 0;i<h;++i)
	{
		now = 0;
		for(int j = 0;j < w;++j)
		{
			if(S[i][j]=='.')
			{
				now++;
				mp1[i][j]=now;
			}
			else if(S[i][j]=='#')
			{
				now = 0;
			}
		}
		for(int j=w-1;j>=0;--j)
		{
			if(S[i][j]=='.')
			{
				now = max(mp1[i][j],now);
			}
			else if(S[i][j]=='#')
			{
				now = 0;
			}
			mp1[i][j] = now;
		}
	}
	for(int i = 0;i<w;++i)
	{
		now = 0;
		for(int j = 0;j < h;++j)
		{
			if(S[j][i]=='.')
			{
				now++;
				mp2[j][i]=now;
			}
			else if(S[j][i]=='#')
			{
				now = 0;
			}
		}
		for(int j=h-1;j>=0;--j)
		{
			if(S[j][i]=='.')
			{
				now = max(mp2[j][i],now);
			}
			else if(S[j][i]=='#')
			{
				now = 0;
			}
			mp2[j][i] = now;
		}

	}
	int ans = 0;
	rep(i,h)
	{
		rep(j,w)ans = max(ans,mp1[i][j]+mp2[i][j]);
	}
	cout<<ans-1<<endl;
	return 0;
}

Measured memory_bytes: 35712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	ll n, x;
	cin >> n >> x;

	ll ans = n;
	ll a = max(x, n-x);
	ll b = min(x, n-x);
	while(b > 0){
		ans += 2*b*(a/b);
		
		ll tmp = a;
		a = b;
		b = tmp%b;
	}
	ans -= a;
	print(ans)
	return 0;
}

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

    int sq(int a){
        int b;
        b = a * a;
        return b;
    }
 
	int a[(int)2e5];

int main(){
    int k, n;
    cin >> k >> n;
    int s = 0;
    for(int i = 0; i < n; i++)
        cin >> a[i];
        a[n] = a[0] + k;
    for(int i = 0; i < n; i++)
        s = max(s, a[i+1] - a[i]);
    cout << k - s;
}

    

		


Measured memory_bytes: 1024
using System;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            var NKS = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            var N = NKS[0]; var K = NKS[1]; var S = NKS[2];
            var A = new int[N];
            for (int i = 0; i < K; i++) A[i] = S;
            for (int i = K; i < N; i++) A[i] = (S == 1000000000 ? S - 1 : S + 1);
            Console.WriteLine(string.Join(" ", A));
        }
    }
}


Measured memory_bytes: 22368
import java.util.Scanner;

class Main {
    
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	
    	int n, m, l, i, j, k, A[][], B[][];
    	long C[][];
    	
    	n = sc.nextInt();
    	m = sc.nextInt();
    	l = sc.nextInt();
    	
    	A = new int[n][m];
    	B = new int[m][l];
    	C = new long[n][l];
    	
    	for(i = 0; i < n; i++) {
    		for(j = 0; j < m; j++) {
    			A[i][j] = sc.nextInt();
    		}
    	}
    	for(i = 0; i < m; i++) {
    		for(j = 0; j < l; j++) {
    			B[i][j] = sc.nextInt();
    		}
    	}
    	
    	for(i = 0; i < n; i++) {
    		for(j = 0; j < l; j++) {
    			for(k = 0; k < m; k++) {
    				C[i][j] += A[i][k] * B[k][j];
    			}
    			System.out.print(C[i][j]);
    			if(j != l - 1) System.out.print(" ");
    		}
    		System.out.println();
    	}
    }
}


Measured memory_bytes: 55352
s = input()

ff = int(s[:2])
bb = int(s[2:])

if (ff>=1 and ff<=12) and (bb>=1 and bb<=12):
    print("AMBIGUOUS")
elif (ff>=1 and ff<=12):
    print("MMYY")
elif (bb>=1 and bb<=12):
    print("YYMM")
else:
    print("NA")

Measured memory_bytes: 3060