akhauriyash/Code-Regression huggingface dataset:
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	final static PrintStream so = System.out;
	final static Scanner sc = new Scanner(System.in);
	
	static String s;
	public static void main(String[] args) {
		char[] nums = sc.next().toCharArray();
		int pattern = (int) Math.pow(2, nums.length-1);
		long sum = 0;
		for (int i = 0; i < pattern; i++) {
			sum += f(nums, i);
		}
		so.println(sum);
	}
	
	// (1234, 3) -> "1plus2plus34" ...(3(10) = 011(2))
	static long f(char[] nums, int bits) {
		StringBuilder sb = new StringBuilder();
		sb.append(nums[0]);
		for (int i = 1; i < nums.length; i++) {
			if ((bits >> i-1 & 1) == 1)
				sb.append("plus");
			sb.append(nums[i]);
		}
		return parse(sb.toString());
	}
	
	// "1plus2plus34" -> 37 ...(1+2+34)
	static long parse(String eq) {
		String[] nums = eq.split("plus");
		long sum = Long.parseLong(nums[0]);
		for (int i = 1; i < nums.length; i++) {
			sum += Long.parseLong(nums[i]);
		}
		return sum;
	}
}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};

int main(){
    ll n,h,w,ans=0;
    cin>>n>>h>>w;
    
    for(int i = 0; i < n; i++)
    {
        ll a,b;
        cin>>a>>b;
        if(a>=h && b>=w) ans++;
    }
    
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define itn int

typedef long long ll;
typedef pair<ll,ll> p;
int h, w;

bool check(vector<string> v)
{
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      // cout << v[i][j];
      if(v[i][j] == '#') return false;
    }
    // cout << endl;
  }
  return true;
}

int main()
{
  cin >> h >> w;
  vector<string> v(h, "@");
  for (int i = 0; i < h; i++) {
    cin >> v[i];
  }
  v[0][0] = '@';
  int dx[2] = {1, 0};
  int dy[2] = {0, 1};

  queue<p> q;
  q.push({0, 0});
  while(q.size() != 0) {
    p tmp = q.front();
    for (int i = 0; i < 2; i++) {
      int ny = tmp.first + dy[i];
      int nx = tmp.second + dx[i];
      if(ny >= 0 && ny < h && nx >= 0 && nx < w && v[ny][nx] == '#')
      {
        q.push({ny, nx});
        v[ny][nx] = '@';
        break;
      }
      else continue;
    }
    q.pop();
  }

  bool flag = check(v);

  if(flag) cout << "Possible" << endl;
  else cout << "Impossible" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	for (auto& x : A) cin >> x;
	map<int,int> a;
	for (auto x : A) ++ a[x];
	const int M = 1000000;
	vector<bool> sieve(M+1);
	int r = 0;
	for (auto p : a) {
		int i = p.first;
		if (!sieve[i]) {
			if (p.second == 1) ++ r;
			for (int j = i; j <= M; j += i) sieve[j] = true;
		}
	}
	cout << r << endl;
}


Measured memory_bytes: 13388
list = {}
list["a"] = gets.chomp.split("")
list["b"] = gets.chomp.split("")
list["c"] = gets.chomp.split("")

turn = "a"
win = "x"

while true do
    turn = list[turn].shift
    if list[turn].empty?
        win = turn
        break
    end
end

puts win.upcase

Measured memory_bytes: 1788
#include <stdio.h>
int main(void){
    // Your code here!
    int a,b,c,n;
    scanf("%d %d %d",&a,&b,&c);
    if (a > b) {
        n = a;
        a = b;
        b = n;
    }
    if (b > c) {
        n = b;
        b = c;
        c = n;
    }
    if (a > b) {
        n = a;
        a = b;
        b = n;
    }
    printf("%d %d %d\n",a,b,c);
}



Measured memory_bytes: 2108
#include <iostream>
#define llint long long

using namespace std;

llint N;
llint sum[100000];

int main(void)
{
	cin >> N;
	
	llint s = 0;
	for(int i = 1; i < 100000; i++){
		s += i;
		sum[i] = s;
	}
	
	for(int i = 99999; i >= 0; i--){
		if(sum[i] < N){
			cout << i+1 << endl;
			N -= i+1;
		}
	}
	return 0;
}

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

using namespace std;

#define LIMIT 100
#define MOD 1000000007ll
#define INF 1e9
typedef long long ll;
typedef pair<ll, ll> ii;
int gcd(ll a, ll b) { return (b==0)?a:gcd(b, a%b); }
int lcm(ll a, ll b) { ll i=(a/gcd(a,b))*b; assert(i>0); return i; }

//  ***** MAIN *****
int main(){

  //ios::sync_with_stdio(false);
  cin.tie(NULL);

  int n; cin >> n;
  int p = 0, w = 0, g = 0, y = 0;
  char c;
  for (int i = 0; i < n; ++i) {
    cin >> c;
    if(c == 'P') p = 1;
    if(c == 'G') g = 1;
    if(c == 'Y') y = 1;
    if(c == 'W') w = 1;
  }

  if(p+g+y+w == 4){
    std::cout << "Four" << std::endl;
  }
  else if(p+g+y+w == 3){
    std::cout << "Three" << std::endl;
  }

  return 0;
}



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

