akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
	int n, k, i, j, num,cardsize, cnt, max, break_up;
	bool jk_flg;
	while(true){
		cin>>n>>k; if(n==0 && k==0)break;
		vector<bool> card(n+2, false);//+joker+end
		for(i=0;i<k;i++){
			cin>>num;
			card[num] = true;
		}
		max=0;
		i=1;
		cardsize=card.size() - 2;//=n
		while(i<cardsize){
			jk_flg = card[0];//joker
			cnt=0;
			if(card[i]==true){
				j=i;
				break_up=0;
				while(true){
					if(card[j]==true){
					}else if(jk_flg==true){
						break_up=j;
						jk_flg=false;
					}else{
						break;
					}
					cnt++;
					//cout<<"cnt="<<cnt<<"j="<<j<<endl;
					j++;
				}
				if(max<cnt) max=cnt;
				if(break_up==0) break_up=j;
				for(i=break_up; card[i]==false&&i<=cardsize; i++);
			}
			for( ; card[i]==false&&i<=cardsize; i++);
		}
		cout<<max<<endl;
	}
	return 0;
}

Measured memory_bytes: 1208
object Main {
  def main(args: Array[String]) {
      val factor = scala.io.StdIn.readLine
      var num_hund = factor(0).toString.toInt

      if( factor(0).toInt < factor(1).toInt ||
         (factor(0).toInt == factor(1).toInt && factor(1).toInt < factor(2).toInt)
        ) {
        num_hund += 1
      }
      else {}

      println(num_hund*111)
  }
}


Measured memory_bytes: 25420
#include<bits/stdc++.h>
#include<cmath>
#define SZ(x) ((int)x.size())
#include<vector>
#include<set>
#include<map>
#define ll long long
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#include<string>
#include<cctype>
#include<queue>
#define ii pair<int,int>
#include <sstream>
#define lli long long int
#define pairs pair<int,int>
#define mod 1000000007
const double PI = 3.141592653589793238460;
typedef std::complex<double> Complex;
typedef std::valarray<Complex> CArray;
using namespace std;
ll pows(ll a,ll n,ll m)
{
	ll res=1;
	while(n)
	{
	if(n%2!=0)
	{
		res=(res*a)%m;
		n--;
		}
		else
		{
			a=(a*a)%m;
			n=n/2;
			}	
	}
	return res%m;
}
ll  gcd(ll a,ll b)
{
	if(b==0)
	return a;
	else 
	return gcd(b,a%b);
}
bool isprime(ll n)
{
	if(n==1)
	{
		return false;
	}
	for(ll i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			return false;
		}
	}
	return true;
}
bool istrue(string s)
{
	int i=0;
	int j=s.size()-1;
	while(i<j)
	{
	if(s[i]==s[j])
	{
		i++;
		j--;
		}
		else
		{
			return false;
			}	
	}
	return true;
}
char ar[7][7];
int h,w,k;
bool check(int p,int q)
{
	int cnt=0;
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			  if(p & (1 << i) && q & (1 << j))
			  {
        if(ar[i][j] == '#')
          cnt++;
			}
		}
	}
	return cnt==k;
}
int main()
{
   ios::sync_with_stdio(false);
	 cin.tie(0);
    cout.tie(0);

cin>>h>>w>>k;
for(int i=0;i<h;i++)
{
	for(int j=0;j<w;j++)
	{
		cin>>ar[i][j];
	}
}
int ans=0;
for(int r=0;r<(1<<h);r++)
{
	for(int c=0;c<(1<<w);c++)
	{
	bool x=check(r,c);
	if(x==true)
	{
		ans++;
		}	
	}
}
cout<<ans<<endl;
}



Measured memory_bytes: 3660
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DIVERTA2019D
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());
            long sum = 0;

            long m1 = n - 1;
            long div = 1;

            while (m1 > 1)
            {
                long r, p;
                r = Math.DivRem(n, m1, out p);

                if (p >= r)
                {
                    if (r == p)
                    {
                        //Console.WriteLine(m1);
                        sum += m1;
                    }

                    div++;
                    m1 = n / div - 1;
                }
                else if (r > div)
                {
                    div = r;
                }
                else
                {
                    m1--;
                }
            }

            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



signed main(){
cin.tie(0);
ios::sync_with_stdio(false);

	int n;
	cin >> n;
	
	int ans = LLINF;

	for(int i=1 ; i*i<=n ; ++i)
	{
		int a, b;
		int cnt = 1, tmp = 1;
		if(n%i == 0)
		{
			a = i;
			b = n / i;
			while (a / 10) {
				a /= 10;
				cnt++;
			}
			while (b / 10) {
				b /= 10;
				tmp++;
			}
			ans = min(ans, max(cnt, tmp));
			
		}
	}

	cout << ans << endl;

	return 0;
}



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

#define ll long long int

void test(vector<int> &arr){
	ll dp[arr.size()][arr.size()];
	memset(dp, 0, sizeof(dp));
	ll temp;
	for(int i = arr.size()-1; i >= 0; i--){
		for(int j  = i + 1; j < arr.size(); j++){
			temp = 0;
			dp[i][j] = LLONG_MAX;
			for(int k = i; k <= j; k++){
				temp+=arr[k];
			}
			for(int k = i; k < j; k++){
				dp[i][j] = min(temp + dp[i][k] + dp[k+1][j], dp[i][j]);
			}
		}
	}
	cout << dp[0][arr.size()-1];
}

