akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (ll i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;

int main()
{
    int N, K;
    cin >> N >> K;
    vector<ll> A(N), C;

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

    ll nax = 0;

    rep(i, N) {
        C.push_back(A[i]);
        ll sum = A[i];
        repd(j, i + 1, N) {
            sum += A[j];
            C.push_back(sum);
            chmax(nax, sum);
        }
    }

    ll st;
    set<ll> ansset;
    for (ll bit = 1; bit <= nax; bit <<= 1) {
        ll cnt = 0;
        rep(i, C.size()) {
            if (C[i] & bit) {
                cnt++;
            }
        }
        if (cnt >= K) {
            st = bit;
        }
    }

    rep(i, C.size()) {
        if (C[i] & st) {
            ansset.insert(C[i]);
        }
    }

    for (ll bit = st; bit > 0; bit >>= 1) {
        ll cnt = 0;
        for (auto itr = ansset.begin(); itr != ansset.end(); itr++) {
            if (*itr & bit) {
                cnt++;
            }
        }
        set<ll> tmp;
        if (cnt >= K) {
            for (auto itr = ansset.begin(); itr != ansset.end(); itr++) {
                if (*itr & bit) {
                    tmp.insert(*itr);
                }
            }
            ansset = tmp;
            tmp.clear();
        }
    }

    ll ans = 0;
    for (auto itr = ansset.begin(); itr != ansset.end(); itr++) {
        if (ans == 0) {
            ans = *itr;
        }
        else {
            ans &= *itr;
        }
    }

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

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

import sys

for s in sys.stdin:
  d = map( float, s.split() )
  det = d[0]*d[4]-d[1]*d[3]
  x = ( d[4]*d[2]-d[1]*d[5] ) / det
  y = ( -d[3]*d[2]+d[0]*d[5] ) / det
  if x == 0:
    x = 0
  if y == 0:
    y = 0
  print "%.3f %.3f" % ( x, y )

Measured memory_bytes: 4240
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>

using namespace std;

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

    if (n%11 > 6) {
        cout << n/11*2+2 << endl;
    }
    else if (n%11 == 0) {
        cout << n/11*2 << endl;
    }
    else if (n%11 <= 6) {
        cout << n/11*2+1 << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

int main(){
  string S;
  cin >> S;
  ll N = S.size();

  ll cnt = N - 1;

  while(true){
    if((cnt >= 6) && (S.substr(cnt - 6, 7) == "dreamer")) cnt -= 7;
    else if((cnt >= 5) && (S.substr(cnt - 5, 6) == "eraser")) cnt -= 6;
    else if((cnt >= 4) && (S.substr(cnt - 4, 5) == "dream")) cnt -= 5;
    else if((cnt >= 4) && (S.substr(cnt - 4, 5) == "erase")) cnt -= 5;
    else if(cnt == -1){
      cout << "YES" << endl;
      return 0;
    } else{
      cout << "NO" << endl;
      return 0;
    }    
  }
  
  return 0;
}

Measured memory_bytes: 512
using System;

namespace ConsoleApp_ITP1_3_C
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            var startNum = Int32.Parse(input[0]);
            var endNum = Int32.Parse(input[1]);
            var dividedNum = Int32.Parse(input[2]);
            var counter = 0;

            for (int i = startNum; i <= endNum; i++)
            {
                var rest = dividedNum % i;
                if (rest == 0)
                    counter++;
            }

            Console.WriteLine(counter);
        }
    }
}



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

