akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

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...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

int main(){
    int N,C,K;
    cin >> N >> C >> K;

    vector<ll> a(N);
    REP(i,N) cin >> a[i];
    sort(all(a));

    ll cnt = 1;
    ll t = a[0]+K;
    ll ans = 1;
    REP(i,N-1){
        if(cnt==C || a[i+1]>t){
            ans++;
            t=a[i+1]+K;
            cnt=1;
        } else cnt++;
    }

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

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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define INF (1e16)
typedef long long ll;

vector<vector<ll>> d;
vector<vector<pair<int, int>>> g;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int v, e;
    cin >> v >> e;
    d.resize(v, vector<ll> (v));
    g.resize(v);
    rep(i, v){
        rep(j, v){
            d[i][j] = INF;
        }
    }
    rep(i, v) d[i][i] = 0;
    rep(i, e){
        int s ,t, w;
        cin >> s >> t >> w;
        d[s][t] = w;
        g[s].push_back(make_pair(t, w));
    }

    for(int k = 0; k < v; k++){
        rep(i, v){
            rep(j, v){
                if(d[i][k] == INF || d[k][j] == INF) continue;
                if(d[i][k] + d[k][j] < d[i][j]){
                    d[i][j] = d[i][k] + d[k][j];
                }
            }
        }
    }

    for(int k = 0; k < v; k++){
        rep(i, v){
            rep(j, v){
                if(d[i][k] == INF || d[k][j] == INF) continue;
                if(d[i][k] + d[k][j] < d[i][j]){
                    cout << "NEGATIVE CYCLE" << endl;
                    exit(0);
                }
            }
        }
    }

    rep(i, v){
        rep(j, v - 1){
            if(d[i][j] == INF) cout << "INF" << " ";
            else cout << d[i][j] << " ";
        }
        int j = v - 1;
        if(d[i][j] == INF) cout << "INF";
        else cout << d[i][j];
        cout << endl;
    }


    return 0;
}



Measured memory_bytes: 3288
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    ll X,Y;
    cin>>X>>Y;
    ll counter=1;
    for(int i=0; ; i++) {
        if(X>Y) break;
        X+=X;
        //cout<<X<<endl;
        counter++;
    }
    cout<<counter-1<<endl;
}

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

int main(){
  string S;
  cin >> S;
  if(S == "Sunny")
    cout << "Cloudy" << endl;
  if(S == "Cloudy")
    cout << "Rainy" << endl;
  if(S == "Rainy")
    cout << "Sunny" << endl;
}

Measured memory_bytes: 256
/// f.cpp

