akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define repR(i, n) for(ll i = n; i >= 0; ++i)
#define FDS(i, n) for(ll i = 0; i < n; ++i)
#define FDSR(i, n) for(ll i = n; i >= 0; ++i)
#define FOR(i, m, n) for(ll i = m; i < n; ++i)
#define FORR(i, m, n) for(ll i = m;i >= n;--i)
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define itn ll
#define ednl endl
using namespace std;
typedef long long ll;template<typename Typell>Typell G_C_D(Typell a, Typell b){if (a < 0) a = -a;if (b < 0) b = -b;while (b != 0) {a %= b;if (a == 0) return b;b %= a;}return a;}template<typename Typell>
Typell G_C_D(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = G_C_D(a, list[i]);}return a;}template<typename Typell>Typell L_C_M(Typell a, Typell b) {if( a == 0 && b == 0)return 0;return a / G_C_D(a, b) * b;}
template<typename Typell>Typell L_C_M(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = L_C_M(a, list[i]);}return a;}

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	
	int N,Q;
	string S;
	cin>>N>>Q>>S;
	vector<int> l(Q);
	vector<int> r(Q);
	FDS(i,Q){
		cin>>l[i]>>r[i];
	}
	vector<int> ruiseki(N+1);
    FDS(i,N-1){
		if(S[i]=='A'&&S[i+1]=='C'){
			ruiseki[i+1]++;
		}
		ruiseki[i+2]=ruiseki[i+1];
	}	

	vector<int> ans(Q);
	FDS(i,Q){
		ans[i]=ruiseki[r[i]-1]-ruiseki[l[i]-1];
	}
	
	FDS(i,Q){
		cout<<ans[i]<<endl;
	}
}

Measured memory_bytes: 2640
/* Author : Aaryan Srivastava ^__^ */ 
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define pb push_back
#define popb pop_back
#define mt make_tuple 
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second 
#define ull unsigned long long  
#define pii pair<int, int>
#define piii pair<int,pii>
#define beg begin
#define rep(i,n) for(int (i) = 0 ; i < (n) ; i++)
#define repA(i,x,y) for(int i = (x) ; i <= (y) ; i++)
#define repD(i,x,y) for(int i = (x) ; i >= (y) ; i--)
#define all(c) (c).begin(),(c).end()
#define fill(a,val) memset(a,val,sizeof(a))
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define int ll
using ll = long long;
const int N = 3*1e5 +5 ;
const int mod = 1e9 + 7 ;
const int inf = 1e18 ;
const int SZ = 101 ;
const double eps = 1e-9 ;
using namespace __gnu_pbds;
using namespace std;
using ordered_set =  tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ;

#ifdef AaryanS
#define mycout cout
#define mycerr cerr 
#endif

#ifndef AaryanS
#define mycout if(false) cout
#define mycerr if(false) cerr
#endif

vector<vector<int>> cache(405,vector<int>(405,-1));
vector<int> a , pref;
int sum(int l, int r){
	return pref[r] - (l? pref[l-1] : 0);
}
int dp(int l, int r){
	if(r == l) return 0;
	int& ans = cache[l][r];
	if(ans != -1) return ans;
	ans = inf;
	for(int i = l ; i <= r-1; ++i)
		ans = min(ans, dp(l,i) + dp(i+1,r) + sum(l,r));
	return ans;
}
void solve()
{
	int n ;
	cin >> n;
	a.resize(n);
	pref.resize(n,0);
	for(auto &it : a) cin >> it;
	for(int i = 0 ; i < n ; ++i){
		pref[i] = a[i];
		if(i) pref[i] += pref[i-1]; 
	}
	cout << dp(0,n-1);
}   

     
int32_t main(int32_t argc, char *argv[])
{
    double t1 = clock() ;
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    int TC = 1, t = 0;
    //cin >> TC ;
    while(t++ < TC)
    {
        //cout << "Case #" << t << ": " ;
        solve();
        //cout << endl ;
    }
    mycerr << "Time : " << 1000 *(clock() - t1)/CLOCKS_PER_SEC << " ms\n" ;
    return 0;
}

Measured memory_bytes: 1536
const main = stdin => {
  const input = stdin.trim().split('\n')

  const [A, B] = input[0].split(' ').map(x => parseInt(x))
  console.log(Math.max(A + B, A - B, A * B))
}

// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))


Measured memory_bytes: 30752
#include <iostream>
#include <stdio.h>

using namespace std;
#define MAX 100000
#define SENTINEL 200000000

struct Card{ 
	char suit;
	int value;
};


struct Card L[MAX/2+2],R[MAX/2+2];

void merge(struct Card A[],int n,int left,int mid,int right){
	int n1=mid-left;//左側の配列を用意
	int n2 = right - mid;//右側の配列を用意
	for(int i = 0;i<n1;i++){
		L[i] = A[left + i];//左側の数列を入力
	}

	for(int i = 0;i<n2;i++){
		R[i] = A[mid+ i];//右側の数列を入力
	}

	L[n1].value = R[n2].value = SENTINEL;
	int i=0,j=0;

	for(int k = left;k < right;k++){//比較
		if(L[i].value<=R[j].value){
			A[k] = L[i++];
		}else{
			A[k] = R[j++];
		}
	}
}

void mergeSort(struct Card A[],int n,int left,int right){
	if(left+1<right){//左のほうが右より小さいなら
		int mid = (left+right)/2;//真ん中を計算
		mergeSort(A,n,left,mid);//右を真ん中とする
		mergeSort(A,n,mid,right);//真ん中を左とする
		merge(A,n,left,mid,right);//統合
	}
}

int partition(struct Card A[],int n,int p,int r){
	int i;
	struct Card x;
	x = A[r];//r以下、r以上で分けるための変数
	i = p-1;//先頭を作成
	for(int j = p;j<r;j++){
		if(A[j].value <= x.value){
			i++;
			swap(A[i],A[j]);//j番目が基準xより小さいか大きいかでわける
		}
	}
	swap(A[i+1],A[r]);//xを正しい位置に挿入
	return i+1;
}

