akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
	int n, k, q;
	cin >> n >> k >> q;
	vector<int> p(n);
	for (int i = 0; i < n; i++) {
		p[i] = 0;
	}

	for (int i = 0; i < q; i++) {
		int a;
		cin >> a;
		a--;
		p[a]++;

	}

	for (int i = 0; i < n; i++) {
		//cerr << p[i];
		if (p[i] - q + k > 0) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}

	return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ll long long
#define PINT pair<int,int>
#define f1 first
#define s2 second
const int INF = 1e9 + 7;

using namespace std;

int gcd( int m, int n )
{
    // 引数に０がある場合は０を返す
    if ( ( 0 == m ) || ( 0 == n ) ) return 0;
    else if(m%n==0) return n;
    else if(n%m==0) return m;

    // ユークリッドの方法
    while( m != n ){
        if ( m > n ) m = m - n;
        else n = n - m;
	}
	return m;
}

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

    int n,k;
    cin >> n >> k;
    vector<int> a(n);
    REP(i,n) cin >> a[i];

    sort(a.begin(),a.end());
    if(k > a[n-1]){
        cout << "IMPOSSIBLE\n";
        return 0;
    }

    int adiv = a[0];
    REP(i,n) adiv = gcd(adiv,a[i]);
    if(k%adiv) cout << "IMPOSSIBLE\n";
    else cout << "POSSIBLE\n";
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
//#include <atcoder/all>

typedef long long ll;
using namespace std;
//using namespace atcoder;

#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) for(ll i = 0; i < (ll)n; i++)
#define _reps(i, s, n) for(ll i = (ll)(s); i < (ll)n; i++)
#define REP(...) _overload(__VA_ARGS__, _reps, _rep,)(__VA_ARGS__)
#define all(v) (v).begin(),(v).end()
#define UNIQUE(v) (v).erase( unique( all(v) ), (v).end() );
#define MOD 1000000007

