akhauriyash/Code-Regression huggingface dataset:
// ----- In the name of ALLAH, the Most Gracious, the Most Merciful -----

#include<bits/stdc++.h>
using namespace std;

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 NINJA ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<n;i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define dloop(i,n) for(int i=n-1;i>=0;i--)
#define iii tuple<int,int,int>
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define int long long
#define ld long double
#define pb push_back
#define endl "\n"
#define setbits __builtin_popcountll
#define mp map<int,int>
#define F first
#define S second
#define sz(v) (int)v.size()
#define mod 1000000007
#define inf (int)1e18

const int mxn = 1010;
int n,m;
string grid[mxn];
int dp[mxn][mxn];

int32_t main(){
	NINJA;

	cin >> n >> m;
	fo(i,n) cin >> grid[i];
	dp[n-1][m-1] = 1;
	for(int i=n-1;i>=0;i--){
		for(int j=m-1;j>=0;j--){
			if(grid[i][j]=='.')dp[i][j] = (dp[i][j]+dp[i+1][j] + dp[i][j+1])%mod;
			else dp[i][j] = 0;
			
		}
	}
	cout << dp[0][0] << endl;
	
	return 0;
}

Measured memory_bytes: 12584
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

int main(){
	string s; cin >> s;
	int n = s.l_ength();
	ll k; cin >> k;
	if( n == 1 ){
		cout << k/2 << endl;
		return 0;
	}
	ll cnt = 0;
	ll ans = 0;
	bool diff = false;
	for( int i = 0; i < n-1; ++i ){
		if( s[i] != s[i+1] ){
			diff = true;
			break;
		}
	}
	if( s.front() == s.back() && diff ){
		s += '0';
		bool erstmal = true;
		ll x = 0;
		ll y = 0;
		for( int i = 1; i <= n; ++i ){
			if( s[i-1] == s[i] ){
				++cnt;
			} else if( s[i] == '0' ){
				y = cnt;
			} else {
				if( erstmal ){
					x = cnt;
					cnt = 0;
					erstmal = false;
				} else {
					ans += (cnt+1)/2;
					cnt = 0;
				}
			}
		}
		// cout << ans << ' ' << x << ' ' << y << endl;
		cout << ans*k + (x+1)/2 + (y+1)/2 + (x+y+2)/2*(k-1) << endl;
		return 0;
	}
	if( s.front() == s.back() && !diff ){
		cout << n*k/2 << endl;
		return 0;
	}
	s += '0';
	for( int i = 1; i <= n; ++i ){
		if( s[i-1] == s[i] ){
			++cnt;
		} else {
			ans += (cnt+1)/2;
			cnt = 0;
		}
	}
	cout << ans*k << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int dp[][] = new int[n+1][3];
        int a[] = new int[n];
        int b[] = new int[n];
        int c[] = new int[n];
        for (int i=0; i<n; i++) {
          a[i] = sc.nextInt();
          b[i] = sc.nextInt();
          c[i] = sc.nextInt();
        }
        dp[0][0] = dp[0][1] = dp[0][2] = 0;
        for (int i=1; i<=n; i++) {
        	dp[i][0] = Math.max(Math.max(dp[i-1][0] , dp[i-1][1] + a[i-1]), dp[i-1][2] + a[i-1]) ;
            dp[i][1] = Math.max(Math.max(dp[i-1][1],dp[i-1][0]+b[i-1]), dp[i-1][2] + b[i-1]);
            dp[i][2] = Math.max(Math.max(dp[i-1][2],dp[i-1][1]+c[i-1]), dp[i-1][0]+c[i-1]);
        }
        int ans = Math.max(dp[n][0], Math.max(dp[n][1], dp[n][2]));
        System.out.println(ans);
    }
}


Measured memory_bytes: 96476
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int r,w,c,d;
	while(true){
	cin>>r>>w>>c>>d;
	if(!(r+w+c+d))break;
	w=w*c-r;
	if(w<=0){cout<<"0"<<endl;goto loop;}
	if(w%d==0)cout<<w/d<<endl;
	else cout<<w/d+1<<endl;
	loop:;
	}
	return 0;
}

Measured memory_bytes: 3052
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define INF (1LL<<50)

signed main(){

	char a,b;
	cin>>a>>b;

	if(a==b)cout<<"H"<<endl;
	else cout<<"D"<<endl;

	return 0;
}

Measured memory_bytes: 256
S = 13 * 0
H = 13 * 1
C = 13 * 2
D = 13 * 3
 
#???????????????????¨??????????????????????????????????????????????????????????,???????????????:1???
#??????????????????????????????5???S(???0)+5???????????????11???D(???39)+11??§??¨??????
#?????????0???????????¨
card_count = [0 for i in range(53)] 

n = int(input())

for i in range(n):
    card_type, card_num = input().split()
    card_count[eval(card_type)+int(card_num)] += 1 #???????????£????¨??????¨???????????????????????°???1????¶????

for s in ['S','H','C','D']:
    for i in range(1, 13+1):
        if card_count[eval(s)+i] == 0: #??????????????°???0??????
            print("{0} {1}".format(s,i)) #?¨??????¨?????????????????????

Measured memory_bytes: 7736
#include <iostream>

using namespace std;

typedef long long ll;

int main() {
	int n;
	while ( cin >> n, n ) {
		ll dp[50] = {1};
		for (int i = 0; i < n; ++i) {
			for (int j = 1; j <= 3; ++j) {
				dp[i+j] += dp[i];
			}
		}

		ll day = (dp[n] + 9) / 10;
		ll year = (day + 364) / 365;
		cout << year << endl;
	}
	
}

