akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>

#define M 1000000
#define L 14

char H[M][L]; /* Hash Table */

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

/* convert a string into an integer value */
long long getkey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

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

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

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

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';

    scanf("%d", &n);

    for ( i = 0; i < n; i++ ){
              scanf("%s %s", com, str);

              if ( com[0] == 'i' ){
                  insert(str);
              } else {
                  if (find(str)){
                            printf("yes\n");
                  } else {
                            printf("no\n");
                  }
              }
    }

    return 0;
}



Measured memory_bytes: 15460
n,k=map(int,input().split())
mod=10**9+7
bikkuri=[0 for i in range(2*n+5)]
bikkuri[0]=1
gyaku=[0 for i in range(2*n+5)]
gyaku[0]=1
for i in range(1,2*n+5):
    bikkuri[i] = (i * bikkuri[i-1])%mod
    gyaku[i]=pow(bikkuri[i], mod-2, mod)
def comb(a,b):
    return bikkuri[a]*gyaku[b]%mod*gyaku[a-b]%mod
if n<=k:
    ans=comb(2*n-1,n)%mod
elif k==1:
    ans=n*n-1
    ans%=mod
else:
    ans=0
    for i in range(k+1):
        if i==0:
            ans+=1
            ans%=mod
        else:
            ans+=comb(n,n-i)*comb(n-1,i)
            ans%=mod
print(ans)
    

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

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int m, hundred = 0, five = 0;
    cin >> m;
    while (m >= 500){
        m -= 500;
        hundred ++; 
    }
    while (m >= 5){
        m -= 5;
        five ++;
    }
    cout << (hundred*1000 + 5*five);
}

Measured memory_bytes: 256
#include<cstdio>
int main(){
	int n;
	scanf("%d",&n);
	int a,b;
	a=n/100;
	b=n%100;
	int p=0;
	int q=0;
	if(0<b&&b<13)p=1;
	if(0<a&&a<13)q=1;
	if(p+q==2)printf("AMBIGUOUS");
	else if(p==1)printf("YYMM");
	else if(q==1)printf("MMYY");
	else printf("NA");
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>
 
const int MAX_N = 105;
const int MAX_M = 1005;
const int MAX_C = 1050;

int N, M;

int a[MAX_M], b[MAX_M], c[MAX_M];
int dist[MAX_N][MAX_N];
bool is_used[MAX_M];
 
int main(int argc, char **argv) {
    std::cin >> N >> M;

    for (int i = 1; i <= M; i++) {
        std::cin >> a[i] >> b[i] >> c[i];
    }

    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= N; j++) {
            dist[i][j] = MAX_C * N;
        }
        dist[i][i] = 0;
    }

    for (int k = 1; k <= M; k++) {
        dist[a[k]][b[k]] = c[k];
        dist[b[k]][a[k]] = c[k];
    }

    for (int k = 1; k <= N; k++) {
        for (int i = 1; i <= N; i++) {
            for (int j = 1; j <= N; j++) {
                dist[i][j] = std::min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    int ret = 0;
    for (int k = 1; k <= M; k++) {
        is_used[k] = false;
        for (int i = 1; i <= N; i++) {
            for (int j = 1; j <= N; j++) {
                if (dist[i][a[k]] + c[k] + dist[b[k]][j] == dist[i][j]) {
                    is_used[k] = true;
                }
            }
        }
        if (!is_used[k]) {
            ret++;
        }
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include<cmath>
#define MAX 100
using ll=long long;
using namespace std;

int cnt_digits(ll N)
{
    int digits=0;
    while(N>0)
    {
        N/=10;
        digits++;
    }
    return digits;
}

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

    int ans=cnt_digits(n);

    for(ll a=1LL ; a*a<=n ; ++a)
    {
        if(n%a!=0)continue;
        const ll b=n/a;
        const int cur=max(cnt_digits(a),cnt_digits(b));

        ans=min(ans,cur);

    }

    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define f first
#define s second
#define int long long
#define sz(x) (ll)(x.size())
#define MAX 200005
using namespace std;

signed main(){
  fast;
  int n,k;
  cin>>n>>k;
  int a[n];
  int neg=0,zero=0,pos=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    if(a[i]<0) neg++;
    else if(a[i]==0) zero++;
    else pos++;
  }
  sort(a,a+n);
  int zero_ind=neg;
  int pos_ind=neg+zero;
  int neg_no=neg*pos;
  int zero_no=zero*(n-zero) + (zero*(zero-1))/2;
  int pos_no=(n*(n-1))/2 - neg_no-zero_no;
  if(k<=neg_no){
   // cout<<"1\n";
    int st=-1e18+2;
    int end=-1;
    while(st<=end){
      int mid=(st+end)/2;
      int tot=0;
      int j=n-1;
      for(int i=neg-1;i>=0;--i){
        while(j>=pos_ind and a[i]*a[j]<=mid){
          j--;
        }
        tot+=(n-1-j);
      }
      if(tot<k){
        st=mid+1;
      }
      else{
        end=mid-1;
      }
    }
    cout<<st<<"\n";
  }
  else if(k<=neg_no+zero_no){
    cout<<"0\n";
  }
  else{
    //cout<<"2 2\n";
    k-=(neg_no+zero_no);
    //cout<<k<<"\n";
    int st=1;
    int end=1e18;
    vector<pair<int,int>> x;
    for(int i=0;i<neg;i++) x.pb({-a[i],0});
    for(int i=neg+zero;i<n;i++) x.pb({a[i],1});
    sort(x.begin(),x.end());
    
    while(st<=end){
      int mid=(st+end)/2;
      int l=0;
      int neg_so_far=0;
      int tot=0;
      int cnt=0;
      int tmp=0;
      //cout<<x.size()<<"\n";
      for(int i=x.size()-1;i>=0;--i){
        while(i>l and (x[l].f*x[i].f)<mid){
          if(x[l].s==0) neg_so_far++;
          if(x[l].s==x[i].s) tmp=x[l].f*x[i].f;
          l++; 
        }
       // cout<<"gandu "<<tot<<" "<<l<<" "<<neg_so_far<<" "<<mid<<"\n";
        if(i!=l and x[i].s==x[l].s and x[i].f*x[l].f==mid) cnt++;
        if(x[i].s==0) tot+=neg_so_far;
        else tot+=(l-neg_so_far);
        if(l>=i){
         // cout<<"just before total "<<tot<<" ";
         // cout<<l<<" "<<neg_so_far<<"\n";
          int pos_here=l-neg_so_far;
          tot+=((pos_here*(pos_here-1))/2 + (neg_so_far*(neg_so_far-1))/2);
          break;
        }
      }
      //cout<<k<<" "<<tot<<" "<<mid<<"\n";
      //if(tot==k){
      //  cout<<tmp<<"\n";
      //  return 0;
      //}
      if(tot>=k){
        end=mid-1;
      }
      else if(tot+cnt>=k){
        cout<<mid<<"\n";
        return 0;
      }
      else{
        st=mid+1;
      }
    }
    cout<<st<<"\n";
  }
}




Measured memory_bytes: 7536
#include <bits/stdc++.h>
#define range(i, a, n) for(int (i) = (a); (i) < (n); (i)++)
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
using namespace std;
int main(void){
    for(int n, k, s; cin >> n >> k >> s, n;){
        vector<vector<int>> dp(k + 1, vector<int>(s + 1));
        dp[0][0] = 1;
        range(i, 1, n + 1){
            for(int j = k; j > 0; j--){
                for(int l = s; l >= i; l--){
                    dp[j][l] += dp[j - 1][l - i];
                }
            }
        }

        cout << dp[k][s] << endl;
    }

    return 0;
}

Measured memory_bytes: 3144
/*I wanna be the very best, like no one ever was...*/

#include<bits/stdc++.h>
using namespace std;
/*******  All Required define Pre-Processors and Constants    *******/

#define ll long long
#define ull unsigned long long 
#define ld long double
#define mem(a, b) memset(a, (b), sizeof(a))
#define rep(i, j, k) for (int i = j ; i < k ; ++i)
#define rrep(i, j, k) for (int i = j; i > k; --i)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(i, a) for(auto i: a)
#define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define in(A, B, C) assert( B <= A && A <= C)
#define debug(a) cout << #a << ": " << a << endl
#define Flag(n) cout << "here " << n << endl
#define mp make_pair
#define pb push_back

#define endl '\n';
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll POSITIVE_INFINITY = 9223372036854775807;
const ll NEGATIVE_INFINITY = -9223372036854775807;
const ll MOD = 1000000007;
const ld PI = acos(-1.0);
 

#define TRACE
#ifdef TRACE
#define see(...) __f(#__VA_ARGS__,__VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr<<name<<" : "<<arg1<<endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma=strchr(names+1,',');cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1, args...);
}
#else
#endif


int pow(int a , int n ){
    ll res =1;
    while(n){
        if(n%2==1){
            res= (res*a)%MOD;
        }
        a=(a*a)%MOD;
        n/=2;
    }
    return res;
}

int pow2(int a , int n ){
    long result=1;
            for(long i=0; i<n/2; i++){
                result=result*2;
                result=result%(1000000000+7);
            }
            
            // cout << result << endl;
    return result;
}


int main() {
    io;
    // freopen("in","r",stdin); 
    // freopen("out","w",stdout);
    int n;
    cin>>n;
    vector<int> v(n);
    rep(i,0,n)cin>>v[i];
    int flag = 1;
    sort(all(v));
    if(n%2==0){
        int start = 1;
        for(int i =0;i<n;i+=2){
            if(v[i]==start && v[i+1]==start){
                start+=2;

            }
            else {
                flag = 0;
                break;
            }

        }
        if(flag){
            // see(n/2);
            // cout<<pow(3,9);
            cout<<pow2(2,n)<<endl;
            return 0;
        }
        else {
            cout<<0<<endl;
            return 0;
        }
    }
    else {
        // see("fasdfa");
        int start = 0;
        if(v[0]!=start){
            flag = 0;
        }
        start+=2; 

       for(int i =1;i<n;i+=2){
        

            if(v[i]==start && v[i+1]==start){
                start+=2;
            }
            else{
                // see(v[i]);
                flag = 0;
                break;
            }
        }

        if(flag){
            
            cout<<pow2(2,n)<<endl;
            return 0;
        }
        else {
            cout<<0<<endl;
            return 0;
        }



    }

 
 
 
    
 
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int arr[n],i,j,k;
	for(i=0;i<n;i++)
	cin >> arr[i];
    int dp[n]={0};
    for(i=1;i<n;i++)
    {
    	if(i==1)
    	dp[i]=dp[i-1]+abs(arr[i]-arr[i-1]);
    	else
    	dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
	}
	cout << dp[n-1];
    return 0;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main {

    /**
     * @param args
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int K = sc.nextInt();
        int S = sc.nextInt();

        int[] ans = solve(N, K, S);

        for (int i=0; i<ans.length; i++) {
            System.out.println(ans[i]);
        }
    }

    private static int[] solve(int N, int K, int S) {
        int[] a = new int[N];

        int b;
        if (S == 1_000_000_000) {
            b = 1;
        } else {
            b = 1_000_000_000;
        }

        for (int i=0; i<N; i++) {
            if (i < K) {
                a[i] = S;
            } else {
                a[i] = b;
            }
        }

        return a;
    }
}


Measured memory_bytes: 42648
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


public class A
{
	public static void Main()
	{
		string[] args = Console.ReadLine().Split(' ');
		int a = Int32.Parse(args[0]);
		int b = Int32.Parse(args[1]);

		Console.WriteLine((a + b + 1)/2);
	}
}





Measured memory_bytes: 13140
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
// 標準入力からデータを読み込む準備
int i;
try (Scanner sc = new Scanner(System.in)) {
while (true) {
int n = sc.nextInt();
if (n == 0) { break; }
int[] scores = new int[n];
for (i = 0; i < scores.length; i++) {
scores[i] = sc.nextInt();
}
double average = 0, variance = 0, sum = 0;

for(i=0;i<n;i++){
    sum = sum+scores[i];
}
average=sum/n;
for(i=0;i<n;i++){
variance=variance+(scores[i]-average)*(scores[i]-average);
}
variance=variance/n;
// … 平均値averageと，分散varianceを計算しよう…
System.out.println(Math.sqrt(variance));
}
}
}
}


Measured memory_bytes: 31764
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      int A = sc.nextInt();
      int B = sc.nextInt();
      if(A>=13){
        System.out.println(B);
      }else if(6<=A && A<=12){
        System.out.println(B/2);
      }else if(A <= 5){
        System.out.println(0);
      }
    }
}

Measured memory_bytes: 35648
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int N=s.size();
  int a=15-N;
  for(int i=0;i<N;i++)
    if(s.at(i)=='o')a++;
  if(8<=a)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
  return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;
using ll = long long;
using ld = long double;

int main() {
    string S, T;
    cin >> S;
    cin >> T;

    for (int i = 0; i < S.length(); ++i) {
        char s = S[S.length() -1];
        S.insert(S.begin(),s);
        S.pop_back();

        if(S == T){
            cout << "Yes"<<endl;
            return 0;
        }

    }

    cout << "No"<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		// 入力
		int a = sc.nextInt();
		String s = sc.next();

		// 出力
		if(a >= 3200){
		  System.out.println(s);  
		}else{
		    System.out.println("red");
		}
	}

}


Measured memory_bytes: 21844
import math
def is_prime(x):
    if x == 2:
        return True
    if x < 2 or x % 2 == 0:
        return False
    i = 3
    while i <= math.sqrt(x):
        if x % i == 0:
            return False
        i += 2
    return True
        
m = int(input())
p_nums = []
max_num = 0
count = 0
for _ in range(m):
    n = int(input())
    if n in p_nums:
        count += 1
        continue
    if is_prime(n):
        p_nums.append(n)
        count += 1
print(count)


Measured memory_bytes: 5684
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

const int mod = 1e9+7;
#define ll long long int
const double epsilon = 1e-7;

ll ma(ll x, ll y){
    if(x>y)return x;
    return y;
}
struct hoge
{
    ll fx, bx, v, f1, b1, f2, b2, f2m, b2m;
};

struct hoge arr[100000];
int main(void){
    int n;
    ll c;
    scanf("%d %lld", &n, &c);
    ll vsum = 0;
    ll f = 0;
    for(int i = 0;i < n;i++){
        scanf("%lld %lld", &arr[i].fx, &arr[i].v);
        vsum += arr[i].v;
        arr[i].f1 = vsum - arr[i].fx;
        arr[i].f2 = vsum - arr[i].fx*2;
        arr[i].bx = c - arr[i].fx;
        f = ma(f, arr[i].f2);
        arr[i].f2m = f;
    }
    vsum = 0;
    ll b = 0;
    for(int i = n-1;i >= 0;i--){
        vsum += arr[i].v;
        arr[i].b1 = vsum - arr[i].bx;
        arr[i].b2 = vsum - arr[i].bx*2;
        b = ma(b, arr[i].b2);
        arr[i].b2m = b;
    }
    ll ans = 0;
    for(int i = 0;i < n-1;i++){
        ans = ma(ans, arr[i].f1 + arr[i+1].b2m);
    }
    ans = ma(ans, arr[n-1].f1);
    for(int i = n-1;i > 0;i--){
        ans = ma(ans, arr[i].b1 + arr[i-1].f2m);
    }
    ans = ma(ans, arr[0].b1);
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 7296
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    public static void Main()
    {
        int N = NextInt();
        long A0 = 1;
        long T0 = 1;
        for (int i = 0; i < N; i++)
        {
            long T = NextLong();
            long A = NextLong();
            if (A < A0 || T < T0)
            {
                long Ax = (A0 % A == 0 ? A0 / A : A0 / A + 1);
                long Tx = (T0 % T == 0 ? T0 / T : T0 / T + 1);
                long x = Math.Max(Ax, Tx);
                A0 = x * A;
                T0 = x * T;
            }
            else
            {
                A0 = A;
                T0 = T;
            }
        }
        Console.WriteLine(A0 + T0);
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

Measured memory_bytes: 13140
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <queue>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
#define MAX_N 100100
#define MOD 1000000007
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    ll n,ans=1;
    cin >> n;
    string s;
    cin >> s;
    ll a[26];
    fill(a,a+26,0);
    for (ll i=0;i<n;i++){
        a[s[i]-'a']=a[s[i]-'a']+1;
    }
    for (ll i=0;i<26;i++){
        ans*=(a[i]+1);
        ans%=1000000007;
    }
    cout << ans-1 << endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <fstream>
#include <cstdio>
using namespace std;
// vector<pair<int,int> > v;
// cin.ignore();//twice getline(cin,s);
// g++ iterator.cpp -std=c++17
// cout<<(A + B == C ? "YES" : "NO")<<endl;
// __gcd(a,b)
// string s=to_string(i);
// sort(arr, arr+n, greater<int>());
// const long double pi = acos(-1.0);
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
#define vll vector<ll>
#define mll map<ll,ll >
#define mlli map<ll,ll>::iterator
#define size size()
#define endl "\n"
#define ll long long int
#define ld long double
void fast(){ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);}


int main(void)
{
	fast();
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int flag=1;
	while(true)
	{
		if(flag==1)
		{
			c=c-b;
			flag=-1;
			if(c<=0)
			{
				cout<<"Yes"<<endl;
				return 0;
			}
		}
		else if(flag==-1)
		{
			a=a-d;
			flag=1;
			if(a<=0)
			{
				cout<<"No"<<endl;
				return 0;
			}
		}
	}
	// if(c<=0)
	// {
	// 	cout<<"Yes"<<endl;
	// }
	// else
	// {
	// 	cout<<"No"<<endl;
	// }
}

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

int main(){
  int N,A,B;cin>>N>>A>>B;
 // int X=max(A,B);
  int Y=min(A,B);
  if(A+B<=N) cout<<Y<<" "<<0<<endl;
  else cout<<Y<<" "<<A+B-N<<endl;
}
  


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define endl "\n"
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define traceV(v) for(auto x:v)cout<<x<<" ";cout<<endl
#define traceM(mp) for(auto x:mp)cout<<x.first<<" "<<x.second<<endl

//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 2e+9 + 10;
typedef pair<ll, ll> P;

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

  mat m(3, vec(3));
  rep(i,3) {
    cin >> m[i][0] >> m[i][1] >> m[i][2];
  }

  bool can = false;
  rep(a0, 101) {
    int b0 = m[0][0]-a0;
    int b1 = m[0][1]-a0;
    int b2 = m[0][2]-a0;
    rep(a1, 101) {
      rep(a2, 101) {
        if(a1+b0==m[1][0] && a1+b1==m[1][1] && a1+b2==m[1][2] && a2+b0==m[2][0] && a2+b1==m[2][1] && a2+b2==m[2][2])can = true;
      }
    }
  }
  if(can)cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    static void solve(long high,long middle,long low,long k){
        long d = 10;
        for(int i=0;i<17;i++){
            d=10*d;
        }
        if((high-middle)>d){
            System.out.println("Unfair");
        }else{
            if(k%2==0){
            System.out.println(high-middle);
            }else{
                System.out.println(middle-high);
            }
        }
    }
    public static void main(String[]args){
        Scanner std = new Scanner(System.in);
        long high=std.nextLong();
        long middle=std.nextLong();
        long low = std.nextLong();
        long k=std.nextLong();
        solve(high, middle, low, k);

    }
}

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

using namespace std;

//#define int long long

main()
{
    ios_base::sync_with_stdio(false);
    bool ok = false;
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        char c;
        cin >> c;
        if(c == 'Y') ok = true;
    }
    if(ok) cout << "Four" << endl;
    else cout << "Three" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
  
#define lol long long
#define gcd(x,y) __gcd(x,y)
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
#define fixed(x) fixed<<setprecision(x)
using namespace std;
using pii=pair<int,int>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
template <class A> inline lol abs(A &a) { return (a < 0 ? -a : a); }
const lol inf=(1LL<<60);
const lol Mod=(1e9)+7;
const lol mod=998244353;
const int dx[]={1,0,-1,0,1,1,-1,-1};
const int dy[]={0,1,0,-1,1,-1,1,-1};
bool line(lol x,lol y,lol nx,lol ny){return (x<nx&&y<ny&&x>=0&&y>=0);}
lol n,m,k;
vector<int> load[10];
lol f(int place,vector<bool> vis);
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >>n>>m;
  for(int i=0;i<m;i++){
    int a,b;
    cin >>a>>b;
    load[a].push_back(b);
    load[b].push_back(a);
  }
  vector<bool> can(n+1,false);
  cout <<f(1,can)<<'\n';
  return (0);
}
lol f(int place,vector<bool> vis){
  if(vis[place]) return 0;
  vector<bool> can(n+1);
  int sum=0;
  vis[place]=true;
  for(int i=1;i<=n;i++){
    can[i]=vis[i];
    if(can[i]) sum++;
  }
  if(sum==n) return 1;
  lol ans=0;
  for(int i=0;i<load[place].size();i++){
    ans+=f(load[place][i],can);
  }
  return ans;
}


Measured memory_bytes: 3648
n,c,*x=`dd`.split.map &:to_i;*s=0;x.map{|e|s<<s[-1]+e};r=[];(1..n).map{|k|t=5*s[n]+(k+n)*c;(n-k*2).step(1,-k){|o|t+=2*s[o]};r<<t};p r.min

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

const int MAX_N = 112345;
struct Edge {
  int to;
  int a, b;
};
vector<Edge> g[MAX_N];

const ll INF = 1LL << 58;
ll d[2][MAX_N];

struct State {
  int to;
  ll d;
  bool operator < (const State &a) const {
    return d > a.d;
  }
};

void dijk(int N, int start, int ab) {
  REP(i, MAX_N) d[ab][i] = INF;

  priority_queue<State> pq;
  pq.push((State){start, 0});
  d[ab][start] = 0;

  while (!pq.empty()) {
    State cur = pq.top(); pq.pop();
    for (auto edge : g[cur.to]) {
      const int cost = (ab == 0) ? edge.a : edge.b;
      if (d[ab][edge.to] > d[ab][cur.to] + cost) {
        d[ab][edge.to] = d[ab][cur.to] + cost;
        pq.push((State){edge.to, d[ab][cur.to] + cost});
      }
    }
  }
}

ll ans[MAX_N];


int main2() {
  REP(i, MAX_N) g[i].clear();

  int N = nextInt();
  int M = nextInt();
  int start = nextInt()-1;
  int goal = nextInt()-1;
  REP(i, M) {
    int x = nextInt() - 1;
    int y = nextInt() - 1;
    int a = nextInt();
    int b = nextInt();
    g[x].push_back({y, a, b});
    g[y].push_back({x, a, b});
  }

  dijk(N, start, 0);
  dijk(N, goal, 1);

  // pv(d[0], d[0] + N);
  // pv(d[1], d[1] + N);

  REP(i, MAX_N) ans[i] = INF;
  for (int i = N-1; i >= 0; i--) {
    ans[i] = min(ans[i+1], d[0][i] + d[1][i]);
  }
  ll have = 1; REP(i, 15) have *= 10;
  REP(i, N) printf("%lld\n", have - ans[i]);
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


Measured memory_bytes: 11388
// clang-format

#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;

using lli = long long int;

void solve(std::string S, std::string T) {
  cout << T << S << endl;
}

int main() {
  int a;
  std::string S;
  std::cin >> S;
  std::string T;
  std::cin >> T;
  solve(S, T);
  return 0;
}


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

typedef long long ll;
typedef char keytype;

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

/* a[0], ..., a[n-1] の数の最大公約数 */
int ngcd(int n, int a[])
{
    int i, d;

    d = a[0];
    for (i = 1; i < n && d != 1; i++)
        d = gcd(a[i], d);
    return d;
}

void quicksort(keytype a[], int first, int last)
{
    int i, j;
    keytype x, t;

    x = a[(first + last) / 2];
    i = first;  j = last;
    for ( ; ; ) {
        while (a[i] < x) i++;
        while (x < a[j]) j--;
        if (i >= j) break;
        t = a[i];  a[i] = a[j];  a[j] = t;
        i++;  j--;
    }
    if (first  < i - 1) quicksort(a, first , i - 1);
    if (j + 1 < last) quicksort(a, j + 1, last);
}

int is_prime(int x){
    if(x <= 1) return 0;
    for(int i = 2; i * i <= x; i++){
        if(x % i == 0) return 0;
    }
    return 1;
}

int is_substr(char s[], char t[], int i){
    int flag = 1;

    if(s[i] == '\0') flag = 0;

    for(int j = 0; j < strlen(t); ++j, ++i){
        if(s[i] != t[j]){
            flag = 0;
            break;
        }
    }
    return flag;
}

// factor list, number of factors, natural number
void factorize(int ftr[], int *num, int n){
    int a = 2, cnt = 0;

    while(n >= a){
        if(n % a == 0){
            n = n / a;
            ftr[cnt++] = a;
        }else{
            a++;
        }
    }
    *num = cnt;
}

//#define N 5
//int p[N + 1];
int nextperm(int p[], int N)  /* 辞書式順序で次の順列 */
{
    int i, j, t;

    i = N - 1;
    p[0] = 0;  /* 番人 */
    while (p[i] >= p[i + 1]) i--;
    if (i == 0) return 0;  /* 完了 */
    j = N;
    while (p[i] >= p[j]) j--;
    t = p[i];  p[i] = p[j];  p[j] = t;
    i++;  j = N;
    while (i < j) {
        t = p[i];  p[i] = p[j];  p[j] = t;  i++;  j--;
    }
    return 1;  /* 未了 */
}

void comb(int size1, int size2, int v[size1][size2]){
  for(int i = 0; i < size1; i++){
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for(int k = 1; k < size1; k++){
    for(int j = 1; j < k; j++){
      v[k][j] = (v[k-1][j-1] + v[k-1][j]);
    }
  }
}

int abs_val(int a, int b){
    if(a > b) return a - b;
    else return b - a;
}

const int inf = 1012345678;
int main(){
    char w[105];

    scanf("%s", w);

    if((strlen(w) % 2) == 1){
        puts("No");
        return 0;
    }
    quicksort(w, 0, strlen(w) - 1);
    for(int i = 0; i < strlen(w); i+=2){
        if(w[i] != w[i+1]){
            puts("No");
            return 0;
        }
    }

    puts("Yes");

    return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }


long long N;

int main() {
    while (cin >> N) {
        bool ok = false;
        for (long long a = 0; a <= 3500; ++a) {
            for (long long b = a; b <= 3500; ++b) {
                if (ok) break;
                long long p = N * a * b;
                long long q = a*b*4 - N*(a+b);
                if (q <= 0) continue;
                if (p % q == 0) {
                    cout << a << " " << b << " " << p/q << endl;
                    ok = true;
                }
            }
        }
    }
}




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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

bool add(map<int,int>& a, int d, int b){
  for(int j=d;j>=0;j--){
    a[j]++;
    if(a[j]==b){
      if(j==0) return false;
      a[j]=0;
    }else{
      break;
    }
  }
  return true;
}

int n;
int a[200010];

bool ok(int X){
  if(X==1){
    rep(i,n-1){
      if(a[i]>=a[i+1])return false;
    }
    return true;
  }
  map<int,int> crt;
  repl(i,1,n){
    if(a[i-1]>=a[i]){
      while(crt.lower_bound(a[i])!=crt.end()){
        crt.erase(crt.lower_bound(a[i]));
      }
      if(!add(crt,a[i]-1,X))return false;
    }
  }

  return true;
}

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

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

  int lb=0,ub=n+1;
  while(ub-lb>1){
    int mid=(lb+ub)/2;
    if(ok(mid)) ub=mid;
    else lb=mid;
  }
  cout<<ub<<endl;

  return 0;
}


Measured memory_bytes: 1024
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: u32 = read();
    let a: u32 = read();
    let b: u32 = read();

    let mut ans = 0;
    for i in 1..n+1 {
        let s: u32 = i
            .to_string()
            .chars()
            .map(|c| (c as u32) - 48)
            .sum();
        if a <= s && s <= b { ans += i; }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
const int inf=1e9;
const ll Inf=1e18;
const int N=3e3+10;
const int mod=0;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
template<typename T> bool chkmax(T &a,T b) { return a<b?a=b,1:0; };
template<typename T> bool chkmin(T &a,T b) { return a>b?a=b,1:0; };
int add(int a,int b) { return a+b>=mod?a+b-mod:a+b; }
int sub(int a,int b) { return a-b<0?a-b+mod:a-b; }
void inc(int &a,int b) { a=(a+b>=mod?a+b-mod:a+b); }
void dec(int &a,int b) { a=(a-b<0?a-b+mod:a-b); }
struct edge { int to,nxt; } e[N<<1];
int tot=1,h[N];
void adde(int u,int v) {
    e[++tot]=(edge){v,h[u]};h[u]=tot;
    e[++tot]=(edge){u,h[v]};h[v]=tot;
}
int n,a[N];
bool dfs(int u,int fa) {
    for(int i=h[u];i;i=e[i].nxt) if(a[u]>a[e[i].to]&&!dfs(e[i].to,u)) return 1;
    return 0;
}
int main() {
    cin>>n;
    for(int i=1;i<=n;i++) a[i]=gi();
    for(int i=1,u,v;i<n;i++) u=gi(),v=gi(),adde(u,v);
    for(int i=1;i<=n;i++) if(dfs(i,0)) printf("%d ",i);
    return 0;
}


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

using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using f64 = double;
using f80 = long double;

#define FOR(v, a, b) for(i64 v = (a); v < (b); ++v)
#define FORE(v, a, b) for(i64 v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(i64 v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <Mylib/Debug/debug.cpp>
#else
#define dump(...) ((void)0)
#endif

using namespace std;

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T> void pout(const T &value){std::cout << value << "\n";}
template <typename T, typename ...Args> void pout(const T &value, const Args&... args){std::cout << value << " ";pout(args...);}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}
template <typename T> auto make_vector(int n, int m, const T &value){return vector<vector<T>>(n, vector<T>(m, value));}


struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(12);
  }
}init;



int main(){
  int N;

  while(cin >> N){
    set<string> t;
    REP(i,N){
      string S; cin >> S;
      t.insert(S);
    }

    pout(t.size());
  }


  return 0;
}


Measured memory_bytes: 19272
#include<bits/stdc++.h>
using namespace std;
string s,t;
int a[26],b[26];
int main()
{
	cin>>s>>t;
	++a[s[0]-'a'];
	++b[t[0]-'a'];
	for(int i=1;i<s.size();i++)
	{
		++a[s[i]-'a'];
		++b[t[i]-'a'];
		if(s[i]!=s[i-1]&&t[i]==t[i-1])
		{
			puts("No");
			return 0;
		}
		if(s[i]==s[i-1]&&t[i]!=t[i-1])
		{
			puts("No");
			return 0;
		}
		if(a[s[i]-'a']!=b[t[i]-'a'])
		{
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 776
#include<stdio.h> 
#include<iostream> 
#include<string.h>
#include<cstring>
#include<string>
#include<math.h>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<queue>
#include<set>
#define cuttime ios::sync_with_stdio(false)
#define swap(x, y) x ^= y, y ^= x, x^= y
#define INF 0x3f3f3f3f
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define dep(i,a,b) for(int i=(a);i>=(b);--i)
#define scan1(x) scanf("%d",&x)
#define scan2(x,y) scanf("%d%d",&x,&y)
#define scan3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define scanll1(x) scanf("%lld",&x)
#define scanll2(x,y) scanf("%lld%lld",&x,&y)
#define scanll3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z)
#define lowbit(x) (x&(-x))
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int N=2e5+20;
const int MAX=10000007;
inline int read() {
    char c=getchar();int x=0,f=1;
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0',c=getchar();}
    return x*f;
}

inline void out(int x) {   
	if(x>9) out(x/10);   
	putchar(x%10+'0'); 
} 
char s[20];
const double p=acos(-1);
int main(){
	double r;
	cin>>r;
	printf("%.2f\n",p*2*r);
	return 0;
}

Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(nullptr); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N;
    cin >> N;
    vi H(N);
    cin >> H;
    H[0]--;

    rep(i, 1, N) {
        if (H[i - 1] > H[i]) {
            cout << "No" << endl;
            return 0;
        } else if (H[i - 1] < H[i]) {
            H[i]--;
        }
    }
    cout << "Yes" << endl;
    return (0^_^0);
}



Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<list>
#include<queue>
#include<functional>
#include<map>
#include<fstream>
using namespace std;
typedef long long LL;
const LL INF = (LL)1e9*(LL)1e5;

typedef vector<LL> VLL;
typedef pair<LL, int> E;
typedef vector<list<E>> ADJ;
#define mp(a,b) make_pair(a,b)
#define cost(_v) _v.first
#define to(_v) _v.second
struct edge{
	LL cost;
	LL enemy;
};
edge inf = { INF, INF };
inline VLL dijkstra(int s, ADJ adj){
	int n = (int)adj.size();
	VLL res(n, -1);
	priority_queue<E, vector<E>, greater<E>> que;
	que.push(mp(0ll, s));
	while (que.empty() == false){
		auto tmp = que.top(); que.pop();
		auto c = cost(tmp);
		auto v = to(tmp);
		if (res[v] >= 0)continue;
		res[v] = c;
		for (auto &i : adj[v]){
			auto d = cost(i);
			auto u = to(i);
			if (res[u] >= 0)continue;
			que.push(mp(c + d, u));
		}
	}

	return res;
};


int main(){

	//ofstream cout("out.txt");
	while (1){
		int N, M, L;
		cin >> N >> M >> L;
		if (N + M + L == 0)return 0;
		vector<vector<LL>> dp(N + 1, vector<LL>(L + 1, INF));
		vector<vector<edge>> d(N + 1,vector<edge>(N + 1, inf));
		ADJ adj(N + 1);
		for (int i = 0; i < M; i++){
			int A, B ;
			LL D, E;
			cin >> A >> B >> D >> E;
			d[A][B].cost = d[B][A].cost = D;
			d[A][B].enemy = d[B][A].enemy = E;
			adj[A].push_back(mp(E, B));
			adj[B].push_back(mp(E, A));
		}
		for (int i = 1; i < N+1; i++){
			d[i][i].cost =d[i][i].enemy = 0;
		}
		dp[1][0] = 0;

		

		for (int l = 0; l < L; l++){
			for (int i = 1; i <= N; i++){
				dp[i][l] = min(dp[i][l], dp[i][max(0,l - 1)]);
			}
			adj[1].clear();
			for (int i = 2; i < N+1; i++){
				adj[1].push_back(mp(min(d[1][i].enemy,dp[i][l]), i));
			}
			auto ddd=dijkstra(1, adj);
			for (int i = 1; i < N+1; i++){
				dp[i][l] = ddd[i];
			}
			for (int i = 1; i <= N; i++){
				for (int j = 1; j <= N; j++){
					if (l + d[i][j].cost>L)continue;
					dp[j][l + d[i][j].cost] = min(dp[i][l], dp[j][l + d[i][j].cost]);
				}
			}
		}
		for (int i = 1; i <= N; i++){
			dp[i][L] = min(dp[i][L], dp[i][max(L - 1,0)]);
		}
		adj[1].clear();
		for (int i = 2; i < N + 1; i++){
			adj[1].push_back(mp(min(d[1][i].enemy, dp[i][L]), i));
		}
		auto ddd = dijkstra(1, adj);
		for (int i = 1; i < N + 1; i++){
			dp[i][L] = ddd[i];
		}
		LL res = INF;
		for (int i = 0; i < L+1; i++){
			res = min(res, dp[N][i]);
		}
		//cout << "res:";
		cout << res << endl;



	}


	return 0;
}

Measured memory_bytes: 2552
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long a=scan.nextLong();
		long b=scan.nextLong();
		if((a+b)%2==0) System.out.println((a+b)/2);
		else System.out.println("IMPOSSIBLE");
	}

}


Measured memory_bytes: 26892
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define INF 1000000007
using namespace std;

int main(void){
    int n,ans=0;
    cin >> n;
    while(n>0){
        if(n%10==2)ans++;
        n/=10;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(x,y) '(' << x << ',' << y << ')'
ll MOD = 1000000007;
ll INF = 214748364700000000;
long double EPS = 1e-11;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<pair<ll,ll>>>;

ll cnt[40][200010];
ll sum[200010];

int main(){
   ll N,C;cin >> N >> C;
   rep(i,N){
       ll s,t,c;
       cin >> s >> t >> c;
       cnt[c][s*2-1]++;
       cnt[c][t*2]--;
   }
   rep(i,C) rep(j,200009) cnt[i+1][j+1] += cnt[i+1][j];
   rep(i,C) rep(j,200010) if(cnt[i+1][j] > 0) sum[j]++;
   ll ans = 0;
   rep(i,200010) ans = max(ans,sum[i]);
   cout << ans << endl; 
}


Measured memory_bytes: 50944