akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

bool cmp(ll a,ll b){
  return a>b;
}

int main(){
  ll n,w;cin >> n >> w;
  ll sum = 0;
  vector<ll> we(n);vector<ll> v(n);
  for(ll i=0;i<n;i++){
    cin >> we[i] >> v[i];
    sum += v[i];
  }

  vector<ll> dp(sum+1,INT_MAX);
  dp[0] = 0;
  for(ll i=0;i<n;i++){
    for(ll j=sum-v[i];j>=0;j--){
      dp[j+v[i]] = min(dp[j+v[i]],dp[j]+we[i]);
    }
  }

  ll ans = INT_MIN;
  for(ll i=0;i<dp.size();i++){
    if(dp[i] <= w) ans = max(ans,i);
  }

  cout << ans << endl;
  cin.get();cin.get();
}


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;
using P = pair<int,int>;

int main() {
    int N;
    cin >> N;
    int ans = 0;

    for (int i = 1; i <= N; i++)
    {
        if (i % 2 == 0)
        {
            continue;
        }
        
        int ret = 0;
        for (int j = 1; j * j <= i; j++)
        {
            if(i % j == 0) {
                ret++;
                if (j * j != i)
                {
                    ret++;
                }
                
            }

        }
        if (ret == 8)
        {
            ans++;
        }
        
    }
    cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<ctime>
#include<utility>
#include<map>
#include<queue>
#include<set>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
int n;
map<ll,int> a;
queue<pii> q;
set<int> l[100010];
int f[100010];
int find(int x)
{
	return f[x]==x?x:f[x]=find(f[x]);
}
ll getid(int x,int y)
{
	if(x>y)
		swap(x,y);
	return ll(x)*n+y;
}
void link(int x,int y)
{
	l[x].insert(y);
	l[y].insert(x);
	ll v=getid(x,y);
	a[v]++;
	if(a[v]==3)
	{
		printf("NO\n");
		exit(0);
	}
	if(a[v]==2)
		q.push(pii(x,y));
}
int main()
{
	scanf("%d",&n);
	int i,x,y;
	for(i=1;i<=2*n-2;i++)
	{
		scanf("%d%d",&x,&y);
		link(x,y);
	}
	for(i=1;i<=n;i++)
		f[i]=i;
	for(i=1;i<n;i++)
	{
		while(1)
		{
			if(q.empty())
			{
				printf("NO\n");
				return 0;
			}
			x=q.front().first;
			y=q.front().second;
			x=find(x);
			y=find(y);
			q.pop();
			if(x!=y)
				break;
		}
		if(l[x].size()>l[y].size())
			swap(x,y);
		f[x]=y;
		a.erase(getid(x,y));
		l[y].erase(x);
		for(auto v:l[x])
		{
			v=find(v);
			if(v==y)
				continue;
			a.erase(getid(x,v));
			link(v,y);
			l[v].erase(x);
			l[x].erase(v);
		}
	}
	printf("YES\n");
	return 0;
}

Measured memory_bytes: 36608
/*
problem's name:
statue:
writer:Patrick_y
*/
#include <iostream>
#include <map>
#include <vector>
#include <cstring>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <string>
#include <stack>
#include <set>
#include <deque>
#include <cctype>
#include <sstream>
#include <math.h>
#include <stdio.h>
#include <time.h>
#define mp make_pair
typedef long long ll;
using namespace std;
const int INF=20050208;
/*------------main part------------*/


int n,m;;
char maze[1005][1005];
int a[1005];
bool vis[1005];
int ans=0;
bool v2[1005];
bool check()
{
	memset(v2,0,sizeof(v2));
	bool used=(m&1);
	for(int i=1;i<=m;i++)
	{
		if(!v2[i])
		{
			bool ok=false;
			for(int j=i+1;j<=m;j++)
			{
				if(!v2[j])
				{
					bool ok2=true;
					for(int k=1;k<=n;k++)
					{
						if(maze[a[k]][i]!=maze[a[n-k+1]][j])
						{
							ok2=false;
						}
					}
					if(ok2)
					{
						v2[j]=true;
						ok=true;
						break;
					}
				}
			}
			if(!ok)
			{
				if(used)
				{
					bool ok2=true;
					for(int k=1;k<=n;k++)
					{
						if(maze[a[k]][i]!=maze[a[n-k+1]][i])
							ok2=false;
					}
					if(ok2)
					{
						used=false;
					}
					else
					{
						return false;
					}
				}
				else
				{
					return false;
				}
			}
		}
	}
	return true;
}
void dfs(int x,int pos,bool odd)
{
	if(ans)
		return;
	if(x>n)
	{
		ans=check();
		return;
	}
	if(vis[x])
	{
		dfs(x+1,pos,odd);
		return;
	}
	for(int i=x+1;i<=n;i++)
	{
		if(!vis[i])
		{
			a[pos]=i;
			a[n-pos+1]=x;
			vis[i]=true;
			dfs(x+1,pos+1,odd);
			vis[i]=false;
		}
	}
	if(odd)
	{
		a[(n>>1)+1]=x;
		dfs(x+1,pos,0);
	}
}
int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			cin>>maze[i][j];
		}
	}
	dfs(1,1,n%2);
	if(ans)
	{
		cout<<"YES";
	}
	else
	{
		cout<<"NO";
	}
	return 0;
}


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

t, a = 1, 1
for _ in  range(N):
    T, A = map(int, input().split())
    t = (t + (T - 1)) // T * T
    a = (a + (A - 1)) // A * A
    if a < t * A // T:
        a = t * A // T
    else:
        t = a * T // A
