akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int[] arr = new int[4];
		Arrays.setAll(arr, i -> 0);
		for(int i=0;i<N;i++) {
			switch(sc.next()) {
			case "AC":
				arr[0]++;
				break;
			case "WA":
				arr[1]++;
				break;
			case "TLE":
				arr[2]++;
				break;
			case "RE":
				arr[3]++;
				break;
			}
		}
		System.out.println("AC x "+arr[0]);
		System.out.println("WA x "+arr[1]);
		System.out.println("TLE x "+arr[2]);
		System.out.println("RE x "+arr[3]);


	}
}

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

using namespace std;

bool tab[100007];

int main()
{
    int N,K;
    cin >> N >> K;
    vector<int>V;
    for(int i=0; i<N; i++)
    {
        int x;
        cin >> x;
        V.push_back(x);
    }
    for(int i=1; i<=K; i++)
    {
        for(int j=0; j<V.size(); j++)
        {
            if(i-V[j]>=0 && !tab[i-V[j]]) tab[i] = true;
        }
    }
    if(tab[K])
        cout << "First";
    else
        cout << "Second";
}

Measured memory_bytes: 384
from bisect import bisect_left

n = int(input())
l = list(map(int, input().split()))

l.sort()
count = 0

for i in range(n - 2) :
    for j in range(i + 1, n - 1) :
        idx = bisect_left(l, l[i] + l[j])
        count += idx - (j + 1)

print(count)

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

