akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#define MOD 1000000007
#define mkp make_pair
typedef long long ll;
using namespace std;

int N;
ll X;
vector<ll> B,L,R;

vector<pair<ll,int>> uv;

bool judge(ll lim){
  vector<int> used(N,0);


  ll aoki=0;
  ll taka=0;
  for(int i=0;i<N;i++){
    aoki+=L[i]*B[i];
  }

  ll opnum=lim;
  int uvnum=0;

  for(int i=0;i<N;i++){
      //int now=uv[i].second;
      int now=uv[i].second;
      if(opnum>=X){
          used[now]=1;
          taka+=R[now]*X;
          aoki-=L[now]*B[now];
          aoki+=R[now]*B[now];
          opnum-=X;
      }else{
          uvnum=i;
          break;
      }
  }

  for(int i=0;i<N;i++){
      ll t=taka,a=aoki;
      if(used[i]){
          t-=R[i]*X;
          a+=L[i]*B[i];
          a-=R[i]*B[i];

          if(opnum<=B[i]){
              t+=opnum*L[i];
          }else{
              t+=R[i]*(opnum-B[i])+L[i]*B[i];
          }

          int now=uv[uvnum].second;
          t+=R[now]*X;
          a-=L[now]*B[now];
          a+=R[now]*B[now];
      }else{
          if(opnum<=B[i]){
              t+=opnum*L[i];
          }else{
              t+=R[i]*(opnum-B[i])+L[i]*B[i];
          }
      }
      if(t>=a) return true;
  }

  if(taka>=aoki) return true;
  else return false;
}

int main(){
  cin>>N>>X;
  B.resize(N);
  L.resize(N);
  R.resize(N);
  for(int i=0;i<N;i++) cin>>B[i]>>L[i]>>R[i];

  for(int i=0;i<N;i++){
    uv.push_back(mkp(R[i]*(X-B[i])+L[i]*B[i],i));
  }

  sort(uv.begin(),uv.end());
  reverse(uv.begin(),uv.end());

  ll ok=N*X,ng=-1;
  while(ok-ng>1){
    ll mid=(ok+ng)/2;
    if(judge(mid)) ok=mid;
    else ng=mid;
  }

  cout<<ok<<endl;

  return 0;
}


Measured memory_bytes: 4724
#include<iostream>
#include<string>
using namespace std;
int main(void){
    string takahashiStep;
    int  takahashiSad = 0;

    cin >> takahashiStep;

    for(int i = 0; takahashiStep[i] != '\0'; i++){
        if(i%2 == 0){
            if(takahashiStep[i] == 'L')   takahashiSad++;
        }else{
            if(takahashiStep[i] == 'R') takahashiSad++;
        }
    }

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

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  
  vector <int> d(N);
  
  for(int i=0;i<N;i++){
    cin >> d.at(i);
  }
  
  for(int i=0;i<N;i++){
    for(int j=i;j<N;j++){
      if(d.at(i)<d.at(j)){
        int t;
        t=d.at(i);
        d.at(i)=d.at(j);
        d.at(j)=t;
      }
    }
  }
  
  int ans=0;
  
  for(int i=1;i<N;i++){
    if(d.at(i)<d.at(i-1))ans++;
  }
  
  cout << ans+1 << endl;
  
}

Measured memory_bytes: 3552
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int ans = 0;
    int mx = 0;
    rep(i, 5){
        int x; cin >> x;
        ans += (x+9)/10*10;
        if(x%10 == 0) continue;
        else{
            mx = max(mx, 10 - x%10);
        }
    }
    cout << ans - mx;
    cout << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

typedef long long ll;
const ll INF = 1e5;

ll gcd(ll a, ll b) {
	if (a % b ==0) { return b; }
	if (b % a == 0) { return a; }

	if(a>b) { return gcd(b, a%b); }
	if (a < b) { return gcd(a, b%a); }
}

bool prime(ll p) { ll i = 1;
while (i*i <= p) {
	if (p / i == 0) { return false; }
	i++;
	}

return true;
}

int main() {
	ll A, B;
	cin >> A >> B;

	ll g = gcd(A, B);

	int ans = 1;

	for (ll i = 2; g > i*i; i++) {


			if (g%i == 0) {
				ans++;

				while (g%i == 0) {
					g = g / i;
				}
			}





	}

	if (g != 1) { ans++; }


	cout << ans;

	system("PAUSE");
}


Measured memory_bytes: 504
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

public class ABC
{
    //          long[] sp = Console.ReadLine().Split().Select(long .Parse).ToArray();
    //          int[] sp = Console.ReadLine().Split().Select(int.Parse).ToArray();
    //          int N = int.Parse(Console.ReadLine());
    //          string S = Console.ReadLine();
    Dictionary<string, long> choice = new Dictionary<string, long>();

