akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int s = sc.nextInt();
		int max = 50 * (n - 1);
		ArrayList<ArrayList<Cost>> graph = new ArrayList<>();
		for (int i = 0; i < n; i++) {
		    graph.add(new ArrayList<>());
		}
		for (int i = 0; i < m; i++) {
		    int a = sc.nextInt() - 1;
		    int b = sc.nextInt() - 1;
		    int c = sc.nextInt();
		    int d = sc.nextInt();
		    graph.get(a).add(new Cost(b, c, d));
		    graph.get(b).add(new Cost(a, c, d));
		}
		int[] coins = new int[n];
		int[] lates = new int[n];
		for (int i = 0; i < n; i++) {
		    coins[i] = sc.nextInt();
		    lates[i] = sc.nextInt();
		}
	    long[][] times = new long[n][max + 1];
	    for (int i = 0; i < n; i++) {
	        Arrays.fill(times[i], Long.MAX_VALUE);
	    }
	    PriorityQueue<Path> queue = new PriorityQueue<>();
	    queue.add(new Path(0, 0, s));
	    while (queue.size() > 0) {
	        Path p = queue.poll();
	        p.coin = Math.min(p.coin, max);
	        if (times[p.idx][p.coin] <= p.time) {
	            continue;
	        }
	        times[p.idx][p.coin] = p.time;
	        for (int i = p.coin - 1; i >= 0 && times[p.idx][i] > p.time; i--) {
	            times[p.idx][i] = p.time;
	        }
	        queue.add(new Path(p.idx, p.time + lates[p.idx], p.coin + coins[p.idx]));
	        for (Cost c : graph.get(p.idx)) {
	            if (c.coin > p.coin) {
	                continue;
	            }
	            queue.add(new Path(c.idx, p.time + c.time, p.coin - c.coin));
	        }
	    }
	    StringBuilder sb = new StringBuilder();
	    for (int i = 1; i < n; i++) {
	        sb.append(times[i][0]).append("\n");
	    }
	    System.out.print(sb);
	}
	
	static class Path implements Comparable<Path> {
	    int idx;
	    long time;
	    int coin;
	    
	    public Path(int idx, long time, int coin) {
	        this.idx = idx;
	        this.time = time;
	        this.coin = coin;
	    }
	    
	    public int compareTo(Path another) {
	        if (time == another.time) {
	            return 0;
	        } else if(time < another.time) {
	            return -1;
	        } else {
	            return 1;
	        }
	    }
	    
	    public String toString() {
	        return idx + ":" + time + ":" + coin;
	    }
	}
	
	static class Cost {
	    int idx;
	    int time;
	    int coin;
	    
	    public Cost(int idx, int coin, int time) {
	        this.idx = idx;
	        this.time = time;
	        this.coin = coin;
	    }
	}
}



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

using namespace std;

typedef long long int ll;
 
template<class T> inline bool chmax(T& a,T b){ if(a<b){ a=b; return true;} return false; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){ a=b; return true;} return false; }
 
typedef pair<int,int> pair;

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

  int ans=0;

  while(a>ans){
    ans+=k;
  }

  //cout << ans << endl;


  if(ans<=b) puts("OK");
  else puts("NG");
  
}

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
namespace KCLC
{
    class Program
    {
        static void Main()
        {
            string[] Input = Console.ReadLine().Split();
            int Goukei = int.Parse(Input[0]);
            int Itido = int.Parse(Input[1]);
            int Jikan = int.Parse(Input[2]);
            int Output = Goukei / Itido;
            if(Goukei % Itido != 0)
            {
                Output += 1;
            }
            Output = Output * Jikan;
            Console.WriteLine(Output);
        }
    }
}

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