int main(){
	#ifndef ONLINE_JUDGE
	freopen("/home/afzalrao/Desktop/Academics/2nd Year/3rd Sem/ESO207/CP/Text Files/input.txt", "r", stdin);
	freopen("/home/afzalrao/Desktop/Academics/2nd Year/3rd Sem/ESO207/CP/Text Files/output.txt", "w", stdout);
	#endif
	int n;
	cin >> n;
	vector<int> arr(n);
	for(int i = 0; i < n; i++){
		 cin >> arr[i];
	}
	test(arr);
	return 0;
}

Measured memory_bytes: 4884
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
#include <queue>
#include <algorithm>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define pb push_back
#define rng(x) x.begin(),x.end()
#define fi first
#define se second
#define sz(x) int(x.size())
// #define double long double
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,int> DP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;

const int INF = 1001001001;

const double eps = 1e-8;

struct V {
  double x, y;
  V(double x=0, double y=0):x(x),y(y){}
  V operator+(V t) { return V(x+t.x,y+t.y);}
  V operator-(V t) { return V(x-t.x,y-t.y);}
  V operator*(double t) { return V(x*t,y*t);}
  double dot(V t) { return x*t.x+y*t.y;}
  double cross(V t) { return x*t.y-y*t.x;}
  double norm2() { return x*x+y*y;}
  double norm() { return sqrt(x*x+y*y);}
};

struct Line {
  V s, t;
  Line(){}
  Line(V s, V t):s(s),t(t){}
  V dir() { return t-s;}
  V rev() { return s-t;}
  double distLP(V p) { return abs(dir().cross(p-s)/dir().norm());}
  double distSP(V p) {
    if (dir().dot(p-s) < eps) return (p-s).norm();
    if (rev().dot(p-t) < eps) return (p-t).norm();
    return distLP(p);
  }
  V proj(V p) {
    double a = (p-s).dot(dir())/dir().norm2();
    return s+dir()*a;
  }
};

bool same(double x, double y) {
  return abs(x-y)<eps;
}

int main() {
  int n, m;
  scanf("%d%d",&n,&m);
  V a;
  scanf("%lf%lf",&a.x,&a.y);
  vector<V> p(n);
  rep(i,n) scanf("%lf%lf",&p[i].x,&p[i].y);
  vi used(n);
  vector<double> dist(n);
  rep(i,n) {
    dist[i] = (p[i]-a).norm();
  }
  double ans = 0;
  rep(mi,m) {
    DP b(INF,0);
    rep(i,n) {
      if (!used[i]) {
        if (same(dist[i],b.fi)) {
          // b.se = min(b.se,i);
        } else if (dist[i] < b.fi) {
          b = DP(dist[i],i);
        }
      }
    }
    // cout<<b.fi<<" "<<b.se<<endl;
    int v = b.se;
    b = DP((p[v]-a).norm(),-1);
    rep(i,n) if (used[i]) {
      double d = (p[i]-p[v]).norm();
      if (same(b.fi,d)) continue;
      if (d < b.fi) b = DP(d,i);
    }
    used[v] = 1;
    Line l;
    if (b.se == -1) {
      l = Line(a,p[v]);
    } else l = Line(p[b.se],p[v]);
    rep(i,n) if (!used[i]) {
      dist[i] = min(dist[i], l.distSP(p[i]));
      // dist[i] = min(dist[i], (l.proj(p[i])-p[i]).norm());
    }
    ans += l.dir().norm();
  }
  printf("%.10f\n",ans);
  return 0;
}

Measured memory_bytes: 3328
using System;
using System.Collections.Generic;
using static Assistant.Input;
using static Assistant.Debug;
using System.Linq;
using Assistant;

namespace ABC162B
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = RInt;

            long ans = 0;
            for (int i = 1; i <= N; i++)
            {
                if (i % 3 == 0 || i % 5 == 0) continue;
                ans += i;
            }

            Console.WriteLine(ans);
        }


    }


}

namespace Assistant
{
    static class Input
    {
        static List<string> line = new List<string>();
        static int index = 0;
        static String RNext()
        {
            if (line.Count <= index) line.AddRange(Console.ReadLine().Split());
            return line[index++];
        }
        public static int RInt => int.Parse(RNext());
        public static long RLong => long.Parse(RNext());
        public static int[] RInts => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static long[] RLongs => Console.ReadLine().Split().Select(long.Parse).ToArray();
        public static string RString => RNext();
        //以下未テスト
        public static int[] RIntsC(int c) => Enumerable.Repeat(0, c).Select(x => int.Parse(RNext())).ToArray();
        public static long[] RLongsC(int c) => Enumerable.Repeat(0, c).Select(x => long.Parse(RNext())).ToArray();
        public static char[][] RMap(int h) => Enumerable.Repeat(0, h).Select(x => Console.ReadLine().ToCharArray()).ToArray();
    }

    static class Debug
    {
        static public void Draw2D<T>(T[,] map, int mode = 1)
        {
#if DEBUG
            int W = map.GetLength(0);
            int H = map.GetLength(1);

            T[,] map2 = new T[W + 1, H + 1];
            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (i == 0 && j == 0) map2[i, j] = (T)(object)0;
                    else if (i == 0) map2[i, j] = (T)(object)(j - 1);
                    else if (j == 0) map2[i, j] = (T)(object)(i - 1);
                    else map2[i, j] = map[i - 1, j - 1];
                }
            }

            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (mode == 0) Console.Write((dynamic)map2[i, j] % 10);
                    if (mode == 1) Console.Write(map2[i, j] + " ");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
#endif
        }

        public static void Draw1D(int[] array, int mode = 0)
        {
#if DEBUG
            Console.WriteLine(string.Join(" ", array));
#endif
        }
    }
}


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

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ALL(a) (a).begin(),(a).end()
#define DEBUG(a) "(" << #a << ": " << (a) << ")"

