akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <cctype>
#include <unordered_map>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define rep_down(i, n) for(int i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(int i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()

string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";
/*
for (iterator = hash.begin(); iterator != hash.end(); iterator++)
{
// ここで、要素毎の操作を行います。
std::pair<std::string, CMyClass> element = *iterator;

}
*/
/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

ll gcd(ll a, ll b){
  ll tmp;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D, E, F, K,W, H, P, Q, R, X, Y;
  ll ans;
  string S, T;
  cin >> N >> A >> B;
  cout << min(N*A, B) << endl; 
  
  
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Linq;
using System.Numerics;

class F
{
	static void Main()
	{
		var a = Console.ReadLine().Split().Select(long.Parse).ToArray();
		long L = a[0], R = a[1];

		BigInteger c = 0;
		pow2 = new long[61];
		pow3 = new BigInteger[61];
		pow2[0] = 1;
		pow3[0] = 1;
		for (var i = 1; i <= 60; pow2[i] = 2 * pow2[i - 1], pow3[i] = 3 * pow3[i - 1], i++) ;

		for (int i = 0; i < 60; i++)
		{
			var p2l = pow2[i];
			var p2r = pow2[i + 1] - 1;

			if (R < p2l) break;
			if (p2r < L) continue;
			if (L <= p2l && p2r <= R) { c += pow3[i]; continue; }

			if (p2r <= R)
			{
				c += SumCount(p2r - L + 1, i);
			}
			else if (L <= p2l)
			{
				c += SumCount(R - p2l + 1, i);
			}
			else
			{
				for (var x = L; x <= R; x++)
					for (var y = x; y <= R; y++)
						if (y - x == (y ^ x)) c++;
			}
		}
		Console.WriteLine(c % 1000000007);
	}

	static long[] pow2;
	static BigInteger[] pow3;

	static int CountBit(long v, bool f, int maxBit)
	{
		var c = 0;
		var b = new BitArray(new[] { (int)v, (int)(v >> 32) });
		for (var i = 0; i <= maxBit; i++) if (b[i] == f) c++;
		return c;
	}

	static BigInteger SumCount(long max, int maxBit)
	{
		BigInteger c = 0;
		var b = new BitArray(new[] { (int)max, (int)(max >> 32) });
		for (int c2 = 0, i = maxBit; i >= 0; i--) if (b[i]) c += pow2[c2++] * pow3[i];
		return c;
	}
}


Measured memory_bytes: 13652
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,t;
    cin>>s>>t;
    int n = s.length();
    int m = t.length();
    int ans = INT_MAX;
    for(int i=0;i<=n-m;i++)
    {
        int cnt = 0;
        for(int j=0;j<m;j++)
        {
            if(s[i+j]==t[j])
            {
                cnt++;
            }
        }
        ans = min(ans,m-cnt);
    }
    cout<<ans;
}



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

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

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int cnt = 1, ans = n;
  rep(_, n) {
    int a;
    cin >> a;
    if (a == cnt) {
      ans--;
      cnt++;
    }
  }
  if (ans == n) {
    cout << -1;
  } else {
    cout << ans;
  }
  return 0;
}


Measured memory_bytes: 3660
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#define MN 100
#define mod 1000000007
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int n,a[MN+5],f[MN/2+5][MN+5][MN+5],b[MN+5];
inline void R(int&x,int y){x+=y;x>=mod?x-=mod:0;}
int main()
{
	n=read();
	for(int i=1;i<n<<1;++i) a[i]=read();
	sort(a+1,a+n*2);memcpy(b,a,sizeof(b));
	int mid=a[n],num=unique(a+1,a+n*2)-a-1;
	for(int i=1;i<=num;++i) if(a[i]==mid) f[n][1][0]=1;
	for(int i=n-1;i;--i)for(int j=1;j<=num;++j)for(int k=0;k<j;++k) if(f[i+1][j][k])
	{
		int bignum=j-1-k+(b[n+(n-i)]!=b[n+(n-i)-1]),smallnum=k+(b[i]!=b[i+1]),T=(b[n+(n-i)]!=b[n+(n-i)-1])+(b[i]!=b[i+1]);
		for(int l=1;l<=smallnum;++l) R(f[i][j+T-(smallnum-l)][l-1],f[i+1][j][k]);
		for(int l=1;l<=bignum;++l) R(f[i][j+T-(bignum-l)][k+1+(b[i]!=b[i+1])],f[i+1][j][k]);
		R(f[i][j+T][k+(b[i]!=b[i+1])],f[i+1][j][k]);
	}
	int ans=0;
	for(int i=1;i<=num;++i)for(int j=0;j<num;++j) 
	//	cout<<1<<" "<<i<<" "<<j<<" "<<f[1][i][j]<<endl,
		R(ans,f[1][i][j]);
	printf("%d\n",ans);
	return 0;
}



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

int main() {
	int H,A;
	cin >> H >> A;

  	int ans=0;
  	if(H <= 0){
      cout << ans << endl;
      return 0;
    }
  	while(H>0){
      ans ++;
      H -= A;
    }
  	cout << ans << endl;
}


Measured memory_bytes: 3588
#include <iostream>
using namespace std;
int main(){
//  int i = 1;

  int a = 0;
  int b = 0;
  int c = 0;

  int i = 0;

  int ans = 0;
  cin >> a >> b >> c;

  for(i = a; i <= b; i++){
    if(c%i == 0){
      ans++;
    }
  }

  cout << ans <<endl;

}