int main() {
	int n;
	cin >> n;
	if(n<10){
		cout << n;
	}else if(n<100){
		cout << 9;
	}else if(n<1000){
		cout << n-90;
	}else if(n<10000){
		cout << 909;
	}else if(n<100000){
		cout << n-9090;
	}else{
		cout << 90909;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define PI 3.14159265358979323846
#define int64 long long
#define uint64 unsigned long long
using namespace std;

int main()
{
	int64 nn, aa, bb, cnt = 1;
	cin >> nn;
	vector<int64> pp(nn), qq(nn), memo(nn);
	for(int64 ii = 0;ii < nn;ii++)
	{
		memo[ii] = ii + 1;
		cin >> pp[ii];
	}
	for(int64 ii = 0;ii < nn;ii++)
	{
		cin >> qq[ii];
	}
	do
	{
		bool tmp1 = true, tmp2 = true;
		for(int64 ii = 0;ii < nn;ii++)
		{
			if(pp[ii] != memo[ii])
			{
				tmp1 = false;
			}
			if(qq[ii] != memo[ii])
			{
				tmp2 = false;
			}
		}
		if(tmp1)
		{
			aa = cnt;
		}
		if(tmp2)
		{
			bb = cnt;
		}
		cnt++;
	}while(next_permutation(memo.begin(), memo.end()));
	cout << abs(aa - bb) << endl;
	return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    ll n;
  cin>>n;
    vector<ll> a(n),b(n);
    for(ll i=0;i<n;i++){
        cin>>a[i]>>b[i];
    }
 
    ll result=0;
    for(ll i=n-1;i>=0;i--){
        result+=(((a[i]+result+b[i]-1)/b[i])*b[i]-(a[i]+result));
    }
 
    cout<<result;
    return 0;
}

Measured memory_bytes: 4768
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
void hr() { cerr << "--------------" << endl; }
const int INF = 2e9;
const int MOD = 1e9 + 7;

int main() {
   double l;
   cin >> l;
   double h = l / 3.0;
   printf("%0.7f\n", h * h * h);
   return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

constexpr double EPS = 1e-3;

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> X(N), Y(N), C(N);
    rep(i, N) cin >> X[i] >> Y[i] >> C[i];

    if (K == 1) {
        write(0);
        return 0;
    }

    double low = 0, high = 3e5;
    rep(it, 60) {
        double mid = (low + high) / 2;
        //mid = 3;
        bool ok = false;
        rep(i, N - 1) rep(j, i + 1, N) {
            double d = hypot(X[i] - X[j], Y[i] - Y[j]);
            if (d * (C[i] * C[j]) > mid * (C[j] + C[i])) {
                continue;
            }
            rep(p, 2) {
                double x, y;
                if (d * (C[i] * C[j]) < mid * abs(C[j] - C[i])) {
                    if (C[i] < C[j]) x = X[j], y = Y[j];
                    else x = X[i], y = Y[i];
                }
                else {
                    double d2 = pow(d, 2);
                    double a = (d2 + pow(mid / C[i], 2) - pow(mid / C[j], 2)) / 2;
                    double b = d2 * pow(mid / C[i], 2) - a * a + EPS;
                    //if (b < 0) cerr << b << endl;
                    //assert(b >= 0);
                    x = (a * (X[j] - X[i]) + (-2 * p + 1) * (Y[j] - Y[i]) * sqrt(b)) / d2 + X[i];
                    y = (a * (Y[j] - Y[i]) + (+2 * p - 1) * (X[j] - X[i]) * sqrt(b)) / d2 + Y[i];
                }

                int cnt = 0;
                rep(k, N) {
                    if (k == i || k == j) cnt++;
                    else if (hypot(x - X[k], y - Y[k]) * C[k] <= mid) cnt++;
                }
                if (cnt >= K) ok = true;
            }
            if (ok) break;
        }

        if (ok) high = mid;
        else low = mid;
    }
    write(high);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mid ((x + y) / 2)
#define left (ind * 2)
#define right (ind * 2 + 1)
#define mp make_pair
#define timer ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"
#define spc " "
#define d1(x) cerr<<#x<<":"<<x<<endl
#define d2(x, y) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<endl
#define d3(x, y, z) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<double, double> dd;

const int N = (int)(1e6 + 5);
const int LOG = (int)(20);

lli ai , ao , at , aj , al , as , az, ans;

int main() {
	fast_io();
	// freopen("inp.in", "r", stdin);
	
	cin >> ai >> ao >> at >> aj >> al >> as >> az;
	ans += ao * 2;
	if(ai % 2 + aj % 2 + al % 2 == 0)
		ans += (ai / 2) * 4 + (aj / 2) * 4 + (al / 2) * 4;
	else if(ai % 2 + aj % 2 + al % 2 == 1)
		ans += (ai / 2) * 4 + (aj / 2) * 4 + (al / 2) * 4;
	else if(ai % 2 + aj % 2 + al % 2 == 3)
		ans += (ai / 2) * 4 + (aj / 2) * 4 + (al / 2) * 4 + 6;
	else if(ai == 0 || aj == 0 || al == 0)
		ans += (ai / 2) * 4 + (aj / 2) * 4 + (al / 2) * 4;
	else
		ans += (((ai + aj + al) * 4) / 2) - 2;

	cout << ans / 2;
}

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

using namespace std;

char p[12][7];
int f[12][6], dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};


int main(void){
	int a, b, i, j, k, l, g, n, flag, cnt, m;
	queue<pair<int,int> > que;
	scanf("%d%*c",&n);
	for(i = 0;i < n;i++){
		for(j = 0;j < 12;j++)
			gets(p[j]);
		m = 0;
		while(1){
			flag = 1;
			memset(f,0,sizeof(f));
			for(j = 0;j < 12;j++){
				for(k = 0;k < 6;k++){
					if(p[j][k] != '.' && p[j][k] != 'O' && !f[j][k]){
						que.push(pair<int,int>(j,k));
						f[j][k] = 1;
						cnt = 0;
						while(que.size()){
							a = que.front().first;
							b = que.front().second;
							cnt++;
							for(l = 0;l < 4;l++){
								if(a + dy[l] >= 0 && a + dy[l] < 12 && b + dx[l] >= 0 && b + dx[l] < 6 && !f[a + dy[l]][b + dx[l]] && p[j][k] == p[a + dy[l]][b + dx[l]]){
									f[a + dy[l]][b + dx[l]] = 1;
									que.push(pair<int,int>(a + dy[l],b + dx[l]));
								}
							}
							que.pop();
						}
						if(cnt >= 4){
							flag = 0;
							que.push(pair<int,int>(j,k));
							char c = p[j][k];
							p[j][k] = '.';
							while(que.size()){
								a = que.front().first;
								b = que.front().second;
								for(l = 0;l < 4;l++){
									if(a + dy[l] >= 0 && a + dy[l] < 12 && b + dx[l] >= 0 && b + dx[l] < 6){
										if(c == p[a + dy[l]][b + dx[l]]){
											que.push(pair<int,int>(a + dy[l],b + dx[l]));
											p[a + dy[l]][b + dx[l]] = '.';
										}
										else if(p[a + dy[l]][b + dx[l]] == 'O')
											p[a + dy[l]][b + dx[l]] = '.';
									}
								}
								que.pop();
							}
						}
					}
				}
			}
			if(flag) break;
			for(j = 10;j >= 0;j--){
				for(k = 0;k < 6;k++){
					if(p[j][k] != '.' && p[j + 1][k] == '.'){
						for(l = j;p[l + 1][k] == '.' && l < 11;l++);
						p[l][k] = p[j][k];
						p[j][k] = '.';
					}
				}
			}
			m++;
		}
		printf("%d\n",m);
	}
	return 0;
}

Measured memory_bytes: 1052
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


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

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, c = 0;

  std::string s;

  std::cin >> N >> s;

  for (int i = 0; i < N; i ++)
    if (s[i] == 'R')
      c ++;

  std::cout << (c > N - c ? "Yes" : "No") << std::endl;

  return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;

ll n;
ll a[500000];
ll sum[500000];
ll zero[500001];
ll dp[500001][2];
bool saw[500001];
map<int, vector<int>> m;

int main() {
    cin >> n;
    rep(i,n) cin >> a[i];
    if (n == 1) {
        cout << 1 << endl;
        return 0;
    }
    sum[0] = a[0];
    for (int i = 1; i < n; i++) sum[i] = sum[i-1] ^ a[i];

    if (sum[n-1] != 0) {
        dp[0][1] = 0; dp[0][0] = 1;
        int j = 0;
        rep(i,n-1) {
            if (sum[i] == sum[n-1]) {
                dp[j+1][1] = (dp[j][0] + dp[j][1]) % MOD;
                dp[j+1][0] = dp[j][0];
                j++;
            } else if (sum[i] == 0) {
                dp[j+1][1] = dp[j][1];
                dp[j+1][0] = (dp[j][0] + dp[j][1]) % MOD;
                j++;
            }
        }
        cout << dp[j][0] << endl;
        return 0;
    }
    rep(i,n) if (sum[i] == 0) zero[i]++;
    for (int i = 1; i <= n; i++) zero[i] += zero[i-1];
    rep(i,n-1) m[sum[i]].push_back(i);
    ll ans = 0;
    bool ex = false;
    for (auto it = m.begin(); it != m.end(); it++) {
        if ((*it).first == 0) {
            ex = true;
            ll hoge = 1;
            rep(i,(*it).second.size()) hoge = hoge * 2 % MOD;
            ans = (ans + hoge) % MOD;
            continue;
        }
        vector<int> v = (*it).second;
        dp[0][1] = 1; dp[0][0] = 0;
        int j = 0;
        for (int i = 1; i < v.size(); i++) {
            dp[j+1][1] = dp[j][1];
            dp[j+1][0] = (dp[j][0] + dp[j][1] * (zero[v[i]] - zero[v[i-1]])) % MOD;
            j++;
            dp[j+1][0] = dp[j][0];
            dp[j+1][1] = (dp[j][0] + dp[j][1] + 1) % MOD;
            j++;
        }
        ans = (ans + dp[j][1]) % MOD;
    }
    if (!ex) ans = (ans + 1) % MOD;
    cout << ans << endl;
}

Measured memory_bytes: 44148
m,d=map(int,input().split())
if 22>d:
    print(0)
else:
    a=22
    ans=0
    while d>=a:
        b=str(a)
        if 2>int(b[0]) or 2>int(b[1]):
            a+=1
        else:
            if m >= int(b[0])*int(b[1]):
                ans+=1
                a+=1
            else:
                a+=1
    print(ans)


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

using namespace std;

#define debug(x) '[' << #x << " is: " << x << "] "
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.precision(10);
	cout << fixed;
	int a,b;
	cin>>a>>b;
	int ans = a+b;
	if(ans%2)cout << "IMPOSSIBLE\n";
	else cout << ans/2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <stack>
#include <queue>

#define FOR(i, b, e) for(ll i = (ll)(b); i < (ll)(e); ++i)
#define RFOR(i, b, e) for(ll i = (ll)(e-1); i >= (ll)(b); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define VS vector<string>
#define VL vector<long long>
#define VI vector<int>
#define VVI vector<vector<int>>
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define PAIR pair<ll,ll>
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using  ll = long long;
constexpr int MOD = 1000000007;
using namespace std;

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; }

VL prime_decomposition(ll n) {
	ll i = 2;
	VL table{};
	while (i * i <= n) {
		while (n % i == 0) {
			n /= i;
			table.emplace_back(i);
		}
		++i;
	}
	if (n > 1) {
		table.emplace_back(n);
		return table;
	}
}

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

	if (str.size() == 2) {
		cout << str;
	} else {
		RREP(i, str.size()) {
			cout << str[i];
		}
		cout << endl;
	}
}

