akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{

	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line[] = br.readLine().split(" ");
		int a = Integer.parseInt(line[0]);
		int b = Integer.parseInt(line[1]);

		System.out.println((a - 1) * (b - 1));

	}

}

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

int main()
{
    long long n;
    while (cin >> n)
    {
        long long ans = 0;
        if (n < 3)
            cout << 0 << endl;
        else
        {

            for (long long i = 1; i * i <= n; i++)
            {
                if (n % i == 0)
                {
                    if (i != n / i && i + 1 != n / i) ans += n / i - 1;
                }
            }
            cout << ans << endl;
        }
    }
}

Measured memory_bytes: 256
n = gets.to_i
l = gets.split.map(&:to_i)
count = 0

0.upto(n - 3) do |i|
  (i + 1).upto(n - 2) do |j|
    (j + 1).upto(n - 1) do |k|
      if l[i] != l[j] && l[j] != l[k] && l[k] != l[i] && l[i] + l[j] > l[k] && l[j] + l[k] > l[i] && l[i] + l[k] > l[j]
        count += 1
      end
    end
  end
end

puts count

Measured memory_bytes: 14312
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = (0); i < (n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)
#define DEBUG(val) cout << #val << " : " << val << endl
#define MOD 1000000007

using Graph = vector<vector<int>>;
vector<bool> seen;
map<int, ll> k_dists;
map<pair<int, int>, ll> dists;

void dfs(const Graph &G, int v, ll dist) {
  seen[v] = true;  // v を訪問済にする
  // v から行ける各頂点 next_v について
  for (auto next_v : G[v]) {
    if (seen[next_v]) continue;  // next_v が探索済だったらスルー
    k_dists[next_v] = dist + dists[make_pair(v, next_v)];
    dfs(G, next_v, dist + dists[make_pair(v, next_v)]);  // 再帰的に探索
  }
}
int main() {
  int n;
  cin >> n;
  Graph G(n);
  REP(i, n - 1) {
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    dists[make_pair(a, b)] = c;
    dists[make_pair(b, a)] = c;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  int q, k;
  cin >> q >> k;
  k--;

  seen.assign(n + 1, false);
  dfs(G, k, 0);

  REP(i, q) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    cout << k_dists[x] + k_dists[y] << endl;
  }
}

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

using ll=int64_t;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#define REACH cerr<<"reached line "<<__LINE__<<endl
#define DMP(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define ZERO(x) memset(x,0,sizeof(x))

using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"[";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"]";
	return os;
}

