akhauriyash/Code-Regression huggingface dataset:
s = input()

top = int(s[0]) * 10 + int(s[1])
bot = int(s[2]) * 10 + int(s[3])

y = False
m = False

if 1 <= top <= 12:
    m = True
if 1 <= bot <= 12:
    y = True

if y and m:
    print('AMBIGUOUS')
elif not y and m:
    print('MMYY')
elif y and not m:
    print('YYMM')
else:
    print('NA')

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rrep(i,n) REP(i,1,n+1)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> PII;
typedef vector<ll> Vl;
typedef vector<int> VI;
typedef tuple<int, int, int> TT;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
const int MAX = 500000;
const int inf = 1000000007;
const ll mod = 1000000007;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;

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


string s;

int main() {

	cin >> s;

	if (s == "ABC")cout << "ARC" << endl;
	else cout << "ABC" << endl;

	return 0;
}


Measured memory_bytes: 3592
#include<stdio.h>

int main(void)
{
    int n,n1,i,j;
    scanf("%d\n",&n);
    n1 = n - 1;
    int array[n];
    for(i = 0;i < n;i++)    scanf("%d",&array[i]);
    for(j = 0;j < n;j++,n1--)
    {
        printf("%d",array[n1]);
        if(j != n - 1)
            printf(" ");
        else    printf("\n");
    }
}


Measured memory_bytes: 2132
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long l = sc.nextLong();
        long r = sc.nextLong();
        if(r - l >= 2019){
            System.out.println(0);
            return;
        }
        long ans = Long.MAX_VALUE;
        for(long i = l; i < r; i++){
            for(long j = i + 1; j <= r; j++){
                ans = Math.min(ans,(i * j) % 2019);
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35636
#include<stdio.h>

typedef struct Process_
{
    char name[11];
    int tim;
} process;
 
#define Q_TAIL 100000

typedef struct Queue_
{
    process p[Q_TAIL];
    int head;
    int tail;
} queue;


process dequeue(queue *q)
{
    int b = q->head;
    q->head = (q->head+1)%Q_TAIL;
    return q->p[b];
}

void enqueue(queue *q,process x)
{
    q->p[q->tail] = x;
    q->tail +=1;
    q->tail = q->tail%Q_TAIL;
}

int queue_empty(queue *q)
{
    return q->head == q->tail;
}

int main()
{
    int n,c,ksn=0;
    scanf("%d %d",&n,&c);
    queue q;
    q.head = 0;
    q.tail = 0;
    for(int i=0;i<n;i++)
    {
        process p;
        scanf("%s", p.name);
        scanf("%d", &p.tim);
        enqueue(&q,p);
    }
    while(!(queue_empty(&q)))
    {
        process x = dequeue(&q);
        if(x.tim < c)
        {
            ksn += x.tim;
            x.tim = 0;
        }
        else
        {
            ksn += c;
            x.tim -= c;
        }
        if(x.tim == 0)
        {
            printf("%s %d\n", x.name,ksn);
        }
        else
        {
            enqueue(&q,x);
        }
    }
    return 0;
}


Measured memory_bytes: 3432
import sys
input = sys.stdin.readline
 
n, m, l = map(int, input().split())
abc = [list(map(int, input().split())) for _ in range(m)]
q = int(input())
 
st = [list(map(int, input().split())) for _ in range(q)]
 
graph = [[float('inf') for _ in range(n)] for _ in range(n)]
 
 
for a, b, c in abc:
    graph[a-1][b-1] = c 
    graph[b-1][a-1] = c
for i in range(n):
    graph[i][i] = 0
 
# print(graph)
 
def warshall_floyd(d):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])
    return d
 
graph = warshall_floyd(graph)
 
for i in range(n):
    for j in range(n):
        if 0 < graph[i][j] <= l:
            graph[i][j] = 1
        if graph[i][j] > l:
            graph[i][j] = float('inf')
 
graph = warshall_floyd(graph)
 
for s, t in st:
    print(graph[s-1][t-1]-1 if graph[s-1][t-1] != float('inf') else -1)

Measured memory_bytes: 131804
#include<bits/stdc++.h>
#include<string>
#include<cmath>

using namespace std;

#define ll long long int
#define ld long double
#define loop(i, n) for (int i = 0; i < n; i++)
#define loops(i, s, n) for (int i = s; i < n; i++)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
#define deb(x) cout<< #x << '=' << x <<endl
#define MOD 1000000007
const int N = 100;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin>>n;
    for(int i = 1; i<=n; i++){
        int ans = 0;
        for(int x = 1; x <=N; x++){
            for(int y = 1; y<=N; y++){
                if(x*x + y*y + x*y > n){
                    break;
                }
                for(int z = 1; z<=N; z++){
                    ll res = (x*x + y*y + z*z);
                    res += (x*y + y*z + z*x);
                    if(res == i){
                        ans++;
                    }
                    if(res > i){
                        break;
                    }
                }
            }
        }
        cout<<ans<<"\n";
    }
}

