akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
// for (int i = 0, i < N, i++) {
// strint'', char'
// エスケープシークエンス改行になる\n　cout << "こんにちは\nAtCoder";
// 行全て取り出す　getline(cin, 文字列変数);
// 配列　vector<型> vec(要素数, 初期値);　　vec.at(i)　　vec.size()
// int型 data[要素数]; // Cの配列
// 逆順に並び替え　reverse(配列変数.begin(), 配列変数.end());
// 小さい順に並び替え　sort(配列変数.begin(), 配列変数.end());





int main() {
  int n;
  cin >> n;
  vector<int> vec(n);
  for (int i = 0; i < n; i++) {
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  int count = 1;
  for (int i = 0; i < n-1; i++) {
    if (vec.at(i) != vec.at(i+1)) {
      count++;
    }
  }
  cout << count << endl;
}


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

int ans[100];
int top=0;

void push(int);
int pop(void);
  
int main(){
  int a,b,x;
  int i=0;
  char n[100];

  while( scanf("%s",n) != EOF ){
    if ( n[0] == '+' ){
      a=pop();
      b=pop();
      push(a+b);
    } else if ( n[0] == '-' ){
      b=pop();
      a=pop();
      push(a-b);
    } else if ( n[0] == '*' ){
      a=pop();
      b=pop();
      push(a*b);
    } else {
      x = atoi(n);
      push(x);
    }
  }
  printf("%d\n",ans[top-1]);

  return 0;
}

void push(int n){
  int i=0;
  ans[top++]=n;
}
int pop(){
  int n;
  n=ans[--top];
  return n;
}



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


int main() {
  int N;
  cin >> N;
  if (N == 1) cout << "Hello World" << endl;
  else {
    int A, B;
    cin >> A >> B;
    cout << A + B << endl;
  }
}


Measured memory_bytes: 3596
#include "iostream"
#include "string"
using namespace std;

int main(int argc, char const *argv[])
{
	string s,p;
	int i,j,k=0;
	int  flug1, flug2=0;

	cin >> s >> p;
	s = s + s;


	for (i=0;i<s.size();i++)
	{
		if(flug2 == 1)
		{
			break;
		}

		flug1 = 0;

		for (j=0;j<p.size();j++)
		{
			if(p[j] != s[i+j])
			{
				flug1 = 1;
			}
		}
		if(flug1 == 0)
		{
			flug2 =1;
		}
	}

	if (flug2 ==1)
	{
		cout << "Yes" << endl; 
	}
	else
	{
		cout << "No" << endl; 
	}


	return 0;
}


Measured memory_bytes: 3176
#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>
using namespace std;
#define int long long


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

    int n; cin >> n;
    vector<int> a(n);

    int ans = 0;
    vector<int> b(n+1);
    for(int i = 0;i < n;i ++){
        cin >> a[i];
        b[a[i]] ++;
    }


    for(int i = 1;i < n+1;i ++){
        ans += b[i] * (b[i] - 1) / 2;
    }

    for(int i = 0;i < n;i ++){
        int t = b[a[i]];
        cout << ans - t * (t-1) / 2 + (t-1) * (t-2) /2 << endl;
    }
}



Measured memory_bytes: 5760
#pragma GCC optimize ('O3')
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mp make_pair
#define f first
#define s second
#define pb push_back

const int N = 5e3 + 5;
const int M = 1e5 + 5;
const ll OO = 1e18;
const int mod = 1e9 + 7;


int n,ans,dp[N][N];
string s;

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin >> n >> s;

    for (int i = n-1; ~i; --i) {
        for (int j = n-1; j>=i ; --j) {
            if(s[i]==s[j]) ans = max(ans, dp[i][j] = min(dp[i+1][j+1]+1, j-i));
        }
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 70312
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,a,b) for(int i=(a),_end_=(b);i<=_end_;i++)
#define DREP(i,a,b) for(int i=(a),_end_=(b);i>=_end_;i--)
#define EREP(i,a) for(int i=start[(a)];i;i=e[i].next)
template<class T>inline void chkmax(T &a,T b){ if(a<b)a=b;}
template<class T>inline void chkmin(T &a,T b){ if(a>b)a=b;}
#define fi first
#define se second
#define mkr(a,b) make_pair(a,b)
inline int read()
{
	int sum=0,p=1;char ch=getchar();
	while(!(('0'<=ch && ch<='9') || ch=='-'))ch=getchar();
	if(ch=='-')p=-1,ch=getchar();
	while('0'<=ch && ch<='9')sum=sum*10+ch-48,ch=getchar();
	return sum*p;
}

const int maxn=2e5+20;

int n,q,sta,stb,x[maxn];
ll s[maxn];

struct Fenwick_Tree {
	int rev;
	ll s[maxn];
	Fenwick_Tree(int _rev=0){ rev=_rev;}
	inline void Clear(){ memset(s,63,sizeof(s));}

	inline void Add(int x,ll d){ for(x=rev?n-x+1:x;x<=n;x+=x&(-x))chkmin(s[x],d);}

	inline ll Sum(int x){ ll res=1ll<<60; for(x=rev?n-x+1:x;x;x-=x&(-x))chkmin(res,s[x]); return res;}
}A(0),B(1);

inline void init()
{
	n=read();q=read(); sta=read(); stb=read();
	REP(i,1,q)x[i]=read();
}

ll dp[maxn];
ll ans=1ll<<60;

inline void doing()
{
	A.Clear(); B.Clear();
	x[0]=sta; 
	REP(i,2,q)s[i]=s[i-1]+abs(x[i]-x[i-1]);
	dp[0]=abs(x[1]-stb); A.Add(sta,dp[0]-sta); B.Add(sta,dp[0]+sta);
	REP(i,1,q)
	{
		dp[i]=s[i]+min(x[i+1]+A.Sum(x[i+1]) , -x[i+1] + B.Sum(x[i+1]));
		A.Add(x[i],-s[i+1]-x[i]+dp[i]); B.Add(x[i],-s[i+1]+x[i]+dp[i]);
		chkmin(ans,dp[i]+s[q]-s[i+1]);
	}
}