print(a + t)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int maxn = 2e5 + 10;
const int mod = 1e9 + 7;
int pow_mod(int a, int n, int mod) {
	if (n == 0)
		return 1;
	int ans = pow_mod(a, n / 2, mod);
	ans = ans * ans % mod;
	if (n % 2 == 1)
		ans = ans * a % mod;
	return ans;
}
//扩展GCD
int ex_gcd(int a, int b, int &x, int &y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	int g = ex_gcd(b, a % b, x, y);
	int temp = x;
	x = y;
	y = temp - a / b * y;
	return g;
}
//扩展欧几里得的另一种写法
void ex_gcd(int a, int b, int &d, int &x, int &y) {
	//求解ax+by=gcd(a,b)的一组解
	if (!b) {
		d = a, x = 1, y = 0;
	} else {
		ex_gcd(b, a % b, d, y, x);
		y -= x * (a / b);
	}
}
//逆元
int inv(int a, int mod) {
	int X, Y;
	int g = ex_gcd(a, mod, X, Y);
	if (g != 1)
		return -1;
	return (X % mod + mod) % mod;
}
vector<int> G[maxn];
int sz[maxn];
int fa[maxn];
void dfs(int u, int f) {
	sz[u] = 1;
	fa[u] = f;
	for (int i = 0; i < G[u].size(); i++) {
		int v = G[u][i];
		if (v == f)
			continue;
		dfs(v, u);
		sz[u] += sz[v];
	}
}
int p[maxn];
signed main() {
	int n;
	scanf("%lld", &n);
	for (int i = 1; i < n; i++) {
		int u, v;
		scanf("%lld%lld", &u, &v);
		G[u].push_back(v);
		G[v].push_back(u);
	}
	dfs(1, -1);
	int ans = 0;
	int inv2 = inv(2, mod);
	for (int i = 1; i <= n; i++) {
		int tot = G[i].size();
		if (G[i].size() == 1)
			continue;
		int now = 1;
		for (int j = 0; j < tot; j++) {
			int v = G[i][j];
			int siz = 0;
			if (v == fa[i])
				siz = n - sz[i];
			else
				siz = sz[v];
			p[j] = (1 - inv(pow_mod(2, siz, mod), mod) + mod) % mod; //点黑的概率
			now *= ((1 - p[j] + mod) % mod);
			now %= mod;
		}
		int cur = now;
		for (int j = 0; j < tot; j++) {
			cur += now * inv((1 - p[j] + mod) % mod, mod) % mod * p[j] % mod;
			cur %= mod;
		}
		ans += inv2 * (1 - cur + mod) % mod;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;

}


Measured memory_bytes: 26948
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
typedef long long ll;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define forn(i,a,b) for(int i=a;i<(int)b;i++)
int main()
{
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)
    cin>>arr[i];
    int ans=1;
    int mn=arr[0];
    for(int i=1;i<n;i++)
    {
        if(arr[i]<mn)
        ans++;
        if(arr[i]<mn)
        mn=arr[i];
    }
    cout<<ans<<"\n";
    return 0;
}

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

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)
#define all(c) (c).begin(), (c).end()
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main() {
  int n; cin >> n;
  string s;
  getline(cin, s);
  while(n--) {
    getline(cin, s);
    rep(i, s.size()) {
      if(s.substr(i, 7) == "Hoshino") s[i+6] = 'a';
    }
    cout << s << endl;
  }
}

Measured memory_bytes: 1220
#include <stdio.h>

long long int absolute(long long int a) {
	return a < 0 ? -a : a;
}

int main() {
	long long int a, b;
	scanf("%lld%lld", &a, &b);
	printf("%lld", absolute((a - 2)*(b - 2)));
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll INF = 1LL << 30;

int main(void){
    int A,B; cin >> A >> B;
    int ans;
    for(int i = 0; i < 22; i++){
        if(A + (A-1)*(i-1) >= B){
            ans = i;
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define UNIQNUM(a) UNIQ(a)-a.begin()
#define UNIQIT(a) a.erase(UNIQ(a), a.end());
#define VOUT(v,i) rep(i,v.size())cout<<v[i]<<(i==v.size()-1?"\n":" ");
#define vout(v) VOUT(v,z);
#define vdbg(v,i) cout<<#v<<": ";for(int i=0;i<(int)v.size();i++){cout<<v[i]<<" ";}cout<<"\n";
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL)
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
#define debg(a) cout<<#a<<": "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define digit(a) to_string(a).length();
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
typedef vector<vector<ll>> VV;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) { a = b; return true; }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) { a = b; return true; }
    return false;
}

const string YES = "Yes";
const string NO = "No";
#define judge(f) cout<<(f?YES:NO)<<"\n";

void solve(std::string S){
    map<char,int> m;
    for (long long i = 0; i < S.length(); i++) {
        m[S[i]]++;
    }
    judge(m.size()>1);
}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
K, N = map(int, input().split())
A = [int(i) for i in input().split()]
ans = A[-1] - A[0]

for i in range(1, N-1):
    ans = min(ans, K - A[i] + A[i-1], A[i] + (K - A[i+1]))

print(ans)

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

int main(){
	int i;
	string S;
	cin >> S;
	int ans = 1, now;
	for(i = 1, now = 1; i < S.size(); ){
		if(now == 2){
			now = 1;
			i++;
		}
		else{
			if(S[i] == S[i - 1]){
				now = 2;
				i += 2;
			}
			else{
				now = 1;
				i++;
			}
		}
		ans++;
	}
	if(i == S.size() + 1){
		ans--;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
string s;
cin>>s;
for(int i=0;i<s.length();i++)
{
	if(s[i]+n<=90)
	s[i]=s[i]+n;
else
	s[i]='A'+s[i]+n-'Z'-1;
}
cout<<s;


	return 0;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!coution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	R := float64(nextInt())
	// R := float64(1)
	fmt.Println(2 * R * math.Pi)

}

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func split(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "fuck")
	}
}

