akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b; a--; b--;
    cout << 100 << ' ' << 100 << '\n';
    for (int i = 0; i < 50; i++) {
        for (int j = 0; j < 100; j++) {
            if (i % 2 && j % 2) {
                if (a) cout << '.', a--;
                else cout << '#';
            } else cout << '#';
        }
        cout << '\n';
    }
    for (int i = 0; i < 50; i++) {
        for (int j = 0; j < 100; j++) {
            if (i % 2 && j % 2) {
                if (b) cout << '#', b--;
                else cout << '.';
            } else cout << '.';
        }
        cout << '\n';
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;



int main(void){
    int n,d;
    cin >> n >> d;
    int ans=0;
    REP(i,n){
        double x,y;
        cin >> x >> y;
        if(sqrt(x*x+y*y)<=d)
            ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3836
#include<stdio.h>
#include<vector>
#include<iostream>
#include<queue>
#include<algorithm>
#include<list>
using namespace std;
vector < int > G[1000000];
list < int > out;
bool v[1000000];
int n;
int indeg[1000000];
void bfs(int u){
	queue < int > Q;
	Q.push(u);
	v[u]=1;
	while(!Q.empty()){
		int k=Q.front();
		Q.pop();
		out.push_back(k);
		v[k]=1;
		for(int i=0;i<G[k].size();i++){
			int p=G[k][i];
			indeg[p]--;
			if(indeg[p]==0&&!v[p]) Q.push(p);
		}
	}
}
void f(){
	for(int i=0;i<n;i++){
		for(int j=0;j<G[i].size();j++){
			int v=G[i][j];
			indeg[v]++;
		}
	}
	for(int i=0;i<n;i++){
		if(!v[i]&&indeg[i]==0) bfs(i);
	}
	for(list<int >::iterator it=out.begin();it!=out.end();it++){
		printf("%d\n",*it);
	}
	
}
int main(){
	int s,t,m;
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		scanf("%d%d",&s,&t);
		G[s].push_back(t);
	}
	f();
	return 0;
}


Measured memory_bytes: 27428
#include <stdio.h>

int main(void)
{
	int matrix[100][100], i, j, input, n, m, matrix1[100], sum = 0;
	scanf("%d %d", &n, &m);
	for (i = 0; i < n; i++){
		for (j = 0; j < m; j++){
			scanf("%d", &matrix[i][j]);
		}
	}
	for (i = 0; i < m; i++){
		scanf("%d", &matrix1[i]);
	}
	for (i = 0; i < n; i++){
		sum = 0;
		for (j = 0; j < m; j++){
			sum += matrix[i][j] * matrix1[j];
		}
		printf("%d\n", sum);
	}
	return 0;
}


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

dic = {chr(97 + i): 50 for i in range(26)}

for _ in range(n):
    s = list(map(str, input()))
    for key in dic:
        dic[key] = min(dic[key], s.count(key))


res = ""
for key in dic:
    if dic[key] != 0:
        res += key * dic[key]

print(res)

Measured memory_bytes: 9072
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

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

    int count = 0;
    int k = 1;

    while (k < b) {
        k = k - 1 + a;
        ++count;
    }

    cout << count << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl
#define MAXSIZE 200005

int onezero[MAXSIZE];
vector<vector<int>> graph;
int ans[MAXSIZE];

void dfs(int depth, int now){
    if(depth%2 == 0){
        onezero[now] = 0;
    }else{
        onezero[now] = 1;
    }
    for(int i = 0; i < graph[now].size(); i++){
        int next = graph[now][i];
        if(onezero[next] == -1){
            dfs(depth + 1, next);
        }
    }
    return;
}

int main(){

    int n;
    cin >> n;
    for(int i = 0; i < MAXSIZE; i++){
        onezero[i] = -1;
    }

    graph.resize(n);
    for(int i = 0; i < n-1; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    dfs(0, 0);
    int zerocnt = 0;
    int onecnt = 0;
    for(int i = 0; i < n; i++){
        if(onezero[i]==0){zerocnt++;}
    }
    onecnt = n - zerocnt;
    if(zerocnt <= n/3){
        int nextval = 3;
        for(int i = 0; i < n; i++){
            if(onezero[i] == 0){
                ans[i] = nextval;
                nextval += 3;
            }
        }
        int nextval2 = 1;
        for(int i = 0; i < n; i++){
            if(onezero[i] == 1){
                ans[i] = nextval2;
                nextval2++;
                if(nextval2 < nextval && nextval2%3 == 0){
                    nextval2++;
                }
            }
        }
    }else if(onecnt <= n/3){
        int nextval = 3;
        for(int i = 0; i < n; i++){
            if(onezero[i] == 1){
                ans[i] = nextval;
                nextval += 3;
            }
        }
        int nextval2 = 1;
        for(int i = 0; i < n; i++){
            if(onezero[i] == 0){
                ans[i] = nextval2;
                nextval2++;
                if(nextval2 < nextval && nextval2%3 == 0){
                    nextval2++;
                }
            }
        }
    }else{
        int nextval = 1;
        for(int i = 0; i < n; i++){
            if(onezero[i] == 1){
                ans[i] = nextval;
                nextval += 3;
                if(nextval > n){
                    nextval = 3;
                }
            }
        }
        int nextval2 = 2;
        for(int i = 0; i < n; i++){
            if(onezero[i] == 0){
                ans[i] = nextval2;
                nextval2 += 3;
                if(nextval2 > n){
                    nextval2 = nextval;
                }
            }
        }
    }

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

}


Measured memory_bytes: 15744
#include <iostream>
#include <algorithm>
#include <stack>
using namespace std;
 
int m, n, sum, ans = 0;
bool ice[90][90], reached[90][90];
 
void solve(int x, int y){
    if(x < 0 || x >= m || y < 0 || y >= n){
        return;
    }
     
    if(ice[x][y] == 0 || reached[x][y] == 1){
        return;
    }
     
    sum++;
    reached[x][y] = 1;
    ans = max(ans, sum);
 
    solve(x + 1, y);
    solve(x - 1, y);
    solve(x, y + 1);
    solve(x, y - 1);
    
    sum--;
    reached[x][y] = 0;
    return;
}
 
int main() {
    while(true){
        cin >> m >> n;
        if(m == 0 && n == 0){
            break;
        }
 
        for(int i = 0; i < m; i++){
            for(int j = 0; j < n; j++){
                cin >> ice[i][j];
            }
        }
 
       for(int i = 0; i < m; i++){
            for(int j = 0; j < n; j++){
                if(ice[i][j]){
                    sum = 0;
                    solve(i, j);
                    reached[i][j] = 0;
                }
            }
        }
 
        cout << ans << endl;
        ans = 0;
    }
    return 0;
}

Measured memory_bytes: 1176
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

class A {
    static StreamWriter Out = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
    static void Main(string[] args) {
        string s;
        Input(out s);
        switch(s) {
        case "AAA":
        case "BBB":
            Print("No");
            break;
        default:
            Print("Yes");
            break;
        }
        Out.Flush();
    }
    static T ChangeT<T>(string s) => (T)Convert.ChangeType(s, typeof(T));
    static void Input<A>(out A a) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
    }
    static void Input<A, B>(out A a, out B b) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
    }
    static void Input<A, B, C>(out A a, out B b, out C c) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
    }
    static void Input<A, B, C, D>(out A a, out B b, out C c, out D d) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
    }
    static void Input<A, B, C, D, E>(out A a, out B b, out C c, out D d, out E e) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
    }
    static void Input<A, B, C, D, E, F>(out A a, out B b, out C c, out D d, out E e, out F f) {
        var words = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries);
        a = ChangeT<A>(words[0]);
        b = ChangeT<B>(words[1]);
        c = ChangeT<C>(words[2]);
        d = ChangeT<D>(words[3]);
        e = ChangeT<E>(words[4]);
        f = ChangeT<F>(words[5]);
    }
    static void InputArray<T>(out T[] array) {
        array = Console.ReadLine().Split(new[] { ' ' }, options: StringSplitOptions.RemoveEmptyEntries).Select(s => ChangeT<T>(s)).ToArray();
    }
    static void Print<T>(T s) => Out.WriteLine(s);
    static void Print<T>(params T[] s) => Out.WriteLine(string.Join(" ", s));
    static void Print<T>(IEnumerable<T> e) => Out.WriteLine(string.Join(" ", e));
}