int main()
{
	init();
	doing();
	swap(sta,stb); doing();
	printf("%lld\n",ans);
	return 0;
}



Measured memory_bytes: 7296
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<string>

using namespace std;

int main(){
  double w,h,x,y;
  cin >> w >> h >> x >> y;
  double b = w;
  double c = h;
  double tmp = b*c;
  tmp = tmp * 0.50000000000;
  int a;
  int f = 0;

  if(x*2 == w && y*2 == h){
    f = 1;
  }
  a = f ? 1 : 0;
  printf("%lf %d\n", tmp, a);
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
int main(){
    int A, B;
    cin>>A>>B;
    if(A >= 13) cout<<B<<endl;
    else{
        if(A >= 6 && A <= 12) cout<<B/2<<endl;
        else cout<<0<<endl;
    }

}

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

using namespace std;
#define PI acos(-1)

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

	int* A = new int[N];

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

		if (A[i] % 2) 
		{
			odd = 1;
			break;
		}
	}

	if (odd == 0)
	{
		while (even == 0) {
			for (int i = 0; i < N; i++)
			{
				if (A[i] % 2 == 0)
				{
					A[i] /= 2;

					if (i == N - 1) 
					{
						num++;

					}
				}
				else
				{
					even = 1;
					break;
				}
			}
		}
	}


	cout << num;
}



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

typedef long long ll;
typedef double lf;
typedef long double Lf;
typedef pair <int,int> pii;
typedef pair <ll, ll> pll;

#define TRACE(x) cerr << #x << "  " << x << endl
#define FOR(i, a, b) for (int i = (a); i < int(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define _ << " " <<

#define fi first
#define sec second
#define mp make_pair

int n, x;
ll tmp;
map <ll, int> mapa;

int main() {
  scanf("%d",&n);
  mapa[0]++;
  ll sol = 0;
  REP(i, n) {
    scanf("%d",&x);
    tmp += x;
    sol += mapa[tmp];
    mapa[tmp]++;
  }
  printf("%lld\n",sol);
  return 0;
}

Measured memory_bytes: 12800
let ok w h x y r =
	x - r >= 0 && y - r >= 0 && x + r <= w && y + r <= h;;
let put w h x y r =
	if ok w h x y r then print_string "Yes\n" else print_string "No\n";;

Scanf.sscanf(read_line()) "%d %d %d %d %d" put;;



Measured memory_bytes: 2268
#include<stdio.h>
#include<string.h>
int main()
{
int n;
int max;
int min;
long sum=0;
int i;
int ai[10000];
int a,b,c;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&ai[i]);
}
max=ai[0];
for(i=1;i<n;i++){
 if(max<ai[i]) max=ai[i];
}
min=ai[0];
for(i=1;i<n;i++) if(min>ai[i]) min=ai[i];
for(i=0;i<n;i++) sum+=ai[i];
printf("%d %d %ld\n",min,max,sum);
return 0;
}

Measured memory_bytes: 1068
import java.util.*;

public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int num = check("3", n) + check("5", n) + check("7", n);
        System.out.println(num);
    }

    public static int check(String cc, int n) {
        long ct = Long.parseLong(cc);
        int ret = 0;
        if (ct > n)
            return 0;
        boolean a1 = false;
        boolean a2 = false;
        boolean a3 = false;
        for (int i = 0; i < cc.length(); i++) {
            if (cc.charAt(i) == '3')
                a1 = true;
            if (cc.charAt(i) == '5')
                a2 = true;
            if (cc.charAt(i) == '7')
                a3 = true;
        }
        if (a1 && a2 && a3)
            ret++;
        ret += check(cc + "3", n) + check(cc + "5", n) + check(cc + "7", n);
        return ret;
    }

}


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

long long A, B;
int main(){
	cin >> A >> B;
	if(A<=5){
		cout << 0 << endl;
	}else if(A>=13){
		cout << B << endl;
	}else{
		cout << B/2 << endl;
	}
}

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


#define DEBUG(x) 			   cout << '>' << #x << ':' << x << endl;
#define D(x)        		   cerr << __LINE__ << ": " << #x << " = " << (x) << '\n'
#define DD(x,y)     		   cerr << __LINE__ << ": " << #x << " = " << x << "   " << #y << " = " << y << '\n'
#define DDD(x,y,z)  		   cerr << __LINE__ << ": " << #x << " = " << x << "   " << #y << " = " << y << "   " << #z << " = " << z << '\n'
#define DBG         		   cerr << __LINE__ << ": Hi" << '\n'
#define fresh                  {ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
#define read                   freopen("in.txt","rt",stdin)
#define write                  freopen("out.txt","wt",stdout)
#define PI                     3.1415926535897932384626433832795
#define mems(ds_name,val)      memset(ds_name,val,sizeof(ds_name))
#define ll					   long long



int main()
{
    fresh;
//    read;
//    write;
    int n;cin>>n;
    int x[105],y[105],h[105];
    for(int i=1;i<=n;i++){
        cin>>x[i]>>y[i]>>h[i];
        if(h[i]>0){
            swap(x[i],x[1]);
            swap(y[i],y[1]);
            swap(h[i],h[1]);
        }
    }

    for(int cx=0;cx<=100;cx++){
        for(int cy=0;cy<=100;cy++){
            int ch=h[1]+abs(cx-x[1])+abs(cy-y[1]);
            bool checker=true;
            for(int i=2;i<=n;i++){
                if(max(ch-abs(x[i]-cx)-abs(y[i]-cy),0)!=h[i]){
                    checker =false;
                }
            }
            if(checker){
                cout<<cx<<" "<<cy<<" "<<ch<<endl;
            }
        }
    }

}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>


using namespace std;

