akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

/* SimpleSegTree(0-index) */

template<typename Type = int>
struct SimpleSegTree {
  int segn2;
  Type initVal;
  vector<Type> data;

  SimpleSegTree(int n) {
    for (segn2 = 1; segn2 < n; segn2 *= 2)
      ;
    data.assign(segn2 * 2, 0);
  }

  //get value [a,b)
  Type query(int a, int b, int l = 0, int r = -1, int k = 0) {
    if (r == -1) r = segn2;
    if (a <= l && r <= b) return data[k];
    if (r <= a || b <= l) return 0;
    return max(query(a, b, l, (l + r) / 2, k * 2 + 1), query(a, b, (l + r) / 2, r, k * 2 + 2));
  }

  //set kth number x
  void set(int k, Type x) {
    k += segn2 - 1;
    data[k] = x;
    while (k > 0) {
      k = (k - 1) / 2;
      data[k] = max(data[k * 2 + 1], data[k * 2 + 2]);
    }
  }
};


int N, X[SIZE], L[SIZE];
int val[SIZE];
vector<int> vec;
map<int,int> dic;
pair<int,int> A[SIZE];

int main() {

  scanf("%d", &N);

  for (int i=0; i<N; i++) {
    scanf("%d%d", X+i, L+i);
    vec.push_back(X[i]-L[i]);
    vec.push_back(X[i]+L[i]);
  }

  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());

  for (int i=0; i<vec.size(); i++) {
    dic[vec[i]] = i;
  }

  for (int i=0; i<N; i++) {
    A[i] = {dic[X[i]-L[i]], dic[X[i]+L[i]]};
  }

  sort(A, A+N);

  SimpleSegTree<int> seg(vec.size()+1);

  for (int i=0; i<N; i++) {
    int t = seg.query(0, A[i].first + 1);
    debug(A[i]);
    debug(t);
    val[A[i].second] = max(val[A[i].second], t + 1);
    seg.set(A[i].second, val[A[i].second]);
  }

  int ans = seg.query(0, vec.size()+1);

  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 14836
import sys
import os
import itertools
import numpy as np
from collections import deque

def main():
    if os.getenv("ENV")=='LOCAL':
        sys.stdin = open(os.path.dirname(__file__)+'/input.txt', 'r')

    N,M,K=map(int, input().split())
    A=list(map(int, input().split()))
    B=list(map(int, input().split()))

    lA=len(A)-1
    Ap=-1
    Bp=-1
    n=0
    t=0

    for i in range(len(A)): #Aは可能な限り足す
        if t+A[i]>K:
            break
        Ap=i
        t+=A[i]
        n+=1
    for i in range(len(B)):
        if t+B[i]>K:
            break
        Bp=i
        t+=B[i]
        n+=1

    max=n #読める本の最大値
    # print(max)
    for i in range(Ap+1):
        # print("n="+str(n)+" t="+str(t)+" A="+str(Ap)+" B="+str(Bp))
        t-=A[Ap]
        n-=1
        Ap-=1
        for j in range(Bp+1,len(B)):
            # print(str(n)+" : "+str(t)+" j="+str(j))
            if t+B[j]>K:
                break
            Bp=j
            t+=B[j]
            n+=1
        if max<n:
            max=n

    print(max)

if __name__ == '__main__':
    main()


