akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void) {
    int H, W;
    int i, j;

    while(1){
        scanf("%d %d", &H, &W);

        if(H == 0 && W == 0){
            break;
        }

        for(i = 0; i < H; i++){
            for(j = 0; j < W; j++){
                if(i == 0 || i == H - 1 || j == 0 || j == W - 1){
                    printf("#");
                } else {
                    printf(".");
                    }
                }
                    printf("\n");
            }

        printf("\n");

    }

    return 0;
}


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

typedef long long ll;

ll K;
const ll N = 50;

int main() {
  cin >> K;
  cout << N << endl;
  for (ll i = 0; i < N; ++i) {
    cout << (i == 0 ? "" : " ")
         << N - 1 + K / N - K % N + (i < K % N ? N + 1 : 0);
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author mikit
 */

#include <iostream>
#include <fstream>

#include <iostream>

class AAdditionAndSubtractionEasy {
public:
  void solve(std::istream &in, std::ostream &out) {
    int a, b;
    char op;
    in >> a >> op >> b;
    if (op == '+') {
      out << a + b << std::endl;
    } else {
      out << a - b << std::endl;
    }
  }
};


int main() {
  AAdditionAndSubtractionEasy solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


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

signed main() {
  string S;
  cin >> S;
  
  for( int i = 0; i < S.size(); i++ ){
    for( int j = i+1; j < S.size(); j++ ){
      if( S.at(i) == S.at(j) ){
        cout << "no" << endl;
        return 0;
      }
    }
  }
  cout << "yes" << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int n;cin>>n;
  int arr[n];
  for(int i=0;i<n;i++)
    cin>>arr[i];
  int total=0;
  for(int i=0;i<n;i++)
    for(int j=i+1;j<n;j++) total+=(arr[i]*arr[j]);
  cout<<total;
  return 0;
}

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

using namespace std;

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< vector<int> > Mat;
typedef tuple<int, int, int, int> T;

const int MOD = (int)1e9+7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

int n, p = 0;
int dp[120][100];

bool is_prime(int n){
    for(int i = 2; i * i <= n; i++){
        if(n % i == 0) return false;
    }
    return true;
}

int main(){
    cin >> n;
    dp[0][1] = 1;

    for(int i = 2; i <= n; i++){
        if(is_prime(i) == false) continue;
        int cnt = 0;
        for(int j = 1; j <= n; j++){
            int a = j;
            while(a % i == 0){
                cnt++;
                a /= i;
            }
        }
        for(int j = 0; j <= cnt; j++){
            for(int k = 1; k * (j + 1) <= 75; k++){
                dp[i][k*(j+1)] += dp[p][k];
            }
        }
        p = i;
    }
    
    cout << dp[p][75] << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                           \
  cerr << __LINE__ << ": " << #x << " = {";        \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];        \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  string s[N];
  for (int i = 0; i < N; i++) cin >> s[i];
  char ans[N];
  set<tuple<int, int, int, int>> memo;
  function<bool(int, int, int, int)> rec = [&](int i, int a, int b, int c) {
    if (memo.count(make_tuple(i, a, b, c))) return false;
    if (i == N) return true;
    if (s[i] == "AB") {
      if (a == 0 && b == 0) return false;
      if (a <= b) {
        if (rec(i + 1, a + 1, b - 1, c)) {
          ans[i] = 'A';
          return true;
        }
      }
      if (a >= b) {
        if (rec(i + 1, a - 1, b + 1, c)) {
          ans[i] = 'B';
          return true;
        }
      }
    } else if (s[i] == "AC") {
      if (a == 0 && c == 0) return false;
      if (a <= c) {
        if (rec(i + 1, a + 1, b, c - 1)) {
          ans[i] = 'A';
          return true;
        }
      }
      if (a >= c) {
        if (rec(i + 1, a - 1, b, c + 1)) {
          ans[i] = 'C';
          return true;
        }
      }
    } else {
      if (b == 0 && c == 0) return false;
      if (b <= c) {
        if (rec(i + 1, a, b + 1, c - 1)) {
          ans[i] = 'B';
          return true;
        }
      }
      if (b >= c) {
        if (rec(i + 1, a, b - 1, c + 1)) {
          ans[i] = 'C';
          return true;
        }
      }
    }
    memo.insert(make_tuple(i, a, b, c));
    return false;
  };
  if (rec(0, A, B, C)) {
    cout << "Yes" << endl;
    for (int i = 0; i < N; i++) cout << ans[i] << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 27172
var GET = (function () {function f(s) {return new g(s);}function g(s) {this._s = s.trim().split("\n");}g.prototype.getValue = function (n) {return this._s[n];};g.prototype.getArray = function (n) {return this.stoa(this._s[n]);};g.prototype.slice = function (s, limit) {return this._s.slice(s, +limit + s || undefined).map(v => this.stox(v));};g.prototype.sliceArray = function (s, limit) {return this._s.slice(s, +limit + s || undefined).map(v => this.stoa(v));};g.prototype.stoa = function (s) {return s.split(" ").map(v => this.stox(v));};g.prototype.stox = function (v) {var i = +v;return (i === i) ? i : v;};return f;})();
var o = GET(require("fs").readFileSync("/dev/stdin", "utf8"));

console.log(main());
function main(){
    var S = o.getValue(0)
    var T = o.getValue(1)

    var result = 0;
    for(var i = 0; S.length > i; i++) {
        if (S[i] === T[i]) result++;
    }

    return result;
}

Measured memory_bytes: 21064
N=int(input())
a=list(map(int,input().split()))
total=0
ans=10**10
tmp=0
for i in range(N):
    total+=a[i]
for j in range(N-1):
    tmp+=a[j]
    if abs(total-tmp*2)<ans:
        ans=abs(total-tmp*2)
print(ans)

Measured memory_bytes: 24800
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const double PI=3.14159265358979323846;
const int64_t waru = 1000000007;
using in = int64_t;

int main(){
int x,s,t;
  cin>>x;
  s=x/100;
  t=x%100;
  if(t<=s*5) cout<<1;
  else cout <<0;
}

Measured memory_bytes: 256
/*
 * ALDS1_4_C.cpp
 *
 *  Created on: Apr 26, 2018
 *      Author: 13743
 */

#include<cstdio>

using namespace std;

const int SIZE = 1045527;
int table[SIZE];

int getKey(char* s) {
	int key = 0;
	int exp = 1;
	for(int i=0; s[i]!='\0'; i++) {
		switch(s[i]) {
		case 'A': key += 4 * exp; break;
		case 'C': key += 3 * exp; break;
		case 'G': key += 2 * exp; break;
		default: key += 1 * exp; break;
		}
		exp *= 5;
	}
	return key;
}

void insert(char* s) {
	int key = getKey(s);
	int hash = key % SIZE;
	while(true) {
		if(table[hash] == 0 || table[hash] == key) {
			table[hash] = key; break;
		}
		hash = (hash + (1 + (key%(SIZE-2)))) % SIZE;
	}
}

bool find(char* s) {
	int key = getKey(s);
	int hash = key % SIZE;
	int i=0;
	while(i++ < SIZE) {
		if(table[hash] == key) {
			return true;
		}
		else if(table[hash] == 0) {
			return false;
		}
		hash = (hash + (1 + (key%(SIZE-2)))) % SIZE;
	}
	return false;
}

int main() {
	int n;
	scanf("%d", &n);
	char d[10];
	char s[13];
	for(int i=0; i<n; i++) {
		scanf("%s %s", d, s);;
		if(d[0] == 'i') {
			insert(s);
		}
		else {
			if(find(s)) printf("yes\n");
			else printf("no\n");
		}
	}
}





Measured memory_bytes: 6676
import collections

def uzai():
            n = int(input())
            s = []
            for i in range(n):
                        s_i = input()
                        s.append(s_i)
            count_dict_s = collections.Counter(s)
            return n, s, count_dict_s

n,s,count_dict_s = uzai()
m,t,count_dict_t = uzai()

#print("count_dict_s",count_dict_s)
#print("count_dict_t",count_dict_t)

s_count_l=[]
for s_name, s_count in count_dict_s.items():
            for t_name, t_count in count_dict_t.items():
                    if s_name==t_name:
                                 s_count_l.append(s_count-t_count)
                    elif s_name not in count_dict_t:
                                 s_count_l.append(s_count)
                                # print(s_name,s_count_l)
if max(s_count_l)<=0:
            print('0')
else:
             print(max(s_count_l)) 
            


                                        


Measured memory_bytes: 3316
import java.util.Scanner;
 
public class Main{
 public static void main(String[] a){
     Scanner s = new Scanner(System.in);
     int i,x,now;
     boolean ch=false;
     x = s.nextInt();
     for(i=1;i<=x;i++){
         now=i;
         if(i%3==0)ch=true;
         while(now>0&&ch==false){
            if(now%10==3)ch=true;
            now/=10;
         }
         if(ch==true){
             ch=false;
             System.out.print(" "+i);
         }
     }
    System.out.println();
 }   
}


Measured memory_bytes: 28568
/************************Code by Hardik Aggarwal!!!!***********************************/

#include<bits/stdc++.h>
using namespace std;

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define endl '\n'
#define debug cout << "Hold right there sparky.....\n";
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;

typedef long long int ll;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =1e9+7;
ll a[401+1],dp[402][402];
ll sum[402];
ll solve(ll l,ll r)
{
	ll &res=dp[l][r];
	if(res!=-1)
		return res;
	else if(l==r)
		return 0;
	else
	{	
		res=mod*mod;
		for(ll i=l;i<r;i++)
			res=min(res,solve(l,i)+solve(i+1,r)+sum[r]-sum[l-1]);

		return res;
	}
}

int main()
{	
	

	IOS
	ll n;
	cin>>n;
	memset(dp,-1,sizeof(dp));
	sum[0]=0;
	for(ll i=1;i<=n;i++)
		cin>>a[i],sum[i]=sum[i-1]+a[i];


	ll ans=solve(1,n);
	cout<<ans;
	
}
    
 
    
    


Measured memory_bytes: 1536
#include <iostream>

using namespace std;
using ll = long long;
using ld = long double;

#define ALL(x) begin(x), end(x)
#define REP(i, n) for (size_t i = 0, i##_len = (n); i < i##_len; ++i)

const string YES = "YES";
const string NO = "NO";

void solve(ll X) {
  bool pred = X == 7 || X == 5 || X == 3;
  cout << (pred ? YES : NO) << endl;
}

int main() {
  ll X;
  cin >> X;
  solve(X);
  return 0;
}


Measured memory_bytes: 256
#define _LIBCPP_DEBUG 0
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const long long INF = 1LL << 60;
ll MOD = 1e9+7;

int main() {

    int K; cin>>K;
    string S; cin>>S;

    if(S.size()<=K) cout<<S<<endl;
    else{
        for (int i = 0; i < K; ++i) {
            cout<<S[i];
        }
        cout<<"..."<<endl;
    }

}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = 1<<29;

int main() {
  ll N, M; cin >> N >> M;
  // x = 100 * (N - M) + 1900 * M, p = 1 / 2^M
  // y = x + (1 - p) * y
  // y = x / p = (100 * (N - M) + 1900 * M) * 2^M
  cout << ((100 * (N - M) + 1900 * M) * (1 << M)) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (int i = 0; i < sz(v); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << " ";
    }
    return os;
}

int main() {
    int s, w;
    cin >> s >> w;
    cout << (s <= w ? "unsafe" : "safe") << endl;
}

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

#define int long long
#define gcd            __gcd
#define setbits(x)     __builtin_popcountll(x)
#define zrobits(x)     __builtin_ctzll(x)
#define mod            1000000007
#define mod2           998244353
#define maxe           *max_element
#define mine           *min_element
#define inf            1e18
#define deci(x, y)      fixed<<setprecision(y)<<x
#define w(t)           int t; cin>>t; while(t--)
#define nitin          ios_base::sync_with_stdio(false); cin.tie(NULL)
#define PI             3.141592653589793238
using namespace std;

int32_t main() {
    nitin;
    double n,x;
    int t;
    cin>>n>>x>>t;
    cout<<(int)(ceil(n/x))*t<<endl;
    return 0;
}

Measured memory_bytes: 3856
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <math.h>
#include <bits/stdc++.h>
#include <queue>
#include <map>

using namespace std;

#define INF (1ll<<60)
#define INFint (1<<30)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;
typedef pair<ll,ll> P;

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

template<class T>
bool umax(T &a, const T &b){
    if (a<b) {
        a=b; return 1;
    }
    return 0;
}

template<class T>
bool umin(T &a, const T &b) {
    if (b<a) {
        a=b; return 1;
    }
    return 0;
}

// gcd
template<typename T>
T gcd(T a, T b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}

// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm( T m, T n ){
    // 引数に0がある場合は0を返す
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;
    return ((m/gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

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


int dx[5]={1,0,-1,0};
int dy[5]={0,1,0,-1};
// v.front() = -BOUND;
// v.back() = BOUND;
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // not prime num
            return false;
        }
    }
    // prime num
    return true;
}

struct edge{
    int cost, to;

    edge(int in_cost, int in_to){
        cost=in_cost;
        to=in_to;
    }
    bool operator<(const edge &a) const
    {
        return cost > a.cost;
    }
};

typedef tuple<ll,ll,ll> T;

int main() {
    ll N;
    cin >> N;
    vector<T>v(N);

    rep(i,N){
        cin >> get<1>(v[i]) >> get<2>(v[i]);
        get<0>(v[i]) = get<1>(v[i]) + get<2>(v[i]);
    }

    sort(v.begin(), v.end(), greater<T>());

    ll sum_a=0LL, sum_b=0LL;

    rep(i,N){
        if(i%2==0){
            sum_a+=get<1>(v[i]);
        }else{
            sum_b+=get<2>(v[i]);
        }
    }

    cout << sum_a-sum_b << endl;
    return 0;
}


Measured memory_bytes: 2560
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        InputStreamScanner in = new InputStreamScanner(System.in);
        new Main().solve(in, out);
        out.flush();
    }

    private void solve(InputStreamScanner in, PrintWriter out) {
        int n = in.nextInt();
        int c = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            c = Math.min(c, Integer.numberOfTrailingZeros(in.nextInt()));
            if (c == 0) {
                break;
            }
        }
        out.println(c);
    }

    static class InputStreamScanner {

        private InputStream in;

        private byte[] buf = new byte[1024];
        private int len = 0;
        private int off = 0;

        InputStreamScanner(InputStream in)	{
            this.in = in;
        }

        String next() {
            StringBuilder sb = new StringBuilder();
            for (int b = skip(); !isSpace(b);){
                sb.appendCodePoint(b);
                b = read();
            }
            return sb.toString();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        char nextChar() {
            return (char)skip();
        }

        int skip() {
            for (int b; (b = read()) != -1;) {
                if (!isSpace(b)) {
                    return b;
                }
            }
            return -1;
        }

        private boolean isSpace(int c) {
            return c < 33 || c > 126;
        }

        private int read() {
            if (len == -1) {
                throw new InputMismatchException("End of Input");
            }
            if (off >= len){
                off = 0;
                try {
                    len = in.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException(e.getMessage());
                }
                if (len <= 0) {
                    return -1;
                }
            }
            return buf[off++];
        }
    }
}

Measured memory_bytes: 23124
#include <iostream>

using namespace std;

int main(void){

	int y,x;
	cin >> y >> x;

	int arr[13] = {0,1,2,1,3,1,3,1,1,3,1,3,1};

	if(arr[y] == arr[x])
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))

#define DEBUG(x) cout<<#x<<": "<<(x)<<endl

int n,k;
ll h[125252];

int main(){
	cin>>n>>k;
	REP(i,n)cin>>h[i];
	sort(h,h+n);
	ll ans = 1ll<<60;
	REP(i,n)if(i+k<=n)CHMIN(ans,h[i+k-1]-h[i]);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 1005;
const int mod = 998244353;

int a[maxn];

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int n,m;
  cin>>n>>m;
  for(int i=0;i<n;i++)cin>>a[i];
  sort(a,a+n);
  int ret = 0;
  for(int i=0;i<m;i++)ret+=a[i];
  cout<<ret<<endl;
  return 0;
}

Measured memory_bytes: 3640
import math
def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

X = int(input())

while True:
  prime = int(math.sqrt(X))
  if is_prime(X):
    break
  X += 1
print(X)

Measured memory_bytes: 9168
a,b,n = map(int,input().split())
ans = 0
ans = max(int(a*n/b) - a*int(n/b),ans)
if b == 1:
    print(0)
else:
    for k in range(1,n//(b-1)+1):
        ans = max(int(a*(k*b-1)/b) - a*int((k*b-1)/b),ans)
        if ans == a:
            print(ans)
            break
    if ans != a:
        print(ans)

Measured memory_bytes: 9208
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

void main() {
    auto S = readln.chomp;
    auto N = S.length.to!int;

    long ans = 0;
    long w = 0;

    foreach_reverse (i; 0..N) {
        if (S[i] == 'W') {
            w += 1;
        } else {
            ans += w;
        }
    }

    ans.writeln;
}


Measured memory_bytes: 764
n=int(input())
s=input()
inf=float("inf")
A=[[inf]*10 for _ in range(n+1)]
for i in reversed(range(n)):
  ss=s[i]
  for j in range(10):
    if j==int(ss):
      A[i][j]=i
    else:
      A[i][j]=A[i+1][j]
ans=0
for x in range(1000):
  x=str(x).zfill(3)
  cur=0
  for xx in x:
    xx=int(xx)
    cur=A[cur][xx]+1
    if cur==inf:
      break
  if cur!=inf:
    ans+=1
print(ans)




Measured memory_bytes: 8940
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    s=input()
    a=len(s)%2
    if s[0]==s[-1]:
        b=1
    else:
        b=0
        
    f=(a+b)%2
    
    if f==1:
        print("First")
    else:
        print("Second")
    
        
    
    
                    
            
        
        

main()


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

class dice{

public:
  int _1,_2,_3,_4,_5,_6,temp;

  void moveN(){
    temp=_1;
    _1=_2;
    _2=_6;
    _6=_5;
    _5=temp;
  }

  void moveE(){
    temp=_1;
    _1=_4;
    _4=_6;
    _6=_3;
    _3=temp;
  }

  void moveW(){
    temp=_1;
    _1=_3;
    _3=_6;
    _6=_4;
    _4=temp;
  }

  void moveS(){
    temp=_1;
    _1=_5;
    _5=_6;
    _6=_2;
    _2=temp;
  }

  void spin(){
    temp=_2;
    _2=_3;
    _3=_5;
    _5=_4;
    _4=temp;
  }

};
int main(){
  dice d[100];
  int i,j,k,l,n;
  cin>>n;
  for(i=0; i<n; i++)cin>>d[i]._1>>d[i]._2>>d[i]._3>>d[i]._4>>d[i]._5>>d[i]._6;
  for(i=0; i<n; i++)for(j=0; j<n; j++){
     if(i==j)continue;
      for(k=0; k<3; k++){
       if(k==1){d[i].moveW();d[i].moveW();}
        if(k==2)d[i].moveW();
          for(l=0; l<4; l++){
            d[i].spin();
            if(d[i]._1==d[j]._1 &&
               d[i]._2==d[j]._2 &&
               d[i]._3==d[j]._3 &&
               d[i]._4==d[j]._4 &&
               d[i]._5==d[j]._5 &&
               d[i]._6==d[j]._6){cout<<"No"<<endl;return 0;}
        }
      }
    }
  cout<<"Yes"<<endl;
  return 0;
}

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

using namespace std;

long long A, B, C;

void solve ()
{
		long long ans = (long long) (1e18);

		long long a = abs ((A / 2) * B * C - (A - (A / 2)) * B * C);
		long long b = abs ((B / 2) * A * C - (B - (B / 2)) * A * C);
		long long c = abs ((C / 2) * A * B - (C - (C / 2)) * A * B);

		ans = min (a, min (b, c));

		cout << ans << '\n';
}

int main ()
{
		cin >> A >> B >> C;

		solve ();

		return 0;
}

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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    int n; cin >> n;
    string s; cin >> s;

    vector<ll> num(30, 0);
    for (auto c : s) {
        num[c - 'a']++;
    }

    ll ans = 1;
    for (int i = 0; i < 26; ++i) {
        ans *= num[i] + 1;
        ans %= MOD;
    }

    ans -= 1;

    cout << ans << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>

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++)
#define FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define ALL(n) n.begin(),n.end()
#define MP make_pair

int main() {
	int n;
	cin >> n;
	if (n == 1) cout << "Hello World" << endl;
	else {
		int a, b;
		cin >> a >> b;
		cout << a + b << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;

int main() 
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string S;
  cin >> S;
  int l = 0;
  l = S.size();

  cout << S.at(0) << to_string(l-2) << S.at(l-1) << endl;
  return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdlib>
#include <climits>

using namespace std;

#define ALL(c) c.begin(),c.end()
#define RALL(c) c.rbegin(),c.rend()
#define REP(i,x,y) for(int i=(x);i<(y);++i)
#define MP(a,b) make_pair((a),(b))
#define F_ first
#define S_ second

typedef long long int lli;
typedef pair<int,int> Pi;

const int INF=100000000;
const long long int INF_=1000000000000000000;

const int MAX_N=1<<17;
int n;
int dat[2*MAX_N-1];
int num[2*MAX_N-1];

void Init(int n_){
	n=1;
	while(n<n_) n*=2;
	for(int i=0; i<2*n-1; ++i){
		if(n-1<=i){
			dat[i]=0;
			num[i]=i;
		} else {
			dat[i]=INT_MIN;
			num[i]=-1;
		}
	}
}

void Update(int k,int a){
	k+=n-1;
	dat[k]=a;
	while(k>0){
		//dat[k]=max(dat[k*2+1],dat[k*2+2]);
		k=(k-1)/2;
		if(dat[k*2+1]>=dat[k*2+2]){
			dat[k]=dat[k*2+1];
			num[k]=num[k*2+1];
		} else {
			dat[k]=dat[k*2+2];
			num[k]=num[k*2+2];
		}
	}
}

Pi Query(int a,int b,int k,int l,int r){
	if(r<=a||b<=l) return Pi(-1,INT_MIN);
	if(a<=l&&r<=b) return Pi(num[k],dat[k]);
	else {
		Pi vl=Query(a,b,k*2+1,l,(l+r)/2);
		Pi vr=Query(a,b,k*2+2,(l+r)/2,r);
		if(vl.S_>=vr.S_) return vl;
		else return vr;
	}
}

int main(){
	int N,R,L;
	cin >> N >> R >> L;
	Init(N);
	vector<int> t(N);
	Pi tmp;
	REP(i,0,R){
		int D,T,X;
		cin >> D >> T >> X;
		--D;
		Update(D,dat[D+n-1]+X);
		Pi p=Query(0,n,0,0,n);
		if(i!=0) t[tmp.F_]+=T-tmp.S_;
		//if(i!=0) cout << tmp.F_ << ' ' << T-tmp.S_ << endl;
		tmp.F_=p.F_-n+1;
		tmp.S_=T;
		if(i==R-1) t[tmp.F_]+=L-T;
	}
	int ans=-1,l=INT_MIN;
	REP(i,0,N){
		if(l<t[i]){
			ans=i+1;
			l=t[i];
		}
	}
	/*
	REP(i,0,2*n-1){
		cout << i << ' ' << num[i] << ' ' << dat[i] << endl;
	}
	cout << endl;
	*/
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3380
from math import factorial

def nCr(n, r) :
    return factorial(n)//(factorial(r)*factorial(n-r))


n,a,b = map(int,input().split())
V = sorted(list(map(int,input().split())), reverse=True)

L1, L2 = V[:a], V[a:]

ans1 = sum(L1)/a

minv = min(L1)
x = L1.count(minv)
y = L2.count(minv)

ans2 = 0

if x == a :
    for i in range(x, x+min(y, b-a)+1) :
        ans2 += nCr(x+y, i)
else :
    ans2 = nCr(x+y, x)

print(ans1)
print(ans2)


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


int main() {
    int a, b;
    scanf("%d %d", &a, &b);

    int ans = 0;
    for(int i = 1; i < a; i++) {
        ans++;
    }
    if(b >= a) {
        ans++;
    }
    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <queue>

//ダイクストラ法
std::vector<long long> dijkstra(long long n, std::vector<std::vector<std::vector<long long>>> &nx, long long start) {
	std::vector<long long> ret(n, LLONG_MAX);
	std::priority_queue<std::vector<long long>, std::vector<std::vector<long long>>, std::greater<std::vector<long long>>> task;
	task.push({0, start});
	while (task.size()) {
		while (task.size() && ret[task.top()[1]] < LLONG_MAX) task.pop();
		if (task.empty()) break;
		std::vector<long long> v = task.top();
		task.pop();
		ret[v[1]] = v[0];
		for (long long i = 0; i < nx[v[1]].size(); i++) {
			std::vector<long long> w = nx[v[1]][i];
			if (ret[w[1]] < LLONG_MAX) continue;
			task.push({ret[v[1]] + w[0], w[1]});
		}
	}
	return ret;
}

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

	long long n, m, s;
	std::cin >> n >> m >> s;
	s = std::min(s, 2500ll);

	//頂点aで銀貨b枚所持
	auto index = [&] (long long a, long long b) {return a + b * n;};

	std::vector<std::vector<std::vector<long long>>> nx(n * 2501, std::vector<std::vector<long long>>(0));
	for (long long i = 0; i < m; i++) {
		long long u, v, a, b;
		std::cin >> u >> v >> a >> b;
		u--;
		v--;
		for (long long j = a; j <= 2500; j++) {
			nx[index(u, j)].push_back({b, index(v, j - a)});
			nx[index(v, j)].push_back({b, index(u, j - a)});
		}
	}

	for (long long i = 0; i < n; i++) {
		long long c, d;
		std::cin >> c >> d;
		for (long long j = 0; j <= 2500 - c; j++) {
			nx[index(i, j)].push_back({d, index(i, j + c)});
		}
	}

	std::vector<long long> ans = dijkstra(n * 2501, nx, index(0, s));
	for (long long i = 1; i < n; i++) {
		long long x = LLONG_MAX;
		for (long long j = 0; j <= 2500; j++) {
			x = std::min(x, ans[index(i, j)]);
		}
		std::cout << x << std::endl;
	}
}


Measured memory_bytes: 57416
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);    
    String str = scan.next();
    scan.close();

    String[] split = str.split("");
    
    if(split[2].equals(split[3]) && split[4].equals(split[5])) {
      System.out.println("Yes");
    }else {
      System.out.println("No");
    }
    
  }
}


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

int main(){
    int k;
    string s;
    cin >> k >> s;
    if (s.size() <= k){
        cout << s << endl;
        return 0;
    }else{
        for (int i = 0; i < k; i++){
            cout << s[i];
        }
    }
    cout << "..." << endl;
}

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

int main() {
  string s, t;
  cin >> s >> t;
  int n = s.size();
  if(n == 1){
    cout << "Yes" << endl;
    return 0;
  }
  //文字列sについてどのアルファベットが初めて何文字目に出てきてたかを管理するvector
  vector<int> alpha_s(26, -1);
  //文字列tについてどのアルファベットが初めて何文字目に出てきてたかを管理するvector
  vector<int> alpha_t(26, -1);
  vector<vector<int>> compose_s(n);
  vector<vector<int>> compose_t(n);
  rep(i, n){
    int s_i = s[i] - 'a';
    int t_i = t[i] - 'a';
    if(alpha_s[s_i] == -1){
      alpha_s[s_i] = i;
    }
    if(alpha_t[t_i] == -1){
      alpha_t[t_i] = i;
    }
    compose_s[alpha_s[s_i]].push_back(i);
    compose_t[alpha_t[t_i]].push_back(i);
  }
  if(compose_s == compose_t){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 15276
x, y = map(int, input().split())
mod = 10**9 + 7
if (x + y) % 3 != 0:
    print(0)
    exit()
n = (x + y) // 3
a = (2 * y - x) // 3
b = (2 * x - y) // 3
if a == 0 or b == 0:
    print(1)
    exit()
if a < 0 or b < 0:
    print(0)
    exit()
MAX = 700000
fac = [1, 1] + [0] * MAX
finv = [1, 1] + [0] * MAX
inv = [0, 1] + [0] * MAX
for i in range(2, MAX):
    fac[i] = fac[i - 1] * i % mod
    inv[i] = -inv[mod % i] * (mod // i) % mod
    finv[i] = finv[i - 1] * inv[i] % mod


def nCr(n, r):
    if n < r:
        return 0
    if n < 0 or r < 0:
        return 0
    return fac[n] * (finv[r] * finv[n - r] % mod) % mod


print(nCr(n, a))


Measured memory_bytes: 91540
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author NikuKyabe
 */

#include "bits/stdc++.h"

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


class BCakesAndDonuts {
public:
    void solve(std::istream &in, std::ostream &out) {
      int n;
      in >> n;
      REP(i, 30) REP(j, 20) {
          if (n == 4 * i + 7 * j) {
            out << "Yes" << endl;
            return;
          }
        }
      out << "No" << endl;
    }
};


signed main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout << fixed;
  BCakesAndDonuts solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}


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

using namespace std;
int main(){
int n,s;
cin>>n>>s;
vector<pair<int,int>> v;
for(int i=0;i<n;i++)
{
    int a,b;
    cin>>a>>b;
    v.push_back({a,-1});
    v.push_back({b,-2});
}
sort(v.begin(),v.end());
int ans=0;
long long sm=0;
for(int i=v.size()-1;i>=0;i--)
{
if(sm>=s)
break;
int a=v[i].first,b=v[i].second;
if(b==-2)
{
    sm+=a;
    ans++;
}
else
{
    while(sm<s)
    {
        sm+=a;
        ans++;
    }
}
}
if(sm<s)
{
    for(int i=v.size()-1;i>=0;i--)
    {
        int a=v[i].first,b=v[i].second;
        if(b==-1)
        {
           while(sm<s)
    {
        sm+=a;
        ans++;
    }
    break; 
        }
    }
}
cout<<ans;
return 0;

}
 


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

public class Main{
  
  public static void main(String[] args) {

        Scanner s = new Scanner(new BufferedInputStream(System.in));
        int n = s.nextInt();
        int k = s.nextInt();
        int[] nums = new int[n];
        int[] dp = new int[n];

        for (int i = 0;i < n;i++) {
            nums[i] = s.nextInt();
        }

        dp[0] = 0;
        for (int i = 1;i < n;i++) {
            for (int j= 1;j <= k ;j++) {
                if (i -j < 0) break;
                if (j != 1 && i-j>=0) {
                    dp[i] = Math.min(dp[i],dp[i-j] + Math.abs(nums[i]-nums[i-j]));
                }else
                    dp[i] = dp[i-1] + Math.abs(nums[i]-nums[i-1]);
            }
        }

        System.out.println(dp[n-1]);
    } 
  
  
  
}

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

using namespace std;

bool is_odd(int x) {
  return x % 2 == 1;
}

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  
  if (a == b && b == c) {
    if (a % 2 == 0) puts("-1");
    else puts("0");
    return 0;
  }
  int ans = 0;
  while (!is_odd(a) &&!is_odd(b) && !is_odd(c) ) {
    int a_ = b / 2 + c / 2;
    int b_ = a / 2 + c / 2;
    int c_ = a / 2 + b / 2;
    a = a_;
    b = b_;
    c = c_;
    ans++;
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(x) x.begin(), x.end()
#define pb(x) push_back(x)
#define INF 1000000000000000000
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define x first 
#define y second
const int maxx = 1000006;
const int maxlog = 20;
const ll mod = 1000000007;
int arr[maxx];

int main() {
    IOS
    ll a, b;
    cin >> a >> b;
    ll g = __gcd(a, b);
    vector<ll> v;
    for (ll i = 2; i * i <= g; i++) {
        if (g % i == 0) {
            while (g % i == 0) g /= i;
            v.pb(i);
        }
    }
    if (g > 1) v.pb(g); 
    ll count = 0;
    count = v.size();
    cout << count + 1;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using static System.Console;
using static ConsoleApp.Util;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            //dpテーブル [i,w]i-1番までの物品を選択し、重さがw以内で得られる価値の最大値
            long[,] dp = new long[110,100010];
            long W = 0;
            long[] ws = new long[110];
            long[] vs = new long[110];

            var a = ReadLine().Split(' ');
            long n = long.Parse(a[0]);
            W = long.Parse(a[1]);

            for(int i = 0;i < n;i++){
                a = ReadLine().Split(' ');
                ws[i] = long.Parse(a[0]);
                vs[i] = long.Parse(a[1]);
            }

            for(int i = 0;i < n;i++){
                for(int sumw = 0;sumw <= W;sumw++){
                    //重さが範囲内で収まるとき
                    if(sumw - ws[i] >= 0){
                        //i番のアイテムを入れるパターン
                        ChMax(ref dp[i+1,sumw],dp[i,sumw-ws[i]] + vs[i]);
                    }

                    ChMax(ref dp[i+1,sumw],dp[i,sumw]);
                }
                
            }

            WriteLine(dp[n,W]);
        }
    }


    static class Util{
        public static void ChMin(ref long a,long b){
            
            if(a > b){
                a = b;
            }
        }

        public static void ChMax(ref long a,long b){
            if(a < b){
                a = b;
            }
        }
    }
}


Measured memory_bytes: 92000
#include<cstdio>
#include<algorithm>
#include<set>
using namespace std;
int main()
{
	int n,t;
	set<int> a;
	scanf("%d", &n);
	while (n--)
	{
		scanf("%d", &t);
		a.insert(t);
	}
	printf("%d", a.size());
	return 0;
}

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


int main() {
  int  K;
  int count=0;
  cin>> K;
  K++;
  for(int i=1; i<K; i++){
    for(int j=1; j<K; j++){
      for(int k=1; k<K; k++){
        count+=gcd(i,gcd(j,k));
          
        }
      }
    }
  cout<<count<<endl;
            
  
}


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


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> l(4000);
	for (int i = 1; i <= n;++i) cin >> l[i];
	vector<int> v(n);
	rep(i, n) v[i] = l[i + 1];
	sort(v.begin(), v.end());
	int ans = 0;
	for (int i = n - 1; i >= 0; --i) {
		for (int j = i - 1; j >= 0; --j) {
			auto itr = lower_bound(v.begin(), v.end(), v[i] + v[j]);
			int ng = distance(itr, v.end());
			ans += (n - 1 - i) - ng;
			//cout << ans << ' ' << i << ' ' << ng << ' ';
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import numpy as np
N,C,K = map(int, input().split())

Ts = []
for i in range(N):
  Ts.append(int(input()))
Ts = np.array(Ts)

Ts = np.sort(Ts)

ans = 1
t0 = None
for t in Ts:
  if t0 is None:
    t0 = t
    count = 1
  else:
    count += 1
    if (t<=t0+K)&(count<=C):
      pass
    else:
      ans += 1
      t0 = t
      count = 1
print(ans)

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

int main(){
  int n;
  double t;
  cin>>n>>t;
  double a[n];
  for(int i=0;i<n;i++){
    double x,h;
    cin>>x>>h;
    a[i]=h/x;
    if(a[i]>=a[0]){
      a[0]=a[i];
    }
  }
  
  printf("%lf", a[0]*t);
  
  return 0;
}
   
 
      
 
  
   
  
	
	  
	  
	  
	  
	  
	  
     
  
  
  
  
  

  

 
  


 

    
  



Measured memory_bytes: 3284
#include <bits/stdc++.h>
using namespace std;
#define INF 1<<30
#define endl '\n'
#define maxn 100005
#define tc printf("Case %d: ", cs)
#define tcn printf("Case %d:\n", cs);
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
typedef long long ll;
const double PI = acos(-1.0);
#define dbg(x) cerr << #x << " = " << x << endl;
#define dbg2(x, y) cerr << #x << " = " << x << ", " << #y << " = " << y << endl;
#define dbg3(x, y, z) cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;
#define dbg4(w,x, y, z) cerr << #w << " = " << w << ", " <<#x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;


int main()
{
    FASTIO
    /*
    //double start_time = clock();
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif
//*/
    int T;
    //cin >> T;
    T = 1;
    for (int cs = 1; cs <= T; cs++) {
        string s, t;
        cin >> s >> t;
        int ans = (s[0] == t[0]) + (s[1] == t[1]) + (s[2] == t[2]);
        cout << ans << endl;
    }

    //double end_time = clock();
    //printf( "Time = %lf ms\n", ( (end_time - start_time) / CLOCKS_PER_SEC)*1000);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;
 
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;

int N;
vector<int> G[100010];
bool used[100010];
int col[100010];
queue< pair<int,int> > que;

void bfs() {
    while(que.size() != 0) {
        int v = que.front().first;
        int c = que.front().second;
        que.pop();
        if(used[v]) continue;
        used[v] = true;
        col[v] = c;
        REP(i,G[v].size()) {
            que.push(make_pair(G[v][i],c));
        }
    }
}

int main() {

    cin >> N;

    REP(i,N-1) {
        int a,b; cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    REP(i,100010) used[i] = false;
    que.push(make_pair(1,0));
    que.push(make_pair(N,1));
    bfs();

    int cnt1 = 0, cnt2 = 0;
    for(int i=1; i<=N; i++) {
        if(col[i] == 0) cnt1++;
        else cnt2++;
    }

    if(cnt1 > cnt2) cout << "Fennec" << endl;
    else cout << "Snuke" << endl;
    
    return 0;
}

Measured memory_bytes: 6656
const main = (inputs) => {
  var N = inputs[0]-0;
  var list = inputs[1].split(" ").map(v=>v-0);
  var ans = 0;
  for(var i=1;i<N-1;i++){
    var n = list[i];
    var srt = [list[i-1], list[i], list[i+1]].sort((a,b)=>a-b);
    if(n == srt[1]) ans++;
  }
  console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8').trim().split("\n"));


Measured memory_bytes: 7372
#include "bits/stdc++.h"
using namespace std;
#define long int64_t

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

	int N;
	cin >> N;

	map<int, int> m;
	for( int i = 0; i < N; ++i ) {
		int a;
		cin >> a;
		m[a] += 1;
	}

	long ans = 0;
	for( auto v: m ) {
		if( v.first <= v.second ) {
			ans += v.second - v.first;
		}
		else {
			ans += v.second;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 4736
#include<bits/stdc++.h>
using namespace std;
typedef long long ll ;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vi;
typedef vector<pll> vpll;
#define loop(i,a,b) for(ll i=a ;i<b;i++)
#define For(i,n) for(int i=0;i<(ll)n;i++)
#define Rev(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,n) for(int i=1;i<=n;++i)
#define F first
#define S second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define mems(x, y) memset(x, y, sizeof(x))
#define sz(v) (v).size()
#define mp(a,b) make_pair(a,b)
#define pf(n) cout<<n<<endl;
#define pff(n) cout <<n<<" ";
long const M=1000000007;
long const mxN=1e5+2 ;
void solve(){
  int k,a,b ; cin >> k >>a  >>  b ;
  for(int i=a;i<=b;i++){
    if(i%k==0){
      pf("OK") ;
      return ;
    }
  }
  pf("NG") ;
  
     
}
int main() {
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     solve() ;
     //ll t ;cin >> t ;while(t--)solve();
	return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i,N){
        cin >> A[i];
    }
    vector<Pll> B(N);
    rep(i,N){
        B[i] = Pll(A[i],i);
    }
    sort(B.begin(), B.end());
    ll ans = 0;
    rep(i,N){
        if(B[i].se%2 != i%2) ans++;
    }
    cout << ans/2 << endl;
}

Measured memory_bytes: 5632
#include<bits/stdc++.h>
#define inf 200000000000000000ll
#define eb emplace_back
#define pb push_back
#define fi first
#define se second
#define fastio ios::sync_with_stdio(false);cin.tie(NULL)
#define rng_23 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
typedef vector<ll> vi;
typedef vector<pair<ll,ll>> vii;
typedef set<ll> si;
typedef multiset<ll> msi;
typedef map<ll,ll> mii;
ll ara[100001],cnt[100001],hcnt[100001],ans[100001];
int main()
{
    ll i,j,k;
    ll n;
    scanf("%lld",&n);
    for(i=0;i<=n;i++){
        scanf("%lld",&ara[i]);
        cnt[i]=ara[i];
    }
    for(i=n;i>=0;i--){
        if(log2((double)cnt[i])>(double)i){
            printf("-1");
            return 0;
        }
        cnt[i-1]+=(cnt[i]+1)/2;
    }
    for(i=1,hcnt[0]=1;i<=n;i++){
        hcnt[i]=min(2ll*(hcnt[i-1]-ara[i-1]),inf);
        //cout<<hcnt[i]<<endl;
    }
    ll res=ara[n];
    for(i=n-1,ans[n]=ara[n];i>=0;i--){
        ans[i]=min(ans[i+1]+ara[i],hcnt[i]);
        res+=ans[i];
    }
    printf("%lld",res);
}


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

public class Main {

    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int ans = 0;
        for(int i=0; i<4; i++){
            int input = sc.nextInt();
            ans += input;
        }
        out.println(ans);
        out.flush();

    }

    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

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

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

    }
}


Measured memory_bytes: 24320