akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Main {
	
	public static void main(String[] args) throws IOException {
		final Scanner sc = new Scanner(System.in);
		
		final int N = sc.nextInt();
		final long C = sc.nextLong();
		final long K = sc.nextLong();
		
		long[] Ts = new long[N];
		for(int i = 0; i < N; i++){
			final long T = sc.nextLong();
			
			Ts[i] = T;
		}
		Arrays.sort(Ts);
		
		
		int answer = 0;
		int prev_index = 0;
		for(int i = 0; i < N; i++){
			while((i + 1) < N && (i + 1) < (prev_index + C) && Ts[i + 1] <= Ts[prev_index] + K){ 
				i++;
			}
			
			
			//System.out.println(C + " " + i + " " + (i - prev_index) + " " + Ts[i] + " " + K);
			
			prev_index = i + 1;
			answer++;
		}
		
		System.out.println(answer);
	}
	
	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;
 
		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}
 
		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}
 
		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}
 
		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		
		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}
		
		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}
 
		public void close() throws IOException {
			br.close();
		}
	}
}

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

using namespace std;

int main() {
	int N;
	char a[11234],b[11234];

	scanf("%d", &N);
	scanf(" %s", a);
	scanf(" %s", b);

	for (int i = 0;i < N;i++){
		printf("%c", a[i]);
		printf("%c", b[i]);
	}
	puts("");
	return 0;
}

Measured memory_bytes: 256
//#include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <limits.h>
#include <string>
#include <deque>
#include <cmath>
#include <bitset>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define mpa make_pair
#define all(a) a.begin(), a.end()

template<typename T>
void vdeb(vector<T> &da) {
	int size = da.size();
	for (int i = 0;i < size;i++) {
		if (i == size - 1) {
			cout << da[i] << endl;
		}
		else {
			cout << da[i] << ' ';
		}
	}
}
template<typename T>
void vvdeb(vector<T> &da) {
	int size = da.size();
	for (int i = 0;i < size;i++) {
		vdeb(da[i]);
	}
}

int n, v, p;
ll m;

bool check(vector<ll> &da, int now) {
	ll h = (ll)n - now + p - 1;
	if (p - v >= 0 || h >= v) {
		return (da[now] + m >= da[p - 1]);
	}
	else {
		if (da[now] + m - da[p - 1] < 0) {
			return false;
		}
		ll sum = 0;
		rip(i, now, p - 1) {
			sum += da[now] + m - da[i];
		}
		ll gg = v - h;
		return (gg*m <= sum);
	}
}

int nibu(vector<ll> &da, int ng, int ok) {
	if (ng - ok == 1) {
		return ok;
	}
	int mi = (ng + ok) / 2;
	if (check(da, mi)) {
		return nibu(da, ng, mi);
	}
	else {
		return nibu(da, mi, ok);
	}
}

int main() {
	cin >> n >> m >> v >> p;
	vector<ll> da(n);
	rip(i, n, 0) {
		cin >> da[i];
	}
	sort(all(da));
	reverse(all(da));
	cout << nibu(da, n, p - 1) + 1 << endl;
}

Measured memory_bytes: 1024
//be naame khodaa

#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <cstdio>
#include <algorithm>
#include <set>
#include <cassert>
#include <iomanip>
#include <cstring>
#include <sstream>
#define fi first
#define se second
#define pb push_back
#define mp make_pair

using namespace std;

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

int in(){ int x; scanf("%d", &x); return x; }

bool ask(int x){
	cout << x << endl;
	string s;
	cin >> s;
	if (s == "Female") return 0;
	if (s == "Male") return 1;
	exit(0);
}

const int maxn = 100 * 1000 + 5;

bool boy[maxn];

int main()
{
	ios::sync_with_stdio(false);
	int n = in();
	boy[0] = ask(0);
	boy[n-1] = ask(n-1);
	int l = 0, r = n-1;
	while (r-l > 1){
		int k = (l + r)/2;
		if (((k-l)%2 == 0) ^ (boy[l] == (boy[k] = ask(k))))
			r = k;
		else
			l = k;
	}
	return 0;
}

Measured memory_bytes: 852
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <string>
#include <complex>

#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <cstring>

#define REP(i,e) for(int i=0;i<(int)(e);i++)
#define FOR(i,b,e) for(int i=(int)(b);i<(int)(e);i++)
#define ALL(c) (c).begin(), (c).end()
#define EACH(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define RALL(c) (c).rbegin(), (c).rend()
#define ALLA(a,n) ((a)+0), ((a)+n)

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef vector<string> vstring;
typedef vector<double> vdouble;

template<class T>void pp(T v,int n){ REP(i,n)cout<<v[i]<< ' ' ; cout << endl; }
template<class T>void pp(T v){ EACH(it,v) cout << *it << ' ' ; cout << endl;  }
template<class T>T& ls(T& a,T b){ if(b<a) a=b; return a; }
template<class T>T& gs(T& a,T b){ if(b>a) a=b; return a; }
inline ll to_i(const string& s){ll n;sscanf(s.c_str(),"%lld",&n);return n;}
inline string to_s(ll n){char buf[32];sprintf(buf,"%lld",n);return string(buf);}

struct __scanner__{ bool e; operator bool(){ return e; } } IN = { false };
inline __scanner__& operator>>(__scanner__& in,int &n)
{ in.e = scanf("%d",&n)==1; return in; }
inline __scanner__& operator>>(__scanner__& in,ll &n)
{ in.e = scanf("%lld",&n)==1; return in; }
inline __scanner__& operator>>(__scanner__& in,double &n)
{ in.e = scanf("%lf",&n)==1; return in; }
inline __scanner__& operator>>(__scanner__& in,char &n)
{ in.e = scanf(" %c",&n)==1; return in; }
inline __scanner__& operator>>(__scanner__& in,string &n) // BUFFER SIZE!
{ static char buf[1000000]; in.e = scanf(" %s",buf)==1; n = buf; return in; } 

int main(){
  int n;
  while (cin >> n) {
    map<int, int> m;
    REP(iter,n) {
      int a; cin >> a; m[a]++;
    }
    int result = 0;
    EACH(it,m) result += it->second % 2;
    cout << result << endl;
  }
}