int main(){
  int N;
  cin>>N;
  int t[N],x[N],y[N];
  t[0]=x[0]=y[0]=0;
  for (int i=1; i<N+1;i++){
    cin>>t[i]>>x[i]>>y[i];
  }
  for (int i=0; i<N;i++){
    int a=x[i+1]-x[i]+y[i+1]-y[i];
    if (a<0)a=-a;
    int tt=t[i+1]-t[i];
    if(tt-a<0 || (tt-a)%2==1){
      cout<<"No"<<endl;
      return 0;
    }
  }
cout<<"Yes" <<endl;
  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int n, m, k;
    std::cin >> n >> m >> k;
    std::vector<std::vector<int>> g(n);

    for (int i = 0; i < m; i++) {
        int u, v;
        std::cin >> u >> v;
        --u; --v;
        g[u].push_back(v);
        g[v].push_back(u);
    }

    int cn = 1;
    std::vector<int> comp(n);
    for (int i = 0; i < n; i++) {
        if (comp[i]) continue;
        const int c = cn++;
        std::deque<int> q { i };
        comp[i] = c;
        while (!q.empty()) {
            int v = q.front();
            q.pop_front();
            for (int to : g[v]) {
                if (comp[to]) continue;
                comp[to] = c;
                q.push_back(to);
            }
        }
    }

    std::vector<int> cnt(cn), ret(n);
    for (int i = 0; i < n; i++) cnt[comp[i]]++;
    for (int i = 0; i < n; i++) ret[i] = cnt[comp[i]] - g[i].size() - 1;

    for(int i = 0; i < k; i++) {
        int u, v;
        std::cin >> u >> v;
        --u; --v;
        if (comp[u] != comp[v]) continue;
        --ret[u];
        --ret[v];
    }

    for (auto e : ret) std::cout << e << ' ';
    std::cout << std::endl;

    return 0;
}


