akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <sstream>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
using namespace std;
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define M 1000000007
#define vvi vector<vector<int>>
//#define FILE_A_IN

void solve() {
    int n;
    cin >> n;
    vector<int> va(n+1);
    for (int i = 2; i < n+1; ++i) {
        int t;
        cin >> t;
        va[t]++;
    }
    for (int i = 1; i < n+1; ++i) {
        cout << va[i] << endl;
    }
}
int main() {
#ifdef FILE_A_IN
    freopen("a.in", "r", stdin);
#endif
    fio;
        solve();
    return 0;
}

Measured memory_bytes: 4004
//13
#include<iostream>

using namespace std;

int main(){
  int n;
  cin>>n;
  int a[100][100];
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      cin>>a[i][j];
    }
  }
  int s[101][101]={};
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      s[i+1][j+1]=s[i+1][j]+s[i][j+1]-s[i][j]+a[i][j];
    }
  }
  int m=-1<<30;
  for(int i=0;i<n+1;i++){
    for(int j=i+1;j<n+1;j++){
      for(int k=0;k<n+1;k++){
	for(int l=k+1;l<n+1;l++){
	  int c=s[j][l]-s[j][k]-s[i][l]+s[i][k];
	  if(c>m){
	    m=c;
	  }
	}
      }
    }
  }
  cout<<m<<endl;
  return 0;
}