int main(){
  int n;
  cin>>n;
  vector<int> num(n),ans(n);
  for(int i=0;i<n;i++){
    cin>>num[i];
  }
  for(int i=0;i<n;i++){
    int s1=0,s2=0;
    for(int j=0;j<n;j++){
      if(j<=i) s1+=num[j];
      else s2+=num[j];
    }
    ans[i]=abs(s1-s2);
  }
  sort(ans.begin(),ans.end());
  cout<<ans[0]<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>

using namespace std;

typedef long long ll;
typedef long double ld;

//#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define no {cout << 0; return;}
#define mkp make_pair
#define cerr if(0) cerr

void solve() {
    int x, n;
    cin >> x >> n;
    vector <int> a(n + 2);
    a[0] = -1;
    a[n + 1] = 105;
    loop1(i, n)
        cin >> a[i];
    sort(all(a));
    int it = lower_bound(all(a), x) - a.begin();
    if (a[it] != x) {
        cout << x; return;
    }
    while (a[it + 1] - a[it] == 1)
        ++it;
    int r = a[it] + 1;
    while (a[it - 1] == a[it] - 1)
        --it;
    int l = a[it] - 1;
    cout << (x - l <= r - x ? l : r);
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //int t; cin >> t; loop(i, t)
    solve();
    return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+20;
int n,c,k,a[N];
int main()
{
	while(cin>>n>>c>>k)
	{
		for(int i=1;i<=n;i++)
			cin>>a[i];
		sort(a+1,a+1+n);
		ll i=1,ans=0,mx;//
		while(i<=n)
		{
			mx=a[i]+k;
			int cnt=0;
			while(cnt<c)
			{
				if(mx>=a[i])
				{
					cnt++;
					i++;
				}
				else
				break;
			}
			ans++;
		}
		cout<<ans<<endl;
	}

	return 0;
}

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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	ll a, b;

	cin >> a >> b;

	if (a + b == 15) {
		cout << "+" << endl;
	}
	else if (a*b == 15) {
		cout << "*" << endl;
	}
	else {
		cout << "x" << endl;
	}
}

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

int main() {
  string S;
  cin >> S;
  int a[] = {0, 0, 0};
  for(int i=0;i<S.length();i++){
    a[S[i] - 'a'] = 1;
  }
  int sum = accumulate(a, a+3, 0);
  if(sum == 3)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18

A=rr(6)
k=A[-1]
if A[-2]-A[0] > k:
    print(":(")
else:
    print('Yay!')

Measured memory_bytes: 3316
module IO = struct

  (* @since 4.04.0 *)
  let split_on_char sep s =
    let open String in
    let r = ref [] in
    let j = ref (length s) in
    for i = length s - 1 downto 0 do
      if get s i = sep then begin
        r := sub s (i + 1) (!j - i - 1) :: !r;
        j := i
      end
    done;
    sub s 0 !j :: !r

  let read_ss () = read_line () |> split_on_char ' '

  let read_ns () = read_line () |> split_on_char ' ' |> List.map int_of_string

end

module SeguementTree = struct

  let default_val = ref 0

  let size = ref 0

  let make n init =
    default_val := init;
    let rec pow_of_2 i =
      if i >= n then i
      else pow_of_2 (2 * i) in
    size := pow_of_2 1;
    Array.make (2 * (!size) - 1) init

  let parent i = int_of_float ((float_of_int (i - 1)) /. 2.)

  let left i = 2*i + 1

  let right i = 2*i + 2

  let update (s : int array) i x =
    let j = !size + i - 1 in
    s.(j) <- x;
    let rec doit j =
      if j <= 0 then () else
      begin
        let p = parent j in
        let l = s.(left p) in
        let r = s.(right p) in
        s.(p) <- if l < r then l else r;
        doit p
      end in
    doit j

  let find s a b =
    let rec doit a b k l r =
      if r <= a || b <= l then !default_val
      else if a <= l && r <= b then s.(k)
      else begin
        let v = doit a b (left k) l ((l + r) / 2) in
        let w = doit a b (right k) ((l + r) / 2) r in
        if v < w then v else w
      end in
    doit a b 0 0 !size

end

module S = SeguementTree

let solve n q =
  let s = S.make n 2147483647 in
  for _ = 0 to q - 1 do
    match IO.read_ns () with
    | c :: x :: y :: _ ->
      if c = 0 then S.update s x y
      else (print_int (S.find s x (y + 1)); print_newline ())
    | _ -> assert false
  done

let () =
  match IO.read_ns () with
  | [n; q] -> solve n q
  | _ -> assert false

Measured memory_bytes: 6380
import java.io.{BufferedReader, InputStreamReader}

import scala.annotation.tailrec

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val n = in.readLine().toInt
    val ls = in.readLine().split("\\s+").map(_.toInt).sorted

    def countWhile(index: Int, cond: Int => Boolean): Int = {
      @tailrec
      def binarySearch(sIndex: Int, eIndex: Int): Option[Int] = {
        if (sIndex > eIndex) {
          None
        } else {
          val index = (eIndex + sIndex) / 2
          if (!cond(ls(index))) {
            binarySearch(sIndex, index - 1)
          } else {
            if (index == ls.length - 1) {
              Some(index)
            } else {
              if (!cond(ls(index + 1))) {
                Some(index)
              } else {
                binarySearch(index + 1, eIndex)
              }
            }
          }
        }
      }

      binarySearch(index, ls.length - 1) match {
        case Some(i) => i - index + 1
        case None => 0
      }
    }

    System.out.println(
      (for {
        ai <- 0 until ls.length - 2
        a = ls(ai)
        bi <- (ai + 1) until ls.length - 1
        b = ls(bi)
        apb = a + b
        amb = a - b
      } yield {
        countWhile(bi + 1, c => c < apb && amb < c && 0 < c + amb)
      }).sum
    )
  }
}


Measured memory_bytes: 151260
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <queue>
#include <utility>
#include <cmath>
#include <iomanip>
#include <map>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;
typedef pair<int,int> P;


