akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scan(&n)
	mp := map[string]int{
		"a": math.MaxInt32,
		"b": math.MaxInt32,
		"c": math.MaxInt32,
		"d": math.MaxInt32,
		"e": math.MaxInt32,
		"f": math.MaxInt32,
		"g": math.MaxInt32,
		"h": math.MaxInt32,
		"i": math.MaxInt32,
		"j": math.MaxInt32,
		"k": math.MaxInt32,
		"l": math.MaxInt32,
		"m": math.MaxInt32,
		"n": math.MaxInt32,
		"o": math.MaxInt32,
		"p": math.MaxInt32,
		"q": math.MaxInt32,
		"r": math.MaxInt32,
		"s": math.MaxInt32,
		"t": math.MaxInt32,
		"u": math.MaxInt32,
		"v": math.MaxInt32,
		"w": math.MaxInt32,
		"x": math.MaxInt32,
		"y": math.MaxInt32,
		"z": math.MaxInt32,
	}
	for i := 0; i < n; i++ {
		var tmp string
		fmt.Scan(&tmp)
		m := map[string]int{
			"a": 0,
			"b": 0,
			"c": 0,
			"d": 0,
			"e": 0,
			"f": 0,
			"g": 0,
			"h": 0,
			"i": 0,
			"j": 0,
			"k": 0,
			"l": 0,
			"m": 0,
			"n": 0,
			"o": 0,
			"p": 0,
			"q": 0,
			"r": 0,
			"s": 0,
			"t": 0,
			"u": 0,
			"v": 0,
			"w": 0,
			"x": 0,
			"y": 0,
			"z": 0,
		}
		for _, v := range tmp {
			vv := string(v)
			m[vv] = m[vv] + 1
		}
		for k, v := range mp {
			vv := m[k]
			mp[k] = min1(vv, v)
		}
	}
	alpha := "abcdefghijklmnopqrstuvwxyz"
	for _, s := range alpha {
		k := string(s)
		v := mp[k]
		if v != math.MaxInt32 {
			for i := 0; i < v; i++ {
				fmt.Print(k)
			}
		}
	}
	fmt.Println()
}

func min1(a, b int) int {
	if a < b {
		return a
	} else {
		return b
	}
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll one = 1;
const ll INF = 9223372036854775807; //10^18
const int inINF = 2147483647; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}
// 0-indexedのUnionFind
struct UnionFind {
    // 親の番号を入れる配列。根のときはpar[i] = -(その成分の大きさ)
    vector<int> par;

    // 初めは空グラフとして初期化
    UnionFind(int N) : par(N){
        for(int i = 0; i < N; i++) par[i] = -1;
    }

    // その点を含む成分の根を取り出す
    int root(int x) {
        if (par[x] < 0) return x;
        return par[x] = root(par[x]);
    }

    // xとyを同じ成分に入れる
    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        if (-par[rx] < -par[ry]) swap(rx, ry); // rxの成分の方が大きい
        par[rx] += par[ry];
        par[ry] = rx; // ryをrxにくっつける
    }

    // xとyが同じ成分に入っているか判定
    bool same(int x, int y) {
        return root(x) == root(y);
    }

    // その点を含む成分の大きさ
    int size(int x){
        return par[root(x)];
    }
};

int main(){
    int N, M;
    cin >> N >> M;
    int a, b;
    UnionFind UF(N);
    for (int i = 0; i < M; i++) {
        cin >> a >> b; a--; b--;
        UF.unite(a, b);
    }
    set<int> s;
    for (int i = 0; i < N; i++) {
        s.insert(UF.root(i));
    }
    int ans = s.size();
    printf("%d\n", ans - 1);

}

Measured memory_bytes: 7708
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  long long N;
  cin >> N;
  vector<long long> A(N),B(N);
  long long a=0,b=0;
  for(int i=0;i<N;i++){cin >> A[i]; a+=A[i];}
  for(int i=0;i<N;i++){cin >> B[i]; b+=B[i];}
  if(a<b){cout << -1 << endl; return 0;}
  long long sum=0,cnt=0;
  for(int i=0;i<N;i++){
    if(A[i]<B[i]){sum+=B[i]-A[i]; cnt++;}
  }
  if(cnt==0){cout << 0 << endl; return 0;}
  vector<long long> q(N);
  for(int i=0;i<N;i++){q[i]=A[i]-B[i];}
  sort(q.begin(),q.end());
  for(int i=N-1;i>=0;i--){
    sum-=q[i]; cnt++;
    if(sum<=0){break;}
  }
  cout << cnt << endl;
}

Measured memory_bytes: 2560
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		char[] s = S.toCharArray();
		int ans1 = 0, ans2 = 0;
		for(int i = 0; i < S.length(); i++) {
			if(i % 2 == 0) {
				if(s[i] == '0')
					ans2 += 1;
				else
					ans1 += 1;
			}
			else {
				if(s[i] == '0')
					ans1 += 1;
				else
					ans2 += 1;
			}
		}
		System.out.println(Math.min(ans1,  ans2));

	}

}

Measured memory_bytes: 27476
N = int(input())
rest = list()
preres = list()
for i in range(N):
    preres = list(map(str,input().split()))
    preres.append(i+1)
    preres[1] = int(preres[1])
    rest.append(preres)
    #  rest.append(preres.append(str(i+1)))
    # rest[i][1] = int(rest[i][1])
    # print(preres)
sort_rest =  sorted(rest, key=lambda x:(x[0], -x[1]))
for i in range(N):
    print(sort_rest[i][2])

Measured memory_bytes: 3060
// -*- coding:utf-8-unix -*-

use proconio::input;