Measured memory_bytes: 1244
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
#define ll long long
const ll INF=1000000000000000000;
ll n,cnt,rec,f0,f1=-INF,f2=-INF;
ll read(){ll res;char ch;while(!isdigit(ch=getchar()));res=ch-'0';while(isdigit(ch=getchar()))res=res*10-'0'+ch;return res;}
ll reado(){char ch;while((ch=getchar())!='+'&&ch!='-');return ch=='-';}
int main()
{
	n=read();
	for(ll i=1,a,o=0;i<=n;++i)
	{
		if(i>1)o=reado();
		a=read();
		if(o)f0=f1=max(f0-a,f2=f1+a);
		else f0+=a,f1=max(f1-a,f2+=a);
	}
	printf("%lld",f0);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define rrep(i,n) for(int (i)=1;i<=(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define INF 1e18
#define int long long
#define endl "\n"
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



signed main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
	
	int n;
	while(cin >> n, n) {
		map<char, char> mp;
		rep(i, n) {
			char a, b;
			cin >> a >> b;
			mp[a] = b;
		}
		int m;
		cin >> m;
		rep(i, m) {
			char c;
			cin >> c;
			if(mp.count(c) != 0) cout << mp[c];
			else cout << c;
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3184
use std::cmp::{max, min};
use std::io::{self, Read};
use std::iter::FromIterator;

#[allow(dead_code)]
struct Source {
    chars: Box<Iterator<Item = char>>,
}

#[allow(dead_code)]
impl Source {
    fn next_chr(&mut self) -> char {
        self.chars
            .by_ref()
            .skip_while(|c| char::is_whitespace(*c))
            .next()
            .expect("eof")
    }

    fn next_str(&mut self) -> String {
        let it = self
            .chars
            .by_ref()
            .skip_while(|c| char::is_whitespace(*c))
            .take_while(|c| !char::is_whitespace(*c));
        let s = String::from_iter(it);
        if s.is_empty() {
            panic!("eof")
        } else {
            s
        }
    }

    fn from_stdin() -> Self {
        let mut data = String::new();
        io::stdin().read_to_string(&mut data).expect("Input error");
        Self::from_str(&data)
    }

    fn from_str(s: &str) -> Self {
        let data = String::from(s);
        let chars = data.chars().collect::<Vec<char>>().into_iter();
        Source {
            chars: Box::new(chars),
        }
    }
}

#[allow(unused_macros)]
macro_rules! input {
    ($src:expr; $($elem:tt)*) => {
        input_inner!($src, $($elem)*)
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($src:expr) => {};
    ($src:expr,) => {};
    ($src:expr, $var:ident : mut $ty:tt $($rest:tt)*) => {
        let mut $var = parse!($src, $ty);
        input_inner!($src $($rest)*)
    };
    ($src:expr, $var:ident : $ty:tt $($rest:tt)*) => {
        let $var = parse!($src, $ty);
        input_inner!($src $($rest)*)
    };
}

#[allow(unused_macros)]
macro_rules! parse {
    ($src:expr, ( $($ty:tt),* )) => {
        ( $(parse!($src,$ty)),* )
    };
    ($src:expr, char) => {
        $src.next_chr()
    };
    ($src:expr, [ $ty:tt; $len:expr ]) => {
        (0..$len).map(|_| parse!($src,$ty)).collect::<Vec<_>>()
    };
    ($src:expr, $ty:tt) => {
        parse_str!($src,$ty)
    };
}

#[allow(unused_macros)]
macro_rules! parse_str {
    ($src:expr, chars) => {
        $src.next_str().chars().collect::<Vec<char>>()
    };
    ($src:expr, $ty:ty) => {
        $src.next_str().parse::<$ty>().expect("Parse error")
    };
}

fn main() {
    let mut src = Source::from_stdin();
    input! { src;
             n: usize, l: mut [usize; n],
    }

    l.sort();

    let s: usize = l.iter().take(n - 1).sum();

    let res = if l[n - 1] < s { "Yes" } else { "No" };

    println!("{}", res)
}


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

int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int a, b;
    cin >> a >> b;

    if(a <= b) {
        rep(i, b) cout << a;
    }else{
        rep(i, a) cout << b;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.stream.*;
class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n;
        n = input.nextInt();
        Dice[] dices = new Dice[n];
        int[] num = new int[6];
        Dice tmp;
        String ans = "Yes";
        for (int i = 0; i < n; i++){
            for (int j = 0; j < 6; j++){
                num[j] = input.nextInt();
            }
            tmp = new Dice(num);
            dices[i] = tmp;
        }
        boolean flag = false;
        String rolling = "EEENEEENEEESEEESEEENEEEN";
        for (int i = 0; i < (n-1); i++){
            if (flag) {
                break;
            }
            for (int j = (i+1); j < n; j++){
                if (dices[i].isSame(dices[j])){
                    ans = "No";
                    flag = true;
                    break;
                }
                for (int k = 0; k < rolling.length(); k++){
                    char c = rolling.charAt(k);
                    dices[j].roll(c);
                    if (dices[i].isSame(dices[j])){
                        ans = "No";
                        flag = true;
                        break;
                    }
                }
            }
        }
        System.out.println(ans);
    }
}

class Dice {
    private int N,E,W,S,T,B;
    private int[] dice_num;
    Dice(int[] num_array){
        dice_num = num_array;
        T = dice_num[0];
        S = dice_num[1];
        E = dice_num[2];
        W = dice_num[3];
        N = dice_num[4];
        B = dice_num[5];
    }
    public void roll(char direction){
        int tmp;
        if (direction == 'N'){
            tmp = T;
            T = S;
            S = B;
            B = N;
            N = tmp;
        } else if (direction == 'E'){
            tmp = T;
            T = W;
            W = B;
            B = E;
            E = tmp;
        } else if (direction == 'W'){
            tmp = T;
            T = E;
            E = B;
            B = W;
            W = tmp;
        } else {
            tmp = T;
            T = N;
            N = B;
            B = S;
            S = tmp;
        }
    }
    public void disp_top(){
        System.out.println(T);
    }
    public boolean isSame(Dice dice){
        if (T == dice.T &&
            S == dice.S &&
            E == dice.E &&
            W == dice.W &&
            N == dice.N &&
            B == dice.B){
                return true;
            } else {
                return false;
            }
    }
}


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

#define FOR0(i,n) for (int i = 0; i < n; i++)
#define FOR(i,j, n) for (int i = j; i < n; i++)
// bool isEven(ll n) {return (n%2!=0)?false:true;};
#define INF 1000000000 // 1 billion, safer than 2B for Floyd Warshall’s

#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
// #define int ll

using namespace std;

//atcoder
//abc167

int main()
{
    string s, t;
    cin>>s;
    cin>>t;

    if(s+t[t.length()-1]!=t)
        cout<<"No"<<endl;
    else
        cout<<"Yes"<<endl;

}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/02/26  Problem: ABC 116 D / Link: http://abc116.contest.atcoder.jp/tasks/abc116_d  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL ans = 0LL;

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

	LL N, K; cin >> N >> K;
	VL t(N), d(N);
	FOR(i, 0, N) {
		cin >> t[i] >> d[i];
		t[i]--;
	}

	VI index(N, 0);
	iota(ALL(index), 0);
	sort(ALL(index),
		[&](int a, int b) {
		return d[a] > d[b];
	});

	VI used(N, 0);
	LL sum = 0;
	LL typecnt = 0;
	priority_queue<LL,VL,greater<LL>>pq;
	FOR(i, 0, K) {
		int idx = index[i];
		sum += d[idx];
		if (used[t[idx]]) {
			pq.push(d[idx]);
		}
		else {
			used[t[idx]] = 1;
			typecnt++;
		}
	}
	ans = sum + typecnt * typecnt;
	DD(de(ans, sum, typecnt));
	FOR(i, K, N) {
		int idx = index[i];
		if (used[t[idx]]) {
			continue;
		}
		if (SZ(pq)) {
			LL swapval = pq.top(); pq.pop();
			DD(de(swapval));
			used[t[idx]] = 1;
			typecnt++;

			sum = sum - swapval + d[idx];
			DD(de(sum))
			ans = max(ans, sum+typecnt*typecnt);
		}
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 3324
#include<iostream>
#include<vector>
#include<stack>
#include<algorithm>
#include<string>
#include<set>
#include<numeric>
#include<functional>
#include<unordered_map>
#include<cmath>
using namespace std;

int main()
{
	string S;
	cin >> S;
	S.erase(S.end() - 1);
	if (S.size() % 2 == 1)
		S.erase(S.end() - 1);
	while (true) {
		if (S.substr(0, S.size() / 2) == S.substr(S.size() / 2))
			break;
		S.erase(S.end() - 1);
		S.erase(S.end() - 1);
	}
	cout << S.size() << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n,i,l[16],j;
	while(scanf("%d",&n)!=EOF){
		j=0;
		for(i=1024;i>0;i/=2){
			if(i<=n){
				l[j]=i;
				n-=i;
				j++;
			}
		}
		for(i=j-1;i>=0;i--){
			printf("%d",l[i]);
			if(i==0){
				printf("\n");
			}else{
				printf(" ");
			}
		}
	}
	return 0;
}

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

using namespace std;
typedef long long ll;
const int MAXN = 100010;
int _w;

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

int clrb( int x, int i ) {
	return x & (~(1<<i));
}

ll check( int x ) {
	ll s = 0;
	for( int i = 0; i < n; ++i )
		if( (x | a[i]) == x ) s += b[i];
	return s;
}

int main() {
	_w = scanf( "%d%d", &n, &k );
	for( int i = 0; i < n; ++i )
		_w = scanf( "%d%d", a+i, b+i );
	ll ans = 0;
	for( int i = 29; i >= 0; --i )
		if( k & (1<<i) )
			ans = max(ans, check(clrb(k,i) | ((1<<i)-1)));
	ans = max(ans, check(k));
	printf( "%lld\n", ans );
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
typedef long long ll;
 
int main(){
    int n;
    cin>>n;
    int a = n%10;
    int b = n/10;
    if(a!=9 && b!=9) {cout<<"No"<<endl;}
    else {cout<<"Yes"<<endl;}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <array>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int a[500][500];

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

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

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> a[i][j];
            a[i][j] %= 2;
        }
    }

    vector<array<int, 4>> r;

    int i1 = -1, j1 = -1;
    for (int i = 0; i < h; i++) {
        for (int j0 = 0; j0 < w; j0++) {
            int j = i % 2 == 0 ? j0 : w - 1 - j0;
            if (i1 < 0) {
                if (a[i][j]) {
                    i1 = i;
                    j1 = j;
                }
            } else {
                r.push_back({ i1, j1, i, j });
                if (a[i][j]) {
                    i1 = -1;
                    j1 = -1;
                } else {
                    i1 = i;
                    j1 = j;
                }
            }
        }
    }

    cout << r.size() << '\n';
    for (const auto& t : r) {
        cout << t[0] + 1 << ' ' << t[1] + 1 << ' ' << t[2] + 1 << ' ' << t[3] + 1 << '\n';
    }
    cout << flush;

    return 0;
}

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

int n,k,q;
map<int,int> m;

signed main() {
    cin >> n >> k >> q;
    rep(i,q) {
        int a;
        cin >> a;
        m[a]++;
    }
    rep(i,n) {
        if (k > q-m[i+1]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

Measured memory_bytes: 6912
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[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		int k = Integer.parseInt(sa[1]);
		int k2 = k * 2;
		int k3 = k * 3;
		int[] x = new int[n];
		int[] y = new int[n];
		for (int i = 0; i < n; i++) {
			sa = br.readLine().split(" ");
			int a = Integer.parseInt(sa[0]);
			int b = Integer.parseInt(sa[1]);
			if (sa[2].equals("W")) {
				a += k;
			}
			x[i] = a % k2 + 1;
			y[i] = b % k2 + 1;
		}
		br.close();

		int[] dx = {-k, -k, k, k};
		int[] dy = {-k, k, -k, k};
		int[][] cnt = new int[k3 + 1][k3 + 1];
		for (int i = 0; i < n; i++) {
			cnt[x[i]][y[i]]++;
			for (int j = 0; j < 4; j++) {
				int nx = x[i] + dx[j];
				int ny = y[i] + dy[j];
				if (0 < nx && nx <= k2 && 0 < ny && ny <= k2) {
					cnt[nx][ny]++;
				}
			}
		}
		for (int i = 1; i <= k2; i++) {
			for (int j = 1; j <= k; j++) {
				cnt[i][j + k2] = cnt[i][j];
			}
		}
		for (int j = 1; j <= k2; j++) {
			for (int i = 1; i <= k; i++) {
				cnt[i + k2][j] = cnt[i][j];
			}
		}

		for (int i = 0; i <= k3; i++) {
			for (int j = 0; j < k3; j++) {
				cnt[i][j + 1] += cnt[i][j];
			}
		}
		for (int j = 0; j <= k3; j++) {
			for (int i = 0; i < k3; i++) {
				cnt[i + 1][j] += cnt[i][j];
			}
		}

		int ans = 0;
		for (int i = 0; i <= k2; i++) {
			for (int j = 0; j <= k2; j++) {
				int val = cnt[i + k][j + k] - cnt[i][j + k] - cnt[i + k][j] + cnt[i][j];
				ans = Math.max(ans, val);
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 80064
N,K = gets.split.map(&:to_i)

data = Hash.new(0)
N.times do
  a,b = gets.split.map &:to_i
  data[a] += b
end

len = 0
data.sort.each do |a,b|
  len += b
  if K <= len
    puts a
    break
  end
end


Measured memory_bytes: 9992
N = int(input())

p_list = [int(s) for s in input().split()]

cnt = 0

for i in range(1,N-1):
  if p_list[i-1] < p_list[i] and p_list[i] < p_list[i+1]:
  	cnt += 1

  if p_list[i+1] < p_list[i] and p_list[i] < p_list[i-1]:
  	cnt += 1

print(cnt)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)
#define each(i, c) for (auto& (i) : (c))

using namespace std;
typedef long long int lli;
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }

int main() {
    int h, w;
    cin >> h >> w;
    int cs[h][w];
    rep(i,h)rep(j,w) {
        cin >> cs[i][j];
    }

    vector<pair<int,int>> ps;
    rep(i,h) {
        for (int j = (i%2 == 0 ? 0 : w-1); i%2==0 ? j < w : j >= 0; i%2 == 0 ? j++ : j--) {
            ps.push_back(make_pair(i, j));
        }
    }
    bool mode = false;
    int ls = 0;
    rep(i,h*w) {
        int x = ps[i].second;
        int y = ps[i].first;
        if (mode) {
            if (cs[y][x]%2 == 1) mode = false;
            ls++;
        } else {
            if (cs[y][x]%2 == 1) mode = true;
        }
    }

    cout << ls << endl;

    mode = false;
    rep(i,h*w) {
        int x = ps[i].second;
        int y = ps[i].first;
        if (mode) {
            if (cs[y][x]%2 == 1) mode = false;
            printf("%d %d %d %d\n", ps[i-1].first+1, ps[i-1].second+1, ps[i].first+1, ps[i].second+1);
        } else {
            if (cs[y][x]%2 == 1) mode = true;
        }
    }

    return 0;
}

Measured memory_bytes: 5104
//
// Created by Myabu on 2020/01/26.
//

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <math.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <numeric>
#include <iomanip>

using namespace std;


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

    if(N.find('9') != std::string::npos){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }



    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>

int
main(int argc, char *argv[])
{
  int n; long long a, b;
  scanf("%d %lld %lld", &n, &a, &b);
  long long x[100000];
  for(int i = 0; i < n; i++) scanf("%lld", &x[i]);

  long long ans = 0;
  for(int i = 1; i < n; i++){
    if(a * (x[i] - x[i - 1]) > b) ans += b;
    else ans += a * (x[i] - x[i - 1]);
  }

  printf("%lld\n", ans);

  return 0;
}
	


Measured memory_bytes: 896
import collections
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
    
ans=0
n=int(input())
if n==1:
    print(0)
    exit()

cnt=collections.Counter(prime_factorize(n))
for num in cnt.values():
    if num<3:
        ans+=1
    elif num<6:
       ans+=2
    elif num<10:
        ans+=3
    elif num<15:
        ans+=4
    elif num<21:
        ans+=5
    elif num<28:
        ans+=6
    elif num<36:
        ans+=7
    elif num<45:
        ans+=8
    else:
        num+=9
print(ans)
    


Measured memory_bytes: 9488
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
//#define REP(i,a,b) for(int i=a;i<=b;i++)

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
long long MOD=1e9+7;
map<string,int> memo;
int main()
{	
	ios_base:: sync_with_stdio(0);
	cin.tie(0);
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	vector < string >  name,name1;
	string x;
	int n,i,j,mini=0,g;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>x;
		memo[x]+=1;
	}
	int maxi=0;
	for(auto k: memo){
		if(k.second>maxi) maxi=k.second;
	}
	for(auto l=memo.begin();l!=memo.end();l++){
		if(l->second==maxi){
			cout<<l->first<<"\n";
		}
	}
}


Measured memory_bytes: 23808
using System;
using System.Collections.Generic;
using System.Text;

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            var inputLine = Console.In.ReadLine();
            var inputs = inputLine.Split(new char []{' ','\t','　'});
            if (inputs.Length != 1)
            {
                return;
            }

            var S = int.Parse(inputs[0]);
            if (false
                || S < 0 || 86400 < S
                )
            {
                return;
            }

            var s = S % 60;
            var M = S / 60;
            var m = M % 60;
            var H = M / 60;

            Console.WriteLine("{0}:{1}:{2}", H, m, s);
        }
    }
}


Measured memory_bytes: 17860
#ifndef ___CLASS_MODINT
#define ___CLASS_MODINT

#include <cstdint>

template<std::uint32_t mod>
class modint {
private:
	std::uint32_t n;
public:
	modint() : n(0) {};
	modint(std::uint64_t n_) : n(n_ % mod) {};
	bool operator==(const modint& m) const { return n == m.n; }
	bool operator!=(const modint& m) const { return n != m.n; }
	std::uint32_t get() const { return n; }
	modint& operator+=(const modint& m) { n += m.n; n = (n < mod ? n : n - mod); return *this; }
	modint& operator-=(const modint& m) { n += mod - m.n; n = (n < mod ? n : n - mod); return *this; }
	modint& operator*=(const modint& m) { n = std::uint64_t(n) * m.n % mod; return *this; }
	modint operator+(const modint& m) const { return modint(*this) += m; }
	modint operator-(const modint& m) const { return modint(*this) -= m; }
	modint operator*(const modint& m) const { return modint(*this) *= m; }
	modint binpow(std::uint64_t b) const {
		modint ans = 1, m = modint(*this);
		while (b) {
			if (b & 1) ans *= m;
			m *= m;
			b >>= 1;
		}
		return ans;
	}
	modint inv() { return (*this).binpow(mod - 2); }
};

#endif // ___CLASS_MODINT

const int mod = 1000000007;
using modulo = modint<mod>;

#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int main() {
	int H, W, N;
	cin >> H >> W >> N;
	vector<int> R(N + 2), C(N + 2);
	R[0] = 1; C[0] = 1;
	R[N + 1] = H; C[N + 1] = W;
	for (int i = 1; i <= N; ++i) {
		cin >> R[i] >> C[i];
	}
	vector<modulo> fact(H + W - 1), inv(H + W - 1), factinv(H + W - 1);
	fact[0] = 1;
	for (int i = 1; i < H + W - 1; ++i) fact[i] = fact[i - 1] * i;
	inv[1] = 1;
	for (int i = 2; i < H + W - 1; ++i) inv[i] = inv[mod % i] * modulo(mod - mod / i);
	factinv[0] = 1;
	for (int i = 1; i < H + W - 1; ++i) factinv[i] = factinv[i - 1] * inv[i];
	function<modulo(int, int)> combination = [&](int n, int m) {
		if (m < 0 || n < m) return modulo(0);
		return fact[n] * factinv[m] * factinv[n - m];
	};
	N += 2;
	vector<int> perm(N);
	for (int i = 0; i < N; ++i) {
		perm[i] = i;
	}
	sort(perm.begin(), perm.end(), [&](int i, int j) { return R[i] != R[j] ? R[i] < R[j] : C[i] < C[j]; });
	vector<modulo> dp(N); dp[perm[0]] = modulo(mod - 1);
	for (int i = 1; i < N; ++i) {
		for (int j = 0; j < i; ++j) {
			dp[perm[i]] -= dp[perm[j]] * combination(R[perm[i]] - R[perm[j]] + C[perm[i]] - C[perm[j]], R[perm[i]] - R[perm[j]]);
		}
	}
	cout << dp[N - 1].get() << '\n';
	return 0;
}

Measured memory_bytes: 2688
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define PB push_back
#define MP make_pair

#define MOD (LL)1000000007

int H, W, K;

LL memo2[10] ={};
LL solve2(int n){
	if(n <= 0) return 1;
	if(memo2[n] != 0) return memo2[n];
	return memo2[n] = (solve2(n-1)+solve2(n-2))%MOD;
}

LL memo[100][8];
LL solve(int h, int w){
	if(w < 0 || w >= W) return 0;
	if(h == H){
		if(w == K-1) return 1;
		else return 0;
	}
	if(memo[h][w] != -1) return memo[h][w];
	return memo[h][w] = (solve(h+1, w)*solve2(w-1)%MOD*solve2(W-w-2)
		+solve(h+1, w-1)*solve2(w-1-1)%MOD*solve2(W-w-2)
		+solve(h+1, w+1)*solve2(w-1)%MOD*solve2(W-w-2-1))%MOD;
}

int main(){
	cin >> H >> W >> K;
	for(int i=0; i<H; i++)
		for(int j=0; j<W; j++)
			memo[i][j] = -1;
	cout << solve(0, 0) << endl;
}


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

int main()
{
  int n, m;
  ll k;
  cin >> n >> m >> k;
  ll a[n], b[m];
  rep(i, n) cin >> a[i];
  rep(j, m) cin >> b[j];
  ll t = 0;
  rep(i, m) t += b[i];
  
  int j = m;
  int ans = 0;
  rep(i, n + 1){
    while(j > 0 && t > k){
      --j;
      t -= b[j];
    }
    if(t > k) break;
    ans = max(ans, i + j);
    if(i == n) break;
    t += a[i];
  }

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

Measured memory_bytes: 6764
#include<bits/stdc++.h>
using namespace std;
#define LL long long int

bool compareFn(tuple<string,LL,LL> t1,tuple<string,LL,LL> t2){
    if(get<0>(t1)!=get<0>(t2)){
        return get<0>(t1)<get<0>(t2);
    }
    else{
        return get<1>(t1)>get<1>(t2);
    }
}

int main() {
    
	LL n;
	cin>>n;
	vector<tuple<string,LL,LL>> vtp;
	for(LL i=0;i<n;i++){
	    string s;
	    LL v;
	    cin>>s>>v;
	    vtp.push_back(make_tuple(s,v,i+1));
	}
	sort(vtp.begin(),vtp.end(),compareFn);
	for(auto i:vtp){
	    cout<<get<2>(i)<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] p = new long[n + 1];
        p[0] = 1;
        for (int i = 0; i < n; i++) {
            p[i + 1] = (p[i] * (i + 1)) % 1000000007;
        }
        System.out.println(p[n]);
    }
}


Measured memory_bytes: 21972
package main

import (
	"fmt"
	"strings"
)

func Reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

// Return the `n`-length string from the position `pos`.
func SubStr(s *string, pos int, n int) string {
	runes := []rune(*s)
	if pos+n >= len(runes) {
		return string(runes[pos:])
	} else {
		return string(runes[pos : pos+n])
	}
}

func main() {
	var s string
	fmt.Scan(&s)
	s = Reverse(s)
	len_s := len(s)

	patterns := []string{"dream", "dreamer", "erase", "eraser"}
	var rev_patterns []string
	for _, p := range patterns {
		rev_patterns = append(rev_patterns, Reverse(p))
	}

	i := 0
	for {
		// fmt.Println(s)
		found := false
		for _, p := range rev_patterns {
			if strings.HasPrefix(s, p) {
				found = true
				s = s[len(p):]
				i += len(p)
				break;
			}
		}
		if !found {
			break;
		}
	}
	// fmt.Println(i)

	if i == len_s {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


Measured memory_bytes: 1792
// Problem : D - RGB Triplets
// Contest : AtCoder Beginner Contest 162
// URL : https://atcoder.jp/contests/abc162/tasks/abc162_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int mod = 1e9+7;
int inf = 4e18;
const int N = 5e5+5;

signed main()
{
    io
    int tt = 1;
    //cin>>tt;
    while(tt--)
    {
    	int n;
    	cin>>n;
    	string s;
    	cin>>s;
    	map<char,vector<int>> mp;
    	for(int i=0;i<n;++i)
    	{
    		mp[s[i]].push_back(i);
    	}
    	int ans = 0;
    	for(int i=0;i<n;++i)
    	{
    		
    		for(int j=i+1;j<n;++j)
    		{
    			
    			set<char> st;
    			st.insert(s[i]);
    			st.insert(s[j]);
    			if(st.size()!=2)
    			{
    				st.clear();
    				continue;
    			}
    			if(s[i]!='R'&&s[j]!='R')
    			{
    			   int x  = (int)mp['R'].size() - (upper_bound(mp['R'].begin(),mp['R'].end(),j)- mp['R'].begin());
    			   if(x)
    			   {
    			   	ans+=x;
    			   	if(binary_search(mp['R'].begin(),mp['R'].end(),2*j-i))
    			   	ans--;
    			   }
    			}
    			if(s[i]!='G'&&s[j]!='G')
    			{
    				int x  = (int)mp['G'].size() - (upper_bound(mp['G'].begin(),mp['G'].end(),j)- mp['G'].begin());
    			   if(x)
    			   {
    			   	ans+=x;
    			   	if(binary_search(mp['G'].begin(),mp['G'].end(),2*j-i))
    			   	ans--;
    			   }
    			}
    			if(s[i]!='B'&&s[j]!='B')
    			{
    				int x  = (int)mp['B'].size() - (upper_bound(mp['B'].begin(),mp['B'].end(),j)- mp['B'].begin());
    			   if(x)
    			   {
    			   	ans+=x;
    			   	if(binary_search(mp['B'].begin(),mp['B'].end(),2*j-i))
    			   	ans--;
    			   }
    			}
    			
    		}
    	}
    	cout<<ans<<"\n";
    }
    return 0;
}



Measured memory_bytes: 3688
l=int(input())
s=len(bin(l))-3
a=1
b=0
d=[[0,0,0]for i in range(60)]
for i in range(s):
    d[b]=[a,a+1,2**(a-1)]
    d[b+1]=[a,a+1,0]
    b+=2
    a+=1
for i in range(a-1,0,-1):
    if l-2**(i-1)>=2**s:
        d[b]=[i,a,l-2**(i-1)]
        l-=2**(i-1)
        b+=1
d=[a for a in d if a!=[0,0,0]]
print(a,len(d))
for i in d:
    print(i[0],i[1],i[2])

Measured memory_bytes: 3064
#include<stdio.h>
#include<math.h>

#define MAX 2000000

int CountingSort(int A[], int B[], int n,int k){
	int C[MAX];

	for(int i = 0; i <= k;i++){
		C[i] = 0;
//		for(int o = 0; o < n; o++){printf("%d ",C[o]);}printf("\n");
	}
//	printf("-----------\n");
	// C[i] にiの出現数を記録する 
	for(int j = 0; j < n;j++){
		C[A[j]]++;
//		for(int o = 0; o < n; o++){printf("%d ",C[o]);}printf("\n");
	}
//	printf("-----------\n");
	
	// C[i]にi以下の数の出現数を記録する 
	for(int i = 1; i <= k; i++){
		C[i] = C[i] + C[i-1];
//		for(int o = 0; o < n; o++){printf("%d ",C[o]);}printf("\n");
	}
//	printf("-----------\n");
	
	for(int j = n-1; j >= 0; j--){
		B[C[A[j]]-1] = A[j];
		C[A[j]]--;
//		for(int o = 0; o < n; o++){printf("%d ",C[o]);}printf("\n");
	}
//	printf("-----------\n");

}


int main(){
	int n,k = 0;
	int val[MAX];
	int ans[MAX];
	
	scanf("%d",&n);
	for(int i = 0; i < n; i++){
		scanf("%d",&val[i]);
		k = k < val[i] ? val[i] : k;
		ans[i] = 0;//初期化
	}
	CountingSort(val, ans, n, k);
	
	printf("%d",ans[0]);
	for(int i = 1;i < n; i++){
		printf(" %d",ans[i]);
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 17400
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
//#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "NO" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl

long long fact(long long x){
    long long k=1;
    for(int i=1;i<=x;i++){
        k=(k*i)%MOD;
    }
    return k;
}

long long inverse(long long b){
    long long r=1,e=MOD-2;
    while(e){
        if(e&1){
            r=(r*b)%MOD;
        }
        b=(b*b)%MOD;
        e >>=1;
    }
    return r;
}

int Comb(int i,int j){
    if(i==0 || j==0)return 0;
    int num=fact(i+j);
    num*=inverse(fact(i));num%=MOD;
    num*=inverse(fact(j));num%=MOD;
    return num;
}

signed main(void){
    int r1,c1,r2,c2;
    cin >> r1 >> c1 >> r2 >> c2;
    int Ans=0;
    Ans+=Comb(r2+1,c2+1);
    Ans-=Comb(r1,c2+1);
    Ans-=Comb(r2+1,c1);
    Ans+=Comb(r1,c1);
    Ans+=MOD;Ans+=MOD;Ans%=MOD;
    
    cout << Ans << endl;
    return 0;
}



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

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

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

using namespace std;

int n;
vector<long long> a;

void hawawa()
{
	cin >> n;
	a.resize(n);
	for (auto&& i : a) {
		cin >> i;
	}
	sort(begin(a), end(a));
	int ans;
	long long sum = 0;
	for (int i = 0; i < n; i++) {
		if (sum * 2 < a[i]) {
			ans = n - i;
		}
		sum += a[i];
	}
	cout << ans << "\n";
}

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


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

using namespace std;

int main(){
	vector<int> v(3);
	
	for(int i=0;i<3;i++) cin >> v[i];
	sort(v.begin(),v.end());
	if(v[0]==v[1] && v[0]==5 && v[2]==7){
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int h = 0,
        w = 0,
        i = 0,
        j = 0;
    while(1){
        scanf("%d %d", &h, &w);
        if( h == 0 && w == 0 )break;
            for(i=0;i<h;i++){
                if( i == 0 && i != h){
                    for(j=0;j<w;j++){
                        printf("#");
                    }
                    printf("\n");
                }
                if( i != 0 && i != h-1 ){
                    printf("#");
                    for(j=0;j<w-2;j++){
                        printf(".");
                    }
                    printf("#\n");
                }
                if( i != 0 && i == h-1){
                    for(j=0;j<w;j++){
                        printf("#");
                    }
                    printf("\n");
                }
                
            }
            printf("\n");
    }
    return 0;
}

Measured memory_bytes: 1740
import bisect

n = int(input())
a = sorted(list(map(int, input().split())))

if n == 2:
    print(a[1], a[0])
    exit()

M = max(a)
m = M/2
mid = bisect.bisect_left(a, m)
x, y = abs(a[mid-1] - m), abs(a[mid] - m)

if x < y:
    print(M, a[mid-1])
else:
    print(M, a[mid])

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

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

	ll i,j,k,l,m,n,t;

	cin >> n;

	ll ans = 1;

	ll flag = 0;

	for(i=0;i<n;i++)
	{
		cin >> k;

		if(k==0)
		{
			cout << 0 << '\n';
			return 0;
		}

		// cout << ans << '\n';

		if((1000000000000000000/ans) >= k)
			ans = ans*k;
		else
		{
			// cout << -1 << '\n';
			flag = 1;
		}

	}


	if(flag == 0)
		cout << ans << '\n';
	else
		cout << -1 << '\n';
}

Measured memory_bytes: 3644
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
        int n,i,j,v;
        Scanner scan=new Scanner(System.in);
        n=scan.nextInt();
        int m[]=new int[n];
        int k[]=new int[n];
        for(i=0;i<m.length;i++)
        {
        	m[i]=scan.nextInt();
        }
        
        for(i=0;i<m.length-1;i++)
        {
        	System.out.print(m[i]+" ");
        }
        System.out.println(m[n-1]);
        for(i=1;i<=m.length-1;i++)
        {
        	v=m[i];
        	j=i-1;
        	while(j>=0&&m[j]>v)
        	{
        		m[j+1]=m[j];
        		j--;
        	}
        	m[j+1]=v;
        	for(j=0;j<m.length-1;j++)
        	{
        		System.out.print(m[j]+" ");
        	}
        	System.out.println(m[n-1]);
        }
	}
}

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

long A;
long B;
long C;

int main(){
    cin>>A;
    cin>>B;
    cin>>C;
    
    if (A%2==0 || B%2==0 || C%2==0) {
        cout<<0;
    }
    else {
        if (A<B) {
            if (A<C) {
                if (B<C) {
                    cout<<A*B;
                }
                else{
                    cout<<A*C;
                }
            }
            else{
                cout<<A*C;
            }
        }
        else{
            if (B<C) {
                if (A<C) {
                    cout<<A*B;
                }
                else{
                    cout<<B*C;
                }
            }
            else{
                cout<<B*C;
            }
        }
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    int a, b;
    cin >> a >> b;
    cout << ceil(a + b, 2) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define li          long
#define ll          long long
#define ull         unsigned long long
#define ff          first
#define ss          second
#define pii         pair<int,int>
#define pli         pair<li,li>
#define pll         pair<ll,ll>
#define pb          push_back
#define fo(i,k,n)   for(int i = k;i<n; i++)
#define ro(i,k,n)   for(int i = k; i>=n; i--)
#define fd(i,k,n,d) for(int i = k; i<n; i+=d)
#define tc          int t;cin>>t;while(t--)
#define all(v)      v.begin(),v.end()
#define inf         INT_MAX
#define ninf        INT_MIN
#define W(x)        cout<<x<<endl
#define WW(x,y)     cout<<x<<' '<<y<<endl;
#define in(x)       cin>>x
#define v(x)        vector<x>
#define int         long long
#define ar(x,y)       array<x,y>
const ll mod1 = 99844353;
const ll mod2 = 1e9+7;
template <class T>
using oset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

//****************************************************************************************************************************************//

void fastio()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

//*****************************************************************************************************************************************//

template<class T>
T power(T a,T b){
    T res = (T)1;
    while(b>0){
        if(b&1)res = res*a;
        b>>=1;
        a*=a;
    }
    return res;
}

template<class T>
T power(T a,T b,T m){
    T res = (T)1;
    a%=m;
    while(b>0){
        if(b&1)res = (res*a)%m;
        b>>=1;
        a = (a*a)%m;
    }
    return res;
}

//*****************************************************************************************************************************************//

struct dsu{
  map<int,int> pr,sz;
  dsu(){
    (this->pr).clear();
    (this->sz).clear();
  }
  void make(int x){
    pr[x] = x;
    sz[x] = 1;
  }
  int getpar(int x){
    if(pr[x] == x)return x;
    return pr[x] = getpar(pr[x]);
  }
  void merge(int x,int y){
    x = getpar(x);
    y = getpar(y);
    if(sz[x]<sz[y])swap(x,y);
    pr[y] = x;
    sz[x]+=sz[y];
    sz[y] = 0;
  }
};

//******************************************************************************************************************************************//


void solve(){
  string s,t;
  cin>>s>>t;
  int ans = 0;
  int n = s.size();
  for(int i = 0; i<n; i++)ans+=(s[i]!=t[i]);
  cout<<ans<<"\n";
}

signed main(){
    fastio();
    int cs = 1;
    //cin>>cs;
    while(cs--){
        solve();
    }
}


Measured memory_bytes: 3800
/* Author : Pranav Deshmukh
            PICT,Pune
   Purpose: Practice B Codeforces Round #653 (Div. 3)
*/

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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#define int             long long
#define dip(type,var)   type var; cin>>var;
#define dipi(x)			int x; cin>>x;
#define w(x)            int x; cin>>x; while(x--)
#define mka(arr,n,type) type *arr=new type[n];
#define foi(i,n)		for(int i=0;i<n;i++)
#define mod             pow(10,9)+7
#define inf             1e18
#define endl			"\n"
#define ff              first
#define ss              second
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >

void c_p_c()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin.tie(0);
#ifndef ONLINE_JUDGE

	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int32_t main() {
	c_p_c();
	string s, t;
	cin >> s >> t;
	bool t1 = false;
	if (t.length() - s.length() != 1)
		cout << "No" << endl;
	else {
		for (int i = 0; i < s.length(); i++) {
			if (s[i] != t[i])
				t1 = true;
		}
		if (t1)
			cout << "No" << endl;
		else
			cout << "Yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 3576
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <unordered_map>
#include <cstring>
#include <stack>
#define INT long long
#define MOD 1000000007
#define oo 987654321
#define OO 999999987654321ll
using namespace std;

INT n, ans = 1, k;
stack<INT> s;

int main()
{
    cin>>n;
    for(int i = 1 ; i <= n ; i++ )
    {
        int t;
        cin>>t;
        s.push(t);
        k = s.size();
        if( t < 2*k-1 ) s.pop();
        ans *= k;
        ans %= MOD;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main()
{
    int a,b,c,x,i,j,k,sum=0;
    scanf("%d%d%d%d",&a,&b,&c,&x);
    for(i=0;i<=a;i++){
        for(j=0;j<=b;j++){
            for(k=0;k<=c;k++){
                if(x==500*i+100*j+50*k) sum++;
            }
        }
    }
    printf("%d",sum);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
	int h, w;
	cin >> h >> w;
	vector<string> v(h);
	rep(i,h) cin >> v[i];
	vector<vector<int>> g(h, vector<int>(w));
	rep(i,h) {
		rep(j,w) {
			int l = j;
			int r = j;
			int t = 1;
			while (r + 1 < w && v[i][r] == v[i][r + 1]) {
				r++;
				t++;
			}
			if (v[i][j] == '#') t = 0;
			for (int k = l; k <= r; k++) {
			 	g[i][k] += t;
			}
			j = r;
		}
	}
	rep(j,w) {
		rep(i,h) {
			int l = i;
			int r = i;
			int t = 1;
			while (r + 1 < h && v[r][j] == v[r + 1][j]) {
				r++;
				t++;
			}
			if (v[i][j] == '#') t = 0;
			for (int k = l; k <= r; k++) {
			 	g[k][j] += max(0, t - 1);
			}
			i = r;
		}
	}
	int ans = 0;
	rep(i,h) {
		rep(j,w) ans = max(ans, g[i][j]);
	}
	cout << ans << endl;
}

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

Measured memory_bytes: 26396
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <cmath>

using namespace std;
typedef long long ll;

#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(a) (a).begin(), (a).end()

int count(int N)
{
        int cnt = 0;
        while (N)
        {
                cnt += N % 10;
                N /= 10;
        }
        return cnt;
}

int main()
{
        int N;
        cin >> N;
        vector<int> a(N + 1);
        rep(i, N) cin >> a[i];
        sort(a.begin(), a.begin() + N);
        reverse(a.begin(), a.begin() + N);

        int ans = 0;
        rep(i, N)
        {
                ans += a[i] * pow(-1, (i % 2));
        }
        cout << ans << endl;
        return 0;
}


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

using namespace std;

#define forn for (ll i = 0; i < n; i++)
#define form for (ll j = 0; j < m; j++)
#define NO cout << "NO\n";
#define YES cout << "YES\n";
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for (ll i = a; i < b; i++)

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> pi;

ll gcd(ll a, ll b){
    ll r;
    while (b != 0){
        r = a % b;
        a = b;
        b = r;
    }
    return a;
}


ll *calc_z(string s){
    ll n = s.size();
    ll *z = new ll[n] {0};
    ll l = 0, r = 0;
    for (ll i = 1; i < n; i++){
        if (r >= i) z[i] = min(z[i-l], r-i+1);
        while (z[i]+i < n && s[z[i]] == s[z[i]+i]) z[i]++;
        if (i + z[i] - 1 > r){
            l = i;
            r = i+z[i]-1;
        }
    }
    return z;
}

ll find_lower(ll *a, ll n, ll v){
    ll l = -1, r = n;

    while (r>l+1){
        ll m = (l+r)/2;

        if (a[m] >= v) r = m;
        else l = m;
    }
    if (r == n) return n-1;
    if (a[r] == v) return r;
    return r == 0 ? 0 : r-1;
}

void init(){
}

int bin(int *p, int n, int x){
    int l = 0, r = n-1;
    while (r >= l){
        int m = (l+r)/2;
        if (p[m] == x) return m;
        if (p[m] > x) r = m-1;
        else l = m+1;
    }
    return -1;
}

void solve(){
    ll a;
    cin >> a;
    string s;
    cin >> s;
    int n = s.size();
    ll c = 10*(s[n-2] - '0') + (s[n-1] - '0');
    ll b = 0;
    ll p = 1;
    for (int i = n-4; i >= 0; i--){
        int t = s[i]-'0';
        b += p*t;
        p *= 10;
    }
    cout << a*b + a*c/100 << '\n';
}

int main(){
    //init();

    ios::sync_with_stdio(0);
    cin.tie(0);

    //ll t; cin >> t; while (t--)
        solve();
    return 0;
}


Measured memory_bytes: 3540