akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
typedef unsigned long long ull;
typedef long double ldouble;
const ll INF=1e18;

vector<int> cost(1000000);
vector<vector<int>> data(1000000);


int main(){
    ll n, d, count = 0;
    cin >> n >> d;
    d = d * d;

    for(int i = 0; i < n; i++){
        ll x, y;
        cin >> x >> y;
        if(x*x + y*y <= d) count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 30564
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end() // 昇順ソート
#define rall(v)(v).rbegin(), (v).rend() // 降順ソート
#define INF 1 LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair < ll, ll >
#define F first
#define S second
const int MOD = 1000000007;
template < class T > bool chmax(T & a,const T & b) { if (a < b) { a = b; return true; } return false; }
template < class T > bool chmin(T & a,const T & b) { if (a > b) { a = b; return true; } return false; }
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)


int main() {
    LL N,L;cin >> N >> L;
    vector<LL> a(N);
    rep(i,N)cin >> a[i];

    bool ok = false;
    int ans = -1;

    rep(i,N-1){
        LL tmp = a[i] + a[i+1];
        if(tmp >= L){
            ok = true;
            ans = i;
            break;
        }
    }
    
    if(ok){
        cout << "Possible" << endl;
        rep(i,N-1){
            if(i == ans)break;
            cout << i+1 << endl;
        }
        for(int i = N-2;i > ans;i--){
            cout << i+1 << endl;
        }
        cout << ans + 1 << endl;
    }
    else cout << "Impossible" << endl;
}

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

const int64_t MOD = 1e9+7;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}
void mul(int64_t& a, int64_t b){
    a = a*b % MOD;
}

int64_t power_mod(int64_t num, int64_t power){
    int64_t prod = 1;
    num %= MOD;
    while(power > 0){
        if(power&1) prod = prod * num % MOD;
        num = num * num % MOD;
        power >>= 1;
    }
    return prod;
}

int64_t extgcd(int64_t a, int64_t b, int64_t& x, int64_t& y){
    int64_t d = a;
    if(b != 0){
        d = extgcd(b, a%b, y, x);
        y -= (a/b) * x;
    }else{
        x = 1; y = 0;
    }
    return d;
}

int64_t inv_mod(int64_t a){
    int64_t x, y;
    extgcd(a, MOD, x, y);
    return (MOD + x%MOD) % MOD;
}

vector<int64_t> fact, fact_inv;

void create_mod_tables(int num){
    fact.assign(num+1, 1);
    fact_inv.assign(num+1, 1);
    for(int i=1; i<=num; i++) fact[i] = fact[i-1] * i % MOD;
    fact_inv[num] = inv_mod(fact[num]);
    for(int i=num; i>0; i--) fact_inv[i-1] = fact_inv[i] * i % MOD;
}

int64_t comb_mod(int n, int k){
    return fact[n] * fact_inv[n-k] % MOD * fact_inv[k] % MOD;
}

int64_t perm_mod(int n, int k){
    return fact[n] * fact_inv[n-k] % MOD;
}

