akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef ostringstream OSS; typedef istringstream ISS;
typedef long long LL;
typedef pair<int, int> PII;  typedef pair<LL, LL> PLL;
typedef vector<int>    VI;   typedef vector<VI>   VVI;   typedef vector<VVI>   VVVI;
typedef vector<LL>     VLL;  typedef vector<VLL>  VVLL;  typedef vector<VVLL>  VVVLL;
typedef vector<double> VD;   typedef vector<VD>   VVD;   typedef vector<VVD>   VVVD;
typedef vector<string> VS;   typedef vector<VS>   VVS;   typedef vector<VVS>   VVVS;
typedef vector<bool>   VB;   typedef vector<VB>   VVB;   typedef vector<VVB>   VVVB;
typedef vector<PII>    VPII; typedef vector<VPII> VVPII; typedef vector<VVPII> VVVPII;
typedef vector<PLL>    VPLL; typedef vector<VPLL> VVPLL; typedef vector<VVPLL> VVVPLL;

typedef unsigned int  UI;
typedef vector<UI>    VUI;
typedef vector<VUI>   VVUI;

#define fst first
#define snd second
// #define Y first
// #define X second
#define MP make_pair
#define PB push_back
#define EB emplace_back 
#define ALL(x)  (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define RANGEBOX(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define RANGE(x, l, r) ((l) <= (x) && (x) <= (r))
#define rep(i, N)  for (int i = 0; i < (int)(N); i++)
#define rrep(i, N) for (int i = N - 1; i >= 0; i--)
#define REP(i, init, N)  for (int i = (init); i < (int)(N); i++)
#define RREP(i, N, last) for (int i = (init - 1); i >= last; i--)
#define MAXUD(orig, target) orig = max(orig, target)
#define MINUD(orig, target) orig = min(orig, target)
#define DUMP(x) cerr << #x << " = " << (x) << endl

template < typename T > inline T fromString(const string &s) { T res; ISS iss(s); iss >> res; return res; };
template < typename T > inline string toString(const T &a)   { OSS oss; oss << a; return oss.str(); };

template<typename T=int> inline void dump(vector<T> vs, bool ent=false) { rep(i, vs.size()) cout << vs[i] << (i+1==vs.size() ? '\n' : ' '); if (ent) cout << endl; }
template<typename T = int> inline void dump(vector<vector<T>> vs, bool ent=false) { rep(i, vs.size()) dump<T>(vs[i]); if (ent) cout << endl; }

const int    INF  = 0x3f3f3f3f;
const LL     INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;
const int    DX[] = {1,  0, -1, 0};
const int    DY[] = {0, -1,  0, 1};
const double EPS  = 1e-12;
// const double PI   = acos(-1.0);

template<typename T = int> inline T in() { T x; cin >> x; return x; }
template<typename T = int> inline vector<T> in(int n) { vector<T> xs(n); rep(i, n) cin >> xs[i]; return xs; }
template<typename T = int> inline vector<vector<T>> in(int n, int m) { vector<vector<T>> xs(n, vector<T>(m)); rep(i, n) rep(j, m) cin >> xs[i][j]; return xs; }

