akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int MOD = 1e9 +7;
vector<ll> x;
int nxt[100001][2];
int skip[100001][2];
int chain[100001][2];
ll dp[100001];

void add(ll &a, ll b)
{
	a = (a+b)%MOD;
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; ll a, b; cin>>n>>a>>b;
	x.resize(n);
	for(int i = 0; i < n; i++)
	{
		cin>>x[i];
	}
	nxt[n-1][0] = n;
	//chain = -1 => impossible
	nxt[n-1][1] = n;
	for(int i = n - 2; i >= 0; i--)
	{
		int z = lower_bound(x.begin(),x.end(),x[i]+a)-x.begin();
		nxt[i][0] = z;
		z = lower_bound(x.begin(),x.end(),x[i]+b)-x.begin();
		nxt[i][1] = z;
	}
	skip[n-1][0] = skip[n-1][1] = n - 1;
	for(int i = n - 2; i >= 0; i--)
	{
		for(int j = 0; j < 2; j++)
		{
			if(nxt[i][j] > i + 1)
			{
				skip[i][j] = -1;
			}
			else
			{
				if(skip[i+1][j] == -1) skip[i][j] = i;
				else skip[i][j] = skip[i+1][j];
			}
		}
	}
	chain[n-1][0] = chain[n-1][1] = n;
	for(int i = n - 2; i >= 0; i--)
	{
		for(int j = 0; j < 2; j++)
		{
			int nt = nxt[i][j];
			if(nt == i + 1) chain[i][j] = i + 1;
			else if(nt == i + 2)
			{
				chain[i][j] = chain[i+1][(j^1)];
			}	
			else
			{
				int z = skip[i+1][(j^1)];
				if(z>=nt-2)
				{
					chain[i][j] = chain[nt-1][(j^1)];
				}
				else chain[i][j] = -1;
			}
		}
	}
	dp[n] = 1;
	dp[n - 1] = 2;
	for(int i = n - 2; i >= 0; i--)
	{
		for(int j = 0; j < 2; j++)
		{
			int z = chain[i][j];
			if(z==-1) continue;
			add(dp[i], dp[z]);
		}
	}
	cout<<dp[0]<<'\n';
}


Measured memory_bytes: 4224
import std.stdio, std.array, std.conv, std.algorithm, std.string, std.numeric, std.range;
void main() {
	string s;
	while( (s=readln.strip).length != 0 ){
		auto as = s.to!int;
		if(as == 0) break;
		int ans = 0;
		while(0 < as){
			ans += as/5;
			as /= 5;
		}
		writeln(ans);
	}
}

Measured memory_bytes: 2360
N, M=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
LR=[[int(i) for i in input().split()] for i in range(M)]  # 二次元配列入力　二次元マップみたいな入力のとき

mi, ma = 0, 10**5

for i in LR:
    mi = max(mi, i[0])
    ma = min(ma, i[1])

if ma-mi < 0:
    print(0)
else:
    print(ma-mi + 1)

