akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define sz(a) ((int)a.size())
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll div_num(ll n){
  vl div(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      div[i]++;
    }
  }
  if(n!=1)div[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=div[i];
  }
  return num;
}
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}
long long lopow(ll a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a ;
        a = a * a ;
        n >>= 1;
    }
    return res;
}


//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vc Alp ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
//cout<<""<<endl;

int main(void){
 ll N,M;cin>>N>>M;vl a(N);rep(i,N)cin>>a[i];
  
  bool ok=true;
  ll lm=1;

  rep(i,N){
    a[i]/=2;
  }
  for(int i=0;i<N;i++){
    lm =(a[i]/(__gcd(a[i],lm)))*lm;
  }
  ll cm=0;
  ll tw=2;
  while(lm%tw==0){
    cm++;
    tw*=2;
  }
  rep(i,N){
    ll ca=0;
    tw=2;
    while(a[i]%tw==0){
      ca++;
      tw*=2;
    }
    if(ca!=cm)ok=false;
  }
  if(!ok)cout<<0<<endl;
  else{
    if((M/lm)%2==0)cout<<(M/lm)/2<<endl;
    else cout<<(M/lm)/2+1<<endl;
    
  }
 
         
}






Measured memory_bytes: 1024
N,M=map(int,input().split())
es = [ tuple(map(int,input().split())) for _ in range(M) ]
ans = 0

data = [0] * (N+1)
def root(i):
  if data[i] < 0:
    return i
  data[i] = root(data[i])
  return data[i]

def link(a, b):
  a = root(a)
  b = root(b)
  if a != b:
    if -data[a] > -data[b]:
      data[a] += data[b]
      data[b] = a
    else:
      data[b] += data[a]
      data[a] = b

for i in range(M):
  for x in range(N+1):
    data[x] = -1
  for j in range(M):
    if i == j: continue
    link( es[j][0], es[j][1])
  if root( es[i][0]) != root( es[i][1]):
    ans += 1
print(ans)



Measured memory_bytes: 3064
N, A, B = map(int, input().split())

total = 0
for i in range(1, N + 1):
    number_list = []
    for n in str(i):
        number_list.append(int(n))
    summation = sum(number_list)
    if A <= summation and summation <= B:
        total += int(i)
    else:
        pass

print(total)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
using ll=long long;
constexpr ll mod=998244353;
constexpr int inf=1000000000;
constexpr ll linf=1000000000000000000;

int main(){
    int n,s;
    cin>>n>>s;
    int a[n];
    rep(i,n)cin>>a[i];
    ll dp[n+1][s+1]={};
    dp[0][0]=1;
    rep(i,n){
        for(int j=0;j<=s;++j){
            (dp[i+1][j]+=2*dp[i][j])%=mod;
            if(j+a[i]<=s){
                (dp[i+1][j+a[i]]+=dp[i][j])%=mod;
            }
        }
    }
    cout<<dp[n][s]<<endl;
}


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

using namespace std;

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long


int main(){
    int n; cin >> n;
    vector<int> v; repn(i, n) v.push_back(i);
    vector<int> p, q;
    rep(i, n){
        int x; cin >> x; p.push_back(x);
    }
    rep(i, n){
        int x; cin >> x; q.push_back(x);
    }

    int c = 0; int cp, cq;
    do{
        if(v == p) cp = c;
        if(v == q) cq = c;
        c++;
    }
    while(next_permutation(v.begin(), v.end()));

    cout << abs(cp-cq) << endl;
}
/*
1 2 3
1 3 2
2 1 3
2 3 1
3 1 2
3 2 1

*/

Measured memory_bytes: 888
import java.util.*;
import java.io.*;

class Mod{
    static final long MOD = 1000_000_007;
    static final long[] fact = makeFactorialArray(210000);
    static final long[] factInv = makeInversedArray(fact);

    public static long add(long a, long b){
        long tmp = (a+b)%MOD;
        return tmp>=0 ? tmp : tmp+MOD;
    }
    public static long adds(long... a){
        long ans = 0;
        for(long x: a) ans = add(ans, x);
        return ans;
    }
    public static long sub(long a, long b){
        return add(a,-b);
    }
    public static long mult(long a, long b){
        long tmp = (a*b)%MOD;
        return tmp>=0 ? tmp : tmp+MOD;
    }
    public static long mults(long... a){
        long ans = 1;
        for(long x: a) ans = mult(ans, x);
        return ans;
    }
    public static long power(long a, long x){ //calculate a^x
        if(x<0)return 0;
        if(x==0)return 1;
        if(x%2==0) {
            long half = power(a,x/2);
            return mult(half,half);
        }
        return (a*power(a,x-1)) % MOD;
    }
    public static long inverse(long a){
        return power(a,MOD-2);
    }
    public static long div(long a, long b){
        return mult(a, inverse(b));
    }
    public static long[] makeFactorialArray(int size){
        long[] array = new long[size];
        array[0]=1;
        for(int i=1;i<size;i++){
            array[i]=mult(array[i-1],i);
        }
        return array;
    }
    public static long[] makeInversedArray(long[] original){
        long[] array = new long[original.length];
        for(int i=0;i<original.length;i++){
            array[i] = inverse(original[i]);
        }
        return array;
    }
    public static long combination(int n, int r){
        if(n<0 || r<0 || n<r) return 0;
        return mult(fact[n], mult(factInv[r],factInv[n-r]));
    }
    public static long gcd(long a, long b){
        if(a<b) return gcd(b,a);
        if(b==0) return a;
        if(a%b==0) return b;
        return gcd(b,a%b);
    }
    public static long lcm(long a, long b){
        return (a/gcd(a,b))*b;
    }

}

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int B = sc.nextInt();
        int W = sc.nextInt();
        int N = B+W;

        long[] noWhite = new long[N+1];
        long[] noBlack = new long[N+1];
        for(int n=1; n<=N; n++){
            noWhite[n] = noWhite[n-1] + Mod.div(Mod.combination(n-1,W-1) ,Mod.power(2,n));
            noBlack[n] = noBlack[n-1] + Mod.div(Mod.combination(n-1,B-1) ,Mod.power(2,n));
        }

        for(int n=1; n<=N; n++){
            long bothExists = Mod.sub(1, Mod.add(noWhite[n-1], noBlack[n-1]));
            long ans = Mod.add(noWhite[n-1], Mod.div(bothExists,2));
            System.out.println(ans);
        }


    }
}


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


