akhauriyash/Code-Regression huggingface dataset:
<?php

    function compare($a, $b){

        if($a < $b){

            return "a < b";

        }else if($a > $b){

            return "a > b";

        }else if($a == $b){

            return "a == b";
        }

    }

    $num = preg_split('/ /', trim(fgets(STDIN)));

    echo(compare($num[0], $num[1]));

?>

Measured memory_bytes: 15624
#include <bits/stdc++.h>
#include <stdlib.h>
#include <time.h> 
 
using namespace std;
long long mod = 1e9 + 7;
long long INF = 1e7;
double EPS = 1e-12;
typedef long long int lld;
long double tick(){static clock_t oldt; clock_t newt=clock();
    long double diff=1.0L*(newt-oldt)/CLOCKS_PER_SEC; oldt = newt; return diff; }
#define rep(i,a,n) for(long long int i = (a); i <= (n); ++i)
#define repI(i,a,n) for(int i = (a); i <= (n); ++i)
#define repD(i,a,n) for(long long int i = (a); i >= (n); --i)
#define repDI(i,a,n) for(int i = (a); i >= (n); --i)
inline lld sc() { lld a; scanf("%lld", &a); return a; }
inline int scd() { int a; scanf("%d", &a); return a; }
inline double scf() { double a; scanf("%lf",&a); return a; }
#define prL(a) printf("%lld\n",a)
#define prS(a) printf("%lld ",a)
#define prdL(a) printf("%d\n",a)
#define prdS(a) printf("%d ",a)
#define all(c) (c).begin(), (c).end()
#define sz(a) ((int)a.size())
#define Error(x...) { cout << "(" << #x << ")" << " = ( "; printIt(x); }
template <typename T1> void printIt(T1 t1) { cout << t1 << " )" << endl; }
template <typename T1, typename... T2>
void printIt(T1 t1, T2... t2) { cout << t1 << " , "; printIt(t2...); }
#define errorpair(a) cout<<#a<<" = ( "<<((a).first)<<" , "<<((a).second)<<" )\n";
#define mset(a, v) memset(a, v, sizeof(a))
#define popcount __builtin_popcountll

typedef pair<lld,lld> PA;

lld powP(lld x, lld y) {
    lld ans = 1, po = x % mod;
    while(y > 0) {
        if(y & 1) ans = ans * po % mod;
        y >>= 1; po = po * po % mod;
    }
    return ans;
}
 
bool bitSet(lld n, lld bit){
    if((n & (1LL << bit)) != 0) return true;
    else return false;
}
 
lld findGcd(lld a, lld b){
    while(a != 0) { lld temp = b % a; b = a; a = temp; }
    return b;
}

#define lim 300010
#define lim2 200010
#define qqqqqq 210
// Ab :)
// inline lld sqr(lld x) { return x * x; }
// unordered_map<lld,lld>::iterator it;
// std::ios::sync_with_stdio(false);
// priority_queue<PA> Q;
// lld dp[1<<18];

vector<lld> G[lim];
// string S[lim];
// lld A[lim];
lld Par[lim], Vis[lim];

void dfs(lld x, lld par) {
    Vis[x] = 1;
    queue<int> Q;
    Q.push(x);
    Par[x] = par;
    while(not Q.empty()) {
        auto x = Q.front(); Q.pop();
        for(auto c : G[x]) {
            if(Vis[c] == 0) {
                Vis[c] = 1;
                Par[c] = x;
                Q.push(c);
            }
        }
    }
}

int main(){
    lld n = sc(), m = sc();
    rep(i,1,n) Par[i] = -1;
    rep(i,1,m) {
        lld a = sc(), b = sc();
        G[a].push_back(b);
        G[b].push_back(a);
    }
    dfs(1, -1);
    // bool poss = true;
    // rep(i,2,n) if(Par[i] == -1) poss = false;
    // if(not poss) printf("No\n");
    // else {
        printf("Yes\n");
        rep(i,2,n) prL(Par[i]);
    // }
    return 0;
}


Measured memory_bytes: 18456
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;
typedef long long ll;


vector<int> g[1000005];
int n;

inline int encode(int u, int v) {
  return u < v ? u*n+v : v*n+u;
}

int vs[1000+1][1000+1];
int st[1000005];
int dp[1000005];

int solve(void) {
  int res = 0;
  memset(dp, -1, sizeof dp);
  REP(i, n) {
    REP(j, n-1) {
      if(i > vs[i][j]) {
        continue;
      }
      int sed = 0;
      st[sed++] = encode(i, vs[i][j]);
      while(sed > 0) {
        int cur = st[--sed];
        if(cur >= 0) {
          if(dp[cur] == -2) {
            return -1;
          } else if(dp[cur] >= 0) {
            continue;
          }
          dp[cur] = -2;
          st[sed++] = ~cur;
          for(int next : g[cur]) {
            st[sed++] = next;
          }
        } else {
          dp[~cur] = 1;
          for(int next : g[~cur]) {
            dp[~cur] = max(dp[~cur], dp[next]+1);
          }
          res = max(res, dp[~cur]);
        }
      }
    }
  }
  return res;
}