fn main() {
    input! {
        x1: i16,
        y1: i16,
        x2: i16,
        y2: i16,
    }

    let vx = x2 - x1;
    let vy = y2 - y1;
    println!("{} {} {} {}", x2-vy, y2+vx, x1-vy, y1+vx);
}


Measured memory_bytes: 2152
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024*1024), bufio.MaxScanTokenSize)
}

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

func nextFloat() float64 {
	sc.Scan()
	f, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func max(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func min(a, b int) int {
	if a < b {
		return a
	} else {
		return b
	}
}

func main() {
	var ANS, MAX int
	S := nextString()
	for i := 0; i < len(S); i++ {
		if S[i:i+1] == "R" {
			ANS++
		} else {
			ANS = 0
		}
		MAX = max(MAX, ANS)
	}
	fmt.Println(MAX)

}


Measured memory_bytes: 1804
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000001
using namespace std;

struct Info{
	int time;
	char name[51];
};

int calc(char time[6]){
	return 60*(10*(time[0]-'0')+time[1]-'0') + 10*(time[3] - '0') + time[4] - '0';
}

void strcpy(char* to,char* str){
	for(int i=0;str[i] != '\0';i++){
		to[i] = str[i];
		to[i+1] = '\0';
	}
}

int main(){

	int N,T,pre = -1,index,tmp,count = 0;
	char from_station[51],to_station[51],to,start[6],arrive[6];
	queue<Info> Q;

	scanf("%d %d",&N,&T);

	for(int i = 0; i < N; i++){
		scanf("%s %s %s %s",start,from_station,arrive,to_station);
		if(i > 0){
			if((tmp = calc(start)-pre) >= T){
				count++;
				Info info;
				strcpy(info.name,from_station);
				info.time = tmp;
				Q.push(info);
			}
		}
		pre = calc(arrive);
	}

	printf("%d\n",count);
	while(!Q.empty()){
		printf("%s %d\n",Q.front().name,Q.front().time);
		Q.pop();
	}

	return 0;
}

Measured memory_bytes: 2692
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
//ある通貨について、時刻 t における価格 Rt (t=0,1,2,,,n−1)が入力として与えられるので、価格の差 Rj−Ri (ただし、j>i とする) の最大値を求めてください。
using namespace std;
int main(){
	int n, max, min;
	cin >> n;
	int num[n];
	for(int i = 0; i < n; i++){
		int x;
		cin >> x;
		num[i] = x;
	}
	min = num[0];
	max = num[1] - num[0];
	for(int j = 1; j < n; j++){
		max = (max >= num[j] - min) ? max : num[j] - min;
		min = (min >= num[j]) ? num[j] : min;
	}
	cout << max << endl;
}



Measured memory_bytes: 3828
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<unistd.h>
#include <array>
#include <map> 
#define ALL(a)  (a).begin(),(a).end()



using namespace std;
typedef long long ll;
struct point{
  int x;
  int y;

};
int gcd(int a, int b)
{
	return a == 0 ? b : gcd(b % a, a);
}
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int input(){
  int x;
  cin>>x;
  return x;
}

int moji(char in)
{
    int ans = (int)in-(int)'a';
    if((ans < 0) || (ans > 25)){
        ans = 26;
    }
    return ans;
}
const int VV=10;//場合に応じてVVの値のみ変更する必要あり
//dijkstra(s)sがスタート地点でそこからの最短距離を配列dで表す。正の重みのみ使用可能
int cost[VV][VV];
int d[VV];
bool used[VV];
void dijkstra(int s){
  fill(d,d+VV,100000);
  fill(used,used+VV,false);
  d[s]=0;
  while(true){
    int v=-1;
    for(int u=0;u<VV;u++){
      if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
    }
    if(v==-1)break;
    used[v]=true;
    for(int u=0;u<VV;u++){
      d[u]=min(d[u],d[v]+cost[v][u]);
    }
  }

}

int compare_int(const void *a, const void *b)//qsort(quick sort利用時に使用)
{
    return *(int*)a - *(int*)b;
}

int binary_searchh(long long x,long long k[],int n){
  int l=0;
  int r=n;
  while(r-l>=1){
    int i=(l+r)/2;
    if(k[i]==x)return i;
    else if(k[i]<x)l=i+1;
    else r=i;
  }
  return -1;
}

struct File {
    int aa;
    int bb;

    File(const int& aa, const int& bb)
        : aa(aa), bb(bb) {}
};

bool operator<(const File& a, const File& b)
{
    // ファイル種別、ファイル名の順番で優先順位を付けて比較
    return std::tie(a.aa, a.bb) < std::tie(b.aa, b.bb);
}

long long kaijo(long long x){
  long long l=10*10*10*10*10*10*10*10*10+7;
  long long sum=1;
  for(int i=x;i>0;i--){
    sum*=i;
    if(sum>l){
      sum%=l;
    }
  }
  return sum;
}






int main(){
  long long A,B,C,K;
  cin>>A>>B>>C>>K;
  long long k=1000000000000000000;
  if(K%2==0){
    if(A-B>=k||A-B<=-k){
      cout<<"Unfair"<<endl;
    }else{
      cout<<A-B<<endl;
    }
  }else{
    
    if(B-A>=k||B-A<=-K){
      cout<<"Unfair"<<endl;
    }else{
      cout<<B-A<<endl;
    }
  }



  
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = LLONG_MAX;

int main()
{
    string s;
    cin >> s;
    bool ans = true;
    for (int i = 1; i < s.length(); i++)
    {
        if (s[i] == s[i - 1])
            ans = false;
    }
    cout << (ans ? "Good" : "Bad") << endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();


        c -= a -b;
        if (c <= 0) {
            System.out.println(0);
        } else {
            System.out.println(c);
        }

    }

}


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

int main(){
	string S,T;
	cin>>S>>T;
	long long int i=0,count=0;
	while(i<S.length()){
		if(S[i]!=T[i]){
			count++;
		}	
		i++;
	}
	cout<<count;
}


Measured memory_bytes: 3920
// 参考:http://kagamiz.hatenablog.com/entry/2013/10/05/005213

#include <stdio.h>
#include <vector>
#include <algorithm>

using namespace std;

vector<int> G[1000000];
vector<pair<int, int> > bridge;
int ord[1000000], low[1000000];
bool vis[1000000];

void dfs(int v, int p, int &k){
	vis[v] = true;
	ord[v] = k++;
	low[v] = ord[v];
	int ct = 0;
	
	for (int i = 0; i < G[v].size(); i++){
		if (!vis[G[v][i]]){
			ct++;
			dfs(G[v][i], v, k);
			low[v] = min(low[v], low[G[v][i]]);
			if (ord[v] < low[G[v][i]]) bridge.push_back(make_pair(min(v, G[v][i]), max(v, G[v][i])));
		}
		else if (G[v][i] != p){
			low[v] = min(low[v], ord[G[v][i]]);
		}
	}
}

int main()
{
	int n,m;
	scanf("%d %d", &n, &m);
	
	for (int i = 0;i < m;++i){
		int v, e;
		scanf("%d %d",&v,&e);
		G[v].push_back(e);
		G[e].push_back(v);
	}
	int k = 0;
	for (int i = 0; i < n; i++){
		if (!vis[i]) dfs(i, -1, k);
	}
	
	sort(bridge.begin(), bridge.end());
	for (int i = 0; i < bridge.size(); i++)
		printf("%d %d\n", bridge[i].first, bridge[i].second);
}


Measured memory_bytes: 27652
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int current = sc.nextInt();
    int mini = current,maxi = current,distance = 0;
    do{
      int res = Math.max(Math.abs(current - mini), Math.abs(current - maxi));
      if(res > distance){distance = res;}
      current = sc.nextInt();
    }while(sc.hasNext());
    if(distance > current){System.out.println(":(");}
    else{System.out.println("Yay!");}
  }
}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
int main(){
	
	int a,b,c;cin>>a>>b>>c;

	for(int i=1;i<=b;i++){
		if( (i*a)%b==c ){
			cout<<"YES"<<endl;
			return 0;
		}
	}
	cout<<"NO"<<endl;
	return 0;

}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <math.h>