int main(){
  int N, K;
  string S;
  cin >> N >> K >> S;
  vector<pair<char,int>> V;
  for(int i = 0; i < N; ++i){
    if(V.empty() or V.back().first != S[i]) V.emplace_back(S[i],1);
    else ++V.back().second;
  }
  int M = V.size();
  vector<int> C(M+1,0);
  for(int i = 0; i < M; ++i){
    C[i+1] = C[i]+V[i].second;
  }
  int L = 2*K, ans = 0;
  for(int i = 0; i < M; ++i){
    if(V[i].first == '1'){
      ans = max(ans,C[min(M,i+L+1)]-C[i]);
    }else{
      ans = max(ans,C[min(M,i+L)]-C[i]);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1652
fn main() {
    let n: u32 = read();
    let mut odd = 0.0;
    for i in 1..n + 1 {
        if i % 2 == 1 {
            odd += 1.0;
        }
    }
    let ans = odd / n as f64;
    println!("{}", ans);
}





//**********************************************************************************************************************************************//

// 標準入力から一行を読み取り、指定の型に変換する関数
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

// 標準入力から一行を読み取り、空白文字で分割し、各要素を指定の型に変換する関数
pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

// 標準入力からn行を読み取り、各行を空白文字で分割し、各要素を指定の型に変換する関数
pub fn read_vec2<T: std::str::FromStr>(n: u64) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

// 10進数での各桁の和
pub fn sum_dights(x: isize) -> isize {
    if x % 10 == 0 {
        return 0
    }
    let m = x % 10;
    m + sum_dights((x - m) / 10)
}

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

using namespace std;

struct Bipartite_Matching
{
  vector< vector< int > > graph;
  vector< int > match, alive, used;
  int timestamp = 0;

  Bipartite_Matching(int n)
  {
    graph.resize(n);
    alive.assign(n, 1);
    used.assign(n, 0);
    match.assign(n, -1);
  }

  void add_edge(int u, int v)
  {
    graph[u].push_back(v);
    graph[v].push_back(u);
  }

  bool dfs(int v)
  {
    used[v] = timestamp;
    for(int i = 0; i < graph[v].size(); i++) {
      int u = graph[v][i], w = match[u];
      if(alive[u] == 0) continue;
      if(w == -1 || (used[w] != timestamp && dfs(w))) {
        match[v] = u;
        match[u] = v;
        return (true);
      }
    }
    return (false);
  }

  int bipartite_matching()
  {
    int ret = 0;
    for(int i = 0; i < graph.size(); i++) {
      if(alive[i] == 0) continue;
      if(match[i] == -1) {
        ++timestamp;
        ret += dfs(i);
      }
    }
    return (ret);
  }

  int back(int k)
  {
    match[match[k]] = -1;
    match[k] = -1;
    ++timestamp;
    dfs(k);
    return (match[k]);
  }

  void decide(int k)
  {
    alive[match[k]] = 0;
    alive[k] = 0;
  }

};

int main()
{
  int N;
  scanf("%d", &N);
  --N;
  Bipartite_Matching flow(N + N);
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < N; j++) {
      int k;
      scanf("%d", &k);
      if(k) flow.add_edge(j, N + i);
    }
  }
  auto get = flow.bipartite_matching();
  if(get < N) {
    cout << "no" << endl;
  } else {
    cout << "yes" << endl;
    for(int i = 0; i < N; i++) {
      printf("%d\n", flow.back(i) - N + 1);
      flow.decide(i);
    }
  }
}

Measured memory_bytes: 3440
#include <iostream>

using namespace std;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if(a != b && a != c)
    {
        cout << a;
    }
    else if(a != b && b != c)
    {
        cout << b;
    }
    else
    {
        cout << c;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    string s;
    cin>>s;
    int n = sz(s);
    ll one = 0;
    ll zero = 0;
    ll ans = 0;
    rep(i, n) {
        if (s[i] == '0') {
            if (one > 0) {
                ans += 2;
                one--;
            }
            else zero++;
        }
        else {
            if (zero > 0) {
                ans += 2;
                zero--;
            }
            else one++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>
#define MAX 2000001
int left(int i);
int right(int i);
int parent(int i);
void maxHeapify(int i);
int extractMax(void);
void increaseKey(int i, int key);
void maxHeapInsert(int key);
int heap[MAX];
int size;

int left(int i){
  return 2*i;
}
  
int right(int i){
  return 2*i+1;
}
 
int parent(int i){
  return i/2;
}
 
void maxHeapify(int i){
  int l, r, x, largest;
  l = left(i);
  r = right(i);
  if( l <= size && heap[l] > heap[i] ){
    largest = l;
  }
  else{ 
    largest = i;
  }
  if( r <= size && heap[r] > heap[largest] ){
    largest = r;
  }
  if( largest != i ){
    x = heap[i];
    heap[i] = heap[largest];
    heap[largest] = x;  
    maxHeapify(largest);
  }
}
 
int extractMax(void){
  int max;
  max = heap[1];
  heap[1] = heap[size];
  size = size - 1;
  maxHeapify(1);
  return max;
}
 
void increaseKey(int i, int key){
  int x;
    heap[i] = key; 
    while( i > 1 && heap[parent(i)] < heap[i] ){
      x = heap[i];
      heap[i] = heap[parent(i)];
      heap[parent(i)] = x;
      i = parent(i);
    }  
}
 
void maxHeapInsert(int key){
  size = size + 1;
  heap[size] = -1;
  increaseKey(size, key); 
}
 
int main(){
  int i, key, max;
  char command[10];  
  while(1){
    scanf("%s", command);
    if( strcmp("end", command) == 0 ) break; 
    else if( strcmp("extract", command) == 0 ){
      max = extractMax();
      printf("%d\n", max);
    }
    else if( strcmp("insert", command) == 0 ){
      scanf("%d", &key);
      maxHeapInsert(key);
    }
    else continue;
  }
  return 0;
}



Measured memory_bytes: 5588
type
  pair = record
    a : longint;
    b : longint;
  end;
	pairArray = array[1..100000] of pair;

var i,j,n,m:longint;
    ans:int64;
    input:pairArray;
    heap:array[0..100000] of longint;
    f, g: text;

procedure swap(var X, Y: longint);
begin
	if X <> Y then begin
		X := X xor Y;
		Y := X xor Y;
		X := X xor Y
	end
end;

procedure	pswap(var a,b:pair);
var tmp:pair;
begin
	tmp:=a;
	a:=b;
	b:=tmp
end;

procedure QuickSort(var a:pairArray;start_index,end_index:longint);
var i,j,x:int64;
begin
	x:=a[(start_index+end_index)div 2].a;
	i:=start_index;
	j:=end_index;
	while(true)do
	begin
		while(a[i].a<x)do i:=i+1;
		while(x<a[j].a)do j:=j-1;
		if(i<j)then
		begin
			pswap(a[i],a[j]);
			i:=i+1;
			j:=j-1;
		end else
		begin
			if(start_index<i-1)then QuickSort(a,start_index,i-1);
			if(j+1<end_index)then QuickSort(a,j+1,end_index);
			exit;
		end;
	end;
end;

procedure upheap(b:longint);
var p:integer;
begin
  heap[0] := heap[0] + 1;
  p := heap[0];
  heap[p] := b;
  while (p>1) and (heap[p]>heap[p div 2]) do begin
    swap(heap[p],heap[p div 2]);
    p := p div 2
  end
end;

function downheap:longint;
var p:integer;
begin
  downheap:=heap[1];
  heap[1] := heap[heap[0]];
  heap[0] := heap[0] - 1;
  p := 1;
  while (p*2 <= heap[0]) and (heap[p]<heap[p*2]) or (p*2+1 <= heap[0]) and (heap[p]<heap[p*2+1]) do
    if (p*2+1 <= heap[0]) and (heap[p*2]<heap[p*2+1]) then begin
      swap(heap[p],heap[p*2+1]);
      p := p*2+1
    end else begin
      swap(heap[p],heap[p*2]);
      p := p*2
    end
end;

begin

  readln(n,m);
  for i := 1 to n do readln(input[i].a,input[i].b);
  QuickSort(input,1,n);
  j := 1;
  ans := 0;
  for i := 1 to m do begin
    while input[j].a=i do begin
      upheap(input[j].b);
      j := j + 1
    end;
    if heap[0]>0 then ans := ans + downheap
  end;
  writeln(ans);
end.


Measured memory_bytes: 1280
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));



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



	int a;
	cin >> a;

	cout << 24 + (24 - a) << endl;

	return 0;
}



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

int main(void) {
	int n, m, F; cin >> n >> m;
	string a[n]; bool flag[m] = { false };
	string b[m];
	int i;
	for (i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (i = 0; i < n; i++) {
		cin >> b[i];
	}
	for (int j = 0; j < n - m + 1; j++) {
		for (i = 0; i < m; i++) {
			if (a[i].find(b[i]) != -1) {
				flag[i] = true;
				F = a[i].find(b[i]);
				j += 1;
				i += F;
			}
		}
	}

	for (i = 0; flag[i] == false&&i<m; i++) {
		if (flag[i] == false) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl; 
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define rep_start(a,i,n) for(ll i=a;i<=n;i++)
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define rev1(i,n) for(ll i=n;i>0;i--)
#define sz(a) int((a).size())
#define all(c) c.begin(),c.end()
#define tr(c,i) for(typeof(c).begin() i+=c.begin; i!=c.end(); i++)
#define present(c,x) (c.find(x)!=c.end())
#define cpresent(c,x) (find(all(c),x)!=c.end())
#define pb push_back
#define F first
#define S second
#define INF INT_MAX
#define mod 1000000007
#define print1(a) cout<<a<<"\n";
#define print2(a,b) cout<<a<<" "<<b<<"\n";
#define print3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n";
#define mt make_tuple
#define eb emplace_back

typedef unsigned long long int ll;
typedef vector<ll> vi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
typedef tuple<int,int,int> State;

void solve(){
    int n,k,d,tmp;cin>>n>>k;
    set<int> s;
    rep(i,k){
        cin>>d;
        rep(j,d) {cin>>tmp; s.insert(tmp);}
    }
    cout<<n-s.size();
}

signed main() {
    // your code goes here
    IOS
    ll t=1;
    //cin>>t;
    rep1(i,t){
        solve(); 
    }
    return 0;
}

Measured memory_bytes: 3672
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		int[] order = new int[n];
		int[] satisfied = new int[n];
		int[] additinalSatisfied = new int[n];
		

		for(int i = 0 ; i < n ; i++ ) {
			order[i] = sc.nextInt();
		}
		
		for(int i = 0 ; i < n ; i++ ) {
			satisfied[i] = sc.nextInt();
		}
		
		for(int i = 0 ; i < n-1 ; i++ ) {
			additinalSatisfied[i+1] = sc.nextInt();
		}
		
		int previousOrder = Integer.MAX_VALUE;
		
		for(int i = 0 ; i < n ; i++ ) {
			if ( previousOrder != order[i] - 1) {
				additinalSatisfied[order[i]-1] = 0;
			}
			previousOrder = order[i];
		}
		
		int sum = 0;
		sum += Arrays.stream(satisfied).sum();
		sum += Arrays.stream(additinalSatisfied).sum();
		
		System.out.println(sum);
		
	}
}


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

int main(){
    int n,ans=0;
    scanf("%d",&n);
    vector <int> l(n);
    for (auto&e:l) scanf("%d",&e);
    sort(l.begin(),l.end());
    for (int i=0;i<n-2;i++) {
        for (int j=i+1;j<n-1;j++) {
            for (int k=j+1;k<n;k++) {
                if (l[i]+l[j]<l[k]) break;
                if (l[k]<l[i]+l[j] && l[i]<l[j]+l[k] && l[j]<l[i]+l[k]) ans+=1;
            }
        }
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;

int main() {
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (i + 1 < s.size() && s[i] == s[i + 1]) {
			cout << i + 1 << " " << i + 2 << endl;
			return 0;
		}
		else if (i + 2 < s.size() && s[i] == s[i + 2]) {
			cout << i + 1 << " " << i + 3 << endl;
			return 0;
		}
	}
	cout << "-1 -1" << endl;
}


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

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using pint = pair<int, int>;
using tint = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

int N, X;
int sr, sc, tr, tc;
int ar[101], ac[101];
int br[101], bc[101];
vint R; // compress
map<int, int> mp; // uncompress
set< pair<pint, pint> > st; // non-exist edge

double base;

double distance(int ar, int br) {
  return (ar == br ? (R[ar]+1)*base : abs(R[ar] - R[br]));
}

double mincost[808][101];

using State = tuple<double, int, int>;

const int dr[] = {0, 1, 0, -1};
const int dc[] = {1, 0, -1, 0};

double dijkstra() {
  priority_queue<State, vector<State>, greater<State> > que;
  fill(mincost[0], mincost[808], DBL_MAX/2);
  que.emplace(0, sr, sc);
  mincost[sr][sc] = 0;
  while(!que.empty()) {
    double cost; int r, c;
    tie(cost, r, c) = que.top(); que.pop();
    if(mincost[r][c] < cost) continue;
    if(r == tr && c == tc) return cost;
    rep(i, 4) {
      int nr = r + dr[i], nc = (c+dc[i]+N)%N;
      if(nr < 0 || R.size() <= nr) continue;
      auto u = make_pair(r, c);
      auto v = make_pair(nr, nc);
      if(st.count(make_pair(u, v))) continue;
      double dist = cost + distance(r, nr);
      if(dist < mincost[nr][nc]) {
	mincost[nr][nc] = dist;
	que.emplace(dist, nr, nc);
      }
    }
  }
  return -1;
}

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  while(cin >> N >> X, N) {
    cin >> sr >> sc >> tr >> tc;
    --sr, --sc, --tr, --tc;
    R.clear();
    R.push_back(0);
    R.push_back(sr);
    R.push_back(tr);
    rep(i, X) {
      cin >> ar[i] >> ac[i] >> br[i] >> bc[i];
      --ar[i], --ac[i], --br[i], --bc[i];
      if(ar[i]) R.push_back(ar[i]-1);
      R.push_back(ar[i]);
      R.push_back(ar[i]+1);
      if(br[i]) R.push_back(br[i]-1);
      R.push_back(br[i]);
      R.push_back(br[i]+1);
    }
    sort(all(R));
    R.erase(unique(all(R)), R.end());
    mp.clear();
    st.clear();
    rep(i, R.size()) mp[R[i]] = i;
    sr = mp[sr], tr = mp[tr];
    rep(i, X) {
      ar[i] = mp[ar[i]], br[i] = mp[br[i]];
      auto u = make_pair(ar[i], ac[i]);
      auto v = make_pair(br[i], bc[i]);
      st.emplace(u, v);
      st.emplace(v, u);
    }
    base = sqrt(2.0-2.0*cos(2.0*acos(-1)/(double)N));
    cout << dijkstra() << endl;
  }

  return 0;
}

Measured memory_bytes: 4364
//
// Created by kuroneko on 2019-09-07.
//

#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>

using namespace std;

typedef long long ll;

#define INF 1000000000000009LL
#define MOD 1000000007LL

typedef int Weight;
struct Edge {
    int src, dst;
    Weight weight;
    Edge(int src, int dst, Weight weight):src(src), dst(dst), weight(weight) {}
};

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

typedef vector<Weight> Array;
typedef vector<Array> Matrix;

ll dp[200005];

void dfs(int src, int node, Graph &g) {
    if (g[node].size() == 0) return ;
    for (auto iter = g[node].begin(); iter != g[node].end(); iter++) {
        if (iter->dst != src) {
            dp[iter->dst] += dp[iter->src];
            dfs(iter->src, iter->dst, g);
        }
    }
}

int main() {
    int N, Q; cin >> N >> Q;
    Graph g(N);
    for (int i = 0; i < N - 1; i++) {
        int a, b; cin >> a >> b;
        g[a-1].push_back(Edge(a-1, b-1, 0));
        g[b-1].push_back(Edge(b-1, a-1, 0));
    }

    for (int i = 0; i < Q; i++) {
        ll p, x; cin >> p >> x;
        dp[p-1] += x;
    }

    dfs(-1, 0, g);
    for (int i = 0; i < N; i++) {
        if (i < N - 1) {
            cout << dp[i] << " ";
        } else {
            cout << dp[i] << endl;
        }
    }
    return 0;

}


Measured memory_bytes: 24320
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
template<class T>
void dmp(T a){
	rep(i,a.size()) cout << a[i] << " ";
	cout << endl;
}
template<class T>
bool chmax(T&a, T b){
	if(a < b){
		a = b;
		return 1;
	}
	return 0;
}
template<class T>
bool chmin(T&a, T b){
	if(a > b){
		a = b;
		return 1;
	}
	return 0;
}

int main(){
	string s; cin >> s;
	int n = s.size();
	bool ok = 1;
	if(n%2 == 1) ok = 0;
	rep(i,n){
		if(i%2 == 0){
			ok &= s[i] == 'h';
		}
		else{
			ok &= s[i] == 'i';
		}
	}
	puts(ok?"Yes":"No");
}

Measured memory_bytes: 256
while True:
    a=0
    n,x=map(int,input().split())
    if n==0 and x==0:
        break
    else:
        for i in range(1,n+1):
            for j in range(i+1,n+1):
                for k in range(j+1,n+1):
                    if x==i+j+k:
                        a+=1
    print(a)
        


Measured memory_bytes: 5596
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
#define IOS ios::sync_with_stdio(false); cin.tie(nullptr);

const int N = 3e5+5;
const int MOD = 1e9+7;

 
int32_t main()
{
	IOS;
 	string s;
	cin >> s;
	int n = s.size(), tot = 0;
	for(int i = 0; i < (1 << (n-1)); i++)
	{
		string temp;
		for(int j = 0; j < n; j++)
		{
			temp += s[j];
			if(i&(1 << j))
			{
				temp += '+';
			}
		}
		int tp = 0, tt = 0;
		for(int j = 0; j <= (int)temp.size(); j++)
		{
			if(j == (int)temp.size())
				tp += tt;
			if(temp[j] == '+')
			{
				tp += tt;
				tt = 0;
			}
			else
				tt = tt*10 + temp[j] - '0';
		}
		tot += tp;
	}
	cout << tot << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
types = {}
for i in A: types[i] = types.get(i, 0) + 1
A = sorted([types[k] for k in types], reverse=True)
L = len(A)
cumsum = [0 for i in range(L+1)]
for i in range(L-1, -1, -1):
    cumsum[i] = A[i] + cumsum[i+1]



def getMidPoint(lo, hi, O):
    if lo >= hi: return lo
    mid = lo + (hi - lo+1) // 2
    if A[mid] > O:
        return getMidPoint(mid, hi, O)
    else:
        return getMidPoint(lo, mid-1, O)

getMid = [getMidPoint(0, L - 1, o) for o in range(N+1)]

# Highest K for given O
def calc(O):
    

    mid = getMid[O]
    if A[mid] < O: mid = - 1
    return (mid+1) + cumsum[mid+1] // O

for K in range(1, N+1):
    def getO(lo, hi):
        if lo >= hi: return lo
        mid = lo + (hi - lo+1) // 2
        if calc(mid) < K:
            return getO(lo, mid - 1)
        else:
            return getO(mid, hi)
        
    print(getO(0, N))
    


Measured memory_bytes: 122060
h, w = map(int, input().split())

# x,yの左からv列を縦に割って、左側を真ん中で横に割った時の答え
def calc(x, y, v):
    c = [v*(y//2), v*(y-y//2), (x-v)*y]
    c.sort()
    return c[2]-c[0]

# 縦横に割った時の差の最小値
def cut(x, y):
    lo = 0
    hi = x
    while hi-lo > 2:
        mid = (hi+lo)//2
        r1 = calc(x, y, mid)
        r2 = calc(x, y, mid+1)
        if r1 < r2:
            hi = mid+1
        else:
            lo = mid
    return min(calc(x, y, hi), calc(x, y, lo), calc(x, y, (hi+lo)//2))

def solve(x, y):
    # 縦横に割った時の最小値と縦だけに割った時の小さい方
    return min(cut(x, y), y)

def Solve(h, w):
    if h*w%3 == 0:
        return 0
    return min(solve(h, w), solve(w, h))

print(Solve(h, w))


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <set>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <map>
#include <cstring>
#include <cmath>
using namespace std;
#define MAXA 1001
#define MAXB 1001
#define MAXH 1000000001
#define MAXW 1000000007
#define INF 1000000007
#define MAXN 100001
#define MAXM 1001
#define MAXP 1000001
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;

ll N, A, B;
ll X[MAXN];
int main(){
    cin >> N >> A >> B;
    for(int i = 0;i < N;i++){
        cin >> X[i];
    }

    ll ans = 0;
    for(int i = 1;i < N;i++){
        if((X[i] - X[i - 1]) * A < B){
            ans += (X[i] - X[i - 1]) * A;
        }else{
            ans += B;
        }
    }

    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define double long double
#define ll long long
#define INF LLONG_MAX/3
#define P pair<int,int>
#define prique priority_queue<int,vector<int>,greater<int>>
#define ggr getchar();getchar();return 0
using namespace std;
int n,a,b,c,d,e;
signed main(){
	cin>>n>>a>>b>>c>>d>>e;
	int cnt=min({a,b,c,d,e});
	cout<<4+(n+cnt-1)/cnt<<endl;
	ggr;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N, M;
	cin >> N >> M;
	vector<int> cnt(M, 0);
	for (int i=0; i < N; ++i) {
		int K; cin >> K;
		for (int j=0; j < K; ++j) {
			int A; cin >> A; --A;
			++cnt[A];
		}
	}
	int ans=0;
	for (int i=0; i < M; ++i) {
		if (cnt[i] == N) {
			++ans;
		}
	}
	cout << ans << endl;
 
	return 0;
}

Measured memory_bytes: 256
N,x = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
count = 0

while a[0] > x:
    count += a[0] - x
    a[0] = x

for i in range(N-1):
    if a[i] + a[i+1] > x:
        count += a[i+1] - (x - a[i])
        a[i+1] = x - a[i]

print(count)



Measured memory_bytes: 14152
s = gets

if s[0] == s[1] && s[2] == s[3] && s[0] != s[2] ||
   s[0] == s[2] && s[1] == s[3] && s[0] != s[1] ||
   s[0] == s[3] && s[1] == s[2] && s[0] != s[1]
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 1788
#include <iostream>
#include <iomanip>
#include <cstdint>
#include <cmath>
#include <climits>
#include <cassert>
#include <string>
#include <string_view>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <functional>
#include <memory>

#define rep(i,n) for(int i = 0; i < (n); ++i)

using namespace std;

template<class T, class U>
istream& operator>>(istream& is, pair<T, U>& pair)
{
    is >> pair.first >> pair.second;
    return is;
}

template<class T>
istream& operator>>(istream& is, vector<T>& collection)
{
    for(auto& item : collection) is >> item;
    return is;
}

template <class T>
T peak_and_pop(std::queue<T>& q)
{
    assert(!q.empty());
    T t = move(q.front());
    q.pop();
    return t;
}

template <class T>
T peak_and_pop(std::priority_queue<T>& q)
{
    assert(!q.empty());
    T t = move(q.top());
    q.pop();
    return t;
}

template <class T>
T peak_and_pop(std::stack<T>& q)
{
    assert(!q.empty());
    T t = move(q.top());
    q.pop();
    return t;
}

void solution()
{
    int64_t a,b,c,k;
    cin >> a >> b >> c >> k;
    if(k <= a){
        cout << k << '\n';
    }else if(k <= a + b){
        cout << a << '\n';
    }else{
        cout << a - (k - a - b) << '\n';
    }
}

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


Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[8] ={1,0,-1,0,1,-1,1,-1};
ll dy[8] ={0,1,0,-1,1,-1,-1,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; }




void solve(){
    ll h,n,a[100010];
    cin>>h>>n;
    rep(i,n) cin>>a[i];
    ll sum=0;
    rep(i,n) sum+=a[i];
    if(sum>=h) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;


}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    
     

    solve(); 


    return 0;
}


Measured memory_bytes: 4420
#include <stdio.h>
#include <string.h>

int main()
{
    int a,b,c;

    scanf("%d %d", &a, &b);
    if (a >= 10 || b >= 10){
        printf("-1");
    } else {
        c = a * b;
        printf("%d",c);
    }
    return(0);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
//type
typedef long long ll;
using pii = pair<int, int>;
using vi = vector<int>;
//x * y * 1.0 can cause overflow
//constant
#define inf (int)(1e9+7)
#define mod (ll)(1e9+7)
#define eps 1e-10
//int dy[] = {0, 0, -1, 1, -1, 1, -1, 1}; //右、左、マイナス、プラス
//int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
//omission
#define eb emplace_back
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define all(v) v.begin(), v.end()
//manip
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end(), v.end());
#define ceil(a, b) a / b + !!(a % b)
template<class T> T power(T a, T b)
{return b ? power(a * a % inf, b / 2) * (b % 2 ? a : 1) % inf : 1;}
#define LB(v, x) (int)(lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (int)(upper_bound(v.begin(), v.end(), x) - v.begin())
//loop
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep3(i, st, n) for (int i = st; i < n; ++i)
//algorithm
//double pointer, l start, how many adds, can be 0 -> init r = l, sum = 0
//bfs, not x, y, i, j
//not !(i % 2), i % 2 == 0



bool comp(pii a, pii b) {
    return a.S < b.S;
}


int main() {
    //cast caution
    //look constraints always
    cin.tie(0); ios::sync_with_stdio(false);
    
    
    
    
    int n, m;
    while (cin >> n && n) {
        cin >> m;
        vector<pii> ALL(n, pii(0, 0));
        vector<pii> only(n, pii(0, 0));
        rep(i, n) {ALL[i].F = i; only[i].F = i;}
        rep(i, m) {
            int s, k; cin >> s >> k;
            
            rep(j, k) {
                int c; cin >> c; c--;
                
                ALL[c].S += s;
                if (k == 1) only[c].S += s;
            }
            
        }
        
        sort(all(ALL), comp);
        sort(all(only), comp);
        
        //cout << endl; rep(i, n) cout << ALL[i].F << " " << ALL[i].S << endl;
        //cout << endl; rep(i, n) cout << only[i].F << " " << only[i].S << endl;
        
        if (ALL[n - 1].F != only[0].F) {
            cout << ALL[n - 1].S - only[0].S + 1 << endl;
        } else {
            cout << max(ALL[n - 1].S - only[1].S + 1, ALL[n - 2].S - only[0].S + 1) << endl;
        }
        
        
        
    }
    
    
    
    
}

/*
 いっちばん解ける人といっちばん解けない人の差
 
 1. いっちばん解ける人
 その人の解けるの全問解ける
 みんなの全問解けた場合考えてその最大
 
 
 
 2. いっちばん解けない人
 その人にしか解けないのだけ
 みんなの、自分しか解けない場合考えてその最小
 
 ただし、1. 2. がかぶったら2番目の人考慮すればいいのかな
 
 
 
 */



Measured memory_bytes: 3220
#include <stdio.h>

int
main(int argc, char *argv[])
{
  int c[3][3];
  for(int i = 0; i < 3; i++) scanf("%d %d %d", &c[i][0], &c[i][1], &c[i][2]);

  int a[2][3], b[3][2];

  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 2; j++){
      a[j][i] = c[j + 1][i] - c[0][i];
    }
  }

  for(int i = 0; i < 2; i++){
    for(int j = 0; j < 3; j++){
      b[j][i] = c[j][i + 1] - c[j][0];
    }
  }

  int s = 0;

  for(int i = 0; i < 2; i++){
    if(a[i][0] == a[i][1] && a[i][1] == a[i][2]) s++;
  }

  for(int i = 0; i < 2; i++){
    if(b[0][i] == b[1][i] && b[1][i] == b[2][i]) s++;
  }

  if(s == 4) printf("Yes\n");
  else printf("No\n");

  return 0;
}
	   


Measured memory_bytes: 128
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#pragma GCC optimize(2)
#define ll long long
using namespace std;
void put(int x){
	if(x<0) {
		putchar('-');
		x*=-1;
	}
	if(x==0) {
		putchar('0');
	}
	int num=0;
	char c[15];
	while(x) {
		c[++num]=(x%10)+48;
		x/=10;
	}
	while(num) {
		putchar(c[num--]);
	}
	putchar('\n');
}
inline void in(int &x){
	char ch=getchar();
	int flag=1;
	while(!(ch>='0'&&ch<='9')) {
		if(ch=='-')
			flag*=-1;
		ch=getchar();
	}
	x=ch-'0';
	ch=getchar();
	while(ch>='0'&&ch<='9') {
		x=((x<<3)+(x<<1))+ch-'0';
		ch=getchar();
	}
	x*=flag;
}
int n,a,maxx;
ll ans;
int b,c; 
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	in(a);in(b);in(c);
	if(b*c>=a)printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 3600
n,*a=map(int,open(0).read().split())
b=[0]*(n+1)
for i in range(1,n+1)[::-1]:
 b[i]+=(sum(b[j] for j in range(i,n+1,i))+a[i-1])%2
print(sum(b))
print(*[i for i in range(n+1) if b[i]>0])

Measured memory_bytes: 17772
#include<bits/stdc++.h>
using namespace std;
char a[105];
int main()
{
	int bj1=0,bj2=0;
	gets(a);
	for(int i=0;i<strlen(a);i++)
	{
		if(a[i]=='C')
		{
			bj1=1;
		}
		if(a[i]=='F'&&bj1)
		{
			bj2=1;
		}
	}
	if(bj1&&bj2)
	{
	 	printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	return 0;
}


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

#define sz(s) (int)(s).size()
#define re(i, n) for (int i = 1; i <= n; i ++)
#define pb push_back
#define finish(x) return cout << x << endl, 0
#define MP make_mair
#define trav(x, a) for(auto& x: a)
#define all(x) (x).begin,(x).end()
#define Sor(x) sort(all(x))
#define REV(x) reverse(all(x))
#define F first
#define S second
#define I insert
#define N 222222
#define MOD 1000000007

using namespace std;

typedef long long ll;
vector <ll> vll;
template <class T> bool umin(T& a, T b) {if(a>b){a = b; return 1;}return 0;}
template <class T> bool umax(T& a, T b) {if(a<b){a=b; return 1;}return 0;}
template <class T, class TT> bool pal(T a, TT n){int k = 0; for(int i =0; i <= n / 2; i ++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

ll powmod(ll a, ll b, ll m = MOD){ll r = 1;while(b>0){if(b&1)r=r*a%m;a=a*a%m;b>>=1;}return r;}


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i ++)
	{
		if (s[i] == '7')
			return cout << "Yes", 0;
	}
	cout << "No";
    
    
    
    
    
    
    
    
}


Measured memory_bytes: 3640
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
namespace ac {
    using namespace std;
}
using namespace std;
using namespace ac;
namespace ac {
    template<typename T> map<T, bool> sieveOfEratosthenes(T n) {
        map<T, bool> res;
        res[0] = false;
        res[1] = false;
        for (size_t i = 2; i <= (size_t)n; i++) {
            res[i] = true;
        }
        // size_t p = 0;
        for (size_t i = 2; i <= (size_t)n; i++) {
            if (res[i]) {
                // prime[p++] = i;
                for (size_t j = 2 * i; j <= (size_t)n; j += i) {
                    res[j] = false;
                }
            }
        }
        return res;
    }
}
int l[100005];
int r[100005];
int table2017[100005];
struct Solution {
    void solve(std::istream& in, std::ostream& out) {
        int n;
        int ma = 0;
        in >> n;
        for (int i = 0; i < n; i++) {
            in >> l[i] >> r[i];
            ma = max(ma, r[i]);
        }
        auto s = sieveOfEratosthenes(ma + 1);
        for (int i = 1; i <= ma; i++) {
            table2017[i] = (s[i] && s[(i + 1) / 2]) + table2017[i - 1];
        }
        for (int i = 0; i < n; i++) {
            int ans = 0;
            ans = table2017[r[i]] - table2017[l[i] - 1];
            out << ans << '\n';
        }
    }
};
void solve(std::istream& in, std::ostream& out) {
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}
#include <fstream>
#include <iostream>
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    istream& in = cin;
    ostream& out = cout;
    solve(in, out);
    return 0;
}


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

using namespace std;

typedef long long LL;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int main(){
	int R,G,B,N; cin >> R >> G >> B >> N;
	int ans = 0;
	repp(i,0,N+1) repp(j,0,N+1){
		if((N-R*i-G*j) >= 0 && (N-R*i-G*j)%B == 0) ++ans;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
N, X, Y = map(int, input().split(' '))

dist_list = [0] * N

for i in range(1,N):
    for j in range(i+1,N+1):
        d1 = abs(X - i) + 1 + abs(Y - j)
        d2 = j - i
        dist = min(d1,d2)
        dist_list[dist] += 1

for k in range(1,N):
    print(dist_list[k])


Measured memory_bytes: 48220
package main

import (
	"fmt"
)

func main() {
	var k, a, b int
	_, _ = fmt.Scan(&k)
	_, _ = fmt.Scanf("%d %d", &a, &b)

	fmt.Println(answer165A(k, a, b))
}

func answer165A(k int, a int, b int) string {
	for i := a; i <= b; i++ {
		if i%k == 0 {
			return "OK"
		}
	}
	return "NG"
}


Measured memory_bytes: 1832
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String str = sc.next();
        int ans = 0;

        for (int i = 0; i < N-2; i++) {
            if (str.substring(i, i+3).equals("ABC")) {
                i = i + 2;
                ans++;
            }
        }

        System.out.println(ans);

        sc.close();
    }    
}


Measured memory_bytes: 23764
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int main()
{
	long long int n, m;
	long long int l;
	cin >> n >> m >> l;
	vector<vector<long long int> > cost(300, vector<long long int>(300, mod));
	for(int i = 0; i < n; i++){
		cost[i][i] = 0;
	}
	for(int i = 0; i < m; i++){
		int a, b, c;
		cin >> a >> b >> c;
		a--;
		b--;
		if(c <= l) cost[a][b] = cost[b][a] = c;
	}
	for(int k = 0; k < n; k++){
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
			}
		}
	}
	vector<vector<long long int> > result(300, vector<long long int>(300, mod));
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			if(cost[i][j] <= l) result[i][j] = 1;
		}
	}
	for(int k = 0; k < n; k++){
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				result[i][j] = min(result[i][j], result[i][k] + result[k][j]);
			}
		}
	}
	int q;
	cin >> q;
	for(int i = 0; i < q; i++){
		int s, t;
		cin >> s >> t;
		s--;
		t--;
		if(result[s][t] == mod) cout << -1 << endl;
		else cout << result[s][t] - 1 << endl;
	}
}


