akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int inf = 1001001001;
 
template <typename T>
struct UnionFind {
   vector<T> par; 
 
   UnionFind(T N) : par(N) { 
        for(T i = 0; i < N; i++) par[i] = i;
   }
 
   int root(T x) { 
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
   }
 
   void unite(T x, T y) { 
       T rx = root(x); 
       T ry = root(y); 
       if (rx == ry) return; 
       par[rx] = ry; 
   }
 
   bool same(T x, T y) { 
       T rx = root(x);
       T ry = root(y);
       return rx == ry;
   }
};


int main() {
    long double n;
    cin >> n;
    vector<long double> data(n);
    rep(i,n) cin >> data[i];
    sort(data.begin(),data.end());
    rep(i,n-1){
        long double x=(data[0]+data[1])/2;
        data.erase(data.begin());
        data.erase(data.begin());
        data.push_back(x);
        sort(data.begin(),data.end());
    }
    cout << fixed << setprecision(10);
    cout << data[0] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 2e9
using namespace std;
typedef long long llong;
typedef long double ldouble;

using Graph = vector<vector<int>>;

// int ctoi(const char c){
//   if('0' <= c && c <= '9') return (c-'0');
//   return -1;
// }

// int gcd(int a, int b){
//   int ma = max(a,b);
//   int mi = min(a,b);
//   if(mi == 0) return ma;

//   return gcd(mi, ma%mi);
// }
int main(){
  int N;
  cin >> N;
  vector<int> candidate = {1, 3, 5, 7, 9, 11, 13};
  int ans = 0;
  for(int i=0; i<candidate.size()-3; ++i){
    for(int j=i+1; j<candidate.size()-2; ++j){
      for(int k=j+1; k<candidate.size()-1; ++k){
        for(int l=k+1; l<candidate.size(); ++l){
          if(candidate[i] * candidate[j] * candidate[k] * candidate[l] <= N) ++ans;
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;


class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		
		while(true) {
			int n = stdIn.nextInt();
			if(n == 0) break;
			String[] list = new String[n];
			for(int i = 0; i < n; i++) {
				int pm = stdIn.nextInt();
				int pe = stdIn.nextInt();
				int pj = stdIn.nextInt();
				int sum = pm + pe + pj;
				if(pm == 100 || pe == 100 || pj == 100 || (pm + pe) >= 180 || sum >= 240) {
					list[i] = "A";
				}
				else if(sum >= 210 || ((sum >= 150) && (pm >= 80 || pe >= 80))) {
					list[i] = "B";
				}
				else {
					list[i] = "C";
				}
			}
			for(int i = 0; i < n; i++) {
				System.out.println(list[i]);
			}
		}
	}
}

Measured memory_bytes: 28268
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;

int X, Y;
int main(){
    cin.sync_with_stdio(0);
    cin.tie(0);
    cin >> X >> Y;
    for (int i = 0; i <= X; i++) {
        for (int j = 0; j <= X; j++) {
            if(i+j==X && (i*2+j*4)==Y){
                cout << "Yes\n";
                return 0;
            }
        }
    }
    cout << "No\n";
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>

using namespace std;

const int INF = 2147483647;

template<class T>
bool chmin(T &a, const T &b) { return b < a && (a = b, 1); }

int main() {
  int n, map[26];
  cin >> n;
  for (int &i : map) i = INF;

  for (int i = 0; i < n; ++i) {
    int _map[26];
    for (int &j : _map) j = 0;
    string s;
    cin >> s;
    for (const char &c : s) _map[c - 'a']++;
    for (int j = 0; j < 26; ++j) chmin(map[j], _map[j]);
  }

  for (int i = 0; i < 26; ++i) {
    char c = 'a' + i;
    for (int j = 0; j < map[i]; ++j) cout << c;
  }
  cout << endl;
}


Measured memory_bytes: 3584
#include <stdio.h>

int main(void)
{
  int N, K;
  long ans;
  scanf("%d %d", &N, &K);
  long x = N/K;
  ans = x*x*x;
  if(K%2 == 0){
    x = N/(K/2) - N/K;
    ans += x*x*x;
  }
  printf("%ld\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) x.begin(), x.end()
using namespace std;
int main(){
  int n;
  cin>>n;
  int a[n];
  rep(i,n) cin>>a[i];
  sort(a,a+n,greater<int>());
  int Alice=0,Bob=0;
  rep(i,n){
    if(i%2==0) Alice+=a[i];
    else Bob+=a[i];
  }
  cout<<Alice-Bob<<endl;
}

Measured memory_bytes: 3612
#include <iostream>
using namespace std;
int main(){
  int n;
  cin >> n;
  int i,j;
  int cnt = 0;
  int cnt2 = 0;
  for(i=1;i<=n;i++){
    if(i%2==0) continue;
    for(j=1;j<=i;j++) if(i%j==0) cnt++;
    if(cnt==8) cnt2++;
    cnt = 0;
  }
  cout << cnt2 << "\n";
  return 0;
}

Measured memory_bytes: 384
use proconio::input;

fn group(x: u8) -> u8 {
    match x {
        1 | 3 | 5 | 7 | 8 | 10 | 12 => 0,
        4 | 6 | 9 | 11 => 1,
        2 => 2,
        _ => unreachable!(),
    }
}
fn main() {
    input! {
        x: u8,
        y: u8
    };
    let ans = group(x) == group(y);
    println!("{}", if ans { "Yes" } else { "No" });
}


Measured memory_bytes: 2072
let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}

// utils
const MOD = 1e9 + 7;
const mod = (n) => ((n % MOD) + MOD) % MOD;
const add = (a, b) => mod(mod(a) + mod(b));
const sub = (a, b) => mod(mod(a) - mod(b));
function mul() {
  for (var a = arguments, r = a[0], i = a.length; --i; )
    r = ((((r >> 16) * a[i]) % MOD) * 65536 + (r & 65535) * a[i]) % MOD;
  return r;
}
function inv(b) {
  for (var a = MOD, u = 0, v = 1, t; b; v = t)
    (t = (a / b) | 0), (a -= t * b), (u -= t * v), (t = a), (a = b), (b = t), (t = u), (u = v);
  u %= MOD;
  return u < 0 ? u + MOD : u;
}

function main() {
  const n = +readLine();
  let result = add(sub(pow(10, n), mul(2, pow(9, n))), pow(8, n));

  console.log(result);
}

function pow(base, n) {
  if (n === 0) return 1;

  let p = pow(base, Math.floor(n / 2));
  let res = mul(mod(p), mod(p));

  if (n % 2 === 1) {
    res = mul(mod(res), base);
  }

  return res;
}


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

int main() {
	string s;
	cin >> s;
	int bn = 0;
	ll ans = 0;
	rep(i, s.size()) {
		if (s[i] == 'B') bn++;
		else ans += bn;
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

ll dp[3000+1][3000+1][4];

int main()
{
    ll R, C, K;
    cin >> R >> C >> K;
    map<pair<ll,ll>,ll> S;
    REP(i,0,K) {
        ll r, c, v;
        cin >> r >> c >> v;
        S[{r, c}] = v;
    }

    
    //REP(i,0,R+1) REP(j,0,C+1) REP(k,0,4) dp[i][j][k] = 0;
    REP(i,1,R+1) {
        REP(j,1,C+1) {
            ll x = 0;
            if(S.count({i, j}) > 0) x = S[{i, j}];
            dp[i][j][0] = MAX(dp[i][j][0],dp[i][j-1][0]);
            REP(k,0,4) dp[i][j][0] = MAX(dp[i][j][0],dp[i-1][j][k]);
            REP(k,1,4) dp[i][j][k] = MAX(dp[i][j][0],dp[i][j-1][k]);
            dp[i][j][1] = MAX(dp[i][j][1],dp[i][j-1][0]+x);
            REP(k,0,4) dp[i][j][1] = MAX(dp[i][j][1],dp[i-1][j][k]+x);
            REP(k,2,4) dp[i][j][k] = MAX(dp[i][j][k],dp[i][j-1][k-1]+x);
        }
    }
    
    ll ans = MAX(dp[R][C][0],dp[R][C][1]);
    ans = MAX(ans,dp[R][C][2]);
    ans = MAX(ans,dp[R][C][3]);
    PR(ans);

    return 0;
}

/*



*/

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

int main() {
  int n, cnt = 0;
  string a;
  set<string> s;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    cin >> a;
    auto itr = s.find(a);
    if (itr == s.end()) {
      s.insert(a);
      cnt++;
    }
  }

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

Measured memory_bytes: 19368
(let* ((x (read))
       (n (read))
       (exists (make-array `(102) :initial-element nil)))
  ;; read
  (loop :for i :from 1 :to n
        :do (let ((p (read)))
              (setf (aref exists p) t)))
  ;;    
  (loop :named main
        :for i :from 0 :to 50
        :do (cond ((null (aref exists (- x i)))
                   (format t "~A~%" (- x i))
                   (return-from main))
                  ((null (aref exists (+ x i)))
                   (format t "~A~%" (+ x i))
                   (return-from main)))))


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

int main(void) {
    int a, b, sum;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> a >> b;
    if (a > b) {
        sum = a + (a - 1);
    } else if (a < b) {
        sum = b + (b - 1);
    } else {
        sum = a + b;
    }

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

Measured memory_bytes: 256
#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 watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=(a);i<(b);i++)
#define fore(i,a,b) for(int i=(a);i<=(b);i++)
#define pb push_back
#define F first
#define S second
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
void amin(ll &a, ll b){ a=min(a,b); }
void amax(ll &a, ll b){ a=max(a,b); }
void YES(){cout<<"Yes\n";} void NO(){cout<<"No\n";}
void SD(int t=0){ cout<<"PASSED "<<t<<endl; }
const ll INF = ll(1e18);
const int MOD = 998244353;

bool DEBUG=0;
const int MAXN = 100005;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	int n; cin>>n;
	ll a[n];
	forn(i,0,n) cin>>a[i];
	a[0]--;
	
	forn(i,1,n){
		if(a[i]>=a[i-1]+1) a[i]--;
		if(a[i]<a[i-1]){
			cout<<"No\n";
			return 0;
		}
	}
	
	YES();
	
	return 0;
}


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

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

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

  int ans=0;
  for(int i=0;i<N-1;i++){
    int down=0;
    for(int j=i+1;j<N;j++){
      if(H[j-1]>=H[j]) down++;
      else break;
    }
    ans=max(down,ans);
    i+=down;
  }

  cout<<ans;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1);
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 dp[200010];

int main() {
    string s; cin >> s;
    reverse(all(s));
    int n = s.size();

    int times = 10;
    dp[0] = (s[0] - '0') % 2019;
    for (int i = 1; i < n; i++) {
        dp[i] = ((s[i] - '0') * times + dp[i-1]) % 2019;
        times *= 10;
        times %= 2019;
        if (times < 0) times += 2019;
    }

    map<int, ll> mp;
    rep(i, n) mp[dp[i]]++;
    mp[0]++;

    ll ans = 0;
    rep(i, 2019) {
        ans += mp[i] * (mp[i] - 1) / 2;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4360
n=int(input())
MAX_N=n
X = [None] * (MAX_N + 1)
def f(n):
    if n==0:
        return 1
    if n==1:
        return 1
    if X[n]:
        return X[n]
    r=f(n-1)+f(n-2)
    X[n]=r
    return r
print(f(n))


Measured memory_bytes: 5600
#include<bits/stdc++.h>
#define Task "B"

using namespace std;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int a, b;
    cin >> a >> b;
    int res = 0;
    if (b == 1) res = 0;
    else
        if (b <= a) res = 1;
        else
            res = (b-a)/(a-1) + ((b-a) % (a-1) != 0) + 1;
    cout << res;

    return 0;
}


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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
typedef vector<ll> VL; const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; } template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}


ll dp[4][4][4] , np[4][4][4];

int main()
{
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	
	dp[3][3][3] = 1;
	rep(i, n){
		memset(np, 0, sizeof np);
		rep(a, 4) rep(b, 4) rep(c, 4) rep(d, 4){
			if((b==0 && c==1 && d==2) || (b==1 && c==0 && d==2) ||
				(b==0 && c==2 && d==1) || (a==0 && c==1 && d==2) ||
				(a==0 && b==1 && d==2)) continue;
			(np[b][c][d] += dp[a][b][c]) %=MD;
		}
		swap(np, dp);
	}
	ll ans = 0;
	rep(a, 4) rep(b, 4) rep(c, 4) (ans += dp[a][b][c]) %=MD;
	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
#define ll long long int
#define tc int t; cin>>t; while(t--)
#define inn ll arr[n]; for(int i=0;i<n;i++) cin>>arr[i];
#define fora(i,n); for(ll i=0;i<n;i++)
#define forb(i,a,n); for(int i=a;i<n;i++)
#define mod 1000000007

int main()
{

//THIS CODE IS CREATED BY ANSHJAIN18

ll n,m;
cin>>n>>m;
if(m==n)
    cout<<"Yes";
else cout<<"No";


return 0; }

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

using namespace std;

int main(){
	int n, a[3];

	cin >> n;
	while (n-- > 0) {
		cin >> a[0] >> a[1] >> a[2];
		sort(a, a + 3);
		cout << (a[0] * a[0] + a[1] * a[1] == a[2] * a[2] ? "YES" : "NO") << endl;
	}

	return 0;
}

Measured memory_bytes: 0
# include <iostream>

typedef long long ll;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a, b; cin >> a >> b;
    ll ans = 0;
    for (ll i = 4 * (ll)(a/4); i < a; i++) ans = ans^i;
    for (ll i = 4 * (ll)(b/4); i <= b; i++) ans = ans^i;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 200000
using namespace std;
struct line {
    int A, B, C, n;
    double p;
} L[N];
int t[N], n;

bool cmpX(line a, line b) {
    return a.A * b.B > b.A * a.B;
}
bool cmp(line a, line b) {
    return a.p < b.p;
}
int lb(int x) {
    return x & (-x);
}
double calc(double x, int i) {
    return ((double)L[i].C - (double)L[i].A * x) / L[i].B;
}
void add(int x) {
    for(; x <= n; x += lb(x)) t[x]++;
}
int ask(int x) {
    int ret = 0;
    for(; x > 0; x -= lb(x)) ret += t[x];
    return ret;
}

int ch(double mid) {
    for(int i = 1; i <= n; i++) L[i].p = calc(mid, i);
    sort(L + 1, L + n + 1, cmp);
    for(int i = 1; i <= n; i++) t[i] = 0;
    int ret = 0;
    for(int i = 1; i <= n; i++) {
        ret += ask(L[i].n);
        add(L[i].n);
    }
    return ret;
}

double sol() {
    double l = -1e9, r = 1e9;
    for(int i = 1; i <= 80; i++) {
        double mid = (l + r) / 2;
        int tmp = ch(mid);
        if (tmp + tmp < n * (n - 1) / 2) l = mid;
        else r = mid;
    }
    return l;
}

int main() {
    cin >> n;
    for(int i = 1; i <= n; i++) scanf("%d%d%d", &L[i].A, &L[i].B, &L[i].C);
    for(int i = 1; i <= n; i++)
        if (L[i].B < 0) L[i].A *= -1, L[i].B *= - 1, L[i].C *= -1;
    sort(L + 1, L + n + 1, cmpX);
    for(int i = 1; i <= n; i++) L[i].n = i;
    double X = sol();
    for(int i = 1; i <= n; i++) swap(L[i].A, L[i].B);
    for(int i = 1; i <= n; i++)
        if (L[i].B < 0) L[i].A *= -1, L[i].B *= - 1, L[i].C *= -1;
    sort(L + 1, L + n + 1, cmpX);
    for(int i = 1; i <= n; i++) L[i].n = i;
    double Y = sol();
    printf("%.20f %.20f\n", X, Y);
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define N 100005
using namespace std;
int n,f[N],a[N];
vector<int> G[N],E[N];
void dfs(int t)
{
	int i;
	for(i=0;i<G[t].size();i++)
		dfs(G[t][i]),E[t].push_back(f[G[t][i]]);
	sort(E[t].begin(),E[t].end());
	for(i=0;i<E[t].size();i++)
		f[t]=max(f[t],E[t][i]+(int)G[t].size()-i);
}
int main()
{
	int i;
	scanf("%d",&n);
	for(i=2;i<=n;i++){
		scanf("%d",&a[i]);
		G[a[i]].push_back(i);
	  }
	dfs(1);
	cout<<f[1];
	return 0;
}


Measured memory_bytes: 18176
#include <iostream>
#include <sstream>
using namespace std;
#include <bits/stdc++.h>
#include<utility>
#include <algorithm>
#include<iterator>
#define  go return 0
#define rep(i,n) for(int i=0;i<n;++i)
#define rep(j,m) for(int j=0;j<m;++j)
#define REP(i,n) for(int i=1;i<=n;++i)
#define all(v)   ((v).begin()), ((v).end())
#define len(s)   ((int)s.size())
#define F first
#define S second
#define pb push_back
#define pf push_front
#define mp make_pair
typedef long long ll;
typedef double db;
typedef vector<ll> ve;
typedef vector<pair<char,int> >vepa;
typedef set<char>se;
typedef map<char ,int> mpp;
const ll N=1e6+5 ,OO=1e18;
const int di[]={1,-1,0,0};
const int dj[]={0,0,1,-1};
ll TC,n,m,a,cnt,arr[N];
bool f,vis[N];
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
       char ch;
       cin>>ch;
       if(ch>='a'&&ch<='z')
         cout<<"a";
       else
        cout<<"A";
go;
}


Measured memory_bytes: 3636
// スタックサイズ: 100MB

#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
using namespace std;

typedef int64_t ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
const ll INF = 1e18;
const double EPS = 1e-10;
#define fastio  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define fst first
#define snd second
ll pw(ll x, ll y) { ll r = 1;  rep(i, y) { r *= x; }; return r; }



int main() {
	fastio;
	
	string s;
	cin >> s;
	cout << ((s[0] == '9' || s[1] == '9') ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <algorithm>
#include <map>
using namespace std;
long long int MOD = 1000000000 + 7;
using ll = long long;

ll C(ll n, ll k) {
	if (n < k) {
		return 0;
	}
	if (n / 2 < k) {
		k = n - k;
	}
	ll num = 1;
	ll den = 1;
	for (ll i = 0; i < k; ++i) {
		num *= (n - i);
		den *= (i + 1);
		num %= MOD;
		den %= MOD;
	}
	return num / den;
}

struct Mat {
	ll h_ = 0;
	ll w_ = 0;
	vector<ll> x;
	void make(ll h, ll w, ll i = -1) {
		h_ = h;
		w_ = w;
		x = vector<ll>();
		x.resize(w * h, i);
	}
	ll& set(ll i, ll j) {
		return x[i * w_ + j];
	}
	ll get(ll i, ll j) const {
		if (i < 0) { return 9999; }
		if (j < 0) { return 9999; }
		if (h_ <= i) { return 9999; }
		if (w_ <= j) { return 9999; }
		return x[i * w_ + j];
	}
	void pr() const {
		cout << "-----------------------------" << endl;
		for (ll i = 0; i < h_; ++i) {
			for (ll j = 0; j < w_; ++j) {
				if (x[i * w_ + j] >= 9999) {
					cout << "X" << " ";
					continue;
				}
				if (x[i * w_ + j] >= 999) {
					cout << "#" << " ";
					continue;
				}
				cout << x[i * w_ + j] << " ";
			}
			cout << endl;
		}
		cout << "-----------------------------" << endl;
	}
};

bool is_finished(const Mat& m) {
	for (ll i = 0; i < m.h_; ++i) {
		for (ll j = 0; j < m.w_; ++j) {
			if (m.get(i, j) == 9999) {
				return false;
			}
		}
	}
	return true;
}

ll solve(Mat m, Mat& mm) {
	ll h = m.h_;
	ll w = m.w_;

	while (!is_finished(mm))
	{
		for (ll i = 0; i < h; ++i) {
			for (ll j = 0; j < w; ++j) {
				if (m.get(i, j) == 1) {
					mm.set(i, j) = 999;
					continue;
				}
				ll u = mm.get(i - 1, j);
				ll d = mm.get(i + 1, j);
				ll l = mm.get(i, j - 1);
				ll r = mm.get(i, j + 1);
				u = u < 0 ? 9999 : u;
				d = d < 0 ? 9999 : d;
				l = l < 0 ? 9999 : l;
				r = r < 0 ? 9999 : r;
				ll dist = u < d ? u : d;
				dist = dist < l ? dist : l;
				dist = dist < r ? dist : r;
				if (dist >= 999) {
					continue;
				}
				if (mm.get(i, j) < dist) {
					continue;
				}
				mm.set(i, j) = dist + 1;
			}
		}
	}

	ll ret = 0;
	for (ll i = 0; i < h; ++i) {
		for (ll j = 0; j < w; ++j) {
			if (mm.get(i, j) >= 999) {
				continue;
			}
			if (ret < mm.get(i, j)) {
				ret = mm.get(i, j);
			}
		}
	}
	return ret;
}

int main() {
	ll h, w;
	cin >> h >> w;
	Mat m;
	Mat mm;
	m.make(h, w);

	ll inii = 0;
	ll inij = 0;
	for (ll i = 0; i < h; ++i) {
		string a;
		cin >> a;
		for (ll j = 0; j < w; ++j) {
			if (a[j] == '#') {
				m.set(i, j) = 1;
			}
			else {
				m.set(i, j) = 0;
			}
		}
	}
	ll emax = 0;
	for (ll i = 0; i < h; ++i) {
		for (ll j = 0; j < w; ++j) {
			if (m.get(i, j) == 1) {
				continue;
			}
			mm.make(h, w, 9999);
			mm.set(i, j) = 0;
			ll r = solve(m, mm);
			if (emax < r) {
				emax = r;
			}
			//mm.pr();
		}
	}

	cout << emax << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T &a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T &a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------

signed main() {
	int x, y;
	cin >> x;
	cout << x / 3600 << ":" << (x % 3600) / 60 << ":" << (x % 60) << endl;
}


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

using namespace std;

int f(int n, int k) { return n == 1 ? 0 : (f(n-1, k) + k) % n; }

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  while (1) {
    int N, K, M; cin >> N >> K >> M;
    if (N == 0 and K == 0 and M == 0) break;
    cout << (f(N-1, K) + M) % N + 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 3444
module Main where

main :: IO ()
main = do
    [n, k] <- (map read . words) <$> getLine :: IO [Int]
    print $ if k == 2
        then (n `div` 2) ^ 3 + (n `myDiv` 2) ^ 3
        else (n `div` k) ^ 3 + if even k
            then ((n + k `div` 2) `div` k) ^ 3
            else 0
    return ()

myDiv a b = (a + (b - 1)) `div` b


Measured memory_bytes: 508
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <array>
#include <math.h>
#include <sstream>
typedef long long ll;
using namespace std;

int main(int argc, char const *argv[])
{
    string str = "";
    bool c = false;
    bool f = false;
    cin >> str;

    for (int i = 0; i < str.size(); i++) {
        if (str[i] == 'C') c = true;
        if (str[i] == 'F' && c == true) f = true;
    }

    if (f) {
        std::cout << "Yes" << '\n';
    } else {
        std::cout << "No" << '\n';
    }
    return 0;
}

Measured memory_bytes: 256
n=int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.append(10000)
cnt=0
for i in range (n):
    cnt+=b[a[i]-1]
    if a[i]+1==a[i+1]:
        cnt+=c[a[i]-1]
print(cnt)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(){
  int r,h,c=0;
  cin>>r>>h;
  for(r;r<=h;r++){
    int i=r,b=0;
    b+=i%10*10000;
    i/=10;
    b+=i%10*1000;
    i/=10;
    b+=i%10*100;
    i/=10;
    b+=i%10*10;
    i/=10;
    b+=i%10;
    if(b==r) c++;
  }
  cout<<c;
}

Measured memory_bytes: 256
/*input

*/


//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define pb          push_back
#define pii         pair<ll int,ll int>
#define vpii        vector< pii >
#define vi          vector<ll int>
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			(ll)1e18
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll mod = 1e9+7;
ll power(ll x,ll y)
{
	ll ans=1;
	while(y)
	{
		if(y&1) ans = (ans*x)%mod;
		y>>=1;
		x=(x*x)%mod;
	}
	return ans;
}
		
int solve()
{
	ll n,k;cin>>n>>k;

	vi dp(k+1);

	for(ll i = k;i>=1;i--)
	{
		dp[i] = power(k/i,n);
		for(ll j = 2*i;j<=k;j+=i) dp[i] = (dp[i]-dp[j]+mod)%mod;
		// whatis(dp[i]);
	}

	ll ans=0;
	rep(i,1,k+1) ans = (ans+(i*dp[i])%mod)%mod;

	cout<<ans<<"\n";

	return 0;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();

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

	ll test_cases=1;
	//cin>>test_cases;
	while(test_cases--)
		solve();

	auto stop = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start);
	// cout<<"\nduration: "<<(double)duration.count()<<" milliseconds";
}


Measured memory_bytes: 4016
import Control.Monad
import Control.Applicative

isDraw :: [Int] -> Bool
isDraw xs =
    let allRock = all (1 ==) xs
        allScissors = all (2 ==) xs
        allPaper = all (3 ==) xs
        allHands = elem 1 xs && elem 2 xs && elem 3 xs
    in allRock || allScissors || allPaper || allHands

solve :: [Int] -> [Int]
solve xs
    | isDraw xs = replicate (length xs) 3
    | otherwise =
        let rockWin = elem 1 xs && elem 2 xs
            scissorsWin = elem 2 xs && elem 3 xs
        in if rockWin then map (\x -> if x == 1 then 1 else 2) xs
           else if scissorsWin then map (\x -> if x == 2 then 1 else 2) xs
           else map (\x -> if x == 3 then 1 else 2) xs

main :: IO ()
main = do
    h1 <- read <$> getLine
    if h1 == 0 then return ()
    else do
        h2 <- read <$> getLine
        h3 <- read <$> getLine
        h4 <- read <$> getLine
        h5 <- read <$> getLine
        mapM_ print $ solve [h1, h2, h3, h4, h5]
        main



Measured memory_bytes: 4092
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
struct HashData {
	ll h1, h2;
	bool operator==(const HashData& rhs) const {
		return h1 == rhs.h1 && h2 == rhs.h2;
	}
	bool operator!=(const HashData& rhs) const { return !(*this == rhs); }
};

class RollingHash {
	template<const ll B, const ll M>
	class RollingHashPart {
	private:
		size_t len;
		vector<ll> pow_b, hash;
	public:
		RollingHashPart() {}
		template<typename T>
		RollingHashPart(const T& s) : len(s.size()), pow_b(s.size() + 1), hash(s.size() + 1) {
			pow_b[0] = 1;
			hash[0] = 0;
			for (ll i = 0; i < len; i++) {
				pow_b[i + 1] = pow_b[i] * B % M;
				hash[i + 1] = (hash[i] * B + s[i]) % M;
			}
		}
		// [l, r)
		ll get(ll l, ll r) const {
			ll res = (hash[r] - hash[l] * pow_b[r - l]) % M;
			if (res < 0) res += M;
			return res;
		}
	};
public:
	RollingHashPart<1033, 1000000007> rh1;
	RollingHashPart<6037, 999999937> rh2;
 
	RollingHash() {}
	template<typename T> RollingHash(const T & s) : rh1(s), rh2(s) {}
	// [l, r)
	HashData get(ll l, ll r) const {
		return (HashData){ rh1.get(l, r), rh2.get(l, r) };
	}

	lpair getPair(ll l, ll r) const {
		return make_pair(rh1.get(l,r) , rh2.get(l, r));
	}
	// [l1, r1), [l2, r2)
	ll lcp(const RollingHash & rhs, ll l1, ll r1, ll l2, ll r2) const {
		ll lb = 0, ub = min(r1 - l1, r2 - l2) + 1;
		while (ub - lb > 1) {
			ll md = (lb + ub) >> 1;
			(get(l1, l1 + md) == rhs.get(l2, l2 + md) ? lb : ub) = md;
		}
		return lb;
	}
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll a[200010], b[200010];
    rep(i,0,N) cin >> a[i];
    rep(i,0,N) cin >> b[i];
    ll xa[200010], xb[200010];
    rep(i,0,N){
        xa[i] = (a[i] ^ a[(i+1)%N]);
        xb[i] = (b[i] ^ b[(i+1)%N]);
    }
    string A = "", B = "";
    rep(i,0,N){
        bitset<32> b(xa[i]);
        A += b.to_string();
        bitset<32> b2(xb[i]);
        B += b2.to_string();
    }
    RollingHash rh_a(A), rh_b(B);
    // printa(xa, N);
    // printa(xb, N);
    rep(i,0,N){
        if(i == 0){
            if(rh_a.getPair(0,N * 32) == rh_b.getPair(0,N * 32)){
                ll k = 0;
                ll x = (a[0]^b[0]);
                print(k,x);
            }
        }else{
            if(rh_a.getPair(0,i * 32) == rh_b.getPair((N-i) * 32, N* 32) && 
                rh_a.getPair(i*32, N*32) == rh_b.getPair(0, (N-i)*32)){
                    ll k = i;
                    ll x = (a[0]^b[N-i]);
                    print(k,x);
            }
        }
    }


    
    

}

Measured memory_bytes: 425128
import sys
from collections import Counter
input = sys.stdin.readline
sys.setrecursionlimit(100000)
def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))

def check(mid, k, pairs):
    tmp = 0
    for pair in pairs:
        a,b = pair
        kari_a = mid // b
        tmp += max(a - kari_a, 0)

    if tmp <= k:
        return True
    else:
        return False


def solve():
    n, k = getList()
    cap = getList()
    foods = getList()
    cap.sort()
    foods.sort(reverse=True)
    h = []
    pairs = [(a, b) for a, b in zip(cap, foods)]
    ansmn = 0
    ansmx = 10**13
    # print(foods)
    # print(cap)
    # print([2046//p for p in foods])
    while(ansmx - ansmn > 1):
        mid = (ansmn + ansmx) // 2
        res = check(mid, k, pairs)
        if res:
            ansmx = mid
        else:
            ansmn = mid


    if check(ansmn, k, pairs):
        print(ansmn)
    else:
        print(ansmx)

def main():
    solve()


if __name__ == "__main__":
    main()


"""
10 10
95 38 9 26 36 10 69 25 44 83
6 42 33 74 75 31 73 20 70 93
"""

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

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

    int ans=0;

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

        cin >> h;

        if (k <= h) {
            ans++;

        }



    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define push_back pb
#define int long long int
string factorial(long long n)
{
	if (n > 1000) {
		cout << " Integer Overflow"
		     << endl;
		return "";
	}

	long long counter;
	long double sum = 0;

	// Base case
	if (n == 0)
		return "1";

	// Calculate the sum of
	// logarithmic values

	for (counter = 1; counter <= n;
	        counter++) {
		sum = sum + log(counter);
	}
	cout << sum << endl;

	// Number becomes too big to hold in
	// unsigned long integers.
	// Hence converted to string
	// Answer is sometimes under
	// estimated due to floating point
	// operations so round() is used
	string result
	    = to_string(round(exp(sum)));

	return result;
}

int32_t main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int a, b, c;
	cin >> a >> b >> c;
	c = b * c;
	if (a > c)
		cout << "No";
	else
		cout << "Yes";
	return 0;
}

Measured memory_bytes: 3696
#include "bits/stdc++.h"

using namespace std;
typedef unsigned long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

int main() {

    string s1, s2;
    cin >> s1 >> s2;

    reverse(s2.begin(), s2.end());
    
    if(s1 == s2){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }

}

Measured memory_bytes: 256
N=int(input())
ans=[["." for i in range(N)] for j in range(N)]
if N==2:
    print(-1)
    exit()
elif N%3==0:
    if N%3==0:
        for i in range(N//3):
            ans[3*i][3*i]="a"
            ans[3*i][3*i+1]="a"
            ans[3*i+1][3*i+2]="a"
            ans[3*i+2][3*i+2]="a"
elif N==11:
    i=0;r=0
    ans[5*i+4*r][5*i+4*r:5*i+4*r+5]=["a","a","b","b","c"]
    ans[5*i+4*r+1][5*i+4*r:5*i+4*r+5]=["b","d","d",".","c"]
    ans[5*i+4*r+2][5*i+4*r:5*i+4*r+5]=["b",".",".","e","b"]
    ans[5*i+4*r+3][5*i+4*r:5*i+4*r+5]=["c",".",".","e","b"]
    ans[5*i+4*r+4][5*i+4*r:5*i+4*r+5]=["c","b","b","a","a"]
    ans[5][5:]=["a","a",".","b","b","a"]
    ans[6][5:]=[".",".","a","c",".","a"]
    ans[7][5:]=[".",".","a","c","b","b"]
    ans[8][5:]=["a","b","b","a","a","."]
    ans[9][5:]=["a",".","a",".",".","a"]
    ans[10][5:]=["c","c","a",".",".","a"]
elif N==7:
    ans[0]=[".",".",".","a",".","d","e"]
    ans[1]=[".",".",".","a",".","d","e"]
    ans[2]=[".",".","b","b","c","a","a"]
    ans[3]=["b","b","e",".","c",".","."]
    ans[4]=[".",".","e","d","d","e","e"]
    ans[5]=["b","b","f",".","c",".","."]
    ans[6]=["a","a","f",".","c",".","."]
else:
    r=5-N%5
    if r==5:
        r=0
    for i in range(0,r):
        ans[4*i][4*i]="a"
        ans[4*i][4*i+1]="a"
        ans[4*i][4*i+2]="c"
        ans[4*i][4*i+3]="d"
        ans[4*i+1][4*i]="b"
        ans[4*i+1][4*i+1]="b"
        ans[4*i+1][4*i+2]="c"
        ans[4*i+1][4*i+3]="d"
        ans[4*i+2][4*i]="c"
        ans[4*i+2][4*i+1]="d"
        ans[4*i+2][4*i+2]="a"
        ans[4*i+2][4*i+3]="a"
        ans[4*i+3][4*i]="c"
        ans[4*i+3][4*i+1]="d"
        ans[4*i+3][4*i+2]="b"
        ans[4*i+3][4*i+3]="b"
    for i in range((N-4*r)//5):
        ans[5*i+4*r][5*i+4*r:5*i+4*r+5]=["a","a","b","b","c"]
        ans[5*i+4*r+1][5*i+4*r:5*i+4*r+5]=["b","d","d",".","c"]
        ans[5*i+4*r+2][5*i+4*r:5*i+4*r+5]=["b",".",".","e","b"]
        ans[5*i+4*r+3][5*i+4*r:5*i+4*r+5]=["c",".",".","e","b"]
        ans[5*i+4*r+4][5*i+4*r:5*i+4*r+5]=["c","b","b","a","a"]

for i in range(N):
    print("".join(ans[i]))

Measured memory_bytes: 49884
#![allow(unused_imports)]
#![allow(dead_code)]
use std::io::prelude::*;
use std::cmp::{max, min};

const MOD: i64 = 1e9 as i64 + 7; 

fn main(){
    let a: isize = read();
    let b: isize = read();
    let ans = max(max(a + b, a - b), a * b);
    println!("{}", ans);
}

fn read<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


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

using namespace std;

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

	int n;
	cin >> n;

	string s;
	cin >> s;

	for(auto& c : s) {
		cout << (char)('A' + (c - 'A' + n) % 26);
	}

	cout << '\n';

	return 0;
}

Measured memory_bytes: 256
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
# from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,m=map(int,input().split())
s=list(map(int,input().split()))
t=list(map(int,input().split()))

dp=[[0]*(m+1) for i in range(n+1)]
sumij=[[0]*(m+1) for i in range(n+1)]
for i in range(n):
    for j in range(m):
        if s[i]==t[j]:
            dp[i+1][j+1]=sumij[i][j]+1
        else:
            dp[i+1][j+1]=0
        sumij[i+1][j+1]=(sumij[i][j+1]+sumij[i+1][j]-sumij[i][j]+dp[i+1][j+1])%mod
print((sumij[-1][-1]+1)%mod)
# print(dp)

Measured memory_bytes: 104540
def main():
    n = int(input())
    a = sorted([int(input()) for _ in [0]*n])
    dp = [1]
    DP = [1]
    s = 1
    mod = 998244353
    for i in a:
        dp2 = dp+([0]*i)
        DP2 = DP+([0]*i)
        for j in range(s):
            dp2[i+j] = (dp2[i+j]+2*dp[j]) % mod
            DP2[i+j] = (DP2[i+j]+DP[j]) % mod
        dp = dp2
        DP = DP2
        s += i
    ALL = sum(dp)
    A = sum(dp[(s-1)//2+1:])
    if s % 2 == 1:
        B = DP[s//2]
    else:
        B = 0
    print((3*A-2*ALL+3*B) % mod)


main()


Measured memory_bytes: 136344
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N, K;
  cin>>N>>K;
  ll A[N];
  for(int i=0;i<N;++i) cin>>A[i];
  for(int i=1;i<=N-K;++i) {
    if(A[i-1]<A[K+i-1]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
}



Measured memory_bytes: 5156
S = input()
flag = 1

for i in range(len(S)):
    if i % 2 == 0:
        if S[i] == "L":
            flag = 0
    else:
        if S[i] == "R":
            flag = 0

if flag == 0:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 2940
a,b,n=map(int,input().split())
s=n//b
nmax = (a*n)//b - a*(n//b)
# b_n = b
# b_nn = 0
# while b_n <= n:
#     x = b_n -1
#     t = (a*x)//b - a*b_nn
#     if t > nmax:
#         nmax = t
#     b_n += b
#     b_nn +=1
if s>0:
    x = b*s-1
    t = (a*x)//b - a*(s-1)
    if t > nmax:
        nmax = t
print(nmax)

Measured memory_bytes: 9184
N, K = gets.chomp.split.map(&:to_i)
# S = gets.chomp

# Ex.
# N = 3, K = 10
# Start: 1 or 2 or 3
# If start is 1, 
  # 1, 2, 4, 8, 16, so we have to win 4 times. This is (1/2)^4
# If start is 2,
  # 2, 4, 8, 16, so we have to win 3 times. This is (1/2)^3
# If start is 3,
  # 3, 6, 12, so we have to win 2 times. This is (1/2)^2
# So, ((1/2)^4 + (1/2)^3 + (1/2)^2)/3

pairs = []

r = 0
1.upto(N).each do |n|  # n is start
  i = 0
  while (n < K) do
    n *= 2
    i += 1
  end
  r += 0.5 ** i
end

r /= N

p r

Measured memory_bytes: 1788
#include<cstdio>
#include<string.h>
using namespace std;
int pNum;
bool IsPrime[1000010];
int Prime[1000010];
int GetPrime(int n){
    memset(IsPrime,true,sizeof(IsPrime));
    IsPrime[0]=IsPrime[1]=false;
    pNum=0;
    for(int i=2;i<=n;i++){
        if(IsPrime[i])Prime[++pNum]=i;
        for(int j=1;j<=pNum&&Prime[j]*i<=n;j++){
            IsPrime[Prime[j]*i]=false;
            if(i%Prime[j]==0)break;
        }
    }
    return pNum;
}
int main(){
    int n;
    while(~scanf("%d",&n)){
        printf("%d\n",GetPrime(n));
    }
    return 0;
}

Measured memory_bytes: 3900
a = int(input())
ar = list(map(int,input().split(" ")))
count = 1
n = ""
for i in range(a-1):
    if ar[i] > ar[i+1]:
        if n == "P":
            count += 1
            n = ""
        else:
            n = "M"
    elif ar[i] < ar[i+1]:
        if n == "M":
            count += 1
            n = ""
        else:
            n = "P"
print(count)

Measured memory_bytes: 14224
using System;
using System.Collections.Generic;

public class CSharp
{
    public static void Main()
    {
        Kyopuro chokudai = new Kyopuro();
        chokudai.AtCoder();
    }
}

public class Kyopuro
{

    int n, m, k;

    public void AtCoder()
    {
        string[] input;
        input = Console.ReadLine().Split(' ');
        n = int.Parse(input[0]);
        

        Console.WriteLine(3 * n * n);
    }
    public static void DebugWL(object x) { System.Diagnostics.Debug.WriteLine(x); }
}


Measured memory_bytes: 11092
package main

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

func main() {
	scn := bufio.NewScanner(os.Stdin)
	scn.Split(bufio.ScanWords)
	nextInt := func() int { scn.Scan(); r, _ := strconv.Atoi(scn.Text()); return r }
	w := bufio.NewWriter(os.Stdout)

	h := nextInt()
	a := make([]int, 1, h+1)
	for i := 0; i < h; i++ {
		a = append(a, nextInt())
	}

	for i := 1; i < len(a); i++ {
		fmt.Fprintf(w, "node %d: key = %d, ", i, a[i])
		if i/2 > 0 {
			fmt.Fprintf(w, "parent key = %d, ", a[i/2])
		}
		if i*2 < len(a) {
			fmt.Fprintf(w, "left key = %d, ", a[i*2])
		}
		if i*2+1 < len(a) {
			fmt.Fprintf(w, "right key = %d, ", a[i*2+1])
		}
		fmt.Fprintln(w)
	}

	w.Flush()
}



Measured memory_bytes: 1128
#include <iostream>
using namespace std;
int main(){	
	ios_base::sync_with_stdio(0);
	string s;
	cin >> s;

	int s_len=s.size();
	bool cont=false;
	for(int i=0;i<s_len;i++){
		if(i%2==0){
			if(s[i]=='L'){
				cont=true;
				break;
			}
		}
		else{
			if(s[i]=='R'){
				cont=true;
				break;
			}
		}
	}

	if(cont){
		cout << "No\n";
	}
	else{
		cout << "Yes\n";
	}
}


Measured memory_bytes: 256
//----AUTHOR:kkdrummer----/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include<ext/rope>
using namespace __gnu_cxx;
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<int> C;
#define X real()
#define Y imag()
//typedef unordered_set<ll> usll;
//typedef unordered_multiset<ll> umsll;
typedef multiset<ll> msll;
typedef set<ll> sll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef vector<pair<ll,ll> > vpll;
typedef priority_queue<ll> pqll;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
//typedef unordered_multiset<int> umsi;
//typedef unordered_set<int> usi;
typedef pair<int,int> pi;
typedef vector<pair<int,int> > vpi;
typedef vector<pair<double,double> > vpd;
typedef pair<double,double> pd;
typedef priority_queue<int> pqi;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ind_set;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ind_setll;
#define in insert
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define be begin
#define en end
#define itr iterator
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mo 1000000007
#define inf 1000000000000000001
#define ninf -1000000000000000001
#define ima INT_MAX
#define imi INT_MIN
#define oncnt __builtin_popcount
#define zerobegin __builtin_clz
#define zeroend __builtin_ctz
#define parity __builtin_parity
const ld pii=3.14159265359;
inline ll modpow(ll x,ll n){if(n==0)return 1;if(n==1)return(x%mo);ll u=(modpow(x,n/2));u=(u*u)%mo;if(n%2!=0)u=(u*x%mo)%mo;return u;}
inline ll modinv(ll x){return modpow(x,mo-2);}
inline ll mmul(ll a,ll b){    if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll madd(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a+b>=mo)return(a+b)%mo;return(a+b);}
inline ll msub(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;return((a-b+mo)%mo);}
inline ll mdiv(ll a,ll bb){if(a>=mo)a=a%mo;ll b=modinv(bb);if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll gcd(ll a,ll b){return __gcd(a,b);}


int main()
{
io
int testcases=1;//cin>>testcases;
while(testcases--)
{
int n,k;
cin>>n>>k;
int a[n];
for(int i=0;i<n;i++)
cin>>a[i];
int dp[n];
dp[n-1]=0;

for(int i=n-2;i>=0;i--)
{int mi=ima;
for(int j=i+1;j<=(i+k)&&j<=n-1;j++)
mi=min(mi,abs(a[j]-a[i])+dp[j]);
	dp[i]=mi;
}
cout<<dp[0];

}return 0;}







Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

ll modpow(ll a, ll n, ll m) {
    ll ret = 1;
    ll now = a;
    while (n > 0) {
        if (n % 2 == 1) ret = ret * now % m;
        now = now * now % m;
        n /= 2;
    }
    return ret;
}

ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

vector<vector<int>> g;
vector<int> num;
int dfs(int now, int pre) {
    int ret = 1;
    for (int nxt : g[now]) {
        if (nxt == pre) continue;
        ret += dfs(nxt, now);
    }
    return num[now] = ret;
}

int main() {
    int n;
    cin >> n;
    g.resize(n);
    num.resize(n);
    vector<pair<int, int>> e(n - 1);
    rep(i, n - 1) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
        e[i] = {a, b};
    }

    dfs(0, -1);
    // rep(i, n) cout << num[i] << endl;

    ll ans = 0;
    rep(i, n - 1) {
        int a, b;
        tie(a, b) = e[i];
        ll p = min((ll)num[a], (ll)num[b]);
        ll q = (ll)n - p;
        ans += (MOD + 1 - modpow(modinv(2, MOD), p, MOD)) *
               (MOD + 1 - modpow(modinv(2, MOD), q, MOD));
        ans %= MOD;
    }
    cout << (ans + 1 - modinv(modpow(2, (ll)n, MOD), MOD) - n * modinv(2, MOD) +
             MOD * MOD) %
                MOD
         << endl;
}

Measured memory_bytes: 22400
n = int(input())
an = [int(x) for x in input().split()]
result = [0] * 8
colorful = 0
for a in an:
    if a >= 3200:
        colorful += 1
    else:
        result[a // 400] += 1
color = len([x for x in result if x > 0])
print(max(1, color), color + colorful)


Measured memory_bytes: 3060