template<typename T>
void chmin(T &x, T y) { x = min(x, y); }

template<typename T>
void chmax(T &x, T y) { x = max(x, y); }

typedef long long int lli;
typedef long double ld;
typedef tuple<double,double,double> Tr;

const int INF = INT_MAX/2 - 1;
const double EPS = 1e-14;
const int dx[4] = {0, 1, 0, -1}; // {-1,  0,  1, -1, 1, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0}; // {-1, -1, -1,  0, 0,  1, 1, 1};

double dist(Tr a, Tr b) {
  double x = get<0>(a) - get<0>(b),
         y = get<1>(a) - get<1>(b),
         z = get<2>(a) - get<2>(b);
  return x * x + y * y + z * z;
}

vector<vector<double>> calc(vector<Tr> colors) {
  int N = colors.size();
  vector<vector<double>> val(N, vector<double>(N));
  REP(i, N) REP(j, N) {
    val[i][j] = dist(colors[i], colors[j]);
  }
  return val;
}

int main() {
  cout << fixed << setprecision(10);
  int N, M;
  while (cin >> N >> M and N) {
    vector<Tr> c(N);
    for (Tr &t : c) {
      cin >> get<0>(t) >> get<1>(t) >> get<2>(t);
    }
    vector<vector<double>> table = calc(c);

    vector<int> use(N);
    REP(i, M) use[i] = 1;
    sort(ALL(use));
    double ans = 0;
    do {
      double sum = 0;
      for(int i = 0; i < N - 1; ++i) for (int j = i + 1; j < N; ++j) {
        if (use[i] and use[j])
          sum += table[i][j];
      }
      chmax(ans, sum);
    } while (next_permutation(ALL(use)));
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3280
import sys
readline = sys.stdin.buffer.readline
n,k = map(int,readline().split())

lst1 = list(readline().rstrip().decode('utf-8').split())
i = n
while True:
    flag = 0
    for j in lst1:
        if j in str(i):
            i += 1
            flag = 1
            break
    if not flag:
        print(i)
        break

Measured memory_bytes: 42224
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

template<typename T>
class CumulativeSum {
	vector<T> a;
	public:
	CumulativeSum(vector<T>& x) : a(x.size() + 1,0) {
		rep(i,x.size()){
			a[i + 1] = a[i] + x[i];
		}
	}
	T get(int l, int r){ // [l, r]の区間の合計を求める
		return a[r + 1] - a[l];
	}
	T operator [] (const int i) const {
		return a[i];
	}
};

int main(){
	int n;
	while(cin >> n,n){
		vector<int> a(1000);
		iota(all(a), 1);

		CumulativeSum<int> c(a);

		int cnt = 0;
		rep(i,n){
			range(j,i + 1,n){
				if(c.get(i, j) == n) cnt++;
			}
		}
		cout << cnt << endl;
	}
}



Measured memory_bytes: 3100
#include<stdio.h>
int main()
{
    int m,f,r;
    while(1)
    {
        scanf("%d %d %d",&m,&f,&r);
        if(m==-1 && f==-1 && r==-1)
        {
            break;
        }
        if( m==-1 || f==-1)
        {
            printf("F\n");
        }
        else
        {
            if(m+f>=80)
            {
                printf("A\n");
            }
            else if(m+f>=65 && m+f<80)
            {
                printf("B\n");
            }
            else if(m+f>=50 && m+f<65)
            {
                printf("C\n");
            }
            else if(m+f>=30 && m+f<50)
            {
                if(r>=50)
                {
                    printf("C\n");
                }
                else
                {
                    printf("D\n");
                }
            }
            else
            {
                printf("F\n");
            }
        }
    }
    return 0;
}



Measured memory_bytes: 2040
void 
solve();

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

//////////////////////////////////////////////////
//////////////////////////////////////////////////
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;

int N;
vector<int> A;
vector<int> times;
vector<int> X, Y;

void solve() {
	cin >> N;
	A.resize(N);
	for (int n = 0; n < N; n++)cin >> A[n];
	sort(A.begin(), A.end());
	times.resize(N,1);
	if (A[0] >= 0) {
		times[0] = -1;
	}
	else if (A[N - 1] < 0) {
		for (int n = 1; n < N; n++)times[n] = -1;
		int temp = A[N - 1];
		for (int n = N - 2; n >= 0; n--)A[n + 1] = A[n];
		A[0] = temp;
	}
	else {
		for (int n = 0; n < N; n++) {
			if (A[n] < 0)times[n] = -1;
		}
		int tempa = A[N - 1];
		int temptimes = times[N - 1];
		for (int n = N - 2; n >= 0; n--) {
			A[n + 1] = A[n];
			times[n + 1] = times[n];
		}
		A[0] = tempa;
		times[0] = temptimes;
	}
	int sum = 0;
	for (int n = 0; n < N; n++)sum += times[n] * A[n];
	cout << sum << endl;
	X.resize(N - 1);
	Y.resize(N - 1);
	int flag = 1;
	for (int n = N - 2; n >= 0; n--) {
		if (times[n + 1] * flag == 1) {
			X[n] = A[n+1];
			Y[n] = X[n] - sum;
			sum = X[n] - sum;
			flag *= -1;
		}
		else {
			Y[n] = A[n + 1];
			X[n] = Y[n] + sum;
			sum = sum + Y[n];
		}
	}
	for (int n = 0; n < N - 1; n++)cout << X[n] << " " << Y[n] << endl;
	return;
}

Measured memory_bytes: 3456
#include <iostream>
using namespace std;
int hit(int a[],int b[]);
int blow(int a[], int b[]);
int main(){
    int a[4];
    int b[4];
    while (cin >> a[0] >> a[1] >> a[2] >> a[3]){
        if (cin.eof()){break;}
        cin >> b[0] >> b[1] >> b[2] >> b[3];
        int hi = hit(a,b);
        int bl = blow(a,b);
        cout << hi << " " << bl << endl;
    }
}

int hit(int a[],int b[]){
    int n=0;
    for (int i=0; i<4;i++){
        if (a[i]==b[i])
            n++;
    }
    return n;
}

int blow(int a[], int b[]){
    int n=0;
    for (int i=0; i<4; i++){
        for (int j=0; j<4; j++){
            if (a[i]==b[j])
                n++;
        }
    }
    n -= hit(a,b);
    return n;
}

Measured memory_bytes: 1160
#include <stdio.h>

int main(void){
    int n,x;
    int i,j,k;
    int a=0;
    while(1){
        fscanf(stdin,"%d",&n);
        fscanf(stdin,"%d",&x);
        if(n == 0 && x == 0){
            break;
        } 
        for(i=1;i<=n-2;i++){
            for(j=i+1;j<=n-1;j++){
                for(k=j+1;k<=n;k++){
                    if(i+j+k == x){
                        a++;
                    }
                }
            }
        }
        printf("%d\n",a);
        a=0;
    }
    return 0;
}

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

template<class T>
T pow(T a, int b){
    if(b == 0) return 1;
    if(b%2){
        T ret = pow(a,(b-1)/2); 
        return ret*ret*a;
    }else{
        T ret = pow(a,b/2);
        return ret*ret;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
     
    ll x; cin >> x;
    for(ll a = 0LL; a <= 10000; ++a){
        for(ll b = -10000; b <= a; ++b){
            if(pow(a,5) - pow(b,5) == x){
                cout << a << " " << b << endl;
                return 0;
            }
        }
    }
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  vector<ll> cum(n+1,0);
  rep(i,n) cum[i+1] = cum[i] + a[i];
  vector<vector<ll>> dp(n+1,vector<ll>(n+1,-1));

  auto calc = [&](auto &&f, int l, int r)->ll{
    if (dp[l][r] >= 0) return dp[l][r];
    if (l == r) return 0LL;
    ll res = 1e18;
    for (int i = l; i < r; i++) {
      res = min(res, f(f,l,i) + f(f,i+1,r));
    }  
    return dp[l][r] = res + cum[r] - cum[l-1];                         
  };
  cout << calc(calc,1,n) << endl;
  return 0;
} 

Measured memory_bytes: 1536
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
using namespace std;


int main () {
	string s;
	cin >> s;
	int res = 0;
	int ans = 0;
	for (auto ss : s) {
		if (ss == 'A' || ss == 'C' || ss == 'G' || ss == 'T') {
			res++;
			ans = max(ans, res);
		}
		else
			res = 0;
	}
	cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>                        
#define pb push_back                            
#define mp make_pair                            
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)((x).size())
#define jonathan ios_base::sync_with_stdio(0)
#define livingston cin.tie(0)
using namespace std;                            
                                                
void yes() {cout << "YES" << endl;}                                               
void no() {cout << "NO" << endl;}                                                        
                                                
int dx[] = {1, 0, -1, 0, -1, -1, 1, 1};         
int dy[] = {0, 1, 0, -1, -1, 1, -1, 1}; 

const int INF = 1e9 + 9;
const long long LINF = 1e18 + 8;
const double EPS = 1e-9;
const long long MOD = 998244353;
const double PI = acos(-1);

vector<int> g[2020];

void solve() {
    int n, k; cin >> n >> k;
    for (int i = 0; i < n - 1; i++) {
        int u, v; cin >> u >> v;
        g[u].pb(v);
        g[v].pb(u);
    }
    int res = n;
    for (int i = 1; i <= n; i++) {
        queue<int> q;
        vector<int> d(n + 1, INF);
        d[i] = 0;
        q.push(i);
        while (!q.empty()) {
            int v = q.front();
            q.pop();
            for (int i = 0; i < sz(g[v]); i++) {
                int to = g[v][i];
                if (d[to] > d[v] + 1) {
                    d[to] = d[v] + 1;
                    q.push(to);
                }
            }
        }
        int cnt = 0;
        for (int i = 1; i <= n; i++) {
            if (d[i] > k / 2) cnt++;
        }
        res = min(res, cnt);
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < sz(g[i]); j++) {
            int u = i, v = g[i][j];
            queue<int> q;
            vector<int> d(n + 1, INF);
            d[u] = 0; d[v] = 0;
            q.push(u); q.push(v);
            while (!q.empty()) {
                int v = q.front();
                q.pop();
                for (int i = 0; i < sz(g[v]); i++) {
                    int to = g[v][i];
                    if (d[to] > d[v] + 1) {
                        d[to] = d[v] + 1;
                        q.push(to);
                    }
                }
            }
            int cnt = 0;
            for (int i = 1; i <= n; i++) {
                if (d[i] > (k - 1) / 2) cnt++;
            }
            res = min(res, cnt);
        }
    }
    cout << res << endl;
} 

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

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

int main() {
  int N;
  cin >> N;
  
  int total = 0;
  int cN = N;
  for(int i=0; i<8; i++){
    int f = cN % 10;
    total += f;
    cN = (cN - f) / 10;
  }
  cout << (N % total == 0 ? "Yes" : "No") << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    long int n, i, A[10000], min=1000000, max=-1000000, sum=0;
    scanf("%ld", &n);

    for(i=0; i<n; i++){
        scanf("%ld", &A[i]);
        if(A[i]>max){max=A[i];}
        if(A[i]<min){min=A[i];}
        sum = sum+A[i];
    }
    printf("%ld %ld %ld\n", min, max, sum);

    return 0;
}

Measured memory_bytes: 680
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <climits> 
#include <assert.h>
#include <random>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------

// int dp[1000][1000];

// bool f(int i,int j){
//   if(dp[i][j] != -1) return dp[i][j];
//   for(int k=1; 2*k<=i; k++) if(f(i-k*2,j+k) == 0) return dp[i][j] = 1;
//   for(int k=1; 2*k<=j; k++) if(f(i+k,j-k*2) == 0) return dp[i][j] = 1;
//   return dp[i][j] = 0;
// }

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  // rep(i,1000)rep(j,1000) dp[i][j] = -1;
  // for(int i=0; i<30; i++){
  //   for(int j=0; j<30; j++){
  //     cout << f(i,j) << " \n"[j+1==30];
  //   }
  // }
  ll X,Y;
  cin >> X >> Y;
  if(abs(X-Y) <= 1){
    cout << "Brown\n";
  }else{
    cout << "Alice\n";
  }
  return 0;
}

Measured memory_bytes: 3636
#include <cstring>
#include <iostream>
#include <string>
using namespace std;
int main() {
    string n;
    cin >> n;
    if (strchr("24579", n.back()))
        cout << "hon\n";
    else if (strchr("0168", n.back()))
        cout << "pon\n";
    else
        cout << "bon";
    return 0;
}


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

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

using namespace std;

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

	vector<int> cnt(n);
	rep(i,n){
		int a; cin>>a; a--;
		cnt[a]++;
	}
	sort(cnt.rbegin(),cnt.rend());

	int ans=0;
	rep(i,n-k) ans+=cnt[k+i];
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 1024
import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);
//aryread!string();
//auto PS = new Tuple!(long,string)[](M);
//x[]=1;でlong[]全要素1に初期化
void main()
{
    long a, b, c;
    scan(a, b, c);
    writeln(min(a + b, a + c, b + c));
}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}