Measured memory_bytes: 13268
import java.io.*;
import java.util.*;

class FastReader 
{ 
    BufferedReader br; 
    StringTokenizer st; 
    
    public FastReader() 
    { 
        br = new BufferedReader(new InputStreamReader(System.in)); 
    } 
    
    String next() 
    { 
        while (st == null || !st.hasMoreElements()) 
        { 
            try
            { 
                st = new StringTokenizer(br.readLine()); 
            } 
            catch (IOException  e) 
            { 
                e.printStackTrace(); 
            } 
        } 
        return st.nextToken(); 
    } 
    
    int nextInt() 
    { 
        return Integer.parseInt(next()); 
    } 
    
    long nextLong() 
    { 
        return Long.parseLong(next()); 
    } 
    
    double nextDouble() 
    { 
        return Double.parseDouble(next()); 
    } 
    
    String nextLine() 
    { 
          String str = ""; 
        try
        { 
            str = br.readLine(); 
        } 
        catch (IOException e) 
        { 
            e.printStackTrace(); 
        } 
        return str; 
    } 
} 

class Solution
{
    void solve()
    {
        FastReader sc = new FastReader();
        
        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();

        System.out.println(Math.min(N*A,B));

    }
}
  
public class Main 
{ 
    public static void main(String[] args) 
    { 
        Solution ob = new Solution();

        ob.solve();
    } 
} 

Measured memory_bytes: 32800
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

typedef pair< int, int > pii;
typedef long long ll;

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1 << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(11);
	}
};
initializer _____;