using namespace std;

int fact(int n){
    if(n == 0){
        return 1;
    }
    if(n < 2){
        return n;
    }
    return n * fact(n - 1);
}

int hantei(int num, vector<int> &vec){
    if(vec.size() == 1){
        return num;
    }
    int size = vec.size();
    for(int i = vec[0] + 1; i <= size; i++){
        num -= fact(size - 1);
    }
    for(int i=0; i < size - 1; i++){
        if(vec[i+1] > vec[0]){
            --vec[i+1];
        }
    }
    vec.erase(vec.begin());
    return hantei(num, vec);
}

int act(int n){
    int input;
    vector<int> array;
    for(int i=0; i < n; i++){
        cin >> input;
        array.push_back(input);
    }
    return 1 + hantei(fact(n), array);
}

int main() {
    int n;
    cin >> n;
    cout << abs(act(n) - act(n)) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b;string ans;
  cin >>a>>b;
  if(a==1)a=14;
  if(b==1)b=14;
  if(a>b)ans="Alice";
  if(a<b)ans="Bob";
  if(a==b)ans="Draw";
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp> // added for pbds
#include<ext/pb_ds/tree_policy.hpp> // added for pbds
#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define forz(i,n) for(ll i = 0 ; i < n ;i++)
#define foro(i,n) for(ll i = 1; i<= n;i++)
#define fort(i,s,e) for(ll i = s ; i<e; i++)
#define pb push_back
#define ff first
#define ss second
#define ii pair<int,int>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<ii>
#define vll vector<pair<ll,ll> >
#define endll '\n'
#define space " "
#define INF 1000000000
#define ps(x,y) fixed<<setprecision(y)<< x; // to set precision to number x upto y decimal digits
#define D(x) cout << #x " = " << (x) << endl
//int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[]={2,1,-1,-2,-1,1};int dy[]={0,1,1,0,-1,-1}; //Hexagonal Direction
using namespace std;
using namespace __gnu_pbds;// for pbds
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds;
//----------------------------------------------//
int t;
int main(){
    IOS
    int n;
    cin>> n;
    ll sum=0;
    ll x;
    map<ll,ll> mp;
    for(int i =0 ; i< n ;i++ ) {
        cin>>x;
        sum+=x;
        mp[x]++;
    }
    int q;
    cin>>q;
    ll b ,c;
    int d;
    for(int i=0 ;i < q;i++ ) {
        cin>> b >>c;
        sum -=(b*mp[b]);
        sum+= (c*mp[b]);
        if(mp.find(c) == mp.end())
            mp[c] = mp[b];
        else
            mp[c] +=mp[b];
         d = mp.erase(b);
        cout<< sum << endll;
    }
}






















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

int main() {
	int N;
	cin >> N;
	set<string> str;
	for (int i = 0; i < N; i++) {
		string S;
		cin >> S;
		str.insert(S);
	}
	cout << str.size() << endl;
	return 0;
}


Measured memory_bytes: 19220
#include<stdio.h>
#include<stdlib.h>
int compare_int(const void *a,const void *b){
  return *(int *)a-*(int *)b;
}
int main (void)
{
  int n;
  int i=0;
  int sum=0;
  scanf("%d",&n);
  int l[2*n];
  for(int i=0;i<2*n;i++){
    scanf("%d",&l[i]);
  }

  qsort(l,2*n,sizeof(int),compare_int);
  while(i<2*n){
    sum+=l[i];
    i++;
    i++;
  }
  printf("%d",sum);
  return 0;
}


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

long long L[110];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  L[0] = 2; L[1] = 1;
  for (int i = 2; i <= 86; i++) {
    L[i] = L[i - 1] + L[i - 2];
  }
  int n;
  cin >> n;
  cout << L[n] << endl;
  return 0;
}


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