Measured memory_bytes: 21156
#include <bits/stdc++.h>
using namespace std;
int main() {
    int a,b,sockets,count=0;
    cin>>a>>b;
    sockets=1;
    while(sockets<b)
    {
        sockets=sockets+(a-1);
        count++;
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = [int(input())-1 for _ in range(n)]

now = 0
judge = False
ans = 0
for i in range(n):
  ans += 1
  if a[now] == now:
    break
  if a[now] == 1:
    judge = True
    break
  now = a[now]

print(ans if judge else -1)

Measured memory_bytes: 80060
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef pair<pii, int> ppi;
typedef pair<int, lint> pil;
typedef pair<lint, pii> plp;
typedef complex<double> xy_t;
typedef pair<pii, char> ppc;
typedef vector<lint> poly;

const lint mod = 1e9 + 7;
const int INF = mod;

int main(){
    int n;
    scanf("%d", &n);
    pii p[n];
    vector<int> v;
    rep(i, n){
        scanf("%d%d", &p[i].fi, &p[i].se);
        v.push_back(p[i].fi);
        v.push_back(p[i].se);
    }
    sort(p, p+n);
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());

    int L[n], R[n], mr[n];
    L[n-1] = -1; R[n-1] = INF;
    rrep(i, n-1){
        L[i] = max(L[i+1], p[i+1].fi);
        R[i] = min(R[i+1], p[i+1].se);
    }
    mr[0] = INF;
    For(i, 1, n) mr[i] = min(mr[i-1], p[i-1].se);
    /*rep(i, n) printf("%d\n", mr[i]);
    rep(i, n) printf("%d %d\n", L[i], R[i]);*/

    int ans = max(0, R[0]-L[0]+1) + max(0, p[0].se-p[0].fi+1);
    For(i, 1, n-1){
        int tmp1 = max(0, R[i]-L[i]+1) + max(0, min(mr[i], p[i].se)-p[i].fi+1);
        int tmp2 = max(0, min(mr[i], R[i])-L[i]+1) + max(0, p[i].se-p[i].fi+1);
        ans = max({ans, tmp1, tmp2});
        //printf("%d %d %d\n", i, tmp1, tmp2);
    }

    printf("%d\n", ans);
}

Measured memory_bytes: 3060
using System;
class c
{
    static void Main()
    {
        var nab = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
        long n = nab[0], a = nab[1], b = nab[2];
        long full = n / (a + b);
        Console.WriteLine(full * a + (n % (a + b) >= a ? a : n % (a + b)));
    }
}


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

typedef long long ll;
const int maxn=1e6+7;
const int inf=INT_MAX;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
//#define int ll

#ifdef HNO2
#define IOS
#else
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#endif // HNO2

string s,t;

int32_t main()
{
    IOS
    cin>>s>>t;
    for (int i=0;i<sz(s);i++)
        if (s[i]!=t[i]) return cout<<"No"<<endl,0;
    cout<<"Yes"<<endl;
}



Measured memory_bytes: 3640
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//
constexpr ll MOD = 1e9 + 7;
/*/
const ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
inline bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
inline bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion
void Pr(bool f){
  cout << (f ? "Yes" : "No") << endl;
  exit(0);
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll k, x;
  cin >> k >> x;
  Pr(k*500>=x);
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};
use std::collections::HashMap;

fn main() {
  let n = read::<i64>();
  let mut ans = 100000;

  for _ in 0..n {
    let mut cnt = 0;
    let mut n = read::<i64>();
    while n % 2 == 0 {
      n = n / 2;
      cnt += 1;
    }
    ans = min(ans, cnt)
  }

  println!("{}", ans);
}



Measured memory_bytes: 4352
/////////////////////////////////////////////////
/////             Give me AC!!!!            /////
/////////////////////////////////////////////////
//↑これじゃ気合いが足りない！
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////             お願いしますACをくださいそうじゃないと僕泣きますお願いしますACをくださいJudge様....            /////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define erep(i,N) for(int i = N - 1; i >= 0; i--)
const int MOD = 1000000007;
const int MAX = 100000;
const ld PI = (acos(-1));
using Graph = vector<vector<int>>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true;} return false;}
typedef pair<int, int> P;
typedef pair<ll,ll> PLL;
ld rad(ld a) {return a * 180 / PI;}
const int dx[4] = {1, 0, -1, 0};//2次元グリッド上のx軸方向
const int dy[4] = {0, 1, 0, -1};//2次元グリッド上のy軸方向

struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) { }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};

vector<pair<ll, ll>> prime_factorize(ll N) {
    vector<pair<ll, ll>> res;
    for (ll a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        ll ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}

//dpTable
vector<ll> dp(100,MAX);

ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

ll mod(ll val, ll m) {
  ll res = val % m;
  if (res < 0) res += m;
  return res;
}

long long fac[MAX], finv[MAX], inv[MAX];

char upper(char c){
    if('a' <= c && c <= 'z'){
        c = c - ('a' - 'A');
    }
    return c;
}
char lower(char c){
    if('A' <= c && c <= 'Z'){
        c = c + ('a' - 'A');
    }
    return c;
}

const ll INF = 10000000000;
struct edge{ll to, cost;};

int main(){
    ll N,X;
    cin >> N >> X;
    vector<ll> x(N);
    for (int i = 0; i < N; i++) {
        ll a;
        cin >> a;
        x.at(i) = abs(X - a);
    }
    ll ans = x.at(0);
    for (int i = 1; i < N; i++) {
        ans = __gcd(ans,x.at(i));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3976
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n;cin >> n;
    string ans = "APPROVED";
    for (int i = 0; i < n; i++)
    {
        int a;cin >> a;
        if(a%2 == 0){
            if(!(a%3 == 0 || a%5 == 0)){
                ans = "DENIED";
                break;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std; 
int ans=1<<30;
int main()
{
  int n,k;
  int h[100005];

  cin>>n>>k;

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

  sort(h,h+n);
  for(int i=0;i<n-k+1;i++){
    if(ans>h[i+k-1]-h[i]){
      ans=h[i+k-1]-h[i];
    }
  }

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


Measured memory_bytes: 640
# pythonでスタック、キューを実現するためにdequeをimport
from collections import deque

N, M = map(int, input().split())

# 辺集合EとグラフGの構築
G = [[] for _ in range(N)]
E = []
for _ in range(M):
    a, b = map(int, input().split())
    # 入力は1-indexedだがこれを扱いやすいように0-indexedに変更
    a -= 1
    b -= 1
    E.append((a, b))
    G[a].append(b)
    G[b].append(a)
# print(G)

# 橋を数えるための変数cntを用意
cnt = 0
for edge_to_remove in E:
    # 橋であるか判定したい辺を取り除いてみる
    i, j = edge_to_remove
    G[i].remove(j)
    G[j].remove(i)

    # 深さ優先探索
    seen = set()
    todo = deque()
    # 適当な頂点から深さ優先探索をスタート（ここでは頂点0をスタートに選んだ）
    todo.append(0)
    seen.add(0)
    while todo:
        here = todo.pop()
        for neighbor in G[here]:
            if neighbor not in seen:
                seen.add(neighbor)
                todo.append(neighbor)
    # print(seen)
    # もし訪問できていない頂点があれば連結でないというなので今着目している辺は橋であった！
    if len(seen) < N:
        cnt += 1

    # 次の辺について調べるために今取り除いた辺を再びGに戻しておく
    G[i].append(j)
    G[j].append(i)
print(cnt)


Measured memory_bytes: 3316
#include<iostream>
#include<vector>
#include<cmath>
#include<climits>

#define ll long long
#define deb(x) cout<<#x <<x<<" "
using namespace std;

ll knapsack(long w,vector<long> weight,vector<long> v,int n)
{
    vector<vector<ll>> dp(n+1,vector<ll>(w+1,0));
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=w;j++)
        {
            if(weight[i] > j)
                dp[i][j] = dp[i-1][j];
            else
            {
                dp[i][j] = max((v[i] + dp[i-1][j-weight[i]]),dp[i-1][j]);
            } 
        }
    }
    return dp[n][w];
}

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

    long n{},w{};
    cin>>n>>w;
    vector<long> wi(n+1),vi(n+1);
    wi[0] = 0;
    vi[0] = 0;
    for(int i=1;i<=n;i++)
    {
        cin>>wi[i]>>vi[i];
    }
    cout<<knapsack(w,wi,vi,n);

    return 0;
} 

Measured memory_bytes: 80256
#include <stdio.h>

int main(){
   long n,i;
   int  j,k,a;

   scanf("%ld",&n);
   if (n%2==0) {
      n/=2;
      for (j=1;n%2==0;j++) n/=2;
      for (k=1;j>=k;k++) j-=k;
      a=k-1;
   } else
      a=0;
   for (i=3;i*i<=n;i+=2) 
      if (n%i==0) {
         n/=i;
         for (j=1;n%i==0;j++) n/=i;
         for (k=1;j>=k;k++) j-=k;
         a+=k-1;
      }
   if (n>1) a++;
   printf("%d\n",a);
   return 0;
}


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

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll N, K, A;
    cin >> N >> K;
    ll bucket[210000] = {0};

    for(int i = 0; i < N; ++i){
        cin >> A;
        bucket[A - 1]++;
    }
    
    sort(bucket, bucket + N);
    ll kinds = 0;

    for(int i = 0; i < N; ++i){
        
        if(bucket[i] > 0){
            kinds++;
        }
    }


    ll res = 0;
    ll cd = kinds - K;

    for(int i = 0; i < N; ++i){

        if(bucket[i] > 0 and cd > 0){
            res += bucket[i];
            cd--;
        }
    }
    cout << res << endl;


}

Measured memory_bytes: 1920
/*
    ##############################
    #  Author: Pratyush Gaurav   #
    #  College: NIT ROURKELA     #
    ##############################
*/
#include <bits/stdc++.h>

using namespace std;

typedef long long lli;
typedef long double ld;
typedef pair<lli, lli > plli;
typedef vector<lli> vlli;
typedef vector<plli > vplli;

#define scan(n) scanf("%lld",&n)
#define scan2(a,b) scanf("%lld %lld",&a,&b)
#define scan3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define print(n) printf("%lld\n",n)
#define scanS(s) scanf("%s",&s)
#define printS(s) printf("%s",s)

#define ff first
#define ss second
#define rep(i,a) for(i = 0 ; i < a ; i++)
#define repr(i,a) for(i = a ; i >= 0 ; i--)
#define REP(i,a,b) for(i = a ; i <= b ; i++)
#define REPR(i,a,b) for(i = a ; i >= b ; i--)
#define mem(a,b)memset(a,b,sizeof(a))
#define opt ios_base::sync_with_stdio(false);cin.tie(NULL);
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*((b)/gcd(a,b)))
#define sqr(x) (x)*(x)
#define all(a) a.begin(),a.end()
#define pb push_back
#define popb pop_back