int main(void) {
  scanf("%d", &n);
  REP(i, n) {
    REP(j, n-1) {
      scanf("%d", &vs[i][j]);
      --vs[i][j];
      if(j > 0) {
        int u = encode(i, vs[i][j-1]);
        int v = encode(i, vs[i][j]);
        g[u].push_back(v);
      }
    }
  }
  int res = solve();
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 49024
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
using namespace std;
typedef long long int ll;

int main(){

  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;
  cout << s1[0] << s2[1] << s3[2] << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define yes(n) cout << ((n) ? "yes" : "no") << endl

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

const int INF = 1001001001;
const vector<int> di = {-1,  0, 1, 0};
const vector<int> dj = { 0, -1, 0, 1};

void chmin(int &a, int b) { if (a > b) a = b; }

ll GCD(ll a, ll b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}
ll LCM(ll a, ll b) {
    ll g = GCD(a, b);
    return a / g * b;
}


int main() {
    int n; cin >> n;
    map<ll, int> cnt;
    rep(i, n) {
        ll a; cin >> a;
        cnt[a]++;
    }
    bool ok = true;
    for (auto e: cnt) {
        if (e.second > 1) {
            ok =false;
            break;
        }
    }

    YES(ok);
}

Measured memory_bytes: 12800
n, m, q = map(int, input().split())
abcd = []
for _ in range(q):
    abcd.append(tuple(map(int, input().split())))
ans = 0
from itertools import combinations_with_replacement
for A in combinations_with_replacement(list(range(1, m+1)), n):
    suma = 0
    for a,b,c,d in abcd:
        if A[b-1] - A[a-1] == c:
            suma += d
    ans = max(ans, suma)
print(ans)


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

using namespace std;

#define long long long
#define INF ((long) 1e18)
#define mOD 1000000007
#define mll map<long, long>
#define pll pair<long, long>
#define umap unordered_map
#define umll umap<long, long>
#define uset unordered_set
#define pb push_back
#define FOR(i, a, b) \
  for (long i = (a); i < (long) (b); i++)
#define PRINTV(v) \
  FOR (_i, 0, v.size()) \
    cout << v[_i] << " "; \
  cout << "\n";

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

  long n;
  cin >> n;

  vector<long> a(n);
  for (auto &x : a) cin >> x;

  long soma = 0;
  long total = 0;
  mll d;
  FOR (i, 0, n) {
    soma += a[i];
    if (soma == 0) total++;
    total += d[soma];
    d[soma]++;
  }
  printf("%lld\n", total);
}


Measured memory_bytes: 14336
def lower(upper):
    if upper==9:
        return [8,9]
    elif upper==0:
        return [0,1]
    else:
        return [upper-1,upper,upper+1]

def numerize(a):
    return sum([a[i]*(10**i) for i in range(len(a))])

def getRunruns(digit):
    if digit==1:
        return [(i,) for i in range(10)]
    elif digit==2:
        return [(k,i) for i in range(1,10) for k in lower(i)]
    else:
        runruns=getRunruns(2)
        for i in range(digit-2):
            runruns=[(k,)+i for i in runruns for k in lower(i[0])]
        return runruns

A1=[(i,) for i in range(10)]
A2=[(k,i) for i in range(1,10) for k in lower(i)]
A=A1+A2
Aprev=A2
K=int(input())
while len(A)<K+1:
    Aprev=[(k,)+i for i in Aprev for k in lower(i[0])]
    A+=Aprev
print(numerize(A[K]))


Measured memory_bytes: 30596
s = input()
t = input()

sl = len(s)
tl = len(t)

min_val = 10000

for i in range(sl-tl+1):
    tmp = 0
    for j in range(tl):
        if t[j] != s[j+i]:
            tmp += 1
    min_val = min(min_val, tmp)

print(min_val)


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

int main() {
  vector<int> vec(5);
  for(int i = 0; i < 5; i++) {
    cin >> vec.at(i);
    if(vec.at(i) == 0) {
      cout << i + 1 << endl;
    }
  }
}

Measured memory_bytes: 3624
import math
from collections import Counter

N = int(input())

def getPrimeFactors(x):
    anss = []
    while x%2 == 0:
        anss.append(2)
        x //= 2
    for d in range(3, int(x**0.5)+1, 2):
        while x%d == 0:
            anss.append(d)
            x //= d
    if x != 1:
        anss.append(x)
    return anss

PFs = getPrimeFactors(N)
cnt = Counter(PFs)

ans = 0
for _, e in cnt.items():
    base = e * 2
    root = math.floor(math.sqrt(base))
    if root * (root + 1) > base:
        root -= 1
    ans += root
print(ans)


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

int main(){
  int n;
  cin >> n;
  vector<int> a(n),b(n),d(n);

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

  int ret = 0;
  long long dif = 0;
  
  for(int i = 0;i < n;i++){
    cin >> b[i];
    d[i] = a[i] - b[i];

    if(d[i] < 0){
      dif += -d[i];
      ret++;
    }
  }

  sort(d.begin(),d.end(),std::greater<long long>());

  for(int i = 0;i < n;i++){
    if(d[i] <= 0 || dif <= 0)break;
    dif -= d[i];
    ret++;
  }

  if(dif <= 0){
    cout << ret << endl;
  }else{
    cout << -1 << endl;
  }
}


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

#define ll long long
#define pb push_back

const int MAXN = 1e3+4;
const ll MOD = (ll)1e9+7;

ll dp[MAXN][MAXN];
bool k[MAXN][MAXN];


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

	int n, m;	cin >> n >> m;
	for(int i=1; i<=n; i++)
		for(int j=1; j<=m; j++)	{
			char z;	cin >> z;
			if(z == '.')	k[i][j] = true;
		}
	dp[1][1] = 1;
	for(int i=1; i<=n; i++)
		for(int j=1; j<=m; j++)	{
			if(k[i][j])
				dp[i][j] += (dp[i-1][j] + dp[i][j-1])%MOD;
		}
	cout << dp[n][m];
}


