akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define INF 1000000
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
vector<int> G[100001];
bool used[100001];

int dfs(int v){
	int cnt=0;
	used[v]=true;
	for(int i=0;i<G[v].size();i++){
		if(!used[G[v][i]])cnt+=dfs(G[v][i]);
	}
	if(cnt==0)return 1;
	if(cnt==1)return 0;
	return 2;
}

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n-1;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		a--;
		b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	printf("%s\n",dfs(0)!=0?"First":"Second");
	return 0;
}


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

int main(){
  int a, b;
  cin >> a >> b;

  int order = b - a;

  int east = 0;

  for (int i = 1; i < order + 1; i++)
  {
    east += i;
  }
  
  cout << east - b << endl;
}

Measured memory_bytes: 3596
n = int(input())
bt,bx,by=0,0,0

ans=True
for i in range(n):
    t, x, y = map(int, input().split())
    dt=t-bt
    dist=abs(x-bx)+abs(y-by)
    if dt<dist:
        ans = False
    if dist % 2 != dt % 2:
        ans=False

    bt,bx,by=t,x,y
    
if ans:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
class UnionFind:
    def __init__(self, size):
        # 負の値はルート (集合の代表) で集合の個数
        # 正の値は次の要素を表す
        self.table = [-1 for _ in range(size)]

    # 集合の代表を求める
    def find(self, x):
        if self.table[x] < 0:
            return x
        else:
            # 経路の圧縮
            self.table[x] = self.find(self.table[x])
            return self.table[x]

    # 併合
    def union(self, x, y):
        s1 = self.find(x)
        s2 = self.find(y)
        if s1 != s2:
            if self.table[s1] <= self.table[s2]:
                # 小さいほうが個数が多い
                self.table[s1] += self.table[s2]
                self.table[s2] = s1
            else:
                self.table[s2] += self.table[s1]
                self.table[s1] = s2
            return True
        return False


N,M = map(int,input().split())
p = list(map(int,input().split()))
t = UnionFind(N+1)
for i in range(M):
    x,y = map(int,input().split())
    t.union(p[x-1],p[y-1])

ans = 0
for i in range(N):
    if t.find(p[i]) == t.find(i+1):
        ans += 1

print(ans)


Measured memory_bytes: 13812
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
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;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    int D; cin >> D;
    veci C(26);
    vecveci S(D,veci(26));
    veci T(D);
    REP(i,26) cin >> C[i];
    REP(i,D) REP(j,26) cin >> S[i][j];
    REP(i,D) T[i] = 1;
    veci last(26);
    ll ans = 0;
    REP(i,D) {
        int d = i+1;
        last[T[i]-1] = d;
        ans += S[i][T[i]-1];
        REP(j,26) {
            ans -= C[j]*(d-last[j]);
        }
        //cout << ans << endl;
    }
    REP(i,D) cout << 1 << endl;
}

Measured memory_bytes: 3668
#include<iostream>
using namespace std;
int main()
{
    int a,b,k,m,i,j,n;
    cin>>a>>b>>k;
    m=k;
    n=b-a+1;
    if(2*k>=n){
        for(i=a;i<=b;i++){
            cout<<i<<endl;
        }
    }
    else if(2*k<n){
        for(i=a;k!=0;i++){
            cout<<i<<endl;
            k--;
        }
        k=m;
        for(i=b-m+1;k!=0;i++){
            cout<<i<<endl;
            k--;
        }
    }
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define fo(i,j,n) for (int i=(j); i < (n); i++)
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; }


int main() {
    int n; cin >> n;
    vector<ll> place(n+1); //各番号の位置を示す
    fo(i, 1, n+1){
        int a; cin >> a; place[a] = i; //数aはi番目に出現する
    }

    set<int> st{-1, 0, n+1, n+2};
    ll ans = 0;
    for(int i=n; i>0; i--){
        auto iter = st.lower_bound(place[i]);
        ll r1 = *iter, r2 = *(++iter); --iter;
        ll l1 = *(--iter), l2 = *(--iter);
        //cout << l2 << " " << l1 << " " << r1 << " " << r2 << ln;
        if(r1 != n+1) ans += i * (place[i]-l1) * (r2-r1);
        if(l1 != 0) ans += i * (l1-l2) * (r1-place[i]);
        //cout << "ans:" << ans << ln;
        st.insert(place[i]);
    }
    cout << ans << ln;
}

    

Measured memory_bytes: 5760
#include<stdio.h>