#define endl '\n'

const long long INF = 2000000000000;
const long long MOD = 1000000007;
const long long MAXN = 100005;

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

void solve() {
    lli n, m, q;
    cin >> n >> m >> q;
    vlli v[n + 1];
    lli i;
    rep(i, m) {
        lli x, y;
        cin >> x >> y;
        if (x > y)
            swap(x, y);
        v[x].pb(y);
    }
    rep(i, n + 1) {
        if (v[i].size() > 0)
            sort(all(v[i]));
    }
    while(q--) {
        lli ans = 0;
        lli l, r;
        cin >> l >> r;
        REP(i, l, r) {
            ans += max(0LL, (lli)(upper_bound(all(v[i]), r) - v[i].begin()));
        }
        cout << ans << endl;
    }
}

int main()
{
    opt;
    lli t = 1;
    //cin >> t;

    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 3456
import java.util.Scanner;
import java.util.StringJoiner;

class Main {

	static int n;

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		int[] a = new int[n];		// ??\????????????????????????
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		int[] b = new int[n];		// ????????¨??????
		countingSort(a, b, 10_000);	// 0???<= A[i] <=???10,000

		StringJoiner sj = new StringJoiner(" ");
		for (int i = 0; i < n; i++) {
			sj.add(String.valueOf(b[i]));
		}

		System.out.println(sj);

	}

	private static void countingSort(int[] a, int[] b, int k) {

		int[] c = new int[k+1];

		/* c[i]?????°i???????????°????¨?????????? */
		for (int i = 0; i < n; i++) {
			c[a[i]] ++;
		}

		/* c[i]?????°i??\????????°???????????°????¨?????????? */
		for (int i = 1; i <= k; i++) {
			c[i] += c[i-1];
		}

		for (int j = n-1; j >= 0; j--) {
			b[ c[a[j]]-1 ] = a[j];
			c[a[j]]--;
		}

	}
}