Measured memory_bytes: 1920
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 210000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ
int x[3100];
int y[3100];
pair<int,int>p[3100];
long long dp[3100];
int main(){
	int a,b,c;scanf("%d%d%d",&a,&b,&c);
	for(int i=0;i<c;i++)scanf("%d%d",x+i,y+i);
	init_C(210000);
	for(int i=0;i<c;i++)p[i]=make_pair(x[i]-1,y[i]-1);
	p[c]=make_pair(a-1,b-1);
	std::sort(p,p+c+1);
	for(int i=0;i<c+1;i++){
		long long tmp=Comb(p[i].first+p[i].second,p[i].first);
		for(int j=0;j<i;j++){
			if(p[j].first<=p[i].first&&p[j].second<=p[i].second)
				tmp=(tmp+mod-dp[j]*Comb(p[i].first-p[j].first+p[i].second-p[j].second,p[i].first-p[j].first)%mod)%mod;
		}
		dp[i]=tmp;
	}
	printf("%lld\n",dp[c]);
}


Measured memory_bytes: 10112
import java.util.*;
import java.io.*;

public class Main {
	
	public static void main (String[] args) {
	   InputReader in = new InputReader(System.in);
	   int n = in.readInt();
	   Deque<Integer> dq = new LinkedList<Integer>();
	   for(int i = 1; i<=n; i++) {
		   int x = in.readInt();
		   if(i%2 == n%2) {
			   dq.push(x);
		   }
		   else dq.addLast(x);
	   }
	   for(Integer i : dq) {
		   System.out.print(i+" ");
	   }
	}
}

