akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        int jCount = int.Parse(Console.ReadLine());

        string[] args0 = Console.ReadLine().Split(' ');
        string[] args1 = Console.ReadLine().Split(' ');

        int[,] array = new int[2, jCount];

        for (int j = 0; j < jCount; ++j)
        {
            array[0, j] = int.Parse(args0[j]);
            array[1, j] = int.Parse(args1[j]);
        }

        int[] sums = new int[jCount];

        int sumUpper = 0;

        for (int upper = 0; upper < jCount; ++upper)
        {
            sumUpper += array[0, upper];

            int sumLower = 0;

            for (int lower = upper; lower < jCount; ++lower)
            {
                sumLower += array[1, lower];
            }

            sums[upper] = sumUpper + sumLower;
        }

        var sorted = sums.OrderBy(x => x);
        int biggest = sorted.Last();

        Console.WriteLine(biggest);
    }
}


Measured memory_bytes: 13396
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		ArrayList<Integer> list=new ArrayList<Integer>();
		for(int i=0;i<N;i++)
		{
			list.add(sc.nextInt());
		}
		int ans=0;
		for(int i=0;i<N;i++)
		{
			for(int j=N-1;j>=i+1;j--)
			{
				if(list.get(j)<list.get(j-1))
				{
					int temp=list.get(j-1);
					list.set(j-1,list.get(j));
					list.set(j,temp);
					ans++;
				}
			}
		}
		for(int i=0;i<list.size();i++)
		{
			if(i==list.size()-1)
			{
				System.out.print(list.get(i));
			}
			else
			{
				System.out.print(list.get(i)+" ");
			}
		}
		System.out.println();
		System.out.println(ans);
	}
}



Measured memory_bytes: 26476
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#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 FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



int main() {
  string s;
  cin >> s;
  int n;
  n = s.length();
  // s += "p";
  string hold = "jgjg";
  int ans = 0;
  int ref = 0;

  while(ref<n){
    string show = "";
    show += s[ref];
    if(show!=hold){
      ++ans;
      hold = s[ref];
      ++ref;
    }
    else{
      if(ref+1>n-1) ref += 2;
      else{
        ++ans;
        hold = "";
        hold += s[ref];
        hold += s[ref+1];
        ref += 2;
      }
    }

    // cout << hold << endl;
  }






  cout << ans << endl;


}



Measured memory_bytes: 640
/*

Our shadows stretch out on the pavement
As I walk in the twilight with you
If we could be together like this forever
Holding hands
It's almost enough to make me cry

The wind grows colder
I can smell winter
Soon the season will come to this town
When I can get close to you

This moment
When the two of us cuddle up
To gaze at the first snow flower of the year
Is overflowing with happiness

It's not dependence or weakness
I just love you
I thought so with all my heart

I feel like when I'm with you
I can overcome anything
I pray that these days
Will continue forever

The wind rattled the window
The night shakes you awake
I will change any sorrow
Into a smile

The snow flowers fell
Outside the window
Unceasing
And colored our town
I realized that love means
Wanting to do something
For someone else

If I should lose you
I'll become a star and shine on you
I'll be with you even on nights
When your smile is wet with tears

This moment
When the two of us cuddle up
To gaze at the first snow flower of the year
Is overflowing with happiness

It's not dependence or weakness
I just want to be like this
With you forever
I can honestly think that now

The pure white snow flowers
Bury this town
Softly drawing memories in our hearts
Together forever with you...

*/

#include <bits/stdc++.h>

using namespace std;

int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  long long ans = 0;
  for (int b = k + 1; b <= n; b++) {
    ans += b - k;
    long long til = n / b * b;
    long long block = (til - b) / b;
    ans += block * (b - k);
    if (n % b >= k) {
      ans += n % b - k + 1;
    }
  }
  if (k == 0) ans -= n;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=300010;
int a[N],n,b[N],m;//2*n+1
int c[N];
int pd(int x)
{
	for(int i=1;i<=m;i++)
	if(a[i]<=x)c[i]=0;else c[i]=1;
	if(n==1)return c[n];
	if(c[n]==c[n+1]||c[n]==c[n-1])return c[n];
	//cout<<x<<" ";for(int i=1;i<=m;i++)cout<<c[i];cout<<endl;
	int l,r;
	for(l=n;l;l--)if(c[l]==c[l-1])break;
	for(r=n;r<=m;r++)if(c[r]==c[r+1])break;
	if(n<=min(n-l+1,r-n+1))
	{
		if(n%2)return c[n];else return c[n]^1;
	}//cout<<l<<" "<<r<<endl;
	if(n-l+1<r-n+1)return c[l];else return c[r];
}
int main()
{
	//freopen("triangle.in","r",stdin);
	//freopen("triangle.out","w",stdout);
	scanf("%d",&n);m=2*n-1;
	for(int i=1;i<=m;i++)scanf("%d",&a[i]),b[i]=a[i];
	sort(b+1,b+m+1);int ou=unique(b+1,b+m+1)-b-1;
	for(int i=1;i<=m;i++)a[i]=lower_bound(b+1,b+ou+1,a[i])-b;
	int l=1,r=m+1,mid;
	while(l<r)
	{
		mid=(l+r>>1);
		if(pd(mid))l=mid+1;
		else r=mid;
	}
	printf("%d",b[r]);
}

Measured memory_bytes: 2560
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;
#define mp make_pair
#define pb push_back
#define ll long long
const ll inf=9e18;
vector<ll> val[8];
const int N=100050;
ll x[N],y[N],z[N];
int main()
{
	int n,i,j,k,m;
	scanf("%i %i",&n,&m);
	for(i=1;i<=n;i++)
	{
		scanf("%lld %lld %lld",&x[i],&y[i],&z[i]);
		for(j=0;j<8;j++)
		{
			ll sum=0;
			if(j&1) sum+=x[i];
			else sum-=x[i];
			if(j&2) sum+=y[i];
			else sum-=y[i];
			if(j&4) sum+=z[i];
			else sum-=z[i];
			val[j].pb(sum);
		}
	}
	ll sol=-inf;
	for(i=0;i<8;i++)
	{
		sort(val[i].rbegin(),val[i].rend());
		ll ans=0;
		for(j=0;j<m;j++) ans+=val[i][j];
		if(sol<ans) sol=ans;
	}
	printf("%lld\n",sol);
	return 0;
}

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

