akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    string s;
    cin >> n >> m >> s;
    reverse(ALL(s));
    int now = 0;
    vector<int> ans;
    while(now < n) {
        bool flg = false;
        for(int i = m; i >= 1; i--) {
            if(now + i <= n && s[now + i] == '0') {
                now += i;
                ans.push_back(i);
                flg = true;
                break;
            }
        }
        if(flg == false) {
            cout << -1 << endl;
            return 0;
        }
    }
    reverse(ALL(ans));
    for(int i : ans) {
        cout << i << ' ';
    }
    cout << endl;
}

Measured memory_bytes: 1096
n = int(input())
t = list(map(int,input().split()))
m = int(input())

list = []
for i in range(m):
    p,x = map(int,input().split())
    new_list = t.copy()
    new_list[p-1] = x
    list.append(sum(new_list))

for i in list:
    print(i)


Measured memory_bytes: 3060
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
//constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;


int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/

	int kkt = 1;
	while (kkt--) {
		ll n, m; scanf("%lld %lld", &n, &m);
		vector<ll> jupi(m);
		for (int i = 0; i < m; i++) {
			scanf("%lld", &jupi[i]);
		}
		vector<ll> res;
		vector<bool> used(n + 1);
		for (int i = m - 1; i >= 0; i--) {
			if (used[jupi[i]]) continue;
			res.push_back(jupi[i]);
			used[jupi[i]] = true;
		}
		for (int i = 1; i <= n; i++) {
			if (used[i]) continue;
			res.push_back(i);
		}
		for (int i = 0; i < n; i++) cout << res[i] << "\n";
	}
	return 0;

}



Measured memory_bytes: 5804
N, K = map(int, input().split())
A=list(map(int, input().split()))
L=[0 for _ in range(40)]
ans=[]
ans.append(sum(a^K for a in A))
for a in A:
    i=0
    while a:
        if a&1==1:
            L[i]+=1
        a=a>>1
        i+=1

opt_str=''
for l in L[::-1]:
    if l > N-l:
        opt_str+='0'
    else:
        opt_str+='1'
opt=int(opt_str,2)

for i in range(40):
    tmp=0
    if ((K>>i)&1)==1:
        Kr=(K&((((1<< 40-i)-1)<<(i+1))))|(opt&(1 << i)-1)
        ans.append(sum(a ^ Kr for a in A))

print(max(ans))


Measured memory_bytes: 14984
using System;

namespace ABC063C
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = Int32.Parse(Console.ReadLine());
            int[] score = new int[N];
            int sum = 0;

            for (int i = 0; i < N; i++)
            {
                score[i] = Int32.Parse(Console.ReadLine());
                sum += score[i];
            }
            Array.Sort(score);

            if(sum % 10 == 0)
            {
                int i = 0;
                while (i < N)
                {
                    if (score[i] % 10 != 0)
                    {
                        sum -= score[i];
                        break;
                    }
                    i++;
                }

                if (i >= N)
                {
                    sum = 0;
                }
            }

            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 11092
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn main() {
    let code = read::<String>().chars().collect::<Vec<char>>();

    let mut c = code[0];
    for i in 1..code.len() {
        if c == code[i] {
            println!("Bad");
            return;
        }
        c = code[i];
    }
    println!("Good");
}


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

#define pb push_back
#define mp make_pair

typedef long long ll;

const ll mod = 1e9 + 7;

int cnt[100000];