void arywrite(T)(T a)
{
    a.map!text.join(' ').writeln;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;

bool is_allsame(string t){
    set<char> char_set;
    rep(i, t.size()){
        char_set.insert(t[i]);
    }
    if(char_set.size() == 1) return true;
    else return false;
}

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

    string s;
    cin >> s;
    int n = s.size();


    int res = 1000;

    rep(c, 26){
        int cnt = 0;
        char ch = 'a' + c;
        string t = s;

        while(!is_allsame(t)){
            string t_ = "";
            rep(i, t.size()-1){
                if(t[i]==ch || t[i+1]==ch) t_ += ch;
                else t_ += t[i];
            }
            ++cnt;
            t = t_;
        }
        
        res = min(res, cnt);
    }

        
    cout << res << endl;


    return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}


// Problem Specific Parameter:
const ll mod=1000000007LL;
	
ll power(ll a,ll n){
	ll b=1LL;
	while(n){
		if(n&1) b=b*a%mod;
		a=a*a%mod;
		n>>=1;
	}
	return b;
}

vector<int> fact;
ll num[1500];

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

	for(int i=1;i*i<=n;++i){
		if(n%i) continue;
		fact.emplace_back(i);
		if(i!=n/i) fact.emplace_back(n/i);
	}

	sort(_all(fact));
	const int m=fact.size();

	rep(i,m){
		ll d=fact[i];
		num[i]=power(k,(d+1)/2LL);
		rep(j,i){
			if(d%fact[j]) continue;
			num[i]+=mod-num[j];
			num[i]%=mod;
		}
	}

	ll ans=0LL;
	rep(i,m){
		ll d=fact[i];
		if(d%2)
			ans+=d*num[i]%mod;
		else
			ans+=d/2*num[i]%mod;
		ans%=mod;
	}	

	cout << ans << endl;
	return 0;
}

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

