akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main()
{
	int N;
	int64_t C;
	int64_t X[100005], V[100005];
	int64_t ans;

	cin >> N >> C;
	for ( int i = 0; i < N; i++ ) {
		cin >> X[i] >> V[i];
	}
	
	function < int64_t() > calc = [&]
	{
		int64_t now_max = 0, sum = 0;
		int64_t maxv[100005];
		int64_t ret;
		for ( int i = 0; i < N; i++ ) {
			sum += V[i];
			if ( now_max < sum - X[i] ) {
				now_max = sum - X[i];
			}
			maxv[i] = now_max;
		}
		ret = now_max;
		sum = 0;
		for ( int i = N - 1; i > 0; i-- ) {
			sum += V[i];
			ret = max(ret, maxv[i - 1] + sum - (C - X[i]) * 2);
		}
		return (ret);	
	};
	
	ans = calc();
	for ( int i = 0; i < N; i++ ) {
		X[i] = C - X[i];
	}

	reverse(X, X + N);
	reverse(V, V + N);
	
	ans = max(ans, calc());

	cout << ans << endl;

	return (0);
}


Measured memory_bytes: 2560
package main

import(
    "fmt"
    "sort"
    "strings"
)



func main() {
    var w,a,b int
    fmt.Scan(&w,&a,&b)
    if (a<=b && b<=a+w) || (b<=a && b+w>=a){
        fmt.Println(0)
    } else {
        fmt.Println(min32(abs32(b-(a+w)),abs32(a-(b+w))))
    }
}





// Pairsort
type Pair struct {
    first,second int64
}

type By func(p1, p2 *Pair) bool

func (by By) Sort(pairs []Pair) {
    ps := &pairSorter{
            pairs : pairs,
            by: by,
    }
    sort.Sort(ps)
}

type pairSorter struct {
    pairs []Pair
    by func(p1, p2 *Pair) bool
}

func (s *pairSorter) Len() int {
    return len(s.pairs)
}

func (s *pairSorter) Swap(i, j int) {
    s.pairs[i], s.pairs[j] = s.pairs[j], s.pairs[i]
}

func (s *pairSorter) Less(i, j int) bool {
    return s.by(&s.pairs[i], &s.pairs[j])
}

func first (p1, p2 *Pair) bool {
        return p1.first < p2.first
}

func second (p1, p2 *Pair) bool {
        return p1.second < p2.second
}
// end



func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func makeTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}

func sortString(s string) string{
    t := strings.Split(s, "")
    sort.Strings(t)
    return strings.Join(t, "")
}

func reverseString(s string) string{
    t := []rune(s)
    for i,j := 0, len(s)-1 ; i < j ; i, j = i+1, j-1 {
        t[i], t[j] = t[j], t[i]
    }
    return string(t)
}

func inside(h,w,H,W int) bool{
    if h>=0 && h<H && w>=0 && w<W{
        return true
    }
    return false
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include <bitset>
#include <cmath>
#include <stack>
#include <iomanip>
#include <map>
#include <math.h>
#include <list>
#include <deque>
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll MOD = 1000000007;
ll INF = 1LL << 60;
int main() {
    string S;
    cin >> S;
    int N = S.size();
    long long res = 0;
    for (int bit = 0; bit < (1<<(N-1)); ++bit) {
        long long tmp = 0;
        for (int i = 0; i < N-1; ++i) {
            tmp *= 10;
            tmp += S[i] - '0';
            if (bit & (1<<i)) res += tmp, tmp = 0;
        }
        tmp *= 10;
        tmp += S.back() - '0';
        res += tmp;
    }
    cout << res << endl;
}

Measured memory_bytes: 256
//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);   

int main(){
    std::ios::sync_with_stdio(false);
    int a,b;
    cin>>a>>b;
    if(abs(a-b)<=1){
    	cout<<"Yay!";
    }
    else{
    	cout<<":(";
    }
    return 0;  
    
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll D,N;
    cin >>D>>N;
    
    if(D==0){
        if(N==100){
            cout<<101<<endl;
        }else{
            cout<<N<<endl;
        }
    }else if(D==1){
        if(N==100){
            cout<<10100<<endl;
        }else{
            cout<<N*100<<endl;
        }
    }else{
        if(N==100){
            cout<<1010000<<endl;
        }else{
            cout<<N*10000<<endl;
        }
    }



    return 0;
    

}

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


int main(){long H, W;
cin >> H >> W;
long s1, s2, s3, sr;
long ansmin = 1e10;
erep(i, H - 1){
    s1 = i * W; sr = (H - i) * W;
    if((H - i) % 2 == 1 && W % 2 == 1){
        s2 = (sr + min(H - i, W)) / 2;
        s3 = (sr - min(H - i, W)) / 2;
    }
    else{
        s2 = sr / 2;
        s3 = sr / 2;
    }
    ansmin = min(ansmin, abs(max(s1, s2) - min(s1, s3)));
}
erep(i, W - 1){
    s1 = i * H; sr = (W - i) * H;
    if((W - i) % 2 == 1 && H % 2 == 1){
        s2 = (sr + min(W - i, H)) / 2;
        s3 = (sr - min(W - i, H)) / 2;
    }
    else{
        s2 = sr / 2;
        s3 = sr / 2;
    }
    ansmin = min(ansmin, abs(max(s1, s2) - min(s1, s3)));
}

cout << ansmin << endl;
return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    long long q,h, s, d, n;
    cin >> q >> h >> s >> d >>n;
    if(2 * q < h)
    {
        h = q * 2;
    }
    if (2 * h < s)
    {
        s = 2 * h;
    }
    if (2 * s < d)
    {
        d = 2 * s;
    }
    cout << n / 2 *d + n % 2 *s;
    return 0;
}


Measured memory_bytes: 256
n, k = gets.strip.split(" ").map(&:to_i)

a = 0.0

def c(x, y)
  a = 1
  x *= 2
  while x < y
    a += 1
    x *= 2
  end
  a
end

1.upto(n) do |i|
  if i >= k
    a += 1.0 / n
  else
    if i == 1
      a += 1.0 / (n * 2**(Math.log2(k).ceil))
    else
      a += 1.0 / (n * 2**c(i, k))
    end
  end
end

puts a


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

using namespace std;

int C[1000005] = {};
bool P[1000005];

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

    int M = 0;
    vector<int> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
        ++C[A[i]];
        M = max(M, A[i]);
    }

    for (int i = 0; i <= M; ++i) P[i] = true;
    for (int i = 0; i < N; ++i) {
        int x = A[i];
        if (P[x]) {
            int j = x + x;
            while (j <= M) {
                P[j] = false;
                j += x;
            }
        }
    }

    int ans = 0;
    for (int i = 0; i < N; ++i) {
        if (C[A[i]] == 1)
            ans += P[A[i]];
    }
    cout << ans << endl;
}