void quickSort(struct Card A[],int n,int p,int r){
	int q;
	if(p<r){
		q = partition(A,n,p,r);
		quickSort(A,n,p,q-1);
		quickSort(A,n,q+1,r);
	}
}

int main(){
	int v,n;
	cin >> n;
	struct Card A[MAX],B[MAX];
	char S[10];
	int stable = 1;

	for(int i = 0;i < n;i++){
		cin >> S >> v;
		A[i].suit = B[i].suit = S[0];
		A[i].value = B[i].value = v;
	}

	mergeSort(A,n,0,n);
	quickSort(B,n,0,n - 1);

	for(int i = 0;i < n;i++){
		if(A[i].suit !=B[i].suit)stable = 0;
	}

	if(stable == 1)cout<<"Stable"<<endl;
	else cout<<"Not stable"<<endl;

	for(int i = 0;i < n;i++){
		cout << B[i].suit <<" "<< B[i].value << endl;
	}
	return 0;
}


Measured memory_bytes: 5404
def solve(N, H):
    max_h = 0
    ret = True
    for h in H:
        if max_h-h >= 2:
            ret = False
            break
        max_h = max(max_h, h)
    print('Yes' if ret else 'No')

N = int(input())
H = map(int, input().split())

solve(N,H)

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

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

using namespace std;
typedef long long ll;  typedef pair<int,ll> pii;
typedef vector<int> VI; typedef vector<ll> VL;
const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

ll f(ll H, ll W){
	ll ans = 1LL<<60;
	rep2(i, max(1LL, W/3 -10), min(W, W/3 + 10)){
		ll a = i * H, q = W  -i;
		rep2(j, max(1LL, H/2-10), min(H, H/2 + 10)){
			ll b= q * j, c= q *(H  -j);
			ll p = max({a,b,c}) - min({a,b,c});
			if(a<=0 && b<=0 && c<=0) continue;
			//dbg(i,j, q,a,b,c, p);
			ans = min(ans, p);
		}
	}
	return ans;
}



int main(){
	//cin.tie(0); ios_base::sync_with_stdio(false);
	ll H, W ;
	cin >>H >>W;
	
	if(H%3==0 || W%3==0){puts("0"); return 0;}
	
	ll ans = 1LL<<60;
	if(W>=3) ans = min(ans, H);
	if(H>=3) ans = min(ans, W);
	
	ans = min(ans , f(H, W));
	ans = min(ans , f(W, H));
	
	cout << ans <<"\n";
	
	return 0;
}

Measured memory_bytes: 256
n,q = map(int,input().split())
sco = [0]*(n+1)
edge = [[i] for i in range(n+1)]

def dfs(i,s):
    E = edge[i]
    if(len(E)==1):
        return 0
    for e in E:
        if(e==i):continue
        sco[e]+=s
        dfs(e,s)

for i in range(n-1):
    a,b = map(int,input().split())
    edge[b].append(a)
#print(edge)
for i in range(q):
    p,x=map(int,input().split())
    sco[p]+=x
for i in range(1,n+1):
    E=edge[i]
    for e in E:
        if(e==i):continue
        sco[i]+=sco[e]
print(*sco[1:])

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


#define mod                1000000000000000007
#define pi                 3.1415926535897932384626433832795
#define ll                 long long
#define pb                 push_back
#define pii                pair < int , int >
#define vecsort(v)         sort(v.begin(),v.end())
#define lcm(x,y)           (x/__gcd(x,y))*y
#define forn(i,n)          for(i = 0 ; i < n ; i++)
#define deb(x)             cout << #x << " " << x << endl;
#define vecsum(v)          accumulate(v.begin(), v.end(), 0)
#define T(t)               cout << "Case " << t <<": ";
#define fast_cin           ios_base::sync_with_stdio(false);cin.tie(NULL)

int main() {


    map < string , int > mp;
    mp["AC"] = 0 ;
    mp["WA"] = 0 ;
    mp["TLE"] = 0 ;
    mp["RE"] = 0 ;


    vector<string>v(100005);

    v[0] = "AC";
    v[1] ="WA";
    v[2] = "TLE";
    v[3] = "RE";



   int n ;
   cin >> n ;
   for( int i = 0 ; i < n ; i++ ){
       string s;
       cin >> s;
       mp[s]++;
   }

   for( int i = 0 ;  i<  4; i++ ){
       cout << v[i] << " x " << mp[v[i]] << endl;
   }



    return 0;
}

Measured memory_bytes: 6228
N,C,K=map(int,input().split())
T=[]
for i in range(N):
    t=int(input())
    T.append(t)
T.sort()
ans=0
tmp=0
count=0
for i in range(N):
    #print(count)
    if i==0:
        dead=T[i]+K
        count=1
        continue
    count+=1
    if T[i]>dead or count>C:
        ans+=1
        dead=T[i]+K
        count=1
        continue
ans+=1
print(ans)

Measured memory_bytes: 50520
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int ans = 0;
        int a = sc.nextInt();
        int b = sc.nextInt();
        for (int i=a;i<=b;i++){
            boolean bool = true;
            String s = Integer.toString(i);
            for (int j=0;j<s.length();j++){
                if (s.charAt(j)!=s.charAt(s.length()-j-1))bool=false;
            }
            if (bool)ans++;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 41480
import itertools

n = int(input())
p = [int(x) for x in input().split()]
q = [int(x) for x in input().split()]

a,b = 0,0
for i,x in enumerate(itertools.permutations(range(1,n+1))):

    if list(x) == p:
        a = i
    if list(x) == q:
        b = i
        
print(abs(a-b))

Measured memory_bytes: 3060
loop do
  n,m = gets.split.map(&:to_i)
  break if n==0
  nums = Hash.new
  n.times do
    num,money = gets.split.map(&:chomp)
    num.delete!('*')
    nums[/#{num}$/]=money.to_i
  end
  sum  =0
  m.times do
    buy = gets.chomp
    nums.each do |k,v|
      if buy=~k
        sum +=v
      end
    end
  end
  p sum
end

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

#define MOD 1000000007
#define INF (0x7fffffff)
#define NINF (1<<31)
#define INFL (0x7fffffffffffffff)
#define NINFL (1LL<<63)
#define MAX 100000000

#define pe(str) return cout<<(str)<<endl,0
#define px(str) cout<<(str)<<endl,exit(0)
#define accu(ac,v) cout<<setprecision(ac)<<v<<endl
#define bpc(a) __builtin_popcount(a)
#define pr(str) cout<<(str)<<endl
#define prpr(str) cout<<str<<endl
#define db(str) cerr<<"debug:"<<(str)<<endl
#define dbdb(str) cerr<<"debugs:"<<str<<endl
#define re(i,n) for(int i=0;i<(n);i++)
#define rre(i,n) for(int i=(n);i>=0;i--)
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b);i>=(a);i--)
#define bw(a,b,c) (((a)<=(b))&&((b)<=(c)))
#define hello cout<<"hello"<<endl
#define spre(a) setprecision(a)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define IF(C,T,F) ((C)?(T):(F))
#define max3(a,b,c) max((a),max((b),(c)))
#define min3(a,b,c) min((a),min((b),(c)))
#define max4(a,b,c,d) max((a),max((b),max((c),(d))))
#define min4(a,b,c,d) min((a),min((b),min((c),(d))))
#define enl cout<<endl
#define declare(t,n) t n;cin>>n
#define EPS 1e-6
#define EPSIN(a,b) ((b)-EPS<=(a)&&(a)<=(b)+EPS)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef complex<int> point;