class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return readString();
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}


Measured memory_bytes: 58232
typedef struct point{
    int x_elem;
    int y_elem;
}point;

#include <stdio.h>

int main(void) {
  point point[4], diff;

  scanf("%d %d %d %d", &point[0].x_elem, &point[0].y_elem, &point[1].x_elem, &point[1].y_elem);

  diff.x_elem = point[1].x_elem - point[0].x_elem;
  diff.y_elem = point[1].y_elem - point[0].y_elem;

  point[2].x_elem = point[1].x_elem - diff.y_elem;
  point[2].y_elem = point[1].y_elem + diff.x_elem;

  point[3].x_elem = point[2].x_elem - diff.x_elem;
  point[3].y_elem = point[2].y_elem - diff.y_elem;

  printf("%d %d %d %d\n", point[2].x_elem, point[2].y_elem, point[3].x_elem, point[3].y_elem);

  return 0;
}

Measured memory_bytes: 1736
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<((ll)n);i++)
#define rep1(i,n) for(ll i=1;i<=((ll)n);i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define meow(a) cout<<a<<" meow\n";
typedef pair<long long,long long> pii;
const ll maxn=200005;
const ll MOD=998244353;
double mypow(ll a,ll b){
	double res=1;
	while(b){
		if(b&1) res=res*a;
		a=a*a;

		b>>=1;
	}
	return res;
}
ll n,k;
string s;
ll a[maxn];