# include <stdio.h>
# include <bits/stdc++.h>
using namespace std;
const pair < int , int > DD[] = {{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define IOS ios_base :: sync_with_stdio(0);cin.tie(0)
# define p(v) cerr << #v << " = " << v << '\n'
# define p2(v) cerr << #v << " = " << (complex < __typeof(v.x) > (v.x,v.y)) << '\n'
# define vi vector < int >
# define vl vector < ll >
# define pll pair < ll , ll >
# define pii pair < int , int >
# define mp make_pair
# define db long double
# define fail puts("-1")
# define yes puts("YES")
# define no puts("NO")
# define PP puts("Possible")
# define II puts("Impossible")
# define vii vector < pii >
# define vll vector < ll >
# define pb push_back
# define pdd pair < db , db >
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
int main(void)
{
    #ifdef CF
    freopen("input","r",stdin);
    #endif // CF
    srand(time(0));
    fo << fixed << setprecision(7);
    cerr << fixed << setprecision(7);
    int n,m;
    fi>>n>>m;
    if (n <= m)
        return II * 0;
    auto ask = [&](int a,int b)
    {
        if (!(1 <= a && a <= n + m && 1 <= b && b <= n + m))
            return 0;
        fo << "? " << (a - 1) << ' ' << (b - 1) << '\n';
        fflush(stdout);
        char ans;
        fi>>ans;
        fflush(stdin);
        return (int)(ans == 'Y');
    };
    static int t[1 << 20];
    int sz = 0;
    for (int i = 1;i <= n + m;++i)
    {
        t[++sz] = i;
        if (sz >= 2)
        {
            if (!ask(t[sz - 1],t[sz]))
                sz -= 2;
        }
    }
    int last = t[sz];
    string answer = "";
    for (int i = 1;i <= n + m;++i)
        answer += ask(last,i) + '0';
    fo << "! " << answer << '\n';
    fflush(stdout);
    cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
    return 0;
}


Measured memory_bytes: 724
n = list(input())
#print(n)
#print(n[-1])
if n[-1] == '2' or n[-1] == '4' or n[-1] == '5' or n[-1] == '7' or n[-1] == '9':
    print("hon")
elif n[-1] == '0' or n[-1] == '1' or n[-1] == '6' or n[-1] == '8':
    print("pon")
else:
    print("bon")

Measured memory_bytes: 9056
class Dice():
    def __init__(self, ls = [0 for i in range(6)]):
        self.ls = ls
        
    def now(self):
        return ls
    
    def S(self):
        ls = self.ls
        n_ls = [0 for i in range(6)]
        n_ls[0] = ls[4]
        n_ls[1] = ls[0]
        n_ls[2] = ls[2]
        n_ls[3] = ls[3]
        n_ls[4] = ls[5]
        n_ls[5] = ls[1]
        
        return Dice(n_ls)
    
    def N(self):
        ls = self.S().S().S().ls
        return Dice(ls)
        
    def E(self):
        ls = self.ls
        n_ls = [0 for i in range(6)]
        n_ls[0] = ls[3]
        n_ls[1] = ls[1]
        n_ls[2] = ls[0]
        n_ls[3] = ls[5]
        n_ls[4] = ls[4]
        n_ls[5] = ls[2]
        return Dice(n_ls)
    
    
    def W(self):
        ls = self.E().E().E().ls
        return Dice(ls)
        
        
        
    def R_rot(self):
        return self.E().S().W()
        
    def rot(self, num):
        for _ in range(num):
            self = self.R_rot()
        return self

n = int(input())

ls = [ list(map(int, input().split())) for _ in range(n)]


a = Dice(ls[0])

me = [a, a.N(), a.W(), a.E(), a.S(), a.S().S()]

judge = False

for i in me:
    for j in range(4):
        #print(i.rot(j).ls)
        for k in ls:
            
            if i.rot(j).ls != a.ls and i.rot(j).ls == k:
                judge = True#一致するものあり
                

if judge == True:
    print('No')
else:
    print('Yes')
            


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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef _DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif


signed main() {

    int n;
    cin >>n;
    int ans=0;
    rep(i,100000){
        if(i*i<=n) ans = i*i;
    }
    cout << ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int min(int a,int b){return a > b ? a : b;}

int main()
{
    long long h,w;
    long long ans = 0;
    
    scanf("%lld %lld",&h,&w);

    ans = h * w;
    if(h == 1 || w == 1)
    {
        printf("%d",1);
    }
    else if(h % 2 == 1 && w % 2 == 1)
    {
        printf("%lld",ans / 2 + 1);
    }
    else
    {
        printf("%lld",ans / 2);
    }
    
}


Measured memory_bytes: 128
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<math.h>
using namespace std;

const int MAX = 100000;
const string str[] = {"AC","WA","TLE","RE"};

int main(){
    int N;
    int cnt[4] = {0};

    cin >> N;
    for(int i = 0;i < N;i++){
        string S;
        cin >> S;

        for(int i = 0;i < 4;i++){
            if(S == str[i])cnt[i]++;
        }
    }

    for(int i = 0;i < 4;i++){
        cout << str[i] << " x " << cnt[i] << endl;
    }

    return 0;
}



Measured memory_bytes: 3116
#include<iostream>
#include<cstdio>
#include<string>
#include<map>
#include<algorithm>
using namespace std;

int W,H,nx,ny;
char kaju[111][111];
int dx[4]={0,1,0,-1};
int dy[4]={-1,0,1,0};
char fulu;
int hata=0;

int fact(int x,int y){
  kaju[x][y]='.';
  for(int i=0;i<4;i++){
    nx=x+dx[i];
    ny=y+dy[i];
    if(0 <= nx && nx < H && 0 <= ny && ny < W && kaju[nx][ny] == fulu){
      fact(nx,ny);
    }
  }
}


int main(){
  while(1){
    hata=0;
    cin >> H >> W;
    if(H == 0 && W == 0)break;
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
	cin >> kaju[i][j];
      }
    }
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
	if(kaju[i][j]!='.'){
	  fulu=kaju[i][j];
	  fact(i,j);
	  hata++;
	}
      }
    }
    cout << hata << endl;
  }
}

 

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

int N;
vector<int> A;

int cut_inc(int i) {
  int res = i;
  while (A[res] <= A[res + 1] && res < N - 1) {
    res++;
  }
  return res;
}

int cut_dec(int i) {
  int res = i;
  while (A[res] >= A[res + 1] && res < N - 1) {
    res++;
  }
  return res;
}

void agc013a() {
  ll res = 0;
  int cut = 0;
  while (cut < N - 1) {
    cut = max(cut_inc(cut), cut_dec(cut)) + 1;
    res++;
  }
  if (cut != N) {
    res++;
  }
  cout << res << "\n";
  return;
}

int main() {
  cin >> N;
  A.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  agc013a();
  return 0;
}

Measured memory_bytes: 640
// clang-format off
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i,n) for(ll i=n-1; i>=0; --i)
#define rrep1(i,n) for(ll i=n; i>0; --i)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define SORT_DESC(x) sort(all(x), greater<>())
#define pb push_back
#define mp make_pair
#define coutl cout<<fixed<<setprecision(10)
#define ANS(ans) cout<<ans<<endl;
const ll LINF = (1LL << 62) - 1;
const int INF = (1 << 30) - 1;
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;}
// clang-format on

void solve(long long a, long long b) {
  if (a < b)
    rep(i, b) cout << a;
  else
    rep(i, a) cout << b;
  cout << endl;
}

// clang-format off
int main() {
  long long a;
  scanf("%lld",&a);
  long long b;
  scanf("%lld",&b);
  solve(a, b);
  return 0;
}


