akhauriyash/Code-Regression huggingface dataset:
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    int h, w, k;
    cin >> h >> w >> k;

    vector <string> s(h);
    for (int i = 0; i < h; i++) cin >> s[i];

    int ans = 1e9;
    for (int i = 0; i < (1 << (h - 1)); i++) {
        int cur = 0;
        vector <int> mp(h);
        int x = 0;
        for (int j = 0; j < h - 1; j++) {
            if (i & (1 << j)) {
                cur++;
                mp[j + 1] = j + 1;
                x = j + 1;
            } else {
                mp[j + 1] = x;
            }
        }

        bool possible = true;
        vector <int> sum(h), now(h);
        for (int j = 0; j < w; j++) {
            for (int l = 0; l < h; l++) {
                if (s[l][j] == '1') {
                    now[mp[l]]++;
                }
            }

            bool div = false;
            for (int l = 0; l < h; l++) {
                if (sum[l] + now[l] > k) {
                    div = true;
                }
                if (now[l] > k) {
                    possible = false;
                }
            }

            if (div) {
                cur++;
                for (int l = 0; l < h; l++) {
                    sum[l] = now[l];
                    now[l] = 0;
                }
            } else {
                for (int l = 0; l < h; l++) {
                    sum[l] += now[l];
                    now[l] = 0;
                }
            }
        }

        if (possible) {
            ans = min(ans, cur);
        }
    }

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

Measured memory_bytes: 888
#include <iostream>

int main(int argc, char *argv[])
{
  unsigned int n, p[20], r;
  std::cin >> n;
  for (int i=0; i<n; ++i) {
    std::cin >> p[i];
  }
  r = 0;
  for (int i=1; i<n-1; ++i) {
    if ((p[i-1] < p[i]) && (p[i] < p[i+1])) {
      ++r;
    } else if ((p[i-1] > p[i]) && (p[i] > p[i+1])) {
      ++r;
    } else {
      ;
    }
  }
  std::cout << r << std::endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Rep(i,a,b) for(register int i=(a);i<=(b);++i)
using namespace std;
template<typename T>inline void read(T&x)
{
	T f;register char ch;x=0;f=1;
	for(ch=getchar();!isdigit(ch);ch=getchar())if(ch=='-')f=-1;
	for(;isdigit(ch);ch=getchar())x=(x*10)+(ch^48);
	x*=f;
}

const int MAXN=1e5+7;

static int n,a[MAXN],b[MAXN];

inline void init()
{
	read(n);
	Rep(i,1,n)read(a[i]),read(b[i]);
}

typedef long long ll;

inline void Chkmin(ll&x,ll y){x=(x<=y?x:y);}

inline bool cmp1(int x,int y)
{return a[x]<a[y];}
inline bool cmp2(int x,int y)
{return b[x]<b[y];}

static ll ans,pre[2][MAXN];

static int cnt,ps[2][MAXN],top[2][MAXN];

inline void solve()
{
	Rep(i,1,n)ps[0][i]=ps[1][i]=i;
	sort(ps[0]+1,ps[0]+n+1,cmp1);
	sort(ps[1]+1,ps[1]+n+1,cmp2);
	Rep(i,1,n)top[0][ps[0][i]]=i,top[1][ps[1][i]]=i;
	Rep(i,1,n)
	{
		pre[0][i]=pre[0][i-1]+a[ps[0][i]];
		pre[1][i]=pre[1][i-1]+b[ps[1][i]];
	}
	ans=min(pre[0][n],pre[1][n]);
	Rep(i,1,n-1)
	{
		if(top[1][ps[0][i]]<=n-i)++cnt;
		if(top[0][ps[1][n-i+1]]<i)--cnt;
		//cout<<cnt<<' '<<pre[1][i]<<' '<<pre[1][n-i]<<' '<<b[top[1][n-i+1]]<<' '<<a[]<<endl;
		if(cnt)Chkmin(ans,pre[0][i]+pre[1][n-i]);
		else Chkmin(ans,min(pre[0][i]+pre[1][n-i-1]+b[ps[1][n-i+1]],pre[0][i-1]+pre[1][n-i]+a[ps[0][i+1]]));
	}
	cout<<ans<<endl;
}

int main()
{
	init();
	solve();
	return 0;
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int n, k;
    cin >> n >> k;
    vector<int> p(n), c(n);
    for (int i = 0; i < n; i++) cin >> p[i];
    for (int i = 0; i < n; i++) cin >> c[i];
    for (int i = 0; i < n; i++) p[i]--;
    ll ans = -LINF;

    for (int si = 0; si < n; si++) {
        int x = si;
        vector<int> s;
        ll tot = 0;
        while (1) {
            x = p[x];
            s.push_back(c[x]);
            tot+= c[x];
            if (x == si) break;
        }
        int l = s.size();
        ll t = 0;
        for (int i = 0; i < l; i++) {
            t += s[i];
            if (k < i+1) break;
            // 周期の和が正の場合は追加する
            ll now = t;
            if (tot > 0) {
                // 何周できるか
                ll e = (k-(i+1)) / l;
                now += tot*e;
            }
            ans = max(ans, now);
        }
    }
    cout << ans << '\n';
}

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

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            int input = int.Parse(Console.ReadLine());
            int ret = (int)Math.Ceiling(input / 2.0);
            Console.WriteLine(ret / (double)input);
        }
    }
}


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

int main() {
  int H,W;
  cin>>H>>W;
  
  vector<vector<char>> A(H,vector<char>(W));
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin>>A.at(i).at(j);
    }
  }
  
  vector<int> L(H),R(W);
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(A.at(i).at(j)=='#'){
        L.at(i)=1;
        R.at(j)=1;
      }
    }
  }
  
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(L.at(i)==1&&R.at(j)==1){
        cout<<A.at(i).at(j);
      }
      if(j==W-1&&L.at(i)==1) cout<<endl;
    }
  } 
}

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