int main()
{
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;

  int dx = tx - sx;
  int dy = ty - sy;

  for(int i = 0; i < dx; i++){
    cout << (dx>0 ? "R" : "L");
  }

  for(int i = 0; i < dy; i++){
    cout << (dy>0 ? "U" : "D");
  }

  for(int i = 0; i < dx; i++){
    cout << (dx<0 ? "R" : "L");
  }

  for(int i = 0; i < dy; i++){
    cout << (dy<0 ? "U" : "D");
  }

  cout << (dy<0 ? "U" : "D");

  for(int i = 0; i < dx+1; i++){
    cout << (dx>0 ? "R" : "L");
  }

  for(int i = 0; i < dy+1; i++){
    cout << (dy>0 ? "U" : "D");
  }

  cout << (dx<0 ? "R" : "L");

  cout << (dy>0 ? "U" : "D");

  for(int i = 0; i < dx+1; i++){
    cout << (dx<0 ? "R" : "L");
  }

  for(int i = 0; i < dy+1; i++){
    cout << (dy<0 ? "U" : "D");
  }

  cout << (dx>0 ? "R" : "L");

  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int > pii;
inline ll qpow(ll a,ll b,ll mod){ll res=1;while(b){if(b&1)res = (res*a)%mod;a=(a*a)%mod;b>>=1;}return res;}
const int mod = 1e9 + 7;
const int MAXN = 2e5 + 7;

int main(){
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if(s[0] == s[1] && s[2] == s[3] && s[1] != s[2])    cout << "Yes" << endl;
    else    cout << "No" << endl;
    return 0;
}

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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define endl '\n'
#define what_is(x) cerr << #x << " is " << x << endl;
#define what_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << e << ' '; cerr << '\n'; //vector, set
#define what_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << x[i] << ' '; cerr <<  '\n'; //n first element of array
#define cerr_pair(x) '{' << x.st << ", " << x.nd << '}'
#define pwhat_is(x) cerr << #x << " is " << cerr_pair(x) << endl;
#define pwhat_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << cerr_pair(e) << ' '; cerr << '\n'; //vector, set
#define pwhat_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << cerr_pair(x[i]) << ' '; cerr <<  '\n'; //n first element of array
// #define int long long

typedef pair<int,int> pii;
const int N = 1e5+5;
const int INF = 1e9;
const int MOD = 1e9+7;

string s, t;
int32_t main()
{
	IOS
	//freopen("input.txt", "r", stdin);
	cin >> s >> t;
	cout << t+s << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long int
#define endl "\n"
using namespace std;
void solve()
{
	//Enter your code here Tanmay:)
	//int n;
	int arr[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int k;
	cin>>k;
	cout<<arr[k-1];

}
signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}
/*
int eulortotent(int n)
     {
    //Enter your code here Tanmay:)
    int total=n;
        for(int p=2;p*p<=n;p++)
        {
            if (n%p==0)
        {
            total /= p;
            total *= (p-1);
            while ( n % p == 0 ) 
                n /= p;
        }
    }

    if(n>1)
    {
        total/=n;
        total*=(n-1);
    }

  return total;
}
*/

Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <iterator>
#include <utility>
#include <string>
#include <algorithm>
#include <time.h>
#include <tuple>
#include <deque>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <iostream>

#define endl '\n'
#define pb push_back
#define fi first
#define se second
#define pll pair<long long, long long>
#define all(v) v.begin(), v.end()

using namespace std;

typedef long long int ll;

mt19937 rnd(time(NULL));

const ll INF = (ll)1e18;
const ll MOD = 1e9 + 7;
const ll maxn = (ll)2 * 1e5 + 10, L = 23;

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll k, n;
    cin >> k >> n;
    vector<ll> a(n);
    for (ll i = 0; i < n; ++i)
        cin >> a[i];
    ll ans = INF;
    ll kek = k - a[n - 1] + a[0];
    for (ll i = 0; i < n; ++i) {
        ll led = (i ? a[i - 1] - a[i] : kek),
            red = (i != n - 1 ? a[i + 1] - a[i] : kek);
        ans = min({ ans, k - led, k - red });
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// --------------------------------------------------------
#define FOR(i,l,r) for (int i = (l); i < (r); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define MIN(c) *min_element(ALL(c))
#define MAX(c) *max_element(ALL(c))
#define SUM(c) accumulate(ALL(c), 0)
#define SUMLL(c) accumulate(ALL(c), 0LL)
#define SZ(c) ((int)(c).size())
#define debug(x) cerr << #x << " = " << (x) << '\n';
using P = pair<int,int>;
using VP = vector<P>;
using VVP = vector<VP>;
using VS = vector<string>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<ll>;
using VVLL = vector<VLL>;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const ll MOD = 1000000007;
// const ll MOD = 998244353;
const int INF = 1 << 30;
// const ll INF = 1LL << 62;
// --------------------------------------------------------


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);

    int N; cin >> N;
    VVLL BA(N, VLL(2)); REP(i, N) cin >> BA[i][1] >> BA[i][0];

    SORT(BA);
    ll sum_A = 0;
    string ans = "Yes";
    REP(i, N) {
        sum_A += BA[i][1];
        if (sum_A > BA[i][0]) {
            ans = "No";
            break;
        }
    }
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 14272
n, m=gets.split.map &:to_i
arr=[]
m.times do |i|
  arr << gets.split.map(&:to_i) +[i]
end
puts arr.group_by{|a|
  a[0]
}.map{|a|
  {a.first => a[1].sort.map.with_index{|aa,ii|
    aa+ [ii+1]}
  }
}.map{|a|
  a.values.first
}.flatten(1).sort_by{|a|a[2]}.map{|a|
  sprintf('%06d%06d',a[0],a[3])
}.join("\n")

  


Measured memory_bytes: 86368
def main():
    n = int(input())
    As = [0] + list(map(int, input().split())) + [0]

    cumsum = [0] * (n+1)
    for i in range(1, n+2):
        cumsum[i-1] = abs(As[i] - As[i-1])
    cumsum_sum = sum(cumsum)
    for i in range(1, n+1):
        ans = cumsum_sum - cumsum[i-1] - cumsum[i] + abs(As[i+1] - As[i-1])
        print(ans)


if __name__ == "__main__":
    main()


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

int gcd(long long a, long long b) { return b != 0 ? gcd(b, a % b) : a; }
// cout << fixed << setprecision(10);
// vector<vector<int>> vec(H, vector<int>(W))    // int H*W
// int binary_search(int key) {
//     int ng = -1;
//     int ok = (int)a.size();
//     while(abs(ok - ng) > 1) {
//         int mid = (ok + ng) / 2;
//         if(isOK(mid, key))
//             ok = mid;
//         else
//             ng = mid;
//     }
//     return ok;
// }
int main() {
    double a, b, x;
    cin >> a >> b >> x;
    double left = (double)2 * x / (a * a);
    double ans;
    if(left > b) {
        double tmp = (double)2 * (b - x / (a * a)) / a;
        ans = atan((double)2 * (b - x / (a * a)) / a);
    } else if(left == b) {
        ans = atan((double)b / a);
    } else {
        ans = atan((double)a * b * b / (2 * x));
    }
    ans *= 180 / M_PI;
    cout << fixed << setprecision(10);
    cout << ans << endl;
}

Measured memory_bytes: 888
#include<iostream>
#include<string>
using namespace std;
int main(){
	int i=0;
	bool f=0;
	string a,b;
	cin>>a>>b;
	if(a.size()==b.size()){
		f=1;
		for(i=0;a[i]==b[i] && i>0;i++);
	}
	if(a.size()>b.size() ||( a[i]>b[i] && f))cout<<"GREATER";
	else if(a.size()<b.size() || (a[i]<b[i] &&f))cout<<"LESS";
	else cout<<"EQUAL";
	cout<<endl;
	return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
using i64 = long long;

int main()
{
  i64 n, k;
  cin >> n >> k;
  vector<i64> x(n), y(n);
  for (i64 i = 0; i < n; i++)
    cin >> x[i] >> y[i];
  vector<pair<double, double>> cnt;
  for (i64 i = 0; i < n; i++)
    for (i64 j = i + 1; j < n; j++)
      if (x[i] != x[j])
      {
        double t = (double)(y[i] - y[j]) / (x[i] - x[j]);
        double s = (double)(x[i] * y[j] - x[j] * y[i]) / (x[i] - x[j]);
        cnt.push_back({t, s});
      }
  sort(cnt.begin(), cnt.end());
  i64 size = cnt.size();
  i64 c = 1, m = 1;
  for (i64 i = 1; i < size; i++)
    if (cnt[i] == cnt[i - 1])
    {
      c++;
    }
    else
    {
      m = max(m, c);
      c = 1;
    }
  if (k * (k - 1) / 2 <= max(m, c))
  {
    cout << 1 << endl;
    return 0;
  }
  map<i64, i64> cntx;
  for (i64 i = 0; i < n; i++)
    cntx[x[i]]++;
  for (pair<i64, i64> i : cntx)
    if (k <= i.second)
    {
      cout << 1 << endl;
      return 0;
    }
  cout << 0 << endl;
  return 0;
}



Measured memory_bytes: 134096
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pb push_back
#define mp make_pair

int N,K;
int g[200][200];

void solve()
{
	const int L = (N-1)*(N-2)/2;
	memset(g, 0, sizeof(g));
	if(K > L) cout << -1 << endl;
	else{
		int cur = L;
		for(int i=1;i<N;++i){
			g[i][N]=g[N][i]=1;
		}
		while(cur > K){
			for(int i=1;i<N;++i)for(int j=i+1;j<N;++j){
				if(!g[i][j]){
					g[i][j]=g[j][i]=1;
					cur--;
					goto out;
				}
			}
			out:
				continue;
		}
		int cnt = 0;
		for(int i=1;i<=N;++i)for(int j=i+1;j<=N;++j)if(g[i][j])cnt++;
		cout << cnt << endl;
		for(int i=1;i<=N;++i)for(int j=i+1;j<=N;++j)if(g[i][j])cout << i << " " << j << endl;
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> N >> K;
	solve();
	return 0;
}

Measured memory_bytes: 384
#include <vector>
#include <map>
#include <algorithm>
#include <cstdio>
using namespace std;

map<int,int>memo;
vector<int>S,T;
int n;

int dfs(int t){
	if(memo.find(t)!=memo.end())return memo[t];
	int r=0;
	for(int i=0;i<n;i++)if((t&T[i])==T[i]){
		int x=S[i]+dfs(t&(~T[i]));
		if(r<x)r=x;
	}
	return memo[t]=r;
}

int main(){
	for(;scanf("%d",&n),n;){
		memo.clear();
		S.resize(n);
		T.resize(n);
		fill(T.begin(),T.end(),0);
		for(int i=0;i<n;i++){
			int m;
			for(scanf("%d%d",&m,&S[i]);m--;){
				int st,en;
				scanf("%d%d",&st,&en);
				for(int j=st-6;j<en-6;j++)T[i]|=1<<j;
			}
		}
		printf("%d\n",dfs(0xffff));
	}
}

Measured memory_bytes: 3912
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int check = 0;
  vector<vector<int>> a(3, vector<int>(3));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> a.at(i).at(j);
    }
  }
  int N;
  cin >> N;
  for (int k = 0; k < N; k++) {
    int b;
    cin >> b;
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        if (b == a.at(i).at(j)) {
          a.at(i).at(j) = 0;
        }
      }
    }
  }
  for (int i = 0; i < 3; i++) {
    if (a.at(i).at(0) == a.at(i).at(1) && a.at(i).at(1) == a.at(i).at(2)) {
      check = 1;
    }
  }
  for (int j = 0; j < 3; j++) {
    if (a.at(0).at(j) == a.at(1).at(j) && a.at(1).at(j) == a.at(2).at(j)) {
      check = 1;
    }
  }
  if (a.at(0).at(0) == a.at(1).at(1) && a.at(1).at(1) == a.at(2).at(2)) {
    check = 1;
  }
  if (a.at(0).at(2) == a.at(1).at(1) && a.at(1).at(1) == a.at(2).at(0)) {
    check = 1;
  }
  if (check == 1) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll value[1005],weight[1005];