template<class InputIterator>
void dump(InputIterator first,InputIterator last,char delim=' '){
	for(InputIterator it=first;it!=last;it++){
		if(it!=first)cout<<delim;
		cout<<*it;
	}
}

ull p(ull x,ull y){
	if(y==0) return 1;
	ull A=p(x,y/2)%MOD;
	// return (y&1?((A*A)%MOD*x)%MOD: (A*A)%MOD);
	return (y&1?((A*A)*x):(A*A));
}

template<class T>
void swp(T &a,T &b){
	T t=a; a=b; b=t;
}

template<class T>
int h(T first,string t){
	T it=first;
	int c=0;
	for(int i=0;i<t.size();i++){
		if(*it!=t[i]) c++;
		it++;
	}
	return c;
}

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

int main(void){
	string s,t;
	while(cin>>s,s!="."){
		cin>>t;
		if(s==t){cout<<"IDENTICAL"<<endl;continue;}
		std::vector<string> v1[2];
		std::vector<string> v2[2];
		bool b,flag=false;
		string temp;
		//*** v1 ***
		b=false;
		temp="";
		re(i,s.size()){
			if(s[i]=='\"'){
				b=!b;
				v1[b].push_back(temp);
				temp="";
			}
			else temp+=s[i];
		}
		if(s[s.size()-1]!='\"')v1[!b].push_back(temp);
		//*** v2 ***
		int aa=0;
		b=false;
		temp="";
		re(i,t.size()){
			if(t[i]=='\"'){
				b=!b;
				v2[b].push_back(temp);
				temp="";
			}
			else temp+=t[i];
		}
		if(t[t.size()-1]!='\"')v2[!b].push_back(temp);

		if(v1[0].size()!=v2[0].size())goto DEF;
		if(v1[1].size()!=v2[1].size())goto DEF;
		re(i,v1[1].size()){ // program
			if(v1[1][i]!=v2[1][i]) goto DEF;
		}
		re(i,v1[0].size()){ // strings
			if(v1[0][i]!=v2[0][i]) aa++;
			if(aa==2)goto DEF;
		}
		if(flag)goto IDE;
		else goto CLOSE;
		
DEF:
		cout<<"DIFFERENT"<<endl;
		continue;
IDE:
		cout<<"IDENTICAL"<<endl;
		continue;
CLOSE:
		cout<<"CLOSE"<<endl;
		continue;
	}
	return 0;
}



Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

typedef long long LL;
typedef pair <int, int> pii;

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

const int MAXN = 200005;

int n, x, y, ans, dep[MAXN], par[MAXN];
vector <int> adj[MAXN], adv[MAXN];
bool f[MAXN];

inline void Dfs(int x)
{
	for (auto y : adv[x])
		if (y ^ par[x])
			par[y] = x, dep[y] = dep[x] + 1, Dfs(y);
}

inline int Dis(int x, int y)
{
	int ret = 0;
	if (dep[x] < dep[y])
		swap(x, y);
	while (ret < 3 && dep[x] > dep[y])
		ret ++, x = par[x];
	while (ret < 3 && (x ^ y))
		ret += 2, x = par[x], y = par[y];
	return min(ret, 3);
}

inline void Dfs(int x, int p)
{
	for (auto y : adj[x])
		if (y ^ p)
			f[x] |=	Dis(x, y) == 3, f[y] |= Dis(x, y) == 3, Dfs(y, x);
}

inline void Dfs(int x, int p, int t)
{
	if (dep[x] <= t)
		return ;
	ans = max(ans, dep[x]);
	if (f[x])
		puts("-1"), exit(0);
	for (auto y : adj[x])
		if (y ^ p)
			Dfs(y, x, t + 1);
}

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	n = Read(), x = Read(), y = Read();
	for (int i = 1, u, v; i < n; i ++)
		u = Read(), v = Read(), adj[u].pb(v), adj[v].pb(u);
	for (int i = 1, u, v; i < n; i ++)
		u = Read(), v = Read(), adv[u].pb(v), adv[v].pb(u);
	Dfs(y);
	Dfs(x, 0);
	Dfs(x, 0, 0);
	return printf("%d\n", ans << 1), 0;
}


Measured memory_bytes: 29440
import java.util.*;

public class Main {


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