Measured memory_bytes: 7544
/*
 * main.c
 *
 *  Created on: 2020/02/22
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a > b ? b : a)
typedef long long int ll;
typedef unsigned long long int ull;

int sort_inc(const void *a, const void *b) { return (*(int*)a - *(int*)b);}
int sort_dec(const void* a, const void* b) { return (*(int*)b - *(int*)a);}
int sort_dec_ll(const void *a, const void *b) {
    ll da = *(ll*)a, db = *(ll*)b;    int val = 0;
    if(da > db) { val = -1; }
    else if (da == db) { val = 0; }
    else { val = 1; }
    return val;
}
int sort_inc_ll(const void *a, const void *b) {
    ll da = *(ll*)a, db = *(ll*)b;    int val = 0;
    if(da > db) { val = 1; }
    else if (da == db) { val = 0; }
    else { val = -1; }
    return val;
}
int sort_dic(const void *a, const void *b) {
    char *pa = (char *)a;    char *pb = (char *)b;    int i = 0, val = 0, N = 10;
    for (i = 0; i < N; i++) {
    	char da = pa[i], db = pb[i];
    	if (da == db) continue;
  		if (da > db) val = 1; else val = -1;
        break;
    }
    return val;
}

int a[100001] = {0};
int b[100001] = {0};
int x[100001] = {0};
int y[100001] = {0};
int c[100001] = {0};

int main()
{
	int A = 0, B = 0, M = 0, i = 0;
	int mina = 200000, minb = 200000;
	int ans = 0;
	scanf("%d %d %d", &A, &B, &M);
	for (i = 0; i < A; i++) {
		scanf("%d", &a[i]);
		mina = MIN(mina,a[i]);
	}
	for (i = 0; i < B; i++) {
		scanf("%d", &b[i]);
		minb = MIN(minb,b[i]);
	}
	for (i = 0; i < M; i++) {
		scanf("%d %d %d", &x[i], &y[i], &c[i]);
	}

	ans = mina + minb;
	//printf("min =%d\n", ans);
    for (i = 0; i < M; i++) {
    	int temp = 0;
    	if (x[i] == y[i]) {
    		//
    		int da = (a[x[i]-1] + b[y[i]-1]) - c[i];
    		int db = (a[x[i]-1] + b[y[i]-1]) - c[i];
    		temp = MIN(da, db);
    		//printf("temp =%d, da=%d, db=%d\n", temp, da, db);
    	} else {
        	temp = (a[x[i]-1] + b[y[i]-1]) - c[i];
    		//printf("temp =%d\n", temp);
    	}
    	ans = MIN(ans, temp);
    }

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


Measured memory_bytes: 2176
#include <iostream>

int main() {
    std::string s;
    int n = 15, k, wins = 0;

    std::cin >> s;
    k = s.size();
    for (char c : s) wins = (c == 'o') ? wins + 1 : wins;

    std::cout << ( (n - k >= 8 - wins) ? "YES" : "NO" ) << std::endl;

    return 0;
}



Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <cstdint>
#include <tuple>
#include <numeric>
#define M_PI       3.14159265358979323846


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define MT make_tuple
#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 FILL(a, x) memset(a, x, sizeof(a))

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


int main() {
	int n, m;
	cin >> n >> m;
	vector<pair<LL, LL>> ab(n);
	REP(i, n) {
		LL a, b;
		cin >> a >> b;
		ab[i] = MP(a, b);
	}
	SORT(ab);
	LL ret = 0;
	for (int i = 0; m > 0; i++) {
		ret += ab[i].first*min(ab[i].second, (LL)m);
		m -= min(ab[i].second, (LL)m);
	}
	cout << ret << endl;

}

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

int main()
{
  int n;
  string s;
  cin >> n >> s;
  vector<int> alphabet(26, 0);
  int i, j;
  long long ans = 0;
  j = 0;
  for(i = 0; i < n; i++)
  {
    alphabet.at(s.at(i)-'a')++;
  }
  vector<long long> sum(26, 0);
  sum.at(0) = alphabet.at(0);
  for(i = 1; i < 26; i++)
  {
    if(alphabet.at(i) == 0) sum.at(i) = sum.at(i-1);
    else sum.at(i) = (sum.at(i-1) + sum.at(i-1)*alphabet.at(i)+alphabet.at(i))%1000000007;
  }
  cout << sum.at(25) << endl;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int c = 0;
        for(int i = 0;i<N;i++){

            if(sc.nextInt()>=K){
                c++;
            }
        }
        System.out.println(c);
    }
}


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  string S, T; cin >> S >> T;
  string result = "Yes";
  rep(i,S.size()) if (S[i]!=T[i]) result = "No";
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)

using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using ull= unsigned long long;
const ll K_MAX=1e5+5;
const ll Lmax=ll(1e18);
const ll INF=1e15+4;
const int Nmax=2e5+1;
const int Nd=61;
ll dfs[3003][3003][4];
ll  s[1003][1003];
vector<int> di={1,-1,0,0};
vector<int> dj={0,0,1,-1};

int main(){
  int h,w;cin>>h>>w;
  vector<string> s(h);
  vector<vector<bool>> done(h,vector<bool>(w,false));

  int ch,cw,dh,dw;
  vector<vector<P>> g(int(h*w)); // グループ番号の座標
  vector<vector<int>> g2(h,vector<int>(w,-1));// 座標のグループ番号
  cin>>ch>>cw>>dh>>dw;
  ch--;cw--;dh--;dw--;
  rep(i,h){
    cin>>s[i];
  }

  ll nw=0; //ワープ数

  queue<P> q,q2;
  q.push(make_pair(ch,cw));
  done[ch][cw]==true;

  while(!q.empty() || !q2.empty()){
    auto p=q.front();q.pop();
    bool edge=false;
    int i=p.first,j=p.second;
    //cout<<i<<":"<<j<<endl;

    if(i==dh && j==dw){
      cout<<nw<<endl;
      return 0;
    }

    rep(k,4){
      int i2=i+di[k],j2=j+dj[k];
      if(i2>=0 && i2<h && j2>=0 && j2<w){
        if(s[i2][j2]=='.'){
          if(done[i2][j2]==false){//未踏
            q.push(make_pair(i2,j2));
            done[i2][j2]=true;
          }
        }
        if(s[i+di[k]][j+dj[k]]=='#') {
          edge=true;
        }
      }

    }

    if(edge){
      q2.push(make_pair(i,j));
    }

    if(q.empty() && !q2.empty()){//歩いて行ける場所はクリアした場合．
      nw++;
      while(!q2.empty()){
        auto p2=q2.front();q2.pop();
        int i3=p2.first,j3=p2.second;
        for(int i4=i3-2;i4<=i3+2;i4++){
          for(int j4=j3-2;j4<=j3+2;j4++){
            if(i4>=0 && i4<h && j4>=0 && j4<w){
              if(s[i4][j4]=='.' && done[i4][j4]==false){
                q.push(make_pair(i4,j4));
                done[i4][j4]=true;
              }
            }
          }
        }
      }
    }
  }
  cout<<-1<<endl;













  return 0;
}


Measured memory_bytes: 32744
n = int(input())
ans=int(n/1.08)
if(int(ans*1.08)!= n):
    if(int((ans+1)*1.08)== n):
        print(int(ans+1))
    elif((int((ans-1)*1.08)== n)):
        print(int(ans+1))
    else:
        print(":(")
else:
    print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h> 
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using P = std::pair<int, int>;

int main(int argc, char *argv[])
{
    int N, T;
    std::cin >> N >> T;

    std::vector<int> c(N), t(N);
    for (int i = 0; i < N; i++) {
        std::cin >> c[i] >> t[i];
    }

    std::vector<int> score;
    bool flag = true;
    for (int i = 0; i < N; i++) {
        if (t[i] <= T) {
            flag = false;
            score.push_back(c[i]);
        }
    }

    if (flag) {
        std::cout << "TLE" << std::endl;
    } else {
        int min = INF;
        for (int i = 0; i < score.size(); i++) {
            if (min > score[i]) {
                min = score[i];
            }
        }

        std::cout << min << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt(); // 子供の人数
		sc.close();

		int sum = 0;
		for (int i = 1; i <= n; i++) {
			sum += i;
		}

		System.out.println(sum);

	}

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define int lint
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};

int N;
int t[100010],x[100010],y[100010];
int dx[4]={-1,0,0,1};
int dy[4]={0,-1,1,0};

signed main(){
  cin>>N;
  for(int i=1;i<=N;i++)cin>>t[i]>>x[i]>>y[i];
  t[0]=0,x[0]=0,y[0]=0;

  for(int i=0;i<=N-1;i++){
    int d=abs(x[i+1]-x[i])+abs(y[i+1]-y[i]);

    if(d>t[i+1]-t[i]){
      cout<<"No"<<"\n";
      return 0;
    }else{
      int temp=t[i+1]-t[i]-d;
      if(temp%2!=0){
        cout<<"No"<<"\n";
        return 0;
      }
    }
  }

  cout<<"Yes"<<"\n";
  return 0;
}


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

#define ll long long

using namespace std;

int main()
{
    ll i,c=0,x;

    cin>>x;

    ll p=100;

    while(p<x)
    {
        p+=p/100;//it's compound interest so need new p in bank to operate
        c++;
    }

    cout<<c<<"\n";

    return 0;
}


Measured memory_bytes: 3580
n = int(input())
l = list(map(int, input().split()))
l.sort()
cnt = 0
for i in range(n - 2):
    for j in range(i + 1, n - 1):
        if l[i] + l[j] > l[n - 1]:
            cnt += n - j - 1
            continue
        le = j + 1
        ri = n - 1
        while ri - le > 0:
            m = (le + ri) // 2
            if l[m] < l[i] + l[j]:
                le = m + 1
            else:
                ri = m
        cnt += le - j - 1
print(cnt)

Measured memory_bytes: 43920
#include<stdio.h>

int main(void)
{
	int a, b, c, d, e;
	scanf("%d %d", &a, &b);
	c = a + b;
	if (c == 0) {
		printf("0\n");
	}
	else if (c > 0) {
		printf("1\n");
	}
	else if(c < 0) {
		printf("-1\n");
	}
	return 0;
}

Measured memory_bytes: 1820
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define M 1000000007
#define pb push_back
#define boost ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define NAYAN freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);



int dp[102][100005];
int n,w;
int val[100001],wt[100001];

/*int solve(int i,int V)
{
    //cout << i << " " << V  << endl;
    if(V==0)
        return 0;
    if(V<0 || i==n)
        return 99999999999999;
    if(dp[i][V]!=-1)
        return dp[i][V];
    int x=solve(i+1,V);
    int y=wt[i]+solve(i+1,V-val[i]);
    dp[i][V]=min(x,y);
    return dp[i][V];

}*/
signed main()
{
    boost
   // #ifndef ONLINE_JUDGE 
   // NAYAN
  //  #endif
   
    //int n;
    cin >> n >> w;
  //  cout << n << endl;
   
    int i,j;
    for(i=1;i<=n;i++)
    {
        cin >> wt[i] >> val[i];
    }
    for(i=0;i<=n;i++)
    {
        for(j=0;j<=100000;j++)
        {
            dp[i][j]=1000000000000;
        }
    }
    dp[0][0]=0;
    for(i=1;i<=n;i++)
    {
        for(j=100000;j>=0;j--)
        {
            //dp[i][j]=999999999999;
            if(val[i]<=j)
                dp[i][j]=min(dp[i-1][j],wt[i]+dp[i-1][j-val[i]]);
            else
                dp[i][j]=dp[i-1][j];
        }
    }
    int ans;
    for(i=100000;i>=0;i--)
    {
        
        ans=dp[n][i];
      //  cout << ans << " " << w << endl;
        if(ans<=w)
            break;
    }
    cout << i << endl;
    


}