ll dp[1005][100005];
ll ans(ll n,ll w)
{
    if(n==0||w==0)
    return 0;
    if(n<0||w<0)
    return INT_MIN;
    if(dp[n][w]!=-1)
    return dp[n][w];
    if(weight[n]>w)
    {dp[n][w]=ans(n-1,w);
    return dp[n][w];}
    else
    {
        dp[n][w]=max(ans(n-1,w),value[n]+ans(n-1,w-weight[n]));
        return dp[n][w];
    }
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll t;
    t=1;
    while(t--)
    {
        ll n,w;
        cin>>n>>w;
        for(ll i=1;i<=n;i++)
        cin>>weight[i]>>value[i];
        for(ll i=0;i<=n;i++)
        for(ll j=0;j<=w;j++)
        dp[i][j]=-1;
        cout<<ans(n,w)<<"\n";
    }
    return 0;
}

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

using namespace std;

using llong = long long int;

#define rep(i, n) for (int i = 0; i < n; ++i)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define delete

const static int MOD = 1000000007;
const static int INF = 1<<30;
const static int dx[4] = {1, 0, -1, 0};
const static int dy[4] = {0, 1, 0, -1};

int main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int k;
    cin >> k;

    string ans = "";
    rep(_, k) ans += "ACL";

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

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
typedef long long ll;
typedef pair<int64_t,int64_t> pll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)
#define sz(s) (s).size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second

