akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define FOR0(i,n) for(ll i=0;i<n;i++)
#define FOR1(i,n) for(ll i=1;i<=n;i++)
#define FORl(i,l,n) for(ll i=l;i<n;i++)
using namespace std;
#define pi pair<int,int>
#define pb push_back
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define mst0(x) memset(x,0,sizeof(x));
#define vi vector<ll>
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define sp <<" "<<
#define intmax 1e18
ll power(ll num,ll g,ll mod){
  if(g==0)return 1;
  if(g%2==1)return (num*power((num*num)%mod,g/2,mod))%mod;
  return power( (num*num)%mod,g/2,mod);
}

int main(){
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int f=0;
	while(a>0 && c>0){
		if(f==0){
			c-=b;
			f=1;
		}else{
			a-=d;
			f=0;
		}
	}
	if(a<=0)cout<<"No"<<endl;
	else cout <<"Yes"<<endl;
}

Measured memory_bytes: 3620
#include "iostream"
#include<vector>
using namespace std;
int arr[100000];
int main()
{
    int n,k,q;
    cin>>n>>k>>q;

    for(int i=1;i<=n;i++)
    {
        arr[i]=k-q;
    }

    int min;
    for(int i=0;i<q;i++)
    {
        cin>>min;
        

        arr[min]=arr[min]+1;
        
    }
    
    for(int i=1;i<=n;i++)
    {
        if(arr[i]>0)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
        
    }
    
    
    
    
}




Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    string S;
    cin >> S;
    char before = S[0];
    int ans = 0;
    FOR(i, 1, S.length()) {
        if (S[i] == before) {
            before = (before == '0') ? '1' : '0';
            ans++;
        }
        else before = S[i];
    }
    int ans2 = 1;
    before = (S[0] == '0') ? '1' : '0';
    FOR(i, 1, S.length()) {
        if (S[i] == before) {
            before = (before == '0') ? '1' : '0';
            ans2++;
        }
        else before = S[i];
    }
    cout << min(ans, ans2) << endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <queue>
#include <cstring>
const int MAX_W = 100, MAX_H = 100;

typedef std::pair<int,int> P;
int map[MAX_H + 1][MAX_W + 1], w, h;

int bfs(P sp, P gp, int c){
	//½±Æª é©ði[
	int f[MAX_H + 1][MAX_W + 1] = {{0}};
	std::queue<P> q;
	q.push(P(sp.first, sp.second));
	
	while(q.size()){
		P p = q.front(); q.pop();
		//S[Å«½ç¬÷
		if(p.first == gp.first && p.second == gp.second)return 1;
		
		int vy[4] = {-1, 1, 0, 0}, vx[4] = {0, 0, -1, 1};
		for(int i=0;i<4;i++){
			int nx = p.first + vx[i], ny = p.second + vy[i];
			if(nx >= 0 && nx <= w && ny >= 0 && ny <= h && map[ny][nx] == c && !f[ny][nx])
				q.push(P(nx,ny)), f[ny][nx] = 1;
		}
	}

	//ÅãÜÅS[Å«È¢Èç¸s
	return 0;
}

int main(){
	P sp, gp;
	while(std::cin >> w >> h, w && h){
		memset(map,0,sizeof(map));
		std::cin >> sp.first >> sp.second;
		std::cin >> gp.first >> gp.second;

		int n;
		std::cin >> n;
		//ubNÌÝu
		while(n--){
			int c, d, x, y;
			std::cin >> c >> d >> x >> y;
			
			int mx, my;
			if(d)//w < h
				my = 4, mx = 2;
			else//w > h
				mx = 4, my = 2;
			for(int i=y;i<y+my;i++)
				for(int j=x;j<x+mx;j++)
					map[i][j] = c;
		}

		int sc = map[sp.second][sp.first];

		//bfsÅS[Å«é©mF
		if(bfs(sp, gp, sc))std::cout << "OK" << std::endl;
		else std::cout << "NG" << std::endl;
	}
}

Measured memory_bytes: 0
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
using namespace std;
int main(){
  long long int ans1,n,a,b,ans;
  scanf("%lld %lld %lld\n",&n,&a,&b);
  ans=n/(a+b);
  if(a==0){
    printf("0\n");
    return 0;
  }
  if(n%(a+b)==0){
    printf("%lld\n",ans*a);
  }
  else{
    ans1=n%(a+b);
    if(ans1<a){
    printf("%lld\n",ans*a+ans1);
    }
    else{
      printf("%lld\n",ans*a+a);
    }
  }
  return 0;
}

Measured memory_bytes: 256
//g++  5.4.0

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAXX 1e9 + 5
vector<ll> adj[200005];
ll arr[200005];
ll LIS[200005];