Measured memory_bytes: 3108
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    def f(a,b):return max(len(str(a)),len(str(b)))
    n=II()
    if n==1:
        print(1)
        exit()
    ans=100
    for d in range(1,n):
        if d**2>n:break
        if n%d==0:
            ans=min(ans,f(d,n//d))
    print(ans)

main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
ll INF = 1e16;
ll MOD = 1e9 + 7;
void add(ll &a, ll b)
{
    a = (a+b+MOD)%MOD;
}
int main()
{
    int n, m, s, t;
    cin >> n >> m >> s >> t;
    vector<vector<P>> e(n+1);
    for(int i = 0; i < m; i++)
    {
        ll u, v, d;
        cin >> u >> v >> d;
        e[u].push_back(P(v, d));
        e[v].push_back(P(u, d));
    }

    vector<ll> ds(n+1);
    vector<ll> dt(n+1);
    vector<ll> paths(n+1);
    vector<ll> patht(n+1);
    for(int i = 1; i <= n; i++)
    {
        ds[i] = INF;
        dt[i] = INF;
    }
    ds[s] = 0;
    dt[t] = 0;
    paths[s] = 1;
    patht[t] = 1;

    function<void(ll, vector<ll> &, vector<ll> &)> dijkstra = [&](ll s, vector<ll> &d, vector<ll> &path)
    {
        priority_queue<P, vector<P>, greater<P>> que;
        que.push(P(0, s));
        while(!que.empty())
        {
            P p = que.top();
            ll now = p.second;
            que.pop();
            if(d[now] < p.first) continue;
            for(auto nx : e[now])
            {
                ll nv = nx.first;
                ll cost = nx.second;
                if(d[nv] > d[now] + cost)
                {
                    d[nv] = d[now] + cost;
                    que.push(P(d[nv], nv));
                    path[nv] = path[now];
                }
                else if(d[nv] == d[now] + cost)
                {
                    add(path[nv], path[now]);
                }
            }
        }
    };
    dijkstra(s, ds, paths);
    dijkstra(t, dt, patht);

    ll len = ds[t];
    ll ans = paths[t] * paths[t] % MOD;
    for(int i = 1; i <= n; i++)
    {
        if(ds[i] + dt[i] == len && ds[i] * 2 == len)
        {
            ll tmp = (paths[i] * paths[i] % MOD) * (patht[i] * patht[i] % MOD) % MOD;
            add(ans, -tmp);
        }
    }
    for(int i = 1; i <= n; i++)
    {
        for(int j = 0; j < e[i].size(); j++)
        {
            P p = e[i][j];
            ll now = p.first;
            ll cost = p.second;
            if(ds[i] + dt[now] + cost == len && ds[i] * 2 < len && dt[now] * 2 < len)
            {
                ll tmp = (paths[i] * paths[i] % MOD) * (patht[now] * patht[now] % MOD) % MOD;
                add(ans, -tmp);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 18772
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

int main (int argc, char *argv[]) {
    int k;
    while(cin >> k, k) {
        int size = int(k * (k-1) / 2);
        int sum = 0;
        for(int i = 0; i < size; ++i) {
            int tmp;
            cin >> tmp;
            sum += tmp;
        }
        cout << int(sum / max(1, k - 1)) << endl;
    }

    return 0;
}


Measured memory_bytes: 3028
#include <iostream>
#include <vector>
using namespace std;

int main(){
    int n,k,q;cin>>n>>k>>q;
    vector<int> ans(n,0);
    for(int i=0;i<q;i++){
        int p;cin>>p;
        ans[p-1]++;
    }
    for(int i=0;i<n;i++){
        if(ans[i]>q-k)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}

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

using namespace std;

typedef pair<int, int> p;
typedef long long ll;
const int inf = 1000000007;

int main() {
  int n;
  cin >> n;
  if (n)
    cout << 0 << endl;
  else
    cout << 1 << endl;
  return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>

int main(){
	long long int n;
	scanf("%lld",&n);
	long long int sayac1=0;
	long long int sayac2=0;
	while(n>=500){
		n-=500;
		sayac1++;
	}
	if(n>0){
		while(n>=5){
			n-=5;
			sayac2++;
		}
	}
	printf("%d",sayac1*1000+sayac2*5);
	return 0;
}

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

using namespace std;

template<class T, class U>
void ckmin(T &a, U b)
{
	if (a > b) a = b;
}
template<class T, class U>
void ckmax(T &a, U b)
{
	if (a < b) a = b;
}

#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--)
#define SZ(x) ((int) ((x).size()))
#define ALL(x) (x).begin(), (x).end()
#define INF 1000000007
#define LLINF 2696969696969696969ll
#define MAXN 100013

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;

int N, K;
int arr[MAXN];
bitset<MAXN> dp;

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> N >> K;
	FOR(i, 0, N)
	{
		cin >> arr[i];
	}
	dp[0] = false;
	FOR(i, 1, K + 1)
	{
		FOR(j, 0, N)
		{
			if (i >= arr[j] && !(dp[i - arr[j]])) dp[i] = true;
		}
	}
	cout << (dp[K] ? "First" : "Second") << '\n';
	return 0;
}


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

using ll = long long;

constexpr ll M = 1e9+7;

int main() {
    int N, W;
    cin >> N >> W;
    vector<int> w(N);
    ll sum = 0;
    for(int i=0; i<N; ++i) {
        cin >> w[i];
        sum += w[i];
    }
    if(sum <= W) {
        cout << 1 << endl;
        return 0;
    }
    sort(w.rbegin(), w.rend());
    vector<vector<ll>> dp(N+1, vector<ll>(W+1));
    dp[0][0] = 1;
    for(int i=0; i<N; ++i) {
        dp[i+1] = dp[i];
        for(int j=W-w[i]; j>=0; --j) {
            (dp[i+1][j+w[i]] += dp[i][j]) %= M;
        }
    }

    reverse(w.begin(), w.end());
    sum = 0;
    ll res = 0;
    for(int i=0; i<N; ++i) {
        for(int j=max(0LL, W-sum-w[i]+1); j <= W - sum - (i == 0 ? 0 : w[i-1]); ++j) {
            (res += dp[N-i][j]) %= M;
        }
        sum += w[i];
    }
    cout << res << endl;
}


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

using namespace std;
typedef long long int LL;
typedef long long int LLint;

//Faster Coding
#define ED return 0
#define GET(a) int a;cin >> a
#define PRINT(a) cout << a << endl
#define ANS(a,b) int a;cin >> a;cout << b << endl
#define SORT(vec) sort(vec.begin(),vec.end())
#define REV(vec) reverse(vec.begin(),vec.end())

//Difficult Syntax
#define DOUBLECHANGE(count) cout << setprecision(count)

//As Function
#define UP(a,b) ((a+(b-1))/b)
#define ipow(x,y) LL(pow(x,y))

//Debug
#define TEST cout << "OK" << endl

const long long INF = 999999999;
const long long mod = 1000000007;

int main(){
      cin.tie(0);
      ios::sync_with_stdio(false);
      GET(A);
      ANS(B,max(A+B,max(A-B,A*B)));
}


Measured memory_bytes: 256
MAX_N = 110
MAX_V = 100100
N, W = map(int, input().split())
w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())
INF = float('inf')
dp = [[INF] * MAX_V for _ in range(MAX_N)]
dp[0][0] = 0
for i in range(N):
    for j in range(MAX_V):
        dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])
        if j - v[i] >= 0:
            dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - v[i]] + w[i])
res = 0
for sum_v in range(MAX_V):
    if dp[N][sum_v] <= W:
        res = sum_v
print(res)

Measured memory_bytes: 312328
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <random>

using namespace std;
using ll = long long;
using ull = unsigned long long;

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

const ll MOD = (ll)1e9 + 7;
const ll MOD2 = 998244353;
const ll LLINF = (ll)1e18;
const ll INTINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template <class T> void corner(bool flg, T hoge) { if (flg) { cout << hoge << endl; exit(0); } }
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) { o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o; }
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) { o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o; }
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) { o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o; }
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) { o << "{" << obj.first << ", " << obj.second << "}"; return o; }
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) { o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o; }
void print(void) { cout << endl; }
template <class Head> void print(Head&& head) { cout << head; print(); }
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) { cout << head << " "; print(forward<Tail>(tail)...); }
template <class T> void chmax(T& a, const T b) { a = max<T>(a, b); }
template <class T> void chmin(T& a, const T b) { a = min<T>(a, b); }
void YN(bool flg) { cout << ((flg) ? "YES" : "NO") << endl; }
void Yn(bool flg) { cout << ((flg) ? "Yes" : "No") << endl; }
void yn(bool flg) { cout << ((flg) ? "yes" : "no") << endl; }

