akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main(){
  string s;
  cin >> s;
  int n=s.size();
  
  vector<int> a(n,0);
  int i,c=0;
  for(i=0;i<n;i++){
    if(s.at(i)=='R'){
      c++;
    }else{
      a.at(i) += c/2;
      a.at(i-1) += (c+1)/2;
      c=0;
    }
  }
  
  c=0;
  for(i=n-1;i>=0;i--){
    if(s.at(i)=='L'){
      c++;
    }else{
      a.at(i) += c/2;
      a.at(i+1) += (c+1)/2;
      c=0;
    }
  }
  
  for(i=0;i<n;i++){
    cout << a.at(i) << " ";
  }
}

Measured memory_bytes: 3792
// https://atcoder.jp/contests/abc144/tasks/abc144_f

#include "algorithm"
#include "iomanip"
#include "iostream"
#include "queue"
#include "set"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

void solve() {
  ll N, M;
  cin >> N >> M;

  VVL edges(N);
  rep(i, M) {
    ll s, t;
    cin >> s >> t;
    s--, t--;
    edges[s].push_back(t);
  }

  // その頂点から点 N までの辺の数の期待値
  V<double> dp(N);
  for (ll u = N - 2; u >= 0; u--) {
    double e = 0;

    for (auto v : edges[u]) {
      e += dp[v];
    }

    ll deg = edges[u].size();
    e /= deg;
    e++;
    dp[u] = e;
  }

  double res = dp[0];

  // 各頂点について、期待値の大きい点への辺を消す
  rep(ru, N - 1) {
    if (edges[ru].size() == 1) continue;

    ll rm_to;
    {
      double max_e = -1;
      for (auto rv : edges[ru]) {
        if (chmax(max_e, dp[rv])) rm_to = rv;
      }
    }

    {
      V<double> dp(N);
      for (ll u = N - 2; u >= 0; u--) {
        double e = 0;

        for (auto v : edges[u]) {
          if (u == ru && v == rm_to) continue;
          e += dp[v];
        }

        ll deg = edges[u].size();
        if (u == ru) deg--;

        e /= deg;
        e++;
        dp[u] = e;
      }

      chmin(res, dp[0]);
    }
  }

  cout << fixed << setprecision(10) << res << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 2560
#include<iostream>
using namespace std;
const int M=105;
int a[M],b[M];
int main()
{
    int N;
    cin>>N;
    int j=1,i;
    for(i=1;i<=N;i++)
    {
        cin>>a[i];
        if(a[i]%2==0)
        {
            b[j]=a[i];
            j++;
        }
    }
    for(i=1;i<j;i++)
    if(b[i]%3!=0&&b[i]%5!=0)
    {
    cout<<"DENIED"<<endl;
    break;
    }
    if(i==j)
    cout<<"APPROVED"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <set>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

using namespace std;

const int N = 1234567;
int a[N],b[N],c[N];

int main() {
    int x,n;
    scanf("%d", &n);
    for (int i=1;i<=n;i++) {
        scanf("%d",&a[i]);
        b[a[i]]++;
    }

    for (int i=1;i<=1000010;i++) {
        if (b[i]>0) {
            for (int j=i;j<=1000010;j+=i) c[j]+=b[i];
        }
    }

    int ans=0;
    for (int i=1;i<=n;i++)
        if (c[a[i]]<=1) ans++;
    cout<<ans;

    return 0;
}


Measured memory_bytes: 12112
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()
const long long INF = 1e15;
using namespace std;
typedef long long ll;
int main() {
  ll n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  ll cnt = 0;
  REP(i, n - 1) {
    if (s[i] == s[i + 1]) cnt++;
  }
  cout << min(cnt + 2 * k, n - 1) << endl;
  return 0;
}

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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);

string vow = "aeiou";

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

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

const ld pie = 3.14159265358979 ;
const ll mod = 1e9 + 7 ;

void solve ( int test_case )
{
    string s ; cin >> s ;

    int n = s.size() ;
    int ans = 0 ;

    for ( int i=0 ; i < n/2 ; i ++ )
    {
        if ( s[i] == s[n-1-i] ) C ;
        ans ++ ;
    }

    cout << ans ; line
}

int main()
{
    int t = 1;
    // cin >> t;

    for ( int i=0 ; i < t ; i++ ) solve(i);
    return 0;
}


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

int n, a, ans;

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n;
	while(n--) {
		cin >> a;
		ans += a - 1;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 892
using System;

namespace abc156B
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            int N = int.Parse(str[0]);
            int K = int.Parse(str[1]);
            int A = 0;
            while (N >= 1)
            {
                N = N / K;
                A += 1;
            }
            Console.WriteLine(A);
        }
    }
}


Measured memory_bytes: 11092
#include <stdio.h>
#include <string.h>
int main(void){
  char w[500][33]={'\0'},ans[2][33];
  int i=0,j=0,c,m1,m2,n,cnt[500]={0};
  while((c=getchar())!=EOF){
    if(c==' '){
      i++;
      j=0;
    }
    else
      w[i][j++]=c;
  }
  n=++i;
  m1=m2=0;
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      if(strcmp(w[i],w[j])==0)cnt[i]++;
    }
    if(m1<cnt[i]){
      m1=cnt[i];
      strcpy(ans[0],w[i]);
    }
    if(m2<strlen(w[i])){
      m2=strlen(w[i]);
      strcpy(ans[1],w[i]);
    }
  }
  printf("%s %s\n",ans[0],ans[1]);
  return 0;
}

Measured memory_bytes: 548
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
int main(){
int n,ans=0;
  cin>>n;
  vector<int> h(n);
  REP(i,n){cin>>h[i];}
  int t=0;
  REP(i,n-1){
  if(h[i]>=h[i+1])t++;
    else t=0;
    ans=max(t,ans);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3780
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int h = sc.nextInt();
		
		System.out.println((a + b) * h / 2);

	}

}

Measured memory_bytes: 35688
#include<iostream>
#include<vector>
#include<queue>
#include<map>
#include<cmath>
using namespace std;
int n, m, a, b, d, u[200000]; vector<int>x[100000], c[100000], H; bool used[100000], f[200009], g[200009];
vector<pair<int, int>>I;
bool solve() {
	vector<int>col(n, -1);
	for (int i = 0; i < d; i++) {
		queue<int>Q; col[c[i][0]] = 0; Q.push(c[i][0]);
		while (!Q.empty()) {
			int a1 = Q.front(); Q.pop();
			for (int j : x[a1]) {
				if (col[j] == -1) { Q.push(j); col[j] = 1 - col[a1]; }
				else if (col[j] == col[a1]) { return false; }
			}
		}
		int v = 0; for (int j = 0; j < c[i].size(); j++) { if (col[c[i][j]] == 0)v++; else v--; }
		H.push_back(abs(v));
	}
	return true;
}
void knapsack() {
	for (int i = 0; i <= n * 2; i++)f[i] = false; f[n] = true;
	for (int i = 0; i < I.size(); i++) {
		for (int j = 0; j <= n * 2; j++) { g[j] = false; u[j] = -1; }
		for (int j = 0; j <= n * 2; j++) {
			if (f[j] == false)continue;
			int r1 = I[i].first * 2;
			if (r1 == 0) { g[j] = true; continue; }
			int r3 = I[i].first*I[i].second*-1, r4 = -r3; r4 += j; r3 += j;
			r3 = max(r3, u[r3%r1]);
			for (int k = r3; k <= r4; k += r1) { g[k] = true; u[k%r1] = k; }
		}
		for (int j = 0; j <= n * 2; j++)f[j] = g[j];
	}
}
int main() {
	cin >> n >> m; for (int i = 0; i < m; i++) { cin >> a >> b; a--; b--; x[a].push_back(b); x[b].push_back(a); }
	for (int i = 0; i < n; i++) {
		if (used[i] == true)continue; queue<int>Q;
		Q.push(i); used[i] = true;
		while (!Q.empty()) {
			int a1 = Q.front(); Q.pop(); c[d].push_back(a1);
			for (int j : x[a1]) {
				if (used[j] == false) { Q.push(j); used[j] = true; }
			}
		}
		d++;
	}
	bool U = solve(); map<int, int>M, M2;
	if (U == false) { cout << "-1" << endl; return 0; }
	for (int i = 0; i < H.size(); i++) M[H[i]]++;
	for (int i = 0; i < H.size(); i++) {
		if (M2[H[i]] == 0) { M2[H[i]] = 1; I.push_back(make_pair(H[i], M[H[i]])); }
	}
	knapsack();
	long long ret = 0;
	for (int i = 0; i <= n; i++) { if (f[2 * i] == true)ret = max(ret, 1LL * (n - i)*i); }
	cout << ret - m << endl;
	return 0;
}

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

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

int main() {
  ll n,k,INF=10000000000;
  cin >> n >>k;
  vector<ll>h(n);
  rep(i,n) cin >> h.at(i);
  vector<ll>dp(n+105,INF);
  dp.at(0)=0;
  rep(i,n-1) rep(j,k) chmin(dp[i+j+1],dp[i]+abs(h[i+j+1]-h[i]));
  cout << dp[n-1] << endl;
}


Measured memory_bytes: 1792
'use strict';
function Main(input) {

	input = input.trim().split("\n");
  
  	let count = 0;
  	for(let i = 1 ; i< input.length; i++){
      let nums = input[i].split(" ");
      let a = nums[0];
      let b = nums[1];
      if(a === b){
        count++;
		if(count >= 3){
          console.log("Yes");
          return;
        }
      }else{
        count = 0;
      }
    }
    	console.log('No');
}