int main(){
  int a,b,c,N,i,j,sum=0;
  scanf("%d %d %d %d",&a,&b,&c,&N);
  for(i = 0;i <= N/a;i++){
    for(j = 0;j <= (N-i*a)/b;j++){
      if((N-i*a-j*b)%c == 0){sum++;}
    }
  }printf("%d\n",sum);
  return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define pf push_front
#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end()) // ユニークなvectorにする。連続した値を除去して切り出す。
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

#define POS(x) cout<<((x)?"POSSIBLE":"IMPOSSIBLE")<<endl;
#define Pos(x) cout<<((x)?"Possible":"Impossible")<<endl;
#define YES(x) cout<<((x)?"YES":"NO")<<endl;
#define Yes(x) cout<<((x)?"Yes":"No")<<endl;
#define yes(x) cout<<((x)?"yes":"no")<<endl;

__attribute__((constructor))
void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

signed main() {

    int x[4];
    int y[4];
    cin >> x[0] >> y[0] >> x[1] >> y[1];
    int dx = x[1] - x[0];
    int dy = y[1] - y[0];
    x[2] = x[1] - dy;
    y[2] = y[1] + dx;
    x[3] = x[0] - dy;
    y[3] = y[0] + dx;
    cout << x[2] << " " << y[2] << " " << x[3] << " " << y[3] << endl;


    return 0;
}

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

using namespace std;

// Repetitions
#define FOR(i,a,n) for(ll i = ((ll) a); i < ((ll) n); ++i)
#define FORR(i, s, g) for(ll i = ((ll)s - 1); i >= ((ll) g); --i)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) FORR(i, n, 0)

// Container Utils
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define SORTALL(v) sort(ALL(v))
#define SZ(a) int((a).size())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())

// For Debug
#define DMP(x)  cerr << #x << " = " << (x) << endl
#define DBG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

// Aliases
#define PB push_back
#define MP make_pair
typedef long long ll;
typedef string str;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

// I/O Asynchronizing
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;

inline ll combi2(const ll n) {
    return n * (n - 1) / 2;
}

int main() {
    int n, y;
    cin >> n >> y;
    REP(i, y / 10000 + 1) {
        REP(j, y / 5000 + 1) {
            if(n - i - j >= 0 && i * 10 + j * 5 + (n - i - j) == y / 1000){
                cout << i << " " << j << " " << n - i - j << "\n";
                goto END;
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1 << "\n";
END:
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
typedef long long ll;
const ll longinf=1LL<<60;
using namespace std;
int n,k;
ll h[200000];
ll f[200000];

ll abs(ll a, ll b)
{
    return (a>b)?a-b:b-a;
}
ll min(ll a, ll b)
{
    return (a<b)?a:b;
}

int main()
{
    cin>>n>>k;
    for (int i=1; i<=n; ++i)
        cin>>h[i];
    f[n]=0;
    for (int i=n-1; i>=1; --i)
    {
        f[i]=longinf;
        for (int j=i+1; j<=min(n,i+k); ++j)
            f[i]=min(f[i],f[j]+abs(h[i],h[j]));
    }
    cout<<f[1]<<endl;
    return 0;
}



Measured memory_bytes: 1792
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.parents = [-1] * n

  def find(self, x):
    if self.parents[x] < 0:
      return x
    else:
      self.parents[x] = self.find(self.parents[x])
      return self.parents[x]

  def union(self, x, y):
    x = self.find(x)
    y = self.find(y)

    if x == y:
      return

    if self.parents[x] > self.parents[y]:
      x, y = y, x

    self.parents[x] += self.parents[y]
    self.parents[y] = x

  def size(self, x):
    return -self.parents[self.find(x)]

  def same(self, x, y):
    return self.find(x) == self.find(y)

  def members(self, x):
    root = self.find(x)
    return [i for i in range(self.n) if self.find(i) == root]

  def roots(self):
    return [i for i, x in enumerate(self.parents) if x < 0]

  def group_count(self):
    return len(self.roots())

  def all_group_members(self):
    return {r: self.members(r) for r in self.roots()}

  def __str__(self):
    return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

def resolve():
  N, M = map(int, input().split(" "))
  # friends = [None] * (N + 1)
  friends = UnionFind(N)

  for _ in range(M):
    A, B = map(int, input().split(" "))
    A -= 1
    B -= 1
    friends.union(min(A, B), max(A, B))

  print(min(friends.parents)*(-1))

if __name__ == "__main__":
  resolve()

Measured memory_bytes: 80944
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();
		int[] a = new int[m + 1];
		int[] b = new int[m + 1];
		for(int i = 1; i <= m; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
		}
		int[] cnt = new int[n + 1];
		for(int i = 1; i <= n; i++) cnt[i] = 0;
		for(int i = 1; i <= m; i++) {
			cnt[a[i]]++;
			cnt[b[i]]++;
		}
		for(int i = 1; i <= n; i++) System.out.println(cnt[i]);
	}
}

Measured memory_bytes: 20948
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <string.h>
#include <math.h>
using namespace std;

int64_t gcd(int64_t n, int64_t m) {
    if (n < m) swap(n, m);
    while (m != 0) {
        int64_t r = n % m;
        n = m;
        m = r;
    }
    return n;
}

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

    int64_t r = 1;
    for (int i = 0; i < n; i++) {
        int64_t t;
        cin >> t;
        r *= t / gcd(r, t);
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 256
N = int(input())
bx = 0
xa = 0
ba = 0
count = 0
for i in range(N):
    #print("{},{},{}: {}".format(bx, xa, ba, count))
    si = input()
    if si[0] == "B":
        if si[-1] == "A":
            ba += 1
        else:
            bx += 1
    else:
        if si[-1] == "A":
            xa += 1
    count += sum([si[i:i+2]=="AB" for i in range(len(si))])
if ba == 0:
    count += min(bx, xa)
else:
    count += (ba-1) + min(1, bx) + min(1, xa) + max(0, min(bx-1, xa-1))
print(count)

Measured memory_bytes: 3188
#include<stdio.h>
int main(void)
{
	int m,f,b,flg;
	scanf("%d %d %d",&m,&f,&b);
	flg=0;
	if(m+f<b)	printf("NA\n");
	else{
		if(m>=b)	printf("0\n");
		else	printf("%d\n",b-m);
	}
	return 0;
}



Measured memory_bytes: 2708
#include<stdio.h>
int main()
{
	int r=0;
	double a,i=1.0;
	scanf("%lf",&a);
	if(a==0.0){
		printf("%d\n",0);
	}else{
		while(a>=i){
			r++;
			i*=2.0;
		}
		printf("%d\n",r);
	}
	return 0;
}

Measured memory_bytes: 2724
#! /usr/bin/python
# -*- coding:utf-8 -*-

# a = int(raw_input())
# # スペース区切りの整数の入力
# b, c = map(int, raw_input().split())
# # 文字列の入力
# s = raw_input()
# # 出力
# print str(a+b+c) + " " + s

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

res = min(N, M/2)

if res == N:
    res += (M - 2*N) / 4

print res

Measured memory_bytes: 2568
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        int count = 0;
        for(int i=0; i<s.length(); i++){
            if(s.charAt(i) =='1'){
                count++;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 24148
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
typedef long long ll;
#define INF 1e+10

int main(){
	ll N;
	cin >> N;
	vector<pair<ll,ll>> p(N);
	rep(i,N){
		ll x,l;
		cin >> x >> l;
		p[i] = make_pair(x+l,x-l);
	}
	
	
	sort(p.begin(),p.end());
	
	ll ans = 0;
	ll zahyo = -INF;
	rep(i,N){
		if (zahyo <= p[i].second){
			ans++;
			zahyo = p[i].first;
		}
	}
	
	cout << ans << endl;
}



Measured memory_bytes: 1792
#include <iostream>
#include <map>
#define VMAX 100000
using namespace std;

int main() {
  int N, W;
  cin >> N >> W;
  long long w[N];
  int v[N];
  for (int i=0; i<N; i++) cin >> w[i] >> v[i];

  long long dp[VMAX+1] = {};
  for (int i=0; i<N; i++) {
    for (int j=VMAX-v[i]; j>0; j--) {
      if (dp[j] > 0 && dp[j]+w[i] <= W) {
        if (dp[j+v[i]] == 0 || dp[j+v[i]] > 0 && dp[j]+w[i] < dp[j+v[i]]) {
          dp[j+v[i]] = dp[j] + w[i];
        }
      }
    }
    if (dp[v[i]]==0 || w[i] < dp[v[i]]) dp[v[i]] = w[i];
  }
  int ans = 0;
  for (int i=1; i<=VMAX; i++) {
    if (dp[i] > 0) ans = i;
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
package main

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

var scanner *bufio.Scanner

func nextInt() int {
	scanner.Scan()

	var i, _ = strconv.Atoi(scanner.Text())

	return i
}

func nextString() string {
	scanner.Scan()

	return scanner.Text()
}

func initScanner() {
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
}

// math functuon
func maxInt(a, b int) int {
	return int(math.Max(float64(a), float64(b)))
}
func minInt(a, b int) int {
	return int(math.Min(float64(a), float64(b)))
}

func main() {
	initScanner()

	var n = nextInt()

	var ws = make([]int, n)
	var a, b = 0, 0
	for i := 0; i < n; i++ {
		ws[i] = nextInt()
		b += ws[i]
	}

	var i = 0
	var diff = -1
	for {
		diff = b - a
		a += ws[i]
		b -= ws[i]

		if a >= b {
			diff = minInt(diff, a-b)
			break
		}
		i++
	}

	fmt.Println(diff)
}


Measured memory_bytes: 640
#include <stdio.h>

#include <iostream>
#include <functional>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <vector>

using namespace std;

int main(int argc, char** argv) {
  int k, x;
  cin >> k >> x;
  
  if (k * 500 >= x) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }

  return 0;
}

Measured memory_bytes: 256
import math
def I():
  return input()
def II():
  return int(input())
def MII():
  return map(int, input().split())
def LMII():
  return list(map(int, input().split()))

n = II()
a = LMII()
ans = 99999999999999999
for i in range(1, 101):
  count = 0
  for j in range(n):
    count += (i-a[j])**2
  if count < ans:
    ans = count
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 114514
int main(){
    double x,ans=0;
    string hoge;
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x>>hoge;
        if(hoge=="JPY"){
            ans+=x;
        }
        else{
            ans+=x*380000;
        }
    }
    printf("%.7f\n",ans);
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    string S;
    cin >> S;
    ll red = 0;
    ll blue = 0;
    rep(i, S.size()) {
        if (S[i] == '0') {
            red++;
        } else {
            blue++;
        }
    }
    cout << min(red, blue) * 2 << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int T, X; cin >> T >> X;
  double ans = T / (X * 1.0);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3204
N = int(input())
A = list(map(int, input().split()))
dic1 = {}
dic2 = {}
for i in range(N):
  if A[i] in dic1:
    dic1[A[i]] += 1
  else:
    dic1[A[i]] = 1
ans = 0
for v in dic1.values():
  ans += (v*(v-1))//2
for j in range(N):
  w = dic1[A[j]]
  v = w-1
  comb = ans -(w*(w-1))//2 + (v*(v-1))//2
  print(comb)


Measured memory_bytes: 25716
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>
#include <tuple>
#include <new>

using namespace std;

#define EPS (1e-9)
#define INF (1e9)
#define MOD (ll)(1e9 + 7)
#define PI (acos(-1))
#define REP(i,a,n) for(int i=a;i<n;i++)
#define rep(i, n) REP(i,0,n)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" ; "IMPOSSIBLE")

using ll = long long int;

ll gcd(ll a, ll b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll beki(ll a, ll b) {
    ll tmp = 1;
    rep(i, b) tmp *= a;
    return tmp;
}

ll modPow(ll x, ll a) {
    if (a == 1) return x;
    if (a % 2) return (x * modPow(x, a - 1)) % MOD;
    ll t = modPow(x, a / 2);
    return ((t % MOD) * (t % MOD)) % MOD;
}

ll modInv(ll x) {
    return modPow(x, MOD - 2);
}

ll N;
ll A[200010];
ll ans;

int main() {
    cin >> N;
    rep(i, N) cin >> A[i];

    ll tmp = A[0];
    REP(i, 1, N) {
        ans += max(tmp - A[i], (ll)0);
        A[i] += max(tmp - A[i], (ll)0);
        //cout << A[i] << endl;
        tmp = A[i];
    }

    cout << ans << endl;
}

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

int main() {
  string S;
  cin >> S;
  int a=0,b=0,c=0;
  for(int i=0;i<S.length();i++){
    if(S[i]=='a')a+=1;
    else if(S[i]=='b')b+=1;
    else if(S[i]=='c')c+=1;
  }
  if(abs(a-b)<=1 && abs(a-c)<=1 && abs(b-c)<=1)cout <<"YES";
  else cout <<"NO";
}



Measured memory_bytes: 512
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include<bits/stdc++.h>

#define for0(i,n) for(ll i = 0;i < (n);i++)
#define for1(i,n) for(ll i = 1;i<=(n);i++)
#define for2(i,n) for(ll i = 2;i<=(n);i++)
std::pair<int,int> DR[] = {{-1,0},{0,1},{1,0},{0,-1},{-1,1},{-1,-1},{1,1},{1,-1}};
#define rep(i,st,en,cnt) for(ll i = st;i <= en;i+=cnt)
#define PB push_back
#define MP make_pair
#define fastio cin.tie(0);cout.tie(0);ios::sync_with_stdio(0)
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define EPS 1e-8
#define INF 0x3f3f3f3f3
#define NEGINF -INF
#define TYPEMAX(type)   std::numeric_limits<type>::max()
#define inp_arr(a,n) for0(i,n) {cin>>a[i];}
#define out_arr(a,n) for0(i,n) {cout<<a[i]<<" ";}

using namespace std;

typedef pair<int,int> ii;
typedef pair<long long,long long> pll;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<long long> vl;
typedef vector<vector<ll> > vvl;
typedef vector<pair<long long, long long> > vll;

const ll mod =  998244353;
/*
ll nop = 100;
vi primes(nop+1,1);

void sieve(){
    primes[1] = primes[0] = 0;
    for(ll i = 2;i * i <= nop;i++){
        if(primes[i]){
            for(ll j = i*i; j <= nop;j+=i){
                primes[j] = 0;
            }
        }
    }
}
*/
ll gcd(ll a,ll b){    //a larger, b smaller
    if(b>a) swap(b,a);
    if(b==0) return a;
    return gcd(b,a%b);
}

void extgcd(ll a,ll b,ll& x,ll& y){  //a smaller b larger
    if(a==0) {
        x = a;y = b;
        return;
    }
    extgcd(b%a,a,x,y);
    ll y1 = y,x1 = x;
    x = y1 - (b/a)*x1;
    y = x1;
}

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

ll bexp(ll num,ll e){
    ll ans = 1;
    while(e>0){
        if(e&1){
            ans *= num;
        }
        num *= num;
        e>>= 1;
    }
    return ans;
}

ll mexp(ll num,ll e){
    ll ans = 1;
    while(e>0){
        if(e&1){
            ans = (ans*num)%mod;
        }
        num = (num*num)%mod;
        e>>=1;
    }
    return ans%mod;
}

ll modinv(ll a){
    return mexp(a,mod-2);
}

void solve() {
    ll x;
    cin>>x;
    ll no = 100;
    ll ans = 0;
    while(no < x) {
        ans++;
        no = (no*1.01);
    }
    cout<<ans<<endl;
}

int main() {
    fastio;
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    int t = 1;
    //cin>>t;
    for1(T,t){
        solve();
        //cout<<"Case #"<<T<<": "<< <<"\n";
    }
    /* #ifndef ONLINE_JUDGE
    cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    #endif */
    return 0;
}


Measured memory_bytes: 3656
using System;
using System.Linq;

public class Hello
{
    public static void Main()
    {
        // Your code here!
        
        int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int d = input[3];
        if(Math.Abs(input[0] - input[2]) <= d || (Math.Abs(input[0] - input[1]) <= d && Math.Abs(input[1] - input[2]) <= d ))
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
        
        
    }
}

Measured memory_bytes: 13396
import Data.List
toInt::String->Int
toInt = read
format::Show a=>[a]->String
format [x] = show x
format (x:xs) = show x ++ " " ++ format xs
gt::String->String->Bool
gt (x:xs) (y:ys) = xs > ys
--swapSub::Ord a=>a->[] a->[] a
swapSub x [] = [x]
swapSub x (y:ys)
  | gt x y = y:x:ys
  | otherwise = x:y:ys
--swap::Ord a=>[] a->[] a
swap xs = foldr swapSub [] xs
--bsort::Ord a=>[] a->[] a
bsort [] = []
bsort xs = y : bsort ys
  where
    (y:ys) = swap xs
--minBreak::Ord a=>[a]->([a], [a])
minBreak [x] = ([], [x])
minBreak (x:xs)
  | gt x z = (x:ys, z:zs)
  | otherwise = ([], x:ys++z:zs)
    where
      (ys, (z:zs)) = minBreak xs
--ssort::Ord a=>[a]->[a]
ssort [y] = [y]
ssort (y:ys)
  | gt y w = w : ssort (zs++[y]++ws)
  | otherwise = y : ssort (zs++[w]++ws)
    where
      (zs, (w:ws)) = minBreak ys
main = do
  getLine
  a <- getLine
  let b = (unwords.bsort.words) a
  putStrLn b
  putStrLn "Stable"
  let s = (unwords.ssort.words) a
  putStrLn s
  putStrLn (if s == b then "Stable" else "Not stable")


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

#define bug cout <<"-----------"<<endl
const long long INF = (long long)1e18;
#define ll long long int
#define MAX 2268312229760322080




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

ll  n ;
cin >> n;

cout << n*(n-1)/2;
    return 0 ;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fast  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define mod 1000000007
int32_t main()
{
 	fast;
 	int k;
 	int n;
 	cin>>k>>n;
 	int a[n];
 	int maxd=0;
 	cin>>a[0];
 	for(int i=1;i<n;i++)
 	{
 		cin>>a[i];
 		maxd=max(maxd,a[i]-a[i-1]);
 	}
 	maxd=max(maxd,k-(a[n-1]-a[0]));
 	cout<<k-maxd;


}       
      

Measured memory_bytes: 1792
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#include<cstring>
#define N 100100
using namespace std;
typedef long long ll;
int n;
int a[N],b[N],c[N];
int main(){
//	freopen ("1.in","r",stdin);
//	freopen ("1.out","w",stdout);
	scanf ("%d",&n);
	for (int i=1;i<=n;++i) scanf ("%d",&a[i]);
	for (int i=1;i<=n;++i) scanf ("%d",&b[i]);
	for (int i=1;i<=n;++i) scanf ("%d",&c[i]);
	sort(a+1,a+n+1),sort(b+1,b+n+1),sort(c+1,c+n+1);
	ll ans=0;
	for (int i=1;i<=n;++i){
		int k=lower_bound(a+1,a+n+1,b[i])-a;
		int p=upper_bound(c+1,c+n+1,b[i])-c;
		ans+=1ll*(k-1)*(n-p+1);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1536
/*
  Motto - try hard to become an expert
*/
#include <bits/stdc++.h>
#include <map>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <thread>
#include <iomanip>
 
//define
#define rep(i,n)    for(int i=0;i<n;i++)
#define repu(i,k,n) for(int i=k;i<=n;i++)
#define repd(i,k,n) for(int i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define INF (int)INT_MAX
#define all(v)  v.begin(), v.end()
#define endl "\n"
 
//typedef
typedef long long int ll;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, int > > vpp;
 
const int N = 3*1e5 +5 ;
const long long MOD = 1e9 + 7;
const long long inf = 1e18;
 
using namespace std;
 

ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}
 
ll modFact(ll n, ll p) 
{ 
    if (n >= p) 
        return 0; 
  
    ll result = 1; 
    for (ll i = 1; i <= n; i++) 
        result = (result * i) % p; 
  
    return result;  
} 
 
bool isPrime(int x)
{
    if(x%2==0)
        return 0;
    for(int i=3;i<=sqrt(x);i+=2)
    {
        if(x%i==0)
            return 0;
    }
    return 1;
}
 
ll binomialCoeff(ll n, ll k) 
{ 
    ll C[n + 1][k + 1]; 
    ll i, j; 


    for (i = 0; i <= n; i++) 
    { 
        for (j = 0; j <= min(i, k); j++) 
        { 
            
            if (j == 0 || j == i) 
                C[i][j] = 1; 

            else
                C[i][j] = (C[i - 1][j - 1] + 
                                        C[i - 1][j])%MOD; 
        } 
    } 

    return C[n][k]; 
}
bool compare(const pair<int,ll> &a , const pair<int,ll>&b){
    //set<pair<int,int> , decltype(&compare)>s(&compare) ;
    return a.se<b.se ;
}

// struct compare{
//     // for priority_queue
//     bool operator()(const int &a , const int&b){
//         return a<b ;
//     }
// };

void solve()
{
    int n ; 
    cin>>n ;
    cout<<n*n<<endl;
}
 
int main() {
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int t = 1;
    //cin>>t;
    while(t--)
    {
        solve();
    } 
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 3804
#include <stdio.h>
 
int main(void)
{
    int min, middle, max;
    int sum;
    int n, x;
    int cnt;
 
    while (1){
        scanf("%d %d", &n, &x);
        if (n == 0 && x == 0){
            break;
        }else{
            cnt = 0;
            for (min = 1; min <= (x / 3); min++){
                for (middle = min + 1; middle < (x - min) / 2.0; middle++){
                    /*max = x - min - middle > middle => middle < (x - min) / 2*/
                    for (max = middle + 1; max <= n; max++){
                        sum = min + middle + max;
                        if (sum == x){
                            cnt++;
                        }
                    }
                }
            }
            printf("%d\n", cnt);
        }
    }
 
    return 0;
}


Measured memory_bytes: 2048
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <random>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
ll mod = 1e9 + 7;

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

	ll n, a, b, c, x;
	string s;
	cin >> s;
	int ans = 700;
	n = 3;
	rep(i, n) {
		if (s[i] == 'o')
			ans += 100;
	}
	cout << ans << endl;
	return 0;
}

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

using ll = long long;

vector<int> par;
int get(int a) {
	if (par[a] < 0) return a;
	return par[a] = get(par[a]);
}

void merge(int a, int b) {
	a = get(a);
	b = get(b);
	assert(a != b);
	par[a] = b;
}

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

	int n, m;
	cin >> n >> m;
	vector<int> a(n), b(n);
	for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
	vector<vector<int>> edges(n);
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		u--; v--;
		edges[u].push_back(v);
		edges[v].push_back(u);
	}

	par = vector<int>(n, -1);
	vector<int> order(n);
	iota(order.begin(), order.end(), 0);
	sort(order.begin(), order.end(), [&](int i, int j) {
		return a[i] - b[i] < a[j] - b[j];
	});
	vector<ll> bsums(n);
	vector<ll> ans(n);
	vector<bool> done(n, false);
	for (int i = 0; i < n; i++) {
		bsums[i] = b[i];
	}
	for (int i : order) {
		set<int> children;
		for (int j : edges[i]) {
			j = get(j);
			if (done[j]) children.insert(j);
		}
		for (int j : children) {
			bsums[i] += bsums[j];
			merge(j, i);
		}
		if (!children.empty()) {
			ll best = 1e18;
			for (int j : children) {
				best = min(best, bsums[i] - bsums[j] + max<ll>(ans[j], a[i] - b[i]));
			}
			ans[i] = best;
		} else {
			ans[i] = max(a[i], b[i]);
		}
		done[i] = true;
	}
	cout << ans[order.back()] << '\n';

	return 0;
}


Measured memory_bytes: 10620
#include<bits/stdc++.h>
using namespace std;
#define int long long int   
int32_t main()
{
  int x,y,z;
  cin>>x>>y>>z;
  int a[x];
  for(int i=0;i<x;i++)
  cin>>a[i];
  if(x==1)
  cout<<abs(z-a[0])<<endl;else
  cout<<max(abs(a[x-1]-z),abs(a[x-1]-a[x-2]))<<endl;
}

Measured memory_bytes: 3636
import java.util.*;
public class Main {
public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
  	int N = sc.nextInt();
  	int[] x = new int[N];
	for (int i=0;i<N;i++){
		x[i] = sc.nextInt();
	}
  	Arrays.sort(x);
  	int tairyoku = 0;
  	int min = Integer.MAX_VALUE;
  	for (int p=0;p<=100;p++){
      tairyoku = 0;
      for(int j=0;j<N;j++){
        tairyoku = tairyoku + (x[j]-p)*(x[j]-p);
      }
      if(min > tairyoku){
        min = tairyoku;
      }
      //System.out.println("p:"+p+",tairyoku:"+tairyoku);
    }

	System.out.println(""+min);
}
}

Measured memory_bytes: 21840
#include <iostream>
#include <algorithm>
#include <queue>
#include <cstring>

using namespace std;

int main() {
	int N, M;
	cin >> N >> M;
	if (N == M) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
import numpy as np

N=int(input())
XL=[]
for i in range(N):
    XL.append(list(map(int,list(input().split()))))
XL=np.asarray(XL)
XLs=XL[np.argsort(XL[:,0])]
right=XLs[0][0]+XLs[0][1]
ans=1
for i in range(N-1):
    if right-(XLs[i+1][0]+XLs[i+1][1])>0:
        right=XLs[i+1][0]+XLs[i+1][1]
    elif XLs[i+1][0]-XLs[i+1][1]-right>=0:
        ans+=1
        right=XLs[i+1][0]+XLs[i+1][1]
print(ans)


Measured memory_bytes: 46828
// {{{
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<bitset>
#include<algorithm>
#include<functional>
#include<numeric>
#include<utility>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cctype>
#include<string>
// }}}
/* {{{
#include<cstring>
#include<ctime>
#include<ncurses.h>
#include<tuple>
}}}  */

using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s; cin >> s;
  int counter[27] = {0};
  for(int i = 0; i < s.length(); ++i)
    counter[s[i] - 'a']++;
  int no = false;
  for(int i = 0; i < sizeof(counter)/sizeof(*counter); ++i)
    if( counter[i] > 1 )
      no = true;
  cout << (no? "no": "yes") << endl;
  return 0;
}


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(name) name.begin(),name.end()
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 0
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

ll N;
vector<ll> A;

int cnt[MAX_N] = {};     // i が出てくる数
int cnt2[MAX_N];

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

    cin >> N;
    A.resize(N);
    REP(i, N) {
        cin >> A[i];
        cnt[A[i]]++;
    }

    // 0 チェック
    REP(i, N) {
        if(cnt[i] > 3) {
            printf("0\n");
            return 0;
        }
        if(i > 0 && cnt[i - 1] == 0 && cnt[i] > 0) {
            printf("0\n");
            return 0;
        }
    }

    ll ans = 1;
    REP(i, N) {
        int num = A[i];
        if(num == 0) {
            cnt2[num]++;
            continue;
        }

        // 自分より前にいる、自分より 1 少ないものの数
        ll val1 = cnt2[num - 1];

        // 自分より前にいる、自分と同じものの数
        ll val2 = cnt2[num];

        ans *= (val1 - val2);
        ans %= MOD;

        cnt2[num]++;
    }

    if(cnt[0] == 1) {
        ans *= 3;
        ans %= MOD;
    }
    else {
        ans *= 6;
        ans %= MOD;
    }
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 2560
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, T = mapint()
Ts = list(mapint())

ans = 0
last = 0
for t in Ts:
    ans += min(t-last, T)
    last = t

print(ans+T)

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

ll sol (ll n) {
    ll x = 26 ;
    while(x<n) x*=26 ;
    return x/26 ;

}

int main() {

    ll n , i ;
    cin >> n ;
    vector<ll>v(n) ;
    ll sum =0 ;
    for (i = 0 ; i< n; i++) {
        cin >> v[i] ;
        sum ^= v[i] ;
    }
    for (i =0 ; i < n; i++) {
        cout << (sum^v[i]) << ' ' ;
    }
}


Measured memory_bytes: 4840
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
typedef vi poly;

template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

const int mod=998244353;
namespace Poly{
	const int N=(1<<20)+5,g=3;
	int power(int x,int p){
		int res=1;
		for(;p;p>>=1,x=(ll)x*x%mod)
			if(p&1)res=(ll)res*x%mod;
		return res;
	}
	int fix(const int x){
		return x>=mod?x-mod:x;
	}
	void dft(poly &A,int n){
		static ull W[N<<1],*H[30],*las=W,mx=0;
		for(;mx<n;mx++){
			H[mx]=las;ull w=1,wn=power(g,(mod-1)>>(mx+1));
			REP(i,1<<mx)*las++=w,w=w*wn%mod;
		}
		if(A.size()!=(1<<n))A.resize(1<<n);
		static ull a[N];
		for(int i=0,j=0;i<(1<<n);++i){
			a[i]=A[j];
			for(int k=1<<(n-1);(j^=k)<k;k>>=1);
		}
		for(int k=0,d=1;k<n;k++,d<<=1)
			for(int i=0;i<(1<<n);i+=(d<<1)){
				ull *l=a+i,*r=a+i+d,*w=H[k],t;
				for(int j=0;j<d;j++,l++,r++){
					t=(*r)*(*w++)%mod;
					*r=*l+mod-t,*l+=t;
				}
			}
		REP(i,1<<n)A[i]=a[i]%mod;
	}
	void idft(poly &a,int n){
		a.resize(1<<n),reverse(a.begin()+1,a.end());
		dft(a,n);int inv=power(1<<n,mod-2);
		REP(i,1<<n)a[i]=(ll)a[i]*inv%mod;
	}
	poly FIX(poly a){
		while(!a.empty()&&!a.back())a.pop_back();
		return a;
	}
	poly add(poly a,poly b,int op=0){
		a.resize(max(a.size(),b.size()));
		REP(i,b.size())a[i]=fix(op?a[i]+mod-b[i]:a[i]+b[i]);
		return FIX(a);
	}
	poly mul(poly a,poly b,int t=1){
		if(t==1&&min(a.size(),b.size())<=8){
			poly c(a.size()+b.size(),0);
			REP(i,a.size())REP(j,b.size())
				c[i+j]=(c[i+j]+(ll)a[i]*b[j])%mod;
			return FIX(c);
		}
		int n=1,aim=a.size()*t+b.size();
		while((1<<n)<=aim)n++;
		dft(a,n),dft(b,n);
		if(t==1)REP(i,1<<n)a[i]=(ll)a[i]*b[i]%mod;
		else REP(i,1<<n)a[i]=(ll)a[i]*a[i]%mod*b[i]%mod;
		idft(a,n),a.resize(aim);
		return FIX(a);
	}
}

const int N=205,M=8005;
int fac[M],rev[M],f[N][M],n,m;

int C(int n,int m){
	return m<0||m>n?0:(ll)fac[n]*rev[m]%mod*rev[n-m]%mod;
}

void init(int n){
	fac[0]=1;
	rep(i,1,n)fac[i]=(ll)fac[i-1]*i%mod;
	rev[n]=Poly::power(fac[n],mod-2);
	per(i,n,1)rev[i-1]=(ll)rev[i]*i%mod;
}

int main(){
	read(m),read(n),init(m+2);
	rep(i,0,m)f[n+1][i]=C(m,i);
	per(i,n,1){
		poly A(m+1),B(m+1);
		rep(j,1,m){
			A[j]=(ll)fac[j+2]*f[i+1][j]%mod;
			B[m-j]=rev[j+1];
		}
		A=Poly::mul(A,B);
		rep(j,0,m-1)
			f[i][j]=(ll)A[m+j]*rev[j]%mod;
		A.resize(m+1);
		A[0]=B[m]=0;
		rep(j,1,m){
			A[j]=(ll)fac[j+2]*f[i+1][j]%mod;
			B[m-j]=(ll)rev[j+2]*(j+1)%mod;
		}
		A=Poly::mul(A,B);
		rep(j,0,m-1)
			f[i][j]=(f[i][j]+mod-(ll)A[m+j]*rev[j]%mod)%mod;
		rep(j,0,m)
			f[i][j]=(f[i][j]+((ll)j*(j+1)/2+1)%mod*f[i+1][j])%mod;
	}
	printf("%d\n",f[1][0]);
	return 0;
}

Measured memory_bytes: 10840
/*input
30
*/

#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>

#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define vpll vector < pair<long long,long long> >
#define mod 1000000007
#define inf 1000000000000000001
#define all(c) c.begin(),c.end()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define pdd pair<double, double>
#define dbg(x) cout << #x << " = " << x << '\n'
#define dbg2(x,y) cout<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<endl
#define dbgstl(v) cout<<#v<<" = \n"; { int c=0; repS(it,v) \
cout<<"    "<<#v<<"["<< ++c <<"] = "<<it<<endl;} cerr<<endl
#define dbgstlp(v) cout<<#v<<" = \n"; { int c=0; repS(it,v) \
cout<<"    "<<#v<<"["<< ++c <<"] = "<<it.f<<" , "<<it.s<<endl;} cerr<<endl
#define PI           3.14159265358979323846

#define rep(i, n)    for(i = 0; i < (n); ++i)
#define repA(i, a, n)  for(i = a; i <= (n); ++i)
#define repD(i, a, n)  for(i = a; i >= (n); --i)
#define repS(a, x) for(auto& a : x)
#define pdd pair<double, double>
#define in(v,n) vll v(n);rep(i,n) cin>>v[i]


using namespace std;

//function<void(int,int)> foo;
// foo = [&](int i,int j){};

int main(){
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    cin.exceptions(cin.failbit);
    int T;
    // cout<<std::fixed<<std::setprecision(35);
    // cin>>T;while(T--)
    {
        ll t,n,i,j,x,y,m,l,d,k;
        cin>>n;
        cout<<((n>29)?"Yes\n":"No\n");
    }
}

Measured memory_bytes: 3596
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        Console.WriteLine(Solve());
        //Solve();
        return;
    }

    public static string Solve()
    {
        long N = ReadLong();
        string S = Read();
        long sum = 0;
        long[] r = new long[4000];
        long[] g = new long[4000];
        long[] b = new long[4000];
        long rs = 0, gs = 0, bs = 0;
        for (int i = 0; i < N; i++)
        {
            if (S[i] == 'R') rs++;
            if (S[i] == 'G') gs++;
            if (S[i] == 'B') bs++;
            r[i] = rs;
            g[i] = gs;
            b[i] = bs;
        }
        for (int i = 0; i < N - 2; i++)
        {
            char c1 = S[i];
            for (int j = i + 1; j < N - 1; j++)
            {
                if (c1 != S[j])
                {
                    char c2 = S[j];
                    if (c1 != 'R' && c2 != 'R')
                    {
                        sum += r[N - 1] - r[j];
                        if (2 * j - i < N && S[2 * j - i] == 'R') sum--;
                    }
                    else if (c1 != 'G' && c2 != 'G')
                    {
                        sum += g[N - 1] - g[j];
                        if (2 * j - i < N && S[2 * j - i] == 'G') sum--;
                    }
                    else if (c1 != 'B' && c2 != 'B')
                    {
                        sum += b[N - 1] - b[j];
                        if (2 * j - i < N && S[2 * j - i] == 'B') sum--;
                    }
                }
            }
        }
        return sum.ToString();
    }

    public static int Gcd(int a, int b)
    {
        if (a < b)
            return Gcd(b, a);
        while (b != 0)
        {
            var remainder = a % b;
            a = b;
            b = remainder;
        }
        return a;
    }

    private static string Read() { return Console.ReadLine(); }
    private static int ReadInt() { return int.Parse(Read()); }
    private static long ReadLong() { return long.Parse(Read()); }
    private static double ReadDouble() { return double.Parse(Read()); }
    private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
    private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
    private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
}


Measured memory_bytes: 17624
#include<bits/stdc++.h>
using namespace std;
#pragma warning (disable: 4996)

int N, A[1 << 18], C[3];
long long sum = 1;

int main() {
    cin >> N;
    for(int i = 1; i <= N; i++) cin >> A[i];

    for (int i = 1; i <= N; i++)
    {
        long long cnt = 0, id = -1;
        if(A[i] == C[0]){ cnt++; id = 0; }
        if(A[i] == C[1]){ cnt++; id = 1; }
        if(A[i] == C[2]){ cnt++; id = 2; }
        if(id == -1){
            cout << "0" << endl;
            return 0;
        }
        sum *= cnt; C[id]++;
        sum %= 1000000007;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 640
S = input()
n = 0
atgc = [0] * len(S)

for i in S:
    if ('A' in i) or ('C' in i) or ('G' in i) or ('T' in i):
        atgc[n] += 1
    else:
        n += 1
        
ans = max(atgc)
print(ans)

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

map<int,list<int>>l;

void dfshelper(int node,bool*visited,int*dist){
    if(visited[node]==true){
        return;
    }   
    visited[node]=true;
    for(auto neighbour:l[node]){
        if(!visited[neighbour]){
            dfshelper(neighbour,visited,dist);
        }
        dist[node]=max(dist[node],dist[neighbour]+1);
    }
}

int main(){
    int n,m;
    cin>>n>>m;
    while(m--){
       int a,b;
       cin>>a>>b;
       l[a].push_back(b);
    }
    int mx=0;
    bool*visited=new bool[n+1];
    int*dist=new int[n+1];
    for(int i=1;i<=n;i++){
        visited[i]=false;
        dist[i]=0;
    }
    for(int i=1;i<=n;i++){
        if(!visited[i]){
            dfshelper(i,visited,dist);
        }
    }
    for(auto i=1;i<=n;i++){
        mx=max(mx,dist[i]);
    }
    cout<<mx;
    return 0;
}

Measured memory_bytes: 14208
#[allow(unused_imports)]
use {
   proconio::{fastout, input, marker::*},
   std::cmp::*,
   std::collections::*,
};

#[fastout]
fn main() {
   input! {
      n: usize,
      m: usize,
      k: usize,
      mut a: [usize; n],
      mut b: [usize; m]
   }

   a.insert(0, 0);
   for i in 0..n {
      a[i + 1] += a[i];
   }
   b.insert(0, 0);
   for i in 0..m {
      b[i + 1] += b[i];
   }
   let mut j = m;
   while b[j] > k {
      j -= 1;
   }
   let mut ans = j;
   for i in 1..=n {
      if a[i] > k {
         break;
      }
      while j != 0 && a[i] + b[j] > k {
         j -= 1;
      }
      ans = std::cmp::max(ans, i + j);
   }
   println!("{}", ans);
}


Measured memory_bytes: 9636
fn solve() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let k: i32 = sc.read();
    let h: Vec<i32> = sc.vec(n);
    let res = h.iter().filter(|&x| *x >= k).count();
    println!("{}", res);
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 8572
N = int(input())
L = [int(_) for _ in input().split()]

# L = [1, 8, 10, 5, 8, 12, 34, 100, 11, 3]
# L = [3, 8, 5,1]

max_L = max(L)
L.remove(max_L)
# print(L, max_L)
# print(sum(L))
op = "Yes" if max_L < sum(L) else "No"
print(op)


Measured memory_bytes: 2940
n = int(input())
a_list = list(map(int, input().split()))
a1_list = []
a2_list = []
n_list = [0]*n
if n % 2 == 0:
    for i in range(n):
        if i % 2 == 0:
            a1_list.append(a_list[i])
        else:
            a2_list.append(a_list[i])
    for i in reversed(a2_list):
        print(i, end="")
        print(" ", end="")
    for i in a1_list:
        if i != a1_list[int((n-2)/2)]:
            print(i, end="")
            print(" ", end="")
        else:
            print(i)
else:
    for i in range(1,n):
        if i % 2 == 0:
            a1_list.append(a_list[i])
        else:
            a2_list.append(a_list[i])
    for i in reversed(a1_list):
        print(i, end="")
        print(" ", end="")
    print(a_list[0], end="")
    print(" ", end="")
    for i in a2_list:
        if i != a2_list[int((n-2)/2)]:
            print(i, end="")
            print(" ", end="")
        else:
            print(i)    

Measured memory_bytes: 25156