stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define maxn 200005

using namespace std;

int n;

vector<int> g[maxn];

int dep[maxn];

int len, id;

bool SG[maxn];

void dfs(int x) {

	if (dep[x] > len) len = dep[x], id = x;

	for (int i = 0; i < g[x].size(); i++) {

		if (!dep[g[x][i]]) {

			dep[g[x][i]] = dep[x] + 1;

			dfs(g[x][i]);

		}

	}

}

int main() {

	scanf("%d", &n);

	memset(dep, 0, sizeof(dep));

	for (int i = 0; i < n - 1; i++) {

		int u, v;

		scanf("%d%d", &u, &v);

		g[u].push_back(v);

		g[v].push_back(u);

	}

	dep[1] = 1;

	dfs(1);

	memset(dep, 0, sizeof(dep));

	dep[id] = 1;

	dfs(id);

	SG[1] = 1; SG[2] = 0;

	for (int i = 3; i <= n; i++) {

		SG[i] = !(SG[i - 1] & SG[i - 2]);

		//printf("%d ", SG[i]);

	}

	//puts("");

	if (SG[len]) printf("First\n");

	else printf("Second\n");

	return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

#define Maxn 400007

int last[Maxn],pre[Maxn],other[Maxn],cnt=0;

int dis[Maxn];

bool vis[Maxn];

void insert(int u,int v)

{

    other[++cnt]=v,pre[cnt]=last[u],last[u]=cnt;

}

void dfs(int u)

{

    vis[u]=true;

    for (int q=last[u];q;q=pre[q])

    {

        int v=other[q];

        if (!vis[v])

        {

            dis[v]=dis[u]+1;

            dfs(v);

        }

    }

}

int n;

int main()

{

    scanf("%d",&n);

    for (int i=1;i<n;i++)

    {

        int u,v;

        scanf("%d%d",&u,&v);

        insert(u,v),insert(v,u);

    }

    memset(vis,false,sizeof(vis));

    dis[1]=0;

    dfs(1);

    int id=1;

    for (int i=1;i<=n;i++)

        if (dis[i]>dis[id]) id=i;

    memset(vis,false,sizeof(vis));

    dis[id]=0;

    dfs(id);

    int ans=0;

    for (int i=1;i<=n;i++)

        ans=max(ans,dis[i]);

    if (ans%3==1) printf("Second\n"); else printf("First\n");

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <vector>

#include <cstring>



using namespace std;



vector<int> L[200005];

int n, D, nr, nodMax, uz[200005], dp[200005];



void DFS(int x);



int main()

{

    int x, y;



    cin >> n;

    for (int i=1;i<n;i++)

    {

        cin >> x >> y;

        L[x].push_back(y);

        L[y].push_back(x);

    }

    DFS(1);

    memset(uz,0,sizeof(uz));

    DFS(nodMax);

    dp[0] = 1;

    dp[1] = 0;

    for (int i=2;i<=D;i++)

        dp[i] = (dp[i-2] == 0 || dp[i-1] == 0);

    if (dp[D])

        cout << "First\n";

    else

        cout << "Second\n";

    return 0;

}



void DFS(int x)

{

    uz[x] = 1;

    if (nr > D)

    {

        D = nr;

        nodMax = x;

    }

    for (int i:L[x])

    {

        if (!uz[i])

        {

            nr++;

            DFS(i);

            nr--;

        }

    }

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

#define Maxn 400007

int last[Maxn],pre[Maxn],other[Maxn],cnt=0;

int dis[Maxn];

bool vis[Maxn];

void insert(int u,int v)

{

    other[++cnt]=v,pre[cnt]=last[u],last[u]=cnt;

}

void dfs(int u)

{

    vis[u]=true;

    for (int q=last[u];q;q=pre[q])

    {

        int v=other[q];

        if (!vis[v])

        {

            dis[v]=dis[u]+1;

            dfs(v);

        }

    }

}

int n;

int main()

{

    scanf("%d",&n);

    for (int i=1;i<n;i++)

    {

        int u,v;

        scanf("%d%d",&u,&v);

        insert(u,v),insert(v,u);

    }

    memset(vis,false,sizeof(vis));

    dis[1]=0;

    dfs(1);

    int id=1;

    for (int i=1;i<=n;i++)

        if (dis[i]>dis[id]) id=i;

    memset(vis,false,sizeof(vis));

    dis[id]=0;

    dfs(id);

    int ans=0;

    for (int i=1;i<=n;i++)

        ans=max(ans,dis[i]);

    if (ans%3==1) printf("Second\n"); else printf("First\n");

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define ll long long

using namespace std;

int a,b,n,l,dis[200100],S;

vector<int> G[200100];

void dfs(int u,int f)

{

    dis[u]=dis[f]+1;

    for(int i=0;i<G[u].size();i++){

        if(G[u][i]!=f) dfs(G[u][i],u);

    }

}

int main(){

	ios::sync_with_stdio(false);

	cin >> n;

	for(int i = 1;i < n;i ++){

		cin >> a >> b;

		G[a].push_back(b);

		G[b].push_back(a);

	}

	dfs(1,0);

    for(int i=1;i<=n;i++) if(dis[i]>dis[S]) S=i;  

    dfs(S,0);

    for(int i=1;i<=n;i++) l=max(l,dis[i]-1);

	if(l %3 == 1)

		cout <<"Second"<<endl;

	else

		cout<<"First"<<endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

#define Maxn 400007

int last[Maxn],pre[Maxn],other[Maxn],cnt=0;

int dis[Maxn];

bool vis[Maxn];

void insert(int u,int v)

{

    other[++cnt]=v,pre[cnt]=last[u],last[u]=cnt;

}

void dfs(int u)

{

    vis[u]=true;

    for (int q=last[u];q;q=pre[q])

    {

        int v=other[q];

        if (!vis[v])

        {

            dis[v]=dis[u]+1;

            dfs(v);

        }

    }

}

int n;

int main()

{

    scanf("%d",&n);

    for (int i=1;i<n;i++)

    {

        int u,v;

        scanf("%d%d",&u,&v);

        insert(u,v),insert(v,u);

    }

    memset(vis,false,sizeof(vis));

    dis[1]=0;

    dfs(1);

    int id=1;

    for (int i=1;i<=n;i++)

        if (dis[i]>dis[id]) id=i;

    memset(vis,false,sizeof(vis));

    dis[id]=0;

    dfs(id);

    int ans=0;

    for (int i=1;i<=n;i++)

        ans=max(ans,dis[i]);

    if (ans%3==1) printf("Second\n"); else printf("First\n");

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <vector>

#define nmax 200005

using namespace std;

int n, nod1, viz1[nmax], viz2[nmax], maxi1, maxi2, nod2;

vector <int> v[nmax];

void dfs1(int nod)

{

    for(auto it=v[nod].begin(); it!=v[nod].end(); ++it)

        if(!viz1[*it])

          {

              viz1[*(it)]=viz1[nod]+1;

              if(maxi1< (viz1[*(it)])) {nod1=*(it); maxi1=viz1[*(it)];}

              dfs1(*it);

          }

}

void dfs2(int nod)

{

    for(auto it=v[nod].begin(); it!=v[nod].end(); ++it)

        if(!viz2[*it])

          {

              viz2[*(it)]=viz2[nod]+1;

              if(maxi2< (viz2[*(it)])) {nod2=*(it); maxi2=viz2[*(it)];}

              dfs2(*it);

          }

}

int main()

{

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);



    int i, x, y;

    cin>>n;

    for(i=1; i<n; i++)

    {

        cin>>x>>y;

        v[x].push_back(y);

        v[y].push_back(x);

    }

    maxi1=1;

    nod1=1;

    viz1[1]=1;

    dfs1(1);



    viz2[nod1]=1;

    maxi2=1;

    dfs2(nod1);



    if(maxi2%3==2) cout<<"Second\n";

    else cout<<"First\n";

    return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

#define Maxn 400007

int last[Maxn],pre[Maxn],other[Maxn],cnt=0;

int dis[Maxn];

bool vis[Maxn];

void insert(int u,int v)

{

    other[++cnt]=v,pre[cnt]=last[u],last[u]=cnt;

}

void dfs(int u)

{

    vis[u]=true;

    for (int q=last[u];q;q=pre[q])

    {

        int v=other[q];

        if (!vis[v])

        {

            dis[v]=dis[u]+1;

            dfs(v);

        }

    }

}

int n;

int main()

{

    scanf("%d",&n);

    for (int i=1;i<n;i++)

    {

        int u,v;

        scanf("%d%d",&u,&v);

        insert(u,v),insert(v,u);

    }

    memset(vis,false,sizeof(vis));

    dis[1]=0;

    dfs(1);

    int id=1;

    for (int i=1;i<=n;i++)

        if (dis[i]>dis[id]) id=i;

    memset(vis,false,sizeof(vis));

    dis[id]=0;

    dfs(id);

    int ans=0;

    for (int i=1;i<=n;i++)

        ans=max(ans,dis[i]);

    if (ans%3==1) printf("Second\n"); else printf("First\n");

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<algorithm>

#include<cstring>

#include<queue>

#include<vector>

#define SIZE 200010



using namespace std;



int n;

int dis[SIZE];

bool vis[SIZE];

vector<int> rec[SIZE];



struct d

{

    int id,dist;

};

int bfs(int from)

{

    int i;

    d tmp;

    queue<d> que;

  //  dis[from]=0;

    que.push({from,1});

    vis[from]=true;

    while(!que.empty())

    {

        tmp=que.front();

    //    printf("id=%d\n",tmp.id);

        que.pop();

        dis[tmp.id]=tmp.dist;

        for(i=rec[tmp.id].size()-1;i>=0;i--)

        {

            if(!vis[rec[tmp.id][i]])

            {

                vis[rec[tmp.id][i]]=true;

                que.push({rec[tmp.id][i],tmp.dist+1});

            }

        }

    }

    return tmp.id;

}



int main()

{

    int i;

    int a,b;

    scanf("%d",&n);

    for(i=1;i<n;i++)

    {

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

        rec[a].push_back(b);

        rec[b].push_back(a);

    }

    int pos=bfs(1);

    memset(vis,false,sizeof(vis));

    pos=bfs(pos);

    if((dis[pos]+1)%3==0)

        puts("Second");

    else

        puts("First");

    return 0;

}


// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

const int maxn = 2e5 + 7;

int n;



int fir[maxn], nxt[2 * maxn], to[2 * maxn], e = 0;

void add(int x, int y) {

	to[++e] = y; nxt[e] = fir[x]; fir[x] = e;

	to[++e] = x; nxt[e] = fir[y]; fir[y] = e;

}



int dp[maxn];

int dfs(int pos, int f) {

	int y, z, rs = pos, d;

	for (y = fir[pos]; y; y = nxt[y]) {

		if((z = to[y]) == f) continue;

		dp[z] = dp[pos] + 1;

		d = dfs(z, pos);

		if(dp[d] > dp[rs]) rs = d;

	}

	return rs;

}



int main() {

	scanf("%d", &n);

	int x, y;

	for (int i = 1; i < n; ++i) {

		scanf("%d%d", &x, &y);

		add(x, y);

	}

	dp[1] = 0;

	x = dfs(1, 0);

	dp[x] = 0;

	y = dfs(x, 0);

	//printf("%d %d\n", x, y);

	if(dp[y] % 3 == 1) printf("Second\n");

	else printf("First\n");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

 

typedef long long LL;

typedef pair<int, int> PII;

typedef vector<int> VI;



#define MP make_pair

#define PB push_back

#define X first

#define Y second

 

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

#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)

#define ITER(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)

#define ALL(a) a.begin(), a.end()

#define SZ(a) (int)((a).size())

#define FILL(a, value) memset(a, value, sizeof(a))

#define debug(a) cout << #a << " = " << a << endl;



const double PI = acos(-1.0);

const LL INF = 1e9 + 47;

const LL LINF = INF * INF;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



const int N = 1 << 18;

int n;

VI g[N];

char used[N];

int d[N];



void bfs(int v)

{

	FILL(used, 0);

	used[v] = 1;

	d[v] = 0;

	queue<int> q;

	q.push(v);

	

	while(!q.empty())

	{

		v = q.front();

		q.pop();

		for(auto i: g[v])

			if (!used[i])

			{

				used[i] = 1;

				d[i] = d[v] + 1;

				q.push(i);

			}

	}

}



int main()

{

	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	//freopen("In.txt", "r", stdin);

	//freopen("In.txt", "w", stdout);

	

	cin >> n;

	FOR(i, 0, n - 1)

	{

		int u, v;

		cin >> u >> v;

		g[u].PB(v);

		g[v].PB(u);

	}

	

	bfs(1);

	int mx = 1;

	FOR(i, 2, n + 1)

		if (d[i] > d[mx])

			mx = i;

	

	bfs(mx);

	mx = 1;

	FOR(i, 2, n + 1)

		if (d[i] > d[mx])

			mx = i;

	

	mx = d[mx];

//	debug(mx)

	if (mx % 3 == 1)

		cout << "Second" << endl;

	else

		cout << "First" << endl;

		

	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;

	return 0;

}


// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

const int maxn = 2e5 + 7;

int n;



int fir[maxn], nxt[2 * maxn], to[2 * maxn], e = 0;

void add(int x, int y) {

	to[++e] = y; nxt[e] = fir[x]; fir[x] = e;

	to[++e] = x; nxt[e] = fir[y]; fir[y] = e;

}



int dp[maxn];

int dfs(int pos, int f) {

	int y, z, rs = pos, d;

	for (y = fir[pos]; y; y = nxt[y]) {

		if((z = to[y]) == f) continue;

		dp[z] = dp[pos] + 1;

		d = dfs(z, pos);

		if(dp[d] > dp[rs]) rs = d;

	}

	return rs;

}



int main() {

	scanf("%d", &n);

	int x, y;

	for (int i = 1; i < n; ++i) {

		scanf("%d%d", &x, &y);

		add(x, y);

	}

	dp[1] = 0;

	x = dfs(1, 0);

	dp[x] = 0;

	y = dfs(x, 0);

	//printf("%d %d\n", x, y);

	if(dp[y] % 3 == 1) printf("Second\n");

	else printf("First\n");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;

struct Edge {

    int next, to;

} edge[200005 << 1];

int head[200005], n, ss, vis[200005], minn;



inline void add(int x, int y) {

    static int cnt = 1;

    edge[cnt].to = y, edge[cnt].next = head[x], head[x] = cnt++;

}



void DFS(int x, int s) {

    if (s > minn)minn = s, ss = x;

    for (int i = head[x]; i; i = edge[i].next) {

        if (vis[edge[i].to] == 0)vis[edge[i].to] = 1, DFS(edge[i].to, s + 1);

    }

}



queue<int> que;



int main() {

    cin >> n;

    for (int i = 1, x, y; i < n; i++) {

        cin >> x >> y;

        add(x, y), add(y, x);

    }

    DFS(1, 0), minn = 0, memset(vis, 0, sizeof(vis)), DFS(ss, 0);

    if ((minn + 1) % 3 == 2)cout << "Second";

    else cout << "First";

    return 0;

}

// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

const int maxn = 2e5 + 7;

int n;



int fir[maxn], nxt[2 * maxn], to[2 * maxn], e = 0;

void add(int x, int y) {

	to[++e] = y; nxt[e] = fir[x]; fir[x] = e;

	to[++e] = x; nxt[e] = fir[y]; fir[y] = e;

}



int dp[maxn];

int dfs(int pos, int f) {

	int y, z, rs = pos, d;

	for (y = fir[pos]; y; y = nxt[y]) {

		if((z = to[y]) == f) continue;

		dp[z] = dp[pos] + 1;

		d = dfs(z, pos);

		if(dp[d] > dp[rs]) rs = d;

	}

	return rs;

}



int main() {

	scanf("%d", &n);

	int x, y;

	for (int i = 1; i < n; ++i) {

		scanf("%d%d", &x, &y);

		add(x, y);

	}

	dp[1] = 0;

	x = dfs(1, 0);

	dp[x] = 0;

	y = dfs(x, 0);

	//printf("%d %d\n", x, y);

	if(dp[y] % 3 == 1) printf("Second\n");

	else printf("First\n");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;

vector<int> g[200001];

int mx  = 0 , vert = 1;

void dfs(int cur , int len = 0, int p = -1) {

    if(len > mx) {

        mx = len;

        vert = cur;

    }

    for(auto to : g[cur]) {

        if(to != p)

            dfs(to , len + 1 , cur);

    }

}



int main() {

    int n;

    cin >> n;

    for(int i = 1; i < n; i ++) {

        int a , b;

        cin >> a >> b;

        g[a].push_back(b);

        g[b].push_back(a);

    }

    dfs(1);

    mx = 0;

    dfs(vert);

    if(mx % 3 == 1)

        cout << "Second";

    else

        cout << "First";

    return 0;

}


// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

const int maxn = 2e5 + 7;

int n;



int fir[maxn], nxt[2 * maxn], to[2 * maxn], e = 0;

void add(int x, int y) {

	to[++e] = y; nxt[e] = fir[x]; fir[x] = e;

	to[++e] = x; nxt[e] = fir[y]; fir[y] = e;

}



int dp[maxn];

int dfs(int pos, int f) {

	int y, z, rs = pos, d;

	for (y = fir[pos]; y; y = nxt[y]) {

		if((z = to[y]) == f) continue;

		dp[z] = dp[pos] + 1;

		d = dfs(z, pos);

		if(dp[d] > dp[rs]) rs = d;

	}

	return rs;

}



int main() {

	scanf("%d", &n);

	int x, y;

	for (int i = 1; i < n; ++i) {

		scanf("%d%d", &x, &y);

		add(x, y);

	}

	dp[1] = 0;

	x = dfs(1, 0);

	dp[x] = 0;

	y = dfs(x, 0);

	//printf("%d %d\n", x, y);

	if(dp[y] % 3 == 1) printf("Second\n");

	else printf("First\n");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

#define ll long long

const int maxx =  100005;

int a[maxx];

int main()

{

    int n;

    cin>>n;

    int flag = 0;

    for(int i=1;i<=n;i++){

        scanf("%d",&a[i]);

    }

    for(int i=2;i<=n;i++){

        if(a[i] > a[i-1]){

            a[i]-=1;

        }

    }

    for(int i=2;i<=n;i++){

        if(a[i] < a[i-1]){

            flag = 1;

        }

    }

    if(flag){

        cout<<"No"<<endl;

    }else{

        cout<<"Yes"<<endl;

    }

    return 0;

}




// Optimized solution to the same problem (faster):
#include <cstdio>

int N;

int h[100005];

int main() {

    scanf("%d",&N);

    h[0] = 0;

    bool flag = true;

    for (int i = 1; i <= N; i++) {

        scanf("%d",&h[i]);

        if (!flag)

            continue;

        if (h[i] >= h[i-1] + 1)

            h[i]--;

        if (h[i] < h[i-1])

            flag = false;

    }

    if (flag)

        printf("Yes\n");

    else

        printf("No\n");

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>                           

using namespace std;                          

                                              

int main()                                    

{                                             

  int N;                                      

  cin >> N;                                   

  int h[N];                                   

  for (int i = 0; i < N; i++ ){               

    cin >> h[i];                              

  }                                           

  h[0]--;                                     

  bool flag = true;                           

  for (int i = 1; i < N && flag ; i++){       

    if (h[i] - h[i-1] < 0) flag = false;      

    else if (h[i] - h[i-1] == 0) h[i]++;      

    h[i]--;                                   

  }                                           

  if (flag) cout << "Yes" << endl;            

  else cout << "No" << endl;                  

}                                             

// Optimized solution to the same problem (faster):
#include <cstdio>                          

using namespace std;                       

                                           

int main()                                 

{                                          

  int N;                                   

  scanf("%d", &N);                         

  int h[N];                                

  for (int i = 0; i < N; i++ ){            

    scanf("%d", &h[i]);                    

  }                                        

  h[0]--;                                  

  bool flag = true;                        

  for (int i = 1; i < N && flag ; i++){    

    if (h[i] - h[i-1] < 0) flag = false;   

    else if (h[i] - h[i-1] == 0) h[i]++;   

    h[i]--;                                

  }                                        

  if (flag) printf("Yes\n");               

  else printf("No\n");                     

}                                          

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

#define ll long long

int main(){

	ll n;

	cin>>n;

	ll a[100001]={0};

	for(int i=0;i<n;i++){

		cin>>a[i];

	}

	int f=1;

	for(int i=n-1;i>0;i--)

	{

		if(a[i]<a[i-1])

		{

			a[i-1]--;

			if(a[i]<a[i-1])

			{

				f=0;

				break;

			}

		}

	}

	if(f==1){

		cout<<"Yes"<<endl;

	}else{

		cout<<"No"<<endl;

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

const int N=1e5+5;

int A[N],n,mx,mn;

int main(){

    scanf("%d",&n);

    scanf("%d",A+0);

    mx=A[0];

    for(int i=1;i<n;++i){

        scanf("%d",A+i);

        if(A[i]<mx-1){

            puts("No");

            return 0;

        }

        mx=max(A[i],mx);

    }

    puts("Yes");

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
// #include<stdio.h>

#include<iostream>

#include<string.h>

using namespace std;

int main(void) {

	int j = 0;

    string s,t;

//	char s[200000], t[200000];

	// scanf("%s", &s);

	// scanf("%s", &t);

    cin >> s >> t;



	for (int i = 0; i <s.size(); i++){

		if (s[i] != t[i]){

			j++;

        }

    }



	// printf("%d", j);

    cout << j << endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>



int main(void) {

	int j = 0;

	char s[200001], t[200001];

	scanf("%s%s",&s, &t);



	for (int i = 0; i <= strlen(s); i++)

		if (s[i] != t[i])

			j++;

	printf("%d", j);

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;

using namespace std;



typedef long long ll;

const int N = 2e5 + 10, OO = 0x3f3f3f3f, mod = 1e9 + 7;



#define PI acos(-1)

#define clr(arr, val) memset(arr, val, sizeof(arr))

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

#define rloop(i, n) for (int i = int(n) - 1; i >= 0; i--)

#define xloop(i, a, b) for (int i = int(a); i <= int(b); i++)

#define ALL(v) ((v).begin()), ((v).end())

#define SZ(v) ((int)((v).size()))

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

//int dy[] = {0, 1, 0, -1}; //4 Direction

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

int dy[] = {0, 1, 1, 1, 0, -1, -1, -1}; //8 direction

//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction

//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction



int n , dp[N];

string s , t;



int solve(int idx){

  if(idx == n)

    return 0;

  int &ret = dp[idx];

  if(~ret) return ret;

  if(s[idx] == t[idx])

    return ret = solve(idx+1);

  ret = OO;

  return ret = min(ret , solve(idx+1)+1);



}



int main()

{

  //ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);



  cin >> s >> t;

  n = SZ(s);

  memset(dp , -1 , sizeof dp);

  printf("%d\n" , solve(0));



  return 0;

}


// Optimized solution to the same problem (faster):
#include <iostream>

#include <algorithm>

#include <string>

#define ll long long

using namespace std;

int main(){

 string s;

 string t;

 ll cou=0;

 cin>>s>>t;

    for (ll i = 0; i <s.size() ; ++i) {

        if(s[i]==t[i]){ continue; }

        else{

          cou++;

        }

    }

    cout<<cou;

}

// Fastest known solution for this problem: