akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define up(i, a, b) for (int i = a, _b = b; i <= _b; i++)
#define down(i, a, b) for (int i = a, _b = b; i >= _b; i--)
#define long long long
#define endl '\n'
#define X first
#define Y second
#define II pair<int, int>
#define debug(X) cerr << #X << " = " << X << endl
#define debug2(X, Y) cerr << #X << " = " << X << " , " << #Y << " = " << Y << endl
#define show(X, a, b) { cerr << #X << " = "; up(_, a, b) cerr << X[_] << " "; cerr << endl; }
#define gc getchar
#define pc putchar
using namespace std;
inline void read(int &x) {
        register int c = gc();
        x = 0;
        int neg = 0;
        for (; ((c<48 || c>57) && c != '-'); c = gc());
        if(c=='-') {neg=1; c=gc();}
        for(; c>47 && c<58; c = gc()) {x = (x<<1) + (x<<3) + c - 48;}
        if(neg) x=-x;
}
inline void writeln(int x) {

        char buffor[21];
        register int i=0;
        int neg=0; if (x<0) {neg=1; x= -x;}
        do {
                buffor[i++]=(x%10)+'0';
                x/=10;
        } while(x);
        i--;
        if (neg) pc('-');
        while(i>=0) pc(buffor[i--]);
        pc('\n');
}
const int N = 1010;
int m, n, a[N][N], f[N][N];
void input() {
        cin >> n >> m;
        up(i, 1, m)
          up(j, 1, n)
            cin >> a[i][j];
}
int query(int x, int y, int u, int v) {
        return a[u][v] - a[x - 1][v] - a[u][y - 1] + a[x -1][y - 1];
}

void solve() {
        up(i, 1, m)
          up(j, 1, n)
            a[i][j] += a[i - 1][j] + a[i][j - 1] - a[i - 1][j - 1];

        f[m][n] = 0;
        down(i, m, 0)
         down(j, n, 0) {
            if (i == m && j == n) continue;
            if ((i + j) % 2 == 0) {
                f[i][j] = -1e9; //try to maximize;
                if (i + 1 <= m) f[i][j] = max(f[i][j], f[i + 1][j] + query(i + 1, j + 1, i + 1, n));
                if (j + 1 <= n) f[i][j] = max(f[i][j], f[i][j + 1] - query(i + 1, j + 1, m, j + 1));
            }
            if ((i + j) % 2 == 1) {
                f[i][j] = 1e9; //try to minimize;
                if (i + 1 <= m) f[i][j] = min(f[i][j], f[i + 1][j] + query(i + 1, j + 1, i + 1, n));
                if (j + 1 <= n) f[i][j] = min(f[i][j], f[i][j + 1] - query(i + 1, j + 1, m, j + 1));
            }
         }

        cout << abs(f[0][0]) << endl;
}
int main() {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);

  #ifdef I_Love_Pork
  #define TASK "tmp"
        freopen(TASK ".inp","r",stdin);
        freopen(TASK ".out","w",stdout);
  #endif


        input();
        solve();



        return 0;
}



Measured memory_bytes: 11068
S = list(input())
N = len(S)
K = int(input())
old = S[0]
a = 0
c = 1
for i in range(1,N):
  if S[i] == old:
    c += 1
  else:
    a += c // 2
    old = S[i]
    c = 1
b = 0
a += c // 2
for i in range(N):
  if S[i] == old:
      b += 1
  else:
    break
ans = a * K + ((b + c) // 2 - b // 2 - c // 2) * (K - 1)
if c == N:
  ans = N * K // 2
print(ans)

Measured memory_bytes: 9144
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        a[--x]++;
    }
    sort(a.begin(), a.end());

    vector<int> pref(n + 1);
    for (int i = 0; i < n; i++)
        pref[i + 1] = pref[i] + a[i];

    int x = n;
    for (int k = 1; k <= n; k++)
    {
        while (true)
        {
            int l = -1;
            int r = n;
            while (r - l > 1)
            {
                int m = (l + r) / 2;
                if (a[m] < x) l = m;
                else r = m;
            }
            int s = pref[r] + (n - r) * x;
            if (s < k * x) x--;
            else break;
        }
        cout << x << "\n";
    }

    return 0;
}


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

using namespace std;
using int64 = long long;
//const int mod = 1e9 + 7;
const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< 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);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int H1, M1, H2, M2, K;
  cin >> H1 >> M1 >> H2 >> M2 >> K;
  int X = H1 * 60 + M1;
  int Y = H2 * 60 + M2;
  cout << Y - X - K << "\n";
}

Measured memory_bytes: 3608
#include<iostream>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<queue>
#include<set>
#include<map>
using namespace std;
using ulong = unsigned long;
using ll = long long;
const int M = 1e9 + 7;

template <class T>
struct SegNode{
	SegNode *left, *right;
	int start, last;
	int value;
	SegNode(int l, int r, const vector<T>& data) :start(l), last(r){
		if(l != r){
			left = new SegNode<T>(l, (l + r)/2, data);
			right = new SegNode<T>((l + r)/2 + 1, r, data);
			value = min(left -> value , right -> value);
		}else{
			value = data[l];
		}
	}
	int getMin(int l, int r){
		if(last < l || r < start){
			return 1e9;
		}
		if(l <= start && last <= r){
			return value;
		}
		return min(left -> getMin(l, r), right -> getMin(l, r));
	}
};