Measured memory_bytes: 3480
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

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

  vector<int> x(5);
  repr(i, 5, 0) {
    cin >> x[i];
    if (x[i] == 0) {
      cout << i+1 << endl;
      return 0;
    }
  }

}

Measured memory_bytes: 3600
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main(){
    int a,b,ans;
    scanf("%d%d",&a,&b);   
    ans=max(a+b,max(a-b,a*b));
    printf("%d",ans);   
    return 0;
}


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

using namespace std;

int main(){
	int a[4], b[4];
	while (scanf("%d %d %d %d %d %d %d %d", &a[0], &a[1], &a[2], &a[3], &b[0], &b[1], &b[2], &b[3]) != EOF){
		int hit = 0;
		int blow = 0;
		for (int i = 0; i < 4; i++)
			for (int j = 0; j < 4; j++)
				if (a[i] == b[j])
					if (i == j) hit++;
					else blow++;
		printf("%d %d\n", hit, blow);
	}
	return 0;
}

Measured memory_bytes: 3172
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <limits.h>
#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0);
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ll long long
#define INF 100000000
#define MOD 1000000007
#define SIZE 100005
#define FOR(i,a,n) for(i=(a);i<(n);i++)
int comp(const void* a,const void* b){
	return *(int*)a-*(int*)b;
}
typedef struct LIST{
	int to;
	struct LIST *next;
}Edge;
void add_edge(Edge **edge,int s,int t){
	Edge *tmp=(Edge*)malloc(sizeof(Edge));
	tmp->to=t;
	tmp->next=edge[s];
	edge[s]=tmp;
	return;
}
void delete_edge(Edge **edge,int v){
	int i;
	Edge *e,*tmp;
	FOR(i,0,v){
		e=edge[i];
		while(e!=NULL){
			tmp=e->next;
			free(e);
			e=tmp;
		}
	}
	return;
}
Edge *edge[100000];
int color[100000];
int cnt[3];
int flag;
void dfs(int v,int c){
	Edge *e;
	color[v]=c;
	for(e=edge[v];e!=NULL;e=e->next){
		if(color[e->to]==c) flag=0;
		if(color[e->to]==0) dfs(e->to,-c);
	}
	return;
}
int main(void)
{
	int n,m,a,b,i;
	ll res=0;
	scanf("%d%d",&n,&m);
	FOR(i,0,m){
		scanf("%d%d",&a,&b);
		add_edge(edge,--a,--b);
		add_edge(edge,b,a);
	}
	FOR(i,0,n){
		if(color[i]!=0) continue;
		if(edge[i]==NULL) cnt[0]++;
		else{
			flag=1;
			dfs(i,1);
			if(flag) cnt[1]++;
			else cnt[2]++;
		}
	}
	//FOR(i,0,3) printf("%d ",cnt[i]);
	res+=(ll)cnt[0]*(2*n-cnt[0]);
	res+=2LL*cnt[1]*cnt[2];
	res+=2LL*cnt[1]*cnt[1]+cnt[2]*cnt[2];
	printf("%lld\n",res);
	delete_edge(edge,n);
	return 0;
}
    

Measured memory_bytes: 15744
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int[] B = new int[N];
    
    for (int i=1; i<N; i++) {
      B[i] = scan.nextInt();
    }
   
    int sum= B[1] + B[N-1];
    
    for (int j=2; j<N; j++){
      sum += Math.min(B[j-1],B[j]);
    }
 
    System.out.println(sum);
  
  }
 
}

Measured memory_bytes: 21844
#include<stdio.h>
#define FOR(i,a,b) for(int i=a;i<b;i++)
int main(){
	int n,t,a[100002],min=1e9,dif=0,num=0;
	scanf("%d %d",&n,&t);
	FOR(i,0,n){
		scanf("%d",&a[i]);
		if(min > a[i]) min = a[i];
		else if(dif == a[i]-min) num++;
		else if(dif < a[i]-min){
			dif = a[i]-min;
			num = 1;
		}
	}
	printf("%d\n",num);
}

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

int main() {
    string s, t;
    cin >> s >> t;
    
    const int n = s.length();
    const int m = t.length();
    vector<int> sa(n + 1, 0), sb(n + 1, 0);
    vector<int> ta(m + 1, 0), tb(m + 1, 0);
    for (int i = 0; i < n; i++) {
        sa[i + 1] = sa[i] + (s[i] == 'A');
        sb[i + 1] = sb[i] + (s[i] == 'B');
    }
    for (int i = 0; i < m; i++) {
        ta[i + 1] = ta[i] + (t[i] == 'A');
        tb[i + 1] = tb[i] + (t[i] == 'B');
    }
    
    auto query = [&] (int l, int r, int p, int q) {
        int a = sa[r] - sa[l - 1], b = sb[r] - sb[l - 1];
        int c = ta[q] - ta[p - 1], d = tb[q] - tb[p - 1];
        
        int x = (c + 2 * d) - (a + 2 * b);
        int y = (2 * c + d) - (2 * a + b);
        return (x % 3 == 0 and y % 3 == 0);
    };
    
    int q;
    cin >> q;
    while (q--) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        if (query(a, b, c, d)) {
            cout << "YES" << '\n';
        } else {
            cout << "NO" << '\n';
        }
    }
    
    return 0;
}

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