Measured memory_bytes: 79232
#include <stdio.h>

int main(void)
{
    int i;
    int num = 0;
    scanf("%d", &i);

    while (i > 0)
    {
        if (i % 10 == 1)
        {
            num++;
        }
        i /= 10;
    }
    printf("%d", num);

    return 0;
}

Measured memory_bytes: 128
//BISMILLAHIR RAHMANIR RAHEEM
//ALLAH IS WATCHING ME
#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<cmath>
#include<iterator>
#include<cstdlib>
#define IOS   ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test IOS long long t;cin >> t;while(t--)
#define ses   "\n"
#define whp   " "
#define mxi 200003
#define mp make_pair
#define PII pair<long long, long long>
#define pf printf
#define sf scanf
#define ff first
#define ss second
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define rep0(i,a,b) for(int i=a; i<b; i++)
#define rep1(i,a,b) for(int i=a; i<=b; i++)
#define rep0in(i,a,b) for(int i=a-1; i>=b; i--)
#define rep1in(i,a,b) for(int i=a; i>b; i--)
#define repv(i,a) for(auto i=a.begin(); i!=a.end();++i)
#define INF 0x3f3f3f3f
#define CLR(a,b) memset(a,b,sizeof(a));
#define PI acos(-1)
#define what_is(x) cout<<x<<ses;
//set <int, greater <int> > ::iterator it;
//vector<pair<int,int> >a;
//memset(arr,0,sizeof(hg));
//priority_queue <int, vector<int>, greater<int> > pq;
///  string single character erase-
///             s.erase(s.begin()+x); where s is st ring name
///               ans x is index;
///    transform(sl.begin(), sl.end(), sl.begin(), ::tolower);
///    transform(su.begin(), su.end(), su.begin(), ::toupper);
typedef long long v99;
typedef unsigned long long ull;
using namespace std;
v99 fx[4]= {1,-1,0,0};
v99 fy[4]= {0,0,1,-1};
v99 ox8[] = {0, 0, 1, 1, 1, -1, -1, -1};
v99 oy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
bool sort2val(const pair<int,int> &a,const pair<int,int> &b)
{
    if(a.second==b.second)return a.first<b.first;
    return a.second<b.second;
}
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
/**bool prime[10000020];vector<v99>prm;
void SieveOfEratosthenes(v99 n)
{
	memset(prime, true, sizeof(prime));
	for(v99 i=4;i<=n;i+=2)prime[i]=false;
	for (v99 p=3; p*p<=n; p+=2)
	{
		if (prime[p] == true)
		{
			/// Update all multiples of p
			for (v99 i=p*p; i<=n; i += 2*p)
				prime[i] = false;
		}
	}
	rep1(i,2,n)if(prime[i])prm.push_back(i);

}*/
v99 pw(v99 a, v99 b)
{
	v99 ans = 1;
	for(v99 i = 1; i <= b; ++i)
		ans = (ans * a);
	return ans;
}

template <class T> inline T bigmod(T n,T p,T m)
{
    if(p==0)return 1;
    else if(p%2==0)
    {
        v99 val=bigmod(n,p/2,m);
        return (T)((val*val)%m);
    }
    else return (T)(((v99)n*(v99)bigmod(n,p-1,m))%m);
}
///-------------------------------------------------------------------------------------------------------



void solve()
{
    /// code is here->
    v99 r,g,b,k;cin>>r>>g>>b>>k;
    while(r>=g && k){g*=2;k--;}
    while(g>=b&&k){b*=2;k--;}
    if(r<g && g<b)cout<<"Yes"<<ses;
    else cout<<"No"<<ses;

}






int main()
{

    //freopen("data.out","w",stdout);
    //while(1)
    //test
    solve();

    return 0;
}



      ///  Alhamdulillah...


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

int n, k;
int arr[100100];
int dp[100100];
bool vis[100100];