int a = 700;



int main() {
	string guzai;

	cin >> guzai;
	for (int i = 0; i < 3; i++) {
		if (guzai[i] == 'o') {
			a = a+100;
		}

	}
	cout << a;
	return 0;
}

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

inline int read()
{
	int ret=0; char c=getchar();
	while(c<48||c>57)c=getchar();
	while(c>=48 && c<=57)ret=ret*10+c-48,c=getchar();
	return ret;
}
#define N 200093
long long k;
int T,f[N],g[N],u,v,st[N],t,n,a[N],h[N],tt,hh[N];
inline void pr(int u)
{
	while(u<=n){
		if(f[u]>u)u=f[u]; else printf("%d ",a[u]);
		++u;
	}
	exit(0);
} 

int main()
{
	n=read(); cin >> k;
	for(int i=1;i<=n;++i) a[i]=read();
	for(int i=1;i<=n;++i) {
		if(!h[a[i]])h[a[i]]=i;
	}
	for(int i=n;i;--i){
		if(!g[a[i]])f[i]=h[a[i]]; else f[i]=g[a[i]];
		g[a[i]]=i;
	}
	
	
	u=1;
	
	
		
	while(1){
		v=f[u]+1;
		if(v<=u+1)++T;if(v==n+1)++T;
//		if(v<=u+1||v==n+1)++T;
//		if(v>n)v=1;
		if(v==n+1)break;
		u=v;
	}
	
	/*
	 
	T=1;
	while(1){
		v=f[u]+1;
		if(v<=u+1)++T;
		if(v==n+1)break;
		u=v;
	}*/
	
	
	
	
	u=1; --k; k%=T; if(!k)pr(u);
	while(1){
		v=f[u]+1;if(v>n)v=1;
		if(v<=u+1)--k;
		if(!k)pr(v);
		u=v;
	}
}

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

class Main{
    public static void main(String args[])throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int a = Integer.parseInt(br.readLine());
        if(a<=100){
            int[] num = new int[a];
            String[] str = br.readLine().split(" ");
            for(int i=0; a>0; i++){
                num[i] = Integer.parseInt(str[--a]);
                System.out.print(num[i]);
                if(a != 0){
                    System.out.print(" ");
                }
            }
            System.out.println();
        }
    }
}

Measured memory_bytes: 16912
/*
	ABC 059
	B - Comparison
*/
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;

double EPS = 1e-10;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define int(x) int x; scanf("%d",&x);
#define lint(x) long long x; scanf("%lld",&x);
#define vint(v,n) vector<int> v(n); rep(i,n) scanf("%d", &v[i]);
#define vlint(v,n) vector<lint> v(n); rep(i,n) scanf("%lld", &v[i]);
#define double(x) double x; scanf("%lf",&x);
#define vdouble(v,n) vector<double> v(n); rep(i,n) scanf("%lf", &v[i]);
#define string(x) string x; cin >> x;

int main()
{
	string a, b;
	cin >> a;
	cin >> b;

	if (a.length() < b.length()) cout << "LESS" << endl;
	else if (a.length() > b.length()) cout << "GREATER" << endl;
	else
	{
		if (a == b)
			cout << "EQUAL" << endl;
		else
		{
			for (int i = 0; i < a.length(); i++)
			{
				if (a[i] < b[i]) { cout << "LESS" << endl; break; }
				else if (a[i] > b[i]) {cout << "GREATER" << endl; break;}
			}
		}
	}

	return 0;
}

Measured memory_bytes: 256
use std::io::Read;

fn update_min<T: Ord>(x: &mut T, min: T){
    if *x > min {
        *x = min;
    }
}

fn lower_bound<T: Ord>(a: &Vec<T>, x: T) -> usize {
    match a.binary_search(&x) {
        Ok(i) => i,
        Err(i) => i
    }
}

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let a: usize = iter.next().unwrap().parse().unwrap();
    let b: usize = iter.next().unwrap().parse().unwrap();
    let q: usize = iter.next().unwrap().parse().unwrap();
    let s: Vec<i64> = (0..a).map(|_| iter.next().unwrap().parse().unwrap()).collect();
    let t: Vec<i64> = (0..b).map(|_| iter.next().unwrap().parse().unwrap()).collect();

    let mut ns = vec![std::i64::MAX; a];
    let mut nt = vec![std::i64::MAX; b];

    let mut cursor = 0 ;

    for i in 0..a {
        while cursor + 1 < b && t[cursor + 1] < s[i] {
            cursor += 1;
        }
        let dist = (t[cursor] - s[i]).abs();
        ns[i] = dist;
        if cursor + 1 < b {
            let dist2 = (t[cursor+1] - s[i]).abs();
            ns[i] = std::cmp::min(ns[i], dist2);
        }
    }
    cursor = 0;
    for i in 0..b {
        while cursor + 1 < a && s[cursor + 1] < t[i] {
            cursor += 1;
        }
        let dist = (s[cursor] - t[i]).abs();
        nt[i] = dist;
        if cursor + 1 < a {
            let dist2 = (s[cursor+1] - t[i]).abs();
            nt[i] = std::cmp::min(nt[i], dist2);
        }
    }

    for _ in 0..q {
        let x: i64 = iter.next().unwrap().parse().unwrap();
        let p = lower_bound(&s, x) as i32;

        let mut ans = std::i64::MAX;

        for d in [-1i32,0,1].iter() {
            let q = p + d;
            if 0 <= q && (q as usize) < s.len() {
                let q = q as usize;
                update_min(&mut ans, (s[q] - x).abs() + ns[q]);
            }
        }
        
        let p = lower_bound(&t, x) as i32;

        for d in [-1i32,0,1].iter() {
            let q = p + d;
            if 0 <= q && (q as usize) < t.len() {
                let q = q as usize;
                update_min(&mut ans, (t[q] - x).abs() + nt[q]);
            }
        }
        
        println!("{}", ans);
    }
}


Measured memory_bytes: 13304
#include <iostream>
#include <set>
#include <vector>
#include <map>

using namespace std;

int main(){

	int tmp;
	int n;
	while(cin >> n && n != 0){
		map<int,int> s;
		int maxNum;
		int maxCnt=0;
		//fill(s.begin(),s.end(),0);
		for(int i = 0; i < n; i++){
			cin >> tmp;
			s[tmp]++;
			if(maxCnt < s[tmp]){
				maxCnt = max(maxCnt,s[tmp]);
				maxNum = tmp;
			}
		}

		if(maxCnt > n/2){
			cout << maxNum << endl;
		}
		else
			cout << "NO COLOR" << endl;
	}

	return 0;
}

Measured memory_bytes: 1940
#!/usr/bin/ruby
R,C=gets.split.map &:to_i
N=gets.to_i
M=Hash.new{|h,k|h[k]=[]}
N.times{
	x,y,d=gets.split.map &:to_i
	M[x]<<[y+R,d]
	M[y+R]<<[x,-d]
}
while !M.empty?
	a=-1<<61;b=1<<61
	s=M.find{|e|e}[0]
	st=[[s,0]]
	memo={s=>0}
	while !st.empty?
		cur,d=st[-1];st.pop
		M[cur].each{|x,c|
			if memo[x]
				(puts :No;exit)if memo[x]!=d+c
			else
				st<<[x,d+c]
				memo[x]=d+c
			end
		}
		if cur<=R
			a=[a,d].max
		else
			b=[b,d].min
		end
	end
	(puts :No;exit)if a>b
	memo.each{|k,v|M.delete(k)}
end
puts :Yes

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

#define PI 3.14159265358979323846264338327950L
#define ll long long

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    long r;
    cin >> r;
    long double answer = (long double)(PI) * (long double)(r) * (long double)(2.0);
    cout.precision(15);
    cout << answer << "\n";


}


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

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] str = br.readLine().split(" ");
        int n = Integer.parseInt(str[0]);
        int m = Integer.parseInt(str[1]);
        int[] h = new int[n + 1];
        int[] adj = new int[n+1];
        str = br.readLine().split(" ");
        for(int i=1; i<=n; ++i){
            h[i] = Integer.parseInt(str[i-1]);
            adj[i] = 0;
        }
        for(int i=0; i<m; ++i){
            str = br.readLine().split(" ");
            int u = Integer.parseInt(str[0]);
            int v = Integer.parseInt(str[1]);

            adj[u] = Math.max(adj[u], h[v]);
            adj[v] = Math.max(adj[v], h[u]);
        }
        int res = 0;
        for(int i=1; i<=n; ++i){
            res += h[i] > adj[i] ? 1 : 0;
        }
        System.out.println(res);
    }
}


Measured memory_bytes: 55788
#include<iostream>
using namespace std;
int main() {
	int a,b,i,g,t[50],T;
	cin >> a;
	for (i = 0; i < a; i++) {
		cin >> t[i];
	}
	i = 0;
	T = 0;
	for (g = 0; g < a; g++) {
		for (i = g + 1; i < a; i++) {
			b = t[g] * t[i];
			T = T + b;
		}
	}
	cout << T;
}

Measured memory_bytes: 256
<?php
  list($a, $b, $c, $num) = explode(' ', input());

  $cards = [1 => $a, 0 => $b, -1 => $c];
  $total = 0;

  while($num > 0) {
    $_val = key($cards);
    $_tmp = current($cards);

    $_num = min($_tmp, $num);
    $total += ($_val * $_num);
    $num -= $_num;
    next($cards);    
  }

 echo $total;
function input()
{
  return trim(fgets(STDIN));
}

Measured memory_bytes: 15972
#include<bits/stdc++.h>
     
using namespace std;
    
#define ll long long int
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
 

int main()
{
    fio
    ll tt=1;
    //cin>>tt;
    while(tt--)
    {
        string s,t;
        cin>>s>>t;
        int flag=1;
        if(t.length()-s.length()!=1) flag=0;
        if(t.substr(0,s.length())!=s) flag=0;
        if(flag) cout<<"Yes\n";
        else
            cout<<"No\n";
    }
    return 0;
}

Measured memory_bytes: 3632
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
int now = 0;
int deco[1000];

int c[30];
int st[30][100000];
ll dp[52][2510];
ll a[101];
void Solve() {
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++)
	{
		int ci = s[i] - 'a';
		c[ci]++;
		st[ci][c[ci]] = i;
		for (int j = 1; j < c[ci]; j++)
		{
			int fi = st[ci][j];
			int num = c[ci] - j + 1;
			if ((i - fi) >= 1 && (num + num) > (i - fi + 1)) {
				cout << (fi + 1) << " " << (i + 1) << endl;
				return;
			}
		}
	}

	cout << "-1 -1" << endl;
}
int main() {
	Solve();
	return 0;
}



Measured memory_bytes: 10752
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<math.h>
#define rep(i,n) for(int i = 0;i<(n);i++);
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 100100100100100;

int main() {
	ll N, K, Q;//Nnin Kpoint Qmon
	cin >> N >> K >> Q;
	vector<ll> A(N,K-Q);
	ll num = 0;
	for (int i = 0; i < Q; i++) {
		cin >> num;
		A[num - 1]++;
	}
	vector<bool> yes(N,false);
	for (int i = 0; i < N; i++) {
		if (A[i] > 0)yes[i] = true;
	}
	for (int i = 0; i < N; i++) {
		if (yes[i])cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}

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

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

for(int i = 0; i <= N; i++){
    for(int j = 0; j <= N; j++){ 
         int z = N - i - j;
         if(Y == 10000 * i + 5000 * j + 1000 * z && z >= 0 && z <= N){
             cout << i << " " << j << " " << z << endl;
             return 0;
         }
    }
}

cout << "-1 -1 -1"<< endl;

}


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


// modint
// 1000000007 で割ったあまりに関する四則演算を直感的に行える
template<int MODULO> struct Fp {
    long long val;

    constexpr Fp(long long v = 0) noexcept : val(v % MODULO) {
        if (val < 0) v += MODULO;
    }
    constexpr Fp operator - () const noexcept {
        return val ? MODULO - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MODULO) val -= MODULO;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MODULO;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MODULO;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MODULO, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MODULO;
        if (val < 0) val += MODULO;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
};

template<int MODULO> constexpr ostream& operator <<
(ostream &os, const Fp<MODULO>& x) noexcept {
    return os << x.val;
}
template<int MODULO> constexpr istream& operator >>
(istream &is, Fp<MODULO>& x) noexcept {
    return is >> x.val;
}

template<int MODULO> constexpr Fp<MODULO> modpow
(const Fp<MODULO> &a, long long n) noexcept {
    if (n == 0) return 1;
    auto t = modpow(a, n / 2);
    t = t * t;
    if (n & 1) t = t * a;
    return t;
}


// 二項係数ライブラリ
template<int MODULO> struct BiCoef {
    vector<Fp<MODULO> > fac, inv, finv;
    constexpr BiCoef(int n) noexcept : fac(n, 1), inv(n, 1), finv(n, 1) {
        for(int i = 2; i < n; i++){
            fac[i] = fac[i-1] * i;
            inv[i] = -inv[MODULO%i] * (MODULO/i);
            finv[i] = finv[i-1] * inv[i];
        }
    }
    constexpr Fp<MODULO> com(int n, int k) const noexcept {
        if (n < k || n < 0 || k < 0) return 0;
        return fac[n] * finv[k] * finv[n-k];
    }
};



// ここから解答
const int MAX = 201010;
const int MOD = 1000000007;
using mint = Fp<MOD>; // mod 計算を直感的に

int main() {
    BiCoef<MOD> bc(MAX); // 二項係数計算の前処理

    long long N, K;
    cin >> N >> K;
    cout << bc.com(N+K-1, N) << endl;
}



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