Measured memory_bytes: 256
### main

while true
  b, r, g, c, s, t = gets.strip.split(' ').map{|s| s.to_i}
  break if b == 0 && r == 0 && g == 0 && c == 0 && s == 0 && t == 0

  bg = b * 5 + r * 3

  rev  = b * 15 + r * 15 + bg * 15 + g * 7 + c * 2
  exp = bg * 2 + (t - bg - s) * 3

  medal = 100 + rev - exp

  puts medal
end

Measured memory_bytes: 6104
// abc160_e
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF (2e9)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    ll X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    vector<ll> P(A), Q(B), R(C);
    REP(i, A) cin >> P[i];
    REP(i, B) cin >> Q[i];
    REP(i, C) cin >> R[i];

    sort(ALL(P), greater<ll>());
    sort(ALL(Q), greater<ll>());
    sort(ALL(R), greater<ll>());

    priority_queue<ll, vector<ll>, greater<ll>> P2, Q2;
    REP(i, X) P2.push(P[i]);
    REP(i, Y) Q2.push(Q[i]);

    REP(i, C){

        ll p = P2.top();
        ll q = Q2.top();

        if (R[i] > min(p, q)){
            if (p < q){
                P2.pop();
                P2.push(R[i]);
            } else {
                Q2.pop();
                Q2.push(R[i]);
            }
        }
    }

    ll ans = 0;
    REP(i, X){ ans += P2.top(); P2.pop();}
    REP(i, Y){ ans += Q2.top(); Q2.pop();}
    print(ans);


    return 0;
}