Measured memory_bytes: 1156
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCorder
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }
        public void Solve(ConsoleInput cin)
        {
            var X = cin.ReadInt;
            var t = cin.ReadInt;
            var ans = Max(0, X - t);
            WriteLine(ans);
        }
        
        /*public long C(long n, long r)
        {
            if (r == 0 || r == n) return 1L;
            if (n < r) return 0L;
            long[,] Pascal = new long[n + 1, n + 1];
            Pascal[0, 0] = 1;
            for (long i = 1; i <= n; i++)
            {
                Pascal[i, 0] = 1;
                Pascal[i, i] = 1;
                for (long j = 1; j < n; j++)
                {
                    Pascal[i, j] = Pascal[i - 1, j] + Pascal[i - 1, j - 1];
                }
            }
            return Pascal[n, r];
        }*/

        public class ConsoleInput
        {
            private readonly System.IO.TextReader _stream;
            private char _separator = ' ';
            private Queue<string> inputStream;
            public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
            {
                this._separator = separator;
                this._stream = stream;
                inputStream = new Queue<string>();
            }
            public string Read
            {
                get
                {
                    if (inputStream.Count != 0) return inputStream.Dequeue();
                    string[] tmp = _stream.ReadLine().Split(_separator);
                    for (int i = 0; i < tmp.Length; ++i)
                        inputStream.Enqueue(tmp[i]);
                    return inputStream.Dequeue();
                }
            }
            public string ReadLine { get { return _stream.ReadLine(); } }
            public int ReadInt { get { return int.Parse(Read); } }
            public long ReadLong { get { return long.Parse(Read); } }
            public double ReadDouble { get { return double.Parse(Read); } }
            public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
            public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
            public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        }
    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

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

    if(d < 10) {
        out(0);
        re0;
    }

    ll ans = 0;
    exrep(x, 1, m) {
        exrep(y, 10, d) {
            ll a = y/10;
            ll b = y%10;
            if(a < 2 || b < 2) {
                continue;
            }
            if(a*b == x) {
                ans++;
            }
        }
    }

    out(ans);
    re0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int>pa;
map<int,int>mp;
const int N=2e5+100;
ll c[100][100];
ll x[100];
void init()
{
    memset(c,0,sizeof c);
    c[0][0]=1;
    for(int i=1;i<=50;i++){
        c[i][0]=1;
        for(int j=1;j<=i;j++){
            c[i][j]=c[i-1][j-1]+c[i-1][j];
        }
    }
}
int main()
{
  // ios::sync_with_stdio(0);cin.tie(0);
    int n,a,b;
    init();

    cin>>n>>a>>b;
    for(int i=1;i<=n;i++)
        cin>>x[i];
    sort(x+1,x+1+n,greater<ll>());
    long double ave=0;
    for(int i=1;i<=a;i++)
        ave+=x[i];
    int pos1,pos2;
    for(int i=1;i<=n;i++){
        if(x[i]==x[a]) {
            pos1=i;
            break;
        }
    }
    for(int i=n;i>=1;i--){
        if(x[i]==x[a]){
            pos2=i;
            break;
        }
    }
    int k=b;
    if(pos1!=1) k=a;
    k=min(k,pos2);
    ll ans=0;
    int num=pos2-pos1+1;
   // cout<<a<<" "<<k<<" "<<num<<endl;
    for(int i=a;i<=k;i++){
        ans+=c[num][i-pos1+1];
    }
    cout<<fixed<<setprecision(6);
    cout<<ave/a<<endl;
    cout<<ans<<endl;
    return 0;
}
/*
15 8 11
981260158260522 316250877914575 547116602436426 223540024979445 408917861648772 859962623690081 509054433933447 713016476190629 845426262703497 335723211047202 842184971407775 49062628894325 324828731963982 979173822804784 312150450968417

*/


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

int n,m,i,j,x,y,ans,order[100000],buc[101],brig[100000][3],node[10000];

void swap (int* x,int* y){
	int z;
	z=*x;
	*x=*y;
	*y=z;
}