void DFS(ll s,ll p,vector<ll> &L,ll count)
{
    ll index = lower_bound(L.begin(),L.end(),arr[s]) - L.begin();
    
    ll prev = L[index];
    
    if(prev == LLONG_MAX)
        count++;
    
    L[index] = arr[s];
    
    LIS[s] = count;
    
    for(ll i=0;i<adj[s].size();++i)
    {
        ll c = adj[s][i];
        if(c != p)
            DFS(c,s,L,count);
    }
    
    L[index] = prev; //rolling back changes
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll N; cin>>N;
    
    for(ll i=1;i<=N;++i)
        cin>>arr[i];
    
    vector<ll> L(N,LLONG_MAX);
    
    for(ll i=0;i<(N - 1);++i)
    {
        ll u,v; cin>>u>>v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    
    DFS(1,-1,L,0);
    
    for(ll i=1;i<=N;++i)
        cout<<LIS[i]<<endl;
    
}

Measured memory_bytes: 33276
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

const int INF = 1 << 30;
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

typedef unsigned long long ull;
typedef std::pair<int,int> P;
typedef std::pair<P,int> State;

// C<=15, D<=30, W<=50, X<=5
int C, D, W, X;
int E[20][40], F[20][40];
// dp[i][j][k]: i日目にコンサートを行い，負担がj，1日に2個以上ライブをしたのがk日となったときの最大利益
int dp[40][60][10];

int main(){
    while(std::cin >> C >> D >> W >> X, C){
        REP(i, C){
            REP(j, D){
                std::cin >> E[i][j];
            }
        }

        REP(i, C){
            REP(j, D){
                std::cin >> F[i][j];
            }
        }

        REP(i, 40){
            REP(j, 60){
                REP(k, 10){
                    dp[i][j][k] = -INF;
                }
            }
        }
        dp[0][0][0] = 0;

        // int day, from, to;
        // while(std::cin >> day >> from >> to, day){
        //     auto p = live(day, from, to);
        //     printf("%d, %d\n", p.first, p.second);
        // }
        
        REP(i, D){
            REP(j, W+1){
                REP(k, X+1){
                    dp[i+1][j][k] = std::max(dp[i+1][j][k], dp[i][j][k]);
                    REP(l, C){
                        int benefit = 0, cost = 0;
                        for(int m=l;m<C;m++){
                            if(E[m][i] == 0 || j + cost + F[m][i] > W){break;}

                            benefit += E[m][i];
                            cost += F[m][i];
                            if(m == l){ // 一箇所だけ
                                dp[i+1][j+cost][k] = std::max(dp[i+1][j+cost][k], dp[i][j][k] + benefit);
                            }else if(k+1 <= X){ // 二箇所以上
                                dp[i+1][j+cost][k+1] = std::max(dp[i+1][j+cost][k+1], dp[i][j][k] + benefit);
                            }
                        }
                    }
                }
            }
        }

        int res = 0;
        REP(j, W+1){
            REP(k, X+1){
                res = std::max(res, dp[D][j][k]);
            }
        }

        std::cout << res << std::endl;
    }
}

Measured memory_bytes: 1260
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int count=0;
    for(int i=1;i<=n;i++)
    {
        int length=0;
        int j=i;
        while(j)
        {
            j=j/10;
            length++;
        }

        if(length&1)
            count++;
    }
    cout<<count<<endl;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))

MOD = 10**9+7
tmp = max(A)
ans = 0
base = 1

while True:
    num1 = 0
    num0 = 0
    for i,a in enumerate(A):
        if (a%2 == 1):
            num1 += 1
        A[i] = a//2
    num0 = N-num1
    ans += num0 * num1 * base
    ans %= MOD
    
    base *= 2
    tmp //= 2
    if (tmp==0):break

print(ans)
    
    
    

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

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

#define RFOR(i, b, a) for(int(i)=(b); (i)>=(a); (i)--)
#define RREP(i, n) FOR((i), (n), 0)

#define pb push_back
#define mp make_pair 

using namespace std;

const int INF=INT_MAX/4;
const int MOD=1000000007;
const double EPS=1e-14;

const bool debug_flag=true;

void debug(string str){
	if(debug_flag){
		cout<<str<<endl;
	}
}

void debugs(string str){
	if(debug_flag){
		cout<<str;
	}
}

class Edge{
public:
	int to;
	long cost;
};

int R, W;
vector<vector<Edge> > edge;
vector<bool> used;
vector<long> value;
int m1=INF, m2=INF;

void dfs(int n, int v){
	used[n]=true;
	value[n]=v;
	if(n<R && value[n]<m1){
		m1=value[n];
	}else if(n>=R && value[n]<m2){
		m2=value[n];
	}

	REP(i, edge[n].size()){
		if(!used[edge[n][i].to]){
			dfs(edge[n][i].to, edge[n][i].cost-v);
		}
	}
}

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

	int N;
	cin>>R>>W;
	cin>>N;
	edge.resize(R+W);
	used.resize(R+W);
	value.resize(R+W);

	int r, w, a;
	Edge ee;
	REP(i, N){
		cin>>r>>w>>a;
		r--;
		w--;
		ee.to=R+w;
		ee.cost=a;
		edge[r].pb(ee);
		ee.to=r;
		edge[R+w].pb(ee);
	}

	REP(i, R+W){
		if(!used[i]){
			m1=INF;
			m2=INF;
			dfs(i, 0);
			if(m1+m2<0){
				cout<<"No"<<endl;
				return 0;
			}
		}
	}

	REP(i, R){
		REP(j, edge[i].size()){
			if(value[i]+value[edge[i][j].to]!=edge[i][j].cost){
				cout<<"No"<<endl;
				return 0;
			}
		}
	}
	
	cout<<"Yes"<<endl;

	return 0;
}



Measured memory_bytes: 16512
#include <stdio.h>
void swap(void);
char str1,str2;
int temp_A=1,temp_B=0,temp_C=0,temp=0;
int main(void)
{
	while(scanf("%c,%c\n",&str1,&str2)!=EOF){
		swap();
	}
	end:
	if(temp_A==1) puts("A");
	if(temp_B==1) puts("B");
	if(temp_C==1) puts("C");
	return 0;
}