int main()
{
	long d,n;
	cin >> d >> n;
	if (n <= 99)
		cout << (long)(pow(100, d) * n) << endl;
	else 
		cout << (long)(pow(100, d) * (n+1)) << endl;
	return (0);
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<functional>
#include<list>
#include<map>
#include<iomanip>
#include<iostream>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<vector>
#include<algorithm>
#include<memory.h>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    int ans=min(a+b,a+c);
    ans=min(ans,(b+c));
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
(defun rally ()
  (let* ((n (read))
         (x (make-array n))
         (ans 10000000)
         (buff))
    (dotimes (i n)
      (setf (aref x i) (read)))
    (setq x (sort x #'<))
    (dotimes (i (aref x (1- n)))
      (setf buff 0)
      (dotimes (j n)
        (setf buff (+ buff (expt (- (aref x j) (1+ i)) 2) )))
      (if (< buff ans)
          (setf ans buff)))
    ans))

(format t "~A~%" (rally))

Measured memory_bytes: 16480
N, M, C = gets.chomp.split.map(&:to_i)
B = gets.chomp.split.map(&:to_i)
res = 0

N.times do |n|
    sum = 0
    A = gets.chomp.split.map(&:to_i)
    M.times do |n|
        sum += B[n]*A[n]
    end
    if sum + C > 0 then
        res += 1
    end
end
puts res

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

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
#define INF 1000000000
#define pb push_back
#define sz(a) int((a).size())
#define all(c) c.begin(), c.end()
#define tr(c, i) for (typeof(c).begin() i = c.begin(); i != c.end(); i++)
#define present(c, x) (c.find(x) != c.end())
#define cpresent(c, x) (find(all(c), x) != c.end())

ll bigmod(ll a, ll b, ll m)
{

    if (b == 0)
        return 1;
    ll x = bigmod(a, b / 2, m);
    x = (x * x) % m;

    if (b % 2)
        x = (x * a) % m;
    return x;
}

ll bigsum(ll a, ll b, ll m)
{
    ll s;
    if (b == 0)
        return b;
    if (b == 1)
        return a + 1;
    if (b % 2)
    {
        b = b / 2;
        s = bigsum(a, b, m) % m;
        s = (s * bigmod(a, b + 1, m)) % m;
        return s;
    }
    else
    {
        s = bigsum(a, b - 1, m) % m;
        s = (a * s + 1) % m;
        return s;
    }
}


int main()
{
    int h,w,m,i,j,mr=0,mc=0,l1,l2,im,a,b,row[300005]={0},col[300005]={0};
    vi vr;
    vi vc;
    map<pair<int,int>,int> mp;
    
    cin>>h>>w>>m;

    for(i=0;i<m;i++){
        cin>>a>>b;
       mp[make_pair(a,b)] = 35;
        row[a]++;
        col[b]++;

        
    }
    


    for(i=0;i<=h;i++) {
        mr = max(mr,row[i]);
    }
    for(i=0;i<=w;i++) {
        mc = max(mc,col[i]);
    }



    for(i=0;i<=h;i++) {
        if(row[i]==mr) vr.pb(i);
    }
    for(i=0;i<=w;i++) {
        if(col[i]==mc) vc.pb(i);
    }

    
    
    
    im = 1;
    l1 = vr.size();
    l2 = vc.size();

    for(i=0;i<l1;i++){
        for(j=0;j<l2;j++){
            

            
            if(mp.find(make_pair(vr[i],vc[j]))!= mp.end()){

               
                continue;

            }

            else{
                im=0;
                break;
            }

        }

        if(im==0) break;
    }


    
    
    if(im==0) cout<<mr+mc<<endl;
    else cout<<mr+mc-1<<endl;



   
    
    return 0;
}

Measured memory_bytes: 28536
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const int nmax=1000010;
ll fact[nmax],finv[nmax],inv[nmax];
 
void inicom(){
    fact[0]=fact[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for (int i = 2; i < nmax; i++){
        fact[i]=fact[i-1]*i%mod;
        inv[i]=mod-inv[mod%i]*(mod/i)%mod;
        finv[i]=finv[i-1]*inv[i]%mod;
    }
}
ll com(int n,int k){
    if(n<k||n<0||k<0) return 0;
    return fact[n]*(finv[k]*finv[n-k]%mod)%mod;
}


int main(){
    inicom();
    int X,Y; cin>>X>>Y;
    if((X+Y)%3!=0){
        cout<<0<<endl;
        return 0;
    }
    ll n=(2*Y-X)/3,m=(2*X-Y)/3;
    cout<<com(n+m,n)<<endl;
}

Measured memory_bytes: 23680
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x,y,z;
  cin>>x>>y>>z;
  int t;
  t=x;
  x=y;
  y=t;
  t=x;
  x=z;
  z=t;
  cout<<x<<" "<<y<<" "<<z<<endl;
}

Measured memory_bytes: 256
s = gets.chomp!
t = gets.chomp!

ls = s.size
lt = t.size

ans = []
ls.times do |i|
    next if i + lt - 1 >= ls

    c = 0
    lt.times do |j|
        break unless s[i+j] == '?' || s[i+j] == t[j]
        c += 1
    end

    if c == lt
        x = s.dup
        x[i,lt] = t
        ans << x.gsub('?', 'a')
    end
end

puts ans == [] ? "UNRESTORABLE" : ans.sort![0]

Measured memory_bytes: 1788
#pragma GCC optimize("O2")
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<unordered_map>
#include<set>
#include<cmath>
#include<climits>
#include<random>
#include <iomanip>
#include <bitset>
using namespace std;
 
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define fast ios::sync_with_stdio(false); cin.tie(NULL);
 
/////////////////////////////////////////////
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
///////////////////////////////
#define int long long

void solve(){

	int n;
	cin>>n;

	int ans = n/1000 + bool(n%1000);

	ans*=1000;

	cout<<ans-n<<endl;
}
 
signed main(){
 
	fast;
	int t = 1;
	//cin>>t;
	for(int i = 1 ; i <= t ; ++i)
		solve();
}


Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()

using namespace std;

int dx[6] = { 0, 1, 1, 0, -1, -1 };
int dy[6] = { 1, 1, 0, -1, -1, 0 };

int nextInt() {int a; cin >> a; return a;}
char nextChar() {char a; cin >> a; return a;}
double nextDouble() {double a; cin >> a; return a;}
string nextString() {string a; cin >> a; return a;}

void inputVector(vector<int> &v, int &n) {rep(i,n){v.push_back(nextInt());}}
void inputVector(vector<double> &v, int &n) {rep(i,n){v.push_back(nextDouble());}}
void inputVector(vector<string> &v, int &n) {rep(i,n){v.push_back(nextString());}}

signed main() {
    int t, n;
    while (cin >> t >> n) {
	if (t == 0 && n == 0) break;

	set<pair<int, int>> s;
	rep(i, n) {
	    int x, y;
	    cin >> x >> y;
	    s.insert(make_pair(x, y));
	}
	int x, y;
	cin >> x >> y;

	set<pair<int, int>> visited;
	queue<pair<int, int>> q, nq;
	q.push(make_pair(x, y));

	rep(i, t + 1) {
	    while (!q.empty()) {
		pair<int, int> now = q.front(); q.pop();
		if (visited.find(now) != visited.end()) continue;
		if (s.find(now) != s.end()) continue;
		visited.insert(now);
		rep(dir, 6) {
		    auto nx = make_pair(now.first + dx[dir], now.second + dy[dir]);
		    nq.push(nx);
		}
	    }
	    swap(q, nq);
	}

	cout << visited.size() << endl;
    }

    return 0;
}

Measured memory_bytes: 3280
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] tmpArray = br.readLine().split(" ");
		int n = Integer.parseInt(tmpArray[0]);
		int q = Integer.parseInt(tmpArray[1]);

		ArrayManager array = new ArrayManager(n);

		for(int i = 0; i < q; i++){
			tmpArray = br.readLine().split(" ");

			int x = Integer.parseInt(tmpArray[1]);
			int y = Integer.parseInt(tmpArray[2]);

			if(tmpArray[0].equals("0")){
				//array.update(x, y);
				array.add(x, y);
			}
			else {
//				int result = array.findMin(x, y);
//				System.out.println(result);
				long sum = array.getSum(x, y);
				System.out.println(sum);
			}
		}
	}

}

class ArrayManager {
	private int[] array;
	private int n;
	private final int INIT = 0;
	private int origin = 1;
	
	public ArrayManager(int n){
		this.n = n;
		array = new int[n + origin];
		
		

		Arrays.fill(array, INIT);
	}

	public void update(int index, int num){
		array[index] = num;
	}
	
	public void add(int index, int num){
		array[index] += num;
	}

	public int findMin(int s, int t){
		int min = Integer.MAX_VALUE;

		for(int i = s ; i <= t; i++){
			if(min > array[i]){
				min = array[i];
			}
		}

		return min;
	}
	
	public long getSum(int s, int t){
		long sum = 0;
		
		for(int i = s; i <= t ; i++){
			sum += array[i];
		}
		
		return sum;
	}
}

