akhauriyash/Code-Regression huggingface dataset:
#pragma region
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define vi vector<int>
#define vd vector<double>
#define vs vector<string>
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m-1);i>=(int)(n);i--)
#define rev(i, n) revi(i, n, 0)
#define each(i, n) for(auto&& i: n)
#define sz(v) ((int)(v).size()) 
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define uniq(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define dump(x) cerr << #x << " = " << x << endl
#define gcd __gcd
int lcm(int a, int b){return a / gcd(a, b) * b;}
const int INF = 1e18;
const int MOD = 1e9 + 7;
const double EPS = 1e-15;
const double PI = acos(-1);
int dig(int n){return (int)(log10(n) + 1);}
int abc(char x){return (int)(x)-(int)('a');} // 0~25
char abc(int x){return (char)(x+(int)('a'));} 
int ABC(char x){return (int)(x)-(int)('A');}
char ABC(int x){return (char)(x+(int)('A'));}
void solve();
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	solve();
}
#pragma endregion

void solve() {
	int a; string s;
	cin >> a >> s;
	if (a < 3200) s = "red";
	cout << s << endl;
}

Measured memory_bytes: 256
from collections import deque

S, inv = deque(input()), False
Q = int(input())
for _ in range(Q):
    q = input().split()
    if len(q) == 1:
        inv = not inv
        continue
    F, C = q[1], q[2]
    if (F == '1') ^ inv:
        S.appendleft(C)
    else:
        S.append(C)
print(''.join(S)[::-1] if inv else ''.join(S))


Measured memory_bytes: 8436
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,m,num[30],cnt,js;
char s[2000];
int main()
{
	int i,j;
	scanf("%d%d",&n,&m);
	for (i=1;i<=n;i++)
	{
	  scanf("%s",s);
	  for (j=0;j<m;j++)
	    num[s[j]-'a']++;
	}
	if (n%2==0&&m%2==0)
	{
		for (i=0;i<=26;i++)
		  if (num[i]%4!=0) {printf("No");return 0;}
		printf("Yes");
	}
	else
	if ((n%2!=0&&m%2==0)||(n%2==0&&m%2!=0))
	{
		if (n%2!=0)  swap(n,m);
		for (i=0;i<=26;i++)
		  if (num[i]%4!=0)
		  {
            if (num[i]%2!=0)  {printf("No");return 0;}
            else  js++;
          }
        if (js>n/2)  printf("No");
        else  printf("Yes");
	}
	else
	{
		cnt=0;
		js=0;
		for (i=0;i<=26;i++)
		  if (num[i]%4!=0)
		  {
		  	if (num[i]%2!=0)  cnt++;
		  	else  js++;
		  	if (num[i]%4==3)  js++;
		  	if (cnt>1) {printf("No");return 0;}
		  }
		if (cnt==1&&js<=(n-1+m-1)/2)  printf("Yes");
		else  printf("No");
	}
}

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

using namespace std;

int n, lans, ans, j;
string str[200005];

int main()
{
    cin>>n;
    for(int i = 0; i < n; i ++)
        cin>>str[i];
    sort(str, str + n);
    for(int i = 0; i < n; i ++)
    {
        lans = 0;
        for(j = i; j < n; j ++)
        {
            if(str[j] != str[i])
                break;
            lans ++;
        }
        i = j - 1;
        //cout<<j<<endl;
        ans = max(ans, lans);
    }
    for(int i = 0; i < n; i ++)
    {
        lans = 0;
        for(j = i; j < n; j ++)
        {
            if(str[j] != str[i])
                break;
            lans ++;
        }
        i = j - 1;
        if(lans >= ans) 
            cout<<str[i]<<endl;
    }
    //system("pause");
    return 0;
}

Measured memory_bytes: 14208
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <ratio>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <climits>
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define in insert
#define vll vector<ll>
#define endl "\n"
#define pll pair<ll,ll>
#define f first
#define s second
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define int ll
#define sz(x) (ll)x.size()
#define all(x) (x.begin(),x.end())
using namespace std;

 
const ll INF = 1e18;
const ll N =(1e5+5); // TODO : change value as per problem
const ll MOD = 1e9+7;

int a[N];
void solve(){
	int n;
	cin >> n;
	for(int i =1;i<=n;i++){
		cin >> a[i];
	}

	// for(int i =1;i<=20;i++){
	// 	int k = i;
	// 	int cur = k;
	// 	for(int j =1;j<=n;j++){
	// 		cur -= (cur % a[j]);
	// 	}
	// 	cout << cur << endl;
	// }
	int lo = 2,hi= 1e18;
	int ans = INF;
	for(;lo<=hi;){
		int k = (lo + hi)>>1ll;
		int cur = k;
		for(int i =1;i<=n;i++){
			cur -= (cur % a[i]);
		}
		if(cur == 2){
			ans = min(ans,k);
			hi = k-1;
		}
		else if(cur > 2) hi = k-1;
		else lo = k+1;
	}
	// cout << ans << endl;
	int x = ans;	
	lo = 2,hi = 1e18;
	ans = -1;
	for(;lo<=hi;){
		int k = (lo + hi)>>1ll;
		int cur = k;
		for(int i =1;i<=n;i++){
			cur -= (cur % a[i]);
		}
		if(cur == 2){
			ans = max(ans,k);
			lo = k+1;
		}
		else if(cur > 2) hi = k-1;
		else lo = k+1;
	}
	int y = ans;
	if(x == INF || y == -1){
		cout << -1 << endl;
		return;
	}
	cout << x << " " << y << endl;
}
signed main(){
 
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
     // freopen(".in","r",stdin);freopen(".out","w",stdout);
    
     ll tt=1;   
     // cin >> tt;
    while(tt--){    
        solve();
    }    
}

Measured memory_bytes: 4396
#include<iostream>
#include<cmath>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;

