akhauriyash/Code-Regression huggingface dataset:
// Copyright (C) 2017 __debug.

// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; version 3

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; If not, see <http://www.gnu.org/licenses/>.


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/priority_queue.hpp>

#define x first
#define y second
#define MP std::make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#ifdef __linux__
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif

using std::pair;
using std::vector;
using std::string;

typedef long long LL;
typedef pair<int, int> Pii;

const int oo = 0x3f3f3f3f;

template<typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, true : false; }
template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, true : false; }
string procStatus()
{
    std::ifstream t("/proc/self/status");
    return string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>());
}
template<typename T> T read(T &x)
{
    int f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar())
        f = (ch == '-' ? -1 : 1);
    for (x = 0; isdigit(ch); ch = getchar())
        x = 10 * x + ch - '0';
    return x *= f;
}
template<typename T> void write(T x)
{
    if (x == 0) {
        putchar('0');
        return;
    }
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    static char s[20];
    int top = 0;
    for (; x; x /= 10)
        s[++top] = x % 10 + '0';
    while (top)
        putchar(s[top--]);
}
// EOT

const int MAXN = 1e5 + 5;

int N, A[MAXN];

void input()
{
    read(N);
    for (int i = 1; i <= N; ++i) {
        read(A[i]);
    }
}

void solve()
{
    std::sort(A + 1, A + N + 1);

    if (A[N] - A[1] > 1) { puts("No"); return; }
    if (A[N] == A[1]) {
        if (A[1] == N - 1 || A[1] * 2 <= N) puts("Yes");
        else puts("No");
        return;
    }
    int cnt = 0;
    for (int i = 1; i <= N; ++i) cnt += (A[i] == A[1]);
    if (A[N] > cnt && (A[N] - cnt) * 2 <= N - cnt) puts("Yes");
    else puts("No");
}

int main()
{
#ifdef __DEBUG
    freopen("B.in", "r", stdin);
    freopen("B.out", "w", stdout);
#endif

    input();
    solve();

    return 0;
}

// 法国也有这么一句话。
// 不过，不说是鸟笼，说是被围困的城堡forteresse assiégée，
// 城外的人想冲进去，城里的人想逃出来。（《围城》）
//   --钱钟书


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


int main(){
  int a,b,m;
  cin >> a >> b >> m;
  vector<int> ai,bi;
  for(int i=0; i<a; i++){
    int aii; cin >> aii;
    ai.push_back(aii);
  }
  for(int i=0; i<b; i++){
    int bii; cin >> bii;
    bi.push_back(bii);
  }
  int ans=500000;
  for(int i=0; i<m; i++){
    int xi,yi,cii;
    cin >> xi >> yi >> cii;
    xi--; yi--;
    int tmp = ai[xi]+bi[yi]-cii;
    if(ans > tmp) ans = tmp; 
  }
  sort(ai.begin(),ai.end());
  sort(bi.begin(),bi.end());
  if(ans > ai[0]+bi[0]){
    ans = ai[0]+bi[0];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1400
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <math.h>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}*/


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

	int n;
	cin >> n;

	// 指数が{4,4,2},{24,2},{14,4},{74}の組の合計値が答え
	int ans = 0;

	//2,3,5,7,11,13,17,19,23,29,31,37,41,43,47この値しか使えない
	vector<int> prime = { 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47 };
	vector<int> primeNum(15, 0);

	Rep(i, 2, n + 1) {
		rep(j, 15) {
			int tmp = i;
			while (tmp % prime[j] == 0) {
				tmp /= prime[j];
				primeNum[j]++;
			}
		}
	}

	// 2^74だけとくべつ
	if(primeNum[0] >= 74)
		ans += 1;

	vector<int> demandNum = { 2,4,14,24 };
	vector<int> num(4, 0);

	rep(i, 15) {
		rep(j, 4) {
			if (primeNum[i] >= demandNum[j]) {
				num[j]++;
			}
		}
	}

	// 指数が{4,4,2},{24,2},{14,4},{74}の組の合計値が答え
	ans += (num[1] * (num[1] - 1) * (num[0] - 2)) / 2;
	ans += (num[3] * (num[0] - 1));
	ans += (num[2] * (num[1] - 1));

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for(int i=0; i<n; ++i)
        cin >> a[i] >> b[i];

    if(a == b){
        cout << 0 << endl;
        return 0;
    }

    long long ans = accumulate(a.begin(), a.end(), 0LL);
    int tmp = INT_MAX;
    for(int i=0; i<n; ++i){
        if(a[i] > b[i])
            tmp = min(tmp, b[i]);
    }
    ans -= tmp;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define X first
#define Y second
#define pb emplace_back
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i))
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef ll LL;
typedef pii PII;
typedef pll PLL;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;

int N;
int M;
int L[314];
int R[314];
int X[314];
priority_queue<pii, vector<pii>, greater<pii>> es;
LL dp[2][3][314][314];
vector<int> rest[314][4];