int main() {
	int N; cin >> N;
	V<ll> H(N + 1, 0), F(N + 1, 0);
	for (int i = 1; i <= N; ++i) cin >> H[i] >> F[i];
	V<P<ll, int>> ord(N + 1);
	for (int i = 0; i <= N; ++i) ord[i] = { { F[i]+H[i] },i };
	sort(ALL(ord));
	V<V<ll>> dp(N + 1, V<ll>(N + 1, (ll)1e16));
	dp[0][0] = 0;
	for (int i = 1; i <= N; ++i) {
		for (int j = 1; j <= N; ++j) if (dp[i - 1][j - 1] <= H[ord[i].second]) chmin(dp[i][j], dp[i - 1][j - 1] + F[ord[i].second]);
		for (int j = 0; j <= N; ++j) chmin(dp[i][j], dp[i - 1][j]);
	}
	int ans = 0;
	for (int i = 0; i <= N; ++i) if (dp[N][i] != (ll)1e16) chmax(ans, i);
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 195968
#include<iostream>

using namespace std;

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

	long int **matrixA = new long int*[n];
	for (int i = 0; i < n; i++) {
		matrixA[i] = new long int[m];
	}

	long int **matrixB = new long int*[m];
	for (int i = 0; i < m; i++) {
		matrixB[i] = new long int[l];
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			int temp;
			cin >> temp;
			matrixA[i][j] = temp;
		}
	}

	for (int i = 0; i < m; i++) {
		for (int j = 0; j < l; j++) {
			int temp;
			cin >> temp;
			matrixB[i][j] = temp;
		}
	}


	long int **matrixC = new long int*[n];
	for (int i = 0; i < n; i++) {
		matrixC[i] = new long int[l];
	}

	//
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l; j++) {
			matrixC[i][j] = 0;
		}
	}

	// start computing 
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l; j++) {
			for (int k = 0; k < m; k++) {
				matrixC[i][j] += matrixA[i][k] * matrixB[k][j];
			}
		}
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l; j++) {
			cout << matrixC[i][j];
			if (j != (l - 1)) {
				cout << ' ';
			}
		}
		cout << endl;
	}


	for (int i = 0; i < n; i++) {
		delete[] matrixA[i];
		delete[] matrixC[i];
	}

	for (int i = 0; i < m; i++) {
		delete[] matrixB[i];
	}

	delete[] matrixC;
	delete[] matrixB;
	delete[] matrixA;
	return 0;
}

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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#define boost ios::sync_with_stdio(0); cin.tie(0);
#define int long long

const int N = 1e2 + 10;
const int mod = 1e9 + 7;


map<int,int> mp;