typedef long long ll;
#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define REPM(i,n) for(ll i=(n); 0<=i; i--)
#define VI vector<int>
#define VL vector<ll>
#define VD vector<double>
#define VS vector<string>
#define V_SORT_U(x) sort(x.begin(), x.end());                   //昇順
#define V_SORT_D(x) sort(x.begin(), x.end(),greater<int>());    //降順
#define V_SUM(x) accumulate(x.begin(), x.end(), 0)
#define STR_TRANS_UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper); 
#define STR_TRANS_LOW(x) transform(x.begin(), x.end(), x.begin(), ::tolower);
#define SetPre(x) setprecision(x)

int main(void){
    //標準入力
    ll X,Y;
    ll honsuu=0;
    cin >> X >> Y;

    REP(i,X+1)
    {
        honsuu = 2*i + 4*(X-i);
        if( honsuu == Y )
        {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 3636
#define _GLIBCXX_DEBUG
    #include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    typedef pair<int, int> pii;
    typedef vector<int> vi;
    typedef vector<bool> vb;
    #define pb push_back
    #define mp make_pair
    #define f first
    #define s second
    #define in insert
    #define FOR(i,a,b) for (int i = a; i < b; i++)
    #define all(x) (x).begin(), (x).end()
    #define rall(x) (x).rbegin(), (x).rend()
    #define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    const int INF = 1e9 + 5;
    int main(){
        int n, d;
        cin >> n >> d;
        vector<vi> p(n, vi(d));
        for(int i = 0; i < n; i++){
            for(int j = 0; j < d; j++) cin >> p[i][j];
        }
        int cnt = 0;
        for(int i = 0; i < n; i++){
            for(int j = i + 1; j < n; j++){
                int x = 0;
                for(int k = 0; k < d; k++){
                    x += (p[i][k] - p[j][k]) * (p[i][k] - p[j][k]);  
                }
                if((int)sqrt(x) * (int)sqrt(x) == x) {
                    cnt++;
                }
            }
        }
        cout << cnt;
    }

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		try {
			int a = sc.nextInt();
			int b = sc.nextInt();
			System.out.println("a " + (a == b ? "==" : (a < b ? "<": ">")) + " b");
		} finally {
			sc.close();
		}
	}

}

Measured memory_bytes: 26152
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-5)
#define bit(n,k) ((n>>k)&1)
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T &a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T &a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
vector<string>split(string s, char c = ' ') {
	vector<string>vec;
	string h = "";
	for (int i = 0; i < s.size();) {
		int j = i;
		while (j < s.size() && s[j] != ' ') {
			h += s[j++];
		}
		if (h.size() > 0) vec.push_back(h);
		h = "";
		i = j + 1;
	}
	return vec;
}
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int n;
int solve(int t, bool x, bool y, bool z) {
	if (t > n) return 0;
	int sum = x & y & z;
	sum += solve(t * 10 + 3, 1, y, z);
	sum += solve(t * 10 + 5, x, 1, z);
	sum += solve(t * 10 + 7, x, y, 1);
	return sum;
}
signed main() {
	n = read();
	cout << solve(0, 0, 0, 0) << endl;
}

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

// #define multitest 1
#ifdef WIN32
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
#define pc(...) PC(#__VA_ARGS__, __VA_ARGS__);
template <typename T, typename U>
ostream &operator<<(ostream &out, const pair<T, U> &p)
{
	out << '[' << p.first << ", " << p.second << ']';
	return out;
}
template <typename Arg>
void PC(const char *name, Arg &&arg)
{
	std::cerr << name << " { ";
	for (const auto &v : arg)
		cerr << v << ' ';
	cerr << " }\n";
}
template <typename Arg1>
void ZZ(const char *name, Arg1 &&arg1)
{
	std::cerr << name << " = " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void ZZ(const char *names, Arg1 &&arg1, Args &&... args)
{
	const char *comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
#else
#define db(...)
#define pc(...)
#endif

using ll = long long;
#define f first
#define s second
#define pb push_back
const long long mod = 1000000007;
auto TimeStart = chrono::steady_clock::now();

const int nax = 2e5 + 10;

void solve()
{
	int n, k, x, cnt = 0;
	cin >> n >> k;
	while (n--)
	{
		cin >> x;
		cnt += x >= k;
	}
	cout << cnt << '\n';
}

int main()
{
#ifndef WIN32
	ios_base::sync_with_stdio(0);
	cin.tie(0);
#endif
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
	while (t--)
		solve();
#ifdef WIN32
	cerr << "\n\nTime elapsed: " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " seconds.\n";
	flush(cout);
#endif
	return 0;
}

Measured memory_bytes: 256
N, Q = map(int, input().split())
S = input()

AC_list = []
cnt = 0
for i in range(N):
  if i != 0 and S[i - 1] == "A" and S[i] == "C":
    cnt += 1
  AC_list.append(cnt)

for _ in range(Q):
  l, r = map(int, input().split())
  print(AC_list[r - 1] - AC_list[l - 1])

Measured memory_bytes: 6104
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef istringstream ISS;
typedef ostringstream OSS;
typedef vector <string> VS;
typedef vector <int> VI;
typedef vector <VI> VVI;
template <class T> T gcd( T a, T b ) { return !b ? a : gcd( b, a % b ); }
template <class T> T lcm( T a, T b ){ return a / gcd( a, b ) * b; }
template <class T> string print_v( vector<T> v ) { OSS oss; for ( typename vector<T>::iterator it_i = v.begin(); it_i != v.end(); ++ it_i ) { oss << *it_i << ", "; } return oss.str(); }

int main() {
    int D[101] = {};
    int a;
    int max_d = 0;
    while ( cin >> a ) max_d = max( max_d, ++D[a] );
    for ( int i = 1; i <= 100; ++ i ) {
        if ( D[i] == max_d ) cout << i << endl;
    }
    return 0;
}

Measured memory_bytes: 0
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws IOException {
        //System.setIn(Main.class.getClassLoader().getResourceAsStream("input"));
        Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int x = sc.nextInt();
        int y = sc.nextInt();
        int res = solve(x, y);
        System.out.println(res);
    }

    private static int solve(int x, int y) {
        int[] prices = new int[206];
        prices[0] = 300000;
        prices[1] = 200000;
        prices[2] = 100000;
        if (x == 1 && y == 1) {
            return 1000000;
        }
        return prices[x - 1] + prices[y - 1];
    }
}


Measured memory_bytes: 21844
#include <cstdio>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

#define EPS 1e-8
typedef complex<double> P;

struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
};