Measured memory_bytes: 58572
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
#include <complex>
typedef complex<double> P;
double dot(P a, P b) {
	return (a.real() * b.real() + a.imag() * b.imag());
}
double cross(P a, P b) {
	return (a.real() * b.imag() - a.imag() * b.real());
}
int ccw(P a, P b,P c) {
	P e = b - a;
	P f = c - a;
	if (cross(e, f) > eps) {
		return 1;
	}
	if (cross(e, f) < -eps) {
		return -1;
	}
	if (dot(e, f) < -eps) return 2;
	if (abs(e) < abs(f)) return -2;
	return 0;
}
bool intersect(P a, P b, P c, P d) {
	if (ccw(a, b, c) * ccw(a, b, d) <= 0) {
		if (ccw(c, d, a) * ccw(c, d, b) <= 0){
			return 1;
		}
	}
	return 0;
}
double getDistanceLP(P a, P b, P c) {
	return abs(cross(b - a, c - a) / abs(b - a));
}
double getDistanceSP(P a, P b, P c) {
	if (dot(b - a, c - a) < 0.0) return abs(c - a);
	if (dot(a - b, c - b) < 0.0) return abs(c - b);
	return getDistanceLP(a, b, c);
}
double getDistance(P a, P b, P c, P d) {
	if (intersect(a, b, c, d)) return 0.0;
	return min({ getDistanceSP(a, b, c), getDistanceSP(a, b, d), getDistanceSP(c, d, a), getDistanceSP(c, d, b) });
}
long long dp[200000][100] = {};
int main() {
	long long n, m;
	cin >> n >> m;
	long long ans = 1;
	for (long long i = 2; i <= sqrt(m); ++i) {
		if (m % i == 0) {
			long long now = 0;
			while (m % i == 0) {
				now++;
				m /= i;
			}
			dp[0][0] = 1;
			for (int q = 1; q <= n; ++q) {
				long long nya = 0;
				for (int j = 0; j <= now; ++j) {
					nya += dp[q - 1][j];
					nya %= MAX_MOD;
					dp[q - 1][j] = 0;
					dp[q][j] = nya;
				}
			}
			ans *= dp[n][now];
			ans %= MAX_MOD;
		}
	}
	if (m != 1) {
		ans *= n;
		ans %= MAX_MOD;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 80128
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <set>
#include <functional>
using namespace std;

#define rep(i,n) for(int i=0;i<(int)n;i++)


int main() {

    string s;
    cin >> s;
    int a = s[0] - '0', b = s[1] - '0', c = s[2]-'0', d = s[3]-'0';

    if (a + b + c + d == 7)printf("%d+%d+%d+%d=7\n", a, b, c, d);
    else if (a + b + c - d == 7)printf("%d+%d+%d-%d=7\n", a, b, c, d);
    else if (a + b - c + d == 7)printf("%d+%d-%d+%d=7\n", a, b, c, d);
    else if (a - b + c + d == 7)printf("%d-%d+%d+%d=7\n", a, b, c, d);
    else if (a + b - c - d == 7)printf("%d+%d-%d-%d=7\n", a, b, c, d);
    else if (a - b + c - d == 7)printf("%d-%d+%d-%d=7\n", a, b, c, d);
    else if (a - b - c + d == 7)printf("%d-%d-%d+%d=7\n", a, b, c, d);
    else if (a - b - c - d == 7)printf("%d-%d-%d-%d=7\n", a, b, c, d);
}

Measured memory_bytes: 256
#!/usr/bin/env python
from collections import defaultdict, deque
import math
from math import factorial
import re

def main():
    N, A, B = map(int, input().split())
    A_price = N * A
    B_price = B

    price = A_price if A_price < B_price else B_price
    print(price)


if __name__ == '__main__':
    main()


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

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

    int res = 0;
    int move = 0;
    int prev;
    int now;
    for (int i = 0; i < N; i++) {
        if (i == 0) {
            cin >> prev;
            continue;
        }
        cin >> now;
        if (now > prev) {
            res = max(res, move);
            move = 0;
        } else {
            move++;
        }
        prev = now;
    }
    res = max(res, move);

    cout << res;
}


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

int main(){
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  rep(i, k){
    if(b>=c){
      c*=2;
      continue;
    }
    if(a>=b){
      b*=2;
      continue;
    }
  }
 
  if(a<b&&b<c){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
 
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18
#define PI 3.14159265358979

using namespace std;

int main(void){
  vector<int> a(3);
  cin >> a[0] >> a[1] >> a[2];
  sort(a.begin(), a.end());

  int sum = a[0] + a[1] + a[2];


  if ((3*a[2] -sum) % 2 == 0){
    cout << (3*a[2] - sum) / 2 << endl;
  }
  else {
    cout << (3*(a[2] + 1) - sum) / 2 << endl;
  }



  return 0;
} 


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

int main()
{
  int n, x, i, j, k;
  int ans = 0;
  while (true) {
    cin >> n >> x;
    if (n == 0 && x == 0) return 0;

    for(int i=1; i < n+1; i++) {
      for(int j=i+1; j < n+1; j++) {
        for(int k=j+1; k < n+1; k++) {
          if (i+j+k == x && i != j && i != k && j != k && k != 0) {
            // cout << "debug" << i << " " << j << " " << k << endl;
            ans++;
          }
        }
        if (i+j+k == x && i != j && i != k && j != k&& k != 0) {
          // cout << "debug" << i << " " << j << " " << k << endl;
          ans++;
        }
      }
      if (i+j+k == x && i != j && i != k && j != k&& k != 0) {
        // cout << "debug" << i << " " << j << " " << k << endl;
        ans++;
      }
    }

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


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

#define MAX 100005
#define NIL -1

struct Node {
	int p,l,r;
}; 

Node T[MAX];
int n,D[MAX];

void  print(int u){
	int i,c;
	cout<<"node "<<u<<": ";
	cout<<"parent = "<<T[u].p<<", ";
	cout<<"depth = "<< D[u] <<", ";
	
	if(T[u].p==NIL) cout<<"root, ";
	else if(T[u].l == NIL) cout<<"leaf, ";
	else cout << "internal node, ";
	
	cout<<"[";
	
	for(i=0,c=T[u].l;c!=NIL;i++,c=T[c].r){
		if(i) cout<<", ";
		cout<<c;
	}
	
	cout<<"]"<<endl;
}

int rec(int u,int p){
	D[u]=p;
	if(T[u].r!=NIL) rec(T[u].r,p);
	if(T[u].l!=NIL) rec(T[u].l,p+1);
}

int main() {
	int i,j,d,v,c,l,r;
	
	cin>>n;
	
	for(i=0;i<n;i++) T[i].p = T[i].l = T[i].r=NIL;
	
	for(i=0;i<n;i++){
		cin>>v>>d;
		for(j=0;j<d;j++){
			cin>>c;
			if(j==0) T[v].l=c;
			else T[l].r=c;
			l=c;
			T[c].p=v;
		}
	}
	
	for(i=0;i<n;i++){
		if(T[i].p==NIL) r=i;
	}
	
	rec(r,0);
	
	for(i=0;i<n;i++) print(i);
	
	
	return 0;
}

Measured memory_bytes: 7684
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
using namespace std;



int main(void){
    int n;
    cin >> n;
    vector<long long int> a(n+1);
    for(int i=1; i<=n; i++) cin >> a[i];
    
    int sum = 0;
    for(int i=1; i<=n; i++) {
        while(a[i]%2 == 0) {
            sum++;
            a[i] = a[i]/2;
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 384
import java.util.Arrays;
import java.util.Scanner;


public class Main{
	
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		int[] in = new int[10];
		for(int i = 0; i < 10; i++) {
			in[i] = sc.nextInt();
		}
		sc.close();
		int[] result = top3(in);
		for(int i: result) System.out.println(i);
	}
	
	static int[] top3(int[] args) {
		int[] copy = Arrays.copyOf(args, args.length);
		Arrays.sort(copy);
		int[] result = new int[3];
		for(int i = 0; i < 3; i++) {
			result[i] = copy[copy.length - 1 - i];
		}
		return result;
	}
}

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

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };

typedef long long ll;
using namespace std;

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

  int n = s.length();  
  rep(i,0,n-1){
    rep(j,i+1,n){
      if(s[i] == s[j]){
        printf("no\n");
        return 0;
      }
    }
  }
  printf("yes\n");
	return 0;
}

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

int main() {
	int n;
	int ans = 0;
	cin >> n;
	vector<int> p(n);
	for (int i = 0; i < n; i++) {
		cin >> p.at(i);
	}
	for (int i = 0; i < n - 2; i++) {
		if (p.at(i) > p.at(i + 1)) {
			if (p.at(i + 1) > p.at(i + 2)) ans++;
		}
		else {
			if (p.at(i + 1) < p.at(i + 2)) ans++;
		}
	}
	cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
const int N=2e5+10;
const int inf=0x3f3f3f3f;
int n,x[N],y[N];
char c[N];
vector<int>g[N],h[N],plsU[N*2],mnsU[N*2],plsD[N*2],mnsD[N*2];
bool cmp1(int a,int b){return y[a]<y[b];}
bool cmp2(int a,int b){return x[a]<x[b];}
bool cmp3(int a,int b){return x[a]>x[b];}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d%d %c",&x[i],&y[i],&c[i]);
		if(c[i]=='L'||c[i]=='R')h[y[i]].pb(i);
		else
		{
			g[x[i]].pb(i);
			if(c[i]=='U')plsU[x[i]+y[i]].pb(i),mnsU[y[i]-x[i]+200000].pb(i);
			if(c[i]=='D')plsD[x[i]+y[i]].pb(i),mnsD[y[i]-x[i]+200000].pb(i);
		}
	}
	int ans=inf;
	for(int i=0;i<=200000;i++)
	{
		if(g[i].empty())continue;
		sort(g[i].begin(),g[i].end(),cmp1);
		for(int j=0;j+1<g[i].size();j++)
		if(c[g[i][j]]=='U'&&c[g[i][j+1]]=='D')ans=min(ans,5*(y[g[i][j+1]]-y[g[i][j]]));
	}
	for(int i=0;i<=200000;i++)
	{
		if(h[i].empty())continue;
		sort(h[i].begin(),h[i].end(),cmp2);
		for(int j=0;j+1<h[i].size();j++)
		if(c[h[i][j]]=='R'&&c[h[i][j+1]]=='L')ans=min(ans,5*(x[h[i][j+1]]-x[h[i][j]]));
	}
	for(int i=0;i<=400000;i++)
	{
		if(!plsD[i].empty())sort(plsD[i].begin(),plsD[i].end(),cmp3);
		if(!plsU[i].empty())sort(plsU[i].begin(),plsU[i].end(),cmp2);
	}
	for(int i=0;i<=400000;i++)
	{
		if(!mnsD[i].empty())sort(mnsD[i].begin(),mnsD[i].end(),cmp2);
		if(!mnsU[i].empty())sort(mnsU[i].begin(),mnsU[i].end(),cmp3);
	}
	for(int i=1;i<=n;i++)
	{
		int z;
		if(c[i]=='U'||c[i]=='D')continue;
		if(c[i]=='L')
		{
			z=y[i]-x[i]+200000;
			if(!mnsU[z].empty())
			{
				int t=lower_bound(mnsU[z].begin(),mnsU[z].end(),i,cmp3)-mnsU[z].begin();
				if(t<mnsU[z].size())ans=min(ans,10*(x[i]-x[mnsU[z][t]]));
			}
			z=x[i]+y[i];
			if(!plsD[z].empty())
			{
				int t=lower_bound(plsD[z].begin(),plsD[z].end(),i,cmp3)-plsD[z].begin();
				if(t<plsD[z].size())ans=min(ans,10*(x[i]-x[plsD[z][t]]));
			}
		}
		if(c[i]=='R')
		{
			z=y[i]-x[i]+200000;
			if(!mnsD[z].empty())
			{
				int t=lower_bound(mnsD[z].begin(),mnsD[z].end(),i,cmp2)-mnsD[z].begin();
				if(t<mnsD[z].size())ans=min(ans,10*(x[mnsD[z][t]]-x[i]));
			}
			z=x[i]+y[i];
			if(!plsU[z].empty())
			{
				int t=lower_bound(plsU[z].begin(),plsU[z].end(),i,cmp2)-plsU[z].begin();
				if(t<plsU[z].size())ans=min(ans,10*(x[plsU[z][t]]-x[i]));
			}
		}
	}
	if(ans==inf)puts("SAFE");
	else printf("%d\n",ans);
	return 0;
}


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

int main(){
    int a,b,i=0;
    char op;
    int result[1000];

    while(1){
        cin >> a >> op >> b;
        if(op == '?'){
            break;
        }else if(op == '+'){
            result[i] = a + b;
        }else if(op == '-'){
            result[i] = a - b;
        }else if(op == '/'){
            result[i] = a / b;
        }else if(op == '*'){
            result[i] = a * b;
        }else{
            continue;
        }
        i++;
    }
    for(int j = 0;j < i;j++) cout << result[j] << endl;

    return 0;

}



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

ll ctoll(char a){
    return (ll)a-'0';
}

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	ll N,P;
	cin>>N>>P;
    string S;
    cin>>S;

    ll ans= 0;
    ll n;

    if(P==2){
        rep(i,N){
            n = ctoll(S[i]);
            if(n%2==0){
                ans += (i+1);
            }
        }
    }else if(P==5){
        rep(i,N){
            n = ctoll(S[i]);
            if(n%5==0){
                ans += (i+1);
            }
        }
    }else{
        //10の倍数ではない
        ll m[N+1]={};
        ll num_ls[P] = {};
        ll po = 1;
        rep(i,N){
            n = ctoll(S[N-1-i]);
            m[N-1-i]=(m[N-i]+n*po)%P;
            po = (po*10)%P;
            // cout<<m[N-1-i]<<"\n";
            ++num_ls[m[N-1-i]];
        }
        n = num_ls[0];
        ans += n;
        ans += n*(n-1)/2;
        rep(i,P-1){
            n = num_ls[i+1];
            ans += n*(n-1)/2;
        }
    }

   

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

Measured memory_bytes: 2196
a=input()
s=len(a)
f=False
for i,s in enumerate(a):
    if i%2==0 and s=='L':
        print("No")
        f=True
        break
    if i%2!=0 and s=='R':
        print("No")
        f=True
        break
if not f:
    print("Yes")

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

map<long long, long long> counter(vector<long long> nums){
    map<long long, long long> freq;
    for (auto i : nums) freq[i]++;
    return freq;
}

int main(){
    int n;cin>>n;
    vector<long long> numbers(n);for (int i=0;i<n;i++){cin >> numbers[i];}
    vector<long long> acc(n+1);
    acc[0] = 0;
    for (int i=0;i<n;i++) acc[i+1] = acc[i] + numbers[i];

    auto freq = counter(acc);

    long long patterns = 0;
    for (auto item: freq){
        if (item.second >= 2){
            patterns += item.second * (item.second - 1) / 2;
        } 
    }
    cout << patterns << endl;
    return 0;

}

Measured memory_bytes: 17408
s = input()
t = input()
ls = len(s)
lt = len(t)
dp = [[0] * (ls+1) for _ in range(lt+1)]

for i in range(1, lt+1):
    tt = t[i-1]
    for j in range(1, ls+1):
        ts = s[j-1]
        if ts == tt:
            dp[i][j] = dp[i-1][j-1] + 1
        else:
            dp[i][j] = max(dp[i-1][j], dp[i][j-1])

ret = []
while ls > 0 and lt > 0:
    # dpテーブルの番号が一致しているということは、今評価対象の文字は最長共通部分列に含まれないということになる
    # そのため評価対象の文字を変更して次のループに入る
    # dpテーブルを右下から左上になめるように見ていくのは、評価対象以降の文字列の影響を除くため
    if dp[lt][ls] == dp[lt][ls-1]:
        ls -= 1
    elif dp[lt][ls] == dp[lt-1][ls]:
        lt -= 1
    else:
        ret.append(s[ls-1])
        ls -= 1
        lt -= 1

ret.reverse()
print("".join(ret))


Measured memory_bytes: 113116
N,M = map(int,input().split())
ans = 0
l = [0] * (M+1)
for i in range(N):
    k,*ks =[int(k) for k in input().split()]
    for j in ks:
      l[j] += 1

for i in range(M+1):
    if(l[i] == N):
        ans += 1
    else:
        continue

print(ans)

Measured memory_bytes: 38256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

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

	    int N=gi();
	    List<Integer> D=new ArrayList<Integer>();
	    
	    int c=0;
	    for (int i=0; i<N;i++) {
	    	int d=gi();
	    	if (!D.contains(d)) {
	    		c++;
	    		D.add(d);
	    	}
	    }
	    System.out.println(c);
//	    if (isNumber(s1) && isNumber(s2) && s.charAt(a) == '-') {
//	    	System.out.print("Yes");
//	    }else {
//	    	System.out.print("No");
//	    }



	}

public static boolean isNumber(String val) {
	try {
		Integer.parseInt(val);
		return true;
	} catch (NumberFormatException nfex) {
		return false;
	}
}

	public static int d(int n) {
		int m=0;
		while(true) {
			if(n<1) {
				break;
			}
			int l= n%10;
			m+=l;
			n= (n-l)/10;
		}
		return m;
	}
	public static long d(long n) {
		String a=String.valueOf(n);
		return (long)a.length();
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

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

int main()
{
    std::string S;
    std::cin >> S;
    int r = 0, b = 0;
    for (int i = 0; i < S.length(); i++)
    {
        if (S[i] == '0') { r++; }
        else
        {
            b++;
        }
    }
    if (r >= b) { std::cout << b * 2 << std::endl; }
    else
    {
        std::cout << r * 2 << std::endl;
    }

    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <map>
typedef long long ll;

using namespace std;

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

    vector<int> data(a);

    int cnt1 = 0;
    int cnt2 = 0;

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

    for (int i = 0; i<a; i++) {
        if (data[i] % 2 == 0) {
            ++cnt1;
            if ((data[i] % 3 == 0) || (data[i] % 5 == 0)) {
                ++cnt2;
            }
        }
    }

    if (cnt1 == cnt2) {
        cout << "APPROVED" << endl;
    } else {
        cout << "DENIED" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

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

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;  cin >> n;
    ll m = 0;
    ll sum = 0;
    ll ans = 100000000000000000LL;
    vector<int> a(n), b(n);
    rep(i, n) {
      cin >> a[i];
      sum += a[i];
    }
    rep(i, n - 1) {
      m += a[i];
      ans = min(ans, abs(sum - m * 2));
    }

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <sstream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
using namespace std;
int i,j,k,n,m;
string s;

int main() {
  cin >> n >>k;
  vector<int> v(n);
  for(i=0;i<n;++i) {
    cin >> v[i];
  }
  auto itr = find(v.begin(),v.end(), 1);
  int id = (int)distance(v.begin(), itr);
  int lids = id;
  int rids = n - id - 1;
  int out = lids/(k-1);
  out += rids/(k-1);
  int rest = lids%(k-1) + rids%(k-1);
  out += rest/(k-1);
  if(rest%(k-1)!=0) out++;
  cout << out << endl;
  return 0;
}

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

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

	public static void main(String[] args) {
		while (true) {
			int P = sc.nextInt();
			if (P == 0) break;
			int Q = sc.nextInt();
			sc.nextLine();
			int[] depth = new int[3];
			int[][] indent = new int[P][4];
			for (int i = 0; i < P; ++i) {
				char[] line = sc.nextLine().toCharArray();
				indent[i][0] = depth[0];
				indent[i][1] = depth[1];
				indent[i][2] = depth[2];
				for (int j = 0;; ++j) {
					if (line[j] != '.') {
						indent[i][3] = j;
						break;
					}
				}
				update(line, depth);
			}
			ArrayList<Amount> list = new ArrayList<Amount>();
			for (int R = 1; R <= 20; ++R) {
				for (int C = 1; C <= 20; ++C) {
					for (int S = 1; S <= 20; ++S) {
						boolean match = true;
						for (int i = 0; i < P; ++i) {
							if (indent[i][0] * R + indent[i][1] * C + indent[i][2] * S != indent[i][3]) {
								match = false;
								break;
							}
						}
						if (match) {
							list.add(new Amount(R, C, S));
						}
					}
				}
			}
			for (int i = 0; i < Q; ++i) {
				char[] line = sc.nextLine().toCharArray();
				int ans = -999;
				for (Amount a : list) {
					int c = a.a[0] * depth[0] + a.a[1] * depth[1] + a.a[2] * depth[2];
					if (ans > 0 && ans != c) {
						ans = -999;
						break;
					}
					ans = c;
				}
				System.out.print((i != 0 ? " " : "") + (ans < 0 ? -1 : ans));
				update(line, depth);
			}
			System.out.println();
		}
	}

	static void update(char[] line, int[] depth) {
		for (int i = 0; i < line.length; ++i) {
			switch (line[i]) {
			case '(':
				depth[0]++;
				break;
			case '{':
				depth[1]++;
				break;
			case '[':
				depth[2]++;
				break;
			case ')':
				depth[0]--;
				break;
			case '}':
				depth[1]--;
				break;
			case ']':
				depth[2]--;
				break;
			}
		}
	}

	static class Amount {
		int[] a = new int[3];

		Amount(int R, int C, int S) {
			a[0] = R;
			a[1] = C;
			a[2] = S;
		}
	}

}

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

int main() {
 
  int d;
  cin >> d;
  if (d == 22 ) cout << "Christmas Eve Eve Eve" << endl;
  if (d == 23 ) cout << "Christmas Eve Eve" << endl;
  if (d == 24 ) cout << "Christmas Eve" << endl;
  if (d == 25 ) cout << "Christmas" << endl;
}


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

#define ll long long
#define mod 1000000007
#define inf 9223372036854775807
#define F first
#define S second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pll pair<ll,ll>
#define vll vector<ll>
#define umap unordered_map<ll,ll>
#define lpq priority_queue<ll,vector<ll>,greater<ll>>
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define repr(i,a,n) for(ll i=n-1;i>=a;i--)
ll globe=0;
template<typename TN>
void sorted(TN &v){sort(v.begin(),v.end());}
template<typename TN>
void reversed(TN &v){reverse(v.begin(),v.end());}
ll powe(ll n,ll r){if(!r)return 1;else if(r%2==0)return powe(n*n,r/2);else return n*powe(n*n,(r-1)/2);}
void traverseVLL(vll &arr,ll a,ll b){rep(i,a,b)  cout<<arr[i]<<" ";  cout<<endl;}
void traverseVPLL(vector<pll> &v,ll a,ll b){rep(i,a,b){cout<<v[i].F<<" "<<v[i].S<<endl;}}
void traverseVVLL(vector<vll> &v){rep(i,0,v.size()){rep(j,0,v[i].size()){cout<<v[i][j]<<" ";}cout<<endl;}}
void init(vll &v,ll a,ll b){for(ll i=a;i<b;i++) cin>>v[i];}
ll sqr(ll r){return r*r;}

void solution(){
    ll cnt=0;
    string s;
    cin>>s;
    vll v;
    for(ll i=0;i<s.size();i++){
        if(s[i]=='R') cnt++;
        else{
            v.pb(cnt);
            cnt=0;
        }
    }
    if(s[s.size()-1]=='R')
    v.pb(cnt);
    sort(v.begin(),v.end());
    cout<<v[v.size()-1]<<endl;
}

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

    ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

    ll T=1;
    //cin>>T;
    while(T--){
        solution();
    }

    return 0;
}

//BitMasking->setBit: n|(1<<i); unsetBit: n&!(1<<i); checkBit: n&(1<<i);
//ll idcharacter=upper_bound(v.begin(),v.end(),val)-v.begin();
//v.erase(unique(v.begin(),v.end()),v.end());
//ll cnt=count(v.begin(),v.end(),val);
//bool f=find(v.begin(),v.end(),val);

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

typedef long long LL;

const int MAX_N = 1000005;
const int mod = 1e9 + 7;

LL pow_mod(LL a, LL k, LL m) {
    LL r = 1;
    for(;k>0; k>>=1) {
        if(k&1) r= (r*a)%m;
        a=(a*a)%m;
    }
    return r;
}

LL inverse(LL a, LL m) {
    return pow_mod(a, m-2, m);
}
int x, y;
LL fac[MAX_N], inv[MAX_N];

LL C(LL n, LL r) {
    return (((fac[n] * inv[r]) % mod) * inv[n-r]) % mod;
}

int main() {
    scanf("%d %d", &x, &y);
    int n = max(x, y);

    fac[0]=1;
    inv[0] = 1;
    for (int i = 1; i <= n; i++)
    {
        fac[i] = (fac[i-1] * i)%mod;
        inv[i] = inverse(fac[i], mod);
    }
    
    
    if((x+y)%3)
        printf("0\n");
    else {
        int p = (x + y) / 3;
        if(x<p || y<p) {
            printf("0\n");
        } else {
            x -= p;
            y -= p;
            cout << C(x + y, x) << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;

int h, w, s;
int total;
int field[40][40];
int cumsum[40][40];
P memo[40][40][40][40];
bool visited[40][40][40][40];

P dfs(int sh, int sw, int eh, int ew){
    if(visited[sh][sw][eh][ew]) return memo[sh][sw][eh][ew];
    int area = cumsum[eh-1][ew-1];
    if(0 < sh) area -= cumsum[sh-1][ew-1];
    if(0 < sw) area -= cumsum[eh-1][sw-1];
    if(0 < sh && 0 < sw) area += cumsum[sh-1][sw-1];

    int demand = total - area;
    if(demand > s) return P(-1, -1);
    P ret(1, s - demand);
    for(int i=sh+1;i<eh;i++){
        P res1 = dfs(sh, sw, i, ew), res2 = dfs(i, sw, eh, ew);
        if(res1.first != -1 && res2.first != -1){
            P res(res1.first + res2.first, min(res1.second, res2.second));
            ret = max(ret, res);
        }
    }
    for(int j=sw+1;j<ew;j++){
        P res1 = dfs(sh, sw, eh, j), res2 = dfs(sh, j, eh, ew);
        if(res1.first != -1 && res2.first != -1){
            P res(res1.first + res2.first, min(res1.second, res2.second));
            ret = max(ret, res);
        }
    }
    visited[sh][sw][eh][ew] = true;
    memo[sh][sw][eh][ew] = ret;
    return ret;
}

int main(){
    while(true){
        cin >> h >> w >> s;
        if(h == 0) break;

        total = 0;
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                cin >> field[i][j];
                total += field[i][j];
            }
        }

        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                cumsum[i][j] = 0;
                for(int k=0;k<=i;k++){
                    for(int l=0;l<=j;l++){
                        cumsum[i][j] += field[k][l];
                    }
                }
            }
        }

        memset(visited, 0, sizeof(visited));
        P ans = dfs(0, 0, h, w);
        cout << ans.first << " " << ans.second << endl;
    }

    return 0;
}

Measured memory_bytes: 14516
#include <bits/stdc++.h>
using namespace std;
#define END '\n'
#define int long long
#define pb push_back
#define pii pair<int, int>
#define ff first
#define ss second
#define trace(x) cerr<<x<<END;
#define loop(i, a, b) for(int i = (a); i < (b); i++)
#define loopb(i, b, a) for(int i = (b); i > (a); --i) 
const int mod = 1e9+7;
const int mod1 = 998244353;
const int inf = 1e18;

void solve()
 {
  int x;
  cin>>x;
  cout<<(x>=30 ? "Yes" :"No");
  
 }  
signed main()
 {   
  ios_base::sync_with_stdio(false);
  cin.tie(0); 
  cout.tie(0); 
   /*int t;
   cin>>t;
   loop(i,1,t+1)*/
      solve();
      
  //cerr<<END<<1.0*clock();
  return 0;
} 


Measured memory_bytes: 3644
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int d = sc.nextInt();
        int bottom = (l%d == 0) ? 1 : 0;
        System.out.println(r/d - l/d + bottom);
    }
}

Measured memory_bytes: 26976
N = int(input())
a_ls=list(map(int, input().split()))

a=sorted(a_ls,reverse=True)

ans=0

if N%2==0:
	ans+=a[0]
	for i in range((N-2)//2):
		ans+=(a[1+i]*2)

if N%2==1:
	ans+=a[0]
	for i in range((N-1)//2):
		ans+=(a[1+i]*2)
	
	ans-=a[((N-1)//2)]

print(ans)


# 2darray [[0] * 4 for i in range(3)]

Measured memory_bytes: 31756
using System;
using System.Collections.Generic;
using System.Linq;
namespace ITP1_5_D
{
    class Problem
    {

        public static List<string[]> getinputdata (){

            List<string[]> list_temp = new List<string[]>();
            string strdata = Console.ReadLine ();

            while (strdata!=null) {

                string[] s_temp = strdata.Split (' ');

                list_temp.Add (s_temp);

                strdata = Console.ReadLine ();

            }
            return list_temp;
        }


        public static void Main (string[] args)
        {
            List<string[]> list_result = new List<string[]>();
            list_result = getinputdata ();

          
            int n= int.Parse(list_result[0][0]);
            string stemp = string.Empty;
            for (int i = 1; i <= n; i++)
            {
                if (i % 3 == 0 || i.ToString().Contains("3"))
                {
                    stemp += " " + i.ToString();
                }

            }
            Console.WriteLine(stemp);

            //Console.WriteLine(string.Join(" ",list01.ToArray()));

        }
    }
}

Measured memory_bytes: 10468
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N;
  cin>>N;
  string S;
  cin>>S;
  int Q;
  cin>>Q;
  ll ans[Q];
  int k;
  ll dnum, mnum, tmpans;
  int dmap[N], mmap[N];
  for(int i=0;i<Q;++i) {
    ans[i] = 0;
    cin>>k;
    for(int j=0;j<N;++j) {
      dmap[j] = 0;
      mmap[j] = 0;
    }
    dnum = 0;
    mnum = 0;
    tmpans = 0;
    for(int j=0;j<N;++j) {
      if(S[j]=='D') {
        dmap[j]++;
        dnum++;
      }
      if(S[j]=='M') {
        mmap[j]++;
        tmpans += dnum;
        mnum++;
      }
      if(S[j]=='C') {
        ans[i] += tmpans;
      }
      if(j-k+1>=0 && dmap[j-k+1]>0) {
        dnum--;
        tmpans -= mnum;
      }
      if(j-k+1>=0 && mmap[j-k+1]>0) {
        mnum--;
      }
    }
  }
  for(int i=0;i<Q;++i) cout<<ans[i]<<endl;
}



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

using namespace std;

#define pb            push_back
#define mp            make_pair
#define po            pop_back
#define fi            first
#define se            second
#define mxn           200001
#define ll            long long int
#define ldb           long double
#define fr(i,a,b,k)   for(ll i=a ; i<b ; i+=k)
#define frr(i,a,b,k)  for(ll i=a ; i>b ; i-=k)
#define all(v)        v.begin(),v.end()
#define endl          "\n"
#define deg(x)        cout<<endl<<#x<<" = "<<(x)<<endl;
#define casep(x)      cout<<"Case #"<<(x)<<": ";
#define fast          ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));

typedef pair<ll,ll> pp;
typedef vector<ll> vi;
typedef vector<pp> vpp;
typedef vector<vi> vvi;

const int inf = 1e9+7;

ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}
ll gcd(ll a,ll b){ return __gcd(a,b);}
ll lcm(ll a,ll b){return a*b/__gcd(a,b);}


void solve(ll test){

    ll n;
    cin >> n;

    ll a[n];
    fr(i,0,n,1)cin >> a[i];

    sort(a,a+n,greater<ll>());

    ll ans = 0;
    priority_queue<ll> q;

    fr(i,0,n,1){
        if(q.empty()){
            q.push(a[i]);
            // ans += 0;
        }
        else{
            ans += q.top();
            q.pop();
            q.push(a[i]);
            q.push(a[i]);
        }
    }

    cout << ans;

}

int main(){

    fast;
    int t=1;
    // cin >> t;
    for(int i=1 ; i<=t ; i++){
        solve(i);
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 6904
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int mod = 998244353;
const int N = 1500000;
const int K = 50 ;
int p[N][3], t[N][3], f1[N], f2[N];
map < pair < int, pair < int, int > >, int > mx;
pair < int, int > gt(pair < int, int > x, int l, int r){
    if (l <= 0) return {0, 0};
    int v1 = x.F;
    int v2 = x.S;
    l--;
    if (l > K){
        l -= K;
        r -= K;
        v1 >>= l;
        r -= l;
        return {0, (v1 & ((1LL << (r)) - 1))};
    }
    v2 >>= l;
    if (r > K){
        int z = v1 & ((1LL << l) - 1);
        v1 >>= l;
        v2 |= (z << (K - l));
    }
    r -= l;
    if (r <= K){
        return {0, (v2 & ((1LL << (r)) - 1))};
    } else{
        r -= K;
        return {(v1 & ((1LL << (r)) - 1)), v2};
    }
}
pair < int, pair < int, int > > encode (string s){
    int n = s.length();
    int x = 0;
    int y = 0;
    for (int i = 0; i < min(n, K); i++){
        if (s[i] == '1') y += (1LL << i);
    }
    for (int i = K; i < n; i++){
        if (s[i] == '1') x += (1LL << (i - K));
    }
    int v1 = gt({x, y}, 1, n).F;
    int v2 = gt({x, y}, 1, n).S;
    return {n, {x, y}};
}
pair < int, int > myand(pair < int, int > x, pair < int, int > y){
    return {(x.F & y.F), (x.S & y.S)};
}
int solve(pair < int, pair < int, int > > x){
    if (x.F == 0) return 1;
    if (mx.find(x) != mx.end()) return mx[x];
    if (x.F == 1) return 1 + (x.S.S == 1);
    int n = x.F;
    int res = 0;
    for (int i = 1; i < n; i++){
        pair < int, int > y = gt(x.S, 1, i);
        for (int j = 1; j * i <= n; j++){
            if (j == 1 && i != 1) continue;
            pair < int, int > z = gt(x.S, (j - 1) * i + 1, j * i);
            y = myand(y, z);
            res = (res + solve({i, y}) * solve({n - i * j, gt(x.S, i * j + 1, n)})) % mod;
        }
    }
    return mx[x] = res;
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    string s;
    cin >> s;
    cout << solve(encode(s));
}


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

int main() {
  int N, a, b, c;
  cin >> N;
  b = 9999;
  for (int i = 0; i < N; i++) {
    cin >> a;
    c = 0;
    while (a % 2 == 0) {
      c++;
      a /= 2;
    }
    if (c < b) {
      b = c;
    }
  }
  cout << b << endl;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int N;
    cin >> N;
    int zoro = 0;
    bool flag = false;
    rep(i, N) {
        int x, y;
        cin >> x >> y;
        if (x == y) zoro++;
        else zoro = 0;
        if (zoro >= 3) flag = true;
    }
    puts(flag ? "Yes" : "No");
    return 0;
    // ll, 0, -, 1i, for s&g, debug
}

Measured memory_bytes: 3628
x,y = map(int,input().split())
k = 100
if y < 10:
    k = 10
if y >99:
    k = 1000

c = y + x * k

for i in range(0,1100000):
    if c == i ** 2:
        print('Yes')
        k = 0
        
if k != 0:
    print('No')
        

Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int h = Integer.parseInt(sc.next());
        int a = Integer.parseInt(sc.next());
        
        if(h % a == 0){
            System.out.println(h/a);
        }else{
            System.out.println(h/a+1);
        }
    }
}

Measured memory_bytes: 22868
n, k = map(int, input().split())
d = list(map(int, input().split()))
ok = [i for i in range(10) if i not in d]
ans = []

def solve(pay):
	if pay == "00000":
		return
	if pay != "" and int(pay) >= n:
		ans.append(pay)
		return
	for c in ok:
		solve(pay + str(c))
	return

solve("")
print(min(list(map(int, ans))))

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> ii;
typedef map<int, int> MPII;
typedef set<int> SETI;

const int mxN = 2e5;
const ld pi = 4.0 * atanl(1.0);
const int iinf = 1e9 + 10;
const int inf = 1e18 + iinf + 10;
const int mod = 1000000007;
const ld prec = .000001;

#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(c) c.begin(), c.end()
#define rall(c) c.end(), c.begin()

int m, t, a[mxN];
vi v;

void fast() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); }

int main() {
  fast();
  double n;
  cin >> n;
  double ans = ceil(n / 1.08);
  if (floor(ans * 1.08) != n)
    cout << ":(";
  else
    cout << ans;

  return 0;
}



Measured memory_bytes: 3768
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i<(n);i++)
#define fore(i,a) for(auto &i:a)
#define debug(a,b) cout << "debug : " << a << " , "<< b << endl
using ll=long long;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
const ll INF=1LL<<60;
const ll mod=1E9+7;