typedef long long lli;
const lli mod = 1000000007LL;

int N, M;
vector<vector<int> > G;
vector<int> vis;

void dfs(int v) {
  vis[v] = true;
  for(int i = 0; i < G[v].size(); ++i) {
    if(vis[G[v][i]]) continue;
    dfs(G[v][i]);
  }
}

lli mod_pow(lli x, lli n) {
  if(n == 0) return 1;
  lli y = mod_pow(x, n/2);
  if(n & 1) return y * y % mod * x % mod;
  else return y * y % mod;
}

int main() {
  while(cin >> N >> M && (N|M)) {
    G = vector<vector<int> >(N);
    for(int i = 0; i < M; ++i) {
      int a, b;
      cin >> a >> b;
      --a; --b;
      G[a].push_back(b);
      G[b].push_back(a);
    }
    lli n_cmp = 0;
    vis = vector<int>(N);
    for(int i = 0; i < N; ++i) {
      if(vis[i]) continue;
      ++n_cmp;
      dfs(i);
    }
    cout << (mod_pow(2LL, n_cmp) + (n_cmp != N)) % mod << endl;
  }
  return 0;
}

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

candle=list(map(int,input().split()))

answer=10**9

for i in range(N-K+1):
  left=candle[i]
  right=candle[i+K-1]
  move=max(abs(left),abs(right))
  if left*right<0:
    move+=min(abs(left),abs(right))*2
  answer=min(move,answer)