//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29684
#include<bits/stdc++.h>
using namespace std;
const int N=100;
int a[N];
int main(){
	int cnt=0;
	for(int i=1;i<=9;i++){
		for(int j=i;j<=9;j++){
			a[cnt++]=i*j;
		}
	}
	int n;
	cin>>n;
	for(int i=0;i<cnt;i++){
		if(n==a[i]){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

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

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

int N, K;
int V;
vector<pi> B;
vector<int> C;
vector<ll> bit;

void init(int n) {
	V = 1;
	while (V < n)
		V <<= 1;
}

ll sum(int i) {
	ll s = 0;
	while (i > 0) {
		s += bit[i];
		i -= i & (-i);
	}
	return s;
}

void add(int i, int x) {
	while (i <= V) {
		bit[i] += x;
		i += i & (-i);
	}
}

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

	cin >> N >> K;
	B.resize(N + 1, make_pair(0LL, 0));
	for (int i = 1; i <= N; ++i) {
		int a;
		cin >> a;
		B[i].first = B[i - 1].first + a - K;
		B[i].second = i;
	}

	C.resize(N + 1);
	sort(B.begin(), B.end());
	int idx = -1;
	for (int i = 0; i <= N; ++i) {
		if (idx < 0)
			idx = i + 1;
		else if (B[i].first != B[i - 1].first)
			idx = i + 1;
		C[B[i].second] = idx;
	}

	init(N + 1);
	bit.resize(V + 1, 0);
	ll ans = 0;
	for (int i = 0; i <= N; ++i) {
		ans += sum(C[i]);
		add(C[i], 1);
	}

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


Measured memory_bytes: 6272
#include <stdio.h>
#include<stdlib.h>
#include<string.h>

int top, S[1000];

void push(int x){
    S[++top] = x;
}

int pop(){
    return S[top--];
}


int main(void){
    // Your code here!
    int a, b;
    top = 0;
    char s[100];
    
    while (scanf("%s", s) != EOF){
        if ( s[0] == '+'){
            a = pop();
            b = pop();
            push (a + b);
        }else if ( s[0] == '-'){
            b = pop();
            a = pop();
            push(a - b);
        }else if ( s[0] == '*'){
            a = pop();
            b = pop();
            push(a*b);
        }else{
            push(atoi(s));
        }
    }
    printf("%d\n", pop());
    
    return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;


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;
}
int main() {
    int N, lim = 0;
    cin >> N;
    vector<int>A(N), D(N);

    for (size_t i = 0; i < N; i++)
    {
        cin >> A.at(i);
        lim = max(lim, A.at(i));//lim:距離の最大値を持っておく
        D.at(A.at(i))++;
    }

    long long ans = 1;
    if (A.at(0) != 0 || D.at(0) != 1){cout << 0; return 0;}
    for (size_t i = 1; i <= lim; i++)
    {
        ans *= modpow(D.at(i - 1), D.at(i), 998244353);
        ans %= 998244353;
    }
    cout << ans;
}

Measured memory_bytes: 1152
#include <iostream>
#include <fstream>
#include <bits/stdc++.h>
#include <map>
#define pb push_back
#define ll long long
#define pii pair <int,int>
#define eb emplace_back
#define pll pair <long, long>
using namespace std;
using namespace std;
int N;
ll a[3010],X,Y;
ll dp[3010][3010];
int main()
{
    int i,j;
    cin>>N;
    for(i=1;i<=N;i++)
    {
        cin>>a[i];
    }
    for(i=N;i>=1;i--)
        for(j=i;j<=N;j++)
    {
        if(i==j)
        {
            dp[i][j]=a[i];
        }
        else
        {
            dp[i][j]=max(a[i]-dp[i+1][j],a[j]-dp[i][j-1]);
        }
    }
//    for(i=N;i>=1;i--)
//      {
//        for(j=i;j<=N;j++)
//        {
//        cout<<dp[i][j]<<" ";
//        }
//        cout<<endl;
//    }
    cout<<dp[1][N];
    //cout<<X<<" "<<Y<<" "<<X-Y<<"\n";
    return 0;
}


Measured memory_bytes: 70016
import Foundation
import CoreFoundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element? {
        return self.maxElement()
    }
    func min() -> Element? {
        return self.minElement()
    }
    func sorted() -> Array {
        return self.sort()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    func reversed() -> Array {
        return self.reverse()
    }
    func enumerated() -> EnumerateSequence<[Element]> {
        return self.enumerate()
    }
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}
//func gcd(x: Int, _ y: Int) -> Int {
//    if y == 0 {
//        return x
//    } else {
//        return gcd(y, x%y)
//    }
//}
//func lcm(x: Int, _ y: Int) -> Int {
//    return x * y / gcd(x, y)
//}

/*************** テストスペース ***************/

//arr.sort{$0.0==$1.0 ? $0.1<$1.1 : $0.0<$1.0}  // 2つの条件に優先順位をつけてソート

/*************** メインプログラム ***************/

let input = readIntSplit(by: " ")
let (N, K) = (input[0], input[1])
print(K==1 ? 0 : N-K)


Measured memory_bytes: 7780
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>
#include <tuple>

//#include "All.h"

using namespace std;

#define EPS (1e-9)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i,a,n) for(int i=a;i<n;i++)
#define rep(i, n) REP(i,0,n)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")

using ll = long long int;

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

ll beki(ll a, ll b) {
    ll tmp = 1;
    rep(i, b) tmp *= a;
    return tmp;
}

//アクセス指定子

int A, B, C, D;

int main() {
    cin >> A >> B >> C >> D;
    cout << Yes((C + (B - 1)) / B <= (A + (D - 1)) / D) << endl;
}

Measured memory_bytes: 3640
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
#include<map>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1001001001;

ll pow_mod(ll p, ll n, ll m) {
	if (n == 0) return 1;
	else if (n == 1) return p % m;
	else if (n % 2 == 1) return p * pow_mod(p, n - 1, m) % m;
	else {
		ll tmp = pow_mod(p, n / 2, m);
		return (tmp * tmp) % m;
	}
}

ll gcd(ll x, ll y) {
	if (y == 0) {
		return x;
	}
	return gcd(y, x % y);
}

ll com_mod(ll n, ll k, ll m) {
	if (k == 0) return 1;
	else {
		ll x = 1;
		ll y = 1;
		for (ll i = 0; i < k; i++) {
			x = (x * (n - i)) % m;
			y = (y * (i + 1)) % m;
		}
		ll res = (x * pow_mod(y, m - 2, m)) % m;
		return res;
	}
}

int main() {
	int n, k, x, y; cin >> n >> k >> x >> y;
	if (n <= k)cout << n * x << endl;
	else cout << k * x + (n - k) * y << endl;
	return 0;
}

Measured memory_bytes: 3640
#include <cstdio>
#include <vector>
#include <algorithm>
#include <bitset>
#include <iostream>
using namespace std;

bitset<10005> board[10];
int ans;
void DFS(int cur_r,const int r,const int c)
{
    if(cur_r==r){
        int res = 0;
        for(int cc = 0;cc < c;cc++){
            int c_num ,c_cnt=0;
            for(int rr = 0;rr < r;rr++){
                if(board[rr][cc]==1)
                    c_cnt++;
            }
            if(c_cnt > r/2)
                c_num = c_cnt;
            else
                c_num = r - c_cnt;
            res += c_num;
        }
        ans = max(ans,res);
        return ;
    }

    DFS(cur_r+1,r,c);
    board[cur_r].flip();
    DFS(cur_r+1,r,c);
    return ;
}

int main()
{   
    // freopen("in","r",stdin);
    int r,c;
    while(scanf("%d%d",&r,&c)&&(r+c)){
        for(int i=0;i<r;i++){
            for(int j=0;j<c;j++){
                int n;
                scanf("%d\n",&n);
                board[i][j] = n;
            }
        }
        ans = 0;
        DFS(0,r,c);
        printf("%d\n",ans);
    }
    return 0;
}

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

int N;

signed main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> N;
    int ans = 1000000000000;
    for (int i=1; i*i<=N; i++) {
        if (N%i==0) {
            int A = i;
            int B = N/i;
            int a = to_string(A).size();
            int b = to_string(B).size();
            ans = min(ans, max(a, b));
        }
    }
    cout << ans << endl;
}

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

int main() {
    int N;
    int t[110000], x[110000], y[110000];
    cin >> N;
    t[0] = x[0] = y[0] = 0;  // 初期状態
    for (int i = 0; i < N; ++i) cin >> t[i+1] >> x[i+1] >> y[i+1];  // 1-index にしておく

    bool can = true;
    for (int i = 0; i < N; ++i) {
        int dt = t[i+1] - t[i];
        int dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]);
        if (dt < dist) can = false;
        if (dist % 2 != dt % 2) can = false;  // dist と dt の偶奇は一致する必要あり！
    }

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

Measured memory_bytes: 4756
n = int(input())
ans = 0
for i in range(1, n + 1):
    if i % 2 == 1:
        cnt = 0
        for j in range(1, i + 1):
            if i % j == 0:
                cnt += 1
        if cnt == 8:
            ans += 1
print(ans)

Measured memory_bytes: 2940
def solve():
    import sys

    input = sys.stdin.readline

    n, m = map(int, input().split())
    edges = tuple(set() for _ in range(n))

    for _ in range(m):
        s, t = map(int, input().split())
        edges[s - 1].add(t - 1)

    ans = float('inf')
    for del_vertical in range(n):
        E = [0] * n
        # E[n - 1] = 0
        for v in reversed(range(n - 1)):
            mx = -1
            for u in edges[v]:
                E[v] += E[u]
                if mx < E[u]:
                    mx = E[u]
            if v == del_vertical and len(edges[v]) > 1:
                E[v] = (E[v] - mx) / (len(edges[v]) - 1) + 1
            else:
                E[v] = E[v] / len(edges[v]) + 1
        ans = min(ans, E[0])
    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 60252
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

ll mpow(ll a, ll b){
	if(b==0) return 1;
	else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
	else return mpow(a,b-1) * a % MOD;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
	if(kaijo_memo.size() > n) return kaijo_memo[n];
	if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
	while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
	return kaijo_memo[n];
}
ll nCr(ll n, ll r){
	if(n < r || r < 0) return 0;
	ll ret = 1;
	ret *= kaijo(n); ret %= MOD;
	ret *= mpow(kaijo(r), MOD-2); ret %= MOD;
	ret *= mpow(kaijo(n-r), MOD-2); ret %= MOD;
	return ret;
}

int main(void){
	ll k,x;
	cin>>k>>x;
	for(ll i=-1e6; i<=1e6; i++){
		if(abs(i-x) <= k-1){
			cout<<i<<" ";
		}
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n; cin >> n;
    vector<vector<int>> dp(n, vector<int>(3));
    int a, b, c;
    cin >> a >> b >> c;
    dp[0][0] = a; dp[0][1] = b; dp[0][2] = c;
    for(int i=0; i+1<n; ++i){
        cin >> a >> b >> c;
        dp[i+1][0] = max(dp[i][1], dp[i][2]) + a; 
        dp[i+1][1] = max(dp[i][2], dp[i][0]) + b; 
        dp[i+1][2] = max(dp[i][0], dp[i][1]) + c; 
    }
    int res = max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2]));
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 8772
n, t = map(int, input().split())
time = list(map(int, input().split()))