int main() {
    lint L,R;
    cin >> L >> R;

    lint ans=20000;
    bool flag=false;





    for(lint i=L;i<L+2019;++i){
    	for(lint j=i+1;j<L+2020;++j){
    		ans = min(ans,(lint)i*j%2019);
    		//cout << i << " " << j << " " <<  i*j%2019 << endl;
        	if(i==R-1 && j==R){
        		flag = true;
        		break;
        	}
        	if(j==R) break;
    	}
    	if(flag) break;
    }



    cout << ans << endl;



}


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

int main(){
    ll k,count,temp,ans;
    cin >> k;
    queue<ll> que;
    count = 0;
    if(k < 10){
        cout << k << endl;
    }
    else{
        for(int i = 1; i < 10; i++){
            que.push(i);
            count++;
        }
        while(count < k){
            temp = que.front();
            que.pop();
            if(temp % 10 != 0){
                ans = temp * 10 + temp % 10 -1;
                que.push(ans);
              count++;
              //printf("countは%d,ansは%d\n",count,ans);
            }
            if(count == k) break;
          ans = temp * 10 + temp % 10;
          que.push(ans);
          count++;
          if(count == k) break;
          //temp = que.front();
            //que.pop();
            if(temp % 10 != 9){
                ans = temp * 10 + temp % 10 + 1;
                que.push(ans);
              count++;
              //printf("countは%d,ansは%d\n",count,ans);
            }
        }
        cout << ans << endl;


    }
    return 0;


}

Measured memory_bytes: 768
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define repd(i,a,b) for (int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N;
    cin >> N;
    vector<int> A(N);
    map<int, int> M;
    rep(i, N) {
        cin >> A[i];
        M[A[i]] = i;
    }
    sort(all(A));
    int cnt = 0;
    rep(i, N){
        if(abs(i - M[A[i]]) % 2 == 1){
            cnt++;
        }
    }
    
    output(cnt / 2, 0);
    
    
    
    return 0;
}

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

int main(){
    string str;
    int i;
    int a, b;
    string order, str1;

    cin >> str >> i;
    for(int j=0;j<i;j++){
        cin >> order >> a >> b;
        if(order == "replace"){
            cin >> str1;
            for(int k=0;k<b-a+1;k++)str[a+k]=str1[k];
        } else if(order=="reverse"){
            while(b - a > 0){
                swap(str[a], str[b]);
                a++;b--;
            }
        }else{
            cout << str.substr(a, b - a + 1) << endl;
        }
        // cout << str << endl;
    }


    return 0;
}


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

int main(){
    ll A, B, C, D, E, F; cin >> A >> B >> C >> D >> E >> F;
    pll res = pll(0,A*100);
    for(ll a = 0; a <= F; a+=100*A){
        for(ll b = 0; a + b <= F; b+=100*B){
            ll water = a + b;
            ll maxsugar = min(F-water,E*(water/100));
            for(ll c = 0; c <= maxsugar; c+=C){
                for(ll d = 0; c + d <= maxsugar; d+=D){
                    ll sugar = c + d;
                    pll tmp = pll(sugar,water);
                    if(res.first*(tmp.first+tmp.second) < tmp.first*(res.first+res.second)){
                        res = tmp;
                    }
                }
            }
        }
    }
    cout << res.first+res.second << " " << res.first << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
	int x, y;
	while (1)
	{
		scanf("%d %d", &x, &y);
		if (x == 0 && y == 0)break;
		if (x<y){
			printf("%d %d\n", x, y);
		}
		else{
			printf("%d %d\n", y, x);
		}
	}
	return 0;
}


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

int main()
{
	int n;
	long k;
	int q;
	int x;
	long a[100001];

	cin>>n>>k>>q;

	for (int i = 0; i < 100001; i++) {
		a[i] = 0;
	}

	for (int i = 0; i < q; i++) {
		cin >> x;
		a[x - 1] = a[x - 1] + 1;
	}
	
	for (int i = 0; i < n; i++) {
		if ( k-q+a[i] > 0) {
			cout << "Yes\n";
		}
		else {
			cout << "No\n";
		}
	}
}

Measured memory_bytes: 1408
#include <iostream>
#include <chrono>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main() {
	string str;
	cin >> str;
	int len = str.size();
	int s, t;
	for (int i = 0; i < len; i++) {
		if (str[i] == 'A') {
			s = i;
			break;
		}
	}
	for (int i = len - 1; i >= 0; i--) {
		if (str[i] == 'Z') {
			t = i;
			t++;
			break;
		}
	}
	cout << t - s << endl;
}



Measured memory_bytes: 640
#include <stdio.h>

int main(void)
{
	int n, m, l;
	int i, j, k;
	int a[100][100]={0};
	int b[100][100]={0};
	long int c[100][100]={0};

	scanf("%d%d%d", &n, &m, &l);


	for(i=0; i<n; i++){
		for(j=0; j<m; j++){
			scanf("%d", &a[i][j]);
		}
	}
	for(i=0; i<m; i++){
		for(j=0; j<l; j++){
			scanf("%d", &b[i][j]);
		}
	}

	for(i=0; i<n; i++){
		for(j=0; j<l; j++){
			for(k=0; k<m; k++){
				c[i][j] += a[i][k]*b[k][j];
			}
		}
	}
	for(i=0; i<n; i++){
		for(j=0; j<l; j++){
			if(j==l-1)
				printf("%ld\n", c[i][j]);
			else
				printf("%ld ", c[i][j]);
		}
	}
	return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int n;
    cin >> n;
    vector<int> d(3);  // d[0] = a, d[1] = b, d[2] = c;
    for (int i = 0; i < 3; i++) cin >> d[i];
    vector<pii> q;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        int a = 0, b = 1;
        if (s == "AB") a = 0, b = 1;
        if (s == "AC") a = 0, b = 2;
        if (s == "BC") a = 1, b = 2;
        q.emplace_back(a, b);
    }

    string ans;
    auto add = [&](int a, int b) {
        d[a]++;
        d[b]--;
        ans += 'A' + a;
    };

    // (A, B) = (0, 0) -> NO
    // (A, B) = (X > 0, 0) -> 1通り (A--, B++)
    // (A, B) = (X > 0, Y > 0) -> 次の手を先読みして詰まないようにする
    q.emplace_back(0, 1);  // 番兵;
    for (int i = 0; i < n; i++) {
        int a = q[i].first;
        int b = q[i].second;
        if (!d[a] && !d[b]) {
            cout << "No" << '\n';
            return 0;
        }
        if (!d[a]) {
            add(a, b);
        }
        else if (!d[b]) {
            add(b, a);
        }
        else {
            int na = q[i + 1].first;
            int nb = q[i + 1].second;
            if (a == na || a == nb) {
                add(a, b);
            }
            else {
                add (b, a);
            }
        }
    }
    cout << "Yes" << '\n';
    for (int i = 0; i < n; i++) {
        cout << ans[i] << '\n';
    }

}