Measured memory_bytes: 4852
#include <iostream>

using namespace std;

int main(){
  int a,b,c;
  int count = 0;
  cin >> a >> b >> c;
  while (true) {
    int tmp_a, tmp_b, tmp_c;
    if (a>b) {//a > b
      if (b>c) {
	tmp_a = a;tmp_b = b;tmp_c = c;//a > b > c
      } else {// c > b
	if (a>c) {
	  tmp_a = a;tmp_b = c;tmp_c = b;//a > c > b
	} else {
	  tmp_a = c;tmp_b = a;tmp_c = b;//c > a > b
	}
      }
    } else {//b > a
      if (a>c) {
	tmp_a = b;tmp_b = a;tmp_c = c;
      } else {//c > a
	if (c>b) {
	  tmp_a = c;tmp_b = b;tmp_c = a;
	} else {
	  tmp_a = b;tmp_b = c;tmp_c = a;
	}
      }
    }
    a = tmp_a;b = tmp_b;c = tmp_c;
    if (a-c>=2) {
      c+=2;
      count++;
    } else {
      if (a-c==1) {
	if (b-c==1) {
	  count += 2;
	  break;
	} else {
	  count++;
	  break;
	}
      } else {
	break;
      }
    }
  }
  cout << count << endl;
  return(0);
}


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

int A, B;

int main() {
  cin >> A >> B;
  if (A >= 13) {
    cout << B << endl;
  }else if (A < 13 && A >= 6) {
    cout << B/2 << endl;
  }else{
    cout << 0 << endl;
  }
  return 0;
}
    

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

const int MAX=INT_MAX;

int main(){
  int h,w;
  std::cin >> h>>w;

  std::vector<std::vector<char> > area(h,std::vector<char>(w));
  rep(i,h)rep(j,w)std::cin >> area[i][j];

  bool ok=true;

  int dh[4]={1,-1,0,0};
  int dw[4]={0,0,1,-1};
  rep(i,h)rep(j,w){
    if(area[i][j]=='.')continue;
    bool n=false;
    rep(k,4){
      if(i+dh[k]<0 || j+dw[k]<0 || i+dh[k]>=h || j+dw[k]>=w)continue;
      if(area[i+dh[k]][j+dw[k]]=='#')n=true;
    }
    if(n==false){
      ok=false;
    }
  }


  if(ok)std::cout << "Yes" << '\n';
  else std::cout << "No" << '\n';


  return 0;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 1e2 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	vector<int> v(5);
	for (auto& x : v) cin >> x;
	int cur = 0;
	int ans = INF;
	sort(v.begin(), v.end());
	do
	{
		cur = 0;
		for (auto& x : v)
		{
			cur = (cur + 9) / 10 * 10;
			cur += x;
		}
		ans = min(ans, cur);
	} while (next_permutation(v.begin(), v.end()));
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef vector<PII> VPII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )
#define EACH( it, c ) for ( auto it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