int main(){
	buc[0]=-1;
	while(scanf("%d %d",&n,&m)*n){
		for(i=1;i<101;i++)buc[i]=0;
		for(i=0;i<m;i++){
			scanf("%d %d %d",&brig[i][0],&brig[i][1],&brig[i][2]);
			if(brig[i][0]>brig[i][1])swap(&brig[i][0],&brig[i][1]);
			buc[brig[i][2]]++;
		}
		for(i=1;i<101;i++)buc[i]+=buc[i-1];
		for(i=m-1;i>=0;i--){
			order[buc[brig[i][2]]]=i;
			buc[brig[i][2]]--;
		}
		for(i=0;i<n;i++)node[i]=i;
		
		m=n-1;i=0;ans=0;
		while(m>0){
			x=node[brig[order[i]][0]];
			y=node[brig[order[i]][1]];
			if(x!=y){
				m--;ans+=brig[order[i]][2];
				for(j=0;j<n;j++){if(node[j]==y)node[j]=x;}
			}
			i++;
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 608
import java.util.Scanner;
import java.util.TreeMap;
public class Main {
//One to One Correspondence
//Every single char in S has to correspond with every single char in T
//Every single char in T has to correspond with every single char in S
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int N = S.length();
		TreeMap<Character, Character> StoT = new TreeMap<>();
		TreeMap<Character, Character> TtoS = new TreeMap<>();
		for (int i=0; i<N; i++){
			if (StoT.containsKey(S.charAt(i)) && (StoT.get(S.charAt(i)) != T.charAt(i))){
				System.out.println("No");
				System.exit(0);
			}
			if (TtoS.containsKey(T.charAt(i)) && (TtoS.get(T.charAt(i)) != S.charAt(i))){
				System.out.println("No");
				System.exit(0);
			}
			StoT.put(S.charAt(i), T.charAt(i));
			TtoS.put(T.charAt(i), S.charAt(i));
		}
		System.out.println("Yes");
		
	}

}

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

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

    ll N, K;
   
    cin >> N >> K;
    vector<ll> H(N);

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

    if(K >= N)
    {
        cout << 0;
        return 0;
    }
  	else if(K == 0)
    {
       cout << accumulate(H.begin(), H.end(), 0LL);
       return 0;
    }
    else
    {
        sort(H.begin(), H.end(), std::greater<ll>());
        rep(i, K)
        {
            H[i] = 0;
        }
        cout << accumulate(H.begin(), H.end(), 0LL);
    }
    
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	vector<int> v(n);
	for (int i = 0; i < n-1; i++)
	{	
		int a;
		cin >> a;
		v[a-1]++;
	}
	for (int x : v)
	{
		cout << x << endl;
	}
	return 0;
}

Measured memory_bytes: 4016
n=int(input())
a1=list(map(int,input().split()))
a2=list(map(int,input().split()))
i=1
ans=0
while i<n+1:
    ans=max(sum(a1[0:i])+sum(a2[i-1:n]),ans)
    i=i+1
else:
    print(ans)

Measured memory_bytes: 38384
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    w,h,x,y = map(int, input().split())
    if x==w/2 and y==h/2:
        print(w*h/2, 1)
    else:
        print(w*h/2, 0)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
N=gets.to_i
M=10**9+7
*F=I=[r=1,t=1]
R=1,1,*(2..N).map{|i|I<<z=M/i*-I[M%i]%M;F<<r=r*i%M;t=t*z%M}
(-~N/2...N).each{|i|r-=F[i-1]*R[2*i-N]*F[i]%M}
p r%M
###############################################
###############################################
###############################################
###############################################
###############################################

Measured memory_bytes: 35096
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,m,k,cnt=0,a[11][1001],ch[11],ans=1e9;
void work(int t)
{
	vector<int> tot(15,0);
	int cut=0;
	for(int i=1;i<=m;i++)
	{
		vector<int> now(15,0);
		bool flag=0;
		for(int l=1;l<=n;l++)
			now[ch[l]]+=a[l][i];
		for(int l=1;l<=t;l++)
			if(tot[l]+now[l]>k)
			{
				flag=1;
				break;
			}	
		if(flag)
			for(int l=1;l<=t;l++)
				tot[l]=now[l];
		else
			for(int l=1;l<=t;l++)
				tot[l]+=now[l];
		cut+=flag;
	}
	for(int l=1;l<=t;l++)
		if(tot[l]>k)
			return ;
	ans=min(ans,cut+t-1);
}
void dfs(int now,int t)
{ 
	if(now==n+1)
	{
		work(t);
		return ;
	}
	ch[now]=t;
	dfs(now+1,t);
	if(now!=1)
	{
		ch[now]=t+1;
		dfs(now+1,t+1);
	}
}
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>n>>m>>k;
	for(int i=1;i<=n;i++)
	{
		string s;
		cin>>s;
		for(int l=1;l<=m;l++)
			a[i][l]=s[l-1]-'0';
	}
	dfs(1,1);
	cout<<ans;
	return 0;
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

signed main()
{
    string S;
    cin >> S;

    ll ans = 0;
    REP(i, S.length()) {
        ll cand = 0;
        for(int j = i; j < S.length(); ++j) {
            if(S[j] != 'A' && S[j] != 'C' && S[j] != 'G' && S[j] != 'T') {
                break;
            }
            cand++;
        }
        ans = max(ans, cand);
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<ll>>;
using P = pair<int,int>;

#define MOD 1000000007
#define INF 1000000
#define PI 3.14159265358979323846264338327950L
#define MAX 200010
#define lb lower_bound //[2,4)=lb(4)-lb(2);

#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << end

/*
こういう問題あんまり好きじゃない・・・・
K=10^5なので操作して変更しながら数えるとかは不可能
つまり最初の条件ですぐ答えが出るということ・・・

一回の操作で増える幸福度に注目すると高々２であることがわかる
＋１・・・・端っこを含む場合
＋２・・・・端っこを含まない場合
*/

ll count_happy(string S)
{
  ll n = S.size();
  ll count=0;
  rep(i,n-1)
  {
    if (S[i]==S[i+1]) count++; 
  }
  return (count);
}

int main()
{
  ll N,K;cin>>N>>K;
  string S;cin>>S;
  
  ll count=0;
  ll flag=1;
  int i=0;
  while (i<N-1)
  {
    while (S[i]==S[i+1]) i++;
    if (S[i]=='R' && i!=N-1) count++;
    i++;
  }
  //cout<<count<<endl;
  
  ll ans = count_happy(S);
  if (count >= K) 
  {
    ans += 2*K;
    //cout<<"==="<<endl;
  }
  else
  {
    ans = N-1;
  }

  cout<<ans<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define F first
#define S second
#define endl "\n"
#define nl cout<<endl
#define pb push_back
#define f(i,a,b) for(ll i=a;i<b;i++)
#define Knucklehead ios_base::sync_with_stdio(false);cin.tie(NULL);
#define txti freopen("input.txt", "r", stdin);
#define txto freopen("output.txt", "w", stdout);
//#define mod 100000007

#define mat vector<vector<ll>>
mat cn(ll n, ll m){return vector< vector<ll> >(n, vector<ll>(m));}
bool compare(char &s1,char &s2){return s1 > s2;} 

bool sortmahstyle(const pair<ll,ll> &a,  const pair<ll,ll> &b) 
{ 
    if(a.second > b.second )
        return true;
    if( a.second==b.second && a.first > b.second )
       return true;
 
    return false;
 }
//me
ll const mod = 1e9+7;
ll const inf = 3e3;
bool isdif(ll a, ll b, ll c)
{
    if( a!=b && b!=c && c!=a )
        return 1;
    return 0;
}
bool poss(ll a, ll b, ll c)
{
    if( (a+b>c) && (b+c>a) && (c+a>b) )
        return 1;
    return 0;
}

void solve()
{
    ll x, k ,d ; cin >> x >> k >> d;
    x = abs(x);
    if(x/k >= d)
        cout << x-d*k << endl;
    else{
        ll big_pp = (x+d-1)/d;

        ll rem  = k-big_pp;
    
        ll pp = abs(x - d*big_pp);


        if(rem%2==0)
            cout << pp << endl;
        else
            cout << min(pp+d, abs(pp-d)) << endl;

    }
}
int main() {
Knucklehead 
//*
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
/**/ 
        
        ll t;
        /**/t=1;
        /*/cin>>t;/**/
        f(testcases,0,t){
            solve();
        }
 
 
    return 0;
}

Measured memory_bytes: 3644
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

N=gets.to_i
A=get_i
if A.count{|x| x.odd?}.even?
  puts "YES"
else
  puts "NO"
end

Measured memory_bytes: 9484
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int a[100001];
int n;
int gf[100001],gb[100001];
int main(){
    cin>>n;
    int ai;
    int tg=0;
    rep(i,n){
        cin>>a[i];
    }
    int cf=0,cb=0;
    FOR(i,1,n){
        gf[i]=__gcd(gf[i-1],a[i-1]);
        gb[n-i-1]=__gcd(gb[n-i],a[n-i]);
    }
    int ans=0;
    rep(i,n){
        ans=max(ans,__gcd(gf[i],gb[i]));
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1408
# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *
from heapq import *
from string import *				# alpha = ascii_lowercase
from random import *				# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from bisect import *				# bisect_left(arr,x,start,end)  => start and end parameters are temporary
from sys import stdin				# bisect_left return leftmost position where x should be inserted to keep sorted
from sys import maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *
from collections import Counter		# d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)

'''

'''

def solve(l):
	n = len(l)
	

N = int(stdin.readline())
ans = pi*(N*2)
print(ans)









Measured memory_bytes: 76612
using System;
 
namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
   string S=Console.ReadLine();
      string T=Console.ReadLine();
      int count=S.Length;
      string hikaku=T.Substring(0,count);
      if(S==hikaku){
        Console.WriteLine("Yes");}
      else{
        Console.WriteLine("No");
      }
    
      
      
    }
    
  }

}

Measured memory_bytes: 25712
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;

int gcd(long long a, long long b){
    if (a%b == 0) return(b);
    else return(gcd(b, a%b));
}

long long lcm(long long a, long long b){
    return a*b/gcd(a,b);
}

int main(){
    long long a, b;
    cin >> a >> b;
    if(a>b) swap(a, b);
    cout << lcm(a, b) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
using PP = pair<int, P>;
using PPP = pair<P, P>;
int N;
vector<int> p;
constexpr int INF = 300000;

class segTree
{
    int num;
    vector<PPP> v;
    void update(int i)
    {
        P tmp_odd = min(v[2 * i + 1].first, v[2 * i + 2].first);
        P tmp_even = min(v[2 * i + 1].second, v[2 * i + 2].second);
        v[i] = make_pair(tmp_odd, tmp_even);
    }
public:
    segTree(){ ;}
    segTree(vector<int> v_init, P DEFAULT)
    {
        num = v_init.size();
        int tmp = 1;
        while (tmp<(int)v_init.size()) tmp*=2;
        tmp *= 2;
        v.resize(tmp, make_pair(DEFAULT, DEFAULT));
        for (int i = 0; i < num; i++)
        {
            if (i&1) v[tmp/2-1+i] = make_pair(DEFAULT, make_pair(v_init[i], i));
            else v[tmp/2-1+i] = make_pair(make_pair(v_init[i], i), DEFAULT);
        }
        for (int i = tmp / 2 - 2; i >= 0; i--) update(i);
    }
    PPP query_min(int begin, int end, int node, int l, int r)
    {
        if (r <= begin || l >= end) return make_pair(make_pair(INF, INF), make_pair(INF, INF));
        if (begin<=l && end>=r) return v[node];

        PPP v_l = query_min(begin, end, 2 * node + 1, l, (l + r) / 2);
        PPP v_r = query_min(begin, end, 2 * node + 2, (l + r) / 2, r);
        return make_pair(min(v_l.first, v_r.first), min(v_l.second, v_r.second));
    }
    P query_min_odd(int begin, int end)
    {
        if (begin % 2 == 0)
        {
            return query_min(begin, end, 0, 0, (int)v.size() / 2).first;
        }
        else
        {
            return query_min(begin, end, 0, 0, (int)v.size() / 2).second;
        }
    }
};

int main()
{
    cin >> N;
    p.resize(N);
    for (auto &i : p) cin >> i;

    segTree tree(p, make_pair(INF, INF));

    priority_queue<PPP, vector<PPP>, greater<PPP> > que;
    que.push(make_pair(tree.query_min_odd(0, N), make_pair(0, N)));

    vector<int> res;
    while (!que.empty())
    {
        PPP q = que.top();
        que.pop();

        int val1 = q.first.first;
        int arg1 = q.first.second;
        P range = q.second;
        P val2cand = tree.query_min_odd(arg1 + 1, range.second);
        int arg2 = val2cand.second;
        res.push_back(val1); res.push_back(val2cand.first);
        if (range.first < arg1) que.push(make_pair(tree.query_min_odd(range.first, arg1), make_pair(range.first, arg1)));
        if (arg1 + 1 < arg2) que.push(make_pair(tree.query_min_odd(arg1+1, arg2), make_pair(arg1+1, arg2)));
        if (arg2 + 1 < range.second) que.push(make_pair(tree.query_min_odd(arg2+1, range.second), make_pair(arg2+1, range.second)));
    }
    for (auto v : res) cout << v << " ";
    return 0;
}

Measured memory_bytes: 12912
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var stArrayData = System.Console.ReadLine();
            var result = int.Parse(stArrayData[0].ToString()) + int.Parse(stArrayData[1].ToString()) + int.Parse(stArrayData[2].ToString());
            System.Console.WriteLine(result.ToString());
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
using namespace std;
main () {
	string s;
	int ada = 0;
	cin>>s;
	for (int i=0;i<s.length();i++) {
		if (s[i] == '7') {
			ada++;
		}
	}
	if (ada > 0) {
		cout<<"Yes"<<endl;
	} else {
		cout<<"No"<<endl;
	}
}

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

int n, k;
int v[50];

signed main() {
  cin >> n >> k;
  rep(i,n) cin >> v[i];

  int ans = 0;

  for (int a=0; a<=min(n,k); a++ ) 
    for(int b=0; b<=min(n,k) - a; b++)
    {
      multiset<int> s;
      int sum = 0;
      for(int i=0; i<a; i++) {
        sum += v[i];
        s.insert(v[i]);
      }
      for(int i=n-1; i>=n-b; i--) {
        sum += v[i];
        s.insert(v[i]);
      }
      int cd=min(a+b, k-a-b);
      rep(i, cd) {
        int m = *s.begin();
        if (m>=0) break;
        sum -= m;
        s.erase(m);
      }
      ans = max(ans ,sum);
    }
  cout << ans << endl;
}


Measured memory_bytes: 3604
#include<cstdio>
int n;
bool a[100010];
signed main()
{
	scanf("%d",&n);int t,ans(0);bool f(0);
	while(n--)
		scanf("%d",&t),!a[t]?a[t]=1,ans++:f=!f;
	return printf("%d\n",ans-f),0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
const long MOD = 1000000007;

int N;
string S;
map<char, long> mp;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> S;
  for (int i = 0; i < N; i++) {
    mp[S[i]]++;
  }

  long ans = 1;
  for (auto &e : mp) {
    ans *= (e.second + 1);
    ans %= MOD;
  }
  ans--;

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

Measured memory_bytes: 512
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

debug = True
# debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)

def solve():
    N = II()
    S = SI()

    current = ''
    cnt = 0
    for c in S:
        if c == current:
            pass
        else:
            cnt += 1
        current = c
    print(cnt)


solve()

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const int INF = 2e9;
template<class T> void print(const T& t){ cout << t << endl; }
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 gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  ll n, k;
  cin >> n >> k;
  if(k==1){
    print(0);
    return 0;
  }
  ll ans = n - k;
  print(ans);
}

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


using namespace std;

int gcd(int a, int b)
{
	if (a < b)
		return gcd(b, a);
	else if (b == 0)
		return a;

	return gcd(b, a % b);
}

int main()
{
	int a, b;
	while (scanf("%d %d", &a, &b) != EOF)
		printf("%d\n", gcd(a, b));

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <string>
#include <string.h>
#include <math.h>
#include <iomanip>
#include <stdio.h>
using namespace std;

#define int64 long long
#define pii pair <int, int>
#define fr first
#define sc second
#define heap priority_queue
struct piii{
    int64 fr, sc, th;
    bool operator < (const piii &b){
        if (fr != b.fr) return fr < b.fr;
        if (sc != b.sc) return sc < b.sc;
        return th < b.th;
    }
};
///////////////////////////////////////////////
///////////////////////////////////////////////

const int maxn = 2e5 + 5;
int n;
int a[maxn], f[maxn], p[maxn];
set <pii> fe[maxn];
vector <pii> b;
vector <int> e[maxn];

void add(int pos, pii val){
    if (pos > n) return;
    fe[pos].insert(val);
    add(pos + (pos & (-pos)), val);
}

void del(int pos, pii val){
    if (pos > n) return;
    fe[pos].erase(val);
    del(pos + (pos & (-pos)), val);
}

int get(int pos){
    if (pos == 0) return 0;
    if (fe[pos].empty()) return get(pos - (pos & (-pos)));
    return max((*fe[pos].rbegin()).fr, get(pos - (pos & (-pos))));
}

void dfs(int u, int par){
    int pos = lower_bound(b.begin(), b.end(), pii({a[u], -1})) - b.begin() - 1;
    f[u] = get(pos) + 1;
    add(p[u], pii({f[u], u}));
    for (int v : e[u])
    if (v != par){
        dfs(v, u);
    }
    del(p[u], pii({f[u], u}));
}

void dfs1(int u, int par){
    for (int v : e[u])
    if (v != par){
        f[v] = max(f[v], f[u]);
        dfs1(v, u);
    }
}

int main(){
    cout << setprecision(2) << fixed;
    ios::sync_with_stdio(false), cin.tie(0);
    //freopen("input.txt", "r", stdin);
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    int u, v;
    for (int i = 1; i < n; i++){
        cin >> u >> v;
        e[u].push_back(v);
        e[v].push_back(u);
    }
    b.resize(n + 1);
    for (int i = 1; i <= n; i++) b[i] = {a[i], i};
    sort(b.begin() + 1, b.end());
    for (int i = 1; i <= n; i++) p[b[i].sc] = i;
    dfs(1, 0);
    dfs1(1, 0);
    for (int i = 1; i <= n; i++) cout << f[i] << endl;
    return 0;
}


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

using namespace std;

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

signed main(){

	lli n,k;

	cin>>n>>k;

	/*コインで出た目がaのとき、何回2乗すればいいか？*/
	/*逆にkから考えて、2で割っていってその数より大きければ1回で済む*/
	/*まず、k以上出たらそれで終了なのでそれが正解*/
	vector<double> a(n+1);
	a[0]=0;
	lli base = 1;
	for(lli i=n;i>0;i--){
		if(i*base < k){
			i++;
			base*=2;
		}
		else{
			a[i] = (double)(1)/(double)(n*base);
			if(DEBUG)cout<<"i="<<i<<"a[i]"<<a[i]<<endl;
		}
	}

	double ans=0;
	REP(i,0,n+1){
		ans += a[i];
	}

	printf("%.013f\n",ans);
	return 0;
}

Measured memory_bytes: 1024
require 'prime'
a,b,c=gets.split.map(&:to_i)
d=c<2 ? [[c]] : c.prime_division.map{|e,n|0.step(n).map{|i|e**i}}
p d.shift.product(*d).map{|e|e.reduce(:*)}.count{|e|a<=e&&e<=b}

Measured memory_bytes: 6256
#include<bits/stdc++.h>
#define oo 1000000007
using namespace std;
long long k;
long long dp[10005][105][2];
string s;
vector<long long>num;
long long solve(long long idx, long long sum, long long tight)
{
    if (idx == num.size())
        return (sum%k==0);
    if (dp[idx][sum][tight] != -1)
        return dp[idx][sum][tight];
    long long res = 0;
    long long biggest=(tight)?num[idx]:9;
    for (int i = 0; i <= biggest; i++)
    {
        long long newtight = ((num[idx])== i) ? tight : 0;
        res =(res+solve(idx + 1,(sum + i)%k, newtight))%oo;
    }
    dp[idx][sum][tight] = res;
    return res;
}
long long khoitao(string s)
{

    for(long long i=0;i<s.size();i++)
        num.push_back(s[i]-'0');
    return solve(0,0,1);
}
main()
{
    num.clear();
    memset(dp,-1,sizeof(dp));
    cin>>s>>k;
    cout<<(khoitao(s)-1+oo)%oo;
    return 0;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//typedef vector<vector<ll>> Graph;

const ll mod = 1e9 + 7;
//const ll mod = 998244353;

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define spa << " " <<
#define fi first
#define se second

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; }

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

template<typename T> void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cerr<<v[i][0];for(ll j=1;j<w;j++)cerr spa v[i][j];cerr<<endl;}};
template<typename T> void debug(vector<T>&v,ll n){if(n!=0)cerr<<v[0];
for(ll i=1;i<n;i++)cerr spa v[i];
cerr<<endl;};

string num2bit(ll num, ll len){
    string bit = "";
    REP(i, len){
    bit += char('0'+(num>>i & 1));
    }
    return bit;
}

const ll INF = (1ll<<60);
vector<ll> dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};

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

    ll N;
    cin >> N;
    vector<ll> A(N*N);
    vector<vector<ll>> D(N, vector<ll>(N, INF));
    vector<vector<ll>> H(N, vector<ll>(N, 1));
    REP(i, N*N) cin >> A[i];
    REP(i, N*N) A[i]--;

    REP(i, N){
        REP(j, N){
            vector<ll> vals = {j, N-1-j, i, N-1-i};
            REP(k, 4){
                chmin(D[i][j], vals[k]);
            }
        }
    }

    ll res = 0;
    REP(i, N*N){
        ll r = A[i]/N;
        ll c = A[i]%N;
        H[r][c]--;

        /*
        dump(r)
        dump(c)
        cout << D << endl;
        cout << endl;
        cout << H << endl;
        cout << endl;
        */

        res += D[r][c];

        queue<pll> qu;
        qu.push({r, c});

        while(!qu.empty()){
            auto now = qu.front();qu.pop();
            ll nr = now.first;
            ll nc = now.second;
            REP(d, 4){
                ll er = nr + dx[d];
                ll ec = nc + dy[d];
                if(er<0 or er>N-1 or ec<0 or ec>N-1) continue;
                if(D[er][ec]>D[nr][nc]+H[nr][nc]){
                    D[er][ec] = D[nr][nc]+H[nr][nc];
                    qu.push({er, ec});
                }
            }
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 9248
#[allow(unused_imports)]
use std::cmp::{max, min};
use std::io::{stdin, stdout, BufWriter, Write};

fn main() {
    let out = &mut BufWriter::new(stdout());

    for i in 0..10000 {
        let mut input = String::new();
        stdin().read_line(&mut input).ok();
        match input.trim().parse::<i32>() {
            Ok(x) => {
                writeln!(out, "Case {}: {}", i+1, x).ok();
            }
            _ => break,
        }
    }
}



Measured memory_bytes: 5048
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

string str;
vector<int> v(105,0);

int main()
{
  int i=0;
  int m=0;
  int n;
  while(scanf("%d",&n)!=EOF){
    v[n]++;
    i++;
  
  }
  int num=i;

  rep(i,num)
    m=max(m,v[i]);
  
  rep(i,num)
    if(v[i]==m)
      cout<<i<<endl;

}

Measured memory_bytes: 1212
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>

using namespace std;


int main() {
	int N;
	string name;
	int ans = 0;

	cin >> N >> name;

	for (int i = 0; i < N; i++) {
		string word;
		cin >> word;

		vector<int> first, second;
		for (int j = 0; j < word.size(); j++) {
			if (name[0] == word[j]) {
				first.push_back(j);
			}
		}
		for (int j = 0; j < word.size(); j++) {
			if (name[1] == word[j]) {
				second.push_back(j);
			}
		}

		bool judge = true;
		for (int j = 0; j < first.size() && judge == true; j++) {
			for (int k = 0; k < second.size() && judge == true; k++) {
				if (first[j] < second[k]) {
					int tmp = first[j];
					for (int l = 0; l < name.size() && tmp < word.size(); l++) {
						if (word[tmp] != name[l]) {
							break;
						}
						else if (l == name.size() - 1) {
							ans++;
							judge = false;
						}
						tmp += second[k] - first[j];
					}
				}
			}
		}
	}

	cout << ans << endl;

	return 0;
}

/*
int main() {
	int N, K;
	cin >> N >> K;

	for (int i = 0; i < K; i++) {
		int a, b;
		cin >> a >> b;

		if (a > N / 2) {
			a = N - a + 1;
		}
		if (b > N / 2) {
			b = N - b + 1;
		}

		int tmp = min(a, b);
		
		tmp = tmp % 3;
		if (tmp == 0) tmp = 3;

		cout << tmp << endl;
	}

	return 0;
}
*/

/*
//パーティー
int main() {
	int N, M;
	cin >> N >> M;
	bool Friends[500][500] = {};
	bool already[500] = {};
	already[0] = true;

	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		Friends[a][b] = true;
		Friends[b][a] = true;
	}

	int ans = 0;
	for (int i = 0; i < N; i++) {
		if (Friends[0][i] == true) {
			if (already[i] == false) {
				ans++;
				already[i] = true;
			}
			for (int j = 0; j < N; j++) {
				if (Friends[i][j] == true && already[j] == false) {
					already[j] = true;
					ans++;
				}
			}
		}
	}

	cout << ans << endl;

	return 0;
}
*/

/*
//カードゲーム
int main() {
	int N;
	cin >> N;
	int TaroSize = N;
	int HanaSize = N;

	int Taro[210];
	for (int i = 1; i <= 2 * N; i++) {
		Taro[i] = -1;
	}

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

	bool TaroTurn = true;
	int Now = 0;
	while (TaroSize != 0 && HanaSize != 0) {
		if (TaroTurn) {
			for (int i = Now + 1; i <= 2 * N; i++) {
				if (Taro[i] == 1) {
					Now = i;
					Taro[i] = 0;
					TaroSize--;
					TaroTurn = false;
					if (Now == 2 * N) {
						Now = 0;
						TaroTurn = true;
					}
					break;
				}
				else if (i >= 2 * N - 1) {
					Now = 0;
					TaroTurn = false;
				}
			}
		}
		else {
			for (int i = Now + 1; i <= 2 * N; i++) {
				if (Taro[i] == -1) {
					Now = i;
					Taro[i] = 0;
					HanaSize--;
					TaroTurn = true;
					if (Now == 2 * N) {
						Now = 0;
						TaroTurn = false;
					}
					break;
				}
				if (i >= 2 * N) {
					Now = 0;
					TaroTurn = true;
				}
			}
		}
	}

	cout << HanaSize << endl;
	cout << TaroSize << endl;


	return 0;
}
*/


Measured memory_bytes: 3144
def f(h, a, b)
  base = b
  optional = a-b
  (1..h.max).bsearch{|i|
    cnt = 0
    h.map{|hp|
      cnt += ([hp - base * i, 0].max.fdiv(optional)).ceil
#      break if cnt > i
    }
    cnt <= i
  }
end

N, A, B = gets.split.map(&:to_i)
H = N.times.map{gets.to_i}

p f(H, A, B)


Measured memory_bytes: 17972
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

struct edge{
	int f,t;
	int c,d;
	double cost;
	edge(){}
	bool operator<(const edge &e)const{
		return cost<e.cost;
	}
};

int n,m;
edge e[100001];
int par[10001],rank[10001];

int find(int x){
	if(par[x]==x){
		return x;
	}else{
		return par[x]=find(par[x]);
	}
}

void unite(int x,int y){
	x=find(x);
	y=find(y);
	if(x==y)return;
	if(rank[x]<rank[y]){
		par[x]=y;
	}else{
		par[y]=x;
		if(rank[x]==rank[y])rank[x]++;
	}
}

bool same(int x,int y){
	return find(x)==find(y);
}

bool C(double x){
	for(int i=0;i<m;i++){
		e[i].cost=(double)e[i].c*x-e[i].d;
	}
	sort(e,e+m);
	double res=0.0;
	for(int i=0;i<n;i++){
		par[i]=i;
		rank[i]=0;
	}
	for(int i=0;i<m;i++){
		if(!same(e[i].f,e[i].t)){
			unite(e[i].f,e[i].t);
		}else res+=e[i].cost;
	}
	return res>=0.0;
}

int main(void){
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		scanf("%d%d%d%d",&e[i].f,&e[i].t,&e[i].c,&e[i].d);
	}
	double l=0.0,r=1000000.0;
	for(int i=0;i<100;i++){
		double mid=(l+r)/2;
		if(C(mid))r=mid;
		else l=mid;
	}
	printf("%.9f\n",r);
	return 0;
}

Measured memory_bytes: 3488
import java.io.IOException;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);

		String S_date = scan.next();

		DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy/MM/dd");

		LocalDate ld = LocalDate.parse(S_date, df);

		LocalDate kijun = LocalDate.of(2019, 4, 30);

		if (ld.isEqual(kijun) || ld.isBefore(kijun)) {
			System.out.println("Heisei");
		} else {
			System.out.println("TBD");
		}
	}

	//***********************以下共通関数************************************************
	/**
	 * 文字列を反転して返す
	 * @param pStr 文字列
	 * @return 反転した文字列
	 */
	public static String myReverse(String pStr) {
		if (pStr.length() < 1) {
			return "";
		}

		StringBuffer sb = new StringBuffer(pStr);
		return sb.reverse().toString();
	}

	/**
	 * 余りを求める。
	 * @param a
	 * @param b
	 * @return 余り。余りがマイナスの時はプラスで返す。
	 */
	public static long myMod(long a, long b) {
		long ret = 0;

		ret = a % b;

		if (ret < 0) {
			ret += b;
		}

		return ret;
	}

	/**
	 * 乗数を求める ※mod対応
	 * @param kisu 基数
	 * @param josu 乗数
	 * @param primeNumMod_0 法 mod値 使わない場合は「0」
	 * @return
	 */
	public static long myPowWithMod(long kisu, long josu, long primeNumMod_0) {

		long ans = 1;

		//乗数が0の場合→1
		if (josu == 0)
			return 1;

		if (primeNumMod_0 == 0) {
			//modを使わないとき

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= kisu;
					josu = josu / 2;
				} else {
					//累乗が奇数の時
					ans *= kisu;
					josu--;
				}
			}

			return ans;

		} else {
			//modを使うとき

			//初めに桁を落とす
			kisu = myMod(kisu, primeNumMod_0);

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= myMod(kisu, primeNumMod_0);
					josu = josu / 2;

				} else {
					//累乗が奇数の時
					ans *= myMod(kisu, primeNumMod_0);
					josu--;

				}
			}

			return myMod(ans, primeNumMod_0);

		}

	}

}


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