int main(void) {
    int a, b, h;
    cin >> a >> b >> h;
    cout << ((a + b) * h / 2) << endl;

    return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	long long x,n,t,ans,tmp;
	scanf("%lld",&n);
	t=10;
	x=n;
	ans=0;
	while(x>0)
		ans+=x%10,x/=10;
	while(1)
	{
		tmp=n%t;
		if(tmp!=t-1)
			n-=(tmp+1);
		x=n;
		tmp=0;
		while(x>0)
			tmp+=x%10,x/=10;
		ans=max(ans,tmp);
		t*=10;
		if(t>n)
			break;
	}
	printf("%lld",ans);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
 	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <cassert>
using namespace std;

int main(){
    string S;
    cin >> S;
    for(int i=0; i<S.size()-1; i++){
        if(S[i] == S[i+1]){
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n; double m; cin >> n >> m;
  vector<int>a(n);
  for(int i; i<n; i++) cin >> a[i];
  int sou=0;
  for(int i; i<n; i++) sou += a[i];
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  double k = sou/(4*m);
  if(a[m-1]>=k) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<cstdio>
int n,p,a[110],c,d;
long long int rem[52][52];
int main()
{
    scanf("%d%d",&n,&p);
    for(int i = 1; i <= n; i ++)
        scanf("%d",&a[i]),a[i] = a[i] % 2;
    for(int i = 1; i <= n; i ++)
        if(a[i])
            c ++;
    d = n - c;
    long long int ans;
    for(int i = 0; i <= 50; i ++)
        rem[i][0] = 1;
    for(int i = 1; i <= 50; i ++)
        for(int j = 1; j <= i; j ++)
            rem[i][j] = rem[i][j-1] * (i+1-j) / j;
    long long int x=0,y=0;
    if(p){
        for(int i = 0; i*2+1 <= c; i++)
            x += rem[c][2*i+1];
        for(int i = 0; i <= d; i ++)
            y += rem[d][i];
        ans = x*y;
    }
    else{
        for(int i = 0; i*2 <= c; i++)
            x += rem[c][2*i];
        for(int i = 0; i <= d; i ++)
            y += rem[d][i];
        ans = x*y;
    }
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
using namespace std;
#define MAX 4000
int main(){
    int i,dataset,snum[MAX],flag;
    long long total[MAX],unitcost,amount;
    while( 1 ){
 
        for(i=0;i<MAX;i++){
            total[i]=0;
            snum[i]=0;
        }
 
        scanf("%d",&dataset);
        if( dataset == 0 ){break;}
 
        else for(i=0;i<dataset;i++){
            scanf("%d %lld %lld",&snum[i],&unitcost,&amount);
            total[snum[i]]+=unitcost*amount;
        }
         
 
        flag=0;
        for(i=0;i<MAX;i++){
                        if( total[snum[i]] >= 1000000 ){
                flag=1;
                printf("%d\n",snum[i]);
                total[snum[i]]=0;
            }
        }
        if( dataset!=0 && flag==0 ){
            printf("NA\n");
        }
    }
}

Measured memory_bytes: 1240
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>
#include<functional>
#include<stack>
#include<utility>
#include<stack>

using namespace std;

int main() {
	long long n, MAX, MIN, SUM = 0, a;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		if (i == 0) {
			MAX = a;
			MIN = a;
			SUM += a;
			continue;
		}
		MAX = max(MAX, a);
		MIN = min(MIN, a);
		SUM += a;
	}
	cout << MIN <<" "<< MAX <<" "<< SUM << endl;
	return 0;
}


Measured memory_bytes: 3112
#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int max=1;
	int i=1;
	while(1){
		if(max<i*i){
			if(i*i>n){
				cout<<max<<endl;
				break;
			}
			else{
				max=i*i;
			}
		}
		i++;
	}
}

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

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

int getChar(char ch)
{
    if (ch == 'A')
        return 1;
    else if (ch == 'C')
        return 2;
    else if (ch == 'G')
        return 3;
    else if (ch == 'T')
        return 4;
    else
        return 0;
}

long long getKey(char str[])
{
    long long sum = 0, p = 1, i;
    for (i = 0; i < strlen(str); i++)
    {
        sum += p * (getChar(str[i]));
        p *= 5;
    }
    return sum;
}

int h1(int key) { return key % M; }
int h2(int key) { return 1 + (key % (M - 1)); }

int find(char str[])
{
    long long key, i, h;
    key = getKey(str);
    for (i = 0;; i++)
    {
        h = (h1(key) + i * h2(key)) % M;
        if (strcmp(H[h], str) == 0)
            return 1;
        else if (strlen(H[h]) == 0)
            return 0;
    }
    return 0;
}

int insert(char str[])
{
    long long key, i, h;
    key = getKey(str);
    for (i = 0;; i++)
    {
        h = (h1(key) + i * h2(key)) % M;
        if (strcmp(H[h], str) == 0)
            return 1;
        else if (strlen(H[h]) == 0)
        {
            strcpy(H[h], str);
            return 0;
        }
    }
    return 0;
}

int main()
{
    int i, n, h;
    char str[L], com[9];
    for (i = 0; i < M; i++)
        H[i][0] = '\0';
    scanf("%d", &n);
    for (i = 0; i < n; i++)
    {
        scanf("%s %s", com, str);
        if (com[0] == 'i')
        {
            insert(str);
        }
        else
        {
            if (find(str))
            {
                printf("yes\n");
            }
            else
                printf("no\n");
        }
    }
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  ll x = 1000;
  rep(i,n-1) {
    int s = a[i];
    int t = a[i+1];
    if (s < t) {
      ll k = x/s;
      x %= s;
      x += k*t;
    }
  }
  cout << x << endl;
  return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> plus, minus;
    for(int i = 0; i < N; i++){
        int x, y;
        cin >> x >> y;
        plus.push_back(x + y);
        minus.push_back(x - y);
    }
    sort(plus.begin(), plus.end());
    sort(minus.begin(), minus.end());
    cout << max(plus[N - 1] - plus[0], minus[N - 1] - minus[0]) << endl;
    return 0;
}

Measured memory_bytes: 5084
using System;
using System.IO;

class Program
{
    static void Main(string[] args) {
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Console.WriteLine(Solve());
        Console.Out.Flush();
    }
    static int Solve() {
        var N = Console.ReadLine();
        var len = N.Length;
        var result = N[0] - '0' + 9 * (len - 1);
        var isNines = true;
        for (int i = 1; i < len; i++) {
            if (N[i] == '9') continue;
            isNines = false;
            break;
        }
        return isNines ? result : result - 1;
    }
}

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

using namespace std;

typedef long long LL;
typedef long double LD;


int main()
{
  LL N;
  cin >> N;
  LL K;
  cin >> K;
  list<LL> V;
  for (LL n = 0; n < N; ++n) {
    LL v;
    cin >> v;
    V.push_back(v);
  }


  LL total_max = 0;
  for (LL k = 0; k <= K; ++k) { //! 取り出す回数 0 to K
    LL cd = K - k; //! 戻す回数
    for (LL a = 0; a <= k; ++a) { //! A
      LL b = k - a;

      list<LL> U(V);

      priority_queue<LL, vector<LL>, greater<LL>> J;

      for (LL i = 1; i <= a; ++i) {
        if (!U.empty()) {
          LL val = U.front();
          U.pop_front();
          J.push(val);
        }
      }
      for (LL i = 1; i <= b; ++i) {
        if (!U.empty()) {
          LL val = U.back();
          U.pop_back();
          J.push(val);
        }
      }
      for (LL i = 1; i <= cd; ++i) {
        if (!J.empty()) {
          if (J.top() < 0) {
            J.pop();
          }
        }
      }

      //cerr << a <<" : " << b << " : " << cd << endl;
      LL total = 0;
      while(!J.empty()){
        //cerr << J.top() << " ";
        total += J.top();
        J.pop();
      }
      //cerr << endl;

      total_max = max(total_max, total);
    }


    
  }
  cout << total_max;

  return 0;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
	//freopen("in.txt","r",stdin);
	int a,b;
	scanf("%d%d",&a,&b);
	bool f=false;
	for(int i=1;i<=1500;i++) {
		if(i*8/100==a&&i/10==b) {
			printf("%d\n",i);
			f=true;
			break;
		}
	}
	if(!f) printf("-1\n");
	return 0;
}

Measured memory_bytes: 256
s=input()
k=int(input())
n = len(s)
same = True
for i in range(1,len(s)):
    if s[i]!=s[i-1]:
        same = False
if same:
    print(len(s)*k//2)
    exit()

for i in range(1,len(s)):
    if s[i] != s[i-1]:
        before = i-1
        break
for i in range(len(s)-1,-1,-1):
    if s[i] != s[i-1]:
        after = i
        break

ans = (before+1)//2 
ans += (len(s)-after)//2
if s[0] == s[-1]:
    ans += (before + 1 + len(s) - after)//2 * (k-1)
else:
    ans += ((before+1)//2  + (len(s)-after)//2)*(k-1)
cnt = 1
for i in range(before+2, after):
    if s[i] != s[i-1]:
        ans += cnt //2 *k
        cnt = 1
    else:
        cnt +=1
ans += cnt //2 * k
print(ans)


Measured memory_bytes: 38256
import java.util.*;
public class Main {
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);
    String C1 = sc.next();
    String C2 = sc.next();

    String C11 = C1.substring(0,1);
    String C12 = C1.substring(1,2);
    String C13 = C1.substring(2,3);
	String C21 = C2.substring(0,1);
	String C22 = C2.substring(1,2);
	String C23 = C2.substring(2,3);

	if ((C11.equals(C23)) && (C12.equals(C22)) && (C21.equals(C13))) {
      System.out.println("YES");
    } else {
	  System.out.println("NO");
    }
    
  }
}

Measured memory_bytes: 23124
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define rep(i, f, n) for (int i = (f); i < (int)(n); i++)
#define repe(i, f, n) for (int i = (f); i <= (int)(n); i++)
using namespace std;
using ll = long long;
using pint = pair<int, int>;

const int MAX = 50;

int n, m;
int a[MAX], b[MAX];
bool g[MAX][MAX];
bool visited[MAX];

void dfs(int v) {
  visited[v] = true;
  // 連結判定
  rep(v2, 0, n) {
    if (!g[v][v2]) continue;
    if (visited[v2]) continue;
    dfs(v2);
  }
}

int main() {
  cin >> n >> m;
  rep(i, 0, m) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    g[a[i]][b[i]] = g[b[i]][a[i]] = true;
  }

  int ans = 0;

  // 一旦橋を辺の連結を解除し、全てを未訪問にした状態で dfs で探索を行う.
  // 辺の連結を解除したことで visited に1つでも未訪問（到達できない）があれば橋
  rep(i, 0, m) {
    g[a[i]][b[i]] = g[b[i]][a[i]] = false;

    rep(j, 0, n) visited[j] = false;

    dfs(0);

    bool bridge = false;
    rep(j, 0, n) if (!visited[j]) bridge = true;
    if (bridge) ans++;

    g[a[i]][b[i]] = g[b[i]][a[i]] = true;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;

using namespace std;

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


const int NM = 101001;//ここを問題の制約を見ながらいじる．配列の確保に使う．
int A[NM];//あまり褒められたことではないが関数の外側に配列を確保すると怒られにくい．

// Main program
void solve(){
  string A,B;
  cin >> A ;
  cin >> B ;

  cout << B +A;

}

int main() {
    solve();
    return 0;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
char arr[2][55];
int moder = 1000000007;
int main(){
	cin>>n>>arr[0]+1>>arr[1]+1;
	int p = 1;
	vector<int>tile;
	while(p<=n){
		if(arr[0][p]==arr[1][p]){
			tile.push_back(2);
			p++;
		}
		else{
			tile.push_back(1);
			p+=2;
		}
	}
	long long ret = 1;
	for(int i=0; i<tile.size(); i++){
		if(i==0){
			if(tile[i]==1) ret*=6;
			else ret*=3;
		}
		else{
			if(tile[i]==1){
				if(tile[i-1]==1) ret*=3;
				else ret*=2;
			}
			else{
				if(tile[i-1]==1) ret*=1; 
				else ret*=2;
			}
		}
		ret%=moder;
	}
	cout<<ret;
}

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

int main() {
  int a[5];
  for (auto& e : a) {
    cin >> e;
  }
  sort(a, a + 5);
  for (int i = 4; i > 0; i--) {
    cout << a[i] << " ";
  }
  cout << a[0] << endl;
}


Measured memory_bytes: 3148
### classes

class FH
  def initialize
    @data = []
    @mins = []
    @maxs = []
  end

  def size
    @data.length
  end

  def add(n)
    if @data.empty?
      @mins << n
      @maxs << n
    else
      @mins << n if @mins.last > n
      @maxs << n if @maxs.last < n
    end

    @data << n
  end

  def remove
    d = @data.pop
    @mins.pop if @mins.last == d
    @maxs.pop if @maxs.last == d
    d
  end

  def mins
    @mins
  end

  def maxs
    @maxs
  end
end

class SH
  def initialize
    @data = []
    @mins = []
    @maxs = []
  end

  def size
    @data.length
  end

  def add(n)
    if @data.empty?
      @mins << n
      @maxs << n
    else
      while ! @mins.empty? && @mins.last > n
        @mins.pop
      end
      @mins << n

      while ! @maxs.empty? && @maxs.last < n
        @maxs.pop
      end
      @maxs << n
    end

    @data << n
  end

  def remove
    d = @data.shift
    @mins.shift if @mins.first == d
    @maxs.shift if @maxs.first == d
    d
  end

  def mins
    @mins
  end

  def maxs
    @maxs
  end
end

class FIMO
  def initialize
    @fh = FH.new
    @sh = SH.new
  end

  def size
    @fh.size + @sh.size
  end

  def add(n)
    @sh.add(n)
    if @fh.size < @sh.size
      @fh.add(@sh.remove)
    end
  end

  def remove
    d = @fh.remove
    if @fh.size < @sh.size
      @fh.add(@sh.remove)
    end
    d
  end

  def fhmin(i)
    @fh.mins[-i]
  end

  def shmin(i)
    @sh.mins[i - 1]
  end

  def fhmax(i)
    @fh.maxs[-i]
  end

  def shmax(i)
    @sh.maxs[i - 1]
  end
end

### main

loop do
  qn = gets.to_i
  break if qn == 0

  fimo = FIMO.new

  qn.times do
    op, num = gets.split.map(&:to_i)
    #p [op, num]

    case op
    when 0
      fimo.add(num)
    when 1
      puts fimo.remove
    when 2
      puts fimo.fhmin(1)
    when 3
      puts fimo.shmin(1)
    when 4
      puts fimo.fhmin(num)
    when 5
      puts fimo.shmin(num)
    when 6
      puts fimo.fhmax(1)
    when 7
      puts fimo.shmax(1)
    when 8
      puts fimo.fhmax(num)
    when 9
      puts fimo.shmax(num)
    end
  end

  #p as
  puts 'end'
end

Measured memory_bytes: 6608
#include <cstdio>
#include <iostream>
#include <cstring>
#define maxn 1000005
int a[maxn],b[maxn],c[maxn];
using namespace std;
int main()
{
	int t;
	scanf("%d",&t);
	for(int i=0;i<t-1;i++){
		scanf("%d%d%d",&a[i],&b[i],&c[i]);
	}
	int tmp=0;
	for(int i=0;i<t-1;i++){
		int ti=0;
		for(int j=i;j<t-1;j++){
			if(ti<b[j]){
				ti=b[j];
			}
			if(ti%c[j]!=0){
				ti+=c[j]-(ti%c[j]);
			}
			ti+=a[j];
		}
		cout<<ti<<endl;
	}
		printf("0");
		return 0;
}


Measured memory_bytes: 4352
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
#define INF 1200000000


int main(){
    
    int H,A;
    cin>>H>>A;
    if(H%A==0){
        cout<<H/A<<endl;
    }
    else{
        cout<<H/A+1<<endl;
    }
}




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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n; cin >> n;
	set<string> s;

	while (n--) {
		string a; cin >> a;
		s.insert(a);
	}
	cout << sz(s) << endl;

}



Measured memory_bytes: 19292
#pragma region include
#include "bits/stdc++.h"
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i,n,m) for(int i = (int)(n); i < int(m); i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll LLINF = 4e18;
void input() {}
template<typename... R> void input(int& f, R&... r) { scanf("%d", &f); input(r...); }
template<typename... R> void input(double& f, R&... r) { scanf("%lf", &f); input(r...); }
template<typename... R> void input(ll& f, R&... r) { scanf("%lld", &f); input(r...); }
template<typename... R> void input(char& f, R&... r) { scanf("%c", &f); input(r...); }
template<typename T, typename... R> void input(vector<T>& f, R&... r) { REP(i, f.size())input(f[i]); input(r...); }
#pragma endregion

int main() {
    int N, D; input(N, D);
    D <<= 1;
    D++;
    cout << (N + D - 1) / D << endl;
    getchar(); getchar();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
main(void){
    int h, n, s=0;
    cin>>h>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
        s+=a[i];
    }
    sort(a,a+n);
    cout<<( s>=h?"Yes":"No" );
}


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

int Calc(int a, int b, string op);

int Calc(int a, int b, string op)
{
    if(op == "+"){
        return a+b;
    } else if(op == "-"){
        return a-b;
    } else if(op == "*"){
        return a*b;
    } else{
        return a/b;
    }
}

int main(void){
    int a, b;
    string op;
    vector<int> Answer;
    
    while(1){
        std::cin >> a;
        std::cin >> op;
        std::cin >> b;
        
        if(op == "?")   break;
        
        Answer.push_back(Calc(a, b, op));
    }

    for(int i = 0; i < Answer.size(); i++){
        std::cout << Answer[i] << std::endl;
    }
}

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

int main() {
	int N;
	int a = 0;
	cin >> N;
	int I = N;
	int i = 1;
	while (i < 15) {
		a += I % 10;
		I = I / 10;
		i++;
	}
	if (N % a == 0)
		cout << "Yes";
	else
		cout << "No";
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e19;
const int MOD = 1e9 + 7;

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    if(n % 2 == 0)
    {
        cout << n * (n-1) / 2 - n / 2 << endl;
        REP(i, n)
        {
            REP(j, n)
            {
                if(i == j || n - i - 1 == j || i >= j) continue;
                cout << i + 1 << " " << j + 1 << endl;
            }
        }
    }
    else
    {
        cout << n * (n-1) / 2 - n / 2 << endl;
        REP(i, n)
        {
            REP(j, n)
            {
                if(i == j || n - i - 2 == j || i >= j) continue;
                cout << i + 1 << " " << j + 1 << endl;
            }
        }
    }
    
}

Measured memory_bytes: 256
package main

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

func main() {
	s := readS()
	a := make([]rune, len(s))
	for i := 0; i < len(s); i++ {
		a[i] = 'x'
	}
	fmt.Println(string(a))
}

/*-----------Input utils-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	if len(os.Args) >= 2 {
		if os.Args[1] == "debug" {
			debug()
		}
	}
	const buf = 200100
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, buf), buf)
}

func debug() {
	testFile, err := os.Open("./test/sample-1.in")
	if err != nil {
		fmt.Fprintln(os.Stderr, "There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

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

func readR() []rune {
	return []rune(readS())
}

func readI() int {
	i, _ := strconv.Atoi(readS())
	return i
}

func readF() float64 {
	f, _ := strconv.ParseFloat(readS(), 64)
	return f
}


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

using namespace std;

typedef long long lli;
typedef double lld;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<double> vdl;
typedef vector<vector<lli>> mat;
typedef vector<vdl> mad;
typedef vector<unordered_map<lli,lli>> graph;

lli n;
mad v;
vll convex;
vdl ans;

lld deg(vdl a,vdl from){
  return fmod(atan2(a[1]-from[1],a[0]-from[0])+2*M_PI,2*M_PI);
}

lld deg(vdl a,vdl b,vdl from){
  return fmod(deg(b,from)-deg(a,from)+2*M_PI,2*M_PI);
}

lld abs(vdl to,vdl from){
  lld x = to[0]-from[0];
  lld y = to[1]-from[1];
  return sqrt(x*x+y*y);
}


int main(){
  cin >> n;
  v = mad(n,vdl(2));
  for(lli i = 0ll;i < n;i++) cin >> v[i][0] >> v[i][1];
  lli s = max_element(v.begin(),v.end())-v.begin();
  vll idx = vll(n);
  iota(idx.begin(),idx.end(),0ll);
  idx.erase(idx.begin()+s);
  sort(idx.begin(),idx.end(),[s](lli a,lli b){
    if(deg(v[a],v[s]) == deg(v[b],v[s])) return abs(v[a],v[s]) < abs(v[b],v[s]);
    return deg(v[a],v[s]) < deg(v[b],v[s]);
  });
  convex.push_back(s);
  for(lli x : idx){
    while(
      convex.size() >= 2 &&
      deg(v[convex[convex.size()-2]],v[x],v[convex[convex.size()-1]]) < M_PI
    ) convex.pop_back();
    convex.push_back(x);
  }
  lli m = convex.size();
  ans = vdl(n);
  for(lli i = 0;i < m;i++){
    ans[convex[i]] = (M_PI-deg(v[convex[(i+1)%m]],v[convex[(i-1+m)%m]],v[convex[i]]))/(M_PI*2);
    if(ans[convex[i]] < 0) ans[convex[i]] = 0;
  }
  cout << setprecision(17);
  for(lli i = 0;i < n;i++) cout << ans[i] << endl;
  return 0;

}


Measured memory_bytes: 256
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
using namespace std;

int inf = 2147483647;
int64_t inf64 = 9223372036854775807;
int mod = 1e+7;

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

  int n, m;
  cin >> n >> m;
  vector<vector<int>> Graph(n, vector<int>(0));
  rep(i,m) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    Graph[a].push_back(b);
    Graph[b].push_back(a);
  }

  vector<int> res(n, -1);
  queue<int> que;
  res[0] = 0;
  que.push(0);

  while(!que.empty()) {
    int v = que.front();
    que.pop();
    for(int nv : Graph[v]) {
      if(res[nv] != -1) continue;
      res[nv] = v;
      que.push(nv);
    }
  }
  cout << "Yes" << endl;
  reps(i,1,n) cout << res[i]+1 << endl;
  return 0;
}

Measured memory_bytes: 10204
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include <numeric>
#include <iostream>
#include <array>
#include <climits>
using namespace std;

int main()
{
  int N, K;
  string S;
  cin >> N >> K;
  cin >> S;

  S += '0';
  int ans=0;
  int count=0;
  int zero_area=0;
  if(N == 1){
    cout << 1 << endl;
    return 0;
  }
  if(S[0] == '0'){
    ++count;
  }
  for(int i=0; i<N; ++i){
    if(S[i] == '1' && S[i+1] == '0'){
      if(count == K){
        ans = max(ans, i-zero_area+1);
        ++zero_area;
        while(S[zero_area-1] != '0' || S[zero_area] != '1'){
          ++zero_area;
        }
      }else{
        ++count;
      }
    }
  }
  ans = max(ans, N - zero_area);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
#define ALL(v) v.begin(), v.end()
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define chmax(x, a) x = max(x, a)
#define chmin(x, a) x = min(x, a)

int main() {
    string S; cin >> S;
    if (S == "SSS") cout << 0 << endl;
    else if (S == "SSR" || S == "SRS" || S == "RSS" || S == "RSR") cout << 1 << endl;
    else if (S == "RRS" || S == "SRR") cout << 2 << endl;
    else cout << 3 << endl;
}


Measured memory_bytes: 3624
#include<stdio.h>
#include<math.h>
int main()
{
  long double a, b, c;
  scanf("%Lf%Lf%Lf", &a, &b, &c);
  long double e=1e-14;
  if(sqrtl(a)+sqrtl(b)+e<sqrtl(c)) printf("Yes");
  else printf("No");
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
ll MOD = 1000000007;
#define INF (1e9)

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

int main()
{
    ll N, A, B;
    cin >> N >> A >> B;
    vector<ll> X(N);
    rep(i, N) cin >> X[i];
    ll count = 0;
    for(ll i = 1; i < N; ++i) {
        ll diff = X[i] - X[i-1];
        if (diff * A > B) {
            count += B;
        } else {
            count += diff*A;
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 1024
N,L=map(int,input().split())
ls=[]
s=0
for i in range(1,N+1):
  s+=L+i-1
  v=abs(L+i-1)
  ls.append(v)
  x=min(ls)
  if L+i-1>=0:
    x=x
  else:x=-x
s=s-x
print(s)

Measured memory_bytes: 3060
// Ho-kago Tea Time

#include <bits/stdc++.h>

using namespace std;

#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define fst first
#define snd second
#define SZ(u) ((int) (u).size())
#define ALL(u) (u).begin(), (u).end()

inline void proc_status()
{
	ifstream t("/proc/self/status");
	cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>()) << endl;
}

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline T read()
{
	register T sum(0), fg(1);
	register char ch(getchar());
	for(; !isdigit(ch); ch = getchar()) if(ch == '-') fg = -1;
	for(;  isdigit(ch); ch = getchar()) sum = sum * 10 - '0' + ch;
	return sum * fg;
}

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

const int MAXN = (int) 5e5;

int n, D;

int d[MAXN + 5];

inline void input()
{
	n = read<int>(), D = read<int>();
	for(int i = 1; i <= n; ++i) d[i] = read<int>();
}

inline void solve()
{
	static int pre[MAXN + 5];

	pre[0] = D;
	for(int i = 1; i <= n; ++i) pre[i] = min(pre[i - 1], abs(pre[i - 1] - d[i]));

	static int g[MAXN + 5];

	g[n + 1] = 1;
	for(int i = n; i >= 1; --i)
	{
		if(g[i + 1] <= d[i] / 2) g[i] = g[i + 1];
		else g[i] = d[i] + g[i + 1];
	}

	for(int Q = read<int>(); Q--; )
	{
		int p = read<int>();
		puts(g[p + 1] <= pre[p - 1] ? "YES" : "NO");
	}
}

int main()
{
#ifdef K_ON // K-ON!
	freopen("E.in", "r", stdin);
	freopen("E.out", "w", stdout);
#endif

	input();
	solve();

	return 0;
}



Measured memory_bytes: 7808
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  string S;
  cin >> S;
  VEC<string> m =   {"SAT", "FRI", "THU", "WED", "TUE", "MON", "SUN"};
  REP(i, 0, m.size()) {
    if (m[i] == S) {
      cout << i + 1 << endl;
      break;
    }
  }

  return 0;
}


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

void rotate(char S1[101]);
int countstring(char S[101]);
int main(void){
    //S1,Tを読み込み
    char S1[101];
    char T[101];
    scanf("%s",S1);
    scanf("%s",T);

    //S1の文字数をカウントする：n
    int n;
    n = countstring(S1);
    
    //初期Ｓ１とＴを比較する
    int judge = 0;
    if(strncmp(S1,T,n)==0){
        judge = 1;
    }
    //rotateしたＳ１とＴとを比較する作業をn-1回繰り返す
        //Ｓ１とＴとが合致してたらjudgeをインクリメントする
    int i;
    for(i = 0;i < n-1;i++){
        
        rotate(S1);
        if(strncmp(S1,T,n)==0){
            judge = 1;
            break;
        }
    }
    
    switch(judge){
        case 0:printf("No"); break;
        case 1:printf("Yes"); break;
    }

    return 0;
}
int countstring(char S[101]){
    //ポインタp1をＳ１先頭に配置
    char *p1;
    p1 = S;
    int n = 0;
    //ppをＳ１末尾まで走査し、文字数をカウントする
    while(*p1 != '\0'){
        n++;
        p1 = p1 + 1;
    }
    return n;
}
void rotate(char S1[101]){
    //ポインタp１がn,1,2,...,n-1文字目の順番に走査し、それをポインタp2にコピーする
    //copy用配列を用意しておく
    int count = 0;
    char copy[101];
    char *p1; 
    char *p2;

    //p1をＳ１先頭に配置する
    p1 = S1;
    //Ｓ１の文字数をカウントする：count
    while(*p1 != '\0'){
        count++;
        p1 = p1 + 1;
    }
    p1 = S1 + (count - 1);
    //p1を末尾に配置、p2をcopy先頭に配置
    p2 = copy;
    //p1をp2にコピーする
    *p2 = *p1;
    p2 = p2 + 1;
    //p1を先頭に戻し、count-1文字目までシフトしながらコピー
    p1 = S1;
    int i;
    for(i = 1;i <= (count - 1);i++){
        *p2 = *p1;
        p2 = p2 + 1;
        p1 = p1 + 1;
    }
    //S2をS1に代入する
    for(i = 0;i < count;i++){
        S1[i] = copy[i];
    }

}

Measured memory_bytes: 128
import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) {

		Main ans = new Main();
		System.out.println(ans.solve());
		
	}

	private int solve() {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();

		int []array = new int[N+1];
		for(int i=1;i<=N;i++){
			array[i] = sc.nextInt();
		}

		int [] dp = new int[N+1];

		dp[1] =0;

		for(int i=2;i<=N;i++){
			dp[i] = Integer.MAX_VALUE;
			for(int j=i-1;j>=1 && i-j<=K;j--) {
				dp[i] = Math.min(dp[i], Math.abs(array[i]-array[j])+dp[j]);
			}
		} 

		return dp[N];
		 
	}


}

Measured memory_bytes: 59428
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<n+1;i++)
typedef long long ll;
typedef vector<int> vec;
#define INF ((1LL<<62)-(1LL<<31))
#define mod 1000000007

ll dp[1005][1005]={};

int main(){
  ll h,w; cin>>h>>w;
  char map[1005][1005];
  rep1(i,h)rep1(j,w) cin>>map[i][j];
  
  dp[1][1]=1;
  rep1(i,h)rep1(j,w)if(!(i==1&&j==1)){
    if(map[i][j]=='#') dp[i][j]=0;
    else dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
  }  
  cout<<dp[h][w]<<endl;
}

Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) for(auto&& x : v){cout << x << " ";} cout << endl
#define printVV(vv) for(auto&& v : vv){for(auto&& x : v){cout << x << " ";}cout << endl;}
#define printP(p) cout << p.first << " " << p.second << endl
#define printVP(vp) for(auto&& p : vp) printP(p);

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<Pii> vp;
const int inf = 1e9;
const int mod = 1e9 + 7;

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

    string s;
    cin >> s;
    int n = s.size();
    int t = n / 2 + (n % 2);
    int ans = 0;
    rep(i, t) {
        if (s[i] == 'p') ans--;
    }
    rep2(i, t, n) {
        if (s[i] == 'g') ans++;
    }
    cout << ans << endl;

}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    if(s == "SUN") cout << 7;
    else if(s == "MON") cout << 6;
    else if(s == "TUE") cout << 5;
    else if(s == "WED") cout << 4;
    else if(s == "THU") cout << 3;
    else if(s == "FRI") cout << 2;
    else if(s == "SAT") cout << 1;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(0); cin.tie(); cout.tie();

#define MAXX 500005
#define PI 3.14159265358979323846264338327950
#define F first
#define S second
#define ll  long long int
#define mod  1000000007



int main()
{
	FAST;
	ll a, b;
	cin >> a >> b;
	a += (b/2);
	cout << a;
	
}

Measured memory_bytes: 3652
#include <stdio.h>
#include <string>
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;

int main(void){
    int a,b,c;
    cin >> a >> b >> c;
    if(a>=b && a>=c)a=b+c;
    else if(b>=a && b>=c)a=a+c;
    else a=a+b;
    cout << a << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,b,a) for(int i=b;i>=a;i--)
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Forenska(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-x))
#define GREATER(x) x,vector<x>,greater<x>
#define randIn(L,R) (((LL)rand()*rand())%(R-L)+L)
#define __lcm(a,b) ((a)/__gcd(a,b)*(b))
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pLL;
typedef vector<int> vec;
typedef vector<LL> vecL;
typedef vector<pii> vecP;
typedef vector<pLL> vecPL;
typedef vector<string> vecS;
typedef vector<vec> mat;
typedef complex<double> point;
const long double PI=3.14159265358979323846264338327950288419716939937510582097;
const LL INFLL=0x3f3f3f3f3f3f3f3f;
const int INF=0x3f3f3f3f;
const long double EPS=1e-10;
int read()
{
    int x=0;
    char ch=' ';
    bool flag=false;
    while(ch<'0' || ch>'9')
    {
        if(ch=='-')flag=true;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
    {
        x=(x<<3)+(x<<1)+ch-'0';
        ch=getchar();
    }
    return flag?-x:x;
}
vec work(string str)
{
	vec res(26);
	rep(i,0,str.size())
	{
		res[str[i]-'a']++;
	}
	sort(all(res));
	return res;
}
int main()
{
	string s,t;
	cin>>s>>t;
	puts(work(s)==work(t)?"Yes":"No");
	return 0;
}



Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std; 
    
int main() {
  int N;
  cin>>N;
  bool ok=true ;
  int c;
  for(int i=0;i<N;i++){
    cin>>c;
    if(c%2==0&& !(c%3==0 ||c%5==0 )){
      ok= false;
    }
  }
  if(ok){
   cout<<"APPROVED"<<endl;
  }
  else{cout<<"DENIED"<<endl;}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();


		int Ans = 0;
		if(S%2 == 0) {
			--S;
		}

		for (int i = 1; i <= S; i += 2) {
			int divisorCount = 0;
			for (int j = 1; j <= i; j++) {
				if(i % j == 0) {
					++divisorCount;
				}
			}
			if(divisorCount == 8) {
				++Ans;
			}
		}

		System.out.println(Ans);
		//全部の数字で割り切れるか確かめる　割り切れたらCount＋＋する
		//iの約数が8個あるのかカウントする
	}

}



Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define IN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long ll;
//////////////////////////////////////////////////////
int count(int n){
	if (n % 100 == 0){
		return (1 + count(n/100));
	}else{
		return 0;
	}
}

int main(){
	int D,N; SCD2(D,N);
	int c = 0;
	int now = 1;
	while(c<N){
		if (count(now) == D){
			c++;
		}
		now++;
	}
	
	PRINTD(now-1);
	
	return 0;
}



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

int main(){
	// sengen
	int n;
	// nyuryoku
	cin >> n;
	// keisan
	if(n == 1){
		cout << "Hello World" << endl;
	}else{
		int a,b;
		cin >> a >> b;
		cout << a + b << endl;
	}
	// syutsuryoku
}

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

int main() {
    string s,t;cin >> s >> t;
    int n=s.size(),m=t.size();
    int ans=1001;
    for(int i = 0; i < n-m+1; i++) {
        int diff=0;
        for(int j = 0; j < m; j++) {
            if(s[i+j]!=t[j]) diff++;
        }
        ans = min(ans,diff);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

using namespace std;

int main(){
	int n;
	cin >> n;
	static int t[110000];
	static int x[110000];
	static int y[110000];

	t[0] = x[0] = y[0] = 0;

	for (int i = 1; i <= n; i++) {
		cin >> t[i] >> x[i] >> y[i];
	}
	bool can = true;
	for (int i = 0; i < n; i++) {
		int dt = t[i + 1] - t[i];
		int dist = abs(x[i] - x[i + 1])+ abs(y[i] - y[i + 1]);
		if (dist > dt)
			can = false;
		else if (dist % 2 != dt % 2)
			can = false;
 	}
	if (can)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

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



int main() {
  ll n;
  cin>>n;
  vector<ll> w(n);
  vector<ll> s(n);
  vector<ll> v(n);
  vector<P> p(n);
  vector<ll> W(n);
  vector<ll> V(n);

  rep(i,n){
    ll w1,s1,v1;
    cin>>w1>>s1>>v1;
    w[i]=w1;
    v[i]=v1;
    s[i]=s1;
    p[i]=make_pair(s[i]+w[i],i);
  //  cout<<p[i].first<<" "<<p[i].second<<endl;
  }
  sort(p.begin(),p.end());

  ll dp[n+5][20005];
  rep(i,n+5)rep(j,20005)dp[i][j]=0;
  //iばんめまでエラんだとき重さwfの価値の最大
  rep(i,n){

    ll idx=p[i].second;
  //  cout<<"idx"<<idx<<endl;
    ll wnow=w[idx];
    ll snow=s[idx];
    ll vnow=v[idx];
    rep(j,20005){

      dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
      //if (j+wnow>10005)continue;
      if (j<=snow)dp[i+1][j+wnow]=max(dp[i+1][j+wnow],dp[i][j]+vnow);
    //  cout<<"j"<<j+wnow<<" "<<dp[i+1][j+wnow]<<endl;
    }
  }
  ll ans=0;
  rep(i,20005){
    ans=max(ans,dp[n][i]);
  }

cout<<ans;
}


Measured memory_bytes: 160692
#include <iostream>
#include <numeric>
#include <string>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <utility>

#define repd(i,a,b); for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define ll long long int
 
 
using namespace std;
int main() {
 int n; cin >> n;
 vector<int> a;
 
  for(int i=0;;i++){
   if ((abs(n/((int)pow(-2,i)))%2) == 1){
     a.insert(a.begin()+i,1);
     n = n-(int)pow(-2,i);
   } else {
     a.insert(a.begin()+i,0);
   }
   if(n == 0){
     rep(j,(int)a.size()){
       cout << a[(int)a.size()-j-1];
     }
     exit(0);
   }
  }
  
    
 

  

   
     
 return 0;
}

Measured memory_bytes: 256
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
using ll = long long;
using VL=vector<ll>;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
const long long INF =  999999999;

ll N,K,a[100010],num[100010],cnt=0;
//num[i]は見ている部分列の(i+1)の個数
//a[i]は一個マイナスして0~K-1だけみる
bool flag;


int main(){
  cin>>N>>K;
  REP(i,N){
    cin >>a[i];
    a[i]--;
  }

  ll ans=N+1;
  fill(num,num+N+1,0);
  ll i=0,j=0;
  //[j,i)
  while(true){
    while(cnt <K && i<N){
      if(a[i]<K && a[i]>=0){
        if(num[a[i]]==0)cnt++;
        num[a[i]]++;
      }
      i++;
    }

    while(cnt>=K && j<N){
      ans=min(ans,i-j);
      if(a[j]<K && a[j]>=0){
        if(num[a[j]]-1==0)cnt--;
        num[a[j]]--;
      }
      j++;
    }
    if(i==N)break;
  }

  if(ans==N+1)cout <<0<<endl;
  else cout <<ans<<endl;
}



Measured memory_bytes: 4624
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <vector>
#include <bitset>
#include <queue>
using namespace std;

bool c(string s, int len){
    if(len % 2 != 0){
        return false;
    }
    for(int i = 0; i < len/2;i++){
        if(s[i] != s[i+len/2]){
            return false;
        }
    }
    return true;
}
int main(){
    string s;
    cin >> s;
    for(int i = 1; i < s.length(); i++){
        if(c(s, s.length()-i)){
            cout << s.length()-i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
import pprint
sys.setrecursionlimit(10 ** 9)


INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


n = S()
dp = [[0] * 2 for _ in range(len(n))]
dp[0] = [int(n[-1]), 11 - int(n[-1])]
for i in range(1, len(n)):
    s = int(n[-i-1])
    dp[i][0] = s + min(dp[i - 1][0], dp[i - 1][1])
    dp[i][1] = min(11 - s + dp[i - 1][0], 9 - s + dp[i - 1][1])


print(min(dp[-1]))


Measured memory_bytes: 135496