Measured memory_bytes: 8712
# require 'pry'
# require 'benchmark'
BINF = -(10**12)
N = gets.to_i
robots = []
N.times do
  s, t = gets.split.map(&:to_i)
  robots << [s + t, s - t]
end
t = BINF
count = 0
# Benchmark.bm do |xxx|
  # xxx.report('part1') do
    robots.sort_by!{|x|x[0]}
  # end
  # xxx.report('part2') do
    robots.each do |robo|
      if t > robo[1]
        next
      end
      count += 1
      t = robo[0]
    end
  # end
# end
puts count


Measured memory_bytes: 12792
N = int(input())
A = []
for i in range(N):
    a = int(input())
    A.append(a)
b = 1
x = A[0]
while x != 2:
    x = A[x - 1]
    if b > N:
        print(-1)
        exit()
    b += 1

print(b)

Measured memory_bytes: 12860
#include<iostream>
#include<map>
#include<algorithm>

int main(void){
    int n;
    std::cin >> n;
    std::map<int, int> score;

    for(int i = 0; i < n; i++){
        int a;
        std::cin >> a;
        score[a]++;
        score[a-1]++;
        score[a+1]++;
    }

    int ans = 0;

    for (auto p : score) {
         auto value = p.second;
         // key, valueを使う
         ans = std::max(ans, value);
    }
    std::printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 4736
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
	      Scanner sc = new Scanner(System.in);
	      int a = sc.nextInt();
	      int b = sc.nextInt();
	      int c = sc.nextInt();
    	      int d = sc.nextInt();
    	      int sum = 0;
	      if(a<b) {
	    	  sum+=a;
	      }
	      else {
	      sum+=b;
	      }
	    	  if(c<d) {
		    	  sum+=c;
		      }
		      else {
		      sum+=d;
		      }
	      System.out.println(sum);
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <cctype>
#include <map>
#include <vector>
#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;


int main() {
	double l;
	cin >> l;
	double num = l / 3;
	printf("%lf\n", num*num*num);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int n,m,ans=0;
  
  scanf("%d%d",&n,&m);
  
  long h[n+1];
  int a[m+1],b[m+1],c[n+1];
  
  for(int i=1;i<=n;i++){
    c[i]=0;
  }
  
  for(int i=1;i<=n;i++){
    scanf("%ld",&h[i]);
  }
  for(int i=1;i<=m;i++){
    scanf("%d%d",&a[i],&b[i]);
  }
  
  for(int i=1;i<=m;i++){
    if(h[a[i]]>h[b[i]]){c[b[i]]=1;}
    if(h[a[i]]<h[b[i]]){c[a[i]]=1;}
    if(h[a[i]]==h[b[i]]){c[b[i]]=1;c[a[i]]=1;}
  }
  
  for(int i=1;i<=n;i++){
    if(c[i]==0){ans+=1;}
  }
  
  printf("%d",ans);
}

Measured memory_bytes: 3684
#include <vector>
using ll = long long;

template <ll MOD> class Combination_Big_Const_N {
  std::vector<ll> comb;

  ll modpow(ll a, ll n, ll p) {
    if (n == 1)
      return a % p;
    if (n % 2 == 1)
      return (a * modpow(a, n - 1, p)) % p;
    ll t = modpow(a, n / 2, p);
    return (t * t) % p;
  }

public:
  Combination_Big_Const_N(ll n, ll maxk) {
    comb.resize(maxk + 1);
    comb[1] = n;
    for (ll i = 2; i <= maxk; i++) {
      comb[i] = comb[i - 1] * (n - i + 1);
      comb[i] %= MOD;
      comb[i] *= modpow(i, MOD - 2, MOD);
      comb[i] %= MOD;
    }
  }

  ll calc(ll k) { return comb[k]; }
};

#include <iostream>
using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;

ll modpow(ll a, ll n, ll p) {
  if (n == 1)
    return a % p;
  if (n % 2 == 1)
    return (a * modpow(a, n - 1, p)) % p;
  ll t = modpow(a, n / 2, p);
  return (t * t) % p;
}

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  ll ans = modpow(2, n, MOD);
  ans--;
  auto com = Combination_Big_Const_N<MOD>(n, 200005);
  ans -= com.calc(a);
  ans -= com.calc(b);
  cout << ((ans % MOD) + MOD) % MOD << endl;
}