using namespace std;

typedef long long ll;

const int MOD = 1e9 + 7;
const int MAXN = 1e5 + 10;

int n, d[MAXN];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	ll ans = 1;
	int lst = 0;
	memset(d, 63, sizeof(d));
	for (int i = 0; i < n; i++){
		int x;	cin >> x;
		d[i] = min(i, lst+1>>1);
		if (i)
			d[i] = min(d[i], 1+d[i - 1]);
		ans = ans * (d[i]+1) % MOD;
		lst = x;
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 768
def solve() :
    k = int(input())
    n = 1
    found = set()
    v = 7
    while v % k != 0: 
        if v in found :
            return -1
        found.add(v)
        v = ((v%k) * 10+7) % k
        n += 1
    return n


print(solve())


Measured memory_bytes: 78084
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define mp make_pair
#define PI pair<int,int>
#define poly vector<int>
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
#define pb push_back
#define mem(a) memset((a),0,sizeof(a))
#define fi first
#define se second
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
const int N=25005,K=405,mod=1e9+7;
ll f[N][K],g[N][K],ycl[N],ans;
int a[N],to[N],fr;
ll ksm(ll a,int b){
	int ans=1;
	for(;b;b>>=1){
		if(b&1)ans=ans*a%mod;
		a=a*a%mod;
	}
	return ans;
}
int main(){
	int n=read(),k=read(),m=read();
	For(i,1,m)a[i]=read(); int dq=0;
	For(i,1,m){dq++; if(to[a[i]])dq=min(dq,i-to[a[i]]); if(dq==k)fr=1; to[a[i]]=i;}
	f[0][dq]=1; 
	For(i,1,k)to[i]=n+1; dq=0;
	Rep(i,m,1){dq++; if(to[a[i]])dq=min(dq,to[a[i]]-i); if(dq==k)fr=1; to[a[i]]=i;}
	g[0][dq]=1;
	ans=n-m+1;
	For(i,1,n-m)ans=ans*k%mod; 
	if(dq<k&&dq==m){
		f[1][1]=k; 
		For(i,1,n){
			Rep(j,k-1,1){
				if(j>=m)g[i][j]=(g[i][j]+f[i][j])%mod;
				//cout<<i<<" "<<j<<" "<<f[i][j]<<" "<<g[i][j]<<endl;
				f[i+1][j]=(f[i][j]+f[i+1][j+1])%mod;
				g[i+1][j]=(g[i][j]+g[i+1][j+1])%mod;
			}
			For(j,1,k-1){
				if(j+1<k)f[i+1][j+1]=(f[i+1][j+1]+f[i][j]*(k-j))%mod;
				if(j+1<k)g[i+1][j+1]=(g[i+1][j+1]+g[i][j]*(k-j))%mod;
			}
		}
		ll sum=0;
		For(i,1,k-1)sum+=g[n][i]; //cout<<sum<<endl;
		sum%=mod;
		For(i,1,m)sum=sum*ksm(k-i+1,mod-2)%mod;
		cout<<(ans-sum+mod)%mod<<endl;
		return 0;
	}
	For(i,0,n-m-1){
		Rep(j,k-1,1){
			f[i+1][j]=(f[i][j]+f[i+1][j+1])%mod;
			g[i+1][j]=(g[i][j]+g[i+1][j+1])%mod;
		}
		For(j,1,k-1){
			if(j+1<k)f[i+1][j+1]=(f[i+1][j+1]+f[i][j]*(k-j))%mod;
			if(j+1<k)g[i+1][j+1]=(g[i+1][j+1]+g[i][j]*(k-j))%mod;
		}
	}
	if(!fr){
		For(i,1,n-m+1){
			ll sum0=0,sum1=0;
			For(j,1,k-1){
				sum0+=f[i-1][j];
				sum1+=g[n+1-i-m][j];
			}
			//cout<<sum0<<" "<<sum1<<endl;
			ans=(ans-sum0%mod*(sum1%mod))%mod;
		}	
	}
	cout<<(ans%mod+mod)%mod<<endl;
}

Measured memory_bytes: 158464
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

from collections import defaultdict, deque
from sys import exit
import math
import copy
from bisect import bisect_left
from heapq import *
import sys
# sys.setrecursionlimit(1000000)
INF = 10 ** 17
MOD = 998244353

def check(mid, points, origin, rotate):
    height = origin * math.cos(math.radians(rotate))
    # print(height)
    cs = math.cos(math.radians(rotate))
    sn = math.sin(math.radians(rotate))
    for px, py in points:
        py = py - origin
        rx, ry = px*cs - py * sn, px * sn + py * cs
        if abs(rx) > height + 0.0000001 or abs(ry) > height + 0.0000001:
            # print("FALSE", rotate)
            return False

    return True


class Segtree_op():
    def __init__(self, n):
        self.size = 1
        while (n >= 1):
            self.size = self.size << 1
            n = n // 2

        self.arr = [self.unit() for i in range(self.size * 2)]

    def op(self, lch, rch):
        return lch + rch

    def unit(self):
        return 0

    def update(self, k, val):
        k += self.size - 1
        self.arr[k] = val
        while (k):
            k = (k - 1) // 2
            self.arr[k] = self.op(self.arr[k * 2 + 1], self.arr[k * 2 + 2])

    def query(self, l, r):
        L = l + self.size
        R = r + self.size
        s = self.unit()
        while L < R:
            if R & 1:
                R -= 1
                s = self.op(s, self.arr[R - 1])

            if L & 1:
                s = self.op(s, self.arr[L - 1])
                L += 1
            L >>= 1
            R >>= 1
        return s

    def show(self):
        idx = 1
        while (idx <= self.size):
            print(self.arr[idx - 1:idx * 2 - 1])
            idx *= 2


def solve():
    a, b, h, m = getList()
    mdeg = 360 * (m / 60)
    hdeg = 360 * ((60 * h + m) / 720)
    hx, hy = a * math.cos(math.radians(hdeg)), a * math.sin(math.radians(hdeg))
    mx, my = b * math.cos(math.radians(mdeg)), b * math.sin(math.radians(mdeg))
    print(math.sqrt((hx - mx) ** 2 + (hy - my) ** 2))
    # print(hx, hy, mx, my)

def main():
    n = getN()
    for _ in range(n):
        solve()
if __name__ == "__main__":
    solve()



Measured memory_bytes: 68604
#include<cstdio>
#include<algorithm>
#define fo(x,a,b) for(int x=(a),e_=(b);x<=e_;x++)
using namespace std;

int a[200005],n;
long long ans=0;
int main(){
	int la,now;
	scanf("%d",&n);
	scanf("%d",&la);
	fo(i,2,n) scanf("%d",&now), ans+=max(0,la-now), la=max(now,la);
	printf("%lld",ans);
	return 0;
}



Measured memory_bytes: 1732
n = int(input())
b = [int(i) for i in input().split()]
a = [0]*n
a[0] = b[0]
a[-1] = b[-1]
if n==2:
  print(sum(a))
  exit()
i=1
while i<n-1:
  a[i]=min(b[i-1],b[i])
  i+=1
print(sum(a))


Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<deque>

using namespace std;

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

int main(){
    int N; string S; cin >> N >> S;
    string ans;
    if (N % 2 == 1) ans = "No";
    else{
        if(S.substr(0, N/2) == S.substr(N/2, N/2)) ans = "Yes";
        else ans = "No";
    }
    cout << ans << endl;
}

Measured memory_bytes: 888
/**Bismillahir Rahmanir Raheem
    Author:Refat(BSMRSTU)**/
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
#define pb push_back
#define vi vector<int>
#define pii pair<int,int>
#define pil pair<int,ll>
const int N = 1e5 + 5;
const int M = 1e9 + 7;
const double pi=2*acos(0.0);
const double esp=1e-9;
int Set(int N,int pos) {
    return N=N | (1<<pos);
}
int reset(int N,int pos) {
    return N= N & ~(1<<pos);
}
bool check(int N,int pos) {
    return (bool)(N & (1<<pos));
}

int w[N],c[N],dp[1005][10005],k,n;
int func(int i,int weight) {

    if((weight>=k))
        return 0;
    else if(i>n)
        return M;
    if(dp[i][weight]!=-1) return dp[i][weight];
    int profit1=M,profit2=M;

    profit1=c[i]+func(i,weight+w[i]);

    profit2=func(i+1,weight);

    dp[i][weight]=min(profit1,profit2);
    return dp[i][weight];
}
int main() {
    /// freopen("input.txt","r",stdin);
    /// freopen("output.txt","w",stdout);
    int test=1;
    ///scanf("%d",&test);
    memset(dp,-1,sizeof(dp));
    for(int cs=1; cs<=test; cs++) {
        scanf("%d %d",&k,&n);
        for(int i=1; i<=n; i++) {
            scanf("%d %d",&w[i],&c[i]);
        }
        printf("%d\n",func(1,0));
    }
    return 0;
}



Measured memory_bytes: 40064
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    String s = sc.next();
    String t = sc.next();    
    
    os.println(t + s);
  }
}