// -*-*-*-*-*-*-*-*-
// * tool snippets *
// -*-*-*-*-*-*-*-*-
func duplicate2Int(base [][]int) (ret [][]int) {
	ret = make([][]int, len(base))
	for i, v := range base {
		ret[i] = append([]int{}, v...)
	}
	return
}

// -*-*-*-*-*-*-*-*-*-*-*-*-*-
// * Algorithms Utility Zone *
// -*-*-*-*-*-*-*-*-*-*-*-*-*-

// -*-*-*-*-*-*-*-
// * 1. nibutan  *
// -*-*-*-*-*-*-*-
func lower_bound(arr []int, target int) int {
	l, r := 0, len(arr)
	for l < r {
		mid := (l + r) / 2
		if arr[mid] < target {
			l = mid + 1
		} else {
			r = mid
		}
	}
	return l
}

func upper_bound(arr []int, target int) int {
	l, r := 0, len(arr)
	for l < r {
		mid := (l + r) / 2
		if target < arr[mid] {
			r = mid
		} else {
			l = mid + 1
		}
	}
	return l
}

// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
// * math flavor typical theories *
// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
func gcd(a, b int) int {
	if a > b {
		return gcd(b, a)
	}
	for a != 0 {
		a, b = b%a, a
	}
	return b
}

func pow(a, b int) (ret int) {
	ret = a
	// 10^2 = 100ってことは10に10を1回掛けることだね
	// なので初期値を含めると上限b-1未満
	for i := 0; i < b-1; i++ {
		ret *= a
	}
	return
}

func powMod(n, m, mod int) (ret int) {
	ret = 1
	for m > 0 {
		if m&1 == 1 {
			ret *= n
			ret %= mod
		}
		n *= n
		n %= mod
		m >>= 1
	}
	return ret
}


Measured memory_bytes: 1760
package main

import "fmt"

func main(){
	var a, b int
	fmt.Scan(&a, &b)

	if 0 < a && 0 < b{
		fmt.Println("Positive")
	} else if b < 0{
		if (b - a + 1) % 2 == 0{
			fmt.Println("Positive")
		} else if (b - a + 1) % 2 == 1{
			fmt.Println("Negative")
		}
	} else if a <= 0 && 0 <= b {
		fmt.Println("Zero")
	}
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
const long long MOD = 1e9 + 7;
const int MAX = 1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    int t = 0;
    cin >> S;
    rep(i, S.length() / 2) {
        if(S[i] != S.at(S.length() - 1 - i)) t++;
    }
    cout << t << endl;
}


Measured memory_bytes: 256
def sumKeta(x)
    res=0
    x.to_s.split('').each{|i|res+=i.to_i}
    res
end
n,a,b = gets.split.map(&:to_i)
r=(a..b)
ans = 0
(1..n).each{|i|ans+=i if r.include?(sumKeta(i))}
puts ans

Measured memory_bytes: 14324
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define all(a) (a).begin(), (a).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int MOD = 1e9+7;
const ll LINF = 1e18;
const int INF = 1e9;
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
vi dp(100100,INF);

int main()
{
    cin >> N;
    int cnt = 0;
    dp[0] = 0;
    while (dp[N] == INF)
    {
        cnt++;
        int six = 1;
        int nine = 1;
        int one = 1;
        for (int i = 100000; i >=0; --i) dp[i+one] = min(dp[i+one],dp[i]+1);
        
        for (int i = 0; i < 7; i++)
        {
            six *= 6;
            nine *= 9;
            for (int i = 100000; i >=0; --i)
            {
                if((i+six) <= 100000)dp[i+six] = min(dp[i+six],dp[i]+1);
                if((i+nine) <= 100000)dp[i+nine] = min(dp[i+nine],dp[i]+1);
            }
            

        }
        
    }
    cout << dp[N];
    
    
    return 0;
}

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

long long L(int i){
  if(i==0){
    return 2;
  }else if(i==1){
    return 1;
  }else if(i==30){
    return 1860498;
  }else if(i==31){
    return 3010349;
  }else if(i==40){
    return 228826127;
  }else if(i==41){
    return 370248451;
  }else if(i==70){
    return 425730551631123;
  }else if(i==71){
    return 688846502588399;
  }else{
    return L(i-1)+L(i-2);
  }
}

int main(){
  int N;
  cin >> N;
  cout << L(N) << endl;
}

