akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }

constexpr ll mod = 998244353;
constexpr ll modsize = 500010;
vector<ll> fac(modsize);
vector<ll> inv(modsize);
vector<ll> facinv(modsize);

void modcalc() {
	if (modsize == 0) abort();
	fac[0] = 1; fac[1] = 1; inv[1] = 1;
	facinv[0] = 1; facinv[1] = 1;
	for (ll i = 2; i < modsize; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		facinv[i] = facinv[i - 1] * inv[i] % mod;
	}
}

ll modinv(ll a) {
	if (a == 0) abort();
	ll b = mod, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= mod;
	if (u < 0) u += mod;
	return u;
}

ll modpow(ll a, ll b) {
	ll ans = 1;
	a %= mod;
	while (b) {
		if (b & 1) ans = ans * a % mod;
		a = a * a % mod;
		b >>= 1;
	}
	return ans;
}

ll modcomb(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[k] % mod * facinv[n - k] % mod;
}

ll modperm(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	return fac[n] * facinv[n - k] % mod;
}

ll modhom(ll n, ll k) {
	if (n < 0 || k < 0 || n == 0 && k > 0) return 0;
	if (n == 0 && k == 0) return 1;
	return fac[n + k - 1] * facinv[k] % mod * facinv[n - 1] % mod;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	modcalc();

	ll n, m, k;
	cin >> n >> m >> k;
	ll x = n - k;
	ll ans = 0;
	for (ll i = x; i <= n; i++) {
		ll p = m * modpow(m - 1, i - 1) % mod;
		ll rem = n - i;
		//cerr << i << ' ' << rem << '\n';
		p *= modhom(i, rem); p %= mod;
		ans += p; ans %= mod;
		//cerr << p << '\n';
	}
	cout << ans << '\n';
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n, m;
char s[200005];
int a[200005];
vector<int> g[200005];
int cnt[200005][2];
queue<int> q;
bool have[200005];

int main() {
    scanf("%d%d", &n, &m);
    scanf("%s", s);
    forn(i, n) {
        a[i] = (s[i] == 'A' ? 0 : 1);
    }
    forn(i, m) {
        int from, to;
        scanf("%d%d", &from, &to);
        --from, --to;
        g[from].pb(to);
        g[to].pb(from);
        ++cnt[from][a[to]];
        ++cnt[to][a[from]];
    }
    forn(i, n) have[i] = true;
    forn(i, n) if (cnt[i][0] == 0 || cnt[i][1] == 0) {
        have[i] = false;
        q.push(i);
    }
    while (!q.empty()) {
        int v = q.front();
        q.pop();
        for (int to : g[v]) {
            if (--cnt[v][a[to]] == 0 && have[v]) {
                have[v] = false;
                q.push(v);
            }
            if (--cnt[to][a[v]] == 0 && have[to]) {
                have[to] = false;
                q.push(to);
            }
        }
    }
    string ans = "No";
    forn(i, n) if (have[i]) {
        ans = "Yes";
        break;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 14592
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a;
  cin >> a;
  for(int i=a;i<1000;i++){
    if(i%111==0){
      cout << i << endl;
      return 0;
    }
  }
  /*
  char s[200];
  cin >> s;
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  for(int i=0;i<a;i++){
    cout << s[i];
  }
  cout << "\"";
  for(int i=a;i<b;i++){
    cout << s[i];
  }
  cout << "\"";
  for(int i=b;i<c;i++){
    cout << s[i];
  }
  cout << "\"";
  for(int i=c;i<d;i++){
    cout << s[i];
  }
  cout << "\"";
  for(int i=d;i<strlen(s);i++){
    cout << s[i];
  }*/
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long a,b,c;
  cin >>a>>b>>c;
  long long kotae1=c-a-b;
  long long kotae2=4*a*b;
  if(kotae1>0 && kotae2<kotae1*kotae1){
    cout <<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}

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

int main(void){
  char S[100000];
  int flag[26];
  scanf("%s",S);

  for(int i = 0;i < 26;i++) flag[i] = 0;

  for(int i = 0;i < strlen(S);i++){
    flag[S[i]-97]++;
  }

  for(int i = 0;i < 26;i++){
    if(!flag[i]){
      printf("%c\n",i+97);
      return 0;
    }
  }

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

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

using namespace std;

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

    int a[m], b[m];
    vector<vector<int>> v(n+1);

    for (int i = 0; i < m; i++) {
        cin >> a[i] >> b[i];
        v[a[i]].push_back(b[i]);
    }

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

    cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 10112
import java.util.Scanner;

public class Main {
	public static void main(String[] args)
	{
		Scanner stdIn = new Scanner(System.in);
		
		while(true)
		{
			int H = stdIn.nextInt();
			int W = stdIn.nextInt();
			
			if(H==0 && W==0)
			{
				break;
			}
			
			for(int i=0;i<H;i++)
			{
				for(int j=0;j<W;j++)
				{
					if((i+j)%2==0)
					{
						System.out.print('#');
					}
					else
					{
						System.out.print('.');
					}
				}
				System.out.println();
			}
			System.out.println();
		}
	}
}

Measured memory_bytes: 28692
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define inf 1000000000000000007
#define eps 0.00000001
#define pi 3.141592653589793
#define pii pair<int,int>
#define pdd pair<ld,ld>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define vii vector<int>
#define vpl vector<pll>
#define vll vector<ll>
#define sti stack <int>
#define stll stack <ll>
#define mseti multiset <ll>
#define msetd multiset <ll, greater <ll> >
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound 
#define stp setprecision(20)//use fixed before stp
#define endl '\n'
bool comparion(pair <string,ll> a,pair <string,ll> b)
{
    if(a.ff==b.ff)
        return (a.ss>b.ss);
    return (a.ff<b.ff);
}
int main()
{  
    FAST
    ll n;
    cin>>n;
    pair <string,ll> p[n];
    ll a[100]={0};
    for(ll i=0;i<n;i++)
    {
        cin>>p[i].ff>>p[i].ss;
        a[p[i].ss]=i+1;
    }
    sort(p,p+n,comparion);
    for(ll i=0;i<n;i++)
    {
        cout<<a[p[i].ss]<<endl;
    }
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
q=int(input())
ans=sum(a)
p=[0]*100001
for i in a:
    p[i]+=1
for i in range(q):
    b,c=map(int,input().split())
    ans+=(c-b)*p[b]
    p[c]+=p[b]
    p[b]=0
    print(ans)

Measured memory_bytes: 20876
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        System.out.println(gcd(a,b));
    }

    private static int gcd(int a, int b) {
        if (b == 0) return a;
        return gcd(b, a % b);
    }
}


Measured memory_bytes: 26344
#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// using Bint = mp::cpp_int;
// using Real = mp::number<mp::cpp_dec_float<1024>>;


int main(){
    int N, K;
    cin >> N >> K;
    vector<bool> sunuke(110, false);

    rep(i, K){
        int d;
        cin >> d;
        rep(j, d){
            int a;
            cin >> a;
            sunuke.at(a) = true;
        }
    }

    int ans = 0;
    for(int i = 1; i <= N; i++){
        if(!sunuke.at(i)) ans++;
    }

    cout << ans << endl;
}


Measured memory_bytes: 3600
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int p = scan.nextInt();
        int m = scan.nextInt();
        int n = scan.nextInt();
        int c = 0;
        for(int i=0;i<p;i++){
            int x= scan.nextInt();
            int y= scan.nextInt();
            if(x>=m&&y>=n){c++;}
        }
        System.out.println(c);
    }
}

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

using namespace std;

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

    vector<int> b(n - 1);
    for (int i = 0; i < n - 1; ++i)
        cin >> b[i];

    int sum = b[0];
    int prev = b[0];
    for (int i = 1; i < n - 1; ++i) {
        sum += min(prev, b[i]);
        prev = b[i];
    }
    sum += b[b.size() - 1];
    cout << sum << '\n';
}


