akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int f[100];
int main()
{
    int n;
    cin >> n;
    for(int i=1;i<=9;i++)
        for(int j=1;j<=9;j++)
            f[i*j]=1;
    if(f[n])
        cout<<"Yes\n";
    else
        cout << "No\n";
    return 0;
}




Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a, b;
	int cnt;
	int flag = 0;
	
	while (scanf("%d %d", &a, &b) != EOF){
		if (a == 0 && b == 0) break;
		
		if (flag == 0){
			flag = 1;
		}
		else {
			printf("\n");
		}
		
		cnt = 0;
		while (a <= b){
			if ((a % 4 == 0) && (a % 100 != 0) || (a % 400 == 0)){
				printf("%d\n", a);
				cnt = 1;
				a += 4;
			}
			else {
				a++;
			}
		}
		if (cnt == 0){
			printf("NA\n");
		}
	}
	
	return (0);
}

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

void trace(int A[],int N) {
    for (int i=0; i<N; i++) {
       printf("%s%d",((i==0)?"":" "),A[i]);
    }
    printf("\n");
}
void insertionSort(int A[],int N) {
    for (int i=1; i<N; i++) {
        int v=A[i];
        int j=i-1;
        while (j>=0 && A[j]>v) {
            A[j+1]=A[j];
            j--;
        }
        A[j+1]=v;
        trace(A,N);
    }
}
int main() {
    int N;
    cin >> N;
    int A[N];
    for (int i=0; i<N; i++) {
        cin >> A[i];
    }
    trace(A,N);
    insertionSort(A,N);
    return 0;
}

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

void file() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

void fast()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL); cout.tie(NULL);
}

const int P = 1e9 + 7;

ll modInv(ll a, ll b){
 return 1<a ? b - modInv(b%a,a)*b/a : 1;
}

ll modDivide(ll a, ll b)
{
    a %=P;
    ll inv = modInv(b, P);
    return (inv * a) % P;
}