int main()
{
    //IOS;
    while(cin>>n>>k)
    {
        double ans=0;
        for(int i=1;i<=n;i++)
        {
            int div=0;
            //double res=1;
            while(i*(1<<div)<k)
            {
                div++;

            }
            //cout<<i<<" "<<div<<"\n";
            double res=1/double(1<<div);
            //cout<<res<<"\n";
            ans+=res;
        }
        cout<<fixed<<setprecision(9)<<ans/n<<"\n";
    }
    return 0;
}


Measured memory_bytes: 256
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
using ll = long long;
using P = pair<ll,ll>;

int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n){
        cin >> a[i];
    }
    ll ans = 0;
    ll r = 0, sum = 0;
    for (ll l = 0; l < n; l++)
    {
        for (; r < n && ((sum ^ a[r]) == (sum + a[r])); r++)
        {
            sum += a[r];
        }
        ans += r - l;
        sum -= a[l];
    }
    cout << ans << endl;
}


Measured memory_bytes: 4764
#ifdef MY_LOCAL
#define MY_NAMESPACE(ns) namespace ns {
#define MY_NAMESPACE_    }
#define MY_DEBUG(s)      s
#else
#define MY_NAMESPACE(ns) 
#define MY_NAMESPACE_    
#define MY_DEBUG(s)      
#endif

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define EPS (1e-7)
#define IINF ((int)1e9)


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

	int h, w, k;
	cin >> h >> w >> k;
	vector<vector<char>> c(h, vector<char>(w));
	for (int ii = 0; ii < h; ii++)
	{
		for (int jj = 0; jj < w; jj++)
		{
			cin >> c[ii][jj];
		}
	}

	int res = 0;
	for (int i = 0; i < (1 << h); i++)
	{
		for (int j = 0; j < (1 << w); j++)
		{
			int num_black = 0;
			for (int ii = 0; ii < h; ii++)
			{
				if (((i >> ii) & 1) != 1)
				{
					for (int jj = 0; jj < w; jj++)
					{
						if (((j >> jj) & 1) != 1)
						{
							if (c[ii][jj] == '#')
								num_black++;
						}
					}
				}
			}
			if (num_black == k)
				res++;
		}
	}
	cout << res << "\n";
	return 0;
}
MY_NAMESPACE_

Measured memory_bytes: 3652