void solve() {
    int n;
    cin >> n;
    vector<vector<int>> a(2, vector<int>(n));
    for (int j = 0; j < 2; j++) {
        for (int i = 0; i < n; i++) {
            cin >> a[j][i];
        }
    }
   
    vector<vector<int>>dp(2, vector<int>(n));
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < n; j++) {
            int left = 0, top = 0;
            if(i == 0 && j == 0) {
                left = 0, top = 0;
            }
            else if (j == 0) {
                left = 0;
                top = dp[i - 1][j];
            }
            else if(i == 0) {
                top = 0;
                left = dp[i][j - 1];
            }
            else {
                top = dp[i - 1][j];
                left = dp[i][j - 1];
            }

            dp[i][j] = a[i][j] + max(left, top);
        }
    }
    cout << dp[1][n - 1];
}


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


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
    string s, t;
    cin >> s >> t;
    int n=s.length(), m=t.length();
    int d1[n+1], d2[m+1];
    d1[0]=0, d2[0]=0;
    for(int i=0; i<n; i++){
        if(s[i]=='A') d1[i+1]=d1[i]+1;
        else d1[i+1]=d1[i]+2;
        d1[i+1]%=3;
    }
    for(int i=0; i<m; i++){
        if(t[i]=='A') d2[i+1]=d2[i]+1;
        else d2[i+1]=d2[i]+2;
        d2[i+1]%=3;
    }

    int q;
    cin >> q;
    for(int i=0; i<q; i++){
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        if((d1[b]-d1[a-1]+3)%3==(d2[d]-d2[c-1]+3)%3) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,d;
  cin>>n>>d;
  vector<vector<int>>c(n,vector<int>(d));
  for(int i=0;i<n;i++){
    for(int j=0;j<d;j++){
      cin>>c[i][j];
    }
  }
  int count=0;
  for(int i=0;i<n;i++){
    for(int k=i;k<n;k++){
      double sum=0;
      if(k!=i){
    	for(int j=0;j<d;j++){
 			    sum+=abs(c[i][j]-c[k][j])*abs(c[i][j]-c[k][j]); 
    	}
      }else sum=2;
      if(floor(sqrt(sum))*floor(sqrt(sum))==sum)count++;
    }
  }
  cout<<count<<endl;
  
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

int main(){
  int w,h;
  while(cin>>w>>h, w+h){
    int f[h][w];
    long long ans[h+2][w];
    memset(ans, 0, sizeof(ans));
    REP(i,h) REP(j,w) cin>>f[i][j];
    REP(i,w) if(f[0][i] == 0) ans[0][i] = 1;
    REP(i,h) REP(j,w){
      if(ans[i][j] != 0){
        int y = i + (f[i][j]==2?2:1);
        REP(k,3){
          if((f[i][j]==2 || i == h - 1) && k!=1) continue;
          int x = j + k - 1;
          if(x < 0 || x >= w) continue;
          if(y >= h || f[y][x] == 0)
            ans[y][x] += ans[i][j];
          else if(k == 1 && f[y][x] == 2)
            ans[y][x] += ans[i][j];
        }
      }
    }
    //REP(i,h+2){REP(j,w)printf("%lld ",ans[i][j]); puts("");}
    long long sum = 0;
    REP(i,2) REP(j,w) sum += ans[h+i][j];
    cout << sum << endl;
  }
  return 0;
}

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


int main(){
	string S, T;
	cin >> S >> T;
	int A, B;
	cin >> A >> B;
	string U; 
	cin >> U;
	if(S == U) cout << A-1 << " " << B << endl;
	else cout << A << " " << B-1 << endl;
}












Measured memory_bytes: 3632
#include <stdio.h>

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

    scanf("%d", &a);
    scanf("%d", &b);
    scanf("%d", &c);

    if (c >= a && c <= b)
    {
        printf("Yes");
    }else
    {
        printf("No");
    }
    
    return 0;
}


Measured memory_bytes: 128