int main(int argc, char const *argv[])
{
    // file();
    
    ll n, k;cin>>n>>k;
    ll A[2002];

    for (int i = 0; i < n; ++i)
    {
        cin>>A[i];
    }
    
    ll self_inv = 0;

    for (int i = 0; i < n - 1; ++i)
    {
        for (int j = i + 1; j < n; ++j)
        {
            self_inv+=A[i] > A[j];
        }
    }

    ll type1_inv = (self_inv % P * k % P) % P; // self inverse * number of copies

    ll cp_inv = 0;

    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < n; ++j)
        {
            cp_inv+=A[i] > A[j];
        }
    }
    ll pairs_cnt = modDivide(k % P * (k - 1) % P, 2); // number of ways to choose pair (k * (k - 1)) / 2 but with modInverse
    ll type2_inv = (pairs_cnt % P * cp_inv % P) % P; // inverse_between_pair * number_of_pairs

    cout<<(type1_inv % P + type2_inv % P) % P;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	string a,b;cin>>a>>b;
	int c=stoi(a+b);
	for(int i=1;i<c;i++){
		if(c==pow(i,2)){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define mod 1000000007 
#define rep(i,j,l) for(int i=j;i<=l;i++)
#define dec(i,j,l) for(int i=j;i>=l;i--)
using namespace std;
typedef long long ll;
typedef unsigned long long ull; 
int arr[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};


int main() {                                     
 ll a,b,c;
 cin>>a>>b>>c;  
  ll x,y;
  x=(a+b-c);
  x*=x;
  y=4*a*b;  
  if(c-a-b < 0) 
  cout<<"No";
  else if(x>y)
  cout<<"Yes";
  else cout<<"No";
}


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

using namespace std;

typedef long long ll;

int main() {
  ll X, Y, ans;
  
  cin >> X >> Y;
  
  if (X % Y == 0) {
    cout << -1 << endl;
    
    return 0;
  }
  
  cout << X * (Y - 1) << endl;
  
  return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, [ $t:tt ]) => {{
    let len = read_value!($iter, usize);
    (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  }};

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn next(mut x: Vec<i8>) -> Vec<i8> {
  let n = x.len();
  let mut incr = 0;
  while incr < n && x[incr] == 9 || incr+1 < n && x[incr+1] < x[incr] {
    incr += 1;
  }
  if incr < n {
    x[incr] += 1;
    for i in (0 .. incr).rev() {
      x[i] = cmp::max(x[i+1]-1, 0);
    }
  } else {
    x = vec![0; n+1];
    *x.last_mut().unwrap() = 1;
  }
  x
}

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    k: i32,
  }
  let mut x = vec![1];
  for _ in 1 .. k {
    x = next(x);
  }

  for &d in x.iter().rev() {
    puts!("{}", d);
  }
  puts!("\n");
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ln "\n"
#define pb push_back
#define pll pair<ll,ll>
#define ppll pair<ll,pll>
#define vll vector<ll>
#define vpll vector<pll>
#define vvll vector<vector<ll>>
#define sll stack<ll>
#define qll queue<ll>
#define mp make_pair
#define f first
#define s second
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define Test ll t;cin>>t; while(t--)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);
#define init(x,n,v) for(ll i=0;i<=n;i++) x[i]=v;
#define all(x) x.begin(),x.end()
ll MOD = 1e9+7 , MAX = 1e18 , k=1e9;
int main() 
{
	fast_io;
	ll n,k;
	cin>>n;
	vll a(n+1,0);
	for(ll i=1;i<n;i++) cin>>k , a[k]++;
	for(ll i=1;i<=n;i++) cout<<a[i]<<ln;
	return 0;
}

Measured memory_bytes: 4780
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
char c[16];
const char v[16]={'C','O','D','E','F','E','S','T','I','V','A','L','2','0','1','6'};
int s;
int main()
{
	scanf("%s",c);
	for(int i=0;i<16;i++)if(c[i]!=v[i])s++;
	printf("%d\n",s);
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void solve() {
        Int N;
        cin >> N;
        Int K;
        cin >> K;
        string S;
        cin >> S;

        Int val = 0;
        Int tval = 0;
        char state = ' ';
        for (int i = 0; i < N; ++i) {
            if (state == ' ') {
                state = S[i];
                tval++;
            } else if (i + 1 == N) {
                if (state == S[i]) tval++;
                val += max(0ll, tval - 1);
            } else if (state != S[i]) {
                state = S[i];
                val += max(0ll, tval - 1);
                tval = 1;
            } else {
                tval++;
            }
        }

        Int ans = min(N - 1, val + K * 2);
        cout << ans << endl;

    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 888
R, G, B, N = map(int, input().split())
ans = 0
for r in range(N//R+2):
    for g in range((N-R*r)//G+2):
        b = (N-R*r-G*g)/B
        if b == int(b) and b >= 0:
            ans += 1
print(ans)


Measured memory_bytes: 41308
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define leading zero str.erase(0, min(str.find_first_not_of('0'), str.size()-1));
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
string text="abcdefghijklmnopqrstuvwxyz";
const int maxn=1e6+7;
//        .--------------.
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'
ll bin_pow(ll a,ll b,ll m)
{
    ll res=1;
    a%=m;
    while(b>0)
    {
        if(b&1)
            res=res*a%m;
        b>>=1;
        a=a*a%m;
    }
    return res;
}
bool miller_rabin(ll d,ll n)
{
    ll a=2+rand()%(n-4);
    ll x=bin_pow(a,d,n);
    if(x==1 || x==n-1)
        return true;
    while(d!=n-1)
    {
        x=(x*x)%n;
        d*=2;
        if(x==1)
            return false;
        if(x==n-1)
            return true;
    }
    return false;
}
bool prime(ll n,ll k)
{
    if(n==1 || n==4)
        return false;
    if(n<=3)
        return true;
    ll d=n-1;
    while(d%2==0)
        d/=2;
    for(int i=0; i<k; i++)
    {
        if(!miller_rabin(d,n))
            return false;
    }
    return true;
}
int n;
string s;
ll ans = 0;

void solve(ll x,ll y){
    if(x==n+1){
        ans += y;
        return;
    }
    ll cur = 0;
    for(ll i=x;i<=n;i++){
        cur = (10*cur) + (s[i]-'0');
        solve(i+1,y+cur);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int a[n+2];
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    multiset<int>s;
    int j=0,mx=0;
    for(int i=0;i<n;i++){
        s.emplace(a[i]);
        while(*s.rbegin()-*s.begin()>2){
            s.erase(s.find(*s.begin()));
        }
        mx=max(mx,(int)s.size());
    }
    cout<<mx<<endl;
}


Measured memory_bytes: 8692
#include<iostream>
#include<vector>
using namespace::std;
#define int long long int
#define MOD 1000000007
int dp[100005][2];
vector<int> v[100005];

void DFS(int i,int p=0){
	for(auto a:v[i])
		if(a!=p)
			DFS(a,i),dp[i][0]=(dp[i][0]*dp[a][1])%MOD,dp[i][1]=(dp[i][1]*((dp[a][0]+dp[a][1])%MOD))%MOD;
}

main(){
	ios_base::sync_with_stdio(0);
	int n;
	cin>>n;
	for(int i=1,l,r;i<n;i++)
		cin>>l>>r,v[l].push_back(r),v[r].push_back(l);
	for(int i=1;i<=n;i++)
		dp[i][0]=dp[i][1]=1;
	DFS(1);
	cout<<(dp[1][0]+dp[1][1])%MOD<<'\n';
}


Measured memory_bytes: 14208
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(int i=0;i<(int)(n);i++)
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
const int inf=1e9+1;
template <class T>
void print(T x){cout << x << '\n';}



void solve(long long N, long long H, std::vector<long long> a, std::vector<long long> b){

  ll amax=*max_element(a.begin(), a.end());
  sort(b.begin(),b.end());
  b.erase(remove_if(b.begin(), b.end(), [amax](ll x) {return amax>x;} ), b.end());

  ll s=0;
  REP(i, b.size()){
    s+=b[b.size()-i-1];
    if(s>=H){
      print(i+1);
      return;
    }
  }

  ll ans=(ll)ceil((long double)(H-s)/(*max_element(a.begin(), a.end()))) + b.size();
  print(ans);
}

int main(){
  long long N;
  scanf("%lld",&N);
  long long H;
  scanf("%lld",&H);
  std::vector<long long> a(N);
  std::vector<long long> b(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&a[i]);
    scanf("%lld",&b[i]);
  }
  solve(N, H, std::move(a), std::move(b));
  return 0;
}


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

int main() {
	int n;
	string s,t;
	cin >> n >> s >> t;
	int k=n;
	for(int i=0;i<n;i++)
	{
		if(s.substr(i,n-i)==t.substr(0,n-i))
		{
			break;
		}
		k++;
	}
    cout << k << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int a,b,c,tmp;
  scanf("%d %d %d",&a,&b,&c);

  if(a>b){
    tmp = a;
    a = b;
    b = tmp;
  }
  if(a>c){
    tmp = a;
    a = c;
    c = tmp;
  }
  if(b>c){
    tmp = b;
    b = c;
    c = tmp;
  }

  printf("%d %d %d\n",a,b,c);
  
  return 0;
}

Measured memory_bytes: 596
def gi; gets.to_i end
def gs; gets.chomp end
def gli; gets.split(' ').map(&:to_i) end
def d(n); Math.log10(n).to_i + 1 end
class Integer
  # 約数の組み合わせを列挙する
  def divisor_combinations
    (1..Math.sqrt(self).to_i).
      select { |i| self % i == 0 }.
      map { |i| [i, self / i] }
  end
end

N = gi.to_f

puts (N / 2).ceil / N


Measured memory_bytes: 1916
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	int N, M;
	cin >> N >> M;
	
	vector <int> a(M), b(M);
	for(int i = 0; i < M; i++)
		cin >> a[i] >> b[i];
	
	int count = 0;
	int start = 1, end;
	while(1){
		end = -1;
		for(int i = 0; i < M; i++){
			if(a[i] <= start && b[i] >= start){
				if(b[i] > end){
					end = b[i];
				}
			}
		}
		if(end == -1){
			cout << "Impossible" << endl;
			break;
		}
		
		start = end + 1;
		count++;
		
		if(end > N - 1){
			cout << count << endl;
			break;
		}
		if(count == N){
			cout << "Impossible" << endl;
			break;
		}
	}
	
	return 0;
}

Measured memory_bytes: 1196
#include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
struct unionfind{
  int par[100010]; // 親ノード  必要に応じて要素数を変えよう
  int rank[100010]; // ランク　必要に応じて要素数を変えよう
  unionfind(int n){
    init(n);
  }
  void init(int n){
    for(int i=0;i<=n;i++){
      par[i]=i;
      rank[i]=1;
    }
  }
  int root(int x) {
    if (par[x] == x) {
      return x;
    }
    else {
      return par[x] = root(par[x]);
    }
  }
  int size(int x){
    return rank[root(x)];
  }
  bool same(int x,int y) {
    return root(x) == root(y);
  }
  void unite(int x,int y) {
    x=root(x);
    y=root(y);
    if(x==y){
      return;
    }
    if(rank[x]<rank[y]){
      swap(x,y);
    }
    rank[x]=rank[x]+rank[y];
    par[y]=x;
  }
};
int main(){
  int n,m,a[100010],x,y,ans=0,i;
  scanf("%d %d\n",&n,&m);
  unionfind tree(n);
  for(i=1;i<=n;i++){
    scanf("%d ",&a[i]);
  }
  for(i=0;i<m;i++){
    scanf("%d %d\n",&x,&y);
    tree.unite(x,y);
  }
  for(i=1;i<=n;i++){
    if(a[i]==i){
      ans++;
    }
    else if(tree.same(i,a[i])==1){
      ans++;
    }
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    if(n==1) cout<<1<<endl;
    else if(n<4) cout<<2<<endl;
    else if(n<8) cout<<4<<endl;
    else if(n<16) cout<<8<<endl;
    else if(n<32) cout<<16<<endl;
    else if(n<64) cout<<32<<endl;
    else cout<<64<<endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.function.*;
import java.math.*;
public class Main {
    public static void main(String[] args){
Scanner s = new Scanner(System.in);
		int H = Integer.valueOf(s.next());
		int W = Integer.valueOf(s.next());
		int[] start = new int[4]; //y, x, 歩数, ワープ
		int[] goal = new int[2];
		start[0] = Integer.valueOf(s.next()) - 1;
		start[1] = Integer.valueOf(s.next()) - 1;
		goal[0] = Integer.valueOf(s.next()) - 1;
		goal[1] = Integer.valueOf(s.next()) - 1;

		int[][] maze = new int[H][W];
		char[] cur;
		for(int i = 0; i < H; i++) {
			cur = s.next().toCharArray();
			for(int j = 0; j < W; j++) {
				maze[i][j] = cur[j] == '.' ? -1 : -2;
			}
		}

		int[] vx = {1, 0, -1, 0};
		int[] vy = {0, -1, 0, 1};
		int[][] vxw = new int[4][5];
		int[][] vyw = new int[4][5];

		vxw[0] = new int[]{2, 2, 2, 2, 2}; //20個
		vyw[0] = new int[]{2, 1, 0, -1, -2}; //20個
		vxw[1] = new int[]{1, 1, 0, -1, -1}; //20個
		vyw[1] = new int[]{-1, -2, -2, -2, -1}; //20個
		vxw[2] = new int[]{-2, -2, -2, -2, -2}; //20個
		vyw[2] = new int[]{-2, -1, 0, 1, 2}; //20個
		vxw[3] = new int[]{-1, -1, 0, 1, 1}; //20個
		vyw[3] = new int[]{1, 2, 2, 2, 1}; //20個

		PriorityQueue<int[]> Q = new PriorityQueue<>((a, b) -> Integer.compare(a[3], b[3]));
		Q.add(start);

		int[] now;
		int[] tmp = new int[4];
		int ret = -1;
		while(!Q.isEmpty()) {
			now = Q.poll();

			for(int i = 0; i < 4; i++) {
				tmp[0] = now[0] + vy[i];
				tmp[1] = now[1] + vx[i];

				// 範囲内チェック
				if(-1 < tmp[0] && tmp[0] < H && -1 < tmp[1] && tmp[1] < W) {

					// 一回も行ってない
					if(maze[tmp[0]][tmp[1]] > now[3] || maze[tmp[0]][tmp[1]] < 0) {

						// 迷路が壁以外
						if(maze[tmp[0]][tmp[1]] != -2) {

							// ゴール
							if(tmp[0] == goal[0] && tmp[1] == goal[1]) {
								System.out.println(now[3]);
								return;
							}

							maze[tmp[0]][tmp[1]] = now[3]; // 迷路の値を更新
							Q.add(new int[] {tmp[0], tmp[1], 0, now[3]});

						// 迷路が壁
						}else {

							for(int j = 0; j < 5; j++) {
								tmp[0] = now[0] + vyw[i][j];
								tmp[1] = now[1] + vxw[i][j];

								// 範囲内チェック
								if(-1 < tmp[0] && tmp[0] < H && -1 < tmp[1] && tmp[1] < W) {

									// 一回も行ってない
									if(maze[tmp[0]][tmp[1]] > now[3] || maze[tmp[0]][tmp[1]] < 0) {
										// 迷路が壁以外
										if(maze[tmp[0]][tmp[1]] != -2) {

											// ゴール
											if(tmp[0] == goal[0] && tmp[1] == goal[1]) {
												System.out.println(now[3] + 1);
												return;
											}
											maze[tmp[0]][tmp[1]] = now[3] + 1; // 迷路の値を更新
											Q.add(new int[] {tmp[0], tmp[1], 0, now[3] + 1});
											j++;
										}
									}
								}
							}
						}
					}
				}
			}
		}
		System.out.println(ret);
	}
}

Measured memory_bytes: 64056
#include"bits/stdc++.h"
#include<unordered_set>
#include<unordered_map>
#include<random>
using namespace std;
typedef long long ll;
const ll MOD = (ll)(1e9+7);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(int)(n); (i)++)
int dx[4]={ 1,0,-1,0 };
int dy[4]={ 0,1,0,-1 };

int A, B, C, D;

signed main(){
	cin >> A >> B >> C >> D;
	while(A > 0 && C > 0){
		C -= B;
		if(C <= 0) break;
		A -= D;
	}
	if(C <= 0) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 3628
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;


void solve(long long K){
	int v[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	cout << v[K-1] << endl;

}

int main(){
    long long K;
    scanf("%lld",&K);
    solve(K);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
/*	#include <boost/math/common_factor.hpp>  boost::math::lcm(10,20) ---> use it to find lcm. fill_n(&an[0][0],n*m,0); typedef long long ll;*/
using namespace std;
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define int long long 
#define PI pair<int , int >
#define mpr make_pair
#define ff first
#define ss second
#define endl "\n"
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define FO(i,a,b) for(int i = (int)a;i < (int)b;++i)
#define FE(i,a,b) for(int i = (int)a;i <= (int)b;++i)
const int MOD = 1e9+7;
const int MAXN = 1e5+3;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,-1,1};
#define print(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
bool cmp(PI p1,PI p2){
	if(p1.ff < p2.ff)return true;	// You should not be writing p1.ss <= p2.ss !!!
	else if(p1.ff == p2.ff){ if(p1.ss < p2.ss)return true; return false; }
	return false;
}

void solve(){
	int a,b,n;
	cin >> a >> b >> n;
	if(n < b){
		int t1 = (a*n);
		t1 /= b;
		cout << t1 << endl;
	}else{
		int t2 = (a*(b-1));
		t2 /= b;
		cout << t2 << endl;
	}
}
/* When you have to multiply many things , do it in different (multiple) lines, not in a single line .*/
int32_t main(){
	IO;
	#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	#endif // ONLINE_JUDGE
	// std::cout << std::setprecision(15); std::cout << std::fixed;
	int nT = 1;
	//cin >> nT;
	FE(i,1,nT)
		solve();
	return 0;
}


Measured memory_bytes: 3612
from collections import deque
from copy import deepcopy
import heapq

n, k = map(int, input().split())
v = list(map(int, input().split()))
v_sorted = sorted(v)

ans = 0
for i in range(k+1):
    if True:
        for nl in range(i+1):
            nr = min(k - nl, n-nl)
            ansl, ansr = 0, 0
            for n_trash in range(nl):
                ansll, ansrr = 0, 0
                hands = sorted(v[:nl-n_trash])
                for vv in hands:
                    if vv < 0 and n_trash > 0:
                        n_trash -= 1
                    else:
                        ansll += vv
                ansl = max(ansl, ansll)

            for n_trash in range(nr):
                ansrr = 0
                hands = sorted(v[-(nr-n_trash):])
                # print(hands, nr, n_trash)
                for vv in hands:
                    if vv < 0 and n_trash > 0:
                        n_trash -= 1
                    else:
                        ansrr += vv
                ansr = max(ansr, ansrr)
            # print(ansl, ansr)
            ans = max(ans, ansl + ansr)
    else:
        n_trash = n-i
        ans_cur = 0
        for vv in v_sorted:
            if vv < 0 and n_trash > 0:
                n_trash -= 1
            else:
                ans_cur += vv
        ans = max(ans, ans_cur)

print(ans)


Measured memory_bytes: 3444
#include<cstdio>
#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>

using namespace std;

const int CMax = 100002;

string S;
int A[26];

int main(){
    cin >> S;
    for (int i = 0; i < S.length(); i++){
        A[(int)(S[i] - 'a')]++;
    }

    bool tik = true;
    for (int i = 0; i < 26 && tik; i++) {
        if (A[i] == 0){
            cout << (char)(i + 'a') << endl;
            tik = false;
        }
    }

    if (tik){
        cout << "None" << endl;
    }
}


Measured memory_bytes: 512
#include <iostream>
#include <map>

using namespace std;

int main()
{
	int n;
	cin >> n;
	int a;
	map<long long, long long> mp;
	long long sum = 0;
	mp[sum]++;
	for (int i = 0; i < n; i++) {
		cin >> a;
		sum += a;
		mp[sum]++;
	}

	long long ans = 0;
	for (auto & i : mp) {
		ans += i.second * (i.second - 1) / 2;
	}
	cout << ans << endl;

	return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

int main(){
	int n, l; cin >> l >> n;
	cout << n << endl;
	rep(i, n){
		int x, w; cin >> x >> w;
		cout << -x << " " << w << endl;
	}
	return 0;
}

Measured memory_bytes: 1164
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect


def zz():
    return list(map(int, input().split()))


def z():
    return int(input())


def S():
    return input()


def C(line):
    return [input() for _ in range(line)]


N = z()
A = zz()
Q = z()
B, C = [], []
for i in range(Q):
    b, c = zz()
    B.append(b)
    C.append(c)
num_lis = [0]*(10**5 + 1)
# print(len(num_lis))
for a in A:
    num_lis[a] += 1
sum_A = sum(A)
# print(len(num_lis))
for i in range(Q):
    b, c = B[i], C[i]

    sum_A = sum_A + (num_lis[b])*c - num_lis[b]*b
    # print('b', b, 'c', c)
    # print(num_lis)
    # print(num_lis[c])
    num_lis[c] = num_lis[c] + num_lis[b]
    # print(num_lis[c])
    num_lis[b] = 0
    # print(num_lis)
    # print("==========")
    print(sum_A)


Measured memory_bytes: 40984
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using ll = long long;
using namespace std;

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.length() - 1; i++) {
    for (int j = i + 1; j < s.length(); j++) {
      if (s[i] == s[j]) {
        cout << "no" << endl;
        return 0;
      }
    }
  }
  cout << "yes" << endl;
}


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  ll l,r;
  bool judge = true;
  string s;cin>>s;
  vector<string> a={"maerd","remaerd","esare","resare"};
  reverse(ALL(s));
  for(i=0;i<s.size();){
    buf=i;
    for(j=0;j<4;j++){
      if(s.substr(i,a[j].size())==a[j])
      i+=a[j].size();
    }
    if(buf==i){judge=false;break;}

  }
  ans2(judge);
  return 0;
}

Measured memory_bytes: 512
#include <stdio.h>

int main(void) {
	int M;
	int A[100000] = {0};
	int i;
	int a, b;
	int n;

	scanf("%d %d", &n, &M);


	for (i = 0; i < M; i++) {
		scanf("%d %d", &a, &b);
		A[a - 1]++;
		A[b - 1]++;
	}
	
	for (i = 0; i < n; i++) {
		printf("%d\n", A[i]);
	}

	return 0;
}


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

using namespace std;
typedef pair<int,int> pii;
typedef long long int ll;

#define INF 1 << 30
#define REP(i,n) for(ll i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(ll i=(k);i<(int)(n);i++)

int n;
int cnt[2][100002];
int ans;
int so[2][2];

int main(){
  cin >> n;
  REP(i,2)REP(j,100002) cnt[i][j] = 0;
  REP(i,n/2){
    int a,b;
    cin >> a >> b;
    cnt[0][a]++;
    cnt[1][b]++;
  }
  REP(i,2)REP(j,2){
    so[i][j] = 100001;
  }
  REP(i,2){
    REP(j,100001){
      if(so[i][0] == 100001 || cnt[i][j]>=cnt[i][so[i][0]]){
        so[i][1] = so[i][0];
        so[i][0] = j;
        continue;
      }
      if(so[i][1] == 100001 || cnt[i][j]>=cnt[i][so[i][1]]){
        so[i][1] = j;
      }
    }
  }
  if(so[0][0] == so[1][0]){
    ans = max(cnt[0][so[0][0]]+cnt[1][so[1][1]],cnt[0][so[0][1]]+cnt[1][so[1][0]]);
  }else{
    ans = cnt[0][so[0][0]]+cnt[1][so[1][0]];
  }
  cout << n -ans<<endl;
}


Measured memory_bytes: 1024
//
// Created by Mahmoud Rashad on 11/27/19.
//

#include <bits/stdc++.h>


using namespace std;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<pair<ii, ii>> vii;

int main() {
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.out", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0), cout.precision(10), cout << fixed;

    int n;
    cin >> n;
    if (n == 1) {
        cout << 0 << '\n';
        return 0;
    }

    cout << 1LL * n * (n - 1) / 2 << '\n';

    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

// n!
ll Perm(ll n){
    ll ret = 1;
    FOR(i, 1, n+1){
        ret = ret * i % mod;
    }
    return ret;
}

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

    // input
    int N, M;
    cin >> N >> M;

    ll answer;
    if(abs(N-M)>1){
        answer = 0;
    }    
    else if(N>M){
        // Nを外側に配置
        answer = Perm(N) * Perm(M) % mod;
    }
    else if(N<M){
        // Mを外側に配置
        answer = Perm(N) * Perm(M) % mod;
    }
    // N == M
    else{
        answer = Perm(N) * Perm(M) * 2 % mod;
    }

    p(answer);

    return 0;
}

Measured memory_bytes: 256
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

typedef long double ld;
typedef long long ll;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1.0);

const int mod = (int) 1e9 + 7;

void add(int &x, int y) {
  if ((x += y) >= mod) {
    x -= mod;
  }
}

int mult(int x, int y) {
  return (long long) x * y % mod;
}

int myPower(int x, int pw) {
  int res = 1;
  for (; pw; pw >>= 1) {
    if (pw & 1) {
      res = mult(res, x);
    }
    x = mult(x, x);
  }
  return res;
}

void precalc() {
}


const int maxn = 510;
int a[maxn];

int n;

int read() {
  if (scanf("%d", &n) < 1) {
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
    --a[i];
  }
  return 1;
}

const int maxv = maxn * maxn;
int ans[maxv];

pair<int, int> tosort[maxn];

void solve() {
  for (int i = 0; i <= n * n; ++i) {
    ans[i] = -1;
  }

  for (int i = 0; i < n; ++i) {
    ans[a[i]] = i;
    tosort[i] = mp(a[i], i);
  }

  sort(tosort, tosort + n);
  {
    int pos = 0;
    for (int i = 0; i < n; ++i) {
      int v = tosort[i].second;
      for (int j = 0; j < v; ++j) {
        while (ans[pos] != -1) {
          ++pos;
        }
        if (pos > a[v]) {
          printf("No\n");
          return;
        }
        ans[pos] = v;
      }
    }
  }
  {
    int pos = n * n - 1;
    for (int i = 0; i < n; ++i) {
      int v = tosort[n - 1 - i].second;
      for (int j = 0; j < n - 1 - v; ++j) {
        while (ans[pos] != -1) {
          --pos;
        }
        if (pos < a[v]) {
          printf("No\n");
          return;
        }
        ans[pos] = v;
      }
    }
  }

  printf("Yes\n");
  for (int i = 0; i < n * n; ++i) {
    printf("%d%c", ans[i] + 1, " \n"[i == n * n - 1]);
  }
}

int main() {
  precalc();
#ifdef LOCAL
  freopen(TASK ".out", "w", stdout);
  assert(freopen(TASK ".in", "r", stdin));
#endif

  while (1) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n)-1;(i)>=0;(i)--)
#define forin(x,n) for(auto& (x) : n)
#define all(v) (v).begin(),(v).end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define inf 1000000000
#define llinf 1000000000000000
#define MAX 1000000


typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
typedef vector<pint> vpint;
typedef pair<int,pint> P;

int main(){
    string s;
    cin>>s;
    string a=s.substr(0,2);
    string b=s.substr(2,2);

    if("01"<=a && a<="12" &"01"<=b && b<="12"){
        cout<<"AMBIGUOUS"<<endl;
    }
    else if("00"<=a && a<="99" &"01"<=b && b<="12"){
        cout<<"YYMM"<<endl;
    }
    else if("01"<=a && a<="12" &"00"<=b && b<="99"){
        cout<<"MMYY"<<endl;
    }
    else{
        cout<<"NA"<<endl;
    }
    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define REPW(i,n) for(i=0;i<(int)(n);++i)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)   // c++14
#define SZ(c) ((int)c.size())
#define EXIST(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,v) os << *i << (i==end(v)-1 ? "" : "\n"); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,v) is >> * i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
        is >> p.first >> p.second; return is; }
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;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
    }
} before_main_function;
//------------------------------------------------------------------------------