    public static void Main()
    {
        int A = int.Parse(Console.ReadLine());
        int B= int.Parse(Console.ReadLine());
        int C = int.Parse(Console.ReadLine());
        int D = int.Parse(Console.ReadLine());
        int E = int.Parse(Console.ReadLine());
        int K = int.Parse(Console.ReadLine());
        if (E - A > K)
        {
            Console.WriteLine(":(");
        }
        else
        {
            Console.WriteLine("Yay!");
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#define int long long
#define endre getchar();getchar();return 0
using namespace std;
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return (y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int n) {
	if (n == 0)return 1;
	return kai(n - 1)*n;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int n, a, ans;
signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		if (a % 2 == 0)ans++;
	}
	cout << ans << endl;
	endre;
}


Measured memory_bytes: 3092
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cstring>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

#define SIZE(x) (int((x).size()))
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
#define repd(i,r,l) for (int i=(r); i>=(l); i--)
#define rept(i,c) for (typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)

#ifndef ONLINE_JUDGE
#define debug(x) { cerr<<#x<<" = "<<(x)<<endl; }
#else
#define debug(x) {}
#endif

char s[1010];

void lemon()
{
	scanf("%s",s+1);
	int n=strlen(s+1), pos=-1;
	rep(i,1,n)
		if (s[i]=='C')
			rep(j,i+1,n)
				if (s[j]=='F')
				{
					printf("Yes\n");
					return;
				}
	printf("No\n");
		
}

int main()
{
	ios::sync_with_stdio(true);
	#ifndef ONLINE_JUDGE
		//freopen("A.in","r",stdin);
	#endif
	lemon();
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// #define debug(a) cout << "["; rep(i,a.size()) cout << a[i] << ", "; cout<<"]"<< endl;

const ll mod = 1000000007;

int main() {
    int n; cin >> n;
    vector<ll> As(10010);

    rep(x, 100) rep(y, 100) rep(z,100){
        int xx=x+1, yy=y+1, zz=z+1;
        ll a;
        a = xx*xx + yy*yy + zz*zz + xx*yy + yy*zz + zz*xx;
        if(a>10000) break;
        As.at(a)++;
    }
    rep(i,n){
        cout << As.at(i+1) << endl;
    }
    return 0;
}

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

int main(){
  long long int n,p,ichi=0,zero,i,k;
  long long int kotae=1;
  cin>>n>>p;
  for(i=0;i<n;i++){
    cin>>k;
    if(k%2==1){
      ichi++;
    }
  }
  zero=n-ichi;
  if(ichi==0&&p==0){
    kotae=pow(2,n);
    cout<<kotae;
    return 0;
  }
  kotae=(int)(pow(2,ichi)/2)*pow(2,zero);
  cout<<kotae;
}

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

int main(){
	while(1){
		int H,W;
		cin >> H >> W;
		if(H== 0 && W == 0)break;
		for(int i=0;i<H;++i){
			for(int j=0;j<W;++j){
				cout << "#";
			}
			cout << endl;
		}
	cout << endl;
	}

	return 0;
}

Measured memory_bytes: 1152
#include<iostream>
#include<queue>
#include<algorithm>
using namespace std;

using pii = pair<int, int>;

const int mxn = 100010;

struct edge{int from, to, cost;};

bool comp(edge a, edge b) {
    return a.cost < b.cost;
}

vector<edge> es;

int par[mxn];
void init_unionfind(int n){
    fill(par, par + n, -1);
}

int root(int x) {
    return par[x] < 0 ? x : par[x] = root(par[x]);
}

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

void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if(par[y] < par[x]) swap(x, y);
    par[x] += par[y];
    par[y] = x;
}

int main() {
    int N;
    cin >> N;
    vector<pii> xs, ys;
    for(int i = 0; i < N; i++) {
        int x, y;
        cin >> x >> y;
        xs.push_back({x, i});
        ys.push_back({y, i});
    }

    sort(xs.begin(), xs.end());
    sort(ys.begin(), ys.end());

    // xについての辺をはる
    for(int i = 1; i < N; i++) {
        int x = xs[i].first, idx = xs[i].second;
        int px = xs[i-1].first, pidx = xs[i-1].second;
        es.push_back({idx, pidx, abs(x - px)});
        es.push_back({pidx, idx, abs(x - px)});
    }

    // yについての辺をはる
    for(int i = 1; i < N; i++) {
        int y = ys[i].first, idx = ys[i].second;
        int py = ys[i-1].first, pidx = ys[i-1].second;
        es.push_back({idx, pidx, abs(y - py)});
        es.push_back({pidx, idx, abs(y - py)});
    }

    sort(es.begin(), es.end(), comp);

    init_unionfind(N+1);

    int ans = 0;
    for(int i = 0; i < es.size() ;i++) {
        if(!same(es[i].from, es[i].to)){
            unite(es[i].from, es[i].to);
            ans += es[i].cost;
        }
    }

    cout << ans << endl;

    return 0;
}

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

int findSumOfDigits(int n){
	int ans;
	while(true){
		if (n==0) return ans;
		ans+=n%10;
		n/=10;
	}
}

int main(){
	int N;
	cin>>N;
	if (N%findSumOfDigits(N)==0) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <iterator>
#include <math.h>
#include <cmath>
#include <stdlib.h>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <regex>
#include <unordered_set>
#include <string>
#include <map>
#include <iomanip>
#include <sstream>
#include <cassert>
#include <time.h>
#include <numeric>
#include <complex>
 
using namespace std;
using ull = unsigned long long;
using ll = long long;
using ld = long double;
using D = double;
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
 
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define makeunique(x) sort(all(x)), (x).resize(unique(all(x)) - (x).begin())
#define rep(i, x)  for(int i = 0; i < (x); i++)
#define rrep(i, x) for(int i = (x - 1); i >= 0; i--)
#define sqrt(x) sqrt(abs(x))
#define y1 y1_1234413
#define j1 j1_235
#define y0 y0_235
#define j0 j0_256
#define fi first
#define se second
#define re return
#define prev PREV
#define next next
#define sz(x) ((int)x.size())
 
template<typename T> T sqr(T a) { re a * a; }
template<typename T> T gcd(T a, T b) { re b ? gcd(b, a % b) : a; }
template<typename T> T sgn(T a) { re a > 0 ? 1 : (a < 0 ? -1 : 0); }
template<typename T> T abs(T a) { re a > 0 ? a : -a; }
 
const ld st = 0.000001;
const ld pi = acos((ld)-1);
const int mod = 1000000007;
 
 
#define FILENAME ""
 
const ll MAXN = 100002;

                        
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL), cout.tie(NULL);
    //freopen("sum2.in", "r", stdin);
    //freopen("sum2.out", "w", stdout);
	ll a, b;
	cin >> a >> b;
	if (a*500 >= b) {
	 	cout << "Yes";
	}
	else {
	 	cout << "No";
	}              
    re 0;
}

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

int q(int n){
  ll ans=1;
  for(int i=0;i<n;i++){
    ans *= 2;
  }
  return ans;
}

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  ll ans=0;
  for(int i=2;i<n+1;i++){
    if(i==2) ans += a[0];
    else{
      ans += a[(i+1)/2-1];
    }
  }
  cout << ans << endl;
      
}