int main(){
	ll n;	cin >> n;
	pair<ll, ll> d[n];
	REP(i, n){
		cin >> d[i].first >> d[i].second;
	}
	ll cnt = 0;
	bool ans = false;

	REP(i, n){
		if( d[i].first == d[i].second ){
			cnt++;
		}else{
			cnt = 0;
		}

		if( cnt == 3 ){
			ans = true;
		}
	}

	if( ans )	cout << "Yes" << endl;
	else		cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);    
    int n;
    cin>>n;
    string s[n];
    int t[n];
    int ans=0;
    for(int i=0;i<n;i++){
        cin>>s[i]>>t[i];
        ans+=t[i];
    }
    string u;
    cin>>u;
    for(int i=0;i<n;i++){
        ans-=t[i];
        if(s[i]==u){
            break;
        }
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<limits.h>

int main(void){
	int n,t,count=0;

	scanf("%d",&n);
	while(n--){
		scanf("%d",&t);
		for(;t%2==0;t/=2) count++;
	}

	printf("%d\n",count);

	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
using namespace std;

typedef long long ll;

int main()
{
    ll n, a, b;
    cin >> n >> a >> b;
    vector<ll> h(n);
    for(int i=0; i<n; i++){
        cin >> h[i];
    }
    sort(h.begin(), h.end(), greater<ll> ());
    ll ad_damage = a-b;
    ll RR=h[0]/b+1, LL=0;//rrは爆発させるのに十分な回数、llは爆発させられない回数
    ll median=(RR+LL)/2;
    while(RR-LL>1){
        ll tmp=0;
        for(int i=0; i<n; i++){
            if(h[i]-median*b>0){
                if((h[i]-median*b)%ad_damage!=0)tmp++;
                tmp+=(h[i]-median*b)/ad_damage;
            }
        }
        if(tmp<=median) RR=median;
        else LL=median;
        median=(RR+LL)/2;
    }
    cout << RR << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std; 
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl "\n" 
#define pb push_back
#define mp make_pair
typedef long long int ll;
 
int main()
{
    fast;
    ll n, m;
    cin >> n >> m;
    ll sum = 0;
    for(ll i = 0; i < m; i++){
        ll k; cin >> k;
        sum+= k;
    }
    if(n - sum < 0){
        cout << -1 << endl;
    }
    else{
        cout << n-sum << endl;
    }

    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
bool check(int d,int m){
	string dd=to_string(d);
	if((int)dd.length()<2) {
		return false;
	}
	int f=dd[0]-'0';
	int s=dd[1]-'0';
	if(f<2 || s<2) {
		return false;
	}
	return (f*s==m);
}
int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	int m;
	int d;
	cin>>m>>d;
	int cnt=0;
	for(int i=1; i<=m; i++) {
		for(int j=1; j<=d; j++) {
			if(check(j,i)) {
				cnt++;
			}
		}
	}
	cout<<cnt<<endl;


	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<stack>
#include<string>
#include<algorithm>

bool check(std::string str){
  bool check1=false;
  bool check2=false;
  bool check3=false;
  for(int i=0;i<str.length();i++){
    if(str[i]=='3')
      check1=true;
    else if(str[i]=='5')
      check2=true;
    else if(str[i]=='7')
      check3=true;
  }
  return check1&&check2&&check3;
}

int main(){
  long N,sum=0;
  std::cin>>N;
  std::stack<std::string> stack;
  
  stack.push("0");
  
  while(!stack.empty()){
    std::string cur_str=stack.top();
    long temp=std::stol(cur_str);
    if(temp<=N)
      if(check(cur_str))
        sum++;
    stack.pop();
    
    if(temp<=N){
      int i=3;
      while(i<8){
        std::string tempstr=cur_str+std::to_string(i);
        stack.push(tempstr);
        i+=2;
      }
    }
  }
  
  std::cout<<sum<<std::endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	stack<int>s1;
	stack<pair<int, int> >s2;
	int sum=0;
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++){
		if(s[i]=='\\')s1.push(i);
		else if(s[i]=='/'&&!s1.empty()){
			int j=s1.top();
			s1.pop();
			sum+=i-j;
			int a=i-j;
			while(!s2.empty()&&s2.top().first>j){
				a+=s2.top().second;
				s2.pop();
			}
			s2.push(make_pair(j,a));
		}
	} 
	
	vector<int>ans;
	while(!s2.empty()){
		ans.push_back(s2.top().second);
		s2.pop();
	}
	reverse(ans.begin(),ans.end());
	cout<<sum<<endl;
	cout<<ans.size();
	for(int i=0;i<ans.size();i++){
		cout<<" "<<ans[i];
	}
	cout<<endl;
}


Measured memory_bytes: 3304
#include <bits/stdc++.h>
#define INF LLONG_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(int i=0; i<n; ++i)
#define MOD 1000000007
using namespace std;
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() {
  int M, D; cin >> M >> D;
  int ans = 0;
  for(int m=2; m<=M; ++m) {
    for(int d=2; d<=D; ++d) {
      int d10 = d/10;
      int d1 = d%10;
      if(d1 >=2 && d10 >=2 && (d10 * d1) == m) ++ans;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define va first
#define vb second
#define lb lower_bound
#define pb push_back
#define all(v) v.begin(),v.end()
#define fio ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
using ll = long long;
using lf = long double;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

ll D[3005][3005];
bool v[3005][3005];
ll a[3005];
int n;

ll dp(int s, int e){
    if(s > e) return 0;
    ll &d = D[s][e];
    if(v[s][e]) return d;
    v[s][e] = 1;
    int turn = (n - e + s) & 1;
    if(turn){ //First
        return d = max(dp(s+1,e)+a[s],dp(s,e-1)+a[e]);
    }else{ //Second
        return d = min(dp(s+1,e)-a[s],dp(s,e-1)-a[e]);
    }
}

int main(){
    fio;
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> a[i];
    cout << dp(1,n) << '\n';
}

Measured memory_bytes: 78592
from fractions import *
n = int(input())
a = [0]+list(map(int, input().split()))+[0]
b = [0]*(n+2)
c = [0]*(n+2)
for i in range(1, n+1):
	b[i] = gcd(b[i-1], a[i])
for i in range(n, 0, -1):
	c[i] = gcd(c[i+1], a[i])
print(max(gcd(b[i-1], c[i+1]) for i in range(1, n+1)))


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

int main() {

	int a, b, c;

	cin >> a >> b >> c;

	if (a == b) {
		cout << c << endl;
	}

	else if (b == c) {
		cout << a << endl;
	}

	else {
		cout << b << endl;
	}

	return 0;
}

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

int main() {
    double a, l, x, sb, sa, S;
    while (cin >> a >> l >> x) {
        S = 0;
        sa = (a + l + l) / 2;
        sb = (l + l + x) / 2;
        S = sqrt(sa * (sa - a) * (sa - l) * (sa - l)) +
            2 * sqrt(sb * (sb - l) * (sb - (l + x) / 2) * (sb - (l + x) / 2));
        //cout << setprecision(10) << S << endl;
        printf("%.6lf\n", S);
    }
    return 0;
}

Measured memory_bytes: 3116
N = int(input())
txy = [input() for i in range(N)]
now_pos = [0, 0]
now_time = 0
fail_flag = False
for i in range(N):
    t, x, y = map(int, txy[i].split(' '))
    if (x+y) % 2 != t % 2:
        fail_flag = True
    distance = (abs(now_pos[0]-x) + abs(now_pos[1]-y))
    if distance > t:
        fail_flag = True
    if fail_flag:
        print('No')
        exit()
print('Yes')


Measured memory_bytes: 10272
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
''' 
------------------------
author : iiou16
------------------------
'''

def main():
    A, B, C = list(map(int, input().split()))

    nokori = A - B
    if C > nokori:
        print(C - nokori)
    else:
        print("0")

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {

            //入力読取。
            string strTabArea = Console.ReadLine();
            string[] strTabArr = strTabArea.Split(' ');
            int intRow = int.Parse(strTabArr[0]);
            int intColumn = int.Parse(strTabArr[1]);
            int[,] intTabArr = new int[intRow, intColumn];
            for (int rowIndex = 0; rowIndex < intRow; rowIndex++)
            {
                string strNum = Console.ReadLine();
                string[] strNumArr = strNum.Split(' ');
                for (int columnIndex = 0; columnIndex < intColumn; columnIndex++)
                {
                    intTabArr[rowIndex, columnIndex] = int.Parse(strNumArr[columnIndex]);
                }
            }

            //新しい表の生成
            int[,] valueTable = new int[intRow + 1, intColumn + 1];
            for (int row = 0; row < intRow; row++)
            {
                for (int col = 0; col < intColumn; col++)
                {
                    valueTable[row, col] = intTabArr[row, col];
                }

            }

            //行、及び列の合計値。
            int intSum = 0;

            //1行ごとに合計値を計算し、表に格納。
            for (int rowIndex = 0; rowIndex < intRow; rowIndex++)
            {
                for (int columnIndex = 0; columnIndex < intColumn; columnIndex++)
                {
                    valueTable[rowIndex, intColumn] += intTabArr[rowIndex, columnIndex];
                    intSum += intTabArr[rowIndex, columnIndex];
                }
            }

            //1列ごと(たて)に合計値を計算し、表に格納。
            for (int columnIndex = 0; columnIndex < intColumn; columnIndex++)
            {
                for (int rowIndex = 0; rowIndex < intRow; rowIndex++)
                {
                    valueTable[intRow, columnIndex] += intTabArr[rowIndex, columnIndex];
                }
            }

            //行、及び列の合計値を表に格納。
            valueTable[intRow, intColumn] = intSum;

            //出力
            for (int rowIndex = 0; rowIndex < intRow + 1; rowIndex++)
            {
                for (int columnIndex = 0; columnIndex < intColumn + 1; columnIndex++)
                {
                    if (columnIndex < intColumn)
                    {
                        Console.Write("{0} ", valueTable[rowIndex, columnIndex]);
                    }
                    else
                    {
                        Console.Write(valueTable[rowIndex, columnIndex]);
                    }
                    
                }
                Console.WriteLine();
            }

            Console.ReadKey();
        }
    }

}



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

using namespace std;
#define MAX 1000001

vector<int> indegree(MAX);
vector<int> g[MAX];
vector<int> dist(MAX);
bool visited[MAX];

void dfs(int node) {
	visited[node] = true;
	
	for(int i = 0;i<g[node].size();i++) {
		indegree[g[node][i]]--;
		dist[g[node][i]] = max(dist[g[node][i]], dist[node] + 1);
		if(indegree[g[node][i]] == 0) {
			dfs(g[node][i]);
		}
	}
}

int main() {
	int n, m;
	cin>>n>>m;
	
	for(int i = 0;i<m;i++) {
		int u, v;
		cin>>u>>v;
		g[u].push_back(v);
		indegree[v]++;
	}
	
	for(int i = 1;i<=n;i++) {
		if(!visited[i] and indegree[i] == 0) {
			dfs(i);
		}
	}
	
	int ans = 0;
	for(int i = 1;i<=n;i++) {
		ans = max(ans, dist[i]);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 39424
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define sf scanf
#define pf printf
#define MAX 200002
#define INF 1000000
#define EXP 1e-6
#define endl '\n'
#define all(v) v.begin(), v.end()
#define FOR(i, a, b, c) for( int i = a; i < b; i+=c )
#define rep(i, a) for( int i = 0; i < a; i++ )
#define fastio ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);

typedef long long int ll;
const int maxn = 1e6 + 5;
const ll MOD = 1e9 + 7;

using namespace std;

typedef pair <int, int> ii;
typedef pair <int, ii> trie;
typedef vector <int> vi;
typedef vector <ii> vii;
typedef vector <vii> vvii;
typedef vector <vi> vvi;
typedef vector <bool> vb;
typedef vector <trie> vtrie;
typedef bitset <maxn> bs;

int arr[maxn], n, k;
int dp[maxn];

int cost( int pos )
{
	int &ret = dp[pos];
	if( pos == (n-1) ) return 0;
	if( pos == (n-2) ) return abs(arr[pos + 1] - arr[pos]);
	if( ret != -1 ) return ret;
	int nth_place = INT_MAX;

	for( int i = 1; i <= k; i++ )
		if( (pos + i) < n )
			nth_place = min( nth_place, cost( pos + i ) + abs(arr[pos + i] - arr[pos]) );
	//snd_place = cost( pos + 2 ) + abs(arr[pos + 2] - arr[pos]);

	return ret = nth_place;
}

int main()
{
	fastio

    cin >> n >> k;
    for( int i = 0; i < n; i++ )
    	cin >> arr[i];

    memset( dp, -1, sizeof(dp) );

    int min_cost = cost( 0 );
    cout << min_cost << endl;

	return 0;

}

Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
typedef long long int ll; 
typedef long double ld; 


	
int main()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	
	ll n;
	cin>>n;
	
	ll br[n+1];
	
	for(ll i=0;1+i<n;i++)
	{
		cin>>br[i];
	}
	ll ar[n+1];
	memset(ar,-1,sizeof(ar));
	for(ll i=0;i<n-1;i++)
	{
		
		if(i!=n-2)
		{
			
			if(br[i+1]>=br[i])
			{
				if(ar[i]==-1)
				ar[i] = max(ar[i],br[i]);
				ar[i+1] = max(ar[i+1],br[i]);
			}
			else{
				if(ar[i]==-1)
				ar[i] = max(ar[i],br[i]);
			}
		}
		else{
			if(ar[i]==-1)
			ar[i] = max(ar[i],br[i]);
			ar[i+1] = max(ar[i+1],br[i]);
		}
		
	}
	ll ans = 0;
	for(ll i=0;i<n;i++)
	{
		//cout<<ar[i]<<" ";
		ans+=ar[i];
	}
	
	cout<<ans<<endl;
}




Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int n ;
    cin>>n ;
    long long ans = 0 ;
    for(int i = 0 ; i<n ; i++){
        int l,r ;
        cin>>l>>r ;
        ans += r-l+1 ;
    }
    cout<<ans<<endl ;
    return 0;
}


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

int main() {
  int N, M, X;
  cin >> N >> M >> X;
  
  int A;
  vector<int> box(101, 0);
  for (int i=0; i<M; i++) {
    cin >> A;
    box.at(A) = 1;
  }
  
  //現在値からマスNまでのコスト
  int cost1=0;
  for (int i=X; i<N; i++) {
    cost1 += box.at(i);
  }
  //現在値からマス0までのコスト
  int cost2=0;
  for (int i=X; i>0; i--) {
    cost2 += box.at(i);
  }

  //小さいほうを出力
  cout << min(cost1, cost2) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	int a[1000]={0};
	a[1]=300000;
	a[2]=200000;
	a[3]=100000;
	int x,y,sum=0;
	cin>>x>>y;
	sum+=a[x];
	sum+=a[y];
	if(x==y&&y==1){
		sum+=400000;
	}
	cout<<sum;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	const maxWord = (1 << 30)
	buf := []byte{}
	sc.Buffer(buf, maxWord)
	sc.Split(bufio.ScanWords)
}

func input() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	a, _ := strconv.Atoi(input())
	b := input()
	b = strings.Replace(b, ".", "", 1)
	if b[:2] == "00" {
		b = b[2:]
	} else if b[0] == '0' {
		b = b[1:]
	}
	bInt, _ := strconv.Atoi(b)
	fmt.Println(a * bInt / 100)
}


Measured memory_bytes: 1756
#include <bits/stdc++.h>
using namespace std;  
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
 
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define F first
#define S second
 
const int MOD = 1e9 + 7; 
const int N = 1e5+10; 
const int INF = 1e9 + 5; 
set<ll> s; 
int main(void) 
{

	#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
	#endif
	int k;
	cin >> k; 
	queue<ll> q; 
	for (int i=1; i<=9; i++) {
		s.insert(i); 
		q.push(i); 
	}
	while (true) 
	{
	//	cout << "size:"<<s.size()<<'\n';
		if (s.size()>=2*100000) break;
		ll now = q.front(); 
		q.pop(); 
		if (now%10 == 9) 
		{
			now *= 10; 
			q.push(now+9);
			s.insert(now+9); 
			q.push(now+8);
			s.insert(now+8); 
		
		}

		else if (now%10 == 0) 
		{
			now *= 10; 
			q.push(now); 
			s.insert(now); 
			q.push(now+1); 
			s.insert(now+1); 
		}
		else
		{
			int x = now%10; 
			now *= 10; 
			q.push(now+x); 
			s.insert(now+x); 
			q.push(now+x-1); 
			s.insert(now+x-1); 
			q.push(now+x+1);
			s.insert(now+x+1); 
		}
	}
	//cout << "size:"<<s.size()<<'\n';
	int cnt = 1; 
	/*
	for (auto x : s)
	{
		cout << cnt<<":"<<x<<'\n';
		if (x==3234566667)
			cout << cnt << '\n';
		cnt++;
	}
	*/
	for (ll it : s) 
	{
	//	cout << it << '\n';
		if (cnt == k)
			cout << it << '\n';
		cnt++;
	}
	
	return false; 
}


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

int main() {
    vector<char> tmp(3);
    rep(i, 3) cin >> tmp[i];
    set<char> S(tmp.begin(), tmp.end());
    if (S.size() == 3) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Map<String,Integer> count = new HashMap<String,Integer>();
		String longest = "";
		while(sc.hasNext()) {
			String s = sc.next();
			if (s.length() > longest.length()) {
				longest = s;
			}
			if (count.containsKey(s)) {
				count.put(s, count.get(s) + 1);
			}else{
				count.put(s, 1);
			}
		}
		int max = 0;
		String most = "";
		for(Entry<String, Integer> e:count.entrySet()) {
			if (e.getValue() > max) {
				max = e.getValue();
				most = e.getKey();
			}
		}
		System.out.println(most + " " + longest);
	}

}

Measured memory_bytes: 17164
n, a, b = map(int, input().split())
s = input()

for i in s:
    if a == b == 0:
        print('No')
        continue
    if i == 'c':
        print('No')
        continue
    if i == 'a':
        if a > 0:
            print('Yes')
            a -= 1
            continue
        else:
            print('Yes')
            b -= 1
            continue
    if i == 'b':
        if b > 0:
            print('Yes')
            b -= 1
            continue
        else:
            print('No')
            continue

Measured memory_bytes: 4016
#include<bits/stdc++.h>
using namespace std;
//size_t f = string::npos
//make pair, tuple

int main(){
      int arr[3];cin >> arr[0] >> arr[1] >> arr[2];
      sort(arr, arr + 3);
      if(arr[2] == arr[0] + arr[1])cout << "Yes";
      else cout << "No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define krep(i,k,n,m) for(int i=k;i<n;i+=m)
#define erep(i,k,n) for(int i=k;i<n;i++)
#define mod 1000000007;
//最大公約数
int gcd(int s,int b){
    if(b==0)return s;
    return gcd(b,s%b);
}
signed main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    if(n%2!=0){
        cout<<"No"<<endl;
        return 0;
    }
    for(int i=0;i<n/2;i++){
        if(s[i]!=s[i+n/2]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

#define rep(i, n) REP(i, 0, n)
#define REP(i, a, n) for(int i = a ; i < (int)n ; i++)
#define ALL(v) v.begin(), v.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define eps 1e-14
#define INF 1e9
#define m0(x) memset(x, 0, sizeof(x))

using namespace std;

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

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

signed main(){
  string s;
  
  int ans = 700;
  cin >> s;
  
  if(s[0] == 'o') ans += 100;
  if(s[1] == 'o') ans += 100;
  if(s[2] == 'o') ans += 100;
  
  cout << ans << endl;

}


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

int main() {
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    int ans = a * x + b * y;
    for (int i = 1; i <= max(x, y); i++) {
        int comb = c * 2 * i;
        int xx = max(0, x - i);
        int yy = max(0, y - i);
        comb += xx * a + yy * b;
        ans = min(ans, comb);
    }
    cout << ans << endl;
    return 0;
}

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

int maxx, minn;
int n, x[120], ans, i;
int main () {
	
	maxx = 0; 
	minn = 1000;
		
	cin >> n;
	for (i=0; i<n; i++) {
		cin >> x[i];
		maxx=max(maxx,x[i]);
		minn=min(minn,x[i]);
	}
	ans = maxx - minn;
	cout << ans;
return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
long long dp[10005][105][2];
string k;
int n,d;
long long rec(int i,int sum,int ch){
	if(i==n&&sum==0)return 1;
	if(i==n)return 0;
	if(dp[i][sum][ch]!=-1)return dp[i][sum][ch];
	dp[i][sum][ch]=0;
	if(!ch)for(int j=0;j<=9;j++){
		dp[i][sum][ch]=(dp[i][sum][ch]+rec(i+1,(sum+j)%d,0))%(1000000007);
	}
	else for(int j=0;j<=(k[i]-'0');j++){
		dp[i][sum][ch]=(dp[i][sum][ch]+rec(i+1,(sum+j)%d,(j==k[i]-'0')?1:0))%1000000007;
	}
	return dp[i][sum][ch];
}
int main()
{
	cin>>k>>d;
	n=k.length();
	long long pre=0,ans=0;
	for(int i=0;i<n;i++)for(int j=0;j<=d;j++)dp[i][j][0]=dp[i][j][1]=-1;
	ans=(rec(0,0,1)+1000000006)%1000000007;
	cout<<ans;
}

Measured memory_bytes: 17408
#include<bits/stdc++.h>
using namespace std;
unsigned long long x[100010];
int main()
{
	unsigned long long c,b,s,ans=0;
	cin>>c>>b>>s;
	for(int i=0;i<c;i++)
	{
		cin>>x[i];
	}
	for(int i=0;i<c-1;i++)
	{
		ans+=min((x[i+1]-x[i])*b,s);
	}
	cout<<ans<<endl;
	return 0;
}  

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

typedef long long ll;
typedef long double ld;
using namespace std;
mt19937_64 mrand(chrono::steady_clock::now().time_since_epoch().count());
//mt19937_64 mrand(42);
#define ii for(int i=1;i<=n;++i)
#define ji for(int j=1;j<=n;++j)
#define jj for(int j=1;j<=m;++j)
#define ij for(int i=1;i<=m;++i)
#define sz(x) ((ll)x.size())
#define all(x) x.begin(),x.end()
#define al(x) x+1,x+1+n
#define asd cout<<"ok"<<endl;
#define asdd cout<<"okok"<<endl;
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define pr(v) for(auto i:v) cout<<i<<" ";cout<<endl
#define prt(a, l, r) for(auto i=l;i<=r;++i) cout<<a[i]<<" ";cout<<endl;
#define pc(x) __builtin_popcount(x)
#define pb push_back

int main() {
    int a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
}

Measured memory_bytes: 3588
a,b,c,x,y=gets.chomp.split(" ").map { |e| e.to_i  }

def abs(n)

  if n>=0
    return n
  else
    return -n
  end

end


i = 2*x*c + abs(y-x)*b
j =  2*y*c + abs(x-y)*a

if a+b < 2*c
    puts a*x + b*y
else
  if x < y
    puts 2*y*c > i ? i : 2*y*c
  else
    puts 2*x*c > j ? j : 2*x*c
  end
end


Measured memory_bytes: 1788
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
"""
h,w = LI()
a,b = LI()
y = h//a
x = w//b
ans = h*w-a*y*b*x
print(ans)
"""

#B
"""
def m(x,y):
    if x == y:
        return "T"
    if x == "F":
        return "T"
    return "F"
n = I()
p = input().split()
ans = p[0]
for i in range(1,n):
    ans = m(ans,p[i])
print(ans)
"""

#C
s = [[1]*8 for i in range(4)]
for i in range(4):
    s.insert(2*i,[1,0,1,0,1,0,1,0])
for j in range(8):
    for i in range(1,8):
        s[j][i] += s[j][i-1]
for j in range(8):
    for i in range(1,8):
        s[i][j] += s[i-1][j]
s.insert(0,[0,0,0,0,0,0,0,0,0])
for i in range(1,9):
    s[i].insert(0,0)
q = I()
for _ in range(q):
    a,b,c,d = LI()
    print(s[c][d]-s[c][b-1]-s[a-1][d]+s[a-1][b-1])

#D
"""
n = I()
a = LI()
dp = [float("inf") for i in range(n)]
b = [[] for i in range(n)]
ind = [0 for i in range(100001)]
for i in range(n):
    k = bisect.bisect_left(dp,a[i])
    dp[k] = a[i]
    b[k].append(a[i])
    ind[a[i]] = max(i,ind[a[i]])
for i in range(n):
    if dp[i] == float("inf"):break
    b[i].sort()
    b[i] = b[i][::-1]
i -= 1
ans = b[i][0]
now_ind = ind[b[i][0]]
now_v = b[i][0]
while i >= 0:
    for j in b[i]:
        if ind[j] < now_ind and j < now_v:
            ans += j
            now_ind = ind[j]
            now_v = j
    i -= 1
print(ans)
"""
#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T



Measured memory_bytes: 8852
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
	int ans = 0;
	int n,x;
	scanf("%d %d",&n,&x);
	for(int i = 0;i < n; ++i)
	{
		int m;
		scanf("%d",&m);
		ans = __gcd(ans,abs(x - m));
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;
int main() {
  int n, m, x;
  cin >> n >> m >> x;
  vector<int> c(n);
  vector<vector<int> > a(n, vector<int>(m));
  long long ans = 1000000000000;
  for (int i = 0; i < n; i++) {
    cin >> c[i];
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 0; i < (1<<n); i++) {
    int cost = 0;
    vector<int> s(m);
    for (int j = 0; j < n; j++) {
      if (i>>j&1) {
        cost += c[j];
        for (int k = 0; k < m; k++) {
          s[k] += a[j][k];
        }
      }
    }
    bool ok = true;
    for (int j = 0; j < m; j++) {
      if (s[j]<x) ok = false;
    }
    if (ok) {
      ans = min(ans, (long long)cost);
    }
  }
  if (ans == 1000000000000) printf("-1\n");
  else cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3156
// atcoder/abc143/A/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

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

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

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

  int a, b;
  while (cin >> a >> b) {
    cout << max(0, a - b - b) << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
ll ans;
ll N;
ll A[200005];
ll sum;



int main(){
    cin >> N;
    for (int i = 1;i<N;i++){
        int a;
        cin >> a;
        A[a-1] += 1;
    }
    for (int i = 0;i<N;i++){
      cout << A[i] << endl;
    }
}



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

#define INF 1e18
#define int long long

template<typename T>
void printVec(vector<T> &v) {
    for(int i = 0; i < v.size(); i++) {
        cout << v[i] << " ";
    }
    cout << endl;
}

signed main() {
    int n; cin >> n;
    vector<pair<int, int>> v(n);
    for(int i = 0; i < n; i++) {
        int a; cin >> a;
        v[i].first = a;
        v[i].second = i;
    }

    sort(v.begin(), v.end());

    for(int i = 0; i < n; i++) {
        cout << v[i].second + 1 << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 2432
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i, n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i, n) for(ll i=(ll)(n-1);i>=0;i--)
#define FOR(i, a, b) for(ll i=(ll)(a); i<=(ll)(b); i++)
#define RFOR(i, a, b) for(ll i=(ll)(a);i>=(ll)(b); i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

signed main()
{
	int N, K;
	cin >> N >> K;
	vector<pair<int, int>> edge;
	vector<pair<int, int>> vs;
	if(K>(N-1)*(N-2)/2){
		cout << -1 << endl;
		return 0;
	}
	for(int i=2; i<=N; i++){
		edge.PB(pair<int, int>(1, i));
	}
	for(int i=2; i<=N-1; i++){
		for(int k=i+1; k<=N; k++){
			vs.PB(pair<int, int>(i, k));
		}
	}
	while(vs.size() != K){
		edge.PB(vs.back());
		vs.pop_back();
	}
	cout << edge.size() << endl;
	for(auto p: edge){
		cout << p.F << " " << p.S << endl;
	}
}

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

typedef long long ll;

int main() {
    int N, b = 0;
    cin >> N;
    vector<int> a(N);
    rep(i, N) {
        cin >> a[i];
        b ^= a[i];
    }
    rep(i, N) {
        cout << (b ^ a[i]);
        if (i == N - 1) cout << "\n";
        else cout << " ";
    }
}

Measured memory_bytes: 3976
n,a,b=map(int,input().split())

def digitSum(x):
            s=str(x)
            array=list(map(int,s))
            return sum(array)
l=[]
for i in range(n+1):
            if a<=digitSum(i)<=b:
                      l.append(i)
print(sum(l))                      


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

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

#define f first
#define s second
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define pb push_back

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (int i = (b); i >= (a); --i)
#define R0F(i, a) ROF(i, 0, a-1)
#define trav(x, a) for (auto& x: a)

const int MX  = 2e5+5;
const int MOD = 1e9+7;
const ll  INF = 1061109567; // 4557430888798830399LL
const ld  EPS = 1e-9;
const ld  PI  = acos(-1);

ll f(ll x, ll k) {
    return x/k;
}

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    ll k, a, b; cin >> k >> a >> b;

    cout << (f(b, k)-f(a-1, k) >= 1 ? "OK" : "NG");

}


Measured memory_bytes: 3640
//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC target ("avx2")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define shandom_ruffle random_shuffle

using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
const int nax=3007;
const ll mod=998244353;

int a, b, aa, bb;

ll dp[nax][nax];
ll pra[nax][nax];
ll gor[nax][nax];

inline void dod(ll &a, ll b)
{
	if ((a+=b)>=mod)
		a-=mod;
}

void sdod(ll &a, ll b)
{
	a=(a+b)%mod;
}

int main()
{
	scanf("%d%d%d%d", &a, &b, &aa, &bb);
	dp[a][b]=1;
	for (int i=a; i<=aa; i++)
	{
		for (int j=b; j<=bb; j++)
		{
			//~ if (dp[i][j])
				//~ debug() << i << " " << j << " " << dp[i][j];
			sdod(dp[i+1][j+1], dp[i][j]*i*j);
			sdod(pra[i][j], dp[i][j]);
			sdod(gor[i][j], dp[i][j]);
			sdod(pra[i][j+1], pra[i][j]*i);
			sdod(gor[i+1][j], gor[i][j]*j);
			sdod(dp[i+1][j+1], pra[i][j]*i);
			sdod(dp[i+1][j+1], gor[i][j]*j);
			
			if (i==aa)
				sdod(dp[i][j+1], dp[i][j]*i);
			if (j==bb)
				sdod(dp[i+1][j], dp[i][j]*j);
		}
	}
	
	printf("%lld\n", dp[aa][bb]);
	return 0;
}


Measured memory_bytes: 215284
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,n) for(int i=0;i<(int)n;i++)
const int INF = (1LL<<31)-1;

int H,W,sh,sw,th,tw;
vector<string> G;
int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};

int solve(){
    vector<vector<int> > dist(H+1,vector<int>(W+1,INF));
    deque<pair<P,int> > que;
    que.push_back({{sh,sw},0});

    while(!que.empty()){
        auto q = que.front();
        que.pop_front();
        P v = q.first;
        int cost = q.second;
        if(dist[v.first][v.second]!=INF) continue;
        dist[v.first][v.second] = q.second;

        rep(i,4){
            P nv = {v.first+dx[i],v.second+dy[i]};
            if(nv.first<0 || nv.first>=H || nv.second<0 || nv.second>=W) continue;
            if(G[nv.first][nv.second]=='#') continue;
            que.push_front({nv,cost});
        }
        for(int x=-2;x<=2;x++){
            for(int y=-2;y<=2;y++){
                P nv = {v.first+x,v.second+y};
                if(nv.first<0 || nv.first>=H || nv.second<0 || nv.second>=W) continue;
                if(G[nv.first][nv.second]=='#') continue;
                que.push_back({nv,cost+1});
            }
        }
    }

    if(dist[th][tw]==INF) return -1;
    else return dist[th][tw];
}

int main(){
    cin >> H >> W;
    cin >> sh >> sw;
    cin >> th >> tw;
    sh--; sw--; th--; tw--;
    G.resize(H+1);
    rep(i,H) cin >> G[i];

    cout << solve() << endl;
}

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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

long long INF=LLONG_MAX;

ll a[100111];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	ll h,n; cin >> h >> n;
	ll sum = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		sum+=a[i];
	}
	if(sum>=h)cout << "Yes" << endl;
	else cout << "No" << endl;
}	


Measured memory_bytes: 1024
#include <math.h>
#include <bits/stdc++.h>//一括で読み込み
typedef long long ll;
using namespace std;
static const int MAX_N = 1000000;

int n,l;
int nums[MAX_N];
int answers[MAX_N];
int deq[MAX_N];

void solve()
{
  int s = 0, decIn = 0;//deqInは既にdeqに入れた個数、連続的に変化
 
  for (int i = 0; i < n; i++)//数字の全個数回
  {
    while(s < decIn && nums[deq[decIn-1]] >= nums[i]) decIn--;

    deq[decIn] = i;//まずdeq[0]を0に。nums[0]<nums[1]でdeq[0]=0で確定しdeq[1]を1に、他はdeq[0]を1に。
    decIn++;
 
    if (i+1 >= l)//ループ回数が区間の長さ以上になったら
    {
      answers[i+1-l] = nums[deq[s]];//解はdeq[s]の数字
 
      if(deq[s] == i+1-l) s++;//解の個数番目と、値deq[s]が同じ時s++
    }
  }
 
  for (int i = 0; i <= n-l; i++)
  {
    if(i > 0) printf(" ");
    printf("%d", answers[i]);
  }
  
  printf("\n");
}
 
main()
{
  cin >> n >> l;
  for (int i = 0; i < n; i++) scanf("%d", &nums[i]);
  
  solve();
  return 0;
}


Measured memory_bytes: 14888
#include<cstdio>
#include<cstring>
#include<queue>
#include<algorithm>
using namespace std;
const int maxn=100;
bool vst[maxn][maxn]; // ·ÃÎÊ±ê¼Ç
int dir[4][2]={0,1,0,-1,1,0,-1,0}; // ·½ÏòÏòÁ¿
int h,w;
int anm=0;

struct State // BFS ¶ÓÁÐÖÐµÄ×´Ì¬Êý¾Ý½á¹¹
{
	int x,y; // ×ø±êÎ»ÖÃ
	int Step_Counter; // ËÑË÷²½ÊýÍ³¼ÆÆ÷
};

State a[maxn];
char  b[maxn][maxn];

bool CheckState(State s) // Ô¼ÊøÌõ¼þ¼ìÑé
{
	if(!vst[s.x][s.y] && b[s.x][s.y]=='.') // Âú×ãÌõ¼þ
		return 1;
	else // Ô¼ÊøÌõ¼þ³åÍ»
		return 0;
}

void bfs(State st)
{
	queue <State> q; // BFS ¶ÓÁÐ
	State now,next; // ¶¨Òå2 ¸ö×´Ì¬£¬µ±Ç°ºÍÏÂÒ»¸ö
	st.Step_Counter=0; // ¼ÆÊýÆ÷ÇåÁã
	q.push(st); // Èë¶Ó
	vst[st.x][st.y]=1; // ·ÃÎÊ±ê¼Ç
	while(!q.empty())
	{
		now=q.front(); // È¡¶ÓÊ×ÔªËØ½øÐÐÀ©Õ¹
		if(now.x==h&&now.y==w) // ³öÏÖÄ¿±êÌ¬£¬´ËÊ±ÎªStep_Counter µÄ×îÐ¡Öµ£¬¿ÉÒÔÍË³ö¼´¿É
		{
			printf("%d\n",h*w-now.Step_Counter-anm-1); // ×öÏà¹Ø´¦Àí
			return;
		}
		for(int i=0;i<4;i++)
		{
			next.x=now.x+dir[i][0]; // °´ÕÕ¹æÔòÉú³ÉÏÂÒ»¸ö×´Ì¬
			next.y=now.y+dir[i][1];
			next.Step_Counter=now.Step_Counter+1; // ¼ÆÊýÆ÷¼Ó1
			if(CheckState(next)) // Èç¹û×´Ì¬Âú×ãÔ¼ÊøÌõ¼þÔòÈë¶Ó
			{
				q.push(next);
				vst[next.x][next.y]=1; //·ÃÎÊ±ê¼Ç
			}
		}
		q.pop(); // ¶ÓÊ×ÔªËØ³ö¶Ó
	}
	printf("-1\n");
	return;
}

int main()
{
	scanf("%d %d",&h,&w);
	for(int i=1;i<=h;i++)
		for(int j=1;j<=w;j++)
			scanf(" %c",&b[i][j]);
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			if(b[i][j]=='#') anm++;
		}
	}
	State ans;
	ans.x=1;
	ans.y=1;
	bfs(ans);
	return 0;
}



Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <map>
#include <list>
#include <cmath>
using namespace std;
typedef long long ll;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define mp make_pair
#define pb push_back
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9+7;

int x[10], y[10];

double dist(int i, int j) {
	double dx = x[i] - x[j];
	double dy = y[i] - y[j];
	return pow(dx*dx + dy*dy, 0.5);
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) cin >> x[i] >> y[i];

	double ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i+1; j < n; j++) {
			ans += dist(i, j) * 2 / n;
		}
	}

	printf("%8lf\n", ans);
    return 0;
}