//各位の数の総和
int divide(int x){
    int ret = 0;
    while(x>0){
        ret += x % 10;
        x /= 10;
    }
    return ret;
}

int main(){
    int n;
    cin >> n;
    if(n%divide(n) == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define forn(i,n) for(int i=0;i<(int)(n);i++)
#define si(c) ((int)(c).size())
#define forsn(i,s,n) for(int i = (int)(s); i<((int)n); i++)
#define dforsn(i,s,n) for(int i = (int)(n)-1; i>=((int)s); i--)
#define all(c) (c).begin(), (c).end()
#define D(a) cerr << #a << "=" << a << endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair
 
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
mt19937_64 rng;

const int 
    M = 1e7 + 10,
    MOD = 1e9 + 7;

int inv[M], fact[M], ifact[M];

int comb(int m, int n) {
    if (m < 0 || n < 0 || n > m) return 0;
    return (ll) fact[m] * ifact[n] % MOD * ifact[m-n] % MOD;
}

int f(int a, int b, int c) {
    return (ll) fact[a+b+c] * inv[a+b] % MOD * a % MOD;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    rng.seed(time(0));

    inv[1] = 1;
    forsn(n,2,M) {
        inv[n] = ll(MOD - MOD/n) * inv[MOD%n] % MOD;
        assert((ll) inv[n] * n % MOD == 1);
    }
    fact[0] = ifact[0] = 1;
    forsn(n,1,M) {
        fact[n] = ll(n) * fact[n-1] % MOD;
        ifact[n] = ll(inv[n]) * ifact[n-1] % MOD;
        assert((ll) fact[n] * ifact[n] % MOD == 1);
    }

    ll ans = 0;
    int n,a; cin >> n >> a;
    for (int i = 1; i < a; i++) {
        for (int k = 0; k <= i; k++) {
            ll sign = k%2 ? MOD - 1 : 1;
            ans += sign * comb(i,k) % MOD * f(i-k, n-a, a-1-i) % MOD;
        }
    }
    for (int k = 0; k <= a; k++) {
        ll sign = k%2 ? MOD - 1 : 1;
        ans += sign * comb(a,k) % MOD * f(a-k, n-a, 0) % MOD;
    }

    cout << ans%MOD << endl;
    return 0;
}


Measured memory_bytes: 120848
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;


int main() {
	int x;
	for (int i=0; i<5; i++) {
		cin >> x;
		if (x == 0) cout << i+1 << endl;
	}

	return 0;
}

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

#define pb push_back
#define ff first
#define ss second

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

int k;
string s, last = "$", now, trash;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		now += s[i];
		if (now != last)
			k++, last = now, now = trash;
	}
	cout << k << endl;
	return 0;
}


Measured memory_bytes: 720
#include <iostream>
#include <vector>
typedef long long ll;
using namespace std;