Measured memory_bytes: 256
// refer: https://atcoder.jp/contests/kupc2016/submissions/12157920
// changed: line 65
#include<iostream>
using namespace std;
//Ford-Fulkerson O(FE)
#include<algorithm>
#include<utility>
#include<vector>
#include<limits>
template<typename T>
struct MF{
	struct edge{
		int to,rev;
		T cap;
	};
	vector<vector<edge> >G;
	vector<int>used;
	MF(int n_=0):G(n_),used(n_,0){}
	void add_edge(int from,int to,T cap)
	{
		G[from].push_back({to,(int)G[to].size(),cap});
		G[to].push_back({from,(int)G[from].size()-1,0});
	}
	T dfs(int u,int t,T f,int dfstime)
	{
		if(u==t)return f;
		used[u]=dfstime;
		for(edge&e:G[u])
		{
			if(used[e.to]<dfstime&&e.cap>0)
			{
				T d=dfs(e.to,t,min(f,e.cap),dfstime);
				if(d>0)
				{
					e.cap-=d;
					G[e.to][e.rev].cap+=d;
					return d;
				}
			}
		}
		return 0;
	}
	T max_flow(int s,int t)
	{
		T ret=0;
		for(int dfstime=1;;dfstime++)
		{
			T f=dfs(s,t,numeric_limits<T>::max(),dfstime);
			if(f>0)ret+=f;
			else break;
		}
		return ret;
	}
};
int H,W;
string s[100];
int d[4]={1,0,-1,0};
main()
{
	cin>>H>>W;
	for(int i=0;i<H;i++)cin>>s[i];
	MF<long>P(H*W*2+2);
	int st=H*W*2,go=H*W*2+1;
	for(int i=0;i<H;i++)for(int j=0;j<W;j++)
	{
		int id=i*W+j;
		// if(i==0||j==0||i==H-1||j==W-1)P.add_edge(st,id*2,1e9);
		// if(s[i][j]=='X')P.add_edge(id*2,go,1e9);
    if(i==0||j==0||i==H-1||j==W-1)P.add_edge(id*2+1,go,1e9);
		if(s[i][j]=='X')P.add_edge(st,id*2+1,1e9);
		P.add_edge(id*2,id*2+1,1);
		for(int r=0;r<4;r++)
		{
			int x=i+d[r],y=j+d[r^1];
			if(x<0||y<0||x>=H||y>=W)continue;
			P.add_edge(id*2+1,2*(x*W+y),1);
		}
	}
	long ans=P.max_flow(st,go);
	if(ans<1e9)cout<<ans<<endl;
	else cout<<-1<<endl;
}


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