int N, M, K, T, Q;
signed main() {
	cin >> N;
	if (N & 1) {
		cout << 0 << endl;
		return 0;
	}
	int five = 0, two = 0;
	int M = N, L = N;
	int tmp = 5;
	rep(i, 10000) {
		five += M / (2 * tmp);
		tmp *= 5;
		if (M / (2 * tmp) == 0)
			break;
	}
	tmp = 2;
	rep(i, 10000) {
	}

	cout << five << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() { 
	int H,R;
	cin >> H >> R;
	if (H + R > 0){
		cout << "1" << endl;
	}
	if (H + R == 0){
		cout << "0" << endl;
	}
	if (H + R < 0){
		cout << "-1" << endl;
	}

return 0; } 









Measured memory_bytes: 3088
#include<stdio.h>
int main() {
    long n;
    long a[100];
    scanf("%ld",&n);
    for (int i=0;i<n;i++) scanf("%ld",&a[i]);
    long money=1000;
    long ticket=0;
    for (int i=0;i<n;i++) {
        if (ticket>0) {
            money+=a[i]*ticket;
            ticket=0;
        }
        if (a[i+1]>a[i]&&i<n-1) {
          	ticket=money/a[i];
            money=money-a[i]*ticket;
        }
    }
    printf("%ld",money);
    return 0;
}

Measured memory_bytes: 1736
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <functional>
#include <queue>

const int MaxN = 100000;

int X, Y, A, B, C;
int P[MaxN + 5], Q[MaxN + 5], R[MaxN + 5];
long long Ans;
std::priority_queue< long long, std::vector<long long>, std::greater<long long> > Pq;

void init() {
  scanf("%d %d %d %d %d", &X, &Y, &A, &B, &C);
  for (int i = 1; i <= A; ++i) scanf("%d", &P[i]);
  for (int i = 1; i <= B; ++i) scanf("%d", &Q[i]);
  for (int i = 1; i <= C; ++i) scanf("%d", &R[i]);
}

void solve() {
  std::sort(P + 1, P + 1 + A, std::greater<int>());
  std::sort(Q + 1, Q + 1 + B, std::greater<int>());
  std::sort(R + 1, R + 1 + C, std::greater<int>());
  for (int i = 1; i <= X; ++i) {
    Ans += P[i];
    Pq.push(P[i]);
  }
  for (int i = 1; i <= Y; ++i) {
    Ans += Q[i];
    Pq.push(Q[i]);
  }
  for (int i = 1; i <= C; ++i) {
    if (Pq.top() >= R[i]) break;
    Ans -= Pq.top();
    Pq.pop();
    Ans += R[i];
    Pq.push(R[i]);
  }
  printf("%lld\n", Ans);
}

int main() {
  init();
  solve();
  return 0;
}

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

typedef long long LL;

template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar.size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}