struct C {
  P p; double r;
  C(const P &p, double r) : p(p), r(r) { }
};

double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}

double dist(const P& a, const P& b)
{
	return sqrt((a.real()-b.real())*(a.real()-b.real())+(a.imag()-b.imag())*(a.imag()-b.imag()));
}

bool isIntoC(const L& l, const C& c)
{
	return dist(l[0], c.p)+EPS < c.r && dist(l[1], c.p)+EPS < c.r;
}

bool intersectSC(const L& l, const C& c)
{
	if(isIntoC(l, c)) return false;
	
	double vc=dot(l[1]-l[0], c.p-l[0]);
	if(vc+EPS<0)
	{
		return dist(l[0], c.p)<c.r+EPS;
	}
	
	double vv=dot(l[1]-l[0], l[1]-l[0]);
	
	if(vc > vv)
	{
		double d=dist(l[1], c.p);
		
		return d*d<c.r*c.r+EPS;
	}
	
	double cc=dot(c.p-l[0], c.p-l[0]);
	
	return cc-(vc/vv)*vc < c.r*c.r+EPS;
}

int main()
{
	int N,M;
	
	while(scanf("%d", &N), N)
	{
		vector<C> walls;
		while(N--)
		{
			int x,y,r;
			scanf("%d%d%d", &x,&y,&r);
			walls.push_back(C(P(x,y), r));
		}
		
		scanf("%d", &M);
		while(M--)
		{
			int tx,ty,sx,sy;
			scanf("%d%d%d%d", &tx,&ty,&sx,&sy);
			bool g=false;
			for(int i=0; i<walls.size(); i++)
			{
				if(intersectSC(L(P(tx,ty),P(sx,sy)), walls[i]))
				{
					g=true;
					break;
				}
			}
			
			puts((g?"Safe":"Danger"));
		}
	}
}

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

int main() {
    int n, d, x;
    cin >> n >> d >> x;
    int count = n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
    }
    d--;
    for (int i = 0; i < n; i++) {
        count += d / a.at(i);
    }
    cout << count + x << endl;
}

Measured memory_bytes: 256
#入力
n=int(input())
ab=[]
#頂点1,3,4が直接つながっている時G[1]=[3,4],G[3]=[1,4],G[4]=[1,3]となるグラフ表現
G=[[] for i in range(n+1)]
for i in range(n-1):
    ab.append(list(map(int,input().split())))
    G[ab[i][0]].append(ab[i][1])
    G[ab[i][1]].append(ab[i][0])

#親から伸びた枝の色を保存するリスト
#p[3]=2ならばノード3の親とノード3をつなぐ枝の色は2
p=[-1 for i in range(n+1)]
#枝の色を保存するディクショナリ
#edge{"2,5":3}ならばノード２とノード５をつなぐ枝の色は３
edge={}
#ノードが探索済みか否かを判別するリスト
#used[6]=1ならばノード６は探索済み
used=[0 for i in range(n+1)]

#一つのノードから伸びる枝の数の最大値
max_n=0
for i in range(n+1):
    tmp=len(G[i])
    if tmp>max_n:
        max_n=tmp
        #枝が最も多いノードを根とする
        top=i

#キューに根を追加
queue=[]
queue.append(top)

#幅優先探索
while len(queue)>0:
    #キューからノードを取り出して、探索済みにする
    num=queue.pop(0)
    used[num]=1
    color=1
    
    #現在のノードから伸びている枝の数だけ探索
    for i in range(len(G[num])):
        #探索するノードが未探索かの判定
        if used[G[num][i]]==0:
            if p[num]==color:
                #いま塗ろうとしている色が親からの伸びる枝の色とかぶっていた場合
                #その色をスキップ
                color+=1
                #双方向から塗っておく
                edge["{},{}".format(num,G[num][i])]=color
                edge["{},{}".format(G[num][i],num)]=color
                #子に伸びる色を保存
                p[G[num][i]]=color
                #キューに子を追加
                queue.append(G[num][i])
            else:
                #かぶっていない場合はそのまま塗る
                edge["{},{}".format(num,G[num][i])]=color
                edge["{},{}".format(G[num][i],num)]=color
                p[G[num][i]]=color
                queue.append(G[num][i])
            color+=1
            
#色の数は一つのノードから伸びる枝の数の最大値に等しい
print(max_n)
#枝の色を表示
for i in range(n-1):
    print(edge["{},{}".format(ab[i][0],ab[i][1])])

        




Measured memory_bytes: 67160
#include<bits/stdc++.h>
#define int long long 

using namespace std ;

int n , w ;
int wiegth[101],values[101];
int dp[100001];

int32_t main(){
        ios_base::sync_with_stdio(0); cin.tie(0);

        cin >> n >> w ; 
        for(int i=0;i<n;i++)
                cin >> wiegth[i] >> values[i];
        fill(dp,dp+w+1,0ll);
        for(int i=0;i<n;i++){
                for(int j=w-wiegth[i];j>=0;j--){
                        dp[j+wiegth[i]] = max(dp[j+wiegth[i]],dp[j]+values[i]);
                }
        }

        cout << dp[w] << endl ;

        return 0;
}

Measured memory_bytes: 1024
import java.io.*;
import java.util.*;
import java.util.Map.Entry;
import java.util.stream.Collectors;