Measured memory_bytes: 9088
#include <iostream>
using namespace std;
static const int N=100;

int main() {
  int M[N][N];
  int n,u,k,v;
  cin>>n;
  for (int i=0; i<n; i++) {
    for (int j=0; j<n; j++) {
      M[i][j]=0;
    }
  }
  for (int i=0; i<n; i++) {
    cin>>u>>k;
    u--;
    for (int j=0; j<k; j++) {
      cin>>v;
      v--;
      M[u][v]=1;
    }
  }
  for (int i=0; i<n; i++) {
    for (int j=0; j<n; j++) {
      if (j) {
        cout<<" "<<flush;
      }
      cout<<M[i][j]<<flush;
    }
    cout<<endl;
  }
  return 0;
}


Measured memory_bytes: 3112
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>

const int N=201000;

int A[N],B[N];
int n,k;

bool check()
{
	static int s[N],t[N];

	int cs=0,ct=0;
	for(int i=1;i<=n;i++)
		if(B[i]&k)s[++cs]=B[i]&(k-1);
		else t[++ct]=B[i]&(k-1);
	std::sort(s+1,s+cs+1);
	std::sort(t+1,t+ct+1);

	int ret=0,x,y;
	for(int i=1;i<=n;i++)
	{
		x=A[i]&(k-1);
		if(A[i]&k)
		{
			y=std::lower_bound(s+1,s+cs+1,k-x)-s-1;
			ret+=cs-y;

			y=std::lower_bound(t+1,t+ct+1,k-x)-t-1;
			ret+=y;

			ret%=2;
		}
		else
		{
			y=std::lower_bound(s+1,s+cs+1,k-x)-s-1;
			ret+=y;

			y=std::lower_bound(t+1,t+ct+1,k-x)-t-1;
			ret+=ct-y;

			ret%=2;
		}
	}

	return ret%2!=0;
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",A+i);
	for(int i=1;i<=n;i++)
		scanf("%d",B+i);

	int ans=0;
	for(k=1<<28;k;k>>=1)
		ans|=check()*k;
	printf("%d\n",ans);
	return 0;
}


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

    int main() {
        
        int n;
        cin >> n;
        vector<long long int> a(n);
        
        for(int i=0; i<n; i++)
            cin >> a[i];
            
            sort(a.begin(), a.end());
            long long int ans=0;
            
            for(int i=0; i<n; i++){
                
                
                for(int j = i+1; j<n; j++){
                    
                    if(a[i]==a[j])
                        continue;
                        
                        for(int k = j+1; k<n; k++){
                            
                            if(a[j]==a[k])
                                continue;
                                
                                if(a[i]+a[j]>a[k])
                                    ans++;
                            
                            }
                    
                    }
                

                
                }
        
            
            cout << ans;
        
        return 0;
        }

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

int main()
{
    long long X , K , D ;
    scanf("%lld%lld%lld",&X,&K,&D) ;
    X = abs(X) ;
    long long p = X/D ;
    if(K<=p) printf("%lld\n",X-K*D) ;
    else
    {
        K -= p ;
        if(K%2) printf("%lld\n",abs(X-(p+1)*D)) ;
        else printf("%lld\n",X-p*D) ;
    }
    return 0 ;
}


Measured memory_bytes: 3784
#include<stdio.h>

int main(){
    int W,H,x,y,r;

    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);

    if(x-r>=0&&y-r>=0&&x+r<=W&&y+r<=H){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

    return 0;
}


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

void solve(int N,vector<int>& v,vector<int>& deg){
    vector<vector<int>> ans(N);
    vector<int> dist(N,0),cnt(N,0);
    vector<int> vis;
    int n = v.size();
    int node = -1;
    for(int i=0;i<n;i++){
        if(v[i]>0){
            node++;
            if(vis.empty()){
                vis.push_back(node);
                dist[node] = 1;
            }else{
                int now = vis.back();
                cnt[now]++;
                dist[node] = dist[now] + 1;
                ans[now].push_back(node);
                ans[node].push_back(now);
                if(v[i]!=1) vis.push_back(node);
                cnt[node]++;
            }
        }else{
            int now = vis.back();
            for(int j=vis.size()-2;j>=0;j--){
                if(dist[now]+v[i]==dist[vis[j]]){
                    cnt[now]++;
                    cnt[vis[j]]++;
                    ans[now].push_back(vis[j]);
                    ans[vis[j]].push_back(now);
                    break;
                }
            }
        }
        while(!vis.empty() && cnt[vis.back()]==deg[vis.back()]) vis.pop_back();
    }
    for(int i=0;i<ans.size();i++){
        cout << i+1 << " ";
        sort(ans[i].begin(),ans[i].end());
        for(int j=0;j<ans[i].size();j++){
            cout << ans[i][j]+1 << (j!=ans[i].size()-1? " ":"\n");
        }
    }
}

int main(){
    int T;
    cin >> T;
    for(int t=0;t<T;t++){
        vector<int> v,deg;
        int a,N = 0;
        while(cin >> a && a!=0){
            v.push_back(a);
            if(a>0){
                N++;
                deg.push_back(a);
            }
        }
        solve(N,v,deg);
    }   
}


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