int main(int argc, char const* argv[])
{
    int a,b,k;
    cin >> a >> b >> k;
    if (b-a+1 <= 2*k) {
        for (int i = a; i <= b; i++) {
            cout << i << endl;
        }
    }else{
        for (int i = a; i < a+k; i++) {
            cout << i << endl;
        }
        for (int i = b-k+1; i <= b; i++) {
            cout << i << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <set>
using namespace std;

int main(){
	int K,S;
	cin >>K>>S;
	
	int ans=0;
	
	for(int X=0;X<=K;X++){
		for(int Y=0;Y<=K;Y++){
			if(S-X-Y>=0 && S-X-Y<=K)ans++;
		}
	}
	cout << ans << endl;
	
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
using ll=long long;

const ll INF = 1LL << 60;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

template<typename T> bool chmin(T& a, T b) {return a > b ? a = b, true : false;}
template<typename T> bool chmax(T& a, T b) {return a < b ? a = b, true : false;}
 
int main(){
    int N, K;
    cin >> N >> K;
    ll h[100010];
    ll dp[100100];
    REP(i, N) cin >> h[i];
    REP(i, N) dp[i] = INF;
    dp[0] = 0;
    REP(i, N){
        FOR(j, 1, K+1){
            chmin(dp[i+j], dp[i]+abs(h[i]-h[i+j]));
        }
    }
    cout << dp[N-1] << endl;
    return 0;
}

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

#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)

using ll = long long;
#define INF 1e9

int N, M;
vector<vector<int>> g;
vector<int> homon;
int ans = 0;
int check(){
  REP(i, N){
    if(homon[i] == 0){
      return 0;
    }
  }
  return 1;
}

void dfs(int c, int depth){
  if(depth == N){
    ans += check();
    return;
  }
  REP(i, g[c].size()){
    int next = g[c][i];
    if(homon[next] == 0){
      homon[next] = 1;
      dfs(next, depth+1);
      homon[next] = 0;
    }
  }
  return ;
}
int main(){
  cin >> N >> M;
  g.resize(N);
  homon.resize(N, 0);

  REP(i, M){
    int a, b;
    cin >> a >> b;
    a--, b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  homon[0] = 1;
  dfs(0, 1);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
n, k, s = map(int,input().split())

if s<10**9:
    for i in range(k):
        print(s, end=" ")
    for i in range(n-k):
        print(s+1, end=" ")
else:
    if k!=n:
        for i in range(k+1):
            if i%2==0:
                print(1, end=" ")
            else:
                print(10**9-1, end=" ")
        for i in range(n-(k+1)):
            print(7777, end=" ")
    else:
        for i in range(n):
            print(10**9, end=" ")

Measured memory_bytes: 48600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
using P = pair<int,int>;
#define MOD 2019

int main()
{
  ll L,R;cin>>L>>R;
  
  ll minimum = pow(10,7);
  if (R-L>=2019)
  {
    cout<<0<<endl;
  } 
  else 
  {
    for (int i=L;i<=R-1;i++)
    {
      int im = i % MOD;
      for (int j=i+1;j<=R;j++)
      {
        ll time = im*(j%MOD) % MOD;
        minimum = min(time,minimum);
      }
    }
    cout<<minimum<<endl;
    return (0);
  }
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline bool chmax(T1& a,T2 b)
{if (a < b) {a = b; return true;} return false;}
template<typename T1,typename T2> inline bool chmin(T1& a,T2 b)
{if (a > b) {a = b; return true;} return false;}

int main(){
    string S; cin >> S;
    int N = S.length(), ans = INT_MAX;
    
    for (int i = 0; i < N; i++) {
        char c = S[i];
        int mx_len = 0, len = 0;
        
        for (int j = 0; j < N; j++) {
            if (c == S[j]) {
                chmax(mx_len, len);
                len = 0;
            } else {
                len++;
            }
        }
        chmax(mx_len, len);
        chmin(ans, mx_len);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int W,H,x,y,r;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	if((r<=x)&&(x<=W-r)&&(r<=y)&&(y<=H-r))
	{printf("Yes\n");
	}
	else{printf("No\n");
	}
	return 0;
}

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

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<int, pair<int, int>> PP;
typedef pair<P, int> PPi;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1e+9 + 7;
// constexpr int mod = 998244353;

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

    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    vector<int> S(n + 1);
    S[0] = 0;
    for(int i = 0; i < n; ++i){
        cin >> a[i];
        S[i + 1] = (S[i] + a[i]) % m;
    }
    map<int, int> mp;
    ll ans = 0;
    for(int i = 0; i <= n; ++i){
        if(mp.find(S[i]) == mp.end())   mp[S[i]] = 1;
        else    ans += mp[S[i]]++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3968
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
  	ll x;
  cin>>x;
  ll y=100,ans=0;
  while(y<x)
  {
    ans++;
    y=y+y*0.01;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3624
N = int(input())
s = 1
for i in range(1,3501):
    if s == 0:
        break
    for j in range(1,3501):
        if 4*i*j-N*(i+j) > 0 and (N*i*j)%(4*i*j-N*(i+j)) == 0:
            print(i,j,(N*i*j)//(4*i*j-N*(i+j)))
            s = 0
            break

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

typedef pair<int, int> P;

int main() {
  int D, G;
  cin >> D >> G;

  vector<P> point(D);
  for(int i=0;i<D;i++) {
    cin >> point[i].first >> point[i].second;
  }

  vector<int> p(D);
  iota(p.begin(), p.end(), 0);

  int ans = INT_MAX;
  do {
    int total = 0;
    int solved = 0;
    for(int i=0;i<D;i++) {
      int k = p[i];
      int add = 100 * (k+1) * point[k].first + point[k].second;
      if(total + add < G) {
        total += add;
        solved += point[k].first;
      }
      else if(total + add == G) {
        solved += point[k].first;
        break;
      }
      else {
        int b = (G-total)/(100 * (k + 1));
        if((G-total)%(100 * (k + 1)) != 0) b++;
        solved += min(point[k].first, b);
        break;
      }
    }

    if(solved < ans) ans = solved;
  } while(next_permutation(p.begin(), p.end()));

  cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int n,b;
	int a[100];
	scanf("%d",&n);
	for(b=0;b<n;b++){
			scanf("%d",&a[b]);
	}
	for(b=n-1;b>=0;b--){
		printf("%d",a[b]);
		if(0<b&&b<=n-1){printf(" ");}
		if(b==0){printf("\n");}
	}
	
	return 0;
}

Measured memory_bytes: 2684
/*
 * Problem Description: Depth First Search
 * Category: Graph
 * Author: Khan
 * Date: 18th October, 2017
 */

#include <stdio.h>
#include <string.h>

#define MAXN 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, M[MAXN][MAXN];
int color[MAXN], d[MAXN], f[MAXN], tt;

void dfs_visit(int u)
{
    color[u] = GRAY;
    d[u] = ++tt;
    for (int i = 0; i < n; ++i)
    {
        if(M[u][i] == 0)
            continue;
        if(color[i] == WHITE)
            dfs_visit(i);
    }
    color[u] = BLACK;
    f[u] = ++tt;
}

void dfs()
{
    for (int i = 0; i < n; ++i)
        color[i] = WHITE;
    tt = 0;
    for (int i = 0; i < n; ++i)
        if(color[i] == WHITE)
            dfs_visit(i);
    for (int i = 0; i < n; ++i)
        printf("%d %d %d\n", i + 1, d[i], f[i]);
}

int main(int argc, char const *argv[])
{
    //freopen("sample.txt", "r", stdin);
    int t;
    memset(M, 0, sizeof(M));
    scanf("%d", &n);
    for (int i = 0; i < n; ++i)
    {
        scanf("%d %d", &t, &t);
        int tmp;
        for (int j = 0; j < t; ++j)
        {
            scanf("%d", &tmp);
            M[i][tmp - 1] = 1;
        }
    }
    dfs();
    return 0;
}

Measured memory_bytes: 1820
import numpy as np

N = input()
K = int(input())

M = len(N)
dp = np.zeros((M+1, K+1, 2), int)
# dp[i,j,k] = i桁の正整数であって、0でない数をj回使っており、Nの下からi桁目までの数を越えていない(k=0)/いる(k=1) ようなものの数

dp[0,0,0] = 1

for i in range(1,M+1):

    # Nの下からi桁目
    X = int(N[-i])
    
    # i桁目が0の場合
    dp[i,:,0] += dp[i-1,:,0]
    if X>0:
        dp[i,:,0] += dp[i-1,:,1]
    else:
        dp[i,:,1] += dp[i-1,:,1]
        
    for n in range(1,10): # i桁目がn(1以上)の場合
        if n<X:
            dp[i,1:,0] += dp[i-1,:-1,0] + dp[i-1,:-1,1]
        elif X==n:
            dp[i,1:,0] += dp[i-1,:-1,0]
            dp[i,1:,1] += dp[i-1,:-1,1]
        else:
            dp[i,1:,1] += dp[i-1,:-1,0] + dp[i-1,:-1,1]

print(dp[-1, K, 0])

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

int gcd(int A, int B)
{
  for(;;)
  {
    if(A<B) swap(A, B);
    if(!B) break;
    A %= B;
  }
  return A;
}

int main()
{
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0; i<N; ++i) cin >> A[i];

  vector<int> left(N+1, 0), right(N+1, 0);
  for(int i=0; i<N; ++i) left[i+1] = gcd(left[i], A[i]);
  for(int i=N-1; i>=0; --i) right[i] = gcd(right[i+1], A[i]);

  int ans = 0;
  for(int i=0; i<N; ++i)
  {
    int l = left[i];
    int r = right[i+1];
    ans = max(ans, gcd(l, r));
  }
  cout << ans << endl;
  return 0;
}


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

int main()
{
	int n;
   cin >> n;
   vector<ll> a(n);
   for(auto &i:a)cin >> i;
   //sort(a.begin(),a.end());

   vector<ll> fac(1000001);
   ll ans = 0;
   for(auto i:a)fac[i]++;
   for(auto i:a)
   {
      fac[i]--;
      bool flg = true;
      for(ll j = 1;j*j<=i;j++)
      {
         if(i%j==0)
         {
            if(fac[j]){flg=false;break;}
            if(fac[i/j]){flg=false;break;}
         }
      }
      if(flg){ans++;}
      fac[i]++;
      
   }
   cout<<ans<<endl;
}

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

using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);

	int N;
  	string s, t;
  cin >> N >> s >> t;
  for (int i = 0; i < N; i++)
    cout << s[i] << t[i];
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    int r,g,b, result;
    scanf("%d %d %d",&r ,&g, &b);

    result = 100*r + 10*g +b;
    if( result%4==0 )
    {
         printf("YES");
    }
    else
    {
         printf("NO");
    }

    return 0;
}


Measured memory_bytes: 1712
N, K = map(int, input().split())

# N, K = 3, 2

if K % 2 != 0:
    ans = (N // K)**3
else:
    full = []
    half = []
    for i in range(int(K/2), N+1, int(K/2)):
        if i % K == 0:
            full.append(i)
        else:
            half.append(i)

    ans = len(half) ** 3 + len(full) ** 3

print(ans)

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

using namespace std;

const int N = 800800;

int a[N];
int sm[N];

int main() {
	int n, m;
	scanf("%d %d", &n, &m);
	n *= 2;
	for (int i = 0; i < n; ++i) {
		scanf("%d", a + i);
	}
	sort(a, a + n);
	for (int i = 0; i < n; ++i) {
		a[i + n] = a[i] + m;
	}
	int l = 0, r = m - 1;
	while (l < r) {
		int md = (l + r) >> 1;
		
		memset(sm, 0, sizeof sm);
		
		for (int i = 0; i < n; ++i) {
			int x = lower_bound(a, a + 2 * n, m - a[i]) - a;
			int y = upper_bound(a, a + 2 * n, m - a[i] + md) - a;
			++sm[x + i];
			--sm[y + i]; 
		}
		
		for (int i = 0; i < 3 * n; ++i) {
			sm[i + 1] += sm[i];
		} 
		
		bool fl = false;
		
		for (int i = 1; i < n; i += 2) {
			if (sm[i] + sm[i + n] + sm[i + 2 * n] == n) {
				fl = true;
				break;
			}
		}
		
		if (fl) {
			r = md;
		} else {
			l = md + 1;
		}
	}
	
	printf("%d\n", l);
}


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

int main() {
	double n;
	cin>>n;
	if(floor(ceil(n/1.08)*1.08)==n){
		cout<<ceil(n/1.08)<<endl;
	}else{
		cout<<":("<<endl;
	}
	return 0;
}


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

int main(void){

  char s[128], p[128];
  int i, j;
  int k, n;
  int t = 0;
  int lens = 0, lenp = 0;

  scanf("%s %s", s, p);

  while(s[lens]){
    lens++;
  }

  while(p[lenp]){
    lenp++;
  }

  for(i = 0; i < lens; i++){
    k = 0;
    n = 0;
    if(s[i] == p[0]){
      if((i + lenp - 1) <= lens - 1){
	for(j = i; j < i + lenp; j++){
	  if(s[j] != p[j - i]){
	    k = 1;
	    break;
	  }else{
	    n++;
	  }
	}
	if(n == lenp){
	  t = 1;
	  break;
	}
      }else{
	for(j = i; j < lens; j++){
	  if(s[j] != p[j - i]){
	    k = 1;
	    break;
	  }else{
	    n++;
	  }
	}
	if(n == lens - i){
	  for(j = 0; j <= i + lenp - lens - 1; j++){
	    if(s[j] != p[j + lens - i]){
	      k = 1;
	      break;
	    }else{
	      n++;
	    }
	  }
	}
	if(n == lenp){
	  t = 1;
	  break;
	}
      }
    }
  }

  if(t == 1){
    printf("Yes\n");
  }else{
    printf("No\n");
  }

  return 0;
}


Measured memory_bytes: 2140
#include <iostream>

using namespace std;

int main() {

    int num = 0;
    int N;
    long long X, Y;
    long long A = 0;

    cin >> X >> Y;

    // cout << X << " " << Y << endl;
    // cout << num << endl;

    while (true) {
        if (A == 0) A = X;
        else A = 2 * A;
        if (A <= Y) num += 1;
        else break;
    }

    cout << num << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
#include <utility>
#include <math.h>
#include <stdexcept>
#include <algorithm>
#include <vector>
#define   FOR(i,n) for(int i=0;i<n;i++)

using namespace std;
int int_sort(const void*a,const void *b) {
    return *(  int *) b - *(int *) a;
    //qsort(b, a, sizeof(long long int), int_sort);
}

int main() {

    int a,b,c,d;
    cin >>a >>b>>c>>d;
    cout<<min({a,b})+min({c,d});
    return 0;
}


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

char s[MAXN];
char ans[MAXN];

void solve(){
	int n;
	scanf("%d%s", &n, &s[0]);
	REP(i, 0, n){
		s[i] = (s[i] == 'o' ? 0 : 1);
	}
	REP(j, 0, 2){
		REP(k, 0, 2){
			ans[0] = j;
			ans[1] = k;
			REP(i, 2, n){
				ans[i] = ans[i - 2] ^ ans[i - 1] ^ s[i - 1];
			}
			if (ans[n - 2] ^ ans[n - 1] ^ ans[0] == s[n - 1] && ans[n - 1] ^ ans[0] ^ ans[1] == s[0]){
				REP(i, 0, n){
					ans[i] = (ans[i] ? 'W' : 'S');
				}
				printf("%s\n", ans);
				return;
			}
		}
	}
	printf("-1\n");
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <unordered_set>

using namespace std;

#define INF (1e9)

typedef pair<int,int> P;
typedef pair<int, pair<int,int> > PP;

class HashP {
    public :
    size_t operator()(const P& key) const {
        return (size_t)(key.first*5000+key.second);
    }
};


void solve(int R) {
    vector<P> vis[2];

    for(int r=0; r<2; ++r) {
        int W,H,X,Y;
        vector<vector<int> > L;
        cin >> W >> H >> X >> Y;

        vector<int> temp(W+2,INF);
        L.push_back(temp);
        for(int h=1; h<=H; ++h) {
            for(int w=1; w<=W; ++w) {
                cin >> temp[w];
            }
            L.push_back(temp);
        }
        fill(temp.begin(),temp.end(),INF);
        L.push_back(temp);

        priority_queue<PP,vector<PP>,greater<PP> > q[2];
        bool flag=true;
        int lev=0;
        int cnt=0;
        unordered_set<P,HashP> pushed[2];

        q[r].push(PP(L[Y][X],P(X,Y)));
        pushed[r].insert(P(X,Y));

        while(!q[r].empty()) {
            PP pp=q[r].top();
            int pplev=pp.first;
            int ppx=pp.second.first;
            int ppy=pp.second.second;
            if(L[ppy][ppx]==INF) continue;
            if(lev<pplev) {
                vis[r].push_back(P(cnt,lev));
                if(cnt>R) {
                    flag=false;
                    break;
                }
                lev=pplev;
                continue;
            }
            q[r].pop();
            L[ppy][ppx]=INF;
            ++cnt;
            int dx[4]={-1,0,1,0};
            int dy[4]={0,1,0,-1};
            for(int i=0; i<4; ++i) {
                if(L[ppy+dy[i]][ppx+dx[i]]!=INF && pushed[r].count(P(ppx+dx[i],ppy+dy[i]))==0) {
                    q[r].push(PP(L[ppy+dy[i]][ppx+dx[i]],P(ppx+dx[i],ppy+dy[i])));
                    pushed[r].insert(P(ppx+dx[i],ppy+dy[i]));
                }
            }
        }
        if(flag) vis[r].push_back(P(cnt,lev));
        L.clear();
    }

    int ans=INF;
    for(vector<P>::iterator itr0=vis[0].begin(); itr0!=vis[0].end(); ++itr0) {
        vector<P>::iterator itr1=lower_bound(vis[1].begin(),vis[1].end(),P(R-itr0->first,-1));
        if(itr1==vis[1].end()) continue;
        ans=min(ans,itr0->second+itr1->second);
    }

    cout << ans << endl;


    return;
}


int main() {
    int R;
    while(true) {
        cin >> R;
        if(R==0) break;
        solve(R);
    }
    return 0;
}


Measured memory_bytes: 9048
import java.io.IOException;
import java.util.Scanner;

public class Main {
	/**
	 * Main method.
	 */
	public static void main(String[] args) throws IOException {
		Scanner s = new Scanner(System.in);
		
		int N = s.nextInt();
		
		System.out.println(N / 3);
 
	}
}

Measured memory_bytes: 21844
S = list(input())

if S[0] != "A":
    print("WA")
elif S[2:-1].count("C") != 1:
    print("WA")
else:
    S.remove("A")
    S.remove("C")
    S = "".join(S)
    if S.islower():
        print("AC")
    else:
        print("WA")

Measured memory_bytes: 9120
#include<bits/stdc++.h>
using namespace std;
#define N 1000000 + 5
#define Mod 1000000007
#define rep(i, l, r) for(int i = l; i <= r; ++i)
int n, m, k, f, g, tmp, ans, p[N], fac[N], inv[N];
int read(){
    char c; int x = 0, f = 1;
    c = getchar();
    while(c > '9' || c < '0'){ if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}
int Inc(int a, int b){
    return (a += b) >= Mod ? a - Mod : a;
}
int Dec(int a, int b){
    return (a -= b) < 0 ? a + Mod : a;
}
int Mul(int a, int b){
    return 1ll * a * b % Mod;
}
int Qpow(int a, int b){
    int ans = 1;
    while(b){
        if(b & 1) ans = Mul(ans, a);
        a = Mul(a, a), b >>= 1;
    }
    return ans;
}
int C(int n, int m){
    if(m > n) return 0;
    return Mul(fac[n], Mul(inv[n - m], inv[m]));
}
int main(){
    n = read(), m = read(), k = read();
    fac[0] = 1, p[0] = inv[0] = 1;
    rep(i, 1, N - 5) fac[i] = Mul(fac[i - 1], i), p[i] = Mul(p[i - 1], 3), inv[i] = Qpow(fac[i], Mod - 2);
    f = 1, ans = Mul(p[m + k], Mul(C(n - 1, 0), f));
    rep(i, 1, m + k){
        f = Dec(Mul(f, 2), C(i - 1, m));
        if(i - k > 0){
            if(i - k == 1) g = 1;
            else g = Inc(Mul(g, 2), C(i - 1, i - k - 1));
            tmp = Dec(f, g);
        } 
        else tmp = f;
        ans = Inc(ans, Mul(p[m + k - i], Mul(C(n + i - 1, i), tmp)));
    }
    printf("%d", ans);
    return 0;
}

Measured memory_bytes: 15364
//
//  main.cpp
//  ABC173F
#include <iostream>
#include<vector>
#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 argc, const char * argv[]) {
    int n;
    cin>>n;
    ll v=0;
    ll e=0;
    // Sに含まれる頂点の数
    for(ll i=1;i<=n;i++){ // 3*1+2*2+1*3 = for(int i=1,i<=n,i++) i*(n-i+1)
        v+=i*(n-i+1);
    }
    // Sに含まれる辺が使われる回数
    rep(i,n-1){
        ll a,b;
        cin>>a>>b;
        if(a>b) swap(a,b);
        e+=a*(n-b+1); // 辺(a-b)が使われる回数
        // a以下の頂点数、b以上n以下の頂点数の積の和
        // 1-3が使われるのは頂点1と頂点3が選ばれたときの1回
        // 2-3が使われるのは頂点1または2と頂点3が選ばれた時の2回
    }
    // 答えは頂点の数の合計ー辺の数の合計
    cout<<v-e<<endl;
    return 0;
}
//   S          L,R     連結成分数   Sに含まれる頂点の数 Sに含まれる辺の数
//  {1}         1,1         1           1           0
//  {1,2}       1,2         2           2           0
//  {1,2,3}     1,3         1           3           2
//  {2}         2,2         1           1           0
//  {2,3}       2,3         1           2           1
// {3}          3,3         1           1           0
//                          7     =    10      -    3


Measured memory_bytes: 3184
import static java.util.Arrays.deepToString;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	void tr(Object... os) {
		System.err.println(deepToString(os));
	}

	HashMap<Integer, Integer> mp;
	int getId(int num) {
		if (mp.containsKey(num)) {
			return mp.get(num);
		}
		int v = mp.size();
		mp.put(num, v);
		return v;
	}
	static final int INF = 1001001001;
	
	Scanner sc = new Scanner(System.in);
	public void run() {
		for (;sc.hasNext();) {
			int n = sc.nextInt();
			if (n == 0) break;
			mp = new HashMap<Integer,Integer>();
			
			int[][] g = new int[n][n];
			for (int i = 0; i < n; i++) {
				Arrays.fill(g[i], INF);
				g[i][i] = 0;
			}
			for (int i = 0; i < n; i++) {
				int here = getId(sc.nextInt());
				int m = sc.nextInt();
				for (int j = 0; j < m; j++) {
					int there = getId(sc.nextInt());
					g[here][there] = 1;
				}
			}
			
			for (int k = 0; k < n; k++) for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) g[i][j] = Math.min(g[i][j], g[i][k] + g[k][j]);
			
			int Q = sc.nextInt();
			for (int q = 0; q < Q; q++) {
				int s = getId(sc.nextInt());
				int t = getId(sc.nextInt());
				int ttl = sc.nextInt();
				
				int d = g[s][t];
				if (d + 1 > ttl) {
					System.out.println("NA");
				} else {
					System.out.println(d + 1);
				}
			}
		}
	}
}

Measured memory_bytes: 27296
#! /usr/bin/env python3

from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

N = int(input())
ret = 0
for i in range(1, N+1):
    if i % 3 == 0 or i % 5 == 0:
        continue
    ret += i
print(ret)

Measured memory_bytes: 10392
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

void solve(){
  int N; cin >> N;
  string A, B, C; cin >> A >> B >> C;
  int ans = 0;
  rep(i,N){
    set<char> st;
    st.insert(A[i]);
    st.insert(B[i]);
    st.insert(C[i]);
    ans += st.size()-1;
  }
  cout << ans << endl;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 3584
n = int(input())
x = sorted(list(map(int, input().split())))
# print(x)
# ans = 10 * 18 + 13
ans=[10**9]*101
for i in range(100 + 1):
    cnt = 0
    for j in range(len(x)):
        # print(x[j], i)
        # print(cnt)
        cnt = cnt + (x[j] - i) ** 2
    # ans = min(ans, cnt)
    ans.append(cnt)
print(min(ans))


Measured memory_bytes: 2940
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <stdio.h>
#include <string.h>
using ll = long long;

//LLONG_MAX
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()

using namespace std;



//---------- 1000000007 ----------
const int MOD = 1000000007;
int m_add(int a, int b)
{
	return (a + b) % MOD;
}
int m_sub(int a, int b)
{
	return (a + MOD - b) % MOD;
}
int m_mul(int a, int b)
{
	return (a * b) % MOD;
}
int m_pow(int x, int n)
{
	if (n == 0) return 1;
	ll res = m_pow((x * x) % MOD, n / 2);
	if (n & 1) res = (res * x) % MOD;
	return res;
}
int m_divide(int a, int b)
{
	return m_mul(a, m_pow(b, MOD - 2));
}


//---------- 組み合わせ ----------
int m_comb(int n, int r)
{
	int i;
	int p = 1;
	for (i = 1; i <= r; i++)
	{
		p = m_mul(p, (n - i + 1));
		p = m_divide(p, i);
	}
	return p;
}

int m_comb_with_rep(int n, int r)
{
	return m_comb(n + r - 1, r);
}


int hh[200001];
int cc[200001];

int make(int n, int r, int *ary)
{
	int i;
	int p = 1;
	for (i = 1; i <= r; i++)
	{
		p = m_mul(p, (n - i + 1));
		p = m_divide(p, i);
		ary[i] = p;
	}
	return p;
}

int N, K;

signed main()
{
	cin >> N >> K;

	int n = m_comb_with_rep(N, N);
	if (N <= K + 1)
	{
		cout << n << endl;
		return 0;
	}

	make(N - 1, N, hh);
	make(N, N, cc);

	int a = N - (K + 1);
	int ans = n;
	for (int i = 0; i <= a; i++)
	{
		int h = hh[N - i];
		int c = cc[N - i];
		int k = m_mul(h, c);
		ans = m_sub(ans, k);
	}
	
	cout << ans << endl;
}




Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
int main()
  {int N, K; cin >> N >> K;
  auto s = 0LL;
  vector<int> H(N); for (auto &h: H) {cin >> h; s += h;} sort(H.rbegin(), H.rend());
  for (int i = 0; i < min(K, N); ++i) s -= H[i];
  cout << s << endl;}

Measured memory_bytes: 3964
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB push_back
#define PF push_front
#define FILL(a,b) memset(a,b,sizeof(a))
using namespace std;
string x;
map<string,int> m;
int n;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n;
	int maxi=0;
	FOR(i,1,n){
		cin>>x;
		m[x]++;
	}
	auto iter=m.begin();
	while(iter!=m.end()){
		maxi=max(maxi,(*iter).S);
		iter++;
	}
	iter=m.begin();
	while(iter!=m.end()){
		if((*iter).S==maxi){
			cout<<(*iter).F<<'\n';
		}
		iter++;
	}
	RE 0;
}



Measured memory_bytes: 23808
#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() {
    string s;
    cin >> s;
    string t = s;
    reverse(t.begin(), t.end());
    string ans = "No";
    if (s.find('C') != string::npos && t.find('F') != string::npos && s.find('C') < t.size() - t.find('F') - 1) ans = "Yes";
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
   int n,c,r;
   scanf("%d", &n);
   r=0;
   for(int i=n; i>0; i--){
       for(int j=1; j<=i; j++){
         if(i%2!=0 && i%j==0){c++;}
       }
       if(c==8){r++;}
       c=0;
   }
   printf("%d", r);
   return 0;
}


Measured memory_bytes: 128
n = gets.chop!
str = gets.split

str.map!{|s| s.to_i}
# array = array.map{|n| n.to_i}

def test(st)
    check = "Yes"
for e in 1...st.length
    if st[e] < st[e-1]
        check = "No"
    elsif st[e] - 1 >= st[e-1]
        st[e] = st[e] - 1
    end
end

    return check
end

print test(str)

Measured memory_bytes: 10244
#include <stdio.h>
#include <stdlib.h>

int main()
{
	int W, H;
	int x, y, r;

	scanf("%d%d%d%d%d", &W, &H, &x, &y, &r);
	W -= r, H -= r;
	if (r <= x && x <= W && r <= y && y <= H) printf("Yes\n");
	else printf("No\n");
	return 0;
}



Measured memory_bytes: 2148
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

//行列は二次元vectorを用いるようにする
typedef vector<int> vec;
typedef vector<vec> mat;

//A*Bの計算
mat mul(mat &A, mat &B){
    mat C(A.size(), vec(B[0].size()));
    for(int i = 0; i < A.size(); i++){
        for(int k = 0; k < B.size(); k++){
            for(int j = 0; j < B[0].size(); j++){
                C[i][j] = (C[i][j] + A[i][k] * B[k][j]);
            }
        }
    }
    return C;
}

//A^nの計算
mat pow(mat A, long long n){
    mat B(A.size(), vec(A.size()));
    for(int i = 0; i < A.size(); i++){
        B[i][i] = 1;
    }
    while(n > 0){//繰り返し二乗法
        if(n & 1) B = mul(B, A);
        A = mul(A, A);
        n >>= 1;
    }
    return B;
}

ll n;

void solve(){
    mat A(2, vec(2));
    A[0][0] = 1; A[0][1] = 1;
    A[1][0] = 1; A[1][1] = 0;
    A = pow(A, n);
    cout << A[0][0] << endl;
}

signed main(){
    cin >> n;
    solve();
}


Measured memory_bytes: 3160
/*
title:

url:

あんま綺麗な実装じゃない
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>

using namespace std;

#define REP(i, n) for (int i = 0; i < (n); i++)
#define INF 1000000007

typedef pair<int, int> p_i;

int main()
{
    int n, k;
    cin >> n >> k;

    int m = 0;
    while (true)
    {
        int min = m * k - (m - 1);
        int max = (m + 1) * k - m;
        m++;
        if (min <= n && n <= max)
        {
            break;
        }
    }
    cout << m << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
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; }
typedef long long ll;
const long long INF = 1LL << 60;
ll N, M;
string s;
int word[50][26];
int main(){
   cin >> N;
   REP(i,N){
       cin >> s;
       for(char c : s) ++word[i][c - 'a']; // 各文字の出現回数をカウント
   }

   string ans = "";
   REP(i,26){
       int cnt = 1e9;
       REP(j,N){
           cnt = min(word[j][i],cnt); // 出現数の最小値
       }
       char c = 'a' + i;
       REP(k,cnt) ans += c;
   }
   cout << ans << endl;
}

Measured memory_bytes: 256