int main() {
  scanf("%d%d", &N, &M);

  rep(i, M) {
    scanf("%d%d%d", &L[i], &R[i], &X[i]);
    rest[R[i]][X[i]].eb(L[i]);
  }

  int src = 0;
  int dst = 1;
  rep(l, 3) {
    if (rest[1][2].empty() && rest[1][3].empty()) {
      dp[src][l][0][0] = 1;
    }
  }

  reps(i, 2, N+1) {
    rep(l, 3) {
      rep(j, i-1) {
        rep(k, i-1) {
          // l l+1 l+2
          // i-1 j   k
          dp[dst][l][j][k] += dp[src][l][j][k];
          dp[dst][l][j][k] %= MOD;
          dp[dst][(l+1)%3][k][i-1] += dp[src][l][j][k];
          dp[dst][(l+1)%3][k][i-1] %= MOD;
          dp[dst][(l+2)%3][i-1][j] += dp[src][l][j][k];
          dp[dst][(l+2)%3][i-1][j] %= MOD;
        }
      }
    }

    rep(j, i) {
      rep(k, i) {
        reps(m, 1, 4) {
          for (int f : rest[i][m]) { 
            int cnt = 0;
            cnt += f <= j;
            cnt += f <= k;
            cnt += f <= i;
            assert(cnt >= 1);

            if (cnt != m) {
              dp[dst][0][j][k] = 0;
              dp[dst][1][j][k] = 0;
              dp[dst][2][j][k] = 0;
              break;
            }
          }
        }
      }
    }

    swap(dst, src);
    fill(dp[dst][0][0], dp[dst+1][0][0], 0);
  }

  /*reps(i, 1, N+1) {
    printf("i=%d\n", i);
    rep(l, 3) {
      printf("l=%d\n", l);
      rep(j, N) {
        rep(k, N) {
          printf("%lld ", dp[i][l][j][k]);
        }
        puts("");
      }
      puts("");
    }
    puts("");
  }*/
  

  LL ans = 0;
  rep(l, 3) {
    rep(j, N) {
      rep(k, N) {
        ans += dp[src][l][j][k];
        ans %= MOD;
      }
    }
  }
  printf("%lld\n", ans);
}


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

using namespace std;