Measured memory_bytes: 21204
def main():
    n, d = map(int, input().split())
    X = [list(map(int,input().split())) for _ in range(n)]
    ans = 0
    for i in range(n-1):
        for j in range(i+1, n):

            d = sum([(xi-xj)**2 for xi,xj in zip(X[i],X[j])])**0.5
            if d.is_integer():
                ans += 1
    print(ans)
if __name__ == "__main__":
    main()

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,i;
    cin>>a>>b>>c>>d;
    for(i=0; ;i++)
    {
        if(a<=0||c<=0)
            break;
        if(i%2)
            a-=d;
        else
            c-=b;
    }
    cout<<(a<=0?"No":"Yes")<<endl;
}


Measured memory_bytes: 3632
//abc171_e.cpp
//Sun Jun 21 20:54:49 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

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

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

	ll a[n];
	ll twos[41];
	fill(twos,twos+41,0);
	for (int i=0;i<n;i++){
		cin >> a[i];
		for (int j=40;j>=0;j--){
			if (a[i]>>j&1){
				twos[j]++;
			}
		}
	}

	for (int i=0;i<41;i++){
		twos[i] = twos[i]%2;
		// cout << i << " " << twos[i] << endl;
	}

	for (int i=0;i<n;i++){
		ll ans = 0;
		for (int j=40;j>=0;j--){
			if (a[i]>>j&1 && twos[j]==0){
				ans += 1<<j;
			}else if ((a[i]>>j&1)==0 && twos[j]==1){
				ans += 1<<j;
			}
		}
		cout << ans << " ";
	}