@SuppressWarnings("unused")
public class Main {
	String fileName = "input.txt";
	final boolean isDebug = false;
	//final boolean isDebug = true;
	FastScanner in = new FastScanner(System.in);
	PrintWriter out = new PrintWriter(System.out);
	final int MOD = (int)1e9+7;
	final long INF = Long.MAX_VALUE / 2;
	//final int INF = Integer.MAX_VALUE / 2;
	
	//System.out.println();はつかわない！！
	void solve() throws Exception{
		int[] e = new int[3];
		for(int i = 0; i < 3; i++) e[i] = in.nextInt();
		Arrays.sort(e);
		out.println(e[0] + e[1]);
	}
	
	/* end solve */
	
	/* main */
	public static void main(String[] args) throws Exception {
		new Main().m();
	}
	
	void m() throws Exception {
		if(isDebug) in = new FastScanner(new FileInputStream(fileName));
		solve();
		out.flush();
	}
	/* end main */
}
/* end Main */

class FastScanner {
	Reader input;

	FastScanner() {this(System.in);}
	FastScanner(InputStream stream) {this.input = new BufferedReader(new InputStreamReader(stream));}
	
	int nextInt() {return (int) nextLong();}

	long nextLong() {
		try {
			int sign = 1;
			int b = input.read();
			while ((b < '0' || '9' < b) && b != '-' && b != '+') {
				b = input.read();
			}
			if (b == '-') {
				sign = -1;
				b = input.read();
			} else if (b == '+') {
				b = input.read();
			}
			long ret = b - '0';
			while (true) {
				b = input.read();
				if (b < '0' || '9' < b) return ret * sign;
				ret *= 10;
				ret += b - '0';
			}
		} catch (IOException e) {
			e.printStackTrace();
			return -1;
		}
	}

	double nextDouble() {
		try {
			double sign = 1;
			int b = input.read();
			while ((b < '0' || '9' < b) && b != '-' && b != '+') {
				b = input.read();
			}
			if (b == '-') {
				sign = -1;
				b = input.read();
			} else if (b == '+') {
				b = input.read();
			}
			double ret = b - '0';
			while (true) {
				b = input.read();
				if (b < '0' || '9' < b) break;
				ret *= 10;
				ret += b - '0';
			}
			if (b != '.') return sign * ret;
			double div = 1;
			b = input.read();
			while ('0' <= b && b <= '9') {
				ret *= 10;
				ret += b - '0';
				div *= 10;
				b = input.read();
			}
			return sign * ret / div;
		} catch (IOException e) {
			e.printStackTrace();
			return Double.NaN;
		}
	}

	char nextChar() {
		try {
			int b = input.read();
			while (Character.isWhitespace(b)) {
				b = input.read();
			}
			return (char) b;
		} catch (IOException e) {
			e.printStackTrace();
			return 0;
		}
	}

	String nextStr() {
		try {
			StringBuilder sb = new StringBuilder();
			int b = input.read();
			while (Character.isWhitespace(b)) {
				b = input.read();
			}
			while (b != -1 && !Character.isWhitespace(b)) {
				sb.append((char) b);
				b = input.read();
			}
			return sb.toString();
		} catch (IOException e) {
			e.printStackTrace();
			return "";
		}
	}
}

Measured memory_bytes: 21076
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> ii;
typedef vector <int> vi;
typedef vector <vi> vvi;
typedef vector <ii> vii;
typedef vector <vii> vvii;
#define endl '\n'
#define PB push_back
#define MP make_pair
#define OO (1000000000)         // ToDo
#define EPS (1e-9)              // ToDo
#define MOD (1000000007)        // ToDo
#define all(v) ((v).begin()),((v).end())
#define DEBUG(x) cout<< #x <<" = "<<"\""<< (x) <<"\""<<endl
#define FASTIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
void read_file(bool outToFile = true){
#ifdef LOCAL_TEST
    freopen("in.in", "rt", stdin);
    if(outToFile)
    freopen("out.out", "wt", stdout);
#endif
}
//
int n, K;
vvi G;
#define nMax 2000+9
int SP[nMax], SP1[nMax];
//
void DFS(int u, int p, int dep){
    SP[u] = dep;
    for(int i=0,sz=G[u].size(); i<sz; i++)
    {
        int v = G[u][i];
        if(v == p) continue;
        DFS(v, u, dep+1);
    }
}
//
int get_ans(int cen){
    
    DFS(cen, -1, 0);
    
    int ret = 0;
    for(int i=0; i<n; i++)
    {
        if(SP[i] > K/2)
            ret++;
    }
    
    return ret;
}
int get_ans(int cen, int cen1){
    
    DFS(cen1, -1, 0);
    for(int i=0; i<n; i++)
        SP1[i] = SP[i];
    DFS(cen, -1, 0);
    
    int ret = 0;
    for(int i=0; i<n; i++)
    {
        if(SP[i] < SP1[i])
        {
            if(SP[i] > (K-1)/2)
            {
                ret ++;
            }
            
        }
        else
        {
            assert(SP[i] > SP1[i]);
            if(SP1[i] > (K-1)/2)
            {
                ret ++;
            }
        }
    }
    
    return ret;
}
//
int main()
{
    read_file();
    while(scanf("%d%d", &n, &K)!=EOF)
    {
        G.assign(n, vi());
        for(int i=0; i<n-1; i++)
        {
            int u, v;
            scanf("%d%d", &u, &v);
            u--, v--;
            G[u].PB(v);
            G[v].PB(u);
        }
        
        
        int ans = OO;
        for(int cen=0; cen<n; cen++)
        {
            if(K%2 == 0)
                ans = min(ans, get_ans(cen));
            
            else
                for(int i=0,sz=G[cen].size(); i<sz; i++)
                {
                    ans = min(ans, get_ans(cen, G[cen][i]));
                }
        }
        
        printf("%d\n", ans);
    }
}


Measured memory_bytes: 512
#include <stdio.h>