int func( int pos ) {
  if (pos == n) return 0;
  if (vis[pos]) return dp[pos];
  vis[pos] = 1;

  int res = INT_MAX;
  for (int i = 1; i <= k; ++i) {
    if (pos + i > n) break;
    res = min(res, func(pos + i) + abs(arr[pos] - arr[pos + i]));
  }

  return dp[pos] = res;
}

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

  cin >> n >> k;
  for (int i = 1; i <= n; ++i) cin >> arr[i];

  cout << func(1) << endl;

  
  return 0;
}


Measured memory_bytes: 5888
# -*- coding: utf-8 -*-
h, w = map(int,input().split()) 
c = []
for i in range(h):
    c.append(list(str(input())))

for i in range(h):
    tmp = list(c[i])
    for j in range(w - 1):
        print(tmp[j], end = '')
    print(tmp[w - 1])
    for j in range(w - 1):
        print(tmp[j], end = '')
    print(tmp[w - 1])


Measured memory_bytes: 4596
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int MOD=1000000007;
using namespace std;
int gcd (int x, int y) {
    if (x < y) swap(x, y);
    if (y == 0) return x;
    return gcd(x % y, y);
}
int main(){
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    rep(i,0,n) cin>>a.at(i);
    sort(all(a));
    
    if(a.at(n-1)<k){
        cout<<"IMPOSSIBLE"<<endl;
        return 0;
    }
    
    int g=0;
    rep(i,0,n){
        g=gcd(g,a.at(i));
    }
    
    rep(i,0,n){
        if(a.at(i)%g==k%g){
            cout<<"POSSIBLE"<<endl;
            return 0;
        }
    }
    
    cout<<"IMPOSSIBLE"<<endl;
}


Measured memory_bytes: 640
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int gi(){
	int x=0,w=1;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-')w=0,ch=getchar();
	while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return w?x:-x;
}
char str[1005];
int main(){
	int n=gi(),r=0,b=0;scanf("%s",str+1);
	for(int i=1;i<=n;++i)if(str[i]=='R')++r;else ++b;
	puts(r>b?"Yes":"No");
	return 0;
}


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

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

const int INF=1e9;
const int MOD=1e9+7;