int main(){
    int w, a, b;
    int ans;
    cin >> w >> a >> b;
    if(a<=b){
        if(b<a+w){
            ans=0;
        }else{
            ans=b-(a+w);
        }
    }else{
        if(a<b+w){
            ans=0;
        }else{
            ans=a-b-w;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
fn get_input() -> String {
    let mut word = String::new();
    std::io::stdin().read_line(&mut word).unwrap();
    word.trim().to_owned()
}

fn main() {
    let n:usize = get_input().parse().unwrap();

    let mut v:Vec<i64> = Vec::new();
    let vline = get_input();
    for l in vline.split_whitespace() {
        v.push(l.parse().unwrap());
    }

    let mut c:Vec<i64> = Vec::new();
    let cline = get_input();
    for l in cline.split_whitespace() {
        c.push(l.parse().unwrap());
    }

    let mut ans = 0;
    for i in 0..n {
        if v[i] > c[i] {
            ans += v[i] - c[i];
        }
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include <iostream>
#include <string>

using namespace std;

int main(){
  int n, start, end, mid;
  bool is_male;
  string gender_start, gender_end, gender_mid;
  int c = 0;
  cin >> n;
  start = 0;
  end = n - 1;
  cout << start << endl;
  cin >> gender_start;
  if (gender_start == "Vacant") {
    return(0);
  }

  cout << end << endl;
  cin >> gender_end;
  if (gender_end == "Vacant") {
    return(0);
  }

  
  while (true) {
    mid = (end + start) / 2;
    cout << mid << endl;
    cin >> gender_mid;
    if (gender_mid == "Vacant") {
      return(0);
    }
    if (((mid - start) % 2 == 0 && gender_mid != gender_start) ||
	((mid - start) % 2 == 1 && gender_mid == gender_start)) {
      end = mid;
      gender_end = gender_mid;
    } else {
      start = mid;
      gender_start = gender_mid;
    }
    c++;
  }
}


Measured memory_bytes: 852
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
 
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  map<char,int> s;
  rep(i, 4){
    char t;
    cin >> t;
    s[t]++;
  }
  for(pii a : s){
    if(a.second != 2){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

for i in range(n):
    if a[i] % 4 == 0:
        a[i] = 2
    elif a[i] % 2 == 0:
        a[i] = 1
    else:
        a[i] = 0
# print(a)

if a.count(0)+(1 if 1 in a else 0) <= a.count(2)+1:
    print('Yes')
    exit(0)
print('No')


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

int gcd(int x, int y){
	while(x > 0 && y > 0){
		if(x > y) x %= y; else y %= x;
	}	
	return x + y;
}
const int MX = 100500;
int a[MX];

int main() {
	int n, k;
	cin >> n >> k;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	int kk = a[0];
	for(int i = 1; i < n; i++){
		kk = gcd(kk, a[i]);
	}
	for(int i = 0; i < n; i++){
		if(a[i] >= k){
			a[i] -= k;
			if(a[i] % kk == 0) {cout << "POSSIBLE"  << endl; return 0;}
		}
	}
	cout << "IM";
	cout << "POSSIBLE" << endl;
	return 0;
}

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

int main() {
  int n, sum = 1;
  string s;
  cin >> n >> s;
  char tmp = s.at(0);
  for (int i = 1;i < n;i++) {
    if (tmp != s.at(i)) {
      sum++;
      tmp = s.at(i);
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 512
/*
The Number of Windows
<問題文>
長さ Nの数列 a1,a2,a3,...,aNが与えられます。また, 次のような質問が Q個与えられます。
i個目の質問では, 整数 xiが与えられます。各質問について, 1≤l≤r≤N かつ al+al+1+...+ar−1+ar≤xi
を満たす整数 (l,r) の組の個数を求めてください。
<入力>
入力は以下の形式で与えられる。
N Q
a1 a2... aN
x1 x2... xQ
<出力>
それぞれの質問に対し, 解の個数を 1 行に出力せよ。
*/
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<iostream>
using namespace std;
int N,Q;
typedef long long ll;
ll a[100000];
ll solve(ll S){
  ll sum=0,ans=0,k=0;
  for(int i=0;i<N;i++){
    sum+=a[i];
    while(sum>S){
      sum-=a[k];
      k++;
    }
    ans+=(i-k+1);
  }
  return ans;
}

int main(){

  scanf("%d %d",&N,&Q);
  for(int i=0;i<N;i++)scanf("%lld",&a[i]);
  for(int i=0;i<Q;i++){
    ll x;
    scanf("%lld",&x);
    printf("%lld\n",solve(x));    
  }

  return 0;
}
/*※しゃくとり法・・・「条件」を満たす区間(連続する部分列)、最小の長さを求めよ
　　　　　　　　　　　　「条件」を満たす区間(連続する部分列)、最大の長さを求めよ
　　　　　　　　　　　　「条件」を満たす区間(連続する部分列)を数え上げよ

*/


Measured memory_bytes: 3984
H, W, D = gets.chomp.split(" ").map(&:to_i)
A = []
H.times do
    A << gets.chomp.split(" ").map(&:to_i)
end

px = Array.new(H*W+1)
py = Array.new(H*W+1)
ruisekiwa = Array.new(H*W+1, 0)

H.times do |i|
    W.times do |j|
        px[A[i][j]] = i
        py[A[i][j]] = j
    end
end

((D+1)..(H*W)).each do |i|
    ruisekiwa[i] = ruisekiwa[i-D] + (px[i] - px[i-D]).abs + (py[i] - py[i-D]).abs
end

Q = gets.chomp.to_i

Q.times do
    l, r = gets.chomp.split(" ").map(&:to_i)
    puts ruisekiwa[r] - ruisekiwa[l]
end

Measured memory_bytes: 6140
package main

import (
  "fmt"
)

func main() {
  res := make(map[int]int)
  for i := 0; i < 3; i++ {
    var a int 
    fmt.Scan(&a)
    res[a]++
  }
  ans := "No"
  if len(res) == 2 {
    ans = "Yes"
  }
  fmt.Println(ans)

}

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

#define rep(i, n) for(int i = 0; i < n; i++)

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    int A[N]; rep(i, N) cin >> A[i];
    int acc_left[N+1] = {};
    int acc_right[N+1] = {};
    acc_right[N] = 0;
    //A[0],...A[N-1]を順番に訪れる
    int pos = 0;
    for(int i = 0; i < N; i++){
        acc_left[i+1] = acc_left[i] + abs(pos - A[i]);
        pos = A[i];
    }
    pos = 0;
    for(int i = N-1; i >= 0; i--){
        acc_right[i] = acc_right[i+1] + abs(pos - A[i]);
        pos = A[i];
    }
    //rep(i, N+1) cout << acc_left[i] << " "; cout << endl;
    //rep(i, N+1) cout << acc_right[i] << " "; cout << endl;

    //acc_left[i]: 0 -> A[0] -> ... -> A[i-1]に行くまでの移動距離
    //acc_right[i]: A[i] -> ... -> A[N-1] -> 0に行くまでの移動距離
    rep(i, N){
        //A[i]を訪れない
        if(i >= 1 && i <= N-2) cout << acc_left[i] + acc_right[i+1] + abs(A[i-1] - A[i+1]) << endl;
        else if(i == 0) cout << acc_left[i] + acc_right[i+1] + abs(A[i+1]) << endl;
        else cout << acc_left[N-1] + abs(A[N-2]) << endl;
    }
    return 0;
}

Measured memory_bytes: 2432
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> P;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[100000],dp[100][100];

int main(){
  char a[50][50],b[50][50];
  cin >> n >> m;
  rep(i,0,n)rep(j,0,n)cin >> a[i][j];
  rep(i,0,m)rep(j,0,m)cin >> b[i][j];
  s = "No";
  rep(i,0,n){
    rep(j,0,n){
      l = 0;
      // if(n-j > m)break;
      rep(k,0,m){
        rep(p,0,m){
          if(a[i+k][j+p] == b[k][p])l++;
        }
      }
      if(l == m * m)s = "Yes";
    }
  }
  print(s);
  return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())

mod = 10 ** 9 + 7
N = 10 ** 6

#逆元テーブル
inv_t = [0]+[1]
for i in range(2, N):
    inv_t += [inv_t[mod % i] * (mod - int(mod / i)) % mod]

#階乗計算
kai = [1, 1]
rev_kai = [1, inv_t[1]]
for i in range(2, N):
    kai.append(kai[-1] * i % mod)
    rev_kai.append(rev_kai[-1] * inv_t[i] % mod)

# コンビネーション計算
def cmb(n, r):
    return kai[n] * rev_kai[r] * rev_kai[n-r] % mod

def prm(n, r):
    return kai[n] * rev_kai[n-r] % mod

ans = 0
tmp = 1

# 包除原理に従って場合の数を求める
for k in range(n+1):
    #　!(Ai != Bi)、つまり　Ai == Bi　という条件N個からK個選び
    # それらの条件の「かつ」の条件を満たす場合の数考える
    ans += tmp * cmb(n, k) * prm(m-k, n-k) % mod # KはAと一致するように決めて、残りのN-K箇所を自由に決める
    ans %= mod
    tmp *= -1

# Aの選び方をかける
ans *= prm(m, n)
ans %= mod

print(ans)



Measured memory_bytes: 127584
#include <stdio.h>
#define N 100

int main ()
{
  int A[1000],i,j,v,data,a;

  scanf("%d",&data);
  for(i=0;i<data;i++)
    {
      scanf("%d",&A[i]);
    }
  for(i=1;i<data;i++)
    {
      for(a=0;a<data;a++)
	{
	printf("%d",A[a]);
	if(a<data-1)
	  printf(" ");
	}
      v=A[i];
      j=i-1;
      while(j>=0&&A[j]>v)
	{
	  A[j+1]=A[j];
	  j--;
	}
      A[j+1]=v;
      printf("\n");
    }
  for(i=0;i<data;i++)
	{
	printf("%d",A[i]);
	if(i<data-1)
	  printf(" ");
	}

      printf("\n");
      return 0;
}



Measured memory_bytes: 2060
const line = require('fs').readFileSync('/dev/stdin', 'utf-8').trim().split('\n');

// {index: List {id, val}} -> {vart, edge}
const getMST = graph => {
    const v = [0];
    const result = [];
    const l = Object.keys(graph).length;

    while(v.length != l) {
        const vert = v.map(x => graph[x])
                      .reduce((acc, x) => [...acc, ...x])
                      .filter(x => v.every(y => y !== x.id))

        const min = vert.reduce((acc, x) => acc.val > x.val ? x : acc);
        
        v.push(min.id);
        result.push(min);
    }

    return result;
};


const data = line
    .slice(1)
    .map(x => {
        return x.trim().split(' ')
            .map((y, i) => { return {id: i, val: Number(y)}; })
            .filter(x => x.val !== -1);
    })
    .reduce((acc, x, i) => {
        acc[i] = x;
        return acc;
    }, {});

console.log(getMST(data).reduce((acc, x) => acc + x.val, 0));



Measured memory_bytes: 32972
n=int(input())
nums=list(map(int,input().split()))
tree={}

def show(tree,i,number):
    if tree[number][2]==None:
        if tree[number][1]==None:
            if tree[number][0]==None:
                print("node "+str(i+1)+": key = "+str(number)+", ")
            else:
                print("node "+str(i+1)+": key = "+str(number)+", left key = "+str(tree[number][0])+", ")
        else:
            print("node "+str(i+1)+": key = "+str(number)+", left key = "+str(tree[number][0])+", right key = "+str(tree[number][1])+", ")
    else:
        if tree[number][1]==None:
            if tree[number][0]==None:
                print("node "+str(i+1)+": key = "+str(number)+", parent key = "+str(tree[number][2])+", ")
            else:
                print("node "+str(i+1)+": key = "+str(number)+", parent key = "+str(tree[number][2])+", left key = "+str(tree[number][0])+", ")
        else:
            print("node "+str(i+1)+": key = "+str(number)+", parent key = "+str(tree[number][2])+", left key = "+str(tree[number][0])+", right key = "+str(tree[number][1])+", ")

for i in range(n):
    number=nums[i]
    tree[number]=[None,None,None]
    if i==0:
        if i+2<=n:
            tree[number]=[nums[i+1],nums[i+2],None]
        elif i+1<=n:
            tree[number]=[nums[i+1],None,None]
        show(tree,i,number)
    else:
        tree[number][2]=nums[int((i+1)/2)-1]
        if 2*(i+1)<n+1:
            if 2*(i+1)+1<n+1:
                tree[number][0]=nums[2*(i+1)-1]
                tree[number][1]=nums[2*(i+1)]
            else:
                tree[number][0]=nums[2*(i+1)-1]
        show(tree,i,number)



Measured memory_bytes: 5640
List_32=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(List_32[int(input())-1])


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15
#define MOD 1000000007

#define access(i) a[i/3][i%3]
int gcd(int x, int y)
{
    if(y==0)
        return x;
    return gcd(y, x%y);
}

 long long numbers[500005];

  int main(){

 ll x;
  cin>>x;

   for(ll i=-1000;i<=1000;i++){
    for(ll j=-1000;j<=1000;j++){
        if(i*i*i*i*i-j*j*j*j*j == x){
            cout<<i<<" "<<j<<endl;
             return 0; }
    }
   }


  return 0;
  }

Measured memory_bytes: 3628
import numpy
h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]
a = numpy.asarray(a)
a = a[:, numpy.any(a == "#", axis=0)]
a = a[numpy.any(a == "#", axis=1)]
for i in range(len(a)):
    print("".join(a[i]))


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

using namespace std;

#define int long long
#define ll long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES puts("YES\n")
#define Yes puts("Yes\n")
#define NO  puts("NO\n")
#define No  puts("No\n")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }



signed main() {

	int Q;
	cin >> Q;

	priority_queue<int> down;	// 大きい順に取り出せる。medianはこっちに入れる。
	priority_queue<int, vector<int>, greater<>> up;	// 小さい順に取り出せる
	int downsum = 0, upsum = 0;

	int sum = 0;
	while (Q--) {
		int kind;
		cin >> kind;
		if (kind == 1) {
			int a, b;
			cin >> a >> b;
			sum += b;

			if (down.size() == 0) {
				down.push(a);
				downsum += a;
				continue;
			}

			if (down.size() > up.size()) {
				int t = down.top();
				if (a >= down.top()) {
					// dddd|uuu -> dddd|uauu
					up.push(a);		upsum += a;
				}
				else {
					// dddd|uuu -> ddad|duuu
					down.pop();		downsum -= t;
					down.push(a);	downsum += a;
					up.push(t);		upsum += t;
				}
			}
			else if (down.size() == up.size()) {
				int t = up.top();
				if (a <= up.top()) {
					// dddd|uuuu -> dddad|uuuu
					down.push(a);	downsum += a;
				}
				else {
					// dddd|uuuu -> ddddu|uauu
					down.push(t);	downsum += t;
					up.pop();		upsum -= t;

					up.push(a);		upsum += a;
				}
			}
			else {
				assert(1);
			}
			
		}
		else {
			int median = down.top();
			int ans = sum;
			ans += upsum - (int)up.size() * median;
			ans += (int)down.size() * median - downsum;
			cout << median << " " << ans << endl;
		}
	}


	return 0;
}


Measured memory_bytes: 3828
import sys

a = sys.stdin.readline().rstrip()
a_int = int(a)

if a_int%2==0:
    print("0.5")
elif a_int == 1:
    print("1.0000000000")
else:
    b = ((a_int - 1)/2 + 1) / a_int
    print('{:.10f}'.format(b))




Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REP(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main(){
  int N, L;
  cin >> N >> L;
  // taste is L, L+1, L+2, ... , L+N-1
  double taste_sum = 0;
  REP(i, 0, N)
    taste_sum += (L+i);

  int min_abs = inf;
  int taste_temp;
  REP(i, 0, N) {
    if ( min_abs > abs(L+i) ){
      taste_temp = L+i;
      min_abs = abs(L+i);
    }
  }

  cout << taste_sum - taste_temp << endl;

  return 0;
}


Measured memory_bytes: 256
import bisect
X,K,D = map(int,input().split())

def binary_search():#0以上になる最小回数を求める
    low = 0
    high = K#Kは移動回数

    while low <= high:
        mid  = (low + high)//2
        guess = mid
        if X + D*guess >= 0:
            if abs(X+D*guess) < D:
                return mid
            else:
                high = mid -1
        else:
            low = mid + 1
    return None

if X >= 0:#スタート位置はマイナスから
    X = -X

if X + D*K < 0:#0未満のとき
    print(abs(X+D*K))
else:#0以上の時
    n = binary_search()
    if (K -n)%2 == 0:
        print(abs(X + D*n))
    else:
        print(abs(X + D*(n-1)))

Measured memory_bytes: 9220
import math

a,b,C = tuple(float(n) for n in input().split())
C = math.radians(C)
S = a*b*math.sin(C) / 2
L = a + b + math.sqrt(a**2+b**2-2*a*b*math.cos(C))
h = b*math.sin(C)
print("{:.8f}\n{:.8f}\n{:.8f}".format(S,L,h))


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;

// 最大公約数 : 3,4 ->  1
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

void solve()
{
	ll a, b;
	cin >> a >> b;

	map<ll, bool> cd;
	cd[1] = true;
	ll prime = 2;
	while(a >= prime * prime)
	{
		if (a % prime == 0)
		{
			while(a % prime == 0) a /= prime;
			cd[prime] = true;
		}
		prime++;
	}
	cd[a] = true;

	prime = 2;
	ll ans = 1;
	while(b >= prime * prime)
	{
		if (b % prime == 0)
		{
			while(b % prime == 0) b /= prime;
			if (cd.find(prime) != cd.end())
			{
				ans++;
			}
		}
		prime++;
	}
	if (b != 1 && cd.find(b) != cd.end())
	{
		ans++;
	}

	cout << ans;
}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 3648
//Walking in JOI Kingdom
#include <iostream>

using namespace std;
typedef long long ll;

static const int MAX = 100000;

enum DIRECTION {
    EAST = 1,
    WEST = 2
};

struct House {
    ll a;
    int d;
    House() {}
    House(ll a, int d): a(a), d(d) {}
};

int N, Q;
ll T;
House H[MAX + 1];
ll A[MAX + 1];
bool Traced[MAX + 1];

ll trace(int target) {
    if(Traced[target]) return A[target];
    ll a;
    if(H[target].d == EAST) {
        if(target == N) a = H[target].a + T;
        else {
            int neighbor = target + 1;
            if(H[neighbor].d == EAST) {
                if(H[neighbor].a - H[target].a >= T) {
                    a = H[target].a + T;
                } else {
                    a = min(H[target].a + T, trace(neighbor));
                }
            }
            else a = min(H[target].a + T, (H[target].a + H[neighbor].a) / 2);
        }
    } else if(H[target].d == WEST) {
        if(target == 1) a = H[target].a - T;
        else {
            int neighbor = target - 1;
            if(H[neighbor].d == WEST) {
                if(H[target].a - H[neighbor].a >= T) {
                    a = H[target].a - T;
                } else {
                    a = max(H[target].a - T, trace(neighbor));
                }
            }
            else a = max(H[target].a - T, (H[target].a + H[neighbor].a) / 2);
        }
    }
    Traced[target] = true;
    A[target] = a;
    return a;
}

int main() {
    scanf("%d %lld %d", &N, &T, &Q);

    ll a;
    int d;
    for(int i = 1; i < N + 1; i++) {
        scanf("%lld %d", &a, &d);
        H[i] = House(a, d);
        Traced[i] = false;
    }

    int target;
    for(int i = 0; i < Q; i++) {
        scanf("%d", &target);
        cout << trace(target) << endl;
    }
}


Measured memory_bytes: 7148
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
using namespace std;
typedef long long LL;
const int N = 1e6+7 , MOD = 1e9+7;
const double PI = acos(0.0) * 2;
int n;
LL a[105];
LL gg(LL c,LL d)
{
    if(c < d)
    {
        LL temp = c;
        c = d;
        d = temp;
    }
    return c%d == 0 ? d : gg(d,c%d);
}
int main()
{
    while(~scanf("%d",&n))
    {
        for(int i = 1;i <= n;i++)scanf("%lld",a+i);
        LL ans = 1;
        for(int i = 1;i <= n;i++)
        {
                LL h = gg(ans,a[i]);
                ans = ans / h * a[i];
        }
        printf("%lld\n",ans);
    }
    return 0;
}


Measured memory_bytes: 256
n=int(input())
f=[list(map(int,input().split())) for _ in range(n)]
p=[list(map(int,input().split())) for _ in range(n)]
ans=-pow(10,9)
# bit全探索
for i in range(1,2**10):
  s=[]
  for j in range(10):
    if ((i>>j) & 1):#0~9の時間のうち、お姉ちゃんの店が営業する時間
      s.append(j)
  ansi=0
  for j in range(n):
    ansi+=p[j][sum([f[j][si] for si in s])]
  ans=max(ans,ansi)
print(ans)


Measured memory_bytes: 3064
import itertools
import math

N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]

p = itertools.permutations(xy, N)
ans = 0
for v in p:
    for i in range(N-1):
        ans += math.sqrt((v[i][0]-v[i+1][0])**2 + (v[i][1]-v[i+1][1])**2)
ans /= math.factorial(N)
print(ans)

Measured memory_bytes: 73868
#include <iostream>
#include <limits.h>
using namespace std;

int main() {
	int n, a[100010], l, max = 0, maxnum;
	cin >> n >> l;
	cin >> a[1];
	for (int i = 2; i <= n; i++) {
	    cin >> a[i];
	    if (a[i - 1] + a[i] > max) {
	        max = a[i - 1] + a[i];
	        maxnum = i;
	    }
	}
	if (l > max) cout << "Impossible";
	else {
	    cout << "Possible" << endl;
	    for (int i = 1; i <= maxnum - 2; i++) cout << i << endl;
	    for (int i = n - 1; i >= maxnum; i--) cout << i << endl;
	    cout << maxnum - 1 << endl;
	}
	return 0;
}


Measured memory_bytes: 1152
# coding:utf-8

import sys

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    n, x = LI()

    if x == 1 or x == 2 * n - 1:
        print('No')
        return 0

    print('Yes')
    if n < 3:
        print(*[n for n in range(1, 2 * n)], sep='\n')
        return 1

    # n - 1段目の中心2つがxになるように並べる
    if x == 2:
        tmp = [3, 2, 1, 4]
    else:
        tmp = [x - 1, x, x + 1, x - 2]

    remain = list(set([n for n in range(1, 2 * n)]) - set(tmp))
    k = 3 - n
    tmp = remain[:k] + tmp + remain[k:]
    print(*tmp, sep='\n')

    return 1


main()


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

int main()
{   int k,n,a[200005],ans=9999999;
   cin>>k>>n;
   for(int i=1;i<=n;i++)cin>>a[i];
   sort(a+1,a+n+1);
   for(int i=1;i<=n;i++)
   {  if(i==1)ans=min(ans,a[n]-a[1]);
      else if(i==n)ans=min(ans,k-a[n]+a[n-1]);
      else ans=min(ans,k-a[i]+a[i-1]);

   }
   printf("%d",ans);




    return 0;
}


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

int main(){
    ios::sync_with_stdio(false);
    int n; cin >> n;
    string S; cin >> S;
    int cr = 0; int cw = 0;
    for (int i = 0; i < n; i++){
        if (S[i] == 'R'){
            cr++;
        }else{
            cw++;
        }
    }
    int c = 0;
    for (int i = 0; i < cr; i++){
        if (S[i] == 'W'){
            c++;
        }
    }
    cout << c << '\n';
    return 0;
}

Measured memory_bytes: 3776
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();

    sc.close();

    long result[] = new long[N+1];

    result[0] = 2;
    result[1] = 1;

    for (int i = 2; i < N+1; i++) {
      result[i] = result[i-1] + result[i-2];
    }

    System.out.println(result[N]);

  }

}

Measured memory_bytes: 21972
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  string X;
  cin >> X;
  ll sum = 0;
  for (int i = 0; i < X.size(); i++) {
    sum += X[i] - '0';
  }
  if (stoll(X) % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

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

using namespace std;

typedef long long int64;
const int64 mod = 1e9 + 7;

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

  map< int, int > appear;
  for(int i = 2; i <= N; i++) {
    int base = i;
    for(int j = 2; j * j <= i; j++) {
      while(base % j == 0) {
        base /= j;
        ++appear[j];
      }
    }
    if(base != 1) ++appear[base];
  }

  int64 ret = 1;
  for(auto &p : appear) (ret *= p.second + 1) %= mod;
  cout << ret << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args){
      // 入力
      Scanner sc = new Scanner(System.in);
      int N = sc.nextInt();
      int[] arr = new int[10001];
      
      // 配列作成
      for(int x = 1; x <= 100; x++){
        for(int y = 1; y <= 100; y++){
          for(int z = 1; z <= 100; z++){
            int ope = x*x + y*y + z*z + x*y + y*z + z*x;
            if(ope <= 10000){
              arr[ope]++;
            }
          }
        }
      }
      
      // 出力
      for(int i = 1; i <= N; i++){
        System.out.println(arr[i]);
      }
    }

}

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

using namespace std;

int main() {
  string S;
  cin >> S;
  int l = 0, r = S.length() - 1;
  int answer = 0;
  while (l < r) {
    if (S[l++] != S[r--]) answer++;
  }
  cout << answer << "\n";
  return 0;
}


Measured memory_bytes: 256
w,h,n=map(int,input().split())
x_a=0
x_b=w
y_a=0
y_b=h

for i in range(n):
  x,y,z=map(int,input().split())
  if(z==1):
    x_a=max(x_a,x)
  elif(z==2):
    x_b=min(x_b,x)
  elif(z==3):
    y_a=max(y_a,y)
  elif(z==4):
    y_b=min(y_b,y)

if(x_b-x_a>0 and y_b-y_a>0):
  print((x_b-x_a)*(y_b-y_a))
else:
  print(0)



Measured memory_bytes: 3064
import heapq

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

a = [i * -1 for i in a]

a = sorted(a,reverse=True)
heapq.heapify(a)

for _ in range(m):
    mini = heapq.heappop(a) * -1 // 2 * -1
    heapq.heappush(a,mini)

print(sum(a) * -1)

Measured memory_bytes: 65636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define SZ(s) ((int)(s.size()))
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ALL(a) (a).begin(), (a).end()
typedef pair<int,int> PI;

int kowa[100][100];

bool isuru(int a){
  if(a % 400 == 0) return true;
  if(a % 400 && a % 100 == 0) return false;
  if(a % 100 && a % 4 == 0) return true;
  if(a % 4) return false;
  return true;
}

string bina[100]={
  "1110111",
  "0010010",
  "1011101",
  "1011011",
  "0111010",
  "1101011",
  "1101111",
  "1010010",
  "1111111",
  "1111011"
};

int table[100] = {
  
};

int segn[100];

int mask[100];

int main(int argc, char *argv[])
{
  rep(i, 10){
    int t = 0;
    rep(j,7){
      t |= (bina[i][j]-'0') << j;
    }
    table[i] = t; // bit seq
    segn[i] = count(ALL(bina[i]), '1');
  }
  
  int n;
  cin >> n;
  int k;
  cin >> k;
  
  rep(i, k){
    int p, q;
    cin >> p >> q;
    mask[p] |= 1 << q;
  }

  long long kumi[100][2] = {};
  
  for(int i = 0; i < 10000; ++i){
    char ne[1000];
    sprintf(ne, "%04d", i);
    bool uru = isuru(i);
    int num = 0;

    for(int j = 0; j < 4; ++j){
      num += __builtin_popcount(~mask[j] & table[ne[j] - '0']);
      //ok &= (mask[j] & table[ne[j] - '0']) == 0;
    }
    kumi[num][uru] += 1;
  }

  long long nkumi[100][40] = {};
  int mo[] = {
    0,
    31,
    28,
    31,
    30,
    31,
    30,
    31,
    31,
    30,
    31,
    30,
    31
  };
  
  for(int i = 0; i < 100; ++i){// used
    for(int uru = 0; uru < 2; ++uru){// is uru
      for(int j = 1; j <= 12; ++j){// use month
        char month[3];
        sprintf(month, "%02d", j);
        int cm = mo[j];
        cm += uru && j == 2;
        int nnum = i;
        rep(k, 2){
          nnum += __builtin_popcount(~mask[4+k] & table[month[k]-'0']);
          //ok &= (mask[4+k] & table[month[k]-'0']) == 0;
        }
        nkumi[nnum][cm] += kumi[i][uru];
      }
    }
  }

  long long dkumi[100] = {};
  
  for(int i = 0; i < 100; ++i){// used
    for(int dlim = 28; dlim <= 31; ++dlim){ // maxday
      for(int j = 1; j <= dlim; ++j){
        char day[3];
        sprintf(day, "%02d", j);
        int nnum = i;
        rep(k, 2){
          nnum += __builtin_popcount(~mask[6+k] & table[day[k] - '0']);
          //ok &= (mask[6+k] & table[day[k]-'0']) == 0;
        }
        dkumi[nnum] += nkumi[i][dlim];
      }
    }
  }

  long long tkumi[100] = {};

  rep(di, 100){
    rep(h,24)rep(m,60)rep(s,60){
      char ti[100];
      sprintf(ti, "%02d%02d%02d", h, m, s);
      int nnum = di;
      rep(k, 6){
        nnum += __builtin_popcount(~mask[8+k] & table[ti[k]-'0']);
      }
      tkumi[nnum] += dkumi[di];
    }
  }
      
  
  cout << tkumi[n] << endl;
  
  return 0;
}

Measured memory_bytes: 1292
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 * @throws NumberFormatException 
	 */
	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int r = Integer.parseInt(br.readLine());
		
		System.out.println(3*r*r);
	}

}


Measured memory_bytes: 22612
//Dragon_warrior7(IITK)
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
#define ll long long
#define pb push_back
#define nl cout << '\n'
#define sor(x) sort(x.begin(), x.end())
#define rev(v) reverse(v.begin(), v.end())
#define lb(v, temp) lower_bound(v.begin(), v.end(), temp)
#define ub(v, temp) upper_bound(v.begin(), v.end(), temp)
#define fi first
#define se second
#define llmax 1000000000000000000
#define pll pair<ll, ll> 
#define ull unsigned ll
#define vll vector<ll> 
#define rub cout << "\n------------------------------------\n"
#define deb(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) 
{
	cout << *it << " = " << a;
	nl;
	err(++it, args...);
}
//typedef  tree < int ,  null_type ,  greater<int> ,  rb_tree_tag ,  tree_order_statistics_node_update > oset;
void read(vector<ll> &v)
{
	for (int i = 0; i < v.size(); i++)
		cin >> v[i];
}
// const int mod=1e9+7;
// ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// ll modInverse(ll a){return power(a,mod-2);}
ll n,m,a,b,c,k,temp,x,y;
void solveforthiscase(const int & test)
{//deb(test);
cin>>n;
vll v(n);
read(v);
bool flag=1;
for(int i=0;i<n;i++)
{
    if(i==0)
    {
        v[i]--;
    }
    else
    {
        if(v[i]<v[i-1])
        {flag=0;break;}
        if(v[i]>v[i-1])
        v[i]--;
        else
        continue;
    }
}
if(flag)
{
    cout<<"Yes\n";
}
else
cout<<"No\n";






return ;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int test=1;
// 	cin>>test;
    for(int i=1;i<=test;i++)
    {
        solveforthiscase(i);
    }
}

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

using namespace std;

typedef long long int ll;
typedef long double ld;
typedef string str;
typedef vector<char> vc;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define all(a) a.begin(), a.end()

template <typename T>
T Sum(vector<T> n, ll a = 0, ll b = 0)
{
  if (b == 0)
  {
    return (accumulate(n.begin() + a, n.end(), 0));
  }
  else
  {
    return (accumulate(n.begin() + a, n.begin() + b, 0));
  }
}
template <>
ld Sum(vector<ld> n, ll a, ll b)
{
  if (b == 0)
  {
    return (accumulate(n.begin() + a, n.end(), 0));
  }
  else
  {
    return (accumulate(n.begin() + a, n.begin() + b, 0));
  }
}

template <typename T>
void Sort(T &n, ll a = 0, ll b = 0)
{
  if (b == 0)
  {
    return (sort(n.begin() + a, n.end()));
  }
  else
  {
    return (sort(n.begin() + a, n.begin() + b));
  }
}

template <typename T>
void Reve(T &n, ll a = 0, ll b = 0)
{
  if (b == 0)
  {
    return (reverse(n.begin() + a, n.end()));
  }
  else
  {
    return (reverse(n.begin() + a, n.begin() + b));
  }
}

template <typename T>
void V(T &n)
{
  for (ll i = 0; i < n.size(); i++)
  {
    cin >> n[i];
  }
}

template <typename T, typename U>
void V2(T &n, U &m)
{
  for (ll i = 0; i < n.size(); i++)
  {
    cin >> n[i] >> m[i];
  }
}

template <typename T, typename U, typename W>
void V3(T &n, U &m, W &p)
{
  for (ll i = 0; i < n.size(); i++)
  {
    cin >> n[i] >> m[i] >> p[i];
  }
}

void fYn(bool a)
{
  if (a)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  exit(0);
}
//最大公約数
ll gcd(ll a, ll b)
{
  return b ? gcd(b, a % b) : a;
}
//最小公倍数
ll lcm(ll a, ll b)
{
  return a * b / gcd(a, b);
}
//複数個の最小公倍数
ll nlcm(vector<ll> numbers)
{
  ll res;
  res = numbers[0];
  for (ll i = 1; i < numbers.size(); i++)
  {
    res = lcm(res, numbers[i]);
  }
  return res;
}
//累乗(xのn乗%mod)
ll mod_pow(ll x, ll n, ll mod = MAX)
{
  ll res = 1;
  while (n > 0)
  {
    if (n & 1)
      res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
ll factorial(ll n)
{
  if (n > 0)
    return n * factorial(n - 1);
  else
    return 1;
}
//大文字->小文字(+32)
//少数はなるべく整数に

void Main()
{
  ll k, x; cin >> k >> x;
  k--;
  for(ll i = x - k;i <= x + k;i++)
  {
    cout << i << " ";
  }
  cout << endl;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <algorithm>

#define MOD7 1000000007
#define MOD9 1000000009

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

using namespace std;

int nextInt() {int a; cin >> a; return a;}
char nextChar() {char a; cin >> a; return a;}
double nextDouble() {double a; cin >> a; return a;}
string nextString() {string a; cin >> a; return a;}

void inputVector(vector<int> &v, int &n) {rep(i,n){v.push_back(nextInt());}}
void inputVector(vector<double> &v, int &n) {rep(i,n){v.push_back(nextDouble());}}
void inputVector(vector<string> &v, int &n) {rep(i,n){v.push_back(nextString());}}

vector<vector<int>> vecs[2];
vector<int> pts[2];

bool check(int id, int a, int b) {
	return pts[id][a] == pts[id][b];
}

void merge(int id, int a, int b) {
	if (check(id, a, b)) return;

	if (vecs[id][pts[id][a]].size() > vecs[id][pts[id][b]].size()) swap(a, b);

	int pta = pts[id][a];
	int ptb = pts[id][b];

	rep(i, vecs[id][pta].size()) {
		vecs[id][ptb].push_back(vecs[id][pta][i]);
		pts[id][vecs[id][pta][i]] = ptb;
	}
	vecs[id][pta].clear();
}

signed main() {
	int N, K, L;
	cin >> N >> K >> L;
	
	rep(i, 2) {
		vecs[i].resize(N);
		pts[i].resize(N);
		rep(j, N) {
			vecs[i][j].push_back(j);
			pts[i][j] = j;
		}
	}

	rep(i, K) {
		int p, q;
		cin >> p >> q;
		p--; q--;

		merge(0, p, q);
	}
	rep(i, L) {
		int p, q;
		cin >> p >> q;
		p--; q--;

		merge(1, p, q);
	}

	map<pair<int, int>, int> m;
	rep(i, N) {
		pair<int, int> p = make_pair(pts[0][i], pts[1][i]);
		if (m.find(p) == m.end()) {
			m[p] = 0;
		}
		m[p]++;
	}

	rep(i, N) {
		pair<int, int> p = make_pair(pts[0][i], pts[1][i]);
		cout << m[p];
		if (i < N - 1) cout << ' ';
		else cout << endl;
	}

    return 0;
}


Measured memory_bytes: 34944
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll m,n,k,sum=0;
    cin>>n>>m>>k;
    ll a[n+5]= {0},b[m+5]= {0};
    for(ll i=1; i<=n; i++)
    {
        cin>>a[i];
        a[i]+=a[i-1];
    }
    for(ll i=1; i<=m; i++)
    {
        cin>>b[i];
        b[i]+=b[i-1];
    }
    int j=m,i,ans=0;
    for(i=0;i<=n;i++)
    {
        if(a[i]>k)break;
        while(b[j]>k-a[i])
        {
            j--;
        }
        ans=max(i+j,ans);
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 6748
#include <bits/stdc++.h>
#define rep(i,n)  for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define deb(x) cerr << #x <<": " << x << '\n';
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
typedef long double ld;
typedef long long ll;

int main(){
    ios;
    string t; cin >> t;
    if(t == "Sunny")cout << "Cloudy";
    else if(t == "Cloudy")cout << "Rainy";
    else cout << "Sunny";
    return 0;
    }



Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
struct Node {
	int key;
	Node* left, * right, * parent;
};
Node* root, * NILL;
void insert(int k) {
	Node *p = NILL;
	Node *id = root;
	Node* z;
	z = new Node;
	z->key = k;
	z->left = NILL;
	z->right = NILL;
	while (id != NILL) {
		p = id;
		if (z->key < id->key) {
			id = id->left;
		}
		else {
			id = id->right;
		}
	}
	z->parent=p;
	if (p == NILL) {
		root=z;
	}
	else if (z->key < p->key) {
		p->left = z;
	}
	else if (z->key > p->key) {
		p->right = z;
	}
}
void Preorder(Node* u) {
	if (u == NILL) return;
	else {
		cout << " " << u->key;
		Preorder(u->left);
		Preorder(u->right);
	}
}
void Inorder(Node* u) {
	if (u == NILL) return;
	else {
		Inorder(u->left);
		cout << " " << u->key;
		Inorder(u->right);
	}

}
int main() {
	int n,value;
	string command;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> command;
		if (command == "insert") {
			cin >> value;
			insert(value);
		}
		else if (command == "print") {
			Inorder(root);
			cout<<endl;
			Preorder(root);
			cout<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 26492
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int INF = 1000000009;
int main()
{
    while(1){
    int n,x;
    cin >> n >> x;
    if(n== 0 && x == 0)
        return 0;
    int cnt = 0;
    for (int i = 1; i <= n; i++)
    {
        
        for (int j = i+1; j <= n; j++)
        {
            for(int k = j+1;k<=n;k++){
                if(i+j+k == x)
                    cnt++;
            }
        }
    }
    cout << cnt << endl;
    }
}


Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dup(x,y) (((x)+(y)-1)/(y))
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e15;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

typedef pair<ll, ll> pll;

int main() {
	int n, m;
	cin >> n >> m;
	map<ll, ll> mp;
	rep(i,n) {
		ll a;
		cin >> a;
		mp[a]++;
	}
	rep(i,m) {
		ll b, c;
		cin >> b >> c;
		mp[c] += b;
	}
	ll ans = 0;
	ll t = 0;
	vector<pll> v;
	for (auto p: mp) v.push_back(p);
	sort(ALL(v), greater<>());
	for (auto p: v) {
		if (t == n) break;
		if (t + p.second <= n) {
			ans += p.first * p.second;
			t += p.second;
		} else {
			ans += p.first * (n - t);
			t = n;
		}
	}
	cout << ans << endl;
}

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

void main()
{
    auto nk = readln.split.to!(long[]);
    auto N = nk[0];
    auto K = nk[1];
    writeln(N <= K ? 1 : 0);
}


Measured memory_bytes: 2480
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define __ ios_base::sync_with_stdio(0);cin.tie(0);
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(),x.end()
#define forn(i,a,n) for(int i=a; i < n; i++)
typedef long long int lli;
typedef long double Double;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int mod = 1e9+7;
#define MAXN 100005
vi adj[MAXN];
lli dp[MAXN][2];

lli dfs(int u, int p, int c){
	if(dp[u][c] != -1ll) return dp[u][c];
	lli res = 1ll;
	for(int v : adj[u]){
		if(v == p) continue;
		if(c == 1){
			//blanco
			res = (res * (dfs(v,u,c) + dfs(v,u,!c))%mod ) %mod;
		}
		else{
			//negro
			res = (res * dfs(v,u,!c)) % mod;
		}
	}
	return dp[u][c] = res%mod;
}
int main(){__
	int n;
	cin >> n;
	memset(dp,-1ll,sizeof(dp));
	for(int i=1; i <= n-1; i++){
		int u,v;
		cin >> u >> v;
		adj[u].pb(v);
		adj[v].pb(u);
	}
	lli ans1 = dfs(1,0,0) % mod, ans2 = dfs(1,0,1) % mod;
	cout << (ans1 + ans2) % mod << endl;
	return 0;
}


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

using namespace std;

#define rep(i, x)   for (__typeof(x) i = 0; i < x; i++)
#define mp             make_pair
#define pb             push_back
#define fi             first
#define se             second
#define sz(x)          (int)((x).size())
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define eprintf(...)   fprintf(stderr, __VA_ARGS__)
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define repi(i, x)  for (__typeof(x) i = x-1; i >= 0; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
typedef long long      ll;
typedef pair<int, int> ii;
typedef pair<ii, int>  iii;
typedef vector<int>    vi;
typedef vector<ii>     vii;
typedef vector<iii>    viii;
typedef vector<vector<int> > vvi;
const   int            infi = numeric_limits<int>::max();
const   double         eps = 0;
const   int            ms  = 0;

int main()
{
    ios::sync_with_stdio(false);//endl->"\n"
    cin.tie(0);

    int N;
    cin >> N;
    int T, A;
    cin >> T >> A;
    vi H(N);
    rep(i, N)cin >> H[i];
    double mid = numeric_limits<double>::max();
    int idx = -1;
    rep(i, N){
        double dif = abs((double)A - ((double)T-H[i]*0.006));
        if(mid > dif){
            mid = dif;
            idx = i;
        }
    }
    cout << idx+1 << "\n";
    return 0;
}

Measured memory_bytes: 256