akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<vector>
#include<set>
#include<string>
#include<map>
#include<cmath>
#include<queue>
#include<cstdlib>
#include<cstring>
#define P pair<int ,int>
using namespace std;

int spd[3] = {1, 0, -1};

struct E {
	int dst, cost, lim;
	E(int d, int c, int l) {
		dst = d;
		cost = c;
		lim = l;
	}
};

struct N {
	int pos, bef, spd;
	double ti;
	N(int p, int b, int s, double t) {
		pos = p;
		bef = b;
		spd = s;
		ti = t;
	}
	N(){}
};

bool operator < (N n1, N n2) {
	return n1.ti > n2.ti;
}

int main()
{
	int n, m, s, g;
	int x, y, d, c;
	N no;
	while (cin >> n >> m, n) {
		cin >> s >> g;
		bool ef = 0;
		bool f[31][31][31];
		memset(f, 0, sizeof(f));
		vector<vector<E> > e(n + 1);
		
		for (int i = 0; i < m; i++) {
			cin >> x >> y >> d >> c;
			e[x].push_back(E(y, d, c));
			e[y].push_back(E(x, d, c));
		}
		
		priority_queue<N> pq;
		pq.push(N(s, s, 0, 0));
		
		while (!pq.empty()) {
			no = pq.top();
			pq.pop();
			if (f[no.pos][no.bef][no.spd]) continue;
			f[no.pos][no.bef][no.spd] = 1;
			
			if (no.pos == g && no.spd == 1) {
				ef = 1;
				break;
			}
			
			for (int i = 0; i < e[no.pos].size(); i++) {
				if (no.bef == e[no.pos][i].dst) continue;
				
				for (int j = 0; j < 3; j++) {
					if (no.spd + spd[j] > 0 && e[no.pos][i].lim >= no.spd + spd[j])
						pq.push(N(e[no.pos][i].dst, no.pos, no.spd + spd[j], no.ti + e[no.pos][i].cost / (double)(no.spd + spd[j])));
				}
			}
		}
		
		if(ef) printf("%.5lf\n", no.ti);
		else cout << "unreachable" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 21088
import numpy as np
N = int(input())

U = 10**5
is_prime = np.full(U+1, True)
is_prime[:2] = False
for p in range(2, U+1):
    if p*p > U:
        break
    if is_prime[p]:
        is_prime[p*p::p] = False

ans = []
for c in range(11, 55556, 5):
    if is_prime[c]:
        ans.append(c)
        if len(ans) == N:
            print(*ans)
            exit()


Measured memory_bytes: 13268
// problem: "https://atcoder.jp/contests/abc145/tasks/abc145_b"

#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    string s;

    cin>>n>>s;

    if(n%2)
    {
        cout<<"No";
        exit(0);
    }
    else
    {
        int i;
        for(i=n/2;i!=s.size();i++)
        {
            if(s[i-n/2] != s[i])
            {
                cout<<"No";
                exit(0);
            }
        }

        cout<<"Yes";
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mp make_pair
#define ff first
#define ss second

using namespace std;
using vi=vector<int>;
using pii=pair<int, int>;
using ull=unsigned long long;

typedef long long ll;

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

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

	int ans = 0;
	for (int i = 0; i<n;i++)
	{
		int cnt = 0;
		int j;
		int aux = h[i];
		for (j = i+1; j < n; j++)
		{
			if (aux >= h[j])
			{
				cnt++;
				aux = h[j];
			}
			else
				break;
		}

		ans = max(ans, cnt);
		i = j-1;
	}

	cout << ans << "\n";
    
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <numeric>
#include <vector>
#include <math.h>
#include <map>
#include <algorithm>
#include <stdio.h>
#include <set>
#include <string>
#include <float.h>
#include <iomanip>
#define mod 1000000007
using namespace std; 
const double pi = acos(-1);

int main(){
	long long n;
	cin >> n;
	bool check=true;
	long long s=pow(10,18);
	long long ans=1;
	for (int i=0;i<n;i++){
		long long a; cin >> a;
		if(a==0){
			ans=0;
			check=false;
		}
		if(check && a>s/ans){
			ans=-1;
			check=false;
		}
		if(check) ans*=a;
	}
	cout << ans << "\n";
}










Measured memory_bytes: 3632
#include<iostream>
int main(){
  int n, h, prev = 0, ans = 0;
  std::cin >> n;
  while(n--){
    std::cin >> h;
    if(prev < h)
        ans += h - prev;
    prev = h;
  }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	char b;
	cin>>b;
	if(b=='A')
		cout<<"T\n";
	else if(b=='T')
		cout<<"A\n";
	else if(b=='C')
		cout<<"G\n";
	else if(b=='G')
		cout<<"C\n";
	return 0;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    a_lst = list(map(int, input().split()))
    count = 0

    for i in range(n):
        a = a_lst[i]

        while a % 2 == 0:
            count += 1
            a //= 2

    print(count)


if __name__ == '__main__':
    main()

Measured memory_bytes: 10008
#include <bits/stdc++.h>
#define mp make_pair
#define X first
#define Y second
#define pii pair<ll,ll>
#define x1 dlfjl
#define x2 dkfj
#define MOD 1000000007
#define y1 dskgj
#define y2 dskfj
#define SQ 320
typedef int ll;
using namespace std;
ll n,i,j,k,x,y,z,m,q,h,r,timer,mx,l;
ll a[100500];
map<ll, ll> f;
int main() {
    //freopen("input.txt","r",stdin);
    string s;
    cin >> s;
    ll n = s.size();
    ll cur_xor = 0;
    f[0] = 0;
    for (int i = 0; i < n; i++) {
        /*for (auto itr = f.begin(); itr != f.end(); itr++)
            cout << (*itr).X << " " << (*itr).Y << endl;
        cout << endl;*/
        ll cur = (1<<(s[i]-'a'));
        ll min_val = n+5;
        if (f.find(cur^cur_xor) != f.end())
            min_val = min(min_val, f[cur^cur_xor]);
        //cout << "Dfgdfgdfg " << cur << " " << cur_xor << endl;
        for (int j = 0; j < 26; j++)
            if (f.find(cur^cur_xor^(1<<j)) != f.end())
                min_val = min(min_val, f[cur^cur_xor^(1<<j)]);
        if (i == n-1) {
            cout << min_val+1 << endl;
            return 0;
        }

        cur_xor ^= cur;
        if (f.find(cur_xor) == f.end())
            f[cur_xor] = min_val+1;
        else
            f[cur_xor] = min(f[cur_xor], min_val+1);
    }
    return 0;
}


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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1001001001;
static const ll MOD = 1000000007;
const int n = 13;
ll dp[100005][n];

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

    cout << 3 * r * r << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int 
#define mod 1000000007
#define se second
#define fi first
#define endl "\n"
#define MAX 9223372036854775807
using namespace std;
typedef pair<ll,ll> pll ;
typedef vector<pair<ll,ll> > vpll;
/*vi adj[200005];
ll vis[200005];
ll parent[200005];
ll level[200005];
ll arr[200005];
ll size[200005];*/
//endl mut bhool!!

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

	ll n,m,x;
	cin>>n>>m>>x;
	ll arr[n][m+1];
	for(int a=0;a<n;a++)
	{
		for(int b=0;b<=m;b++)
		cin>>arr[a][b];
	}
	ll y,z,ans=9999999999999999;
	for(int a=0;a<=pow(2,n)-1;a++)
	{
		ll crr[m+1]={0};
		for(int b=n-1;b>=0;b--)
		{
			y=((1<<b)&a);
			if(y>=1)
			y=1;
			if(y==1)
			{
				for(int c=0;c<=m;c++)
				{
					crr[c]+=arr[b][c];
				}
			}
		}
//		cout<<endl;
		z=1;
		for(int aa=1;aa<=m;aa++)
		{
			if(crr[aa]<x)
			{
				z=0;
				break;
			}
		}
		if(z==1)
		{
			ans=min(ans,crr[0]);
		}
	}
	if(ans==9999999999999999)
	cout<<"-1";
	else
	cout<<ans;
	return 0;
}

Measured memory_bytes: 4080
package main

import "fmt"

func main() {
	var N, M int
	var hoge [30]int
	fmt.Scan(&N, &M)
	for i := 0; i < N; i++ {
		var K int
		fmt.Scan(&K)
		for j := 0; j < K; j++ {
			var A int
			fmt.Scan(&A)
			A--
			hoge[A]++
		}
	}
	ans := 0
	for i := 0; i < 30; i++ {
		if hoge[i] == N {
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

ll ceil(ll a, ll b) {    // a÷b以上の最小の整数
    if(a%b == 0) {
        return a/b;
    }
    else {
        return a/b + 1;
    }
}

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

    ll x[5];
    rep(i, 5) {
        cin >> x[i];
    }
    sort(x, x+5);

    ll ans = ceil(n, x[0]) + 4LL;

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

Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

int main(){

   int a,b,h;
   cin >> a >> b >> h;

   cout << (a+b)*h/2 << endl;


   return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		System.out.println((1900 * M + 100 * (N - M)) * (int)Math.pow(2, M));
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)

int main(){
  long x,y;
  cin >> x >> y;
  long answer = 0;
  while(x <= y){
    answer++;
    x *= 2;
  }
  cout << answer << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a==1&&a!=b)
		cout<<"Alice";
	else{
		if(b!=a&&b==1)
			cout<<"Bob";
		else{
			if(a>b)
				cout<<"Alice";
			else{
				if(a<b)
					cout<<"Bob";
				else
					{
					if(a=b)
						cout<<"Draw";
		
	}	}
}
}
}

Measured memory_bytes: 256
def main():
    N, M = map(int, input().split())  # N must be an odd number

    is_odd = (N-1) & 1
    bias = 0

    for i, distance in enumerate(range(N-1, 0, -2)):

        if is_odd and distance <= -distance % N:
            bias = 1

        left = i + 1
        right = left + distance - bias
        print(left, right)

        if i == M-1:
            return


if __name__ == "__main__":
    main()


Measured memory_bytes: 9264
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

X, Y, A, B, C = MAP()
p = LIST()
q = LIST()
r = LIST()
r = [-x for x in r]

p.sort()
q.sort()
r.sort()

p_tmp = p[-X:]
q_tmp = q[-Y:]

while r:
	if -r[0] < p_tmp[0] and -r[0] < q_tmp[0]:
		break
	p_min = heappop(p_tmp)
	q_min = heappop(q_tmp)
	r_max = heappop(r)
	
	if p_min <= q_min:  # pに入れる
		heappush(p_tmp, -r_max)
		heappush(q_tmp, q_min)
	else:  # qに入れる
		heappush(q_tmp, -r_max)
		heappush(p_tmp, p_min)
print(sum(p_tmp+q_tmp))


Measured memory_bytes: 124828
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <climits>
#include <iomanip>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;

int main() {
    int d, t, s;    cin >> d >> t >> s;
    if (d <= t * s)
        cout << "Yes" << endl;
    else 
        cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3620
#include <stdio.h>

#define PMAX 100000

int main()
{
	unsigned long price = 0, tmp = 0;
	unsigned int people = 0;

	scanf( "%d", &people );
	for ( int i = 0 ; i < people ; i++ ) {
		scanf( "%ld", &tmp );
		price += tmp;
	}

	printf( "%ld\n", price / people );

	return 0;
}



Measured memory_bytes: 2056
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long INF = 1LL << 60;

int main(){
  int n; cin >> n;
  
  int sum = 0;
  int ma = 0;
  rep(i, n){
    int l; cin >> l;
    sum += l;
    chmax(ma, l);
  }

  cout << (ma < sum-ma ? "Yes" : "No") << endl;

  return 0;
} 


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;

int dp[11000];
int main() {
    int N, W; cin >> N >> W;
    rep(i, 11000) dp[i] = 0;
    rep(j, N) {
        int v, w; cin >> v >> w;
        rep(i, W) {
            chmax(dp[i+w], dp[i] + v);
        }
    }
    cout << dp[W] << endl;
}


Measured memory_bytes: 3172
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int count = 0;
		int a = s.nextInt();
		int b = s.nextInt();
		int c = s.nextInt();
		int d = s.nextInt();

		int AB=Math.abs(a-b);
		int AC=Math.abs(a-c);
		int BC=Math.abs(c-b);

		if (AC <= d) {
			System.out.println("Yes");
		} else if (AB <= d&&BC<=d) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}
}


Measured memory_bytes: 21972
#define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <sstream>
#include <cmath>
#include <set>
#include <map>
#include <stack>
using namespace std; 

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define len(x) ((int)(x).size())
#define tmax(a,b,c) max((a),max((b),(c)))
#define tmin(a,b,c) min((a),min((b),(c)))
#define debug(x) cerr << #x << " is " << x << endl;

typedef pair<int, int> Pii;
typedef map<int, int> Mii;
typedef vector<int> Vi;
typedef vector<vector<int> > VVi;
typedef long long ll;
const int inf = 2e9;
const ll ll_inf = 1e17;
const int mod = 1e9 + 7;
const long double eps = 1e-10;
typedef pair<ll, ll> Pll; 

int p[300001];

int main()
{
	set<int> msPrime;
	rep (i,2,300001) {
		int t = i % 7;
		bool f = true;
		if (t == 1 || t == 6) {
			if (p[i] == 0) msPrime.insert(i);
			int j = i+i;
			while (j < 300001) {
				p[j]++;
				j += i;
			}
		}
	}

	while (1) {
		int x; cin >> x;
		if (x == 1) break;
		cout << x << ":";
		for (auto a: msPrime) if (x % a == 0) cout << " " << a;
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 5868
import java.util.*

class Card(private val s: String) {
    val suits = s[0]
    val value = s[1].toInt()

    override fun toString(): String {
        return s
    }
}

fun bubbleSort(C: Array<Card>): Array<Card> {
    for (i in C.indices) {
        for (j in C.size - 1 downTo i + 1) {
            if (C[j].value < C[j - 1].value) {
                C[j] = C[j - 1].also { C[j - 1] = C[j] }
            }
        }
    }
    return C
}

fun selectionSort(C: Array<Card>): Array<Card> {
    for (i in C.indices) {
        var minj = i
        for (j in i until C.size) {
            if (C[j].value < C[minj].value) {
                minj = j
            }
        }
        C[i] = C[minj].also { C[minj] = C[i] }
    }
    return C
}

fun whatNumber(target: Card, cards: Array<Card>): Int {
    var n = 0
    for (card in cards) {
        if (target.value == card.value) {
            n++
            if (target.suits == card.suits) {
                return n
            }
        }
    }
    return n
}

fun isStable(original: Array<Card>, sorted: Array<Card>): Boolean {
    for (card in original) {
        val n = whatNumber(card, original)
        val m = whatNumber(card, sorted)
        if (n != m) {
            return false
        }
    }
    return true
}

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val N = scanner.nextInt()
    val list = mutableListOf<Card>()
    for (i in 0 until N) {
        list.add(Card(scanner.next()))
    }
    val barr = bubbleSort(list.toTypedArray())
    println(barr.joinToString(" "))
    println(if (isStable(list.toTypedArray(), barr)) "Stable" else "Not stable")
    val sarr = selectionSort(list.toTypedArray())
    println(sarr.joinToString(" "))
    println(if (isStable(list.toTypedArray(), sarr)) "Stable" else "Not stable")
}



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

int main(){
  int N;
  string W1;
  cin>>N>>W1;
  unordered_set<string> A;
  A.insert(W1);
  char c=W1[W1.size()-1];
  for(int i=1;i<N;i++){
    string W;
    cin>>W;
    if(W[0]!=c || A.count(W)){
      cout<<"No"<<endl;
      return 0;
    }
    c=W[W.size()-1];
    A.insert(W);
  }
  cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, start, n) for (ll i = (ll)(start); i < (ll)(n); ++i)
static const ll INFTY = 1L << 62L;
ll solver(ll *x,ll *y,ll n)
{
    map<pair<ll,ll>,ll> mp;
    rep(i,0,n){
        rep(j,0,n){
            if(i==j)continue;
            ll px=x[j]-x[i],py=y[j]-y[i];
            if(mp.count(make_pair(px,py))==0){
                mp.emplace(make_pair(px,py),1);
            }
            else
            {
                ++mp[make_pair(px,py)];
            }
        }
    }
    ll max=0;
    for(auto e:mp){
        if(e.second>max){max=e.second;}
    }
    return n-max;

}
int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
ll n;
cin>>n;
ll x[n],y[n];
rep(i,0,n)cin>>x[i]>>y[i];
cout<<solver(x,y,n)<<endl;
}

Measured memory_bytes: 3732
n=int(input())
s=str(input())

if not len(s)%2 == 0:
    ans="No"

else:
    l=int(len(s)/2)
    s1=str(s[:l])

    if s == s1 + s1:
        ans="Yes"
    else:
        ans="No"

print(ans)


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

int main()
{
    string s, t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());
    if (s < t)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3600
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N;
int A[100000], B[100000];
int X[100000];

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N;
  rep(i, N) cin >> A[i];
  rep(i, N) cin >> B[i];
  rep(i, N) {
    if (i == 0 || A[i] != A[i-1]) X[i] = A[i];
  }
  bool f = true;
  //if (A[N-1] != B[0]) f = false;
  for (int i=N-1; i>=0; i--) {
    if (i == N-1 || B[i] != B[i+1]) {
      if (X[i] != 0 && B[i] != X[i]) f = false;
      X[i] = B[i];
    }
  }
  for (int i=N-1; i>=0; i--) {
    if (X[i] != 0 && (X[i] > A[i] || X[i] > B[i])) f = false;
  }
  if (!f) {
    cout << 0 << "\n";
  }
  else {
    long long s = 1;
    rep(i, N) {
      if (X[i] == 0) s = (s*min(A[i], B[i])) % MOD;
    }
    cout << s << "\n";
  }
  return 0;
}


Measured memory_bytes: 1408
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools


import queue
from collections import deque


def main():
    a = input()
    if a[:4] == 'YAKI':
        print('Yes')
    else:
        print('No')









if __name__ == '__main__':
    main()



Measured memory_bytes: 38892
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A, B;
        String op;

        A = sc.nextInt();
        op = sc.next();
        B = sc.nextInt();
        
        if(op.equals("+")){
            System.out.println(A + B);
        }else if(op.equals("-")){
            System.out.println(A - B);
        }

        sc.close();
    }
}

Measured memory_bytes: 20692
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  a += b;
  c += d;
  cout << (a < c ? "Right" : a == c ? "Balanced" : "Left") << endl;
  return 0;
}