int main(){
  ll n,m,k;
  cin >> n >> m >> k;
  vector<ll>a(n),b(m);
  rep(i,n)cin >> a[i];
  rep(i,m)cin >> b[i];
  vector<ll>Sa(n+1,0),Sb(m+1,0);
  rep(i,n)Sa[i+1]=Sa[i]+a[i];
  rep(i,m)Sb[i+1]=Sb[i]+b[i];
  ll b_max=0;int c=0;
  while(1){
    if(b_max+1>m)break;
    if(Sb[b_max+1]>k)break;
    b_max++;
  }
  //cout << b_max;
  ll ans=b_max,sum=Sb[b_max],cnt=b_max,j=0;
  for(int i=b_max;i>=0;i--){
    while(1){
      if(sum+a[j]>k||j==n)break;
      sum+=a[j];
      j++;
      cnt++;
    }
    //debug(sum,cnt);
    ans=max(ans,cnt);
    sum-=b[i-1];
    cnt--;
  }
  cout << ans;
}












Measured memory_bytes: 9576
using System.Linq;using static System.Console;class E{static void Main(){ReadLine();int[]a=ReadLine().Split().Select(int.Parse).ToArray(),c=new int[9];foreach(var x in a)if(x>3199)c[8]++;else c[x/400]=1;c[0]=c.Sum();WriteLine("{0} {1}",c[8]==a.Length?1:c[0]-c[8],c[0]);}}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define ll long long
#define lf long double
#define INF 1000000000
#define MAX 200001
#define M 1000000007
using namespace std;
 