Measured memory_bytes: 640
ABCD = input()

for i in range(2 ** 3):
    res = ABCD[0]
    c = int(ABCD[0])
    for j in range(1, 4):
        if (i >> (j - 1)) & 1:
            c += int(ABCD[j])
            res += "+" + ABCD[j]
        else:
            c -= int(ABCD[j])
            res += "-" + ABCD[j]
    if c == 7:
        print(res + "=7")
        exit()


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = (int)1e7;  
using  p = pair<int,int>;
int n,m;
auto c = vector<vector<int> >();

int main(){
   c = vector<vector<int> >(3,vector<int>(3,0));
   
   for (int i = 0; i < 3; i++)
   {
      for (int j = 0; j < 3; j++)
      {
         cin >> c[i][j];
      }  
   }

   bool flag = true;
   for (int i = 0; i < 2; i++)
   {
      if(c[i][0]-c[i+1][0]!=c[i][1]-c[i+1][1]||
         c[i][1]-c[i+1][1]!=c[i][2]-c[i+1][2]
      ) {
         flag = false;
         break;
      }
   }
   
   cout << (flag ? "Yes":"No");
   
}
  
  

Measured memory_bytes: 256
import java.util.Scanner;

/**
 *
 * @author kke2
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String hex = sc.next();
        String fex = sc.next();
        int dec = Integer.parseInt(hex, 16);
        int inc = Integer.parseInt(fex, 16);
        if (dec < inc) {
            System.out.println("<");
        }
        if (inc < dec) {
            System.out.println(">");
        }
        if (inc == dec) {
            System.out.println("=");
        }

        // TODO code application logic here
    }

}

Measured memory_bytes: 20948
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;
namespace io{
    #define re register
    #define ll long long
    #define inf 0x3f3f3f3f
    #define il inline 
    #define in1(a) read(a)
    #define in2(a,b) in1(a),in1(b)
    #define in3(a,b,c) in2(a,b),in1(c)
    #define in4(a,b,c,d) in2(a,b),in2(c,d)
    il void readl(ll &x){
        x=0;ll f=1;char c=getchar();
        while(c<'0'||c>'9'){if(c=='-')f=-f;c=getchar();}
        while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
        x*=f;
    }
    il void read(int &x){
        x=0;int f=1;char c=getchar();
        while(c<'0'||c>'9'){if(c=='-')f=-f;c=getchar();}
        while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
        x*=f;
    }
}using namespace io;
#define N 105
int n;
double a[N];
priority_queue<double,vector<double>,greater<double> > q;
int main(){
	read(n);
	for(re int i=1;i<=n;i++) scanf("%lf",&a[i]),q.push(a[i]);
	for(re int i=1;i<=n-1;i++){
		double x=q.top();
		q.pop();
		double y=q.top();
		q.pop();
		q.push((x+y)/2); 
	}
	printf("%lf",q.top());
	return 0;
}

Measured memory_bytes: 256
import sys 
s=input()
s=s[:len(s)-1]
for i in range(len(s)):
    #print("s:{},長さ:{},前半:{},後半:{}".format(s,len(s),s[:int(len(s)/2)],s[int(len(s)/2):]))
    if len(s)%2==0 and (s[:int(len(s)/2)]==s[int(len(s)/2):]):
        print(len(s))
        sys.exit()
    else:
        s=s[:len(s)-1]

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

using namespace std;

int main()
{
  char a[105];
  cin.getline(a,105);
  int n=strlen(a);
  sort(a,a+n);
  char z=a[0];
  int flag=1;
  // puts(a);
  int count=1;
  for(int i =1;i<n;i++){
    if(z==a[i])
    {count++;
    z=a[i];}
    // cout<<count<<endl;}
    else if (z!=a[i]){
      z=a[i];
      // cout<<count;
      if(count%2!=0){flag=1;break;}
      else flag=0;
      count=1;
      // cout<<count<<endl;
    }
  }
  if(count%2!=0){flag=1;}
  else flag=0;
  if(flag){cout<<"No";}
  else cout<<"Yes";
}


Measured memory_bytes: 256
import sys
pm = ["+", "-"]
# table1 = [0007,0016,0025,0034,0043,0052,0061,0070,0106,0115,0124,0133,0142,0151,0160,
# 0205,0214,0223,0232,0241,0250,0304,0313,0322,0331,0340,0403,0412,0421,0430,0502,
# 0511,0520,0601,0610,0700,1006,1015,1024,1033,1042,1051,1060,1105,1114,1123,1132,1141,1150,1204,1213,
# 1222,1231,1240,1303,1312,1321,1330,1402,1411,1420,1501,1510,1600,2005,2014,2023,
# 2032,2041,2050,2104,2113,2122,2131,2140,2203,2212,2221,2230,2302,2311,2320,2401,
# 2410,2500,3004,3013,3022,3031,3040,3103,3112,3121,3130,3202,3211,3220,3301,3310,
# 3400,4003,4012,4021,4030,4102,4111,4120,4201,4210,4300,5002,5011,5020,5101,5110,
# 5200,6001,6010,6100,7000]
ABCD = str(input())
for s0 in pm:
    for s1 in pm:
        for s2 in pm:
            if(eval(ABCD[0] + s0 + ABCD[1] + s1 + ABCD[2] + s2 + ABCD[3] ) == 7):
                print(ABCD[0] + s0 + ABCD[1] + s1 + ABCD[2] + s2 + ABCD[3] + "=7")
                sys.exit()


Measured memory_bytes: 3060
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
ans = 0
for i in range(n-1):
  if a[i]+1 == a[i+1]:
    ans += b[a[i]-1]+c[a[i]-1]
  else:
    ans += b[a[i]-1]
ans += b[a[-1]-1]
print(ans)

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

int main(){
  int n, k;
    cin >> n >> k;
  double p=0; //= max(0, (n-k+1));

    for(int i=1; i<=n; i++){
      ll tmp=i, cnt=0;
      while(tmp<k){
        tmp *= 2;
        cnt += 1;
      }
      if(cnt==0) p += 1.0/n;
      else p += pow(0.5, cnt)/n;
      //cout << p << endl;
    }
    cout << fixed << setprecision(15) << p << endl;


}

Measured memory_bytes: 256