Measured memory_bytes: 65504
/*jai_ganeshdeva*/

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pu push  //  adds the value to the last of the queue 
#define lld long long int
#define ins insert /// used in set to insert the values 
#define adv advance  /// used to increment the iterator
#define mp make_pair
#define fi first
#define se second
#define all(c) c.begin(),c.end()
#define PI 3.1415926
#define INF (lld)1e18
#define vl  vector<long long int >
#define vpl vector< pair<lld ,lld> >
#define vvl vector<vector<lld> > 
#define pll pair <lld,lld>
#define modA(cccc,bbbb ,p) (((cccc+bbbb)%p+p)%p)
#define modS(cccc,bbbb ,p) (((cccc-bbbb)%p+p)%p)
#define modM(cccc,bbbb ,p) ((((cccc%p)*(bbbb%p))%p+p)%p)
/*
long long int modp(lld a,lld p,lld n)
{
    lld d[100];
    lld i,j,k,l;
    if(n==0) return 1;
    for(i=0;n>=1;i++)
    {
        d[i]=n%2;
        n/=2;
    }
    l=i;
    long long int e=1;
    if(d[0]==1) e*=(a%p);
    for(i=1;i<l;i++)
    {
        a*=a;
        a=a%p;
        if(d[i]==1) 
        {
            e*=a;
            e=e%p;
        }
    }
    return e%p;
}
lld modInverse(lld n, lld p) 
{ 
    return modp(n, p, p-2); 
}

lld fac[200001]; 

void getfac(lld p)
{
    fac[0] = 1; 
    for (lld i=1 ; i<=200000; i++) 
        fac[i] = fac[i-1]*i%p; 
}    

long long int nCrmodp(lld n, lld r,lld p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
     
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
}


long long int gcd(lld b,lld a)
{
    if(a<b) return gcd(a,b);
    if(a%b==0) return b;
    return gcd(a%b , b);
}
*/
lld p1=1000000007,p2=998244353;
lld l,r,mid,ans=0;
lld n,i,j,k;
lld x,y,n1,b=0,a,n2,h,z,c;
lld p=1000000000;
double pi=3.1415926535;
    
void solve()
{
    cin>>n;
    x=n%10;
    if(x==0 || x==1 || x==6 || x==8)
    {
        cout<<"pon";
    }
    else if(x==2|| x==4 || x==5||x==7||x==9)
    {
        cout<<"hon";
    }
    else
    {
        cout<<"bon";
    }
}   

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t=1;
    
    // cin>>t;
    //cout<<t;
    //getfac(p2);
    for(int i=0;i<t;i++)
    {
       //cout<<"Case #"<<i+1<<": ";
            solve();
        cout<<"\n";
    }

    return 0;
}

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

ll comb(ll n){
    return n * (n - 1) / 2;
}

int main(){

    ll n, m; cin >> n >> m;
    vector<ll> acc(n + 1);
    acc[0] = 0LL;
    map<ll, ll> M;
    M[0]++;
    for(int i = 1; i <= n; i++){
        cin >> acc[i];
        acc[i] += acc[i - 1];
        acc[i] %= m;
        M[acc[i]]++;
        //cout << acc[i] << " ";
    }
    //cout << endl;
    ll ans = 0LL;
    //cout << combination_mod(5, 2, MOD) << endl;
    for(auto itr : M){
        //cout << itr.first << " " << itr.second << endl;
        if(itr.second >= 2){
            //cout << combination_mod(itr.second, 2, MOD) << endl;
            ans += comb(itr.second);
            //cout << ans << endl;
        }
    }

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

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define endl "\n"
using ll=long long;
using ld=long double;
using namespace std;
const ll mod= 1e9+7;
const ll INF = 1LL<<60;
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 GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }


ll a[1100],b[1100];
vector<ll> dp(11000,INF);
main(){
  ll h,n,ans=0;
  cin>>h>>n;
  rep(i,0,n)cin>>a[i]>>b[i];
  dp[0]=0;
  rep(i,0,n){
    rep(j,0,h+1){
      chmin(dp[min(j+a[i],h)],dp[j]+b[i]);
    }
  }
  cout<<dp[h];
}


Measured memory_bytes: 512
#include<algorithm>
#include<cstdio>
int n,a,num[100],t=0,ans=0;
bool cmp(int m,int n)
{
	return m>n;
}
int main()
{
	scanf("%d%d",&n,&a);
	for(;t<n;t++)
	{
		scanf("%d",&num[t]);
	}
	std::sort(num,num+n,cmp);
	for(t=0;t<a;t++)
	{
		ans+=num[t];
	}
	printf("%d",ans);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
  long long n,k;
  cin >> n >> k;
  long long mod = 1000000007;
  int a[n];
  for (int i = 0; i<n; i++){
    cin >> a[i];
  }
  long long all,r;
  long long kotae =0;
  for (int i=0;i<n;i++){
    all=0;
    r=0;
    for (int m =0;m<i;m++){
      if (a[i] > a[m]){
	all += 1;
      }
    }
    for (int m = i+1;m<n;m++){
      if (a[i] > a[m]){
	all += 1;
	r += 1;
      }
    }
    kotae = (kotae+(r*k%mod)+((k*(k-1)/2)%mod)*all%mod)%mod;
  }
  cout<< kotae%mod <<endl;
  return 0;
}


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

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define fr(i,k) for(i=0;i<k;i++)
#define ALL(c) (c).begin(),(c).end()
#define deb(x) cerr<<#x<<"  = "<<x<<endl;
#define SZ(x) (x).size();
#define ll long long
#define MOD 1000000007
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define em emplace_back
#define ulli unsigned long long int
#define INF 1e18
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> ii;
void solve();

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

int main() {
	fastio;
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/

	int t;
	t=1;

    //cin>>t;
	while (t--)
	{
		solve();
	}
	return 0;
}

ll n;

ll calc(vvi &v,ll i,ll subset,vvi &dp)
{
    if(i==n)
    {
        if(subset==0)
            return 1;
        else
            return 0;
    }

    if(dp[i][subset]!=-1)
        return dp[i][subset];

    ll ans=0;
    for(ll m=0;m<n;m++)
    {
        bool f = ( (1<<m)&(subset) )?1:0;
        if( f && v[i][m]==1)
        {
            ans = (ans + calc(v,i+1,subset^(1<<m),dp))%MOD;
        }
    }

    return dp[i][subset]=ans;

}