int main() {
  int H,W;
  cin >> H >> W;
  vector<vector<char>> table(H,vector<char>(W,'.'));
  vector<vector<char>> reverse(W,vector<char>(H,'.'));
  
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> table.at(i).at(j);
    }
  }
  
  for (int i = 0; i < W; i++) {
    for (int j = 0; j < H; j++) {
      reverse.at(i).at(j) = table.at(j).at(i);
    }
  }
  
  vector<char> row(W,'.');
  vector<char> col(H,'.');
  
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (table.at(i) != row && reverse.at(j) != col) {
      	cout << table.at(i).at(j);
      }
    }
    
    if (table.at(i) != row) {
      cout << endl;
    }
  }  
}


Measured memory_bytes: 256
import java.util.*

fun main() {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val k = sc.nextInt()
    
    val sunukes = IntArray(n)

    val a = Array(k) {
        val di = sc.nextInt()
        repeat(di) {
            sunukes[sc.nextInt() - 1]++ 
        }
    }

    println(sunukes.count { it == 0 })
}


Measured memory_bytes: 46932
#include <stdio.h>
#include <ctype.h>

int main()
{
    int ch;
    while((ch=getchar()) != EOF) {
        if(isupper(ch)) putchar(tolower(ch));
        else if(islower(ch)) putchar(toupper(ch));
        else putchar(ch);
        if(ch=='\n') break;
    }
    return 0;
}

Measured memory_bytes: 524
#include <iostream>
#include <unordered_map>

#define ll long long

using namespace std;

int main(){
    ll n, cnt=0; cin>>n;
    ll arr[n];
    unordered_map<ll, int> mp;

    for(int i=0; i<n; i++){
        ll x; cin>>x;
        arr[i]=x;
        mp[x+i+1]++;
    }

    for(int i=0; i<n; i++){
        ll x=i+1-arr[i];
        if(mp[x]) cnt+=mp[x];
    }
    cout<<cnt;
    return 0;
}


Measured memory_bytes: 19988
n, l = map(int, input().split())
# リスト内包表記
# 以下と同等
## strs = []
## for i in range(n):
##    strs.append(input())
strs = [input() for _ in range(n)]
strs.sort()
strs = ''.join(strs)
print(strs)

Measured memory_bytes: 3060
//IOI 2021

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

#define pb push_back
#define ff first
#define ss second

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

int a, b;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> a >> b;
	if (a < 10 && b < 10)
		cout << a * b << endl;
	else
		cout << -1 << endl;
	return 0;
}


Measured memory_bytes: 256
from decimal import *

def calc_vote(T, A, TN_prev, AN_prev):
    '''
    input:
        T, A: rate of vote
        TN_prev, AN_prev: previous minimum number of vote
    output:
        TN, AN: minimum number of vote 
    '''
    k = max((TN_prev/T).quantize(Decimal('0'), rounding=ROUND_CEILING), (AN_prev/A).quantize(Decimal('0'), rounding=ROUND_CEILING))
    TN = k * T
    AN = k * A
    
    return TN, AN
  
# input N
N = int(input())

TN, AN = map(Decimal, input().split())
for _ in range(2, N + 1):
    T, A = map(Decimal, input().split())
    TN, AN = calc_vote(T, A, TN, AN)

print(TN + AN)

Measured memory_bytes: 5204
# https://beta.atcoder.jp/contests/abc061/tasks/abc061_b


def solve1():
    n, m = map(int, input().split())
    roads = []
    for _ in range(m):
        city = map(int, input().split())
        for c in city:
            roads.append(c)

    for i in range(1, n+1):
        print(roads.count(i))


def solve():
    n, m = map(int, input().split())
    roads = {}

    for i in range(1, n+1):
        roads[i] = 0

    for _ in range(m):
        road = input().split()
        for r in road:
            roads[int(r)] += 1

    for road in roads.values():
        print(road)


if __name__ == '__main__':
    # solve()
    solve1()


Measured memory_bytes: 3064
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

//long mod = 10^^9 + 7;
long mod = 998_244_353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(T)(ref T x, T y) { x.modm(y.modpow(mod - 2)); }

void main()
{
	auto K = RD;
	
	char[] inc2(char[] s, long i)
	{
		foreach_reverse (j; 0..i)
		{
			auto num = s[j+1] - '0';
			s[j] = cast(char)(max(num-1, 0)+'0');
		}
		return s;
	}

	char[] inc(char[] s, long i)
	{
		auto x = s[i] - '0';
		if (i+1 < s.length)
		{
			auto y = s[i+1] - '0';
			if (y - x >= 0 && x+1 != 10)
			{
				++s[i];
				return inc2(s, i);
			}
			else
			{
				return inc(s, i+1);
			}
		}
		else
		{
			if (x == 9)
			{
				s ~= '1';
				return inc2(s, i+1);
			}
			else
			{
				++s[i];
				return inc2(s, i);
			}
		}
	}

	char[] ans = ['1'];
	foreach (i; 0..K-1)
	{
		ans = inc(ans, 0);
	}

	ans.reverse();
	writeln(ans);
	stdout.flush;
	debug readln;
}


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

typedef long long int ll;
typedef vector<int> vi;            
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef pair<int, int>     pii;
typedef vector<bool> vb;
#define endl '\n'
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define pf push_front
#define rb pop_back
#define rf pop_front
#define in insert
#define mp make_pair
#ifdef LOCAL
    #include "../../trace.h"
#else
    #define trace(args...)
#endif

ll div_floor(const ll &a,const ll &b) { return a / b - (((a ^ b) < 0) and a % b);}
ll div_ceil(const ll &a,const ll &b) { return a / b + (((a ^ b) >= 0) and a % b);}