void solve(){
	

	string s ;
	cin>>s ;

	int count=0 ;
	int ans_count=0 ;

	for(int i=0;i<(int)s.length();i++){
		if(s[i]=='R' && count==0)
			count++ ;
		else if(s[i]=='R' && s[i-1]=='R')
			count++ ;
		else
			count=0 ;
	


		ans_count=max(count,ans_count) ;

	}

	cout<<ans_count ;

}	

int main(){

	
	int y ;

	y=1 ;
	//cin>>y ;

	while(y--)
	{	
		solve() ;
	}

}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
long long search(long long Z){
	string W=to_string(Z);
	long long H1=9,H2=1,H3=1;
	for(int i=0;i<(int)W.size()-1;i++){H2+=H1*(i+1);H1*=10;H3*=10;}
	H1/=10;
	long long K=H2+(Z-H3)*W.size();
	return K;
}
long long solve(string S){
	string T="-";
	for(int i=1;i<=10009;i++)T+=to_string(i);
	for(int i=0;i<=(int)(T.size()-S.size());i++){
		if(T.substr(i,S.size())==S)return i;
	}
	long long minx=1LL<<62;
	for(int i=5;i<=min((int)S.size(),17);i++){
		for(int j=0;j<i;j++){
			if(S[j]=='0')continue;
			string Y=S.substr(j,S.size()-j);
			if((int)Y.size()>i)Y=Y.substr(0,i);
			if((int)Y.size()<i){
				while((int)Y.size()<i){Y+=S[j-(i-Y.size())];}
				int R=j-1,D=Y.size()-1;
				while(R>=0 && D>=0){Y[D]=S[R];R--;D--;}
				long long J=stoll(Y);J++;Y=to_string(J);
			}
			string R="";int J=0;
			for(int k=-30;k<=30;k++){if(k==0)J=R.size();R+=to_string(stoll(Y)+k);}
			R=R.substr(J-j,S.size());
			if(R!=S)continue;
			minx=min(minx,search(stoll(Y))-j);
		}
	}
	return minx;
}
int main(){
	while(true){
		string U;cin>>U;if(U=="#")break;
		long long ret=1LL<<62;
		if(U[0]=='0'){
			for(int k=0;k<17;k++){
				for(int i=1;i<=9;i++){
					string ADD="";ADD+=(char)('0'+i);
					for(int j=0;j<k;j++)ADD+="0";
					ret=min(ret,solve(ADD+U)+1);
				}
			}
		}
		else ret=solve(U);
		cout<<ret<<endl;
	}
	return 0;
}

Measured memory_bytes: 3228
import decimal
import math


a, b, C = map(decimal.Decimal, input().split())


S = decimal.Decimal("0.5") * a * b * decimal.Decimal(math.sin(math.radians(C)))

c = decimal.Decimal(math.sqrt(a ** decimal.Decimal("2") + b ** decimal.Decimal("2") - decimal.Decimal("2") * a * b * decimal.Decimal(math.cos(math.radians(C)))))
L = a + b + c
h = b * decimal.Decimal(math.sin(math.radians(C)))

print(f"{S} {L} {h}")



Measured memory_bytes: 6516
#if defined(LOCAL)
const double _max_double_error = 1e-9;
#include "testutils.h"
#define L(x...) (debug(x, #x))
#define I(x, ...) (x)
#define C(x...) CHECK(x)
#else
#define L(x, ...) (x)
#define I(x, ...) (x)
#define C(x, ...) ;
#endif
#include <math.h>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using ii = pair<int, int>;
using lu = unsigned long long;
using l = long long;
using vs = vector<string>;
using vii = vector<ii>;
using vl = vector<l>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vlu = vector<lu>;
using ll = pair<l, l>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using vd = vector<double>;
using vvd = vector<vd>;
using mll = unordered_map<l, l>;
using sl = unordered_set<l>;
const l      INF = numeric_limits<l>::max();
const double EPS = 1e-10;
const double PI = 3.14159265358979323846;
const l      e0 = 1, e3 = 1000, e5 = 100000, e6 = 10 * e5, e7 = 10 * e6,
        e8 = 10 * e7, e9 = 10 * e8, l0 = 0, l1 = 1, l2 = 2;
const char lf = '\n';
#define all(x) begin(x), end(x)
#define F(a, b, c) for (l a = l(b); a < l(c); a++)
#define B(a, b, c) for (l a = l(c) - 1; a >= l(b); a--)

void solve(istream &in, ostream &out);
void solve_brute(istream &, ostream &);
bool interactive_judge(istream &, istream &, ostream &);
bool generate_random(l, ostream &);
bool solution_checker(istream &, istream &, istream &, ostream &);
int  main(int argc, char **argv) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(15);
#if defined(LOCAL)
  tst::test_init(argc, argv);
  // _generate_random_test = generate_random;
  // _solve_brute = solve_brute;
  // _judge = interactive_judge;
  // _custom_solution_checker = solution_checker;
  tst::maybe_run_tests(cin, cout);
#else
  solve(cin, cout);
#endif
}
const l MOD = e9 + 7;  // end of template

void solve(istream &in, ostream &out) {
  l n, a, b;
  in >> n >> a >> b;
  a--;
  b--;
  if (a > b) swap(a, b);
  l d = abs(a - b);
  l z = 0;
  if (d % 2) {
    d--;
    z = min(a + 1, n - b);
  }
  out << z + d / 2 << lf;
}