Measured memory_bytes: 4292
#include <bits/stdc++.h>
//#include <ext/numeric>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define oo 0x3f3f3f3f
#define OO 0x3f3f3f3f3f3f3f3f
#define popcount(n) __builtin_popcount(n)
#define popcountll(n) __builtin_popcountll(n)

using namespace std;
//using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const double PI = acos(-1.0), EPS = 1e-6;
const long long inf = 2e12 + 12;
const int MAXN = 400005, MAXM = 102, Mod = 1000000007, MAXLog = 20;


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

	int n;
	cin >> n;
	vector<int> arr(n);
	int prev = 0;
	for (int i = 0; i < n; ++i) {
		cin >> arr[i];
		if (arr[i] < prev) {
			cout << "No\n";
			return 0;
		}
		prev = max(arr[i] - 1, prev);
	}

	cout << "Yes\n";


	return 0;
}


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

int main(){
  int n;
  double ave = 0;
  double sum = 0;
  int ans = 0;

  while(1){
    cin >> n;
    if(n==0){
      break;
    }

    int a[n];

    for(int i=0;i<n;i++){
      cin >> a[i];
      sum +=a[i];
    }
    ave = sum/n;

    for(int i=0;i<n;i++){
      if(ave>=a[i]){
        ans++;
      }
    }

    cout << ans << endl;
    sum = 0;
    ans = 0;
  }

  return 0;
}



Measured memory_bytes: 3024
import sys
input = sys.stdin.readline

N = int(input())
a = [int(x) for x in input().split()]

count = 0
now = 1

for i in range(N):
    if a[i] == now:
        now += 1
    else:
        count += 1
        
if now == 1:
    print(-1)
else:
    print(count)

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

int gcd(long long a, long long b){
  long long M = max(a, b), m = min(a, b);
  while(m != 0){
  	long long r = M%m;
    M = m; m = r;
  }
  return M;
}

int digit_sum(long long n){
  long long ans;
  while(n != 0){
  	ans += n%10;
  	n /= 10;
  }
  return ans;
}

int main(){
  int n, m;
  cin >> n >> m;
  priority_queue<long long> pq;
  
  for(int i = 0; i < n; i++){
  	long long a;
  	cin >> a;
  	pq.push(a);
  }
  
  for(int i = 0; i < m; i++){
  	long long a = pq.top();
  	a /= 2;
    pq.pop();
    pq.push(a);
  }
  
  long long ans = 0;
  for(int i = 0; i < n; i++){
  	long long a = pq.top();
  	pq.pop();
  	ans += a;
  }
  
  cout << ans << endl;
}


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

int main(void){
	long N , K;
	cin >> N >> K;
	ll A[N];
	rep(i,N) cin >> A[i];

	//ll grade = 1;
	//rep(i,K) grade *= A[i];

	for (int i = K; i < N; i++) {
		//ll grade_new = grade*A[i]/A[i-K];
		if (A[i] > A[i-K]) cout << "Yes" << endl;
		else cout << "No" << endl;
		//grade = grade_new;
	}

	return 0;
}


Measured memory_bytes: 5184
#include<bits/stdc++.h>
#define fu(a,b) for(int i=a;i<b;i++)
#define fv(a,b) for(int j=a;j<b;j++)
using namespace std;

int mini(int x, int y)
{
	return x>y?y:x;
}

int main()
{
	int dp[100001];
	dp[0]=dp[1]=0;
	int n;
	cin>>n;
	int a[n+1];
	fu(1,n+1)
	{
		cin>>a[i];
	}
	dp[2]=abs(a[1]-a[2]);
	fu(3,n+1)
	{
		dp[i] =mini(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
	}
	
	cout<<dp[n];
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long ll;
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;}
typedef pair<ll,ll> P;

int main(){
    int h1,m1,h2,m2,k;
    cin >> h1>>m1>>h2>>m2>>k;
    int sum = (h2*60+m2)-(h1*60+m1) - k;
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3636
n = int(input())
lst = []
ans = 0
for i in range(n):
    a = int(input())
    lst.append([list(map(int,input().split())) for _ in range(a)])

for k in range(2**n):
    target = bin(k)[2:].zfill(n)
    nk = 0
    for i in range(n):
        if target[i] == '1':
            if any(target[x-1] != str(y)  for x,y in lst[i]):
                break
            else:
                nk += 1
    else:
        ans = max(ans,nk)
print(ans)

Measured memory_bytes: 3064
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        int ab = Integer.parseInt(a + b);

        double sqrt_num = Math.sqrt(ab);

        PrintWriter out = new PrintWriter(System.out);
        if (sqrt_num == (int) sqrt_num) {
            out.println("Yes");
        } else {
            out.println("No");
        }

        out.flush();
        sc.close();
    }
}

Measured memory_bytes: 39356
import java.util.*;

public class Main {