int main(void) {
  int i, j, k, n, a[21][21], m;
  while( 1 ) {
    int x = 10, y = 10;
    for(i = 0; i < 21; ++i) for(j = 0; j < 21; ++j) a[i][j] = 0;
    scanf("%d", &n);
    if(!n) break;
    int c, b;
    for(i = 0; i < n; ++i) {
      scanf("%d%d", &c, &b);
      a[c][b] = 1;
    }
    scanf("%d", &m);
    char d;
    int l;
    for(i = 0; i < m; ++i) {
      scanf("%c", &d);
      scanf("%c", &d);
      scanf("%d", &l);
      if(d == 'N') {
        for(j = y; j <= y + l; ++j) a[x][j] = 0;
        y += l;
      } else if(d == 'S') {
        for(j = y; j >= y - l; --j) a[x][j] = 0;
        y -= l;
      } else if(d == 'W') {
        for(j = x; j >= x - l; --j) a[j][y] = 0;
        x -= l;
      } else {
        for(j = x; j <= x + l; ++j) a[j][y] = 0;
        x += l;
      }
    }
    int ans = 0;
    for(i = 0; i < 21; ++i) for(j = 0; j < 21; ++j) ans += a[i][j];
    if(ans) printf("No\n");
    else printf("Yes\n");
  }
  return 0;
}


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

int main(){
    int n,d;
    cin>>n>>d;
    int za[n][d];
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < d; ++j) {
            cin>>za[i][j];
        }
    }
    int ans=0;
    for (int k = 0; k < n-1; ++k) {
        for (int i = k+1; i <n ; ++i) {
            int sum=0;
            for (int j = 0; j < d; ++j) {
                sum+=(za[k][j]-za[i][j])*(za[k][j]-za[i][j]);
            }
            if(sqrt(sum)==floor(sqrt(sum)))ans++;
        }
    }
    cout<<ans;
    return 0;
}

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


int main(){
    double N,K,ans;
    cin >> N >> K;
    ans = 0;
    for(double i = 1;i < N+1;i++){
        double P = 1 / N;
        for(double j = 0;j < 1000;j++){
            if(pow(2,j) * i >= K){
                P = P * pow(0.5,j);
                break;
            }
        }
        ans += P;
    }
    cout << fixed << setprecision(16);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cmath>
#include <climits>

#include <sstream>
#include <iostream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
#include <functional>
#include <algorithm>

using namespace std;

#define fast_cin() ios_base::sync_with_stdio(false)

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

int main()
{
	ll K;
	cin >> K;

	int N = 50;
	ll base = (K / N) + N - 1;

	vector<ll> a(N);
	for (int i = 0; i < N; ++i) {
		if (i < K % N) {
			a[i] = base + 1;
		} else {
			a[i] = base - (K % N);
		}
	}

	cout << N << endl;
	for (auto &x : a) {
		cout << x << ' ';
	}
	cout << endl;
}

Measured memory_bytes: 256
// Problem : 
// 			B - Cut and Count
// 			Editorial
// 		
// Contest : AtCoder - AtCoder Beginner Contest 098
// URL : https://atcoder.jp/contests/abc098/tasks/abc098_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define fo(i,n)         for(int i=0;i<n;i++)
#define Fo(i,k,n)       for(int i=k;i<n;i++) 
#define endl            "\n"
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define vec(x)          vector<x>
#define matrix(x)       vector<vector<x>>
#define sz(x)             (int)x.size()
#define mem(a,b)        memset(a, b, sizeof a)
#define vii             vector<pair<int,int>>
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define gcd(a,b)        __gcd(a,b)
#define lcm(a,b)        (a*(b/gcd(a,b)))
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define MOD             998244353
#define deb(x)          cerr <<#x<<" = "<<x<<"\n"
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(v)          v.begin(),v.end()
#define rep(i,a,b)      for (int i = a; i<b; ++i)
#define len(s)          s.length()
#define watch(x)         cout << #x << " = " << x << endl
#define trace(x)         cerr << #x << " = " << x << endl
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
 
int power(int a,int b,int m=mod)
{int ans=1;while(b>0){if(b&1)ans=(ans*a)%m;a=(a*a)%m;b>>=1;}
return ans;}

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

const int N = 1e5+1;
const double pi = acos(-1);

void solve(){
    
    int n; cin>>n;
	string s; cin>>s;
	int mx = -inf;
	for(int i = 1;i<n;i++){
		int cnt = 0;
		for(char x = 'a';x<='z';x++){
			bool left = false, right = false;
			for(int j = 0;j<i;j++) if(s[j]==x) left = true;
			for(int j = i;j<n;j++) if(s[j]==x) right = true;
			if(left and right) cnt++;
		}
		mx = max(mx,cnt);
	}
	cout<<mx;
}

 
int32_t main()
{
    angshuGod();

    int t;

    t = 1;
    //cin>>t;

    while(t--){
        solve();
    }
    
    return 0;
}

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

int a, b, c;

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

int main(void){
  cin >> a >> b >> c;
  if(c%gcd(a, b) == 0) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


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

const ll MOD = 1e9 + 7;

ll factorial_m(ll n) {
  if (n == 1) return 1;
  return n * factorial_m(n - 1) % MOD;
}

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

  if (abs(n - m) > 1) {
    cout << 0 << endl;
    return 0;
  }

  ll dog = factorial_m(n);
  ll mon = factorial_m(m);
  ll ans = dog * mon % MOD;
  if (n == m) {
    ans = ans * 2 % MOD;
  }

  cout << ans << endl;
}


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

rooms = {}

for i in range(1, 5):
    rooms[i] = {}
    for j in range(1, 4):
        rooms[i][j] = {}
        for k in range(1, 11):
            rooms[i][j][k] = 0

for i in range(n):
    b, f, r, v = map(int, input().split())
    rooms[b][f][r] += v
    
for i in range(1, 5):
    for j in range(1, 4):
        for k in range(1, 11):
            #print('', end=' ')
            print(f' {rooms[i][j][k]}', end='')
        print()

    if i < 4:
        print('####################')



Measured memory_bytes: 5632
N, M, Q = map(int, input().split())
lst = []
cnt = [0]*N
ans = [0]*Q
for i in range(M):
    a, b = map(int, input().split())
    lst.append([b, a, 't'])
for i in range(Q):
    a, b = map(int, input().split())
    lst.append([b, a+500, i])
lst.sort()
for i in lst:
    if i[2] == 't':
        cnt[i[1]-1] += 1
    else:
        ans[i[2]] = sum(cnt[i[1]-501:i[0]])
for j in ans:
    print(j)

Measured memory_bytes: 54428
#include<bits/stdc++.h>
#define LL long long int
using namespace std;
int main(void)
{
	int i,j,n,rank[8]={0},cnt=0,sum=0,x,f=0;
	cin>>n;
	int a[n];
	for(i=0;i<n;i++) cin>>a[i];
	for(i=0;i<n;i++) if(a[i]>=3200) cnt++;
	for(i=0;i<n;i++) {
		if(a[i]<=399) rank[0]=1;
		else if(a[i]<=799) rank[1]=1;
		else if(a[i]<=1199) rank[2]=1;
		else if(a[i]<=1599) rank[3]=1;
		else if(a[i]<=1999) rank[4]=1;
		else if(a[i]<=2399) rank[5]=1;
		else if(a[i]<=2799) rank[6]=1;
		else if(a[i]<=3199) rank[7]=1;
	}
	for(i=0;i<8;i++) sum+=rank[i];
	if(sum==0) {
		sum=1;
		cout<<sum<<" "<<cnt<<endl;
	}
	else cout<<sum<<" "<<sum+cnt<<endl;
}
	

Measured memory_bytes: 256
package main

import (
	"fmt"
	"bufio"
	"os"
	"strconv"
	// "strings"
	// "sort"
)

var stdin = initStdin()
 
func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func scanInt() int {
	stdin.Scan()
	i, _ := strconv.Atoi(stdin.Text())
	return i
}

func scanStr() string {
	stdin.Scan()
	return stdin.Text()
}

type ia []int

func (ia ia)Len() int {
	return len(ia)
}
func (ia ia)Swap(i, j int) {
	ia[i], ia[j] = ia[j], ia[i]
}
func (ia ia)Less(i, j int) bool {
	return ia[i] < ia[j]
}

func per(n int, k int) int {
	v := 1
	if 0 < k && k <= n {
			for i := 0; i < k; i++ {
					v *= (n - i)
			}
	} else if k > n {
			v = 0
	}
	return v
}

func fac(n int) int {
	return per(n, n - 1)
}

func com(n int, k int) int {
	return per(n, k) / fac(k)
}

func hom(n int, k int) int {
	return com(n + k - 1, k)
}

func main() {
	n := scanInt()
	a := scanInt()
	b := scanInt()
	ans := 0
	if n*a < b {
		ans = n*a
	} else {
		ans = b
	}
	fmt.Println(ans)
}

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

int main() {
    string s; cin >> s;
    int ans = 0;
    for (int i=0; i<s.size(); i++) {
        if (i%2 == 0 && s[i] == '0') ans++;
        if (i%2 == 1 && s[i] == '1') ans++;
    }
    cout << (ans > s.size()/2 ? s.size()-ans : ans) << endl;
}

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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder(sc.nextLine());
		sc.close();
		
		int B_position = 1;
		while (B_position != -1) {
			B_position = sb.indexOf("B");
			if (B_position == 0) {
				sb.delete(B_position, B_position + 1);
			} else if ( B_position == -1) {
				continue;
			} else {
				sb.delete(B_position -1, B_position + 1);
			}
		}
		
		System.out.println(sb);
	}
}