void swap(void){
		if((str1=='A' && str2=='B') || (str1=='B' && str2=='A')){
			temp=temp_A;
			temp_A=temp_B;
			temp_B=temp;
		}
		if((str1=='B' && str2=='C') || (str1=='C' && str2=='B')){
			temp=temp_B;
			temp_B=temp_C;
			temp_C=temp;;
		}
		if((str1=='C' && str2=='A') || (str1=='A' && str2=='C')){
			temp=temp_C;
			temp_C=temp_A;
			temp_A=temp;
		}
		return ;
}

Measured memory_bytes: 528
//-fexec-charset=CP932
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAX 100
#define THOU 1000
#define FIVEMAX 100000
#define NINEMAX 1000000000
#define TWEMAX 1000000000000
#define rep(i,n) for (int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;i>=0;i--)
#define arep(i,a,n) for(int i=a;i<n;i++)
#define darep(i,a,n) for(int i=n,i>=a;i--)

vector<pair<ll,ll>>prime_factorize(ll n){
    vector<pair<ll,ll>>res;
    for(ll a=2;a*a<=n;a++){
        if(n%a!=0)continue;
        ll ex=0;
        while(n%a==0){
            ex++;
            n/=a;
        }res.push_back({a,ex});
    }
    if(n!=1)res.push_back({n,1});
    return res;
}


int main(){
    ll n;
    cin>>n;
   
 cin.tie(0);
 ios::sync_with_stdio(false);
 string str;
 vector<int>v(n);
 map<string,int>m;
 pair<int,int>p;
 vector<ll>ex(n+1,0);

 for(ll i=2;i<=n;i++){
     const auto &res=prime_factorize(i);
     for(auto p:res)ex[p.first]+=p.second;
 }

 ll res=1;
 const int MOD = 1000000007;
 arep(i,2,n+1){
     res*=ex[i]+1;
     res%=MOD;
 }
 
 
 cout<<res<<endl;
 return 0;
}




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

int main(){
	int a,b,field[100][100],x,y,loop;
	char c[100][100];
	while (1){
		loop = 0;
		x = 0;
		y = 0;
		for (int i = 0; i < 100; i++){
			for (int j = 0; j < 100; j++) field[i][j] = 0;
		}
		cin >> a >> b;
		if (!a && !b) break;
		getchar();
		for (int i = 0; i < a; i++){
			for (int j = 0; j < b; j++){
				c[i][j] = getchar();
			}
			getchar();
		}
		while (c[x][y] != '.'){
			if (field[x][y]) {
				loop = 1;
				break;
			}
			field[x][y] = 1;
			if (c[x][y] == '>') y++;
			if (c[x][y] == '^') x--;
			if (c[x][y] == '<') y--;
			if (c[x][y] == 'v') x++;
		}
		if (loop) cout << "LOOP" << endl;
		else cout << y << " " << x << endl;
	}
	return 0;
}

Measured memory_bytes: 1208
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define int ll

#define loopinc(i, a, b, inc) for(int i = a; i < (b); i += inc)
#define loop(i, a, b) for(int i = a; i < (b); i++)
#define rep(i, n) loop(i, 0, n)
#define endl "\n"
#define all(c) (c).begin(),(c).end()
//#define lloopinc(i, a, b, inc) for(ll i = a; i < (b); i += inc)
//#define lloop(i, a, b) for(ll i = a; i < (b); i++)
//#define lrep(i, n) lloop(i, 0, n)
typedef pair<int, int> pii;
//typedef pair<ll, ll> pll;
typedef vector<int> vi;
//typedef vector<ll> vll;
typedef tuple<int, int, int> tiii;
//void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

int n;
vi lower;
vi upper;
int total = 0;
void solve() {
	total = upper[n/2] - lower[n/2] + 1;
}

void solve2() {
	total = (upper[n/2-1] + upper[n/2]) - (lower[n/2-1] + lower[n/2]) + 1;
}

signed main() {
	// freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
	std::ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin >> n;
	lower.resize(n);
	upper.resize(n);
	rep(i, n) {
		int a, b;
		cin >> a >> b;
		lower[i] = a;
		upper[i] = b;
	}

	sort(all(lower));
	sort(all(upper));

	if (n&1 == 1)
		solve();
	else
		solve2();

	cout << total << endl;
}


Measured memory_bytes: 6368
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
#include <random>
#include <time.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
int main() {
	map<ll, ll>mp;
	ll n, a;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		mp[a]++;
	}
	cout << mp.size() << endl;
	return 0;
}