int read(){
	int i;
	scanf("%" SCNd64,&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(int x,int suc=1){
	printf("%" PRId64,x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341919];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341919];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

template<class T,class U>
void chmax(T& a,U b){
	if(a<b)
		a=b;
}

template<class T,class U>
void chmin(T& a,U b){
	if(a>b)
		a=b;
}

template<class T>
T Sq(const T& t){
	return t*t;
}

const int inf=LLONG_MAX/3;

const int Nmax=114514;
vi tr[Nmax];
pi dfs(int v,int p,int b){
	multiset<int> lens;
	int cnt=0;
	for(auto ch:tr[v])if(ch!=p){
		pi w=dfs(ch,v,b);
		cnt+=w.first;
		lens.insert(w.second);
	}
	int rems=0,mn=inf;
	while(!lens.empty()){
		auto itr=lens.end();itr--;
		int x=*itr;lens.erase(itr);
		itr=lens.upper_bound(b-x);
		if(itr==lens.begin()){
			rems++;
			chmin(mn,x);
		}else{
			itr--;
			lens.erase(itr);
			cnt++;
		}
	}
	if(mn==b){
		rems++;
		mn=0;
	}
	if(rems)
		cnt+=rems-1;
	else
		mn=0;
	return pi(cnt,mn+1);
}

signed main(){
	int n=read();
	REP(i,n-1){
		int a=read()-1,b=read()-1;
		tr[a].PB(b);
		tr[b].PB(a);
	}
	int par;
	REP(i,n)if(tr[i].size()==1)par=i;
	int root=tr[par][0];
	int a=dfs(root,par,inf).first+1;
	int bot=0,up=n;
	while(up-bot>1){
		int mid=(up+bot)/2;
		pi w=dfs(root,par,mid);
		if(w.first==a-1)
			up=mid;
		else
			bot=mid;
	}
	cout<<a<<" "<<up<<endl;
}

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

// syntax sugar: `for (int i = 0; i < N; ++i)`
#define rep(i, N) for (int i = 0; i < (int)(N); ++i)
// syntax sugar: `for (int i = 0; i < N; ++i)`
#define REP(type, name, beginValue, endCondValue) \
  for (type name = beginValue; name < endCondValue; ++name)
// syntax sugar: 多次元vector
#define VECTOR_DIM3(T, name, d1, d2, d3, initValue) \
    std::vector<std::vector<std::vector<T>>> name(d1, std::vector<std::vector<T>>(d2, std::vector<int>(d3, initValue)));
#define VECTOR_DIM2(T, name, d1, d2, initValue) \
    std::vector<std::vector<T>> name(d1, std::vector<T>(d2, initValue));
#define VECTOR_DIM1(T, name, d1, initValue) \
    std::vector<T> name(d1, initValue);
#define ll long long
#define ld long double


// ABC079C - Train Ticket
int main(){
  int n;
  cin >> n;
  int a = n / 1000;
  int b = (n - a * 1000) / 100;
  int c = (n - a * 1000 - b * 100) / 10;
  int d = n % 10;
  for (int i = 0; i < 8; ++i) {
    int total = a;
    if ((i & 0b100) > 0) {
      total += b;
    } else {
      total -= b;
    }
    if ((i & 0b010) > 0) {
      total += c;
    } else {
      total -= c;
    }
    if ((i & 0b001) > 0) {
      total += d;
    } else {
      total -= d;
    }
    if (total == 7) {
      cout << a;
      cout << (((i & 0b100) > 0) ? "+" : "-");
      cout << b;
      cout << (((i & 0b010) > 0) ? "+" : "-");
      cout << c;
      cout << (((i & 0b001) > 0) ? "+" : "-");
      cout << d << "=7" << endl;
      return 0;
    }
  }
  return 0;
}



Measured memory_bytes: 256
//To include everything you need
#include <bits/stdc++.h>
using namespace std;
typedef std::vector<int>  vi;
typedef std::vector<std::pair<int,int> > vpi;
typedef std::vector<string>  vs;
typedef std::vector<char>  vc;


int main(){

    long  n;
    int triangles = 0;
    cin>>n;
    vector<int> stickLength(n);

    for(int i = 0;i < n;i++){
        int stick;
        cin>>stick;
        stickLength[i] = stick;
    }

    std::sort(stickLength.begin(),stickLength.end(),std::greater<int>());
    for(int i =0;i<n-2; i++){
        for(int j=i+1;j<n-1;j++){
            for(int k =j+1;k<n;k++){
            int stick1 = stickLength[i];
            int stick2 = stickLength[j];
            int stick3 = stickLength[k];
            if(stick1<stick2 + stick3)
                triangles++;
            else
                break;
            }    
        }
    }
    cout<<triangles;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int r, g, b;

int main(){
	scanf("%d %d %d", &r, &g, &b);
	int sum = r*100+g*10+b;
	if(sum%4==0)
		printf("YES");
	else 
		printf("NO");
	return 0;
	
	
}

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

using namespace std;


void solve() {
    int N; cin >> N;

    map<string, int> mp;
    for (int i = 0; i < N; i++) {
        string s; cin >> s;
        mp[s]++;
    }

    vector<pair<int, string>> v;
    for (auto iter = mp.begin(); iter != mp.end(); iter++) {
        v.push_back(make_pair(iter->second, iter->first));
    }
    sort(v.begin(), v.end(), greater<pair<int, string>>());

    int ma = v[0].first;
    vector<string> ans;
    for (auto e : v) {
        if (e.first == ma) ans.push_back(e.second);
    }

    sort(ans.begin(), ans.end());
    for (auto e : ans) {
        cout << e << endl;
    }
}


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

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

int main()
{
    int n;
    cin >> n;
    for (int i = 3; i <= n; ++i)
    {
        if(i%3==0 || to_string(i).find("3")!=string::npos){
            cout << " " << i;
        }
    }
    cout << "\n";
}


Measured memory_bytes: 3248
#define _CRT_SECURE_NO_WARNINGS
//#define _USE_MATH_DEFINES
#include<stdio.h>
//#include<stdlib.h>
//#include<math.h>
#include<string.h>
#define P(type,x) fprintf(stdout,"%"#type"\n",x)
int main() {
	char s[10000], *p;
	int c;
	while (fgets(s, sizeof(s), stdin)) {
		s[strlen(s) - 1] = '\0';
		if (strcmp(s, "END OF INPUT") == 0) break;
		p = s;
		c = 0;
		while (*p) {
			if (*p == ' ') fprintf(stdout, "%d", c), c = 0;
			else c++;
			p++;
		}
		P(d, c);
	}
	return 0;
}

Measured memory_bytes: 520
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>
#include<tuple>
#include<stack>


using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef tuple<int, int, int> tpl;
int dx[4] = { 1,0,0,-1 };
int dy[4] = { 0,1,-1,0 };

#define ARRAY_MAX 1500

const int INF = 1 << 30;
const int MOD = 1e9 + 7;

template<typename T>
T histArea(vector<T>& h) {

	T N = h.size();
	h.push_back(0);
	N++;

	T ans = 0;
	stack<pii> st;

	for (T i = 0; i < N; i++)
	{
		if (st.empty())
		{
			//スタックが空の場合は長方形を追加
			st.push(pii(h[i], i));
		}
		else if (st.top().first < h[i])
		{
			//今見ている長方形がスタックの頂点の長方形の高さより高い場合はスタックに追加
			st.push(pii(h[i], i));
		}
		else if (st.top().first > h[i])
		{
			//今見ている長方形がスタックの頂点の長方形の高さより低い場合はスタックから取り出す作業を行う
			int lastpos = 0;

			while (!st.empty() && st.top().first >= h[i]) {
				//スタックが空でなく、スタックの頂点にある長方形の高さが今見ている長方形の高さ以上
				//の場合はスタックから長方形を取り出してその都度面積を計算して最大値を更新する
				lastpos = st.top().second;
				ans = max(ans, st.top().first * (i - lastpos));
				st.pop();
			}
			//取り出す作業が終わったら今見ている長方形をスタックに追加する
			//追加位置は最後に取り出した長方形の位置
			st.push(pii(h[i], lastpos));
		}
	}
	return ans;
}

template<typename T>
T maxRectangle(vector< vector<T> >& board) {
	T H = board.size(), W = board[0].size();
	vector< vector<T> > dp(H, vector<T>(W, 0));

	T ret = 0;
	for (int i = 0; i < H; i++)
	{
		for (int j = 0; j < W; j++)
		{
			if (board[i][j] == 1) continue;
			if (i > 0)
			{
				dp[i][j] = dp[i - 1][j] + 1;//縦の長さを保持
			}
			else
			{
				dp[i][j] = 1;
			}
		}
	}

	for (int i = 0; i < H; i++)
	{
		ret = max(ret, histArea(dp[i]));
	}
	return ret;
}


int main() {

	int h, w;
	cin >> h >> w;
	vector<vector<int> > mp(h, vector<int>(w, 0));
	for (int i = 0; i < h; i++)
	{
		for (int j = 0; j < w; j++)
		{
			cin >> mp[i][j];
		}
	}

	cout << maxRectangle(mp) << endl;
}


Measured memory_bytes: 25052
#include <bits/stdc++.h>
#define pb(x)                    push_back(x)
#define all(a)                   a.begin(), a.end()
#define dbg(a)                   cout<< #a <<" --> "<<(a)<<endl;
#define IO                       ios::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define read                     freopen("tst.txt","r",stdin)
#define write                    freopen("out.txt","w",stdout)
typedef long long ll;
using namespace std;






main(){
//read;
IO;

int n,k,ans = 0;
cin>>n>>k;
for(int i = 0; i<n; i++){
    int x;
    cin>>x;
    if(x>=k)    ans++;
}
cout<<ans;


return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int hairetu(int x[],int a);
int main(void)
{
  int n,i,j,tmp,sum;
  int a[100];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  /*
  for(i=0;i<n;i++){
    for(j=i;j<n;j++){
      if(a[i]<a[j]){
        tmp=0;
        tmp=a[i];
        a[i]=a[j];
        a[j]=tmp;
      }
    }
  }
  */
  hairetu(a,n);
  for(i=0;i<n;i++){
    if(i%2==0){
      sum+=a[i];
    }else{
      sum-=a[i];
    }
  }
  printf("%d\n",sum);
  return 0;
}
int hairetu(int x[],int a)
{
  int i,j,tmp;
  for(i=0;i<a;i++){
    for(j=i;j<a;j++){
      if(x[i]<x[j]){
        tmp=0;
        tmp=x[i];
        x[i]=x[j];
        x[j]=tmp;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 128
def solve(N, W, weightValues):
    dp = [0] * (W + 1)
    s = 0
    for w, v in weightValues:
        s += w
        for j in range(min(W, s), w - 1, -1):
            if dp[j - w] + v > dp[j]:
                dp[j] = dp[j - w] + v

    print(max(dp))


N, W = map(int, input().split())
weightValues = sorted([list(map(int, input().split())) for i in range(N)])
solve(N, W, weightValues)

Measured memory_bytes: 7736
#include <bits/stdc++.h>
using namespace std;
int main() {
  int X;
  cin >> X;
  long A, B;
  long fA, fB;
  for (A = -150; A < 150; A++) {
    fA = A*A*A*A*A;
    for (B = -150; B < 150; B++) {
      fB = B*B*B*B*B;
      if (fA - fB == X) {
        break;
      }
    }
    if (fA - fB == X) {
      break;
    }
  }
  cout << A << ' '<< B << endl;
  return 0;
}


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

#define bitGet(a, i) a & (1 << i)
#define bitOn(a, i) a != (1 << i)
#define bitOff(a, i) a &= ~(1 << i)
#define bitMake(a, i) a = (1 << N)
#define fto(i, a, b) for(int i = a; i <= b; ++i)
#define fdto(i, a, b) for(int i = a; i >= b; --i)
#define ull unsigned long long
#define ll long long
#define ld long double
#define pri(a) cout << a << " "
#define pril(a) cout << a << " "
#define pb push_back
#define mp make_pair
#define vi vector<int> 
#define pi pair<int, int>
#define sz(a) (int)(a.size()-1)
#define oo INT_MAX
#define maxN 200005

using namespace std;


int n, m, nfre[maxN], cnt;
map<int, bool> dd[maxN];
vi ke[maxN];

void dfs(int u) {
    nfre[u] = 1;

    fto(i, 0, sz(ke[u])) {
        int v = ke[u][i];
        if(!nfre[v]) {
            ++cnt;
            dfs(v);
        }
    }
}

int main() {
    #ifndef ONLINE_JUDGE
        freopen("test.inp", "r", stdin);
        freopen("test.out", "w", stdout);
    #endif // !ONLINE_JUDGE

    cin >> n >> m;

    fto(i, 1, m) {
        int u, v;
        cin >> u >> v;
        if(!dd[u][v]) {
            ke[u].pb(v);
            ke[v].pb(u);
            dd[u][v] = 1;
            dd[v][u] = 1;
        }
    }

    int rs = 0;
    fto(i, 1, n) {
        if(!nfre[i]) {
            cnt = 1;
            dfs(i);
            rs = max(rs, cnt);
        }
    }

    pril(rs);
    
    return 0;
}


Measured memory_bytes: 49608
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,an;
  cin >> n;
  vector<int> a(n,0);
  for(int i = 0;i < n - 1;i++){
    cin >> an;
    a[an - 1]++;

  }
  for(int i = 0;i < n;i++){
    cout << a[i] << endl;
  }
}

Measured memory_bytes: 4052
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


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

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, Q, l, r, a[111111] = {0}, acc[111111];

  std::string s;

  std::cin >> N >> Q >> s;

  for (int i = 0; i < N - 1; i ++)
    if (s[i] == 'A' && s[i + 1] == 'C')
      a[i] = 1;

  acc[0] = 0;

  for (int i = 0; i < N; i ++)
    acc[i + 1] = a[i] + acc[i];

  for (int i = 0; i < Q; i ++) {
    std::cin >> l >> r;

    if (a[r - 1]) {
      std::cout << acc[r] - acc[l - 1] - 1 << std::endl;
    }
    else {
      std::cout << acc[r] - acc[l - 1] << std::endl;
    }
  }
  
  return 0;
}


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


int main() {
  
  int val[1000];
  
  
  string s;
  
  cin >> s;
  
  val[ s.length() ] = 0;
  for ( int i = s.length() - 1 ; i >= 0 ; i-- )
    val[i] = val[i+1] + s[i] - '0';
  
  
  int ans = val[0];
  int pre = 0;
  for ( int i = 0 ; i < s.length() ; i++ ) {
    
    if ( s[i] > '0' ) {
      int cur = pre + s[i] - '0' - 1 + ( s.length() - i - 1 ) * 9;
    
      if ( cur > ans )
        ans = cur;
    }
    pre += s[i] - '0';
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main (){
    string s;
    int left, right;
    cin >> s;
    left = s[0] * 10 + s[1]-528;
    right = s[2] * 10 + s[3]-528;
    if ((left > 12 || left == 0) && (right > 12 || right == 0))
        cout << "NA" << endl;
    else if ((left > 12 && 0 < right <= 12) || (left == 0 && right <= 12))
        cout << "YYMM" << endl;
    else if ((0 < left <= 12 && right > 12) || (left <= 12 && right == 0))
        cout << "MMYY" << endl;
    else
        cout << "AMBIGUOUS" << endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#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++)
#define all(v) v.begin(), v.end()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)

int main(){
  int N, T, A;
  cin >> N >> T >> A;
  vector<int> H(N);
  rep(i, N){
    cin >> H.at(i);
  }
  double diff = abs(T - H.at(0) * 0.006 - A);
  int p = 0;
  rep(i, N){
    if(diff > abs(T - H.at(i) * 0.006 - A)){
      chmin(diff, abs(T - H.at(i) * 0.006 - A));
      p = i;
    }
  }
  cout << p+1 << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
using namespace std;
int main(void){
  int x,y,z,t;
  scanf("%d%d%d",&x,&y,&z);
  printf("%d\n",(t=floor((x-z)/(y+z)))>0?t:0);
  return 0;
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    string in;
    cin >> in;
    deque<char> s;
    rep(i, in.size()) s.push_back(in[i]);
    bool flip = false;
    int q;
    cin >> q;
    rep(i, q) {
        int t;
        cin >> t;
        if (t == 1) {
            flip = !flip;
        }
        else {
            int f;
            char c;
            cin >> f >> c;
            if (flip) f = 3 - f;
            if (f == 1) s.push_front(c);
            else s.push_back(c);
        }
    }
    if (flip) reverse(all(s));
    string ans;
    rep(i, s.size()) {
        ans += s[i];
    }
    cout << ans << endl;
    return 0;
}


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

int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    
    for(int i = 0; i < n; i++){
        cin>> h[i];
    }
    
    const int INF = 1e9+5;
    vector<int> dp(n+1, INF);
    
    dp[0] = 0;
    for(int i = 0; i < n; i++){
        for(int j : {i+1, i+2}){
            if(j < n){
                dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
            }
        }
    }
    cout << dp[n-1];
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <stack>
using namespace std;

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if((a-c)*(c-b)>0)cout<<"Yes\n";
  else cout<<"No\n";
  return 0;
}


Measured memory_bytes: 256
readline = open(0).readline
writelines = open(1, 'w').writelines
s = set()
def insert(x):
    s.add(x)
    ans.append("%d\n" % len(s))
def find(x):
    ans.append("%d\n" % (x in s))
 
C = [insert, find, s.discard].__getitem__
Q = int(readline())
ans = []
for _ in range(Q):
    t, x = map(int, readline().split())
    C(t)(x)
writelines(ans)


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

int main(int argc, char const *argv[])
{
    string S;
    cin >> S;
    char a = S[0];
    char b = 'a';
    for(int i = 0; i < S.size(); i++) {
        if(S[i] != a) {
            b = S[i];
        }
    }
    if(b == 'a') {
        cout << "No" << endl;
        return 0;
    }
    int num_a = count(S.begin(), S.end(), a);
    int num_b = count(S.begin(), S.end(), b);
    if(num_a == 2 && num_b == 2) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import collections

def calc_sum(c):
    sum_val = 0
    for key, val in c.items():
        sum_val += key * val
    return sum_val

N = int(input())
arr = list(map(int, input().split()))
Q = int(input())

actions = []

for i in range(Q):
    B, C = map(int, input().split())
    actions.append({'B':B, 'C':C})

c = collections.Counter(arr)
sum_val = calc_sum(c)

for i in range(Q):
    B = actions[i]['B']
    C = actions[i]['C']
    if B in c:
        c[C] += c[B]
        sum_val += c[B] * C - c[B] * B
        c.pop(B)

    print(sum_val)

Measured memory_bytes: 50144
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
#include <random>
#include <time.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
int main() {
	ll n, a[100010] = {}, ans = 0;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		ans += abs(a[i] - a[i - 1]);
	}
	ans += abs(a[n]);
	for (int i = 1; i <= n; i++) {
		ll num = ans;
		num += abs(a[i + 1] - a[i - 1]);
		num -= abs(a[i] - a[i - 1]) + abs(a[i] - a[i + 1]);
		cout << num << endl;
	}
	return 0;
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

ll ppow(ll a,ll b){
	ll res=1;
	while(b){
		if(b&1)res=(res*a)%MOD;
		a=(a*a)%MOD;
		b>>=1;
	}
	return res;
}
int a[600000],s[600000];
ll dp[2000000][2];
ll c2[2000000];

int main(){
	int n;cin>>n;
	rep(i,n){
		scanf("%d",&a[i]);
		s[i+1]=s[i]^a[i];
	}
	ll ans=0;
	if(s[n]==0){
		int cnt=0;
		for(int i=1;i<n;i++){
			if(s[i]==0)cnt++;
		}
		ans=ppow(2,cnt);
	}
	for(int i=1;i<(1<<20);i++){
		dp[i][1]=1;
	}
	ll c1=0;
	for(int i=1;i<n;i++){
		if(s[i]){
			(dp[s[i]][1]+=dp[s[i]][0]*(c1-c2[s[i]])%MOD)%=MOD;
			c2[s[i]]=c1;
			(dp[s[i]][0]+=dp[s[i]][1])%=MOD;
		}
		else c1++;
	}
	for(int i=1;i<(1<<20);i++){
		if(s[n]==0)(ans+=dp[i][0])%=MOD;
		else if(s[n]==i){
			(dp[i][1]+=dp[i][0]*(c1-c2[i])%MOD)%=MOD;
			(ans+=dp[i][1])%=MOD;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 35072
import math
def make_divisors(n):
    divisors = []
    for i in range(1, int(math.sqrt(n))+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
def main():
    N, K = map(int, input().split())
    mod = 10**9 + 7
    d = {}
    r = 0
    for i in range(K, 0, -1):
        l = make_divisors(i)
        x = K // i
        t = pow(x, N, mod)
        if i in d:
            t -= d[i]
        for j in l:
            if j not in d:
                d[j] = t
            else:
                d[j] += t
        r += t * i
        r %= mod
    return r % mod
print(main())


Measured memory_bytes: 19396
import java.util.Scanner;

public class Main {

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long h = sc.nextLong();
        long w = sc.nextLong();

        if(h == 1 || w == 1){
            System.out.println(1);
            System.exit(0);
        }

        System.out.println(Math.round((double)h*w/2));
    }
}

Measured memory_bytes: 22612
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <cassert>
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define RREP(i,n) for(int i=(n)-1; i>=0; --i)

using namespace std;
typedef long long int ll;

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    if (b == 1) return 1;
    T r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

bool comp(pair<int, int> a, pair<int, int> b) {
    return a.second > b.second;
}

struct UnionFind {
    vector<int> par;
    vector<int> rank;
    
    UnionFind(int n = 1) {
        init(n);
    }
    
    void init(int n = 1) {
        par.resize(n); rank.resize(n);
        for (int i = 0; i < n; ++i) {
            par[i] = i;
            rank[i] = 0;
        }
    }
    
    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        return true;
    }
};


int main(int argc, const char * argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N, M;
    cin >> N >> M;
    
    UnionFind uf(N);
    REP(i, M) {
        int X, Y, Z;
        cin >> X >> Y >> Z;
        uf.merge(X-1, Y-1);
    }
    set<int> r;
    REP(i, N) {
        r.insert(uf.root(i));
    }
    
    cout << r.size() << endl;
}


Measured memory_bytes: 5760
#include <stdio.h>
#include <string.h>
char a[100005];
int main()
{
	int n,m,i,j,k,s,t;
	while(~scanf("%d",&n))
	{
		scanf("%s",a);
		s=1;
		for(i=1;i<n;i++)
		if(a[i]!=a[i-1]) s++;
		printf("%d\n",s);
	}
	return 0;
}

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

#define _ cin.tie(0);ios::sync_with_stdio(false);
using namespace std;

#define rep(n) for(int i = 0; i < n; i++)
#define Sort(a) sort(a.begin(), a.end())
using LL = long long;
const int N = 100000 + 5;

LL tree[N];
LL Query(int pos){
    LL sum = 0;
    while(pos > 0){
        sum += tree[pos];
        pos -= (pos & -pos);
    }
    return sum;
}

void Add(int pos,LL num){
    while(pos <= N){
        tree[pos] += num;
        pos += (pos & -pos);
    }
}
vector<LL> a, b, c;
int main(){ _
    LL  n, m;
    memset(tree, 0, sizeof(tree));
    cin >> n;
    rep(n) { cin >> m; a.push_back(m); }
    rep(n) { cin >> m; b.push_back(m); }
    rep(n) { cin >> m; c.push_back(m); }
    Sort(a), Sort(b), Sort(c);

    for(int i = 0; i < n; i++){
        auto tmp = lower_bound(a.begin(), a.end(), b[i]);
        int num = tmp - a.begin();
        Add(i + 1, num);

    }
    LL sum = 0;
    for(auto &i : c){
        auto tmp = lower_bound(b.begin(), b.end(), i);
        int cur = tmp - b.begin();
        LL num = Query(cur);
        sum += num;
    }
    /**
    LL sum = 0;
    rep(n){
        LL A = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
        LL B = n - (upper_bound(c.begin(), c.end(), b[i]) - c.begin());
        sum += (A * B);
    }*/
    cout << sum << endl;
}


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

#define ipair pair<int,int>
#define rep(i,n) for(i=0;i<n;i++)
#define repj(i,j,n) for(i=j;i<n;i++)

#define PB(a,i) (a).push_back(i)
#define ALL(a) (a).begin(),(a).end()
#define SIZE(a,n) (a).resize(n)
#define SORT(a) sort(ALL(a))
#define RSORT(a, type) sort(ALL(a),greater<type>())
#define MAPIN(a,i,j) (a).insert(make_pair(i,j))
#define PREC(n) setprecision(n)

#define OK(i) cout<<"OK "<<i<<endl
#define Yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define NO cout<<"NO"<<endl

#define M (pow(10,9)+7)

using namespace std;

typedef unsigned long long lli;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vi > Matrix;

int main() {
    vll a;
    ll n,i,j,ans;

    cin>>n;
    SIZE(a,n);

    rep(i,n){
        cin>>a[i];
    }

    ans=0;
    rep(i,60){
        ll one=0,ze=0,tmp;
        rep(j,n){
            if(a[j]>>i & 1)one++;
            else ze++;
        }
        tmp=one*ze;
        rep(j,i){
            tmp*=2;
            tmp%=(ll)(M);
        }
        ans+=tmp;
        ans%=(ll)(M);
    }
    cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 2560
# input
N = int(input())
X = list(map(int, input().split()))
X_sorted = sorted(X)

a1 = X_sorted[N // 2 - 1]
a2 = X_sorted[N // 2]

for i in range(N):
    if X[i] <= a1:
        print(a2)
    else:
        print(a1)

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

int n,m,k,minv,xx=1e9+7,yy=1e9+7;
int a[100005],b[100005];

struct node
{
	int x,y,c;
}t[100005];

signed main()
{
	cin>>n>>m>>k;
	for (int i=1;i<=n;i++)  cin>>a[i],xx=min(xx,a[i]);
	for (int i=1;i<=m;i++)  cin>>b[i],yy=min(yy,b[i]);
	for (int i=1;i<=k;i++)  cin>>t[i].x>>t[i].y>>t[i].c;

	minv=xx+yy;
	
	for (int i=1;i<=k;i++)  minv=min(minv,a[t[i].x]+b[t[i].y]-t[i].c);
	cout<<minv<<endl;
	
	return 0;
}

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

int main() {
  int x,a,b;
  cin>>x>>a>>b;
  if(b-a<=0)cout<<"delicious"<<endl;
  if(0<b-a&&b-a<=x)cout<<"safe"<<endl;
  if(x<b-a)cout<<"dangerous"<<endl;
}


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

int main()
{
    int a[9][4], k = 65;
    string str;

    for( int i = 0; i < 9; i++ )
    {
        a[i][0] = k - 3;
        a[i][1] = k + 1;
        a[i][2] = k + 3;
        a[i][3] = k - 1;
        k++;
    }
    a[2][1] = -1;
    a[3][3] = -1;
    a[5][1] = -1;
    a[6][3] = -1;

    for( int i = 0; i < 1000; i++ )
    {
        cin >> str;
        bool judge = true;
        for( int j = 0; j < str.size() - 1; j++ )
        {
            if( a[str[j]-65][0] == str[j+1] || a[str[j]-65][1] == str[j+1] || a[str[j]-65][2] == str[j+1] || a[str[j]-65][3] == str[j+1] );
            else
            {
                judge = false;
                break;
            }
        }
        if( judge )
            cout << str << endl;
    }

    return 0;
}


Measured memory_bytes: 3208
import sys

def input(): return sys.stdin.readline()[:-1]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def MATINT(h): return [list(map(int, input().split())) for _ in range(h)]
def MATSTR(h): return [input() for _ in range(h)]
sys.setrecursionlimit(10 ** 9)
inf = float('inf')
mod = 10 ** 9 + 7

N = INT()

keep = 1
for i in range(1, int(N**0.5)+1):
    if N % i == 0:
        keep = i
print(N//keep + keep - 2)


Measured memory_bytes: 40428
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
ll mod=1000000007;
using namespace std;


int main(){
	ll n;
	cin>>n;
	ll c=0;
	for(ll i=1;i<n;i++){
		for(ll j=1;j<n;j++){
			if(i*j<n){
				c++;
			}else{
				break;
			}
		}
	}

	cout<<c<<endl;
}

Measured memory_bytes: 3616
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long ll;

ll n, m;
ll a[100005];
ll cnt = 0;

int main()
{
    scanf("%lld%lld", &n, &m);
    for(ll i = 0; i < m * 2; i++)
    {
        ll t;
        scanf("%lld", &t);
        a[t] ^= 1;
        cnt += a[t] * 2 - 1;
    }
    if(cnt) printf("NO\n");
    else printf("YES");
    return 0;
}


Measured memory_bytes: 1024
/**********************************************************
* @Author: 			   .Sunbeam
* @Date:   			   2020-03-22 20:04:52
* @Last Modified by:   .Sunbeam
* @Last Modified time: 2020-03-22 20:05:22
* @Remark: 
**********************************************************/
#include <bits/stdc++.h>
#define lowbit(x) (x&(-x))
#define CSE(x,y) memset(x,y,sizeof(x))
#define INF 0x3f3f3f3f
#define Abs(x) (x>=0?x:(-x))
#define FAST ios::sync_with_stdio(false);cin.tie(0);
using namespace std;

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

const int maxn=1000;


int main()
{
	int n,m;
	cin>>n>>m;
	cout<<(n-1)*n/2+(m-1)*m/2<<endl;
	return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
ab=[[] for i in range(n)]
for i in range(n):
    a,b=map(int,input().split())
    ab[i].append(a)
    ab[i].append(b)

ab=sorted(ab)
ans=0
d=m

for i in range(n):
    if ab[i][1]<=d:
        ans+=ab[i][0]*ab[i][1]
        d-=ab[i][1]
    else:
        
        ans+=ab[i][0]*d
        
        break
print(ans)
        
        
    


Measured memory_bytes: 26720
import Data.Array
import Data.List

main = interact $ show . sol . get

get = fmap (fmap read . words) . lines

sol ([n,m]:scs) = if ss==nub ss && (n==1 || (1,0) `notElem` ps) then x else (-1)
  where
  ns = nub $ sort scs
  ps = (\[s,c] -> (s,c)) <$> ns
  ss = fst <$> ps
  ar = accumArray (+) 0 (1,n) $ if 1 `elem` ss 
    then ps 
    else (1,if n>1 then 1 else 0):ps
  x = foldl1 (\s c -> 10*s+c) $ elems ar

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

int main(){
  int N,K;
  cin>>N>>K;
  vector<double> vec(N+1);
  for(int i=1;i<N+1;i++){
    cin>>vec.at(i);
    vec.at(i)=(vec.at(i)+1)/2;
    vec.at(i)+=vec.at(i-1);
  }
  double tmp=vec.at(K)-vec.at(0);
  double ans=tmp;
  for(int i=0;i<N-K+1;i++){
  	tmp=vec.at(K+i)-vec.at(i);
    ans=max(ans,tmp);
  }
  cout<<fixed<<setprecision(15)<<ans<<endl;
}

Measured memory_bytes: 1792
/*
Be accepted!
  ∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define printyn(test) printf(test ? "Yes\n" : "No\n");
#define all(x) (x).begin(), (x).end()

using ll = long long;

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

using namespace std;


int main() {

	int r;
	scanf("%d", &r);
	if (r < 1200)printf("ABC\n");
	else if (r < 2800)printf("ARC\n");
	else printf("AGC\n");

	return 0;
}

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

constexpr ll DP_MAX = 1000000;
ll dp[DP_MAX];

int main(int argc, char **argv)
{
	ll n; cin >> n;
	memset(dp, 0, sizeof dp);
	dp[0] = dp[1] = 1;
	for (ll i = 2; i <= n; ++i)
		dp[i] = dp[i-1] + dp[i-2];
	std::cout << dp[n] << std::endl;
}



Measured memory_bytes: 10900
#include<stdio.h>
#include<string.h>
int main()
{
	char a[110];
	int f,i;
	int count;
	while(scanf("%s",&a)!=EOF)
	{
		count = 0;
		f=strlen(a);
		for(i=0;i<f;i++)
		{
			if(a[i]=='C')
			{
				count=1;
			}
			if(a[i]=='F'&&count==1)
			{
				count=2;
			}
		}
		if(count==2)
			printf("Yes\n");
		else
			printf("No\n");
	}
	return 0;
}


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

int main(){
	int n, a;
	cin >> n >> a;
	int r = 2*n-1;
	if(a == 1 || a == r){
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
	if(n == 2){
		cout << 1 << endl << 2 << endl << 3 << endl;
		return 0;
	}
	vector<int> b;
	if(a == 2){
		vector<int> oth;
		for(int j = 1; j <= a-2; j++) oth.push_back(j);
		for(int j = a+3; j <= r; j++) oth.push_back(j);
		for(int i = 0; i < n-2; i++){
			cout << oth[i] << endl;
		}
		cout << a+1 << endl << a << endl << a-1 << endl << a+2 << endl;
		for(int i = n-2; i < oth.size(); i++){
			cout << oth[i] << endl;
		}
	} else {
		vector<int> oth;
		for(int j = 1; j <= a-3; j++) oth.push_back(j);
		for(int j = a+2; j <= r; j++) oth.push_back(j);
		for(int i = 0; i < n-2; i++){
			cout << oth[i] << endl;
		}
		cout << a-1 << endl << a << endl << a+1 << endl << a-2 << endl;
		for(int i = n-2; i < oth.size(); i++){
			cout << oth[i] << endl;
		}
	}
}


Measured memory_bytes: 2420
//
//  main.cpp
//  A1
//
//  Created by 汪之涛 on 16/10/7.
//  Copyright © 2016年 汪之涛. All rights reserved.
//

#include <iostream>
#include <string>
using namespace std;

int main()
{
    string str, ans;
    while(cin>>str)
    {
        cout<<str.substr(0, 4)<<" "<<str.substr(4)<<endl;
    }
    return 0;
}


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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

bool IsPrime(ll num)
{
  if (num < 2)
    return false;
  else if (num == 2)
    return true;
  else if (num % 2 == 0)
    return false;
  ld sqrtNum = sqrt(num);
  for (ll i = 3; i <= sqrtNum; i += 2)
  {
    if (num % i == 0)
      return false;
  }
  return true;
}

//実行部
void Main()
{
  ll n; cin >> n;
  str s; cin >> s;
  ll k; cin >> k;
  char flag = s[k - 1];
  rep(i, n)
  {
    if(s[i] == flag) cout << s[i];
    else cout << '*';
  }
  cout << endl;
}
//前処理
int main()
{
  ifstream in("text.txt");
  cin.rdbuf(in.rdbuf());
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}

/*
//test時
  g++ test.cpp -o test;./test
*/


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

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public  static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // int d[]=new int[n];
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}

        int n=sc.nextInt();
        int k=sc.nextInt();
        n++;

        out.println(n/2 >= k?"YES":"NO");
        out.flush();
    }


    
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}

//class P {
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//}

//class P implements Comparable<P>{
//    int a,b;
//    P(int a, int b) {
//        this.a=a;
//        this.b=b;
//    }
//    public int compareTo(P p){
//        return b-p.b; //des
//    }
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
    	int r[] = new int[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextInt(); 
		}
    	return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 21332
<?php

$win_matrix = array(
	array(0, 1, 2),
	array(3, 4, 5),
	array(6, 7, 8),
	array(0, 3, 6),
	array(1, 4, 7),
	array(2, 5, 8),
	array(0, 4, 8),
	array(2, 4, 6));

while($line = fgets(STDIN)){
    $arr = trim($line);
    
    $judg = "d";
    foreach($win_matrix as $win){
    	if($arr[$win[0]] == $arr[$win[1]] && $arr[$win[1]] == $arr[$win[2]]){
    		if($arr[$win[0]] == "x"){
    			// x ?????????
    			$judg = "x";
    			break;
    		}
    		if($arr[$win[0]] == "o"){
    			// o ?????????
    			$judg = "o";
    			break;
    		}
    	}
    }
    
    echo $judg."\n";
}

Measured memory_bytes: 15116
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n,m;
  cin>>n>>m;
  vecll v1(m+2), v0(m+2);
  int old = 0;
  ll sum = 0;
  REP(i,n) {
    int a;
    cin>>a;
    if (i) {
      if (a > old) {
        sum += a - old;
        v1[old+1] += 1;
        v1[a+1] += -1;
        v0[old+1] += -old-1;
        v0[a+1] += old+1;
      } else {
        v1[0] += 1;
        v1[a+1] += -1;
        v1[old+1] += 1;
        v0[0] += m-old-1;
        v0[a+1] += -m+old+1;
        v0[old+1] += -old-1;
        sum += (m + a) - old;
      }
    }
    old = a;
  }
  ll mx = 0;
  FOR(i,1,m+1) {
    v1[i] += v1[i-1];
    v0[i] += v0[i-1];
    ll val = v1[i] * i + v0[i];
    mx = max(mx, val);
  }
  cout << sum - mx << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>

int main(){
  int x, y, z;

  scanf("%d%d",&x,&y);

  if(x < y){
    z = x;
    x = y;
    y = z;
  }
  
  for(z = x % y ; z != 0 ; z = x % y){
    x = y;
    y = z;
  }

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

  return 0;

}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
int main()
{
	unordered_map<string,int> m;
	int n;
	string s;
	cin>>n;
	int i=0;
	while(n--)
	{
		cin>>s;
		m[s]=++i;
	}
	cout<<m.size()<<endl;
	return 0;
}

Measured memory_bytes: 17728
#include<stdio.h>
#include<string.h>
int main(void)
{
	char a[2000];
	int s,z,i;
	int n = scanf("%[^\r\n]",a);
	s=strlen(a);
	for(i=0;i<=s;i++){
		if(a[i]>=65&&a[i]<=90)
			a[i]+=32;
		else if(a[i]>=97&&a[i]<=122)
			a[i]-=32;
	}
	for(i=0;i<s;i++){
		printf("%c",a[i]);
	}
	printf("\n");
}

Measured memory_bytes: 2556
#include <iostream>
#include <string>
#include <numeric>

using namespace std;

int main() {
    string s;
    cin >> s;
    cout << max(accumulate(s.begin(), s.end(), 0, [](int init, char i) { return init + (i - '0'); }), int((s.size() - 1) * 9 + (s.front() - '1'))) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

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

Measured memory_bytes: 640
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
	int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    if (a+b>=c) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 21972
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <set>

#define rep0(i, n) for (i = 0; i < n; i++)
#define rep(s, i, n) for (i = s; i < n; i++)
using namespace std;

int sieve[1000002], cnt[1000002], a[1000002], n, m, i, j, g, t;
 
int gcd(int x, int y) {
	return y? gcd(y,x%y) : x;	
}
 
int main() {
	scanf("%d",&n);
	for(i=0;i<n;i++) {
		scanf("%d",a+i);
		if(a[i]>m) m=a[i];
		if(g) g=gcd(g,a[i]);
		else g=a[0];
	}
	if(g>1){
		printf("not coprime\n");
		return 0;
	}
	for(i=2;i<=m;i++) {
		if(sieve[i]==0) {
			sieve[i]=i;
            if((long long)i*i<=m)
			  	for(j=i*i;j<=m;j+=i){
					if(sieve[j]==0) sieve[j]=i;
			  	}
		}	
	}
	for(i=0;i<n;i++){
		j=a[i];
		while(j>1){
			t=sieve[j];
			cnt[t]++;
			if(cnt[t]>1) {
				printf("setwise coprime\n");
				return 0;
			}
			while(j%t==0) j/=t;
		}
	}
	printf("pairwise coprime\n");
	return 0;
}

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

bool solve();

int main()
{
	if (solve()) puts("Yes");
	else puts("No");

	return 0;
}

bool solve()
{
	int N;
	scanf("%d", &N);
	std::vector<std::pair<int64_t, int64_t>> BA(N);
	for (auto& e: BA) scanf("%lld%lld", &e.second, &e.first);
	std::sort(BA.begin(), BA.end());

	int64_t time{};
	for (auto& e: BA)
	{
		if (time + e.second > e.first)
			return false;
		time += e.second;
	}
	return true;
}

Measured memory_bytes: 3328
// B.cpp
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 1e5 + 200;

typedef pair<int, int> pii;

int n, m, head[MAX_N], current, parity[MAX_N];
bool inst[MAX_N], vis[MAX_N];
vector<pii> ansBox;

struct edge
{
    int to, nxt;
} edges[MAX_N << 1];

void addpath(int src, int dst)
{
    edges[current].to = dst, edges[current].nxt = head[src];
    head[src] = current++;
}

bool dfs(int u, int fa)
{
    vis[u] = inst[u] = true;
    for (int i = head[u]; i != -1; i = edges[i].nxt)
        if (!vis[edges[i].to] && edges[i].to != fa)
        {
            bool res = dfs(edges[i].to, u);
            parity[u] ^= !res;
            if (res)
                ansBox.push_back(make_pair(edges[i].to, u));
            else
                ansBox.push_back(make_pair(u, edges[i].to));
        }
    inst[u] = false;
    for (int i = head[u]; i != -1; i = edges[i].nxt)
        if (inst[edges[i].to] && edges[i].to != fa)
            if (parity[u])
                parity[u] ^= 1, ansBox.push_back(make_pair(u, edges[i].to));
            else
                parity[edges[i].to] ^= 1, ansBox.push_back(make_pair(edges[i].to, u));
    return parity[u];
}

int main()
{
    memset(head, -1, sizeof(head));
    scanf("%d%d", &n, &m);
    for (int i = 1, u, v; i <= m; i++)
        scanf("%d%d", &u, &v), addpath(u, v), addpath(v, u);
    if (!dfs(1, 0))
        for (pii x : ansBox)
            printf("%d %d\n", x.first, x.second);
    else
        puts("-1");
    return 0;
}

Measured memory_bytes: 16256
import math


def main():
    N = int(input())
    TA = [
        list(map(int, input().split()))
        for _ in range(N)
    ]

    # ans = f(N, TA)
    ans = editorial(N, TA)
    print(ans)


def editorial(N, TA):
    A, B = 1, 1
    for x, y in TA:
        # n = max(math.ceil(A / x), math.ceil(B / y))
        n = max(A // x + (A % x != 0),
                B // y + (B % y != 0))
        A, B = n * x, n * y

    ans = A + B
    return ans


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188