int main()
{
	cin.tie( 0 );
	ios::sync_with_stdio( false );
	cout << setprecision( 8 ) << fixed;

	for ( int x, h; cin >> x >> h, x | h; )
	{
		const double naname = sqrt( pow( x / 2., 2. ) + pow( 1. * h, 2. ) );
		const double res = x * x + ( naname * x ) * 2;
		cout << res << endl;
	}

	return 0;
}

Measured memory_bytes: 1264
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10e16
#define MOD 1000000007
#define mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int k,x;
    cin>>k>>x;
    if(k*500>=x)cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------







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

int main() {
    ll N, K;
    cin >> N >> K;
    double ans = 0;
    for (int i=1; i<=N; ++i) {
        int x = i;
        double p = 1;
        while(x < K) {
            x*=2;
            p /= 2;
        }
        ans += (p/N);
    }
    cout << setprecision(15);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>

unsigned long long int cnt(unsigned long long int a, unsigned long long int b, unsigned long long int c)
{
  return b / c - a / c;
}

unsigned long long int lcm(unsigned long long int a, unsigned long long int b)
{
  unsigned long long int x, tmp, r;

  x = a * b;
  if (a < b)
  {
    tmp = a;
    a = b;
    b = tmp;
  }

  r = a % b;
  while (r != 0)
  {
    a = b;
    b = r;
    r = a % b;
  }

  return x / b;
}

int main(void)
{
  unsigned long long int a, b, c, d;
  scanf("%llu %llu %llu %llu", &a, &b, &c, &d);
  printf("%llu\n", b - a + 1 - cnt(a - 1, b, c) - cnt(a - 1, b, d) + cnt(a - 1, b, lcm(c, d)));
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define int long long
#define endl "\n"
#define PI 3.1415926535897932384626433
#define ceil1(a,b)   (a+(b-1))/b
#define all(v)  v.begin(),v.end()
#define gen(arr,n,nxt)  generate(arr,arr+n,nxt)
#define base ios_base::sync_with_stdio(false);cin.tie(0);
#define open freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
using namespace std;
const int mo=1e9+7;
int nxt(){int x;cin>>x;return x;}
int mod(int n,int m){int ans=n%m;if(ans<0)ans+=m;return ans;}
vector<int>adj[200001];
bool vis[200001];
int cnt=0;
void dfs(int u,int sum=1){
    cnt++;
    vis[u]=1;
    bool ok=0;
    for(auto v:adj[u]){
        if(!vis[v])
            dfs(v,sum+1);
    }
    return;
}
int32_t main(){
    base
    int n=nxt(),m=nxt();
    for(int i=0;i<m;i++){
        int x=nxt()-1,y=nxt()-1;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
    int Max=0;
    for(int i=0;i<n;i++){
        if(!vis[i]){
            cnt=0;
            dfs(i);
            Max=max(Max,cnt);
        }
    }
    cout<<Max;
    return 0;
}


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

#define sz(x) ((int)x.size())
#define fast_io ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll; 


string s; 

int main(){
  cin>>s; 
  ll ans=0; 
  int cnt=0; 
  for(int i=sz(s)-1;i>=0;i--){
    if(s[i]=='A'){
      ans+=cnt; 
    }
    else if(i>0 && s[i]=='C' && s[i-1]=='B'){
      cnt++; 
      i--; 
    }
    else {
      cnt=0; 
    }
  }
  cout<<ans<<endl; 
}

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

int main(){
 int h,w;
 int height[3000], width[3000];
 int count;
 while(1){
  cin >> h >> w;
  if( h==0 && w==0 ){
    break;
  }
  height[count]=h;
  width[count]=w;
  count++;
 }

 int output_count=0;
 while( output_count<count ){
   for( int i=0; i<height[output_count]; i++ ){
    for( int j=0; j<width[output_count]; j++ ){
     cout << "#";
     if( j==width[output_count]-1 ){
      cout << endl;
     }
    }
   }
   cout << endl;
   output_count++;
 }

 return 0;
}


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

using namespace std;

#define LL long long
#define DD double
#define Pb push_back
#define Bp pop_back
#define Pf push_front
#define Fp pop_front
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define X first
#define Y second
#define mx1 10
#define mx2 110
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

typedef vector<LL> Vl;
typedef vector<DD> Vd;
typedef vector<bool> Vb;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef pair<DD, DD> Pdd;
typedef vector<Pll> Vpl;
typedef vector<Pdd> Vpd;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
typedef deque<LL> Dl;

LL _set(LL N, LL pos) {return N = N | (1 << pos);}
LL _reset(LL N, LL pos) {return N = N & ~(1 << pos);}
bool _check(LL N, LL pos) {return (bool)(N & (1 << pos));}
bool _upper(char a) {return a >= 'A' && a <= 'Z';}
bool _lower(char a) {return a >= 'a' && a <= 'z';}
bool _digit(char a) {return a >= '0' && a <= '9';}

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

///**************************DONE****************************///

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    
    if((a == b && a != c) || (b == c && b != a) || (c == a && c != b))
        cout << "Yes\n";
    else
        cout << "No\n";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

const ll M = 1000000007;

int main(){
	int n,k;
	cin >> n >> k;
	if(n >= 2*k-1)puts("YES");
	else puts("NO");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=105;
const ll INF=1LL<<62;

int when[MAX][MAX][4];
string ESWN="ESWN";
vector<int> dh={0,1,0,-1},dw={1,0,-1,0};

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        int H,W;cin>>H>>W;
        ll N;cin>>N;
        
        if(H+W+N==0) break;
        
        memset(when,0,sizeof(when));
        
        vector<string> S(H);
        for(int i=0;i<H;i++) cin>>S[i];
        
        int hnow,wnow,dir;
        
        bool yatta=false;
        
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                for(int k=0;k<4;k++){
                    if(S[i][j]==ESWN[k]){
                        hnow=i;
                        wnow=j;
                        dir=k;
                    }
                }
            }
        }
        int turn=0,roop=-1,left=-1,right=-1;
        while(1){
            int toh=hnow+dh[dir],tow=wnow+dw[dir];
            
            while(toh<0||toh>=H||tow<0||tow>=W||S[toh][tow]=='#'){
                dir=(dir+1)%4;
                toh=hnow+dh[dir];
                tow=wnow+dw[dir];
            }
            
            turn++;
            hnow=toh;
            wnow=tow;
            
            if(when[hnow][wnow][dir]){
                roop=turn-when[hnow][wnow][dir];
                left=when[hnow][wnow][dir];
                right=turn-1;
                break;
            }
            
            when[hnow][wnow][dir]=turn;
            
            if(turn==N){
                cout<<(hnow+1)<<" "<<(wnow+1)<<" "<<ESWN[dir]<<endl;
                yatta=true;
                break;
            }
        }
        
        if(yatta) continue;
        
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                for(int k=0;k<4;k++){
                    if(left<=when[i][j][k]&&when[i][j][k]<=right&&(N-when[i][j][k])%roop==0){
                        cout<<i+1<<" "<<j+1<<" "<<ESWN[k]<<endl;
                        //return 0;
                    }
                }
            }
        }
    }
}