Measured memory_bytes: 4864
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {

	public static void main(String[] args)throws Exception {
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader (is);
		String []input = br.readLine().split("");
		Main m = new Main();
		stack st = m.new stack();
		for(String s: input) {
			st.push(s);
			if(st.getSize() > 1) {
				String temp = st.pop();
				temp =st.pop() + temp;
				if(!"ST".equals(temp)) {
					st.push(temp.substring(0,1));
					st.push(temp.substring(1,2));
				}
			}
		}
		System.out.println(st.getSize());
	}


	public class stack{
		private ArrayList<String> stackList;
		private int count;

		stack(){
			stackList = new ArrayList<String>();
			count = 0;
		}

		public String pop() {
			String s = stackList.get(count-1);
			stackList.remove(count-1);
			count--;
			return s;
		}

		public void push(String s) {
			stackList.add(s);
			count++;
		}
		public int getSize() {
			return count;
		}

	}


}


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

#define long long long int
using namespace std;


#ifdef JUDGE
std::ifstream cin("input.txt");
std::ofstream cout("output.txt");
#else
using std::cin;
using std::cout;
#endif

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin >> n;
    cout << (n % 10 == 7 || n / 10 % 10 == 7 || n / 100 == 7 ? "Yes" : "No");
    return 0;
}








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