Measured memory_bytes: 9680
#include<bits/stdc++.h>
#define itn int
#define lli unsigned long long int
#define REP(a,n) for(int i=a;i < n;i++)
#define REP2(a,n) for(int j = a;j<n;j++)
#define scanf scanf_s
using namespace std;
int main(void) {
	lli H;
	lli count = 0;
	lli bi = 1;
	cin >> H;
	for (int i = 0;;i++) {
		if (H == 0)break;
		H = H >> 1;
		count += bi;
		bi <<= 1;
	}
	cout << count << endl;
	return 0;
}

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

using namespace std;

const ll mod=1000000007;
const ll inf=1e18;

int main(){

  //以下、O(n)の解法
  ll n;
  cin >> n;
  ll d[n];
  for(ll i=0;i<n;i++)cin >> d[i];

  ll s=0;
  for(ll i=0;i<n;i++)s+=d[i];
  s*=s;
  for(ll i=0;i<n;i++)s-=d[i]*d[i];
  s/=2;
  cout << s << endl;


}

Measured memory_bytes: 3616
import os
import sys
from io import BytesIO, IOBase



def main():
    n, m = getints()
    g = [0] * n
    for i in range(n):
        g[i] = i
    def find(u):
        if u == g[u]:
            return u
        else:
            g[u] = find(g[u])
            return g[u]
    def merge(u, v):
        g[find(u)] = find(v)
    for _ in range(m):
        a, b = getints()
        merge(a - 1, b - 1)
    cnt = 0
    for i in range(n):
        if i == g[i]:
            cnt += 1
    print(cnt - 1)


# region fastio


BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)


def input(): return sys.stdin.readline().rstrip("\r\n")
def getint(): return int(input())
def getints(): return list(map(int, input().split()))
def getint1(): return list(map(lambda x: int(x) - 1, input().split()))


# endregion


if __name__ == "__main__":
    main()

Measured memory_bytes: 76768
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, bn;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) cin >> a.at(i);
  bn = 1;
  for (int i = 1; i <= n; i++) {
    bn = a.at(bn);
    if (bn == 2) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}
    


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