Measured memory_bytes: 256
h1,h2=map(int,input().split())
k1,k2=map(int,input().split())
a,b,c,d=map(int,input().split())
hp=h1*a+h2*b+(h1//10)*c+(h2//20)*d
kp=k1*a+k2*b+(k1//10)*c+(k2//20)*d
if hp>kp:
    print("hiroshi")
elif kp>hp:
    print("kenjiro")
else:
    print("even")


Measured memory_bytes: 5596
package main
 
import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)
 
var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  var line, buffer []byte
  var isPrefix bool = true
  var err error
  for isPrefix {
    line, isPrefix, err = reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
  }
  return string(buffer)
}
func NextInt() int {
  var n int
  n, _ = strconv.Atoi(NextLine())
  return n
}
func NextIntVec() []int {
  L := strings.Split(NextLine(), " ")
  N := make([]int, len(L))
  for i := range N {
    N[i], _ = strconv.Atoi(L[i])
  }
  return N
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func Output() {
  _ = writer.Flush()
}

const p = 1000000007

func main() {
  N := NextInt()
  T := NextIntVec()
  A := NextIntVec()
  H := make([]int, N)
  H[0] = T[0]
  H[N - 1] = A[N - 1]
  M := make([]int, N)
  M[0] = 1
  M[N - 1] = 1
  cnt := 1
  if N == 1 && T[0] != A[0] {
    M[0] = 0
  }
  for i := 1; i < N; i++ {
    if T[i] < H[i] {
      M[i] = 0
      break
    }
    if T[i - 1] < T[i] {
      if 0 < H[i] && H[i] < T[i] {
        M[i] = 0
        break
      }
      if H[i] == 0 && 0 < M[i] && M[i] < T[i] {
        M[i] = 0
        break
      }
      H[i] = T[i]
      M[i] = 1
    } else if M[i] == 0 {
      M[i] = T[i]
    } else if T[i] < M[i] {
      M[i] = T[i]
    }
    j := N - 1 - i
    if A[j] < H[j] {
      M[j] = 0
      break
    }
    if A[j + 1] < A[j] {
      if 0 < H[j] && H[j] < A[j] {
        M[j] = 0
        break
      }
      if H[j] == 0 && 0 < M[j] && M[j] < A[j] {
        M[j] = 0
        break
      }
      H[j] = A[j]
      M[j] = 1
    } else if M[j] == 0 {
      M[j] = A[j]
    } else if A[j] < M[j] {
      M[j] = A[j]
    }
  }
  for _, m := range M {
    cnt *= m
    cnt %= p
  }
  Write(cnt)
  Output()
}

Measured memory_bytes: 11648
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<pi> vii;

ll n,m;

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

  cin>>n>>m;
  vector<ll> adj[8];
  ll a,b,c;
  for(int i=0; i<n; ++i){
    cin>>a>>b>>c;
    for(int i=0; i<8; ++i){
      if( i == 0)  { adj[i].push_back(a + b + c);}
    else if(i == 1){ adj[i].push_back(a + b - c);}
    else if(i == 2){ adj[i].push_back(a - b + c);}
    else if(i == 3){ adj[i].push_back(a - b - c);}
    else if(i == 4){ adj[i].push_back(-a +b + c);}
    else if(i == 5){ adj[i].push_back(-a +b - c);}
    else if(i == 6){ adj[i].push_back(-a -b + c);}
    else if(i == 7){ adj[i].push_back(-a -b - c);}
    }
  }
  for(int i=0; i<8; ++i){ sort(adj[i].begin(),adj[i].end()) ; }
  ll max_ans = - 1;
  for(int i=0; i<8; ++i){
    ll c = 0, ptr = n-1;
    ll temp_ans = 0;
    while(c!=m){ temp_ans += adj[i][ptr]; ptr--; c++; }
    max_ans = max( max_ans, temp_ans);
  }
  cout<<max_ans<<"\n";
  return 0;
}


Measured memory_bytes: 384
#include <math.h>
#include <algorithm>
#include <functional>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

using ll = long long;

int INF = 32 << 1;
int H, W;
int A[52][52];
pair<int, int> dir[] = { {-1, 1}, {0, 1}, {1, 1}, {-1, 0}, {1, 0}, {-1, -1}, {0, -1}, {1, -1} };


int main() {
    cin >> H >> W;

    for (int i = 1; i <= H; i++) {
        string s;
        cin >> s;
        for (int j = 1; j <= s.size(); j++) {
            if (s[j - 1] == '#') {
                A[i][j] = -INF;
                for (auto& d : dir) {
                    A[i + d.first][j + d.second] += 1;
                }
            }
        }
    }

    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            if (A[i][j] >= 0) { cout << A[i][j]; }
            else { cout << '#'; }
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int X, N;
  cin >> X >> N;
  if(N == 0) {
    cout << X << endl;
  }
  else {
    vector<int> vec(N);
    for(int i = 0; i < N; i++) {
      cin >> vec.at(i);
    }
    for(int i = 0; i < 100; i++) {
      int Y = X - i;
      int Z = X + i;
      int count_Y = 0;
      int count_Z = 0;
      bool finished = false;
      for(int j = 0; j < N; j++) {
        if(Y != vec.at(j)) {
          count_Y++;
        }
        if(count_Y == N) {
          cout << Y << endl;
          finished = true;
          break;
        }
        if(Z != vec.at(j)) {
          count_Z++;
        }
        if(count_Z == N) {
          cout << Z << endl;
          finished = true;
          break;
        }
      }
      if(finished) {
        break;
      }
    }
  }
}

Measured memory_bytes: 3636
#include<cstdio>

typedef long long LL;

inline LL Max(LL i, LL j) {
	return i > j ? i : j;
}

int N,M;
LL A[5005];
int B[5005][205];

int Lm[5005][205], Rm[5005][205];
int stk[5005], top;

