akhauriyash/Code-Regression huggingface dataset:
#include "iostream"
#include "algorithm"
#include "cmath"
#include "cstdlib"

using namespace std;

int main()
{	
	int A, B, X;
	cin >> A >> B >> X;

	if (A <= X && (A+B) >= X) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}


    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  int H1, M1, H2, M2, K; cin >> H1 >> M1 >> H2 >> M2 >> K;
  int result = H2*60+M2 - (H1*60+M1) - K;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 3640
//JHY_fan
#include<bits/stdc++.h>
#define MX 1000005
#define INF 1000000005
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
 
struct UF
{
	int par[MX],rank[MX];
	
	void init(int n)
	{
		for(int i=0;i<n;i++)
		{
			par[i]=i;
			rank[i]=0;
		}
	}
	void rem(int i)
	{
		par[i]=i;
		rank[i]=0;
	}
	int find(int x)
	{
		if(x==par[x]) return x;
		return par[x]=find(par[x]);
	}
	void unite(int x,int y)
	{
		x=find(x);
		y=find(y);
		if(x==y) return;
		if(rank[x]<rank[y])
		{
			par[x]=y;
		}
		else
		{
			par[y]=x;
			if(rank[x]==rank[y]) rank[x]++;
		}
	}
	bool same(int x,int y)
	{
		return find(x)==find(y);
	}
};
UF uf;
vector <int> vec[MX];
vector <P> query[MX];
int id[MX];
bool use[MX];
int dp[MX];
 
int main()
{
	int n,m;
	scanf("%d %d",&n,&m);
	for(int i=0;i<m;i++)
	{
		int p,q,c;
		scanf("%d %d %d",&p,&q,&c);p--,q--,c--;
		query[c].push_back(P(p,q));
	}
	int sz=n;
	for(int i=0;i<MX;i++)
	{
		if(query[i].empty()) continue;
		for(int j=0;j<query[i].size();j++)
		{
			P p=query[i][j];
			uf.rem(p.first);
			uf.rem(p.second);
			id[p.first]=id[p.second]=-1;
			use[p.first]=use[p.second]=false;
		}
		for(int j=0;j<query[i].size();j++)
		{
			P p=query[i][j];
			uf.unite(p.first,p.second);
		}
		for(int j=0;j<query[i].size();j++)
		{
			P p=query[i][j];
			if(!use[p.first])
			{
				use[p.first]=true;
				int r=uf.find(p.first);
				if(id[r]==-1) id[r]=sz++;
				//printf("%d %d: %d\n",r,id[r],p.first);
				vec[p.first].push_back(id[r]);
				vec[id[r]].push_back(p.first);
			}
			if(!use[p.second])
			{
				use[p.second]=true;
				int r=uf.find(p.second);
				if(id[r]==-1) id[r]=sz++;
				//printf("%d %d: %d\n",r,id[r],p.second);
				vec[p.second].push_back(id[r]);
				vec[id[r]].push_back(p.second);
			}
		}
	}
	queue <int> que;
	que.push(0);
	memset(dp,-1,sizeof(dp));
	dp[0]=0;
	while(!que.empty())
	{
		int v=que.front();que.pop();
		for(int i=0;i<vec[v].size();i++)
		{
			int to=vec[v][i];
			if(dp[to]==-1)
			{
				dp[to]=dp[v]+1;
				que.push(to);
			}
		}
	}
	if(dp[n-1]==-1) puts("-1");
	else printf("%d\n",dp[n-1]/2);
	return 0;
}


Measured memory_bytes: 73600
def f(y, m):
	if y in range(1, 13) and m in range(1, 13):
		return "AMBIGUOUS"
	if m in range(1, 13):
		return "YYMM"
	if y in range(1, 13):
		return "MMYY"
	return "NA"
  
S = input()
y, m = int(S[:2]), int(S[2:])
print(f(y, m))
  


Measured memory_bytes: 9176
#line 2 "header.hpp"

//%snippet.set('header')%
//%snippet.fold()%
#ifndef HEADER_H
#define HEADER_H

// template version 2.0
using namespace std;
#include <bits/stdc++.h>

// varibable settings
const long long INF = 1e18;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define _rrep(i, n) rrepi(i, 0, n)
#define rrepi(i, a, b) for (ll i = (ll)((b)-1); i >= (ll)(a); --i)
#define r_rep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(i, a) for (auto &&i : a)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(...) make_tuple(__VA_ARGS__)
#define ub upper_bound
#define lb lower_bound
#define lpos(A, x) (lower_bound(all(A), x) - A.begin())
#define upos(A, x) (upper_bound(all(A), x) - A.begin())
template <class T>
inline void chmax(T &a, const T &b) {
    if ((a) < (b)) (a) = (b);
}
template <class T>
inline void chmin(T &a, const T &b) {
    if ((a) > (b)) (a) = (b);
}

#define divceil(a, b) ((a) + (b)-1) / (b)
#define is_in(x, a, b) ((a) <= (x) && (x) < (b))
#define uni(x)    \
    sort(all(x)); \
    x.erase(unique(all(x)), x.end())
#define slice(l, r) substr(l, r - l)

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef tuple<ll, ll, ll> iii;