Measured memory_bytes: 256
h, w, K = [int(item) for item in input().split()]

ans = [[0 for i in range(w)] for j in range(h+1)]
pats = []

def layer_pattern(w, pat):
  if w == 0:
    for i in range(len(pat) -1):
      if pat[i] == 1 and pat[i+1] == 1:
        return False
    pats.append([0] + pat + [0])
    return True
  layer_pattern(w-1, pat + [0])
  layer_pattern(w-1, pat + [1])

layer_pattern(w-1, [])

for i in range(h+1):
  if i == 0:
    ans[0][0] = 1
  else:
    for pat in pats:
      for k in range(len(pat)):
        if k == len(pat)-1:
          continue
        elif pat[k] == 0 and pat[k+1] == 0:
          ans[i][k] += ans[i-1][k]
        elif pat[k] == 1 and pat[k+1] == 0:
          ans[i][k] += ans[i-1][k-1]
        elif pat[k] == 0 and pat[k+1] == 1:
          ans[i][k] += ans[i-1][k+1]
        else:
          print("cannot be happen")
          break

print(ans[h][K-1] % 1000000007)

Measured memory_bytes: 3064
def allocation(p, w, n, k):
    truck = [0]*k
    idx = 0
    cnt = 0
    for i in range(n):
        if (truck[idx] + w[i]) > p:
            idx += 1
            if idx >= k:
                break
        if w[i] > p:
            continue
        truck[idx] += w[i]
        cnt += 1
    return cnt
n, k = map(int,input().split())
w = [int(input()) for i in range(n)]
left = 0
right = 100000*10000
while left < right:
    mid = (left + right)//2
    ans1 = allocation(mid, w, n, k)
    ans2 = allocation(mid-1,w, n, k)
    if n == ans1 and ans2 < n:
        print(mid)
        break
    elif n == ans1:
        right = mid
    elif ans1 < n:
        left = mid


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

template <class T>
T pow(T x, T n, T mod) {
    T ret = 1;
    while(n > 0) {
        if ((n & 1) == 1) ret = (ret * x) % mod;
        x = (x * x) % mod;
        n >>= 1;
    }
    return ret;
}

template <class T>
T inverse(T x, T p) { return pow(x, p - 2, p); }

int main() {
    constexpr auto mod = 1000000007ll;
    long long n, k;
    std::cin >> n;
    std::vector<long long> a(n + 3), b(n + 3);
    for (int i = 1; i <= n + 1; i++) {
        std::cin >> a[i];
        if (b[a[i]]) k = i;
        else b[a[i]] = i;
    }
    long long fst = b[a[k]], snd = k;
    k = a[k];

    std::vector<long long> fact(n + 2), inv(n + 2);
    fact[0] = 1;
    for (auto i = 1; i <= n + 1; i++) fact[i] = fact[i - 1] * i % mod;
    inv[n + 1] = inverse(fact[n + 1], mod);
    for (auto i = n + 1; i > 0; i--) inv[i - 1] = inv[i] * i % mod;

    for (int i = 1; i <= n + 1; i++) {
        auto ret = fact[n + 1] * inv[i] % mod * inv[n + 1 - i] % mod;
        //std::cout << ret << std::endl;
        // fst - 1
        // n + 1 - snd
        // => n + fst - snd
        if (n + fst - snd >= i - 1) {
            auto d = fact[n + fst - snd] * inv[i - 1] % mod * inv[n + fst - snd - i + 1] % mod;
            ret = (ret + mod - d) % mod;
        }

        std::cout << ret << std::endl;
    }

    return 0;
}

Measured memory_bytes: 4352
#include<stdio.h>