int main () {
  int n,x;
  cin >>n>>x;
  vector<int>m(n);
  int calc =0;
  int cnt =0;
  for (int i=0;i<n;i++){
    cin >>m[i];
  }
  sort(m.begin(),m.end());
  for (int i=0;i<n;i++){
    calc +=m[i];
  }
  x =x-calc;
  cnt = x/m[0];
  cout <<n+cnt<<endl;
}


Measured memory_bytes: 256
//author: clorf
//Think twice,Code once.
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<ctime>
#define INF 1e9
using namespace std;
const int maxn=200010;
const double Pi=acos(-1.0);
template<class T>void read(T &x)
{
	x=0;int f=0;char ch=getchar();
	while(ch<'0'||ch>'9') {f|=(ch=='-');ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	x=f?-x:x;
	return;
}
int n,k,num,sum;
double l,r,mid,ans=1000000000.0,a[maxn];
bool check(double mid)
{
	int sum=0;
	for(int i=1;i<=n;i++)
	{
		double e=(double)a[i]/mid;
		int t1=floor(e);
		int t2=a[i]/t1;
		if(fabs(t2-mid)<1e-6)
			t1--;
		sum+=t1;
	}
	if(sum<=k)
		return true;
	return false;
}
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
		scanf("%lf",&a[i]);
	l=0.0,r=1000000000.0;
	while(r-l>1e-6)
	{
		mid=(l+r)/2.0;
		if(check(mid))
		{
			ans=mid;
			r=mid;
		}
		else
			l=mid;
	}
	printf("%.0lf",ceil(ans));
	return 0;
}

Measured memory_bytes: 3264
/*
	AARUSH JUNEJA
	@vivace
	IIT(ISM),Dhanbad
*/

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

typedef double lf;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef set<ll> sll;
typedef vector<ll> vll;
typedef map<string,ll> msl;
typedef pair<int,int> pii;
typedef pair<ll,ll> ii;
typedef vector<ii > vpll;
typedef map<ll,ll> mll;
typedef vector<vll > vvll;
typedef list<ll> lll;
typedef vector<lll > vlll;
typedef pair<ll,ii> iii;

#define rtn return 
#define gc getchar
#define pb push_back
#define ff first
#define ss second
#define mp(x,y) make_pair(x,y)
#define all(a) a.begin(),a.end()
#define allr(a) a.rbegin(),a.rend()
#define lp(i,b) for(ll i = ll(0); i<ll(b) ; i++) 
#define lpit(it,a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define mid(s,e) (s+(e-s)/2)
#define min3(a,b,c)	min(a,min(b,c))
#define max3(a,b,c)	max(a,max(b,c))
#define min4(a,b,c,d) min(min(a,b),min(c,d))
#define max4(a,b,c,d) max(max(a,b),max(c,d))

ll ip(){
	ll x = 0; bool isNeg = false; char c;
	c = gc();
	if(c == '-')	isNeg = true , c = gc();
	for( ; c >= '0'  && c <= '9' ; c = gc()); x = (x << 1) + (x << 3) + c - '0';
	if(isNeg)	x *= -1;	return x;
}
//////////////////////////////////////////// CONTAINERS FOR FUNCTIONS MENTIONED IN TEMPLATE ///////////////////////////////////
#define MAX 100005
//bool isPrime[MAX];
//int spf[MAX];
//////////////////////////////////////////// FUNCTIONS THAT NEED COMMENTED OUT CONTAINERS ////////////////////////////////////


//void prime_sieve(){ for(ll i=2 ; i*i<=MAX ; i++){	if(!isPrime[i]){ for(ll j=i*i ; j<=MAX ; j+=i)	isPrime[j] = 1;} } 	}
//void spf_sieve(){	for(ll i=2 ; i<MAX ; i+=2)	spf[i] = 2;
//	for(ll i=3 ; i<MAX ; i+=2){	if(!isPrime[i]){ spf[i] = i; for(ll j=i ; (j*i)<MAX ; j+=2){ if(!isPrime[i*j])	isPrime[i*j] = true , spf[i*j] = i; } } }
//}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
inline ll ncr(ll n,ll r){ ll ans = 1 ; if(r > n-r) r = n-r; lp(i,r+1){ans*=(n-i) ; ans/=(i+1); } rtn ans; }
inline ll gcd(ll a,ll b){if(!a) rtn b; rtn gcd(b%a,a); }
inline ll fme(ll x,ll n,ll mod){ll ans=1;x%=mod;while(n>0){if(n&1){ ans*=x;ans%=mod;} x*=x;x%=mod;n>>=1;}rtn ans%mod;}
inline bool isPalin(string &s){	int len = s.size()-1;lp(i,(len/2)+2){if(!(s[i]==s[len-i]))	rtn false;} rtn true;}
inline ll lcm(ll a,ll b){rtn (a*b)/gcd(a,b); }
inline ll fmm(ll a,ll b,ll m) {ll r=0;a%=m;b%=m;while(b>0){if(b&1){r+=a;r%=m;}a+=a;a%=m;b>>=1;}rtn r%m;}
inline ll sfme(ll a,ll b,ll m) {ll r=1;a%=m;while(b>0){if(b&1)r=fmm(r,a,m);a=fmm(a,a,m);b>>=1;}rtn r%m;}
inline int in(){ int NR=0; register char c=gc(); while( c < 48 || c > 57 ){c=gc();} 
	while(c>47 && c< 58){	NR = (NR << 3) + (NR << 1) + (c - 48); c=gc();} return NR;
}

ll dx[] = {0,0,1,-1}, dy[] = {1,-1,0,0};
//--------------------------------TEMPLATE ENDS HERE--------------------------------------------------//

int main(){
	ll n;
	cin >> n;
	ll ans = 0;
	for(ll a = 1; a <= n; a++){
		for(ll b = 1; b <= n; b++){
			if(a*b >= n) break;
			else ans ++;
		}
	}
	cout << ans << "\n";

	return 0;
}














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