    public static void main(String[] args) {
        //Compute c1 = new Compute();//calc

        int count = 0;
        boolean sw = false;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        double dMax = Double.MIN_VALUE;
        double dMin = Double.MAX_VALUE;
        //StringBuilder answer=new StringBuilder();

        //input
        Scanner sc = new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();

        if (a+b>max)
        {
            max=a+b;
        }
        if (a-b>max)
        {
            max=a-b;
        }
        if (a*b>max)
        {
            max=a*b;
        }
        System.out.println(max);

        //output
        //System.out.println(String.format("%.0f",answer));
    }
}

Measured memory_bytes: 21844
def main():
    N, K = map(int,input().split(' '))
    snuke = [0] * (N+1)
    for _ in range(K):
        d = input()
        A = list(map(int,input().split(' ')))
        for j in A:
            snuke[j] = 1
    
    print(N-sum(snuke))
    
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 9048
#include <bits/stdc++.h>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
const ll INF =1001001001;

//最大公約数
ll gcd(ll a, ll b){
   if (a%b==0){
       return(b);
   }else{
       return(gcd(b,a%b));
   }
}
//最小公倍数
ll lcm(ll a, ll b){
   return a*b/gcd(a,b);
}

//素数判定
ll isprime(ll n){
  bool prime=true;
  for(int i=2;i<n;i++){
    if(n%i==0){
      prime=false; break;
    }
  }
if(prime){cout<<n<<" is prime"<<endl;
         }else{cout<<n<<" is not prime"<<endl;}

}
//階乗　20くらいが限界
ll factorial(ll n){
  ll a=1;ll b=n;
  for(int i=0;i<n;i++){
    a*=b;
    b--;
  }
  return a;
}

//組み合わせ　nCr
ll comb(ll a,ll b){
  ll c;
  c=factorial(a)/(factorial(a-b)*factorial(b));
  return c; 
}




//10億7。　　　100000007
//2*2行列 H*W
//vector<vector<int>> vec(H,vector<int>(W));
//for(int i=0;i<H;i++){
//for(int j=0;j<W;j++){
//cin>>vec[i][j];
//  }
//}

//文字列→数列
//string S;int A=atoi(S.c_str());
//数列→文字列
//int A;string S=to_string(A);
//数字判定　isdigit(a)
//pair宣言　pair<int,int> p(5,7);
//ソート　sort(vec.begin(),vec.end());



int main(){
cout<<fixed<<setprecision(10);

ll Q,H,S,D;
  cin>>Q>>H>>S>>D;
  ll N;cin>>N;

  int ans=0;
  
H=min(H,Q*2);
  S=min(2*H,S);
  if(S*2<=D){cout<<S*N<<endl;
           }else{
    if(N%2==0){
      cout<<N/2*D<<endl;
    }else{cout<<N/2*D+S<<endl;
         }
  }

  
  
  
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
#define int long long
int a[114514], b[114514];
signed main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}
	sort(a, a + n);
	sort(b, b + n);
	a[n] = a[n - 1] + 1;
	int i = 0, j = 0, cnt = 0, ans = 0;
	while (j < n) {
		while (i < n&&a[i] <= b[j]) {
			cnt++; i++;
		}
		ans = max(ans, cnt);
		while (j < n && (i == n || b[j] < a[i])) {
			cnt--; j++;
		}
	}
	cout << ans << endl;
}


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


void solve(long long N, std::vector<long long> p){
    long long temp=0,ans=0;
    for(int i=0;i<N;i++){
        ans+=p[i];
        if(temp<p[i]){temp=p[i];}
    }
    ans-=temp/2;
    printf("%lld\n",ans);
}


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


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
  double a,s;
  while(cin>>a){
  s=a;
  for(int i=0;i<9;i++){
    if(i%2==0)a*=2;
    else a/=3;
    s+=a;
  }
  printf("%.10f\n",s);
  }  
return 0;
}

Measured memory_bytes: 1232
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
using namespace std;
int main() {
	int x,y,z = 0;
	cin >> x >> y;
	if (x == 2) {
		if (y == 2) {
			z = 1;
		}
	}
	else if(x == 4 || x == 6 || x == 9 || x == 11){
		if (y == 4 || y == 6 || y == 9 || y == 11) {
			z = 1;
		}
	}
	else {
		if (y == 1 || y == 3 || y == 5 || y == 7 || y == 8 || y == 10 || y == 12) {
			z = 1;
		}
	}
	if (z == 1) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

double dp[3300][3300];
int n;
double p[3300];

int main(){
    cin>>n;
    for(int i=1;i<=n;i++) cin>>p[i];
    dp[0][0]=1;

    for(int i=1;i<=n;i++){
        for(int j=0;j<=i;j++){
            dp[i][j]=dp[i-1][j]*(1-p[i]);
            if(j-1>=0) dp[i][j]+=dp[i-1][j-1]*p[i];
        }
    }

    double ans;
    for(int i=0;i<=n;i++){
        if(i>n-i) ans+=dp[n][i];
    }
    cout<<setprecision(10)<<ans<<endl;
}

Measured memory_bytes: 76416
use std::io::prelude::*;
use std::str::FromStr;
pub struct Scanner<R: Read>(R);
impl<R: Read> Scanner<R> {
    pub fn new(reader: R) -> Self {
        Self(reader)
    }
    pub fn read<T: FromStr>(&mut self) -> T {
        let token = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| (b as char).is_whitespace())
            .take_while(|&b| !(b as char).is_whitespace())
            .collect::<Vec<u8>>();
        unsafe { std::str::from_utf8_unchecked(token.as_slice()) }
            .parse()
            .ok()
            .expect("Can't parse it.")
    }
    pub fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
fn main() {
    let (stdin, stdout) = (std::io::stdin(), std::io::stdout());
    let mut sc = Scanner::new(stdin.lock());
    let mut out = std::io::BufWriter::new(stdout.lock());
    solve(&mut sc, &mut out);
    out.flush().ok().unwrap();
}
fn solve(sc: &mut Scanner<std::io::StdinLock>, out: &mut std::io::BufWriter<std::io::StdoutLock>) {
    let mut s: String = sc.read();

    let patterns = vec!["dream", "dreamer", "erase", "eraser"];
    'again: while s.len() > 0 {
        for &pat in &patterns {
            if s.ends_with(pat) {
                s.truncate(s.len() - pat.len());
                continue 'again;
            }
        }
        break;
    }
    println!("{}", if s.len() == 0 { "YES" } else { "NO" });
}