int n;

map<int, int> mp[20];
vector<int> vc[20];
int sz[20];

int mx;

int solve(int v) {
    int cn = 0;
    for (int i=0;i<n;i++) {
        int szz = vc[i].size();
        if (!((1<<i)&v)) continue;
        cn++;
        for (int j=0;j<szz;j++) {
            int x = vc[i][j];
            int y = mp[i][x];
            int ver = ((1<<x)&v)!=0?1:0;
            if (ver != y) return 0;
        }
    }
    mx = max(mx, cn);
    return 0;
}

int brute(int i, int v) {
    if (i==n) {
        // solve
        solve(v);
        return 0;
    }
    brute(i+1, v);
    brute(i+1, v|(1<<i));
    return 0;
}

int main() {
    cin >> n;
    for (int i=0;i<n;i++) {
        cin >> sz[i];
        for (int j=0;j<sz[i];j++) {
            int x, y;cin >> x >> y;x--;
            mp[i][x] = y;
            vc[i].push_back(x);
        }
    }
    mx = 0;
    brute(0, 0);
    cout << mx << endl;
    return 0;
}

Measured memory_bytes: 256
n=int(input())

#素因数分解した結果を2次元配列にして返す
def prime_factorize(n):
    primelist=[]
    a=2
    n_origin=n
    while a*a<=n_origin:
        if n%a!=0:
            a+=1
            continue
        ex=0
        while n%a==0:
            ex+=1
            n=n//a
        primelist.append([a,ex])
        a+=1
    if n!=1:
        primelist.append([n,1])
    return primelist