diff = [t1 - t0 for t0, t1 in zip(time, time[1:])]

ans = 0
for dt in diff:
    if dt <= t:
        ans += dt
    else:
        ans += t

print(ans + t)


Measured memory_bytes: 30824
#include <bits/stdc++.h>
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int,int> PII;

#define REP(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for (int i=(a); i<(b); ++i)
#define FORD(i,a,b) for (int i=(a)-1; i>=(b); --i)

#define pb push_back
#define mp make_pair
#define st first
#define nd second

const int MOD = 1000000007;

int main() {
  // ios_base::sync_with_stdio(0);

  LL N, A, B;
  scanf("%lld%lld%lld", &N, &A, &B);
  if (A > B) swap(A,B);
  LL result = 0;
  if (A % 2 != B % 2) {
    result = min(A - 1, N - B) + 1;
  }
  result += (B-A)/2;
  printf("%lld\n", result);
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
#define N 123
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int n,m,a[N][N],G[N][N],b[N][N],c[N][N],vis[N],match[N];
vector<int> num[N][N];
bool dfs(int u){
	for(int v=1;v<=n;++v){
		if(vis[v]||!G[u][v])continue;
		vis[v]=1;
		if(!match[v]||dfs(match[v])){
			match[v]=u;
			return true;
		}
	}
	return false;
}
void Match(){
	memset(match,0,sizeof(match));
	for(int i=1;i<=n;++i){
		memset(vis,0,sizeof(vis));
		dfs(i);
	}
}
int main(){
	n=read(),m=read();
	for(int i=1;i<=n;++i){
		for(int j=1;j<=m;++j){
			a[i][j]=read();
			num[i][(a[i][j]-1)/m+1].push_back(a[i][j]);
		}
	}
	for(int p=1;p<=m;++p){
		memset(G,0,sizeof(G));
		for(int i=1;i<=n;++i){
			for(int j=1;j<=n;++j){
				if(!num[i][j].empty()){
					G[i][j]=1;	
				}
			}
		}
		Match();
		for(int i=1;i<=n;++i){
			b[match[i]][p]=num[match[i]][i].back();
			num[match[i]][i].pop_back();
		}
	}

	for(int i=1;i<=n;++i){
		for(int j=1;j<=m;++j){
			printf("%d ",b[i][j]);
		}
		printf("\n");
	}
	for(int j=1;j<=m;++j){
		static int tmp[N];
		for(int i=1;i<=n;++i){
			tmp[i]=b[i][j];
		}
		sort(tmp+1,tmp+n+1);
		for(int i=1;i<=n;++i){
			c[i][j]=tmp[i];
		}
	}
	for(int i=1;i<=n;++i){
		for(int j=1;j<=m;++j){
			printf("%d ",c[i][j]);
		}
		printf("\n");
	}
	return 0;
}



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

#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

template<typename T,typename U>bool chmin(T& a,const U& b){return a>b?(a=b,1):0;}
template<typename T,typename U>bool chmax(T& a,const U& b){return a<b?(a=b,1):0;}

void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
	print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}

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