Measured memory_bytes: 587992
N = int(input())
r = {"AC": 0, "WA": 0, "TLE": 0, "RE": 0}
for _ in range(N):
    S = input()
    r[S] += 1
print("AC x " + str(r["AC"]))
print("WA x " + str(r["WA"]))
print("TLE x " + str(r["TLE"]))
print("RE x " + str(r["RE"]))

Measured memory_bytes: 74664
#include<bits/stdc++.h>
using namespace std;
bool visited[100005];
int path[100005];
vector<int>adj[100005];
queue<int>q;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	memset(visited,sizeof(visited),false);
	int n,m;
	cin>>n>>m;
	int x,y;
	bool flag=false;
	for(int i=0;i<m;i++)
	{	
		cin>>x>>y;
		adj[x].push_back(y);
		adj[y].push_back(x);
		if(x==1 || y==1)
			flag=true;
	}	
	if(!flag)
	{
		cout<<"No";
		return 0;
	}
	q.push(1);
	while(q.size())
	{
		int x=q.front();
		q.pop();
	if(!visited[x]){
		visited[x]=true;
		for(int i=0;i<adj[x].size();i++)
		{
			q.push(adj[x][i]);
			if(path[adj[x][i]]==0)
				path[adj[x][i]]=x;
		}
		
	}
}
cout<<"Yes\n";
for(int i=2;i<=n;i++)
{
	cout<<path[i]<<"\n";
}


 return 0;
}


Measured memory_bytes: 11104
import collections
n = int(input())

a = list(input())
su = 0
co = 1
coo = 0
c = 0
cc = 0
k = a[0]
c1 = n
c2 = 0
c3 = 0
aa = []
p = a.count("#")
pp = a.count(".")

for i in range(n-1):
	if k == a[i+1]:
		co += 1
	else:
		aa.append([k,co])
		k = a[i+1]
		co = 1

aa.append([k,co])
co = 0
if aa[-1][0] == ".":
	aa.append(["#",0])
for i in range(len(aa)):
	if aa[-(i+1)][0] == "#":
		c += aa[-(i+1)][1]
		c3 += aa[-(i+1)][1]
		c1 = min(c1,cc + p - c)
	else:
		cc += aa[-(i+1)][1]
		c2 += aa[-(i+1)][1]
		c1 = min(c1,cc + p - c)

print(min(c1,c2,c3))



Measured memory_bytes: 78792
/* ex 3_1
  kt125 */

#include <stdio.h>

int main(void) {
  int n;
  scanf("%d", &n);
  
  switch(n % 10){ // nの一の位
    case 2: case 4: case 5: case 7: case 9:
      printf("hon\n"); break;
    case 0: case 1: case 6: case 8:
      printf("pon\n"); break;
    case 3:
      printf("bon\n"); break;
  }
  return 0;
}



Measured memory_bytes: 1648
n, m, x, y = map(int,input().split())
X = list(map(int,input().split()))
Y = list(map(int,input().split()))
X.append(x)
Y.append(y)
X.sort()
Y.sort()
if X[len(X)-1] < Y[0]:
    print("No War")
else:
    print("War")


Measured memory_bytes: 3060
use proconio::input;
use std::cmp;

fn main() {
    input! {
        n: isize,
        a: isize,
        b: isize,
    }

    let q = n / (a + b);
    let r = n % (a + b);

    let ans = q * a + cmp::min(r, a);
    println!("{}", ans);
}


Measured memory_bytes: 2148
#include <stdio.h>