Measured memory_bytes: 504
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int compare_int(const void *a, const void *b)
{
//    return *(int*)a - *(int*)b;
    return *(long long*)a - *(long long*)b;
}
//  qsort(A, b, sizeof(int), compare_int);

int main()
{
  int a ,b, c, d, e, X, Y;
//  long long  b, c, d, e, X, Y;
  //  double  c;
  long long  A[100003]={};
  int  B[100003]={};
  int  C[100003]={};

  int  flag[103]={};

//  long long  a, b, c, d, X, Y;
  char s[101]={};
//  int N, M;
//  int A[1000000001]={};
//  long long  C[101]={};
  int i,j,k;
//  int flag=0;
  int tmp=0;
//  int min=1000000;
  long long min=100000001;
  int len=0;
  double cnt=0;
  int num=0;
  double ans=0;
  int max=0;
//  char alp[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

  //  a=0;
//  scanf("%lld %lld", &a, &b);
//  scanf("%d%d", &a,&c);
//  cnt = strlen(t);
// printf("%d\n",a);
    scanf("%d%d", &a,&b);
/*  
  for(i=1;i<a;i++){
    tmp=i;
    cnt=0;
    while(tmp<b){
//      printf("%d\n", tmp);
        tmp=tmp*2;
        cnt++;
    }
      //len++;
//    }
//    printf("%lf\n",pow(0.5, 1));
    ans=ans+((1/a)*pow(1/2, cnt));
    printf("%lf\n", ans);
  }
  */  
if(a<6)    printf("0\n");
else if(a<13) printf("%d\n", b/2);
else  printf("%d\n", b);
  
//  printf("%d %d\n", a,b);
  
//  printf("%lf\n",ans);
  //  //  if(flag==0)   printf("TLE\n");
//    if(max < cnt - max)  printf("Yes\n");
//    else  printf("No\n");
  
return 0;
}


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