int main() {
  long long int n,m,i,j,count;

  scanf("%lld %lld",&n,&m);
 
  if (n == m || n == m-1 || n == m+1) {

     for (i = n; i > 1; i--) {
        n *= i-1;
        n = n%1000000007;
     }
     
     for (j = m; j > 1; j--) {
        m *= j-1;
        m = m%1000000007;
     }
     
     count = n * m%1000000007;

     if ( n == m ) {
        count = count*2;
     }
     
     printf("%lld \n", count%1000000007);
  
  } else {
     printf("0 \n");
  }
     
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (sc.hasNext()) {
			String input = sc.nextLine();
			String[] array = input.split(" ");
			int h = Integer.parseInt(array[0]);
			int w = Integer.parseInt(array[1]);
			if (h == 0 && w == 0) {
				System.exit(0);
			}
			for (int i = 0; i < h; i++) {
				if (i == 0 || i == h - 1) {
					for (int j = 0; j < w; j++) {
						System.out.print("#");
					}
				} else {
					for (int j = 0; j < w; j++) {
						if (j == 0 || j == w - 1) {
							System.out.print("#");
						} else {
							System.out.print(".");
						}
					}

				}
				System.out.print("\n");
			}
			System.out.print("\n");

		}
	}
}

Measured memory_bytes: 35612
#include <cstdio>
#include <cstdint>
#include <cassert>
#include <cctype>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <utility>

std::vector<std::string> ops={"uidsc"};

std::set<int> parse(const std::string& s, size_t& i, size_t preced,
                    const std::map<char, std::set<int>>& sets) {

  if (preced == ops.size()) {
    if (isupper(s[i])) return sets.at(s[i++]);
    if (s[i] == 'c') {
      auto cmpl=parse(s, ++i, preced, sets);
      std::set<int> res;
      for (int x: sets.at('U'))
        if (!cmpl.count(x)) res.insert(x);
      return res;
    }
    if (s[i] == '(') {
      auto res=parse(s, ++i, 0, sets);
      assert(s[i] == ')');
      ++i;
      return res;
    }
    assert(false);
  }

  auto res=parse(s, i, preced+1, sets);
  while (i < s.length()) {
    char op=s[i];
    if (!std::count(ops[preced].begin(), ops[preced].end(), op)) break;
    auto rhs=parse(s, ++i, preced+1, sets);

    if (op == 'u') {
      for (int x: rhs) res.insert(x);
    } else if (op == 'i') {
      std::set<int> tmp;
      for (int x: res)
        if (rhs.count(x)) tmp.insert(x);
      res = std::move(tmp);
    } else if (op == 'd') {
      std::set<int> tmp;
      for (int x: res)
        if (!rhs.count(x)) tmp.insert(x);
      res = std::move(tmp);
    } else if (op == 's') {
      std::set<int> tmp;
      for (int x: res)
        if (!rhs.count(x)) tmp.insert(x);
      for (int x: rhs)
        if (!res.count(x)) tmp.insert(x);
      res = std::move(tmp);
    }
  }
  return res;
}

int testcase_ends() {
  std::set<int> U;
  std::map<char, std::set<int>> sets;

  while (true) {
    char name;
    size_t n;
    if (scanf(" %c %zu", &name, &n) == EOF) return 1;
    if (name == 'R' && n == 0) break;
    std::set<int> tmp;
    for (size_t i=0; i<n; ++i) {
      int a;
      scanf("%d", &a);
      U.insert(a);
      tmp.insert(a);
    }
    sets[name] = tmp;
  }
  sets['U'] = U;

  char buf[131072];
  scanf("%s", buf);
  std::string s=buf;
  size_t i=0;
  std::set<int> res=parse(s, i, 0, sets);
  if (res.empty()) {
    puts("NULL");
  } else {
    for (auto it=res.cbegin(); it!=res.cend(); ++it) {
      printf("%d%c", *it, std::next(it)!=res.cend()? ' ':'\n');
    }
  }
  return 0;
}

int main() {
  while (!testcase_ends()) {}
}



Measured memory_bytes: 2780
#include<stdio.h>
int main(void){
    int N;
    char S[100000];
    scanf("%d %s",&N,S);
    int sum=1;
    for (int i=1; i<N; i++) {
        if (S[i]!=S[i-1]) {
            sum++;
        }
    }
    printf("%d\n",sum);
    return 0;
}

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

/* macro */
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define int long long
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define isin(a, b, c) (b <= a && a <= c)
#define println cout << "\n";
#define sz(v) (int)v.size()
#define bin(x) static_cast<bitset<16> >(x)


/* alias */
template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef tuple<int, int, int> ti;
typedef map<int, int> mi;
typedef set<int> si;


/* constant */
const int inf = 1LL << 62;
const int mod = 1e9 + 7;
const int dx[8]={1,0,-1,0,-1,1,-1,1};
const int dy[8]={0,1,0,-1,-1,-1,1,1};
const string alphabet = "abcdefghijklmnopqrstuvwxyz";

/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T, class U, class V> void printx(tuple<T, U, V> t){cout << "{" << get<0>(t) << "," << get<1>(t) <<"," << get<2>(t) << "}" << endl;}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}
template<class T> void printans(vec<T> v){rep(i,0,sz(v)){cout << v[i] << (i == sz(v) - 1 ? "" : " ");}cout << endl;}


/* general_method */
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>T cut(T &a, int l, int r){return T(a.begin()+l, a.begin()+r);}


/* math_method */
int ceil(int a, int b){return a / b + (a % b > 0);}


/* main */

string s;
void in(){
    cin >> s;
}

void solve(){

    int cnt = 0;
    for(char e : s){
        if(e == 'x') cnt++;
    }

    if(cnt <= 7){
        print("YES");
    }else{
        print("NO");
    }

}

signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);
    in();
    solve();
    
}

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