Measured memory_bytes: 3400
#include <bits/stdc++.h>
#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 = m; i >= n; i--)
#define INF 1e9;
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
int main() {
  ll X, Y, Z, K;
  cin >> X >> Y >> Z >> K;
  ll A[X], B[Y], C[Z];
  REP(i, X) { cin >> A[i]; }
  REP(i, Y) { cin >> B[i]; }
  REP(i, Z) { cin >> C[i]; }

  vector<ll> AB, ABC;

  REP(i, X) {
    REP(j, Y) { AB.push_back(A[i] + B[j]); }
  }

  sort(AB.rbegin(), AB.rend());

  AB.resize(K);

  REP(i, AB.size()) {
    REP(j, Z) { ABC.push_back(AB[i] + C[j]); }
  }

  sort(ABC.rbegin(), ABC.rend());

  REP(i, K) { cout << ABC[i] << endl; }

  return 0;
}

Measured memory_bytes: 43364
MOD=10**9+7
cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def desc(ar) ar.sort!{|x,y|y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

def bs(ar,eq,n) en=(eq==1 ? :>= : :>); ar.bsearch_index{|x|x.send(en,n)} end
def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end

def puts_yesno(can) puts(can ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def debug(k,v) puts "#{k}:#{v}" end
########### ( ˘ω˘ )ｽﾔｧ… ###########
s=gs.chars
k=gi

ans=1
s.each.with_index do |ss,j|
  if ss != "1"
    ans=ss
    break
  elsif j+1==k
    ans=1
    break
  end
end
puts ans


Measured memory_bytes: 1788
n=int(input())
a=[0,0,0,0]
for i in range(n):
    s=input()
    if s=='AC':
        a[0]+=1
    elif s=='WA':
        a[1]+=1
    elif s=='TLE':
        a[2]+=1
    else:
        a[3]+=1
print('AC x',a[0])
print('WA x',a[1])
print('TLE x',a[2])
print('RE x',a[3])

Measured memory_bytes: 9096
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

class Main {

	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			while (true) {
				String line = br.readLine();
				int N = Integer.parseInt(line);
				if (N < 1) {
					break;
				}
				if (N == 1) {
					System.out.println(0);
				} else {
					int count = sieveOfEratosthenes(N).size();
					System.out.println(count);
				}
			}
		} catch (IOException e) {
			//System.out.println("exit by IOException");
		} catch (NumberFormatException e) {
			//System.out.println("end of input");
		}
	}

	public static List<Integer> sieveOfEratosthenes(int n) {
		if (n <= 1) {
			return null;
		}

		boolean[] list = new boolean[n + 1];
		for (int i = 0; i <= n; i++) {
			list[i] = true;
		}

		List<Integer> primes = new ArrayList<Integer>();
		for (int i = 2; i * i <= n; i++) {
			if (list[i]) {
				primes.add(new Integer(i));
				for (int j = i; j <= n; j += i) {
					list[j] = false;
				}
			}
		}

		for (int i = 2; i <= n; i++) {
			if (list[i]) {
				primes.add(new Integer(i));
			}
		}

		return primes;
	}
}

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