mod=10**9+7
dic={}
ans=1
for i in range(2,n+1):
    pfs=prime_factorize(i)
    for j in range(len(pfs)):
        dic[pfs[j][0]]=dic.get(pfs[j][0],0)+pfs[j][1]
for v in dic.values():
    ans=(ans*(v+1))%mod
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define CMAX(m, x)  m = max(m,x);
#define CMIN(m, x)  m = min(m,x);
#define itn int
typedef long long lint;
typedef long double ldouble;
const int INF = 1e9;
const lint LINF = 1e18;

int sum = 0;
int len = 0;
int dfs(int i,int n, int m, vector<int> &buf, vector<vector<int>> &q){
    if(i == n){
        REP(i,q.size()){
            if(buf[q[i][1] - 1] - buf[q[i][0] - 1] == q[i][2])
                sum += q[i][3];
        }
        CMAX(len,sum);
        sum = 0;
    }else{
        if(i == 0){
            for(int j = 1;j <= m; j++){
                buf[i] = j;
                dfs(i + 1, n, m, buf, q);
            }
        }else{
            for(int j = buf[i - 1]; j <= m; j++){
                buf[i] = j;
                dfs(i + 1, n, m, buf, q);
            }
        }
    }
    return len;
}
int main(){
    int n,m,q;
    cin >> n >> m >> q;
    vector<vector<int>>qq(q,vector<int>(4));
    vector<int> digit(m);
    vector<int> val(m,1);
    REP(i,q)
        cin  >> qq[i][0] >> qq[i][1] >> qq[i][2] >> qq[i][3];
    vector<int> buf(n,1);

    cout << dfs(0, n, m,buf,qq) << endl;

    return 0;

}