using namespace std;

void call(int n){
	for(int i = 1; i <= n; i++){
		if(i % 3 == 0) cout << " " << i;
		else{
			for(int tmp = i; tmp != 0; tmp /= 10){
				if(tmp % 10 == 3){
					cout << " " << i;
					break;
				}
			}
		}
	}
	cout << endl;
}

int main(){
	int n;
	cin >> n;
	call(n);
	return 0;
}

Measured memory_bytes: 1160
S = input()
NQ = int(input())

reverseFlag = False
prefix = ""
suffix = ""

for i in range(NQ):
    query = input().split()
    if (int(query[0]) == 1):
        reverseFlag = not reverseFlag
    else:
        if (reverseFlag):
            if (int(query[1]) == 1):
                suffix = suffix + query[2]
            else:
                prefix = query[2] + prefix
        else:
            if (int(query[1]) == 1):
                prefix = query[2] + prefix
            else:
                suffix = suffix + query[2]

if (reverseFlag):
    print(suffix[::-1] + S[::-1] + prefix[::-1])
else:
    print(prefix + S + suffix)



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

using namespace std;

#define MOD ((long long)1E9+7)

long long expmod(long long b, long long i){
    if(i == 0) return 1;
    long long e = expmod(b, i / 2);
    e *= e;
    e %= MOD;
    if(i % 2 == 1){
        e *= b;
        e %= MOD;
    }
    return e % MOD;
}

long long inv(long long x){
    return expmod(x, MOD - 2);
}

long long fact(long long n){
    static long long memo[300000] = {0};
    if(n == 0) return 1;
    if(memo[n] != 0) return memo[n];
    return memo[n] = n * fact(n - 1) % MOD;
}

long long comb(long long n, long long k){
    long long ans = fact(n);
    ans *= inv(fact(k));
    ans %= MOD;
    ans *= inv(fact(n - k));
    ans %= MOD;
    return ans;
}

int main(void){
    long long denom = 1;
    long long up = 1;
    long long down = 1;
    long long B, W;
    cin >> B >> W;
    long long N = B + W;
    for(int n = 0; n < N; n++){
        long long numer = denom;

        // cout << n << endl << up << ", " << down << endl;


        if(n >= B){
            numer += MOD - down;
            numer %= MOD;
            down *= 2;
            down %= MOD;
            down += comb(n, n + 1 - B);
            down %= MOD;
        }
        if(n >= W){
            numer += up;
            numer %= MOD;
            up *= 2;
            up %= MOD;
            up += comb(n, n + 1 - W);
            up %= MOD;
        }
        denom *= 2;
        denom %= MOD;

        // cout << "ans = " << numer << " / " << denom << endl;

        long long ans = numer * inv(denom);
        ans %= MOD;
        cout << ans << endl;
    }
    return 0;
}


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

using namespace std;

const int MOD = 1e9 + 7;

const int MAXN = 1e5 + 10;
int dp[MAXN][13];

int main() {
	string s;
	cin >> s;
	int n = s.size();
	if (s[0] == '?') {
		for (int i = 0; i < 10; i++) {
			dp[0][i] = 1;
		}
	} else {
		dp[0][s[0] - '0'] = 1;
	}
	for (int i = 1; i < n; i++) {
		for (int p = 0; p < 13; p++) {
			if (s[i] == '?') {
				for (int q = 0; q < 10; q++) {
					int r = (p * 10 + q) % 13;
					dp[i][r] += dp[i - 1][p];
					dp[i][r] %= MOD;
				}
			} else {
				int r = (p * 10 + s[i] - '0') % 13;
				dp[i][r] += dp[i - 1][p];
				dp[i][r] %= MOD;
			}
		}
	}
	// for (int i = 0; i < n; i++) {
	// 	cout << i << endl;
	// 	for (int j = 0; j < 13; j++) {
	// 		cout << dp[i][j] << " ";
	// 	}	
	// 	cout << endl;
	// }
	cout << dp[n - 1][5];
	return 0;
}

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

typedef pair<double,double>vec;

int main()
{
    double v;
    while(cin>>v){
        double h=4.9*(v/9.8)*(v/9.8);
        int ans=0;
        for(;5*ans-5<h;ans++){}
        cout<<ans<<endl;;
    }
    return 0;
}

Measured memory_bytes: 1224
def selection_sort(ary,num)
  time = 0
  for i in 0..num-1
    minj = i
    for j in i..num-1
      if ary[j] < ary[minj]
        minj = j
      end
    end
    if minj != i
      k = ary[minj]
      ary[minj] = ary[i]
      ary[i] = k
      time += 1
    end
  end
  puts ary.join(" ")
  puts time
end

N = gets.to_i
a = gets.chomp.split.map(&:to_i)

selection_sort(a,N)

Measured memory_bytes: 8688
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int k,n,m,flag=0;
    cin>>k;
    cin>>n>>m;
    for(int i=n;i<=m;i++)
    {
        if(i%k==0)
            flag=1;
    }
    if(flag==0)
        cout<<"NG";
    else
        cout<<"OK";



    return 0;
}


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

int main(){
    ios::sync_with_stdio(false);
	cin.tie(nullptr);
    ll n; cin >> n;
    vector<ll> a(100005,0);
    ll sum=0;
    rep(i,n){
        ll x;
        cin >> x;
        sum += x;
        a[x]++;
    }
    ll q; cin >> q;
    vector<ll> b(q);
    vector<ll> c(q);
    rep(i,q){
        cin >> b[i] >> c[i];
    }
    rep(i,q){
        a[c[i]] += a[b[i]];
        sum += (c[i]-b[i])*a[b[i]];
        a[b[i]] = 0;
        cout << sum << endl;
    }
}

Measured memory_bytes: 5580
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
0 0 3 4
1
2 5