Measured memory_bytes: 256
import math
n = int(input())
l = int(math.sqrt(n))
ans = 0
  
insu = []
sisu = []
i = 2
while i <= l:
  if n % i == 0:
    if i in insu:
      sisu[insu.index(i)] += 1
    else:
      insu.append(i)
      sisu.append(1)
    n //= i
  else:
    i += 1
if n != 1:
  insu.append(n)
  sisu.append(1)
  
if not insu:
  if n == 1:
    print(0)
  else:
    print(1)
  exit()

for s in sisu:
  cnt = 1
  while cnt * (cnt + 1) / 2 <= s:
    ans += 1
    cnt += 1
    
# print(insu)
# print(sisu)
print(ans)

Measured memory_bytes: 9064
#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() {
  int x,y;
  cin >> x >> y;
  ll a = 2 * x - y / 2;
  ll b = y / 2 - x;
  ll result = 2 * a + 4 * b;
  if(result == y && a + b == x && a >= 0 && b >= 0) {
    cout << "Yes" << endl;
  }else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
int main(){
    int n;
    cin>>n;
    vi a(n);
    rep(i,n){
        int x;
        cin>>x;
        x-=(i+1);
        a[i]=x;
    }

    sort(been(a));

    ll ans=0;
    int b;
    if(n%2==0){
        b=(a[n/2-1]+a[n/2])/2;
    }
    else {
        b=a[(n+1)/2-1];
    }
    
    rep(i,n){
        ans+=abs(a[i]-b);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace あああああああああ
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] inputs = Console.ReadLine().Split(' ');
            int k = int.Parse(inputs[0]);
            int x = int.Parse(inputs[1]);
            Console.WriteLine(500 * k >= x ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int gcd(int a, int b) {
   
    if (b == 0) return a;

    return gcd(b, a%b);

}
    

int main() {
    int N;
    cin >> N;
    vector<int> A;
    int in;
    for (int i = 0; i < N; i++) {
        cin >> in;
        A.push_back(in);
    }
    sort(A.begin(), A.end(), greater<int>());
    
    int ans = A[0];
    int a, b;
    for(int i = 1; i < N; i++) {
        if(ans > A[i]) ans = gcd(ans, A[i]);
        else           ans = gcd(A[i], ans);
    }
    cout << ans << endl;
    return 0;
}

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

int d[50][410][410];

int main(){
	const int INF = 1 << 30;
	int N, Ma, Mb;
	cin >> N >> Ma >> Mb;
	vector<int> a(N + 1), b(N + 1), c(N + 1);
	for (int i = 1; i <= N; i++){
		cin >> a[i] >> b[i] >> c[i];
	}

	for (int i = 0; i <= N; i++){
		for (int ma = 0; ma <= N*10; ma++){
			for (int mb = 0; mb <= N*10; mb++){
				d[i][ma][mb] = INF;
			}
		}
	}

	for (int i = 1; i <= N; i++){
		for (int ma = 1; ma <= N*10; ma++){
			for (int mb = 1; mb <= N*10; mb++){
				if((ma < a[i]) || (mb < b[i])){
					d[i][ma][mb] = d[i - 1][ma][mb];
					continue;
				}

				if ((ma == a[i]) && (mb == b[i])){
					d[i][ma][mb] = min(d[i - 1][ma][mb], c[i]);
				} else if (d[i - 1][ma - a[i]][mb - b[i]] != INF){
					d[i][ma][mb] = min(d[i - 1][ma][mb], d[i - 1][ma - a[i]][mb - b[i]] + c[i]);
				} else {
					d[i][ma][mb] = d[i - 1][ma][mb];
				}
			}
		}
	}

	int res = INF;
	for (int ma = 1; ma <= N*10; ma++){
		for (int mb = 1; mb <= N*10; mb++){
			if (ma*Mb != mb*Ma) continue;

			res = min(res, d[N][ma][mb]);
		}
	}

	if (res == INF) cout << -1 << endl;
	else cout << res << endl;

	return 0;
}


Measured memory_bytes: 28928
#include<cstdio>
#include<iostream>
#include<algorithm>
 
using namespace std;
 
int main() 
{
	int n,m;
	while(cin >> n >> m)
	{
		if(n % m == 0)  printf("-1\n");
		else printf("%d\n",n);
	}
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  long long int a[100],n,i,min=1000000000,max=0;
  scanf("%lld",&n);
  for(i=0;i<n;i++){
    scanf("%lld",&a[i]);
    if(max<a[i]) max=a[i];
    if(min>a[i]) min=a[i];
  }
  printf("%lld",max-min);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <stdio.h>

using namespace std;

int main()
{
    double r;
    cin >> r;
    //int ;
    double x, y;
    x = 2 * r * 3.141592653589;
    y = r * r * 3.141592653589;
//  cout <<  << endl;
    printf("%f %f\n", y, x);
}



Measured memory_bytes: 3212
//#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
//#include <queue>
//#include <stack>
#include <cstring>
#include <cassert>

using namespace std;

#ifdef LOCAL_DEBUG
#include <local_debug.h>
#define DEBUG(x...) {                                       \
   cerr << "\e[91m";                                        \
   cerr << __LINE__ << ": " << #x << " = "; DBG::_print(x); \
   cerr <<"\e[39m";                                         \
}
#else
#define DEBUG(x...)
#endif

#define SZ(a) int((a).size())
#define REP(i,n) for(int i=0,_n=(n);i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)

typedef long long llong;
typedef vector<int> VI;
typedef vector<VI> VVI;



int main(int argc, char* argv[]) {
   ios_base::sync_with_stdio(false); 
   cin.tie(nullptr);

   string s;
   cin >> s;
   
   cout << (isupper(s[0]) ? "A" : "a") << endl;

   return 0;
}


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

typedef long long int Int;

void faster()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
Int n,s;

int main()
{
    faster();
    string s,t;
    cin>>s;
    cin>>t;
    cout<<t<<s;
    

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
    
    typedef pair<long , long> pair_t;
    
    bool comp(const pair_t &a , const pair_t &b){
        return a.first < b.first;
    }
    
 
    int main(){
      int n ;
      cin >> n;
      vector<long> v;
      long t;
      for(int i = 0; i < n ; i++){
          cin >> t;
          v.push_back(t);
      }
      sort( v.begin(), v.end() , std::greater<>());
      long r = 0;
      long halfn;
      halfn = v[0] / 2;
      vector<pair_t> v2;
      for(int i = 1 ; i < n ; i++){
          pair_t pt;
          pt.first = abs(v[i] - halfn) ;
          pt.second = v[i];
          v2.push_back(pt);
      }
      sort( v2.begin(), v2.end() , comp);
      
      cout << v[0] << " " << v2[0].second <<  endl;

      return 0;
    }

Measured memory_bytes: 3188
'use strict'

function main(s) {

  s = s.split('\n')[0].split(' ').map(x => Number(x));
  const N = s[0];
  const K = s[1];
  const result = K * Math.pow(K - 1, N - 1);

  console.log(result);

}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 11468
// D - XOR World
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll f0(ll n){//f(0,n)
	ll cnt = (n+1)/2;
	ll c = cnt%2;
	if(n%2==0) c ^= n;
	return c;
}

ll f(ll A, ll B){
	return f0(B) ^ f0(A-1);
}

int main(){
	ll A,B; cin>>A>>B;
	cout<<  f(A,B) <<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <limits>
#include <ios>
#include <iomanip>
#include <stdio.h>
#include <iomanip>
#include <queue>
using namespace std;

#define rep(i,N) for(int (i)=0; (i)<(N); (i)++)
#define revrep(i,N) for(int (i)=(N)-1; (i)>=0; (i)--)
#define dump(vec) for(int i = 0; i < (vec).size(); i++){cout << vec.at(i) << ",";}cout << endl

typedef long long ll;

int main(void)
{
    int N;
    cin >> N;
    vector<int> W(N);
    rep(i,N){
        cin >> W.at(i);
    }

    int ans = 100*100+1;
    rep(i,N){
        int s1 = 0;
        int s2 = 0;
        for(int j = 0; j <= i; j++){
            s1 += W.at(j);
        }
        for(int j = i+1; j < N; j++){
            s2 += W.at(j);
        }

        ans = min(ans, abs(s2-s1));
    }

    cout << ans << endl;
    

    return 0;
}


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

int main() {
  int a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;

  int ans_sugar, ans_total;
  double density = -1.0;
  for (int i = 0; i * a * 100 <= f; i++) {
    for (int j = 0; j * b * 100 <= f; j++) {
      for (int k = 0; k * c <= f; k++) {
        for (int l = 0; l * d <= f; l++) {
          int water = i * a * 100 + j * b * 100;
          int sugar = k * c + l * d;
          int total = sugar + water;
          if (total == 0) continue;
          if (total > f) continue;
          if (sugar * 100 > e * water) continue;
          if (density < 100 * sugar / (double)total) {
            density = 100 * sugar / (double)total;
            ans_sugar = sugar;
            ans_total = total;
          }
        }
      }
    }
  }

  cout << ans_total << " " << ans_sugar << endl;
}

Measured memory_bytes: 3608
from itertools import accumulate


def solve(n, k, ppp, ccc):
    NINF = -(10 ** 18)
    ans = NINF

    checked = [False] * n
    for s in range(n):
        if checked[s] == True:
            continue
        checked[s] = True
        scores = [ccc[ppp[s]]]
        v = ppp[s]
        while v != s:
            scores.append(ccc[ppp[v]])
            checked[v] = True
            v = ppp[v]

        l = len(scores)
        d, m = divmod(k, l)
        loop = sum(scores)

        if d > 0:
            d -= 1
            m += l

        scores += scores * 2
        scores.insert(0, 0)
        acc = list(accumulate(scores))
        tmp = max(max(acc[i + 1:i + m + 1]) - acc[i] for i in range(l))
        ans = max(ans, tmp, loop * d + tmp)

    return ans


n, k = map(int, input().split())
ppp = list(map(int, input().split()))
ppp = [p - 1 for p in ppp]
ccc = list(map(int, input().split()))

print(solve(n, k, ppp, ccc))


Measured memory_bytes: 10488
N,H=map(int,input().split(' '))
A=0
B=[]
ans = 0
for i in range(N):
    a,b=map(int,input().split(' '))
    A=max(a,A)
    B.append(b)
B=sorted([i for i in B if i > A],reverse=True)
for i in B:
    H -=i
    ans += 1
    if H<=0:
        print(ans)
        exit()
ans+=-((-1*H)//A)
print(ans)

Measured memory_bytes: 9052
/*
 * If you're not willing to make sacrifices yourself, you'll never be
 * able to change anything. In order to overcome monsters, you must
 * be willing to abandon your own humanity.
 * ~ Arlert
 */

#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int> II;
typedef vector<II> VII;
typedef vector<int> VI;
typedef vector<VI> VVI;

typedef long long int LL;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(), a.end()
#define SET(a, b) memset(a, b, sizeof(a))
#define si(n) scanf("%d", &n)
#define dout(n) printf("%d\n", n)
#define sll(n) scanf("%lld", &n)
#define lldout(n) printf("%lld\n", n)

#define TRACE

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

#define fast_io                     \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL)

#define endl '\n'

int main() {
  fast_io;
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    ans += b - a + 1;
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
    long n;cin>>n;
    vector<long> a(n);
    vector<long> b(1000001,0);
    for(long i=0;i<n;i++){
        cin>>a[i];
        b[a[i]]++;
    }
    sort(a.begin(),a.end());
    vector<bool> dp(a[n-1]+1,true);
    for(int i=0;i<n;i++){
        if(dp[a[i]]){
            int j=2;
            while(a[i]*j<=a[n-1]){
                dp[a[i]*j]=false;
                j++;
            }
            if(b[a[i]]>=2){
                dp[a[i]]=false;
            }
        }
    }
    long res=0;
    for(int i=0;i<n;i++){
        if(dp[a[i]])res++;
    }
    cout<<res<<endl;
}


Measured memory_bytes: 12716
n = int(input())
l = list(map(int,input().split()))
import itertools
ans = 0
for i in itertools.combinations(l, 3):
    if abs(i[0]-i[1])<i[2] and i[2] < i[0]+i[1] and i[0]!=i[1] and i[1]!=i[2] and i[2]!=i[0]:
        ans += 1
print(ans)

Measured memory_bytes: 9140
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
 
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <iterator>
#include <functional>
#include <limits>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <stack>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
typedef int64_t ll;
 
#define endl '\n'
#define int ll
ll mod=1e9+7;
ll mod1=1e9+5;
ll power(ll a,ll b)
{
    if(b==0) return 1;
    else if(b%2==0)
        return power((((a%mod)*(a%mod))%mod),b/2)%mod;
    else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
}

int dp[100019];
int32_t main()
{
    IOS
    
    int n,w;
    cin>>n>>w;
    int a[n],b[n];
    for(int i=0;i<n;++i)
        cin>>a[i]>>b[i];
    for(int i=1;i<=100010;++i)
        dp[i]=100000000000;
    dp[0]=0;
    for(int i=1;i<=n;++i)
    {
        //dp[b[i-1]]=min(dp[b[i-1]],a[i-1]);
        for(int j=100000;j>=b[i-1];--j)
        {

            dp[j]=min(dp[j],dp[j-b[i-1]]+a[i-1]);
        }
        
    }
    int ans=0;
    for(int i=0;i<=100000;++i)
    {
        if(dp[i]<=w)
            ans=i;
    }
    cout<<ans;


}



Measured memory_bytes: 1024
#include<iostream>
using namespace std;
void dfs(int,int,int);
int cnt,big,mas[93][93],d[]={0,1,0,-1},h,w;
int main(){
  while(cin >> w >> h && w||h){
    big = 0;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        cin >> mas[i][j];
      }
    }
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        if(mas[i][j]==1){
          mas[i][j] = 0;
          dfs(i,j,1);
          mas[i][j] = 1;
        }
      }
    }
    cout << big << endl;
  }
}
void dfs(int x,int y,int cnt){
  if(cnt > big) big = cnt;
  for(int i=0;i<4;i++){
    int nx=d[i]+x,ny=d[3-i]+y;
    if(nx>=0&&nx<h&&ny>=0&&ny<w&&mas[nx][ny]==1){
      mas[nx][ny] = 0;
      dfs(nx,ny,cnt+1);
      mas[nx][ny] = 1;
    }
  }
}

Measured memory_bytes: 1192
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

N = int(input())
S = [0] * N
for i in range(N):
    s, t = input().split()
    S[i] = (s, int(t))
X = input()

cnt = False
ans = 0
for s, t in S:
    if s == X:
        cnt = True
    elif cnt:
        ans += t

print(ans)

Measured memory_bytes: 9444
#include <iostream>
#include <stdio.h>
using namespace  std;

int n ,a[20];
int solve (int i,int m);
int solve (int i,int m){
    if(m==0) return true;
    if (i>=n)return false;
    int res=solve(i+1,m)||solve(i+1,m-a[i]);
    return res;
}
int main(){
    int q,m;
    cin>>n;
    for (int i=0;i<n;i++){
        cin>>a[i];
    }
    cin>>q;
    int i=0;
    while(q--){
        cin>>m;
        if(solve(0,m)){
            cout<<"yes"<<endl;
        }
        else {
            cout<<"no"<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3088
#include <stdio.h>

int main(){
    int W, H, x, y, r;
    
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    
    if((x-r)>=0&&(x+r)<=W&&(y-r)>=0&&(y+r)<=H){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    
    return 0;
}


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

using namespace std;

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

#define MOD 1000000007

const int MAX = 2000;
ll fac[MAX], finv[MAX], inv[MAX];

void Cinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
ll C(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
    int n, k;
    cin >> n >> k;
    Cinit();
    for(ll i = 1; i <= k; i++){
        ll ad = 0;
        ad = C(k-1,i-1);
        ad = (ad*C(n-k+1,i))%MOD;
        cout << ad << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<ll>
#define pb push_back
#define ff first
#define ss second
#define inf 2e18
#define ull unsigned long long
#define pi acos(-1.0)
#define mod 1000000007
#define lop0(n) for(ll i=0;i<n;i++)
#define lopj(n) for(ll j=0;j<n;j++)
#define lop1(n) for(ll i=1;i<=n;i++)
#define all(v) v.begin(),v.end()
ll Set(ll N,ll pos){ return N=N | (1LL<<pos); }
ll reset(ll N,ll pos){ return N= N & ~(1LL<<pos); }
bool check(ll N,ll pos){ return (bool)(N & (1LL<<pos)); }
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

main()
{
    ll n;
    cin>>n;
    string ans;
    while(n>0)
    {
        n-=1;
        ans.pb('a'+(n%26));
       
        n/=26;
    }
    reverse(all(ans));
    cout<<ans;
}



Measured memory_bytes: 3616
N, Q = map(int, input().split())
S = input()
lr = []
for i in range(Q):
    lr.append(list(map(int, input().split())))

ACnum = [0]
for i in range(N - 1):
    ACnum.append(ACnum[-1])
    if("AC" == S[i:i + 2]):
        ACnum[i + 1] += 1
#print("ACnum = {}".format(ACnum))

for l, r in lr:
    print(str(ACnum[r - 1] - ACnum[l - 1]))


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

typedef long long lint;
typedef pair<int, int> pii;
typedef priority_queue<int, vector<int>, greater<int>> PQ;

const int INF = 2e9;
const int MOD = 1e9+7;
const int MAX = 1e5+10;
const lint LNF = 2e18;

int n, m, A[MAX];
lint now, ans=LNF;
lint P[MAX], Q[MAX];

int dist(int a, int b){
	return (b>=a) ? b-a : b+m-a;
}

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
	
	cin>>n>>m;
	for(int i=1; i<=n; i++) cin>>A[i];

	for(int i=2; i<=n; i++){
		now += min(dist(A[i-1], A[i]), 1+dist(1, A[i]));
	}

	for(int i=2; i<=n; i++){
		int l = A[i-1]%m+1, r = A[i];
		P[l]--, P[r]++;
		if(l>r) P[m]++, P[1]--;
		Q[r] += dist(A[i-1], A[i])-1;
	}

	lint sum1=0, sum2=0;
	for(int i=1; i<=m; i++){
		now += sum1 + sum2; sum2=0;
		ans = min(ans, now);
		sum1+=P[i], sum2+=Q[i];
	}

	cout<<ans<<'\n';

	return 0;
}


Measured memory_bytes: 2176
import math
import itertools
from collections import deque
import bisect
import heapq

def IN(): return int(input())
def sIN(): return input()
def lIN(): return list(input())
def MAP(): return map(int,input().split())
def LMAP(): return list(map(int,input().split()))
def TATE(n): return [input() for i in range(n)]
ans = 0

def bfs(sx,sy):
    global count 
    
    d = [[-1] * w for i in range(h)]

    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]

    que = deque([])
    que.append((sx, sy))#スタート座標の記録
    d[sx][sy] = 0#スタートからスタートへの最短距離は0

    while que:#中身がなくなるまで
        p = que.popleft()
        if p[0] == h-1 and p[1] == w-1:#ゴールなら終わり
            break
        for m in range(4):#現在地から4方向の移動を考える
            nx = p[0] + dx[m]
            ny = p[1] + dy[m]

            if 0 <= nx < h and 0 <= ny < w:
              if maze[nx][ny] != "#" and d[nx][ny] == -1:
                que.append((nx, ny))#↑範囲内である＆壁でない＆まだ通ってない
                d[nx][ny] = d[p[0]][p[1]] + 1

    if d[h-1][w-1] == -1:
      return -1
    else:
      for i in range(h):
        count += maze[i].count('.')
      count -= 2#スタートとゴールの分引いた
      return count - d[h-1][w-1] + 1
  
  

h,w = MAP()
maze = [list(input()) for i in range(h)]
count = 0

print(bfs(0,0))


Measured memory_bytes: 3440
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstring>
#include <string>
#include <set>
using namespace std;
#define maxn 100000+5
typedef long long int ll;
const double INF = 1e20;
const double pi = acos (-1.0);
int vis[5];
int main () {
    int n,a,b;
    scanf("%d%d%d",&n,&a,&b);
    printf("%d ",min(a,b));
    if(a+b<=n)printf("0");
    else printf("%d",a+b-n);
   //while(1)getchar();
    return 0;
}


Measured memory_bytes: 256
import numpy as np
import itertools
N,M,X=map(int,input().split())
arr=[list(map(int,input().split())) for _ in range(N)]
ans=9999999999
 
V=list(itertools.product([0,1], repeat=N))
 
for v in V:
  cost=0
  C=[0]*M
  for n in range(N):
    if v[n]==1:
      cost += arr[n][0]
      for j in range(1,M+1):
        C[j-1] += arr[n][j]
      
  if min(C) >= X:
    ans=min(ans,cost)
    
if  ans ==  9999999999: 
  print(-1)
else:
  print(ans)
    


Measured memory_bytes: 27488
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define iton for(long i=0;i<n;i++)
#define itok for(long i=0;i<k;i++)
#define jton for(long j=0;j<2;j++)
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    long n,k;
    cin>>n>>k;
    vector<vector<long>> v;
    iton
    {
        vector<long> s(2);
        for(long j=0;j<2;j++)
        {
            cin>>s[j];
        }
        v.push_back(s);
    }
    vector<vector<long>> dp;
    iton
    {
        vector<long> s(k+1,0);
        dp.push_back(s);
    }
    for(long j=0;j<k+1;j++)
    {
        if(j >= v[0][0])
        {
            dp[0][j] = v[0][1];
        }
    }
    for(long i=1;i<n;i++)
    {
        for(long j=1;j<k+1;j++)
        {   
            if(  j >= v[i][0] )
            dp[i][j] = max( v[i][1] + dp[i-1][j-v[i][0]] , dp[i-1][j] );

            else 
            dp[i][j] = dp[i-1][j];
        }
    }
    cout<<dp[n-1][k];
}


Measured memory_bytes: 79216
#include<cstdio>
int main(){
    int n,t,t0,t1,tsum=0;
    scanf("%d%d%d",&n,&t,&t0);
    for(int i=1;i<n;i++){
        scanf("%d",&t1);
        tsum+=(t1-t0>t)?t:(t1-t0);
        t0=t1;
    }
    printf("%d",tsum+t);
    return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N, M;
    cin >> N >> M;

    if(N < M) swap(N, M);
    ll res;
    if(N == 1){
    	res = 1;
    }else if(M == 1){
    	res = N-2;
    }else{
    	res = (N-2)*(M-2);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int thp,tatt,ahp,aatt;
    cin>>thp>>tatt>>ahp>>aatt;
    if(((thp+aatt-1)/aatt)*tatt>=ahp){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
}

Measured memory_bytes: 3604
#include <iostream>
#include <cmath>
#define ll long long
using namespace std;

int main(){
    long double n, k;
    cin >> n >> k;
    ll a, b, c, d;
    a = ceil(n/k);
    b = floor(n/k);
    c = abs(n - a*k);
    d = abs(n - b*k);
    cout << min(c, d) ;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<iomanip>

using namespace std;

int main(void) {
	int a, b;
	cin >> a >> b;
	if (a < 0 && b>0) {
		cout << "Zero";
		return 0;
	}
	if (a > 0 && b > 0) {
		cout << "Positive";
		return 0;
	}
	if (a < 0 && b < 0) {
		if (abs(a - b) % 2 == 0) {
			cout << "Negative";
		}
		else {
			cout << "Positive";
		}
	}
	return 0;
}

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

map<char, int> charToInt = {{'R',1},{'G',2},{'B',4}};

int main() {
    int n;
    string s;
    cin >> n >> s;
    vector<int> t;
    ll r = 0, g = 0, b = 0;

    rep(i, n) {
        if (s[i] == 'R') r++;
        else if (s[i] == 'G') g++;
        else b++;
        t.push_back(charToInt[s[i]]);
    }

    ll ans = r * g * b;
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
            int k = j + (j - i);
            if (k > n) continue;
            if (t[i] + t[j] + t[k] == 7) --ans;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(signed i=0;i<n;++i)
#define int long long
#define str string
#define vint vector<signed>
#define pint pair<signed,signed>
#define pb(a) push_back(a)
#define all(v) v.begin(),v.end()
#define fst first
#define snd second
#define yn(b) cout<<((b)?"Yes":"No")<<endl
#define YN(b) cout<<((b)?"YES":"NO")<<endl
#define call(a) for(auto t:a)cout<<t<<" ";cout<<endl
#define ENDL printf("\n");
#define debg(a) cout<<#a<<":"<<a<<endl;

signed main(){
  int n;
  cin>>n;
  vector<pair<signed,signed>> ab(n),cd(n);
  rep(i,n)cin>>ab[i].snd>>ab[i].fst;
  rep(i,n)cin>>cd[i].fst>>cd[i].snd;
  sort(all(ab));
  sort(all(cd));
  int res=0;

  rep(i,n){
    for(int j=n-1;j>=0;--j){
      if(ab[j].snd<cd[i].fst && ab[j].fst<cd[i].snd){
        res++;
        ab.erase(ab.begin()+j);
        break;
      }
    }
  }

  cout<<res<<endl;
  
  //rep(i,n)printf("%d %d %d %d\n",ab[i].fst,ab[i].snd,cd[i].fst,cd[i].snd);
  
  return 0;

}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

#define INF 100000000000

int N;
long long W, w[102], v[102];
long long dp[102][1000000];

int main(void)
{
    cin >> N >> W;
    for (int i = 0; i < N; i++)
    {
        cin >> w[i] >> v[i];
    }

    for (int i = 0; i < N; i++)
    {
        for (long long j = 0; j < 1000000; j++)
        {
            dp[i][j] = INF;
        }
    }
    dp[0][0] = 0;

    for (int i = 0; i <= N; i++)
    {
        for (long long j = 0; j < 1000000; j++)
        {
            if (j < v[i])
            {
                dp[i + 1][j] = dp[i][j];
            }
            else
            {
                dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i]);
            }
        }
    }

    long long ans = INF;
    for (long long i = 1; i < 1000000; i++)
        if (W >= dp[N][i])
        {
            ans = i;
        }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 800500
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

#define INF 1000000021
#define MOD 1000000007
#define pb push_back
#define sqr(a) (a)*(a)
#define M(a, b) make_pair(a,b)
#define T(a, b, c) make_pair(a, make_pair(b, c))
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define deb(x) cerr << #x << " = " << x << '\n'
#define N 222222

using namespace std;
//using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const ld pi = 2 * acos(0.0);
template<class T> bool umin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
template<class T> bool umax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T, class TT> bool pal(T a, TT n){int k=0;for(int i=0;i<=n/2;i++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

//int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

int a[N];
int main()
{
	int n;
	cin >> n;
	for(int i = 2; i <= n; i ++)
	{
		int x;
		cin >> x;
		a[x] ++;
	}
	for(int i = 1; i <= n; i ++)
		cout << a[i] << '\n';





	





	getchar();
	getchar();
	return 0;
	//ios::sync_with_stdio(false);
	//cin.tie(0);
}

Measured memory_bytes: 4400
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;

ll func(ll A, ll B, ll x) {
    ll l = (A * x) / B;
    ll r = A * (x / B);
    return l - r;
}
int main()
{
    ll A, B, N;
    cin >> A >> B >> N;

    ll ans;
    if (N >= B) {
        ans = func(A, B, B - 1);
    }
    else {
        ans = func(A, B, N);
    }

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

Measured memory_bytes: 3616
#include<iostream>
#include<algorithm>
#define INF 1<<28
using namespace std;
 
int p[1000001];
int memo[1000001];
int memo2[1000001];
 
int solve(int n){
   
  //cout << n << endl;

  if(!n) return 0;
  if(n < 0) return INF;
  if(memo[n]) return memo[n];
   
  int ans = INF;
  for(int i=1;p[i]<=n; i++) ans = min(ans, solve(n-p[i])+1);
   
  return memo[n] = ans;
}
 
int solve2(int n){
   
  if(!n) return 0;
  if(n<0) return INF;
  if(memo2[n]) return memo2[n];
   
  int ans = INF;
  for(int i=1;p[i]<=n;i++){
    if(!(p[i]%2)) continue;
    ans = min(ans, solve2(n-p[i])+1);
  }
   
  return memo2[n] = ans;
}
 
int main(){
   
  int n;
   
  for(int i=0;i<=1000000;i++) p[i] = i*(i+1)*(i+2)/6;
  for(int i=1;i<=1000000;i++) solve(i), solve2(i);
   
  while(cin >> n, n) cout << solve(n) << " " << solve2(n) << endl;
}

Measured memory_bytes: 12880
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define in insert
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define sz(v) (int)(v.size())
#define all(x) x.begin(), x.end()
#define prec fixed << setprecision(20)
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define test int t; cin >> t; while(t--)

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef set<int> si;
typedef map<int, int> mii;
typedef vector<pii> vpi;

int h[100010], mx[100010];

void solve() {
	int n, m; cin >> n >> m;
	rep(i, 0, n - 1) cin >> h[i], mx[i] = 0;
	rep(i, 0, m - 1) {
		int a, b; cin >> a >> b;
		mx[a - 1] = max(mx[a - 1], h[b - 1]);
		mx[b - 1] = max(mx[b - 1], h[a - 1]);
	}

	int ans = 0;
	rep(i, 0, n - 1) ans += h[i] > mx[i];

	cout << ans << '\n';
}

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);


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

	// test
	solve();

	return 0;
}

Measured memory_bytes: 4432
#include<bits/stdc++.h>
using namespace std;
int n,k,d,x,m[105],c;
int main()
{
    cin>>n>>k;
    for(int i=1;i<=k;i++){
        cin>>d;
        for(int j=1;j<=d;j++)cin>>x,m[x]++;
    }
    for(int i=1;i<=n;i++)if(!m[i])c++;
    cout<<c<<endl;
    return 0;
}

Measured memory_bytes: 3628