int main() {
    long n;
    cin >> n;
    long ans = 0;
    for (long i = 1; i * i < n; i++) {
        if (n % i == 0) {
            long m = n / i - 1;
            if (n / m == n % m) {
                ans += n / i - 1;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N, M, K = LI()
    A=  LI()
    B = LI()
    cumA = [0] * (N+1)
    cumB = [0] * (M + 1)
    for i in range(N):
        cumA[i+1] = cumA[i] + A[i]

    for j in range(M):
        cumB[j+1] = cumB[j] + B[j]

    ans = 0
    for read_a in range(N+1):
        left = K - cumA[read_a]
        if left < 0:
            continue
        if left == 0:
            ans = max(ans, read_a)
            continue
        # print('read_a: ', read_a)
        # print('cumA[read_a]: ', cumA[read_a])
        # print('left: ', left)
        # print('cumB: ', cumB)
        ix = bisect.bisect_right(cumB, left)
        # print('ix: ', ix)
        ans = max(ans, read_a + (ix - 1))
        # print()
    print(ans)

main()



Measured memory_bytes: 119560
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
#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 REP(i, n) FOR(i,0,n)
#define INF 1e9
const int MOD = 1000000007;
typedef pair<ll,ll> P;

int main(void){
    int n,cnt = 0;
    bool ok = false;
    cin >> n;
    int d[110][2];
    REP(i,n){
        int d1,d2;
        cin >> d1;
        cin >> d2;
        if(d1 == d2) cnt++;
        else cnt = 0;

        if(cnt == 3) ok = true;
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3644
import math
from collections import Counter
def pf(n):
    l = []
    while n % 2 == 0: 
        l.append(2)
        n = n / 2
    for i in range(3,int(math.sqrt(n))+1,2): 
        while n % i== 0: 
            l.append(i)
            n = n / i 
    if n > 2: 
        l.append(n)
    return l
def count(n):
    i = 1
    sum = 0
    while sum <= n:
        sum += i
        i+=1
    return (i-2)
n = int(input())
l = Counter(pf(n))
ans = 0
for x in l:
    ans += count(l[x])
print (ans)


Measured memory_bytes: 9548
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int,int> PP;

/*
    freopen("input","r",stdin);
    freopen("output","w",stdout);
*/

char G[52][2];

bool check(int n, int a, int b, int c, int d) {
	if (G[n - 1][0] == G[n - 1][1] && a != b) return 0;
	if (G[n - 1][0] != G[n - 1][1] && a == b) return 0; 
	if (G[n][0] == G[n][1] && c != d) return 0;
	if (G[n][0] != G[n][1] && c == d) return 0;
	if (G[n - 1][0] == G[n][0] && a != c) return 0;
	if (G[n - 1][0] != G[n][0] && a == c) return 0;
	if (G[n - 1][1] == G[n][1] && b != d) return 0;
	if (G[n - 1][1] != G[n][1] && b == d) return 0;
	return 1;
}

int main() {
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    for (int i = 0;i < N;i++) cin >> G[i][0];
    for (int i = 0;i < N;i++) cin >> G[i][1];
    ll MOD = 1E9 + 7;
    ll DP[53][9];
    memset(DP, 0, sizeof(DP));
    if (G[0][0] == G[0][1]) {
    	DP[0][0] = 1; // 00
    	DP[0][4] = 1; // 11
    	DP[0][8] = 1; // 22
    }
    else {
    	DP[0][1] = 1; // 01
    	DP[0][2] = 1; // 02
    	DP[0][3] = 1; // 10
    	DP[0][5] = 1; // 11
    	DP[0][6] = 1; // 20
    	DP[0][7] = 1; // 21
    }
    for (int i = 1;i < N;i++) {
    	for (int a = 0;a < 3;a++) {
    		for (int b = 0;b < 3;b++) {
    			for (int c = 0;c < 3;c++) {
    				for (int d = 0;d < 3;d++) {
    					if (check(i, a, b, c, d)) {
    						DP[i][c * 3 + d] += DP[i - 1][a * 3 + b];
    						DP[i][c * 3 + d] %= MOD;
    					}
    				}
    			}
    		}
    	}
    }
    ll sol = 0;
    for (int i = 0;i < 9;i++) {
    	sol += DP[N - 1][i];
    	sol %= MOD;
    }
    cout << sol << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	ll n;
	string s;
	cin >> n >> s;
	ll ans = 0;
	zep(i, 0, n-2){
		if(s.substr(i, 3) == "ABC"){
			ans++;
		}
	}
	print(ans)
	return 0;
}

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

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a, i##_len=(b); i<i##_len; i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

#define all(box) box.begin(), box.end()

using namespace std;

using P = pair<int,int>;
using ll = long long;

const long long INF = LLONG_MAX/3;

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; }
inline void Yes (bool condition) { if(condition) { cout << "Yes" << endl; } else { cout << "No" << endl;} }

struct UnionFind{
	std::vector<int> par,siz;
	void init(int n){
		par.resize(n);
		for(int i=0;i<n;i++)par[i]=i;
		siz.resize(n,1);
	}
	UnionFind(int n){
		init(n);
	}
	int root(int n){
		if(par[n]==n)return n;
		else return par[n]=root(par[n]);
	}
	bool issame(int x,int y){
		return (root(x)==root(y));
	}
	bool marge(int a,int b){
		if(issame(a,b))return false;
		else{
			a=root(a),b=root(b);
			if(siz[a]<siz[b])swap(a,b);
			siz[b]+=siz[a];
			par[a]=par[b];
			return true;
		}
	}
	int size(int n){
		return siz[root(n)];
	}
};

long long gcd(long long a,long long b){
    if(b==0)return a;
    return gcd(b,a%b);
}
long long lcm(long long i,long long j){
    return i*(j/gcd(i,j));
}

const int MOD=998244353;
long long fac[510000], finv[510000], inv[510000];
long long MAX=510000;
bool COMinited=false;
long long COM(int n, int k){
	if(COMinited==false){
		fac[0] = fac[1] = 1;
    	finv[0] = finv[1] = 1;
    	inv[1] = 1;
    	for (int i = 2; i < MAX; i++){
        	fac[i] = fac[i - 1] * i % MOD;
        	inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        	finv[i] = finv[i - 1] * inv[i] % MOD;
    	}
		COMinited=true;
	}
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}
template< typename T >
struct BinaryIndexedTree {
  vector< T > data;

  BinaryIndexedTree(int sz) {
    data.assign(++sz, 0);
  }

  T sum(int k) {
    T ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return (ret);
  }

  void add(int k, T x) {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};
signed main(){
	int n,m;
	cin>>n>>m;
	int w[110],v[110];
	rep(i,n){
		cin>>w[i]>>v[i];
	}
	int dp[100010];
	dp[0]=0;
	rep(i,1,100010)dp[i]=INF;
	rep(i,1,n+1){
		for(int j=100009;j>=v[i-1];j--){
			if(dp[j-v[i-1]]<INF){
				
				chmin(dp[j],dp[j-v[i-1]]+w[i-1]);
			}
		}
	}
	int ret=0;
	rep(i,100010)if(dp[i]<=m)chmax(ret,i);
	cout<<ret<<endl;
}

Measured memory_bytes: 1024
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define ANS(ans) cout<<(ans)<<endl;
typedef vector<int> VI;


//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)


int main() {

	string s;
	cin >> s;

	int plus = 0;
	int minus = 0;

	REP(i, 4) {
		if (s[i] == '+') {
			plus++;
		}
		else {
			minus++;
		}
	}


	ANS(plus - minus);

	return 0;
}



Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
from copy import deepcopy
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

va=I()
if va==1:
    print(4)
    sys.exit()
if va==2:
    print(4)
    sys.exit()
if va==4:
    print(4)
    sys.exit()
else:
    for i in range(1,10**6+10):
        if va%2==0:
            va=va//2
        else:
            va=3*va+1
        if va==4:
            print(i+4)
            sys.exit()

Measured memory_bytes: 3436
import java.util.*;

public class Main {

	private void doit(){
		Scanner sc = new Scanner(System.in);
		long mod = 1000000007;
		while(sc.hasNext()){
			String s = sc.next();
			char [] data = s.toCharArray();
			
			int ind = 0;
			StringBuilder sb = new StringBuilder();
			
			for(int i = 0; i < data.length; i++){
				char c = data[i];
				if(c == '0'){
					sb.append(c);
					ind++;
				}
				else if(c == '1'){
					sb.append(c);
					ind++;
				}
				else{
					ind--;
					if(ind < 0){
						ind++;
						continue;
					}
					
					sb.deleteCharAt(ind);
				}
			}
			
			System.out.println(sb.toString());

		}

	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().doit();
	}

}


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

typedef struct{
  int num;
  bool kanousei;
} Data;

int main(){
  int n,m;
  Data data[100000];
  cin >> n >> m;

  for(int i = 0;i < n;i++){
    data[i].num = 1;
    data[i].kanousei = false;
  }

  data[0].kanousei = true;
  int x, y;
  for(int i = 0;i < m;i++){
    cin >> x >> y;
    x--; y--;
    data[x].num--;
    data[y].num++;
    if(data[x].kanousei){
      if(data[x].num == 0){
        data[x].kanousei = false;
      }
      data[y].kanousei = true;
    }
  }

  int ans = 0;
  for(int i = 0;i < n;i++){
    if(data[i].kanousei) ans++;
  }

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






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

int main(){
  ll a,b,c;
  cin>>a>>b>>c;
  ll d = c - a - b;
  if(d > 0 && d * d > 4 * a * b){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

using namespace std;

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


struct E {
	int p;
	int a;
	int b;
	bool operator<(const E &left) const {

		return p < left.p;
	}
};

int main() {
	int H, W;
	cin >> H >>  W;
	string s[H];

	vector<pair<int, int> > cur;

	rep(i , H) {
		cin >> s[i];
	}

	int black_count = 0;
	int count = 0;


	rep(y, H) {
		rep(x, W) {
			if (s[y][x] == '#') {
				cur.push_back(make_pair(y, x));
				black_count++;
			}

		}
	}
	while(true) {
		//cout << black_count << endl;
		if (black_count == W * H) {
			break;
		}
		count++;
		vector<pair<int, int> > next;
		for (auto p : cur) {
			int y = p.first;
			int x = p.second;
			int dx[] = {1,-1,0,0}; 
			int dy[] = {0,0,1,-1}; 

			rep(i, 4) {
				int nx = x + dx[i];
				int ny = y + dy[i];
				if (nx < 0 || nx >= W || ny < 0 || ny >= H)
					continue;
				if (s[ny][nx] == '.') {
					s[ny][nx] = '#';
					next.push_back(make_pair(ny,nx));
					black_count++;
				} 
			}
		}
		cur = next;
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 14440
#ifdef _MSC_VER
#  define _CRT_SECURE_NO_WARNINGS
#  define _USE_MATH_DEFINES
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

#include <bits/stdc++.h>
using namespace std;
using i32 = int; using i64 = long long int; using f64 = double; using str = string;
using u32 = unsigned int; using u64 = unsigned long long int;
template <class T> using vec = vector<T>;
void in(){}; template <class T, class...TS> void in(T &&x, TS &&...xs) { cin >> x; in(move(xs)...); };
template <class T> void out(T &&x) { cout << x << "\n"; }; template <class T, class...TS> void out(T &&x, TS &&...xs) { cout << x << " "; out(move(xs)...); }
#define indef(t, ...) t __VA_ARGS__; in(__VA_ARGS__)
#define get(t) []{ t _; cin >> _; return _; }()
#define times(n, i) for (i32 i =  0 ; i < (n); ++i)
#define range(a, b, i) for (i32 i = (a); i < (b); ++i)
#define upto(a, b, i) for (i32 i = (a); i <= (b); ++i)
#define downto(a, b, i) for (i32 i = (a); i >= (b); --i)
#define all(xs) (xs).begin(), (xs).end()
#define sortall(xs) sort(all(xs))
#define reverseall(xs) reverse(all(xs))
#define even(x) ((abs(x) & 1) == 0)
#define odd(x) ((abs(x) & 1) == 1)
#define bit(x, i) (((x) >> i) & 1)
#define append emplace_back
#define findge lower_bound
#define findgt upper_bound
const i64 MOD = 1000000007ll;
const f64 EPS = 1e-10;

i32 solve() {
    indef(i64, n, m);
    if (abs(n-m) > 1) return 0;

    i64 a = 1, b = 1;
    downto(n, 1, ni) {
        a = (a * ni) % MOD;
    }
    downto(m, 1, mi) {
        b = (b * mi) % MOD;
    }
    if (n == m)
        return (a * b * 2) % MOD;
    else
        return (a * b) % MOD;
}

i32 main()
{
    ios::sync_with_stdio(false);

#ifdef _MSC_VER
    /**
    ifstream fin("input.txt"); cin.rdbuf(fin.rdbuf()); assert(fin);
    ofstream fout("output.txt"); cout.rdbuf(fout.rdbuf()); assert(fout);
    /**/
#endif

    out(solve());

    return 0;
}

Measured memory_bytes: 256
<?php
    while (true) {
        $num = trim(fgets(STDIN));
        if (strlen($num <= 3)){
                break;
        }
        $hit = 0;
        $brow = 0;
        $num = str_split($num);
        for($i = 0; $i < 4; $i++){
            if($num[$i] == $num[5]){
                $brow++;
            }elseif($num[$i] == $num[6]){
                $brow++;
            }elseif($num[$i] == $num[7]){
                $brow++;
            }elseif($num[$i] == $num[8]){
                $brow++;
            }
        }
        if ($num[0] == $num[5]) {
            $hit++;
            $brow--;
        }
        if ($num[1] == $num[6]) {
            $hit++;
            $brow--;
        }
        if ($num[2] == $num[7]) {
            $hit++;
            $brow--;
        }
        if ($num[3] == $num[8]) {
            $hit++;
            $brow--;
        }
            echo $hit . " " . $brow . "\n";
    }


Measured memory_bytes: 9240
import sys
import math

def str_input():
    S = raw_input()
    if S[len(S)-1] == "\r":
        return S[:len(S)-1]
    return S

def float_to_str(num):
    return str("{:.10f}".format(num))

def list_input(tp):
    return map(tp, str_input().split())

# # # # # # # # # # # # # # # # # # # # # # # # #

class Dice:
    pip = [0 for i in xrange(6)]

    def __init__(self, arg):
        self.pip = arg

    def rollDir(self, dr):
        nextPip = [0 for i in xrange(6)]
        if dr == "N":
            nextPip[0] = self.pip[1]
            nextPip[1] = self.pip[5]
            nextPip[2] = self.pip[2]
            nextPip[3] = self.pip[3]
            nextPip[4] = self.pip[0]
            nextPip[5] = self.pip[4]
        elif dr == "E":
            nextPip[0] = self.pip[3]
            nextPip[1] = self.pip[1]
            nextPip[2] = self.pip[0]
            nextPip[3] = self.pip[5]
            nextPip[4] = self.pip[4]
            nextPip[5] = self.pip[2]
        self.pip = nextPip

    def roll(self, dr):
        if dr == "N" or dr == "E":
            self.rollDir(dr)
        elif dr == "S":
            self.rollDir("N")
            self.rollDir("N")
            self.rollDir("N")
        elif dr == "W":
            self.rollDir("E")
            self.rollDir("E")
            self.rollDir("E")

dice = Dice(list_input(int))
command = str_input()

for x in command:
    dice.roll(x)

print dice.pip[0]

Measured memory_bytes: 6512
#include<bits/stdc++.h>
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define A first
#define B second
#define make_pair MP
#define MOD 1000000007
#define MAXM 100005
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef long long ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int mulmd(ll a, ll b){
    ll ret = (a * b) % MOD;
    return (int)ret;

}

inline int power(ll x, ll y, int p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = mulmd(res,x);
        y = y>>1;
        x = mulmd(x,x);
    }
    return (int)res;
}

int submd(ll a, ll b){
    ll ret = a-b;
    if(ret<0){
        ret+=MOD;
    }
    return (int)ret;
}

int addmd(ll a, ll b){
    ll ret = (a + b) % MOD;
    return (int)ret;
}

int phi(int n){
    int result = n;
    for(int i=2;i*i<=n;i++){
        if(n%i==0){
            while(n%i==0){
                n=n/i;
            }
            result-=result/i;
        }
    }
    if(n>1) result-=result/n;
    return result;
}

int gcd(int a, int b, int& x, int& y){
    if(a==0){
        x=0;
        y=1;
        return b;
    }
    int x1,y1;
    int d = gcd(b%a, a, x1, y1);
    x = y1 - (b/a)*x1;
    y = x1;
    return d;
}

int arr[100005];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    vector<ll>h(n);
    vector<ll>sap(n);
    REP(i,n){
    cin>>h[i];
    sap[i]=0;
    }
    int c=0;
    REP(i,n-1)
    {
        if(h[i]<h[i+1]){
            sap[i]=c;
            c=0;
        }
        else
            c++;
    }
    sap[n-1]=c;
    //REP(i,sap.size())
    //cout<<sap[i]<<" ";
    int maxi=0;
    REP(i,n)
    {
        if(sap[i]>maxi)
            maxi=sap[i];
    }
    //cout<<"\n";
    cout<<maxi;
}


Measured memory_bytes: 1792
import core.bitop, std.bitmanip;
import core.checkedint;
import std.algorithm, std.functional;
import std.array, std.container;
import std.bigint;
import std.conv;
import std.math, std.numeric;
import std.range, std.range.interfaces;
import std.stdio, std.string;
import std.typecons;

void main()
{
    int a, b;
    readf("%s %s", &a, &b);
    readln;
    
    auto ans = (b-1 + (a-1)-1) / (a-1);
    
    ans.writeln;
}

Measured memory_bytes: 256
while 1:
    M, N = map(int, input().split())
    if M == N == 0:
        break
    W = [int(input()) for i in range(N)]
    left = max(W)-1; right = sum(W)
    while left+1 < right:
        mid = (left + right) >> 1
        k = 1; cur = 0
        for w in W:
            if mid < cur+w:
                cur = w
                k += 1
            else:
                cur += w
        if k <= M:
            right = mid
        else:
            left = mid
    print(right)


Measured memory_bytes: 5600
#include <stdio.h>

void trace(int*,int);
void insertionSort(int*,int);
int main()
{
  int hiroshi,mika,takuro,i,j,k;
  int takeshi[1000];

  scanf("%d",&k);
  for(i=0;i<k;i++)
    scanf("%d",&takeshi[i]);
    trace(takeshi,k);
    insertionSort(takeshi,k);
  
    return 0;
}

void trace(int takeshi[],int k){
  int i;
  for(i=0;i<k;i++){
    if(i>0)printf(" ");
    printf("%d",takeshi[i]);
  }
  printf("\n");
}

void insertionSort(int takeshi[],int k){
  int j,mika,takuro;
  for(j=1;j<k;j++){
    takuro=takeshi[j];
    mika=j-1;
    while(mika>=0 && takeshi[mika]>takuro){
      takeshi[mika+1]=takeshi[mika];
      mika--;
    }
    takeshi[mika+1]=takuro;
    trace(takeshi,k);
  }
}



Measured memory_bytes: 2040
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//写経AC
int main(){
 ll N; cin >> N;
  vector<ll> A(N); for(ll i = 0; i < N; i++){ cin >> A[i]; A[i]--;}
  vector<ll> idx(N); for(ll i = 0; i < N; i++){ idx[A[i]] = i;}
  set<ll> s;
  ll ans = 0;
  for(ll x = N-1; x >= 0; x--){
    ll i = idx[x];
    ll c = 0;
    {
      s.insert(i);
      vector<ll> l(2,-1); vector<ll> r(2,N);
      {
        auto it = s.find(i);
        for(ll j = 0; j < 2; j++){
          if( it == s.begin()){ break;}
          it--;
          l[j] = *it;}
      }
      { 
        auto it = s.find(i);
        for(ll j = 0; j < 2; j++){
          it++;
          if( it == s.end()){ break;}
          r[j] = *it;}
      }
      
      c += (i-l[0])*(r[1]-r[0]) + (l[0]-l[1])*(r[0]-i);
    }
    ans += c*(x+1);
  }
  
  cout << ans << endl; return 0;}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ll long long
#define db double
#define el "\n"
#define ld long double
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n;i>=0;i--)
#define rep_a(i,a,n) for(int i=a;i<n;i++)
#define tr(ds, it) for(auto it=ds.begin(); it!=ds.end(); it++)
#define rtr(ds, it) for(auto it=ds.rbegin(); it!=ds.rend(); it--)
#define all(ds) ds.begin(), ds.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef priority_queue <int> pq;
typedef vector< long long > vi;
typedef pair<long long, long long> ii;
#define o_set tree<ii, null_type,less<ii>, rb_tree_tag,tree_order_statistics_node_update>
#define graph vector<vi>
#define Mod 1000000007
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define T int t;cin>>t;rep(i,t)

void solve() {

	string str1, str2;
	cin >> str1 >> str2;
	
	int size1 = str1.size(), size2 = str2.size();
	if (size1 >= size2)
		cout << "No\n";
	else {
		bool flag = true;
		rep(i, size1)
			if (str1[i] != str2[i])
				flag = false;
				
		if (flag)
			cout << "Yes\n";
		else
			cout << "No\n";
	}
	
}

int main()
{
    fastio;
//    T
    solve();
	//code
	return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main(){
  long a,b,k;
  cin>>a>>b>>k;
  for(int i=0;i<k;i++){
    if(i%2==0){
     
       b+=a/2;
       a=a/2;
     
    }else{
      
       a+=b/2;
        b=b/2;
      
    }
  }
  cout<<a<<" "<<b<<endl;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;

ll maxx(ll x,ll y,ll z){
	return max(max(x,y),z);
}
ll minn(ll x,ll y,ll z){
	return min(min(x,y),z);
}
ll gcd(ll x,ll y){
	if(x%y==0) return y;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
	return x*(y/gcd(x,y));
}
ll myceil(ll x,ll y){//yがいくつ集まったらx以上になるか
	if(x<=y) return 1;
	else if(x%y==0) return x/y;
	else return x/y+1;
}

//a,b x
int main(){
	ll N; cin>>N;
	ll AB=0,c1=0,c2=0,c3=0;//内部
	//vector<string> S(N);
	//rep(i,N) cin>>S[i];
	rep(i,N){
		string tmp; cin>>tmp;
		rep(j,tmp.sz-1){
			if(tmp[j]=='A' && tmp[j+1]=='B') AB++;
		}
		if(tmp[0]=='B' && tmp[tmp.sz-1]=='A') c3++;
		else if(tmp[0]=='B') c2++;
		else if(tmp[tmp.sz-1]=='A') c1++;
	}
	if(c3==0) cout<<min(c1,c2)+AB;
	else{
		ll ans=AB+c3-1;
		if(c2!=0) ans++;
		if(c1!=0) ans++;
		cout<<ans+max(min(c1,c2)-1,(ll)0);
	}
}

Measured memory_bytes: 256
import java.io.*;
import java.util.Scanner;

class Main {
   public static void main(String[] args) {
       Scanner in = new Scanner(System.in);
       int    w = in.nextInt();
       int    h = in.nextInt();
       int    x = in.nextInt();
       int    y = in.nextInt();
       int    r = in.nextInt();
       
       if(x-r>=0 && y-r>=0 && x+r<=w && y+r<=h){
        System.out.println("Yes");
   }else{
        System.out.println("No");
} 
}
}

Measured memory_bytes: 17324
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define EPS 1e-9
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    int t1,t2;
    cin >> t1 >> t2;
    int a1,a2,b1,b2;
    cin >> a1 >> a2 >> b1 >> b2;
    int p = (a1 - b1)*t1;
    int q = (a2 - b2)*t2;
    if(p > 0)p *= -1, q *= -1;
    // 0 -> +P -> +Q -> +P -> …
    if(p + q < 0)cout << 0 << endl;
    else if(p + q == 0)cout << "infinity" << endl;
    else{
        int s = -p/(p+q);
        if(-p%(p+q)){
            cout << s*2+1 << endl;
        }else{
            cout << s*2 << endl;
        }
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <map>
#include <functional>
#include <queue>
#include <vector>
#define INF 1e9
typedef long long ll;
using namespace std;

map<ll,int> ind;
typedef pair<int,int> P;
int dp[500000];
int fie[500000][9];
int wx[500000];
int next[4]={-3,-1,3,1};
int perm[10];
int ch,cv;
ll s,g;

int func(){
	for(int i=0;i<500000;i++){
		dp[i]=INF;
	}
	priority_queue<P,vector<P>,greater<P> > que;
	que.push(P(0,s));
	dp[s]=0;
	while(1){
		P q=que.top();
		que.pop();
		int x=q.second,c=q.first;
		if(c>dp[x])continue;
		if(x==g)return c;
		for(int i=0;i<4;i++){
			swap(fie[x][wx[x]],fie[x][(wx[x]+next[i]+9)%9]);
			ll sum=0,pp=1;
			for(int j=0;j<9;j++){
				sum+=(ll)pp*fie[x][j];
				pp*=10;
			}
			sum=ind[sum];
			int nc=c+ch;
			if(i%2==0)nc=c+cv;
			if(dp[sum]>nc){
				dp[sum]=nc;
				que.push(P(nc,sum));
			}
			swap(fie[x][wx[x]],fie[x][(wx[x]+next[i]+9)%9]);
		}
	}
	return -1;
}

int main(void){
	for(int i=0;i<9;i++){
		perm[i]=i;
	}
	int cnt=0;
	do{
		ll pp=1,sum=0;
		for(int i=0;i<9;i++){
			sum+=(ll)pp*perm[i];
			fie[cnt][i]=perm[i];
			if(perm[i]==0){
				wx[cnt]=i;
			}
			pp*=10LL;
		}
		ind[sum]=cnt;
		cnt++;
	}while(next_permutation(perm,perm+9));
	while(1){
		scanf("%d %d",&ch,&cv);
		if(ch==0 && cv==0)break;
		s=0,g=0;
		ll pp=1;
		for(int i=0;i<3;i++){
			for(int j=0;j<3;j++){
				ll a;
				scanf("%lld",&a);
				s+=pp*a;
				pp*=10LL;
			}
		}
		pp=1;
		for(int i=0;i<3;i++){
			for(int j=0;j<3;j++){
				ll a;
				scanf("%lld",&a);
				g+=pp*a;
				pp*=10LL;
			}
		}
		s=ind[s];
		g=ind[g];
		printf("%d\n",func());
	}
	return 0;
}

Measured memory_bytes: 45640
#include<cstdio>
#include<cstring>
int N,A,B,C,D;
int c[1010][1010];
int w[1010][1010];
int d[2][1010];

#define mod 1000000007
int add(int x,int y){
	return (x+=y)<mod?x:x-mod;
}
int mul(int x,int y){
	return (int)((long long int)x*y%mod);
}
void addto(int&x,int y){
	x = add(x,y);
}
int main(){
	scanf("%d%d%d%d%d",&N,&A,&B,&C,&D);

	for(int i=0; i<=N; i++)for(int j=0; j<=i; j++)
		c[i][j] = j==0||j==i?1:add(c[i-1][j],c[i-1][j-1]);
	for(int i=A; i<=B; i++){
		w[i][0] = 1;
		for(int j=1; j<=D && i*j<=N; j++)
			w[i][j] = mul(w[i][j-1], c[i*j-1][i-1]);
	}

	d[0][0] = 1;bool f = false;
	for(int k=A; k<=B; k++,f=!f){
		memset(d[!f],0,sizeof(d[!f]));
		for(int i=0; i<=N; i++){
			addto(d[!f][i], d[f][i]);
			for(int j=C; j<=D && k*j+i<=N; j++){
				addto(d[!f][k*j+i], mul(d[f][i], mul(c[i+k*j][i], w[k][j])));
			}
		}
	}
	printf("%d\n",d[f][N]);
	return 0;
}


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

int main()
{
    int a, b, c;
    int appear[105] = {};
    int i;

    cin >> a >> b >> c;

    for (i = a; appear[i % b] == 0 && i % b != c; i += a) {
        appear[i % b] = 1;
    }

    if (i % b == c) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}


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

const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
const int MOD=1000000007;

int a[2000][2000];
int b[2000];
int upd[2000];

int main(){
	int n;cin>>n;
	rep(i,n)rep(j,n-1){
		scanf("%d",&a[i][j]);a[i][j]--;
	}
	queue<P>que;
	rep(i,n){
		for(int j=i+1;j<n;j++){
			if(a[i][0]==j&&a[j][0]==i){
				que.push(P(i,1));
				que.push(P(j,1));
				upd[i]=1;upd[j]=1;
				b[i]++;b[j]++;
			}
		}
	}
	int Max=0;
	while(!que.empty()){
		P p=que.front();que.pop();
		Max=max(Max,p.second);
		if(b[p.first]==n-1)continue;
		int nx=a[p.first][b[p.first]];
		if(a[nx][b[nx]]==p.first){
			b[p.first]++;
			b[nx]++;
			int tim=max(upd[p.first],upd[nx])+1;
			upd[p.first]=tim;
			upd[nx]=tim;
			que.push(P(p.first,tim));
			que.push(P(nx,tim));
		}
	}
	rep(i,n){
		if(b[i]!=n-1){
			puts("-1");return 0;
		}
	}
	cout<<Max<<endl;
}

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

#define testcase            int t; cin>>t; while (t--)
#define sc(a)               scanf("%lld",&a)
#define sc2(a,b)            scanf("%lld %lld",&a,&b)
#define pb                  push_back
#define reversed(s)         reverse(s.begin(), s.end())
#define asort(s)            sort(s.begin(), s.end())
#define dsort(s)            sort(s.begin(), s.end(),greater<ll>())
#define gtl(x)              getline(cin, (x))
#define PI                  acos(-1)
#define CLR(x, y)           memset(x, y, sizeof(x))
#define Precision(a)        cout << fixed << setprecision(a)
#define FasterIo            ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl                "\n"

template <typename T> T Sqr(T x) { T n = x * x ; return n ;}
template <typename T> T Pow(T B,T P){ if(P==0) return 1; if(P&1) return B*Pow(B,P-1);  else return Sqr(Pow(B,P/2));}
template <typename T> T Abs(T a) {if(a<0)return -a;else return a;}
template <typename T> T Gcd(T a,T b){if(a<0)return Gcd(-a,b);if(b<0)return Gcd(a,-b);return (b==0)?a:Gcd(b,a%b);}
template <typename T> T Lcm(T a,T b) {if(a<0)return Lcm(-a,b);if(b<0)return Lcm(a,-b);return a*(b/Gcd(a,b));}

int main()
{
    string s, t;
    cin >> s >> t;
    int cnt=0;
    for(int i=0; i<s.size(); i++)
    {
        if(s[i]!=t[i])
        {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3828
#include "bits/stdc++.h"
using namespace std;

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
const int inf = 1000000001;
const ll INF = 1e18 * 2;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };


struct Modint {
	ll n;
	static const ll Mod = 1000000007;
	Modint(int n = 0) : n(n) {}
};

Modint operator+(Modint a, Modint b) { return Modint((a.n += b.n) >= mod ? a.n - a.Mod : a.n); }
Modint operator-(Modint a, Modint b) { return Modint((a.n -= b.n) < 0 ? a.n + a.Mod : a.n); }
Modint operator*(Modint a, Modint b) { return Modint(1LL * a.n * b.n % a.Mod); }
Modint &operator+=(Modint &a, Modint b) { return a = a + b; }
Modint &operator-=(Modint &a, Modint b) { return a = a - b; }
Modint &operator*=(Modint &a, Modint b) { return a = a * b; }

ll MAXM = 100100;
vector<Modint> fact(MAXM);
vector<Modint> C(MAXM);

Modint modpow(Modint a, int b) {
	Modint ret = 1;
	while (b > 0) {
		if (b & 1) ret *= a;
		a *= a;
		b >>= 1;
	}
	return ret;
}

Modint modinv(Modint a) {
	return modpow(a, a.Mod - 2);
}

Modint nCr(Modint n, ll r) {
	Modint ret = fact[n.n];
	ret *= modinv(fact[r]);
	ret *= modinv(fact[n.n - r]);
	return ret;
}

Modint nCr(Modint n, Modint r) {
	Modint ret = fact[n.n];
	ret *= modinv(r.n);
	ret *= modinv(fact[n.n - r.n]);
	return ret;
}


int main() {
	int n, i, j;
	cin >> n;

	Modint one(1);
	
	fact[0] = one;
	for (i = 1; i <= n + 1; i++) {
		fact[i] = (i*fact[i - 1]);
	}

	vi a(n + 1);
	vi ichi(n + 1, -1);
	int x1, x2;
	for (i = 0; i < n + 1; i++) {
		cin >> a[i];
		if (ichi[a[i]] == -1) {
			ichi[a[i]] = i;
		}
		else {
			x1 = ichi[a[i]];
			x2 = i;
		}
	}
	//cout << x1 << " " << x2 << endl;
	for (int k = 1; k <= n + 1; k++) {
		Modint cnt(0);
		//cout << nCr(n + 1, k) << endl;
		cnt += nCr(n + 1, k);
		if (k <= n + x1 - x2 + 1) {
			cnt -= nCr(n + x1 - x2, k - 1);
		}
		while (cnt.n < 0) {
			cnt += MOD;
		}
		cout << cnt.n << endl;
	}
	
}

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

class Main {

	void solve() {
		
		int a = inint(), b = inint();
		a = a==1? 14 : a; b = b==1? 14 : b;
		
		if (a == b) out.println("Draw");
		else out.println(a<b ? "Bob" : "Alice");

	}

	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}

	public int inint() {
		return in.nextInt();
	}

	public long inlong() {
		return in.nextLong();
	}

	public String instr() {
		return in.next();
	}

	public char inchar() {
		return in.next().charAt(0);
	}

	public int[] inintar(int num) {
		int[] a = new int[num];
		for (int i=0; i<num; i++) {
			a[i] = in.nextInt();
		}
		return a;
	}

	public char[] incharar() {
		return in.next().toCharArray();
	}

}

Measured memory_bytes: 23508
# -*- coding: utf-8 -*-
N = int(input())
if N == 100000:
  x = 90909
elif N >= 10000:
  x = 909 + N - 10000 + 1
elif N >= 100:
  if N >= 1000:
    x = 909
  else:
    x = 9 + N - 100 + 1
elif N >= 1:
  if N >= 10:
    x = 9
  else:
    x = N
    
print(x)


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <iomanip>
#include <ios>
using namespace std;
int main(void){
  int n,a,b;
  cin >> n >> a >> b;
  
  string s;
  cin >> s;
  
  int pass = 0;
  int passb = 0;
  
  int p = s.length();
  for(int i=0;i<p;i++){
    if(s[i] == 'a'){
      if(pass < a + b){
        cout << "Yes" << endl;
        pass++;
      }
      else{
        cout << "No" << endl;
      }
    }
    if(s[i] == 'b'){
      if(pass < a + b && passb < b){
        cout << "Yes" << endl;
        pass++;
        passb++;
      }
      else{
        cout << "No" << endl;
      }
    }
    if(s[i] == 'c'){
      cout << "No" << endl;
    }
  }
  
  return 0;
}

Measured memory_bytes: 896
def eve_odo(a, b)
    return true if a%2 == 0 and b%2 != 0
    return true if a%2 != 0 and b%2 == 0
    return false
end

def aa
    k = gets.chomp.to_i

    o = []
    for i in 1..(k-1)
        for j in (i+1)..k
            o.push([i, j]) if eve_odo(i, j)
        end
    end

    puts o.length
end

aa

Measured memory_bytes: 1788
import java.util.Scanner;
 
class Main{
public static void main(String[] args){
 
Scanner scan = new Scanner(System.in);
 
int i = scan.nextInt();
long max = -1000000, min = 1000000, sum = 0;
for(int j = 0; j <i; j++){
    long x = scan.nextLong();
    sum += x;
    if(x > max) max = x;
    if(x < min) min = x;
    }
 
 
System.out.println(min +" "+ max +" "+sum);
   }
}
    

Measured memory_bytes: 31316
from math import sqrt
n=int(input())
t=0
i=2
while i*i<=n:
  if n%i==0:
    c=0
    while n%i==0:
      n//=i
      c+=1
    t+=(int(sqrt(8*c+1))-1)//2
  i+=1
if n>1:
  t+=1
print(t)

Measured memory_bytes: 63292
/// 1行の文字を空白で分割してVec<T>にする。
fn read_split<T : std::str::FromStr>() -> Vec<T> {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();
    input.trim().split_whitespace().map(|x| x.parse().ok().unwrap()).collect()
}

/// Vecを1列で出力する
fn output_vec<T : std::fmt::Display>(item : Vec<T>, splitter : char) {
    let cnt = item.len();
    let mut c = 0;
    for i in item.iter() {
        c+=1;
        if cnt > c {print!("{}{}", i, splitter);} else {println!("{}", i);}
    }
}

fn main() {
    let input : Vec<i32> = read_split();
    let min = input[1] - input[0] + 1;
    let max = input[1] + input[0];
    let answer = min..max;
    output_vec(answer.collect(), ' ');
}

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

int main() {
  int n;
  cin >> n;
  long long ans = 1;
  bool x = true;
  for(int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    if(a == 0) {
      cout << 0 << endl;
      x = false;
      break;
    }
    ans *= a;
  }
  if(x) {
    if(ans > 1000000000000000000 || ans <= 0) cout << "-1" << endl;
    else cout << ans << endl;
  }
}

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

int main(int argc, char *argv[]){
        long okane;
        long ureshisa = 0;
        scanf("%ld", &okane);
        while (okane / 500 > 0){
                ureshisa += 1000;
                okane -= 500;
        }
        while (okane / 5 > 0){
                ureshisa += 5;
                okane -= 5;
        }
        printf("%ld\n", ureshisa);
        return 0;
}

Measured memory_bytes: 128
N=int(input())
s=[]
for i in range(N):
    s+=[input()]
M=int(input())
t=[]
for j in range(M):
    t+=[input()]
u=[]
for k in range(N):
    u.append(s.count(s[k])-t.count(s[k]))
if max(u)<0:
    print("0")
else:
    print(max(u))

Measured memory_bytes: 3064
divMod' :: Int -> Int -> (Int, Int)
divMod' a b = let quotient = div a b
                  surplus = a `mod` b
              in (quotient, surplus)
       
hours :: Int -> (Int, Int)
hours a = divMod' a 3600

minutes :: Int -> (Int, Int)
minutes a = divMod' a 60

main = do
    numString <- getLine
    let num = read numString
        (hQuo, hSur) = hours num
        (mQuo, mSur) = minutes hSur
        seconds = mSur
    putStrLn $ show hQuo ++ ":" ++ show mQuo ++ ":" ++ show seconds





Measured memory_bytes: 3580
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int po[]=new int[n];
        int med1,med2;
        for(int i=0;i<n;i++)po[i]=sc.nextInt();
        int[]po2=po.clone();
        Arrays.sort(po);
        med1=po[n/2];
        med2=po[n/2-1];
        for(int i=0;i<n;i++){
            if(med1==med2)System.out.println(med1);
            else{
                System.out.println((med1<=po2[i])?med2:med1);
            }
        }
        
    }
}

Measured memory_bytes: 95240
import sys

N, M = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(M)]
ans = [0 for _ in range(N)]
ume = [False for _ in range(N)]
for i, j in sc:
    if not ume[i-1]:
        ume[i-1] = True
        ans[i-1] = j
    else:
        if ans[i-1] != j:
            print(-1)
            sys.exit()
            
if N == 1 and M == 0:
    print(0)
    sys.exit()


if not ume[0]:
    ans[0] = 1
elif ans[0] == 0 and N != 1:
    print(-1)
    sys.exit()

for i in ans:
    print(i, end="")

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

int a[200010];
int b[200010];

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

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

    for(int i=n;i>0;i--)
    {
        int cnt=0;
        for(int j=2;i*j<=n;j++)if(b[i*j-1])cnt++;
        cnt%=2;
        b[i-1]=(cnt+a[i-1])%2;
    }

    int ans=0;
    for(int i=0;i<n;i++)if(b[i])ans++;
    cout<<ans<<"\n";
    for(int i=0;i<n;i++)if(b[i])cout<<i+1<<" ";
    cout<<"\n";

    return 0;
}


Measured memory_bytes: 5112
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main
{
  static int a;
  static int b;
  static int c;

  static int n;
  static int l[];

  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    PrintWriter out = new PrintWriter(System.out);

    String s;
    String sl[];

    s = r.readLine();
    sl = s.split(" ");

    n = Integer.parseInt(sl[0]);
    a = Integer.parseInt(sl[1]);
    b = Integer.parseInt(sl[2]);
    c = Integer.parseInt(sl[3]);

    l = new int[n];
    for(int i = 0; i < n; i++)
    {
      l[i] = Integer.parseInt(r.readLine());
    }
    out.println(search(n - 1, 0, 0, 0, 0));
    out.flush();
  }

  public static int search(int n, int m, int aa, int bb, int cc)
  {
    if(n == -1)
    {
      if(aa == 0 || bb == 0 || cc == 0)
      {
        return 99999999;
      }
      return Math.abs(aa - a) + Math.abs(bb - b) + Math.abs(cc - c) + m;
    }
    int z = search(n - 1, m, aa, bb, cc);
    z = Math.min(z, search(n - 1, aa == 0 ? m : m + 10, aa + l[n], bb, cc));
    z = Math.min(z, search(n - 1, bb == 0 ? m : m + 10, aa, bb + l[n], cc));
    z = Math.min(z, search(n - 1, cc == 0 ? m : m + 10, aa, bb, cc + l[n]));

    return z;
  }

}

Measured memory_bytes: 25044