Measured memory_bytes: 256
#include<bits/stdc++.h>
#define L long long
#define pb push_back
#define pi pair<int,int>
#define pii pair<pair<int,int>,int>
#define aa first
#define bb second
#define xx aa.aa
#define yy aa.bb
#define zz bb
#define mp make_pair
#define mpp(a,b,c) mp(mp(a,b),c)
using namespace std;
int n,f[200010],x[200010],b[200010],c[200010],w[200010],p;
vector<int> a[200010];
inline void get(int i)
{
	int j;
	for(auto j:a[i])
	  w[f[j]]++;
	for(j=0;w[j];j++);
	f[i]=j;
	for(auto j:a[i])
	  w[f[j]]--;
}
inline void get2(int i)
{
	int j;
	for(auto j:a[i])
	  w[f[j]]++;
	for(j=0;w[j];j++);
	for(j++;w[j];j++);
	f[i]=j;
	for(auto j:a[i])
	  w[f[j]]--;
}
inline void dfs(int i)
{
	for(auto j:a[i])
	  dfs(j);
	get(i);
}
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int i;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	  {
	   scanf("%d",&x[i]);
	   a[x[i]].pb(i);
	  }
	for(i=1;b[i]<2;i=x[i])
	  {
	   b[i]++;
	   if(b[i]==2)
	     c[++p]=i;
	  }
	for(i=1;i<=p;i++)
	  for(auto j:a[c[i]])
	    if(b[j]<2)
	      dfs(j);
	f[c[p]]=n+5;
	get(c[1]);
	for(i=2;i<=p;i++)
	  get(c[i]);
	i=f[c[1]];
	get(c[1]);
	if(i==f[c[1]])
	  {
	   printf("POSSIBLE\n");
	   return 0;
	  }
	f[c[p]]=n+5;
	get2(c[1]);
	for(i=2;i<=p;i++)
	  get(c[i]);
	i=f[c[1]];
	get(c[1]);
	if(i==f[c[1]])
	  printf("POSSIBLE\n");
	else
	  printf("IMPOSSIBLE\n");
	return 0;
}


Measured memory_bytes: 14080
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int main(){
	int n;
	cin>>n;
	string s;
	double r;
	double sum=0;
	for(int i=0;i<n;i++){
		cin>>r>>s;
		if(s=="JPY"){
			sum=sum+r;
		}else{
			sum=sum+r*380000.0;
		}
	}
	cout<<sum<<endl;
}

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

int main() {
  
	int K;
  	string S;
  cin >> K >> S;
  
  string strout ;
  
  if(S.size()>K){
  	
    for(int i = 0; i<K;i++){
    	strout += S.at(i);
    }
    strout += "...";
    
  	cout << strout << endl;
    
  }else{
  	cout << S << endl;
  }  
}


Measured memory_bytes: 3628
import numpy as np
# 複数個格納
# A B = map(int, input().split())
# 行列化
# A = np.array(A)
# A=A.reshape(1,-1)
# A=A.T

N = int(input())
A = list(map(int, input().split()))
A = np.array(A)
A=A.reshape(1,-1)
vector0=A*0
count=0
i=0
flg=False

for i in range(19999):
    B=A%2
    for k in range(N-1) :
        if B[0,k] != 0:
            flg = True
            break
    if flg:
        break
    count=count+1
    A=A/2

print(count)

Measured memory_bytes: 21884
n = int(input())
a,b,c = map(int,input().split())
for i in range(1,n):
    aa,bb,cc = map(int,input().split())
    aaa,bbb,ccc = a,b,c
    a = max(aa+bbb,aa+ccc)
    b = max(bb+ccc,bb+aaa)
    c = max(cc+aaa,cc+bbb)
print(max(a,b,c))

Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007


//マージソート
const long long INFTY =30000000005;
long long L[10000],R[10000];

void merge(long long A[],int left,int mid,int right){
    int n1=mid-left;
    int n2=right-mid;
    for(int i=0;i<n1;i++) L[i]=A[left+i];
    for(int i=0;i<n2;i++) R[i]=A[mid+i];
    L[n1] =R[n2]=INFTY;
    int i=0,j=0;
    for(int p=left;p<right;p++){
        if(L[i]<=R[j]) A[p]=L[i++];
        else A[p]=R[j++];
    }
}

void sort(long long A[],int left,int right){
    if(left+1<right){
        int mid=(left + right)/2;
        sort(A,left,mid);
        sort(A,mid,right);
        merge(A,left,mid,right);
    }
}

//sort(A,0,n)で使用
int main(){
    int x,y,z,k,p;
    cin>>x>>y>>z>>k;
    vector<long long> D;
    vector<long long> Q;
    long long A[1005],B[1005],C[1005],m;
    REP(i,x)cin>>A[i];
    REP(i,y)cin>>B[i];
    REP(i,z)cin>>C[i];
    
    sort(C,0,z);
    REP(i,x){
        REP(j,y){
            D.push_back(A[i]+B[j]);
        }
    }
    sort(D.begin(),D.end(),std::greater<long long>());
    REP(i,min(x*y,k)){
        for(int j=z-1;j>=z-1-min(z-1,k);j--){
            Q.push_back(D[i]+C[j]);
        }
    }
    sort(Q.begin(),Q.end(),std::greater<long long>());
    
    REP(i,min(k,x*y*z)) cout<<Q[i]<<endl;

}

Measured memory_bytes: 43364
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}

func readLines() -> [String] {
    return readLine()!.map { String($0) }
}
///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}

///最大公約数を返す
func gcd(_ array: [Int]) -> Int {
    var value = array[0]
    if array.count > 1 {
        for i in 1..<array.count {
            value = gcd(value, array[i])
        }
    }
    return value
}

