akhauriyash/Code-Regression huggingface dataset:
// problem: "https://atcoder.jp/contests/abc152/tasks/abc152_e"

#include<bits/stdc++.h>
#define ll long long
#define p (ll)(1e9+7)

using namespace std;

ll power(ll a,ll n)
{
    if(!n)
        return 1;

    ll b = 1;
    if(n%2)
        b = a;

    ll ans = power(a,n/2);
    ans = ((ans*ans)%p * b)%p;

    return ans;
}

void findPrimes(vector<ll>&P,ll n)
{
    vector<bool>Prime(n+1,1);
    Prime[0] = Prime[1] = 0;

    ll i,j;
    i = 2;
    while(i <= n)
    {
        P.push_back(i);

        j = 2*i;

        while(j <= n)
        {
            Prime[j] = 0;
            j += i;
        }

        i++;
        while(!Prime[i])
            i++;
    }
}

void findFactors(vector<ll>&V,vector<ll>&factors,vector<ll>&P)
{
    unordered_map<ll,ll>M;
    ll i;
    for(i=0;i!=V.size();i++)
    {
        ll n = V[i],j;
        for(j=0;j!=P.size();j++)
        {
            ll c = 0;
            while(n%P[j] == 0)
            {
                n /= P[j];
                c++;
            }

            if(M.count(P[j]))
                M[P[j]] = max(M[P[j]],c);

            else
                M[P[j]] = c;
        }

        if(n != 1)
            M[n] = 1;
    }

    for(auto it=M.begin();it!=M.end();it++)
    {
        ll a,b;
        a = it->first;
        b = it->second;

        factors.push_back(power(a,b));
    }
}

int main()
{
    ll n;
    cin>>n;

    vector<ll>V(n);
    ll i;
    for(i=0;i!=n;i++)
        cin>>V[i];

    vector<ll>P;
    findPrimes(P,1000);     // define

    vector<ll>factors;
    findFactors(V,factors,P);       // define

    ll lcm = 1;
    for(i=0;i!=factors.size();i++)
        lcm = (lcm*factors[i])%p;

    ll sum = 0;
    for(i=0;i!=n;i++)
        sum = (sum + (lcm*power(V[i],p-2))%p)%p;        // define

    cout<<sum;

    return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<string> s(n);

  rep(i,n) {
    cin >> s[i];
  }

  sort(s.begin(), s.end());
  cout << (unique(s.begin(), s.end()) - s.begin()) << endl;
}


Measured memory_bytes: 9596
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  ll a,b,c;
  cin >> a >> b >> c;
  ll C=min(a+b+1,c);
  cout << b+C << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String S = sc.next();
      
      if(S.equals("Sunny")){
     	System.out.println("Cloudy");   
      }else if(S.equals("Cloudy")){
        System.out.println("Rainy");
      }else if(S.equals("Rainy")){
        System.out.println("Sunny");
      }
	}
}

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define ALPHABET    (26)
#define INF         INT_MAX
#define MOD         (1000000007LL)

using LL  = long long;
// }}}

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


Measured memory_bytes: 256
#include <cstdlib>
#include <iostream>
#include <queue>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
typedef unsigned long long u64;
typedef signed long long l64;
u64 over = 1000000007;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  string s;
  cin >> s;
  cout << s[0] << s.size()-2 << s[s.size()-1] << endl;
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	as := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&as[i])
	}
	sort.Ints(as)

	ans := 1
	for i := 0; i < n; i++ {
		a := as[i]
		if a == 0 {
			ans = 0
			break
		}
		if 1e18/a < ans {
			ans = -1
			break
		}
		ans *= a
	}
	fmt.Println(ans)
}


Measured memory_bytes: 6328
using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using Debug = System.Diagnostics.Debug;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

static class P
{
    static void Main()
    {
        var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();
        HashSet<int> broken = new HashSet<int>(Enumerable.Repeat(0, nm[1]).Select(_ => int.Parse(Console.ReadLine())).ToArray());
        ModInt prev2 = 0;
        ModInt prev = 1;
        for (int i = 1; i <= nm[0]; i++)
        {
            ModInt current = 0;
            if (broken.Contains(i))
            {
                current = 0;
            }
            else
            {
                current = prev + prev2;
            }
            prev2 = prev;
            prev = current;
        }
        Console.WriteLine(prev);
    }
}