void solve(){
    string s; cin>>s;
    if(s=="RRR") cout<<3<<endl;
    else if(s=="RRS"||s=="SRR") cout<<2<<endl;
    else if(s=="SSS") cout<<0<<endl;
    else cout<<1<<endl;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifdef LOCAL
        freopen(".inp.txt", "r", stdin);
        freopen(".out.txt", "w", stdout);
        freopen(".err.txt", "w", stderr);
    #endif
    int t=1;
    // cin>>t;
    while(t--)
        solve();
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
int main() {
	string str;
	while(cin>>str,str!="#"){
		int ans=0;
		for(int i=0,now=-1,num=0;i<str.size();i++){
			if(str[i]>103&&str[i]<113||str[i]==117||str[i]==121)num=1;
			else num=0;
			if(now==-1)now=num;
			else if(now!=1&&num==1||now!=0&&num==0){
				ans++;
				now=(now+1)%2;
			}
		}
		cout<<ans<<endl;
	}
}

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

#define int long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end())
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double pi = 3.1415926535897932384626433832795028L;
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int N;
signed main() {
  cin>>N;
  if(N&1)fin(0);
  int ans1=0;
  for(int i=60;i>0;i--){
    int k=1;
    rep(j,i)k*=2;
    ans1+=N/k;
  }
  int ans2=0;
  ans2+=N/10;
  N/=10;
  for(int i=26;i>0;i--){
    int k=1;
    rep(j,i)k*=5;
    ans2+=N/k;
  }
  cout<<min(ans1,ans2)<<endl;
}

Measured memory_bytes: 256
if __name__ == "__main__":
    num_a = int(input())
    a = list(map(lambda x: int(x), input().split()))
    num_query = int(input())

    for _ in range(num_query):
        begin, margin, end = map(lambda x: int(x), input().split())
        diff = end - margin
        modulo = end - begin
        a_sliced = a[begin: end]
        a_sliced = [a_sliced[(idx + len(a_sliced) - diff) % modulo] for idx in range(len(a_sliced))]
        a[begin: end] = a_sliced

    print(" ".join([str(elem) for elem in a]))



Measured memory_bytes: 5636
/// a.cpp
# include <stdio.h>
# include <bits/stdc++.h>
using namespace std;
const pair < int , int > DD[] = {{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define IOS ios_base :: sync_with_stdio(0);cin.tie(0)
# define p(v) cerr << #v << " = " << v << '\n'
# define p2(v) cerr << #v << " = " << (complex < decltype(v.x) > (v.x,v.y)) << '\n'
# define vi vector < int >
# define vl vector < ll >
# define pll pair < ll , ll >
# define pii pair < int , int >
# define mp make_pair
# define db long double
# define fail puts("-1")
# define yes puts("YES")
# define no puts("NO")
# define PP puts("Possible")
# define II puts("Impossible")
# define vii vector < pii >
# define vll vector < pll >
# define pb push_back
# define pdd pair < db , db >
# define all(s) s.begin(),s.end()
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
int main(void)
{
    #ifdef CF
    freopen("input","r",stdin);
    #endif // CF
    srand(time(0));
    fo << fixed << setprecision(7);
    cerr << fixed << setprecision(7);
    int n,k;
    fi>>n>>k;
    int g = 0;
    int mx = 0;
    while (n --)
    {
        int v;
        fi>>v;
        g = __gcd(g,v);
        smax(mx,v);
    }
    if (!(k % g) && mx >= k)
        puts("POSSIBLE");
    else
        puts("IMPOSSIBLE");
    cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,k,num[53];
	cin>>n>>k;
	int sum=0;
	for(int i=0;i<n;i++)
		cin>>num[i];
 
	for(int i=1;i<=k&&i<=n;i++){
		for(int a=0;a<=i;a++){
			int b=i-a,flag=0,pan[53];
			for(int j=0;j<a;j++){
				pan[flag]=num[j];
				flag++;
			}
			for(int j=0;j<b;j++){
				pan[flag]=num[n-1-j];
				flag++;
			}
			sort(pan,pan+flag);
			int left=0,temp=0;
			while(pan[left]<0)
				left++;
			if(k-i<left&&k-i>=0)
				left=k-i;
			for(int c=left;c<flag;c++){
				temp+=pan[c];
			}
			if(temp>sum)
				sum=temp;
		}
	}
	cout<<sum<<endl;
	return 0;
}

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

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef queue<int> qi;
typedef stack<int> si;
typedef deque<int> dqi;

#define reps(i, a, b) for (int i = a; i < b; ++i)
#define rep(i, n) reps(i, 0, n)
#define REPS(i, a, b) reps(i, a, b)
#define REP(i, n) rep(i, n)
#define deps(i, a, b) for (int i = a; i >= b; --i)
#define dep(i, n) deps(i, n, 0)
#define DEPS(i, a, b) deps(i, a, b)
#define DEP(i, n) dep(i, n)

#define pf push_front
#define pb push_back
#define mp make_pair
#define fst first
#define FST fst
#define sec second
#define SEC sec
#define sz(obj) ((int)(obj).size())
#define all(v) (v).begin(), (v).end()
#define ALL(v) all(v)

const int INF = 999999999;
const int MOD = 1e9 + 7;
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; std::cin >> x; return x;}
template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T> void print(T x) { std::cout << x << '\n'; }

signed main()
{
  int n = in();
  int a = 0, u = 0;
  bool f = false;
  
  rep(i, n){
    string str;
    cin >> str;
    if (str == "A") a++;
    else u++;
    if (a < u) f = true;
  }
  if (f || a != u) print("NO");
  else print("YES");

  return (0);
}

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

int main() {
   int a, b, c, k;
   cin >> a >> b >> c >> k;
   if(k <= a){
      cout << k << endl;
   }else if(a < k == k <= a + b){
      cout << a << endl;
   }else{
      cout << a - (k-a-b) << endl;
   }
   return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int N,Q;
    string S;
    cin >> N >> S >> Q;
    vector<set<int>> se(26);
    rep(i,N){
        // a~zの各文字について、出てくるインデックスを保存する
        se[S[i]-'a'].insert(i);
    }
    rep(i,Q){
        int t;
        cin >> t;
        if(t==1){
            // 文字の置き換え
            int ix;
            char c;
            cin >> ix >> c;
            ix--;
            char bf = S[ix];
            S[ix] = c;
            se[bf-'a'].erase(ix); // 置き換え前の文字のインデックスを削除
            se[c -'a'].insert(ix); // 置き換え後の文字のインデックスを追加
        }else{
            // 出力
            int l,r;
            cin >> l >> r;
            l--;r--;
            int cnt=0;
            // 区間内に各文字があるかどうかを確認する
            for(int i=0;i<26;i++){
                if(se[i].empty()) continue;
                auto itr = se[i].lower_bound(l);
                if(itr==se[i].end()) continue;
                if(*itr<=r){
                    cnt++;
                }
            }
            cout << cnt << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 26304
n,m=map(int,input().split())
R=[]
for i in range (m) :
    a,b=map(int,input().split())
    R.append ([b, a])
R.sort()

def solve() :
    ans,t=0,0
    for i in range (m) :
        if t<=R[i][1]:
            ans+=1
            t=R[i][0]
    return ans
print (solve ())

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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(auto i=0;i<(n);i++)

using namespace std;


struct Node{
    int pos;
    vector<bool> used;
    int cost;
    bool operator< (const Node &r) const{
        return cost > r.cost;
    }
};

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int n, c;
    cin >> n >> c;
    vector<vector<int>> d(c, vector<int>(c));
    rep(hx, c){
        rep(wx, c) cin >> d[hx][wx];
    }
    vector<vector<int>> v(3, vector<int>(c, 0));
    rep(hx, n){
        rep(wx, n){
            int x;
            cin >> x;
            x--;
            v[(hx+wx)%3][x]++;
        }
    }

    vector<vector<int>> list(3, vector<int>(c, 1e9));
    rep(i, 3){
        rep(to, c){
            int sum = 0;
            rep(from, c){
                sum += v[i][from] * d[from][to];
            }
            list[i][to] = sum;
        }
    }

    priority_queue<Node> que;
    que.push({0, vector<bool>(c, false), 0});

    while(!que.empty()){
        Node node = que.top(); que.pop();

        if(node.pos == 3){
            cout << node.cost << endl;
            break;
        }
        rep(i, c){
            if(node.used[i]) continue;
            vector<bool> v = node.used;
            v[i] = true;
            que.push({node.pos+1, v, node.cost+list[node.pos][i]});
        }
    }
    
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
	EACH(x,vec) is >> x;
	return is;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
	REP(i,vec.size()) {
		if (i) os << " ";
		os << vec[i];
	}
	return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
	REP(i,vec.size()) {
		if (i) os << endl;
		os << vec[i];
	}
	return os;
}

vector< vector<int> > v[3] = {
	{
		{0,1,0},
		{1,1,1},
		{0,1,0},
	},
	{
		{1,1,1},
		{1,1,1},
		{1,1,1},
	},
	{
		{0,0,1,0,0},
		{0,1,1,1,0},
		{1,1,1,1,1},
		{0,1,1,1,0},
		{0,0,1,0,0},
	},
};

int main() {
//	std::ios::sync_with_stdio(false);
//	std::cin.tie(0);
	int x, y, sz;
	const int W = 10, H = 10;
	vector< vector<int> > m(H, vector<int>(W, 0));
	while ( scanf("%d,%d,%d", &x, &y, &sz) != EOF ) {
		--sz;
		x -= v[sz].size()/2;
		y -= v[sz].size()/2;
		REP(dy, v[sz].size()) {
			REP(dx, v[sz][dy].size()) {
				int nx = x + dx, ny = y + dy;
				if (nx < 0 || nx >= W || ny < 0 || ny >= H) continue;
				m[ny][nx] += v[sz][dy][dx];
			}
		}
	}
//	cout << m << endl;
	int ans = 0, cnt = 0;
	REP(i, H) REP(j, W) {
		if (m[i][j] == 0) ++cnt;
		ans = max(ans, m[i][j]);
	}
	cout << cnt << endl;
	cout << ans << endl;
}

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

#define ld long double
#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define IN freopen("input.txt","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(int i=a ; i<=b ; i++)
#define FORD(i,a,b) for(int i=a ; i>=b ; i--)
#define INF 1000000000
#define ll long long int
#define eps (1e-8)
#define sq(x) ( (x)*(x) )
#define all(x) x.begin(),x.end()
#define flog2(n) 64 - __builtin_clzll(n) - 1
#define popcnt(n) __builtin_popcountll(n)

using namespace std;

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

ll K;
int n;

ll d[100005][2], sub[100005];
vector<int> v[100005];
ll mu_2[100005];
int par[100005];
ll prod[100005];
ll prefixP[100005], sufP[100005];

void dfs(int a, int p) {
	sub[a] = 1;
	par[a] = p;

	for (int i = 0; i < v[a].size(); i++) {
		if (v[a][i] == p) {
			v[a].erase(v[a].begin() + i);
			break;
		}
	}

	for (auto i: v[a]) {
		dfs(i, a);
		sub[a] += sub[i];
	}
	d[a][0] = 1;

	for (auto i: v[a]) {
		d[a][0] = d[a][0] * (d[i][0] + 1) % K;
	}
	d[a][1] = (mu_2[sub[a]] - 1 - d[a][0] + K) % K;

	if (v[a].size() == 0) return;
	if (v[a].size() == 1) {
		prod[v[a][0]] = 1;
		return;
	}

	for (int i = 0; i < v[a].size(); i++) {
		if (i == 0) {
			prefixP[i] = d[v[a][0]][0] + 1;
		}
		else {
			prefixP[i] = prefixP[i - 1] * (d[v[a][i]][0] + 1) % K;
		}
	}

	for (int i = v[a].size() - 1; i >=0; i--) {
		if (i == v[a].size() - 1) {
			sufP[i] = d[v[a][i]][0] + 1;
		}
		else {
			sufP[i] = sufP[i + 1] * (d[v[a][i]][0] + 1) % K;
		}
	}

	FOR (i, 0, v[a].size() - 1) {
		if (i == 0) {
			prod[v[a][i]] = sufP[1];
		}
		else if (i == v[a].size() - 1) {
			prod[v[a][i]] = prefixP[v[a].size() - 2];
		}
		else {
			prod[v[a][i]] = prefixP[i - 1] * sufP[i + 1] % K;
		}
 	}
}

int vs[100005];
ll f[100005], g[100005]; // f = g * d[a][0]

void dfs2(int a) {
	if (vs[a] || a == 1) {
		return;
	}
	vs[a] = 1;
	dfs2(par[a]);
	g[a] = (prod[a] * g[par[a]] % K + 1) % K;
	f[a] = g[a] * d[a][0] % K;
}



int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    cin >> n >> K;

    FOR (i, 1, n - 1) {
    	int x, y;
    	cin >> x >> y;
    	v[x].pb(y);
    	v[y].pb(x);
    }

    mu_2[0] = 1;
    FOR (i, 1, n) mu_2[i] = mu_2[i - 1] * 2LL % K;

    dfs(1, 0);
    f[1] = d[1][0];
    g[1] = 1;

    FOR (i, 1, n) dfs2(i);

    FOR (i, 1, n) cout << f[i] << "\n";

 	
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
#define X first;
#define Y second;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll;
const ll INF = 2e18;
const int inf = 1e9+10;
const int maxN = 1e6 + 10;
const int maxK = 1e4+10;
const int maxD = 15;
const int maxH = 100; 
const int MOD = 1e9+7;

ll p[maxN];

int main()
{
	ll k;
	cin>>k;
	p[1] = 1;
	for(int i=2;i<=1e6;i++)
	{
		p[i] = (p[i-1] * 10)%k;
	}
	for(int i=1;i<=1e6;i++)
	{
		p[i] = (p[i] * 7)%k;
	}
	int ans = -1;
	for(int i=1;i<=1e6;i++)
	{
		p[i] = (p[i]+p[i-1])%k;
		if(p[i] == 0)
		{
			ans = i;
			break;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 11484
//! # Bundled libraries

use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        mut s: String,
    }

    if s.ends_with('s') {
        s += "es";
    } else {
        s += "s";
    }
    println!("{}", s);
}

// The following code was expanded by `cargo-equip`.


Measured memory_bytes: 2172
#include <iostream>
#include <algorithm>

int main(void)
{
	int a[3];

	std::cin >> a[0] >> a[1] >> a[2];
	std::sort(a, a+3);
	std::cout << a[0] << " " << a[1] << " " << a[2] << "\n";

	return 0;
}

Measured memory_bytes: 1180
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  int A,B,C,D,E;
  cin >> A >> B >> C >> D >> E;
  int a,b,c,d,e;
  a = A%10;
  b = B%10;
  c = C%10;
  d = D%10;
  e = E%10;
  vector<int> cook(5);
  int sum = A+B+C+D+E;
  cook = {a,b,c,d,e};
  int m = 10;
  rep(i,5)
  {
    if(cook[i]!=0)
    {
      sum += 10-cook[i];
      m = min(m,cook[i]);
    }
  }
  if(m!=10)
  {
    cout << sum + m - 10 << endl;
  }
  else
  {
    cout << sum << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>

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

using namespace std;
const int inf = 1001001000;
const long long int Inf = 1001001001001001000;

void print(vector<vector<int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}


int main(){
	int h, w, k;
	cin >> h >> w >> k;
	vector<string> choco(h);
	rep(i, h) cin >> choco[i];
	int ans = inf;
	rep(div, (1 << (h-1)))
	{
		int g = 0;
		vector<int> id(h, 0);
		rep(i,h){
			id[i] = g;
			if (div>>i&1){
				g++;
			}
		}
		g++;
		vector<vector<int>> c(g, vector<int>(w, 0));
		rep(i, h) rep(j, w) c[id[i]][j] += (choco[i][j] - '0');
		int num = g - 1;
		vector<int> now(g, 0);
		auto add = [&](int j) {
			rep(i, g) now[i] += c[i][j];
			rep(i, g) if (now[i] > k) return 1;
			return 0;
		};
		
		rep(j, w)
		{
			if (add(j)){
				num++;
				now = vector<int>(g, 0);
				if (add(j)){
					num = inf;
					break;
				}
			}
		}
		ans = min(ans, num);
	}
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 256
l_bound = [[1]*101 for _ in range(101)]
u_bound = [[10**10]*101 for _ in range(101)]

N = int(input())
for n in range(N):
    x, y, h = list(map(int, input().split()))

    if h==0:
        for r in range(101):
            for c in range(101):
                u_bound[r][c] = min(u_bound[r][c], abs(c-x) + abs(r-y))
    else:
        for r in range(101):
            for c in range(101):
                l_bound[r][c] = max(l_bound[r][c], h + abs(c-x) + abs(r-y))
                u_bound[r][c] = min(u_bound[r][c], h + abs(c-x) + abs(r-y))

for r in range(101):
    for c in range(101):
        if l_bound[r][c] == u_bound[r][c]:
            print(c, r, l_bound[r][c])

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

int main(){
  int n,tmp;
  int max=0;
  int ans=1;
  cin>>n;
  for(int i=1;i<=n;i++){
    tmp=0;
    int it = i;
    while(it%2 == 0){
      it =it/2;
      tmp++;
    }
    if(max<=tmp){
      max=tmp;
      ans=i;
    }
  }
  cout<<ans<<endl;
  return 0;
}

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

#define M 1046527
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
}
 
/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key % M; }
int h2(int key){ return 1+key%(M-1); }

bool find(char str[]){
    long long j,key = getKey(str),i = 0;
    while(true){
        j = (h1(key) + i * h2(key))%M;
        if(strcmp(H[j],str) == 0 ) return true;
        else if(strlen(H[j]) == 0) return false;
        i++;
    }
    return false;
}

int insert(char str[]){
    long long j,key = getKey(str),i = 0;
    while(true){
        j = (h1(key) + i * h2(key))%M;
        if(strlen(H[j]) == 0 || H[j] == NULL) {
            strcpy(H[j],str);
            return j;
        }
        i++; 
    }
    
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);
	
	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}


Measured memory_bytes: 17468
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;


int main() {
  string s,t,u; ll a,b; cin >> s >> t >> a >> b >> u;
  if(s==u) cout << a-1 << ' ' << b << endl;
  else cout << a << ' ' << b-1 << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    a, b = LS()
    a = int(a)
    b = float(b)
    b *= 1000
    b = int(b)
    print(a * b // 1000)
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 95444
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const int MOD = 998244353;
const ll INF = 1000000000000000000;


int main()
{
	int N,Q;
	string S;
	cin >> N >> S >> Q;
	set<int> st[26];
	for (int i = 0; i < N; i++) {
		st[S[i] - 'a'].insert(i);
	}
	for (int i = 0; i < 26; i++) {
		st[i].insert(N);
	}
	while (Q--) {
		int q; cin >> q;
		if (q == 1) {
			int i;
			char c;
			cin >> i >> c;
			i--;
			st[S[i] - 'a'].erase(i);
            S[i] = c;
			st[S[i] - 'a'].insert(i);
		}
		else {
			int l, r;
			cin >> l >> r;
			l--; r--;
			int ans = 0;
			for (int i = 0; i < 26; i++) {
				auto itr = st[i].lower_bound(l);
				int num = *itr;
				if (num <= r) ans++;
			}
			cout << ans << endl;
		}
	}
}


Measured memory_bytes: 27228
N=int(input())
W=[input() for _ in range(N)]
flag=0
if N==len(set(W)):
  for i in range(N-1):
    if W[i][-1]!=W[i+1][0]:
      flag=1
      break
else:
  flag=1

print("YNeos"[flag==1::2])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MAX_N 100000
#define MAX_M 100000
const int MAX = 100100;
const int MOD = 1000000007;
#define vec vector<int>
#define vecll vector<ll>
#define vecllvec vector<vector<ll>>
#define vecb vector<bool>
#define vecBvec vector<vector<bool>>
#define vecst vector<string>
#define vecch vector<char>
#define vecd vector<double>
#define vecvec vector<vector<int>>
#define vecDvec vector<vector<double>>
#define vecHvec vector<vector<char>>
#define all(x) (x).begin(),(x).end()
const long long INF = 1LL<<60;
#define PI 3.141592653589793
// cout << setprecision(15) << std::fixed;

// もしかしてACですかぁ～～？！　Yse!! Yse!! Yse!!

int main() {
  int h,w,k,c=1;
  cin>>h>>w>>k;
  vecvec cake(h,vec(w,0));
  bool che[h][w];
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      char a;
      cin>>a;
      if(a=='#'){
        cake[i][j]=c;
        che[i][j]=true;
        c++;
      }
      else{
        che[i][j]=false;
      }
    }
  }
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(che[i][j]){
        for(int l=j-1;l>=0;l--){
          if(che[i][l]) break;
          cake[i][l]=cake[i][j];
        }
        for(int r=j+1;r<w;r++){
          if(che[i][r]) break;
          cake[i][r]=cake[i][j];
        }
      }
    }
  }
  for(int i=0;i<h;i++){
    if(cake[i][0]==0){
      if(i!=0){
        for(int u=i-1;u>=0;u--){
          if(cake[u][0]!=0){
            cake[i]=cake[u];
            break;
          }
        }
      }
      else{
        for(int d=i+1;d<h;d++){
          if(cake[d][0]!=0){
            cake[i]=cake[d];
            break;
          }
        }
      }
    }
  }
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cout<<cake[i][j]<<endl;
    }
  }
}


Measured memory_bytes: 1152