Measured memory_bytes: 1792
/************************************************
 *Author* :zzy
 *Created Time* : 2019年08月04日 星期日 19时57分45秒
**Problem**:
**Analyse**:
**Get**:
**Code**:
*********************************************/

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <stack>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
#define pr(x) cout << #x << ": " << x << " " 
#define pl(x) cout << #x << ": " << x << endl;
#define pri(a) printf("%d\n",(a))
#define xx first
#define yy second
#define sa(n) scanf("%d", &(n))
#define sal(n) scanf("%lld", &(n))
#define sai(n) scanf("%I64d", &(n))
#define vep(c) for(decltype((c).begin() ) it = (c).begin(); it != (c).end(); it++) 
const int mod = int(1e9) + 7, INF = 0x3f3f3f3f;
const int maxn = 1e5 + 13;

int main(void)
{
#ifdef LOCAL
 //freopen("in.txt", "r", stdin);
 //freopen("out.txt", "w", stdout);
#endif
    int n,a[maxn];
    bool f[maxn];
    fill(f,f+maxn,false);
    sa(n);
    for(int i=1; i<=n; i++) sa(a[i]);
    for(int i=1; i<n; i++)
    {
        if(a[i+1] > a[i])
        {
            a[i+1]--;
            f[i+1] = true;
        }
        if(a[i+1] == a[i])
        {
            if(a[i]==false)
                a[i+1]--;
            f[i+1] = true;
        }
        if(a[i+1] < a[i])
        {
            if(a[i])
                return 0*printf("No");
            else
            {
                a[i]--;
                f[i+1] = true;
                if(a[i] > a[i+1]) return 0*printf("No");
            }
        }
    }
    printf("Yes");
 return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG
#include "../../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

int main(void) {
    ll k;
    string s;
    cin >> k >> s;

    if(s.size() <= k) cout << s << "\n";
    else cout << s.substr(0, k) + "...\n";

    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include<map>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

int main(){
    
    int a,b;
    cin >> a>>b;
    int ans=0;
    ans=max(max(2*a-1,2*b-1),a+b);
    cout << ans<<endl;
    
    
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

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

  vector<int> ae(n+1, 0), aw(n+1, 0);
  for(int i=0; i<n; i++) {
    if(s[i] == 'E'){
      ae[i+1] = ae[i]+1;
      aw[i+1] = aw[i];
    } else {
      ae[i+1] = ae[i];
      aw[i+1] = aw[i]+1;
    }
  }

  int ans = numeric_limits<int>::max();
  for(int i=0; i<n; i++) {
    int cnt = aw[i] + (ae[n]-ae[i+1]);
    ans = min(ans, cnt);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3076
using System;

namespace v0_0007
{
    class Program
    {
        static void Main(string[] args)
        {
            var week = int.Parse(Console.ReadLine());
            decimal debt = 100000M;
            for (int i = 0; i < week; i++)
            {
                debt *= 1.05M;
                var rem = debt % 1000;
                debt = debt - rem + ((rem > 0) ? 1000 : 0);
            }
            Console.WriteLine("{0:f0}", debt);
        }
    }
}

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

//#define min(a, b) a < b ? a : b
//#define max(a, b) a > b ? a : b

//#define MAXN 100001

int main(void)
{
	long long i;
	long long N;
	//int ok;
	long long sumn = 0, suma = 0, k;

	scanf("%lld", &N);

	long long A[N];
	long long d[N];

	for (i = 0; i < N; i++) {
		scanf("%lld", &A[i]);
		suma += A[i];
	}

	sumn = N * (N + 1) / 2;
	if ((suma % sumn) != 0) {
		//ok = 0;
		printf("NO\n");
	} else {
		k = suma / sumn;
		for (i = 0; i < N; i++) {
			d[i] = A[(i + 1) % N] - A[i] - k;
		}
		for (i = 0; i < N; i++) {
			/*if (d[i] % N == 0 && d[i] <= 0) {
				ok = 1;
			} else {
				ok = 0;
				break;
			}*/
			//ok = 1;
			if (d[i] % N != 0 || d[i] > 0) {
				//ok = 0;
				//break;
				printf("NO\n");
				return (0);
			}
		}
		printf("YES\n");
	}
	/*if (ok) {
		
	} else {
		printf("NO\n");
	}*/
	return (0);
}

Measured memory_bytes: 1664
import math
a,b,x = map(int,input().split())

t = False
volume = a*a*b
if x <= volume/2:
  t = True
  
if t:
  tan = a*(b**2)/(2*x)
else:
  tan = 2*((a**2)*b - x)/a**3
    
print(math.degrees(math.atan(tan)))

Measured memory_bytes: 9276
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int main() {
	long long n;
	cin >> n;
	vector<long long> a(n);
	for (long long i = 0; i < n; i++) {
		cin >> a[i];
	}
	long long sum = 0;
	for (long long i : a) {
		sum += i;
	}
	long long x = 0;
	long long ans = 100000000000;
	for (int i = 0; i < n-1;i++) {
		x += a[i];
		ans = min(ans, llabs(sum - x * 2));
	}
	cout << ans << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int n,t;
int main()
{
	cin>>n;
	if(n==1)
	{
		cout<<1<<endl;
		return 0;
	}
    for(int i=1;i<=10;i++)
    {
    	if(pow(2,i)<=n) t=pow(2,i);
    	else break;
	}
	cout<<t<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;
const int N=200005;
int n,k,a[N],s[N];
int main(){
	scanf("%d%d",&n,&k);
	For(i,1,n) scanf("%d",&a[i]);
	for (;k;--k){
		memset(s,0,sizeof(s));
		For(i,1,n){
			int l=max(1,i-a[i]);
			int r=min(n,i+a[i]);
			++s[l]; --s[r+1];
		}
		For(i,1,n) s[i]+=s[i-1],a[i]=s[i];
		bool f1=0,f2=0;
		For(i,1,n) f1|=(a[i]!=n),f2|=a[i];
		if (!f1||!f2) break;
	}
	For(i,1,n) cout<<a[i]<<' ';
}

Measured memory_bytes: 5320
// package com.company;

import java.util.*;
import java.io.*;

public class Main {
    static Scanner input = new Scanner(System.in);


    public static void main(String[] args) {
        String ans = "";
        int n = input.nextInt();
        int m = input.nextInt();
        while (n > 0 || m > 0) {

            int[] arr1 = new int[n];
            int[] arr2 = new int[m];

            for (int i = 0; i < n ; i ++) {
                arr1[i] = input.nextInt();
            }
            for (int i = 0; i < m ; i ++) {
                arr2[i] = input.nextInt();
            }

            Arrays.sort(arr1);
            Arrays.sort(arr2);

            int sum1 = 0;
            for (int i= 0; i < n; i ++) {
                sum1 += arr1[i];
            }
            int sum2 = 0;
            for (int i= 0; i < m; i ++) {
                sum2 += arr2[i];
            }

            int dis = sum1 - sum2;

            if (Math.abs(dis) % 2 == 1) {
                ans += "-1\n";
            } else  {
                dis = dis / 2;
               
                boolean check = false;
                for (int i =0 ; i < n; i ++) {
                    for (int j = 0; j < m; j++) {
                        
                        if (arr1[i] - arr2[j] == dis) {
                            ans += arr1[i] + " " + arr2[j] + "\n";
                            check = true;
                            break;
                        }
                    }
                    if (check) break;
                }
                if (!check) ans += "-1\n";
            }
            n = input.nextInt();
            m = input.nextInt();
        }
        
        System.out.println(ans.trim());
    }
}


Measured memory_bytes: 29516
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

D = get_int

case D
when 25
  puts 'Christmas'
when 24
  puts 'Christmas Eve'
when 23
  puts 'Christmas Eve Eve'
when 22
  puts 'Christmas Eve Eve Eve'
end


Measured memory_bytes: 14332
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }

int main(){
    ll N, K;
    cin >> N >> K;
    ll sum = 0;
    for(ll i=K+1;i<=N;i++){
        ll q = N/(i);
        ll r = N%(i);
        r = max(r-K+1,ll(0));
        if(K == 0) r--;
        sum += q*(i-K) + r;
        //cout << q*(i-K) + r << " ";
    }
    //cout << endl;

    cout << sum << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define fi first
#define se second
#define pi 3.141592653589793
#define mod 998244353
#define pb push_back
#define all(v) v.begin(),v.end()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;

int main() {
	fast_io;
	int n, m;
	cin >> n >> m;
	for (int i = 0, l = m, r = m + 1;i < m - m/2;i++) {
		cout << l << ' ' << r << '\n';
		l--;
		r++;
	}
	for (int i = 0, l = 1, r = n - 1;i < m/2;i++) {
		cout << l << ' ' << r << '\n';
		l++;
		r--;
	}
}


Measured memory_bytes: 3688
#include <iostream>
#include <string>
#include <queue>
using namespace std;

typedef pair<string, int> P;
int n;
int q;
queue<P> Q;


int main() {
    cin >> n >> q;
    string s;
    int t;
    for (int i = 0 ; i < n; i++) {
        cin >> s >> t;
        Q.push(make_pair(s, t));
    }

    P temp;
    int time = 0;

    while (!Q.empty()) {
        temp = Q.front(); Q.pop();
        if (temp.second <= q) {
            time += temp.second;
            cout << temp.first << " " << time << '\n';
        }
        else {
            time += q;
            temp.second -= q;
            Q.push(temp);
        }
    }

}





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

int main(){
    double a,b,x;
    cin>>a>>b>>x;
    if(x>=a*a*b/2){
        printf("%.10f\n",atan(2*(a*a*b-x)/(a*a*a))*180/M_PI);
    }else{
        printf("%.10f\n",atan(a*b*b/(2*x))*180/M_PI);
    }
}

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

int main(){
  string s,t,u;
  cin >> s >> t;
  int same,maxi = 0;
  for(int i = 0;i <= s.size()-t.size();i++){
    same = 0;
    u = s.substr(i,t.size());
    for(int j = 0;j < t.size();j++){
      if(t[j] == u[j])same++;
    }
    maxi = max(maxi,same);
  }
  cout << (int)t.size() - maxi << endl;
}



Measured memory_bytes: 3616
#include <iostream>
#include <vector>

using namespace std;

bool checker(vector<int>* set, int count);

int main()
{
	int count = 0;
	int time = 0;
	int x = 0;
	int y = 0;
	bool check = false;
	cin >> count;

	vector<int>* set = new vector<int>();

	set->clear();
	set->resize(0);

	for (int i = 0; i < count; ++i)
	{
		cin >> time >> x >> y;
		set->push_back(time);
		set->push_back(x);
		set->push_back(y);
	}

	check = checker(set, count);

	if (check)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	delete set;
	return 0;
}

bool checker(vector<int>* set, int count)
{
	bool result = true;
	int x = 0;
	int y = 0;
	int j = 0;
	for (int i = 0; i < count * 3; i += 3)
	{
		for (; j < (*set)[i]; ++j)
		{
			if ((*set)[i+1] - x > 0)
			{
				++x;
			}
			else if ((*set)[i + 1] - x < 0)
			{
				--x;
			}
			else if ((*set)[i + 2] - y > 0)
			{
				++y;
			}
			else
			{
				--y;
			}
		}
		if (set->at(i + 1) != x || set->at(i + 2) != y)
		{
			result = false;
			break;
		}
	}
	return result;
}

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

using namespace std;

int main(void)
{
    int N;
    cin >> N;
    int ans = 1;

    vector<unsigned long long int> A(N);
    vector<unsigned long long int> B(N);

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

    sort(A.begin(),A.end());

    B[0] = A[0];
    for (int i = 1; i < N; i++) {
        B[i] = B[i-1] +A[i];
    }

    for (int i = N-2; i >= 0; i--) {
        if (B[i]*2 >= A[N-1]) {
            ans++;
        } else {
            int sum = B[i];
            for (int j = i+1; j < N-1; j++) {
                if (sum*2 >= A[j]) {
                    sum += A[j];
                    if (sum*2 >= A[N-1]) {
                        ans++;
                        j = N;
                    }
                } else {
                    i = 0;
                    j = N;
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;
    static final int ALF = 26;

    Main() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int min = 100;
        for (int i = 0; i < N; i++) {
            int num = sc.nextInt();
            int k = 0;
            while( (1 & num) == 0){
                num>>=1;
                k++;
            }
            min = Math.min(min, k);
        }

        System.out.println(min);
    }

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


Measured memory_bytes: 23124
#include <bits/stdc++.h>
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())
int n,k;
ll dp[2005][2005];
ll rui[2005][2005];
ll rui2[3005];
ll modpow(ll x,ll n){
	ll res=1;
	while(n>0){
		if(n&1) res=res*x%mod;
		x=x*x%mod;
		n>>=1;
	}
	return res;
}
ll F[2005],R[2005];
void make(){
	F[0] = 1;
	for(int i=1;i<2005;i++) F[i] = F[i-1]*i%mod;
	for(int i=0;i<2005;i++) R[i] = modpow(F[i],mod-2);
}
ll C(int a,int b){
	return F[a]*R[b]%mod*R[a-b]%mod;
}
int main(){
	cin>>n>>k; make();
	if(k == 1){
	    ll ans = 1;
	    for(int i=1;i<n-k;i++) ans = ans*2LL%mod;
	    cout << ans << endl;
	    return 0;
	}
	dp[1][2] = 1;
	rui[1][2] = 1;
	rui2[999] = 1;
	for(int i=2;i<=k-1;i++){
		dp[i][i+1] = 1;
		for(int a=2;a<=i;a++){
			//dp[i][a] wo calc
			dp[i][a] = rui2[i-a+999];
			//for(int b=1;b<=a-1;b++){
			    //dp[i][a] += rui[i-(a-b)][b+1];
				//for(int c=b+1;c<=i+1-(a-b);c++) dp[i][a] += dp[i-(a-b)][c];
			//}
			//dp[i][a] %= mod;
		}
		//rui[i][x] = dp[i][a(>=x)] no sum
		//rui2[x] = rui[p+x-1000][p] no sum
		for(int x=i+1;x>=2;x--){
		    rui[i][x] = (rui[i][x+1]+dp[i][x])%mod;
    		rui2[i-x+1000] = (rui2[i-x+1000]+rui[i][x])%mod;
		}
	}
	ll ans = 0;
	for(int a=2;a<=k;a++){
		ans = (ans+dp[k-1][a]*C(n-k+a-1,a-1)%mod)%mod;
	}
	for(int i=1;i<n-k;i++) ans = ans*2LL%mod;
	cout << ans << endl;
}


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

int main() {
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(a+b>c+d)
	  {
	  	  cout<<"Left";
	  }
	else if(a+b==c+d)
	  {
	  	cout<<"Balanced";
	  }
	else
	  cout<<"Right"<<"\n";
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef long long ll;
typedef pair<ll,ll> P;
const int INF=INT_MAX / 3;
const ll LINF=LLONG_MAX / 3LL;
#define CONST 1000000007
#define EPS (1e-8)
#define PB push_back
#define MP make_pair
#define sz(a) ((int)(a).size())
#define reps(i,n,m) for(int i=(n);i<int(m);i++)
#define rep(i,n) reps(i,0,n)
#define SORT(a) sort((a).begin(),(a).end())
ll mod(ll a,ll m){return (a%m+m)%m;}
int dx[9]={0,1,0,-1,1,1,-1,-1,0},dy[9]={1,0,-1,0,1,-1,1,-1,0};

ll rec(ll a, ll b) {
  if (a < b) return rec(b, a);
  if (a%b==0) {
    return a*2-b;
  }
  ll t = a/b;
  ll s = rec(b, a % b);
  return b*2*t + s;
}
int main(){
  ll n,x;
  ll ans = 0;
  cin>>n>>x;
  ans+=x;
  ans+=n-x;
  ans+=rec(n-x,x);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
using namespace std;

int A,B,C,X,Y;

int main(){
        scanf("%d%d%d%d%d",&A,&B,&C,&X,&Y);
        if(X<Y){
                swap(A,B);
                swap(X,Y);
        }

        int ans=0;
        if(2*C < A+B){
                ans+=Y*2*C;
                X-=Y;
                Y=0;

                if(2*C < A){ 
                        ans+=2*C*X;
                }else{
                        ans+=A*X;
                }
        }else{
                ans+=A*X + B*Y;
        }
        printf("%d\n",ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long
#define pb push_back
#define mp make_pair
#define endl "\n"
#define int long long
#define f0(n) for(int i=0;i<n;i++)
#define ms(x) memset(x,0,sizeof(x))
#define ms2d(x,m,n) memset(x, 0, sizeof(x[0][0]) * m * n)
#define uniq(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pi pair<int,int>
#define tc(t) int t;cin>>t;while(t--)
#define bits(n) __builtin_popcount(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define ins insert
#define ALL(v) v.begin(),v.end()
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define fi first
#define se second
#define PI acos(-1)
#define sz(a) (int)a.size();
#define IOS ios::sync_with_stdio(false);
using namespace std;
int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}

int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const long long MOD = 1000000007;
double sq(double x) {return x*x;}
template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}

bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}
signed main()
{
    IOS
    int n,m,k;
    cin>>n>>m>>k;
    vector<int>a(n+1),b(m+1);
    f0(n){
        cin>>a[i+1];
        a[i+1]+=a[i];
    }
    f0(m){
        cin>>b[i+1];
        b[i+1]+=b[i];
    }
    int ans=0;
    for(int i=0,j=m;i<=n;i++){
        if(a[i]>k)break;
        while(a[i]+b[j]>k)j--;
        ans=max(ans,i+j);
    }
    cout << ans << endl;
    return 0;
}
///Alhamdulillah


Measured memory_bytes: 6420
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;

int main() {
  ll n, m;
  cin >> n >> m;

  ll ans = 1;
  for (ll i = 1; i * i <= m; i++) {
    if (m % i != 0) continue;
    if (i * n <= m) ans = max(ans, i);
    ll i2 = m / i;
    if (i2 * n <= m) ans = max(ans, i2);
  }

  cout << ans << endl;
}


Measured memory_bytes: 3608
#include <iostream>
using namespace std;
int main(void){
   int n,a[100]={0};
   cin >> n;
   for(int i=0;i<n;i++){
       cin >> a[i];

   }

   for (int i=n-1;i>=0;i--){

   if(i==n-1){
       cout << a[i];
   }
   else {
       cout << " " << a[i];
   }
   }

   cout << endl;
}


Measured memory_bytes: 3068
program ABC097B
	integer(8)::X,i,j
	integer(8)::result=1
	
	read(5,*)X
	
	do i=2,9
		do j=2,31
			if(j**i>X)then
				exit
			else if(j**i>result)then
				result=j**i
			end if
		end do
	end do
	
	print'(i0)',result
end program ABC097B


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end());
#define VREV(v) reverse(v.begin(), v.end());
using namespace std;
using ll = long long;
using pll = pair<ll,ll>;
using vll = vector<ll>;
using vdouble = vector<double>;
using vstr = vector<string>;
typedef pair<int,int> P;
int dx[4] = {1, 0, -1, 0},dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
template<class T> inline bool chmax(T& a, T b){if(a<b) {a=b; return 1;} return 0; }
template<class T> inline bool chmin(T& a, T b){if(a>b) {a=b; return 1;} return 0; }
const ll INF = 1LL << 60;
const ll mod = 1000000007;

bool dp[110000];// dp[i]=石の個数が残りi個の局面が勝ちか負けかをbool値で表したもの

int main(){
	ll N,K; cin>>N>>K;
	vll a(N); rep(i,N) cin>>a[i];
	dp[0]=false;
	for(ll i=1; i<=K; i++){
		for(ll j=0; j<N; j++){
			if(i-a[j]>=0){
				if(dp[i]==false&&dp[i-a[j]]==false)dp[i]=true; 
			}
		}
	}
	
	if(dp[K])cout<<"First"<<endl;
	else cout<<"Second"<<endl;
	
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>
using namespace std;


const long long int mod=1000000007;
const long long int INF=99999999999999999;


//階乗先に計算
class Kaizyou{
    public:
    long long int *kaizyou;
    Kaizyou(){};
    Kaizyou(long long int n,long long int mod){
        kaizyou=new long long int[n+1];
        kai(1,n,mod);
        return;
    }

    long long int kai(long long int a, long long int b, long long int mod) {
        long long int tmp = 1;
		kaizyou[0]=1;
        for (long long int i = a; i <= b; i++) {
            tmp *= i;
            tmp %= mod;

            kaizyou[i] = tmp;
        }
        return tmp;
    }
};

//累乗(繰り返し2乗法)　aのb乗(mod)を求める。
class Ruizyou{
    public:
    long long int rui(long long int a, long long int b, long long mod) {
        int memo[65] = {};
        long long int A[65] = {};
        long long int tmp = 1;
        for (int i = 0; i < 65; i++) {
            memo[i] = b % 2;
            b /= 2;
        }

        A[0] = a;
        A[0] %= mod;

        for (int i = 1; i < 65; i++) {
            A[i] = A[i - 1] * A[i - 1];
            A[i] %= mod;
        }
        for (int i = 0; i < 65; i++) {
            if (memo[i] == 1) {
                tmp *= A[i];
                tmp %= mod;
            }
        }
        tmp %= mod;
        return tmp;
    }
};
//コンビネーション計算
class Combination{
    public:
        Kaizyou * Kaizyou_Instance;
        Ruizyou Ruizyou_Instance;
		long long int CombinationMod;
    Combination(long long int n,long long int mod){
        Kaizyou_Instance=new Kaizyou(n,mod);
		CombinationMod=mod;
    }
    long long int comb(long long int n, long long int r) {
        long long int tmp;
		if(r>n){return 0;}
        tmp = (Kaizyou_Instance->kaizyou[n] * Ruizyou_Instance.rui(Kaizyou_Instance->kaizyou[r], CombinationMod - 2, CombinationMod)) % CombinationMod;
        tmp *= Ruizyou_Instance.rui(Kaizyou_Instance->kaizyou[n - r], CombinationMod - 2, CombinationMod);
        tmp %= CombinationMod;
        if (tmp < 0) { tmp = (CombinationMod - tmp) % CombinationMod; }
        return tmp;
    }
	//start~endまでのn+iCiの和を出力
	long long int combRange1(long long int n,long long int start,long long int end){
		if(start!=0)return (comb(n+end+1,end)-comb(n+start,start-1)+3*CombinationMod)%CombinationMod;
		else return comb(n+end+1,end)%CombinationMod;
	}
	//start1~end1のiとstart2~end2のjまでのi+jCiの和を出力
	long long int combRange2(long long int start1,long long int end1,long long int start2,long long int end2){
		return (comb(end1+end2+2,end1+1)-comb(end1+start2+1,start2)-comb(end2+start1+1,start1)+comb(start1+start2,start1)+5*CombinationMod)%CombinationMod;		
	}
};	

string N;


int main() {
	cout << fixed << setprecision(18);
	
	long long int r1,r2,c1,c2;
	cin>>r1>>c1>>r2>>c2;
	Combination Comb(2000005,mod);
	cout<<Comb.combRange2(r1,r2,c1,c2);
} 


Measured memory_bytes: 15872
n=int(input())
a=list(map(int,input().split()))
ans=0
a2=sorted(a)
now=a2[0]
ren=1
for i in range(1,n):
    if now!=a2[i]:
        if ren<now:
            ans+=ren
        elif now<ren:
            ans+=(ren-now)
        now=a2[i]
        ren=1
        continue
    ren+=1
if ren<now:
    ans+=ren
elif now<ren:
    ans+=(ren-now)
print(ans)

Measured memory_bytes: 14692
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    //int l, r, d;
    //cin >> l >> r >> d;
    //int c = 0;
    //for (int i = l; i <= r; i++)
    //{
    //    if (i % d == 0) c++;
    //}
    //cout << c;
    //cout << '\n';
    //int n;
    //cin >> n;
    //vector<int> a(n);
    //for (auto& i : a) cin >> i;
    //int c = 0;
    //for (int i = 0; i < n; i++)
    //{
    //    if (i % 2 == 0 && a[i] % 2 == 1) c++;
    //}
    //cout << c;
    int n;
    scanf("%d", &n);
    vector<int> f(n + 1);
    for (int x = 1; x <= 100; x++)
    {
        for (int y = 1; y <= 100; y++)
        {
            for (int z = 1; z <= 100; z++)
            {
                int m = x * x + y * y + z * z + x * y + y * z + z * x;
                if (m <= n) f[m]++;
            }
        }
    }
    for (int i = 1; i <= n; i++) printf("%d\n", f[i]);
    //cout << '\n';
    return 0;
}

Measured memory_bytes: 3800
# coding:utf-8

import sys
from collections import deque, defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


n, m = LI()
edge = [LI() for _ in range(m)]


def dfs(s):
    q = deque([s])
    visited = set()

    while q:
        curr = q.pop()
        visited.add(curr)
        for next in G[curr]:
            if next in visited:
                continue
            q.append(next)

    return True if len(visited) == n else False


ans = 0
for i in range(m):
    G = defaultdict(list)
    for j, e in enumerate(edge):
        if i == j:
            continue
        a, b = e
        a -= 1
        b -= 1
        G[a].append(b)
        G[b].append(a)

    ans += 0 if dfs(0) else 1

print(ans)


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

using namespace std;
using ll = long long;

const int N = 1e6 + 5, MOD = 1e9 + 7;
const ll INF = 1e18 + 17;

void solve() {
	string s;
	cin >> s;
	if (s.back() != 's') s += 's';
	else {
		s += "es";
	} 
	cout << s;
}

main() {
	ios :: sync_with_stdio(0);		
	cin.tie(0);
	int tt = 1;
	//cin >> tt;
	while (tt--) {
		solve();
		cout << '\n';
	} 
	return 0;
}

Measured memory_bytes: 3664
#include <cstdio>
#include <cmath>
#include <limits>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdint>
#include <functional>
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;
using ll = long long;

const ll mod = 1000000000 + 7; //10^9


bool is_integer(double x){
    return floor(x) == x;
}

int main() {
    int N, D;
    cin >> N >> D;
    vector<vector<double>> X(N, vector<double>(D));
    
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < D; j++)
        {
            cin >> X.at(i).at(j);
        }
    }
    // for (int i = 0; i < N; i++)
    // {
    //     for (int j = 0; j < D; j++)
    //     {
    //         cout << X[i][j] << endl;
    //     }
    // }
    int ans = 0;
    for (int i = 0; i < N - 1; i++)
    {
        for (int j = i + 1; j < N; j++)
        {
            double distance = 0;
            for (int k = 0; k < D; k++)
            {
                distance += pow(X[i][k] - X[j][k],2);
                // cout << X[i][k] <<"," << X[j][k] << ","<< distance << endl;
                
            }
            distance = sqrt(distance);
            // cout << "i:" << i << "j:" << j << "disntance:" << distance << endl;
            bool c = is_integer(distance);
            if(c) ans++;
        }
        
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 3800
#include <stdio.h>
typedef long long ll;

int main(void) {
  ll a, b, k;
  scanf("%lld%lld%lld", &a, &b, &k);
  a -= k;
  if(a < 0) b += a, a = 0;
  if(b < 0) b = 0;
  printf("%lld %lld", a, b);
  return 0;
}

Measured memory_bytes: 128
Q = int(input())

import heapq
import sys
input = sys.stdin.readline

INF = 10**18
L = []
R = []
heapq.heappush(L,INF)
heapq.heappush(R,INF)
L_size = 0
R_size = 0
sum_b = 0
sum_L = 0
sum_R = 0

def f1(a,b):
  global sum_b,L_size,R_size,sum_L,sum_R
  sum_b += b
  L_max = -heapq.heappop(L)
  R_min = heapq.heappop(R)
  sum_L -= L_max
  sum_R -= R_min
  X = sorted([L_max,a,R_min])
  if L_size == R_size:
    heapq.heappush(L,-X[0])
    heapq.heappush(L,-X[1])
    heapq.heappush(R,X[2])
    L_size += 1
    sum_L += X[0] + X[1]
    sum_R += X[2]
  else:
    heapq.heappush(L,-X[0])
    heapq.heappush(R,X[1])
    heapq.heappush(R,X[2])
    R_size += 1
    sum_L += X[0]
    sum_R += X[1] + X[2]
  return

def f2():
  min_value = sum_b
  min_x = -L[0]
  if L_size == R_size:
    min_value += sum_R - sum_L
  else:
    min_value += sum_R - sum_L + min_x
  print(min_x,min_value)

QUERY = [[int(x) for x in input().split()] for _ in range(Q)]
for q in QUERY:
  if q[0]&1:
    f1(q[1],q[2])
  else:
    f2()


Measured memory_bytes: 44264
#include<iostream>
#include<stdio.h>
#include<vector>
#include<utility>
#include<queue>
#include<math.h>
#include<string>
#include<algorithm>
#include<stack>
#include<typeinfo>
using namespace std;
typedef pair<int, int> P;
int main() {
	char ch, straight, four, three, twop, onep;
	int check[5] = { 1,10,11,12,13 }, st = 0;
	int card[5];	while (cin >> card[0] >> ch >> card[1] >> ch >> card[2] >> ch >> card[3] >> ch >> card[4]) {
		int cnt[14] = { 0 };
		sort(card, card + 5);
		four = false;
		three = false;
		twop = false;
		onep = false;
		straight = true;
		st = 0;
		for (int i = 0; i < 5; ++i) {
			if (i != 0 && card[i - 1] + 1 != card[i])straight = false;
			if (card[i] == check[i])st++;
			cnt[card[i]]++;
		}
		if (st == 5)straight = true;
		for (int i = 0; i < 5; ++i) {
			if (i != 0 && card[i - 1] == card[i])continue;
			if (cnt[card[i]] == 4) {
				four = true;
				break;
			}
			else if (cnt[card[i]] == 3) three = true;
			else if (cnt[card[i]] == 2 && onep)twop = true;
			else if (cnt[card[i]] == 2)onep = true;
		}

		if (four)cout << "four card" << endl;
		else if (onep&&three)cout << "full house" << endl;
		else if (straight)cout << "straight" << endl;
		else if (three)cout << "three card" << endl;
		else if (twop)cout << "two pair" << endl;
		else if (onep)cout << "one pair" << endl;
		else cout << "null" << endl;


	}
	return 0;
}


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#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<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

int main(){
  int n,C;cin>>n>>C;
  vector<P> programs[C];
  rep(i,n){
    int s,t,c;cin>>s>>t>>c;
    programs[--c].push_back(P(s,t));
  }
  rep(i,C)sort(all(programs[i]));
  rep(i,C){
    rep(j,programs[i].size()-1){
      if(programs[i][j].second==programs[i][j+1].first){
        programs[i][j+1]=P(programs[i][j].first,programs[i][j+1].second);
        programs[i][j]=P(-1,-1);
      }
    }
  }
  int imos[200010]={};
  rep(i,C){
    rep(j,programs[i].size()){
      if(programs[i][j]==P(-1,-1))continue;
      imos[programs[i][j].first*2-1]++;
      imos[programs[i][j].second*2]--;
    }
  }
  rep(i,200009)imos[i+1]+=imos[i];
  sort(imos,imos+200010,greater<int>());
  cout<<imos[0]<<endl;
}



    

Measured memory_bytes: 2304