int main(){
	int n, x;
	cin >> n >> x;
	vector<int> as(n);
	for(int i=0;i<n;i++){
		cin >> as[i];
	}
	auto root = new SegNode<int>(0, n - 1, as);
	ll ans = 1e18;
	for(int i=0;i<n;i++){
		ll tmp = x * i;
		for(int j=0;j<n;j++){
			if(j - i >= 0){
				tmp += root -> getMin(j - i, j);
			}else{
				tmp += min(root -> getMin(0, j), root -> getMin(n - (i - j), n - 1));
			}
		}
		ans = min(ans, tmp);
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
using namespace std;
int a[30],b[30],c[30];
int main(){
  int n,m=0,d=0,e=0;
  cin>>n;
  for(int i=1;i<=n;i++)
    cin>>a[i];
  for(int i=1;i<=n;i++)
    cin>>b[i];
  for(int i=1;i<n;i++)
    cin>>c[i];
  for(int i=1;i<=n;i++){
    e=a[i];
    m=m+b[e];
    if(d==e-1)
      m=m+c[e-1];
    d=e;
    
  }
  cout<<m<<'\n';
  return 0;
}


Measured memory_bytes: 256
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define pii pair<ll,ll>
#define vi(x) vector<x>
#define maxn 100005
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
using namespace std;
using namespace __gnu_pbds;
ll ma[1000010],cnt[1000010];
signed main()
{
    fast;
   
    ll n,i,ans=0,j;
    cin>>n;
    ll a[n+2];
    for(i=0;i<n;i++)
    {
    	cin>>a[i];
    	ma[a[i]]++;
    }
    for(i=1;i<1000006;i++)
    {
    	for(j=i;j<1000006;j += i)
    	{
    		if(ma[j])
    		{
    			if(i==j)
    			{
    				if(ma[i]>1) cnt[j]++;
    			}
    			else if(ma[i]) cnt[j]++;
    		}
    	}
    }
    for(i=0;i<n;i++)
    {
    	if(cnt[a[i]]==0) ans++;
    }
    cout<<ans;

}

Measured memory_bytes: 20792
# ランレングス圧縮
def getRunLengthEncoding(Ss):
    anss = []
    Ss += '$'
    SPrev = Ss[0]
    num = 1
    for S in Ss[1:]:
        if S == SPrev:
            num += 1
        else:
            anss.append((SPrev, num))
            SPrev = S
            num = 1
    return anss

N, K = map(int, input().split())
R, S, P = map(int, input().split())
Ts = input()

ans = 0
for i in range(K):
    As = Ts[i::K]
    RLE = getRunLengthEncoding(As)
    for c, num in RLE:
        m = (num+1)//2
        if c == 'r':
            ans += P*m
        elif c == 's':
            ans += R*m
        else:
            ans += S*m

print(ans)


Measured memory_bytes: 53360
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<cstring>
#include<utility>
#include<cmath>
#include<assert.h>

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound

int A[1010];
int B[1010];
int C[1010];
int d[110][110];

signed main() {
    int N, M;
    cin >> N >> M;
    rep(i, 110)rep(j, 110)d[i][j] = INF;
    rep(i, 110)d[i][i] = 0;
    rep(i, M) {
        cin >> A[i] >> B[i] >> C[i];
        --A[i];
        --B[i];
        d[A[i]][B[i]] = C[i];
        d[B[i]][A[i]] = C[i];
    }
    rep(k, N) {
        rep(i, N) {
            rep(j, N) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
    int ans = 0;
    rep(i, M) {
        int a = A[i], b = B[i], c = C[i];
        bool flag = false;
        rep(k, N) {
            if (c > d[a][k] + d[k][b]) {
                flag = true;
                break;
            }
        }
        ans += flag;
    }
    cout << ans << endl;
    return 0;
}


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

int main()
{
    int n, sum = 0;
    cin >> n;
    int l[n], r[n];
    for (int i = 0; i < n; i++)
    {
        cin >> l[i] >> r[i];
        sum += r[i] - l[i] + 1;
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

const int MAX_N = 100005;
vector<int> v[MAX_N];
int flag1[MAX_N];
int flag2[MAX_N];
int ans[MAX_N];
queue<int> que;

void bfs(int x,int s){
    set<int> st1;
    rep(i,v[x].size()){
        if(flag1[v[x][i]]==0){
            st1.insert(v[x][i]);
            flag1[v[x][i]] = 1;
        } 
    }
    set<int> st2;
    for(auto itr = st1.begin(); itr != st1.end(); ++itr){
        rep(i,v[*itr].size()){
            if(flag2[v[*itr][i]]==0){
                st2.insert(v[*itr][i]);
                flag2[v[*itr][i]] = 1;
            }
        }
    }
    for(auto itr = st2.begin(); itr != st2.end(); ++itr){
        rep(i,v[*itr].size()){
            if(ans[v[*itr][i]]==0&&v[*itr][i]!=s){
                ans[v[*itr][i]] = ans[x] + 1;
                que.push(v[*itr][i]);
            }
        }
        
    }
}


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

    rep(i,m){
        int x,y;
        cin >> x >> y;
        v[x].push_back(y);
    }
    int s,t;
    cin >> s >> t;

    que.push(s);

    while(0<que.size()){
        int x = que.front();
        que.pop();
        if(x==t){
            cout << ans[t] << endl;
            return 0;
        }
        bfs(x,s);
    }

    cout << "-1" << endl;
    return 0;
}
 
 


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

using namespace std;

int q, h, s, d, n;

int main() {
  scanf("%d %d %d %d %d", &q, &h, &s, &d, &n);
  if (q + q < h) h = q + q;
  if (h + h < s) s = h + h;
  if (s + s < d) d = s + s;
  long long ans = (n / 2) * (long long) d + (n % 2 > 0) * (long long) s;
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 256
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
//---------------------------------------------------------------
#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 rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define SIZE 100005
#define INF 1000000000000000LL
#define all(x) x.begin(),x.end()
using pint = pair<int,int>;
using vec = vector<int>;
using ll=long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//---------------------------------------------------------------

//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

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

    int h,w,k;
    cin>>h>>w>>k;
    string field[h];

    rep(i,h){
        cin>>field[i];
    }


    int ans = 0;
    for(int i = 0; i < (1 << h); i++){
        for(int j = 0; j < (1 << w); j++){
            int cnt = 0;
            for(int H = 0; H < h; H++){
                for(int W = 0; W < w; W++){
                    if(i&(1<<H)) continue;
                    if(j&(1<<W)) continue;
                    if(field[H][W]=='#') cnt++;
                }
            }
            if(cnt==k) ans++;
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}

template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

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

	vector<int> a = {1,6};
	while(a.back() <= n) a.emplace_back(a.back() * 6);
	a.emplace_back(9);
	while(a.back() <= n) a.emplace_back(a.back() * 9);

	vector<int> dp(n + 1, INT_MAX);
	dp[0] = 0;
	rep(i,a.size()){
		rep(j,n + 1){
			if(dp[j] == INT_MAX) continue;
			if(j + a[i] > n) break;
			dp[j + a[i]] = min(dp[j + a[i]], dp[j] + 1);
		}
	}
	cout << dp[n] << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll n;
    vector<int> a;
    cin >> n;
    
    for(int i=0;i<n;i++){
        ll t;
        cin >> t;
        a.push_back(t);
    }
    //accumulateは第3引数にinit(計算する型)の指定が必要
    ll sum = accumulate(a.begin(),a.end(),0LL);
    ll ma  = *max_element(a.begin(),a.end());
    ll mi = *min_element(a.begin(),a.end());
    cout << mi << " " << ma << " " << sum << endl;
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/


Measured memory_bytes: 3268
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
signed main(){
  init_io();
  ll x[]={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};
  ll k = 0;
  cin >> k;
  cout << x[k-1]<<endl;
}


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

const int INF = 1 << 30;

int main() {
    int N;
    string s[3];
    cin >> N;
    for (int i = 0; i < 3; i++) cin >> s[i];
    int ans = 0;
    for (int i = 0; i < N; i++) {
        map<int, int> MP;
        for (int j = 0; j < 3; j++) MP[s[j][i]]++;
        int num = 0;
        for (int j = 0; j < 3; j++) {
            if (num < MP[s[j][i]]) num = MP[s[j][i]];
        }
        ans += 3 - num;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
#define MOD 1000000007
using namespace std;

int main(void)
{
	int H, A; cin >> H >> A;
	int ans = (H + A - 1) / A;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
long long mod = 1e9 + 7;
const int iINF = 0x3f3f3f3f;
const long long INF = 1LL << 60;
using namespace std;

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

struct Cell
{
  double x, y, z, r;
};

struct Edge
{
  int a, b;
  double cost;

  bool operator<(const Edge &o) const
  {
    return cost < o.cost;
  }
};

struct UnionFind
{
  vector<int> d;
  UnionFind(int n = 0) : d(n, -1) {}
  int find(int x)
  {
    if (d[x] < 0)
      return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y)
  {
    x = find(x);
    y = find(y);
    if (x == y)
      return false;
    if (d[x] > d[y])
      swap(x, y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return -d[find(x)]; }
};

int main()
{
  int n;

  for (;;)
  {
    cin >> n;
    if (n == 0)
      break;
    vector<Cell> cells;
    vector<Edge> es;

    rep(i, n)
    {
      double x, y, z, r;
      cin >> x >> y >> z >> r;
      Cell c;
      c.x = x;
      c.y = y;
      c.z = z;
      c.r = r;
      cells.push_back(c);
    }

    rep(i, cells.size()) repi(j, i + 1, cells.size())
    {
      Cell c1 = cells[i];
      Cell c2 = cells[j];
      double cost = sqrt(pow(c1.x - c2.x, 2) + pow(c1.y - c2.y, 2) + pow(c1.z - c2.z, 2)) - c1.r - c2.r;
      chmax(cost, 0.0);
      Edge e;
      e.a = i;
      e.b = j;
      e.cost = cost;
      es.push_back(e);
    }

    // クラスカル法
    sort(es.begin(), es.end());
    UnionFind uf(n);
    double ans = 0.0;

    rep(ei, es.size())
    {
      Edge e = es[ei];

      if (!uf.same(e.a, e.b))
      {
        ans += e.cost;
        uf.unite(e.a, e.b);
      }
    }

    cout << fixed << setprecision(3) << ans << endl;
  }

  return 0;
}


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

int A[20], n;
int dp[21][2001];

//TODO: この方法やってみる
// https://teratail.com/questions/19591
int is_combinated(int i, int m){
  if(dp[i][m] != 2) return dp[i][m];

  if(m == 0) dp[i][m] = 1;
  else if(m < 0  || i >= n) dp[i][m] = 0;
  else if(is_combinated(i+1, m)) dp[i][m] = 1;
  else if(is_combinated(i+1, m-A[i])) dp[i][m] = 1;
  else dp[i][m] = 0;

  return dp[i][m];
}

//bool is_combinated(int i, int m){
//  if(m == 0) return true;
//  else if(m < 0  || i >= n) return false;
//  bool res = is_combinated(i+1, m) || is_combinated(i+1, m-A[i]);
//  return res;
//}

int main(void){
  int q, m;
  for(int i=0; i<21; i++){
    for(int j=0; j<2001; j++){
      dp[i][j] = 2;
    }
  }
  scanf("%d", &n);
  for(int i=0; i<n; i++){
    scanf("%d", &A[i]);
  }
  scanf("%d", &q);

  for(int i=0; i<q; i++){
    scanf("%d", &m);
    if(is_combinated(0, m)){
      printf("yes\n");
    }else{
      printf("no\n");
    }
  }
  return 0;
}



Measured memory_bytes: 3316
def solve():
    N, K = map(int,input().split())
    h = list(map(int,input().split()))

    dp = [float('inf')] * N
    dp[0] = 0

    for i in range(1,N):
        for j in range(1,K+1):
            if i-j < 0:
                break
            dp[i] = min(dp[i], dp[i-j] + abs(h[i-j] - h[i]))
    
    print(dp[-1])

if __name__ == '__main__':
    solve()


Measured memory_bytes: 54880
#include <iostream>
#include <vector>
#include <algorithm>

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef long long int lli;

inline int min(int x, int y) {return x < y ? x : y;}
inline long min(long x, long y) {return x < y ? x : y;}
inline int max(int x, int y) {return x > y ? x : y;}
inline long max(long x, long y) {return x > y ? x : y;}

inline void swap(int &a, int &b) {
    int tmp = a;
    a = b;
    b = tmp;
}

inline int euclid(int a, int b) {
    if (a > b) swap(a, b);
    int r = a % b;
    while (r > 0) {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

using namespace std;
class UnionFindWithSize {
    public:
        UnionFindWithSize(int N) : parent(N, -1) {}
        void unite(int x, int y) {
            x = find(x);
            y = find(y);
            if (x == y) return;
            if (parent[x] > parent[y]) swap(x, y);
            parent[x] += parent[y];
            parent[y] = x;
        }
        int find(int x) {
            if (parent[x] < 0) return x;
            return parent[x] = find(parent[x]);
        }
        int size(int x) {
            return -parent[find(x)];
        }
    private:
        vector<int> parent;
};;

// ( ´･ω･)( ´･ω)ぐる( ´･)( ´)ぐる( )(` )ぐる(･` )(ω･` )ぐる(･ω

signed main() {
    int A, B, Q;
    cin >> A >> B >> Q;
    vector<lli> s(A), t(B);
    for (int i = 0; i < A; i++) {
        cin >> s[i];
    }
    for (int i = 0; i < B; i++) {
        cin >> t[i];
    }

    s.push_back(-3000000000000);
    s.push_back(3000000000000);
    t.push_back(-3000000000000);
    t.push_back(3000000000000);
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    while (Q > 0) {
        lli x;
        cin >> x;

        lli ans = 3000000000000;
        vector<lli>::iterator sit = lower_bound(s.begin(), s.end(), x);
        for (int i = 0; i < 2; i++) {
            vector<lli>::iterator tit = lower_bound(t.begin(), t.end(), x);
            for (int j = 0; j < 2; j++) {
                ans = min(ans, min(
                            abs(x - *sit) + abs(*sit - *tit),
                            abs(x - *tit) + abs(*tit - *sit)
                            ));
                --tit;
            }
            --sit;
        }
        cout << ans << endl;
        --Q;
    }
}


Measured memory_bytes: 2912
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n;
    cin >> n;
    map<int, int> m;
    for (int i = 0; i < n; ++i) {
        int d;
        cin >> d;
        m[d]++;
        if(m[d] >= 3 || d == 0) {
            puts("0");
            return 0;
        }
    }
    vector<int> a, b;
    a.emplace_back(0);
    int ans1 = INF<int>;
    for (auto &&i : m) {
        if(i.second == 2) a.emplace_back(i.first), a.emplace_back(24-i.first);
        else b.emplace_back(i.first);
        ans1 = min(ans1, i.first);
    }
    int ans = 0;
    auto k = b.size();
    vector<int> c(a.size()+k);
    for (int i = 0; i < a.size(); ++i) c[i] = a[i];
    for (int i = 0; i < (1 << k); ++i) {
        for (int j = 0; j < k; ++j) {
            if (i & (1<<j)) {
                c[a.size()+j] = (24 - b[j]);
            } else {
                c[a.size()+j] = b[j];
            }
        }
        int p = INF<int>;
        for (int l = 0; l < c.size(); ++l) {
            for (int j = l+1; j < c.size(); ++j) {
                p = min(p, abs(c[l]-c[j]));
            }
        }
        ans = max(ans, p);
    }
    cout << min(ans, ans1) << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
    int n, m;
    scanf("%d %d", &n, &m);
    int lmx = 1, rmn = n;
    for (int i = 1; i <= m; ++i){
        int l, r;
        scanf("%d %d", &l, &r);
        lmx = max(lmx, l);
        rmn = min(rmn, r);
    }
    int cnt = 0;
    if(rmn >= lmx) cnt = rmn - lmx + 1;
    printf("%d", cnt);
    return 0;
}

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

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

    pair<int, int> p[q];
    for(int i = 0; i < q; i++){
        cin >> p[i].first >> p[i].second;
    }

    int flag[100001];
    int c[100001];
    for(int i = 0; i < 100001; i++){
        flag[i] = 0;
        c[i] = 0;
    }
    for(int i = 2; i < 100001; i++){
        if(flag[i] == 0){
            for(int j = i + i; j < 100001; j += i){
                flag[j] = 1;
            }
        }
    }
    for(int i = 3; i < 100001; i += 2){
        if(flag[i] == 0 && flag[(i + 1) / 2] == 0){
            c[i]++;
        }
    }
    for(int i = 3; i < 100001; i++){
        c[i] += c[i - 1];
    }

    for(int i = 0; i < q; i++){
        cout << c[p[i].second] - c[p[i].first - 1] << endl;
    }
}

Measured memory_bytes: 2176
#include <cstdio>
#include <utility>
#include <bitset>
#include <iostream>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	bitset<32> n = in();
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << n << endl << ~n << endl
		<< (n << 1) << endl << (n >> 1) << endl;
}


Measured memory_bytes: 3192
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var as []int

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	var N int
	scanner.Scan()
	fmt.Sscanf(scanner.Text(), "%d", &N)

	as = make([]int, N)
	for i := 0; i < N; i++ {
		scanner.Scan()
		fmt.Sscanf(scanner.Text(), "%d", &as[i])
	}

	cpy := make([]int, len(as))
	copy(cpy, as)
	for i, elem := range cpy {
		cpy[i] = elem - i
	}
	sort.Sort(sort.IntSlice(cpy))

	fmt.Println(f(cpy[len(cpy)/2]))
}

func f(b int) int {
	ret := 0
	for i := 0; i < len(as); i++ {
		ret = ret + abs(as[i]-(b+i))
	}
	return ret
}

func abs(n int) int {
	if n >= 0 {
		return n
	}
	return -n
}


Measured memory_bytes: 6656
#include <bits/stdc++.h>
using namespace std;
#define iinf 2000000000
#define linf 1000000000000000000LL
#define ulinf 10000000000000000000ull
#define MOD1 1000000007LL
#define mpr make_pair
typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned long UL;
typedef unsigned short US;
typedef pair < int , int > pii;
clock_t __stt;
inline void TStart(){__stt=clock();}
inline void TReport(){printf("\nTaken Time : %.3lf sec\n",(double)(clock()-__stt)/CLOCKS_PER_SEC);}
template < typename T > T MIN(T a,T b){return a<b?a:b;}
template < typename T > T MAX(T a,T b){return a>b?a:b;}
template < typename T > T ABS(T a){return a>0?a:(-a);}
template < typename T > void UMIN(T &a,T b){if(b<a) a=b;}
template < typename T > void UMAX(T &a,T b){if(b>a) a=b;}
int b[200005],n,q,v[200005],suf[200005];
pii qry[200005];
class segT{
	public:
		int l[800005],r[800005],v[800005];
		void init(int p,int L,int R){
			l[p]=L;
			r[p]=R;
			v[p]=-iinf;
			if(L<R){
				int M=((L+R)>>1);
				init((p<<1),L,M);
				init(((p<<1)|1),M+1,R);
			}
		}
		void modify(int p,int d,int V){
			if(l[p]==r[p])
				UMAX(v[p],V);
			else{
				int M=((l[p]+r[p])>>1);
				if(d<=M)
					modify((p<<1),d,V);
				else
					modify(((p<<1)|1),d,V);
				v[p]=MAX(v[p<<1],v[(p<<1)|1]);
			}
		}
		int query(int p,int L,int R,int rt){
			if(R<L) return rt;
			if(l[p]>=L && r[p]<=R) return v[p];
			int M=((l[p]+r[p])>>1),ret=rt;
			if(L<=M) ret=query((p<<1),L,R,rt);
			if(R>M) UMAX(ret,query(((p<<1)|1),L,R,rt));
			return ret;
		}
}segt[2];
inline int sum(int l,int r){return suf[l]-suf[r+1];}
int solve(){
	segt[0].init(1,0,n-1);
	segt[1].init(1,0,n-1);
	int xb;
	for(xb=n-1;xb>=0;--xb) suf[xb]=suf[xb+1]+v[xb];
	sort(qry,qry+q);
	for(xb=0;xb<n;++xb) segt[0].modify(1,xb,0);
	for(xb=0;xb<q;++xb){
		int val=segt[0].query(1,0,qry[xb].first-1,0)+sum(qry[xb].first,qry[xb].second),
			val2=segt[1].query(1,qry[xb].first,qry[xb].second,-iinf)-suf[qry[xb].second+1];
		UMAX(val,val2);
		segt[0].modify(1,qry[xb].second,val);
		segt[1].modify(1,qry[xb].second,val+suf[qry[xb].second+1]);
	}
	return segt[0].query(1,0,n-1,0);
}
int main(){
    // inputing start
    //数据结构记得初始化！
    scanf("%d",&n);
	int xb,x2,ini=0;
	for(xb=0;xb<n;++xb) scanf("%d",b+xb);
	scanf("%d",&q);
	for(xb=0;xb<q;++xb){
		scanf("%d%d",&qry[xb].first,&qry[xb].second);
		--qry[xb].first;
		--qry[xb].second;
	}
    #ifdef LOCAL
        TStart();
    #endif
    // calculation start
    //数据结构记得初始化！
    for(xb=0;xb<n;++xb){
		if(b[xb]) v[xb]=1;
		else{
			v[xb]=-1;
			++ini;
		}
	}
	printf("%d\n",n-ini-solve());
    #ifdef LOCAL
        TReport();
    #endif
    return 0;
}

Measured memory_bytes: 22912
def main():
    N = int(input())
    Prices = list(map(int, input().split()))

    current_money = 1000
    cheap = Prices[0]
    index_cheap = 1
    index_expen = 1

    N_stock = 0


    while (True):

        if (index_expen >= N or index_cheap >= N):
            break
        
        while (index_cheap < N):
            if (cheap >= Prices[index_cheap]):
                cheap = Prices[index_cheap]
                index_cheap += 1
            
            else:
                cheap = Prices[index_cheap]
                index_expen = index_cheap
                index_cheap -= 1
                break

        if (index_expen >= N or index_cheap >= N):
            break

        N_toBuy = current_money // Prices[index_cheap]
        current_money += (Prices[index_expen] - Prices[index_cheap]) * N_toBuy
        

        index_cheap = index_expen


    print(current_money)



if __name__ == '__main__':
    main()

Measured memory_bytes: 9204
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>


int main(){
  int N; cin >> N;
  int a, cnt = 0; 
  rep(i,N) {
    cin >> a;
    if ((i+1)%2==1 && a%2==1) cnt++;
  }
  cout << cnt << endl;



  // cout << fixed << setprecision(10);
  
  return 0;
}


Measured memory_bytes: 3580
// https: //onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/1/ALDS1_1_B
#include <iostream>

int gcd(int x, int y)
{
    int divider = 1;
    if (x > y)
    {
        for (int i = x % y; i > 0; i--)
        {
            if (x % i == 0 && y % i == 0)
                return i;
        }
    }
    else if (x < y)
    {
        for (int i = y % x; i > 0; i--)
        {
            if (x % i == 0 && y % i == 0)
                return i;
        }
    }
    else
    {
        return x;
    }
    return -1;
}

int main()
{
    int x, y;
    std::cin >> x >> y;
    std::cout << gcd(x, y) << std::endl;
}



Measured memory_bytes: 3100
#include <algorithm>
#include <iostream>

using namespace std;

int gcd(int a, int b) {
	return b == 0 ? a : gcd(b, a % b);
}

int main() {
	int k; cin >> k;
	int ans = 0;
	for (int a = 1; a <= k; a++)
		for (int b = 1; b <= k; b++)
			for (int c = 1; c <= k; c++)
				ans += gcd(a, gcd(b, c));
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int n;
    cin >> n;
    int a[n];
    rep(i,n) cin >> a[i];
    if(n%2==0){
        for(int i=n-1;i>0;i-=2){
            cout << a[i] << " ";
        }
        for(int i=0;i<n;i+=2){
            cout << a[i] << " ";
        }
        cout << endl;
    }else{
        for(int i=n-1;i>=0;i-=2){
            cout << a[i] << " ";
        }
        for(int i=1;i<n;i+=2){
            cout << a[i] << " ";
        }
        cout << endl;
    }


}


Measured memory_bytes: 2944
h,w = map(int,input().split())
s = [list(map(str,input().split())) for i in range(h)]
for i in range(h):
    for j in range(w):
        if s[i][j]=="snuke":
            ans = [ord("A")+j,i+1]
            print("{}{}".format(chr(ans[0]),ans[1]))

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <cmath>
#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 N, K;
  cin >> N >> K;
  int d, p[100] = {0};
  rep(k,K) {
    cin >> d;
    rep(i,d) {
      int t;  
      cin >> t;
      p[t-1]++;
    }
  }
  int ans = 0;
  rep(i,N) {
    if (p[i] == 0) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3164
/*
 * main.c
 *
 *  Created on: 2020/02/22
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a > b ? b : a)
typedef long long int ll;
typedef unsigned long long int ull;

int sort_inc(const void *a, const void *b) { return (*(int*)a - *(int*)b);}
int sort_dec(const void* a, const void* b) { return (*(int*)b - *(int*)a);}
int sort_dec_ll(const void *a, const void *b) {
    ll da = *(ll*)a, db = *(ll*)b;    int val = 0;
    if(da > db) { val = -1; }
    else if (da == db) { val = 0; }
    else { val = 1; }
    return val;
}
int sort_inc_ll(const void *a, const void *b) {
    ll da = *(ll*)a, db = *(ll*)b;    int val = 0;
    if(da > db) { val = 1; }
    else if (da == db) { val = 0; }
    else { val = -1; }
    return val;
}
int sort_dic(const void *a, const void *b) {
    char *pa = (char *)a;    char *pb = (char *)b;    int i = 0, val = 0, N = 10;
    for (i = 0; i < N; i++) {
    	char da = pa[i], db = pb[i];
    	if (da == db) continue;
  		if (da > db) val = 1; else val = -1;
        break;
    }
    return val;
}


int main()
{
	ll N = 0, A = 0, B = 0, ans = 0;
	scanf("%lld %lld %lld", &N, &A, &B);
	ans = (N/(A+B) * A);
	if ((N%(A+B) - B) != 0) {
		if (N%(A+B) <= A) {
			ans += N%(A+B);
		} else {
			ans += A;
		}
	}
	printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
long long int *value;bool *ready;

long long int dp(long int n, long int a, int *h){
    if(ready[n])return value[n];
    long int k=a;
    if(n==0)return 0;
    value[n]=INT_MAX;
    if(k>n)k=n;
    for(long int i=n-k;i<n;i++){
        value[n]=min(value[n],dp(i,a,h)+abs(h[n]-h[i]));
    }

    ready[n]=true;
    return value[n];
}


void run_case(){
    long int n;
    long int k;
    cin>>n>>k;
    int *h;
    value = new long long int[n];ready=new bool[n];
    h=new int[n];

    for(long int i=0;i<n;i++){
        cin>>h[i];
        ready[i]=false;
    }
    cout<<dp(n-1,k,h);
    
    

}
int main(){
	ios_base::sync_with_stdio(false),cin.tie(nullptr);
    int t=1;
    while(t--){
        run_case();

    }
}



Measured memory_bytes: 11088
program main
  implicit none
  integer :: x, y, w, h
  double precision :: area
  integer :: flag

  read(*,*) w, h, x, y
  area = dble(w)*dble(h)/2.0d0


  if (x+x == w .and. y+y == h) then
    flag = 1
  else
    flag = 0
  endif


  write(*,*) area, flag

end program main


Measured memory_bytes: 256
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    a,b,c=input().split()
    if a[-1]==b[0] and b[-1]==c[0]:
        print("YES")
    else:
        print("NO")

main()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define N 1000005
#define ll long long int 	
#define MP make_pair
#define pb push_back
#define ppb pop_back
#define sp " "
#define endl "\n"
#define fi first
#define se second
#define ii pair<int,int>
#define lli pair<ll,ll>
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define fast2 freopen ("badhair.gir","r",stdin);freopen ("badhair.cik","w",stdout);
#define mod 1000000007
#define fs(x,y) for(ll i=1;i<=y;i++) cin>>x[i]
#define fo(i,x,y) for(ll i=x;i<=y;i++)
#define INF 1000000000005
using namespace std;

ll n,m,ar[N],sum,t;



int main()
{
	fast;
	cin>>n>>m;
	if(n>=10 || m>=10)
		return cout<<-1,0;
	cout<<n*m;

}



/*     cd onedrive\desktop\kod
cls

Sinav:21-22 aralik
Aciklama: Muhtemelen 25 aralik
*/

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define print(x) cout<<(x)<<'\n'
#define print_vec(v) rep(i,v.size()){if(i!=0)cout<<" ";cout<<v[i];}cout<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<'\n'
#define pb push_back
#define mp make_pair
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pi=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
using vstr=vector<string>;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
void yes(bool c) { if (c)print("Yes"); else print("No"); };
void YES(bool c) { if (c)print("YES"); else print("NO"); };

void solve() {
    const double PI = acos(-1);
    // DEBUG(PI);
    ll A,B,H,M; cin >> A >> B >> H >> M;
    double deg = (60*H+M)*PI*(11.0/360);
    deg = deg>180?360-deg:deg;
    // DEBUG(deg);
    double ans = sqrt(A*A + B*B - 2*A*B*cos(deg));
    print(ans);
}
 
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
    //int q; cin >> q;
	//while (q--)
		solve();
    return 0;
}

Measured memory_bytes: 4312
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll n,x;
ll ans=0;
int main(){
	cin>>n>>x;
	if(x*2>n){
		n-=x;
		ans+=x;
		ll tmp=n;
		n=x;
		x=tmp;
		if(n<x)swap(n,x);
		ans+=x;
	}
	else if(x*2<n){
		ans+=x;
		n-=x;
		ans+=n;
		//cout<<n<<" "<<x<<endl;
	}ll tmp;
	while(1){
		if(n%x==0){
			ans+=(n/x)*x*2;
			ans-=x;
			break;
		}
		else{
			ans+=(n/x)*x*2;
			tmp=n-(n/x)*x;
			n=x;
			x=tmp;
			if(x>n)swap(n,x);
		}
		//cout<<n<<" "<<x<<endl; 
	}
	cout<<ans<<endl;
	return 0;
}
/*
x
(n-x)
1.x>(n-x)->a*(n-x)>x->x-(a-1)(n-x)  (n-x)
*/

Measured memory_bytes: 256
N = int(input())
xyh = [[int(i) for i in input().split()] for i in range(N)]
nonzero_h = 0
for i in range(N):
    if xyh[i][2] != 0:
        nonzero_h = i
        break
for Cx in range(0, 101):
    for Cy in range(0, 101):
        maybeH = (
            xyh[nonzero_h][2]
            + abs(xyh[nonzero_h][0] - Cx)
            + abs(xyh[nonzero_h][1] - Cy)
        )
        for i in range(N):
            if max(maybeH - abs(xyh[i][0] - Cx) - abs(xyh[i][1] - Cy), 0) != xyh[i][2]:
                break
            if i == N - 1:
                print(Cx, Cy, maybeH)
                exit()


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define mp make_pair
#define PI pair<int,int>
#define poly vector<ll>
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
#define pb push_back
#define fi first
#define se second
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
const int N=200005,M=800005,oo=1e9;
struct edge{
	int di,nxt,ed;
}e[M];
int son[N],nedge,cur[N],deep[N];
PI an[N];
inline void aedge(int a,int b,int c){
	e[++nedge].nxt=son[a];
	son[a]=nedge;
	e[nedge].ed=b;
	e[nedge].di=c;
}
inline void ins(int a,int b,int c){
	aedge(a,b,c); aedge(b,a,0); //cout<<a<<" "<<b<<endl;
}
inline bool bfs(int s,int t){
	for(int i=0;i<N;i++)deep[i]=oo;
    for(int i=0;i<N;i++)cur[i]=son[i];
    deep[s]=0;
    queue<int> q;
    q.push(s);
    while(!q.empty()){
        int now=q.front();q.pop();
        for(int tmp=son[now];tmp;tmp=e[tmp].nxt)
            if(deep[e[tmp].ed]>=oo&&e[tmp].di){deep[e[tmp].ed]=deep[now]+1,q.push(e[tmp].ed);}
    }
    return deep[t]<oo;
}
int dfs(int now,int t,int limit){
    if(!limit||now==t) return limit;
    int flow=0,f;
    for(int tmp=cur[now];tmp;tmp=e[tmp].nxt){
        cur[now]=tmp;
        if(deep[e[tmp].ed]==deep[now]+1&&(f=dfs(e[tmp].ed,t,min(limit,e[tmp].di)))){
            flow+=f; limit-=f; e[tmp].di-=f; e[((tmp-1)^1)+1].di+=f; if(!limit)break;
        }
    }
    return flow;
}
int dinic(int s,int t){
    int ans=0;
    while(bfs(s,t))ans+=dfs(s,t,oo);
    return ans;
}
void GG(){
	puts("-1"); exit(0);
}
vector<int> v[N>>1];
int match[N>>1];
int main(){
	int n=read(),s=n,t=n+1;
	For(i,1,n-1){
		int c=read();
		ins(s,i,1); ins(n+i+1,t,1);
		For(j,1,c){int t=read(); v[t].pb(i); if(t>1)ins(i,t+n,1);}
	}
	int ans=dinic(s,t); 
	if(ans!=n-1)GG();
	For(i,1,n-1)for(int j=son[i];j;j=e[j].nxt)if(!e[j].di){match[i]=e[j].ed-n; break;}
	queue<int> q; q.push(1);
	while(q.size()){
		int t=q.front(); q.pop(); 
		for(auto i:v[t])if(match[i]){
			q.push(match[i]);  ans--;
			an[i]=mp(t,match[i]);
			match[i]=0;
		}
	}
	if(ans)GG();
	For(i,1,n-1){wri(an[i].fi);writeln(an[i].se);}
}

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

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)

const static llong MOD = 1000000000 + 7;
const static llong INF = 1LL << 60;
const static double eps = 1e-6;
const static int dy[] = {0, 1, 0, -1};
const static int dx[] = {1, 0, -1, 0};

template<typename T> T my_gcd(T a, T b) {
    return (a ? my_gcd(b % a, a) : b);
}

template<typename T> T my_lcm(T a, T b){
	return a * b / my_gcd(a, b);	
}

template<typename T> struct UF {
    vector<int> par;
    vector<T> sz;

    UF(int n) {
        par.resize(n);
        sz.resize(n);
        for (int i = 0; i < n; ++i) {
            par[i] = i;
            sz[i] = 1;
        }
    }

    int find_root(int x) {
        return par[x] == x ? x : par[x] = find_root(par[x]);
    }

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

    void unite(int x, int y) {
        x = find_root(x);
        y = find_root(y);
        if (x == y) return;
        
        if (sz[x] < sz[y]) swap(x, y);
        sz[x] += sz[y];
        par[y] = x;
    }

    T size_of_tree(int x) {
        return sz[find_root(x)];
    }
};

signed main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, m;
    cin >> n >> m;
    UF<int> uf(n + m);
    rep(i, n) {
        int k;
        cin >> k;
        rep(j, k) {
            int l;
            cin >> l;
            uf.unite(l - 1, m + i);
        }
    }

    bool flag = true;
    rep(i, n - 1) {
        if (! uf.same(m + i, m + i + 1)) {
            flag = false;
            break;
        }
    }

    if (flag) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 1792
#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 n, m;
  cin >> n >> m;
  cout << n*(n-1)/2+m*(m-1)/2 << endl;
  return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
typedef long long ll;

const int INF = 1e9+7;

using ipair = pair<int, int>;

bool operator>(const ipair a,const ipair b){return a.first > b.first;}

int N, K;
vector<int> dislike;

bool check(int t){
    string t_str = to_string(t);
    for(char c: t_str){
        for(int num: dislike){
            if(c-'0' == num) return false;
        }
    }

    return true;
}

int main(){
    cin >> N >> K;
    dislike.resize(K);
    rep(i, K) cin >> dislike[i];


    while(1){
        if(check(N)){
            cout << N << endl;
            return 0;
        }else{
            N++;
        }
    }

   
    return 0;
}

Measured memory_bytes: 256