template <typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast {
    Fast() {
        std::cin.tie(0);
        ios::sync_with_stdio(false);
    }
} fast;
void check_input() {
    assert(cin.eof() == 0);
    int tmp;
    cin >> tmp;
    assert(cin.eof() == 1);
}

#if defined(PCM) || defined(LOCAL)
#else
#define dump(...) ;
#define dump_1d(...) ;
#define dump_2d(...) ;
#define cerrendl ;
#endif

#endif /* HEADER_H */
//%snippet.end()%
#line 2 "solve.cpp"
// #define int long long

signed main() {
    //input
    int N;cin>>N;
    vector<int> x(N);
    rep(n, N) cin>>x[n];
    int L;cin>>L;
    int Q;cin>>Q;

    //solve
    vector<vector<int>> db(N, vector<int>(18));
    rep(n, N){
        // fill: db[n][0]
        // x[n] + L
        db[n][0] = upos(x, x[n]+L) - 1;
    }

    rep(k, 1, 18){
        rep(n, N){
            // fill: db[n][k];
            db[n][k] = db[db[n][k-1]][k-1];
        }
    }
    dump_2d(db, N, 18);

    rep(q, Q){
        int a,b;
        cin>>a>>b;
        a--;b--;
        if (a>b) swap(a, b);
        // db[a][x]<=bとなる最大
        int ans = 0;
        r_rep(k, 0, 18){
            if (db[a][k]<b) {
                ans += 1<<k;
                a = db[a][k];
            }
        }
        cout << ans+1 << endl;
    }

    return 0; 
}


Measured memory_bytes: 11392
<?php

class In {

	private $buf = [];
	private $count = 0;
	private $pointer = 0;

	public function nextLine() {
		$ret = '';
		if($this->hasNext()){
			while($this->hasNext()){
				$ret .= $this->next();
			}
		}else{
			$ret = trim(fgets(STDIN));
		}

		return $ret;
	}

	public function next() {
		if(!$this->hasNext()) {
			$str = trim(fgets(STDIN));
			$this->buf = explode(' ',$str);
			$this->count = count($this->buf);
			$this->pointer = 0;
		}

		return $this->buf[$this->pointer++];
	}

	public function hasNext() {
		return $this->pointer < $this->count;
	}

	public function nextInt() {
		return (int)$this->next();
	}

	public function nextDouble() {
		return (double)$this->next();
	}
}

class Out {
	public function println($str = '') {
		echo $str . PHP_EOL;
	}
}

$in = new In();
$out = new Out();

$x = $in->nextInt();
$y = $in->nextInt();

$a = [1,3,5,7,8,10,12];
$b = [4,6,9,11];
$c = [2];

if ((in_array($x, $a) && in_array($y, $a)) ||
	(in_array($x, $b) && in_array($y, $b)) ||
	(in_array($x, $c) && in_array($y, $c))) {
	$out->println('Yes');
} else {
	$out->println('No');
}
?>


Measured memory_bytes: 4732
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <queue>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()

int main() {
    int d;
    cin>>d;
    vector<int>c(26),t(d),nod(26);
    rep(j,26)cin>>c[j];
    vector<vector<int>>s(d,vector<int>(26));
    rep(i,d)rep(j,26)cin>>s[i][j];
    rep(i,d)cin>>t[i];
    int pt=0;
    rep(i,d){
        rep(j,26){
            if(t[i]-1==j){
                pt+=s[i][j];
                nod[j]=0;
            }
            else{
                nod[j]++;
                pt-=c[j]*nod[j];
            }
        }
        cout<<pt<<endl;
    }
    
	return 0;
}