Measured memory_bytes: 4048
#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
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    int n;
    cin >> n;
    vector<ll> ans (90, 0);
    rep(i, n + 1) {
        if (i == 0) {
            ans[i] = 2LL;
            continue;
        }
        else if (i == 1) {
            ans[i] = 1LL;
            continue;
        } 
        else {
            ans[i] = ans[i - 1] + ans[i - 2];
        }
    }
    cout << ans[n] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep_1(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define rep_2(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main(){
    int n,k;cin>>n>>k;

    vector<int> h(n);
    rep(i,n)cin>>h[i];

    vector<ll> dp(n+k,LINF);
    dp[0] = 0;

    for(int i = 0;i <= n;i++){
        for(int j = 1;j <= k;j++){
            dp[i+j] = min(dp[i+j],dp[i]+abs( h[i+j] - h[i] ));
        }
    }

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


    return 0;
}



Measured memory_bytes: 1408
l,r = map(int,input().split())

cand = []
for i in range(l,r+1):
  cand.append(i%2019)
  if len(cand) == 2020*2:
    break
    
ans = float('inf')
for i in range(len(cand)):
  for j in range(len(cand)):
    if i==j:
      continue
    ans = min(ans, (cand[i]*cand[j])%2019)
    if ans ==0:
      break
  else:
    continue
  break
print(ans)

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

int main() {
  int k, x;
  cin>>k>>x;
  cout<<x-k+1;
  for (int i=1;i<=k*2-2;i++) {
    cout<<" "<<x-k+1+i;
  }
  cout<<endl;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

f = True
for v in a:
    if v % 2 == 0:
        if v % 3 == 0 or v % 5 == 0:
            pass
        else:
            f = False

if f:
    print('APPROVED')
else:
    print('DENIED')

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define int ll

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;

const int M = 1e9 + 7;

int bk[100005], dp[100005];

int32_t main()
{
	IO_OP;
	
	int n, m;
	cin >> n >> m;
	for(int i=0;i<m;i++) {
		int t;
		cin >> t;
		bk[t] = 1;
	}
	if(!bk[1]) dp[1] = 1;
	if(!bk[2]) dp[2] = 1 + dp[1];
	for(int i=3;i<=n;i++) {
		if(bk[i]) continue;
		dp[i] = (dp[i-1] + dp[i-2]) % M;
	}
	cout << dp[n] << endl;
}



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

int main(void){
    int N, max = 0, sum = 0;
    
    cin >> N;
    
    for (int i = 0; i < N; ++i) {
        int li;
        cin >> li;
        
        if (li > max) max = li;
        sum += li;
    }
    
    cout << (max < (sum - max) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ull unsigned long long
#define key 1000000007
#define k 9223372036854775807ull
using namespace std;
int n;
char s[250010];
map <ull, ull> M;
inline ull power(ull x, ull y)
{
	ull Ans = 1;
	while(y)
	{
		if(y & 1)
			Ans *= x;
		y >>= 1;
		x *= x;
	}
	return Ans;
}
map <ull, ull> P;
int main()
{
	ull ny = power(key, k);
	scanf("%d%s", &n, s);
	ull w = 0;
	ull p = 0;
	for(int i = 0; i < n; ++ i)
	{
		if(s[i] == '+')
			++ P[p];
		else if(s[i] == '-')
			-- P[p];
		else if(s[i] == '>')
			++ p;
		else -- p;
	}
	for(int i = - n; i < 0; ++ i)
		w += power(ny, - i) * P[i];
	for(int i = 0; i <= n; ++ i)
		w += power(key, i) * P[i];
	ull a = 1, b = 0;
	ull Ans = 0;
	for(int i = n - 1; i >= 0; -- i)
	{
		++ M[-b * power(a, k)];
		if(s[i] == '+')
			++ b;
		else if(s[i] == '-')
			-- b;
		else if(s[i] == '>')
			a *= key, b *= key;
		else if(s[i] == '<')
			a *= ny, b *= ny;
		Ans += M[(w - b) * power(a, k)];
	}
	printf("%llu", Ans);
	return 0;
}

Measured memory_bytes: 62976
N = int(input())
SP = []
name = []
for i in range(N):
    x = list(input().split())
    x = [x[0], int(x[1]), int(i)]
    name.append(x[0])
    SP.append(x)


# sort on secondary key
s = sorted(SP, key=lambda x: (x[0], -x[1]))
# now sort on primary key, descending
#sorted(s, key=attrgetter('grade'), reverse=True)

for i in range(N):
    print(s[i][2] + 1)


Measured memory_bytes: 3060
#include <stdio.h>

#define HUGE 1000000001  /*define array's keeper*/
void  mergesort(int *,int,int);
void merge(int * , int ,int,int);
int count=0;
int main(){
  int num,array[500000],i;

  scanf("%d",&num);
  for(i=0;i<num;i++){
    scanf("%d",&array[i]);
  }
  mergesort(array,0,num);

  for(i=0;i<num;i++){
    printf("%d",array[i]);
    if(i!=num-1) printf(" ");
  }
  printf("\n");
  printf("%d\n",count);
}

void mergesort(int *array,int left, int right){
  int mid;
  if(left<right-1){
    mid=(left+right)/2;
    mergesort(array,left,mid);
    mergesort(array,mid,right);
    merge(array,left,mid,right);
  }
}

void merge(int *array,int left,int mid, int right){
  int i,j,k,num1,num2,array1[250001],array2[250001];
  num1=mid-left;
  num2=right-mid;
  for(i=0;i<num1;i++) array1[i]=array[left+i]; /*left array*/
  for(i=0;i<num2;i++) array2[i]=array[mid+i]; /*right array*/
  array1[num1]=HUGE; /*insert huge value in array as a keeper*/
  array2[num2]=HUGE;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    count++;
    if(array1[i]<=array2[j]){
      array[k]=array1[i];
      i++;
    }
    else{
      array[k]=array2[j];
      j++;
    }
  }
}



Measured memory_bytes: 5616
// Package main provides
//
// File:  main.go
// Author: ymiyamoto
//
// Created on Thu Jul 11 07:43:17 2019
//
package main

import (
	"fmt"
	"math"
)

const eps = 1e-9

func main() {
	var n, d int
	fmt.Scan(&n, &d)

	xs := make([][]float64, n)
	for i := range xs {
		xs[i] = make([]float64, d)
		for j := range xs[i] {
			fmt.Scan(&xs[i][j])
		}
	}

	var ans int
	for i := range xs {
		for j := i + 1; j < len(xs); j++ {
			total := 0.0
			for k := range xs[i] {
				d := xs[i][k] - xs[j][k]
				total += d * d
			}
			total = math.Sqrt(total)
			if float64(int64(total))-eps <= total && total <= float64(int64(total))+eps {
				ans++
			}
		}
	}
	fmt.Println(ans)
}


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

set<ll> getFactors(ll n) {
	set<ll> res;
	while(n%2==0) {
		res.insert(2);
		n >>= 1;
	}
	for(int i = 3; i*i <= n; i+=2) {
		while(n%i==0) {
			res.insert(i);
			n /= i;
		}
	}
	if(n > 2)
		res.insert(n);
	return res;
}
bool ispairwise(vector<ll>& a) {
	ll n = a.size();
	set<ll> factors;
	for(int i = 0; i < n; i++) {
		set<ll> get = getFactors(a[i]);
		for(auto x : get) {
			if(factors.count(x))
				return false;
			factors.insert(x);
		}
	}
	return true;
}

bool issetwise(vector<ll>& a) {
	ll res = __gcd(a[0], a[1]);
	for(int i = 2; i < a.size(); i++) {
		res = __gcd(res, a[i]);
	}
	if(res == 1)
		return true;
	return false;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	ll n;
	cin >> n;
	vector<ll> a(n); for(auto& x : a) cin >> x;

	bool pairwise = ispairwise(a);
	if(pairwise) {
		cout << "pairwise coprime\n";
		return 0;
	}
	bool setwise = issetwise(a);
	if(setwise) {
		cout << "setwise coprime\n";
		return 0;
	}
	cout << "not coprime\n";
	return 0;

}


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

#define PI 3.14159265359
#define INF 1000000009
#define LINF 10000000000000000009
#define IMOD 1000000007 
#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)

#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<v_char > v2_char;
typedef std::vector<double> v_double;
typedef std::vector<v_double > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<v_int > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<v_ll > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<v_string > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<v_bool > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

int dx[4] = {1, 0, -1, 0};
int dy[5] = {0, 1, 0, -1};
using namespace std; 

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

    long double ans = 1;
    map<long double, int> mp;
    irep(i, n) {
        long double tmp;
        
        cin >> tmp;
        mp[tmp]++;
    }
    
    for(auto a : mp) {
        //cout << a.first << endl;
        long double tmp = a.first;
        irep(i, a.second) {
            if(tmp == 0) {
                cout << 0 << endl;
                return 0;
            } else if((ans * tmp) - 1000000000000000000.0 < 1e-10) {
                ans *= tmp;
            } else {
                cout << -1 << endl;
                return 0;
            }
        }
    }
    //cout << ans << endl;
    cout << (ll)ans << endl;
    return 0;
}
/** atcoder **/


Measured memory_bytes: 11572
#include <bits/stdc++.h>
using namespace std;
#define mem(ar,value) memset(ar,value,sizeof(ar))
#define all(x) x.begin(),x.end()
#define len(s) (int)s.size()
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define maxall(v) *max_element(all(v))
#define minall(v) *min_element(all(v))
#define mod 1000000007
#define limit 100005
#define READ freopen("input.txt","r",stdin)
#define WRITE freopen("output.txt","w",stdout)
#define d1(x) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#x" = "<<x<<endl;
#define d2(x,y) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#x" = "<<x<<" | "#y" = "<<y;
#define d3(x,y,z) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#x" = "<<x<<" | "#y" = "<<y<<" | "#z" = "<<z;
#define GG {printf("-1"); return 0;}	
#define inf 1e9*2
#define y1 asdas
#define ll long long
#define writesize(a) printf("%d\n",len(a));
#define writeall(a) for(int i=0;i<len(a);i++) printf("%d ",a[i]);
int q,h,s,d,n;
int main()
{
	scanf("%d %d %d %d %d",&q,&h,&s,&d,&n);
	h=min(h,q*2);
	s=min(s,h*2);
	d=min(d,s*2);
	printf("%lld",1ll*n/2*d+(n%2?s:0));
}


Measured memory_bytes: 256
x, y = map(int, input().split())

A = (1,3,5,7,8,10,12)
B = (4,6,9,11)
# (2) は合うことはない
if x in A and y in A:
  print("Yes")
elif x in B and y in B:  
  print("Yes")  
else:
  print("No")  


Measured memory_bytes: 2940
n = input()
h_string = input()
h_list = h_string.split(" ")
for i in range(len(h_list)):
    h_list[i] =	int(h_list[i])


longest = 0
now_value = -1
now_length = 0


for value in h_list:
    if value <= now_value:
        now_length += 1
        now_value = value
        if now_length > longest:
            longest = now_length
    else:
        if now_length > longest:
            longest = now_length
        now_value = value
        now_length = 0

print(longest)


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

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int 	LL;
typedef vector<LL> 		VL;
#define si(n) cin>>n
#define dout(n) cout<<n<<"\n"
#define DRT() int t; si(t); while(t--)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//# define M_PI           3.14159265358979323846264338327950288
// DSU
void IO(){
	#ifndef ONLINE_JUDGE
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
	#endif
	srand(chrono::steady_clock::now().time_since_epoch().count());
	off;
}

int main(){
	IO();
	LL n;
	cin>>n;
	VL arr(n);
	rep(i,0,n){
		cin>>arr[i];
	}
	sort(ALL(arr), greater<LL> ());
	LL ans = arr[0];
	int done = 2;
	for(int i=1;i<n;i++){
		if(done >= n)
			break;
		if(done + 2 <= n){
			ans += 2*arr[i];
			done += 2;
		}
		else{
			ans += arr[i];
			done++;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 4820
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
ll inf = llmax / 2;
double eps = 1e-11;

double cross_product (xy_t a, xy_t b) {
    return (conj(a) * b).imag();
}

int main() {
    double x[4], y[4];
    while (true) {
        for (int i = 0; i < 4; i++) {
            cin >> x[i] >> y[i];
        }
        if (!cin) break;
        xy_t a(x[0], y[0]), b(x[1], y[1]), c(x[2], y[2]), p(x[3], y[3]);
        double d[3];
        d[0] = cross_product(a - p, b - p);
        d[1] = cross_product(b - p, c - p);
        d[2] = cross_product(c - p, a - p);
        if (d[0] * d[1] > 0 && d[1] * d[2] > 0) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
}



Measured memory_bytes: 3056
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
typedef pair<ll,ll> pa;
#define w1 first
#define w2 second
#define ls (x<<1)
#define rs (x<<1|1)
#define pb push_back
#define mp make_pair
#define mid ((l+r)>>1)
#define SZ(x) (ll((x).size()))
#define All(x) (x).begin(),(x).end()
#define rep(i,a,b) for(ll (i)=(a);(i)<=(b);(i)++)
#define rep2(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define per(i,a,b) for(ll (i)=(a);(i)>=(b);(i)--)
#define Rep(p,x) for(ll (p)=head[(x)];(p);(p)=nxt[(p)])
template<class T>void read(T&num){
	num=0;T f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')num=num*10+ch-'0',ch=getchar();
	num*=f;
}
ll power(ll x,ll k,ll p){ll res=1;for(;k;k>>=1,x=1ll*x*x%p)if(k&1)res=1ll*res*x%p;return res;}
const ll maxn=7e6+5;
ll n,a,b,k,tot;
ll ans;
ll head[maxn],des[maxn],nxt[maxn];
ll x[maxn],y[maxn];
ll sum[maxn],vis[maxn];
map<ll,vector<pa> > X,Y;
map<ll,vector<ll> > EX,EY;
typedef map<ll,vector<pa> >::iterator It;
typedef vector<ll>::iterator It2;
void adde(ll x,ll y){
	des[++tot]=y;nxt[tot]=head[x];head[x]=tot;
}
void dfs(ll x){
	vis[x]=1;
	ans+=sum[x];
	Rep(p,x)if(!vis[des[p]])dfs(des[p]);
}
int main(){
	read(n);read(a);read(b);
	rep(i,1,n){
		read(x[i]);read(y[i]);
		ll tx=x[i]+y[i],ty=x[i]-y[i];
		x[i]=tx;y[i]=ty;
		X[tx].pb(mp(y[i],ll(i)));Y[ty].pb(mp(x[i],ll(i)));
		EX[tx].pb(0);EY[ty].pb(0);
	}
	for(It it=X.begin();it!=X.end();it++)sort(All(it->w2)),EX[it->w1].pb(0);
	for(It it=Y.begin();it!=Y.end();it++)sort(All(it->w2)),EY[it->w1].pb(0);
	ll D=max(abs(x[a]-x[b]),abs(y[a]-y[b]));
	rep(i,1,n){
		ll l,r;
		l=lower_bound(All(Y[y[i]-D]),mp(x[i]-D,0ll))-Y[y[i]-D].begin();
		r=lower_bound(All(Y[y[i]-D]),mp(x[i]+D+1,0ll))-Y[y[i]-D].begin();
		if(l!=r)EY[y[i]-D][l]++,EY[y[i]-D][r-1]--,adde(i,Y[y[i]-D][l].w2),adde(Y[y[i]-D][l].w2,i);
		sum[i]+=r-l;
		l=lower_bound(All(Y[y[i]+D]),mp(x[i]-D,0ll))-Y[y[i]+D].begin();
		r=lower_bound(All(Y[y[i]+D]),mp(x[i]+D+1,0ll))-Y[y[i]+D].begin();
		if(l!=r)EY[y[i]+D][l]++,EY[y[i]+D][r-1]--,adde(i,Y[y[i]+D][l].w2),adde(Y[y[i]+D][l].w2,i);
		sum[i]+=r-l;
		l=lower_bound(All(X[x[i]-D]),mp(y[i]-D+1,0ll))-X[x[i]-D].begin();
		r=lower_bound(All(X[x[i]-D]),mp(y[i]+D,0ll))-X[x[i]-D].begin();
		if(l!=r)EX[x[i]-D][l]++,EX[x[i]-D][r-1]--,adde(i,X[x[i]-D][l].w2),adde(X[x[i]-D][l].w2,i);
		sum[i]+=r-l;
		l=lower_bound(All(X[x[i]+D]),mp(y[i]-D+1,0ll))-X[x[i]+D].begin();
		r=lower_bound(All(X[x[i]+D]),mp(y[i]+D,0ll))-X[x[i]+D].begin();
		if(l!=r)EX[x[i]+D][l]++,EX[x[i]+D][r-1]--,adde(i,X[x[i]+D][l].w2),adde(X[x[i]+D][l].w2,i);
		sum[i]+=r-l;
	}
	for(It it=X.begin();it!=X.end();it++){
		rep2(i,1,SZ(EX[it->w1]))EX[it->w1][i]+=EX[it->w1][i-1];
		rep2(i,0,SZ(EX[it->w1])-1)if(EX[it->w1][i])adde((it->w2)[i].w2,(it->w2)[i+1].w2),adde((it->w2)[i+1].w2,(it->w2)[i].w2);
	}
	for(It it=Y.begin();it!=Y.end();it++){
		rep2(i,1,SZ(EY[it->w1]))EY[it->w1][i]+=EY[it->w1][i-1];
		rep2(i,0,SZ(EY[it->w1])-1)if(EY[it->w1][i])adde((it->w2)[i].w2,(it->w2)[i+1].w2),adde((it->w2)[i+1].w2,(it->w2)[i].w2);
	}
	dfs(a);
	cout<<ans/2<<endl;
	return 0;
}

Measured memory_bytes: 94976
import sys

read = sys.stdin.readline

N = int(read())
A = tuple(map(int, read().split()))
B = tuple(map(int, read().split()))

d = [i - j for i, j in zip(A, B)]
d.sort()
if d[0] >= 0:
    print(0)
    exit()
elif sum(d) < 0:
    print(-1)
    exit()

n = 0
below = 0
for i in d:
    if i < 0:
        below += i
        n += 1
    else:
        break

for i in d[::-1]:
    below += i
    n += 1
    if below > 0:
        print(n)
        exit()

Measured memory_bytes: 18644
from collections import*
n,m,*d=map(int,open(0).read().split())
a=Counter(d[:n])
for b,c in zip(d[n::2],d[n+1::2]):a[c]+=b
s=0
for k, v in sorted(a.items())[::-1]:
 if n<v:exit(print(s+k*n))
 n-=v
 s+=k*v

Measured memory_bytes: 47572
n=int(input(""))
le=len(str(n))
ten=10**(le-1)
one=int(str(n)[-1])

b=[]
for k in range(9):
    a=[]
    for i in range(9):
        a+=[0]
    b+=[a]
    
if(le==1):
    print(1)
else:
    
    for i in range(9):
            s=0
            if(ten*(i+2)<=n):
                s=10**(le-2)
                for k in range(9):
                    b[i][k]+=s
            elif(ten*(i+1)<n):
                s=int((n-ten*(i+1))/10)+1
                if(one==0):
                    s-=1
                for k in range(9):
                    
                    b[i][k]+=s
                    if (k+1==one):
                        s-=1
    
    for i in range(9):
        b[i][i]=1+b[i][i]
        
    s=0    
    for i in range(2,le):
            s+=10**(i-2)
    
    c=0
    for i in range(9):
        for k in range(9):
            c+=(b[i][k]+s)*(b[k][i]+s)
    
            
        
        
    print(c)
                
                
                
            


Measured memory_bytes: 9228
#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(), v.end()
#define dcout cout << fixed << setprecision(15)
#define arep(i, a) for(auto i : a)
#define F first
#define S second
#define VE vector<int>
#define pb(x) push_back(x)
#define MOD 1000000007
#define INF 10000000000
#define int long long
#define KETA(n) floor(log10(n) + 1)
using namespace std;
signed main() {
    int n, r;
    cin >> n >> r;
    if(n >= 10)
        cout << r << endl;
    else
        cout << r + (100 * (10 - n));
    return 0;
}

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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;

void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

bool prime[101010];
void eratos ( int n){
	prime[2] = true; prime[0] = prime[1] = false;
	for(int i = 3; i <= n; i += 2) prime[i] = true, prime[i+1] = false;
	int limit = (int)sqrt((double)n) + 1;
	for(int i = 3; i <= limit; i += 2){
		if(!prime[i]) continue;
		for(int j = i * i, k = i * 2; j <= n; j += k) prime[j] = false;
	}
}
int main()
{
 
	cin.tie(0); ios_base::sync_with_stdio(false);
	eratos(101000);
	int q;
	cin >>q;
	vector<int8_t> ck(101000);
	rep(i, 100100){
		if(i&1 && prime[i] && prime[(i+1)/2]) ck[i]=1;
	}
	VI sm(100101);
	rep(i, 100100) sm[i+1] = sm[i] + ck[i];
	
	rep(p, q){
		int l, r;
		cin >> l >>r;
		cout << sm[r+1] - sm[l] <<"\n";
		
	}
	return 0;
}


Measured memory_bytes: 1280
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
inf = -float('inf')
a = list(map(int, readline().split())) + [inf] * 2
dp = [[inf] * 3 for _ in range(n + 4)]
for i in range(3):
    dp[0][i] = 0
for i, (bf, aa, af) in enumerate(zip(a, a[1:], a[2:])):
    dp[i + 4][2] = max(dp[i + 4][2], dp[i][0] + af)
    for j in range(1, 3):
        dp[i + 3][j] = max(dp[i + 3][j], dp[i][j - 1] + aa)
    for j in range(3):
        if dp[i + 2][j] != inf or j == 0:
            dp[i + 2][j] = max(dp[i + 2][j], dp[i][j] + bf)
if n % 2 == 0:
    print(max(dp[n + 1][1], dp[n][0]))
else:
    print(max(dp[n + 1][2], dp[n][1], dp[n - 1][0]))


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

#ifdef LOCAL
#include <debug.hpp>
#else
#define debug(...) void()
#endif

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  unordered_map<int, bool> mp;
  for (int i = 0, a; i < n; i++) {
    cin >> a;
    if (mp.count(a) && mp[a]) {
      mp[a] = false;
    } else {
      mp[a] = true;
    }
  }
  int ans = 0;
  for (auto&& [_, e] : mp) {
    if (e) ans++;
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 7160
s = gets.chop.chars
s1 = []
s2 = []
s.each_with_index do |c, idx|
  case c
  when '\\'
    s1 << idx
  when '_'
  when '/'
    t = s1.pop
    next if t.nil?

    sum = idx - t
    loop do
      p = s2.pop
      break if p.nil?
      if p[0] > t
        sum += p[1]
      else
        s2 << p
        break
      end
    end
    s2 << [t, sum]
  end
end

puts s2.inject(0) { |acc, cur| acc + cur[1] }
puts [s2.length, *(s2.map{ |p| p[1] })].join(' ')


Measured memory_bytes: 9736
#include<iostream>
using namespace std;
const int N=1e5+10;
typedef long long LL;

LL prime[1000],num[1000],cnt;

LL gcd(LL a, LL b)
{
    return b ? gcd(b, a % b) : a;
}

void divide(LL x)
{
    for (LL i = 2; i <= x / i; i ++ )
        if (x % i == 0)
        {
            LL s = 0;
            while (x % i == 0) x /= i, s ++ ;
            prime[cnt]=i,num[cnt++]=s;
        }
    if (x > 1) prime[cnt]=x,num[cnt++]=1;
}

int main()
{
    LL a,b;
    cin>>a>>b;
    LL g=gcd(a,b);
    divide(g);
    cout<<cnt+1<<endl;
    //system("pause");
}

Measured memory_bytes: 3576
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:108777216")
#define _FORTIFY_SOURCE 0
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("fast-math")
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <utility>
#include <algorithm>
#include <ctime>
#include <cstdarg>
#include <sstream>
#include <functional>
using namespace std;

int const MAX_N = 512 * 1024;
long long const LL_INF = 5000000000000000000LL;

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	
	vector<pair<string, int> > v, vv;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		string s;
		int x;
		cin >> s >> x;
		v.push_back(make_pair(s, 1000-x));
	}
	vv = v;
	sort(vv.begin(), vv.end());
	
		for (int j=0; j<(int) vv.size(); j++)
			for (int i = 0; i < (int)v.size(); i++) {
			if (vv[j] == v[i]) {
				cout << (i + 1);
				cout << "\n";
			}
	}
	return 0;
}


Measured memory_bytes: 256
import Data.List

main :: IO ()
main = do
    n <- readLn
    print $ solve n

solve :: Integer -> Integer
solve = foldr (\x y -> x + 10 * y) 0 . unfoldr go
    where
        go 0 = Nothing
        go n = let (q, r) = n `divMod` 2 in Just (r, -q)

Measured memory_bytes: 508
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a;
    cin>>a;
    for(int i=0;i<a.size();i++)
    {
        if(a[i]=='9'){cout<<"Yes"<<endl;return 0;}
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long L = sc.nextLong();
        long R = sc.nextLong();
        long min = Long.MAX_VALUE;
        for (long i = L; i < R; i++) {
            for (long j = L+1; j <= R; j++) {
                long num = (i*j)%2019;
                if (num < min) {
                    min = num;
                } else if (num == 0) {
                    System.out.println(0);
                    return;
                }
            }
        }
        System.out.println(min);
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
int main(){
  int x,y;
  cin>>x>>y;
  int sum=0;
  for(int i=y;i<x+y;i++){
    sum +=i;
  }
  if(y>=0){
    cout<<sum-y<<endl;
  }
  else if(y<0&&y+x-1>=0){
    cout<<sum<<endl;
  }
  else{
    cout<<sum-(y+x-1)<<endl;
  }
  
}


Measured memory_bytes: 256
import numpy as np
import itertools

H,W,K=map(int, input().split())
C_=[list(input()) for _ in range(H)]
C=[]
temp=[]
ans=0

for i in range(H):
	for h in range(W):
		if C_[i][h]==".":temp.append(0)
		else:temp.append(1)
	C.append(temp)
	temp=[]
C=np.array(C)

HP_=[h for h in range(H)]
HP=[]
for r in range(H):
	HP.append(list(itertools.combinations(HP_,r)))
WP_=[w for w in range(W)]
WP=[]
for r in range(W):
	WP.append(list(itertools.combinations(WP_,r)))
#print(HP,WP)

for i in range(len(HP)):
	for hp in HP[i]:
		C_del_wp=np.delete(C,hp,0)
		#print(C_del_wp)
		
		for h in range(len(WP)):
			for wp in WP[h]:
				C_del=np.delete(C_del_wp,wp,1)
				#print(C_del)
				#print(np.count_nonzero(C_del==1))
				if np.count_nonzero(C_del==1)==K:
					ans+=1

print(ans)
		


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

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

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

    int ans = 1;
    int h = H[0];
    for(int i=1; i<N; i++){
        if(h<=H[i]){
            ans++;
            h = H[i];
        }
    }
    cout<< ans <<endl;
    return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
long long n,a[100050],c[100050];
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)scanf("%lld",&a[i]),a[i]*=2;
	int l=0,r=1e9;
	while(l<=r)
	{
		int mid=(l+r)/2;
		c[0]=mid*2;
		for(int i=1;i<=n;i++)c[i]=a[i]-c[i-1];
		c[n]>=c[0]?l=mid+1:r=mid-1;
	}
	c[0]=(l-1)*2;
	for(int i=1;i<=n;i++)c[i]=a[i]-c[i-1];
	for(int i=0;i<n;i++)printf("%lld ",c[i]);
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> A;
vector<long long> B;
pair<long long, long long> f(int s, int t) {
	int L = s+1;
	int R = t-1;
	for (;;) {
		if (R-L <= 4) {
			long long r = 0;
			for (int i = L; i <= R; ++ i) {
				r = max(r, min(B[i]-B[s], B[t]-B[i]));
			}
			return {r, B[t]-B[s]-r};
		} else {
			int i = L + (R-L)/3;
			int j = R - (R-L)/3;
			auto ri = min(B[i]-B[s], B[t]-B[i]);
			auto rj = min(B[j]-B[s], B[t]-B[j]);
			if (ri > rj) R = j; else L = i;
		}
	}
}
int main() {
	cin >> N;
	A = vector<int>(N);
	B = vector<long long>(N+1);
	for (int i = 0; i < N; ++ i) {
		cin >> A[i];
		B[i+1] = B[i] + A[i];
	}
	long long r = 1LL<<62;
	for (int i = 2; i <= N-2; ++ i) {
		auto p1 = f(0, i);
		auto p2 = f(i, N);
		r = min(r, max(p1.second, p2.second) - min(p1.first, p2.first));
	}
	cout << r << endl;
}


Measured memory_bytes: 2560
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#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) << endl
#define pn(s) cout << (#s) << " " << (s) << endl

const ll mod = 1e9 + 7;
const ll inf = 1e18;

// カウント
ll C[4000][4000] = {};

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

    // input
    ll N, K;
    cin >> N >> K;

    ll K2 = 2 * K;
    ll K4 = 4 * K;

    FOR(i, 0, N){
        ll x, y;
        char c;
        cin >> x >> y >> c;

        // すべてBに変換する
        if(c=='W'){
            x += K;
            c = 'B';
        }

        // 2K x 2K の領域に収める
        x = x % (2*K);
        y = y % (2*K);

        C[y][x]++;
    }



    // 4K x 4Kの領域にコピー
    FOR(i, 0, K2){
        FOR(j, 0, K2){
            C[j+K2][i] = C[j][i];
            C[j][i+K2] = C[j][i];
            C[j+K2][i+K2] = C[j][i];
        }
    }

    // p("C0");
    // FOR(i, 0, K4){
    //     FOR(j, 0, K4){
    //         cout << setw(4) << C[i][j];
    //     }
    //     cout << endl;
    // }

    // Cをそのまま累積和にする

    // 1. 横の累積和
    FOR(i, 0, K4){
        FOR(j, 1, K4){
            C[i][j] += C[i][j-1];
        }
    }

    // 2. 縦の累積和
    FOR(j, 0, K4){
        FOR(i, 1, K4){
            C[i][j] += C[i-1][j];
        }
    }

    ll count_max = 0;
    // 左下の点を2K, 2Kの領域で動かしながらそれぞれカウントする
    FOR(i, 0, K2){
        FOR(j, 0, K2){
            // 右上のカウント
            ll count0 = C[i+K2][j+K2] - C[i+K][j+K2] - C[i+K2][j+K] + C[i+K][j+K];
            // 左下のカウント
            ll count1 = C[i+K][j+K] - C[i+K][j] - C[i][j+K] + C[i][j];
            ll count = count0 + count1;

            count_max = max(count_max, count);
        }
    }



    // p("C");
    // FOR(i, 0, K4){
    //     FOR(j, 0, K4){
    //         cout << setw(4) << C[i][j];
    //     }
    //     cout << endl;
    // }

    p(count_max);

    
    return 0;
}

Measured memory_bytes: 125312
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fio ios_base::sync_with_stdio(false)
#define pdl cout << "*" << endl
#define MOD 1000000007
#define INF 1000000000
#define INFLL 1000000000000000000ll
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define long int64_t
using namespace std;
using namespace __gnu_pbds;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef priority_queue<pii, vector<pii>, greater<pii>> min_pq;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> OST;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
uniform_int_distribution<> dis(0, INF<<1);
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void __f(const char* name, Arg1&& arg1){ cerr << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args)
{ const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma+1, args...); }

const int N = 200001;

unordered_map<int, unordered_map<int, bool>> m;
vector<int> v[N];

int main()
{
	fio;
	int h, w, n;
	cin >> h >> w >> n;
	for(int i=1; i<=n; i++)
	{
		int x, y;
		cin >> x >> y;
		m[x][y] = true;
		v[y].pb(x);
	}
	int ans = h, cur = 1;
	for(int i=1; i<=w; i++)
	{
		for(int it : v[i])
			if(it > cur)
				ans = min(ans, it-1);
		bool f = true;
		while(i < w and cur+1 < ans)
		{
			cur++;
			if(!m[cur][i+1])
			{
				f = false;
				break;
			}
		}
		if(f)
			break;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 44360
import sys, math
from functools import lru_cache
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    S = input()
    win = S.count('o')
    N = len(S)
    if win + 15-N >= 8:
        print('YES')
    else:
        print('NO')


if __name__ == '__main__':
    main()

Measured memory_bytes: 9504
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
#include <map>

#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;

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 A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

const int INF = 0x3fffffff;


int main(){
	int N, M, Q;
	bool ans=false;

	cin >> N >> M >> Q;
	vector<int> s;
	vector<int> a(Q);
	rep(i,Q){
		cin >> a[i];
		a[i]--;
	}
	reverse( all(a) );

	map<int,int> mp;
	int max_num=0;
	int cnt[100005]={};
	rep(i,Q){
		if( !mp.count(a[i]) ){
			mp[ a[i] ] = s.size();
			s.push_back(a[i]);
		}
		int num = mp[ a[i] ];
		if( num == 0 || cnt[num-1] > cnt[num] ){
			cnt[num]++;
		}
	}

	map<int,int> m;
	max_num = 0;
	rep(i, s.size()){
		m[ s[i] ] = i;
		if( cnt[i] >= N || s[i] == max_num ){
			ans = true;
		}else{
			ans = false;
			break;
		}
		while( m.count(max_num) ) max_num++;
	}

	cout << (ans?"Yes":"No") << endl;

	return 0;
}


Measured memory_bytes: 10744