printf("\n");

}

Measured memory_bytes: 5124
package main

import "fmt"

func main() {
	// Code for A - Favorite Sound
	var A, B, C int
	fmt.Scanf("%d %d %d", &A, &B, &C)

	if A*C <= B {
		fmt.Println(C)
	} else {
		fmt.Println(B / A)
	}
}


Measured memory_bytes: 1832
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define loop(k) rep(author_is_masa,k)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const long long INF = 1e18;

/*--------------------------------------------------------------------*/

signed main(){
	int n;cin>>n;
	vi a(n);
	rep(i,n) cin>>a[i];

	sort(all(a));
	reverse(all(a));

	if(n==2){
		cout<<a[0]<<endl;
		return 0;
	}

	queue<int> q;
	q.push(a[1]);
	q.push(a[1]);

	int ans=a[0];
	FOR(i,2,n-1){
		int p=q.front();q.pop();
		ans+=p;
		q.push(a[i]);
		q.push(a[i]);
	}


	cout<<ans<<endl;

	return 0;
}



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

int main(){
    ll N;
    cin>>N;

    int n;
    vector<char> s;
    if(N<27){
        n=N%27;
        cout<<char('a'+n-1);  
        return 0;
    }else{
        while(N>0){
            int n=N%26;
            if(n==0) n=26;
            s.push_back(char('a'+n-1));
            N=(N-1)/26;
            if(N==0) break;
        }
    }

    rep(i, s.size()) cout<<s[s.size()-i-1];

    return 0;
}

Measured memory_bytes: 3632
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0; 
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
	
	long p = read.to!long;
	long q = read.to!long;
	long r = read.to!long;
	
	long[] as = [p, q, r];
	as.sort();
	
	(as[0] + as[1]).writeln;
	
}


Measured memory_bytes: 384
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< int,int > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;

lo n,m,b[li],a[li],k,flag,t;
lo cev;
string s;
vector<int> v;

int main(void){
	scanf("%lld",&n);
	FOR{
		scanf("%lld",&a[i]);
	}
	for(lo i=n;i>=2;i--){
		if(a[i]<a[i-1])a[i-1]--;
	}
	for(lo i=2;i<=n;i++){
		if(a[i]<a[i-1]){printf("No\n");return 0;}
	}
	printf("Yes\n");
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    int N;cin >> N;
    int ans = 1;
    rep(i,3){
        ans *= N;
    }
    cout << ans << endl;
}



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

void solve(){
	ll n;
	cin >> n;
	string s;
  cin >> s;
	if(n>=3200)
	cout << s << endl;
	else
	cout << "red";
	

}


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t=1;
	//cin >> t;
	while(t--)
	{
		solve();
	}
		return 0;
}


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

Measured memory_bytes: 256
K, N = map(int, input().split())
A = list(map(int, input().split()))
A = sorted(A)
B = [0] * N

for i in range(N - 1):
  B[i] = A[i + 1] - A[i]
  
B[N - 1] = A[0] + (K - A[N - 1])

print(K - max(B))



Measured memory_bytes: 25840
N = int(input())
S = input()
ans = []
alp = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z','A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
for i in range(0,len(S)):
    for j in range(0,26):
        if S[i] == alp[j]:
            ans.append(alp[j+N])
print("".join(ans))

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


void solve(long long N, std::vector<std::string> S){
    auto a = set<string>();
    for (const string s : S) {
        a.insert(s);
    }
    cout << a.size() << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<std::string> S(N);
    for(int i = 0 ; i < N ; i++){
        std::cin >> S[i];
    }
    solve(N, std::move(S));
    return 0;
}


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

#define M 100000
int main(){
  int n,m,a[M],i,b[M],ca[M];
  int c=0,c2=0;
  cin>>m>>n;
  if(m>2){
    cin>>a[0];
    for(i=1;i<n;i++){
      cin>>a[i];
      if(a[i]==a[i-1])c++;
    }
    if(c>0)c=(c+1)/2;
    cout<<c<<endl;
  }
  else{
    for(i=0;i<n;i++){
      if(i%2==0){
	b[i]=1;
	ca[i]=2;
      }else{
	b[i]=2;
	ca[i]=1;
      }
    }

    for(i=0;i<n;i++){
      cin>>a[i];
      if(a[i]!=b[i])c++;
      if(a[i]!=ca[i])c2++;
    }
    if(c<c2)cout<<c<<endl;
    else cout<<c2<<endl;
  }

  return 0;
}



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