Measured memory_bytes: 3612
s = gets.chomp
n = s.size

# 2文字以上同じ文字が連続すれば、それが答え
(n - 1).times do |i|
  if s[i] == s[i + 1]
    puts "#{i + 1} #{i + 2}"
    exit
  end
end

# 長さ2であれば、ここに来れば答えなし
if n == 2
  puts "-1 -1"
  exit
end

# 偶数列で文字が連続すれば、それも答え
(n / 2).times do |i|
  if s[i * 2] == s[i * 2 + 2]
    puts "#{i * 2 + 1} #{i * 2 + 3}"
    exit
  end
end

if n == 3
  puts "-1 -1"
  exit
end

# 奇数列
(n/2 - 1).times do |i|
  if s[i*2+1] == s[i*2+3]
    puts "#{i*2+2} #{i*2+4}"
    exit
  end
end

puts "-1 -1"


Measured memory_bytes: 2044
def solve():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    ans = 0
    c = {}
    s = [0 for i in range(N+1)]
    s[0] = 0
    for i in range(0, N):
        s[i + 1] = (s[i] + A[i]) % M
    #print(s)
    for i in range(0, N+1):
        if s[i] not in c.keys():
            c[s[i]] = 0
        ans += c[s[i]]
        c[s[i]] += 1
    return ans