int32_t main(){
	boost;
	int n , m;
	cin >> n >> m;
	string a[n] , b[m];

	for(int i = 0 ; i < n; ++i)
		cin >> a[i];

	for(int i = 0 ; i < m ; ++i)
		cin >> b[i];


	for(int i = 0 ; i < n-m+1 ; ++i){
		for(int j = 0 ; j < n-m+1 ; ++j){
			bool flag = true;
			for(int k = 0 ; k < m ; ++k){
				for(int l = 0 ; l < m ; ++l){
					if(a[i+k][j+l] != b[k][l]){
						flag = false;
						break;
					}
				}
				if(!flag)
					break;
			}
			if(flag){
				(cout << "Yes");
				return  0;
			}
		}
	}
	cout << "No";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;vector<vector<int> >a(11,vector<int>(331));void r(int n,int u,int s,int d){a[n][s]++;for(int i=10;i-->0;)if(!(u>>i&1))r(n+1,u^1<<i,s+d*i,d+1);}main(){r(0,0,0,1);for(int n,s;cin>>n>>s;)cout<<a[n][s]<<endl;}

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

using namespace std;
typedef long long LL;

int main(){
  int A, B, C, K;
  cin >> A >> B >> C >> K;
  if(K<=A) cout << K << endl;
  else if(K<=A+B) cout << A << endl;
  else cout << A-(K-A-B) << endl;

  return 0;
}


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

int main()
{
	int k;
	cin >> k;
	auto gcd = [](int a, int b, int c) -> int {
		auto f = [](int x, int y) -> int {
			int t;
			while((t = x % y) != 0){
				x = y;
				y = t;
			}
			return y;
		};
		return f(f(a, b), c);
	};
	int ans = 0;
	for(int i = 1; i <= k; ++i){
		for(int j = 1; j <= k; ++j){
			for(int s = 1; s <= k; ++s){
				ans += gcd(i, j, s);
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3608
for _ in [0] * int(raw_input()):
  a, b = map(int, raw_input().split(':'))
  x = abs(a*60 - b*11)
  if x>360: x = 720-x
  if x<60: print 'alert'
  elif 180<=x: print 'safe'
  else: print 'warning'

Measured memory_bytes: 4204
#include<iostream>
#include<fstream>
#include<sstream>
#include<algorithm>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cmath>
#include<ctime>
#include<cstdlib>
#include<cstring>
#include<string>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<iomanip>
#include<utility>
using namespace std;
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define rg register
#define il inline
#define lch(x) ((x)<<1)
#define rch(x) ((x)<<1^1)
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define rep0(i,n) for(register int i=0;i<(n);++i)
#define per0(i,n) for(register int i=(n)-1;i>=0;--i)
#define rep(i,st,ed) for(register int i=(st);i<=(ed);++i)
#define per(i,ed,st) for(register int i=(ed);i>=(st);--i)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef double dbl;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T> il T qmin(const T &a,const T &b){return a<b?a:b;}
template<typename T> il T qmax(const T &a,const T &b){return a>b?a:b;}
template<typename T> il void getmin(T &a,const T &b){if(a>b) a=b;}
template<typename T> il void getmax(T &a,const T &b){if(a<b) a=b;}
il void fileio(string s){
	freopen((s+".in").c_str(),"r",stdin);
	freopen((s+".out").c_str(),"w",stdout);
}

const int inf=(int)1e9+7;
const ll linf=(ll)1e17+7;
const int N=2e5+7,M=N<<1;
const int mod=inf;

int f[N][3],pw2[N];
int v[N],nxt[N];
int p[N],dep[N],head[N],up[N],from[N];
int q[N],st,ed;
priority_queue<pii,vector<pii>,less<pii> > pq;
bool inq[N];
int n,ans;

il void dfs(const int &u){
	if(u){
		dep[u]=dep[p[u]]+1;
		up[u]=(nxt[head[p[u]]]?u:up[p[u]]);
	}
	for(int e=head[u];e;e=nxt[e]){
		dfs(v[e]);
	}
}

il int top(const int &u){
	return up[u]==u?u:up[u]=top(up[u]);
}

il void inc(int &x,const int &y){
	x+=y;
	if(x>=mod) x-=mod;
}

il void upd(int v,int u){
	if(!inq[v]) f[v][0]=1,f[v][1]=f[v][2]=0;
	ll cnt0=f[u][0]+f[u][2],cnt1=f[u][1];
	f[v][2]=((cnt0+cnt1)*f[v][2]+cnt1*f[v][1])%mod;
	f[v][1]=(cnt0*f[v][1]+cnt1*f[v][0])%mod;
	f[v][0]=(cnt0*f[v][0])%mod;
}

int main(){
//	fileio("test");
	scanf("%d",&n);
	pw2[0]=1;
	rep(i,1,n+1){
		pw2[i]=pw2[i-1]<<1;
		if(pw2[i]>=mod) pw2[i]-=mod;
	}
	rep(i,1,n){
		scanf("%d",p+i);
		v[i]=i,nxt[i]=head[p[i]],head[p[i]]=i;
	}
	dfs(0);
	rep(i,1,n) cerr<<i<<" "<<up[i]<<endl;
	for(st=0,ed=0,q[ed]=0;st<=ed;){
		int cur=dep[q[st]],cnt=0;
		for(;st<=ed&&dep[q[st]]==cur;++st){
			int u=q[st];
			++cnt;
			f[u][0]=f[u][1]=1,f[u][2]=0;
			pq.push(mp(dep[u],u));
			inq[u]=true;
			for(int e=head[u];e;e=nxt[e]) q[++ed]=v[e];
			for(u=top(u);u;u=top(p[u])){
				if(from[p[u]]!=u) from[p[u]]=(!from[p[u]]?u:-1);
			}
		}
		while(!pq.empty()){
			pii tmp=pq.top();pq.pop();
			int u=tmp.Y,v=p[top(u)];
			inq[u]=false;
			if(from[u]>0) up[from[u]]=u;
			from[u]=0;
			if(!u){
				inc(ans,1ll*f[u][1]*pw2[n+1-cnt]%mod);
				break;
			}
			upd(v,u);
			if(!inq[v]){
				pq.push(mp(dep[v],v));
				inq[v]=true;
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

using i64 = int64_t;

const i64 MOD = 1e9+7;

const i64 INF = 1e18+7;


signed main(){
	i64 i, o, t, j, l, s, z;
	cin >> i >> o >> t >> j >> l >> s >> z;
	i64 p = min({i, j, l});
	i -= p;
	j -= p;
	l -= p;
	i64 ans =  3 * p + (i & ~1) + o +  (j & ~1) + (l & ~1);
	if(p){
		--p, ++i, ++j, ++l;
		ans = max(ans, 3 * p + (i & ~1) + o +  (j & ~1) + (l & ~1));
	}
	cout << ans << endl;
}


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

int main() {
	int n;
	while (cin >> n, n) {
		map<int, string>m;
		for (int i = 0;i < n;i++) {
			string s;
			int a, b;
			cin >> s >> a >> b;
			m.insert(make_pair(a + b, s));
		}
		auto itr = m.rbegin();
		cout << itr->second << ' ' << itr->first << endl;
	}
	return 0;
}

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

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

    for(int i=0;i<S.size();i++){
        if(S[i]=='h'){
            if(i!=S.size()-1){
                if(S[i+1]=='i'){
                    i++;
                }else{
                    cout << "No" << endl;
                    return 0;
                }
            }else{
                cout << "No" << endl;
                return 0;    
            }
        }else{
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main()
{
  int a;
  cin >> a;
  cout << a + a * a + a * a * a << endl;

  return 0;
}


Measured memory_bytes: 3620
#include <iostream>

using namespace std;

int main() {
    int sx, sy, tx, ty;

    cin >> sx >> sy >> tx >> ty;

    int dx, dy;

    dx = tx - sx;
    dy = ty - sy;

    cout << string(dy, 'U') << string(dx, 'R');
    cout << string(dy, 'D') << string(dx, 'L');
    cout << string(1, 'L') << string(dy+1, 'U')
         << string(dx+1, 'R') << string(1, 'D');
    cout << string(1, 'R') << string(dy+1, 'D')
         << string(dx+1, 'L') << string(1, 'U');
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC omodtimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
using namespace __gnu_pbds;
using namespace std;
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<long long ,long long> ii; 	
typedef complex<long double> com;
 
const ll mod = 1e9+7;

vector <string> ans;
ll n;

void func(string s,ll c){
	if (s.size() == n) {
		ans.push_back(s);
		return;
	}
	ll maxi = 0;
	for (int z=0;z<s.size();z++){
		maxi = max(maxi,ll(s[z]-'a'));
	}
	for (ll z=0;z<=c;z++){
		func(s+char('a'+z),max(maxi,z)+1);
	}
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n;
	func("a",1);
	sort(ans.begin(),ans.end());
	for (string s : ans){
		printf("%s\n",s.c_str());
	}
}

Measured memory_bytes: 9716
// AOJ 2423 Code Art Online
// 2018.4.8 bal4u

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

#define MAX 210
short hi[MAX], to[MAX][MAX];
char seen[MAX];
int  match[MAX];

int bpm(int u);
int bipartiteMatching(int m, int n)
{
	int u, max;

	memset(match, -1, (m+n)*sizeof(int));
	max = 0;
	for (u = 0; u < m; u++) {
		memset(seen, 0, m+n);
		if (bpm(u)) max++;
	}
	return max;
}

int bpm(int u)
{
	int i, v;

	for (i = 0; i < hi[u]; i++) {
		v = to[u][i];
		if (seen[v]) continue;
		seen[v] = 1;
		if (match[v] < 0 || bpm(match[v])) {
			match[u] = v, match[v] = u;
			return 1;
		}
	}
	return 0;
}

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0, c = getchar_unlocked();
	if (c == '-') {	c = getchar_unlocked();
		do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
		return -n;
	}
	do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
	return n;
}

int    rn[102];
double rm[102];
char   rel[102][102];
char   assign[102], f[102];

typedef struct { double x, y; } PP;
PP p[102];

#define EPS 1e-6
#define EQ(a,b)  (fabs((a)-(b))<EPS)

double smallestCircle(int n)
{
	int  k, i, t;
	PP a = { 50, 50 };
	double move, max, d;

	move = 0.5;
	while (move > 1e-12) {
		for (t = 0; t < 100; t++) {
			max = 0;
			for (i = 0; i < n; i++) {
				if ((d = hypot(a.x-p[i].x, a.y-p[i].y)) > max) max = d, k = i;
			}
			a.x += (p[k].x - a.x)*move;
			a.y += (p[k].y - a.y)*move;
		}
		move /= 2;
	}
	return max;
}

int main()
{
	int n, m, i, j, k, l;

	n = in(), m = in();
	for (i = 0; i < n; i++) rn[i] = in();
	for (i = 0; i < m; i++) {
		k = in();
		for (j = 0; j < k; j++) p[j].x = in(), p[j].y = in();
		rm[i] = smallestCircle(k);
	}

	for (i = 0; i < m; i++) for (j = 0; j < n; j++) {
		if (EQ(rm[i], rn[j]) || rm[i] <= rn[j]) {
			rel[i][j] = 1;
			to[i][hi[i]++] = m+j;
		}
	}

	if (bipartiteMatching(m, n) != m) puts("NG");
	else {
		for (i = 0; i < m; i++) {
			for (j = 0; j < n; j++) {
				if (!f[j] && rel[i][j]) {
					for (k = i+1; k < m; k++) hi[k] = 0;
					f[j] = 1;
					hi[i] = 1, to[i][0] = m+j;
					for (k = i+1; k < m; k++) {
						for (l = 0; l < n; l++) {
							if (rel[k][l] && !f[l]) to[k][hi[k]++] = m+l;
						}
						if (hi[k] == 0) continue;
					}

					if (bipartiteMatching(m, n) == m) {
						assign[i] = 1+j;
						break;
					}
					f[j] = 0;
				}
			}
		}
		for (i = 0; i < m; i++) printf("%d\n", assign[i]);
	}
	return 0;
}


Measured memory_bytes: 2136
#!/usr/bin/env python3
from collections import deque

s = input()
q = int(input())
deq = deque(s)
cur = 1
for _ in range(q):
    query = input().split()
    if query[0] == "1":
        cur ^= 1
    else:
        f, c = query[1:]
        f = int(f) - 1
        if cur ^ f:
            deq.appendleft(c)
        else:
            deq.append(c)
ans = ""
while len(deq) > 0:
    ans += deq.popleft() if cur else deq.pop()
print(ans)


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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}
int64_t rll() {
	long long n;
	scanf("%lld", &n);
	return n;
}

int main() {
	int n = ri();
	int k = ri();
	std::string s, t;
	std::cin >> s;
	t = s;
	std::reverse(t.begin(), t.end());
	s += t;
	k--;
	char min = s[0];
	for (auto c : s) min = std::min(min, c);
	int max = 0;
	std::vector<int> starts;
	for (int i = 0; i < 2 * n; ) {
		if (s[i] == min) {
			int st = i;
			while (i < 2 * n && s[i] == min) i++;
			if (max < i - st) max = i - st, starts.clear();
			if (max == i - st) starts.push_back(st);
		} else i++;
	}
	for (int i = 0, cur = max; i < k; i++) {
		if ((cur *= 2) >= n) {
			for (int i = 0; i < n; i++) putchar(min);
			std::cout << std::endl;
			return 0;
		}
	}
	std::set<std::string> res;
	if (!k) {
		for (auto start : starts) {
			if (start > n) continue;
			res.insert(s.substr(start, n));
		}
	} else {
		for (auto start : starts) {
			int ren = max;
			if (start + ren < n) continue;
			std::deque<char> cur;
			for (int i = start + ren - n; i < start + ren; i++) cur.push_back(s[i]);
			for (int i = 0; i + 1 < k; i++) {
				for (int j = 0; j < ren; j++) cur.push_back(min), cur.pop_front();
				ren *= 2;
			}
			std::reverse(cur.begin(), cur.end());
			for (int i = 0; i < ren; i++) cur.push_front(min), cur.pop_back();
			std::string cur_s;
			for (auto c : cur) cur_s.push_back(c);
			res.insert(cur_s);
		}
	}
	std::cout << *res.begin() << std::endl;
	
	
	return 0;
}


Measured memory_bytes: 12032
import math
def is_prime(n):
    if n < 2:
        return False
    if n % 2 == 0 and n > 2:
        return False
    for i in range(3, int(math.sqrt(n)) + 1, 2):
        if n % i == 0:
            return False
    return True

Q= 100000

primes = [is_prime(n) and is_prime((n+1) / 2) for n in range(0, Q+1)]

accu=[0] * (Q+1)
for i in range(1, Q+1):
    #print(i)
    accu[i] = accu[i-1]
    if primes[i]:
        accu[i] = accu[i]+ 1

n = int(input())
for k in range(n):
    l,r = map(int, input().strip().split(' '))
    print("%d" % (accu[r] - accu[l-1]))


Measured memory_bytes: 5144
from collections import deque
from itertools import accumulate
import sys
sys.setrecursionlimit(10**6)

mo=10**9+7
#n=int(input()) 
n,d=map(int,input().split())
y=[]
for i in range(n):
    x=[int(i) for i in input().split()]
    y.append(x)
    
def dist(x,y):
    a=0
    rt=False
    for i in range(len(x)):
        a+=(x[i]-y[i])**2
    if a==int(a**0.5)**2:
        rt=True
    return rt
    #print(a,int(a**0.5)**2)
ans=0
for i in range(n):
    for j in range(i+1,n):
        ans+=1 if dist(y[i],y[j]) else 0


print(ans)



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

int main(){
    long N, M, C;
    cin >> N >> M >> C;
    vector<long> B(M);
    for(auto& i : B) cin >> i;
    long ans(0);
    long c;
    for(int i = 0; i < N; ++i){
        c = 0;
        for(auto i : B){
            long a;
            cin >> a;
            c += a * i;
        }
        ans += c + C > 0;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 234567;
namespace Tree {
	int tr[maxn<<2], lazy[maxn<<2];
	void push(int id, int l, int r){
		if(lazy[id]){
			tr[id] = 0;
			if(l != r){
				lazy[id<<1] = 1;
				lazy[id<<1|1] = 1;
			}
			lazy[id] = 0;
		}
	}
	void reset(int id, int l, int r, int x, int y){
		push(id, l, r);
		if(l > y || r < x) return;
		if(x <= l && r <= y) {
			lazy[id] = 1;
			push(id, l, r);
			return;
		}
		int mid = (l + r)>>1;
		reset(id<<1, l, mid, x, y);
		reset(id<<1|1, mid + 1, r, x, y);
		tr[id] = tr[id<<1] + tr[id<<1|1];
	}
	void upd(int id, int l, int r, int p, int x){
		push(id, l, r);
		if(r < p || l > p) return;
		if(l == r) tr[id] += x;
		else {
			int mid = (l + r)>>1;
			upd(id<<1, l, mid, p, x);
			upd(id<<1|1, mid + 1, r, p, x);
			tr[id] = tr[id<<1] + tr[id<<1|1];
		}
	}
	int sum(int id, int l, int r, int x, int y){
		push(id, l, r);
		if(l > y || r < x) return 0;
		if(x <= l && r <= y) return tr[id];
		int mid = (l + r)>>1;
		return sum(id<<1, l, mid, x, y) + sum(id<<1|1, mid + 1, r, x, y);
	}
};
int val[maxn], ans[maxn], par[maxn], sz[maxn];
vector<int> e[maxn];
const int N = 200020;
void dfs(int u, int v){
	val[u] = max(val[u], u);
	par[u] = v;
	sz[u] = 1;
	for(int to : e[u]){
		if(to == v) continue;
		val[to] = max(val[to], val[u]);
		dfs(to, u);
		sz[u] += sz[to];
	}
}
void add(int u, int v, int val){
	val = max(val, u);
	Tree::upd(1, 0, N, val, 1);
       	for(int to : e[u]) if(to != v) add(to, u, val);	
}
void sack(int u, int v, bool keep = true){
	int big = -1;
	for(int to : e[u]) if(to != v && (big == -1 || sz[to] > sz[big])) big = to;
	for(int to : e[u]) if(to != v && to != big) sack(to, u, false);
	if(big != -1) sack(big, u);
	for(int to : e[u]) if(to != v && to != big) add(to, u, to);
	ans[u] += Tree::sum(1, 0, N, 0, val[v]);
	ans[u] += 1;
	{
		int bad = Tree::sum(1, 0, N, 0, u);
		Tree::reset(1, 0, N, 0, u);
		Tree::upd(1, 0, N, u, bad + 1);
	}
	ans[u] -= Tree::sum(1, 0, N, 0, val[par[v]]);
	if(!keep) Tree::reset(1, 0, N, 0, N);
}
void fix(int u, int v){
	if(v) ans[u] += ans[v];
	for(int to : e[u]) if(to != v) fix(to, u);
}
int main(){
	int n; cin >> n;
	for(int i = 0; i < n - 1; i++){
		int x, y; cin >> x >> y;
		e[x].push_back(y);
		e[y].push_back(x);
	}
	dfs(1, 0);
	sack(1, 0);
	ans[1] = 0;
	fix(1, 0);
	for(int i = 2; i <= n; i++) cout << ans[i] << " ";
	cout << endl;
	return 0;
}


Measured memory_bytes: 43008
a=int(input())
b=int(input())
c=int(input())
x=int(input())
count=0
for z in range(a+1):
    for i in range(b+1):
        for j in range(c+1):
            if (500*z)+(100*i)+(50*j)==x:
                count+=1
print(count)
            

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin >> s;

    int mmyy = false;
    int yymm = false;

    int first = stoi(s.substr(0, 2));
    int second = stoi(s.substr(2, 2));

    if (first >= 1 && first <= 12) {
        mmyy = true;
    }

    if (second >= 1 && second <= 12) {
        yymm = true;
    }

    if (yymm && mmyy) {
        cout << "AMBIGUOUS";
    } else if (yymm) {
        cout << "YYMM";
    } else if (mmyy) {
        cout << "MMYY";
    } else {
        cout << "NA";
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <climits>
#include <cmath>
#include <vector>
#include <string>

#define REP(i, n) for (int i=0;i<(n);i++)
#define FOR(i, a, b) for (int i=(a);i<(b);i++)

using namespace std;

int N;
int X[200001];

int main()
{
    scanf("%d", &N);
    REP(i, N)
        scanf(" %d", &X[i]);
    int X_copy[200001];
    REP(i, N)
        X_copy[i] = X[i];
    sort(X_copy, X_copy+N, greater<int>());

    REP(i, N) {
        if(X[i]<X_copy[N/2-1])
            printf("%d\n", X_copy[N/2-1]);
        else
            printf("%d\n", X_copy[N/2]);
    }

    return 0;
}


Measured memory_bytes: 3712
#include<algorithm>
#include<cmath>
#include<iostream>
using namespace std;
long long int gcd(long long int a,long long int b)
{
    if(!b)return a;
    else return gcd(b,a%b);
}
int main()
{
    long long int n,k;
    cin>>n>>k;
    if(n>=k){
        if(n%k==0)cout<<"0";
        else{
            long long int m;
            m=n%k;
            if(m>=k-m)cout<<k-m;
            else cout<<m;
    }
    }
    else{
        if(n==0)cout<<"0";
    else{
        if(k%n==0)cout<<n;
        else {
            if(n>=k-n)cout<<k-n;
            else cout<<n;
        }
    }
}
}


Measured memory_bytes: 256
n = int(input())
S = list(map(int, input().split()))[::-1]

flag = True
for i in range(1, n):
  if S[i] > S[i-1]:
    S[i] -= 1
    
  if S[i] > S[i-1]:
    flag = False
    break

print("Yes" if flag else "No")
  

Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int x,y;
    cin>>x>>y;
    int a=0,b=0;
    vector<int>s1{1,3,5,7,8,10,12};
    vector<int>s2{4,6,9,11};
    rep(i,s1.size()){
        if(x==s1[i]){
            a=1;
        }
        if(y==s1[i]){
            b=1;
        }
    }
    rep(i,s2.size()){
        if(x==s2[i]){
            a=2;
        }
        if(y==s2[i]){
            b=2;
        }
    }
    cout<<(a==b?"Yes":"No")<<endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main implements Runnable {
	static int V;
	static int E;
	static ArrayList<Integer>[] g;

	@Override
	public void run() {
		new Main().solver();
	}

	public static void main(String[] args) {
		new Thread(null, new Main(), "", 16 * 1024 * 1024).start();
	}

	@SuppressWarnings("unchecked")
	void solver() {
		Scanner sc = new Scanner(System.in);
		V = sc.nextInt();
		E = sc.nextInt();
		g = new ArrayList[V];
		for (int i = 0; i < V; ++i)
			g[i] = new ArrayList<>();
		for (int i = 0; i < E; ++i) {
			int s = sc.nextInt();
			int t = sc.nextInt();
			g[s].add(t);
		}
		vis = new boolean[V];
		marked = new boolean[V];
		cmp = new int[V];
		low = new int[V];
		id = new int[V];
		for (int i = 0; i < V; ++i) {
			if (!marked[i]) {
				dfs(i);
			}
		}
		int Q = sc.nextInt();
		for (int i = 0; i < Q; ++i) {
			int u = sc.nextInt();
			int v = sc.nextInt();
			if (cmp[u] == cmp[v]) {
				System.out.println("1");
			} else {
				System.out.println("0");
			}
		}
	}

	static ArrayDeque<Integer> stack = new ArrayDeque<>();
	static boolean[] vis;
	static int[] low;
	static int[] id;
	static int curId = 0;
	static boolean[] marked;
	static int[] cmp;
	static int col = 0;

	static void dfs(int cur) {
		vis[cur] = true;
		stack.addFirst(cur);
		id[cur] = curId++;
		low[cur] = id[cur];
		for (int dst : g[cur]) {
			if (marked[dst])
				continue;
			if (!vis[dst]) {
				dfs(dst);
				low[cur] = Math.min(low[cur], low[dst]);
			} else {
				low[cur] = Math.min(low[cur], id[dst]);
			}
		}
		if (id[cur] == low[cur]) {
			int v;
			do {
				v = stack.removeFirst();
				cmp[v] = col;
				marked[v] = true;
			} while (v != cur);
			++col;
		}
		return;
	}
}

Measured memory_bytes: 102564
#include<iostream>
#include<math.h>
using namespace std;

int main() {
    int X; cin >> X;
    int ans = 0;
    for (int i = 1; i <= 1000; i++) {
        for (int j = 2; j <= 1000; j++) {
            int ex = pow(i, j);
            if (ex <= X) {
                ans = max(ans, ex);
            } else {
                break;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 4032
N = int(input())
A = list(map(int, input().split()))
double_X = [0] * N

double_X_0 = 0
for i in range(N):
    if i % 2 == 0:
        double_X_0 += A[i]
    else:
        double_X_0 -= A[i]
double_X[0] = double_X_0
for i in range(1, N):
    double_X[i] = A[i - 1] * 2 - double_X[i - 1]
print(' '.join(map(str, double_X)))


Measured memory_bytes: 84580
#include <bits/stdc++.h>
#define kyopro ios::sync_with_stdio(false);cin.tie(NULL)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define rep(i, s, N) for(ll i{s}; i < N; i++)
#define rem(i, N, s) for(ll i{N}; i > s; i--)
using namespace std;using ll = long long int;using ld = long double;using P = pair<ll,ll>;const int MOD = (int)1e9+7;const string rt = "\n";const string sp = " ";/* 最大公約数 */template<typename T> T gcd(T a, T b){return b != 0 ? gcd(b, a % b) : a;}/* UnionFind */template<typename T> struct UnionFind{vector<T> par;UnionFind(T n) : par(n, -1){}void init(T n){par.assign(n, -1);}T root(T x){if (par[x] < 0) return x;else return par[x] = root(par[x]);}bool issame(T x, T y){return root(x) == root(y);}bool merge(T x, T y){x = root(x); y = root(y);if(x == y) return false;if(par[x] > par[y]) swap(x, y);par[x] += par[y];par[y] = x;return true;}int size(int x) {return -par[root(x)];}};/* コンビネーション */template<typename T> ll combpm(T N_, T C_) {const int NUM_=400001;static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];if (fact[0]==0) {inv[1]=fact[0]=factr[0]=1;for (int i=2;i<=NUM_;++i) inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%MOD, factr[i]=factr[i-1]*inv[i]%MOD;}if(C_<0 || C_>N_) return 0;return factr[C_]*fact[N_]%MOD*factr[N_-C_]%MOD;}/* 多次元ベクター */template<class T>vector<T> multi_vector(size_t a){return vector<T>(a);}template<class T, class... Ts>auto multi_vector(size_t a, Ts... ts){return vector<decltype(multi_vector<T>(ts...))>(a, multi_vector<T>(ts...));}/* テスト関数 */void test(ll n){cout << "test" << n << endl;}/* 小数点以下 */void fixsp(ll n){cout << fixed << setprecision(n);}void defsp(ll n){cout << defaultfloat << setprecision(n);}

/* ここからコード開始 */

int main(){
  kyopro;
  ll N;
  cin >> N;
  vector<ll> A(N);
  ll sum{};
  for(auto&& i : A){
    cin >> i;
    sum += i;
  }
  vector<ll> yama(N);
  yama[0] = sum;
  rep(i, 0, N/2){
    yama[0] -= 2*A[2*i+1];
  }
  rep(i, 0, N-1){
    yama[i+1] = 2*A[i] - yama[i];
  }
  rep(i, 0, N){
    cout << yama[i];
    if(i < N-1) cout << sp;
    else cout << rt;
  }
}

Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
const int N=55;
typedef long long ll;

int n,x,d,fa[N],ans;
ll f[N][N*N*N];

struct dat {
	ll v;int w,lim;
	bool operator<(const dat &A) const {
		return 1ll*w*A.v>1ll*A.w*v;
	}
} a[N];

int main() {
	cin>>n>>x>>d>>a[1].v;
	a[1].w=1,a[1].lim=1e9;
	for(int i=2;i<=n;i++) {
		cin>>a[i].v>>fa[i];a[i].w=1;a[i].lim=d;
	}
	for(int i=n;i>1;i--) a[fa[i]].v+=a[i].v,a[fa[i]].w+=a[i].w;
	sort(a+1,a+n+1);
	memset(f,0x3f,sizeof(f));
	f[0][0]=0;
	for(int i=1;i<=n;i++)
		for(int j=0;j<=n*n*n;j++)
			for(int k=0;k<=n&&k<=a[i].lim&&j+k*a[i].w<=n*n*n;k++)
				f[i][j+k*a[i].w]=min(f[i][j+k*a[i].w],f[i-1][j]+k*a[i].v);
	for(int i=0;i<=n*n*n;i++) {
		if(f[n][i]>x) continue;
		int rem=x-f[n][i],now=i;
		for(int j=1;j<=n;j++) {
			if(a[j].lim<=n) continue;
			int t=min(1ll*a[j].lim-n,rem/a[j].v);
			now+=t*a[j].w;rem-=t*a[j].v;
			if(t<a[j].lim-n) break;
		}
		ans=max(ans,now);
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 71680
#include<stdio.h>
#include<string.h>

int main(){
    int n,p1=0,p2=0;
    
    char c1[102],c2[102];
    scanf("%d",&n);
    for(int i=0; i<n; i++){
        scanf("%s",c1);
        scanf("%s",c2);
        
        int cmp=strcmp(c1,c2);
        
        if(cmp>0){
            p1+=3;
        }else if(cmp<0){
            p2+=3;
        }else{
            p1++;
            p2++;
        }
    }
    printf("%d %d\n",p1,p2);
}


Measured memory_bytes: 1932
#include <bits/stdc++.h>
#include <ext/pb_ds/priority_queue.hpp>
#define priority_queue __gnu_pbds::priority_queue
typedef long long LL;
typedef long double LD;
typedef unsigned int ui;
typedef unsigned long long ul;
#define ri register int
#define pb push_back
#define fi first
#define se second
#define mid ((l + r) >> 1)
#define ls (i << 1)
#define rs (i << 1 | 1)
#define enum(i, j, k) for(int i = j; i <= k; i ++)
#define FO(x) { freopen(#x".in", "r", stdin); freopen(#x".out", "w", stdout); }
using namespace std;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef pair<int, LL> pil;
typedef pair<LL, int> pli;
typedef vector<int> vi;
#define ae(x) for(node *p = h[x]; p; p = p->nxt)
#define G \
	struct node { int v; node *nxt; } e[maxm], *h[maxn]; int z;\
	void adde(int u, int v) { e[++z].v = v; e[z].nxt = h[u]; h[u] = &e[z]; }\
	void addrev(int u, int v) { adde(u, v); adde(v, u); }
#define W \
	struct node { int v, w; node *nxt; } e[maxm], *h[maxn]; int z;\
	void adde(int u, int v, int w) { e[++z].v = v; e[z].w = w; e[z].nxt = h[u]; h[u] = &e[z]; }\
	void addrev(int u, int v, int w) { adde(u, v, w); adde(v, u, w); }
inline int _() // ret >= 0
{
	int ret = 0; char ch = getchar();
	while(ch < '0' || ch > '9') ch = getchar();
	do { ret = ret * 10 + ch - '0'; ch = getchar(); } while('0' <= ch && ch <= '9');
	return ret;
}
inline void _(int x) // x >= 0
{
	if(x < 10) { putchar(x + '0'); return ; }
	_(x / 10); putchar(x % 10 + '0');
}
void What_are_you_doing_at_the_end_of_the_world_Are_you_busy_Can_you_save_us()
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cout << fixed << setprecision(16);
}
/* Default Code Ends Here. */

#define maxn 100100
int n, m;
int a[maxn];
bool f[maxn];

int main()
{
	What_are_you_doing_at_the_end_of_the_world_Are_you_busy_Can_you_save_us();
	
	cin >> n >> m;
	enum(i, 1, n)
		a[i] = 1;
	f[1] = true;
	int u, v;
	enum(i, 1, m)
	{
		cin >> u >> v;
		a[u] --;
		a[v] ++;
		if(f[u])
			f[v] = true;
		if(!a[u])
			f[u] = false;
	}
	int res = 0;
	enum(i, 1, n)
		res += f[i];
	cout << res;
	return 0;
}


Measured memory_bytes: 768
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
typedef pair<int, int> P;
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define rep(i, n) for (lint i = 0; i < (n); i++)
#define INF LLONG_MAX
#define all(x) (x).begin(), (x).end()
#define pb push_back
int main()
{
    int n;
    cin >> n;
    bool flag = false;
    lint ans = 1;
    vector<lint> a(n);
    rep(i, n)
    {
        cin >> a.at(i);
        if (a.at(i) == 0)
            flag = true;
    }
    if (flag)
    {
        cout << 0 << endl;
        return 0;
    }
    rep(i, n)
    {
        if (a.at(i) <= lint(1e18) / ans)
        {
            ans *= a.at(i);
        }
        else
        {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3984
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define FPEN freopen("in.txt", "r", stdin);
#define debug(...)                                                             \
    { cerr << "# " << __VA_ARGS__ << "\n"; }
#else
#define debug(...)
#define FPEN
#endif
const int maxn = 200009;
typedef long long i64;
typedef pair<i64, i64> pi64;
typedef pair<int, int> pi;
const i64 MOD = 119 << 23 | 1;
class {
  public:
    void solve() {
        i64 n, a, b;
        cin >> n >> a >> b;
        if (a == 0) {
            cout << 0;
        } else {
            cout << n / (a + b) * a + (n % (a + b) >= a ? a : n % (a + b))
                 << '\n';
        }
    }
} NSPACE;
int main() {
    FPEN;
    ios_base::sync_with_stdio(false);
    cout.tie(0);
    cin.tie(0);
    NSPACE.solve();
}

Measured memory_bytes: 256