int main(){
    int N, A, B;
    cin >> N >> A >> B;
    if(A > B) swap(A, B);

    // i番目まで、Bがj個、最後がどっちか、フィーバーかどうか
    static int64_t dp[5001][5001][2][2];
    dp[0][0][1][0] = 1;

    for(int i=0; i<N; i++) for(int j=0; j<B; j++) for(int l=0; l<2; l++) for(int f=0; f<2; f++){
        if(i+A <= N && l && !f){
            if(j+A < B) add(dp[i+A][j+A][0][1], dp[i][j][l][f]);
            add(dp[i+A][0][0][0], MOD - dp[i][j][l][f]);
        }
        for(int n=0; n<2; n++){
            int j2 = (n||f ? j+1 : 0);
            int l2 = n;
            int f2 = f && !n;
            if(j2 < B) add(dp[i+1][j2][l2][f2], dp[i][j][l][f]);
        }
    }

    int64_t ans = power_mod(2, N);
    for(int j=0; j<B; j++) for(int l=0; l<2; l++) for(int f=0; f<2; f++) add(ans, MOD - dp[N][j][l][f]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 785044
use std::io;
use std::collections::VecDeque;

fn main() {
    let mut input = Input::new();
    let n: usize = input.next();
    let a: Vec<usize> = (0..n - 1).map(|_| input.next::<usize>() - 1).collect();
    let mut c: Vec<Vec<usize>> = (0..n).map(|_| Vec::new()).collect();
    for i in 0..n - 1 {
        c[a[i]].push(i + 1);
    }
    fn dfs(c: &Vec<Vec<usize>>, i: usize) -> usize {
        let len = c[i].len();
        let mut x = len;
        let mut v: Vec<usize> = (0..len).map(|j| dfs(c, c[i][j])).collect();
        v.sort();
        for j in 0..len {
            let t = v[j] + len - j;
            if x < t {
                x = t;
            }
        }
        x
    }
    println!("{}", dfs(&c, 0));
}

struct Input {
    queue: VecDeque<String>,
}

impl Input {
    fn new() -> Input {
        Input { queue: VecDeque::new() }
    }

    fn next<T>(&mut self) -> T
        where T: std::str::FromStr,
              T::Err: std::fmt::Debug
    {
        if self.queue.is_empty() {
            let mut line = String::new();
            let _ = io::stdin().read_line(&mut line);
            for x in line.split_whitespace() {
                self.queue.push_back(String::from(x));
            }
        }
        return self.queue.pop_front().unwrap().parse::<T>().unwrap();
    }
}



Measured memory_bytes: 46844
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const ll inf=1e9+7;
const ll INF=1e18;

int MAX_N=2e5+20;

vin par(MAX_N);
vin deep(MAX_N);
vin sizee(MAX_N);
void init(int n);
int root(int x);
void unite(int x,int y);
bool same(int x,int y);
int group_size(int x);

int main(){
    int n,m;cin>>n>>m;
    init(n);
    int a,b;
    rep(i,m){
        cin>>a>>b;
        unite(a,b);
    }
    int ans=0;
    rep2(i,1,n+1)ans=max(ans,group_size(i));
    cout<<ans<<endl;
}

void init(int n){
    rep(i,n+1){
        par[i]=i;
        deep[i]=0;
        sizee[i]=1;
    }
}
int root(int x){
    if(par[x]==x)return x;
    else return par[x]=root(par[x]);
}
void unite(int x,int y){
    x=root(x);
    y=root(y);
    if(x==y)return;
    if(deep[x]<deep[y]){
        par[x]=y;
        sizee[y]+=sizee[x];
    }
    else{
        par[y]=x;
        sizee[x]+=sizee[y];
        if(deep[x]==deep[y])deep[x]++;
    }
}
bool same(int x,int y){
    return root(x)==root(y);
}
int group_size(int x){
    return sizee[root(x)];
}

Measured memory_bytes: 5440
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>

using namespace std;

int f(int pos, int k, const vector<int>& h, vector<int>& res) {
  if (pos == 0) {
    return 0;
  }

  if (res[pos] == -1) {
    int out = INT32_MAX;
    for (int i = 1; i <= k; i++) {
      int from = pos - i;
      if (from < 0) {
        break;
      }
      out = min(out, f(from, k, h, res) + abs(h[from] - h[pos]));
    }
    res[pos] = out;
  }

  return res[pos];
}

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

  // lets start from 0, to n-1
  vector<int> h(n);
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }

  vector<int> res(n, -1);

  cout << f(n - 1, k, h, res) << endl;

  return 0;
}