output:
3.1200000000 4.1600000000
"""

import sys


def solve(_prj_info):
    for point in _prj_info:
        xp, yp = map(int, point)
        p = xp + yp * 1j
        hypo = p - p1
        prj = p1 + base * project(base, hypo)
        print('{0:.10f} {1:.10f}'.format(prj.real, prj.imag))

    return _prj_info


def dot(a, b):
    return a.real * b.real + a.imag * b.imag


def project(a, b):
    return dot(a, b) / dot(a, a)


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    base_info = _input[0].split()
    q_num = int(_input[1])
    prj_points = map(lambda x: x.split(), _input[2:])

    x1, y1, x2, y2 = map(int, base_info)
    p1, p2 = x1 + y1 * 1j, x2 + y2 * 1j
    base = p2 - p1
    res = solve(prj_points)

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

int main(){
  vector<int> q(5);
  vector<int> r(5);
  vector<int> s(5);
  cin>>q[0]>>q[1]>>q[2]>>q[3]>>q[4];
  for(int i=0;i<5;i++){
    r[i]=q[i]%10;
    s[i]=q[i]/10+1;
    if(r[i]==0){
      r[i]=10;
      s[i]--;
    }
  }
  sort(r.begin(),r.end());
  int ans;
  for(int i=0;i<5;i++){
    ans+=s[i]*10;
  }
  ans-=(10-r[0]);
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  vector<int> v(n);
  for(int i=0;i<n;i++){
    cin >> v[i];
  }
  sort(v.begin(),v.end());
  int sum = 0;
  for(int i=0;i<k;i++){
    sum += v[i];
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 3608
n = int(input())
a = [int(i) for i in input().split()]
mean = sum(a)/len(a)
for i in range(n):
    if i == 0:
        result = i
    elif i > 0:
        if abs(mean - a[i]) < abs(mean - a[result]):
            result = i
print(result)


Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {

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

		int n = sc.nextInt();
		int t = sc.nextInt();

		int a[] = new int[n];

//		int min = Integer.MAX_VALUE;
//		int max = 0;
		for(int i = 0; i < n; i++){
			a[i] = sc.nextInt();
//			min = Math.min(min, a[i]);
//			max = Math.max(max, a[i]);
		}

//		int maxBenefit = max - min;
//
		int min = a[0];
//		int max = a[0];
		int maxBenefit = 0;
		for(int i = 1; i < n; i++){
			min = Math.min(min, a[i]);
//			max = Math.max(max, a[i]);
			maxBenefit = Math.max(maxBenefit, a[i] - min);
		}

//		System.out.println(maxBenefit);

		int minNum = 1;
		int maxNum = 0;
		min = a[0];
		int result = 0;
		for(int i = 1; i < n; i++){
			if(a[i] == min){
				minNum++;
			}
			if(a[i] == min + maxBenefit){
				maxNum++;
			}

			if(a[i] < min || i == n - 1){
				min = a[i];

				result += Math.min(minNum, maxNum);

				minNum = 1;
				maxNum = 0;
			}

//			System.out.println("i = "+i+" minNum = "+minNum+" maxNum = "+maxNum);
		}

		System.out.println(result);
	}

}


Measured memory_bytes: 49360
#include <bits/stdc++.h>
 
#define FOR(i, j, n) for (int i(j); i < n; ++i)
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define dbg(x) std::cerr<<#x<<" = " << (x) << std::endl
#define pnl(x) std::cout << x << "\n"
 
typedef	std::vector<int>	vi;
typedef std::pair<int,int>	ii;
typedef std::vector<std::string>	vs;
typedef std::vector<ii>	vii;
typedef std::vector<long long>	vl;
typedef	long long ll;
 
 
const int	NB_D = 4;
const int	DY[] = {-1, 1, 0, 0};
const int	DX[] = {0, 0, -1, 1};
 
int		main(void)
{
	std::ios_base::sync_with_stdio(false);
	std::set<int>	set;
	int	N;
	std::cin >> N;
	for (int i(0); i < N; ++i)
	{
		int	a;
		std::cin >> a;
		set.insert(a);
	}
	std::cout << set.size() << std::endl;
}

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

int H, W;
int mp[1000][1000];
string dp[1000][1000];

string max_comp(string s1, string s2){
  if(s1.length() > s2.length())return s1;
  if(s1.length() < s2.length())return s2;

  for(int i=0; i<s1.length(); i++){
    if(s1[i] > s2[i])return s1;
    if(s1[i] < s2[i])return s2;
  }
  return s1; //??????
}

int main(){
  while(cin >> W >> H, !(H==0 && W==0)){
    //??\???
    for(int i=0; i<H; i++){
      for(int j=0; j<W; j++){
	char tmp;
	cin >> tmp;
	if('0'<=tmp && tmp<='9')mp[i][j] = tmp-'0';
	else mp[i][j] = -1;
      }
    }

    //?????????
    for(int i=0; i<H; i++)
      for(int j=0; j<W; j++)
	dp[i][j]="";

    if(mp[H-1][W-1]!=-1)dp[H-1][W-1].insert(dp[H-1][W-1].begin(), mp[H-1][W-1]+'0');

    for(int i=H-2; i>=0; i--){
      if(mp[i][W-1] != -1){
	string tmp = dp[i+1][W-1];
	tmp.insert(tmp.begin(), mp[i][W-1]+'0');
	dp[i][W-1] = tmp;
      }
    }
    for(int j=W-2; j>=0; j--){
      if(mp[H-1][j] != -1){
	string tmp = dp[H-1][j+1];
	tmp.insert(tmp.begin(), mp[H-1][j]+'0');
	dp[H-1][j] = tmp;
      }
    }

    //???????¨???????
    for(int i=H-2; i>=0; i--){
      for(int j=W-2; j>=0; j--){
	if(mp[i][j]==-1)continue; //??????????????????
	string tmp1 = dp[i+1][j], tmp2 = dp[i][j+1];
	tmp1.insert(tmp1.begin(), mp[i][j]+'0');
	tmp2.insert(tmp2.begin(), mp[i][j]+'0');
	dp[i][j] = max_comp(tmp1, tmp2);
      }
    }

    for(int i=0; i<H; i++)
      for(int j=0; j<W; j++)
	while(dp[i][j][0]=='0')dp[i][j].erase(dp[i][j].begin());

    string ans = "";
    for(int i=0; i<H; i++)
      for(int j=0; j<W; j++)
	ans = max_comp(ans, dp[i][j]);

    while(ans[0]=='0')ans.erase(ans.begin());

    if(ans=="")cout << "0" << endl;
    else cout << ans << endl; 
  }
  return 0;
}

Measured memory_bytes: 9536
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 10000000000000007
#define ggr getchar(); getchar();return 0;
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int n, m;
pair<bool, int> ta[100010];

signed main() {
	cin >> n >> m;
	ta[1].first = true;
	rep(i, n + 5)ta[i].second = 1;
	rep(i, m) {
		int x, y;
		cin >> x >> y;
		if (ta[x].first == false) {
			ta[x].second--;
			ta[y].second++;
		}
		else if (ta[x].second == 1) {
			ta[x].first = false;
			ta[x].second--;
			ta[y].first = true;
			ta[y].second++;
		}
		else {
			ta[x].second--;
			ta[y].first = true;
			ta[y].second++;
		}
	}
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		if (ta[i].first)ans++;
	}
	cout << ans << endl;
	ggr
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define FOR(i) for(cin>>i;i>0;i--)
#define elif else if
#define pb push_back
#define ll long long
#define mp make_pair
#define all(x) x.begin(),x.end()
#define re(x) {cout<<x<<endl;return 0;}
//#define x first
//#define y second

using namespace std;
int a,b;
int main()
{
	cin>>a>>b;
	if(a>b) re("safe")
	else re("unsafe")
	return 0;}

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

int gcd(int a,int b) {return b==0? a:gcd(b,a%b);}


int main(){
    ll n,ans=0;
    cin>>n;

    for(int i=1;i<=n;i++){
        if(i%3!=0 && i%5!=0) ans+=i;
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, H;
    vector<int> h;
    cin >> n;
    vector<int> DP(n);
    while (n--){ 
        scanf("%i", &H); 
        h.push_back(H); 
    }
    DP[0] = 0;
    DP[1] = abs(h[1] - h[0]);
    
    for (int i = 2; i < DP.size(); i++){
        DP[i] = min(DP[i - 2] + abs(h[i] - h[i - 2]), DP[i - 1] + abs(h[i] - h[i - 1]));
    }
    cout << DP[DP.size() - 1];
}

Measured memory_bytes: 1276
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll t=b-a+1;
	ll x=__gcd(c,d);
	x=c/x*d;
	ll t1=a/c+a/d-a/x;
	ll t2=b/c+b/d-b/x;
	if(a%c==0||a%d==0)
		t1--;
	//cout<<t1<<" "<<t2<<" "<<t<<"\n";
	t=t-(t2-t1);
	printf("%lld\n",t);
}

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

ll N = pow(10,9) + 7;

int main(){
    string s;
    cin >> s;
    int n = (int)s.size();
    reverse(s.begin(), s.end());
    int keta_mod[6] = {1, 10, 9, 12, 3, 4};
    vector<vector<ll>> dp(n+1,vector<ll>(13,0));
    dp.at(0).at(0) = 1;
    for(int i=1; i<=n; i++){
        //下i桁まで使う
        if(s.at(i-1) != '?'){
            int k = s.at(i-1) - '0';
            int plus = k * keta_mod[(i-1)%6];
            for(int j=0; j<13; j++){
                if(dp.at(i-1).at(j)==0) continue;
                int t = (j+plus)%13;
                dp.at(i).at(t) = (dp.at(i).at(t)+dp.at(i-1).at(j))%N;
            }
        }
        else{
            // '?'だった時
            for(int k=0; k<10; k++){
                int plus = k * keta_mod[(i-1)%6];
                for(int j=0; j<13; j++){
                    if(dp.at(i-1).at(j)==0) continue;
                    int t = (j+plus)%13;
                    dp.at(i).at(t) = (dp.at(i).at(t)+dp.at(i-1).at(j))%N;
                }
            }
        }
    }
    /*
    for(int i=0; i<n+1; i++){
        for(int j=0; j<13; j++){
            cout << dp.at(i).at(j) << ' ';
        }
        cout << endl;
        
    }
    */
    
    cout << dp.at(n).at(5) << endl;
}


Measured memory_bytes: 16664
import math

def solve():
    a, b, c = map(int, input().split())
    mindiff = 10 ** 27
    mindiff = min(mindiff, math.ceil(a/2) * b * c - math.floor(a/2) * b * c)
    mindiff = min(mindiff, math.ceil(b/2) * a * c - math.floor(b/2) * a * c)
    mindiff = min(mindiff, math.ceil(c/2) * b * a - math.floor(c/2) * b * a)
    print(mindiff)

if __name__=="__main__":
    solve()

Measured memory_bytes: 43120
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
long long a[110]={0},n,x=0,y=0;
int main()
{
	long long i,j=0;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	sort(a+1,a+n+1);
	for(i=n;i>=1;i--)
	{
		if(j==0)
		{
			x+=a[i];
		}
		else
		{
			y+=a[i];
		}
		j=!j;
	}
	cout<<x-y<<endl;
	return(0);
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;string s;cin>>s;
  int ans=0;
  int ma=0;
  for(int i=0;i<n;i++){
    if(s[i]=='I')ans++;
    else ans--;
    ma=max(ma,ans);
  }
  cout<<ma<<endl;
}

Measured memory_bytes: 256
A = int(input())
B = list(map(int, input().split()))

ansList = [0] * A

for i in range(len(B)):
    if i == 0:
        ansList[i] = B[0]
    else:
        ansList[i] = min(B[i], B[i - 1])
ansList[A - 1] = B[-1]

print(sum(ansList))

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

#ifdef DEBUG
#include "../include/debug.hpp"
#else
#define debug(...) 42
#endif

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

    int N, C, K;
    cin >> N >> C >> K;

    vector<int> T(N);
    for (int i=0; i<N; ++i) cin >> T[i];
    sort(T.begin(), T.end());

    int bus = 0, people = 0, depart = -1;
    for (int i=0; i<N; ++i) {
        if (depart < T[i] || C == people) {
            depart = T[i]+K;
            people = 0;
            bus ++;
        }
        people ++;
    }

    cout << bus << endl;

    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> // sort
#include <map> // pair
#include <queue>
#include<iomanip>
#include <cmath>
#include <set>

#define ABS(x) ((x)>0?(x):-(x))
#define MIN(x,y) ((x)>(y)?(y):(x))

using namespace std;
typedef long long ll;

ll newton(long long int a, long long int  b)
{
	if(a==b)
		return a;
	while(a != 0 && b != 0)
	{
		if(a > b)
		{
			b += a;
			a = b-a;
			b -= a;
		}
		b %= a;
	}
	return a;
}

struct UnionFind {
	vector<int> p;
	UnionFind(int N):p(N)
	{
		for(int i=0; i< N; i++)
		{
			p[i] = i;
		}
	}
	int root(int x)
	{
		if(p[x] == x)
			return x;
		return p[x] = root(p[x]);
	}
	void unite(int x, int y)
	{
		int rx = root(x);
		int ry = root(y);
		if(rx == ry) return;
		p[rx] = ry;
	}
	bool issame(int x, int y)
	{
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};

//大きな数に対する割り算をするとき、MODを指定することで掛け算の値に変換できる

ll div2mul_calc(ll a, ll b, ll m)
{
	if (b == 0) {
        return 1;
    } else if (b % 2 == 0) {
        ll d = div2mul_calc(a, b / 2, m);
        return (d * d) % m;
    } else {
        return (a * div2mul_calc(a, b - 1, m)) % m;
    }
}
ll div2mul(ll n, ll mod)
{
	return div2mul_calc(n, mod-2, mod);
}

int main()
{
	char p[200020];
	string str;
	string inp;
	cin >> str;
	int N = str.size();
	int cur = 0;
	int pos = 0;
	ll ans = 0;
	//str.copy(inp, N);
	inp = str;
	ll start_A, n,c;
	while(cur < N - 2)
	{
		if(inp[cur] == 'A')
		{
			start_A = cur;
			cur += 1;
			while(cur < N - 1 and inp[cur] == 'A')
			{
				cur ++;
			}
			if(cur > N-2)
				break;
			n = cur - start_A;
			c = 0;
			while(cur < N-1)
			{
				if(inp[cur] == 'B'&&inp[cur+1] == 'C')
				{
					c ++;
					cur += 2;
				}
				else
				{
					break;
				}
			}
			if(c == 0)
			{
				cur = start_A + n;
				continue;
			}
			ans += n*c;
			inp = inp.substr(0,start_A) + inp.substr(start_A+n,c*2) + inp.substr(start_A,n) + inp.substr(start_A+n+c*2);
			//cout << inp << endl;
			cur = start_A + n - 1;
			if(c>=1)
				cur = start_A + c*2 - 1;
			//cout << cur << " " << n << " " << c << endl;
		}
		++cur;
	}
	inp.copy(p, N);
	cur = 0;
	while(cur < N - 2)
	{
		if(p[cur] == 'A')
		{
			if(p[cur+1] == 'B')
			{
				if(p[cur+2] == 'C')
				{
					p[cur] = 'B';
					p[cur+1] = 'C';
					p[cur+2] = 'A';
					if(cur > 0)
						cur -= 2;
					ans += 1;
				}
			}
		}
		cur += 1;
	}
	cout << ans << endl;
	return 0;
}




































Measured memory_bytes: 1668
#include<iostream>
using namespace std;
int main(){
	int n,m;
	cin>>n>>m;
	for(int i=0;i<m;i++){
		int x;
		cin>>x;
		n-=x;
		if(n<0) return cout<<-1,0;
	}
	cout<<n;
	return 0;
}


Measured memory_bytes: 3644
H,W = map(int,input().split())

if H % 3 == 0:
    print(0)
    exit()
if W % 3 == 0:
    print(0)
    exit()

ans = 10**10
for h in range(1,H):
    S1 = W*h
    if W % 2 == 0:
        S2 = (W/2)*(H-h)
        S3 = (W/2)*(H-h)
    else:
        S2 = (W//2+1)*(H-h)
        S3 = (W//2)*(H-h)
    Smax = max(S1,S2)
    Smin = min(S1,S3)
    ans = min(ans , Smax - Smin )

for w in range(1,W):
    S1 = H*w
    if H % 2 == 0:
        S2 = (H/2)*(W-w)
        S3 = (H/2)*(W-w)
    else:
        S2 = (H//2+1)*(W-w)
        S3 = (H//2)*(W-w)
    Smax = max(S1,S2)
    Smin = min(S1,S3)
    ans = min(ans , Smax - Smin )

ans = min(ans , H*(W//3 +1) - H*(W//3))
ans = min(ans , W*(H//3 +1) - W*(H//3))
print(int(ans))


Measured memory_bytes: 3064
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;

int main() {
  int X, Y; cin >> X >> Y;
  int cnt = 0;
  for (int i = 0; i <= X; ++i) {
    int j = X - i;
    if (2 * i + 4 * j == Y) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 3616
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def main():
	#a = int(input())
	#b , c = tin()
	#s = input()
	b, c= tin()
	return 'YES' if (b + 1) // 2 >= c else 'NO'
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 61956
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int num=sc.nextInt();
        int[] a=new int[num];
        for(int i=0;i<num;i++){
            a[i]=sc.nextInt();
        }
        for(int j=num-1;j>=0;j--){
            if(j==0){
                System.out.println(a[j]);
            }else{
               System.out.print(a[j]+" "); 
            }
            
            
        }
    }
}


Measured memory_bytes: 26496
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
using namespace std;
template<typename T>
void get(T& t){cin >> t;}
double calc(int h, int n, int w){
	return 1.0 / h + 1.0 / n + 1.0 / w;
}
int main(void){
	int N;get(N);
	for(uint64_t h=1;h<=3500;h++){
		if(3 * N < 4 * h)break;
		if(3500 * N + 2 * h * N > 4 * 3500 * h)continue;
		for(uint64_t n = h;n<=3500;n++){
		if(n * N + 2 * h * N < 4 * n * h)continue;
		if(N * (n * 3500 + 3500 * h + h*n) > 4 * h * n * 3500)continue;
			for(int w=n;w<=3500;w++){
				if(4 * h * n * w == N * (n * w + w * h + h * n)){
					cout << h << " "<<n << " "<<w<<endl;
					return 0;
				}
			}
		}
	}
	std::exit(-1);
	return 0;
}


Measured memory_bytes: 256
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<cstdio>
#include<iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include<cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define infy  1000000000
#define all(x) begin(x),end(x)
#define ll long long int
#define ff first
#define ss second
#define pb push_back
const ll mod = 1000000007;
#pragma GCC optimization ("O3")
const int N = 1000010;
using namespace std;
vector<string> vec_splitter(string s) {
  s += ',';
  vector<string> res;
  while(!s.empty()) {
    res.push_back(s.substr(0, s.find(',')));
    s = s.substr(s.find(',') + 1);
  }
  return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
  if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
  stringstream ss; ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifndef ONLINE_JUDGE
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
ll lcm(ll a,ll b)
{
  return (a*b)/__gcd(a,b);
}
int main()
{
  // int x = -1, y = 10000;
  // double z = 0.2;
  // string s2 = "beginner1010";
  // long long b = 1LL << 60;
    
  // // debug(x, y, z, s, b);
    
  // double aux = 1010.0;
  // string code = "code";
    
  // debug(code + "forces",-aux / 10 * 2.3);
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n;
  cin >> n;
  set <int>s;
  for (int i = 0; i < n; ++i)
  {
    int a;
    cin >> a;
    s.insert(a);
  }
  if (s.size() == n)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}


Measured memory_bytes: 9728
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
int n,k;
bool dp[200010];
int main(){
    cin >> n >> k;
    vi a(n);rep(i,n) cin >> a[i];
    rep(i,200010) dp[i]=false;
    dp[0]=false;
    rep(i,100000){
        rep(j,n){
            if(!dp[i]) dp[i+a[j]]=true;
        }
    }
    if(dp[k]){
        cout << "First" << endl;
    }
    else cout << "Second" << endl;
    return 0;
}

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

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

int main() {
	int H, W;
	cin >> H >> W;
	vector<string> S(H);
	for (int n = 0; n < H; ++n) {
		cin >> S[n];
	}
	for (int n = 0; n < H; ++n) {
		for (int m = 0; m < W; ++m) {
			if ('#' == S[n][m]) {
				bool b = false;
				for (int l = 0; l < 4; ++l) {
					int x1 = n + dx[l];
					int y1 = m + dy[l];
					if ((0 <= x1) && (H > x1) && (0 <= y1) && (W > y1)) {
						if ('#' == S[x1][y1]) {
							b = true;
						}
					}
				}
				if (!b) {
					cout << "No" << endl;
					return 0;
				}
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define pa pair<int,int>
const int Maxn=300010;
const int inf=2147483647;
int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
    return x*f;
}
int n,a[Maxn],b[Maxn];char s[Maxn];
int main()
{
	n=read();
	scanf("%s",s+1);
	a[0]=0;
	for(int i=1;i<=n;i++)
	{
		a[i]=a[i-1];
		if(s[i]=='W')a[i]++;
	}
	b[n+1]=0;
	for(int i=n;i;i--)
	{
		b[i]=b[i+1];
		if(s[i]=='E')b[i]++;
	}
	int ans=inf;
	for(int i=1;i<=n;i++)ans=min(ans,a[i-1]+b[i+1]);
	printf("%d",ans);
}

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

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

int main(void)
{
    ll n; cin>>n;
    ll ans=0;
    for(int i=1;i<=n;i++){
        if(i%3==0||i%5==0) continue;
        ans+=i;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3612
R, G, B, N = map(int, input().split())

ret = 0

for r in range(N + 1):
    for g in range(N - r + 1):
        bB = (N - R * r - G * g)
        if bB >= 0 and bB % B == 0:
            ret += 1

print(ret)


Measured memory_bytes: 2940
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N, M = mi()
xyz = li2(N)

sign = [[1, 1, 1], [1, 1, -1], [1, -1, 1], [1, -1, -1], [-1, 1, 1], [-1, 1, -1], [-1, -1, 1], [-1, -1, -1]]
ans = 0

for i in range(8):
    A = [sum(xyz[x][k] * sign[i][k] for k in range(3)) for x in range(N)]

    A = sorted(A, reverse=True)

    ans = max(ans, sum(A[:M]))

print(ans)

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

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n, a, b; cin >> n >> a >> b;
	if ((a & 1) == (b & 1)) cout << "Alice\n";
	else cout << "Borys\n";
}

Measured memory_bytes: 256