int main(void) {
	int a, b;
	
	scanf("%d %d", &a, &b);
	if (a < b)
		printf("a < b\n");
	else if (a > b)
		printf("a > b\n");
	else
		printf("a == b\n");
	
	return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>

using namespace std;
using ll = long long;

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

ll gcd(ll a, ll b){
  return a%b ? gcd(b, a%b) : b;
}

ll lcm(ll a, ll b){
  return a / gcd(a, b) * b; // prevent from overflowing
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s; cin >> s;
  ll res = 0;
  for(int i=0; i<4; ++i){
    if(s[i] == '+') ++res;
    else --res;
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
n=int(input())
a=[0]*n
b=[0]*n
c=[0]*n
for i in range(n):
    a[i],b[i],c[i]=list(map(int,input().split()))
dpa=[100000000]*n
dpb=[100000000]*n
dpc=[100000000]*n
dpa[0]=a[0]
dpb[0]=b[0]
dpc[0]=c[0]
for i in range(n-1):
    dpa[i+1]=max(dpb[i]+a[i+1],dpc[i]+a[i+1])
    dpb[i+1]=max(dpa[i]+b[i+1],dpc[i]+b[i+1])
    dpc[i+1]=max(dpa[i]+c[i+1],dpb[i]+c[i+1])


print(max(dpa[n-1],dpb[n-1],dpc[n-1]))

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

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

    long long i,j,k,l,m,n,o,p,T;

 char s1[200009],s2[200009];
 while(cin>>s1>>s2){
    l=strlen(s1);

    j=0;

    for(i=0;i<l;i++)if(s1[i]!=s2[i])j++;

    cout<<j<<endl;

 }
    return 0;

}


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

int main() {
  int H, W;
  cin >> H >> W;
  string S[H];
  for(int i=0; i<H; i++){
    cin >> S[i];
  }

  int n[3] = {-1, 0, 1};
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      int count = 0;
      if(S[i][j] == '.'){
        for(int y : n){
          y += i;
          for(int x : n){
            x += j;
            if(x == j && y == i || x < 0 || x >= W || y < 0 || y >= H) continue;
            if(S[y][x] == '#') count++;
          }
        }
        S[i][j] = to_string(count)[0];
      }
    }
  }

  for(int i=0; i<H; i++){
    cout << S[i] << endl;
  }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std ;

typedef long long ll ;

#define fr(i) f[i].first
#define sc(i) f[i].second
#define pint pair<int, int>

const int N = 300010 ;

ll ans ;
int m, n ;
pint f[N] ;
ll base[N] ;

bool comp(int x, int y){
    return base[x] > base[y] ;
}
int main(){
    cin >> m ; n = (1 << m) - 1 ;
    for (int i = 0 ; i <= n ; ++ i){
        cin >> base[i] ;
        f[i] = make_pair(i, n + 1) ;
    }
    base[n + 1] = -1 ;
    for (int i = 0 ; i <= n ; ++ i)
        for (int j = 0 ; j < m ; ++ j)
            if (!((1 << j) & i)){
                int k = (1 << j) | i ;
                int t[4] = {fr(i), sc(i), fr(k), sc(k)} ;
                sort(t, t + 4, comp) ; unique(t, t + 4) ;
                f[k] = make_pair(t[0], t[1]) ;
            }
    for (int i = 1 ; i <= n ; ++ i){
        ans = max(ans, base[fr(i)] + base[sc(i)]) ;
        cout << ans << endl ;
    }
}


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

template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
#define endl '\n'
#define __ ios_base::sync_with_stdio(0);cin.tie(0);
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(),x.end()
#define forn(i,a,n) for(int i=a; i < n; i++)
typedef long long int lli;
typedef long double Double;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int mod = 1e9+7;
const int inf= 1<<30;
const int maxn = 1000005;
void solve(){
	int n,x,t;
	cin >> n >> x >> t;
	int ans = n/x;
	if(n%x) ans++;
	cout << ans * t << endl;
}

int main(){
	int t=1;
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <cstdio>
#include <queue>
#include <cstring>
#include <algorithm>

using namespace std;

const int N = 205;
const int INF = 0x3f3f3f3f;

int n, m, a[N][N], b[N][N], c[N][N], res[N];

struct NetworkFlow
{
	int head[N << 1], to[N * N * 2], nxt[N * N * 2], edge[N * N * 2], cnt;
	int dep[N << 1], s, t;
	queue<int> q;
	
	void add(int u, int v, int w)
	{
		nxt[++cnt] = head[u];
		head[u] = cnt;
		to[cnt] = v;
		edge[cnt] = w;
	}
	
	void Add(int u, int v, int w)
	{
		add(u, v, w);
		add(v, u, 0);
	}
	
	bool bfs()
	{
		memset(dep, -1, sizeof(dep));
		dep[s] = 0;
		q.push(s);
		
		while (!q.empty())
		{
			int u = q.front();
			q.pop();
			for (int i = head[u]; i; i = nxt[i])
			{
				int v = to[i];
				int w = edge[i];
				if (w > 0 && dep[v] == -1)
				{
					dep[v] = dep[u] + 1;
					q.push(v);
				}
			}
		}
		
		return dep[t] != -1;
	}
	
	int dfs(int u, int flow)
	{
		if (dep[u] == dep[t]) return u == t ? flow : 0;
		int out = 0;
		for (int i = head[u]; i; i = nxt[i])
		{
			int v = to[i];
			int w = edge[i];
			if (w > 0 && dep[v] == dep[u] + 1)
			{
				int f = dfs(v, min(flow - out, w));
				edge[i] -= f;
				edge[i ^ 1] += f;
				out += f;
				if (out == flow) break;
			}
		}
		return out; 
	}
	
	void reset()
	{
		cnt = 1;
		s = N * 2 - 2;
		t = N * 2 - 1;
		memset(head, 0, sizeof(head));
		for (int i = 1; i <= n; ++i)
		{
			Add(s, i, 1);
			Add(i + n, t, 1);
		}
	}
	
	void maxflow()
	{
		while (bfs()) dfs(s, INF);
		for (int u = 1; u <= n; ++u)
		{
			res[u] = -1;
			for (int i = head[u]; i; i = nxt[i])
			{
				int v = to[i];
				int w = edge[i];
				if (v <= 2 * n && w == 0)
				{
					res[u] = v - n;
					break;
				}
			}
		}
	}
} flow;

int main()
{
	scanf("%d%d", &n, &m);
	
	for (int i = 1; i <= n; ++i)
	{
		for (int j = 1; j <= m; ++j)
		{
			scanf("%d", a[i] + j);
		}
	}
	
	for (int t = 1; t <= m; ++t)
	{
		flow.reset();
		for (int i = 1; i <= n; ++i)
		{
			for (int j = 1; j <= m; ++j)
			{
				if (a[i][j]) flow.Add(i, (a[i][j] - 1) / m + 1 + n, 1);
			}
		}
		flow.maxflow();
		for (int i = 1; i <= n; ++i)
		{
			for (int j = 1; j <= m; ++j)
			{
				if (a[i][j] && (a[i][j] - 1) / m + 1 == res[i])
				{
					b[i][t] = c[res[i]][t] = a[i][j];
					a[i][j] = 0;
					break;
				}
			}
		}
	}
	
	for (int i = 1; i <= n; ++i)
	{
		for (int j = 1; j <= m; ++j)
		{
			printf("%d%c", b[i][j], " \n"[j == m]);
		}
	}
	
	for (int i = 1; i <= n; ++i)
	{
		for (int j = 1; j <= m; ++j)
		{
			printf("%d%c", c[i][j], " \n"[j == m]);
		}
	}
	
	return 0;
}

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

int main()
{
    int H,W,h,w;
    cin >> H >> W >> h >> w;

    int hb = h*W;
    int wb = H*w;
    int ans = H*W - hb - wb + h*w;
    cout << ans << endl; 
    return 0;
}

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

struct Edge { int s, t, cost; };

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

int n, m;
vector<Edge> es;

int main() {
  while (cin >> n >> m, n) {
    es = vector<Edge>();

    REP(i, m) {
      int a, b, w;
      cin >> a >> b >> w, a--, b--;
      es.push_back({a, b, w});
    }

    sort(begin(es), end(es), [](Edge e1, Edge e2) { return e1.cost < e2.cost; });
    int ans = 1e9;
    REP(l, m - n + 2) {
      int mn = es[l].cost;
      int mx = 0;
      UnionFind uf(n);
      REP(r, m) {
        if (l > r) continue;
        if (uf.unite(es[r].s, es[r].t)) {
          mx = es[r].cost;
        }
        if (uf.size(0) == n) ans = min(ans, mx - mn);
      }
    }
    cout << ((ans == 1e9) ? -1 : ans) << endl;
  }
}



Measured memory_bytes: 3248
#include<cstdio>
using namespace std;

signed main(void){
  int a, b;
  scanf("%d %d", &a, &b);

  bool sign = true;
  for(int i = a;i <= b;++i){
    if(i < 0)sign = !sign;
    else if(i == 0){
      puts("Zero");
      return 0;
    }
  }

  if(sign)puts("Positive");
  else puts("Negative");

  return 0;
}


Measured memory_bytes: 128
S = input()
N = len(S)

ans = N//2 + bool(N%2)


# 奇数
if N%2 == 1:
    left = S[:N//2]
    left = left[::-1]
    right = S[N//2+1:]
    cent = S[N//2]
    
    i = 0
    while i < N//2:
        if left[i] == cent and right[i] == cent:
            ans += 1
            i += 1
        else:
            break
        
else:
    left = S[:N//2]
    left = left[::-1]
    right = S[N//2:]
    cent = S[N//2]
    
    i = 0
    while i < N//2:
        if left[i] == cent and right[i] == cent:
            ans += 1
            i += 1
        else:
            break
        
print(ans)
        

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

typedef long long ll;
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int t; cin>>t; while(t--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)


int main()
{
    optimize();


    int t;
    cin>> t;

    cout<< (t>= 30 ? "Yes\n": "No\n");

    return 0;
}




Measured memory_bytes: 3604
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

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

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  sort(a.begin(), a.end());
  int ret = 0, i;
  for (i = 0; i < n; ++i) {
    if (m >= a[i]) {
      ++ret;
      m -= a[i];
    } else {
      break;
    }
  }
  if (i == n && m > 0) --ret;
  printf("%d\n", ret);
  return 0;
}


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

using ll = long long;

void solve(long long X, long long Y, long long Z){
    ll a = X, b = Y, c = Z;
    X = c;
    Y = a;
    Z = b;
    cout << X << " " << Y << " " << Z << endl;
}

int main(){
    long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);
    long long Z;
    scanf("%lld",&Z);
    solve(X, Y, Z);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string.h>
#define ll long long
using namespace std;

int a[5];
int main()
{
    int n,x;
    scanf("%d",&n);

     a[0] = a[1] = a[2] = 0;
    for (int i=1;i<=n;i++)
       {
           scanf("%d",&x);
           int cnt=0;
           while (x % 2 == 0)
           {
               cnt++;
               x /= 2;
           }
           a [ min(cnt,2) ] ++ ;
       }



     int need=a[0];
     if (a[1]) need++;

    if ( a[2] >=  need -1 )
        printf("Yes\n");
    else
        printf("No\n");

    return 0;
}


Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as BS
import Data.Maybe (fromJust)

divableN :: Integral a => a -> a -> a
divableN n x
  | x `rem` n /= 0 = 0
  | otherwise      = 1 + divableN n (x `div` n)

solve :: [Int] -> Bool
solve a = let x = if c1 == 0 then 0 else 1
           in c0 + x <= c2 + 1
  where
    count p = length . filter p
    c0 = count (==0) a
    c1 = count (==1) a
    c2 = count (>=2) a

main :: IO ()
main = do
    _ <- getLine
    a <- map (divableN 2) . map (fst . fromJust . BS.readInt)
        . BS.words <$> BS.getLine :: IO [Int]
    putStrLn $ if solve a then "Yes" else "No"

Measured memory_bytes: 4348
n = int(input())
#print(n/1.08)
#print(999*1.08)
#print(1000*1.08)
a = int(n/1.08)
b = a+1

if int(a*1.08)==n:
  print(a)
elif int(b*1.08)==n:
  print(b)
else:
  print(":(")

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

bool isSortable(int min_b, int min_c, int *l)
{
    int first;
    bool res1, res2;

    first  = l[0];
    if (first == 0) return true;
    l++;
    // case1 firstをBに入れた場合
    if(first < min_b) {  // firstがmin_bより小さいときはfalse
        res1 = false;
    } else {             // firstはmin_bより大きい
        res1 = isSortable(first, min_c, l);
    }
    // case2 firstをCに入れた場合
    if(first < min_c) {
        res2 = false;
    } else {
        res2 = isSortable(min_b, first, l);
    }

    return (res1 || res2);
}

int main(void)
{
    int n, i, a[11];

    cin >> n;

    for(; n > 0 ; n--) {
        for(i = 0 ; i < 10 ; i++) {
            cin >> a[i];
        }
        a[10] = 0;
        if (isSortable(0, 0, a)) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 1152
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int Max = 1000000;
int main(){
  	int K, N;
  	cin >> K >> N;
  	int A[N];
 
  	int width = 0;
  	for(int i=0;i<N;i++){
  		cin >> A[i];
  	}
  	for(int i=0;i<N-1;i++){
  		width = max(width, A[i+1]- A[i]);
  	}
 
  	width = max(width, A[0]+ K-A[N-1]);
 
  	cout << K - width <<endl;
 
    
  	return 0;
}

Measured memory_bytes: 1024
# import numpy as np
import sys, math, heapq
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep="\n")

S = input()
T = input()
lenS = len(S)
lenT = len(T)

difmin = float("inf")
for si in range(lenS - lenT + 1):
    dif = 0
    for s, t in zip(S[si:], T):
        if s != t:
            dif += 1
    difmin = min(difmin, dif)

print(difmin)


Measured memory_bytes: 67752
#include <iostream> // cout, endl, cin
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
using namespace std;

const double pi = 3.141592653589793;

int main(){
  double a, b, c, S, L, h;
  double d;
  double unit;
  unit = pi / 180;
  cin >> a >> b >> c;
  h = b * sin(unit * c);
  d = sqrt(h * h + (a - b * cos(unit * c)) * (a - b * cos(unit * c)));
  L = a + b + d;
  S = (a * h) / 2;
  cout << fixed << setprecision(10);
  cout << S << endl << L << endl << h << endl;
}



Measured memory_bytes: 3472
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;


int main() {
    int x, y;
    cin >> x >> y;
    if (y - 2 * x < 0 || (y - 2 * x) % 2 == 1) {
        cout << "No" << endl;
        return 0;
    }
    int b = (y - 2 * x) / 2;
    if (x - b >= 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String str_scan = scan.nextLine();
    // int型へ変換
    var X = Integer.parseInt(str_scan);
    var ans = "No";

    if (X >= 30) {
      ans = "Yes";
    }

    System.out.println(ans);
    scan.close();
  }
}

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

struct edge {
    long long to;
    long long cost;
};

typedef pair<long long, long long> P;  // first: 最短距離, second: 頂点番号

int n;long long d[1000000];
vector<vector<edge>> G; // 隣接リスト表現

void dijkstra(int s) {
    fill(d, d + n, 1e18);
    d[s] = 0;  // 始点sへの最短距離は0

    priority_queue<P, vector<P>, greater<P>> que;  // 距離が小さい順に取り出せるようgreater<P>を指定
    que.push(P(0, s));
    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;  // 更新した頂点の中で距離が最小の頂点v
        if (d[v] < p.first) {
            continue;
        }
        for (auto e : G[v]) {  // 頂点vから出る辺eを走査
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}
int main(){
	cin>>n;
	G.resize(n);
	for(int i=0;i<n-1;++i){
		int a,b;long long t;
		cin>>a>>b>>t;
		a--;b--;
		G[a].push_back(edge{b,t});
		G[b].push_back(edge{a,t});
	}
    int q,k;cin>>q>>k;
    k--;
    dijkstra(k);
    for(int i=0;i<q;++i){
        int x,y;
        cin>>x>>y;
        x--;y--;
        cout<<d[x]+d[y]<<endl;
    }
}


Measured memory_bytes: 11248
/*************************************************************************

       Author:            palayutm
       Created Time :     Sat 18 Feb 2017 08:35:46 PM CST

       File Name:         e.cc
       Description:       new style, new life

 ************************************************************************/
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

pair<int, int> a[100005];
ll ans[100005];

int main(int argc, const char *argv[])
{
  int n;
  cin >> n;
  for (int i = 0; i < n; i ++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a, a+n);
  int minn = a[n-1].second;
  for (int i = n-2; i >= 0; i --) {
    ans[minn] += (ll)(a[i+1].first - a[i].first) * (n-i-1);
    minn = min(minn, a[i].second);
  }
  ans[minn] += (ll)a[0].first * n;
  for (int i = 0; i < n; i++) {
    cout << ans[i] << endl;
  }
  
  return 0;
}



Measured memory_bytes: 2688
n, q = (int(i) for i in input().split())  
s = input()

count_list = []
bef_str = ''
bef_count = 0

for x in s:
  if bef_str == 'A' and x == 'C':
    bef_count += 1
    
  count_list.append(bef_count)
  bef_str = x
    
for i in range(q):
  l, r = (int(i) for i in input().split())
  print(count_list[r-1] - count_list[l-1])

Measured memory_bytes: 6152
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<ctime>
#include<vector>
#include<queue>
#include<map>
#include<deque>
#include<stack>
#include<algorithm>
#define N 105
using namespace std;
const long long INF=1e19;
const double Pi=acos(-1);
int A[N];
int main()
{
	int i,j,n;
	long long Ans=INF;
	scanf("%d",&n);
	for(i=1;i<=n;i++)scanf("%d",&A[i]);
	sort(A+1,A+n+1);
	for(i=A[1];i<=A[n];i++)
	{
		long long Sum=0;
		for(j=1;j<=n;j++)Sum+=(A[j]-i)*(A[j]-i);
		Ans=min(Ans,Sum);
	}
	printf("%lld\n",Ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
#define ll long long
const ll INF=1e15;
#define int long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define fastio cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(false)
const double pi = acos(-1.0);
int gcd (int a, int b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}
int lcm (int a, int b) {
    return a / gcd(a, b) * b;
}

long long binpows(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)  //impar
            res = res * a;
        a = a * a;
        b >>= 1;  // /2
    }
    return res;
}
const int mod=1e9+7;
int binpow(int a, int b, int m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
//CHECAR SE PRECISA DE LONG LONG
vector<tuple<int,int,int> > v;
int n;
int dp[123456][3];
int resolve(int pos, int qual){
	if(pos==n)
		return 0;
	int &x=dp[pos][qual];
	if(x!=-1)
		return x;
	x=0;
	if(qual!=0){
		x=max(x,resolve(pos+1,0)+get<0>(v[pos]));
	}
	if(qual!=1){
		x=max(x,resolve(pos+1,1)+get<1>(v[pos]));
	}
	if(qual!=2){
		x=max(x,resolve(pos+1,2)+get<2>(v[pos]));
	}
	return x;
}
void solve(){
	memset(dp,-1,sizeof(dp));
	cin>>n;
	v.resize(n);
	for(int i=0; i<n; i++){
		cin>>get<0>(v[i])>>get<1>(v[i])>>get<2>(v[i]);
	}
	int ans=0;
	ans=max(ans,resolve(1,0)+get<0>(v[0]));
	ans=max(ans,resolve(1,1)+get<1>(v[0]));
	ans=max(ans,resolve(1,2)+get<2>(v[0]));
	
	cout<<ans<<endl;
}
//revise as variaveis e a ordem nas funções
signed main(){
    int t=1;
    //cin>>t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 16068
#include <iostream>
#include <vector>

using namespace std;

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

    vector<vector<long long>> T(N+1, vector<long long>(50*N+1));
    T[0][0] = 1LL;

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

        vector<vector<long long>> P = T;

        for (int j=0; j<=i; j++)
        for (int k=0; k<=50*i; k++)
            T[j+1][k+x] += P[j][k];
    }
    long long ans = 0;
    for (int i=1; i<=N; i++)
        ans += T[i][i*A];
    cout<<ans<<endl;
}


Measured memory_bytes: 2312
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef vector<float> vf;
typedef vector<vf> vvf;

#define INF 1e8
#define V_MAX 30

struct edge {
    int to, distance, limit;
};

struct P {
    int from;
    float cost;
    int v;
    int before;

    bool operator >(const P& p) const {
        return cost > p.cost;
    }
};

int node_n, edge_n, start, goal;

int main() {
    while (cin >> node_n >> edge_n, node_n|edge_n) {
        vector<vector<edge>> E(node_n+1);
        cin >> start >> goal;
        REP(i, edge_n) {
            int to, from, distance, limit;
            cin >> to >> from >> distance >> limit;
            E[to].push_back({from, distance, limit});
            E[from].push_back({to, distance, limit});
        }

        vector<vvf> G(node_n+1, vvf(node_n+1, vf(V_MAX+1, INF)));
        priority_queue<P, vector<P>, greater<P>> q;
        q.push({start, 0, 0});

        float cost = 0;
        while (!q.empty()) {
            P p = q.top(); q.pop();

            if (p.from == goal && p.v == 1) {
                cost = p.cost;
                break;
            }

            for (edge e : E[p.from]) {
                if (e.to == p.before) continue;
                // v+1, v, v-1
                for (int i = -1; i <= 1; i++) {
                    int v = p.v + i;
                    if (1 <= v && v <= V_MAX && v <= e.limit) {
                        float t = e.distance / (float)(v);
                        if (G[e.to][p.from][v] > p.cost + t) {
                            G[e.to][p.from][v] = p.cost + t;
                            q.push({e.to, p.cost + t, v, p.from});
                        }
                    }
                }
            }
        }
        if (cost > 0) {
            printf("%.5f\n", cost);
        } else {
            printf("unreachable\n");
        }
    }
}

Measured memory_bytes: 1744
n,m=map(int,input().split())
s=list(input())
s=list(map(int,s))

i=n
ans=[]
while i>0:
    if i<=m:
        ans.append(i)
        break
    j=m
    while True:
        if j==0:
            print(-1)
            exit()
        if s[i-j]:
            j-=1
        else:
            ans.append(j)
            i-=j
            break


ans.reverse()
print(*ans)


Measured memory_bytes: 7064