///最小公倍数を返す
func lcm(_ m:Int, _ n:Int) -> Int {
    return m * n / gcd(m, n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {
    
    mutating func remove(_ element: Element) {
        _ = firstIndex(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt
    
    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2
        
        if Int(ary[mid])! < key {
            left = mid
            
        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }
    
    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}
// https://algo-logic.info/divisor/
/// 約数の配列を返す
func divisor(_ n:Int) -> [Int] {
    var ret = [Int]()
    var i = 1
    while i * i <= n {
        if n % i == 0 {
            ret.append(i)
            if i * i != n {
                ret.append(n / i)
            }
        }
        i += 1
    }
    return ret
}

func main() {
    let n = readInt()
    let table = [readInts(),readInts()]
    //＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿ここまで入力
    var remUnder = table[1].reduce(0) { $0 + $1 }
    
    var ans = 0
    var left = 0
    for i in 0..<n {
        left += table[0][i]
        ans = max(ans, remUnder + left)
        remUnder -= table[1][i]
    }
    print(ans)
}
main()

Measured memory_bytes: 13504
fn main() {
    let a: i32 = read();
    let b: i32 = read();
    let mut ans = 0;
    for i in a..b+1 {
        let s: String = i.to_string();
        let s: Vec<char> = s.chars().collect();
        if s[0] == s[4] && s[1] == s[3] {
            ans += 1;
        }
    }
    println!("{}", ans);
}

// 以下関数


use std::io::*;
use std::str::FromStr;
pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

pub const MOD: u64 = 10e9 as u64 + 7;

pub fn is_prime(n: i32) -> bool {
    if n < 2 {
        return false;
    } else if n == 2 {
        return true;
    }
    let mut i = 2;
    while i * i < n {
        if n % i == 0 {
            return false;
        } else {
            i += 1;
            continue;
        }
    }
    true
}

pub fn lcm(mut n: i32, mut m: i32) -> i32 {
    n = if n > m { m } else { n };
    m = if n > m { n } else { m };
    let mut i = n;
    while i % m != 0 {
        i += n;
    }
    i
}

pub fn abs(n: i32) -> i32 {
    if n >= 0 {
        n
    } else {
        -n
    }
}

pub fn max(n: i32, m: i32) -> i32 {
    if n >= m {
        n
    } else {
        m
    }
}

pub fn min(n: i32, m: i32) -> i32 {
    if n <= m {
        n
    } else {
        m
    }
}

Measured memory_bytes: 4352
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func NextStr() string {
	scanner.Scan()
	return scanner.Text()
}

func NextInt() int {
	i, _ := strconv.Atoi(NextStr())
	return i
}

func main() {
	scanner.Split(bufio.ScanWords)
	d, t, s := NextInt(), NextInt(), NextInt()
	if d/t < s || d/t == s && d%t == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

}


Measured memory_bytes: 1772
fun main(args : Array<String>) {
    var (a, b, k) = readLine()!!.split(" ").map{it.toInt()}

    repeat(k) {
        if (it % 2 == 0) {
            // takahashi
            if (a % 2 == 1) a--
            a /= 2
            b += a
        } else {
            // aoki
            if (b % 2 == 1) b--
            b /= 2
            a += b
        }
    }

    println("$a $b")
}

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

typedef vector<vector<int> > Matrix;

const int INF = 100000000;
Matrix graph; // グラフの距離を格納した2次元配列（隣接行列）
              // graph[u][v]は辺e=(u,v)のコスト（辺が存在しない場合はINF）

// 戻り値がtrueなら負の閉路を含む
bool bellman_ford(int n, int s) { // nは頂点数、sは開始頂点
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < n; k++) {
        if (j == k) continue;
        if (graph[j][s] > graph[j][k] + graph[k][s]) {
          graph[j][s] = graph[j][k]+graph[k][s];
        }
      }
    }
  }
  return false;
}

int main() {
  int h, w;
  cin >> h >> w;
  for (int i = 0; i < 10; ++i) {
    vector<int> row(10);
    for (int j = 0; j < 10; ++j) {
      cin >> row[j];
    }
    graph.push_back(row);
  }
  bellman_ford(10, 1);
  // for (int i = 0; i < 10; ++i) { 
  //   cout << i << " " << graph[i][1] << endl;
  // }
  int ans = 0;
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      int a;
      cin >> a;
      if (a >= 0) ans += graph[a][1];
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            string T = Console.ReadLine();
            int cnt = 0;
            for (int i = 0; i < S.Length; i++)
            {
                if (S[i] == T[i])
                {
                    cnt += 1;
                }

            }
            Console.WriteLine(cnt);
            Console.Read();
        }
    }
}


Measured memory_bytes: 13140
import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int M = scanner.nextInt();

        int res = 0;
        if(N > 0) {
            res += N * (N-1) / 2;
        }
        if(M > 0){
            res += M * (M-1) / 2;
        }
        System.out.println(res);
    }
}

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

//諸機能
#pragma region MACRO 
#define putans(x)  cerr << "answer: " ; cout << (x) << endl
#define dputans(x) cerr << "answer: "; cout << setprecision(10) << (double)(x) << endl
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define RREP(i,a,n) for(int i=(int)(n-1); i>= a; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) begin((a)),end((a))
#define mp make_pair
#define exist(container, n) ((container).find((n)) != (container).end())
#define substr(s,i,l) string((s), (i), (l))
#define tos(x) (to_string((x)))
#ifdef _DEBUG //ファイルからテストデータを読み込む
std::ifstream ifs("data.txt");
#define input ifs >>
#else //いい感じにやる
#define input cin >>
#endif
#pragma endregion
//デバッグなどの支援
#pragma region CODING_SUPPORT
#define dbg(var0) { std::cerr << ( #var0 ) << "=" << ( var0 ) << endl; }
#define dbg2(var0, var1) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg(var1); }
#define dbg3(var0, var1, var2) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg2(var1, var2); }
#define dbgArray(a,n) {std::cerr << (#a) << "=";  rep(i,n){std::cerr <<(a[i])<<",";} cerr<<endl;} 
#ifndef _DEBUG
#define dbg1 {}
#define dbg2 {}
#define dbg3 {}
#define dbgArray {}
#endif 
#pragma endregion 
//typedef（書き換える、書き足す可能性ある）
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii; typedef pair<string, string> pss; typedef pair<int, string>pis;
typedef vector<string> vs; typedef vector<int> vi;
#pragma endregion
//諸々の定数(書き換える可能性ある)
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-9)
#define MOD (ll)(1e9 + 7)
#define INF (ll)(1e9)
#pragma endregion