int main(){
    int N; cin >> N;
    P d[N];
    for(int i=0;i<N;i++){
        int d1,d2; cin >> d1 >> d2;
        d[i]={d1,d2};
    }
    bool flag=false;
    for(int i=0;i<N-2;i++){
        if(d[i].first==d[i].second){
            if(d[i+1].first==d[i+1].second){
                if(d[i+2].first==d[i+2].second){
                    flag=true;
                }
            }
        }
    }
    if(flag){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
string s;
int main() {
           cin>>s;
if(s[s.size()-1]=='2' || s[s.size()-1]=='4' || s[s.size()-1]=='5' || s[s.size()-1]=='7' || s[s.size()-1]=='9') cout<<"hon";
else if(s[s.size()-1]=='0' || s[s.size()-1]=='1' || s[s.size()-1]=='6' || s[s.size()-1]=='8') cout<<"pon";
else cout<<"bon";
}

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

//https://blog.foresta.me/posts/enumerate_all_pattern/
//https://hacknote.jp/archives/20862/

void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

int make_kaijo(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

int main() {

    int N; // 街の数、街座標(x, y) // 2 8
    // 、N!通りの、処理の平均値

    cin >> N;

    int x[N]; // -1000 1000
    int y[N]; // -1000 1000

    //vector<int> nums { 0, 1, 2};
    vector<int> nums;

    int kaijo = make_kaijo(N);

    for (int i = 0; i < N ; i++) {
        cin >> x[i] >> y[i];
        nums.push_back(i);

    }

    double total_l = 0;

    // vector順列ループ
    do {
        double l = 0;

        // 一経路あたり
        for (int i = 0; i < N - 1 ; i++) {

            int now = nums.at(i);
            int next = nums.at(i+ 1);
            //cout << "now:  " << now << endl;
            //cout << "next: " << next << endl;

            l +=  sqrt((pow((x[now] - x[next]),2) + pow((y[now] - y[next]),2)));
            //cout << l << endl;
        }
        //cout << "------- l:  " << l << endl;

        total_l += l;

        //printVector(nums);
    } while (next_permutation(nums.begin(), nums.end()));

    
    cout << fixed << setprecision(20) << total_l / kaijo << endl;

    return 0;

}

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

using ll = long long;

#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (int)(a.size())
#define clr(a, b) memset(a, b, sizeof(a))
#define REP(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define REPD(i, a, b) for(int i=(int)(a)-1; i>=(int)(b); --i)

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x;
    cin >> x;
    int p = 599, res = 8;
    while(1) {
    	if(x <= p) {
    		cout << res << "\n";
    		return 0;
    	}
    	p += 200;
    	--res;
    }
    return 0;
}


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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#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 range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

string S;
size_t cur;


int digit();
int number();
int factor();
int term();
int expression();

int digit(){
	return S[cur++]-'0';
}

int number(){
	int res=digit();
	while(cur<S.size()&&isdigit(S[cur])){
		res*=10;
		res+=digit();
	}
	return res;
}
int factor() {
    if (S[cur] != '(') return number();
	cur++;
    int res=expression();
	cur++;
    return res;
}

int term(){
	int a=factor();
	while(S[cur]=='*'||S[cur]=='/'){
		char op=S[cur];
		cur++;
		int b=factor();
		switch(op){
			case '*':
				a*=b;
				break;
			case '/':
				a/=b;
				break;
		}
	}
	return a;
}

int expression(){
	int a=term();
	while(S[cur]=='+'||S[cur]=='-'){
		char op=S[cur];
		cur++;
		int b=term();
		switch(op){
			case '+':
				a+=b;
				break;
			case '-':
				a-=b;
				break;
		}
	}
	return a;
}

int main(void){
	int n;
	cin >> n;
	rep(i,n){
		cin >> S;
		cur=0;
		cout << expression() << endl;
	}
	return 0;
}

Measured memory_bytes: 1204
N = int(input())
lst = []
for _ in range(N):
    lst += str(input())[:1]

# M = lst.count('M')
# A = lst.count('A')
# R = lst.count('R')
# C = lst.count('C')
# H = lst.count('H')

lst2 = []
for i in 'MARCH':
    lst2 += [lst.count(i)]
# print (lst2)

ans = 0
for i in range(5):
    for j in range(5):
        for k in range(5):
            if i < j and j < k:
                ans += lst2[i] * lst2[j] * lst2[k]

print (ans)

Measured memory_bytes: 3864
#include <stdio.h>

int main(void){

  int n;
  scanf("%d", &n);
  int price;
  for (int i = 1; i <= n; i++) {
    price = i*108/100;
    if (price == n) {
      printf("%d\n", i);
      return 0;
    }
    if (price > n) {
      break;
    }
  }
  printf(":(\n");

  return 0;
}

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

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a+b>c+d){
        cout<<"Left"<<endl;
    }
    else if(a+b==c+d){
        cout<<"Balanced"<<endl;
    }
    else if(a+b<c+d){
        cout<<"Right"<<endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
const int inf=1e9;

int gi() {
	int x=0,o=1;char ch=getchar();
	while(!isdigit(ch)&&ch!='-') ch=getchar();
	if(ch=='-') o=-1,ch=getchar();
	while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x*o;
}

int n,m,mx[N<<2],tag[N<<2];
vector<int> vec[N];

#define ls (x<<1)
#define rs (x<<1|1)

void mdf(int x,int v) {
	mx[x]+=v,tag[x]+=v;
}

void down(int x) {
	if(tag[x]) mdf(ls,tag[x]),mdf(rs,tag[x]),tag[x]=0;
}

void modify(int L,int R,int v,int x=1,int l=0,int r=m+1) {
	if(L<=l&&r<=R) return mdf(x,v);
	down(x);
	int mid=(l+r)>>1;
	if(L<=mid) modify(L,R,v,ls,l,mid);
	if(R>mid) modify(L,R,v,rs,mid+1,r);
	mx[x]=max(mx[ls],mx[rs]);
}

int main() {
	cin>>n>>m;
	for(int i=1;i<=n;i++) {
		int l=gi(),r=gi();
		vec[l].push_back(r);
	}
	int ans=max(0,n-m);
	for(int i=0;i<=m+1;i++) modify(i,i,-(m-i+1));
	for(int i=0;i<=m;i++) {
		modify(i,i,-inf);
		if(i) modify(i+1,m+1,-1);
		for(auto x:vec[i]) modify(i+1,x,1);
		ans=max(ans,mx[1]);
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 14080
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int N;
ll A, B;
ll h[100000];
bool enough(ll T){
	ll n = 0;
	for(int i=0;i<N;i++){
		if(h[i]>B*T) n += (h[i]-B*T + A-B -1)/(A-B);
	}
	if(n > T) return false;
	else return true;
}

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

  	ll upper = 1000000000, lower = 0;

  	while(upper-lower>0){
  		ll T = (upper+lower)/2;
  		if(enough(T)==true){
  			upper = T;
  			//cout << upper <<endl;
  		}else{
  			lower = T+1;
  		}
  		//if(upper==lower) cout << 99 <<endl;
  	}
  	/*bool flag = false;
  	for(int i=0;i<N-1;i++){
  		if(enough(i)==true && enough(i+1)==false){
  			cout << "NO" <<endl;
  			return 0;
  		}
  	}*/

  	cout << lower <<endl;
  
  	return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <limits.h>
#include <string>
#include <string.h>
#include <sstream>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <stack>
#include <queue>

using namespace std;

typedef long long ll;
const double EPS = 1e-10;

const int COUNTER_CLOCKWISE = 1;
const int CLOCKWISE = -1;
const int ONLINE_BACK = 2;
const int ONLINE_FRONT = -2;
const int ON_SEGMENT = 0;

class Vector {
  public:
  double x;
  double y;

  Vector(double y = 0.0, double x = 0.0){
    this->y = y;
    this->x = x;
  }

  Vector operator+(Vector p){
    return Vector(y + p.y, x + p.x);
  }

  Vector operator-(Vector p){
    return Vector(y - p.y, x - p.x);
  }

  Vector operator*(double a){
    return Vector(a * y, a * x);
  }

  Vector operator/(double a){
    return Vector(y / a, x / a);
  }

  double norm(){
    return x*x + y*y;
  }

  double abs(){
    return sqrt(norm());
  }
};

// ????????????a??¨b?????????
double dot(Vector a, Vector b){
  return a.x * b.x + a.y * b.y;
}

// ????????????a??¨b?????????
double cross(Vector a, Vector b){
  return a.x * b.y - a.y * b.x;
}

int ccw(Vector p0, Vector p1, Vector p2){
  Vector a = p1 - p0;
  Vector b = p2 - p0;

  if(cross(a, b) > EPS){
    return COUNTER_CLOCKWISE;
  }
  if(cross(a, b) < -EPS){
    return CLOCKWISE;
  }
  if(dot(a, b) < -EPS){
    return ONLINE_BACK;
  }
  if(a.norm() < b.norm()){
    return ONLINE_FRONT;
  }

  return ON_SEGMENT;
}

bool intersect(Vector p1, Vector p2, Vector p3, Vector p4){
  return (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 &&
      ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0);
}

int main(){
  int n;
  Vector p0, p1, p2, p3;

  cin >> n;

  for(int i = 0; i < n; i++){
    scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &p0.x, &p0.y, &p1.x, &p1.y, &p2.x, &p2.y, &p3.x, &p3.y);

    if(intersect(p0, p1, p2, p3)){
      cout << "1" << endl;
    }else{
      cout << "0" << endl;
    }
  }
  return 0;
}

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

int main(){
    int A, B, C, D, ans = 0;
    cin >> A >> B >> C >> D;
    if ( A > B ) ans += B;
    else ans += A;


    if ( C > D ) ans += D;
    else ans += C;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
from sys import stdin
input = stdin.readline()
counter = 0
max_c = 0
for i in input:
    if i == 'R':
        counter += 1
    else:
        if max_c < counter:
            max_c = counter
        counter = 0
if max_c < counter:
    max_c = counter
print(max_c)

Measured memory_bytes: 9036
#include <iostream>
#include <vector>
#include <stack>
#include <utility>

using namespace std;

void dfs(int x,int y,vector<vector<bool> >&map){
    if(!map[x][y])return;
    map[x][y]=false;
    for(int i=-1;i<2;i++)
    for(int j=-1;j<2;j++){
        if(i==0 && j==0)continue;
        int nx=x+i;
        int ny=y+j;
        dfs(nx,ny,map);
    }
    return;
}

int main(){
    while(true){
        int w,h;
        cin >> w >> h;
        if(w==0)break;
        vector<vector<bool> > map(h+2,vector<bool>(w+2,false));
        for(int i=1;i<=h;i++)
        for(int j=1;j<=w;j++){
            int t;
            cin >> t;
            if(t==1)map[i][j]=true;
        }

        int ans=0;
        for(int i=1;i<=h;i++){
            for(int j=1;j<=w;j++){
                if(map[i][j]){
                    ans++;
/*                    for(int k=1;k<=w;k++){
                    for(int l=1;l<=h;l++){
                        if(map[l][k])cout<<'o';
                        else cout << '_';
                    }
                    cout << endl;
                    }
                    cout << endl;*/
                    dfs(i,j,map);
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}

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

typedef long long ll;
#define endl "\n"
#define deb(x) cerr << #x << ":" << x << "\n"

void solve(){
    ll n;
    cin>>n;
    vector<ll> v(n);
    for(auto &x:v)cin>>x;
    vector<ll> dp(n);
    dp[0]=v[0];
    dp[1]=abs(v[1]-v[0]);
    if(n>2)dp[2]=min(abs(v[2]-v[0]),dp[1]+abs(v[2]-v[1]));
    for(int i=3;i<n;i++)dp[i]=min(dp[i-1]+abs(v[i]-v[i-1]),dp[i-2]+abs(v[i]-v[i-2]));\
    cout<<dp[n-1];
}

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

Measured memory_bytes: 1792
#include <cstdio>
#include <iostream>
#include <math.h>

using namespace std;

double heron(double a,double b, double c)
{
	double s = (a+b+c)/2;
	return sqrt(s*(s-a)*(s-b)*(s-c));
}

int main()
{
	double x1,x2,x3,y1,y2,y3,xp,yp,AB,BC,CA,AP,BP,CP,S,PS;
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)!=EOF){
		//A(x1,y1) B(x2,y2) C(x3,y3) P(xp,yp)
		AB = sqrt(pow(x2-x1,2)+pow(y2-y1,2));
		BC = sqrt(pow(x3-x2,2)+pow(y3-y2,2));
		CA = sqrt(pow(x3-x1,2)+pow(y3-y1,2));

		AP = sqrt(pow(xp-x1,2)+pow(yp-y1,2));
		BP = sqrt(pow(xp-x2,2)+pow(yp-y2,2));
		CP = sqrt(pow(xp-x3,2)+pow(yp-y3,2));

		S = heron(AB,BC,CA);
		PS = (heron(AB,AP,BP)+heron(BC,BP,CP)+heron(CA,CP,AP));
		
		if((PS-S)<0.0001)
		{
			cout<<"YES"<<endl;
		}
		else
		{
			cout<<"NO"<<endl;
		}
	
	}

	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<set>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<map>
#include<queue>
#include<iomanip>
#define INF 1e9
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using namespace std;
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; }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  return s;
}

template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
  s << vv[i] << endl;
  }
  return s;
}

string S,T;
signed main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> S >> T;
  int len = S.length();
  rep(i,len){
    if(S == T){
      cout << "Yes" << endl;
      return 0;
    }
    char c = S.back();
    S.pop_back();
    S.insert(S.begin(),c);
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,hikaku,alice,bob;
  cin >> N;
  vector<int> card(N);
  alice = 0;
  bob = 0;
  
  for (int i=0; i < N; i++) {
    cin >> card.at(i);
  }
  for (int i =0; i < N-1; i++) {
   hikaku = card.at(i);
  
   for (int j=1; j < N-i; j++) {
    if (hikaku < card.at(i + j)) {
    card.at(i) = card.at(i+j);
    card.at(i+j) = hikaku;
    hikaku = card.at(i);
    
    }
  }
  }
  for (int i=0; i < N; i++) {
    if (i % 2 == 0) {
      alice += card.at(i);
    }
    else{
      bob += card.at(i);
    }
  }
  cout << alice - bob << endl;
}

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

long long int GCD(long long int a,long long int b){long long int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
using namespace std;

int main() {
  string s;
  cin >> s;
  int ans=0;
  int tmp=0;
  for(int i=0;i!=s.size();i++){
    if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T'){
      tmp++;
    }
    else{
      if(ans<tmp){
        ans = tmp;
      }
      tmp=0;
    }
  }
  if(ans<tmp){
    ans=tmp;
  }
  cout << ans << endl;
}


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



int main()
{
    long long int Q, H, S, D, N, K;
    cin >> Q >> H >> S >> D >> N;
    long long int V[3];
    V[0] = 4*Q;
    V[1] = 2*H;
    V[2] = S;

    sort (V, V+3);
    if(2*V[0] < D )
    {
        K = V[0];
        cout << K*N << endl;
    }
    
    else if (N % 2 == 0)
    {
        cout << D*N/2 << endl;
    }
    
    else
    {
        cout << D*(N-1)/2+V[0] << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256