int main() {
 string S,T ;
 cin >> S >>T;
  int N = 0;
  for (int i=0; i<S.size();i++){
    if (S.at(i)==T.at(i)){
       N++ ;
    }
  }
 
  cout << N ;
      
}

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

typedef long long ll;

int main(){
    int N;
    cin>>N;
    vector<int> A(N);
    for(int i=0;i<N;i++){
        cin>>A.at(i);
    }
    sort(A.begin(),A.end());
    reverse(A.begin(),A.end());
    map<int,int> mp;
    for(int i=0;i<=A.at(0);i++){
        mp[i]=0;
    }
    for(int i=0;i<N;i++){
        mp[A.at(i)]++;
    }
    int count=0;
    for(int i=0;i<=A.at(0);i++){
        if(mp[i]==1){
            //count++;
        }
        if(mp[i]>1){
            count=count+mp[i]-1;
        }
    }
    if(count%2==0){
        cout<<N-count<<endl;
    }
    else{
        cout<<N-count-1<<endl;
    }/*
    for(int i=0;i<=A.at(0);i++){
        cout<<mp[i]<<endl;
    }*/
}

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

using namespace std;

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

    int m, d;
    cin >> m >> d;

    int cnt = 0;
    for (int i = 1; i <= m; i++) {
        for (int j = 1; j <= d; j++) {
            int a = j % 10;
            int b = j / 10;
            if (a >= 2 && b >= 2 && i == a * b) cnt++;
        }
    }

    cout << cnt << endl;
}

Measured memory_bytes: 892
while True:
    a, op, b = input().split()
    a, b = int(a), int(b)
    if op == "?":
        break
    if op == "+":
        print(a+b)
    if op == "-":
        print(a-b)
    if op == "*":
        print(a*b)
    if op == "/":
        import math
        print(math.floor(a/b))


Measured memory_bytes: 5664
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;
const Int INF = 1LL << 61;

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

    int n, p;
    cin >> n >> p;
    string s;
    cin >> s;
    reverse(s.begin(), s.end());

    Int ans = 0;
    if (p == 2) {
        for (Int i = 0; i < n; i++) {
            if (!((s[i] - '0') & 1)) {
                ans += n - i;
            }
        }
    } else if (p == 5) {
        for (Int i = 0; i < n; i++) {
            if ((s[i] - '0') % 5 == 0) {
                ans += n - i;
            }
        }
    } else {
        Int x = 1, total = 0;
        vector<Int> cnt(p);
        for (Int i = 0; i < n; i++) {
            cnt[total]++;

            total += (s[i] - '0') * x;
            total %= p;

            ans += cnt[total];

            x = x * 10 % p;
        }
    }

    cout << ans << endl;

    return 0;
}

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

int main(){
	string s;
	cin >> s;
	string t = "ACGT";
	vector<bool> ans(s.size());
	rep(i,s.size())rep(j,t.size()){
		if(s[i] == t[j]) ans[i] = true;
	}
	int counts = 0;
	int maxim = 0;
	rep(i,s.size()){
		if(ans[i]) {
			counts++;
			maxim = max(maxim,counts);
		}
		else counts = 0;
	}
	cout << maxim << endl;
}

Measured memory_bytes: 3548
#include <bits/stdc++.h>
#define F first
#define S second
#define T second.first
#define C second.second
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int,pair<int,int>> piii;

const int N= 1e2+5, L = 14, OO = 0x3f3f3f3f;
const ll M=10 ;
const double ESP = 1e-8;

string s1, s2;
int dp[3005][3005];
int solve(int idx1, int idx2){
    if(idx1 == s1.size() || idx2 == s2.size())
        return 0;

    int& ret = dp[idx1][idx2];
    if(~ret)
        return ret;

    if(s1[idx1] == s2[idx2])
        return ret = solve(idx1+1, idx2+1)+1;

    return ret = max(solve(idx1+1, idx2), solve(idx1, idx2+1));
}

void print(int idx1, int idx2){
    if(idx1 == s1.size() || idx2 == s2.size())
        return;

    int optimal = solve(idx1, idx2);

    if(s1[idx1] == s2[idx2]){
        cout<<s1[idx1];
        print(idx1+1, idx2+1);
        return;
    }

    if(solve(idx1+1, idx2) == optimal)
        print(idx1+1, idx2);

    else if(solve(idx1, idx2+1) == optimal)
        print(idx1, idx2+1);
}


int main(){
    FIO
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    cin>>s1>>s2;
    memset(dp, -1, sizeof dp);
    print(0,0);
}


Measured memory_bytes: 35968
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#define rep(i, m, n) for(int i = m;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout<<#x<<": "<<x<<endl
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int main(){
  int a,b,c,cnt=0;
  cin>>a>>b>>c;
  if(a==b && b==c && a==c){
    cnt=1;
  }else if((a==b && a!=c) || (b==c && a!= b) || (a==c && b!=c)){
    cnt=2;
  }else{
    cnt=3;
  }
  cout << cnt << endl;
}


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

int main(int argc, char *argv[]) {
  std::string s;
  std::cin >> s;
  for (auto &c : s) {
    if (c == '7'){
      std::cout << "Yes" << std::endl;
      return 0;
    }
  }
  std::cout << "No" << std::endl;
}


Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 200005;