Measured memory_bytes: 2252
#include <iostream>

using namespace std;

int main()
{
    int a, b, c, x;
    cin >> a >> b >> c;
    x = max(max(a, b), c);
    if (x == a)
        cout << x * 10 + b + c;
    else if (x == b)
        cout << x * 10 + a + c;
    else if (x == c)
        cout << x * 10 + a + b;
    return 0;
}


Measured memory_bytes: 256
//#include "stdafx.h"
#include "stdio.h"
#include "stdlib.h"
#include "iostream"
#include "math.h"
#include <string.h>
#include <stack>
#include <queue>
#include <map>
#include <string>
#include "algorithm"


using namespace std;
#define fori0(G) for(int i=0;i<G;i++)
#define fori1(G) for(int i=1;i<=G;i++)
#define forj0(G) for(int j=0;j<G;j++)
#define forj1(G) for(int j=1;j<=G;j++)
#define fork0(G) for(int k=0;k<G;k++)
#define fork1(G) for(int k=1;k<=G;k++)
int dx[] = { -1,0,1,0 ,0 }, dy[] = { 0,1,0,-1,0 };
#define nxnycon (0<=nx&&nx<h&&0<=ny&&ny<w) 
#define lo long long int

int n,a[101],c;



int main() {
	cin >> n;
	fori0(n) {
		cin >> a[i];
	}
	a[n] = 0;
	fori0(n-1) {
		if (a[i] == a[i + 1]) {
			c++;
			i++;
		}
	}
	cout << c;
	//system("pause");
	return 0;

}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <set>
#include <queue>
#include <map>
#include <iomanip>
#include <cstring>
#include <cmath>

using namespace std;
const long double eps = 1e-12;

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

#define sz(a) ((int) a.size() )
#define LL(x) (x << 1)
#define RR(x) ((x << 1) | 1)
#define For(i , a , b) for (int i = a ; i <= b ; i++)
#define Ford(i , a , b) for (int i = a ; i >= b ; i--)
#define Rep(i , n) for (int i = 0 ; i < n ; i++)

const int maxn = 5006;
int n , m , a[maxn] , b[maxn];
int Next[maxn][1005];

void ReadData() {
    cin >> n >> m;
    For(i , 1 , n) cin >> a[i];
    For(i , 1 , m) cin >> b[i];
    For(i , 1 , 1000) Next[n + 1][i] = n + 1;
    Ford(i , n , 0) {
        For(j , 1 , 1000) Next[i][j] = Next[i + 1][j];
        Next[i][a[i]] = i;
    }
}

int dp[3][maxn];

void Process() {
    memset(dp , -1 , sizeof(dp));
    dp[0][0] = 0;
    int last = 0;
    int res = 0;
    For(i , 1 , m) {
        int cur = last ^ 1;
        For(j , 0 , i) dp[cur][j] = -1;
        dp[cur][i + 1] = 0;
        For(j , 1 , i) {
            if (j == i) {
                int z = Next[0][b[i]];
                if (z <= n) if (dp[cur][j] == -1) dp[cur][j] = z; else dp[cur][z] = min(dp[cur][j] , z);
            } else
            if (dp[last][j] != -1) {
                int x = dp[last][j];
                int z = Next[x + 1][b[i]];
                if (z <= n) {
                    if (dp[cur][j] == -1) dp[cur][j] = z; else dp[cur][j] = min(dp[cur][j] , z);
                }
            }
            if (dp[cur][j] != -1) res = max(res , i - j + 1);
        }
        last = cur;
    }
    cout << res << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("/users/youaremysky/documents/workspace/input.inp" , "r" , stdin);
    ReadData();
    Process();
}

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

int main(){
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    int card=k;//残りのカード枚数
    int sum=0;
    int f=0;
    if (a>=card){
        sum=k;
    }else{
        card-=a;
        sum+=a;
        if (b>=card){
            sum+=0;
            card=0;
        }else{
            card-=b;
            sum-=card;
        }
    }
    cout<<sum<<endl;
}


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

using namespace std;

const complex<double> spin = 1.0i;

int main() {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    complex<double> z1(x1, y1);
    complex<double> z2(x2, y2);
    auto z3 = (z2 - z1) * spin + z2;
    auto z4 = (z3 - z2) * spin + z3;

    cout << int(z3.real()) << ' ' << int(z3.imag()) << ' ';
    cout << int(z4.real()) << ' ' << int(z4.imag()) << endl;

    return 0;
}


Measured memory_bytes: 256
package main

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

var (
	sc = bufio.NewReader(os.Stdin)
)

func main() {
	S := scanStr()
	c, r := 0, 0
	for _, s := range S {
		if s == 'R' {
			c++
			if r < c {
				r = c
			}
		} else {
			c = 0
		}
	}
	fmt.Println(r)
}