void init() {
	
	scanf("%d%d", &N, &M);
	
	for(int i = 2; i <= N; ++i) {
		scanf("%d", &A[i]);
	}
	
	for(int i = 1; i <= N; ++i) {
		for(int j = 1; j <= M; ++j) {
			scanf("%d", &B[i][j]);
		}
	}
}

void pre() {
	
	for(int i = 2; i <= N; ++i) {
		A[i] += A[i - 1];
	}
	
	for(int j = 1; j <= M; ++j) {
		top = 0;
		for(int i = 1; i <= N; ++i) {
			while(top > 0 && B[stk[top]][j] < B[i][j]) {
				Rm[stk[top]][j] = i - 1;
				--top;
			}
			Lm[i][j] = stk[top] + 1;
			stk[++top] = i;
		}
		while(top > 0) {
			Rm[stk[top]][j] = N;
			--top;
		}
	}
}

namespace _100pts {
	
	LL F[5005][5005], Ans;
	
	void solve() {
		
		for(int i = 1; i <= N; ++i) {
			for(int j = 1; j <= M; ++j) {
				F[Lm[i][j]][i] += B[i][j];
				F[Lm[i][j]][Rm[i][j] + 1] -= B[i][j];
				F[i + 1][i] -= B[i][j];
				F[i + 1][Rm[i][j] + 1] += B[i][j];
			}
		}
		
		for(int i = 1; i <= N; ++i) {
			for(int j = 1; j <= N; ++j) {
				F[i][j] += F[i - 1][j] + F[i][j - 1] - F[i - 1][j - 1];
			}
		}
		
		for(int i = 1; i <= N; ++i) {
			for(int j = i; j <= N; ++j) {
				Ans = Max(Ans, F[i][j] - (A[j] - A[i]));
			}
		}
		
		printf("%lld", Ans);
	}
}

int main() {
	
	init();
	pre();
	
	_100pts :: solve();
//	_120pts :: solve();
	
	return 0;
}

Measured memory_bytes: 207872
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long
#define pb push_back
bool isPrime(ll n) 
{ 
   
   if (n <= 1)  return false; 
   if (n <= 3)  return true; 
 
   if (n%2 == 0 || n%3 == 0) return false; 
 
   for (ll i=5; i*i<=n; i=i+6) 
       if (n%i == 0 || n%(i+2) == 0) 
          return false; 
 
   return true; 
} 
ll minthis(ll a, ll b){
if(a < b){
return a;
}
return b;
}
ll maxthis(ll a, ll b){
if(a > b){
return a;
}
return b;
}
int gcd(int a, int 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;
}
 
int findLargestDivisor(int n) 
{ 
int max = 1;
   for (int i = 2; i < n; i++) {        
       if(n %(i) == 0) { 
           max = i;
       } 
    }
   return max;     
} 
 
 
ll power(ll x, ll y)  
{  
   ll temp;  
   if(y == 0)  
       return 1;  
   temp = power(x, y / 2);  
   if (y % 2 == 0)  
       return temp * temp;  
   else
   {  
       if(y > 0)  
           return x * temp * temp;  
       else
           return (temp * temp) / x;  
   }  
} 
bool sortbysec(const pair<int, int>& a, 
               const pair<int, int>& b) 
{ 
   return (a.second < b.second); 
} 
void solve(){
    string s;
    cin >> s;
    int ans = 0;
    for(int i = 0 ; i < (int)s.length() ; i++){
        if(s[i] == 'R'){
            int count = 1;
            while(s[i] == s[i+1] && i < (int)s.length()){
                i++;count++;
            }
            ans = maxthis(ans, count);
        }
    }
    cout << ans << "\n";
}
int main(){ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1;
    //cin >> t;
    while(t--){
    solve();
    }
  return 0; 
}
 
 
 
  
 

Measured memory_bytes: 3608
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define sz(c) (int)(c.size())
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T, class U>using vp = vector<pair<T, U>>;
template<class T>using vv = vector<vector<T>>; template<class T, class U>using vvp = vv<pair<T, U>>;
template<class T>vv<T> vvec(size_t n, size_t m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T>bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T>bool chmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 28, MAX = 1e5 + 5, MOD = 998244353;
constexpr ll LINF = 1ll << 60; constexpr double EPS = 1e-6;
constexpr int dy[4] = { 0,1,0,-1 }, dx[4] = { 1,0,-1,0 };
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

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

    int cnt = 0;
    rep(i, N) {
        if (S[i] == '.') cnt++;
    }

    int ans = cnt;
    rep(i, 1, N + 1)  {
        if (S[i - 1] == '.') cnt--;
        else cnt++;

        chmin(ans, cnt);
    }

    //if (S[N - 1] == '.') cnt--;
    //else cnt++;
    //chmin(ans, cnt);

    write(ans);
}

Measured memory_bytes: 720
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE BangPatterns #-}

-- Default Imports

import Control.Monad
import Control.Monad.ST
import Control.Monad.Trans.Class

import qualified Control.Monad.Reader as Reader
import Control.Monad.Reader (Reader, ReaderT, runReader, runReaderT)

import qualified Data.Array.MArray as MArray
import qualified Data.Array.ST as STArray
import Data.Array.ST (STArray, STUArray, runSTArray, runSTUArray)
import Data.Ix (Ix)

import qualified Data.Bits as Bits
import Data.Bits ((.&.), (.|.))

import qualified Data.ByteString.Char8 as BS
import Data.ByteString.Char8 (ByteString)

import qualified Data.Char as Char
import qualified Data.List as List
import qualified Data.Map.Strict as Map
import Data.Map.Strict (Map)
import qualified Data.Maybe as Maybe
import qualified Data.Set as Set
import Data.Set (Set)

import qualified Data.Vector as Vector
import qualified Data.Vector.Generic as GVector
import qualified Data.Vector.Mutable as MVector
import Data.Vector.Mutable (STVector)
import qualified Data.Vector.Unboxed as UVector

import Numeric

import Debug.Trace
-- ----------

-- Custom Import Here


-- ----------

-- Default Definitions

type Vector = Vector.Vector
-- type GVector = GVector.Vector
type UVector = UVector.Vector