Measured memory_bytes: 3688
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define rep2(i, a)for(auto i : a)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x, std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
#define vvec vector<vector<ll>>
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 1000000007;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll ac(ll n, ll k) { ll a = 1; rep(i, 1, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }

int main()
{
	int n;
	cin >> n;
	n++;
	vector<int> d(n);
	d[0] = 0;
	rep(i, 1, n)cin >> d[i];
	sort(all(d));
	for (int i = 1; i < n; i += 2) {
		d[i] = 24 - d[i];
	}
	int ans = 12;
	sort(all(d));
	d.push_back(24);
	rep(i, 0, n) {
		ans = min(ans, min(d[i+1] - d[i], 24 - d[i+1]+d[i]));
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 3688
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <stdlib.h>
#include <time.h>
#include <limits.h>
#include <assert.h>
using namespace std;
int n, m, dp[3000][3000];
char s[3001], t[3001];
int calc(int i, int j) {
	if (i == n || j == m) return 0;
	if (dp[i][j] != -1) return dp[i][j];
	int res = max(calc(i + 1, j), calc(i, j + 1));
	if (s[i] == t[j]) res = max(res, calc(i + 1, j + 1) + 1);
	return dp[i][j] = res;
}
void trace(int i, int j) {
	if (i == n || j == m) return;
	if (calc(i, j) == calc(i + 1, j)) {
		trace(i + 1, j);
	} else if (calc(i, j) == calc(i, j + 1)) {
		trace(i, j + 1);
	} else {
		printf("%c", s[i]);
		trace(i + 1, j + 1);
	}
}
int main() {
	scanf("%s %s", s, t);
	n = strlen(s);
	m = strlen(t);
	memset(dp, -1, sizeof(dp));
	trace(0, 0);
	puts("");
	return 0;
}

Measured memory_bytes: 35840
n = int(input())
*a, = map(int, input().split())

b1 = 0
b2 = 0
b4 = 0
for _a in a:
    if _a%4 == 0:
        b4 += 1
    elif _a%2 == 0:
        b2 += 1
    else:
        b1 += 1

if b2 == 0:
    print("Yes" if b1 <= b4+1 else "No")
else:
    print("Yes" if b1 <= b4 else "No")


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

using i64=int64_t;

#define rep(i,x,y) for(i64 i=i64(x),i##_max_for_repmacro=i64(y); i<i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif
 
const int inf=1.01e9;
const i64 inf64=4.01e18;
const double eps=1e-9;
 
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    string S;
    cin >> S;
    S[3]='8';
    cout << S << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD (int)(1e9+7)
#define ceil(x, y) (x%y==0? (x/y) : (x/y+1))
#define FOR(i, N) for(int i = 0; i < N; ++i)
#define FOR1(i, N) for(int i = 1; i <= N; ++i)
#define vi vector <int>
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mset(a, v) memset(a, v, sizeof(a))
#define all(v) (v).begin(), (v).end()
#define INF 2e9
#define EPS 1e-9
#define MAX 200009
#define int long long
void __print(int x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
using namespace std;
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    	freopen("in.txt", "r", stdin);
    	freopen("out.txt", "w", stdout);
    #endif

	int T=1;
	//cin >> T;
	FOR1(tp, T)
	{
		//cout << "Case #" << tp << ": ";
		int x, y; cin >> x >> y;
		if(y-2*x >= 0 and 4*x-y >= 0 and ((y-2*x) % 2 == 0) and ((4*x-y) % 2 == 0)) cout << "Yes";
		else cout << "No";
		cout<<'\n';
	}
	return 0;
}


Measured memory_bytes: 3652
N = int(input())
A = list(map(int, input().split()))

flag = True

for i in range(N):
    if A[i] % 2 == 0:
        if A[i] % 3 > 0 and A[i] % 5 > 0:
            flag = False
            break

if flag:
    print('APPROVED')
else:
    print('DENIED')

Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int N;
    cin >> N;
    cout << (N * 1LL * (N - 1)) / 2 << endl;
    return 0;
};


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> TUP;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define mp(a,b) make_pair(a,b)
const ll MOD=1000000007;

ll maxx(ll x,ll y,ll z){
	return max(max(x,y),z);
}
ll minn(ll x,ll y,ll z){
	return min(min(x,y),z);
}
ll gcd(ll x,ll y){
	if(x%y==0) return y;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	return x*y/gcd(x,y);
}

int main(){
	ll N; cin>>N;
  if(N%2==0) cout<<N<<endl;
  else cout<<N*2<<endl;
  
}

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

using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;

#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;

#define sz(x) (int)(x).size()
#define HOGE cout << "hoge" << endl;
using P = pair<ll,ll>;

template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}

const int INF = 1e9;

int main() {
    string s;
    string ans;
    cin >> s;
    int S = s.size();
    REP(i,S){
        if(s[i]=='0') ans.push_back('0');
        if(s[i]=='1') ans.push_back('1');
        if(ans!=""&&s[i]=='B') ans.pop_back();
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
 
using namespace std;
 
int main(){
  int H,N;
  int A[111111];
  int sum = 0;
  int i;
  cin >> H >> N;
  for(i=0;i<=N-1;i++)
    cin >> A[i];
  for(i = 0;i<=N-1;i++)
    sum += A[i];
  if(sum >= H) cout << "Yes";
    else cout << "No";
}

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

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 T> inline T gcd(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T lcm(T a,T b){return a*b/gcd(a,b);}

const ll INF = 1LL << 60;




//大文字小文字気をつけろ


int main(){
  ll n,x;
  cin >> n >> x;
  ll ans=n;
  ll a=x,b=n-x,c,d;
  if(b>a){swap(a,b);}
  while(b!=0){
    c=a%b;
    d=a/b;
    ans+=d*2*b;
    a=b;
    if(c==0){
      ans-=b;
    }
    b=c;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N, a, b = MAP()

mod = a + b
ans = a * (N // mod)
ans += min(N % mod, a)
print(ans)


Measured memory_bytes: 3440
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>
#include <bitset>
#include <cstdint>

using namespace std;
using lli = long long int;
using i64 = int64_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

int main() {
  char x, y;
  cin >> x >> y;
  if (x < y) cout << '<';
  if (x == y) cout << '=';
  if (x > y) cout << '>';
  cout << '\n';
  return 0;
}



Measured memory_bytes: 256
def examA():
    S = SI()
    if S=="ARC":
        ans = "ABC"
    else:
        ans = "ARC"
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(readline())
def LI(): return list(map(int,readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examA()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 9976
# -*- coding: utf-8 -*-

def calcCons(nA, nB, nC, nD):
    W = nA*a*100 + nB*b*100
    S = nC*c + nD*d
    if W+S == 0:
        return -1
    return 100*S/(W+S)


a, b, c, d, e, f = map(int, input().split())


maxCons = 0
answer_W, answer_S = 0, 0

nA, nB, nC, nD = 0, 0, 0, 0
while nA*a*100 + nB*b*100 + nC*c + nD*d <= f:
    # Operation A
    while nA*a*100 + nB*b*100 + nC*c + nD*d <= f:
        # Operation B
        while nA*a*100 + nB*b*100 + nC*c + nD*d <= f:
            # Operation C
            while nA*a*100 + nB*b*100 + nC*c + nD*d <= f:
                # Operation D
                cons = calcCons(nA, nB, nC, nD)
                # print("{} {} {} {} {}".format(cons, nA, nB, nC, nD))
                if cons > maxCons and cons <= 100*e/(100+e):
                    maxCons = cons
                    answer_W, answer_S = nA*a*100 + nB*b*100, nC*c + nD*d
                nD += 1
            nD = 0
            nC += 1
        nC = 0
        nB += 1
    nB = 0
    nA += 1

if maxCons == 0:
    answer_W = a*100
print("{} {}".format(int(answer_W+answer_S), int(answer_S)))


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

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

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<< #str << " " str<<endl

constexpr int INF = (1 << 28);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7



int main()
{
	while (true) {
		int a, b, d;
		int n1 = INF, n2 = INF;
		bool retry = false;
		bool third = true;
		cin >> a >> b >> d;
		if (!a)break;

	start:;
		REP(i, 1e6) {
			int left = (i * a - d) * (third ? -1 : 1);
			if (left < 0)continue;
			if (left%b == 0) {
				int j = left / b;
				if (i + j < n1 + n2) {
					n1 = i;
					n2 = j;
				}
				else if (i + j == n1 + n2) {
					if (a * i + b * j < a * n1 + b * n2) {
						n1 = i;
						n2 = j;
					}
				}
			}
		}
		//swap(n1, n2);
		if (third) {
			third = false;
			goto start;
		}

		if (!retry) {
			retry = true;
			swap(n1, n2);
			swap(a, b);
			goto start;
		}
		swap(n1, n2);
		cout << n1 << " " << n2 << endl;
	}
	return 0;
}



Measured memory_bytes: 3004
INF=float('inf')
n,w=map(int,input().split())
l=[list(map(int,input().split())) for _ in [0]*n]
dp=[INF]*(sum(l[i][1] for i in range(n))+1)
dp[0]=0
for i in range(n):
    for j in range(len(dp)-1,l[i][1]-1,-1):
        dp[j]=min(dp[j],dp[j-l[i][1]]+l[i][0])
for i in range(len(dp)-1,-1,-1):
    if dp[i]<=w:
        print(i)
        break

Measured memory_bytes: 92116
//BISMILLAH
#include<bits/stdc++.h>
#define ll long long

using namespace std;
int main()
{

      // ll  res,big,small,humty,flag=0,temp=0;
       //int n,x,a,b,check;
       int flag=0;
       char c[1000000],s[1000000];
       scanf("%s%s",c,s);
       int len=strlen(c);
       for(int i=0;i<len;i++) if(c[i]!=s[i]) flag++;

       cout<<flag<<endl;



return 0;
}

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

int main(){
	int a[3], n;
	while(cin >> a[0] >> a[1] >> a[2], a[0]){
		sort(a, a+3);
		double s = sqrt(a[0]*a[0] + a[1]*a[1]);
		cin >> n;
		while(n--){
			double r;cin >> r;
			cout << (s < r*2 ? "OK" : "NA") << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3156
K, N = list(map(int, input().split()))
A = list(map(int, input().split()))


a = 0
b = K - A[-1] + A[0]
for i in range(N - 1):
    a = A[i + 1] - A[i]
    b = max(a, b)
ans = K - b
print(ans)

Measured memory_bytes: 26444
n=int(input())

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

t.sort(reverse=True)

ans = t[0]

i = 1

count = 1

flag = False

while count < n-1:
    ans += t[i]
    if flag:
        flag = False
        i += 1
    else:
        flag = True
    count += 1
print(ans)

Measured memory_bytes: 94204
nums = [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]
ans = int(input())
print(nums[ans-1])

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
typedef long long ll;
ll MOD = 1e9+7;

using namespace std;

int main()
{
	int n,m;
	string s[100];
	string t[100];
	int cnt=0;
	int ans=0;
	
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>s[i];
	}
	cin>>m;
	for(int i=0;i<m;i++)
	{
		cin>>t[i];
	}

	for(int i=0;i<n;i++)
	{
		cnt=0;
		for(int j=0;j<n;j++)
		{
			if(s[i]==s[j])
				cnt++;
		}
		for(int j=0;j<m;j++)
		{
			if(s[i]==t[j])
				cnt--;
		}
		if(ans<cnt)
		{
			ans=cnt;
		}
	}

	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] Ss = new int[N];
        for(int i=0;i<N;i++){
            Ss[i] = sc.nextInt();
        }
        IntStream tens = Arrays.stream(Ss.clone()).filter(i ->{ if( i % 10 == 0){return  true;}else{return  false; } } );
        IntStream notens = Arrays.stream(Ss.clone()).filter(i ->{ if( i % 10 == 0){return  false;}else{return  true; } } );

        int notensSum = Arrays.stream(Ss.clone()).filter(i ->{ if( i % 10 == 0){return  false;}else{return  true; } } ).sum();
        int[] notensAry = Arrays.stream(Ss.clone()).filter(i ->{ if( i % 10 == 0){return  false;}else{return  true; } } ).sorted().toArray();
        int notensLen = notensAry.length;

        for(int i=0;i<notensLen && notensSum % 10 == 0;i++){
            notensSum -= notensAry[i];
        }

        if(notensSum == 0){
            System.out.print(0);
        }else{
            System.out.print(tens.sum() + notensSum);
        }
    }
}

Measured memory_bytes: 28884
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <list>
#include <set>
using namespace std;

int main(){
	int n;
  	set<string> s;
	cin >> n;
	for(int i = 0; i < n; i++){
    	string s_;
      	cin >> s_;
      	s.insert(s_);
    }
  	int ans = s.size();
  	
	cout << ans << endl;
}

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

int main(){
        long double N, K;
        cin >> N >> K;
        long double ret = 0;

        for(int i = 1; i <= N; i++){
                int o = i;
                long double tret = 1;
                while( o < K ){
                        o *= 2;
                        tret *= 0.5;
                }
                ret += tret;
        }
        cout << setprecision(12) << ret/N << endl;
        return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main(){
	long t = 0;
	int time[3] = {};

	scanf("%ld", &t);

	time[0] = static_cast<int>(t / 3600);
	t = (t % 3600);
	time[1] = static_cast<int>(t / 60);
	t = (t % 60);
	time[2] = static_cast<int>(t);

	printf("%d:%d:%d\n", time[0], time[1], time[2]);

	return 0;
}

Measured memory_bytes: 1164
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, X = MAP()
L = LIST()

L = list(accumulate(L))

L.insert(0, 0)
# print(L)

ans = 0
for i in L:
	if i <= X:
		ans += 1
print(ans)

Measured memory_bytes: 5700
/*input

*/

#include<bits/stdc++.h>
using namespace std;
//#define int 					ll
#define ios	    				ios_base::sync_with_stdio(false); cin.tie(0)
#define hell 					1000000007
#define inf 					9e18

// Data Structures //
#define ull 					unsigned long long
#define ll 						long long
#define p_q 					priority_queue
#define pii         			pair<ll,ll>
#define vi          			vector<ll>
#define vii         			vector<pii>
#define mi          			map<ll,ll>
#define mii         			map<pii,ll>
// Functions //
#define pb 						push_back
#define ppb						pop_back
#define all(a)      			(a).begin(),(a).end()
#define gcd(a,b)    			__gcd((a),(b))
#define lcm(a,b)    			((a)*(b)) / gcd((a),(b))
#define mp 						make_pair
#define bs						binary_search
#define lb 						lower_bound
#define ub						upper_bound
#define F						first
#define S						second
#define take(a,n)				for(ll i=0;i<n;i++) cin>>a[i];
#define dbg(x) 					cout << #x << " = " << x << '\n'
#define endl					"\n"
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n"; std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());

#define N  1000005



void solve()
{
	string s,t,u;
	ll n,m,k=0,cnt=0,mx=-hell,mn=hell;
	cin>>s>>t;
	m = s.size();
	n = t.size();
	ll dp[m+1][n+1];
	memset(dp,0,sizeof(dp));
	for(int i=1;i<=m;i++)
	{
		for(int j=1;j<=n;j++)
		{
			if(s[i-1]==t[j-1])
			{
				dp[i][j] = 1 + dp[i-1][j-1];
			}
			else dp[i][j] = max(dp[i][j-1],dp[i-1][j]);
		}
	}
	ll i=m,j=n;
	for(int k=0;k<=m+n;k++)
	{
		if(i==0||j==0) break;
		if(s[i-1]==t[j-1])
		{
			u.pb(s[i-1]);
			i--; j--;
		}
		else if(dp[i][j-1]>=dp[i-1][j])
		{
			j--;
		}
		else if(dp[i-1][j]>dp[i][j-1])
		{
			i--;
		}
	}
	reverse(u.begin(),u.end());
	cout<<u<<endl;
}


signed main()
{
	ios;
	ll n,tests=1,prev=0,i=0;

	//cin>>tests;
	while(tests--)
	{
		solve();
	}
	time
	return 0;
}


Measured memory_bytes: 73972
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N,K,X,Y;
    cin >> N >> K >> X >> Y;
    int ans = 0;
    for(int i = 1; i <= N; i++){
        if(i <= K) ans += X;
        else ans += Y;
    }
    cout << ans << endl;
}


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

using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> ans(10001, 0);
  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= 100; j++) {
      for (int k = 1; k <= 100; k++) {
        int v = i * i + j * j + k * k + i * j + j * k + i * k;
        if (v <= 10000) ans[v]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 1)return 1;
	return kai(x - 1)*x%mod;
}

int mod_pow(int x, int y, int moder) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%moder;
		x = x * x%moder;
		y >>= 1;
	}
	return res;
}

int kaij[214514];

int comb(int x, int y) {
	if (y > x)return 0;
	if (x == y)return 1;
	return kaij[x]* mod_pow(kaij[x - y], mod - 2, mod) % mod * mod_pow(kaij[y], mod - 2, mod) % mod;
}

int n;
int dp[114][4][4][4];


signed main() {
	cin >> n;
	rep(i, 4) {
		rep(j, 4) {
			rep(k, 4) {
				dp[3][i][j][k] = 1;
			}
		}
	}
	dp[3][0][2][1] = 0;
	dp[3][2][0][1] = 0;
	dp[3][0][1][2] = 0;
	//0==A,1==C,2==G,3==T
	for (int i = 4; i <= n; i++) {
		rep(j, 4) {
			rep(k, 4) {
				rep(l, 4) {
					rep(m, 4) {
						if (!((k == 0 && l == 2 && m == 1) || (k == 2 && l == 0 && m == 1) || (k == 0 && l == 1 && m == 2) || (j == 0 && k == 2 && l == 2 && m == 1) || (j == 0 && k == 3 && l == 2 && m == 1) || (j == 0 && k == 2 && l == 3 && m == 1))) {
							dp[i][k][l][m] += dp[i - 1][j][k][l];
							dp[i][k][l][m] %= mod;
						}
					}
				}
			}
		}
	}
	int ans = 0;
	rep(i, 4) {
		rep(j, 4) {
			rep(k, 4) {
				ans += dp[n][i][j][k];
				ans %= mod;
			}
		}
	}
	cout << ans << endl;
}

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

int main() {
  int N, K;
  cin >> N;
  cin >> K;
  int total = 0;
  for(int i=0;i<N;i++){
    int x;
    cin >> x;
    total += min(x, K-x)*2;
  }
  cout << total << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int i,n,flag=0,flag_max=0;
  int a[1001],b[1001];
  
  for(n=0;n<1001;n++){
    a[n]=0;
    b[n]=0;
  }
  scanf("%d",&i);
  for(n=0;n<i;n++) scanf("%d %d",&a[n],&b[n]);
  
  for(n=0;n<i;n++){
    if(a[n]==b[n]) flag++;
    else flag = 0;
    if(flag> flag_max) flag_max = flag;
  }
  if(flag_max>=3) printf("Yes");
  else printf("No");
    
 return 0; 
}

Measured memory_bytes: 1740
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <fstream>
#include <sstream>

using namespace std;

int n;

int price[3]={200,300,500};
int min_price;


int price_cal(int a, int b, int c){
    int ret=0;
    ret+=(a-a%5)*380*0.8 +a%5*380;
    ret+=(b-b%4)*550*0.85+b%4*550;
    ret+=(c-c%3)*850*0.88+c%3*850;
    //cout<<a<<" "<<b<<" "<<c<<endl;;
    return ret;
}

void soba(int a, int b, int c, int now){
    if(a*200+b*300+c*500==n){
        min_price=min(min_price,price_cal(a, b, c));
    }else if(a*200+b*300+c*500>n){
        
    }else{
        if(now==0){
            soba(a+1,b,c,0);
            soba(a,b+1,c,1);
            soba(a,b,c+1,2);
        }else if(now==1){
            soba(a,b+1,c,1);
            soba(a,b,c+1,2);
        }else{
            soba(a,b,c+1,2);
        }
    }
    
}





int main(){
    while(cin>>n){
        if(n==0)break;
        min_price=100000000;
        soba(0, 0, 0, 0);
        cout<<min_price<<endl;
    }
}

Measured memory_bytes: 1160
import std.stdio, std.conv, std.string;
import std.algorithm, std.array, std.container, std.typecons;
import std.numeric, std.math;
import core.bitop;

T RD(T = string)() { static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T)(in string str) { return str.split.to!(T[]); }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool INSIDE(T)(T x, T b, T e) { return x >= b && x < e; }

long mod = pow(10, 9) + 7;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

struct UnionFind
{
	void init(long n) { par = new long[](n); foreach (i; 0..n) par[i] = i; }
	long root(long i) { return par[i] == i ? i : (par[i] = root(par[i])); }
	bool same(long i, long j) { return root(i) == root(j); }
	void unite(long i, long j) { i = root(i); j = root(j); if (i == j) return; par[i] = j; }
	long[] par;
}

void main()
{
	auto N = RD!long;
	auto C = RD!long;

	long[][30] st;
	foreach (i; 0..N)
	{
		auto s = RD!long;
		auto t = RD!long;
		auto c = RD!long - 1;
		st[c] ~= [s, t];
	}
	foreach (i; 0..30)
	{
		st[i].sort!"a < b"();
		long[] newSt;
		bool isCopy = true;
		foreach (j; 0..st[i].length)
		{
			if (j % 2 == 1)
			{
				isCopy = st[i][j] != st[i][j+1];
			}
			if (isCopy) newSt ~= st[i][j];
		}
		st[i] = newSt;
	}
	auto dp = new long[](pow(10, 5)+1);
	foreach (i; 0..30)
	{
		foreach (j; 0..st[i].length)
		{
			if (j % 2 == 0)
			{
				foreach (k; st[i][j]-1..st[i][j+1])
					++dp[k];
			}
		}
	}
	long ans;
	foreach (e; dp) ans = max(ans, e);

	writeln(ans);
	stdout.flush();
}

Measured memory_bytes: 8060
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << x << endl;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int cnt[100005];
int main(){
    int n;
    cin >> n;
    vector<int>a(n);
    int ans = 0;
    rep(i,n){
        cin >> a[i];
        if(a[i] <=100000){
            cnt[a[i]]++;
        }else{
            ans++;
        }
    }
    for(int i = 1; i <= 100000;i++){
        if(cnt[i] >i){
            ans += cnt[i]-i;
        }
        if(cnt[i] < i){
            ans += cnt[i];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define PI 3.14159265358979323

//void quick(int *,long long,long long);
//int comp(char *a,char *b);

int main(){
	
	int a,b,i;
	
	while(scanf("%d %d",&a,&b)!=EOF){
		i=1;
		a=a+b;
		while(a/10!=0){
			a=a/10;
			i++;
		}
		printf("%d\n",i);
	}
	//for(i=0;i<=10000000000;i++);
	return 0;
}

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

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;
#define REP(i, n)  for(int i = 0; i < n; ++i)
#define FOR(i, t, n)  for(ll i = t; i <= (ll)n; ++i)
struct edge {
    int from, to;
    ll cost;
};


class Eratosthenes {
public:
    vector<bool> prime;

    Eratosthenes(int size) {
        prime.resize(size + 1, 1);
        prime[0] = 0;
        prime[1] = 0;
        FOR(i, 2, size) {
            if (prime[i]) {
                for (int j = 2 * i; j <= size; j += i) {
                    prime[j] = 0;
                }
            }
        }
    }

};


class Combination {
    vector<ll> fac; //n!(mod M)
    vector<ll> ifac; //k!^{M-2} (mod M)
public:
    Combination(ll size) {
        fac.resize(size);
        ifac.resize(size);
        fac[0] = 1;
        ifac[0] = 1;
        for (ll i = 0; i < size; i++) {
            fac[i + 1] = fac[i] * (i + 1) % MOD;
            ifac[i + 1] = ifac[i] * mpow(i + 1, MOD - 2) % MOD;
        }
    }

    ll mpow(ll x, ll n) {
        ll ans = 1;
        while (n != 0) {
            if (n & 1) ans = ans * x % MOD;
            x = x * x % MOD;
            n = n >> 1;
        }
        return ans;
    }

    ll comb(ll a, ll b) {
        if (a == 0 && b == 0)return 1;
        if (a < b || a < 0)return 0;
        ll tmp = ifac[a - b] * ifac[b] % MOD;
        return tmp * fac[a] % MOD;
    }
};


ll GCD(ll a, ll b) {
    if (b == 0)return a;
    return GCD(b, a % b);
}

ll LCM(ll a, ll b) {
    ll gcd = GCD(a, b);
    return a / gcd * b;
}

int N, K;

int main() {
    cin >> N >> K;
    vector<int> A(N);
    REP(i, N) {
        cin >> A[i];
    }
    N--;
    K--;
    cout << (N + K - 1) / K << endl;
    return 0;
}


Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	int N, K; cin >> N >> K;
	vector<int> a(K);
	for (int& x: a) cin >> x;
	int x;
	for (x = N; ; x++) {
		bool ok = true;
		for (int y = x; y; y /= 10)
			for (int& d: a)
				if (y % 10 == d)
					ok = false;
		if (ok) break;
	}
	cout << x << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
  using namespace std;
   
  #define ll long long
  #define pb push_back
  #define mp make_pair
  #define ff first
  #define ss second


   
void func(){

ll x,y,a,b,c;
cin>>x>>y>>a>>b>>c;

multiset <ll> ans,a1,b1,c1;

for(int i=0;i<a;i++){
  ll temp;
  cin>>temp;
  a1.insert(temp);
}

for(int i=0;i<b;i++){
  ll temp;
  cin>>temp;
  b1.insert(temp);
}

for(int i=0;i<c;i++){
  ll temp;
  cin>>temp;
  c1.insert(temp);
}
ll sum=0;
for(int i=0;i<x;i++){
  sum = sum + *a1.rbegin();
  ans.insert(*a1.rbegin());
  auto t= a1.end();
  t--;
  a1.erase(t);
}

for(int i=0;i<y;i++){
  sum = sum + *b1.rbegin();
  ans.insert(*b1.rbegin());
  auto t= b1.end();
  t--;
  b1.erase(t);
  
}

for(int i=0;i<c;i++){
  if(*c1.rbegin()>*ans.begin()){
    sum = sum-*ans.begin();
    sum = sum+*c1.rbegin();
    ans.erase(ans.begin());
    auto t= c1.end();
    t--;
    ans.insert(*t);
    c1.erase(t);
  }
  else
    break;
}
cout<<sum<<endl;


}
   
   
  int main(){
          ios_base::sync_with_stdio(false);
          cin.tie(0);
          cout.tie(0);
   
       /* #ifndef ONLINE_JUDGE
        freopen("input.txt", "r" , stdin);
        freopen("output.txt", "w" , stdout);
        #endif*/
   
     ll t=1;
     //cin>>t;
     while(t--)
     func();
   }

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

struct team{
	  int id;
	  int ac,time;
	  vector<int> wa;
	  team(int i, int a, int t, int P){
			id = i; ac = a; time = t;
			wa = vector<int>(P+1,0);
	  }
	  bool operator < (const team& tgt) const {
			if( ac != tgt.ac )
				  return ac < tgt.ac;
			if( time != tgt.time )
				  return time > tgt.time;
			return id < tgt.id;
	  }

};

int main(){
	  while(1){
			int M,T,P,R; cin >> M >> T >> P >> R;
			if(!M) break;
			vector<team> teams;
			for(int i=0; i<T; i++)
				  teams.push_back( team(i+1,0,0,P) );
	  
			for(int i=0; i<R; i++){
				  int m,t,p,j;
				  cin >> m >> t >> p >> j;
				  if( j == 0 ){
						teams[ t-1 ].ac ++;
						teams[ t-1 ].time += m;
						teams[ t-1 ].time += teams[ t-1 ].wa[ p ]*20 ;
						
				  }
				  else{
						teams[ t-1 ].wa[ p ]++;
				  }
			}
			sort(teams.begin(),teams.end());
			reverse(teams.begin(),teams.end());
			
			team pre = team(-1,-1,-1,P);
			for(int i=0; i<T; i++){
				  team corr = teams[i];
				  if( pre.ac == corr.ac and pre.time == corr.time )
						cout << "=" << corr.id;
				  else
						if(i!=0)
							  cout << "," << corr.id;
						else
							  cout << corr.id;
				  pre = corr;
			}
			cout << endl;
	  
	  }
}

Measured memory_bytes: 1236
#include <iostream>
#include <map>
#include <cstdio>
#include <set>
#include <algorithm>
#include <functional>
#include <string>

using namespace std;

string s;

string t = "keyence";

void fail() {
	puts("NO");
	exit(0);
}

int main() {
	cin >> s;
	int to_removed = s.length() - t.length();
	if (to_removed < 0) {
		fail();
	}
	for (int i = 0; i < s.length() && i + to_removed <= s.length(); i++) {
		int l = i, r = i + to_removed; // [l, r)
		int tag = 1;
		for (int j = 0; j < l; j++) if (s[j] != t[j]) tag = 0;
		for (int j = r; j < s.length(); j++) if (s[j] != t[j - r + l]) tag = 0;
		if (tag) {
			puts("YES");
			exit(0);
		}
	}
	fail();
	return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
A = [input() for _ in range(n)]
B = [input() for _ in range(m)]
na = len(A[0])
nb = len(B[0])
flag = False
for i in range(n-nb+1):
    for j in range(n-m+1):
        cnt = 0
        for a, b in zip(A[i:i+nb], B):
            if a[j:j+m] == b:
                cnt += 1
        if cnt == m:
            flag = True
            break
print('Yes' if flag else 'No')


Measured memory_bytes: 9140
s = gets.chomp
prev = s[0]
cnt = 0
1.upto(s.length-1) do |i|
	if s[i] == prev 
		cnt += 1
		#puts "i:#{i}"
		prev = prev == "0" ? "1" : "0"
	else
		prev = s[i]
	end
end
puts cnt


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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

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

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'000'000'001;
constexpr ll LLINF = 4'000'000'000'000'000'001;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int n, m;
    cin >> n >> m;
    vector<int> a(m), c(m);
    for(int i = 0; i < m; ++i){
        int b;
        cin >> a[i] >> b;
        for(int j = 0; j < b; ++j){
            int t;
            cin >> t;
            --t;
            c[i] |= (1 << t);
        }
    }
    vector<vector<int>> dp(m + 1, vector<int>(1 << n, INF));
    dp[0][0] = 0;
    for(int i = 1; i <= m; ++i){
        for(int j = 0; j < (1 << n); ++j){
            dp[i][j | c[i-1]] = min(dp[i][j | c[i-1]], dp[i-1][j] + a[i-1]);
            dp[i][j] = min(dp[i][j], dp[i-1][j]);
        }
    }
    cout << (dp[m][(1 << n) - 1] == INF ? -1 : dp[m][(1 << n) - 1]) << "\n";
    return 0;
}

Measured memory_bytes: 16384
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

N,T = map(int,input().split())
A = [int(i) for i in input().split()]

L_min = [mod for i in range(N)]
L_min[0] = A[0]
for i in range(1,N):
    L_min[i] = min(L_min[i-1],A[i])

A.reverse()
R_max = [0 for i in range(N)]
R_max[0] = A[0]
for i in range(1,N):
    R_max[i] = max(R_max[i-1],A[i])

R_max.reverse()

ans = 0
dif = -mod

for i in range(1,N):
    if dif < R_max[i] - L_min[i] and 0 < R_max[i] - L_min[i]:
        dif = R_max[i] - L_min[i]
        r,l = R_max[i],L_min[i]
        # print(dif)
        ans = 1
    elif dif == R_max[i] - L_min[i]:
        if r == R_max[i]:
            pass
        else:
            r,l = R_max[i],L_min[i]
            ans += 1

print(ans)


Measured memory_bytes: 16976
a = gets.chomp.split('')


['-', '+'].repeated_permutation(3) do |op|
  exp = []
  op.each_with_index do |b, i|
    exp << a[i]
    exp << b
  end
  exp << a[3]
  if eval(exp.join).to_i == 7
    puts "#{exp.join}=7"
    exit(0)
  end
end



Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
int main(){
    
    string S;
    cin >> S;
    
    int len = S.size();
    int count=0;
    vector<int> bn(2019,0), an(2019,0);
    
    for(int i=0; i<len; i++){
        for(int j=0; j<2019; j++){
            an.at((j*10+S.at(i)-'0')%2019) = bn.at(j);
        }
        an.at(S.at(i)-'0')++;
        
        /*
        for(int j=0; j<2019; j++){
            bn.at(j) = an.at(j);
        }
        */
        
        bn = an;
        
        count += bn.at(0);
    }
    
    cout << count << endl;
    
    return 0;
}


Measured memory_bytes: 3584