print(answer)
  

'''
getcandle=0
for i in range(N):
  if candle[i]>=0:
    plusindex=i
    if candle[i]!=0:
      candle.insert(i,0)
    else:
      getcandle+=1
    break;

print(candle)
distance=[]
for i in range(len(candle)-1):
  distance.append(abs(candle[i]-candle[i+1]))
print(distance)

'''

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

using namespace std;
#define mygc(c) (c)=getchar_unlocked()
#define mypc(c) putchar_unlocked(c)
void reader(int& x) { int k, m = 0; x = 0; for (;;) { mygc(k); if (k == '-') { m = 1; break; }if ('0' <= k&&k <= '9') { x = k - '0'; break; } }for (;;) { mygc(k); if (k<'0' || k>'9')break; x = x * 10 + k - '0'; }if (m) x = -x; }
void writer(int x, char c) { int s = 0, m = 0; char f[10]; if (x<0)m = 1, x = -x; while (x)f[s++] = x % 10, x /= 10; if (!s)f[s++] = 0; if (m)mypc('-'); while (s--)mypc(f[s] + '0'); mypc(c); }
template<class T> void writerLn(T x) { writer(x, '\n'); }
#define rep(i,n)for(int i=0;i<n;i++)
vector<int>E[100000];
int u[200000], v[200000], r[200000], ans[200000], d[100000], cnt = 1;
char b[200000], ok[100000]{ 1 };
deque<int>que;

void bfs(int u, char t) {
	que.emplace_back(u);
	while (!que.empty()) {
		int p = que.front(); que.pop_front();
		for (int v : E[p]) {
			if (t) {
				if (d[v] > d[p] && !ok[v]) {
					ok[v] = 1; cnt++; que.emplace_back(v);
				}
			}
			else if (!~d[v]) {
				d[v] = d[p] + 1; que.emplace_back(v);
			}
		}
	}
}
int main() {
	int n, m, q; reader(n); reader(m); reader(q);
	rep(i, m) {
		reader(u[i]); reader(v[i]);
		u[i]--; v[i]--;
		E[u[i]].emplace_back(v[i]); E[v[i]].emplace_back(u[i]);
	}
	memset(d, -1, sizeof(d));
	d[0] = 0; bfs(0, 0);
	rep(i, n)E[i].clear();
	rep(i, q) {
		reader(r[i]); r[i]--;
		b[r[i]] = 1;
	}
	rep(i, m) {
		if (!b[i]) {
			if (d[v[i]] > d[u[i]]) {
				E[u[i]].emplace_back(v[i]);
			}
			if (d[v[i]] < d[u[i]]) {
				E[v[i]].emplace_back(u[i]);
			}
		}
	}
	bfs(0, 1);
	for (int i = q - 1; i >= 0; i--) {
		ans[i] = n - cnt;
		if (d[v[r[i]]] > d[u[r[i]]] && !ok[v[r[i]]]) {
			E[u[r[i]]].emplace_back(v[r[i]]);
			if (ok[u[r[i]]]) {
				cnt++; ok[v[r[i]]] = 1;
				bfs(v[r[i]], 1);
			}
		}
		if (d[v[r[i]]] < d[u[r[i]]] && !ok[u[r[i]]]) {
			E[v[r[i]]].emplace_back(u[r[i]]);
			if (ok[v[r[i]]]) {
				cnt++; ok[u[r[i]]] = 1;
				bfs(u[r[i]], 1);
			}
		}
	}
	rep(i, q)writerLn(ans[i]);
}

Measured memory_bytes: 13576
#include <bits/stdc++.h>
using namespace std;
#define pii pair <int, int>
vector <pii> res;

int main()
{
	int n; 
	while (scanf("%d", &n) != EOF)
	{
		res.clear();
		int id = (n & 1) ? n : n + 1;
		for (int i = 1; i <= n; ++i)
		{
			for (int j = i + 1; j <= n; ++j)
			{
				if (i + j == id) continue;
				res.push_back(pii(i, j));
			}
		}
		int len = res.size();
		printf("%d\n", len);
		for (int i = 0; i < len; ++i)
			printf("%d %d\n", res[i].first, res[i].second);
	}
	return 0;
}


Measured memory_bytes: 384
S=input()
for i,s in enumerate(S):
    if i%2:
        if s!='L' and s!='U' and s!='D':
            print('No')
            break
    else:
        if s!='R' and s!='U' and s!='D':
            print('No')
            break
else:
    print('Yes')

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