struct ModInt
{
    const int MOD = 1000000007;
    long Data;
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public ModInt(long data) { if ((Data = data % MOD) < 0) Data += MOD; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static implicit operator long(ModInt modInt) => modInt.Data;
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static implicit operator ModInt(long val) => new ModInt(val);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator +(ModInt a, ModInt b)
    {
        long res = a.Data + b.Data;
        return new ModInt() { Data = res >= MOD ? res - MOD : res };
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator +(ModInt a, long b) => a.Data + b;
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator -(ModInt a, ModInt b)
    {
        long res = a.Data - b.Data;
        return new ModInt() { Data = res < 0 ? res + MOD : res };
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator -(ModInt a, long b) => a.Data - b;
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator *(ModInt a, ModInt b) => new ModInt() { Data = a.Data * b.Data % MOD };
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator /(ModInt a, ModInt b) => a.Data * GetInverse(b);

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public override string ToString() => Data.ToString();

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    static long GetInverse(long a)
    {
        long div;
        long p = MOD;
        long x1 = 1, y1 = 0, x2 = 0, y2 = 1;
        while (true)
        {
            if (p == 1) return x2;
            div = a / p;
            x1 -= x2 * div;
            y1 -= y2 * div;
            a %= p;
            if (a == 1) return x1;
            div = p / a;
            x2 -= x1 * div;
            y2 -= y1 * div;
            p %= a;
        }
    }
}


Measured memory_bytes: 14432
#include <stdio.h>
int main()

{
    int a,h,count=0,i;
    scanf("%d%d",&a,&h);

    for(i=a;;i-=h){
        count++;
        if(i<=0){
            break;
        }
    }
    printf("%d",count-1);

    return 0;
}


Measured memory_bytes: 128
N = int(input())
dic = {}
for i in range(N):
    spell = ''.join(sorted(input()))
    if spell in dic.keys():
        dic[spell] += 1
    else:
        dic[spell] = 1

count = 0
for num in dic.values():
    count += sum([i for i in range(num)])

print(count)

Measured memory_bytes: 17852
#include<bits/stdc++.h>
using namespace std;
const int N=25;     
int n,a[N],b[N],c[N],sum;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i];
    for(int i=1;i<=n;i++)cin>>b[i],sum+=b[i];
    for(int i=1;i<n;i++)cin>>c[i];
    for(int i=1;i<n;i++){
        if(a[i+1]-a[i]==1)sum+=c[a[i]];
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
      Scanner scan = new Scanner(System.in);
      int n =  scan.nextInt();
      int[] a = new int[n];
      for (int i=0; i<n; i++) {
        a[i] = scan.nextInt();
      }
      int count = even(n,a);
      System.out.println(count);
      scan.close();
  }
  
  public static int even(int n,int[] a){
  int count = 0;
  for (int i=0; i<n; i++) {
    if (a[i]%2 != 0){
      return 0;
    } 
    a[i] /= 2;
  }
  count = even(n,a);
  count++;
  return count;
}
}



Measured memory_bytes: 21844
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

#define ll long long

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

int main() {
    int  a, b;
    char op;
    int  ans;
    while (true) {
        cin >> a >> op >> b;
        if (op == '?') break;
        if (op == '+') ans = a + b;
        if (op == '-') ans = a - b;
        if (op == '*') ans = a * b;
        if (op == '/') ans = a / b;
        cout << ans << "\n";
    }
    return 0;
}



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

using namespace std;
typedef long long ll;

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

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

int main()
{
        int N;
        cin >> N;
        int ans = 1;
        while (ans * 2 <= N)
        {
                ans *= 2;
        }
        cout << ans << endl;
        return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
const int M = 1e5 + 10;
long long num[M];
int main() {
    int n;
    long long k;
    cin >> n >> k;
    memset(num , 0 , sizeof(num));
    for(int i = 0 ; i < n ; i++) {
        int a , b;
        cin >> a >> b;
        num[a] += (long long)b;
    }
    long long sum = 0;
    for(int i = 1 ; i <= M - 10 ; i++) {
        sum += num[i];
        if(sum >= k) {
            cout << i << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 1024
import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.math, std.typecons, core.bitop;

int r, c;
int[] sb;

void main() {
    string s = readln.chomp;
    int n = s.length.to!int;

    bool[] e = new bool[](26);

    foreach (ch ; s) {
        e[ch - 'a'] = 1;
    }

    if (e.count(1) == 1) {
        writeln(0);
        return;
    }

    int ans = 1000;

    foreach (char ch; 'a' .. 'z' + 1) {
        if (!e[ch - 'a']) continue;

        auto t = s.dup;
        int cnt;

        foreach (i ; 0 .. n - 1) {
            cnt++;

            foreach (j ; 0 .. n - 1 - i) {
                if (t[j + 1] == ch) {
                    t[j] = ch;
                }
            }

            bool flag = true;

            foreach (j ; 0 .. n - 1 - i) {
                if (t[j] != ch) {
                    flag = false;
                    break;
                }
            }

            debug {
                stderr.writeln(t[0 .. n - 1 - i]);
            }

            if (flag) break;
        }

        ans = min(ans, cnt);
    }

    writeln(ans);
}

void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<queue>
#include<cmath>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
ll inf = 100000000;
ll w[205];
ll v[205];
ll x[20000005];
ll a[10005], b[10005];
ll dp[1000005];
typedef pair<int, int> P;

int main() {
	ll h, n;
	cin >> h >> n;
	for (int i = 0; i <= h; i++) {
		dp[i] = inf;
	}
	dp[0] = 0;
	for (int i = 0; i < n; i++) {
		ll a, b;
		cin >> a >> b;
		for (int j = 0; j < h; j++) {
			int x = min(j + a, h);
			dp[x] = min(dp[x], dp[j] + b);
		}
	}
	cout << dp[h] << endl;
	return 0;
}


Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Deque;

public class Main {

	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				System.in));
		StringBuilder builder = new StringBuilder();
		String[] line = reader.readLine().split(" ");
		int n = Integer.parseInt(line[0]);
		int q = Integer.parseInt(line[1]);
		Deque<String[]> queue = new ArrayDeque<String[]>(n);
		for (int i = 0; i < n; i++) {
			queue.add(reader.readLine().split(" "));
		}
		String[] work = new String[2];
		int elapse = 0;
		while ((work = queue.poll())!=null) {
			int time = Integer.parseInt(work[1]);
			if (time <= q) {
				elapse += time;
				builder.append(work[0]).append(" ").append(elapse).append("\n");
			} else {
				time -= q;
				elapse += q;
				work[1] = String.valueOf(time);
				queue.add(work);
			}
		/*	queue.forEach(a->System.out.println(Arrays.toString(a)));
			System.out.println(Arrays.toString(work) + "  ->  work    " + elapse);
			System.out.println();*/

		}
		System.out.print(builder);
	}
}

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

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

// Graph.h start--------------------------------------------
#pragma once

#include <vector>

using Weight = long long;

struct Vertex;
using Vertices = std::vector<Vertex *>;
struct Edge;
using Edges = std::vector<const Edge *>;

struct Vertex {
	const int id;
	Edges edges;
	Vertex(int id);
	void add_edge(const Edge *const p_e);
	void add_edge(const Edges &es);
};

struct Edge {
	Vertex *p_src, *p_dst;
	Weight weight;
	
	Edge(Vertex *p_src, Vertex *p_dst, Weight weight);
	Edge(const Edge &e);
	Edge& operator = (const Edge &de);
};

struct Graph {
	Vertices vertices;
	Edges edges;
	Graph(int nvertices);
	Graph();
	~Graph();
	void add_edge(Edge *p_edge);
	void add_edge(int edge_src, int edge_dst, Weight w);
};

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

using namespace std;

Vertex::Vertex(int id) : id(id) { }
void Vertex::add_edge(const Edge *const p_e) {
	edges.push_back(p_e);
}
void Vertex::add_edge(const Edges &es) {
	for (const auto &p_e : es) {
		add_edge(p_e);
	}
}

Edge::Edge(Vertex *p_src, Vertex *p_dst, Weight weight) : p_src(p_src), p_dst(p_dst), weight(weight) { }
Edge::Edge(const Edge &e) : Edge(e.p_src, e.p_dst, e.weight) {}
Edge& Edge::operator = (const Edge &e) {
	p_src = e.p_src;
	p_dst = e.p_dst;
	weight = e.weight;
	return *this;
}
bool operator < (const Edge &e1, const Edge &e2) {
	return e1.weight != e2.weight ? e1.weight > e2.weight : // !!INVERSE!!
		e1.p_src != e2.p_src ? e1.p_src->id < e2.p_src->id : e1.p_dst->id < e2.p_dst->id;
}

Graph::Graph(int nvertices) {
	for (int id = 0; id < nvertices; id++) {
		vertices.push_back(new Vertex(id));
	}
}
Graph::Graph() : Graph(0) {}
Graph::~Graph() {
	for (auto &p_vertex : vertices) {
		delete p_vertex;
	}
	for (auto &p_edge : edges) {
		delete p_edge;
	}
}
void Graph::add_edge(Edge *p_edge) {
	vertices[p_edge->p_src->id]->add_edge(p_edge);
	edges.push_back(p_edge);
}
void Graph::add_edge(int edge_src, int edge_dst, Weight w) {
	add_edge(new Edge(vertices[edge_src], vertices[edge_dst], w));
}

// Graph.h end----------------------------------------------

vector<int> color;

void paint(int s, int d, Weight w, Graph& g) {
	color[d] = (color[s] + w) % 2;
	for (const auto &p_e : g.vertices[d]->edges) {
		int nd = p_e->p_dst->id;
		if (nd == s)
			continue;
		paint(d, nd, p_e->weight, g);
	}
}

int main() {
	int N;
	cin >> N;
	vector<int> u(N + 1), v(N + 1), w(N);
	for (int i = 0; i < N - 1; i++)
	{
		cin >> u[i] >> v[i] >> w[i];
		w[i] = w[i] % 2;
	}
	Graph g(N + 1);

	color = vector<int>(N + 1);
	for (int i = 0; i < N - 1; i++)
	{
		int U = u[i];
		int W = w[i];
		g.add_edge(u[i], v[i], w[i]);
		g.add_edge(v[i], u[i], w[i]);
	}
	color[0] = 0;
	paint(0, 1, 0, g);

	for (int i = 1; i <= N; i++)
	{
		cout << color[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 19440
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
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; }

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  ll n;
  cin >> n;
  ll a[n];
  FOR(i,0,n-1) cin >> a[i];

  ll b[n+1];
  b[0] = 0;
  map<ll,ll> m;
  ++m[0];

  ll ans = 0;

  FOR(i,1,n){
    b[i] = b[i-1] + a[i-1];
    // cout << b[i] << endl;
    ++m[b[i]];
  }

  sort(b,b+n+1);

  for(auto i : m){
    // cout << i.first << " " << i.second << endl;
    if(i.second>1){
      ans += i.second*(i.second-1)/2;
    }
  }

  cout << ans << endl;


}



Measured memory_bytes: 15872
#include <iostream>
#include <string>

using namespace std;

int main() {
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (i + 1 < n && i + 2 < n && s[i] == 'A' && s[i + 1] == 'B' &&
        s[i + 2] == 'C') {
      ++ans;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
def resolve():
    sx, sy, tx, ty = map(int, input().split())
    tx, ty = (tx-sx), (ty-sy)
    sx, sy = 0, 0

    ans1 = ["R"]*tx + ["U"]*ty
    ans2 = ["L"]*tx + ["D"]*ty
    ans3 = ["D"]+["R"]*(tx+1)+["U"]*(ty+1)+["L"]
    ans4 = ["U"] + ["L"]*(tx+1)+["D"]*(ty+1)+["R"]
    print("".join(ans1+ans2+ans3+ans4))
resolve()

Measured memory_bytes: 38384
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String w = sc.next().toLowerCase();
        String t;
        int count = 0;

        while( !((t=sc.next()).equals("END_OF_TEXT")) ){
            if(t.toLowerCase().equals(w)) count++;
        }

        System.out.println(count);
    }
}

Measured memory_bytes: 26176
#include <bits/stdc++.h>
using namespace std;
map<string,int> mp;
int main() {
    long test=1;
    // cin>>test;
    while(test--)
    {
	long long t,i,j,n,a,b,c,d,ans,A,B,x,y,one,q,l,r;
	string s,s1,s2,s3;
	cin>>a>>b>>c;
	if(b-a==c-b)
	cout<<"YES";
	else cout<<"NO";
	
	
	
    }

}

Measured memory_bytes: 256
from functools import reduce
import math
import copy

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N,M = (int(_) for _ in input().split())
    a = []
    b = []
    d = []
    for i in range(M):
        s1,s2 = (int(_) for _ in input().split())
        a.append(s1-1)
        b.append(s2-1)
        
    for i in range(N):
        d.append(list(INF for _ in range(N)))

    for i in range(N):
        for j in range(N):
            if (i==j):
                d[i][j] = 0
                    
    for i in range(M):
        d[a[i]][b[i]] = 1
        d[b[i]][a[i]] = 1

    ans = 0
    for m in range(M):
        d_tmp = copy.deepcopy(d)
        d_tmp[a[m]][b[m]] = INF
        d_tmp[b[m]][a[m]] = INF

        for k in range(N):
            for i in range(N):
                for j in range(N):
                    d_tmp[i][j] = min(d_tmp[i][j],d_tmp[i][k]+d_tmp[k][j])

        for i in range(N):
            if d_tmp[i].count(INF) > 0:
                ans +=1
                break
    print(ans)
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 49628
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
#define x1 X1
#define y1 Y1
#define x2 X2
#define y2 Y2
#define SZ 2333333
const int MOD=1e9+7;
int x1,x2,x3,x4,x5,x6,y1,y2,y3,y4,y5,y6;
ll fac[SZ],rfac[SZ];
ll qp(ll a,ll b)
{
	ll x=1;
	while(b)
	{
		if(b&1) x=x*a%MOD;
		a=a*a%MOD; b>>=1;
	}
	return x;
}
inline ll rt(int x1,int y1,int x2,int y2)
{
	if(x1<=x2&&y1<=y2) return
		fac[x2-x1+y2-y1]*rfac[x2-x1]%MOD*rfac[y2-y1]%MOD;
	return 0;
}
ll f(int sx,int sy,int tx,int ty)
{
	ll ans=0;
	for(int x=x3;x<=x4;++x)
		ans-=rt(sx,sy,x,y3-1)*rt(x,y3,tx,ty)%MOD*(x+y3)%MOD;
	for(int y=y3;y<=y4;++y)
		ans-=rt(sx,sy,x3-1,y)*rt(x3,y,tx,ty)%MOD*(y+x3)%MOD;
	for(int x=x3;x<=x4;++x)
		ans+=rt(sx,sy,x,y4)*rt(x,y4+1,tx,ty)%MOD*(x+y4+1)%MOD;
	for(int y=y3;y<=y4;++y)
		ans+=rt(sx,sy,x4,y)*rt(x4+1,y,tx,ty)%MOD*(y+x4+1)%MOD;
	return ans%MOD;
}
ll f(int sx,int sy)
{
	return f(sx,sy,x6+1,y6+1)
	-f(sx,sy,x5,y6+1)
	-f(sx,sy,x6+1,y5)
	+f(sx,sy,x5,y5);
}
int main()
{
	fac[0]=1;
	for(int i=1;i<SZ;++i) fac[i]=fac[i-1]*i%MOD;
	rfac[SZ-1]=qp(fac[SZ-1],MOD-2);
	for(int i=SZ-1;i>=1;--i)
		rfac[i-1]=rfac[i]*i%MOD;
	cin>>x1>>x2>>x3>>x4>>x5>>x6
	>>y1>>y2>>y3>>y4>>y5>>y6;
	ll ans=f(x2,y2)-f(x1-1,y2)-f(x2,y1-1)+f(x1-1,y1-1);
	ans=(ans%MOD+MOD)%MOD;
	printf("%d\n",int(ans));
}


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

int main(){
    int n, T; cin >> n >> T;
    int cost = 1000, time = 1000;
    bool flag = false;
    for(int i=0;i<n;i++){
        int c, t; cin >> c >> t;
        if(t <= T){
            cost = min(cost, c);
            flag = true;
        }
    }
    if(flag) cout << cost << endl;
    else cout << "TLE" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
// #include <numeric> // gcdとかlcmとか C++17から
#include <time.h> // time_t timer; time(&timer); でtimerに現在時刻が代入される．
#include <unistd.h> // sleep関数．引数は秒単位．
using namespace std;

typedef long long ll;


// sortの仕方
// 	■ string s の場合
// 	昇順: sort(s.begin(), s.end())
// 	降順: sort(s.rbegin(), s.rend())
//
// 	■ ll a[N] の場合
// 	昇順: sort(a, a+N)
// 	降順: 不明

// vector の使い方
// 宣言：
// vector<int> v;
// vector<int> v(N);
// 初期化:
// vector<int> v(10, 5); 要素数10，全ての要素の値5．
// vector<int> v = {1, 2, 3};
// 代入：
// v[0] = 3;
// sort:
// sort(v.begin(), v.end());
//

// int alph2int(char character) {
//     int x = character - 'a';
//     return x;
// }

ll my_gcd(ll a, ll b){
	return (b==0) ? a : my_gcd(b, a%b);
}

ll my_lcm(ll a, ll b){
	return a*b / my_gcd(a,b);
}

ll factorial(ll a){
	ll ans = 1;
	for(ll i=a; i>0; i--){
		ans *= i;
	}
	return ans;
}

ll pow(ll a, ll b) {
	ll a_powered = 1;
	for (int i=0; i<b; i++) {
		a_powered *= a;
	}
	return a_powered;
}


int main(int argc, char *argv[]){
    int A, B, T;
    cin >> A >> B >> T;

    cout << (T/A)*B << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cout << "[" << #var << "] " << var << endl
const ll mod = 1000000007;


int main(){
    int a, b;
    cin >> a >> b;
    string ans = "Yay!";
    if (a>8 || b>8) {
        ans = ":(";
    }
    
    
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int h = in.nextInt(), w = in.nextInt();
			char[][] s = new char[h][w];
			for (int i = 0; i < h; i++) {
				s[i] = in.nextString().toCharArray();
			}

			for (int i = 0; i < h; i++) {
				out.println(new String(s[i]));
				out.println(new String(s[i]));
			}

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}


Measured memory_bytes: 21460
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
  int X; cin>>X;
  int ans = 1;
  for(int x = 2; x*x <= X; x++) {
     int v = x*x;
     while(v <= X) {
     	ans = max(ans, v);
       v *= x;
     }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<stdio.h>
#include<string.h>
using namespace std;
#define ll  long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define rep(i,t,n) for(int i=t;i<n;i++)
#define nd "\n"
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>




/*ll power(ll x,ll t){
if(t<=0){
    return 1;
}
ll y=(power(x,t/2));
y=(y*y)%ma;
if(t%2)
    y=(y*x)%ma;
return y;

}*/
/*ll ph[100001];
void E_phi(int n){

ph[0]=0;
ph[1]=1;
for(int i=2;i<=n;i++){
    ph[i]=i;
}
for(int i=2;i<=n;i++){
    if(ph[i]==i){
        for(int j=i;j<=n;j+=){
            ph[j]-=ph[j]/i;
        }
    }
}


}*/
/*string s,t;
vector<int>  z_fun(string s){

int n = (int) s.length();
    vector<int> z(n);
    for (int i = 1, l = 0, r = 0; i < n; ++i) {
        if (i <= r)
            z[i] = min (r - i + 1, z[i - l]);
        while (i + z[i] < n && s[z[i]] == s[i + z[i]])
            ++z[i];
        if (i + z[i] - 1 > r)
            l = i, r = i + z[i] - 1;
    }
    return z;
}*/

/*struct st{
ll sum,pre,suf,ans;
st(){}
st(ll k){
ans=k,pre=k,suf=k,sum=0;
}

};
ll t[4*200001+4];
ll a[200001];
ll lazy[4*200001+4];
ll mx=1e14;



void push(int ind){
int l=2*ind+1,r=2*ind+2;
t[l]+=lazy[ind];
t[r]+=lazy[ind];
lazy[l]+=lazy[ind];
lazy[r]+=lazy[ind];
lazy[ind]=0;

}

void build(int ind,int l,int r){
if(l==r){
    t[ind]=a[l];
return;
}
int mid=(l+r)/2;
build(2*ind+1,l,mid);
build(2*ind+2,mid+1,r);

  t[ind] =min(t[ind*2+1] , t[ind*2+2]);



}
ll query(int ind,int l,int r,int p,int q){

if(l>q || r<p )
    return mx;
    int mid=(l+r)/2;

if(l>=p && r<=q )
    {
      return t[ind];
    }
    push(ind);
ll x=query(2*ind+1,l,mid,p,q);
ll y=query(2*ind+2,mid+1,r,p,q);


return min(x,y);
}

void update(int ind,int l,int r,int p,int q,int val){
if(l>q || r<p )
    return;

if(l>=p && r<=q )
    {
      t[ind]+=val;
      lazy[ind]+=val;
      return;
    }
push(ind);
int mid=(l+r)/2;
    update(2*ind+1,l,mid,p,q,val);
     update(2*ind+2,mid+1,r,p,q,val);
    t[ind]=min(t[2*ind+1],t[2*ind+2]);



}


ll mod(ll a){
if(a>=0)
    return a;
else return -a;
}
*/

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<max({b*d,a*c,a*d,c*b})<<endl;

}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef std::pair<int, ll> pr;

int main(int, char**)
{
    int n;
    vector<pr> a;

    cin >> n;
    int tmp;
    for (int i = 0; i < n; i++) {
        cin >> tmp;
        a.push_back(make_pair(i+1, tmp));
    }
    sort(
        a.begin(),
        a.end(),
        [](const pr& x, const pr& y){ return x.second > y.second; }
    );

    int x, y;
    ll tmp1, tmp2;
    vector< vector<ll> > dp(n+1, vector<ll>(n+1, 0));
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= i; j++) {
            x = j;
            y = i-j;
            tmp1 = tmp2 = 0LL;
            if (x > 0) tmp1 = dp[x-1][y] + a[i-1].second * abs(a[i-1].first - x); // 左詰め
            if (y > 0) tmp2 = dp[x][y-1] + a[i-1].second * abs(a[i-1].first - (n-y+1)); // 右詰め
            dp[x][y] = max(tmp1, tmp2);
        }
    }
    ll max = 0;
    for (int i = 0; i <= n; i++) {
        if (dp[i][n-i] > max) max = dp[i][n-i];
    }

    cout << max << endl;

    return 0;
}

Measured memory_bytes: 34680
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a[100],number,i;
    scanf("%d",&number);
    for(i = 0; i < number ;i++){
        scanf("%d" ,&a[i]);
    }
    for(i = number - 1; i > 0;i--){
        printf("%d ",a[i]);
    }
    printf("%d\n",a[0]);
    return 0;
}

Measured memory_bytes: 596
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define PI 3.14159265358979323846264338327950L

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back

template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

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

bool isPalindrome(string s){
    REP(i, s.length() / 2){
        if(s[i] != s[(s.length() - 1) - i]){
            return false;
        }
    }
    return true;
}

//scanf("%lld", &);
//cin >> ;
//cout << ans << endl;

 ll N, M, K, Q, i, j, k, l, tmp, ans;

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

    bool flag = true;

    int tmp = (s.length() + 3) / 2;

    if(!isPalindrome(s)){
        flag = false;
    }
    else if(!isPalindrome(s.substr(0, s.length() / 2))){
        flag = false;
    }
    else if(!isPalindrome(s.substr(tmp, (s.length() - 1) - tmp))){
        flag = false;
    }

    if (flag){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3620
MOD = int(1e9) + 7

def main():
    buf = input()
    buflist = buf.split()
    N = int(buflist[0])
    A = int(buflist[1])
    B = int(buflist[2])
    C = int(buflist[3])
    # ABの二項分布*1-Cの逆数っぽい
    # nCnから(2n-1)Cnまで計算
    divisor = 1
    for i in range(1, N+1):
        divisor = (divisor * i) % MOD
    nCr = []
    dividend = divisor
    for i in range(1, N+1):
        nCr.append((dividend * modinv(divisor)) % MOD)
        dividend = (dividend * (i+N)) % MOD
        dividend = (dividend * modinv(i)) % MOD
    Apow = []
    Bpow = []
    pow100 = []
    a = 1
    b = 1
    p100 = 1
    for i in range(N+1):
        Apow.append(a)
        Bpow.append(b)
        pow100.append(p100)
        a = (a * A) % MOD
        b = (b * B) % MOD
        p100 = (p100 * (A + B)) % MOD
    probability = []
    for i in range(N, 2*N):
        dividend = 1
        divisor = 1
        dividend = (dividend * nCr[i-N]) % MOD
        dividend = (dividend * Apow[N]) % MOD
        dividend = (dividend * Bpow[i-N]) % MOD
        divisor = (divisor * pow100[N]) % MOD
        divisor = (divisor * pow100[i-N]) % MOD
        probability.append(((dividend * 100) % MOD, (divisor * (100-C)) % MOD))
    for i in range(N, 2*N):
        dividend = 1
        divisor = 1
        dividend = (dividend * nCr[i-N]) % MOD
        dividend = (dividend * Bpow[N]) % MOD
        dividend = (dividend * Apow[i-N]) % MOD
        divisor = (divisor * pow100[N]) % MOD
        divisor = (divisor * pow100[i-N]) % MOD
        probability.append(((dividend * 100) % MOD, (divisor * (100-C)) % MOD))
    dividend = probability[0][0]
    divisor = probability[0][1]
    for i in range(1, len(probability)):
        dividend = (dividend * probability[i][1]) % MOD
        dividend = (dividend + (probability[i][0] * divisor) % MOD) % MOD
        divisor = (divisor * probability[i][1]) % MOD
    print((dividend * modinv(divisor) * N) % MOD)

def modinv(x, m = MOD):
    b = m
    u = 1
    v = 0
    while b:
        t = x // b
        x -= t * b
        x, b = b, x
        u -= t * v
        u, v = v, u
    u %= m
    if u < 0:
        u += m
    return u

if __name__ == '__main__':
    main()


Measured memory_bytes: 45988
#include <bits/stdc++.h>
#define int long long int
#define pb push_back

#define mod 1000000007
#define sp fixed<<setprecision(12)
using namespace std;
/*
const int MAX=10000005;
vector<int> primes;
bitset<MAX> is_prime;
void sieve(){
    is_prime.set();
    is_prime[0]=is_prime[1]=0;
    for(int i=4;i<MAX;i+=2){
        is_prime[i]=0;
    }
    for(int i=3;i*i<MAX;i+=2){
        if(is_prime[i]){
            primes.pb(i);
            for(int j=i*i;j<MAX;j+=i){
                is_prime[j]=0;
            }
        }
    }
}
*/
/*
void lcs(char s1[],char s2[]){
    int n=strlen(s1);
    int m=strlen(s2);
    vector<vector<int>> dp(n+1,vector<int>(m+1,0));
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            int sum=0;
            if(s1[i-1]==s2[j-1]){
                sum=1+dp[i-1][j-1];
            }
            else{
                sum=max(dp[i-1][j],dp[i][j-1]);
            }
            dp[i][j]=sum;
        }
    }
    
    int index=dp[n][m];
    //cout<<index<<endl;
    char ans[index+1];
    ans[index]='\0';
    index--;
    int x=n;
    int y=m;
    while(x>0 and y>0){
        if(dp[x-1][y]==dp[x][y-1] and dp[x-1][y]!=dp[x][y]){
            ans[index]=s1[x-1];
            index--;
            x--;
            y--;
        }else if(dp[x-1][y]>dp[x][y-1]){
            x--;
        }else{
            y--;
        }

    }
    //reverse(ans.begin(),ans.end());

    cout<<ans;
    return;
}
*/



int32_t main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    //double    pi=3.14159265358979323846;
    //sieve();
    int t=1;
    
    //cin>>t;
    
    for(int tc=1;tc<=t;tc++){
        int n;
        cin>>n;
        string s;
        cin>>s;
        int low=0,high=n-1;
        int ans=0;
        while(low<high){
            if(s[low]=='W' and s[high]=='R'){
                ans++;
                low++;
                high--;
            }else if(s[low]=='W' and s[high]=='W'){
                high--;
            }else{
                low++;
            }
        }
        cout<<ans<<'\n';
    }
    
    return 0;
    
}

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

#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
namespace adaptor = boost::adaptors;

// 多倍長テンプレ
/* ---------------------- ここから ---------------------- */
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;
/* ---------------------- ここまで ---------------------- */

using ll = long long;
using ull = unsigned long long;

bool is_product_overflow(ull a, ull b) {
	ull prod = a * b;
	return (prod / b != a);
}

void Main()
{
	string S, T;
	cin >> S >> T;

	int c = 0;
	for (int i = 0; i < (int)S.size(); ++i) {
		const char s = S[i];
		const char t = T[i];
		if (s != t) {
			++c;
		}
	}
	cout << c;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 3780
#include"bits/stdc++.h"
using namespace std;
int main(){
	int n,s;
	cin>>n>>s;
	vector<int> x;
	for(int i=0;i!=n;++i){
		int m;
		cin>>m;
		x.push_back(m);
	}
	sort(x.begin(),x.end());
	int i=0;
	for(;i!=n;++i){
		if(i==n-1){
			if(x[i]==s)
				++i;
			break;
		}
		if(x[i]>s)
			break;
		s-=x[i];
	}
	cout<<i;
}



Measured memory_bytes: 256
n=int(input())
a=[0]*n
x=[[0]*n for i in range(n)]
y=[[0]*n for i in range(n)]
for i in range(n):
  a[i]=int(input())
  for j in range(a[i]):
    u,v=map(int,input().split())
    x[i][j]=u-1
    y[i][j]=v
ans=0
for k in range(2**n):
  arr=[0]*n
  cnt=0
  flag=True
  for i in range(n):
    if k>>i&1:
      arr[i]=1
      cnt+=1
  for i in range(n):
    for j in range(a[i]):
      if arr[i]==1:
        if (y[i][j]==1 and arr[x[i][j]]==0) or (y[i][j]==0 and arr[x[i][j]]==1):
          flag=False
  if flag:
    ans=max(ans,cnt)
print(ans)

Measured memory_bytes: 45804
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main() {
	int a, b, s;
	cin >> a >> b;
	int i = 0;
	for (s = a;s <= b;s++) {
		int t = s % 10, u = s / 10000, p = s / 10 % 10, q = s / 1000 % 10;
		if (t == u && p == q)i++;
	}
	cout << i << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main(){FIN

    ll x; cin>>x;
    if (x==1){
        cout<<1<<' '<<0<<endl;
        return 0;
    }

    vll ret = divisor(x);

    for(auto p:ret){
        ll b=0; ll a=p;
        ll f;
        if(pow(a,5)-pow(b,5)>x) f=1;
        else f=0;

        while(f){
            a--; b--;
            if(pow(a,5)-pow(b,5)==x){
                cout <<a<<' '<<b<<endl;
                return 0;
            }
            if(pow(a,5)-pow(b,5)<x) break;
        }

        while(!f){
            a++; b++;
            if(pow(a,5)-pow(b,5)==x){
                cout<<a<<' '<<b<<endl;
                return 0;
            }
            if(pow(a,5)-pow(b,5)>x) break;
        }
    }
    cout<<-1<<endl;
    return 0;
}

Measured memory_bytes: 4064
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>



void swap (int *x, int *y) {
  int temp;

  temp = *x;
  *x = *y;
  *y = temp;

  return;
}


int gcd(int a, int b){
  int c;

  while (b > 0){
    c = a % b;
    a = b;
    b = c;
  }

  return a;
}

/* クイックソート */
int dn(const void*a,const void*b){return*(int*)b-*(int*)a;}


long int modpow(long int a,long int n,long int mod){
  long int ans=1;
  while(n>0){
    if(n & 1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    n/=2;
  }
  return ans;
}

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

int max(int a,int b){
  if(a<b){
    return b;
  }
  else{
    return a;
  }
}

int min(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}

void chmax(int *a,int b){
  if(*a < b){
    *a = b;
  }

  return;
}

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

  return;
}

/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/

int main(void){
  double a,b,h,m;
  scanf("%lf%lf%lf%lf",&a,&b,&h,&m);

  double pi=3.14159265358979;
  /*

  時計の中心と文字盤の0を結んだ線を基準線と呼ぶことにします．

  時計の中心と文字盤のh(0<=h<12)を結んだ線と基準線が作る角の大きさx(0<=x<180)は
  度数法で(30*h)と表すことができます．
  
  また，m分(0<=m<60)の時の長針と基準線が作る角の大きさy(0<=y<180)は
  度数法で(6*m)と表すことができます．

  これらをまとめてh時m分の時の長針と短針が作る角の大きさは
  abs(30*h-6*m)と表すことができそうです(これが180を超える場合は180を引いてやればいいです)

  が，短針は時間が変わったら30度一気に動くわけではなく，60分かけて30度を動いていくので，それも考慮しなければなりません．

  つまり，30*(m/60)=m/2をxに足してやる必要があります．

  改めて，h時m分の時の長針と短針が作る角の大きさzは
  abs(30*h+m/2-6*m)と表すことができます．

  ここで余弦定理を用いて求める長さが欲しいわけですが，注意しなければいけないのは
  sin(z)の引数(渡してあげるzのこと)は度数法ではなく弧度法でないといけません．

  pi==180\degreeであるのでpi:180==?:zの式を?について解くと
  ?=z*pi/180であることがわかります．

  以上のことより，答えは

  a*a+b*b-2*a*b*cos(z*pi/180)

  となります．
  
  */
  
  //0<=h<12にする
  if(h>=12){
    h-=12;
  }

  //hは基準線とそれが作る角度
  h=30*h+m/2;

  //mは基準線とそれが作る角度
  m*=6;
  
  
  double z=h-m;
  
  if(z<0){
    z*=-1;
  }
  
  
  if(z>180){
    z=360-z;
  }


  z=z*pi/180;
  
  double ans=a*a+b*b-2*a*b*cos(z);

  printf("%.16lf\n",sqrt(ans));

  return 0;
}

Measured memory_bytes: 2516
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;

void solve() {
	int x, y, z, a, b, c;
	cin >> x >> y >> z >> a >> b >> c;
	int n; cin >> n;
	vector<ll> cx(n),cy(n),cz(n);
	rep(i, x) {
		int d = abs(i - a);
		cx[d%n]++;
	}
	rep(i, y) {
		int d = abs(i - b);
		cy[d%n]++;
	}
	rep(i, z) {
		int d = abs(i - c);
		cz[d%n]++;
	}
	vector<ll> cnt(n);
	rep(i, n) {
		rep(j, n) {
			cnt[(i + j) % n] += cy[i] * cz[j];
		}
	}
	rep(i, n) {
		if (i > 0)cout << " ";
		ll sum = 0;
		rep(j, n) {
			int d = n - j+i; d %= n;
			sum += cx[j] * cnt[d];
		}
		cout << sum;
	}
	cout << endl;
}

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


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

int main() {
  string S;
  cin >> S;
  while (true) {
    int N = S.size();
    if (S == "") {
      cout << "YES" << endl;
      break;
    }
    else if (N >= 5 && S.substr(N - 5, 5) == "dream") S = S.substr(0, N - 5);
    else if (N >= 7 && S.substr(N - 7, 7) == "dreamer") S = S.substr(0, N - 7);
    else if (N >= 5 && S.substr(N - 5, 5) == "erase") S = S.substr(0, N - 5);
    else if (N >= 6 && S.substr(N - 6, 6) == "eraser") S = S.substr(0, N - 6);
    else {
      cout << "NO" << endl;
      break;
    }
  }
}

Measured memory_bytes: 512
#include <iostream>
#include <cmath>

using namespace std;

int main(void) {
	string a, b;
	cin >> a >> b;

	string s = a + b;
	int c = atoi(s.c_str());

	string result = "No";
	for (int i = 0; ; i++) {
		int by2 = i * i;
		if (c == by2) {
			result = "Yes";
			break;
		} else if (c < by2) {
			break;
		}
	}

	cout << result << endl;

	return 0;
}


Measured memory_bytes: 256