int main() {
  int n;
  int sum=0;
  
  vector<int>primelist(1000010);
    primelist.at(2)=1;
    primelist.at(3)=1;
  
  for(int i=3;i<1000001;i++){
    for(int j=2;j<=sqrt(i);j++){
      
      if(i%j==0){
        primelist.at(i)=0;
        break;
      }
      primelist.at(i)=1;
    }
  }
  
  while(cin >> n){
  
  sum=0;
  for(int i=0;i<(n+1);i++){
    sum=sum+primelist.at(i);
  }
  
  
  cout <<sum<<endl;
  }
  return 0;
}



Measured memory_bytes: 6568
"use strict";

var processData = function processData(lines) {
  var s = lines[0];
  var mid = s.length / 2;

  if (s.slice(0, mid) === s.slice(mid + 1)) {
    console.log('Yes');
  } else {
    console.log('No');
  }
};

var i = '';
process.stdin.on('data', function (c) {
  return i += c;
});
process.stdin.on('end', function () {
  var _require = require('os'),
      EOL = _require.EOL;

  var lines = i.split(EOL);
  /*your input text, split by lines*/

  processData(lines);
});


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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.setf(ios::fixed);
    cout.precision(10);
    
    int N; cin >> N;
    queue<string> Q;
    Q.push("a");
    set<string> ST;
    ST.insert("a");
    
    auto valid = [](const string& s) {
        char mx = 'a';
        for (char ch : s) {
            if (ch > char(mx + 1)) return false;
            mx = max(ch, mx);
        }
        return true;
    };
    
    while (true) {
        string s = Q.front();
        if (s.size() > N) break;
        Q.pop();

        for (int i = 0; i < N; ++i) {
            char c = 'a' + i;
            string temp = s + string(1, c);
            if (valid(temp)) {
                Q.push(temp);
                ST.insert(temp);
            }
        }
    }
    
    for (auto& item : ST) {
        if (item.size() == N) {
            cout << item << "\n";
        }
    }
}


Measured memory_bytes: 84096
def main():
    T = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    K = int( input())
    print(T[K-1])

if __name__ == '__main__':
    main()


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

int main()
{
	int A[3], K;
	cin >> A[0] >> A[1] >> A[2] >> K;
	sort(A, A + 3);
	cout << (A[0] + A[1] + (A[2] << K)) << endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.B
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var S = ReadText().ToCharArray();
            var T = ReadText().ToCharArray();

            var tcount = T.Length;
            var max = 0;
            for (var i = 0; i <= S.Length - tcount; i++)
            {
                max = Math.Max(max, SameCount(S, T, i));
            }
            return tcount - max;
        }
        private static int SameCount(char[] s, char[] t, int i)
        {
            var count = 0;
            for (var j = 0; j < t.Length; j++)
            {
                if (t[j] == s[i + j])
                {
                    count++;
                }
            }
            return count;
        }
        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 25976
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
//
void yes(){
  cout <<"Yes"<<endl ;
}
void no(){
  cout <<"No"<<endl ;
}


//-------------------------------------------------
//




//-------------------------------------------------


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n , k ;
  cin >> n >> k ;
  
  vector<double> vec(n) ;
  
  REP(i,n){
    double a ;
    cin >> a ;
    vec.at(i) = (a+1)/2 ;
  }
  
  vector<double> sum(n-k+1) ;
  
  REP(i,k){
    sum.at(0) += vec.at(i) ;
  }
  
  REP(i,n-k){
    sum.at(i+1) = sum.at(i)-vec.at(i)+vec.at(k+i) ;
  }
  
  sort(ALL(sum)) ;
  reverse(ALL(sum)) ;
  
  cout << SP(10) << sum.at(0) <<endl ;
  
    
  
  
  
  return 0 ;
}

Measured memory_bytes: 3456
import copy
#n,d=map(int,input().split())
n=int(input())
a=list(int(input())for _ in range(n))
A=copy.deepcopy(a)
A.sort(reverse=True)
#print("-----------")
for i in range(n):
        if a[i]!=A[0]:
                print(A[0])
        else:
                print(A[1])


Measured memory_bytes: 14616
from collections import Counter

def Replacing():

    Num = int(input())

    value_A = list(map(int,input().split()))

    Sum = sum(value_A)
    Counter_value = Counter(value_A)

    NumB = int(input())

    for i in range(NumB):
        value_B = list(map(int,input().split()))

        Sum += (value_B[1] - value_B[0])*Counter_value[value_B[0]]
        Counter_value[value_B[1]] += Counter_value[value_B[0]]
        Counter_value[value_B[0]] = 0

        print(Sum)

if __name__ == '__main__':
    Replacing()


Measured memory_bytes: 24052
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch Not | diff Not.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address Not.cpp && ./a.out

/*

 9/13/2020

 5:00-

 */

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

  int x; cin>>x;
  cout<<1-x<<endl;

  return 0;
}


Measured memory_bytes: 3636
h,w=map(int,input().split())
m,mod=[],10**9+7
for i in range(h):m.append(input())
dp=[[0]*w for i in range(h)]
dp[0][0]=1
for i in range(h):
	for j in range(w):
		if m[i][j]=='.':
			if i==0 and j!=0:dp[i][j]=dp[i][j-1]
			elif i!=0 and j==0:dp[i][j]=dp[i-1][j]
			elif i!=0 and j!=0:dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod
print(dp[h-1][w-1])

Measured memory_bytes: 51824
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<queue>
#include <cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<ctime>
#define rep(i,n) for (long int i=1;i<=n;i++)
//#include <bits/stdc++.h>
using namespace std;

int main(){
    long int N;
    cin>>N;
    vector<long int> f(N);
    rep(i,N){
        long int a=i;
        while(a<=N){
            f[a]=f[a]+1;
            a+=i;
        }
    }
    long long ans=0;
    rep(i,N){
        ans+=i*f[i];
    }


    cout<<ans<<endl;

    return 0;
}

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

int main()
{
    int H, N;
    cin >> H >> N;
    int A[N];
    rep(i, N) cin >> A[i];

    sort(A, A+N, greater<int>());
    
    bool is_ok = false;
    for (int i = 0; i < N; i++) {
        H -= A[i];
        if (H <= 0) {
            is_ok = true;
            break;
        }
    }

    if (is_ok) {
        print("Yes");
    }
    else {
        print("No");
    }

    return 0;
}

Measured memory_bytes: 640
import java.util.Arrays;
import java.util.Scanner;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        int A = Integer.parseInt(scanner.next());
        int B = Integer.parseInt(scanner.next());
        System.out.println(B % A == 0 ? A + B : B - A);
    }

}



Measured memory_bytes: 22612
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1e18 + 10;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); 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; }



int main(){ 
    int n, m; cin >> n >> m;
    priority_queue<pii, vector<pii>, greater<pii>> que;
    rep(i, m){
        int a, b; cin >> a >> b;
        que.push({b, a});
    }

    int res = 0, fall = -1;
    while(!que.empty()){
        auto p = que.top(); que.pop();
        int a = p.second, b = p.first;
        if(a <= fall)continue;
        fall = b-1;
        res++;
    }
    cout << res << ln;
}

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

using namespace std;

const int OO = 1e9;
const double EPS = 1e-9;

#define ndl cout << '\n'
#define sz(v) int(v.size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define present(a, x) (a.find(x) != a.end())
#ifdef LOCAL
#define db(...) ({cout << "> Line " << __LINE__  \
		<< ": "; _db(#__VA_ARGS__, __VA_ARGS__);})
#define RNG() rng()
#else
#define db(...) true
#define RNG() true
#endif

template<class T>
void _db(const char *dbStr, T e) {
	cout << dbStr << " = " << e << endl;
}
template<class T, class... L>
void _db(const char *dbStr, T e, L... r) {
  while(*dbStr != ',') cout << *dbStr++;
  cout << " = " << e << ','; _db(dbStr + 1, r...);
}
template<class S, class T>
ostream& operator<<(ostream& o, const map<S, T>& v) {
	o << "["; int i = 0;
	for (const pair<S, T>& pr : v) o << (!i++ ? "" : ", ") << "{"
	<< pr.fs << " : " << pr.sc << "}"; return o << "]";
}
template<template <class, class...> class S, class T, class... L>
ostream& operator<<(ostream& o, const S<T, L...>& v) {
	o << "["; int i = 0;
	for (const auto& e : v) o << (!i++ ? "" : ", ") << e;
	return o << "]";
}
template<class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& pr) {
	return o << "(" << pr.fs << ", " << pr.sc << ")";
}
ostream& operator<<(ostream& o, const string& s) {
	for (const char& c : s) o << c;
	return o;
}

template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = VV<V<T>>;
using ll = long long;
using pii = pair<int, int>;
using vi = V<int>;
using vii = V<pii>;
using vvi = VV<int>;
using mii = map<int, int>;
using umii = unordered_map<int, int>;
using si = set<int>;
using usi = unordered_set<int>;





int main() {
	#ifdef LOCAL
	auto stTime = clock();
//	freopen("in.txt", "r", stdin);
	mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
	#endif
	ios::sync_with_stdio(false);
	cout.precision(10);
	cin.tie(0);


	int N, K;

	cin >> N >> K;

	V<int> A(N);

	for (int i = 0; i < N; ++i)
		cin >> A[i];

	int lo = 1, hi = 1000000000;

	while (lo < hi) {
		int mid = (lo + hi) / 2;

		bool good;
		{
			int need = 0, len = mid;
			for (auto& ai : A) {
				if (ai <= mid)
					continue;
				if (ai % len == 0)
					need += ai / len - 1;
				else
					need += ai / len;
			}
			good = (need <= K);
		}
		if (good)
			hi = mid;
		else
			lo = mid + 1;
	}

	cout << lo << '\n';


	#ifdef LOCAL
	cout << "\n\n\nExecution time: " <<
		(clock() - stTime) * 1e3 / CLOCKS_PER_SEC << " ms" << endl;
	#endif
	return 0;
}