template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
	print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<0,Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int main()
{
	#ifndef _GLIBCXX_DEBUG
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	constexpr char endl='\n';
	#endif

	for(int a,b,c;cin>>a>>b>>c;){
		int cure=a+b;
		int nice=b+min(cure+1,c);
		cout<<nice<<endl;
	}
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        int cntAC = 0;
        int cntWA = 0;
        int cntTLE = 0;
        int cntRE = 0;

        for(int i = 0; i < N; i++)
        {
            string input = Console.ReadLine();
            if (input == "AC") cntAC++;
            else if (input == "WA") cntWA++;
            else if (input == "TLE") cntTLE++;
            else if (input == "RE") cntRE++;
        }



        Console.WriteLine("AC x " + cntAC);
        Console.WriteLine("WA x " + cntWA);
        Console.WriteLine("TLE x " + cntTLE);
        Console.WriteLine("RE x " + cntRE);
    }

}



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

int main(){
    long long a,b,c,d,n,lcm,f_a,f_b;
    cin>>a>>b>>c>>d;
    lcm=(c*d)/(__gcd(c,d));
    f_b=(b-(b/c)-(b/d)+(b/lcm));
    a=a-1;
    f_a=(a-(a/c)-(a/d)+(a/lcm));


    printf("%lld\n",f_b-f_a);


return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
#include <chrono>
using namespace std;
 
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;
 
//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a)  (a).begin(),(a).end()
//constant
//--------------------------------------------
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

int main(){
    string S;cin>>S;
    string res="";
    if(S[SZ(S)-1]=='3')res="bon";
    else if(S[SZ(S)-1]=='0'||S[SZ(S)-1]=='1'||S[SZ(S)-1]=='6'||S[SZ(S)-1]=='8')res="pon";
    else res="hon";
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 3596
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<stdlib.h>
#include<vector>
#include<map>
#include<set>
#define ll long long int

using namespace std;

int n;
int L[200];
int main(){
  cin>>n;
  for(int i=0;i<2*n;i++){
    cin>>L[i];
  }
  sort(L,L+n*2);
  int sum = 0;
  for(int i=0;i<2*n;i=i+1){
    sum+=min(L[i],L[i+1]);
    i++;
  }
  cout<<sum<<endl;
  return 0;
}


Measured memory_bytes: 256
while True:
  H,W = map(int, input().split())
  if W==0 and H==0:
   break
  for i in range(H):
    for j in range(W):
      if i==0 or i==H-1 or j==0 or j==W-1:
        print('#', end="")
      else:
        print('.',end="")
    print()
  print()


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

int main()
{
    string b;
	string c;
	int count = 0;
	int maxcount = 0;
    
    cin >> b;

	for(size_t i = 0; i < b.length(); i++)
	{
		c = b[i];
		if( c == "A" || c == "T" || c == "C" || c == "G" ){
			count++;
		} else{
			if( count > maxcount ){
				maxcount = count;
			}
			count = 0;
		}
	}

	if( count != 0 && count > maxcount ){
		cout << count << endl;
	} else {
		cout << maxcount << endl;
	}
	

	return 0;
}

Measured memory_bytes: 256
// AtCoder Grand Contest 014
// C - Closed Rooms

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;


const int MAX_H = 800;
const int MAX_W = 800;
const int INF = 1e8;

int H, W, K;
bool rooms[MAX_H][MAX_W];
queue<pii> q;
int dist[MAX_H][MAX_W];
int dh[4] = { -1, 0, 1, 0 };
int dw[4] = { 0, 1, 0, -1 };

int main() {

    string s;
    int ans;

    cin >> H >> W >> K;
    for (int i = 0; i < H; i++) {
        cin >> s;
        for (int j = 0; j < W; j++) {
            rooms[i][j] = (s[j] != '#');
            dist[i][j] = INF;
            if (s[j] == 'S') {
                q.push(pii(i, j));
                dist[i][j] = 0;
            }
        }
    }

    ans = INF;
    while (!q.empty()) {
        auto p = q.front(); q.pop();
        int h = p.first;
        int w = p.second;
        int d = min(min(h, w), min(H - 1 - h, W - 1 - w));

        if (dist[h][w] <= K) {
            ans = min(ans, (d + K - 1) / K + 1);
            for (int k = 0; k < 4; k++) {
                int i = h + dh[k];
                int j = w + dw[k];
                if (0 <= i && i < H && 0 <= j && j < W && rooms[i][j] && dist[i][j] > dist[h][w] + 1) {
                    dist[i][j] = dist[h][w] + 1;
                    q.push(pii(i, j));
                }
            }
        }
    }

    cout << ans << endl;

    return 0;

}





Measured memory_bytes: 3456
import java.util.Scanner;

/**
 * How many ways?
 */
public class Main {
    private static Scanner scan;

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

        // n までの数,３つの数の合計x
        int n,x = 0;
        int i,j,k = 1;
        while (true) {
            int cnt = 0;
            n = scan.nextInt();
            x = scan.nextInt();
            if (n == 0 && x == 0) {
                return;
            }
            for (i = 1; i <= n; i++) {
                for (j = i; j <= n; j++) {
                    for (k = j; k <= n; k++) {
                        // 重複していないかつ合計が一致
                        if (x == (i + j + k) && !(i == j) && !(j == k) && !(i == k)) {
                            ++ cnt;
                            break;
                        }
                    }
                }
            }
            System.out.println(cnt);
        }
    }
}

Measured memory_bytes: 19660
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

Int n, m, x, y;
vector<int> edge[110000];
Int dp1[110000];
Int dp2[110000];

void dfs1(int x, int last = -1){
    Int prod= 1;
    for(auto to:edge[x]){
        if(to == last)continue;
        dfs1(to, x);
        prod = prod * dp1[to] % m;
    }
    dp1[x] = prod + 1;
}

void dfs2(int x, int last = -1){
    if(last == -1)dp2[x] = 1;
    vector<Int> lprod= vector<Int>(edge[x].size(), 1);
    vector<Int> rprod= vector<Int>(edge[x].size(), 1);
    for(Int i = 0;i < edge[x].size();i++){
        int to = edge[x][i];
        if(i-1 >= 0)lprod[i] = lprod[i-1];
        if(to == last)continue;
        lprod[i] *= dp1[to];lprod[i] %= m;
    }
    for(Int i = (int)edge[x].size() - 1;i >= 0;i--){
        int to = edge[x][i];
        if(i+1 < rprod.size())rprod[i] = rprod[i+1];
        if(to == last)continue;
        rprod[i] *= dp1[to];rprod[i] %= m;
    }
    for(Int i = 0;i < edge[x].size();i++){
        int to = edge[x][i];
        if(to == last)continue;
        Int rest_prod = 1;
        if(i-1 >= 0)rest_prod = rest_prod * lprod[i-1] % m;
        if(i+1 < rprod.size())rest_prod = rest_prod * rprod[i+1] % m;
        dp2[to] = (dp2[x] * rest_prod + 1) % m;
        dfs2(to, x);
    }
}

Int ans[110000];

void dfs3(int x, int last = -1){
    ans[x] = dp2[x];
    for(auto to:edge[x]){
        if(to == last)continue;
        ans[x] *= dp1[to];
        ans[x] %= m;
        dfs3(to, x);
    }
}

int main(){
    cin >> n >> m;
    for(int i = 0;i < n-1;i++){
        cin >> x >> y;
        edge[x].push_back(y);
        edge[y].push_back(x);
    }

    dfs1(1);
    dfs2(1);
    dfs3(1);

    for(int i = 1;i <= n;i++){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 20608
#include<iostream>
#include<string>
using namespace std;
int r[1000][1000], b[1000][1000], H, W;
int main() {
	cin >> H >> W;
	for (int i = 0; i < H; i++) { r[i][0] = 1; b[i][W - 1] = 1; }
	for (int i = 0; i < H; i++) {
		for (int j = 1; j < W - 1; j++) {
			if (i % 2 == 0)r[i][j] = 1;
			if (i % 2 == 1)b[i][j] = 1;
		}
	}
	for (int i = 0; i < H; i++) {
		string S; cin >> S;
		for (int j = 0; j < S.size(); j++) {
			if (S[j] == '.')continue;
			if (i % 2 == 0)b[i][j] = 1; if (i % 2 == 1)r[i][j] = 1;
		}
	}
	for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { if (r[i][j] == 1)cout << "#"; else cout << "."; }cout << endl; }cout << endl;
	for (int i = 0; i < H; i++) { for (int j = 0; j < W; j++) { if (b[i][j] == 1)cout << "#"; else cout << "."; }cout << endl; }
	return 0;
}

Measured memory_bytes: 4608
#include <stdio.h>

int main() {
  int a, b, c, d, e;
  int res;

  scanf("%d%d%d%d%d", &a, &b, &c, &d, &e);

  if (a <= 0) {
    res = (-a) * c + d + e * b;
  } else {
    res = (b - a) * e;
  }

  printf("%d\n", res);

  return 0;
}

Measured memory_bytes: 1800
a = list(map(int, input().split()))
b = 0
for i in range(len(a)):
    for j in range(len(a)):
        if i != j:
            if b == 0:
                b = a[i] + a[j]
            else:
                b = min(b, a[i] + a[j])
print(b)


Measured memory_bytes: 2940
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <typeinfo>
#include <math.h>
#include <iomanip>
#include <limits>

using namespace std;
using ll = long long;
const ll res = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
	ll n, m, cnt=0, sm=0;
	cin >> n >> m;
	vector<int> a(n);
	rep(i, n) {
		cin >> a[i];
		sm += a[i];
	}
	rep(i, n) {
		if (a[i]*4*m >= sm)
			cnt++;
	}
	if (cnt >= m)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

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

int N;


bool isCorrectSevenFiveThreeNumber(long long number)
{
	bool isAppearThree = false, isAppearFive = false, isAppearSeven = false;
	while (number != 0)
	{
		int e = number % 10;
		switch (e)
		{
		case 3:
			isAppearThree = true;
			break;
		case 5:
			isAppearFive = true;
			break;
		case 7:
			isAppearSeven = true;
			break;
		}
		number /= 10;
	}
	return isAppearThree && isAppearFive && isAppearSeven;
}

int BruteForce(long long number, int k)
{
	if (k == 0)
	{
		if (number > N || isCorrectSevenFiveThreeNumber(number) == false)
			return 0;
		else
		{
			return 1;
		}
			
	}

	int res = 0;
	res += BruteForce(number * 10 + 3, k - 1);
	res += BruteForce(number * 10 + 5, k - 1);
	res += BruteForce(number * 10 + 7, k - 1);
	return res;
}

int main()
{
	string NStr;
	cin >> NStr;
	N = atoi(NStr.c_str());
	int NSize = NStr.size();
	int res = 0;
	while (NSize > 2)
	{
		res += BruteForce(0, NSize);
		--NSize;
	}
	cout << res;
	
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define double long double
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < A[i].size(); j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	string S;
	cin >> S;
	int tmp = 0;
	int ans = 0;
	rep(i, 3) {
		if (S[i] == 'R')
			tmp++;
		else
			tmp = 0;
		chmax(ans, tmp);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3632
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws Exception {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	String array[] = br.readLine().split(" ");
	double D = Integer.parseInt(array[0]);
	int T = Integer.parseInt(array[1]);
	double S = Integer.parseInt(array[2]);

	if (T >= D / S) {
	    System.out.println("Yes");
	} else {
	    System.out.println("No");
	}
    }
}

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

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

    switch(D)
    {
        case 25:
            cout<<"Christmas"<<endl;
            break;
        case 24:
            cout<<"Christmas Eve"<<endl;
            break;
        case 23:
            cout<<"Christmas Eve Eve"<<endl;
            break;
        case 22:
            cout<<"Christmas Eve Eve Eve"<<endl;
            break;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
using namespace std;
int n;
int main() {
    cin >> n;
    int res = 10000;
    for (int i = 1; i < n; ++i) {
        int a = i;
        int b = n - a;
        int tmp = 0;
        while (a) {
            tmp += a % 10;
            a /= 10;
        }
        while (b) {
            tmp += b % 10;
            b /= 10;
        }
        res = min(res, tmp);
    }
    cout << res;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define endl '\n';
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;



int main() {
    
    int n,y;
    cin>>n>>y;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=n;j++){
            if(i+j>n)continue;
            if(10000*i+5000*j+1000*(n-i-j)==y){
                cout<<i<<" "<<j<<" "<<n-i-j<<endl;
                return 0;
            }
        }
    }
    cout<<"-1 -1 -1"<<endl;
}



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

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

  int a, b;
  cin >> a >> b;

  cout << max({a+b, a-b, a*b}) << endl;

  return (0);
}


Measured memory_bytes: 3580
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<cassert>
#include<cassert>
#include<unordered_map>
#include<unordered_set>
#include<functional>
#include<queue>
#include<stack>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<sstream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<numeric>
#include<random>
#include<chrono>
#include<bitset>
using namespace std;

#define all(x) (x).begin(), (x).end()
#define pb push_back
#define xx first
#define yy second
#define sz(x) (int)(x).size()
#define gc getchar
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mp make_pair

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr << #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const double PI=3.1415926535897932384626433832795;
const ll INF = 1LL<<62;
const ll MINF = -1LL<<62;

template<typename T> T getint() {
	T val=0;
	char c;
	
	bool neg=false;
	while((c=gc()) && !(c>='0' && c<='9')) {
		neg|=c=='-';
	}

	do {
		val=(val*10)+c-'0';
	} while((c=gc()) && (c>='0' && c<='9'));

	return val*(neg?-1:1);
}

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); uniform_int_distribution<int>(0, n-1)(rng)

int main() {
	IO;
	int a,b;
	cin>>a>>b;
	int ans=0;
	int curr=1;
	while(curr<b) {
		curr+=a-1;
		ans++;
	}
	
	cout<<ans<<"\n";
	

	return 0;
}


Measured memory_bytes: 256