        int numBC = 0;
        boolean bc = false;
        long ans = 0;
        for(int i = line.length()-1;i >= 0;i--){
            if(bc) {
                if (i != 0 && line.charAt(i - 1) == 'B' && line.charAt(i) == 'C') {
                    i--;
                    numBC++;
                } else if(line.charAt(i) == 'A'){
                    ans += numBC;
                } else {
                    numBC = 0;
                    bc = false;
                }
            } else {
                if (i != 0 &&  line.charAt(i - 1) == 'B' && line.charAt(i) == 'C') {
                    bc = true;
                    i--;
                    numBC++;
                }
            }
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 26760
#include<iostream>
using namespace std;
void counts(int h,int w);
int check[121][121]={0};
char s[121][121];
int dh[4]={-1,0,1,0};
int dw[4]={0,1,0,-1};
int ww,hh;
int counta=0;
char now;
main(){
  int sw,sh,countx;
  while(1){
    cin>>hh>>ww;
    if(ww==0&&hh==0) break;
    for(int i=1;i<=hh;i++){
      for(int j=1;j<=ww;j++){
	cin>>s[i][j];
      }
    }
    for(int i=1;i<=hh;i++){
      for(int j=1;j<=ww;j++){
	if(check[i][j]==0){
	  now=s[i][j];
	  counts(i,j);
	  counta++;
	  //cout<<endl;
	}
      }
    }
    cout<<counta<<endl;
    for(int i=0;i<=120;i++){
      for(int j=0;j<=120;j++){
	check[i][j]=0;
      }
    }
    counta=0;
  }
}
void counts(int h,int w){
  check[h][w]=1;
  //cout<<"check="<<h<<" "<<w<<"| ";
  for(int i=0;i<4;i++){
    int nh=h+dh[i];
    int nw=w+dw[i];
    if(nh>=1&&nh<=hh&&nw>=1&&nw<=ww&&s[nh][nw]==now&&check[nh][nw]==0){
      counts(nh,nw);
    }
  }
  return;
}

Measured memory_bytes: 1540
// #![allow(unused_mut)]
#![allow(dead_code)]
#![allow(unused_macros)]

use proconio::{input};

// The debug version
#[cfg(feature = "debug")]
macro_rules! debug {
       ($( $args:expr ),*) => { println!( $( $args ),* ); }
}
// Non-debug version
#[cfg(not(feature = "debug"))]
macro_rules! debug {
       ($( $args:expr ),*) => {}
}


use num_traits::int::PrimInt;
// #[overflow_checks(off)]
// i32 -> i32, i64 -> i64
fn accum<T: PrimInt>(a: &Vec<T>) -> Vec<T> {
    let n: usize = a.len();
    let mut ac: Vec<T> = Vec::with_capacity(n + 1);
    ac.push(a[0] - a[0]);  // ac.push(0) がしたいんですけど
    for i in 0..n {
        ac.push(ac[i] + a[i]);
    }
    ac
}
/// i32 -> i64
fn accum64(a: &Vec<i32>) -> Vec<i64> {
    let n: usize = a.len();
    let mut ac: Vec<i64> = Vec::with_capacity(n + 1);
    ac.push(0);
    for i in 0..n {
        ac.push(ac[i] + i64::from(a[i]));
    }
    ac
}

fn rle<T: PrimInt>(a: &Vec<T>) -> Vec<(T,u32)> {
    let mut res: Vec<(T,u32)> = Vec::with_capacity(0);

    let mut last : T = T::zero();
    let mut cnt : u32 = 0;

    for c in a.iter() {
        if *c == last {
            cnt += 1;
        } else {
            if cnt > 0 {
                res.push((last, cnt));
            }
            last = *c;
            cnt = 1;
        }
    };
    if cnt > 0 {
        res.push((last, cnt));
    }
    res
}
fn rle_str(a: &str) -> Vec<(char,u32)> {
    let mut res: Vec<(char,u32)> = Vec::with_capacity(0);

    let mut last : char = '\0';
    let mut cnt : u32 = 0;

    for c in a.chars() {
        if c == last {
            cnt += 1;
        } else {
            if cnt > 0 {
                res.push((last, cnt));
            }
            last = c;
            cnt = 1;
        }
    };
    if cnt > 0 {
        res.push((last, cnt));
    }
    res
}

fn yesno(b: bool) -> &'static str {
    if b {
        return "Yes";
    } else {
        return "No";
    }
}

fn solve(s: String) -> u32 {
    let r = rle_str(&s);
    let mut res: u32 = 0;
    for (ch, cnt) in r {
        if ch == 'R' {
            res = core::cmp::max(res, cnt);
        }
    };
    res
}

fn main() {
    input! {
        s: String,
    }

    let ans: u32 = solve(s);
    println!("{}", ans);
}


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

int main(){
  string A,B,C;
  cin >> A >> B >> C;
  if(A.at(A.size()-1)  == B.at(0)&&B.at(B.size()-1) == C.at(0)){
    cout << "YES";}
    else {cout << "NO";}
  }
  

Measured memory_bytes: 256
#include <iostream>
//#define k 10001
using namespace std;

void CountingSort(int A[],int n,int B[],int k){
    int C[k];
    for(int i=0;i<k;i++)
        C[i]=0;
    for(int i=0;i<n;i++)
        C[A[i]]++;
    for(int i=1;i<k;i++)
        C[i]=C[i]+C[i-1];
    for(int i=n-1;i>=0;i--)
    {
        if(C[A[i]]>0){
            B[C[A[i]]-1]=A[i];
            C[A[i]]--;
        }
    }
}

int main(){
    int *A,*B;
    int k=10001;
    int n;
    cin>>n;
    A=new int[n];
    B=new int[n];
    for(int i=0;i<n;i++)
        cin>>A[i];
    CountingSort(A,n,B,k);
    int isn=0;
    for(int i=0;i<n;i++)
    {
        if(isn++>0)cout<<' ';
        cout<<B[i];
    }
    cout<<endl;
    delete A;
    delete B;
    return 0;
}


Measured memory_bytes: 18288
import java.util.*;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int R = sc.nextInt();
		if (N >= 10) {
			System.out.println(R);
		} else {
			int a = 100 * (10-N);
			System.out.println(R+a);
		}
	}
}

Measured memory_bytes: 21588
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

	public static void main(String[] args) {
		Main main = new Main();
		main.totalTimeCalculation();
		return;
	}
	
	private void totalTimeCalculation() {
		
		BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); //標準入力
		
		try {
			
			int totalTime = 0;
			
			for (int i = 0; i < 4; i++) {
				String inputStr = bufferedReader.readLine();
				totalTime += Integer.parseInt(inputStr);
			}
			
			int minuteTime = totalTime / 60;
			int secondTime = totalTime % 60;
			
			System.out.println(minuteTime);
			System.out.println(secondTime);
			
		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}
			
	}
	
}