int main() {
	ll x;
	cin >> x;
	vector<ll> five(120);
	for (ll a = 0; a <= 119; a++)
		five[a] = a * a * a * a * a;
	for (ll a = 0; a <= 119; a++) {
		for (ll b = 0; b <= 119; b++) {
			if (five[a] - five[b] == x) {
				cout << a << ' ' << b << endl;
				return 0;
			}
			else if (five[a] + five[b] == x) {
				cout << a << ' ' << -b << endl;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 3604
using System;
using System.Linq;
using System.Collections.Generic;

public class Test
{
	public static void Main( )
	{
		var n = int.Parse( Console.ReadLine() );
		int[] A = new int[n];
		
		for( var i=0; i<n; i++ ) {
			A[i] = int.Parse( Console.ReadLine().Trim() );
		}
		
		shellSort( A, n );
		foreach( var i in A ) {
			Console.WriteLine( "{0}", i );
		}
		
		return;
	}

	public static int insertionSort( int[] A, int n, int g )
	{
		int cnt;
		
		cnt = 0;
		for( var i=g; i<=n-1; i++ ) {
			var v = A[i];
			var j = i - g;
			while( j>=0 && A[j] > v ) {
				A[j+g] = A[j];
				j -= g;
				cnt++;
			}
			A[j+g] = v;
		}
		return cnt;
	}

	public static void shellSort( int[] A, int n )
	{
		int cnt = 0;
		int m = n;
		var t = 0;
		var T =  new List<int>();
		for( var i=0; i<n; i++ ) {
			t += (int)Math.Pow( 3, i);
			T.Add( t );
			if( n - t <= 0 ) {
				m = i;
				break;
			}
		}
		if(m == 0) { 
			m=1;
		} else {
			T.RemoveAt(m);
		}
		
		T.Reverse();
		var G = T.ToArray();
		
		
		for( var i=0; i<=m-1; i++ ) {
			cnt += insertionSort( A, n, G[i] );
		}
		Console.WriteLine( m );
		Console.WriteLine( String.Join( " ", G ) );
		Console.WriteLine( cnt );
		
		return;
	}
}


Measured memory_bytes: 23616
#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>

using namespace std;

typedef long long ll;

int main() {
    int N, H;
    priority_queue<int> damage;
    int max_a = 0;
    
    cin >> N >> H;
    for (int i=0; i<N; ++i) {
        int a, b;
        cin >> a >> b;
        damage.push(max(a,b));
        max_a = max(a, max_a);
    }
    
    int ans = 0;
    
    while (H > 0 && !damage.empty()) {
        int max_damage = damage.top();
        
        
        if (max_damage > max_a) {
            H -= max_damage;
            ++ans;
            damage.pop();
        } else {
            break;
        }
    }
    
    while (H > 0) {
        H -= max_a;
        ++ans;
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 892
# 全探索 O(10**5)
import sys

K = int(input())
if K < 10:
    print(K)
    sys.exit()
i = 9
operation = [-1, 0, 1]
lst = [str(i + 1) for i in range(9)]
while True:
    tmp = []
    for a in lst:
        for ope in operation:
            val = int(a[-1]) + ope
            if 0 <= val <= 9:
                i += 1
                if i == K:
                    print(int(a + str(val)))
                    sys.exit()
                tmp.append(a + str(val))
    lst = tmp

Measured memory_bytes: 8596
#include<bits/stdc++.h>
using namespace std;
#define MAX_V 2000
#define INF (1<<26)
typedef pair<int,int > P;
struct edge{int to,cap,cost,rev;};
 
int V;
vector<edge> G[MAX_V];
int h[MAX_V];
int dist[MAX_V];
int prevv[MAX_V],preve[MAX_V];
 
void add_edge(int from,int to,int cap,int cost){
  G[from].push_back((edge){to,cap,cost,G[to].size()});
  G[to].push_back((edge){from,0,-cost,G[from].size()-1});
}
 
int min_cost_flow(int s,int t,int f){
  int res=0;
  fill(h,h+V,0);
  while(f>0){
    priority_queue< P , vector<P> , greater<P> > que;
    fill(dist,dist+V,INF);
    dist[s]=0;
    que.push(P(0,s));
    while(!que.empty()){
      P p=que.top();que.pop();
      int v=p.second;
      if(dist[v]<p.first)continue;
      for(int i=0;i<(int)G[v].size();i++){
    edge &e=G[v][i];
    if(e.cap>0&&dist[e.to]>dist[v]+e.cost+h[v]-h[e.to]){
      dist[e.to]=dist[v]+e.cost+h[v]-h[e.to];
      prevv[e.to]=v;
      preve[e.to]=i;
      que.push(P(dist[e.to],e.to));
    }
      }
    }
   
    if(dist[t]==INF){
      return -1;
    }
    for(int v=0;v<V;v++)h[v]+=dist[v];
    int d=f;
    for(int v=t;v!=s;v=prevv[v]){
      d=min(d, G[prevv[v]][preve[v]].cap);
    }
    f-=d;
    res+=d*h[t];
    for(int v=t;v!=s;v=prevv[v]){
      edge &e = G[prevv[v]][preve[v]];
      e.cap-=d;
      G[v][e.rev].cap+=d;
    }
  }
  return res;
}
 
int n;
int t[200][200],u[200][200];
char a[200][200],b[200][200];
 
int main(){
  cin>>n;
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
      cin>>t[i][j];
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
      cin>>u[i][j];
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
      cin>>a[i][j];
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
      b[i][j]='.';
 
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      int sum=0;
      if(a[i][j]=='.'){
    sum+=t[i][j]*2;
    for(int k=0;k<n;k++){
      if(a[i][k]=='o')sum+=u[i][k];
      if(a[k][j]=='o')sum+=u[k][j];
    }
      }else{
    for(int k=0;k<n;k++){
      if(k!=j&&a[i][k]=='o')sum+=u[i][k];
      if(k!=i&&a[k][j]=='o')sum+=u[k][j];
    }   
      }
      add_edge(i,n+j,1,sum);
    }
  }
  for(int i=0;i<n;i++){
    add_edge(n+n,i,1,0);
    add_edge(n+i,n+n+1,1,0);
  }
  V=n+n+2;
  cout<<min_cost_flow(n+n,n+n+1,n)/2<<endl;
 
 
   
  for(int i=0;i<n;i++){
    for(int j=0;j<(int)G[i].size();j++){
      edge e=G[i][j];
       
      if(e.cap==0&&n<=e.to&&e.to<n+n){
    b[i][e.to-n]='o';
      }
    }
  }
 
 
  vector<P> ans;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(a[i][j]==b[i][j])continue;
      ans.push_back(P(i,j));
    }
  }
   
  cout<<ans.size()<<endl;
  for(int i=0;i<(int)ans.size();i++){
    P p=ans[i];
    if(a[p.first][p.second]=='.'){
      cout<<p.first+1<<" "<<p.second+1<<" write"<<endl;
    }else{
      cout<<p.first+1<<" "<<p.second+1<<" erase"<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1980
N = int(input())

A = list(map(int,input().split()))
B = list(map(int,input().split()))

cnt = 0
for i in range(N):
    if A[i] >= B[i]:
        cnt += B[i]
    else:
        cnt += A[i]
        if A[i+1] > B[i]-A[i]:
            cnt += B[i]-A[i]
            A[i+1] -= B[i]-A[i]
        else:
            cnt += A[i+1]
            A[i+1] = 0

print(cnt)    



Measured memory_bytes: 18624
/**
*	created: 11.09.2020 13:48:21
**/
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
using ll = long long;
using P = pair<int,int>;
// #define endl '\n'
#define int long long
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define rrep(i,n) for (int i = (int)(n - 1); i >= 0; i--)
#define rep2(i,s,n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1ll << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;
template<typename T> inline bool chmax(T &a, T &b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T> inline bool chmin(T &a, T &b) {if (b < a) {a = b; return 1;} return 0;}
template<typename T> T pow(T a, ll n) {T r(1); while(n) {if (n & 1) r *= a; a *= a; n >>= 1;} return r;}
struct faster_io {faster_io() {cin.tie(0); ios_base::sync_with_stdio(false);}} faster_io_;

signed main() {
    vector<P> to;
    int n, m; cin >> n >> m;
    rep(i,m) {
        int a, b; cin >> a >> b;
        a--; b--;
        to.push_back(P(min(a,b),max(a,b)));
    }
    vector<int> v;
    rep2(i,1,n) v.push_back(i);
    int t = 1;
    rep(i,n-1) t *= i + 1;
    sort(all(to));
    int cnt = 0;
    rep(i,t) {
        bool ok = true;
        if (!binary_search(all(to),P(0,v[0]))) ok = false;
        rep2(j,1,n-1) {
            int a = min(v[j-1],v[j]), b = max(v[j-1],v[j]);
            if (!binary_search(all(to),P(a,b))) ok = false;
        }
        if (ok) {
            cnt++;
        }
        next_permutation(all(v));
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3596
#include <stdio.h>
#include <string.h>
#include <math.h>
int main(void){
    
    int n;
    int k;
    char s[199999];
    int ans=0;
    int tmp=0;
    
    scanf("%d %d", &n, &k);
    scanf("%s", s);
    
    for(int i=0; i<n; i++){
        
        if(s[i]=='L'){
            
            if(i>=1){
                
                if(s[i-1]=='L'){
                    
                    tmp += 1;
                    
                }
                
            }
            
        } else {
            
            if(i<n){
                
                if(s[i+1]=='R'){
                    
                    tmp += 1;
                    
                }
                
            }
            
        }
        
    }
    
    tmp += k * 2;
    
    if(tmp>n-1){
        
        ans = n - 1;
        
    } else {
        
        ans = tmp;
        
    }
    
    printf("%d", ans);
    
    return 0;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

template< int mod >
struct ModInt {
  int x;

  ModInt() : x(0) {}

  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
    return *this;
  }

  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }

  ModInt operator-() const { return ModInt(-x); }

  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

  bool operator==(const ModInt &p) const { return x == p.x; }

  bool operator!=(const ModInt &p) const { return x != p.x; }

  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }

  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }

  friend ostream &operator<<(ostream &os, const ModInt &p) {
    return os << p.x;
  }

  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt< mod >(t);
    return (is);
  }

  static int get_mod() { return mod; }
};

using modint = ModInt< MOD >;


constexpr int M = 114514;

modint dp[M] = {0};
ll s[M]={0};

int main(int argc, char const *argv[]) {
    int n,m; cin>>n>>m;
    rep(i,m) {
        int a; cin>>a; s[a] = 1;
    }

    dp[0] = 1;
    
    rep(i,n) {
        if (!s[i+1]) dp[i+1] += dp[i];
        if (!s[i+2]) dp[i+2] += dp[i];
    }

    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 1536
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;

    vector<int> cnt(n);
    for(int i=0; i<n; ++i){
        int a;
        cin >> a;
        ++ cnt[a-1];
    }

    sort(cnt.rbegin(), cnt.rend());
    int ans = n - accumulate(cnt.begin(), cnt.begin() + k, 0);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>

using namespace std;

const int NMAX = 100000 + 5;

int N;
int v[NMAX];

int main()
{
    int C, K;
    cin >> N >> C >> K;

    for (int i = 1; i <= N; ++ i)
        cin >> v[i];
    sort(v + 1, v + N + 1);

    int cnt = 0;

    int rem = 0;
    int limit = -1;
    for (int i = 1; i <= N; ++ i) {
        if (!rem || v[i] > limit) {
            ++ cnt;
            rem = C;
            limit = v[i] + K;
        }
        -- rem;
    }

    cout << cnt << '\n';
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const ll mod=1e9+7;

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

	int ans=0;
	if(N==100000) {
		ans=90909;
	}else if(N>9999){
		ans=909+N-9999;
	}else if(N>999){
		ans=909;
	}else if(N>99){
		ans=9+N-99;
	}else if(N>=10){
		ans=9;
	}else{
		ans=N;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
X = list(map(int, input().split()))
idx = range(N)
Y = [ [ idx[i], X[i]] for i in range(N) ]
Z = sorted(Y , key=lambda x: x[1])
ans = []
for i,j in enumerate(Z):
    idx_tmp = Z[i][0]
    if i < int(N/2):
        median = Z[int(N/2)][1]
    else:
        median = Z[int(N/2)-1][1]
    ans.append([idx_tmp,median])
ans = sorted(ans, key=lambda x:x[0])
for i in ans:
    print(i[1]) 

Measured memory_bytes: 67472
n = int(input())
p = [int(i) for i in input().split()]
count = 0
for i in range(1,n-1):
    mn = min(p[i-1],p[i],p[i+1])
    mx = max(p[i-1],p[i],p[i+1])
    if mn!=p[i] and  mx != p[i]:
        count += 1
print(count)

Measured memory_bytes: 38256
#include <iostream>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int K, A, B;
  cin >> K >> A >> B;
  if (A % K == 0) {
    cout << "OK" << endl;
  } else if (A / K == B / K) {
    cout << "NG" << endl;
  } else {
    cout << "OK" << endl;
  }
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll MOD = 1e9+7;
ll LLINF = 1LL << 60;
int INF = INT_MAX;

int main(){
    ll n; cin >> n;
    ll x = 1; ll y = 2;
    bool ok = false;
    while(x*y <= 2*n){
        if(x*y == 2*n){
            ok = true;
            break;
        }
        x++; y++;
    }
    if(!ok){
        cout<<"No"<<endl;
        return 0;
    }else cout<<"Yes"<<endl;

    vector<vector<ll>> sets(y);
    rep(i,0,y) sets[i].push_back(x);
    sets[0].push_back(1); sets[1].push_back(1); 
    ll now = 1; ll stop = 3; ll step = 3; ll h2 = 2;
    while(now < n){
        ll h1 = 0;
        while(now < stop){
            now++;
            sets[h1].push_back(now);
            sets[h2].push_back(now);
            h1++;
        }
        h2++;
        stop+=step; step++;
    }

    cout<<y<<endl;
    rep(i,0,y){
        rep(j,0,x+1){
            cout<<sets[i][j]<<" ";
        }
        cout<<endl;
    }
    

}

Measured memory_bytes: 3200
n = int(input())
l = [input() for _ in range(n)]

flg = True
if len(l) != len(set(l)):
    flg = False


for i in range(len(l)-1):
    if l[i][-1] != l[i+1][0]:
        flg = False
        break

print('Yes' if flg else 'No')


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define pc(x) putchar(x)
namespace ib {char b[100];}
inline void pi(int x){
	if(x==0) {pc(48); return;}
	if(x<0) {pc('-'); x=-x;}
	char *s=ib::b;
	while(x) *(++s)=x%10,x/=10;
	while(s!=ib::b) pc((*(s--))+48);
}
inline void ri(int &x){
	x=0; static char c; bool t(0);
	while(c=getchar(),c<'0'||c>'9') if(c=='-') t=1; else t=0;
	do x=(x<<1)+(x<<3)+c-'0'; while(c=getchar(),c>='0'&&c<='9');
	if(t) x=-x;
}
const int M=1e9+7,N=2024;
int JC[N*N],RJC[N*N],f[N][N];
inline int ksm(int n,int c){
	int jc=1;
	while(c){
		if(c&1) jc=(long long)jc*n%M;
		n=(long long)n*n%M; c>>=1; 
	}
	return jc;
}
inline int C(int n,int m){
	if(m==0||m==n) return 1;
	if(m>n) return 0;
	return (long long)JC[n]*RJC[m]%M*RJC[n-m]%M;
}
int main(){
	int i,j,n,k; ri(n); ri(k);
	if(k==1){pc('1'); return 0;}
	JC[0]=1; for(i=1;i<=2000*2000;++i) JC[i]=(long long)JC[i-1]*i%M;
	RJC[2000*2000]=ksm(JC[2000*2000],M-2);
	for(i=2000*2000-1;i>=0;--i) RJC[i]=(long long)RJC[i+1]*(i+1)%M;
	f[0][0]=1;
	for(i=0;i<=n;++i)
	for(j=0;j<=n;++j){
		f[i][j+1]=(f[i][j+1]+f[i][j])%M;
		if(j) f[i+1][j-1]=(f[i+1][j-1]+(long long)(n-i)*C(n*k-i*k-j-1,k-2)%M*f[i][j])%M;
	}
	cout<<f[n][0];
	return 0;
}

Measured memory_bytes: 47872
while True:
	n,k = map(int,raw_input().split())
	if n == 0 and k == 0:
		break
	
	fridge = map(int,raw_input().split())
	
	judge = False
	for i in xrange(n):
		uses = map(int,raw_input().split())
		for j in xrange(k):
			fridge[j] -= uses[j]
			if fridge[j] < 0:
				judge = True
				
	if judge:
		print "No"
	else:
		print "Yes"

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

#define int 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 repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

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


#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/

// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
	os << "(" << pair_var.first << ", " << pair_var.second << ")";
	return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
	os << "{";
	for (int i = 0; i < vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
	}
	os << "}";
	return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
	os << "{";
	repi(itr, map_var) {
		os << *itr;
		itr++;
		if (itr != map_var.end()) os << ", ";
		itr--;
	}
	os << "}";
	return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
	os << "{";
	repi(itr, set_var) {
		os << *itr;
		itr++;
		if (itr != set_var.end()) os << ", ";
		itr--;
	}
	os << "}";
	return os;
}

#define DUMPOUT cerr

void dump_func() {
	DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
	DUMPOUT << head;
	if (sizeof...(Tail) > 0) {
		DUMPOUT << ", ";
	}
	dump_func(std::move(tail)...);
}
#ifdef _DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif


signed main() {

	int K, X;
	cin >> K >> X;

	for (int i = X-K+1; i <= X+K-1; i++) {
		cout << i << " ";
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 768
#include <stdio.h>
int main(void){
    int W,H;
    int x,y,r;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    if(x+r<=W && x-r>=0){
        if(y+r<=H && y-r>=0){
            printf("Yes\n");
        }
        else{
            printf("No\n");
        }
    }
    else{
        printf("No\n");
    }
    
    return 0;
}


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


using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,s) for (auto i = begin(s); i != end(s); ++i)
#define itrepd(i,s) for (auto i = --end(s); i != begin(s); --i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
#define rall(f,x,...) [&](decltype(x)& whole) { return (f)(rbegin(whole), rend(whole), ##__VA_ARGS__); }(x)
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e17;
ll mod = static_cast<ll>(1e9 + 7);
std::ostream& endn(std::ostream& os) { return os.put(os.widen('\n')); }
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T> constexpr T pow2(const T a) { return a * a; }
template<class T, class ... Args> constexpr T mins(T& a, Args... args) { return a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr T maxs(T& a, Args... args) { return a = max<T>({ a,args... }); }

int n;
vector<pair<int, int>> to[100005];
int v[100005];
int ans[100005];
bool used[100005];
void solve() {
    cin >> n;

    rep(i, n - 1) {
        int a, b; cin >> a >> b; --a; --b;
        to[a].emplace_back(b, i); to[b].emplace_back(a, i);
        ++v[a]; ++v[b];
    }

    int k = 0;
    rep(i, n) maxs(k, v[i]);

    cout << k << endn;
    queue<pair<int, int>> que;
    que.emplace(0, 0);
    used[0] = true;
    while (!que.empty()) {
        auto p = que.front(); que.pop();
        int val = 1;
        rep(i, to[p.first].size()) {
            auto v = to[p.first][i];
            if (used[v.first]) continue;
            if (val == p.second) ++val;
            used[v.first] = true;
            ans[v.second] = val;
            que.emplace(v.first, val);
            ++val;
        }
    }

    rep(i, n - 1) cout << ans[i] << endn;

}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    cout << flush;
    return 0;
}


Measured memory_bytes: 7552
#include<iostream>
#include<string>
using namespace std;
int main(){
    int i,j,n,tt=0;
    cin >> n;
    int d[n];
    for(i=0;i<n;i++){
        cin >> d[i];
    }
    for(i=0;i<n-1;i++){
        for(j=i+1;j<n;j++){
            tt=tt+d[i]*d[j];
        }
    }
    cout << tt;
}

Measured memory_bytes: 256
// d

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ru(a,b) (((a)+((b)-1)) / (b))   //切り上げ(a/b)
#define dump(x)  cout << #x << " = " << (x) << endl;
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    // 単発入力
    int N, K;
    cin >> N >> K;

    vector<int> P(N);
    rep(i,N) cin >> P[i];

    queue<double> kitai;

    double kitai_max = 0;
    double kitai_cur = 0;

    for (int i = 0; i < N; ++i)
    {
        // 期待値出す
        double kita = (double)(P[i] + 1) / 2.0;
        
        // 末尾に足す
        kitai.push(kita);
        kitai_cur += kita;

        if (kitai.size() > K)
        {
            //Kより多かったら先頭を引く
            kitai_cur -= kitai.front();
            kitai.pop();
        }

        if (kitai.size() == K)
        {
            if (kitai_cur > kitai_max) kitai_max = kitai_cur;
        }
    }

    // cout << kitai_max << endl;
    printf("%.10f\n", kitai_max);
    return 0;
}

Measured memory_bytes: 2688
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define  mod 998244353
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0};
int dy[8]={0,-1,0,1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    ll r,g;cin>>r>>g;
    cout<<g*2-r<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------






Measured memory_bytes: 256
n, m = map(int, input().split())
A = [[] for i in range(n)]
for i in range(n):
    A[i] = list(map(int, input().split()))

B = [i for i in range(m)]
for i in range(m):
    B[i] = int(input())

for i in range(n):
    c = 0
    for j in range(m):
       c += A[i][j]*B[j]
    print(c)


Measured memory_bytes: 6024
// #pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);
#define fou(i,a,n) for(int i=a;i<n;i++)
#define fod(i,a,n) for(int i=n-1;i>=a;i--)
#define rep(n) fou(_,0,n)
#define tra(a,x) for(auto& a : x)
#define elif(c) else if(c)
#define VI vector<int>
#define VD vector<double>
#define VC vector<char>
#define VS vector<string>
#define VVI vector<VI>
#define VVD vector<VD>
#define VVC vector<VC>
#define VVS vector<VS>
#define emb emplace_back
#define pub push_back
#define pob pop_back
#define mp make_pair
#define fi first
#define se second
#define si(vec) ((int)(vec).size())
#define all(vec) vec.begin(),vec.end()
#define lla(vec) vec.rbegin(),vec.rend()
#define range(vec,x,y) vec.begin()+x,vec.begin()+y
#define sortup(vec) sort(all(vec))
#define sortdown(vec) sort(lla(vec))
#define eraseif(vec,condition_x) vec.erase(remove_if(all(vec),[](auto x){return condition_x;}),vec.end())
#define countif(vec,condition_x) count_if(all(vec),[](auto x){return condition_x;})
#define replaceif(vec,condition_x,n) replace_if(all(vec),[](auto x){return condition_x;},n)
#define optvalue(vec,condition_x,relation_x_opt) *min_element(all(vec),[](int x,int opt){return condition_x ? (opt==0)||!(relation_x_opt):false;})
#define erase_unique(vec) vec.erase(unique(all(vec)),vec.end())
#define calcvec(vec,calc_x) for_each(all(vec),[](int&x){x= calc_x;})
#define calc2vec(vec1,op,vec2) {rep(1){int s=min(si(vec1),si(vec2));fou(i,0,s)vec1[i]=vec1[i] op vec2[i];}}
template<class C>void mini(C &a,C b){a=min(a,b);}
template<class C>void maxi(C &a,C b){a=max(a,b);}
#define in(T,...) T __VA_ARGS__;_cin(__VA_ARGS__);
#define out(...) _cout(__VA_ARGS__);
void _cin(){}template<class Head,class...Tail>void _cin(Head&head,Tail&&...tail){cin>>head;_cin(forward<Tail>(tail)...);}
template<class Head>void _cout(Head head){cout<<head<<endl;}template<class Head,class...Tail>void _cout(Head head,Tail...tail){cout<<head<<" ";_cout(forward<Tail>(tail)...);}
template<class C>void outvec(vector<C> vec){int vecsize=si(vec);fou(i,0,vecsize-1)cout<<vec[i]<<" ";out(vec[vecsize-1]);}
template<class C> C gcd(C a,C b){if(a&&b)return gcd(min(a,b),max(a,b)%min(a,b));else return a;}
template<class C> C lcm(C a,C b){return a/gcd(a,b)*b;}




// #define int int64_t
// #define double long double


// 無名関数template
// map,makepair

signed main(){
  IOS;

  in(int,n);
  VI a(n);
  fou(i,0,n)cin>>a[i];

  sortdown(a);
  out(a[0]-a[si(a)-1])

}

Measured memory_bytes: 256
n = int(input())
ans = 1
a, b = False, False
x = list(map(int, input().split()))
for i in range(1, n):
    if x[i] > x[i - 1]:
        a = True
    if x[i] < x[i - 1]:
        b = True
    if a and b:
        a, b = False, False
        ans += 1
print(ans)


Measured memory_bytes: 85604