int A[MAXN];
ll nxt[MAXN][64];
vector<int> p[MAXN];
bitset<MAXN> inv;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll N, K;
	cin >> N >> K;
	for (int i = 0; i < N; ++i) cin >> A[i];

	for (int i = 0; i < N; ++i) p[A[i]].push_back(i);
	for (int i = 0; i < MAXN; ++i) {
		if (!p[i].empty()) {
			for (int j = 0; j < p[i].size() - 1; ++j) nxt[p[i][j]][0] = p[i][j + 1] + 1 - p[i][j];
			nxt[p[i].back()][0] = p[i].front() + N + 1 - p[i].back();
		}
	}

	for (int j = 0; j < 63; ++j) {
		for (int i = 0; i < N; ++i) {
			if (nxt[i][j] <= N * K) nxt[i][j + 1] = nxt[i][j] + nxt[(i + nxt[i][j]) % N][j];
			else nxt[i][j + 1] = N * K + 1;
		}
	}

	ll x = 0;
	int cnt = 0;
	while (1) {
		int l = 0, h = 63;
		while (l < h) {
			int m = (l + h) >> 1;
			x + nxt[x % N][m] >= N * K ? h = m : l = m + 1;
		}
		if (h <= 0) break;
		x += nxt[x % N][h - 1];
	}

	vector<int> v;
	for (int i = x % N; i < N; ++i) {
		if (inv[A[i]]) {
			while (v.back() != A[i]) {
				inv[v.back()] = 0;
				v.pop_back();
			}
			inv[A[i]] = 0;
			v.pop_back();
		}
		else {
			inv[A[i]] = 1;
			v.push_back(A[i]);
		}
	}
	for (auto& i : v) cout << i << ' ';
}

Measured memory_bytes: 114168
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner stdn = new Scanner(System.in);
		
		int x = 0;
		int i = 1;
		
		for(int r = 0; r <= 10000; r++){
			x = stdn.nextInt();
			if(x != 0){
				System.out.println("Case " + i + ": " + x);
			}else if(x == 0){
				break;
			}
			i++;
		}
	}
}

Measured memory_bytes: 41904
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <math.h>
#include <map>
#include <stack>
using namespace std;
static const int INF = 1e9+7;
// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (int i =a; i < b; i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define PI 3.14159265359

int main(){
    int n; cin >> n;
    if(n < 105){
        cout << 0 << endl;
        return 0;
    }
    int cnt = 1;
    for(int i=107; i<=n; i=i+2){
        int num_cnt = 0;
        for(int j=1; j<=i; j++){
            if(i % j == 0) num_cnt++;
        }
        if(num_cnt == 8) cnt++;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3628
import heapq
import sys
if sys.version[0] == '2':
    range, input = xrange, raw_input


class MinCostFlow:
    class Edge:
        def __init__(self, to, cap, rev, cost):
            self.to, self.cap, self.rev, self.cost = to, cap, rev, cost

    def __init__(self, V):
        self.V = V
        self.E = [[] for _ in range(V)]

    def add_edge(self, fr, to, cap, cost):
        self.E[fr].append(self.Edge(to, cap, len(self.E[to]), cost))
        self.E[to].append(self.Edge(fr, 0, len(self.E[fr])-1, -cost))

    def run(self, source, sink, f, INF=10**5):
        res = 0
        h, prevv, preve = [0] * self.V, [0] * self.V, [0] * self.V
        while (f > 0):
            pque = []
            dist = [INF] * self.V
            dist[source] = 0
            heapq.heappush(pque, (0, source))
            while pque:
                cost, v = heapq.heappop(pque)
                cost = -cost
                if dist[v] < cost:
                    continue
                for i, e in enumerate(self.E[v]):
                    if e.cap > 0 and dist[v] - h[e.to] < dist[e.to] - e.cost - h[v]:
                        dist[e.to] = dist[v] + e.cost + h[v] - h[e.to]
                        prevv[e.to], preve[e.to] = v, i
                        heapq.heappush(pque, (-dist[e.to], e.to))
            if dist[sink] == INF:
                return -1
            for v in range(self.V):
                h[v] += dist[v]

            d, v = f, sink
            while v != source:
                d = min(d, self.E[prevv[v]][preve[v]].cap)
                v = prevv[v]
            f -= d
            res += d * h[sink]
            v = sink
            while v != source:
                self.E[prevv[v]][preve[v]].cap -= d
                self.E[v][self.E[prevv[v]][preve[v]].rev].cap += d
                v = prevv[v]
        return res


while True:
    N = int(input())
    if not N:
        break
    V = 366
    mcf = MinCostFlow(V)
    for i in range(V - 1):
        mcf.add_edge(i, i + 1, 2, 0)
    for _ in range(N):
        s, t, c = map(int, input().split())
        mcf.add_edge(s - 1, t, 1, -c)
    print(-mcf.run(0, V - 1, 2, 10 ** 9))

Measured memory_bytes: 7544