int main()
{
  string s, t;
  cin >> s >> t;
  for (int i = 0; i < s.size(); ++i)
  {
    if (s == t)
    {
      cout << "Yes" << endl;
      return 0;
    }
    s = s[s.size() - 1] + s;
    s.pop_back();
  }
  cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<deque>
#include<set>
#include<map>
#include<bitset>
#include<ctime>
#include<queue>
using namespace std;
#define int long long
#define pii pair <int, int>
#define XX first
#define YY second

// constants:
const int mn = 200005;
const int mod = 1000000007;
const long long inf = 4444444444444444444;
const int sminf = 1111111111;
const bool is_multitest = 0;
const bool is_interactive = 0;

// i/o methods:
const bool input_from_file = 0;
const bool output_to_file = 0;
#define filename ""
#define in_extension "inp"
#define out_extension "out"

// data preprocessing: (e.g.: divisor generating, prime sieve)
void preprocess()
{
  
}

// global variables:
int a, b, c, d;
// main solution goes here:
void execute(int test_number)
{
  cin>>a>>b>>c>>d;
  cout<<max(max(a*c, b*d), max(a*d, b*c));
}
// REMEMBER TO CHOOSE TEST METHODS
// PLEASE REMOVE cout AND cerr DEBUG LINES BEFORE SUBMITTING PROBLEMS
// Solution by low_



















signed main()
{
#ifdef lowie
    if (!is_interactive)
    {
        freopen("test.inp", "r", stdin);
        freopen("test.out", "w", stdout);
    }
#else
    if (input_from_file) freopen(filename"."in_extension, "r", stdin);
    if (output_to_file) freopen(filename"."out_extension, "w", stdout);
#endif
    if (!is_interactive)
    {
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
    }

    preprocess();
    int ntest;
    if (is_multitest) cin >> ntest;
    else ntest = 1;

    for (int testno = 1; testno <= ntest; testno++)
    // use for instead of while to serve facebook hacker cup test format
    {
        execute(testno); // only start coding in this function, not in main
    }
}
// Template by low_
// Contact me via mail: ttuandung1803@gmail.com
// ...or codeforces: https://www.codeforces.com/profile/low_
// ...or linkedIn: https://www.linkedin.com/in/daniel-to-83045a19a/
// I use VS Code. Here's a JSON format for my template: https://pastebin.com/xH2yRdwx


Measured memory_bytes: 3684
H, W = map(int, input().split())

Ai = []
for _ in range(H):
    a = list(map(int, input().split()))
    Ai.append(a)

operations = []

# 0 <= x,y < W or H
def get_text(y1, x1, y2, x2):
    return str(y1 + 1) + " " + str(x1 + 1) + " " + str(y2 + 1) + " " + str(x2 + 1)

for y in range(H):
    if y % 2 == 0:
        for x in range(W):
            if Ai[y][x] % 2 == 0:
                continue
            if x == W - 1:
                if y < H - 1:
                    Ai[y][x] -= 1
                    Ai[y + 1][x] += 1
                    operations.append(get_text(y, x, y + 1, x))
            else:
                Ai[y][x] -= 1
                Ai[y][x + 1] += 1
                operations.append(get_text(y, x, y, x + 1))
    else:
        for x in range(W - 1, -1, -1):
            if Ai[y][x] % 2 == 0:
                continue
            if x == 0:
                if y < H - 1:
                    Ai[y][x] -= 1
                    Ai[y + 1][x] += 1
                    operations.append(get_text(y, x, y + 1, x))
            else:
                Ai[y][x] -= 1
                Ai[y][x - 1] += 1
                operations.append(get_text(y, x, y, x - 1))

print(len(operations))
for o in operations:
    print(o)

Measured memory_bytes: 16472
def g(A,l,m,r):
 global c
 L,R=A[l:m]+[1e10],A[m:r]+[1e10]
 i=j=0
 for k in range(l,r):
  if L[i]<R[j]:A[k]=L[i];i+=1
  else:A[k]=R[j];j+=1
  c+=1
def s(A,l,r):
 if l+1<r:
  m=(l+r)//2
  s(A,l,m);s(A,m,r)
  g(A,l,m,r)
c=0
n=int(input())
A=list(map(int,input().split()))
s(A,0,n)
print(*A)
print(c)


Measured memory_bytes: 63176
fun main(args: Array<String>) {
    val (n, k) = readLine()?.split(" ")?.map(String::toInt) ?: return
    val s = readLine() ?: return
    var c = s[0]
    var happy = 0
    var unhappy = 0
    1.until(s.length).forEach { i ->
        val ss = s[i]
        if (ss == c) {
            happy++
        } else {
            unhappy++
        }
        c = ss
    }
    val h = unhappy - k * 2
    if (h <= 0) {
        println((n - 1).toString())
    } else {
        println((n - 1 - h).toString())
    }
}

Measured memory_bytes: 40988
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
using ll = long long;
using P = pair<int, int>;
 
int main() {
    int a,b;
    cin >> a >> b;
    if(a > b) cout << "a > b";
    if(a < b) cout << "a < b";
    if(a == b) cout << "a == b";
    cout << endl;
}


Measured memory_bytes: 3100
#include <iostream>

struct D
{
    int b, c;
} tab[30];

int A[30];

int main()
{
    std::ios_base::sync_with_stdio(0);
    int n;
    std::cin >> n;
    for (int i=0;i<n;++i) std::cin >> A[i];
    for (int i=0;i<n;++i) std::cin >> tab[i].b;
    for (int i=0;i<n-1;++i) std::cin >> tab[i].c;
    int result = 0;
    for (int i=0;i<n;++i)
    {
        result += tab[i].b;
        if (i>0 && A[i] == A[i-1]+1)
            result += tab[A[i-1]-1].c;
    }
    std::cout << result << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <utility>
using namespace std;

const int dx[] = {-1,0,1,0}, dy[] = {0,-1,0,1};
pair<int,int> DP[1002][1002];
int Num[1002][1002], l;
bool visited[1002][1002];

pair<int,int> dfs(int x, int y){
  if(x < 0 || x > l || y < 0 || y > l) return {0,0};
  if(visited[x][y]) return DP[x][y];
  visited[x][y] = true;
  pair<int,int> ret = max({dfs(x+1,y-1),dfs(x+1,y),dfs(x+1,y+1)});
  if(DP[x][y].first > 0){
    if(ret.first < DP[x][y].first) ret = DP[x][y];
    else ++ret.first;
  }
  DP[x][y] = ret;
  return ret;
}

signed main(){
  int M = (1e6), N;
  vector<bool> is_prime(M+1,true);
  is_prime[0] = false;
  is_prime[1] = false;
  for(int i = 2; i*i <= M; ++i){
    if(!is_prime[i]) continue;
    for(int j = i; j*i <= M; ++j){
      is_prime[i*j] = false;
    }
  }
  
  while(cin >> M >> N, N||M){
    l = 1;
    while(l*l < M) l += 2;
    
    for(int i = 0; i <= l; ++i){
      for(int j = 0; j <= l; ++j){
        DP[i][j] = {0,0};
        visited[i][j] = false;
      }
    }
    
    int x = l/2, y = x, d = 0, x_ = x, y_ = y;
    DP[x][y] = {0,0};
    Num[x][y] = 1;
    visited[x][y] = true;
    ++y;
    
    for(int i = 2; i <= M; ++i){
      visited[x][y] = true;
      if(i == N){
        x_ = x;
        y_ = y;
      }
      if(is_prime[i]) DP[x][y] = {1,i};
      else DP[x][y] = {0,0};
      Num[x][y] = i;
      int d_ = (d+1)%4;
      if(!visited[x+dx[d_]][y+dy[d_]]) d = d_;
      x += dx[d];
      y += dy[d];
    }
    
    for(int i = 0; i <= l; ++i)
      for(int j = 0; j <= l; ++j)
        visited[i][j] = false;
    
    /*
    for(int i = 0; i < l; ++i){
      for(int j = 0; j < l; ++j) printf("%2d ",Num[i][j]);printf("\n");
    }
    */
    
    pair<int,int> ans = dfs(x_,y_);
    cout << ans.first << " " << ans.second << endl;
  }
  return 0;
}



Measured memory_bytes: 16012
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n=int(input())
s=input()
mae=[0]*(n+2)
usiro=[0]*(n+2)
for i in range(1,n+1):
    if s[i-1]=="#":
        mae[i]+=1
    mae[i]+=mae[i-1]
    if s[n-i]==".":
        usiro[n-i+1]+=1
    usiro[n-i+1]+=usiro[n-i+2]

ans=2*n
for i in range(1,n+2):
    ans=min(ans,mae[i-1]+usiro[i])
print(ans)


Measured memory_bytes: 99492
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

void solve() {
    int h,n;
    cin >> h >> n;
    VI a(n), b(n);
    REP(i,0,n) cin >> a[i] >> b[i];
    VVI dp(n,VI(h+1+10000, 1<<30));
    dp[0][0] = 0;
    //dp[0][a[0]] = b[0];
    for (int i = 1; i * a[0] < h + 1 + 10000; i++) {
        dp[0][i * a[0]] = i* b[0];
    }
    REP(i,1,n) REP(j,0,h+1+10000) {
        dp[i][j] = dp[i-1][j];
        if (j - a[i] < 0) continue;
        dp[i][j] = min(dp[i][j], dp[i][j - a[i]] + b[i]);
    }
    int ans = 1 << 30;
    REP(i,h,h+1+10000) ans = min(ans, dp[n-1][i]);
    //REP(i,0,101) dump(dp[0][i]);
    cout << ans << endl;
}

signed main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 78464
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = 999999999;

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

    int N;
    cin >> N;
    vector<int> A(N);
    REP(i, N) cin >> A[i];
    vector<int> B(N);
    REP(i, N) cin >> B[i];
    int ans = -1;
    REP(i, N){
        int tmp = 0;
        REP(j, N){
            if(j <= i) tmp += A[j];
            if(i <= j) tmp += B[j];
        }
        ans = max(tmp, ans);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
package main

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

func getNextWord(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextWord(scanner))
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	aa := make([]Card, n)
	for i := 0; i < n; i++ {
		aa[i].suit = getNextWord(scanner)
		aa[i].i = getNextInt(scanner)
	}

	stable = true

	quickSort(aa, 0, n-1)
	if stable {
		fmt.Fprintln(writer, "Stable")
	} else {
		fmt.Fprintln(writer, "Not stable")
	}
	for i := 0; i < n; i++ {
		fmt.Fprintln(writer, fmt.Sprintf("%s %d", aa[i].suit, aa[i].i))
	}

	writer.Flush()
}

var stable bool

func partition(a []Card, p, r int) int {
	x := a[r]
	i := p - 1
	m := make(map[int]int, 0)
	for j := p; j < r; j++ {
		if a[j].i <= x.i {
			i++
			m[a[i].i]--
			a[i], a[j] = a[j], a[i]
			continue
		}
		_, ok := m[a[j].i]
		if ok {
			m[a[j].i]++
		} else {
			m[a[j].i] = 1
		}
	}
	a[i+1], a[r] = a[r], a[i+1]
	m[a[i+1].i]--
	for _, c := range m {
		if c > 1 {
			stable = false
			break
		}
	}
	return i + 1
}

func quickSort(a []Card, p, r int) {
	if p >= r {
		return
	}
	q := partition(a, p, r)
	quickSort(a, p, q-1)
	quickSort(a, q+1, r)
}

type Card struct {
	suit string
	i    int
}



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

int main() {
	int N, K;
	std::cin >> N >> K;

	std::vector<int> V(N, 0);
	for(auto &v : V) {
		std::cin >> v;
	}

	//// leftSum[i] := v[0] ~ v[i]の和
	//std::vector<int> leftSum(N, 0);

	//// rightSum[i] := v[i] ~ v[N - 1]の和
	//std::vector<int> rightSum(N, 0);
	//
	//leftSum[0] = V[0];
	//rightSum[N - 1] = V[N - 1];
	//for(int i = 1; i < N; i++) {
	//	leftSum[i] = leftSum[i - 1] + V[i];
	//	const int j = N - i - 1;
	//	rightSum[j] = rightSum[j + 1] + V[j];
	//}

	int result = 0;
	// np: 取り出す数
	for(int np = 1; np <= N; np++) {
		if(np > K) {
			break;
		}

		// ln: 左から取り出す数
		for(int ln = 0; ln <= np; ln++) {
			const int rn = np - ln;

			std::vector<int> select(np);
			select.insert(select.end(), V.begin(), V.begin() + ln);
			select.insert(select.end(), V.end() - rn, V.end());

			std::sort(select.begin(), select.end(), [](const int &a, const int &b) {
				return a > b;
			});

			const int max_nd = K - np;
			for(int i = 0; i < max_nd; i++) {
				if(select.empty() || select.back() >= 0) {
					break;
				}
				select.pop_back();
			}

			int sum = 0;
			for(const auto &s : select) {
				sum += s;
			}
			
			if(sum > result) {
				result = sum;
			}
		}
	}

	std::cout << result << std::endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
    for(auto i=begin(v); i != end(v); ++i){
        if(i !=begin(v)) os << ' ';
        os << *i;
    }
    return os;
}

int main(){
  ll A[5];
  rep(i,4){
    cin >> A[i];
  }
  sort(A,A+4);
  if(A[0]!=1){
    cNO;
    return 0;
  }
  if(A[1]!=4){
    cNO;
    return 0;
  }
  if(A[2]!=7){
    cNO;
    return 0;
  }
  if(A[3]!=9){
    cNO;
    return 0;
  }
  cYES;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>

#include <vector>

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define inc( i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec( i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

template<typename T> void swap(T & x, T & y) { T t = x; x = y; y = t; return; }
template<typename T> T abs(T x) { return (0 <= x ? x : -x); }
template<typename T> T max(T a, T b) { return (b <= a ? a : b); }
template<typename T> T min(T a, T b) { return (a <= b ? a : b); }
template<typename T> bool setmin(T & a, T b) { if(a <= b) { return false; } else { a = b; return true; } }
template<typename T> bool setmax(T & a, T b) { if(b <= a) { return false; } else { a = b; return true; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, m;
std::vector<int> p2l[100000];
std::vector<int> l2p[100000];
bool p_vis[100000];
bool l_vis[100000];

int queue[100000], get, set; // person

int main() {
	scanf("%d%d", &n, &m);
	inc(i, n) {
		int k;
		scanf("%d", &k);
		inc(j, k) {
			int lang;
			scanf("%d", &lang);
			p2l[i].push_back(lang);
			l2p[lang].push_back(i);
		}
	}
	
	p_vis[0] = true;
	queue[set++] = 0;
	while(get < set) {
		int q = queue[get++];
		
		for(auto && le : p2l[q]) {
			if(l_vis[le]) { continue; }
			l_vis[le] = true;
			for(auto && pe : l2p[le]) {
				if(! p_vis[pe]) { queue[set++] = pe; p_vis[pe] = true; }
			}
		}
	}
	
	bool ans = true;
	inc(i, n) { ans &= p_vis[i]; }
	
	printf("%s\n", ans ? "YES" : "NO");
	
	return 0;
}


Measured memory_bytes: 9080
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    n,k=map(int,input().split())
    
    def COMinit(n,MOD):
        fac,finv,inv=[0]*max(2,n+1),[0]*max(2,n+1),[0]*max(2,n+1)
        fac[0]=fac[1]=1
        finv[0]=finv[1]=1
        inv[1]=1
        for i in range(2,(n+1)):
            fac[i]=fac[i-1]*i%MOD
            inv[i]=MOD-inv[MOD%i]*(MOD//i)%MOD
            finv[i]=finv[i-1]*inv[i]%MOD
        return fac,finv,inv
    
    fac,finv,inv=COMinit(n,MOD)
    
    def COM(n, k, MOD):
        if n<k or n<0 or k<0:
            return 0
        return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD
    
    if k>=n:
        k=n-1
    ans=1
    for i in range(1,k+1):
        ans+=COM(n,i,MOD)*COM(n-1,i,MOD)
        ans%=MOD
    print(ans)
    

if __name__ == '__main__':
    main()


Measured memory_bytes: 44784
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
using namespace std;
#include <vector>
//#include <stack>
//#include <queue>

/*
#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;
*/
string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 
 

int main(){

    int N;
    int X;
    
    cin >> N;
    cin >> X;

    int L=0;
    int tmp;
    int cnt=1;
    for( int ni = 0 ; ni < N ; ni++ ){
        cin >> tmp;
        L+=tmp;
        if(L<=X) cnt++;

    }    
    cout << cnt << endl;

}

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

#define MOD 1000000007

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


template <class T>
ostream &operator<<(ostream &o, const vector<T>&obj) {
    o << "["; for (int i = 0; i < (int)obj.size(); ++i) o << (i > 0 ? ", " : "") << obj[i]; o << "]"; return o;
}
template <class T>
ostream &operator<<(ostream &o, const vector<vector<T>>&obj) {
    o << "[" << endl; for (int i = 0; i < (int)obj.size(); ++i) o << "  " << obj[i] << endl; o << "]"; return o;
}
template <class T, class U>
ostream &operator<<(ostream &o, const pair<T, U>&obj) {
    o << "(" << obj.first << ", " << obj.second << ")"; return o;
}
template <class T, class U>
ostream &operator<<(ostream &o, const map<T, U>&obj) {
    o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}
template <class T>
ostream &operator<<(ostream &o, const set<T>&obj) {
    o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}
template <class T>
ostream &operator<<(ostream &o, const queue<T>&obj) {
    queue<T> obj_cp = obj;
    bool first = true;
    o << "{";
    while (!obj_cp.empty()) { o << (!first ? ", " : "") << obj_cp.front(); obj_cp.pop(); first = false; }
    o << "}"; return o;
}

void print() {
    cout << "\n";
}
template<class Head, class... Body>
void print(Head head, Body... body) {
    cout << head << " ";
    print(body...);
}


map<ll, ll> factorize(ll n) {
    map<ll, ll> ret;
    ll a = 2;
    while (a * a <= n) {
        if (n % a == 0) {
            if (ret.count(a) == 0) {
                ret[a] = 1;
            } else {
                ret[a] += 1;
            }
            n /= a;
        } else {
            a++;
        }
    }
    if (n > 1) {
        if (ret.count(a) == 0) {
            ret[n] = 1;
        } else {
            ret[n] += 1;
        }
    }
    return ret;
}


int main(int argc, char const *argv[]) {
    ll N;
    cin >> N;
    map<ll, ll> factors = factorize(N);
    // print(factors);

    ll ans = 0;
    for (auto p : factors) {
        for (ll i = 1;; ++i) {
            ll s = (i * (i+1)) / 2;
            if (s <= p.second) {
                ans += 1;
            } else {
                // print(p.first, p.second, i-1);
                break;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


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

bool g[81][81][(80 + 80) * 80];

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<int>> A(H, vector<int>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> A[i][j];
    }
  }
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      int B;
      cin >> B;
      A[i][j] -= B;
      A[i][j] = abs(A[i][j]);
    }
  }

  g[0][0][A[0][0]] = true;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (i > 0) {
        for (int k = 0; k <= (i + j) * 80; k++) {
          if (g[i - 1][j][k]) {
            g[i][j][k + A[i][j]] = true;
            g[i][j][abs(k - A[i][j])] = true;
          }
        }
      }
      if (j > 0) {
        for (int k = 0; k <= (i + j) * 80; k++) {
          if (g[i][j - 1][k]) {
            g[i][j][k + A[i][j]] = true;
            g[i][j][abs(k - A[i][j])] = true;
          }
        }
      }
    }
  }

  for (int t; t <= 160 * 80; t++) {
    if (g[H - 1][W - 1][t]) {
      cout << t << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 81280
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private void solve(Scanner sc) {
        int N = sc.nextInt();
        int[] A = new int[N];
        long sum = 0;
        long prev = 0;
        for (int i = 0; i < N; ++i) {
            A[i] = sc.nextInt();
            if (prev == 1 && A[i] > 0) {
                --A[i];
                ++sum;
            }
            sum += A[i] / 2;
            prev = A[i] % 2;
        }

        _out.println(sum);
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Measured memory_bytes: 51228
import java.util.Scanner;
public class Main {
	
	static char[] k = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
	

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String s = stdIn.next();
		String p = stdIn.next();
		
		boolean ans = false;
		
		IN:for(int i = 0; i < s.length(); i++) {
			for(int j = 0; j < p.length(); j++) {
				if(s.charAt((i + j) % s.length()) != p.charAt(j)) {
					continue IN;
				}
			}
			ans = true;
			break;
		}
		
		System.out.println((ans)?"Yes":"No");
		
	}
}

Measured memory_bytes: 17320