int main(){
  int h,n;
  cin >> h >> n;
  vi a(n);
  rep(i,n) cin >> a[i];
  ll sum = 0;
  rep(i,n) sum += a[i];
  if(sum >= h) cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

long max(long a,long b){
  if(a > b) return a;
  else return b;
}

int check(long a,long b){
  if(a > b) return 1;
  else if(a < b) return -1;
  else return 0;
}

int main(){
  long n,k;
  scanf("%ld %ld",&n,&k);
  long a[100000];
  for(int i=0;i<n;i++){
    scanf("%ld",&a[i]);
  }
  
  if(k == 0){
    long ans = 0;
    for(int i=0;i<n;i++){
      ans += a[i];
    }
    printf("%ld\n",ans);
    return 0;
  }
  
  long two[41];
  two[0] = 1;
  for(int i=1;i<41;i++){
    two[i] = 2*two[i-1];
  }
  
  long ktwo[40];
  for(int i=0;i<40;i++){
    ktwo[i] = (k % two[i+1]) / two[i];
  }
  
  long total = 0;
  long dp[40][3] = {};
  long tmp;
  
  for(int i=39;i>=0;i--){
    for(int j=0;j<n;j++){
      tmp = (a[j] % two[i+1]) / two[i];
      dp[i][0] += (tmp ^ 0)*two[i];
      dp[i][1] += (tmp ^ 1)*two[i];
    }
    dp[i][2] = max(dp[i][0],dp[i][1]);
  }
  
  long dps[40] ={};
  int memo;
  for(int i=0;i<40;i++){
    if(ktwo[i] == 1){
      memo = i;
      dps[i] += dp[i][0];
      for(int j=i-1;j>=0;j--){
        dps[i] += dp[j][2];
      }
    }
  }
  long maxi = dps[memo];
  long x;
  for(int i=38;i>=0;i--){
    x = 0;
    if(ktwo[i] == 1){
      for(int j=39;j>i;j--){
        x += dp[j][ktwo[j]];
      }
      x += dps[i];
      maxi = max(maxi,x);
    }
  }
  long fire = 0;
  for(int i=39;i>=0;i--){
    fire += dp[i][ktwo[i]];
  }
  total = max(maxi,fire);
  printf("%ld",total);
  return 0;
}

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

int main() {
    string s, t;
    int nr = 0;
    cin >> s >> t;
    for(int i = 0; i < 3; i++) {
        if(s[i] == t[i]) {
            nr++;
        }
    }
    cout << nr;
    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <cstdio>
#include <deque>
#include <algorithm>
using namespace std;

int H, W;
char board[25][25];
int dist[410][410];
int dp[1 << 11][11];
const int INF = 1 << 20;

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

int get_idx(int x, int y) {
    return x*W + y;
}

int main() {
    while(cin >> W >> H, W || H) {
        deque<int> stains;
        for(int i=0; i<H; i++) {
            for(int j=0; j<W; j++) {
                scanf(" %c", &board[i][j]);

                if(board[i][j] == 'o') {
                    stains.push_front(get_idx(i, j));
                }
                if(board[i][j] == '*') {
                    stains.push_back(get_idx(i, j));
                }
            }
        }

        fill(dist[0], dist[410], INF);
        for(int i=0; i<H; i++) {
            for(int j=0; j<W; j++) {
                for(int k=0; k<4; k++) {
                    int nx = i + dx[k], ny = j + dy[k];
                    if(nx < 0 || nx >= H || ny < 0 || ny >= W) continue;
                    if(board[i][j] == 'x') continue;
                    if(board[nx][ny] == 'x') continue;

                    int u = get_idx(i, j), v = get_idx(nx, ny);
                    dist[u][v] = 1;
                }
            }
        }

        int N = H*W;
        for(int k=0; k<N; k++) {
            for(int i=0; i<N; i++) {
                for(int j=0; j<N; j++) {
                    dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
                }
            }
        }

        int M = stains.size();
        fill(dp[0], dp[1 << 11], INF);
        dp[1][0] = 0;

        for(int bit=0; bit<(1<<M); bit++) {
            for(int i=0; i<M; i++) {
                if(!(bit >> i & 1)) continue;
                for(int k=0; k<M; k++) {
                    if(bit >> k & 1) continue;

                    int nbit = bit | (1 << k);
                    int u = stains[i], v = stains[k];
                    int cost = dist[u][v];

                    dp[nbit][k] = min(dp[nbit][k], dp[bit][i] + cost);
                }
            }
        }

        int ans = INF;
        for(int i=0; i<M; i++) {
            ans = min(ans, dp[(1<<M) - 1][i]);
        }

        if(ans == INF) {
            cout << -1 << endl;
        }
        else {
            cout << ans << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3956
n=int(input())
s=list(input())
i=0
j=n-1
ans=0
while i<j:
    while s[i]!="W" and i<j:
        i+=1
    while s[j]!="R" and i<j:
        j-=1
    if i<j:
        ans+=1
        i+=1
        j-=1
print(ans)

Measured memory_bytes: 10684
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define dcml(n) fixed<<setprecision(n)
using namespace std;

int main(){
    ll R;cin>>R;
    cout<<dcml(5)<<2.0*PI*R<<"\n";
}


Measured memory_bytes: 3792
n = int(input())
pf={}
for m in range(1,n+1):
    for i in range(2,int(m**0.5)+1):
        while m%i==0:
            pf[i]=pf.get(i,0)+1
            m//=i
    if m>1:
        pf[m]=pf.get(m,0)+1
ans = 0
for k , v in pf.items():
    if v >= 74:
        ans += 1
    if v >= 24:
        for s , t in pf.items():
            if s != k and t >= 2:
                ans += 1
    if v >= 14:
        for s , t in pf.items():
            if s != k and t >= 4:
                ans += 1
    if v >= 4:
        for s , t in pf.items():
            if s > k and t >= 4:
                for f , g in pf.items():
                    if f != s and f != k and g >= 2:
                        ans += 1
print(ans)

Measured memory_bytes: 9428
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>

#define ABS(x) ( (x)>0 ? x : -(x) )
#define MIN(x,y) ( (x) < (y) ? (x) : (y) )
#define MAX(x,y) ( (x) > (y) ? (x) : (y) )

#define INF 1000000000

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

	t = *x;
	*x = *y;
	*y = t;
}

int binary_search(int p[], int n, int key)
{
	int left, right, middle;

	left = 0;
	right = n-1;


	while (left <= right)
	{
		middle = (left + right) / 2;

		if (p[middle] == key)
			return middle;
		else if (p[middle] > key)
		{
			right = middle - 1;
		}
		else if (p[middle] < key)
		{
			left = middle + 1;
		}
	}

	return -1;

}

void bubble_sort(int p[], int n)
{
	int i, j;

	for (i = 0; i < n-1; i++)
	{
		for (j = 0; j < n - i - 1; j++)
		{
			if (p[j] > p[j + 1])
				swap(&p[i], &p[i + 1]);
		}
	}
}

int main()
{
	int H[10000], W[10000];
	int i, j,k,count = 0;

	for (i = 0;; i++)
	{
		scanf("%d%d", &H[i], &W[i]);

		if (H[i] == 0 && W[i] == 0)
			break;

		count++;
	}

	for (i = 0; i < count; i++)
	{
		for (j = 0; j < H[i]; j++)
		{
			for (k = 0; k < W[i]; k++)
				printf("#");

			printf("\n");
		}
		printf("\n");
	}
}


Measured memory_bytes: 2128
// atcoder/abc066/A/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

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

  int a, b, c;
  while (cin >> a >> b >> c) {
    cout << a + b + c - max({a, b, c}) << endl;
  }

  return 0;
}


Measured memory_bytes: 256
use proconio::input;
use proconio::marker::Usize1;
use std::collections::BTreeSet;

fn main() {
    input! {
        n: usize,
        m: usize,
        edges: [(Usize1, Usize1); m], // グラフのエッジを読み込む. Usize1 は 1-origin to 0-origin変換を行う
    }

    let graph = {
        let mut graph = vec![Vec::new(); n];
        for &(u, v) in &edges {
            graph[u].push(v);
            graph[v].push(u)
        }
        graph
    };

    let mut arrived = vec![false; n];

    let mut vec = Vec::new();
    for i in 0..n {
        if !arrived[i] {
            let mut stack = Vec::new();
            stack.push(i);
            let mut set = BTreeSet::new();
            while let Some(j) = stack.pop() {
                arrived[j] = true;
                set.insert(j);
                for &k in graph[j].iter().filter(|&&k| !arrived[k]) {
                    stack.push(k);
                }
            }
            vec.push(set);
        }
    }

    println!("{}", vec.iter().map(|x| x.len()).max().unwrap())
}


Measured memory_bytes: 33536
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define st first
#define nd second
#define turbo ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define vi vector<ll>
#define vvi vector<vector<ll> >
#define qi queue<int>
#define ld long double

using namespace std;

/*---------------------------------------------------------///CODE///---------------------------------------------------------*/

vvi graph(51, vi(51));
const int MOD = 1e9 + 7;

vvi multiply(vvi a, vvi b)
{
    vvi ans(51, vi(51));

    for(int i = 0; i < 50; i++)
        for(int j = 0; j < 50; j++)
        {
            ans[i][j] = 0;

            for(int k = 0; k < 50; k++)
                (ans[i][j] += (a[i][k] * b[k][j]) % MOD) %= MOD;
        }
    return ans;
}

vvi fast(vvi a, ll b)
{
    if(b == 1) return a;
    if(b % 2 == 0) return fast(multiply(a, a), b / 2);
    return multiply(a, fast(a, b - 1));
}
int main()
{
    turbo

    int n; cin >> n;
    ll k; cin >> k;

    for(int i = 0; i < n; i++)
        for(int j = 0; j < n; j++)
            cin >> graph[i][j];

    auto x = fast(graph, k);

    ll ans = 0;

    for(int i = 0; i < n; i++)
        for(int j = 0; j < n; j++)
            (ans += x[i][j]) %= MOD;

    return cout << ans, 0;
}

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

const int mod = 1000000007;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  bool ok = true;
  rep(i, n) {
    cin >> a[i];
    if (a[i] % 2 == 0) {
      if (a[i] % 3 != 0 && a[i] % 5 != 0) {
        ok = false;
      }
    }
  }
  if (ok) {
    cout << "APPROVED" << endl;
  } else {
    cout << "DENIED" << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void)
{
        int n,i;
        char s[100];

        scanf("%s",s);
        n=strlen(s);

        if(n%2==0) return 1;

        for(i=0;i<n/2;i++){
                if(s[i]!=s[n-i-1]){
                       printf("No\n");
                       return 0;
                }
                else if(s[i]!=s[n/2+i+1]){
                        printf("No\n");
                        return 0;
                }
        }
        printf("Yes\n");
        return 0;
}


Measured memory_bytes: 128
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

fun main() {
    val s = readString()
    val t = readString()
    if (s.length+1 == t.length && s == t.substring(0 until t.length-1)) {
        println("Yes")
    } else {
        println("No")
    }
}


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

int memo[32][16][256];
int N, K, S;
vector<int> data;
map<vector<int>, bool> m;

int rec(int p, int k, int s){
	if(s < 0)
		return 0;
	if(k >= K){
		if(s == 0){
			return 1;
		}
		else{
			return 0;
		}
	}
	if(memo[p][k][s] != -1)
		return memo[p][k][s];
	
	int res = 0;
	for(int i = p - 1; i > 0; --i){
		res += rec(i, k + 1, s - i);
	}
	return memo[p][k][s] = res;
}

int main() {
	while(cin >> N >> K >> S && (N || K || S)){
		data.clear();
		memset(memo, -1, sizeof(memo));
		cout << rec(N + 1, 0, S) << endl;
	}
	return 0;
}

Measured memory_bytes: 1680
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main(){
	string s;
	cin >> s;
	if(s[2] == s[3] && s[4] == s[5])cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 
 using namespace std;
  
 int main()
 {
   string ss,kk;
   cin>>ss;
   for(int i=0;i<ss.length();i++)
   {
     if(ss[i]>='D'&&ss[i]<='Z') kk+=(ss[i]-3);
     else kk+=(ss[i]+23);        
   }
   cout<<kk<<endl;
   //while(1);      
   return 0;    
 }

 
 

Measured memory_bytes: 3184
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

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

        try {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            String inputString = br.readLine();

            String isPalindromicNumber = "No";
            if (inputString.charAt(0) == inputString.charAt(2)) {
                isPalindromicNumber = "Yes";
            }

            System.out.println(isPalindromicNumber);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
}

Measured memory_bytes: 23124
#include<stdio.h>
int main()
{
int a,i,b;
  b=0;
scanf("%d",&a);
  int num[a];
scanf("%d %d",&num[0],&num[1]);
  
  for(i=2;i<a;++i)
  {
  scanf("%d",&num[i]);
  if(num[i-2] < num[i-1] && num[i-1] < num[i]) b++;
  else if(num[i-2] > num[i-1] && num[i-1] > num[i]) b++;
  }

printf("%d",b);

return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
using namespace std;
int main() {
    int n;
    cin >> n;
    cout << n << ':';
    for (int i = 2; i <= sqrt(n); i++) {
        while (n % i == 0) {
            cout << ' ' << i;
            n /= i;
        }
    }
    if (n > 1) {
        cout << ' ' << n;
    }
    cout << '\n';
    return 0;
}



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

int main(){
    int N; cin >> N;
    vector<int> cnt(100010, 0); // cnt.at(i)はXとしてa_iを選んだときにいくらかの操作を経た後にXと等しくなる項の数
    for (int i = 0; i < N; i++) {
        int a; cin >> a;
        cnt.at(a+1)++;
        cnt.at(a)++;
        cnt.at(a+2)++;
    }
    sort(cnt.begin(), cnt.end());
    reverse(cnt.begin(), cnt.end());
    cout << cnt.at(0) << endl;
    return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const int N = 1e5 + 7, M = 1e7, OO = 0x3f3f3f3f;
#define AC ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin.sync_with_stdio(0);
LL freq[100005];
int main()
{
LL i,n,sum=0,k;
scanf("%lld %lld",&n,&k);
while(n--){
    LL num,freqs;
    scanf("%lld %lld",&num,&freqs);
    freq[num]+=freqs;
}
for(i=1;i<=100005;++i){
    sum+=freq[i];
    if(sum>=k){
        printf("%lld",i);
        return 0;
    }
}



    return 0;
}


Measured memory_bytes: 4568
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <numeric>
#include <climits>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, k, n) for(int i = (k); i < (int)(n); i++)
using namespace std;
using ll = long long;
int cnt = 0;
int main(){
    map<string, int> mp;
    int N;
    cin >> N;
    string S[N];
    rep(i, N){
        cin >> S[i];
        mp[S[i]]++;
    }
    int M;
    cin >> M;
    rep(i, M){
        string T;
        cin >> T;
        mp[T]--;
    }
    int ans = 0;
    rep(i, N) ans = max(ans, mp[S[i]]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <array>
#include <algorithm>
#include <queue>
#include <map>
using namespace std;
const int  INF=10e7;

typedef  pair<int,int> P;


int main(){
     int a,b,c;
     cin>>a>>b>>c;
     if(a==b+c||b==a+c||c==a+b){
          cout<<"Yes"<<endl;

     }else cout<<"No"<<endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var sps = new Tuple<string, int, int>[n];
        for (int i = 0; i < sps.Length; i++)
        {
            var sp = Console.ReadLine().Split().ToArray();
            sps[i] = Tuple.Create(sp[0], -int.Parse(sp[1]), i + 1);
        }

        Array.Sort(sps);

        for (int i = 0; i < sps.Length; i++)
        {
            Console.WriteLine(sps[i].Item3);
        }
    }
}


Measured memory_bytes: 13536
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		int s=0;
		String ns=n+"";
		for(int i=0; i<ns.length(); i++) {
			s+=ns.charAt(i)-'0';
		}
		System.out.println((n%s==0?"Yes":"No"));
	}
}

Measured memory_bytes: 21716
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define MOD 1000000007
#define enld endl
typedef long long ll;
using namespace std;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int N; cin >> N;
    if(N % 1000 == 0) cout << 0 << enld;
    else cout << 1000 - N%1000 << enld;
    return 0;
}

Measured memory_bytes: 3624
N, K = map(int, input().split())
R, S, P = map(int, input().split())
t = list(input())

score = [0 for _ in range(N)]
for i in range(N):
    if i >= K and t[i-K] == t[i] and score[i-K] != 0:
        continue
    if t[i] == 'r':
        score[i] += P
    elif t[i] == 's':
        score[i] += R
    else:
        score[i] += S

print(sum(score))

Measured memory_bytes: 7848
var toInt = x=>parseInt(x,10);
var toIntArr = arr=>arr.map(x=>toInt(x));
var abs = x=>x>0?x:-x;
function min(){var rest = arguments,val=rest[0];for(var i=1;i<rest.length;i++)if(rest[i]<val)val = rest[i];return val}
function max(){var rest = arguments,val=rest[0];for(var i=1;i<rest.length;i++)if(rest[i]>val)val = rest[i];return val}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
 
function Main(input){
	var input = input.split('\n');
	var temp1 = input[0].split(' ');
	var n = toInt(temp1[0]);
	var m = toInt(temp1[1]);
	var abs = [];
	for(var i = 0; i < m; i++){
		c = toIntArr(input[i+1].split(' '));
		a = c[0];
		b = c[1];
		abs[i] = [a,b];
	}
	abs.sort(function(a,b){
		if(a[0]!==b[0]){
			return a[0] - b[0];
		}else{
			return a[1] - b[1];
		}
	})
	var l=1;r=n;
	var ab;
	var ans = 1;
	for(var i = 0; i < m; i++){
		ab = abs[i];
		if(ab[1]<=l || r<=ab[0]){
			ans++;
			l = ab[0];
			r = ab[1];
		}else{
			l = max(l,ab[0]);
			r = min(r,ab[1]);
		}
	}
	console.log(ans);
}

Measured memory_bytes: 49992
n = int(input())

s1 = input()
s2 = input()
s3 = input()

sum = 0
for i in range(n):
	if(s1[i] == s2[i] and s2[i] == s3[i]):
		sum += 0
	elif (s1[i] == s2[i]):
		sum += 1
	elif (s2[i] == s3[i]):
		sum += 1
	elif (s1[i] == s3[i]):
		sum += 1
	else:
		sum += 2


print ("{0:d}".format(sum) )


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

string s;
map<char, bool> f;
bool res = true;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> s;
	for(char c: s) f[c] = true;
	if((f.count('N')+f.count('S') == 1) || (f.count('E')+f.count('W') == 1)) cout << "No";
	else cout << "Yes";
}


Measured memory_bytes: 256
n=int(input())

dp = [0] * 70000

for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            idx_tmp = x*x + y*y + z*z + x*y + y*z + z*x
            dp[idx_tmp] += 1 

for i in range(1, n+1):
    print(dp[i])

Measured memory_bytes: 9712
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.next();
		int r = 1;
		char[] str = sc.next().toCharArray();
		sc.close();
		for (int i = 0; i < str.length - 1; i++) {
			if(str[i] != str[i + 1]) ++r;
		}
		System.out.println(r);
	}
}

Measured memory_bytes: 29700
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    int ans = b / a;
    chmin(ans, c);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.io.*;
public  class Main
{
	public static void main (String[] args)
	{
			Scanner sc = new Scanner(System.in);
			String str = sc.next();
			if((str.charAt(2) == str.charAt(3)) && (str.charAt(4) == str.charAt(5)))
			{
				System.out.println("Yes");
			}
			else
			{
				System.out.println("No");
			}
	}
}


Measured memory_bytes: 22868
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod = 1e9 + 7;

ll cnt(ll n) {
	ll res = 0;
	while (n) {
		res++;
		n /= 10;
	}
	return res;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//freopen("INP.txt", "r", stdin);
	//freopen("OUT.txt", "w", stdout);
	ll n;
	cin >> n;
	ll res = 0;
	for (ll i = 1; i <= n; i++) {
		if (cnt(i) % 2 != 0) {
			res++;
		}
	}
	cout << res << '\n';
	return 0;
}

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

using namespace std;
typedef long long ll;
ll arr[100001];

int main()
{
   ll x1,x2,x3,x4,x5;
   cin>>x1>>x2>>x3>>x4>>x5;
   if(x1==0)
    cout<<1;
   if(x2==0)
    cout<<2;
    if(x3==0)
    cout<<3;
    if(x4==0)
    cout<<4;
    if(x5==0)
    cout<<5;
    cout<<endl;
}





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

long long MOD=998244353LL;

int main(){
	int N;
	long long ans;
	cin >> N;
	vector<int> D(N);
	for(auto &i:D)cin >> i;
	
	if(D[0]>0)ans=0;
	else{
		vector<int> C(N);
		for(int i=1;i<N;i++)C[D[i]]++;
		if(C[0]>0)ans=0;
		else{
			ans=1;
			for(int i=2;i<N;i++){
				for(int j=0;j<C[i];j++){
					ans*=C[i-1];
					if(ans>=MOD)ans%=MOD;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vdouble vector<double>
#define vll vector<ll>:
#define vbool vector<bool>
#define INF 1101010101010101010
#define MOD 1000000007
#define int long long
using P = pair<int,int>;

signed main(){
  int h,w;
  cin >> h >> w;
  vstring S(h);
  rep(i,h) cin >> S[i];
  vvint judge(h,vint(w,-1));
  int count = 0;
  rep(i,h) rep(j,w){
    if(S[i][j] == '.') count++;
  }
  queue<P> que;
  judge[0][0] = 0;
  que.push(make_pair(0,0));
  vint dx = {-1,0,0,1};
  vint dy = {0,-1,1,0};
  while(que.size() > 0){
    P use = que.front();
    int ox = use.first;
    int oy = use.second;
    //cout << "ox" << ox << "oy" << oy << endl;
    rep(s,4){
      int nx = ox + dx[s];
      int ny = oy + dy[s];
      if(0 <= nx && nx < h && 0 <= ny && ny < w){
        if(S[nx][ny] == '.' && judge[nx][ny] == -1){
          judge[nx][ny] = judge[ox][oy] + 1;
          //cout << "nx" << nx << "ny" << ny << " " << judge[nx][ny] << endl;
          que.push(make_pair(nx,ny));
        }
      }
    }
    que.pop();
  }
  if(judge[h-1][w-1] == -1) cout << -1 << endl;
  else cout << count - 1 - judge[h-1][w-1] << endl;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <tuple>
#include <unordered_map>
#include <boost/functional/hash.hpp>


int main(){
  long long H,W,N;
  std::cin >> H >> W >> N;

  std::unordered_map<std::tuple<int,int>, int, boost::hash<std::tuple<int,int>>> count_map;
  for(int i = 0; i < N; i++){
    long long x,y;
    std::cin >> x >> y;
    x--; y--;
    for(int j = std::max(2LL, x); j < std::min(H, x+3); j++){
      for(int k = std::max(2LL, y); k < std::min(W, y+3); k++){
        count_map[std::make_tuple(j, k)] += 1;
      }
    }
  }

  long long ans[10] = {};
  ans[0] = (H-2)*(W-2);
  for(auto&& it: count_map){
    ans[it.second] += 1;
    ans[0] -= 1;
  }

  for(int i = 0; i < 10; i++) std::cout << ans[i] << std::endl;

  return 0;
}



Measured memory_bytes: 50704
#include <bits/stdc++.h>
using namespace std;
int main ()
{
int n;
cin>>n;
int t=0;
int shang,yushu;
shang=n;
while(shang!=0)
{
yushu=shang%10;
if(yushu==1)
t++;
shang=shang/10;
}


cout<<t<<endl;
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define P pair<int,int>
#define vp vector<P>
#define PP pair<int,P>
#define vpp vector<PP>
#define fi first
#define se second
#define INF 1e9
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(x) (x).begin(),(x).end()
class Combination{
private:
    vi fact;
public:
    Combination(int size){
        size++;
        fact.resize(size);
        fact[0]=1;
        FOR(i,1,size){
            fact[i]=(fact[i-1]*i)%MOD;
        }
    }
    int Fact(int n){
        return fact[n];
    }
    int MPow(int x,int y){
        if(y==0)return 1;
        if(y%2){
            return (MPow(x,y-1)*x)%MOD;
        }
        int p=MPow(x,y/2);
        return (p*p)%MOD;
    }
    int Comb(int n,int r){
        if(r>n)return 0;
        int res=Fact(n);
        (res*=MPow(Fact(r),MOD-2))%=MOD;
        (res*=MPow(Fact(n-r),MOD-2))%=MOD;
        return res;
    }
};
signed main(){
    int n;
    cin>>n;
    Combination C(n+1);
    map<int,int> ma;
    int p;
    REP(i,n+1){
        int t;
        cin>>t;
        if(ma.find(t)!=ma.end()){
            p=i-ma[t]+1;
        }else{
            ma[t]=i;
        }
    }
    FOR(i,1,n+2){
        cout<<(C.Comb(n+1,i)-C.Comb(n+1-p,i-1)+MOD)%MOD<<endl;
    }
    return 0;
}

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


int main()
{
    int N, K;
    cin >> N >> K;
    vector<int> l(N);
    for (int i=0; i<N; i++) cin >> l.at(i);
    sort(l.begin(), l.end(), greater<int>());
    int sum = 0;

    for (int i=0; i<K; i++) {
        sum += l.at(i);
    }
    cout << sum << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		String T = sc.nextLine();
		boolean can = false;

		for(int i = 0;i < S.length();i++) {
			S = S + S.charAt(0);
			S = S.substring(1);
				if(S.equals(T)) {
					can = true;
					break;
				}
		}
		if(can == true) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 21844