void solve()
{
	ll i,j;
	cin>>n;

	vvi v(n,vi(n));

	for(i=0;i<n;i++)
    {
        for(j=0;j<n;j++)
            cin>>v[i][j];
    }

    vvi dp(n,vi(1<<n,-1));

    cout<<calc(v,0,( (1<<n) - 1),dp)<<endl;

}


Measured memory_bytes: 183472
//#include </Users/piyush/Desktop/nodejs/first-app/CP/bits/stdc++.h>
 #include <bits/stdc++.h>
typedef long long ll;
using namespace std;

#define br cout<<"\n"
const int INF=1e9+5;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    ll n,k;
    cin>>n>>k;

    vector<ll> arr(n),dp(n,INF);

    for(ll i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    dp[0]=0;

    for(ll i=1;i<n;i++){
        ll start=i-k;
        if(start<0){
            start=0;
        }

        for(ll j=start;j<i;j++){
            dp[i]=min({dp[i],dp[j]+abs(arr[i]-arr[j])});
        }
    }

    cout<<dp[n-1];br;


}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
const char newl = '\n';
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;
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; }
const long long INF = 1LL<<60;

int main(){
    Int n,p;cin >> n >> p;
    int m = 0;
    rep(i,n){
        int a;cin >> a;
        if(a%2==1) m++;
    }
    if(m==0) cout << (p==0?(1LL<<n):0) << endl;
    else cout << (1LL<<(n-1)) << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<functional>

using namespace std;

long long N, a[10000], b[10000];
long long cnt, pos;

int main() {
	scanf("%lld", &N);
	for (int i = 0; i < N; i++) {
		scanf("%lld", &a[i]);
	}
	for (int i = 0; i < N; i++) {
		scanf("%lld", &b[i]);
	}

	cnt = 0; pos = 0;
	for (int i = 0; i < N; i++) {
		if (a[i] - b[i] > 0) { pos = pos + (a[i] - b[i]); }
		if (a[i] - b[i] < 0) { cnt = cnt + (b[i] - a[i]) / 2; }
	}

	if (pos <= cnt) { printf("Yes\n"); }
	else { printf("No\n"); }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
    string S;
    cin >> S;
    sort(S.begin(), S.end());
    if(S[0]==S[1]&&S[2]==S[3]&&S[1]!=S[2]){
        cout << "Yes" << endl;
    }else{
        cout << "No"<< endl;
    }
    return 0;
}

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

namespace A_Five_Antennas
{
    class Program
    {
        static void Main(string[] args)
        {
            var antennas = new int[5];
            antennas[0] = int.Parse(Console.ReadLine());
            antennas[1] = int.Parse(Console.ReadLine());
            antennas[2] = int.Parse(Console.ReadLine());
            antennas[3] = int.Parse(Console.ReadLine());
            antennas[4] = int.Parse(Console.ReadLine());
            var k = int.Parse(Console.ReadLine());

            if(antennas[4] - antennas[0] <= k)
            {
                Console.WriteLine("Yay!");
            }else{
                Console.WriteLine(":(");
            }
        }
            
    }
}


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

int main(){
    int H, W;
    string S;
    cin >> H >> W;
    int dh[] = {1,-1, 0, 0, 1, 1,-1,-1};
    int dw[] = {0, 0,-1, 1, 1,-1, 1,-1};
    vector<vector<char>> X(H+1, vector<char>(W+1, '#')), ans(H+1, vector<char>(W+1, '#'));
    for(int i = 1; i <= H; ++i){
        cin >> S;
        for(int j = 0; j < S.size(); ++j) X[i][j+1] = S[j];
    }
    for(int i = 1; i <= H; ++i){
        for(int j = 1; j <= W; ++j){
            if(X[i][j] == '.'){
                int buf = 0;
                for(int k = 0; k < 8; ++k){
                    if(1 <= i+dh[k] && i+dh[k] <= H && 1 <= j+dw[k] && j+dw[k] <= W && X[i+dh[k]][j+dw[k]] == '#') ++buf;
                }
                ans[i][j] = '0'+buf;
            }
        }
    }
    for(int i = 1; i <= H; ++i){
        for(int j = 1; j <= W; ++j){
            cout << ans[i][j];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3644
main :: IO ()
main = do
  s <- getLine
  putStrLn $ if isHeisei s then "Heisei" else "TBD"

isHeisei :: String -> Bool
isHeisei s = y * 10000 + m * 100 + d <= 20190430
  where
    y = read $ take 4 s
    m = read $ take 2 $ drop 5 s
    d = read $ drop 8 s


Measured memory_bytes: 508
/* ITP1_2_D: Circle in a Rectangle */

import scala.io.StdIn.{readLine, readInt}

object Main {
  val centerX: Int = 0
  val centerY: Int = 0

  def main(args: Array[String]): Unit = {
    val inputs = readLine().split(" ").map(_.toInt)
    val within = withinRect(inputs)
    println( if (within) "Yes" else "No" )
  }

  def withinRect(inputs: Seq[Int]): Boolean = {
    val Seq(width, height, x, y, radius) = inputs
    val distances = List(
      width - x,
      x - centerX,
      height - y,
      y - centerY
    )
    distances.forall(_ >= radius)
  }
}

Measured memory_bytes: 44076
#include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    ll n,p;
    map <ll,ll> mp;
    vector <ll> at;
    int main(){
    	cin>>n>>p;
    	ll pp=p;
    	for (ll i=2;i*i<=p;i++){
    		if (p%i!=0) continue;
    		while (pp%i==0){
    			mp[i]++;
    			pp/=i;
    			if (mp[i]==1)
    				at.push_back(i); 
    		}
    	}
    	for (ll j=2;j*j<p;j++){
    		if (p%j!=0) continue;
    		ll i=p/j;
    		while (pp%i==0){
    			mp[i]++;
    			pp/=i;
    			if (mp[i]==1)
    				at.push_back(i); 
    		}
    	}
    	ll ans=1;
    	for (ll i=0;i<at.size();i++){
    		for (ll j=0;j<mp[at[i]]/n;j++)
    			ans*=at[i];
    	}
    	cout<<ans;
    	return 0;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
#define rep(i,s,t) for(ll i=s ; i<t ; i++)
typedef pair<int,int> P;
typedef pair<int,P> pp;
const int INF = 1e5;
string s[20];
int h,w;
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
const ll mod = 1e9+7;
int main(){
  ll n;  cin >> n;
  vector<ll> a(n);
  ll cnt[60]={0};
  rep(i,0,n){
    ll add; cin >> add;
    rep(j,0,60){
      if(add & (1LL<<j)){
        cnt[j]++;
      }
    }
  }
  ll ans = 0;
  rep(i,0,60){
    ans += (1LL<<i)%mod * cnt[i] % mod * (n-cnt[i]) % mod;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2560
N,M=list(map(int,input().split()))
ans=-1

S=[];C=[]
for m in range(M):
  s,c=list(map(int,input().split()))
  S.append(s)
  C.append(c)

x=1 if N==1 else 0
for i in range(10**(N-1)-x,10**N):
  tmp=[]
  for m in range(M):
    tmp.append(True if int(list(str(i))[S[m]-1])==C[m] else False)

  if tmp.count(True)==M:
    if int(list(str(i))[0])!=0 or N==1:
      ans=i
    break
  
if M==0 and N==1:
    ans=0
    
print(ans)
      

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using ll = long long;
const ll INF_LL = 1000000000000;
#define fir first
#define sec second

int main()
{
    int n,c;
    std::cin >> n >> c;
    std::vector<std::vector<bool>> ch(c,std::vector<bool>(100010));
    for(int i = 0; i < n; i++){
        int s,t,c;
        std::cin >> s >> t >> c;
        c--;
        for(int i = s; i <= t; i++){
            ch[c][i] = true;
        }
    }
    std::vector<std::pair<int,int>> kukan;
    for(int i = 0; i < c; i++){
        for(int j = 1; j < 100005;){
            if(ch[i][j]){
                int k = j;
                while(ch[i][j])j++;
                kukan.push_back({j,k});
            }else{
                j++;
            }
        }
    }
    int cnt = 0;
    for(int i = 0; i < 100005; i++){
        int cur = 0;
        for(int j = 0; j < c; j++){
            if(ch[j][i])cur++;
        }
        cnt = std::max(cnt,cur);
    }
    std::cout << cnt << std::endl;


    /*
    //区間スケジューリング
    int cnt = 0;
    int cur = -1;
    std::sort(kukan.begin(), kukan.end());
    for(int i = 0; i < n; i++){
        if(kukan[i].second >= cur){
            cnt++;
            cur = kukan[i].first;
        }
    }
    std::cout << cnt << std::endl;
    */
}


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

using namespace std;

const int N = 1e6 + 6;

int to[N][26];
int dp[N][26];
int leaf[N];

int nodes = 1;

char s[N];

int ada[N][26];

long long dfs(int now) {
  long long ret = 0;
  for (int i = 0; i < 26; ++i) {
    if (to[now][i] == 0) continue;
    int u = to[now][i];
    if (leaf[u]) {
      ret += leaf[u] * (dp[now][i] - 1);
    }
    ret += dfs(u);
  }
  return ret;
}

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%s", s);
    int len = strlen(s);
    int now = 1;
    for (int j = 0; j < 26; ++j)
      ada[0][j] = 0;
    for (int j = 0; j < len; ++j) {
      s[j] -= 'a';
      for (int k = 0; k < 26; ++k) {
        ada[j+1][k] = ada[j][k];
      }
      ada[j+1][s[j]] = 1;
    }
    for (int k = 0; k < 26; ++k)
      dp[now][k] += ada[len][k];
    for (int j = len-1; j >= 0; --j) {
      if (to[now][s[j]] == 0) {
        to[now][s[j]] = ++nodes;
      }
      now = to[now][s[j]];
      for (int k = 0; k < 26; ++k) {
        dp[now][k] += ada[j][k];
      }
    }
    ++leaf[now];
  }
  printf("%lld\n", dfs(1));
  return 0;
}


Measured memory_bytes: 349480
#include<iostream>
#include<ctype.h>
#include<string>
 
using namespace std;
 
int main(){
  string s;
  getline(cin,s);
  for(int i=0;i<s.length();i++){
    if(islower(s[i]))
      s[i]=toupper(s[i]);
    else
      s[i]=tolower(s[i]);
  }
  cout << s << endl;
}

Measured memory_bytes: 3136
#include <bits/stdc++.h>
#define maxn 500050
#define ll long long
using namespace std;

ll n,V,l=1,r,tsum,vsum;

double ans;

struct node{
	double t;ll v;
}q[maxn];

void read(ll &x){
	char s=getchar();x=0;
	while(s<'0'||s>'9') s=getchar();
	while(s>='0'&&s<='9') x=(x<<3)+(x<<1)+s-48,s=getchar();
}

int main(){
	read(n);read(V);
	for(int i=1;i<=n;i++){
		ll x,y;
		read(x);read(y);
		while(vsum+y>V){
			ll pr=min(vsum+y-V,q[l].v);
			vsum-=pr;
			q[l].v-=pr;
			tsum-=pr*q[l].t;
			if(q[l].v==0) l++;
		}
		q[++r]=(node){x,y};
		tsum+=x*y;vsum+=y;
		while(l<r&&q[r].t<q[r-1].t){
			q[r-1].t=1.0*(q[r-1].v*q[r-1].t+q[r].v*q[r].t)/(q[r-1].v+q[r].v);
			q[r-1].v+=q[r].v;
			r--;
		}
		printf("%.8lf\n",1.0*tsum/vsum);
	}
	return 0;
}

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

int main () {
  string S ;
  cin >> S ;
  sort(S.begin(),S.end());
  if(S[0]==S[1]&&S[2]==S[3]&&S[1]!=S[2]) cout << "Yes" << endl ;
  else cout << "No" << endl ;
}

Measured memory_bytes: 256