readIntToList :: ByteString -> [Int]
readIntToList = List.unfoldr (fmap (second $ BS.dropWhile Char.isSpace) . BS.readInt)

readToList :: Read a => ByteString -> [a]
readToList = List.unfoldr $ fmap (mapTaken . mapRemain) . span' (not . Char.isSpace)
	where
		mapTaken  = first $ read . BS.unpack
		mapRemain = second $ BS.dropWhile Char.isSpace
		span' pred s
			| BS.null taken = Nothing
			| otherwise     = Just (taken, remain')
			where
				(taken, remain) = BS.span pred s
				remain' = BS.dropWhile Char.isSpace remain

readToListN :: Read a => Int -> ByteString -> [a]
readToListN n = take n . readToList

readIntToVector :: ByteString -> Vector Int
readIntToVector = Vector.unfoldr (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

readIntToUVector :: ByteString -> UVector.Vector Int
readIntToUVector = UVector.unfoldr (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

readIntToVectorN :: Int -> ByteString -> Vector.Vector Int
readIntToVectorN n = Vector.unfoldrN n (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace

readIntToUVectorN :: Int -> ByteString -> UVector.Vector Int
readIntToUVectorN n = UVector.unfoldrN n (fmap stripRemain . BS.readInt)
	where stripRemain = second $ BS.dropWhile Char.isSpace


first :: (a -> a') -> (a, b) -> (a', b)
first f (a, b) = (f a, b)

second :: (b -> b') -> (a, b) -> (a, b')
second f (a, b) = (a, f b)

average :: Fractional a => [a] -> a
average xs = sum xs / (fromIntegral . length) xs

-- ----------

main :: IO ()
main = do
	s <- getLine
	putStrLn $ if s == "ARC"
		then "ABC"
		else "ARC"


Measured memory_bytes: 3696
N,K = map(int,input().split())
p = list(map(int,input().split()))

def exp(n):
    if n % 2 == 0:
        s = (n+1)*n/2
    else:
        s = (n+1)*(n-1)/2+(n+1)/2
    ans = s / n
    return ans

q = []
for i in range(N):
    q.append(exp(p[i]))
#print(q)

S = sum([q[i] for i in range(K)])
M = S
#print(M)

for i in range(N-K):
    S = S - q[i] + q[K+i]
    #print(S)
    if S > M:
        M = S

print('{:.12f}'.format(M))

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

int main()
{
    long long N;
    int cents[] = {25, 10, 5, 1};
    std::scanf("%d", &N);
    long long sum = 0;
    for (int i = 0; i < 4; i++) {
        if (N == 0) break;
        sum += int(N / cents[i]);
        N = N % cents[i];
    }
    std::printf("%d\n", sum);
    return 0;
}



Measured memory_bytes: 3224
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		int b = in.nextInt(); in.nextLine();
		String s = in.nextLine();
		String ans = "No";
		if( s.contains("-") ) {
			String[] arr = s.split("-");
			if( arr.length == 2 ) {
				if( arr[0].length() == a && arr[1].length() == b ) ans = "Yes";
			}
		}
		System.out.println(ans);
	}

}

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

int main(){
  string s,t;
  cin >> s >> t;
  int i = 0;
  if(s[0] == t[0]){i++;}
  if(s[1] == t[1]){i++;}
  if(s[2] == t[2]){i++;}
    cout << i <<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <map>
#include <algorithm>
#include <cmath>
#include <vector>
#include <fstream>
#include <string>
#include <random>
#include <queue>
#include <iomanip>
#include <functional>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <limits>
#include <functional>

#define FOR(x,n) for(int x = 0; x < n; x++)
#define PUT(x) cout << x << endl
#define DPUT(x) printf("%.15lf\n",x)
#define GET(x,y) std::get<x>(y)
#define CHMAX(x,y) x = std::max(x,y)
#define CHMIN(x,y) x = std::min(x,y)

using namespace std;

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vll = std::vector<ll>;
using vpll = std::vector<pll>;
using vpii = std::vector<pii>;
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using vvpii = std::vector<vpii>;
using vch = std::vector<char>;
using vvch = std::vector<vch>;
using tiii = std::tuple<int, int, int>;

const ll mod197 = 1000000007LL;
const ll INF = 200LL * 200 * 100000 + 10;

const double PI11 = 3.14159265359;

const int dis[5] = { 0,1,0,-1,0 };

const int disD[4] = { 0,1,1,0 };

int n;
int c[500], s[500], f[500];

int main(void) {

	cin >> n;

	FOR(i, n - 1) {
		cin >> c[i] >> s[i] >> f[i];
	}

	FOR(i, n) {
		
		int now = 0;

		for (int j = i; j < n - 1; j++) {
			if (now < s[j]) {
				now = s[j];
				now += c[j];
			}
			else {
				int work = now - s[j];
				work = ((work + f[j] - 1) / f[j]) * f[j];
				now = s[j] + work + c[j];
			}
		}

		cout << now << endl;

	}

	return 0;
}

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

int main() {
    vector<long long>v(4,0);
    for(int i=0;i<4;i++) cin>>v[i];
    // for(int i=0;i<4;i++) cout<<v[i]<<" ";
    // cout<<endl;
    long long maxi1 = v[0]*v[2];
    long long maxi2 = v[0]*v[3];
    long long maxi3 = v[1]*v[2];
    long long maxi4 = v[1]*v[3];
    // long long maxi = maxi1;
    cout<<max(max(max(maxi1,maxi2),maxi3),maxi4)<<endl;
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define fix(f,n) std::fixed<<std::setprecision(n)<<f
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long int ll;
typedef unsigned long long int ull;
#define vi vector<ll>
#define pii pair<ll,ll>
#define vii vector<pii>
#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a>b)?b:a)
#define max3(a,b,c) ((a>b)?(a>c)?a:c:(b>c)?b:c)
#define min3(a,b,c) ((a<b)?(a<c)?a:c:(b<c)?b:c)
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define pb push_back
#define mp make_pair
#define mod 998244353
#define MAX 1000000001

struct segtree{
    int siz=1;
    vector<ll> nodes;
    segtree(ll n){
        while(siz<n){
            siz*=2;
        }
        nodes.assign(2*siz,0);
    }
    
    void set(int i,ll v,int x,int lx,int rx){
        if(lx==rx){
            nodes[x]=max(nodes[x],v);
            return;
        }
        int mid=(lx+rx)/2;
        if(mid>=i){
            set(i,v,2*x+1,lx,mid);
        }else{
            set(i,v,2*x+2,mid+1,rx);
        }
        nodes[x]=max(nodes[2*x+1],nodes[2*x+2]);
    }
    
    void set(int i,ll v){
        set(i,v,0,0,siz-1);
    }
    
    ll sum(int l,int r, int x,int lx,int rx){
        if(l>rx || r<lx){
            return 0;
        }else if(lx>=l && rx<=r){
            return nodes[x];
        }
        int mid=(lx+rx)/2;
        int s1= sum(l,r,2*x+1,lx,mid);
        int s2=sum(l,r,2*x+2,mid+1,rx);
        return max(s1,s2);
    }
    
    ll sum(int l,int r){
        return sum(l,r,0,0,siz-1);
    }
};

int main(){
	fast;
	int test=1;
	//cin >> test;
	while(test--){
	    int n,k;
	    cin >> n >> k;
	    segtree st(300001);
	    int ans=0;
	    for(int i=0 ; i<n ; i++){
	        int x;
	        cin >> x;
	        int temp=st.sum(max(0,x-k),min(x+k,300000))+1;
	        ans=max(ans,temp);
	        st.set(x,temp);
	    }
	    cout << ans << endl;
	}
	return 0;
}

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

int main()
{
  int N;
  cin >> N;
  int T, A;
  cin >> T >> A;
  
 
  vector<int> vec(N);
  int min_ind;
  double min = 1000000;
  
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
    if ( abs(T - vec.at(i) * 0.006 - A) < min) {
      min_ind = i+1;
      min = abs(T- vec.at(i) * 0.006 - A);
    }
  }
   cout << min_ind << endl;        
}

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

int main(){
    int a, b;
    cin >> a >> b;
    if(a == b){
    cout << "a == b" << endl;
    } 
    else if(a > b){
    cout << "a > b" << endl;
    } 

    else{
    cout << "a < b" << endl;
    } 
    return 0;
}

Measured memory_bytes: 1156
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    string s;
    ll K;
    cin >> s >> K;
    int one = 0;
    char res;
    rep(i,s.size()) {
        if (s.at(i) == '1') {
            one++;
            continue;
        } else {
            res = s.at(i); break;
        }
    }
    if (one >= K) {
        cout << 1 << endl;
    } else {
        cout << res << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int n=s.size();
  long long ans=0;
  for(int bit=0;bit<1<<n-1;bit++){
    long long t=(long long)s[0]-'0';
    for(int i=0;i<n-1;i++){
      if((bit>>i)&1){
        ans+=t;
        t=(long long)s[i+1]-'0';
      }
      else{
        t=t*10+s[i+1]-'0';
      }
    }
    ans+=t;
  }
  cout << ans << endl;
}

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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b,c,d; cin>>a>>b>>c>>d;
	int x=a+b, y=c+d;
	if(x>y) cout << "Left" << endl;
	else if(x<y) cout << "Right" << endl;
	else cout << "Balanced" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>

using namespace std;

int N, M;
int a[50], b[50];
bool graph[50][50];
bool checked[50];

void dfs(int v) {
    if (checked[v]) return;
    checked[v] = true;

    for (int w = 0; w < N; w++) {
        if (graph[v][w] == false) continue;
        if (checked[w] == true) continue;
        dfs(w);
    }
}

int main() {
    int ans = 0;
    cin >> N >> M;

    for (int i = 0; i < M; i++) {
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
        graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
    }

    for (int i = 0; i < M; i++) {
        graph[a[i]][b[i]] = graph[b[i]][a[i]] = false;

        for (int j = 0; j < N; j++) checked[j] = false;

        dfs(0);

        bool is_bridge = false;
        for (int j = 0; j < N; j++) {
            if (checked[j] == false) is_bridge = true;
        }

        if (is_bridge) ans++;

        graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
    }

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

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

if n < 105:
    print(0)
elif 105 <= n < 135:
    print(1)
elif 135 <= n < 165:
    print(2)
elif 165 <= n < 189:
    print(3)
elif 189 <= n < 195:
    print(4)
else:
    print(5)
    


Measured memory_bytes: 2940
#include <stdio.h>

void swap(int *a, int *b) {
    int temp = *a;
    *a = *b;
    *b = temp;
}

int bubbleSort(int A[],int N) {
    int i,j;
    int sw = 0;
    unsigned short flag = 1;
    for(i=0;flag;i++) {
        flag = 0;
        for(j=N-1;j>=i+1;j--) {
            if(A[j]<A[j-1]) {
                swap(&A[j],&A[j-1]);
                flag = 1;
                sw++;
            }
        }
    }
    return sw;
}

int main(void) {
    int i, A[100], N, sw;
    scanf("%d",&N);
    for(i=0;i<N;i++) scanf("%d",&A[i]);

    sw = bubbleSort(A,N);

    for(i=0;i<N;i++) {
        if (i) printf(" ");
        printf("%d",A[i]);
    }
    printf("\n%d\n",sw);

    return 0;
}





Measured memory_bytes: 1972
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner as = new Scanner(System.in);
		String a = as.next();
		String l = "NO";
		int n = a.length();
		boolean t = true;
		int alice = 0;
		for(int i=0;i<(n-1)/4;i++){
			//System.out.println(a.charAt(i));
			//System.out.println(a.charAt((n-1)/2-i-1));
			if(String.valueOf(a.charAt(i)).equals(String.valueOf(a.charAt((n-1)/2-i-1)))){
				t = true;
			}else{
				//System.out.println(i);
				t = false;
				break;
			}
		}
		//System.out.println(alice);
		if(t){
			alice++;
		}
		//System.out.println(alice);
		t = true;
		for(int i=0;i<(n-1)/4;i++){
			//System.out.println(a.charAt((n+3)/2+i-1));
			//System.out.println(a.charAt(n-i-1));
			if(String.valueOf(a.charAt((n+3)/2+i-1)).equals(String.valueOf(a.charAt(n-i-1)))){
				t = true;
			}else{
				t = false;
				break;
			}
		}
		if(t){
			alice++;
		}
		//System.out.println(alice);
		t = true;
		for(int i=0;i<n/2;i++){
			//System.out.println(a.charAt((n+3)/2+i-1));
			//System.out.println(a.charAt(n-i-1));
			if(String.valueOf(a.charAt(i)).equals(String.valueOf(a.charAt(n-i-1)))){
				t = true;
			}else{
				t = false;
				break;
			}
		}
		if(t){
			alice++;
		}
		//System.out.println(alice);
		if(alice == 3){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 22868
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int Q;
	cin >> Q;

	ll maeX = 0;
	ll atoX = 0;
	priority_queue<int> mae;
	priority_queue<int, vector<int>, greater<int>> ato;
	mae.push(-2e9);
	ato.push(2e9);
	int maeN = 0;
	int atoN = 0;
	ll B = 0;

	rep(i, Q) {
		int q;
		cin >> q;
		if (q == 1) {
			int a, b;
			cin >> a >> b;
			B += b;

			if (atoN != maeN) {
				int k = mae.top();
				if (a < k) {
					mae.pop();
					ato.push(k);
					mae.push(a);
					maeX += a - k;
					atoX += k;
				}
				else {
					ato.push(a);
					atoX += a;
				}
				atoN++;
			}
			else {
				int k = ato.top();
				if (a > k) {
					ato.pop();
					mae.push(k);
					ato.push(a);
					maeX += k;
					atoX += a - k;
				}
				else {
					mae.push(a);
					maeX += a;
				}
				maeN++;
			}
		}
		else {
			int k = mae.top();
			ll ans = (ll)maeN * k - maeX + atoX - (ll)atoN * k + B;
			cosp(k);
			co(ans);
		}
	}

	Would you please return 0;
}

Measured memory_bytes: 3452
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define INF_LL 1e18
#define INF 1e9

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

#define fst first
#define snd second

using namespace std;

using ll = long long;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;
using PLLL = pair<ll, PLL >;

ll MOD = 1e9+7;

int main(void){
	int n, m, h, k;
	while(cin >> n >> m >> h >> k && n && m && h && k){
	vector<ll> where, p;
	vector<PLL> row;
	vector<PLL> use;
	vector<ll> rp;
	
	REP(i, n){
		where.push_back(i);
		ll a;
		cin >> a;
		p.push_back(a);
		rp.push_back(0);
	}
	REP(i, m){
		ll a, b;
		cin >> a >> b;
		row.push_back({b, a});
	}
	sort(all(row));

	REP(i, row.size()){
		int l = row[i].second-1, r = l+1;
		swap(where[l], where[r]);
		use.push_back({where[l], where[r]});
	}
	ll total = 0;
	REP(i, n){
		rp[where[i]] = i;
		if(where[i] < k)
			total += p[i];
	}
	ll res = total;
	REP(i, m){
		int l = use[i].first, r = use[i].second;
		if((l < k && r < k) || (k <= l && k <= r)){
			res = min(res, total);
		}else if(l < k && r >= k){
			res = min(res, total-p[rp[l]]+p[rp[r]]);
		}else if(l >= k && r < k){
			res = min(res, total-p[rp[r]]+p[rp[l]]);
		}
	}
	cout << res << endl;
	}
}

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

namespace AtCoder
{
	public class Program
	{

		static void Main(string[] args)
		{
			string s = Console.ReadLine();

			int count1 = 0, count2 = 0;
			for (int i = 0; i < s.Length; i++) {
				char c = $"{i % 2}"[0];
				if (s[i] == c) {
					count1++;
				} else {
					count2++;
				}
			}
			Console.WriteLine(Math.Min(count1, count2));
		}
	}
}

Measured memory_bytes: 17500
# include <bits/stdc++.h>
# define maxn 100005
# define ll long long
# define clock (clock() * 1000.0 / CLOCKS_PER_SEC)
# define rc(s) return cout << s,0
# define _ ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
# define pb push_back
# define mp make_pair
# define int ll
using namespace std;

int c,s;

int32_t main(){_
	cin >> s >> c;
	c /= 2;
    if(c < s)
		rc(c);
	rc((s + c) / 2);
}


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

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

    
    if(n % 2 == 1) cout << 0;
    else{
        ll tmp = 5;
        ll ans = 0;
        while(tmp < n){
            ans += (n/tmp)/2;
            tmp *= 5;
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
use num::integer::gcd;
fn main() {
    input!{
        k: i32,
    }
    let mut ans = 0;
    for a in 1..k + 1 {
        for b in 1..k + 1 {
            for c in 1..k + 1 {
                ans += gcd(a, gcd(b, c));
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int N;
vector<P> x, y;
vector<vector<P>> graph(100001); //辺のコスト、行先の頂点
bitset<100001> bit;//各点を一度使ったかどうか

ll Prim(int start = 1){
    
    priority_queue<P, vector<P>, greater<P>> que;
    que.push(make_pair(0, start)); //頂点startから始める
    
    ll num = 0;
    while(!que.empty()){
        ll cost, next; tie(cost, next) = que.top(); que.pop();
        if(bit[next]) continue;
        bit[next] = true;
        num += cost;
        for(int i = 0; i < graph[next].size(); ++i) que.push(graph[next][i]);
    }
    
    return num;
}

int main(void){
	
	scanf("%d", &N);
	for(int i = 1; i <= N; ++i){
	    ll a, b; scanf("%lld %lld", &a, &b);
	    x.push_back(make_pair(a, i)), y.push_back(make_pair(b, i));
	}
	sort(x.begin(), x.end()), sort(y.begin(), y.end());
	
	for(int i = 0; i < x.size() - 1; ++i){
	    int t1 = x[i].second, t2 = x[i + 1].second;
	    ll c = abs(x[i].first - x[i + 1].first);
	    graph[t1].push_back(make_pair(c, t2));
	    graph[t2].push_back(make_pair(c, t1));
	}
	
	for(int i = 0; i < y.size() - 1; ++i){
	    int t1 = y[i].second, t2 = y[i + 1].second;
	    ll c = abs(y[i].first - y[i + 1].first);
	    graph[t1].push_back(make_pair(c, t2));
	    graph[t2].push_back(make_pair(c, t1));
	}
	
	printf("%lld\n", Prim());
	
    return 0;
}


Measured memory_bytes: 20580
// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>

using namespace std;

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

const int N = (int) 1e5 + 5, mod = 0;

int mark[N], cnt[N];

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < n; ++i)
        cnt[i] = 1;
    mark[0] = 1;
    while (m--) {
        int u, v;
        cin >> u >> v;
        --u, --v;
        mark[v] |= mark[u];
        cnt[u]--;
        if (!cnt[u])
            mark[u] = 0;
        cnt[v]++;
    }
    int res = 0;
    for (int i = 0; i < n; ++i)
        res += mark[i];
    cout << res << endl;


}








Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <queue>

#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <functional>
#include <iterator>

using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define INF 1<<29
#define ALEN(ARR) (sizeof(ARR) / sizeof((ARR)[0]))
#define MP make_pair
#define mp make_pair
#define pb push_back
#define PB push_back
#define _DEBUG(x) cout<<#x<<": "<<x<<endl
#define _DDEBUG(x,y) cout<<#x<<": "<<x<<", "<<#y<<": "<<y<<endl
#define ll long long
#define ull unsigned long long
#define MOD 1000000007

/** FOR VECTOR DEBUG */
template <typename T>
ostream& operator<< (ostream& out, const vector<T>& v) {
  if ( !v.empty() ) {
    out << '[';
    copy (v.begin(), v.end(), ostream_iterator<T>(out, ", "));
    out << "\b\b]";
  }
  return out;
}


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

    int n, mink;
    cin >> n >> mink;

    int xs[n];
    int ys[n];
    REP(i, n) cin >> xs[i] >> ys[i];

    set<int> xst(xs, xs + n);
    set<int> yst(ys, ys + n);

    ll ans = 1LL * (*xst.rbegin() - *xst.begin()) * (*yst.rbegin() - *yst.begin());

    REP(i, xst.size()) {
        FOR(j, i + 1, xst.size()) {
            REP(k, yst.size()) {
                FOR(l, k + 1, yst.size()) {

                    auto xiter1 = xst.begin();
                    auto xiter2 = xst.begin();
                    advance(xiter1, i);
                    advance(xiter2, j);
                    int ix = min(*xiter1, *xiter2);
                    int jx = max(*xiter1, *xiter2);
                    
                    auto yiter1 = yst.begin();
                    auto yiter2 = yst.begin();
                    advance(yiter1, k);
                    advance(yiter2, l);
                    int ky = min(*yiter1, *yiter2);
                    int ly = max(*yiter1, *yiter2);

                    int count = 0;
                    REP(m, n) {
                        if(ix <= xs[m] && xs[m] <= jx 
                                && ky <= ys[m] && ys[m] <= ly) {
                            count++;
                        }
                    }

                    if(count >= mink) {
                        ans = min(ans, 1LL * (jx - ix) * (ly - ky));
                    }
                }
            }
        }
    }
#if DEBUG
	cout << "** RESULT **" << endl; // debug
#endif
    cout << ans << endl;	
	return 0;
}


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

using namespace std;

typedef pair<int, int> P;

#define MP make_pair

const int INF = (1<<30);

char mp[1000][1000];

int h, w, n;

int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
P coords[10];

P s, g;
int memo[10][1000][1000];

int f(char c)
{
	if (c == 'S') return 0;
	if (c == '1') return 1;
	if (c == '2') return 2;
	if (c == '3') return 3;
	if (c == '4') return 4;
	if (c == '5') return 5;
	if (c == '6') return 6;
	if (c == '7') return 7;
	if (c == '8') return 8;
	if (c == '9') return 9;
}

int bfs(int goal) // arihon ha saikou
{
	queue<P> que;
	que.push(s);

	memo[goal][s.first][s.second] = 0;

	while (que.size()) {
		P p = que.front(); que.pop();
		if (p.first == g.first && p.second == g.second) break;

		for (int i = 0; i < 4; ++i) {
			int ny = p.first + dy[i], nx = p.second + dx[i];
			if (0 <= ny && ny < h && 0 <= nx && nx < w && mp[ny][nx] != 'X' && memo[goal][ny][nx] == INF) {
				que.push(MP(ny, nx));
				memo[goal][ny][nx] = memo[goal][p.first][p.second] + 1;
			}
		}
	}

	return memo[goal][g.first][g.second];
}

int main()
{
	cin >> h >> w >> n;

	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			cin >> mp[i][j];
			if (('1' <= mp[i][j] && mp[i][j] <= '9') || mp[i][j] == 'S') {
				int idx = f(mp[i][j]);
				coords[idx] = MP(i, j);
			}
		}
	}

	for (int i = 1; i <= n; ++i) {
		for (int j = 0; j < h; ++j) {
			for (int k = 0; k < w; ++k) {
				memo[i][j][k] = INF;
			}
		}
	}

	int ans = 0;

	for (int i = 1; i <= n; ++i) {
		s = coords[i - 1], g = coords[i];
		ans += bfs(i);
	}

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

Measured memory_bytes: 39196