int main() {
	int n;
	cin >> n;
	string str;
	cin >> str;
	int ans = 0;
	for (int i = 0; i < n-1; i++) {
		if (str[i] != str[i + 1]) {
			ans++;
			i++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 3336
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define rep(i, a, n) for (int i=(a); i<(n); i++)
#define per(i, a, n) for (int i=(a); i>(n); i--)
typedef long long ll;
const int maxn = 2e5+5;
const int mod = 1e9+7;
using namespace std;

void solve() {
	string s; cin >> s;
	ll n = s.size();
	ll ans=0, tmp=0;
	rep(i,0,n) {
		if (s[i]=='R') tmp++;
		else ans=max(ans,tmp), tmp=0;
	}
	ans = max(ans, tmp);
	cout << ans << '\n';
}

int main(int argc, char * argv[]) 
{
	ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef DEBUG
	freopen("C:/Users/Fish_Brother/Desktop/in", "r", stdin);
	//freopen("C:/Users/Fish_Brother/Desktop/out", "w", stdout);
#endif

	//int t; cin >> t; while(t--)
	solve();

    return 0;
}

Measured memory_bytes: 3644
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{

    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        var d = new List<int>();
        for (int i = 0; i < n; i++)
        {
            d.Add(int.Parse(Console.ReadLine()));
        }

        Console.WriteLine(d.Distinct().Count());
    }

}

Measured memory_bytes: 13152
#include<cstdio>
#include<iostream>
using namespace std;
#define ll long long
ll ans;
int gcd(int a, int b)
{
	return b ? gcd(b, a%b) : a;
}
int main()
{
	int k;cin>>k;
	for(int i=1;i<=k;i++)
	for(int j=1;j<=k;j++)
	for(int l=1;l<=k;l++)
	{
		ans+=gcd(gcd(i,j),gcd(j,l));
	}
	cout<<ans;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
int main(void){
    int n, k;
    std::cin >> n >> k;
    std::vector<int> h(n);
    rep(i, n) std::cin >> h.at(i);
    sort(h.begin(), h.end());
    int64_t ans = 0;
    rep(i, n - k){
        ans = ans + h.at(i);
    }
    std::cout << ans << std::endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

signed main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a%2==0 || b%2==0 || c%2==0) {
        cout<<0<<endl;
    }
    else{
        cout<<min({a*b,b*c,c*a})<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
while(True):
    X,Y = map(int, input().split())
    if X==0 and Y==0:
        break
    ar = [list(map(int, input().split())) for _ in range(Y)]
    ar.append([0]*X)
    br = [[0]*X for _ in range(Y+1)]
    for j in range(X):
        if ar[-2][j] != 1:
            br[-2][j] = 1
        br[-1][j] = 1
    for i in range(Y-2,-1,-1):
        for j in range(X):
            if j-1 >= 0 and ar[i][j] != 2 and ar[i+1][j-1] == 0: br[i][j] += br[i+1][j-1]
            if j+1 < X and ar[i][j] != 2 and ar[i+1][j+1] == 0: br[i][j] += br[i+1][j+1]
            if ar[i][j] != 2 and ar[i+1][j] != 1: br[i][j] += br[i+1][j]
            if ar[i][j] == 2 and ar[i+2][j] != 1: br[i][j] += br[i+2][j]
        for j in range(X):
            if ar[i][j] == 1: br[i][j] = 0
    print(sum(br[0]))



Measured memory_bytes: 5620
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<int,int>
#define F first
#define S second
#define mod 1000000007
#define INF 9000000000000000000
signed main(void){
    int l,r;cin>>l>>r;
    int ans=INF;
    if(r-l>=2019)ans=0;
    else{
        for(int i=l;i<=r-1;i++){
            for(int j=i+1;j<=r;j++){
                ans=min(ans,i*j%2019);
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=a;i<n;++i)
#define per(i,a,n) for(int i=n-1;i>=a;--i)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define sz(v) (int)v.size()
#define all(v) (v.begin(),v.end())
#define ll long long
const int N=605;
const int inf=2e9;
//char a[N][N];
char a[N][N];

inline int judge(int i,int j,int n){
    int n1=n+i,n2=n+j;
   // b.clear();
    for(int x=0;x<n;++x){
        for(int y=x+1;y<n;++y){
            char u=a[x+i][y+j];
            char v=a[y+i][x+j];
            if(u!=v) return 0;
           /* if(u>v) swap(u,v);
            b.pb(mp(u,v));*/
            //if(a[x+i][y+j]!=a[y+i][x+j]) return 0;
        }
    }
    //sort(b.begin(),b.end());
    //c.pb(b);
    return 1;
}
int main(){
    ios::sync_with_stdio(0);
    int n;
    cin>>n;
    rep(i,0,n) rep(j,0,n) cin>>a[i][j];
    //rep(i,0,n) rep(j,0,n) a[i][j]=i*n+j;
    for(int i=0;i<n-1;++i) for(int j=0;j<n;++j) a[i+n][j]=a[i][j];
    for(int j=0;j<n-1;++j) for(int i=0;i<2*n-1;++i) a[i][j+n]=a[i][j];
    int ans=0;
    for(int i=0;i<n;++i){
        for(int j=0;j<1;++j){
            if(judge(i,j,n)) ans+=n;
        }
    }
    cout<<ans<<endl;
    /*int cnt=0,sum=0;
    for(int i=0;i<n*n;++i){
        for(int j=0;j<n*n;++j) if(g[i][j]) ++cnt,sum+=g[i][j];//cout<<i<<' '<<j<<' '<<g[i][j]<<'\n';
       cout<<endl;
    }
    cout<<cnt<<' '<<sum<<endl;
    cout<<1.0*sum/cnt<<' '<<cnt/n<<endl;
    sort(c.begin(),c.end());
    for(int i=0;i<c.size();++i){
        for(int j=0;j<c[0].size();++j) cout<<c[i][j].first<<' '<<c[i][j].second<<endl;
        cout<<endl;
    }*/
    return 0;
}


Measured memory_bytes: 640