int main() {
  int a,b,t;
  cin >> a >>b >>t;
  int time=1;
  int ans=0;
  while(a*time<=t){
    ans+=b;
    time++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int t,i;
    int a[10000],temp,max=0;
    double sum=0;
    cin>>t;
    for(i=0;i<t;i++) {
        cin >> a[i];
        if(max<a[i])
            max=a[i];
    }
    sort(a,a+t);
    sum=a[0];
    for(i=1;i<t;i++) {
        sum=(sum+a[i])/2;
    }

cout<<sum;
    return 0;
}

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

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


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <bits/stdc++.h>
#define ALL(x) (x).begin(), (x).end()
#define sz(a) int(a.size())
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define chu(x)  if(DEBUG_Switch) cout<<"["<<#x<<" "<<(x)<<"]"<<endl
#define du3(a,b,c) scanf("%d %d %d",&(a),&(b),&(c))
#define du2(a,b) scanf("%d %d",&(a),&(b))
#define du1(a) scanf("%d",&(a));
using namespace std;
typedef long long ll;
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;}
ll powmod(ll a, ll b, ll MOD) { if (a == 0ll) {return 0ll;} a %= MOD; ll ans = 1; while (b) {if (b & 1) {ans = ans * a % MOD;} a = a * a % MOD; b >>= 1;} return ans;}
ll poww(ll a, ll b) { if (a == 0ll) {return 0ll;} ll ans = 1; while (b) {if (b & 1) {ans = ans * a ;} a = a * a ; b >>= 1;} return ans;}
void Pv(const vector<int> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%d", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
void Pvl(const vector<ll> &V) {int Len = sz(V); for (int i = 0; i < Len; ++i) {printf("%lld", V[i] ); if (i != Len - 1) {printf(" ");} else {printf("\n");}}}
inline long long readll() {long long tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
inline int readint() {int tmp = 0, fh = 1; char c = getchar(); while (c < '0' || c > '9') {if (c == '-') fh = -1; c = getchar();} while (c >= '0' && c <= '9') tmp = tmp * 10 + c - 48, c = getchar(); return tmp * fh;}
void pvarr_int(int *arr, int n, int strat = 1) {if (strat == 0) {n--;} repd(i, strat, n) {printf("%d%c", arr[i], i == n ? '\n' : ' ');}}
void pvarr_LL(ll *arr, int n, int strat = 1) {if (strat == 0) {n--;} repd(i, strat, n) {printf("%lld%c", arr[i], i == n ? '\n' : ' ');}}
const int maxn = 1000010;
const int inf = 0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
#define DEBUG_Switch 0
int n;
ll a[maxn];
int main()
{
#if DEBUG_Switch
    freopen("C:\\code\\input.txt", "r", stdin);
#endif
    //freopen("C:\\code\\output.txt","w",stdout);
    n = readint();
    repd(i, 1, n)
    {
        a[i] = readint();
    }
    int ans = 0;
    repd(i, 1, n)
    {
        repd(j, i + 1, n)
        {
            if (a[i] == a[j])
                continue;
            repd(k, j + 1, n)
            {
                if (a[k] == a[i] || a[k] == a[j])
                    continue;
                if (a[i] + a[j] > a[k] && abs(a[i] - a[j]) < a[k])
                {
                    // cout << a[i] << " " << a[j] << " " << a[k] << endl;
                    ans++;
                }
            }
        }
    }
    printf("%d\n", ans );
    return 0;
}




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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

int main2() {
  int H1 = nextInt();
  int M1 = nextInt();
  int H2 = nextInt();
  int M2 = nextInt();
  int K = nextInt();

  int x1 = H1 * 60 + M1;
  int x2 = H2 * 60 + M2;

  int ans = (x2 - K) - x1;
  cout << ans << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

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

#ifdef _DEBUG
#define debug(x) cout<<#x<<": "<<x<<endl
#else
#define debug(x)
#endif

using namespace std;

vector<int> dx = {-1, 0, 1, 0};
vector<int> dy = {0, 1, 0, -1};

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> field(H + 2, vector<char>(W + 2, '#'));
    for (int i = 1; i <= H; ++i) {
        for (int j = 1; j <= W; ++j) {
            char c;
            cin >> c;
            field[i][j] = c;
        }
    }

    function<int(int, int, int, int)> bfs = [&](int sx, int sy, int tx, int ty) {
        queue<tuple<int, int, int>> Q;
        vector<vector<bool>> visited(H + 2, vector<bool>(W + 2, false));
        Q.push(make_tuple(sx, sy, 0));
        debug(sx);
        debug(sy);
        debug(tx);
        debug(ty);
        while (!Q.empty()) {
            int cx, cy, cc;
            tie(cx, cy, cc) = Q.front(); Q.pop();
            debug(cx); debug(cy); debug(cc);
            if (cx == tx && cy == ty) { return cc; }
            if (visited[cy][cx]) { continue; }
            visited[cy][cx] = true;
            for (int i = 0; i < 4; ++i) {
                if (field[cy][cx] != '.' || visited[cy + dy[i]][cx + dx[i]]) {
                    continue;
                }
                Q.push(make_tuple(cx + dx[i], cy + dy[i], cc + 1));
            }
        }
        assert(false);
    };

    int res = 0;
    for (int sy = 1; sy <= H; ++sy) {
        for (int sx = 1; sx <= W; ++sx) {
            for (int ty = 1; ty <= H; ++ty) {
                for (int tx = 1; tx <= W; ++tx) {
                    if (field[sy][sx] == '.' && field[ty][tx] == '.') {
                        res = max(res, bfs(sx, sy, tx, ty));
                    }
                }
            }
        }
    }
    assert(res != 1e9);
    cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)
#define ZERO(a) memset(a,0,sizeof(a))





//3111111111111111111111111111111





	void solve(){

		ins(morty);
		int rick = 0;
		FOR(i,0,6){
			if(morty[i] == '1')rick++;
		}

		out(rick);














	}









































int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	solve();
	


	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <assert.h>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <random>
#include <cmath>
#include <chrono>
#include <bitset>

#define ld long double
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

#define int long long
using namespace std;

const int INF = 2e18;
const int MOD = 1e9 + 7;
const int MB = 20;

void solve() {
	string s, t;
	cin >> s >> t;
	int ans = 0;
	for (int i = 0; i < 3; i++) if (s[i] == t[i]) ans++;
	cout << ans;
}
signed main() {
	/*
	freopen("search.in", "r", stdin);
	freopen("search.out", "w", stdout);
	*/
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout.precision(12);
	solve();
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int answer =0;
    if(a>=13){
      answer=b;
    }else if(6<=a&&a<=12){
      answer = b/2;
    }else{
      
    }
    System.out.println(answer);
  }
}

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


int N;
vector<pair<int, int>> XL;


void input() {
    cin >> N;
    XL = vector<pair<int, int>>(N);
    rep(i, N) cin >> XL[i].first >> XL[i].second;
}


int main() {
    input();
    vector<pair<int, int>> LR(N);
    rep(i, N) {
        LR[i].first = XL[i].first - XL[i].second;
        LR[i].second = XL[i].first + XL[i].second;
    }
    sort(LR.begin(), LR.end());
    int ans = N;
    int pre = LR[0].second;
    for (int i = 1; i < N; i++) {
        if (pre <= LR[i].first) pre = LR[i].second;
        else {
            pre = min(pre, LR[i].second);
            ans--;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

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

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	a, b, m := scanInt(), scanInt(), scanInt()
	as := make([]int, a)
	bs := make([]int, b)
	minA, minB := math.MaxInt32, math.MaxInt32
	for i := range as {
		as[i] = scanInt()
		minA = min(minA, as[i])
	}
	for i := range bs {
		bs[i] = scanInt()
		minB = min(minB, bs[i])
	}
	xs := make([]int, m)
	ys := make([]int, m)
	cs := make([]int, m)
	for i := range xs {
		xs[i], ys[i], cs[i] = scanInt(), scanInt(), scanInt()
		xs[i]--
		ys[i]--
	}

	minD := math.MaxInt32
	for i := 0; i < m; i++ {
		minD = min(minD, as[xs[i]]+bs[ys[i]]-cs[i])
	}

	fmt.Println(min(minA+minB, minD))
}

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


Measured memory_bytes: 7524
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>

using namespace std;

static const double EPS = 1e-9;
template<class T> bool INRANGE(T x, T a, T b) { return a <= x&&x <= b; }
template<class T> void amin(T &a, T v) { if (a > v) a = v; }
template<class T> void amax(T &a, T v) { if (a < v) a = v; }
int ROUND(double x) { return (int)(x + 0.5); }
bool ISINT(double x) { return fabs(ROUND(x) - x) <= EPS; }
bool ISEQUAL(double x, double y) { return fabs(x - y) <= EPS*max(1.0, max(fabs(x), fabs(y))); }
double SQSUM(double x, double y) { return x*x + y*y; }
#define PI  (acos(-1))
#define ARRAY_NUM(a) (sizeof(a)/sizeof(a[0])) 
#define NG (-1)
#define BIG ((int)1e9+10)
#define BIGLL ((ll)4e18)
#define SZ(a) ((int)(a).size())
#define SQ(a) ((a)*(a))
typedef unsigned long long ull;
typedef long long ll;

int main(void) 
{
	double n, m, d;
	cin >> n >> m >> d;

	double ans = 0;

	if (d == 0)
	{
		ans = n;
	}
	else if (d > n)
	{
		ans = 0;
	}
	else
	{
		ans = 2.0 * (n - d);
	}

	ans *= (m - 1);
	ans /= (n*n);


	printf("%.20f\n",ans);

	return 0;
}


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



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

print("0:")

for b in range(1,2**n):
    a = bin(b)[2:]
    a = a[::-1]
    ans = []
    for i in range(len(a)):
        if a[i] == "1":
            ans.append(i)
    ans.sort()
    print(str(b)+":",*ans)


Measured memory_bytes: 6176
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;

int main()
{
	int n;
	cin >> n;
	long long int ans = 0;
	int m = 1000000007;
	bool p = false, z = false;
	for(auto i = 1; i <= n; ++i){
		int a;
		cin >> a;
		if(a < 0) p = !p;
		if(a == 0) z = true;
		a = abs(a);
		m = min(m, a);
		ans += a;
	}
	cout << (!z && p ? ans - m * 2 : ans) << endl;
	return 0;
}

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

using namespace std;

#define int ll
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pi> vp;
typedef vector<pl> vpl;

signed main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(nullptr); 
    cout.tie(nullptr); 
    cerr.tie(nullptr);    

    string s, t;
    cin >> s >> t;

    int n = s.length(), m = t.length();

    int dp[n + 1][m + 1];

    for (int i = 0; i <= n; ++i)
        for (int j = 0; j <= m; ++j)
            dp[i][j] = 0;

    for (int i = 1; i <= n; ++i){
        for (int j = 1; j <= m; ++j){
            if (s[i - 1] == t[j - 1]){
                dp[i][j] = dp[i - 1][j - 1] + 1;
            } else {
                dp[i][j] = max(dp[i][j - 1], dp[i - 1][j]);
            }
        }
    }

    string sol = "";
    int len = 0;
    int x = n, y = m;
    while (len < dp[n][m]){
        if (s[x - 1] == t[y - 1]){
            sol += s[x - 1];
            --x;
            --y;
            ++len;
        } else {
            if (dp[x][y - 1] > dp[x - 1][y]){
                --y;
            } else {
                --x;
            }
        }
    }

    reverse(sol.begin(), sol.end());

    cout << sol << '\n';
}

Measured memory_bytes: 70656