Measured memory_bytes: 3992
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(std::unique(all(x)), x.end());
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
const double PI = acos(-1);
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    int x;
    cin >> x;
    x--;
    while (x++) {
        bool prime = true;
        for (int i = 2; i <= sqrt(x); i++) {
            if (x % i == 0) {
                prime = false;
                break;
            }
        }
        if (prime) {
            cout << x << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(void){
  
 int i;
 int N = 0;
 int number = 0; 
 
  
  scanf("%d", &N);
    
  for(i = 0; i < N; i++){
    scanf("%d", &number);
     if(number % 2 == 0){
      if(number % 3 != 0 ){
        if(number % 5 != 0){
        printf("DENIED\n");
        break;
        }
      }
    }
  }
  
  if(i == N ){
   printf("APPROVED\n");
  }
  
  
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#define MAX 2000
int solve(int,int);
int n,a[MAX];

int main(){
int b[MAX],i,m;

scanf("%d",&n);

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

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

for(i=0;i<m;i++){
if(solve(0,b[i]))printf("yes\n");
else printf("no\n");
}

return 0;
}
int solve(int x,int y){
if(a[x]==y)return 1;
if(x+1==n)return 0;
if(solve(x+1,y-a[x])||solve(x+1,y))return 1;
return 0;
}

Measured memory_bytes: 588
#define	_USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
using namespace std;
int main(){
	
	long long n,m;
	while(cin>>n,n!=0){
		char p,a;
	map<char,char>	t;
		
		for(int i=0;i<n;i++){
			cin>>p>>a;
			t[p]=a;
	}
		string s="";
		cin>>m;
		
		for(int i=0;i<m;i++){
			cin>>p;
			if(!t[p])
				s+=p;
			else
				s+=t[p];
		}
		cout<<s<<endl;
	}
}

Measured memory_bytes: 1340
import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n, h = list(map(int, input().rstrip('\n').split()))
    ab = [list(map(int, input().rstrip('\n').split())) for _ in range(n)]
    ab.sort(reverse=True)
    ma = ab[0][0]
    ab.sort(key=lambda x: x[1], reverse=True)
    cnt = 0
    for a, b in ab:
        if ma >= b or h <= 0:
            break
        else:
            h = max(h - b, 0)
            cnt += 1
    print(cnt + (h + ma - 1) // ma)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 60380
# coding: utf-8
# Your code here!

A, B = map(int, input().rstrip().split())

flag = False
for i in range(1000000):
    if int(i * 0.08) == A and int(i * 0.1) == B:
        print(i)
        flag = True
        break
    
if flag == False:
    print(-1)

Measured memory_bytes: 40172
// Charan Sriramula
 
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long int ll;
 
const ll logx=30;
const ll N=1e3+5;
const ll INF=1e18+5;
const ll mod=1e9+7;
const double PI = 3.14159265358979323846;
 
#define ints(n) scanf("%d",&n)
#define intp(n) printf("%d\n",n)
#define longs(n) scanf("%intd",&n)
#define longp(n) printf("%intd\n",n)
 
inline ll mul(ll a, ll b){ return (a * 1ll * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }
 
#define f first
#define s second
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define mp(x,y) make_pair(x,y)
#define GCD(a,b) __gcd((a),(b))
#define all(v) v.begin(),v.end()
#define bits(x) __builtin_popcount(x)
#define LCM(a,b) ((a)*(b))/GCD((a),(b))
#define ms(dp,val) memset(dp,val,sizeof(dp))
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
template<typename T> T power(T x,T y,ll m){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1ll;x=(x*x)%m;}return ans%m;}
 
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
 
int main()
{
  ll k,x;
  cin>>k>>x;
  ll l=x-k+1;
  ll r=x+k-1;
  for(ll i=l;i<=r;i++){cout<<i<<" ";}
}

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


int main(){
	
	int sw=0;
	int n;
	cin>>n;
	int A[10001];
	for(int i=0;i<n;i++)
		cin>>A[i];
	int m;
	cin>>m;
	int B[m];
	for(int j=0;j<m;j++)
		cin>>B[j];
		
	for(int j=0;j<m;j++){
		for(int i=0;i<n;i++){
			if(A[i]==B[j]){
				sw++;
				break;
			}
		}
	}
	cout<<sw<<endl;	
	
	return 0;
}


Measured memory_bytes: 3140
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
//#include <map>
#include <iomanip>
#include <vector>

using namespace std;



int main()
{
	int c1, c2, c3;
	int sum;	//合計が20以下になる有効カードの枚数
	
	while (cin >> c1 >> c2 >> c3)
	{
		sum = 0;
		for (int i=1; i<=10; i++)
		{
			if (i != c1 && i != c2 && i != c3 && c1 + c2 + i <= 20) sum++;
		}
		//cout << "sum = " << sum << endl;
		if (sum / 7.0 >= 0.5)
		{
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 1152