int main() {
  int five = 2;
  int seven = 1;
  for (int i = 0; i < 3; i++) {
    int input;
    cin >> input;
    if (input == 5) {
      five--;
    } else if (input == 7) {
      seven--;
    }
  }
  if (five == 0 && seven == 0) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(0)
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
typedef long long ll;
#define pri(n) printf("%d\n",n)
#define lpri(n) printf("%lld\n",n);
#define rep(i,st,ed) for(int i=st;i<ed;i++)
#define var(n) int n; scn(n)
#define F first
#define S second 
#define pb push_back
const int N=1e5+5;
// const ll M = 998244353;
const ll M=1e9+7;
const ll inf=1e18;

ll dp[1001][1001];

int main()
{
	var(h);var(w);
	string s[h];
	for(int i=0;i<h;i++)
	{
		cin>>s[i];
	}
	dp[0][0]=1;
	for(int j=1;j<w;j++)
	{
		if(s[0][j]=='.')
			dp[0][j]=1;
		else break;			
	}
	for(int i=1;i<h;i++)
	{
		if(s[i][0]=='.')
			dp[i][0]=1;
		else break;
	}
	for(int i=1;i<h;i++)
	{
		for(int j=1;j<w;j++)
		{
			if(s[i][j]!='#')
			{
				dp[i][j]=(dp[i][j]+dp[i-1][j])%M;
				dp[i][j]=(dp[i][j]+dp[i][j-1])%M;
			}
		}
	}
	lpri(dp[h-1][w-1]);
}

Measured memory_bytes: 9088
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
using namespace std;
typedef long long int ll;
ll gcd(int x ,int y)
{
    if(y==0) return x;
    return gcd(y,x%y);
}
int main()
{
    int x;
    cin>>x;
    int g=gcd(x,360);
    int l=(x*360)/g;
    cout<<l/x;
}


Measured memory_bytes: 3636
#include<stdio.h>
#include<string.h>
#define debug system("PAUSE")

void sort(int [], int);

int main()
{
    int a[3][3];
    int i, j;

    for (i = 0; i < 3; i++)
        for (j = 0; j < 3; j++)
            scanf("%d", &a[i][j]);

    if (a[1][0] - a[0][0] == a[1][1] - a[0][1] && a[1][1] - a[0][1] == a[1][2] - a[0][2])
        if (a[2][0] - a[1][0] == a[2][1] - a[1][1] && a[2][1] - a[1][1] == a[2][2] - a[1][2])
            printf("Yes\n");
        else
            printf("No\n");
    else
        printf("No\n");
    return 0;
}


void sort(int a[], int len)
{
    int i, j, temp;

    for (i = 0; i < len - 1; i++)
        for (j = 0; j < len - 1 - i; j++)
            if (a[j] > a[j + 1])
            {
                temp = a[j];
                a[j] = a[j + 1];
                a[j + 1] = temp;
            }
}


Measured memory_bytes: 128
n  = int(input())
v = list(map(int, input().split()))

v0 =[]
v1 =[]

for i in range(n):
  if i % 2 == 0:
    v0.append(v[i])
  else:
    v1.append(v[i])
  
v0.sort()
v1.sort()

v0_count = [[0,0]]
v1_count = [[0,0]]

#print(len(v0_count))
k = 0
for i in range(n//2):
  if v0[i] == v0_count[k][0]:
    v0_count[k][1] += 1
  else:
    v0_count.append([v0[i],1])
    k += 1


v0_count.sort(key=lambda x: x[1], reverse=True)

k = 0
for i in range(n//2):
  if v1[i] == v1_count[k][0]:
    v1_count[k][1] += 1
  else:
    v1_count.append([v1[i],1])
    k += 1


v1_count.sort(key=lambda x: x[1], reverse=True)

if v0_count[0][0] != v1_count[0][0]:
  print(n - v0_count[0][1] - v1_count[0][1])
else:
  print(min( n - v0_count[1][1] - v1_count[0][1] , n - v0_count[0][1] - v1_count[1][1]))

Measured memory_bytes: 65004
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<map>
#include<queue>
#include<set>
#include<bitset>
#include<stdio.h>
#include<deque>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> v(n), w(n+1);
    rep(i, n) cin >> v[i];
    w[0] = 0;
    for(int i = 1; i < n+1; i++){
        w[i] = w[i-1] + v[i-1];
    }
    int ans = 0;
    rep(i, n+1){
        if(w[i] <= k){
            ans++;
        }
        else break;
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  int k,a,b;
  cin >> k >> a >> b;
  
  int n = a / k;
  
    while(n*k <= b){
      if(a <= n*k){ cout << "OK"; return 0; }
      n++;
    }
  
  cout << "NG";
  
  return 0;
}

Measured memory_bytes: 3064
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 100000000000000000
#define EPS 1e-9
#define PI  acos(-1)
const vector<vector<int>> DXY={{-1,0},{1,0},{0,-1},{0,1}};

//----***パーツ***----
#define fi first
#define se second
#define pb push_back
#define re return
#define br break

//----***入出力***---
void print() { std::cout << "\n"; }
template <class T>void print(const T &x) {std::cout << x<<"\n";}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;

signed main(){
  int N,M;cin>>N>>M;
  vector<string> A(N),B(M);
  REP(i,0,N)cin>>A[i];
  REP(i,0,M)cin>>B[i];

  REP(i,0,N-M+1)REP(j,0,N-M+1){
    bool flg=true;
    REP(k,i,i+M){
      REP(l,j,j+M){
        // print(A[k][l],B[k-i][l-j]);
        if(A[k][l]!=B[k-i][l-j]){
          flg=false;
          br;
        }
      }

    }
    if(flg){
      print("Yes");
      re 0;
    }
  }
  print("No");


}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
using namespace std;
long long a [1000000];


/*long long min(long long a, long long b){
	int t = a;
	if(b <= t) t = b;
	return t;

}*/

int main(){
	int n;
	cin >> n;
	
	for(int t = 0; t < n; t++) cin >> a[t];
	

	long long sum = 0LL;
	long long x = 0LL;


	
		
		
		for(int t = 0; t < n; t++){
			
			sum += a[t];
			if(t % 2 == 1 && sum >= 0){
				long long s = sum + 1;
				sum = -1;
				x += s;
			}
			else if(t % 2 == 0 && sum <= 0){
				long long s = 1 - sum ;
				sum = 1;
				x += s;
			}
		}


		long long positive_x = x;
		x = 0LL;
		sum = 0LL;

	
		
		for(int t = 0; t < n; t++){
			
			
			sum += a[t];
			if(t % 2 == 0 && sum >= 0){
				long long s = sum + 1;
				sum = -1;
				x += s;
			}
			else if(t % 2 == 1 && sum <= 0){
				long long s = 1 - sum ;
				sum = 1;
				x += s;
			}
		}

		long long negative_x = x;
	
		long long result = min(positive_x, negative_x);

	    cout << result << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n,mi=inf,ans=0;
	cin>>n;
	for(ll i=0;i<n;i++){
		ll now;
		cin>>now;
		mi=min(now,mi);
		if(mi>=now){
			ans++;
		}
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n,a,b,c,d;
	scanf("%d",&n);
	a = n / 1000;
	b = (n-a*1000)/100;
	c = (n-a*1000-b*100)/10;
	d = (n-a*1000-b*100-c*10);
	if((a==b&&b==c)||(b==c&&c==d)){
		printf("Yes\n");
	}
	else printf("No\n");
}


Measured memory_bytes: 256
import sys
def check(x, y):
    for i in range(6):
        order = [0, 0, 0]
        for j in range(3):
            k = a[i][j]
            if {x[j], x[-j-1]} != {y[k], y[-k-1]}:
                break
            if x[j] == y[k]:
                order[j] = 1
                if x[j] == x[-j-1]:
                    order[j] = 2
        else:
            if 2 in order or (i < 3) == sum(order) % 2:
                return True
    return False

a = [[0, 1, 2], [2, 0, 1], [1, 2, 0], [0, 2, 1], [2, 1, 0], [1, 0, 2]]
n = int(sys.stdin.readline())
x = [input().split() for i in range(n)]
for i in range(n):
    for j in range(i+1, n):
        if check(x[i], x[j]):
            break
    else:
        continue
    print('No')
    break
else:
    print('Yes')

Measured memory_bytes: 7804
#include <iostream>
#include <math.h>

using namespace std;

int main(void){
  int a, b;
  cin >> a >> b;
  if(13 <= a){
    cout << b << endl;
  }
  else if(6 <= a){
    cout << b / 2 << endl;
  }
  else{
    cout << 0 << endl;
  }

  return 0;
}

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

#include <bits/stdc++.h>

using namespace std;

// CHECK THE LIMITS
typedef long long ll;

const int MOD = 1000000007;
const ll INFLL = 1e18;
const int INF = 1e9;
const int NMAX = 1000001;

int gcd(int a, int b) {
  return b ? gcd(b, a%b) : a;
} 

bool check(string aux, string s)
{
	int i = 0, j = 0;
	while(i< 3 && j < (int) s.size())
	{
		if(aux[i] == s[j])
			i++;
		j++;
	}
	if(i == 3)
		return true;
	return false;

}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    string s;
    cin >> n >> s;
    unordered_set<string> un;
	ll ct = 0;
    for(int i =0 ;i <= 9; ++i)
	{
		for(int j = 0; j <= 9; ++j)
		{
			for(int k= 0; k <= 9;++k)
			{
				string aux = "";
				aux += (char) i+'0';
				aux += (char) j+'0';
				aux += (char) k+'0';

				if(un.count(aux) == 0)
				{
					if(check(aux,s))
					{
						ct++;
						un.insert(aux);
					}
				}
			}
		}
	}
	cout << ct;


    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

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

	sort(a.begin(), a.end());
	Int sum = 0;
	int mx = -1;
	for (int i = 0; i + 1 < N; ++i) {
		sum += a[i];
		if (sum * 2 < a[i + 1]) { mx = i; }
	}
	cout << N - 1 - mx << endl;

	return 0;
}


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

int main(){
    int a, b;
    cin >> a >> b;
    if (a < b){
        cout << "a < b" << endl;
    } else if (a > b) {
        cout << "a > b" << endl;
    } else{
        cout << "a == b" << endl;
    }
    return 0;
}


Measured memory_bytes: 3116
n = int(input())
a_list = list(map(int, input().split()))
si = 1
for i in range(n):
    si = si*a_list[i]
bo_list = [si] * n
for i in range(n):
    bo_list[i] = bo_list[i] / a_list[i]
print(si/sum(bo_list))


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
const ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

// conversion number to bit
string num2bit(ll num, ll len){
  string bit = "";
  REP(i, len){
    bit += char('0'+(num>>i & 1));
  }
  return bit;
}

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

    ll N;
    vector<ll> A(5);
    cin >> N;
    REP(i, 5) cin >> A[i];

    ll mi = (1ll<<60);
    REP(i, 5) chmin(mi, A[i]);

    cout << (N+mi-1)/mi+4 << endl;
    return 0;
}

Measured memory_bytes: 384
#include<iostream>

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
char buf[1<<20],*p1,*p2;
#define GC (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<20,stdin),p1==p2)?0:*p1++)
template<class T> inline void read(T &n){
	char ch=GC;T w=1,x=0;
	while(!isdigit(ch)){if(ch=='-') w=-1;ch=GC;}
	while(isdigit(ch)){x=(x<<3)+(x<<1)+(ch^48);ch=GC;}
	n=x*w;
}
const int maxn=500005;
int n,L;
#define pid pair<int,double>
#define fir first
#define sec second
pid Q[maxn];
inline pid merge(pid x,pid y){
    return make_pair(x.fir+y.fir,(x.sec*x.fir+y.sec*y.fir)/(x.fir+y.fir));
}
int main(){
    read(n),read(L);
    int head=1,tail=0;
    int T,V;
    read(T),read(V);
    printf("%.7lf\n",(double)T);
    Q[++tail]=make_pair(V,(double)T);
    double sum=(double)T*V;
    for(int i=2,T,V;i<=n;i++){
        read(T),read(V);
        int tmp=L;
        while(tmp+V>L){
            int tp=min(tmp+V-L,Q[head].fir);
            tmp-=tp,Q[head].fir-=tp;
            sum-=Q[head].sec*tp;
            if(!Q[head].fir) head++;
        }
        sum+=(double)T*V;
        printf("%.7lf\n",sum/L);
        Q[++tail]=make_pair(V,(double)T);
        while(head<tail&&Q[tail].sec<Q[tail-1].sec){
            Q[tail-1]=merge(Q[tail-1],Q[tail]);
            tail--;
        }
    }
	return 0;
}

Measured memory_bytes: 17920
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

const ll MOD = (ll)1e9 + 7LL;
ll dp[(int)1e5 + 5][4];

int main()
{
	memset(dp, 0LL, sizeof(dp));

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string S; cin >> S;
	int N = (int)S.length();

	for (int i = N; i >= 0; --i){
		for (int j = 3; j >= 0; --j){
			if (i == N){
				dp[i][j] = (j == 3 ? 1LL : 0LL);
			}else{
				dp[i][j] = dp[i+1][j] * (S[i] == '?' ? 3LL : 1LL);
				if (j < 3 && (S[i] == '?' || S[i] == "ABC"[j])){
					dp[i][j] += dp[i+1][j+1];
				} // end if
				dp[i][j] %= MOD;
			} // end if
		} // end for
	} // end for

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

Measured memory_bytes: 3664
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
signed main(){
  ll n,t0,t1,t2;
  ll a0,a1,a2;
  a0=a1=a2=0;
  cin >> n;
  ll a[n];
  for(int i=0;i<n;i++){
    cin >> a[i];
    a[i] -= i+1;
  }
  sort(a,a+n);
  t0=n/2;
  t1=max((ll)0,n/2-1);
  t2=n/2+1;
  t0=a[t0];
  t1=a[t1];
  t2=a[t2];
  for(int i=0;i<n;i++){
    a0 += abs(a[i]-t0);
    a1 += abs(a[i]-t1);
    a2 += abs(a[i]-t2);
  }
  cout << min(a0,min(a1,a2))<<endl;
}


Measured memory_bytes: 1792
#include<iostream>
#include<unordered_set>
using namespace std;
int main()
{
    int n;
    cin >> n;
    unordered_multiset<int> ms;
    for(int i = 0; i < n; i ++)
    {
        int c;
        cin >> c;
        ms.insert(c);
    }
    cin >> n;
    for(int i = 0; i < n; i ++)
    {
        int c;
        cin >> c;
        if(ms.find(c) == ms.end())
        {
            cout << "NO";
            return 0;
        }
        ms.erase(ms.find(c));
    }
    cout << "YES";
}


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

int main()
{
  int n;
  cin >> n;
  
  int t;
  long a;
  cin >> t >> a;
  
  int index = 0;
  int min_diff = 1000000;
  rep(i, n)
  {
    int h_tmp;
    cin >> h_tmp;
    
    int diff = abs((t * 1000 - h_tmp * 6) - a * 1000);
    
    if (min_diff > diff)
    {
      index = i + 1;
      min_diff = diff;
    }
  }
  
  cout << index << endl;
    
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void) {
  string s;
  cin >> s;
  int a, z;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'A') {
      a = i;
      break;
    }
  }
  for (int i = s.size() - 1; i >= 0; i--) {
    if (s[i] == 'Z') {
      z = i;
      break;
    }
  }
  cout << z - a + 1 << endl;
  return 0;
}

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

int main() {
int a[100],n;
cin>>n;
for(int i=0;i<n;i++)
cin>>a[i];
for(int i=0;i<n;i++)
{
	if(i==n-1) cout<<a[i]<<endl;
	else cout<<a[i]<<" ";
}
for(int i=1;i<n;i++)
{
	int k=i;
	for(;k>0;k--)
	if(a[k-1]>a[k])
	{
		int temp=a[k];
		a[k]=a[k-1];
		a[k-1]=temp;
	}
	for(int i=0;i<n;i++)
{
	if(i==n-1) cout<<a[i]<<endl;
	else cout<<a[i]<<" ";
}
}
	return 0;
}


Measured memory_bytes: 3084
import java.util.*;
import java.util.Collections;
import java.util.Comparator;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int Y = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		Integer p[] = new Integer[A];
		Integer q[] = new Integer[B];
		Integer r[] = new Integer[C];
		Integer ary[] = new Integer[X + Y + C];
		for(int i = 0; i < A; i++) {
			p[i] = sc.nextInt();
		}
		for(int i = 0; i < B; i++) {
			q[i] = sc.nextInt();
		}
		for(int i = 0; i < C; i++) {
			r[i] = sc.nextInt();
			ary[i] = r[i];
		}
		
		Arrays.sort(p, Collections.reverseOrder());
		Arrays.sort(q, Collections.reverseOrder());
		Arrays.sort(r, Collections.reverseOrder());
		for(int i = 0; i < X; i++) {
			ary[C + i] = p[i];
		}
		for(int i = 0; i < Y; i++) {
			ary[C + X + i] = q[i];
		}
		Arrays.sort(ary, Collections.reverseOrder());
		long ans = 0;
		for(int i = 0; i < X + Y; i++) {
			ans += ary[i];
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 103296
# coding: utf-8
import numpy as np

card = np.array([list(map(int, input().split())) for _ in range(3)])
n = int(input())

for _ in range(n):
    num = int(input())
    if num in card:
        pos = tuple(nd[0] for nd in np.where(card == num))
        card[pos[0], pos[1]] = 0

f = 0

for i in range(3):
    if sum(card[i,:]) == 0 or sum(card[:,i]) == 0:
        f = 1
    if card[0,0]+card[1,1]+card[2,2] == 0 or card[2,0]+card[1,1]+card[2,0] == 0:
        f = 1

if f:
    print('Yes')
else:
    print('No')

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

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


count = 0
max_count = 0

for i in range(1, len(h)):
    if (h[i - 1] >= h[i]):
        count += 1
    else:
        max_count = max(count, max_count)
        count = 0

max_count = max(count, max_count)
count = 0
print(max_count)


Measured memory_bytes: 14224
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX_EDGE_LEN 50
#define VERY_LARGE_I32 0x7fffffff

#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)

typedef struct {
  int x;
  int y;
  int dist;
} Point;

#define QUEUE_SIZE 0x1000
typedef Point Item;
Item queue[QUEUE_SIZE];
size_t queue_in = 0;
size_t queue_out = 0;
int queue_is_full = 0;

int32_t map[MAX_EDGE_LEN+2][MAX_EDGE_LEN+2];

size_t inc_queue_index(size_t index)
{
  return (index + 1) % QUEUE_SIZE;
}

void queue_push(const Item* item)
{
  if(queue_is_full) {
    fputs("Queue is full.\n", stderr);
    exit(1);
  }
  memcpy(&queue[queue_in], item, sizeof(Item));
  queue_in = inc_queue_index(queue_in);
  queue_is_full = queue_in == queue_out;
}

int queue_pop(Item* result)
{
  if(queue_in == queue_out && !queue_is_full) {
    return 1;
  }
  memcpy(result, &queue[queue_out], sizeof(Item));
  queue_out = inc_queue_index(queue_out);
  queue_is_full = 0;
  return 0;
}

void clear_queue()
{
  queue_in = 0;
  queue_out = 0;
  queue_is_full = 0;
}

void next_point(Point* dst, const Point* src, int diffx, int diffy)
{
  dst->x = src->x + diffx;
  dst->y = src->y + diffy;
  dst->dist = src->dist + 1;
}

int count_dots(int height, int width)
{
  int result = 0;
  for(int x = 1; x <= height; x++) {
    for(int y = 1; y <= width; y++) {
      if(map[x][y] != -1) {
        result++;
      }
    }
  }
  return result;
}

int bf_search(int height, int width)
{
  Point start;
  start.x = 1;
  start.y = 1;
  start.dist = 1;
  queue_push(&start);
  while(1) {
    Point point;
    if(queue_pop(&point)) {
      return -1;
    }
    if(point.x == height && point.y == width) {
      return point.dist;
    }
    if(map[point.x][point.y] <= point.dist) {
      continue;
    }
    map[point.x][point.y] = point.dist;
    Point up;
    Point down;
    Point left;
    Point right;
    next_point(&up, &point, -1, 0);
    next_point(&down, &point, 1, 0);
    next_point(&left, &point, 0, -1);
    next_point(&right, &point, 0, 1);
    queue_push(&up);
    queue_push(&down);
    queue_push(&left);
    queue_push(&right);
  }
}

int main()
{
  memset(map, -1, sizeof(map));

  int height, width;
  scanf("%d%d", &height, &width);
  getchar(); // remove LF
  for(int x = 1; x <= height; x++) {
    for(int y = 1; y <= width; y++) {
      char ch = getchar();
      switch(ch) {
        case '.':
          map[x][y] = VERY_LARGE_I32;
          break;
        case '#':
          map[x][y] = -1;
          break;
        default:
          fprintf(stderr, "Unknown char: '%c'\n", ch);
          exit(1);
      }
    }
    getchar(); // remove LF
  }
  int distance = bf_search(height, width);
  if(distance == -1) {
    printf("%d\n", distance);
    return 0;
  }
  int num_dots = count_dots(height, width);
  printf("%d\n", num_dots - distance);
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

var (
	read  = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

func main() {
	defer write.Flush()

	var n, m int
	fmt.Fscan(read, &n, &m)

	var ans string
	if n == m {
		ans = "Yes"
	} else {
		ans = "No"
	}
	fmt.Fprintln(write, ans)
}


Measured memory_bytes: 640
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
char buf[1<<21],*p1=buf,*p2=buf;
inline char getc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}
int read(){
    R int res,f=1;R char ch;
    while((ch=getc())>'9'||ch<'0')(ch=='-')&&(f=-1);
    for(res=ch-'0';(ch=getc())>='0'&&ch<='9';res=res*10+ch-'0');
    return res*f;
}
int read(char *s){
    R int len=0;R char ch;while(((ch=getc())>'9'||ch<'0'));
    for(s[++len]=ch;(ch=getc())>='0'&&ch<='9';s[++len]=ch);
    return s[len+1]='\0',len;
}
double readdb()
{
    R double x=0,y=0.1,f=1;R char ch;
    while((ch=getc())>'9'||ch<'0')(ch=='-')&&(f=-1);
    for(x=ch-'0';(ch=getc())>='0'&&ch<='9';x=x*10+ch-'0');
    for(ch=='.'&&(ch=getc());ch>='0'&&ch<='9';x+=(ch-'0')*y,y*=0.1,ch=getc());
    return x*f;
}
char sr[1<<21],z[20];int C=-1,Z=0;
inline void Ot(){fwrite(sr,1,C+1,stdout),C=-1;}
void print(R int x){
    if(C>1<<20)Ot();if(x<0)sr[++C]='-',x=-x;
    while(z[++Z]=x%10+48,x/=10);
    while(sr[++C]=z[Z],--Z);sr[++C]='\n';
}
const int P=998244353;
inline void upd(R int &x,R int y){(x+=y)>=P?x-=P:0;}
inline int inc(R int x,R int y){return x+y>=P?x+y-P:x+y;}
inline int dec(R int x,R int y){return x-y<0?x-y+P:x-y;}
inline int mul(R int x,R int y){return 1ll*x*y-1ll*x*y/P*P;}
int ksm(R int x,R int y){
	R int res=1;
	for(;y;y>>=1,x=mul(x,x))(y&1)?res=mul(res,x):0;
	return res;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
clock_t start=clock();
inline void ck(){
    if(1.0*(clock()-start)/CLOCKS_PER_SEC>0.1)exit(0);
}
const int N=205;
int a[N],d[N],n,res;
int f(int n,int d){
	if(n<d)return 0;if(n%d==0)return n/d;
	int p=n/d,q=p*d+1;
	return f(n-((n-q)/(p+1)+1)*(p+1),d);
}
int main(){
//	freopen("testdata.in","r",stdin);
	scanf("%d",&n);
	fp(i,1,n)scanf("%d%d",&a[i],&d[i]),res^=f(a[i],d[i]);
	puts(res?"Takahashi":"Aoki");
	return 0;
}

Measured memory_bytes: 256
'use strict';

function Main(input) {
  const A = Number(input.split('\n')[0].split(' ')[0]);
  const B = Number(input.split('\n')[0].split(' ')[1]);

  if((A * B) % 2 === 0) {
    console.log('No');
  } else {
    console.log('Yes');
  }

};

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


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

#ifndef __TOPCYBERFLOWER
#define debug(...) 0
#else
#define debug(...) cout << " [-] ", _dbg(#__VA_ARGS__, __VA_ARGS__)
template<class TH> void _dbg(const char *sdbg, TH h){ cout << sdbg << '=' << h << endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
    while(*sdbg != ',') cout << *sdbg++;
    cout << '=' << (h) << ','; 
    _dbg(sdbg+1, a...);
}
#endif

#define TYPEMAX(type)   numeric_limits<type>::max()
#define TYPEMIN(type)   numeric_limits<type>::min()
typedef long long ll;
typedef pair<int,int> pii;
const ll MD=1e9+7;
const int SZ=200005;
ll fac[SZ];
ll inv[SZ];
ll pow(ll x, ll y){
    ll res=1;
    while(y>0ll){
        if(y%2==1ll) res=(res*x)%MD;
        x=(x*x)%MD;
        y/=2;
    }
    return res;
}
ll combi(ll n, ll x){
    ll res=fac[n];
    res=(res*pow(fac[x],MD-2))%MD;
    return (res*pow(fac[n-x],MD-2))%MD;
}
ll myf(ll n, ll k){
    return (combi(n,k)*combi(n-1,n-k-1))%MD;
}
int main(void){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    fac[0]=fac[1]=1;
    ll n,k; cin>>n>>k;
    k=min(k,n-1);
    for(ll i=2;i<=n;i++) fac[i]=(fac[i-1]*i)%MD;
    ll ans=0;
    for(ll i=0;i<=k;i++){
        ans=(ans+myf(n,i))%MD;
    }
    cout<<ans;
    return 0;
}

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

signed main(void)
{
	string s;
	map<char, int> mp;
	bool ok;

	cin >> s;
	mp['N'] = 0;
	mp['W'] = 0;
	mp['S'] = 0;
	mp['E'] = 0;
	rep(i, s.size()) mp[s[i]]++;
	ok = true;
	if (mp['N'] > 0)		
	{
		if (mp['S'] <= 0)
			ok = false;
	}
	if (mp['S'] > 0)		
	{
		if (mp['N'] <= 0)
			ok = false;
	}
	if(mp['W'] > 0)
	{
		if(mp['E'] <= 0)
			ok = false;
	}
	if (mp['E'] > 0)		
	{
		if (mp['W'] <= 0)
			ok = false;
	}
	if(ok)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	int D;
	int[] c;
	int[][] s;

	int[] ans;

	long score(int[] a) {
		int[] last = new int[26];

		long res = 0;

		for (int d = 0; d < D; d++) {
			res += s[d][a[d]];
			last[a[d]] = d + 1;

			for (int j = 0; j < 26; j++) {
				res -= (c[j] * (d + 1 - last[j]));
			}
//			System.err.println(res);
		}
		return Math.max(res + 1000000, 0);
	}

	public void _main(String[] args) {
		long st = System.currentTimeMillis();
		Scanner sc = new Scanner(in);

		D = sc.nextInt();
		c = new int[26];
		for (int i = 0; i < 26; i++) {
			c[i] = sc.nextInt();
		}

		s = new int[D][26];
		for (int i = 0; i < D; i++) {
			for (int j = 0; j < 26; j++) {
				s[i][j] = sc.nextInt();
			}
		}

		sc.close();

		ans = new int[D];

		long max = score(ans);
		Random random = new Random();

		while (System.currentTimeMillis() - st < 1800) {

			for (int d = 0; d < D; d++) {
				for(int i=0;i<26;i++) {
					int t = ans[d];
					if(t==i) continue;
					ans[d] = i;
	
					long s = score(ans);
					if (s < max) {
						ans[d] = t;
					} else {
						max = s;
					}
				}
			}
		}

		System.err.println(max);

		for (int x : ans) {
			out.println(x + 1);
		}

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}


Measured memory_bytes: 55124
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
string s;
  cin>>s;
  ll sum=0;
  for(int i=0;i<s.size();i++)
  {
    int d=(int)s[i]-48;
    sum+=d;
  }
  if(sum%9==0) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;

int parent[100010];//iの親parent[i]を格納する配列
int my_rank[100010];//iを根とする部分木の高さみたいな量?
void init(int n){
    for(int i=0;i<n;i++){
        parent[i]=i;
        my_rank[i]=0;
    }
}
int root(int x){
    if(parent[x]==x)return x;
    else return root(parent[x]);
}
void unite(int x,int y){
    x=root(x);
    y=root(y);
    if(x==y)return ;
    if(my_rank[x]<my_rank[y])parent[x]=y;
    else{
        parent[y]=x;
        if(my_rank[x]==my_rank[y])my_rank[x]++;
    }
}
bool same(int x,int y){
    return root(x)==root(y);
}
struct edge {int u,v,cost;};
bool comp(const edge& e1,const edge& e2){
    return e1.cost<e2.cost;
}

vector <edge> edges;
long long kruskal(){
    sort(edges.begin(),edges.end(),comp);
    long long res=0;
    REP(i,edges.size()){
        edge e=edges[i];
        if(!same(e.u,e.v)){
            unite(e.u,e.v);
            res += (long long)e.cost;
        }
    }
    return res;
}

int main(){
  int n;
  cin>>n;
  int x,y;
  vector<pair<int,int>> xs,ys;
  REP(i,n){
    cin>>x>>y;
    xs.push_back(make_pair(x,i));
    ys.push_back(make_pair(y,i));
  }
  
  sort(xs.begin(),xs.end());
  sort(ys.begin(),ys.end());
  
  REP(i,n-1){
    edge e;
    e.u = xs[i].second;
    e.v = xs[i+1].second;
    e.cost = xs[i+1].first - xs[i].first;
    edges.push_back(e);
  }
  REP(i,n-1){
    edge e;
    e.u = ys[i].second;
    e.v = ys[i+1].second;
    e.cost = ys[i+1].first - ys[i].first;
    edges.push_back(e);
  }
  
  long long ans;
  init(n);
  ans = kruskal();
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 7144
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
int main() {
	//code

string X,Y;
cin>>X>>Y;
int m=X.length();
int n=Y.length();
int L[m+1][n+1];

   for (int i=0; i<=m; i++)
   {
     for (int j=0; j<=n; j++)
     {
       if (i == 0 || j == 0)
         L[i][j] = 0;
       else if (X[i-1] == Y[j-1])
         L[i][j] = L[i-1][j-1] + 1;
       else
         L[i][j] = max(L[i-1][j], L[i][j-1]);
     }
   }
   int index = L[m][n];


   char lcs[index+1];
   lcs[index] = '\0';
   int i = m, j = n;
   while (i > 0 && j > 0)
   {

      if (X[i-1] == Y[j-1])
      {
          lcs[index-1] = X[i-1];
          i--; j--; index--;
      }


      else if (L[i-1][j] > L[i][j-1])
         i--;
      else
         j--;
   }
   cout<<lcs;

	}



Measured memory_bytes: 35456
def com(n, r, mod):
    num = 1
    denom = 1
    for i in range(r):
        denom = (denom * (i+1)) % mod
        num = (num * (n-i)) % mod
    return num*pow(denom, mod-2, mod)

n, a, b = map(int,input().split())

mod = 10**9 + 7

sum = pow(2, n, mod) - 1
sum -= com(n, a, mod)
sum -= com(n, b, mod)

print(int(sum % mod))


Measured memory_bytes: 3064
#include <stdio.h>

int main(){
	int N;
	int b[101];
	scanf("%d",&N);
	int i;
	for(i=1;i<=N;i++){
		scanf("%d",&b[i]);
	}
	int c[101];
	int d;
	int e;
	int f;
	f=0;
	for(d=0;d<N;d++){
		e=0;
		for(i=N-d;i>0;i--){
			if(b[i]==i&&e==0){
				c[N-d]=i;
				e=1;
				int j;
				for(j=i;j<N-d;j++){
					b[j]=b[j+1];
				}
			}
		}
		if(e==0){
			f=1;
			break;
		}
	}
	if(f==1){
		printf("-1\n");
	}else{
		for(i=1;i<=N;i++){
			printf("%d\n",c[i]);
		}
	}
}

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

#define int long long
#define ff first
#define ss second
#define loop(i,k,n) for(int i=k;i<n;++i)
#define rloop(i,n,k) for(int i=n;i>=k;i--)
#define vi vector<int>
#define vvi vector<vector<int> >
#define vpii vector<pair<int,int> >
#define all(v) v.begin(),v.end()
#define mii map<int,int>
#define mci map<char,int>  
#define pii pair<int,int>
#define pdd pair<double,double>
#define deb(x) cout<<#x<<" "<<x<<endl;
#define mp make_pair
#define pb push_back
#define mod 1000000007  
#define endl "\n"
#define inf 1e18
#define sp(x,y) fixed<<setprecision(y)<<x

void get_it_done(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}
int gcd(int a, int b){ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
void swap(int &a,int &b){
	a^=b;b^=a;a^=b;
}
const int N = 1e5+5;
int dp[105][N];
int n;
int weights[105],values[105];   

int solve(int idx,int maxWeight){
    if(idx>=n)
        return 0;
    if(dp[idx][maxWeight]!=-1)
        return dp[idx][maxWeight];
    int ans = 0;
    if(maxWeight-weights[idx]>=0){
        ans = values[idx]+solve(idx+1,maxWeight-weights[idx]);
    }
    ans = max(ans,solve(idx+1,maxWeight));
    return dp[idx][maxWeight] = ans;
}

int32_t main(){
	get_it_done();
    int t=1;
    // cin >> t;
    while (t--){
        int maxWeight;
        cin>>n>>maxWeight;
        loop(i,0,n){
            cin>>weights[i]>>values[i];
        }
        memset(dp,-1,sizeof(dp));
        cout<<solve(0,maxWeight)<<endl;

    }
}


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

typedef long long LL;

LL solve(LL n, LL m){
    LL ret = n * m;
    for(LL i=1; i<n; i++){
        LL s1 = i * m;
        LL s2 = (n - i) * (m / 2);
        LL s3 = (n - i) * (m - m / 2);
        if(s1 < s2)	swap(s1, s2);
        if(s1 < s3)	swap(s1, s3);
        if(s2 < s3)	swap(s2, s3);
        ret = min(ret, s1 - s3);

        if((n-i) >= 2){
            s1 = i * m;
            s2 = (n-i)/2 * m;
            s3 = (n - i - (n - i) / 2) * m;
			if(s1 < s2)	swap(s1, s2);
			if(s1 < s3)	swap(s1, s3);
			if(s2 < s3)	swap(s2, s3);
			ret = min(ret, s1 - s3);
        }
    }

    return ret;
}

int main(){
	LL n, m;
	while(~scanf("%lld %lld", &n, &m)){
		LL ans = min(solve(n, m), solve(m, n));
		printf("%lld\n", ans);
	}
	return 0;
}


Measured memory_bytes: 256
H,W,K = map(int,input().split())
C = []
for _ in range(H):
    S = input()
    C.append(S)

ans = 0
for i in range(1<<H):
    for j in range(1<<W):
        count = 0
        for h in range(H):
            for w in range(W):
                if ((i&(1<<h)==0) and (j&(1<<w)==0) and C[h][w]=="#"):
                    count += 1
        if(count == K):
            ans += 1
print(ans)


Measured memory_bytes: 9196
#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 = (int)(n)-1; i >=0; i--)

using ll = long long;

int main(){
  int n;
  cin>>n;
  vector<pair<int,int>> a(n),c(n);
  rep(i,n)cin>>a.at(i).second>>a.at(i).first;//x y red  yjiku
  rep(i,n)cin>>c.at(i).first>>c.at(i).second;//y x blue xjiku

  sort(a.begin(),a.end());//red;
  sort(c.begin(),c.end());//blue;
  //red y 軸で　降順
  reverse(a.begin(),a.end());

  int ans = 0;
  vector<int> seen(n);
  rep(i,n) seen.at(i) = 0;
  rep(i,n){
    rep(j,n){
      if(c.at(i).first>a.at(j).second&&c.at(i).second>a.at(j).first&&seen.at(j)==0){
        seen.at(j) = 1;
        ans++;
        break;
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n, q = map(int, input().split())

g = [[] for _ in range(n)]
for i in range(n-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)

memo = [0] * n

for i in range(q):
    p, x = map(int, input().split())
    p -= 1
    memo[p] += x

def dfs(v, par):
    for nv in g[v]:
        if nv == par:
            continue
        memo[nv] += memo[v]
        dfs(nv, v)

dfs(0, -1)

print(*memo)

Measured memory_bytes: 230960
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
	ll cnt=0;
	string s;
	cin>>s;
	for(ll i=0;i<s.size()/2;i++)
	{
		if(s[i]!=s[s.size()-i-1])
		++cnt;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int main() {
    int N, M;
    int long sum = 0;
    int count = 0;
    cin >> N >> M;
    vector<long int> A(N);
    vector<pair <long int,int>> BC(M);
    vector<long int> D(0);
 
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    for (int i = 0; i < M; i++) {
        cin >> BC.at(i).second >> BC.at(i).first;
    }
    sort(BC.begin(), BC.end());
    reverse(BC.begin(), BC.end());
    sort(A.begin(), A.end());
 
    for (int j = 0; j < M; j++) {
        for (int k = 0; k < BC.at(j).second; k++) {
            count++;
            D.push_back(BC.at(j).first);
            if (count == N) {
                break;
            }
        }
        if (count == N) {
            break;
        }
    }
 
   for (int i = 0; i < N; i++) {
        D.push_back(0);
    }
 
    for (int i = 0; i < N; i++) {
        sum += max(D.at(i), A.at(i));
    }
 
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 4724
'use strict'

const Main = (input) => {
  const tmp = input.trim().split(' ')
  const A = parseInt(tmp[0])
  const B = parseInt(tmp[1])

  const count = Math.ceil((B - 1) / (A - 1))

  let result = count

  console.log(result)
  return result
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 21064
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    int ans = 0;
    rep(i,n){
        int x;
        cin >> x;
        ans += min(x, k-x) * 2;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3548
l = []
s = int(input())
l.append(s)

while True:
    if l[-1] % 2==0:
        l.append(l[-1]/2)
        if l[-1] in l[:-1]:
            print(len(l))
            break
    else:
        l.append(l[-1]*3 + 1)
        if l[-1] in l[:-1]:
            print(len(l))
            break

Measured memory_bytes: 3060
#map(int,input().split())
n,m,x = map(int,input().split())
c=[0 for _ in range(n)]
a=[[] for j in range(n)]
#a 上げりゅううううううううううう
#X以上にしゅりゅうううううううううううううう
#m個全部
maxcnt = 10**9+7
for i in range(n):
	k = list(map(int,input().split()))
	c[i] = k[0]
	a[i] = k[1:]
for i in range(2**n):
	asum = [0 for _ in range(m)]
	cnt = 0
	for j in range(n):
		if ((i>>j) & 1):
			cnt += c[j]
			for k in range(m):
				asum[k] += a[j][k]
	cntj = 0
	for k in range(m):
		if asum[k] >= x:
			cntj += 1
	if cntj == m:
		if cnt <= maxcnt:
			maxcnt = cnt

if maxcnt != 10**9+7:
	print(maxcnt)
else:
	print("-1")

Measured memory_bytes: 9272
#include <bits/stdc++.h>
using namespace std;
int n,k,pre[100005];
map<int,int> ma;

int main()
{
  bool flag = false;
  scanf("%d%d",&n,&k);
  for(int i=1;i<=n;i++){
    scanf("%d",&pre[i]);
    ma[pre[i]] ++;
    if(ma[pre[i]] == k) flag = true;
  }
  if(flag == true){
    puts("0");
    return 0;
  }
  sort(pre + 1, pre + 1 + n);
  int ans = 0x3f3f3f3f;
  for(int i=1;i + k<=n;i++){
    ans = min(ans, pre[i + k - 1] - pre[i]);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 5376