int main(){
	#ifdef EVAL
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	int X,A;
	cin >> X >> A;
	int ans = 0;
	if(X < A){
		ans = 0;
	}else{
		ans = 10;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
//@Author: wxyww
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<queue>
#include<vector>
#include<ctime>
#include<cmath>
#include<map>
#include<string>
using namespace std;
typedef long long ll;
map<int,int>ma;
ll read() {
	ll x = 0,f = 1; char c = getchar();
	while(c < '0' || c > '9') {if(c == '-') f = -1;c = getchar();}
	while(c >= '0' && c <= '9') {x = x * 10 + c - '0',c = getchar();}
	return x * f;
}
const int N = 1000010;
int a[N],b[N];
int main() {
	int n = read();
	for(int i = 1;i <= n;++i) a[i] = read();

	int now = 0,ans = 0;
	for(int i = n - 1;i >= 1;--i) {
		if(a[i + 1] <= a[i]) ++now;
		else now = 0;
		ans = max(ans,now);
	}
	cout<<ans;
	return 0;
}

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

using namespace std;
int main() {
	int n, k;
	cin >> n >> k;
	vector<int> co(n, 2);
	vector<vector<int>> da(n, vector<int>(0));
	queue<int> q;
	vector<bool> ju(n, false);
	for (int i = 0;i < n-1;i++) {
		int x, y;
		cin >> x >> y;
		da[x - 1].push_back(y - 1);
		da[y - 1].push_back(x - 1);
	}
	vector<long long> po(n+1, 1);
	for (int i = 0;i < n;i++) {
		po[i + 1] = (po[i] * (i + 1)) % 1000000007;
	}
	for (int i = 0;i < da[0].size();i++) {
		ju[da[0][i]] = true;
		q.push(da[0][i]);
	}
	co[0] = 1;
	ju[0] = true;
	long long ans = k;
	while (!q.empty()) {
		int z = q.front(),gg;
		q.pop();
		for (int i = 0;i < da[z].size();i++) {
			if (ju[da[z][i]] == false) {
				ju[da[z][i]] = true;
				q.push(da[z][i]);
			}
			else
				gg = da[z][i];
		}
		if (k - co[gg] > 0) {
			ans=(ans*(k-co[gg])) % 1000000007;
			co[gg]++;
		}
		else {
			cout << 0 << endl;
			return 0;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 7672
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using P = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
int INF = 1e9+7;

int main() {
    int A,B,C,X;
    int count = 0;
    cin >> A >> B >> C >> X;
    for (int i=0; i<=A; i++)
        for (int j=0; j<=B; j++)
            for (int k=0; k<=C; k++) {
                int sum = i*500+j*100+k*50;
                if (sum==X) count++;
            }

    cout << count << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define llu unsigned long long int
#define N 100001
using namespace std;

vector<int> dp(N,0);
int main()
{
    int n,k;
    cin>>n>>k;
    vector<ll> v(n+1);
    for(int i=1;i<n+1;i++)
    {
        cin>>v[i];
    }
    dp[1]=0;
    for(int i=2;i<=n;i++)
    {
        ll m=INT_MAX;
        for(int j=1;j<=k&&i-j>0;j++)
        {
          ll x=dp[i-j]+abs(v[i]-v[i-j]);
          if(x<m)
            m=x;
        }
        dp[i]=m;
    }
    cout<<dp[n];
    return 0;
}


Measured memory_bytes: 1408
#include <stdio.h>
int main()
{
long int sum=0;
int n,a[55],i,j;
a[55]=0;
scanf("%d",&n);
for(i=0;i<=n-1;i++)
scanf("%d",&a[i]);
for(i=0;i<=n-1;i++)
 for(j=i+1;j<=n-1;j++)
 {
 sum+=a[i]*a[j];
 }
 printf("%ld",sum);
 return 0;
}


Measured memory_bytes: 128
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	var n int
	fmt.Scan(&n)

	ans := make([]int, n+1)
	idx := 1
	for ; idx*idx <= n; idx++ {
		x := idx
		for y := 1; x*x+y*y <= n; y++ {
			for z := 1; x*x+y*y+z*z <= n; z++ {
				if v := x*x + y*y + z*z + x*y + y*z + z*x; v <= n {
					ans[v]++
				}
			}
		}
	}

	wr := bufio.NewWriter(os.Stdout)
	for _, v := range ans[1:] {
		wr.WriteString(strconv.Itoa(v) + "\n")
	}
	wr.Flush()
}


Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	std::string s; cin >> s;

	std::vector<std::string> ans = {"ABC", "ARC"};
	printf("%s\n", ans[s == "ABC"].c_str());
	return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>

int	main(void)
{
	int	i = 1;
	int	scanNumber;
	while (1)
	{
		scanf("%d", &scanNumber);
		if (scanNumber == 0)
			break ;
		else
			printf("Case %d: %d\n", i, scanNumber);
		i++;
	}
	return (0);
}



Measured memory_bytes: 2040
#include<bits/stdc++.h> 
using namespace std;
int str[1005];
main()
{
	int ans=0,N,total=0;
	cin >> N;
	for(int i=0;i<N;i++)
	{
		cin >> str[i];
		if(i==0)
		{
			total++;
		}
		if(i!=0 && str[i]==str[i-1])
		{
			total++;
			//cout << i << " " << total << endl;
		}
		else if(i!=0 && str[i]!=str[i-1])
		{
			ans+=(total/2);
			total=1;
		}
		if(i==N-1)
		{
			ans+=(total/2);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
	#define debug(...) printf(__VA_ARGS__)
#else
	#define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

int main() {
	int X;
	int sum = 0;
	cin >> X;
	for(int i = 1; ; i++) {
		sum += i;
		if(sum >= X) {
			cout << i << endl;
			break;
		}
	}
	return 0;
}


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

using namespace std;
typedef long long ll;

int N;
ll a[2 * 100010];
ll b[2 * 100010];
const ll INF = 1 << 29;

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

    cin >> N;
    ll sum = 0;
    for(int i = 0; i < N; ++i){
        cin >> a[i];
        sum += a[i];
    }
    
    b[0] = a[0];
    //cout << b[0] << endl;
    for(int i = 1; i < N; ++i){
        b[i] = a[i] + b[i - 1];
        //cout << b[i] << endl;
    }

    ll ans = abs(b[0] - (sum - b[0]));
    for(int i = 1; i < N - 1; ++i){
        ans = min(ans, abs(b[i] - (sum - b[i])));
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
const int N = 1e5 + 33;

vector<int> G[N];
int n, m, a, b, deg[N] ,dp[N];

void max_self(int & A, int B) {
	A = max(A,B);
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	for(int i = 1; i <= m; i++)  {
		cin >> a >> b;
		G[b].pb(a);
		deg[a]++;
	}
	queue<int> Q;
	for(int i = 1; i <= n; i++) {
		if(deg[i] == 0) {
			Q.push(i);
			dp[i] = 0;
		}
	}
	
	while(Q.size()) {
		int v = Q.front();
		Q.pop();
		for(auto x : G[v]) {
			deg[x]--;
			if(deg[x] == 0) Q.push(x);		
			max_self(dp[x],dp[v] + 1);
		}
	}
	int wy = 0;
	for(int i = 1; i <= n; i++) {
		if(wy < dp[i]) {
	//		cout <<"I: "<< i << " " << dp[i] << endl;
		}
		max_self(wy, dp[i]);
	}
	cout << wy;
}


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

int main(void){
    string s;
    cin >> s;
    
    int ans = 0;
    for (int i = 0; i < s.size() - 1; i++) {
        if (char(s[i]) != char(s[i + 1])) ans++;
    }
    
    cout << ans << endl;
    
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;

#define ANS(f) if(f) cout << "YES" << endl; else cout << "NO" << endl;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }
void debug(mat m){REP(i, m.size()){ REP(j, m[0].size()){ cout << m[i][j] << ","; } cout << endl; }}



signed main(){

    int N; cin >> N;
    vec H(N), P(N);
    vector<Pii> HP(N);
    REP(i, N){
        cin >> H[i] >> P[i];
        HP[i] = Pii(H[i] + P[i], i);
    }
    SORT(HP);

    vec dp(N + 1, INF);
    dp[0] = 0;
    REP(i, N){
        int i0 = HP[i].second;
        IREP(j, i + 1){
            if(dp[j] <= H[i0]) dp[j + 1] = min(dp[j + 1], dp[j] + P[i0]);
        }
    }
    int ans = 0;
    REP(i, N + 1) if(dp[i] < INF) ans = max(ans, i);
    cout << ans;
    
    return 0;
}

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

int main()
{

 int x,y,z;
 cin>>x>>y>>z;
 if(x!=y && x!=z)
    cout<<x;
 else if(y!=x && y!=z)
    cout<<y;
 else
    cout<<z;



    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std ;
#define endl '\n' 

struct HASH{
  size_t operator()(const pair<int,int>&x)const{
    return hash<long long>()(((long long)x.first)^(((long long)x.second)<<32));
  }
};
unordered_map<pair<int,int>,int,HASH>mp;
#ifdef _DEBUG
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

int cnt ;
void selectionSort(int n , int ara[]) 
{
	for(int i = 0 ; i < n ; i++){
		int min = i ;  
		for(int j = i ; j < n ; j++){ 
			if(ara[j] < ara[min]){
				min = j ;
			}
		}
		swap(ara[i] , ara[min]) ;
		if(i == min) cnt-- ;
		cnt++ ;
	}
}

int main(){
	int n , ara[105] ; 
	scanf("%d" ,&n) ;
	for(int i = 0 ; i < n ; i++){ 
		scanf("%d" ,&ara[i]) ;
	}
	
	selectionSort(n , ara) ;
	
	for(int i = 0 ; i < n ; i++){
		if(i > 0) printf(" ") ;
		printf("%d" ,ara[i]) ;
	}
	printf("\n") ;
	printf("%d\n",cnt) ;
	return 0 ;
}



Measured memory_bytes: 3212
#_______________________________________________________________#
def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x-1)
def lower_bound(li, num): 
	answer = -1
	start = 0
	end = len(li)-1

	while(start <= end):
		middle = (end+start)//2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer #index where x is not less than num
def upper_bound(li, num): 
	answer = -1
	start = 0
	end = len(li)-1

	while(start <= end):
		middle = (end+start)//2

		if li[middle] <= num:
			answer = middle
			start = middle + 1
		
		else:
			end = middle - 1
	return answer #index where x is not greater than num

def abs(x):
	return x if x >=0 else -x
def binary_search(li, val, lb, ub): 
	ans = 0
	while(lb <= ub):
		mid = (lb+ub)//2
		#print(mid, li[mid])
		if li[mid] > val:
			ub = mid-1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = 1
			break
	return ans
def kadane(x): #maximum sum contiguous subarray
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = mpos(sum_so_far,current_sum)
	return sum_so_far
def pref(li):
	pref_sum = [0]
	for i in li:
		pref_sum.append(pref_sum[-1] + i)
	return pref_sum

#_______________________________________________________________#
'''
      ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
   ▄███████▀▀▀▀▀▀███████▄
░▐████▀▒▒Aestroix▒▒▀██████
░███▀▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▀████
░▐██▒▒▒▒▒KARMANYA▒▒▒▒▒▒████▌         ________________
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌  ? ?   |▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒|
░░█▒▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▒▐███▌   ?    |___CM ONE DAY___|
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▒▐███▌     ? ? |▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒|
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌    ? ?    
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌      ? 
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█     ? ? 
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀       ? 
░░░░▄█████████ ████=========█▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐
░░░░░████████████████
'''
from math import *
#for _ in range(int(input())):
for _ in range(1):
	#n = int(input())
	#p,f = map(int,input().split())
	d,t,s = map(int,input().split())
	#ws,wa = map(int,input().split())
	#b = list(input())
	#x = int(input())
	#n = len(b)
	#s2 = input()
	#r, g, b, w = map(int,input().split())
	#a = list(map(int,input().split()))
	#b = list(map(int,input().split()))
	#s1 = list(st)
	if d/s > t:
		print('No')
	else:
		print('Yes')





	


















	






Measured memory_bytes: 62644
#include<cstdio>
using ull = unsigned long long;

int main(){
	ull A, B;
	scanf("%llu %llu", &A, &B);
	ull begin = A + 1 >> 1 << 1;
	begin += B + 1 - begin >> 2 << 2;
	ull ans = A & 1 ? A : 0;
	for (ull i = begin; i <= B; ++i){
		ans ^= i;
	}
	printf("%llu\n", ans);
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;


public class Main{
    public  static void main(String[] args) {
    	try (Scanner sc = new Scanner(System.in)) {
    			int a=sc.nextInt();
    			int b=sc.nextInt();
    			if(a*b%2==0)	System.out.println("Even");
    			else	System.out.println("Odd");
    	}
    }
}

Measured memory_bytes: 22868
#include <bits/stdc++.h>
#define pb emplace_back
#define mp make_pair  
#define st first 
#define nd second 
#define all(v)  v.begin(),v.end()
#define max(aa, bb) (aa > bb ? aa : bb)
#define min(aa, bb) (aa < bb ? aa : bb)
#define ln '\n'
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(nullptr);cout.tie(nullptr);
	int a, b, n;
	cin >> n >> a >> b;
	for(int i = a; i < b + 1; ++i){
		if(i%n == 0){
			cout << "OK" << ln;
			return 0;
		}
	}
	cout << "NG" << ln;
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

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


int main()
{
    int N, K;
    cin >> N >> K;
    vector<long long> a(N);
    REP(i, N) cin >> a[i];

    sort(a.begin(), a.end(), greater<long long>());

    int ans = 0;
    set<long long> s;
    REP(i, N){
        if(a[i] >= K) continue;
        if(!s.empty()){
            set<long long> tmp(s);
            if(a[i]+*(--s.end()) >= K) ans = 0;
            else ++ans;
            for(int v: tmp){
                if(v+a[i] < K){
                    s.insert(v+a[i]);
                    s.erase(v);
                }
                else break;
            }
        }else ++ans;
        s.insert(a[i]);
        //for(int v: s) cout << v << " "; cout << endl;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String[] w = new String[n];
		String ans;
		for(int i = 0; i < n; i++) {
			w[i] = sc.next();
		}
		for(int i = 0; i < n; i++) {
			for(int j = i+1; j < n; j++) {
				if(w[i].equals(w[j])) {
					System.out.println("No");
					return;
				}
			}
		}
		for(int i = 1; i < n; i++) {
			if(w[i-1].charAt(w[i-1].length()-1)!=w[i].charAt(0)) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
}


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

#define dump(...) cout<<"# "<<#__VA_ARGS__<<'='<<(__VA_ARGS__)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename Ostream,typename Container>
Ostream& operator<<(Ostream& os,const Container& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

struct UnionFind{
	vi data;
	UnionFind(int n):data(n,-1){}
	int Find(int i){
		return data[i]<0?i:(data[i]=Find(data[i]));
	}
	bool Unite(int a,int b){
		a=Find(a),b=Find(b);
		if(a==b) return false;
		if(-data[a]<-data[b]) swap(a,b);
		data[a]+=data[b];
		data[b]=a;
		return true;
	}
	int Size(int i){
		return -data[Find(i)];
	}
};

int ModPow(int a,int r,int m)
{
	ll x=1;
	per(i,32){
		x=x*x%m;
		if(r>>i&1)
			x=x*a%m;
	}
	return x;
}

int main()
{
	for(int n,m;cin>>n>>m && n|m;){
		UnionFind uf(n);
		int cc=n;
		rep(i,m){
			int a,b; cin>>a>>b; a--,b--;
			cc-=uf.Unite(a,b);
		}
		int one=0; // サイズ1の連結成分の数
		rep(i,n) one+=uf.data[i]==-1;
		int two=cc-one; // サイズ2以上の連結成分の数
		
		ll res=ModPow(2,one,MOD);
		if(two) res=(res*ModPow(2,two,MOD)+1)%MOD;
		cout<<res<<endl;
	}
}

Measured memory_bytes: 1580
import java.util.*;

public class Main {
 public static void main(String... args) {
   Scanner scan = new Scanner(System.in);
   String[] line = scan.nextLine().split(" ");
   int N = Integer.parseInt(line[0]);
   int K = Integer.parseInt(line[1]);
   int Q = Integer.parseInt(line[2]);
   
   int[] score = new int[N];
   int A = 0;
   for(int i=0; i<Q; i++) {
     score[scan.nextInt()-1]++;
   }
   
   for(int i=0; i<N; i++) {
     System.out.println(K-Q+score[i]>0 ? "Yes" : "No");
   }
 }
}

Measured memory_bytes: 55212
# C - Maximal Value
N = int(input())
B = list(map(int, input().split()))

maxA = B[0] + B[N - 2]
for i in range(N - 2):
    if B[i + 1] < B[i]:
        maxA += B[i + 1]
    else:
        maxA += B[i]

print(maxA)


Measured memory_bytes: 3060
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string s = Console.ReadLine();
    string a = s[0].ToString();
    string b = s[1].ToString();
    string c = s[2].ToString();
    string d = s[3].ToString();
    string x = a+b;
    string y = c+d;
    string[] answers = new string[12]{"01","02","03","04","05","06","07","08","09","10","11","12"};
    int answer = 0;

    for(int i = 0; i < 12; i++)
    {
      if(x == answers[i]) answer += 10;
      if(y == answers[i]) answer += 1;
    }

    if(answer == 0) Console.WriteLine("NA");
    if(answer == 10) Console.WriteLine("MMYY");
    if(answer == 1) Console.WriteLine("YYMM");
    if(answer == 11) Console.WriteLine("AMBIGUOUS");
	}
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll * pos,ll val){*pos=max(*pos,val);}//Max(&dp[i][j],dp[i-1][j]);
void Min(ll * pos,ll val){*pos=min(*pos,val);}
void Add(ll * pos,ll val){*pos=mod(*pos+val);}
// long double EPS=1E-8;
////////////////////////////////////////



ll ans;
ll n,m;
bool check(stack<ll>x[3],int sta){
    rep(c,0,m){
        if(x[1].size()==0){
            if(x[0].size()==0||x[2].size()==0){
                Min(&ans,c);return true;
            }
        }
        if(x[sta+1].size()==0){
            ll t=x[sta].top();x[sta].pop();
            x[sta+1].push(t);
        }else if(x[sta].size()==0||x[sta].top()<x[sta+1].top()){
            ll t=x[sta+1].top();x[sta+1].pop();
            x[sta].push(t);
        }else{
            ll t=x[sta].top();x[sta].pop();
            x[sta+1].push(t);
        }
        sta=1-sta;
    }
    return false;
}

int main() {
    while(1){
        stack<ll>a[3],b[3];
        cin>>n>>m;
        if(n==0&&m==0)break;
        rep(i,0,2){
            ll s;cin>>s;
            rep(j,1,s){
                ll t;cin>>t;a[i].push(t);
            }
            b[i]=a[i];
        }
        ans=inf;
        check(a,0);//cout<<ans<<endl;
        check(b,1);
        if(ans!=inf)cout<<ans<<endl;
        else cout<<-1<<endl;
    }
    return 0;
}


Measured memory_bytes: 3100
A, B, C, X, Y = map(int, input().split())

ans = 0
ans += min(A + B, 2 * C) * min(X, Y)
if X > Y:
    ans += min(A, 2 * C) * (X - Y)
elif X < Y:
    ans += min(B, 2 * C) * (Y - X)
print(ans)


Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int f(int k) {
    int r = 0, t = 1;
    for (int i = 0; i < 8; i++) {
        if (k >= t) r++;
        t *= 10;
    }
    return r;
}

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

    int r = 0;
    for (int i = 1; i <= n; i++) {
        if (f(i) % 2) r++;
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include <string.h>
int main()
{
  	int len;
    char s[1000];
    // 文字列の入力
    scanf("%s",s);
  	len = strlen(s);
    
    // 出力
    if('s'==s[len - 1])(printf("%ses\n",s));
    else(printf("%ss\n",s));

}

Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
const long long INF = 1LL<<60;
#define pairint pair<int,int>
bool compare_by_b(pair<string, int> a, pair<string, int> b) {
    if(a.second != b.second){
        return a.second > b.second;
    }else{
        return a.first < b.first;
    }
}
signed main(){
  int x=0,y=0,z=0,w=0,n=0;
std::cin >> x>>y;
std::vector<int> v(x);
rep(i,x)std::cin >> v[i];
std::vector<int> dp(x,INF);
dp[0]=0;
repone(i,x){
  Repone(j,y+1){
    if(i-j>=0) dp[i]=min(dp[i],dp[i-j]+abs(v[i]-v[i-j]));
    else break;
  }
}
std::cout << dp[x-1] << '\n';
}


Measured memory_bytes: 1792
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <iostream>
#include <set>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <complex>
#include <map>
#include <queue>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<pii> vii;
typedef vector<string> vs;

int main() {
  int n, t;
  cin >> n >> t;
  vi a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int mi = a[0], ma = 0;
  for (int i = 1; i < n; ++i) {
    mi = min(a[i], mi);
    ma = max(ma, a[i] - mi);
  }
  int c = 0;
  mi = a[0];
  for (int i = 1; i < n; ++i) {
    mi = min(a[i], mi);
    if (ma == a[i] - mi) ++c;
  }
  cout << c << endl;
  return 0;
}



Measured memory_bytes: 640
s=list(input())
t=list(input())

n=len(s)
m=len(t)

ans=0
for i in range(n-m+1):
    tmp=0
    for j in range(m):
        p=s[i+j]
        q=t[j]
        if s[i+j]==t[j]:
            tmp+=1
    
    ans=max(ans,tmp)

print(m-ans)

Measured memory_bytes: 9056
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int K,N,a;
  cin >>K>>N;
  
  vector<int> d(N);
  for (int i = 0; i < N; i++) {
    cin >> d[i];
  }
  
  a = K - d[N - 1] + d[0];
    
  for (int i = 0; i < N - 1 ; i++) {
   a = max (a,d[i+1]-d[i]);
  }
  
  cout << K - a << endl;
  
 
}


Measured memory_bytes: 1024
//コンパイラ最適化用
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;
typedef pair<ll, ld> pld;
typedef pair<pii, int> ppiii;
typedef pair<pii, ll> ppiill;
typedef pair<pll, ll> ppllll;
typedef pair<pli, int> pplii;
typedef map<int, int> mii;
typedef deque<ll> dll;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqrll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<pll>> vvpll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define cin(x) cin >> x

signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    //入力
    ll A = 0, B =0, K=0;
    cin >> A >> B >> K;
    //本文
    if(A>K){
      A-=K;
    }
    else if(A<=K&&A+B>=K){
      B -= K-A;
      A=0;
    }
    else if(A+B<K){
      A = 0;
      B = 0;
    }

    //出力
    cout << A << " " <<  B;
    //REP(i,N) cout << ans.at(i) <<endl;
  return 0;
}

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

#define int long long
const int INF = (1LL << 31) - 1;
const int sqrtN = 512;
struct SqrtDecomposition {
  int N, K;
  vector<int> data;
  vector<int> bucketMin;
  vector<bool> lazyFlag;
  vector<int> lazyUpdate;
  SqrtDecomposition(int n) : N(n) {
    K = (N + sqrtN - 1) / sqrtN;
    data.assign(K * sqrtN, INF);
    bucketMin.assign(K, INF);
    lazyFlag.assign(K, false);
    lazyUpdate.assign(K, 0);
  }
  void eval(int k) {
    if (lazyFlag[k]) {
      lazyFlag[k] = false;
      for (int i = k * sqrtN; i < (k + 1) * sqrtN; ++i) {
        data[i] = lazyUpdate[k];
      }
    }
  }
  // [s, t)
  void update(int s, int t, int x) {
    for (int k = 0; k < K; ++k) {
      int l = k * sqrtN, r = (k + 1) * sqrtN;
      if (r <= s || t <= l)
        continue;
      if (s <= l && r <= t) {
        bucketMin[k] = x;
        lazyFlag[k] = true;
        lazyUpdate[k] = x;
      } else {
        eval(k);
        for (int i = max(s, l); i < min(t, r); ++i) {
          data[i] = x;
        }
        int &minVal = bucketMin[k] = INF;
        for (int i = l; i < r; ++i) {
          minVal = min(minVal, data[i]);
        }
      }
    }
  }
  // [s, t)
  int find(int s, int t) {
    int minVal = INF;
    for (int k = 0; k < K; ++k) {
      int l = k * sqrtN, r = (k + 1) * sqrtN;
      if (r <= s || t <= l)
        continue;
      if (s <= l && r <= t) {
        minVal = min(minVal, bucketMin[k]);
      } else {
        eval(k);
        for (int i = max(s, l); i < min(t, r); ++i) {
          minVal = min(minVal, data[i]);
        }
      }
    }
    return minVal;
  }
};

signed main() {
  ios::sync_with_stdio(false);
  int N, Q;
  cin >> N >> Q;
  SqrtDecomposition decomp(N);
  while (Q--) {
    int c;
    cin >> c;
    if (c == 0) {
      int s, t, x;
      cin >> s >> t >> x;
      decomp.update(s, t + 1, x);
    } else {
      int s, t;
      cin >> s >> t;
      cout << decomp.find(s, t + 1) << endl;
    }
  }
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m); (i) > (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define R cin>>
#define repr(i, n) REPR(i, n, 0)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define in(a) insert(a)
#define P(p) cout<<(p)<<endl;
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SORT(a) sort((a).begin(), (a).end())
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long int> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename T> void co(T e){cout << e << "\n";}
template<typename T> void co(const vector<T>& v){for(const auto& e : v)
    { cout << e << " "; } cout << "\n";}
ll gcd(ll a, ll b) {
    if (a < b)swap(a, b);
    if (b == 0) return a;
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}
ll lcm(ll a, ll b) {
    ll g = gcd(a, b);
    return a * b / g;
}
bool prime(ll n) {
    for (ll i = 2; i <= sqrt(n); i++) {
        if (n%i == 0)return false;
    }
    return n != 1;
}

Vec fac, finv;

ll PowMod(ll a, ll n){
    if(n == 1) return a;
    if(n%2 == 0) return PowMod(a*a%MOD, n/2);
    return a*PowMod(a*a%MOD, n/2)%MOD;
}

ll combi(ll n, ll k){
    if(k>n) return 0;
    return fac[n]*finv[k]%MOD*finv[n-k]%MOD;
}

int main(){
    int n, ret, ans=1;
    R n >> ret;
    rep(i, n-1){
        int h;
        R h;
        if (h >= ret){
            ans++;
            ret=h;
        }
    }
    co(ans);
}

Measured memory_bytes: 256
N = int(input())
S = [input() for i in range(N)]

ans = 'Yes'
if len(S) != len(set(S)):
    ans = 'No'
for i in range(N-1):
    if S[i][-1] != S[i+1][0]:
        ans = 'No'
        break

print(ans)

Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=203,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string S;cin>>S;
    int L=S.size();
    ll N=stoll(S);
    vector<ll> dig(10),rui(L);
    iota(all(dig),0);
    rui[L-1]=1;
    for(int i=L-2;i>=0;i--) rui[i]=rui[i+1]*10;
    
    ll maxi=0,ans=-1;
    
    do{
        ll M=0;
        for(int i=0;i<L;i++) M+=rui[i]*dig[i];
        
        ll diff=min(abs(N-M),rui[0]*10-abs(N-M));
        
        if(maxi<diff){
            maxi=diff;
            ans=M;
        }else if(maxi==diff){
            if(ans>M) ans=M;
        }
    }while(next_permutation(all(dig)));
    
    string T=to_string(ans);
    
    while(T.size()<L) T='0'+T;
    
    cout<<T<<endl;
}





Measured memory_bytes: 3296
s = input()
a=int(s[:2])
b=int(s[2:])
if (1<=b and b<=12) and (1<=a and a<=12):
    print("AMBIGUOUS")
elif (1<=a and a<=12):
    print("MMYY")
elif (1<=b and b<=12):
    print("YYMM")
else:
    print("NA")

Measured memory_bytes: 3060
import fractions
N = int(input())
A = list(map(int, input().split()))
L = 1
for i in range(N):
  g = fractions.gcd(A[i], L)
  L = A[i]*L//g
ans = 0
for i in range(N):
  ans += L//A[i]
print(ans%(7+10**9))

Measured memory_bytes: 6072
#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 int long long
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long double ld;
typedef long long ll;
#define X first
#define Y second
#define all(o) o.begin(), o.end()
#define endl '\n'
#define IOS ios::sync_with_stdio(0), cin.tie(0)

int gcd(int x,int y){ return (!y ? x : gcd(y, x%y)); }

int32_t main(){
	IOS;
	int n, m;
	cin >> n >> m;
	int x = 1, cnt = 0;
	while(x < m){
		cnt++;
		x += (n - 1);
	}
	cout << cnt << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int k = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();

		for (int i = a; i <= b; i++) {
			if (i % k == 0) {
				System.out.println("OK");
				return;
			}

		}
		System.out.println("NG");
		sc.close();
	}

}


Measured memory_bytes: 27084
#include<iostream>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int X, Y; std::cin >> X >> Y;
  int t = Y - X*2;
  if(t < 0) fin("No");
  if(t%2 > 0) fin("No");
  t /= 2;
  int c = X - t;
  if(c < 0) fin("No");
  fin("Yes");
  return 0;
}


Measured memory_bytes: 3644
n = gets.to_i
graph = Array.new(n + 1) { [] }

(n - 1).times do
  a, b, c = gets.split.map(&:to_i)
  graph[a] << [b, c]
  graph[b] << [a, c]
end

q, k = gets.split.map(&:to_i)

def dfs(v, parent, dist, graph, arr)
  graph[v].each do |u, d|
    next if u == parent

    dfs(u, v, dist + d, graph, arr)
    arr[u] = dist + d
  end
end

arr = Array.new(n + 1)
dfs(k, nil, 0, graph, arr)

q.times do
  x, y = gets.split.map(&:to_i)

  puts arr[x] + arr[y]
end

Measured memory_bytes: 148784
#include <iostream>
#include <fstream>

using namespace std;

#define ll long long
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))

int main()
{
  string s;
  int pos = 0, last = 2, result = 0;
  cin >> s;
  while(pos < s.size()){
    if(last == 2){
      pos++;
      result++;
      last = 1;
    } else if(last == 1){
      if(s[pos - 1] != s[pos]){
        pos++;
        result++;
        last = 1;
      } else if(pos + 1 < s.size()){
        pos += 2;
        result++;
        last = 2;
      } else {
        pos++;
      }
    }
  }
  cout << result;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr ll INFL = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

signed main() {
  ld A;
  cin >> A;
  COUTF((A / 3.0) * (A / 3.0) * (A / 3.0));
  return 0;
}

Measured memory_bytes: 384
// Created by Nandu Vinodan
#include <bits/stdc++.h>

#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define pi pair<int, int>
#define INF INT_MAX
#define _INF INT_MIN

using namespace std;
using ll = long long;

void testcase() {
	int m1, d1, m2, d2;
    cin >> m1 >> d1 >> m2 >> d2;
    cout << (m2 > m1) << endl;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    while(t--) {
        testcase();
    }
    return 0;
}

Measured memory_bytes: 256
main = do
  getLine
  dominoes <- getLine >>= return . (0:) . f

  print $ h dominoes

  where
    -- 1: vertical, 2: horizontal
    f (x:y:xs) = if x/=y then 1 : (f (y:xs)) else 2 : (f xs)
    f (x:[]) = [1]
    f [] = []

    g :: Int -> Int -> Integer
    g 0 1 = 3
    g 0 2 = 6
    g 1 1 = 2
    g 1 2 = 2
    g 2 1 = 1
    g 2 2 = 3

    h [] = 1
    h (_:[]) = 1
    h (x:y:xs) = ((g x y) * (h (y:xs))) `mod` (10^9+7)


Measured memory_bytes: 508
#include<bits/stdc++.h>
using namespace std;
 
//#define int long long
#define ll long long 
#define f(i,l,n) for(int i=l;i<n;i++)
#define E "\n"
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAX 1e18
#define float long double
 
const int N=2e5+3;

#define pi 3.141592653590





int32_t main()
{
 
  

int n;
cin >> n;
int frq[n+1]={0},temp;
f(i,1,n) cin >> temp,frq[temp]++;

f(i,1,n+1) cout<<frq[i]<<E;
}


Measured memory_bytes: 4408
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
#include<list>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {1, 1, 0, -1, -1, 0};
int dx[] = {1, 0, -1, -1, 0, 1};
#define ceil(a, b) a / b + !!(a % b)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)

int main() {
    int a, b, t;
    cin >> a >> b >> t;
    int c = 0;
    rrep(i, 1, t + 1) {
        if (i % a == 0) c += b;
    }
    cout << c << endl;
}


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

int main() {
	int n, s[1000];
	double a, m;

	while (1) {
		cin >> n;
		if (n == 0)
			break;

		m = 0;
		a = 0;

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

		m /= n;

		for (int i = 0;i < n;i++)
			a += (s[i] - m)*(s[i] - m);

		a /= n;
		a = sqrt(a);
		printf("%f\n", a);
	}
	return 0;
}

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

int main() {
	int i,a[10];
	for (i = 0; i < 10; i++) {
		cin >> a[i];
	}
	sort(a, a+10);
	cout << a[9] <<endl<< a[8] <<endl<< a[7] << endl;
	return 0;
}

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

const ll MAXX = 1e18;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("INP.txt", "r", stdin);
    //freopen("OUT.txt", "w", stdout);
	vector<pair<ll, ll>> hold;
	ll n;
	cin >> n;
	for (ll i = 0; i < n; i++) {
		ll x;
		cin >> x;
		hold.push_back(make_pair(x, i + 1));
	}
	sort(hold.begin(), hold.end());
	for (ll i = 0; i < hold.size(); i++) {
		cout << hold[i].second << ' ';
	}
	return 0;
}

Measured memory_bytes: 2544