Measured memory_bytes: 16996
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int total = 0;
    int n[] = new int[5];
    int saigo = 0;
    for(int i = 0;i<5;i++){
      n[i] = sc.nextInt();
      int a = n[i]/10;
      if(n[i]%10==0){
        total+=n[i];
      }else{
        total+=(a+1)*10;
        saigo=Math.max(saigo,(a+1)*10-n[i]);
      }
    }

    System.out.println(total-saigo);
  }
}


Measured memory_bytes: 35752
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

sum = 0
before = n
for i in range(n):
  sum += b[a[i]-1]
  if(a[i] == before+1): sum += c[before-1]
  before = a[i]  

print(sum)


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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n;
    cin >> n;
    vector<int32> p(n);
    REP(i,n)cin >> p[i];
    int32 ans = 0;
    REP(i,n-1){
        if(p[i] == i+1){
            swap(p[i], p[i+1]);
            ans++;
        }
    }
    if(p[n-1] == n){
        ans++;
    }
    ANS(ans);
    return 0;
}

Measured memory_bytes: 1024
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
ll gcd(ll a,ll b){
    if(a%b==0)return b;
    return gcd(b,a%b);
}

int main() {
    ll n;
    std::cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }
    
    ll res = 1e15;
    
    for (int j = -100; j <= 100; j++) {
        ll k = 0;
        
        for (int i = 0; i < n; i++) {
            k += (a[i]-j)*(a[i]-j);
        }
        
        res = min(res,k);
    }
    
    std::cout << res << std::endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());
		String[] tmpArray = br.readLine().split(" ");
		
		int[] h = new int[n + 1];
		
		for(int i = 0; i < n; i++){
			h[i] = Integer.parseInt(tmpArray[i]);
		}
		h[n] = Integer.MAX_VALUE;

		int result = 0;
		
		int tmpCount = 0;
		for(int i = 0; i < n ; i++){
//			System.out.println("i = "+i);
			if(h[i] >= h[i + 1]){
				tmpCount++;
			}
			else {
//				System.out.println("count "+tmpCount);
				result = Math.max(tmpCount, result);
				tmpCount = 0;
			}
			
		}
		
		System.out.println(result);

	}

}


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