void solve()
{   
    stack<char>s;
    char x;
    while(cin>>x){
        if(x=='T'){if(s.empty()||s.top()=='T')s.push('T');else if(s.top()=='S')s.pop();}
        else if(x=='S')s.push('S');
    }cout<<s.size()<<endl;
}


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

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

using namespace std;
typedef long long ll;


template <typename T>
T bfs(vector<vector<T> > a, vector<bool> vis, T source)
{
    static_assert(is_same<T, int>::value || is_same<T, ll>::value, "this bfs function can only be in type \"int\" or \"long long int\"!\n");
    T element_num = 1;
    queue<T> q;
    q.emplace(source);
    vis.at(source) = true;
    while(!q.empty())
    {
        T top = q.front();
        q.pop();
        for(T i = 0; i < (T)a.at(top).size(); i++)
        {
            T tem = a.at(top).at(i);
            if(vis.at(tem)) continue;
            vis.at(tem) = true;
            q.emplace(tem);
            element_num++;
        }
    }
    return element_num;
}

template <typename T>
T dfs(vector<vector<T> > a, vector<bool> vis, T source)
{
    static_assert(is_same<T, int>::value || is_same<T, ll>::value, "this dfs function can only be in type \"int\" or \"long long int\"!\n");
    T element_num = 1;
    stack<T> s;
    s.push(source);
    vis.at(source) = true;
    while(!s.empty())
    {
        T top = s.top();
        s.pop();
        for(T i = 0; i < (T)a.at(top).size(); i++)
        {
            T tem = a.at(top).at(i);
            if(vis.at(tem)) continue;
            vis.at(tem) = true;
            s.emplace(top);
            s.emplace(tem);
            element_num++;
            break;
        }
    }
    return element_num;
}

template <typename T>
vector<vector<T> > input_graph(T array_num, T edge_num)
{
    static_assert(is_same<T, int>::value || is_same<T, ll>::value, "this input_graph function can only be in type \"int\" or \"long long int\"!\n");
    vector<vector<T> > a(array_num, vector<T>());
    for(T i = 0; i < edge_num; i++)
    {
        T d1, d2;
        cin >> d1 >> d2;
        a.at(d1-1).emplace_back(d2-1);
        a.at(d2-1).emplace_back(d1-1);
    }

    return a;
}

template <typename T>
vector<T> input_vector(T array_num)
{
    static_assert(is_same<T, int>::value || is_same<T, ll>::value, "this input_vector function can only be in type \"int\" or \"long long int\"!\n");
    vector<T> a(array_num, 0);
    for(T i = 0; i < array_num; i++)
    {
        cin >> a.at(i);
    }

    return a;
}

ll inf = 1e9+7;


int main() {
    int n, k, d;
    string s;
    cin >> s;
    n = 0;
    k = 0;
    for(int i = 0; i < s.size(); i++)
    {
        if (s[i] != 'A' && s[i] != 'T' && s[i] != 'C' && s[i] != 'G' )
        {
            if(n < k)
            {
                n = k;
                k = 0;
            }
        }
        else
        {
            k++;
        }
    }
    if(n < k)
    {
        n = k;
    }

    cout << n ;

    return 0;
}


Measured memory_bytes: 256
import heapq

def dijkstra(graph, weights, s):
    d = {u: float('inf') for u in graph}
    d[s] = 0
    queue = []
    heapq.heappush(queue, (0, s))
    while queue:
        w, u = heapq.heappop(queue)
        for v in graph[u]:
            d_temp = d[u] + weights[u, v]
            if d[v] > d_temp:
                d[v] = d_temp
                heapq.heappush(queue, (d_temp, v))
    return d

n = int(input())
graph, weights = {}, {}
for _ in range(n):
    line = input().split()
    neighbors = []
    for i in range(0, 2 * int(line[1]), 2):
        neighbors.append(line[2+i])
        weights[line[0], line[2+i]] = int(line[3+i])
    graph[line[0]] = neighbors

d = dijkstra(graph, weights, '0')

for i in range(n):
    print(i, d[str(i)])


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

typedef long long ll;

using namespace std;