int main() {
	string s; input s;
	int seek = 0;
	vector<char> ans;
	rep(i, s.length()) {
		if(s[i] != 'B'){
			seek++; 
			ans.push_back(s[i]);
		}
		else {
			if (seek != 0) {
				ans.erase(ans.begin() + seek-1);
				seek--;
			}
		}
	}
	rep(i, ans.size()) {
		cout << ans[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>

using namespace std;

int main() {
    string s1, s2, s3;

    cin >> s1 >> s2 >> s3;

    cout << s1[0] << s2[0] << s3[0] << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int MAX = 100;
const int INFTY = (1 << 21);

class MST
{
    int num, G[MAX][MAX], status[MAX];

public:
    MST()
    {
        int value;
        cin >> num;
        for (int i = 0; i < num; i++)
        {
            for (int j = 0; j < num; j++)
            {
                cin >> value;
                G[i][j] = value == -1 ? INFTY : value;
            }
        }
        for (int i = 0; i < num; i++)
        {
            status[i] = 0;
        }
    }

    int prim(int node)
    {
        int min_index1, min_index2, sum = 0;
        status[node] = 1;
        for (int j = 0; j < num-1; j++)
        {
            min_index1 = min_index2 = 0;
            for (int n = 0; n < num; n++)
            {
                if (status[n] != 0)
                {
                    for (int i = 1; i < num; i++)
                    {
                        if (status[i] == 0 && G[min_index1][min_index2] > G[n][i])
                        {
                            min_index1 = n;
                            min_index2 = i;
                        }
                    }
                }
            }
            status[min_index2] = 1;
            sum += G[min_index1][min_index2];
        }
        return sum;
    }
};

int main()
{
    MST mst;
    cout << mst.prim(0) << endl;
}


Measured memory_bytes: 3128
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

using ll = long long;
using ull = uint64_t;
using P = pair<int, int>;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

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

    int n, q;
    cin >> n;
    vector<int> S(n);
    for(int i = 0; i < n; ++i)  cin >> S[i];
    cin >> q;
    ll ans = 0;
    for(int i = 0; i < q; ++i){
        int T;
        cin >> T;
        ans += upper_bound(S.begin(), S.end(), T) - lower_bound(S.begin(), S.end(), T) > 0;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3356
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>

using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;
    int min = b*10;
    int max = (b+1)*10;
    for(int i = min; i<max; i++){
            if(floor(i*0.08) == a){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

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

int main(void){
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    
    cout << (a + b + c) + max({a, b, c}) * (pow(2, k) - 1) << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<cstdint>
#include<cstdio>
#include<functional>
#include<iostream>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
using namespace std;

#define loop(i,a,b) for(int i=(a); i<(b); ++i)
#define rep(i,n) for(int i=0; i<n; ++i)
#define all(v) begin(v), end(v)
#define dump(a) cerr << #a << " = " << (a) << "(L:" << __LINE__ << ")" << endl

const double PI = acos(-1.0);

int main() {
  std::ios::sync_with_stdio(false);
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  cout << min(a,b) + min(c,d) << endl;
  return 0;
}


Measured memory_bytes: 256
H, W, M = map(int, input().split())

L = [ 0 for i in range(M)]
for i in range(M):
  L[i] = tuple( map(int, input().split()) )

H_val = [ 0 for i in range(H+1)]
W_val = [ 0 for i in range(W+1)]

H_key = {}
for i in L:
  if i[0] in H_key:
    H_key[ i[0] ].add( i[1] )
  else:
    H_key[ i[0] ] = {i[1]}

for i in L:
  H_val[ i[0] ] += 1
  W_val[ i[1] ] += 1
  
Hm = 0
Hs = set()
Wm = 0
Ws = set()
for i in range(1, H+1):
  if H_val[i] == Hm:
    Hs.add(i)
  elif H_val[i] > Hm:
    Hs = {i}
    Hm = H_val[i]
for i in range(1, W+1):
  if W_val[i] == Wm:
    Ws.add(i)
  elif W_val[i] > Wm:
    Ws = {i}
    Wm = W_val[i]
  
flg = False
for i in Hs:
  for j in Ws:
    if j not in H_key[i]:
      flg = True
      break
  if flg:
    break
if flg:
  print( Hm + Wm )
else:
  print( Hm + Wm - 1)

Measured memory_bytes: 291860
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;
#define REP(i,n) for (int i = 0; i <(n); ++i)
//debug 
#ifdef _DEBUG
#define debug(var)  do{cout << #var << " :";view(var);}while(0)
#else
#define debug(...)
#endif
template<typename T> void view(T e){cout << e << endl;}
template<typename T> void view(const vector<T>& v){for(const auto& e : v){ cout << e << " "; } cout << endl;}
template<typename T> void view(const vector<vector<T> >& vv){ for(const auto& v : vv){ view(v); } }


int main(){
  int a, b;
  cin >> a >> b;
  int cnt = 0;
  for(int i = a; i <= b; i++){
    string s = to_string(i);
    if(s[0] == s[4] && s[1] == s[3]) cnt++;
  }

  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin>>s;
  if(s=="SUN") cout<<7<<endl;
  else if(s=="MON") cout<<6<<endl;
  else if(s=="TUE") cout<<5<<endl;
  else if(s=="WED") cout<<4<<endl;
  else if(s=="THU") cout<<3<<endl;
  else if(s=="FRI") cout<<2<<endl;
  else cout<<1<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

#define MOD_BIG 1000000007
#define MOD_BIG2 998244353
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;
using pint = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using std::vector;

#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

//////////////////////////////////////



//////////////////////////////////////

int main() {
    
    int H, W;
    cin >> H >> W;
    vector<vector<bool>> b(H, vector<bool>(W));
    std::queue<pint> q;
    
    REP(i, H) {
        string S;
        cin >> S;
        REP(j, W) {
            if (S[j] == '#') {
                b[i][j] = true;
                q.push(pint(i,j));
            }
        }
    }
    int ans = -1;
    bool flag = true;
    while (flag) {
        std::queue<pint> q2;
        while (!q.empty()) {
            auto v = q.front();
            q.pop();
            if (v.first > 0) if (!b[v.first-1][v.second]) {
                b[v.first-1][v.second] = true;
                q2.push(pint(v.first-1,v.second));
            }
            if (v.second > 0) if (!b[v.first][v.second-1]) {
                b[v.first][v.second-1] = true;
                q2.push(pint(v.first,v.second-1));
            }
            if (v.first < H-1) if (!b[v.first+1][v.second]) {
                b[v.first+1][v.second] = true;
                q2.push(pint(v.first+1,v.second));
            }
            if (v.second < W-1) if (!b[v.first][v.second+1]) {
                b[v.first][v.second+1] = true;
                q2.push(pint(v.first,v.second+1));
            }
        }
        ans++;
        q = q2;
        if (q.empty()) {
            flag = false;
        }
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 8832
import java.util.*;
//Increment Decrement
public class Main {
	public static void main(String[] args){
		Scanner scn=new Scanner(System.in);
		int N=Integer.parseInt(scn.nextLine());
		String S=scn.nextLine();
		int x=0;
		int max=0;
		scn.close();
		
		for(int i=0;i<N;i++){
			switch(S.charAt(i)){
			case 'I':
				x++;
				if(x>max){
					max=x;
				}
				break;
			case 'D':
				x--;
				break;
			}
		}
		System.out.println(max);
	}
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
signed main(void){
    int n;
    string a; cin>>n>>a;
    
    a.erase(unique(a.begin(), a.end()), a.end());
    cout<<a.size()<<endl;
    
}


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

using namespace std ;

const int MAX = 1e5 + 10 ;

int arr[MAX] ;
int x , y ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>x>>y ;
	return cout<<(x+y-1)/y<<"\n" , 0 ;
}		

Measured memory_bytes: 256
#ifdef LOCAL
//#define _GLIBCXX_DEBUG
#endif
//#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<char> Vc;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;
typedef vector<vector<char>> VVc;
typedef vector<vector<vector<ll>>> VVV;
typedef vector<vector<vector<vector<ll>>>> VVVV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define rEach(i, mp) for (auto i = mp.rbegin(); i != mp.rend(); ++i)
#ifdef LOCAL
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define dbgmint(n,arr) rep(i,n){cerr<<arr[i].x<<" ";}cerr<<endl;
#define dbgarrmint(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j].x<<" ";}cerr<<endl;}
#else
#define dbg(...)
#define dbgmap(...)
#define dbgarr(...)
#define dbgdp(...)
#define dbgmint(...)
#define dbgarrmint(...)
#endif
#define out(a) cout<<a<<endl
#define out2(a,b) cout<<a<<" "<<b<<endl
#define vout(v) rep(i,v.size()){cout<<v[i]<<" ";}cout<<endl
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

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

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

template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,v.size())i>>v[j];return i;}

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int solve(){
    string s;
    string t;
    cin>>s>>t;
    ll ans = 0;
    ll n = s.length();
    rep(i,n){
        if(s[i]!=t[i])ans++;
    }
    cout<<ans<<endl;
    return  0;
}

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


Measured memory_bytes: 3800
/*
 * AOJ 2212: Stolen Jewel
 * ???????????°?????????????????°??°???????????¨?????¨???????????????????????¨???????????¶?????????????????¢?????????????????¨???????????????????????¢????¬????????????¶????±???°????????????????°???\??°???
 * ?±???????DP+?????????
 * ??????????????¢?§???????????????????????????¶???????¢??????????????????¨??¶???i????????????????????????????¬???¬?§???°?????????????????¶???j???d[x][y][i]??¨??????(x,y)??¨?????????i???????°???\??°?????¨Dijkstra?????°??°????????????????????????
 */

#include <cstdio>
#include <queue>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <string>


using namespace std;


int m, n, nr, ns;
string mat[53];
string rule[13];

int d[53][53][113];
int t[113][4];
string suf[113];

int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
char dc[] = {'U', 'R', 'D', 'L'};


struct Status {
  int x, y, s, d;

  Status() {}

  Status(int dd, int xx, int yy, int ss) : d(dd), x(xx), y(yy), s(ss) {}

  void Get(int &dd, int &xx, int &yy, int &ss) const {
    dd = d;
    xx = x;
    yy = y;
    ss = s;
  }

  bool operator<(const Status &ts) const {
    return d > ts.d;
  }
};

priority_queue<Status> pq;

int Dijkstra() {
  while (!pq.empty()) pq.pop();
  memset(d, 0x3f, sizeof(d));
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j < n; ++j) {
      if (mat[i][j] == 'S') {
        d[i][j][0] = 0;
        pq.emplace(0, i, j, 0);
        goto L;
      }
    }
  }
  L:
  int ans = -1;
  while (!pq.empty()) {
    int pre, x, y, s;
    pq.top().Get(pre, x, y, s);
    pq.pop();
    if (pre > d[x][y][s]) continue;
    for (int k = 0; k < 4; ++k) {
      int xx, yy, ss;
      ss = t[s][k];
      if (ss == -1) continue;
      xx = x + dx[k];
      yy = y + dy[k];

      if (xx >= 0 && xx < m && yy >= 0 && yy < n && mat[xx][yy] != '#' && pre + 1 < d[xx][yy][ss]) {
        if (mat[xx][yy] == 'G') {
          ans = pre + 1;
          return ans;
        }
        d[xx][yy][ss] = pre + 1;
        pq.emplace(pre + 1, xx, yy, ss);
      }
    }
  }
  return ans;
}


bool IsSuf(string a, string b) {
  if (a.length() < b.length()) return false;
  return a.substr(a.length() - b.length()) == b;
}

void GaoEdge() {
  sort(suf, suf + ns);
  memset(t, 0, sizeof(t));
  for (int i = 0; i < ns; ++i) {
    for (int k = 0; k < 4; ++k) {
      string ts = suf[i] + dc[k];
      for (int j = 0; j < nr; ++j) {
        if (IsSuf(ts, rule[j])) {
          t[i][k] = -1;
          break;
        }
      }
      if (t[i][k] != -1) {
        for (int j = 0; j < ns; ++j) {
          if (IsSuf(ts, suf[j]) && suf[j].length() > suf[t[i][k]].length()) {
            t[i][k] = j;
          }
        }
      }
    }
  }
}


int main() {
  //freopen("/Users/yogy/acm-challenge-workbook/db.in", "r", stdin);
  while (cin >> m >> n && m > 0 && n > 0) {
    for (int i = 0; i < m; ++i) {
      cin >> mat[i];
    }
    cin >> nr;
    ns = 0;
    suf[ns++] = "";
    for (int i = 0; i < nr; ++i) {
      cin >> rule[i];
      for (int j = 1; j < rule[i].length(); ++j) {
        suf[ns++] = rule[i].substr(0, j);
      }
    }
    GaoEdge();
    int ans = Dijkstra();
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 4484
use proconio::input;
use std::cmp;

fn main() {
    input! {
        n: usize,
        k: usize,
        kukan: [(usize, usize); k],
    }

    let mo = 998244353;
    let mut dp = BIT::new(n);
    dp.add(0, 1);

    for i in 1..n {
        let mut tmp = 0;
        for j in 0..k {
            if i < kukan[j].0 {
                continue;
            }
            let start = i - kukan[j].0;
            let end = cmp::max(0, i as isize - kukan[j].1 as isize) as usize;

            tmp += dp.sum(end as isize, start as isize + 1);
            tmp %= mo;
        }
        dp.add(i, tmp);
    }

    let ans = dp.sum(n as isize - 1, n as isize);
    println!("{}", ans);
}

struct BIT {
    n: usize,
    d: Vec<usize>,
}

impl BIT {
    fn new(n: usize) -> Self {
        BIT {
            n: n,
            d: vec![0; n + 1],
        }
    }

    fn add(&mut self, mut i: usize, x: usize) {
        let mo = 998244353;
        i += 1;
        while i <= self.n {
            self.d[i] = self.d[i] + x;
            self.d[i] %= mo;
            i += i & i.wrapping_neg();
        }
    }

    fn sum_one(&self, mut i: isize) -> usize {
        let mo = 998244353;
        let mut x = 0;
        i += 1;
        let mut i = i as usize;
        while i != 0 {
            x = x + self.d[i];
            x %= mo;
            i -= i & i.wrapping_neg();
        }
        x
    }

    fn sum(&self, l: isize, r: isize) -> usize {
        let mo = 998244353;
        (self.sum_one(r - 1) + mo - self.sum_one(l - 1)) % mo
    }
}


Measured memory_bytes: 3696
object Main extends App {
  val in = scala.io.Source.stdin.getLines.toSeq
  val ls = in.map(_.split(' ').toIndexedSeq).head
  val S = ls(0)
  
  val ret = if(S > "2019/04/30") "TBD" else "Heisei"
  println(ret)
}


Measured memory_bytes: 27316
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <map>
#include <vector>

using namespace std;

void b_buffet(void) {
	int n;
	cin >> n;
	vector<int> a(n+1);
	vector<int> b(n+1);
	vector<int> c(n+1);
	for (int i = 1; i <= n; i++) cin >> a[i];
	for (int i = 1; i <= n; i++) cin >> b[i];
	for (int i = 1; i < n; i++) cin >> c[i];

	int sum = 0;
	for (int i = 1; i <= n; i++) {
		sum += b[a[i]];
		if (i < n) {
			if (a[i + 1] -a[i] == 1) {
				sum += c[a[i]];
			}
		}
		//cout << sum << endl;
	}

	cout << sum << endl;
}

int main()
{
    b_buffet();

    return 0;
}


Measured memory_bytes: 3580