func abs(a int) int         { return int(math.Abs(float64(a))) }
func scan(a ...interface{}) { _, err := fmt.Fscan(sc, a...); pnc(err) }
func scanStr() (s string)   { scan(&s); return }
func scanInt() int          { i, err := strconv.Atoi(scanStr()); pnc(err); return i }
func scanFloat() float64    { f, err := strconv.ParseFloat(scanStr(), 64); pnc(err); return f }
func pnc(err error) {
	if err != nil {
		panic(err)
	}
}


Measured memory_bytes: 1840
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
  #include "dbgtoki.hpp"
  #define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) 
DbgTimer D_t;
  #define TSTART() D_t.start()
  #define TSTOP() D_t.stop()
#else
  #define DUMP(i) 
  #define TSTART()
  #define TSTOP()  
#endif
 
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()) , v.end());

using namespace std;
typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;

const int EPS = 1e-9;



int main (){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  while(cin >> n){
    TSTART();
    vi A(n);
    REP(i,n){
      cin >> A[i];
    }
    sort(ALL(A));
    int ans = A[SZ(A) - 1] - A[0];
    cout << ans << endl;
    TSTOP();
  }
  return 0;
}



Measured memory_bytes: 256
import sys

def resolve():
  n, m = map(int, input().split())
  l = 1
  r = 100000
  for i in range(m):
    a, b = map(int, input().split())
    l = max(l, a)
    r = min(r, b)

  if l > r:
    print(0)
  else:
    print(r-l+1)
  return

if __name__ == "__main__":
  resolve()


Measured memory_bytes: 3060
import sys
input = sys.stdin.readline

def main():
    n, k = map(int, input().split())
    mod = 998244353

    dp = [0]*(n)

    zone = [tuple(map(int, input().split())) for i in range(k)]
    zone.sort()

    dp[0] = 1
    count = 0
    bit = [0]*k

    for i in range(1, n):
        for j in range(k):
            l, r = zone[j]
            if i-l >= 0:
                bit[j] += dp[i-l]
            if i-r-1 >= 0:
                bit[j] -= dp[i-r-1]
        dp[i] += sum(bit)%mod
        dp[i] %= mod
    ans = dp[n-1]
    print(ans)

if __name__ == "__main__":
    main()





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

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


Measured memory_bytes: 3584
//This code was made by Chinese_zjc_.
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<map>
#include<queue>
#define int long long
#define INF 0x3fffffffffffffff
using namespace std;
int n,a,b,q,s[100001],sum;
signed main()
{
	std::ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;++i)
	{
		cin>>a;
		++s[a];
		sum+=a;
	}
	cin>>q;
	for(int i=1;i<=q;++i)
	{
		cin>>a>>b;
		sum+=s[a]*(b-a);
		s[b]+=s[a];
		s[a]=0;
		cout<<sum<<endl;
	}
	return 0;
}


Measured memory_bytes: 4392
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define print(n) cout<<n<<endl
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vector<ll>>
#define vvi vector<vector<int>>
const int M=200111;
const int inf=1000000007;
const int mod=1000000007;
const double PI = 3.1415926535897932384626433;
const long long INF=1e18;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
int ddx[8]={1,-1,0,0,1,-1,-1,1},ddy[8]={0,0,1,-1,1,-1,1,-1};


struct UnionFind {
	vector<int> par;
	UnionFind(int n) : par(n, -1) { }

	int root(int x) {
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool same(int x, int y) {
		return root(x) == root(y);
	}

	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y); // merge technique
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x) {
		return -par[root(x)];
	}
};

vvl comb(int n) {
	vvl v(n + 1,vl(n + 1, 0));
	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int j = 1; j < v.size(); j++) {
		for (int k = 1; k < j; k++) {
			v[j][k] = (v[j - 1][k - 1] + v[j - 1][k])%mod;
		}
	}
	return v;
}

void sosu(ll x,bool f[]){
	ll y=x;
	for(ll i=2;i<=sqrt(y);i++){
		if(x%i==0){
			x/=i;
			f[i]=true;
			i--;
		}
	}
}

ll __gcd(ll x,ll y){
	if(x<y)swap(x,y);
	while(1){
		ll tmp=x%y;
		x=y;
		y=tmp;
		if(y==0)break;
	}
	return x;
}

int keta(ll a){
	int ke=1;
	while(a/=10)ke++;
	return ke;
}

vector<long long> enum_divisors(long long N) {
	vector<long long> res;
	for (long long i = 1; i * i <= N; ++i) {
		if (N % i == 0) {
			res.push_back(i);
			// 重複しないならば i の相方である N/i も push
			if (N/i != i) res.push_back(N/i);
		}
	}
	// 小さい順に並び替える
	sort(res.begin(), res.end());
	return res;
}

ll zyou(ll x,ll n){
	ll y=1;
	rep(i,0,n){
		y*=x;
	}
	return y;
}

int main() {
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	while(1){
		c-=b;
		if(c<=0){
			print("Yes");
			break;
		}
		a-=d;
		if(a<=0){
			print("No");
			break;
		}
	}



}


Measured memory_bytes: 3632
#include <cstdio>

using namespace std;

bool is_valid(const int D[10], int N) {
    while (N) {
        if (D[N%10]) return false;

        N /= 10;
    }
    return true;
}

int main() {
    int N, K;
    scanf("%d %d", &N, &K);

    int D[10]={};
    for (int i=0; i<K; ++i) {
        int d;
        scanf("%d", &d);
        ++D[d];
    }

    while (!is_valid(D, N))
        ++N;

    printf("%d\n", N);
    return 0;
}