int x[3][3];
signed main() {
    cin>>x[0][0]>>x[0][1]>>x[1][1];
    for(int k=0;;k++) {
        x[0][2]=(k-(x[0][0]+x[0][1]));
        x[2][2]=(k-(x[0][0]+x[1][1]));
        x[2][1]=(k-(x[0][1]+x[1][1]));
        x[1][2]=(k-(x[0][2]+x[2][2]));
        x[2][0]=(k-(x[2][1]+x[2][2]));
        x[1][0]=(k-(x[0][0]+x[2][0]));
        if(x[0][2]+x[1][1]+x[2][0]!=k) continue;
        if(x[1][0]+x[1][1]+x[1][2]!=k) continue;
        break;
    }
    REP(i,3) {
        REP(j,3) {
            cout<<x[i][j];
            if(j!=2) cout<<" ";
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
 
using namespace std;
 
int main()
{
vector<array<int, 2>> a;
array<int, 2> b;
 
do
{
	cin >>b[0] >>b[1];
	a.push_back(b);
}while(!(b[0] == 0 && b[1] == 0));

for(int i=0; i<a.size()-1; ++i)
{
	sort(a[i].begin(), a[i].end());
	cout <<a[i][0] <<" "<<a[i][1] <<endl;
}
 
return 0;
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
 
#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define F first
#define S second
#define mp make_pair
#define all(x) (x).begin(), (x).end()

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef array <ll, 2> pii;
typedef vector <int> vi;

typedef tree <pii, null_type, less <pii>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int x[5];

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	for (int i = 0; i < 5; i++) {
		cin >> x[i];
		if (x[i] == 0) {
			cout << i + 1;
			return 0;
		}
	}
}


Measured memory_bytes: 3612
//Twitter@KonoLv1 2020年春卒で現在就職活動中！
 
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
 
int main(void){
    int i,j;            //  ループ文に使用
    int x,y,z;
    int count1,count2,count;   //  カウント用に使用
    int box[256] = {};
    int box2[256] = {};
    int box3[256] = {};
    char s[200001] = {};        //  文字列
    char s2[200001] = {};        //  文字列
    int a,b,c,n,save;
    a = b = c = i = 0;
    save = -999;
    int mode = 0;
    count = count1 = count2 = 0;
 
    //  入力処理
    
    scanf("%d",&n);
            
    for (i = 0; i < n - 1; i++){
        scanf("%d",&box[i]);
    }
    
    box2[0] = box[0];
    
    for (i = 1; i < n - 1 ; i++){
        if (box[i] > box[i - 1]){
            box2[i] = box[i - 1];
        }else{
            box2[i] = box[i];
        }
    }
    
    box2[n - 1] = box[n - 2];
            
        
     
        
    
    //  計算処理

    for (i = 0; i < n; i++){
        count = count + box2[i];
    }
  
    //  出力処理

    printf("%d",count);

 
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>

using namespace std;

int main() {
    size_t n, m;
    cin >> n >> m;
    vector<int> a(n + 1, 0);
    for (size_t i = 0; i < m; ++i) {
        size_t j;
        cin >> j;
        a[j] = 1;
    }
    vector<size_t> s(n + 1, 0);
    s[0] = 1;
    for (size_t i = 1; i <= n; ++i) {
        if (!a[i]) {
            if (i > 1)
                s[i] += s[i - 2];
            s[i] += s[i - 1];
            s[i] %= 100'000'0007;
        }

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

Measured memory_bytes: 1408
#include <stdio.h>

int main() {
    /*
    long long x = 1;
    
    for(int i = 0; i < 40; ++i) {
        x *= 2;
        printf("%d %lld\n", i+1, x);
    }
    return 0;
    */

    long long n, a, b;
    
    scanf("%lld%lld%lld", &n, &a, &b);
    
    long long total = 0, resposta = 0;
    
    long long ciclosCompletos = n / (a+b);
    resposta = ciclosCompletos * a;
    long long sobra = n % (a+b);
    
    if (sobra <= a) 
        resposta += sobra;
    else
        resposta += a;
    /*
    
    for(;;) {
        if (total + a <= n) {
            total += a;
            resposta += a;
        } else {
            resposta += n - total;
            break;
        }
        
        if (total + b <= n)
            total += b;
        else
            break;
    }
    */
    
    printf("%lld\n", resposta);
    

    return 0;
}









Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout<<(a)<<endl
#define VECIN(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;

int main(){
	int n,d,ans;
    cin>>n>>d;
    ans=(n+2*d)/(2*d+1);
    OUT(ans);
	return 0;
}

Measured memory_bytes: 256
s = str(input())
t = list(s)
t.sort()
a = []
b = 1
for i in range(len(t)):
    if i >= 1:
        if t[i] == t[i-1]:
            b = b + 1
        else:
            a.append(b)
            b = 1
a.append(b)
for i in range(len(a)):
    if a[i] % 2 != 0:
        print("No")
        break
    else:
        if i == len(a) - 1:
            print("Yes")   

Measured memory_bytes: 3064
Month = [0,1,2,3,4,5,6,7,8,9,10,11,12]
Day = [31,28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

IN = list(map(int, input().split()))
_month1 = IN[0]
_day1 = IN[1]

IN = list(map(int, input().split()))
_month2 = IN[0]
_day2 = IN[1]

if _month1 == 1:
    if _day1 == 31:
        print(1)
    else:
        print(0)
        
if _month1 == 2:
    if _day1 == 28:
        print(1)
    else:
        print(0)

if _month1 == 3:
    if _day1 == 31:
        print(1)
    else:
        print(0)

if _month1 == 4:
    if _day1 == 30:
        print(1)
    else:
        print(0)
        
if _month1 == 5:
    if _day1 == 31:
        print(1)
    else:
        print(0)

if _month1 == 6:
    if _day1 == 30:
        print(1)
    else:
        print(0)

if _month1 == 7:
    if _day1 == 31:
        print(1)
    else:
        print(0)
        
if _month1 == 8:
    if _day1 == 31:
        print(1)
    else:
        print(0)

if _month1 == 9:
    if _day1 == 30:
        print(1)
    else:
        print(0)

if _month1 == 10:
    if _day1 == 31:
        print(1)
    else:
        print(0)
        
if _month1 == 11:
    if _day1 == 30:
        print(1)
    else:
        print(0)

if _month1 == 12:
    if _day1 == 31:
        print(1)
    else:
        print(0)

Measured memory_bytes: 3064
#include<iostream>

int main(){
    long long int a,b;
    int c;
    c=0;
    b=100;
    std::cin>>a;
    while(true){
        b=b*1.01;
        c++;
        if(b>=a)break;
    }
    std::cout<<c<<std::endl;
    return 0;
}


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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    string s; cin >> s;
    int n = s.length();
    if (n & 1) {
        cout << "No" << endl;
        return 0; 
    }
    for (int i = 0; i < n - 1; i++) {
        if (i & 1) continue;
        if (s[i] != 'h' ||  s[i + 1] != 'i') {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
AC = Counter(A)
BC = Counter(B)
for i in BC.keys():
    if i in AC and BC[i] + AC[i] > N:
        print("No")
        exit()
AL,AR = {},{} 
BL,BR = {},{}
for i in range(N):
    if not A[i] in AL:
        AL[A[i]] = i
    AR[A[i]] = i

for i in range(N):
    if not B[i] in BL:
        BL[B[i]] = i
    BR[B[i]] = i
can = [1]*(N)

for i in BL.keys():
    if not i in AL:
        continue
    s = (N+AL[i]-BR[i])%N
    e = (N+AR[i]-BL[i])%N
    if e<s:
        e += N
    # print(i,s,e)
    for j in range(s,e+1):
        can[j%N] = 0

if 1 in can:
    print("Yes")
    ind = can.index(1)
    print(* (B+B)[N-ind:2*N-ind])
else:
    print("No")


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

using namespace std;
using ll =long long;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> PII;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
using P = pair<int,int>;
//Write From this Line

int main()
{
	int n, a, b;
	cin >> n >> a >> b;
	string s;
	cin >> s;

	int foreign = 1;
	int pas = 0;
	rep(i,n){
		if(s[i] == 'a'){
			if(pas < a + b){
				cout << "Yes" << endl;
				pas++;
			} else {
				cout << "No" << endl;
			}
		}
		else if(s[i] == 'b'){
			if(pas < a + b && foreign <= b){
				cout << "Yes" << endl;
				pas++;
			} else {
				cout << "No" << endl;
			}
			foreign ++;
		}
		else {
			cout << "No" << endl;
		}
	}
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5+10;
int l[maxn], r[maxn];
int main(){
  	int n;
  	cin>>n;
  	for (int i=1;i<=n;i++) cin>>l[i]>>r[i];
  	sort(l+1,l+1+n);
  	sort(r+1,r+1+n);
 	int a=(n & 1)?l[(n+1)/2]:l[n/2]+l[n/2+1];
  	int b=(n & 1)?r[(n+1)/2]:r[n/2]+r[n/2+1];
  	cout<<b-a+1<<endl;
	return 0;
}

Measured memory_bytes: 5156
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <utility>
#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;

int main() {
    char b;
    cin >> b;
    char ans;
    if(b == 'A') ans = 'T';
    else if(b == 'T') ans = 'A';
    else if(b == 'C') ans = 'G';
    else if(b == 'G') ans = 'C';
    cout << ans << endl; 
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll a,b,c;
  cin >> a >> b >> c;
  if(c <= a-b) cout << 0;
  else cout << c-(a-b);
  return 0;
}

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

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

using namespace std;

int main() {
  int cnt = 1;
  while(1){
    int n;
    cin >> n;
    if(!n)break;
    vector<double> sx(n);
    vector<double> sy(n);
    vector<double> tx(n);
    vector<double> ty(n);
    vector<double> xa;
    vector<double> ya;
    REP(i,n) {
      double x,y,r;
      cin >> x >> y >> r;
      sx[i] = x - r;
      sy[i] = y - r;
      tx[i] = x + r;
      ty[i] = y + r;
      xa.push_back(sx[i]);
      xa.push_back(tx[i]);
      ya.push_back(sy[i]);
      ya.push_back(ty[i]);
    }
    xa.push_back(0.0);
    ya.push_back(0.0);
    sort(begin(xa),end(xa));
    sort(begin(ya),end(ya));
    auto xei = unique(begin(xa),end(xa));
    auto yei = unique(begin(ya),end(ya));
    xa.resize(xei-begin(xa));
    ya.resize(yei-begin(ya));
    vector<vector<int>> tb(ya.size(), vector<int>(xa.size()));
    REP(i,n){
      int begx = lower_bound(begin(xa),end(xa),sx[i]) - begin(xa);
      int begy = lower_bound(begin(ya),end(ya),sy[i]) - begin(ya);
      int edx = lower_bound(begin(xa),end(xa),tx[i]) - begin(xa);
      int edy = lower_bound(begin(ya),end(ya),ty[i]) - begin(ya);
      for (int j = begy; j < edy; ++j) {
        for (int k = begx; k < edx; ++k) {
          tb[j][k] = 1;
        }
      }
    }
    double area = 0.0;
    REP(i,ya.size() - 1){
      REP(j,xa.size() - 1){
        if(tb[i][j] == 1){
          area += (ya[i+1] - ya[i])*(xa[j+1] - xa[j]);
        }
      }
    }
    printf("%d %.2lf\n", cnt, area);
    ++cnt;
  }
  return 0;
}

Measured memory_bytes: 1308