print(solve())


Measured memory_bytes: 16268
// Template by [thunder_blade]
// IIIT ALLAHABAD
// includes :)

#include <bits/stdc++.h>
#include <ext/rope> 
#include <ctime>
using namespace __gnu_cxx;
using namespace std;
#define TEST  ll test_case; cin>>test_case; while(test_case--)
#define all(v) (v).begin(),(v).end()
#define fi  first
#define se  second
#define pb push_back
#define mp make_pair
#define ll long long int
#define SPEED ios_base::sync_with_stdio(false);  cin.tie(0);  cout.tie(0);
#define pi(x) printf("%d\n",x)
#define pl(x) printf("%lld\n",x)
#define pf(x) printf("%f\n",x)
#define ps(x) printf("%s\n",x)
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define sf(x) scanf("%f",&x)
#define ss(x) scanf("%s",x)
#define pis(x) printf("%d ",x)
#define pls(x) printf("%lld ",x)
#define pfs(x) printf("%f ",x)
#define pss(x) printf("%s ",x)
#define FOR(i,a,b) for(i=a;i<b;i++)
#define mod 1000000007
#define pii pair<int,int>
#define tr(container, it)  for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
ll power(ll a, ll n) {
  ll p = 1;
  while (n > 0) {
    if(n&1) {
      p = ((p%mod) * (a%mod))%mod; 
    } 
    n >>= 1; 
    a = ((a%mod)*(a%mod))%mod;
  } 
  return p%mod;
}

const long long B = 100000007; 
const long long M = 1000000009;
const int N = 500005;
int a[N];

int main()
{
  int n,a,b;
  si(n), si(a), si(b);
  int x = abs(a-b-1);
  if(a < b){
    if(x%2 == 0){
      puts("Borys");
    }else{
      puts("Alice");
    }
  }else{
    if(x%2){
      puts("Borys");
    }else{
      puts("Alice");
    }
  }
}

Measured memory_bytes: 256