Measured memory_bytes: 8832
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<typename T> using rev_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<class S, class T> void map_init(map<S, T> &m, S k, T v){if(!m.count(k)) m[k] = v;}
void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }
int main() {
    int N, C;
    cin >> N >> C;
    i64 ans = 1e15;
    vector<vector<i64>> D(C, vector<i64>(C));
    vector<vector<int>> c(3, vector<int>(C, 0));
    for(int i = 0; i < C; i++) {
        for(int j = 0; j < C; j++) {
            cin >> D[i][j];
        }
    }
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < N; j++) {
            int tmp;
            cin >> tmp;
            c[(i + j + 2) % 3][tmp - 1]++;
        }
    }
    int y[3];
    for (y[0] = 0; y[0] < C; y[0]++) {
        for (y[1] = 0; y[1] < C; y[1]++) {
            for (y[2] = 0; y[2] < C; y[2]++) {
                if(y[0] == y[1] || y[1] == y[2] || y[2] == y[0]) continue;
                i64 cand = 0;
                for(int b = 0; b < 3; b++) {
                    for(int i = 0; i < C; i++) {
                        cand += c[b][i] * D[i][y[b]];
                    }
                }
                ans = min(ans, cand);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main()
{
    int n;
    cin >> n;
    vector<ll> values(n);
    rep(i, 0, n) cin >> values[i];

    sort(values.begin(), values.end());
    ll max_c = 0;
    pii ans = {-1, -1};
    for (auto v: values)
    {
        ll tgt = (v&1)? v/2+1: v/2;
        int i = lower_bound(values.begin(), values.end(), tgt) - values.begin();
        // cout << v << ' ' << tgt << ' ' << values[i] << endl;

        if (i < n and values[i] == tgt)
        {
            ll now = v*1000000000L+tgt;
            if (max_c < now)
            {
                // cout << v << '-' << values[i] << endl;
                max_c = now;
                ans = make_pair(v, values[i]);
            }
        }
        else
        {
            if (i<n and tgt > abs(tgt-values[i]))
            {
                ll now = v*1000000000L+2*tgt-values[i];

                if (max_c < now)
                {
                    // cout << v << '=' << values[i] << endl;
                    max_c = now;
                    ans = make_pair(v, values[i]);
                }
            }
            if (0<=i-1)
            {
                ll now = v*1000000000L+values[i-1];

                if (max_c < now)
                {
                    // cout << v << ' ' << values[i] << endl;

                    max_c = now;
                    ans = make_pair(v, values[i-1]);
                }
            }
        }
    }
    cout << ans.first << ' ' << ans.second << endl;
    return 0;
}

Measured memory_bytes: 1024
var a:array[1..10,1..10] of integer;
    n,k,i,j,t,sum,re,tmp:longint;
begin
	readln(n,k);
	for i:=1 to n do
	  begin
	    for j:=1 to k do read(a[i,j]);
	    readln;
	  end;
	re:=0;
    for i:=1 to n - 1 do
      for j:=i + 1 to n do
        begin
          sum:=0;
          for t:= 1 to k do sum:= sum + sqr(a[i,t] - a[j,t]);
          tmp:= trunc(sqrt(sum));
          if tmp = sqrt(sum) then inc(re);
        end;
    write(re);
end.

Measured memory_bytes: 128
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int W, H;
vector<string> vs(70);
map<int, string> MAP;
bool checked[70][70]; 
string calc(string a, string b) {
  if(a.length() > b.length()) return a;
  if(a.length() < b.length()) return b;
  else return a > b ? a : b;
}
string dfs(int h, int w) {
  checked[h][w] = true;
  if(h < 0 || h >= H || w < 0 || w >= W || !isdigit(vs[h][w])) {
    return "";
  }
  if(MAP.count(h*100+w)) return MAP[h*100+w];
  string a = vs[h][w] + dfs(h+1,w);
  string b = vs[h][w] + dfs(h,w+1);
  MAP[100*h+w] = calc(MAP[100*h+w], calc(a, b));
  return MAP[100*h+w];
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  while(cin>>W>>H,W||H) {
    FOR(i,0,H) cin >> vs[i];
    string ans = "";
    CLR(checked);
    MAP.clear();
    FOR(h,0,H) {
      FOR(w,0,W) {
        if(checked[h][w] || vs[h][w] == '0') continue;
        checked[h][w] = true;
        ans = calc(ans, dfs(h, w));
      } 
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3284
#include <iostream>
using namespace std;
int main(){
  int cou,a,b;
  while(1){
    cin >> a >> b;
    if(a==0&&b==0)break;
    cou=0;
    for(int i=1;i<=a-2;i++){
      for(int j=i+1;j<=a-1;j++){
	for(int k=j+1;k<=a;k++){
	  if(i+j+k==b)cou++;
	}
      }
    }
    cout << cou<< endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
//typedef unsigned int uint;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int gcd(int n, int m) {
	if (n < m) swap(n, m);
	while (m) {
		swap(n, m);
		m %= n;
	}
	return n;
}

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

	int N, A, ans;

	cin >> N;
	cin >> ans;
	rep(i, 1, N)
	{
		cin >> A;
		ans = gcd(ans, A);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
import java.util.Random;

public class Main {
    private static FastScanner sc = new FastScanner();
    private static boolean DEBUG_FLG = false;

    public static void main(String[] args) {
    	int X = sc.nextInt();
    	int A = sc.nextInt();
    	System.out.println(X < A ? 0 : 10);
    }

    static void debug(long... args) {
    	if(!DEBUG_FLG) return;
    	boolean flg = false;
    	for(long s : args) {
    		if(flg) System.out.print(" ");
    		flg = true;
    		System.out.print(s);
    	}
    	System.out.println();
    }

    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if(ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch(IOException e) {
                    e.printStackTrace();
                }
                if(buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }

    static void shuffleArray(long[] arr){
        int n = arr.length;
        Random rnd = new Random();
        for(int i=0; i<n; ++i){
            long tmp = arr[i];
            int randomPos = i + rnd.nextInt(n-i);
            arr[i] = arr[randomPos];
            arr[randomPos] = tmp;
        }
    }
}


Measured memory_bytes: 21204
#include <iostream>

using namespace std;

int main()
{
    int r,c,sum=0;
    cin>>r>>c;
    int tbl[r+1][c+1];
    for (int i=0; i<r; i++)
    {
        for (int j=0; j<c; j++)
        {
            cin>>tbl[i][j];
            sum+=tbl[i][j];
        }
        tbl[i][c]=sum;
        sum=0;
    }
    for (int i=0; i<=c; i++)
    {
        for (int j=0; j<r; j++)
        {
            sum+=tbl[j][i];
        }
        tbl[r][i]=sum;
        sum=0;
    }
    for (int i=0; i<=r; i++)
    {
        for (int j=0; j<=c; j++) { cout<<tbl[i][j]; if (j!=c) cout<<' '; }
        cout<<'\n';
    }
    return 0;
}



Measured memory_bytes: 3132
Z=[]
Y=[]
for i in range(5):
    a=int(input())
    if a% 10!=0:
        Z.append(10-a % 10+a)
        Y.append(a % 10)
    else:
        Z.append(a)
if len(Y)==0:
    H=10
else:
    H=min(Y)

print(sum(Z)-(10-H))

Measured memory_bytes: 3060
/*
  Author : lifehappy
*/
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

const double pi = acos(-1.0);
const double eps = 1e-7;
const int inf = 0x3f3f3f3f;

inline ll read()   {
  ll f = 1, x = 0;
  char c = getchar();
  while(c < '0' || c > '9') {
    if(c == '-')    f = -1;
    c = getchar();
  }
  while(c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = getchar();
  }
  return f * x;
}

void print(ll x) {
  if(x < 10) {
    putchar(x + 48);
    return ;
  }
  print(x / 10);
  putchar(x % 10 + 48);
}

const int N = 5e5 + 10;

char str[N];
int a1[N], a2[N], n;
vector<int> ans;

int main() {
  // freopen("in.txt", "r", stdin);
  // freopen("out.txt", "w", stdout);
  // ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  scanf("%d", &n), scanf("%s", str + 1);
  int sz= 0;
  for(int i = 1; i <= n; i++) if(str[i] == '1') sz++;
  const int mod1 = sz + 1, mod2 = sz - 1;
  a1[0] = a2[0] = 1;
  for(int i = 1; i <= n; i++) {
    a1[i] = (a1[i - 1] * 2) % mod1;
    if(mod2) a2[i] = (a2[i - 1] * 2) % mod2;
  }
  int sum1 = 0, sum2 = 0;
  for(int i = 1, j = n - 1; i <= n; i++, j--) {
    sum1 = (sum1 + a1[j] * (str[i] - '0')) % mod1;
    if(mod2) sum2 = (sum2 + a2[j] * (str[i] - '0')) % mod2;
  }
  for(int i = 1, j = n - 1; i <= n; i++, j--) {
    int temp;
    if(str[i] == '1') {
      if(mod2 == 0) {
        ans.pb(0);
        continue;
      }
      temp = ((sum2 - a2[j]) % mod2 + mod2) % mod2;
    }
    else {
      temp = (sum1 + a1[j]) % mod1;
    }
    int num = 1;
    while(temp) {
      int sum = 0;
      for(int j = 0; j < 30; j++)
        if((temp >> j) & 1) sum++;
      num++;
      temp %= sum;
    }
    ans.pb(num);
  }
  for(int i : ans)
    printf("%d\n", i);
  return 0;
}

Measured memory_bytes: 6012
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define fs first
#define sc second

int main(void){
    int n;
    cin >> n;
    int ans=0;
    int now, tmp;
    cin >> now;
    int cnt = 0;
    rep(_,n-1){
        cin >> tmp;
        if(tmp <= now){
            cnt++;
            now = tmp;
            ans=max(ans,cnt);
        }else{
            cnt=0;
            now = tmp;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
# coding: utf-8
n=int(input())
l = []
last = ""
for i in range(n):
    s = input()
    if i == 0:
        last = s[-1]
        l.append(s)
        continue
    if last != s[0]:
        print("No")
        exit()
    last = s[-1]
    l.append(s)

if len(l) != len(set(l)):
    print("No")
else:
    print("Yes")
    

Measured memory_bytes: 3060
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=500005;
int d[N],low[N],A[N],i,j,k,n,m,Q,x;
char c;

inline char getc()
{
	#define VV 10000000
	static char s[VV],*l=s,*r=s;
	if (l==r)
		l=s,r=s+fread(s,1,VV,stdin);
	return l==r?0:*l++;
}

int read(){ int z=0; do c=getc(); while (c<'0'||c>'9'); while (c>='0'&&c<='9') z*=10,z+=c-'0',c=getc(); return z; }

int main()
{
	n=read(),d[0]=read();
	for (i=1;i<=n;++i) A[i]=read(),d[i]=min(d[i-1],abs(d[i-1]-A[i]));
	for (low[n+1]=1,i=n;i;--i)
	{
		low[i]=low[i+1];
		if (A[i]<(low[i+1]<<1))
			low[i]+=A[i];
	}
	Q=read();
	while (Q--)
		x=read(),puts(d[x-1]>=low[x+1]?"YES":"NO");
	return 0;
}

Measured memory_bytes: 16128
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n, q;
    while(cin >> n >> q, n|q){
        array<int, 101> v{};
        for (int i = 0; i < n; ++i) {
            int m;
            cin >> m;
            for (int j = 0; j < m; ++j) {
                int x;
                cin >> x;
                v[x]++;
            }
        }
        int ans = 0, m = q-1;
        for (int i = 0; i <= 100; ++i) {
            if(m < v[i]){
                ans = i;
                m = v[i];
            }
        }
        cout << ans << "\n";
    }
    return 0;
}



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

int main()
{
    string x,y;
    int i=0;
    cin >> x;
    rep(i,3){
    if(x[i]==x[i+1]){
                cout << "Bad" << endl;
    return 0;
    }
    }
    cout << "Good" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


struct node{
  int key;
  struct node *left;
  struct node *right;
  struct node *parent;
};

typedef struct node *NodePointer;

void insert(int);
void Preorder(NodePointer);
void Inorder(NodePointer);

NodePointer root = NULL; 


int main () {
  int n = 0, i, x = 0;
  char str[7];


  scanf("%d",&n);

  for(i = 0 ; i < n ; i++) {
    scanf("%s",str);
    if(strcmp(str,"insert") == 0) {
      scanf("%d",&x);
      insert(x);
    }
    else {
      Inorder(root);
      printf("\n");
      Preorder(root);
      printf("\n");
    }
  }
  

  return 0;
}


void insert(int z) {
  NodePointer p, x = root, y = NULL;
  
  p = (NodePointer)malloc(sizeof(struct node));

  p->key = z;

  y = NULL;
  
  while(x != NULL) {
  
    y = x;
    
    if(z < x->key) x = x->left;
    else x = x->right; 
  }
  
  p->parent = y; 
  
  if(y == NULL) root = p;
  else if(p->key < y->key) y->left = p;
  else y->right = p; 

  p->left = NULL;
  p->right = NULL;
  

}

void Preorder(NodePointer cur) {

  if(cur != NULL) {
    printf(" %d",cur->key);
    Preorder(cur->left);
    Preorder(cur->right);
  }
  
}


void Inorder(NodePointer cur) {

  if(cur != NULL) {
    Inorder(cur->left);
    printf(" %d",cur->key);
    Inorder(cur->right);
  }
}





Measured memory_bytes: 25172
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<ll>;
using VV = vector<VI>;
using VS = vector<string>;

// tourist set
template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
// tourist set end

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; }

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,b) FOR(i, 0, b)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("YES")
#define p_no() p("NO")
#define pb(s) push_back(s)
#define SZ(x) ((int)(x).size())

void no(){p_no(); exit(0);}
void yes(){p_yes(); exit(0);}

const ll mod = 1e9 + 7;
const ll inf = 1e18;

void vprint(vector<ll> A){
    ll L = A.size();
    FOR(i, 0, L){
        if(i) cout << ' ';
        cout << A[i] + 1;
    }
    cout << endl;
}

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

    // input
    ll N; 
    cin >> N;

    VI A(N);
    rep(i, N){
      ll a; cin >> a;
      a--;
      A[a]=i;
    }

    vprint(A);
    
    return 0;
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--) 
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define downque(que) priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;
typedef vector<vector<int>> Matrix;
const int MOD = 1e9 + 7;
const int MAX = 1e7;
const int INF = numeric_limits<int>::max();

int main(){
 int a,b,c,res=0; cin>>a>>b>>c;

int m=max({a,b,c});
if(m==c)res=a*b/2;
if(m==a)res=c*b/2;
if(m==b)res=a*c/2;
 cout<<res<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char a,b;
  int  u=0;
  cin >>a>>b;
  if(a=='9')u++;
  if(b=='9')u++;
  
  if(u!=0) cout<<"Yes"<<endl;
  else  cout<<"No"<<endl;
  
  }


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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    int n; cin >> n;
    vs a(n);
    map<string,int> mp1;
    map<string,int> mp2;
    rep(i,n){
      cin >> a[i];
      mp1[a[i]]++;
    }
    int m; cin >> m;
    vs b(m);
    rep(i,m){
      cin >> b[i];
      mp2[b[i]]++;
    }
    ll res = 0;
    rep(i,n){
      ll sum = mp1[a[i]] - mp2[a[i]];
      res = max(res,sum);
    }
    out(res);
}


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

int main(){
    int n, k;
    cin >> n>> k;
    int x;
    int sum = 0;

    rep(i, n){
        cin >> x;
        sum += min(x, k-x) * 2;

    }
    cout << sum << endl;
    return 0;
}

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

const int N = 100005;

int head[N], tot, a[N], b[N], rA, rB;
struct edge { int to, nxt; } e[N << 1];
void link(int x, int y) {
	e[++tot] = (edge) {y, head[x]}, head[x] = tot;
	e[++tot] = (edge) {x, head[y]}, head[y] = tot;
}

struct tree {
	int head[N], nxt[N]; bool parity[N];
	void link(int x, int y) {nxt[y] = head[x], head[x] = y;}
	void dfs0(int x) {
		parity[x] = 1;
		for (int i = head[x]; i; i = nxt[i])
			parity[x] ^= 1, dfs0(i);
	}
	int dfs1(int x) {
		int rem = parity[x] ? x : 0;
		for (int i = head[x]; i; i = nxt[i]) {
			int ret = dfs1(i); if (!ret) continue;
			if (!rem) rem = ret;
			else ::link(rem, ret), rem = 0;
		}
		return rem;
	}
} A, B;

int number[N], n;
void dfs(int x, int color = 1) {
	number[x] = color;
	for (int i = head[x]; i; i = e[i].nxt)
		if (!number[e[i].to]) dfs(e[i].to, -color);
}

int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	std::cin >> n;
	for (int i = 1; i <= n; ++i)
		std::cin >> a[i], rA = a[i] == -1 ? i : rA, A.link(a[i], i);
	for (int i = 1; i <= n; ++i)
		std::cin >> b[i], rB = b[i] == -1 ? i : rB, B.link(b[i], i);
	A.dfs0(rA), B.dfs0(rB);
	for (int i = 1; i <= n; ++i)
		if (A.parity[i] != B.parity[i])
			return std::cout << "IMPOSSIBLE\n", 0;
	std::cout << "POSSIBLE\n";
	A.dfs1(rA), B.dfs1(rB);
	for (int i = 1; i <= n; ++i)
		if (!number[i] && A.parity[i])
			number[i] = 1, dfs(i);
	for (int i = 1; i <= n; ++i)
		std::cout << number[i] << ' ';
	std::cout << '\n';
	return 0;
}

Measured memory_bytes: 7808
#include <iostream>
#include <algorithm>

using namespace std;

int n, m;
double in[100][100], dp[101][101];

int main( void )
{
	while(cin >> n >> m, n | m) {

		for(int i=0; i < n; ++i)
			for(int j=0; j < n; ++j) {
				cin >> in[i][j];
			}
		for(int i=1; i <= m; ++i)
			fill(dp[i], dp[i]+n, 0);
		fill(dp[0], dp[0]+n, 1);

		for(int i=1; i < m; ++i)
		{
			for(int j=0; j < n; ++j)
			{
				for(int k=0; k < n; ++k)
				{
					//printf("(%lf, %lf, %lf) = (%lf, %lf)\n", i, j, k, dp[i][j], in[j][k]*dp[i-1][j]);
					dp[i][k] = max(dp[i][k], in[j][k] * dp[i-1][j]);
					//dp[i][j] = max(dp[i][j], in[k][j] * dp[i-1][j]);
				}
			}
		}
		double Max = -1.0;
		for(int i=0; i < n; ++i) {
			Max = max(Max, dp[m-1][i]);
		}
		//for(int i=0; i < m; ++i,printf("\n"))
		//	for(int j=0; j < n; ++j) printf("%.2lf ", dp[i][j]);
		
		printf("%.2lf\n", Max);
	}
	return 0;
}

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

signed main(){
  int N;cin>>N;
  int a;
  map<int,int> m;
  for(int i=0;i<N;i++){
    cin>>a;
    m[a]++;
  }
  int k=1;
  set<int> s;
  for(int i=0;i<35;i++){
    s.emplace(k);
    k*=2;
  }
  int ans=0;
  for(auto p=m.rbegin();p!=m.rend();p++){
    while((p->second)>0){
      (p->second)--;
      if(m[*s.upper_bound(p->first)-(p->first)]>0){
        ans++;
        m[*s.upper_bound(p->first)-(p->first)]--;
      }
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 25216
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<vector<int> > Graph;
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; }

ll n;
//約数の全列挙

vector<ll> f(ll n){
    vector<ll> factor;
    for(ll i=1;i*i<=n;i++){
        if(n%i!=0)continue;
        factor.push_back(i);
        if(i*i!=n)factor.push_back(n/i);
    }
    return factor;
}
int main(){
    cin >> n;
    int ans = 0;
    for(ll x:f(n)){
        if(x==1)continue;
        ll temp=n;
        while(temp%x==0){
            temp/=x;
        }
        temp%=x;
        if(temp==1)ans++;
    }
    ans+=f(n-1).size()-1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int p = c - a, q = d - b;
  if(p > 0){
    cout << c - q << " " << d + p << " " << a - q << " " << b + p;
  }else{
    cout << c - q << " " << d + p << " " << a - q << " " << b + p;
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n+1];
        for (int i = 0; i < n+1; i++) {
            array[i] = sc.nextInt();
        }
        
        if (n == 0) {
            if (array[0] == 1) {
                System.out.println(1);
                return;
            } else {
                System.out.println(-1);
                return;
            }
        } else {
            if (array[0] != 0) {
                System.out.println(-1);
                return;
            }
        }
        
        long[] sum = new long[n+1];
        sum[n] = array[n];
        for (int i = n-1; i >= 0; i--) {
            sum[i] = sum[i+1] + array[i];
            
        }
        // System.out.println(Arrays.toString(sum));
        
        long[] ans = new long[n+1];
        long now = 1;
        ans[0] = 1;
        now -= array[0];
        if (now < 0) {
            System.out.println(-1);
            return;
        }
        for (int i = 1; i < n+1; i++) {
            now *= 2;
            ans[i] = Math.min(sum[i], now);
            now = ans[i] - array[i];
            if (now < 0) {
                System.out.println(-1);
                return;
            }
        }
        
        long count = 0;
        for (int i = 0; i < n+1; i++) {
            count += ans[i];
        }
        System.out.println(count);
        
    }
}


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

int main(){
  char c;
  cin >> c;
  
  if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'){
    cout << "vowel" << endl;
  }
  else{
    cout << "consonant" << endl;
  }
}

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

int c[50];
int main()

{
	int n,m,i,j,a,b;
	cin>> n >> m;
	for(i=0;i<m;i++)
{
	cin >> a>> b;
	c[a]++;
	c[b]++;}
	
	for(i=1;i<=n;i++)
	cout << c[i] << "\n";
}


Measured memory_bytes: 256
#?¨????:Ruby
#??????:Combinatorial - Edit Distance (Levenshtein Distance)
#URL:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_E

def make2d(m,n)
  Array.new(m).map{Array.new(n,0)}
end


def min(x,y)
  if x > y
    return y
  else
    return x
  end
end

def align_ed(s,t)
  m = s.length()
  n = t.length()
  a = make2d(m+1,n+1)
  a[0][0] = 0
  for j in 1..n
    a[0][j] = a[0][j-1] + 1
  end
  for i in 1..m
    a[i][0] = a[i-1][0] + 1
  end
  for i in 1..m 
    for j in 1..n
      x = a[i-1][j-1]
      if s[i-1] != t[j-1]
        x += 1
      end
      y = a[i][j-1] + 1                         
      z = a[i-1][j] + 1
      a[i][j] = min(x,min(y,z))
    end
  end
  a[-1][-1]
end


s1 = gets.chomp
s2 = gets.chomp
puts align_ed(s1,s2)

Measured memory_bytes: 16640
N = int(input())
AList = list(map(int, input().split()))

sortList = sorted(AList)
Amax = max(sortList)

dp = [0]*(Amax+1)

for n in sortList:
  dp[n] += 1
  if dp [n] == 1:
    for i in range(n*2, Amax+1, n):
      dp[i] += 2

print(dp.count(1))

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

int main()
{
	int n;
	char str[10], com[13];
	map<string, bool> t;

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> com;
		if (com[0] == 'i') {
			cin >> str;
			t[string(str)] = true;
		}
		else {
			cin >> str;
			if (t[str]) cout << "yes\n";
			else cout << "no\n";
		}
	}

	return 0;
}


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

typedef vector<int> veci;
typedef pair<int, int> pii;
typedef vector<pii> vecii;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vecl;
typedef vector<pll> vecll;
#define EPS (1e-9)
#define MOD (1e9 + 7)
#define fi first
#define se second
#define endl '\n'

void solve() {
    int n, m, v, p;
    cin >> n >> m >> v >> p;

    vector<int> va(n);
    for (int i = 0; i < n; ++i) {
        cin >> va[i];
    }
    sort(va.rbegin(), va.rend());

    int lo = p - 1;
    int hi = n - 1;
    while (lo < hi) {
        int mid = lo + (hi - lo + 1) / 2;

        ll cum = -1;
        if (va[mid] + m >= va[p-1]) {
            cum = 0;
            for (int i = p-1; i < mid; ++i) {
                cum += va[mid] + m - va[i];
            }
        }
        ll vcnt = max(0, v - (n - mid) - p + 1);

        if (cum < vcnt * m) {
            hi = mid - 1;
        } else {
            lo = mid;
        }
    }
    cout << lo+1 << endl;
}

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef LOCAL_TEST
    (void)argc;
    const string strpath = string(argv[0]) + string("-test.in");
    freopen(strpath.c_str(), "r", stdin);
    int tcs;
    cin >> tcs;
    while (tcs-- > 0)
#endif
        solve();
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int k;
  cin >> k;
  
  vector<int> a(32);
  a={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  
  cout << a[k-1] << endl;
  
}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').ToList();
            input.Sort();
            var buf = input[1];
            input[1] = input[3];
            input[3] = buf;
            if (string.Join("", input) == "1974")
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}


Measured memory_bytes: 13524
n, k = map(int, input().split())
x = list(map(int, input().split()))

a = []
b = []
for i in x:
    if i == 0:
        k -= 1
    elif i < 0:
        a.append(-i)
    else:
        b.append(i)
a.reverse()
ans = float("inf")
if len(b) > len(a):
    a, b = b, a
if k == 0:
    ans = 0
else:
    for i in range(k):
        if i < len(a):
            if i == k - 1:
                ans = min(ans, a[i])
            else:
                ta = a[i]
                if 0 <= k - i - 2 < len(b):
                    tb = b[k - i - 2]
                    ans = min(ans, ta * 2 + tb, ta + tb * 2)

print(ans)


Measured memory_bytes: 14564
import sys
n,m,x,y = map(int, input().split())
lis1 = [int(i) for i in input().split()]
lis2 = [int(i) for i in input().split()]
z = x+1
while z <= y:
  if max(lis1) < z and min(lis2) >= z:
    print('No War')
    sys.exit()
  else:
    z += 1
print('War')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vs = vector<string>;
using vvs = vector<vs>;
using pli = pair<long long, int>;
using vpli = vector<pli>;

int main() {
  ll N, D, ans = 1, max;
  cin >> N;
  vll Ds(N);
  map<ll, ll> mll;
  
  for (int i = 0; i < N; i++) {
    cin >> D;
    if (i == 0 && D > 0) {
      cout << 0 << endl;
      return 0;
    }
    else if (i > 0 && D == 0) {
      cout << 0 << endl;
      return 0;
    }
    else {
      Ds.at(i) = D;
      if (!mll.count(D))
        mll[D] = 1;
      else
        mll[D]++;
    }
  }
  
  sort(Ds.begin(), Ds.end());
  max = Ds.at(N-1);
  
  for (int i = 1; i <= max; i++) {
    if (mll[i] == 0) {
      cout << 0 << endl;
      return 0;
    }
    else if (i > 1) {
      for (int j = 0; j < mll[i]; j++) {
        ans *= mll[i-1];
        ans %= 998244353;
      }
    }
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 7296
#include<stdio.h>

#define N 201

int main(void)
{
  int i,m,n,n1,n2,p[N],G,G1;

  while(1)
    {
      scanf("%d%d%d",&m,&n1,&n2);
      if(m==0 && n1==0 && n2==0) break;
      for(i=0;i<=m-1;i++)
	{
	  scanf("%d",&p[i]);
	}
      G1=0;
      for(i=n1-1;i<=n2-1;i++)
	{
	  G=p[i]-p[i+1];
	  if(G1<=G)
	    {
	      G1=G;
	      n=i+1;
	    }
	}
      printf("%d\n",n);
    }
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define lb lower_bound
#define ub upper_bound
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll k,x;cin>>k>>x;
  if(500*k>=x)cout<<"Yes"<<ENDL;
  else cout<<"No"<<ENDL;
}
//( ・ __ ・ ) KEEP BEING ORGANIZED
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
  
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second
  
using namespace std;
  
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;

struct era{
    string name;
    int start;
    int end;
    era(string n, int s, int e):name(n),start(s),end(e){}
    bool include(int n){
        if(start < n && n <= end) return true;
        return false;
    }
};

int main(){
    int n, q;
    while(cin >> n >> q, n|q){
        vector<era> v;
        rep(i, n){
            string name;
            int period, end;
            cin >> name >> period >> end;
            v.push_back(era(name, end-period, end));
        }
        rep(i, q){
            int year;
            cin >> year;
            int ans = -1;
            rep(j, v.size()){
                if(v[j].include(year)){
                    ans = j;
                    break;
                }
            }
            if(ans != -1) cout << v[ans].name << ' ' << year-v[ans].start << endl;
            else cout << "Unknown" << endl;
        }

    }

    return 0;
}

Measured memory_bytes: 1284
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define db long double
#define ii pair<int,int>
#define vi vector<int>
#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define FN(i, n) for (int i = 0; i < (int)(n); ++i)
#define FEN(i,n) for (int i = 1;i <= (int)(n); ++i)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(i,a,b) for(int i=b-1;i>=a;i--)
#define SET(A, val) memset(A, val, sizeof(A))
typedef tree<int ,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set ;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
map<string,int> m;
int main()
{
  std::ios::sync_with_stdio(false);
  cin.tie(NULL) ; cout.tie(NULL) ;
  string s;
  cin>>s;
  int k;
  cin>>k;
  rep(j,1,k+1)
    {
      rep(i,0,sz(s))
	{
	  if(i+j-1>=sz(s)) continue;
	  m[s.substr(i,j)];
	}
    }
  auto it=m.begin();
  rep(i,0,k-1) it++;
  cout<<(*it).fi<<endl;
  return 0 ;
}


Measured memory_bytes: 1920
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Li Hong Sheng Gabriel
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CModuloSummation solver = new CModuloSummation();
        solver.solve(1, in, out);
        out.close();
    }

    static class CModuloSummation {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt();
            int a = 0;
            long ans = 0;

            for (int i = 0; i < n; i++) {
                a = in.nextInt();
                ans += a - 1;
            }
            out.println(ans);
        }

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream));
        }

        public FastReader(String name) throws IOException {
            br = new BufferedReader(new FileReader(name));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 23252