Measured memory_bytes: 128
/*
 *  *s.rbegin()=*(--s.end())
 *   sort(v.rbegin(),v.rend()) = negative of v[i] , sort(v.begin(),v.end())
 *   sort(v.begin()+l_index,v.begin()+r_index+1);
 * 
 *   for(auto &it:v)cin>>it; 
 *   n + n/2 + n/3 + n/4 + n/5 + ........n/n =>n*log(n)
 *   n + n/3 + n/5 + n/7 + n/11+.............=>n*log(log(n))
 *   1 , 3 , 5 , 7 , 9 , 11 , 13 , 15 .......=>gcd( a[i] , a[i+1] , a[i+2] )=1;
 *   2 , 3 , 5 , 7 , 11 , 13 , 17 , 19 ......=>upto 1e6 max diff a[i], a[i+1] ~ 150
 *   Every even integer greater than 2 can be expressed as the sum of two primes.[1]  : https://en.wikipedia.org/wiki/Goldbach%27s_conjecture
 *   printf("%03d\n",k);
 *   scanf("%d/%d/%d",&d,&m,&y);   
 */

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define srt(a) sort(a.begin(),a.end())
#define rsrt(a) sort(a.rbegin(),a.rend())
#define lb(a,b) lower_bound(a.begin(),a.end(),b)
#define ub(a,b) upper_bound(a.begin(),a.end(),b)
#define MOD ((int)(1e9+7))
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define float long double
#define sqrt sqrtl
#define cbrt cbrtl
typedef vector<int> vi;
typedef vector<float> vf;
typedef pair<float,int> fi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<fi> vfi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<string> vs;
vector<int>dx={0,1,0,-1},dy={1,0,-1,0};
long long  gcd(long long  a,long long b)
{
     while (a&&b)a>b?a%=b:b%=a;
     return a+b;
}
const int N=1e6;
int n,m,ans=1e18+100,k;
int d_sum(int num)
{
	int s=0;
	while(num)
	{
		s+=num%10;num/=10;
	}
	return s;
}
int is_possible(int mid)
{ 
	int d=d_sum(mid);
	if( mid*mid + d*mid == n )return 0;
	else if( mid*mid + d*mid > n)return 1;
	else return -1;
}
void b_search(int l,int r)
{
	if(l<=r)
	{
		int mid=(l+r)/2;
		int s=is_possible(mid);
		if(s==0)
		{
			ans=min(ans,mid);r=mid-1;
		}
		else if(s>0)r=mid-1;
		else if(s<0)l=mid+1;
		b_search(l,r);
	}
}
int32_t main()
{
	IOS
	string s;
	int n,k;
	cin>>n>>k>>s;
	s[k-1]=tolower(s[k-1]);
	cout<<s<<endl;
	
}
		


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x,a,b,z,k;
    cin>>x>>a>>b;
    z=abs(x-a);
    k=abs(x-b);
    if(z<k)
        cout<<"A"<<endl;
    else
        cout<<"B"<<endl;
    return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define ll long long
#define PI 3.141592653589
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define EPS 1e-7
#define PII pair<int,int>
#define s second
#define f first
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
ll MOD = 1e9+7;
const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int random_int(int l,int r){return uniform_int_distribution<int>(l,r)(rng);}
ll fast_power(ll x, ll p){
    ll res = 1;
    while(p > 0){
        if(p & 1){
            res = (res * x)%MOD;
        }
        p = p >> 1;
        x = (x*x)%MOD;
    }
    return res;
}
vector<int> arr;
int n;
ll dp[3005][3005];
ll prefix[3005];
ll getRangeSum(int l, int r){
    return prefix[r] - ((l-1 >= 0) ? prefix[l-1] : 0);
}
ll solve(int l, int r){
    if(l > r){
        return 0;
    }
    if(dp[l][r] != -1){
        return dp[l][r];
    }
    ll ans = arr[l] + solve(l+1, r);
    ans = max(ans, arr[r] + solve(l, r-1));
    return dp[l][r] = getRangeSum(l, r) - ans;
}
int main() {
    IO;
    cin >> n;
    arr.resize(n);
    memset(dp, -1, sizeof dp);
    for(int i = 0; i < n; i++){
        cin >> arr[i];
    }
    prefix[0] = arr[0];
    for(int i = 1; i < n; i++){
        prefix[i] = arr[i] + prefix[i-1];
    }
    ll y = solve(0, n-1);
    ll x = getRangeSum(0, n-1) - y;
    cout << x - y;


    return 0;
}


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

int main()
{
  int a[3];
  int res=0;

  rep(i,3) cin >> a[i];

  sort(a,a+3);

  int b=a[0];
  rep(i,3){
    res += a[i]-b;
    b = a[i];
  }
  cout << res << endl;
}

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

#define int long long
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define vcopy(v1,v2) copy((v1).begin(), (v1).end(), back_inserter((v2)));
#define pb(n) push_back(n);

int a,b,c,x,ans;

main() {
    cin >> a >> b >> c >> x;
    rep(i,a+1) rep(j,b+1) rep(k,c+1) if (500*i+100*j+50*k == x) ans++;
    ct(ans)
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int N[31]={0},a=0;
	for(int i=1;i<29;i++){
		scanf("%d",&a);
		N[a]=1;
	}
	for(int i=1;i<31;i++){
		if(N[i]!=1){
			printf("%d\n",i);
			}
	}
	return 0;
}
//前回記録31:37.770クリア
//3分25秒クリア


Measured memory_bytes: 3188
#include <iostream>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>

using namespace std;

int main() {
  int x,y,z,swap;
  cin >>x>>y>>z;
  swap=x;
  x=y;
  y=swap;

  swap=x;
  x=z;
  z=swap;

  cout<<x<<" "<<y<<" "<<z<<endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
bool acgt(char ch)
{
	if(ch=='A'||ch=='C'||ch=='G'||ch=='T') return true;
	return false;
}
int main()
{
	string s;
	int sum=0;
	int max=0;
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(acgt(s[i])) 
		{
		sum++;	if(sum>max) max=sum;
		}
		
		else sum=0;
	}
	cout<<max;
	return 0;
}

Measured memory_bytes: 256