map <int, char> m;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  m[0] = 'R';
  m[1] = 'G';
  m[2] = 'B';
  int n;
  string s;
  cin >> n;
  cin >> s;
  // RGB
  vector <int> dis[3][3][4005];
  vector <int> pos[3];
  for (int j = 0; j < n; j++) {
    if (s[j] == 'R') 
      pos[0].push_back(j);
    else if (s[j] == 'G')
      pos[1].push_back(j);
    else
      pos[2].push_back(j);
  }
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      if (i != j) {
        char l1 = m[i];
        char l2 = m[j];
        for (int a = 0; a < n; a++) {
          if (s[a] == l1) {
            for (int b = a + 1; b < n; b++) {
              if (s[b]  == l2) {
                dis[i][j][a].push_back(b - a);
              }
            }
          }
        }
      }
    }
  }
  long long ans = 0;
  for (int a = 0; a < 3; a++) {
    for (int b = 0; b < 3; b++) {
      for (int c = 0; c < 3; c++) {
        if (a != b && b != c && a != c) {
          for (int i = 0; i < pos[a].size(); i++) {
            int p = pos[a][i];
            for (int u = 0; u < dis[a][b][p].size(); u++) {
              int dis1 = dis[a][b][p][u];
              int posb = p + dis1;
              for (int v = 0; v < dis[b][c][posb].size(); v++) {
                int dis2 = dis[b][c][posb][v];
                if (dis1 != dis2) ans++;
              }
            }
          }
        }
      }
    }
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 36260
<?php
$n = intval(fgets(STDIN));
$A = array_map("intval", explode(" ", trim(fgets(STDIN))));
if(min($A)==0){
    echo 0;
    exit;
}
$p = array_product($A);
if($p>1000000000000000000){
    echo -1; 
}else{
    echo $p;
}


Measured memory_bytes: 28788
var fs = require('fs');

// class Stdin
function Stdin() {
  this.__input = null;
  this.__lines = [];
  this.__index = 0;
}
Stdin.prototype.init = function() {
  this.__input = fs.readFileSync('/dev/stdin', 'utf-8');
  this.__lines = this.__input.split("\n");
  this.__index = 0;
}
Stdin.prototype.readline = function() {
  if(this.__index === this.__lines.length) this.init();
  return this.__lines[this.__index++];
};
Stdin.prototype.readlines = function() {
  if(this.__index === this.__lines.length) this.init();
  cur = this.__index; this.__index = this.__lines.length;
  return this.__lines.slice(cur);
};
var stdin = new Stdin;

Array.prototype.imap = function() { return this.map((x)=>parseInt(x)); }
Array.prototype.fmap = function() { return this.map((x)=>parseFloat(x)); }
Array.prototype.smap = function() { return this.map((x)=>String(x)); }
Array.prototype.ffill = function(cb) {
  for(var i=0; i<this.length; ++i) { this[i] = cb(i); } return this;
}
Array.prototype.max = function() {
  if(this.length === 0) return undefined;
  res = this[0];
  for(var i=1; i<this.length; ++i) if(res < this[i]) res = this[i];
  return res;
}
Array.prototype.min = function() {
  if(this.length === 0) return undefined;
  res = this[0];
  for(var i=1; i<this.length; ++i) if(this[i] < res) res = this[i];
  return res;
}

Number.prototype.times = function(cb) { res = []; for(var i=0; i<this; ++i) res.push(cb ? cb(i) : i); return res; }

Object.prototype.forEach = function(cb) { Object.keys(this).forEach(cb); }
Object.prototype.map = function(cb) { Object.keys(this).map(cb); }

var l = stdin.readline().split(' ').imap();
var N = l[0], M = l[1];
var A = N.times(x=>stdin.readline()).imap();

for(var k = 1; k <= M; ++k) {
  for(var i = 0; i < N-1; ++i) {
    if((A[i] % k) > (A[i+1] % k)) {
      var tmp = A[i]; A[i] = A[i+1]; A[i+1] = tmp;
    }
  }
}
for(var i = 0; i < N; ++i) {
  console.log(A[i]);
}

Measured memory_bytes: 16464
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
	int x, n; cin >> x >> n;
	vector<int> p(n);
	for (auto& e : p) cin >> e;
	sort(p.begin(), p.end());
	for (int i = 0; i < 200; ++i) {
		if (find(p.begin(), p.end(), x - i) == p.end()) {
			cout << x - i << endl;
			return 0;
		}
		if (find(p.begin(), p.end(), x + i) == p.end()) {
			cout << x + i << endl;
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 3628
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

static constexpr ll nc2(ll n) { return n <= 1 ? 0 : n * (n - 1) / 2; }

int main() {
  ll N;
  cin >> N;
  vec<ll> A(N);
  unordered_map<ll, ll> m;
  REP(i, N) {
    cin >> A[i];
    m[A[i]]++;
  }

  ll acc = 0;
  for (const auto &[_, v] : m) {
    acc += nc2(v);
  }

  REP(i, N) {
    const ll v = m[A[i]];
    if (v == 2) {
      cout << acc - 1 << endl;
    } else if (v == 1) {
      cout << acc << endl;
    } else {
      cout << acc - (v - 1) << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 11792
#include <iostream>
#include <cmath>
#include <stdio.h>
using namespace std;
int main()
{
  double x1,y1,x2,y2;
  cin>>x1>>y1>>x2>>y2;
  double sq=sqrt(pow((x1-x2),2)+pow((y1-y2),2));
  double ans=fabs(sq);
  printf("%11f\n",ans);
  return 0;
}


Measured memory_bytes: 3288
#include <iostream>
#include <string>
using namespace std;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a >= b&&a >= c) {
		cout << b + c;
		return 0;
	}
	if (b>=a&&b >= c) {
		cout << a+ c;
		return 0;
	}
	if (c>=b&&c>= a) {
		cout << b + a;
		return 0;
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
#define pb push_back
#define ll long long int
# define pll pair<ll,ll>
# define fio ios_base::sync_with_stdio(false); cin.tie(NULL)
# define ft first
# define sec second

int main()
{      ll rem=0;
       ll n;
       cin >>n ;
       for(int i=1 ; i<= 1e6+1 ; i++)
       {
           rem=(rem*10+7)%n;
           if(rem==0){ cout << i ; return 0 ;}
       }
       cout<<-1;
   }



Measured memory_bytes: 3188
S = input()
l = len(S)
s1 = ''.join(['0' if i % 2 == 0 else '1' for i in range(l)])
s2 = ''.join(['1' if i % 2 == 0 else '0' for i in range(l)])

t1 = 0
t2 = 0
for i, j, s in zip(s1, s2, S):
    if i != s:
        t1 += 1
    if j != s:
        t2 += 1
print(min(t1, t2))

Measured memory_bytes: 4068
#pragma region ヘッダー
#define _CRT_SECURE_NO_WARNINGS

#ifdef _____MY_DEBUG_____
#define VS_ENDPAUSE()	(system("pause"))
#define DEBUG_OUT(...)  (printf(__VA_ARGS__))
#else
#define VS_ENDPAUSE()
#define DEBUG_OUT(...)
#endif

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;
typedef signed char int8;
typedef signed short int16;
typedef signed int int32;
typedef signed long long int64;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long long uint64;
#define int int64

#ifndef INT8_MIN
#define INT8_MIN	(-127)
#endif
#ifndef INT8_MAX
#define INT8_MAX	( 128)
#endif
#ifndef UINT8_MAX
#define UINT8_MAX	( 255)
#endif
#ifndef INT16_MIN
#define INT16_MIN	(-32768)
#endif
#ifndef INT16_MAX
#define INT16_MAX	( 32767)
#endif
#ifndef UINT16_MAX
#define UINT16_MAX	( 65535)
#endif
#ifndef INT32_MIN
#define INT32_MIN	(-2147483648)	// -2 * 10^9
#endif
#ifndef INT32_MAX
#define INT32_MAX	( 2147483647)	//  2 * 10^9
#endif
#ifndef UINT32_MAX
#define UINT32_MAX	( 4294967295)	//  4 * 10^9
#endif
#ifndef INT64_MIN
#define INT64_MIN	(-9223372036854775808)	// -9 * 10^18
#endif
#ifndef INT64_MAX
#define INT64_MAX	( 9223372036854775807)	//  9 * 10^18
#endif
#ifndef UINT64_MAX
#define UINT64_MAX	( 18446744073709551615)	// 18 * 10^18
#endif

void func(void);
#pragma endregion

int32 main(void)
{
    func();
    VS_ENDPAUSE();
    return 0;
}

void func(void)
{
//DEBUG_OUT("----\n");
    uint32 H, W, N;
    cin >> H >> W;
    cin >> N;
    vector<uint32> a(N);
    for(uint32 i=0; i<N; i++){
        uint32 tmpA;
        cin >> tmpA;
        a[i] = tmpA;
    }

    vector< vector<uint32> > c(H, vector<uint32>(W, 0));
    int32 h = 0;
    int32 w = 0;
    int32 direction = 1;
    for(uint32 k=1; k<=N; k++){
        for(uint32 l=0; l<a[k-1]; l++){
            c[h][w] = k;
            if(direction == 1){
                if(w != W-1){ w += direction; }
                else{
                    h++;
                    direction = -1;
                }
            }else{
                if(w != 0){ w += direction; }
                else{
                    h++;
                    direction = 1;
                }
            }
        }
    }
DEBUG_OUT("-----\n");
    for(h=0; h<H; h++){
        for(w=0; w<W-1; w++){
            cout << c[h][w] << " ";
        }
        cout << c[h][w] << endl;
    }

    return;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define LLINF 1000000000000000ll
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
template<class T>
void dump(vector<T> &vec){
	for(int i=0;i<vec.size();i++){
		cout << vec[i];
		if(i+1<vec.size())cout << ' ';
		else cout << endl;
	}
	return;
}
template<class T>
void input(vector<T>& vec,int n){
	vec.resize(n);
	for(int i=0;i<n;i++){
		cin >> vec[i];
	}
}
int N;
int p[100100];
int rev[100100];
ll ans = 0ll;
vector<P> vec;
set<int> s;
int main(){
	cin >> N;
	for(int i=0;i<N;i++){
		cin >> p[i];
		rev[p[i]] = i;
		vec.pb(P(p[i],i));
	}
	sort(all(vec));
	for(int i=N-1;i>0;i--){
		s.insert(vec[i].sec);
		auto it = s.lower_bound(rev[i]);
		ll R,L;
		if(it==s.end()){
			R = N-rev[i];
			it--;	
			L = *it;
			if(it==s.begin())L++;
			else{
				it--;
				L = L-(*it);
			}
			ans += (ll)i*(R*L);
		}else if(it==s.begin()){
			L = rev[i]+1;
			auto nxt = it;
			nxt++;
			if(nxt==s.end()){
				R = N-(*it);
			}else{
				R = (*nxt)-(*it);
			}
			ans += (ll)i*(R*L);
		}else{
			auto nxt = it;
			nxt++;
			auto prev = it;
			prev--;
			L = rev[i]-(*prev);
			if(nxt==s.end()){
				R = N-(*it);
			}else{
				R = (*nxt)-(*it);
			}
			ans += (ll)i*(R*L);

			R = (*it)-rev[i];
			L = *prev;
			if(prev==s.begin())L++;
			else{
				auto pp = prev;
				pp--;
				L = L-(*pp);
			}
			ans += (ll)i*(R*L);
		}
	}
	cout << ans << endl;
	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
	ll k,n;cin>>k>>n;
	vl a(n),b(n);
	rep(i,n){
		cin>>a[i];
	}
	rep(i,n-1){
		b[i]=a[i+1]-a[i];
	}
	b[n-1]=(k-a[n-1])+a[0];
	ll m=0;
	rep(i,n){
		m=max(m,b[i]);
	}
	cout<<k-m<<endl;
}

Measured memory_bytes: 3328
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
#define vvec vector<vector<ll>>
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 1000000007;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll c(ll n, ll k) { ll a = 1; rep(i, 1, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }
int main(void) {
	string s;
	cin >> s;
	deque<ll> n;
	ll x = 0, sum = 0;
	n.push_back(s[0] - '0');
	rep(i, 0, s.size()) {
		x *= 10;
		x += s[i] - '0';
	}
	rep(i, 0, 1 << (s.size() - 1)) {
		ll v = s[0] - '0';
		rep(i2, 0, s.size()) {
			if (i >> i2 & 1) {
				v *= 10;
			}
			else {
				sum += v;
				v = 0;
			}
			v += s[i2 + 1] - '0';
		}
	}
	printf("%lld\n", sum);
	return 0;
}


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

using namespace std;

const int N=1e6+3;

const double eps=0.000000001;

#define pb push_back
#define all(x) (x).begin(),(x).end()
typedef long long ll;

const int dx[]={1,-1,0,0},
		  dy[]={0,0,1,-1};

const int inf=1e9;

int n,m,a[N],b[N],k,q,u,v,x,y,tc,c,l,r,ans;

char s[N];

void IO(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	#ifndef ONLINE_JUDGE
		freopen("test.txt","r",stdin);
	#endif
}


int main(){
	//IO();
	ll ans=4e18;
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++)
		scanf("%d %d",&a[i],&b[i]);
	for(int i=0;i<n;i++){
		for(int j=i;j<n;j++){
			for(int k=j;k<n;k++){
				for(int l=k;l<n;l++){
					int min_x=min(min(a[i],a[j]),min(a[k],a[l]));
					int max_x=max(max(a[i],a[j]),max(a[k],a[l]));
					int min_y=min(min(b[i],b[j]),min(b[k],b[l]));
					int max_y=max(max(b[i],b[j]),max(b[k],b[l]));
					int cnt=0;
					for(int ii=0;ii<n;ii++)
						if (! (a[ii]>max_x || a[ii]<min_x || b[ii]>max_y || b[ii]<min_y) )
							cnt++;
					if (cnt>=m)
						ans=min(ans,(ll)(max_x-min_x)*(max_y-min_y));
				}
			}
		}
	}
	printf("%lld\n",ans);
}


Measured memory_bytes: 2304
import java.util.Scanner;
import java.util.stream.IntStream;

class Main{
	public static void main(String[]$){
		Scanner s=new Scanner(System.in);
		System.out.println(IntStream.range(s.nextInt(),s.nextInt()+1).filter(Main::f).count());
	}
	static boolean f(int i) {
		return (""+i).equals(new StringBuilder(""+i).reverse().toString());
	}
}

Measured memory_bytes: 50980
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
const long long LLINF = 1LL<<60;
const int INF = 1e9;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
#define pint pair<int,int>
using namespace std;

ll gcd(ll x, ll y){ 

    return y?gcd(y,x%y):x; 

} 

 

ll lcm(ll a, ll b){ 

    return a/gcd(a,b)*b; 

} 
int main() {
    ll n, m; cin >>  n >> m;
    cout << lcm(n,m) << endl;


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 10000000000005LL
#define MOD 1000000007

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

int n,k;
ll a[16];

int main(){
  cin >> n >> k;
  rep(i,0,n) cin >> a[i];
  int comb = (1<<k)-1;
  ll ans = INF;
  while(comb < 1 << n){

    ll u=0;//money
    ll z=0;
    rep(i,0,n){
      if(comb >> i & 1){
        if(z >= a[i]){
          z++;
          u += (z-a[i]);
        }
      }
      z = max(z,a[i]);
    }
    ans = min(ans,u);
    int x = comb & -comb, y = comb+x;
    comb = ((comb & ~y) / x>>1) | y;
  }
  cout<< ans << endl;

  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ITP1_1C
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] StrNum = Console.ReadLine().Split(' ');
            int area = int.Parse(StrNum[0]) * int.Parse(StrNum[1]);
            int circuit = (int.Parse(StrNum[0]) + int.Parse(StrNum[1])) * 2;
            Console.WriteLine(area.ToString("G") + " " + circuit.ToString("G"));
        }
    }
}

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

int main(){
    
    int n;
    cin >> n;
    int h[30];
  
    for (int i=0; i<n; i++){
    cin >> h[i];
    }
  
    int count = 0;
    int max = h[0];
   
    for (int i=1; i<n; i++){
     
    if (h[i]>= max){
    count++;
    max=h[i];
    }
    }
  
    cout << 1+count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cassert>

bool is_triangle(std::istream& is)
{
	unsigned int length[3];

	is >> length[0] >> length[1] >> length[2];

	assert(!is.fail() && !is.bad());
	assert(length[0] <= 1000 && length[1] <= 1000 && length[2] <= 1000);

	std::sort(length, length + 3);

	return length[0] * length[0] + length[1] * length[1] == length[2] * length[2];
}


int main(void)
{
	int num_cases;

	std::cin >> num_cases;

	for (int i = 0; i < num_cases; i++) {
		std::cout << (is_triangle(std::cin) ? "YES\n" : "NO\n");
	}
	return 0;
}

Measured memory_bytes: 1140
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define qwq(x) cerr<<" #"<<#x<<" = "<<x<<endl;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
 
template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

const int N=1050;
int l[N],q[N],from[N],d[N],mx[N];
int n,cnt,a,b,X; ll Y=1e18;
vi e[N];

int main(){
	read(n);
	rep(i,1,n-1){
		read(a),read(b);
		e[a].pb(b),e[b].pb(a);
	}
	auto bfs=[&](int s,int f=0){
		int l=0,r=0;
		d[q[r++]=s]=1,from[s]=f;
		for(int u;l<r;l++){
			int sn=0;u=q[l];
			for(auto v:e[u])if(v!=from[u])
				d[q[r++]=v]=d[u]+1,from[v]=u,++sn;
			mx[d[u]]=max(mx[d[u]],sn);
		}
	};
	bfs(1); int rt=max_element(d+1,d+n+1)-d;
	bfs(rt);int rt2=max_element(d+1,d+n+1)-d;
	for(int x=rt2;x;x=from[x])l[++cnt]=x;
	if(cnt%2==0){
		fill(mx+1,mx+n+1,0);
		int A=l[cnt/2],B=l[cnt/2+1];
		bfs(A,B),bfs(B,A);
		X=cnt/2,Y=2;
		rep(i,1,X-1)Y*=mx[i];
	}
	else{
		X=cnt/2+1;
		int A=l[(cnt+1)/2];
		for(auto B:e[A]){
			fill(mx+1,mx+n+1,0);
			ll now=1; bfs(A,B),bfs(B,A);
			rep(i,1,X-1)now*=mx[i];
			Y=min(Y,now*2);
		}
		fill(mx+1,mx+n+1,0);
		ll now=1; bfs(A);
		rep(i,1,X-1)now*=mx[i];
		Y=min(Y,now);
	}
	cout<<X<<" "<<Y<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int a[5];
  int tmp = 10;
  int sum = 0;
  for(int i = 0;i<5;i++){
    scanf("%d",&a[i]);
  }
  for(int i = 0;i<5;i++){
    if((a[i] % 10) != 0){
      if((a[i] % 10) < tmp){
        tmp = (a[i] % 10);
      }
    }
    sum += (a[i]+9) / 10;
  }
  sum *= 10;
  sum -= 10-tmp;
  printf("%d",sum);
  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
 
int main(){
  int n;
  char s[300];
  int i;
  int flag = 0;
  
  scanf("%d\n", &n);
  gets(s);
  
  for(i=0;i<300;i++){
    if(s[i] == 'Y'){
      flag = 1;
      break;
    }
  }
  
  switch(flag){
    case 0:printf("Three");break;
    case 1:printf("Four");break;
  }
  
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)                                                         

using namespace std;
#define ll long long

int main(){
  int N, A, B;
  cin >> N >> A >> B;
  if(abs(A - B) % 2 == 0)
    cout << "Alice" << endl;
  else
    cout << "Borys" << endl;
  return 0;
}


Measured memory_bytes: 256
N,M = map(int,raw_input().split())
ab = [map(int,raw_input().split()) for i in range(M)]
maxb = 0
for a,b in ab:
	if a == 1 and b > maxb:
		maxb = b
flag = 0 if maxb > 0 else 1
i = 1
while maxb < N and flag == 0:
	lsb = [b for a,b in ab if a <= maxb + 1 and b > maxb]
	if len(lsb) > 0:
		maxb = max(lsb)
	else:
		flag = 1
	i += 1
print i if maxb == N and flag == 0 else "Impossible"
	

Measured memory_bytes: 4236
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Map<String, Integer> map = new HashMap<>();

		Scanner sc  =new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		String[] s = new String[N];
		for(int i = 0;i < N;i++) {
			s[i] = sc.next();
			if(!map.containsKey(s[i])) {
				map.put(s[i], 1);
			}else {
				map.put(s[i], map.get(s[i])+1);
			}
		}
		int M = Integer.parseInt(sc.next());
		String[] t = new String[M];
		for(int i = 0;i < M;i++) {
			t[i] = sc.next();
			if(!map.containsKey(t[i])) {
				map.put(t[i], -1);
			}else {
				map.put(t[i], map.get(t[i])-1);
			}
		}
		sc.close();

		int max = 0;
		for(Map.Entry<String, Integer> bar : map.entrySet()) {
			if(max < bar.getValue()) {
				max = bar.getValue();
			}
		}
		System.out.println(max);
	}
}

Measured memory_bytes: 21972
#include <stdio.h>
int main(void){
    int a,b,c;
    int i=0;
    scanf("%d %d %d",&a,&b,&c);
    while(a<=b){
        if(c%a==0)
            i++;
        a++;
    }
    printf("%d\n",i);
    return 0;
}


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


int main(){
  int x, y, z;
  
  cin>>x>>y>>z;
  bool ok=false;
  for(int i=1;i<=1000; i++){
    
    if(i%x==0 && y<=i&&i<=z){
      ok=true;
    }
    
  }
  if(ok==true){
    cout<<"OK\n";
    
  }
  else{
    cout<<"NG\n";
  }
    
    
    
  
  
  
  return 0;
}

Measured memory_bytes: 3604