int main(){
    string s;
    cin >> s;
    for(int i = 0; i < s.length()-1; i++){
        if(s[i] == s[i+1]) {
            cout << "Bad" << endl;
            return 0;
        } 
    }
    cout << "Good" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
using P = pair <int, int>;
 
 
int main() {
    string a,s,c;
    cin >> a>>s>>c;
    cout << 'A'<<s[0] << 'C' << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int a,b,c,d;
  scanf("%d%d%d%d",&a,&b,&c,&d);
  while(a>0&&c>0){
    c=c-b;
    a=a-d;
  }
  if(c<=0) printf("Yes");
  else printf("No");
  return 0;
}


Measured memory_bytes: 1728
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
using namespace std;

int main(){
	long long n,h=0,w=0;
	cin >> n;
	
	vector<long long> a(n,0);
	
	for(long long i=0;i<n;i++){
		cin >> a[i];
	}
	
	sort(a.begin(),a.end(),greater<long long>());
	
	for(long long i=1;i<n;i++){
		if(h==0){
			if(a[i]==a[i-1]){
				h=a[i];
				a[i]=0;
				a[i-1]=0;
				continue;
			}
		}
		if(w==0){
			if(a[i]==a[i-1]){
				w=a[i];
				cout << h*w << endl;
				return 0;
			}
		}
	}
	
	cout << "0" << endl; 
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(ll i=0;i<n;i++)

int main(){
	int n;cin>>n;
	int a[n];
	rep(i,n) cin>>a[i];
	int s[n+1]={};
	vector<int> vec;
	for(int i=n-1;i>=0;i--){
		int sum=0,j=(i+1);
		for(int k=2;k*j<=n;k++){
			sum+=s[j*k];
		}
		if(sum%2==a[i]) s[i+1]=0;
		else{
			s[i+1]=1;
			vec.push_back(i+1);
		}
	}
	cout<<vec.size()<<"\n";
	rep(i,vec.size()) cout<<vec[i]<<" ";
	cout<<"\n";
}

Measured memory_bytes: 3064
from math import gcd 
K=int(input())

A=[0]*K

for i in range(K,0,-1):
    b=pow(K//i,3)
    A[i-1]=b

for i in range(K,0,-1):
    for j in range(K//i-1):
        c=i*(j+2)
        A[i-1]-=A[c-1]

s=0
for i in range(K):
    s+=A[i]*(i+1)

print(s)

Measured memory_bytes: 9124
#include <bits/stdc++.h>
using namespace std;
int ans[40];
int n, m, a, k;
int cnt = 0;
int main()
{
    cin >> n >> m;
    for (int i = 0; i < n; i++)
    {
        cin >> k;
        for (int j = 0; j < k; j++)
        {
            cin >> a;
            ans[a]++;
        }
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (in i = 0; i < (in)(n); i++)
const double PI=3.14159265358979323846;
const int64_t waru = 1000000007;
const in INF=1<<30;
using vec = vector<vector<vector<vector<int>>>>;
 int main(){
   in n,k;
   cin>>n>>k;
   vector<in> h(n);
   rep(i,n) cin>>h.at(i);

   sort(all(h));
   if(k>=n){cout<<0; return 0;}
   for(int i=n-1;true;i--){
     if(k==0ll) break;
     h.at(i)=0ll;
     k --;
   }
   
   in sum=0ll;
   rep(i,n){
     sum +=h.at(i);
   }
   cout<<sum;
 }


Measured memory_bytes: 1792
#include <bits/stdc++.h>
//For ordered_set
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define MOD 1000000007
#define test int t; cin>>t; while(t--)
#define init(arr,val) memset(arr,val,sizeof(arr))
#define loop(i,a,b) for(int i=a;i<b;i++)
#define loopr(i,a,b) for(int i=a;i>=b;i--)
#define loops(i,a,b,step) for(int i=a;i<b;i+=step)
#define looprs(i,a,b,step) for(int i=a;i>=b;i-=step)
#define ull unsigned long long int
#define ll long long int
#define P pair
#define PLL pair<long long, long long>
#define PII pair<int, int>
#define PUU pair<unsigned long long int, unsigned long long int>
#define L list
#define V vector
#define D deque
#define ST set
#define MS multiset
#define M map
#define UM unordered_map
#define mp make_pair
#define pb push_back
#define pf push_front
#define MM multimap
#define F first
#define S second
#define IT iterator
#define RIT reverse_iterator
#define FAST ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define FILE_READ_IN freopen("input.txt","r",stdin);
#define FILE_READ_OUT freopen("output.txt","w",stdout);
#define all(a) a.begin(),a.end()
using namespace std;
// For ordered_set
using namespace __gnu_pbds;
template <typename T>
using ord_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
const ll maxn = 1e5;
const ll inf = 1e9;
const double pi = acos(-1);
ll dp[1000000][4];

ll solve(ll a[],ll b[],ll c[],ll n,ll prev){
    if(n<0)
    {
        return 0;
    }
    else
    {
        if(dp[n][prev]!=-1)
        {
            return dp[n][prev];
        }
        ll max1=0,max2=0,max3=0;
        if(prev==1)
        {
            max2=solve(a,b,c,n-1,2)+a[n];
            max3=solve(a,b,c,n-1,3)+a[n];
        }
        if(prev==2)
        {
            max1=solve(a,b,c,n-1,1)+b[n];
            max3=solve(a,b,c,n-1,3)+b[n];
        }
        if(prev==3)
        {
            max1=solve(a,b,c,n-1,1)+c[n];
            max2=solve(a,b,c,n-1,2)+c[n];
        }
        ll maxi=max(max1,max2);
        maxi=max(max3,maxi);
        dp[n][prev]=maxi;
        
        return dp[n][prev];
    }
    
    
}

int main(){
   ll n;
   cin>>n;
   ll a[n],b[n],c[n];
   for(ll i=0;i<n;i++)
   {
       cin>>a[i]>>b[i]>>c[i];
   }
    for(ll i=0;i<100000;i++)
    {
        for(ll j=0;j<4;j++)
        dp[i][j]=-1;
    }
    
   //cout<<solve(a,b,c,n-1,3)<<"\n";
   ll ans1=solve(a,b,c,n-1,1);
   ll ans2=solve(a,b,c,n-1,2);
   ll ans3=solve(a,b,c,n-1,3);
   ll ans=max(ans1,ans2);
   ans=max(ans,ans3);
   cout<<ans<<'\n';
   return 0;
}


Measured memory_bytes: 18456
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
signed main(){
  int x;cin>>x;
  int k;
  rep1(i,360){
      if((i*x)%360==0){
          k=i;
          break;
      }
  }
  cout<<k<<"\n";
  return 0;
}

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

//using INF = INT_MAX / 2;
//#define int long long

#define DEBUG
#ifdef DEBUG
#define dump(x) cout << "[*] " #x ": " << x << endl
#define debug(x) x
#else
#define dump(x)
#define debug(x)
#endif

// dp[i][v] := v の価値の時 i 個の荷物を入れた時の重量の総和
long long dp[105][100005];

decltype(1) main() {
    int N, W;
    cin >> N >> W;
    vector<int> w(N);
    vector<int> v(N);
    for (int i = 0; i < N; ++i) {
        cin >> w[i] >> v[i];
    }
    for (int i = 0; i <= 104; ++i) {
        for (int j = 0; j <= 100000; ++j) {
            dp[i][j] = LONG_MAX / 2;
        }
    }
    dp[0][0] = 0;

    for (int i = 0; i < N; ++i) {
        for (int j = 0; j <= 100000; ++j) {
            if (j - v[i] >= 0) {
                dp[i+1][j] = min(dp[i+1][j], dp[i][j - v[i]] + w[i]);
            }
            dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
            //dp[i+1][j] = min(dp[i+1][j], j-v[i] >= 0 ? dp[i][j - v[i]] + w[i] : dp[i][j]);
        }
    }

    long long int ans = 0;
    for (int i = 0; i <= 100000; ++i) {
        if (dp[N][i] > W) {
            continue;
        } else if (dp[N][i] > 0) {
            ans = i;
        }
    }
    cout << ans << endl;

    return 0;
}


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

int main(){
    int N, K; cin >> N >> K; int A[N];
    for (int i = 0; i < N; i++) cin >> A[i];
    cout << (N-1) / (K-1) + ((N-1) % (K-1) != 0) << endl;

    return 0;
}


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

public class Main {

	/* --------------------------------------------------------------------
	   main
	 * -------------------------------------------------------------------- */
	public static void main(String args[]) throws Exception {

		// ----- input -----
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
		String n = input.readLine();
		int num = Integer.parseInt(n);
		input.close();

		// ----- main -----
		int w = 0;
		for(int i=0; i < n.length(); i++) {
			w += Character.getNumericValue(n.charAt(i));
		}
		System.out.println(num%w==0?"Yes":"No");
	}
}


Measured memory_bytes: 22228
N, M = map(int, input().split())
L = [0 for i in range(M)]
R = [0 for i in range(M)]
for i in range(M):
        L[i], R[i] = map(int, input().split())

Lmax = max(L)
Rmin = min(R)
if Lmax > Rmin:
        print(0)
else:
        print(Rmin - Lmax + 1)


Measured memory_bytes: 10984
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rep3(var, min, max) for (ll (var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll (var) = (max) - 1; (var) + 1 > (min); --(var))
#define Mp(a,b) make_pair((a),(b))
#define F first
#define S second
#define CIN(s) int (s);cin>>(s);
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll MOD = 1e9 + 7;
ll INF =1e18;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    if(n%2==0){
        cout<<n/2-1<<endl;
    }else{
        cout<<n/2<<endl;
    }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
string name[50];
string code[50];
int main() {
	int n;
	while (cin >> n, n) {
		for (int i = 0; i < n; i++) {
			cin >> name[i];
			code[i].clear();
		}
		int ans = -1;
		for (int i = 0; i < n; i++) {
			code[i].push_back(name[i][0]);
			for (int j = 0; j < name[i].size(); j++) {
				if (name[i][j] == 'a' || name[i][j] == 'i' || name[i][j] == 'u' || name[i][j] == 'e' || name[i][j] == 'o') {
					if (j + 1 < name[i].size()) code[i].push_back(name[i][j + 1]);
				}
			}
		}
		for (int i = 0; i <= 50; i++) {
			set<string> S;
			for (int j = 0; j < n; j++) {
				string s;
				for (int k = 0; k < min((int)code[j].size(), i); k++) {
					s.push_back(code[j][k]);
				}
				S.insert(s);
			}
			if (S.size() == n) {
				ans = i;
				break;
			}
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long MOD = 998244353;
const long long INF = 1LL << 60;
const int inf = pow(10, 9) + 7;
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

int main()
{
  int N;
  cin >> N;
  
  int ans = 0;
  for (int i = 0; i < N; i++)
  {
    int l, r;
    cin >> l >> r;
    ans += r - l + 1;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
int main()
{
    int N, M;
    cin >> N >> M;

    string ans = "Yes";
    if(N!=M) ans = "No"; 
    cout << ans << endl;

   return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys
sys.setrecursionlimit(10**7)

def main(N,G):
    global ans
    ans = [-1]*N
    dfs(0,0)
    for i in ans:
        print(i)

def dfs(v,now):
    ans[v] = now
    for next_v, w in G[v]:
        if(ans[next_v]!=-1):
            continue
        if w:
            dfs(next_v,1-now)
        else:
            dfs(next_v,now) 
            
if __name__ == '__main__':
    N = int(input())
    G = [[]for i in range(N)]
    for i in range(N-1):
        u, v, w = map(int, input().split())
        u -= 1
        v -= 1
        G[u].append((v,w%2))
        G[v].append((u,w%2))
    main(N,G)

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

bool pal(int a)
{
    string s;
    s=to_string(a);
    int n=s.size();
    for(int i=0;i<n/2;i++)
    {
        if(s[i]!=s[n-1-i])
            return false;
    }
    return true;
}



int main()
{
    int a,b,ans=0;
    cin>>a>>b;
    if(a>b)
        swap(a,b);
    for(int i=a;i<=b;i++)
    {
        if(pal(i))
            ++ans;
    }
    cout<<ans;
    return 0;
}




Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;

vector<pair<ll,ll>> count_num(ll N){
    vector<pair<ll,ll>> num_pair;
    for(ll i = 2; i * i <= N; ++i){
        if (N % i != 0) continue;
        ll cnt = 0;
        while (N % i == 0)
        {
            ++cnt;
            N /= i;
        }
        num_pair.push_back({i,cnt});          
    } 
    if(N!=1){
        num_pair.push_back({N,1});
    }
    return num_pair;
}

int main() {
    ll N;
    cin >> N;
    ll ans = 1;
    vector<long long> exp(N+1, 0);

    for(ll n = 2; n <= N; ++n){
        const auto &num_pair = count_num(n);
        for(auto p:num_pair) exp[p.first] += p.second;
    }

    for(ll i = 2; i <= N; ++i){
        ans *= (exp[i] + 1);
        ans %= MOD;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
int main(){
	int day,hw;
	cin>>day>>hw;
	int work,cnt=0;
	for(int i=1;i<=hw;i++)
	{
		cin>>work;
		cnt+=work;
	}
	if(cnt>day)
		cout<<-1;
	else
		cout<<day-cnt;
	
	return 0;
}

Measured memory_bytes: 3624
n = int(input())
S = [input() for i in range(n)]
ans = ''
num = []
for spell in range(26):
    for s in S:
        tmp = chr(97+spell)
        num.append(s.count(tmp))
    for i in range(min(num)):
        ans = ans + tmp
    num = []

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define ll long long
#define endl "\n"
#define print_array(name,n) for(ll o=0;o<n;o++) cout<<name[o]<<" "
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 2e18
#define pll pair<ll,ll>
#define pii pair<int,int>
bool sortbysecond(const pair<int,int> &a,const pair<int,int> &b){
	return (a.ss>b.ss);
}
 
ll gcd(ll a,ll b){ if(b==0) return a; return gcd(b,a%b) ;} 

template <typename T>
string NumberTostring(T Number )
{
	ostringstream ss;
	ss<<Number;
	return ss.str();
}
 

 
int main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
 	ll n;
 	cin>>n;
 	ll ans = 0;
 	vector<int> vec(n);
 	for(int i=0;i<n;i++){
 		cin>>vec[i];
 	}
 	for(int i=0;i<n-2;i++){
 		for(int j=i+1;j<n-1;j++){
 			for(int k = j+1;k<n;k++){
 				if(vec[i]+vec[j]> vec[k] and vec[i]+vec[k]> vec[j] and vec[k]+vec[j]> vec[i]){
 					if(vec[i]!=vec[j] and vec[i]!=vec[k] and vec[j]!=vec[k]){
 						// cout<<vec[i]<<vec[j]<<vec[k]<<endl;
 						ans++;
 					}
 				}
 			}
 		}
 	}   
 	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3644
//header{{{
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/math/common_factor_rt.hpp>
  
using namespace std;
//using namespace boost::multiprecision;  
//using namespace boost::math;

#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 Fixed fixed << setprecision(12)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7; 
constexpr int MOD = 998244353;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }

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

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

    string s, t;
    cin >> s >> t;

    int cnt = 0;

    rep(i, s.size()){
        cnt += (s[i] != t[i]);
    }

    cout << cnt << '\n';

    return 0;
}




Measured memory_bytes: 3800
/*
h s, d't skp th si tll i's sved
 * ABC141 E
*/
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
int main()
{
int n;
cin>>n;
string ans="No";
for(int i=1;i<=9;i++)
{
if(n%i==0 && n/i<=9)
{
ans="Yes";
break;
}
}
cout<<ans;
}

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


int main(){
  ll n;
  cin >> n;
  map<ll,int> mp;
  for(ll i=0;i<n;++i){
    ll a;
    cin >> a;
    mp[a]++;
  }
  ll k=mp.size();
  if(k%2==0) cout << k-1 << endl;
  else cout << k << endl;

  return 0;
}


Measured memory_bytes: 9804
import math
k=int(input())

sum_num=0
for i in range(1,k+1):
  for j in range(1,k+1):
    tmp=math.gcd(j,i)
    for l in range(1,k+1):
      s=math.gcd(l,tmp)
      sum_num+=s
      
print(sum_num)

Measured memory_bytes: 9124
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>

#define R register
typedef long long ll;
int dig(R ll x)
{
	R int ret = 0; while (x) ++ret, x /= 10;
	return ret;
}
int main()
{
	R ll n; scanf("%lld", &n);
	R int ans = 100;
	for (R int i = 1; 1ll * i * i <= n; ++i)
		if (n % i == 0 && dig(n / i) < ans)
			ans = dig(n / i);
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;
long long x, a, b;
int main()
{
	cin >> x >> a >> b;
	b -= a;
	if(b <= 0){
		cout << "delicious";
	}else if (b <= x){
		cout << "safe";
	}else{
		cout << "dangerous";
	}
    return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DLamp solver = new DLamp();
        solver.solve(1, in, out);
        out.close();
    }

    static class DLamp {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int h = in.nextInt();
            int w = in.nextInt();
            char[][] arr = new char[h][w];
            for (int i = 0; i < h; i++) {
                arr[i] = in.next().toCharArray();
            }

            int[][] maxPerRow = new int[h][w];
            for (int i = 0; i < h; i++) {
                int from = 0;
                int to = -1;
                for (int j = 0; j < w; j++) {
                    if (arr[i][j] == '#') {
                        for (int k = from; k <= to && k < w; k++) {
                            maxPerRow[i][k] = to - from + 1;
                        }
                        from = j + 1;
                        to = j;
                    } else {
                        to++;
                    }
                }
                for (int k = from; k <= to && k < w; k++) {
                    maxPerRow[i][k] = to - from + 1;
                }
            }

            int[][] maxPerCol = new int[h][w];
            for (int j = 0; j < w; j++) {
                int from = 0;
                int to = -1;
                for (int i = 0; i < h; i++) {
                    if (arr[i][j] == '#') {
                        for (int k = from; k <= to && k < h; k++) {
                            maxPerCol[k][j] = to - from + 1;
                        }
                        from = i + 1;
                        to = i;
                    } else {
                        to++;
                    }
                }
                for (int k = from; k <= to && k < h; k++) {
                    maxPerCol[k][j] = to - from + 1;
                }
            }

            int res = 0;
            for (int i = 0; i < h; i++)
                for (int j = 0; j < w; j++)
                    res = Math.max(res, maxPerRow[i][j] + maxPerCol[i][j] - 1);
            out.println(res);

        }

    }
}



Measured memory_bytes: 108128
<?php
$n=trim(fgets(STDIN));
$b=explode(" ",trim(fgets(STDIN)));
$a[0]=$b[0];
$i=1;
while($i<$n-1){
  if($b[$i-1]<=$b[$i]){
    $a[$i]=$b[$i-1];
  }else{
    $a[$i]=$b[$i];
  }
  ++$i;
}
$a[$n-1]=$b[$n-2];
echo array_sum($a);

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

int dp[5005][5005];

int main(void){
    int N; cin >> N;
    string S; cin >> S;
    
    int ans = 0;
    for (int i = 0; i < N; i++) {
        for (int j = i+1; j < N; j++) {
            if (S[i] == S[j]) {
                dp[i+1][j+1] = min(dp[i][j] + 1, j - i);
            }
            ans = max(ans, dp[i+1][j+1]);
        }
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 96768
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
typedef pair<int,int>P;
#define fi first
#define se second

int dp[4003][4003],r[2003],b[2003];

signed main(){
  string s;
  cin>>s;
  int n=s.size();
  r(i,s.size()){
    if(s[i]=='0')r[i]=2;
    if(s[i]=='1')r[i]=1,b[i]=1;
    if(s[i]=='2')b[i]=2;
  }
  r(i,s.size()-1){
    r[i+1]+=r[i];
    b[i+1]+=b[i];
  }
  dp[0][0]=1;
  r(i,n*2){
    r(j,n*2)if(j<=i){
      int x=min(i,n-1);
      if(r[x]-j>0)dp[i+1][j+1] += dp[i][j];
      if(b[x]-(i-j)>0)dp[i+1][j] += dp[i][j];
      dp[i+1][j+1]%=998244353;
      dp[i+1][j]%=998244353;
    }
  }
  int sum=0;
  r(i,4003)sum+=dp[n*2][i],sum%=998244353;
  cout<<sum<<endl;
}

Measured memory_bytes: 123648
#include "bits/stdc++.h"

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<int, int> P;
struct Edge{ll from, to, cost;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

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

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N;
  cin >> N;
 
  llvec A(N);
  llvec R(N);
  llvec L(N), cand(N);

  
  rep(i, N){
    cin >> A[i];
    if(i==0){
      L[i]=A[i];
    }else{
      L[i] = gcd(L[i-1], A[i]);
    }
  }

  R[N-1] = A[N-1];
  for(ll i=N-2;i>=0;i--){
    R[i] = gcd(R[i+1], A[i]);
  }

  ll ans = 0;
  rep(i, N){
    ll l, r;
    if(i==0){
      l=R[1];
      r = R[1];
    }else if( i==N-1){
      l = L[N-2];
      r = L[N-2];
    }else{
      l = L[i-1];
      r = R[i+1];      
    }
    ans = max(ans, gcd(l, r));
  }

  cout << ans;
  return 0;
}


Measured memory_bytes: 3328