akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<queue>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bitset>
#include<iomanip>
using namespace std;

typedef stack<int> IntStack;
typedef queue<int> IntQueue;

const double pi = 3.141592653589793;

/*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*//*ここまでテンプレ*/

int sheet[101][101];

int main()
{	
	int n, m, l;
	cin >> n >> m >> l;

	long int A[100][100], B[100][100], C[100][100];
	
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			cin >> A[i][j];
		}
	}
	for (int i = 0; i < m; i++)
	{
		for (int j = 0; j < l; j++)
		{
			cin >> B[i][j];
		}
	}

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < l; j++)
		{
			C[i][j] = 0;

			for (int k = 0; k < m; k++)
			{
				C[i][j] += A[i][k] * B[k][j];
			}
		}
	}

	for (int i = 0; i < n; i++)
	{
		cout << C[i][0];
		for (int j = 1; j < l; j++)
		{
			cout << " " << C[i][j];
		}
		cout << endl;
	}

	return 0;
}



Measured memory_bytes: 3320
/* Author - Ankur Kumar Singh 
	IDE :- Offine Linux
	
 ---------------------------------*/
#include <bits/stdc++.h>
using namespace std;
/* variable type :- */
	# define ll long long int
	# define ld long double
	# define I int
/* map */
	# define abc  pair<long long int,long long int>
	map < pair < abc,abc > , long long int > pqr;
	map <  pair < long long int,long long int > ,long long int > xyz;	
/* vector */
	# define pb push_back
	# define pp pop_back
	# define ff first
	# define ss second
	# define mp make_pair
	# define ac accumulate
/* pairs */
	vector<pair<ll,ll>>a;
	vector<pair<pair<int,int>,pair<int,int> > > b;
	vector<pair<ll,pair<ll,ll>>>c;
	priority_queue<ll>pq; // pq.top() = Largest Element
	priority_queue<ll,vector<ll>,greater<ll>>bc; // bc.top() = Smallest Element
 
bool compare( const pair<long long int,long long int>&x , const pair<long long int,long long int>&y )
{
	return x.ff>y.ff;
}
bool sortbysec(const pair<int,int> &a,const pair<int,int> &b)
{
        return (a.ss < b.ss);
}
int main()
{
	ll n,k;
	 cin>>n>>k;
	ll y=n*k;
	if(y%2==0)
	{
	    cout<<"No";return 0;
	    
	}
	cout<<"Yes";
}

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

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define rep2(i,j,n) for(int i=(j);i<=(n);i++)
#define all(i) i.begin(),i.end()
#define INF 1e9

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;
typedef long long i64;

int main() {
	int a, b;
	string s;
	cin >> a >> s >> b;
	int ans;
	if (s == "+") ans = a + b;
	else ans = a - b;
	cout << ans << endl;
}

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

namespace ABC155_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var flag = a.Where(x => x % 2 == 0);
            if (flag.Any() && flag.Where(x => x % 3 != 0 && x % 5 != 0).Any())
            {
                Console.WriteLine("DENIED");
            }
            else
            {
                Console.WriteLine("APPROVED");
            }
        }
    }
}


Measured memory_bytes: 13396
#include<iostream>
#include<limits.h>
using namespace std;

int w[]={2,3,5,10,12,15};
int v[]={380,550,850,1520,1870,2244};
 
int dp[50+1];
void solve(){
    for(int i=0;i<51;i++){
        dp[i]=INT_MAX/3;
    }
    dp[0]=0;
    for(int i=0;i<6;i++){
        for(int j=w[i];j<=50;j++){
            dp[j]=min(dp[j],dp[j-w[i]]+v[i]);
        }
    }
}
 
int main(){
    solve();
    int n;
    while(cin>>n){
        if(n==0)break;
        n/=100;
        cout<<dp[n]<<endl;
    }
  return 0;
}

Measured memory_bytes: 1160
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let s = read::<String>().chars().collect::<Vec<_>>();
    if s.len() == s.iter().cloned().collect::<HashSet<_>>().len() {
        println!("yes");
    } else {
        println!("no");
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;

const ll LINF = 1001002003004005006LL;
const int INF = 1001001001;

const int mod = 1000000007;

int main() {
    string s; cin >> s;
    if (s == "ABC") puts("ARC");
    else puts("ABC");
    return 0;
}














Measured memory_bytes: 3620
#include <cmath>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
#define REP(i,n) for(int i = 0; i < n; i++)

int main(void)
{
    int N;
    int a[100];
    
    cin >> N;
    for(int i = 0; i < N; i++) cin >> a[i];

    sort(a, a+N, greater<int>());
    int alice = 0, bob =0;
    for(int i = 0; i < N; i++)
    {
        if(i % 2 ==0)
        {
            alice += a[i];
        }
        else
        {
            bob += a[i];
        }
    }

    cout << alice - bob << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

void insertSort(int A[],int N){
  int i,j,v;
  for(i=1;i<N;i++){
    j=i-1;
    v=A[i];
    while(j>=0&&A[j]>v){
      A[j+1]=A[j];
      j--;
    }
    A[j+1]=v;
    trace(A,N);
  }
}

void trace(int A[],int N){
  int i;
  for(i=0;i<N;i++){
    if(i>0) printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
}

int main(void){
  int n,i;
  scanf("%d",&n);
  int a[n];
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }

  trace(a,n);
  insertSort(a,n);
  return 0;
}

Measured memory_bytes: 604
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

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

int main(){
    ll N, K, Q;
    cin >> N >> K >> Q;
    ll A[Q];
    ll p[N];
    rep(i, N) p[i] = K - Q;
    rep(i, Q){
        cin >> A[i];
        p[A[i] - 1]++;
    }
    rep(i, N){
        if(p[i] > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
# define MOD 1000000007
int dp[101][100001];
long long util(int arr[], int n, int k, int i){
    if(i == n and k == 0) return 1;
    else if(k < 0 or i == n) return 0;
    if(dp[i][k] != -1) return dp[i][k];
    dp[i][k] = (MOD + util(arr, n, k, i+1) + util(arr, n, k-1, i) - util(arr, n, k-1-arr[i], i+1))%MOD;
    return dp[i][k]%MOD;
}
int main() {
	int n, k;
	cin>>n>>k;
	int arr[n];
	for(int i=0;i<n;i++){
	    cin>>arr[i];
	}
	memset(dp, -1, sizeof(dp));
	int res = util(arr, n, k, 0);
	cout<<res;
	return 0;
}

Measured memory_bytes: 47488
a,b,k=map(int,input().split())
if k>(b-a+1)//2:
    for i in range(a,b+1):
        print(i)
else:
    for i in range(a,a+k):
        print(i)
    for i in range(b-k+1,b+1):
        print(i)

Measured memory_bytes: 3060
module Main where

import Control.Applicative
import Numeric
import Data.List

main :: IO()
main = do
  { [n] <- getInts
  ; cards <- loop n
  ; putCards (allCards \\ cards)
  }

putCards :: [(Suit, Int)] -> IO()
putCards = putStr . unlines . map showCard

loop :: Int -> IO [(Suit, Int)]
loop 0 = return []
loop n = do
  {c <- getCard
  ; cs <- loop(n-1)
  ; return (c:cs)
  }

showCard :: (Suit, Int) -> String
showCard (s, n) = show s ++ " " ++ show n
--

data Suit = S | H | C | D deriving (Eq, Ord, Show, Read)

allCards :: [(Suit, Int)]
allCards = [ (s,r) | s <- [S, H, C, D] , r <- [1..13] ]

getCard :: IO (Suit, Int)
getCard = do
  { [s, r ] <- words <$> getLine
  ; return (read s, read r)
  }

getInts :: IO[Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO()
putInts = putStrLn . unwords . map show

getDoubles :: IO[Double]
getDoubles = map read . words  <$> getLine

putDoubles :: [Double] -> IO()
putDoubles = putStrLn . unwords . map showDouble

showDouble :: Double -> String
showDouble d = showFFloat Nothing d ""



Measured memory_bytes: 4204
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#define FI first
#define SE second
#define PF push_front
#define PB push_back
#define POF pop_front
#define POB pop_back
#define MA make_pair
#define ll long long
#define PA pair<int,int>
#define VE vector<int>
#define VP vector<PA>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
const int mod=1e9+7;
//
int main(){
  int A,B,C;
	cin>>A>>B>>C;
	if(A>B){
		swap(A,B);
	}
	if(B>C){
		swap(B,C);
	}
	int K;
	cin>>K;
	while(K){
		C*=2;
		K--;
	}
	cout<<A+B+C<<endl;
  return 0;
}


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

signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int a;
	string s;
	cin >> a >> s;
	if (a < 3200) cout << "red";
	else cout << s;
	return 0;
}

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

using namespace std;

char g[202][202];
int dp[202][202];

int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i = 1; i<=n; i++)
        scanf("%s",g[i]+1);
    for(int i = 1; i<=n; i++)
        for(int j = 1; j<=m; j++)
            dp[i][j] = 100000;
    dp[1][1]=0;
    if(g[1][1]=='#')
        dp[1][1] = 1;
    for(int i = 1; i<=n; i++){
        for(int j = 1; j<=m; j++){
            int adder = (g[i][j]=='.');
            if(i+1<=n)
                dp[i+1][j] = min(dp[i+1][j],dp[i][j]+adder*(g[i+1][j]=='#'));
            if(j+1<=m)
                dp[i][j+1] = min(dp[i][j+1],dp[i][j]+adder*(g[i][j+1]=='#'));
        }
    }
    printf("%d\n",dp[n][m]);
    return 0;
}

Measured memory_bytes: 384
from collections import Counter
def main():
    n = int(input())
    A = list(map(int, input().split()))
    c = Counter(A)
    l1, l2 = 0, 0
    for k, v in c.items():
        if k > l1:
            if v >= 4:
                l1, l2 = k, k
            elif 2 <= v <= 3:
                l1, l2 = k, l1
            else:
                pass
        elif l2 < k <= l1 and v >= 2:
            l2 = k
    print(l1 * l2) 

if __name__ == '__main__':
    main()


Measured memory_bytes: 68760
N = int(input())
A = [input() for _ in range(N)]

n = 0
Acount, Bcount,both = 0,0,0
for a in A:
    n += a.count("AB")
    if (a[0]=="B")&(a[-1]=="A"):both+=1
    elif a[0] == "B":Bcount+=1
    elif a[-1] == "A":Acount+=1

# print(n,Acount,Bcount,both)
n += min(Acount,Bcount)
if Acount+Bcount>0:n += both
elif both>0:n += both-1
print(n)


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

using namespace std;

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

typedef long long ll;
int const inf = INT_MAX / 2;

int main() {
  int N; cin >> N;
  vector<string> v(N);
  rep(i, N) cin >> v[i];
  int n_xa = 0, n_ba = 0, n_bx = 0;
  int n_inside = 0;
  rep(i, N) {
    n_xa += v[i][0] != 'B' && v[i].back() == 'A';
    n_ba += v[i][0] == 'B' && v[i].back() == 'A';
    n_bx += v[i][0] == 'B' && v[i].back() != 'A';
    rep(k, (int)v[i].size() - 1) {
      n_inside += v[i][k] == 'A' && v[i][k + 1] == 'B';
    }
  }
  int ans = n_inside;
  ans += n_ba ? !!n_xa + (n_ba - 1) + !!n_bx : 0;
  ans += min(n_xa - (n_ba && n_xa), n_bx - (n_ba && n_bx));
  cout << ans << endl;
}


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

using pii = pair<int, int>;
using ll = long long;

constexpr int INF = 1e9;
constexpr ll INFLL = 1e18;

constexpr int M = 1e9 + 7;

int main() {
    int n, k; cin >> n >> k;
    vector<int> x(n), y(n);
    vector<char> c(n);
    for(int i = 0; i < n; ++i) {
        cin >> x[i] >> y[i] >> c[i];
    }
    vector<vector<vector<int>>> cnt(2, vector<vector<int>>(4 * k));
    for(int i = 0; i < n; ++i) {
        cnt[c[i] == 'W'][x[i] % (2 * k)].push_back(y[i] % (2 * k));
        cnt[c[i] == 'W'][x[i] % (2 * k)].push_back((y[i] % (2 * k)) + 2 * k);
        cnt[c[i] == 'W'][(x[i] % (2 * k)) + 2 * k].push_back(y[i] % (2 * k));
        cnt[c[i] == 'W'][(x[i] % (2 * k)) + 2 * k].push_back((y[i] % (2 * k)) + 2 * k);
    }
    for(int i = 0; i < 2; ++i) {
        for(int j = 0; j < 4 * k; ++j) {
            sort(begin(cnt[i][j]), end(cnt[i][j]));
        }
    }
    int ans = 0;
    for(int i = 0; i < 2 * k; ++i) {
        int t = 0;
        deque<pii> deq1, deq2;
        for(int j = 0; j < 2 * k; ++j) {
            if(!deq1.empty() && j - deq1.front().first >= k) {
                t -= deq1.front().second;
                deq1.pop_front();
            }
            if(!deq2.empty() && j - deq2.front().first >= k) {
                t -= deq2.front().second;
                deq2.pop_front();
            }
            int t1 = lower_bound(begin(cnt[0][j]), end(cnt[0][j]), i + k) - lower_bound(begin(cnt[0][j]), end(cnt[0][j]), i);
            t1 += lower_bound(begin(cnt[0][j + k]), end(cnt[0][j + k]), i + 2 * k) - lower_bound(begin(cnt[0][j + k]), end(cnt[0][j + k]), i + k);
            int t2 = lower_bound(begin(cnt[1][j + k]), end(cnt[1][j + k]), i + k) - lower_bound(begin(cnt[1][j + k]), end(cnt[1][j + k]), i);
            t2 += lower_bound(begin(cnt[1][j]), end(cnt[1][j]), i + 2 * k) - lower_bound(begin(cnt[1][j]), end(cnt[1][j]), i + k);
            t += t1 + t2;
            ans = max(ans, t);
            deq1.emplace_back(j, t1);
            deq2.emplace_back(j, t2);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3712
#include <iostream>
#include <string>
#include <stdlib.h>
#include <cmath>
#include <iomanip>
using namespace std;

int main(){

    long long a,b,c,d;
    cin>>a>>b>>c>>d;

    long long ans=a*c;

    //if(ans<=a*c)    ans=a*c;
    if(ans<=a*d)    ans=a*d;
    if(ans<=b*c)    ans=b*c;
    if(ans<=b*d)    ans=b*d;

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

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int N;
  cin >> N;
  vector<ll> A, B;
  rep(i,N+1){
    ll a;
    cin >> a;
    A.push_back(a);
  }
  rep(i,N){
    ll b;
    cin >> b;
    B.push_back(b);
  }

  ll ret = 0;
  rep(i,N){
    ll lhs = min(A[i], B[i]);
    ret += lhs;
    A[i] -= lhs;
    B[i] -= lhs;
    ll rhs = min(A[i+1], B[i]);
    ret += rhs;
    A[i+1] -= rhs;
    B[i] -= rhs;
  }

  cout << ret << endl;
  
  return 0;
}



Measured memory_bytes: 2548
#define _CRT_SECURE_NO_WARNINGS

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

typedef unsigned int uint;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef map<int, int> mii;
typedef pair<int, ii> edge;


#define sc(x)  scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mem(arr,val) memset(arr,val,sizeof arr)
#define sz(v) (int)v.size()
#define rsz(v) v.resize
#define clr(v) v.clear()
#define rev(v) reverse(all(v))
#define lop(i,end) for(int i=0; i<end; i++)
#define rlop(i,start) for(int i=start-1; i>=0; i--)
#define loop(i,start,end) for(int i=start; i<end; i++)
#define rloop(i,start,end) for(int i=start-1; i>=end; i--)
#define PB push_back
#define pb pop_back
#define mP make_pair
#define f first
#define s second

const ll OO = (ll)(4e18) + 9;
const int MOD = (int)(1e9) + 7;
const int oo = 2147483647;
const double EPS = 1e-8;
const double PI = acos(-1.0);

//enum dir { D, R, U, L , dr, ur, dl, ul };
int dx[] = { 1, 0, -1, 0, 1, -1, 1, -1 };
int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

string abc = "abcdefghijklmnopqrstuvwxyz";
string vowels = "aeiouy"; //and sometimes "aeiouy"

template<typename X, typename Y> bool ckmin(X& a, Y b) { return a > b ? a = b, true : false; }
template<typename X, typename Y> bool ckmax(X& a, Y b) { return a < b ? a = b, true : false; }
bool cklex(string &a, string b) {
	if (b == "") return false;
	if (a == "") return a = b, true;
	if (sz(a) < sz(b)) return false;
	if (sz(b) < sz(a)) return a = b, true;
	if (a < b) return false;
	return a = b, true;
}

int dcmp(ld d1, ld d2) { return fabs(d1 - d2) <= EPS ? 0 : d1 > d2 ? 1 : -1; } //Compare Double Numbers
ll gcd(ll x, ll y) { return !y ? x : gcd(y, x%y); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
int conv_2_1(int r, int c, int nCol) { return (nCol*r) + c + 1; } //convert index from 2D array to 1D array. (Zero-indexed)
ii conv_1_2(int n, int nCol) { return{ n / nCol, n % nCol }; } //convert index from 1D array to 2D array (row, col). (Zero-indexed)
template<typename T> void inter(T X) { cout << X << endl; fflush(stdout); }



int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	ios_base::sync_with_stdio(false); cin.tie(NULL);

	int t = 1;
	//cin >> t;
	while (t--) {
		int a, b, c, k;
		cin >> a >> b >> c >> k;
		while (b <= a and k) b *= 2, k--;
		while (c <= b and k) c *= 2, k--;
		if (a < b and b < c) cout << "Yes\n";
		else cout << "No\n";
	}


	return 0;
}


Measured memory_bytes: 3612
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        String s = sc.next();
        int fast = 0;
        int slow = 0;
        int limit = 0;
        int max = 0;
        while(fast < s.length() && slow < s.length()) {
            if(s.charAt(fast) == '0') {
                while(fast < s.length() && s.charAt(fast) == '0') {
                    fast++;
                }
                limit++;
                if(limit <= k && fast < s.length()) max = Math.max(max, fast - slow + 1);
                if(limit <= k && fast == s.length()) max = Math.max(max, fast - slow);
                while(limit > k && slow <= fast) {
                    if(s.charAt(slow) == '0') {
                        while(slow < s.length() && s.charAt(slow) == '0') slow++;
                        limit--;
                        if(limit <= k && fast < s.length()) max = Math.max(max, fast - slow + 1);
                        if(limit <= k && fast == s.length()) max = Math.max(max, fast - slow);
                    } else {
                        slow++;
                    }
                }
            } else {
                max = Math.max(max, fast - slow + 1);
                fast++;
            }
        }
        System.out.println(max);
    }
}


Measured memory_bytes: 25300
S = input()
T = input()
count = 0
flg = False
if len(S) < len(T):
    print('UNRESTORABLE')
    exit()
while True:
    flg = False
    for i in range(1,len(T)+1):
        if S[-i-count] != T[-i] and S[-i-count] != '?':
            count += 1
            flg = True
            break
    if count == len(S) - len(T) + 1:
        print('UNRESTORABLE')
        exit()
    if not flg:
        if count == 0:
            ans = S[0:len(S)-len(T)] + T
        elif count == len(S)-len(T):
            ans = T + S[len(T):]
        else:
            ans = S[0:len(S)-len(T)-count] + T + S[-count:]
        print(ans.replace('?','a'))
        exit()

Measured memory_bytes: 38256
#include <vector>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <ctime>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <cassert>
#include <stack> 

#define INFLL 2000000000000000000
#define INF 2000000000
#define MOD 1000000007
#define BASE 77747
#define PI acos(-1.0)
#define MAXLEN 29

typedef std::pair <int, int> pii;
typedef long long ll;
typedef std::vector <ll> vll;

using namespace std;

int d, g;
int p[10], c[10];
int dp[10][1001];

int main() {
	string str;
	cin >> str;
	if (str[0] != 'A') {
		cout << "WA" << endl;
		return 0;
	}
	int cnt = 0;
	for (int i = 2; i < str.length() - 1; i++) if (str[i] == 'C') cnt++;
	if (cnt != 1) {
		cout << "WA" << endl;
		return 0;
	}
	cnt = 0;
	for (int i = 0; i < str.length(); i++) if (str[i] >= 'A' && str[i] <= 'Z') cnt++;
	if (cnt != 2) {
		cout << "WA" << endl;
		return 0;
	}
	cout << "AC" << endl;
	return 0;
}


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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()      //昇順
#define RALL(obj) (obj).rbegin(), (obj).rend()   //降順
#define print(obj) cout << obj << endl
#define scan(obj) cin >> obj

typedef long long ll;

using namespace std;

int main(void){
    int n, d;
     cin >> n >> d;
     int ans = (int)ceil((double)n / (double)(2 * d + 1));
     print(ans);
}


Measured memory_bytes: 256
N = gets.to_i

def digit(n)
    n.to_s.length
end

a = []
a[0] = digit(N)

for i in 1..N ** (0.5)

    if N % i == 0

        a[i] = digit(N/i)

    elsif N % i != 0

        a[i] = digit(N)

    end

end

puts a.min

Measured memory_bytes: 2632
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
INF = float("inf")


def solve(K: int):

    X = set()

    def rec(keta, val):
        X.add(val)
        if keta == 10:
            return

        for j in range(-1, 2):
            add = (val % 10)+j
            if add >= 0 and add <= 9:
                rec(keta+1, val*10+add)

    for i in range(1, 10):
        rec(1, i)
    X = sorted(X)
    print(X[K-1])

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    solve(K)


if __name__ == '__main__':
    main()


Measured memory_bytes: 21828
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

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

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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

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

    vector<vector<int>> a(n, vector<int>(m, 0));
    vector<int> c(n);
    for(int in=0;in<n;in++) {
        cin >> c.at(in);
        for(int im=0;im<m;im++) {
            cin >> a.at(in).at(im);
        }
    }

    bool flg;
    int ans = 1e9, anstmp;
    for(int ib=0;ib<(1<<n);ib++) {
        vector<int> algo(m);
        anstmp = 0;
        flg = true;
        for(int in=0;in<n;in++) {
            if(((ib>>in)&1)) {
                for(int im=0;im<m;im++) {
                    algo.at(im) += a.at(in).at(im);
                }
                anstmp += c.at(in);
            }
        }
        for(int im=0;im<m;im++) {
            if(algo.at(im)<x) { 
                flg = false;
            }
        }
        if(flg) ans = min(ans, anstmp);
    }

    if(ans==1e9) ans = -1;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3640
taka_hp, taka_atk, aoki_hp, aoki_atk = [int(x) for x in input().split()]
a = False
while a == False:
    aoki_hp -= taka_atk
    if aoki_hp <= 0:
        a = True
        print('Yes')
        break
    taka_hp -= aoki_atk
    if taka_hp <= 0:
        a = True
        print('No')
        break

Measured memory_bytes: 9036
#include<bits/stdc++.h>
using namespace std;
#define INF 1000000000


//???????????????
int di[6] = {1, 1, 0, -1, -1, 0};
int dj[6] = {0, 1, 1, 0, -1, -1};

int main(){

    while(1){

        int n, t; cin >> t >> n;
        if(n == 0 && t == 0) break;
        vector<vector<bool> > canGo(1000, vector<bool> (1000, true));
        for(int k = 0; k < n; k++){
            int i, j; cin >> i >> j;

            //??§?¨???????
            i += 100;
            j += 100;
            canGo[i][j] = false;
        }
        int si, sj; cin >> si >> sj;
        si += 100;
        sj += 100;

        //???????????????s????????±????????\??????????????????????????¢????????????
        queue<pair<int, pair<int, int> > > wait;
        wait.push(make_pair(0, make_pair(si, sj)));
        canGo[si][sj] = false;

        //??\???????????????
        int counter = 1;
        while(!wait.empty()){    //?????\???????????????????????§
            //?????\????????????????´????????????????
            int nowcost = wait.front().first;
            int nowi = wait.front().second.first;
            int nowj = wait.front().second.second;

            wait.pop();

            //???????????°??????????????????????????¢?´¢?????????
            if(nowcost == t){
                continue;
            }

            //??????????????¢?´¢
            for(int k = 0; k < 6; k++){
                int nexti = nowi + di[k];
                int nextj = nowj + dj[k];

                //??????????????????????????????
                if(canGo[nexti][nextj]){
                    //????????????????????\???????????????
                    //??????????´¢???????????¨????????????????£???§?????????
                    wait.push(make_pair(nowcost + 1, make_pair(nexti, nextj)));
                    canGo[nexti][nextj] = false;
                    counter++;
                }
            }
        }

        cout << counter << endl;
    }

    return 0;
}

Measured memory_bytes: 3208
class Doubling:
    m = 0
    to = [[]]
    # fを次の値を得る関数として、[0,n)のvについて最大でf^k(v)を得られる。
    def __init__(self, n, f, k):
        while k > 0:
            k = k >> 1
            self.m += 1
        self.to = [[-1] * n for _ in range(self.m+1)]
        for j in range(n):
            self.to[0][j] = f(j)
        for i in range(self.m):
            for j in range(n):
                if self.to[i][j] == -1:
                    self.to[i+1][j] = -1
                else:
                    self.to[i+1][j] = self.to[i][self.to[i][j]]

    # p番目の値のq個先を得る。
    def query(self, p, q):
        for i in range(self.m+1):
            if p == -1:
                break
            if (q >> i) & 1:
                p = self.to[i][p]
        return p

n,k = map(int, input().split())
a = list(map(int, input().split()))

d = Doubling(n, lambda x: a[x]-1, k)
print(d.query(0, k) + 1)


Measured memory_bytes: 174780
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

func warshallFloyd(d [][]int, n int) [][]int {
	for k := 0; k < n; k++ {
		for i := 0; i < n; i++ {
			for j := 0; j < n; j++ {
				d[i][j] = min(d[i][j], d[i][k] + d[k][j])
			}
		}
	}

	return d
}

func main() {
	sc.Split(bufio.ScanWords)
	const inf = 1<<60 - 1

	n, m, l := nextInt(), nextInt(), nextInt()

	dist, fuel := make([][]int, n), make([][]int, n)
	for i := 0; i < n; i++ {
		dist[i] = make([]int, n)
		fuel[i] = make([]int, n)
		for j := 0; j < n; j++ {
			dist[i][j] = inf
			fuel[i][j] = inf
		}
		dist[i][i] = 0
		fuel[i][i] = 0
	}

	for i := 0; i < m; i++ {
		a, b, c := nextInt()-1, nextInt()-1, nextInt()
		dist[a][b] = c
		dist[b][a] = c
	}

	dist = warshallFloyd(dist, n)
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if i == j {
				continue
			}
			if dist[i][j] <= l {
				fuel[i][j] = 1
			}
		}
	}
	fuel = warshallFloyd(fuel, n)

	q := nextInt()
	qs := make([][]int, q)
	for i := 0; i < q; i++ {
		qs[i] = []int{nextInt()-1, nextInt()-1}
	}
	for i := 0; i < q; i++ {
		from, to := qs[i][0], qs[i][1]
		if fuel[from][to] < inf {
			fmt.Println(fuel[from][to]-1)
		} else {
			fmt.Println(-1)
		}
	}
}

Measured memory_bytes: 7424
N = int(input())
S = input()

total_comb = S.count('R')*S.count('G')*S.count('B')

minus = 0
for i in range(N-2):
    for j in range(i+1, N):
        k = 2*j - i
        if k < N:
            if (S[i] != S[j]) and (S[j] != S[k]) and (S[k] != S[i]):
                minus += 1

print(total_comb - minus)


Measured memory_bytes: 68068
#include <iostream>

#include <deque>

#include <stdio.h>

#include <cstdio>

#include <algorithm>

#include<bits/stdc++.h>

#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define sp <<" "
#define nw <<"\n"
#define ca "Case "<<tc++<<": "
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
#define ull unsigned LL
#define check cout<<"* ";
#define show_vector for(int q=0;q<s.size();q++){cout<<s[q]<<" ";}
#define REP(i,n) for (int i=0;i<(n);++i)
#define N_MAX 26

const int inf=1<<30;
const long long int INF=1e10;
const int MOD=1e9+7;
const int maxn = 1e5+10;

using namespace std;

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

int N, Q;
string balls;
vector<pii> relations; // (x, y) in relations <=> x < y

int main(){

    int a,b;
    cin>>a>>b;
    cout<<(a*b) nw;
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main()
{
    int a,b;
    string s;
    vector<int> d(0);
    while (cin>>a>>b)
    {
        d.push_back(0);
        a+=b;
        s=to_string(a);
        d[d.size()-1]=s.size();
    }
    for (int i=0; i<d.size(); i++) cout<<d[i]<<'\n';
    return 0;
}



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

int main(){
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  while(A>0 && C>0){
    C -= B;
    if(C<=0){cout << "Yes"; break;}
    A -= D;
    if(A<=0) cout << "No";
  }
    
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) find(Range(c), x) != c.end()
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Vec2(T, n, m, xs) vector<vector<T>> xs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, n, xs, sxs) vector<T> sxs(n+1); For(i, n) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, x) T x; cin >> x
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; For(i, n){ Cin(T, x); map[x] ++; }
#define Cout(x) cout << (x) << "\n"
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define Couty(cond) Cout((cond) ? "Yes" : "No")
#define CoutY(cond) Cout((cond) ? "YES" : "NO")

using namespace std;
using ll = long long;

int main(void){
  Cin(int, n);
  Cin(int, k);
  Cins(int, n, x);
  int ans = 0;
  For(i, n) ans += min(x[i], k-x[i]);
  Cout(2*ans);
}


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

int main()
{
	char s[1000],t[1000];
  	string x,y;
	cin>>s>>t;
	sort(s,s+strlen(s));
  	sort(t,t+strlen(t),greater<char>());
  	x=s;
  	y=t;
  	if(x<y)
		cout<<"Yes";
  	else
      	cout<<"No";
}

Measured memory_bytes: 256
import itertools

N = int(input()) 
P = input().split()
Q = input().split()

P = tuple(map(int,P))
Q = tuple(map(int,Q))

list_N = list(range(N))
list_N.append(N)
list_N.remove(0)
list_all = []

for i in itertools.permutations(list_N): 
    list_all.append(i)

a = (list_all.index(P)) + 1
b = (list_all.index(Q)) + 1

print(abs(a-b))


Measured memory_bytes: 7924
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define rando mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define fi first
#define se second
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define debugii(x) cerr << " - " << #x << ": " << x.fi<<","<<x.se << endl;
#define sep() cerr << "--------------------" << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ld long double
#define ll long long
#define int ll
#define ii pair<int,int>
#define v vector<int>
#define vii vector<ii>
#define vv vector<vector<int> >
#define mp make_pair
#define INF 1000000000
#define pb push_back
#define EPS 1e-9
const int MOD = 998244353; // 998244353
const int MAXN = 200005;
int factorial[MAXN+5];
int binpow(int a, int b) {
    a %= MOD;
    int res = 1;
    while (b > 0LL) {
        if (b & 1LL)
            res = (res * a) % MOD;
        a = (a * a) % MOD;
        b >>= 1LL;
    }
    return res;
}
int inverse(int a){
	return binpow(a,MOD-2);
}
int b_c(int n, int k) {
    return (((factorial[n] * inverse(factorial[k]) )% MOD) * inverse(factorial[n - k])) % MOD;
}
int32_t main(){
	boost;
	//freopen(".in","r",stdin);
	factorial[0] = 1;
	for (int i = 1; i <= MAXN; i++) {
	    factorial[i] = (factorial[i - 1] * i) % MOD;
	}
	int n,m,k,ans=0;
	cin>>n>>m>>k;
	for (int i = 0; i <= k; ++i)
		ans=(ans+(((b_c(n-1,i)*binpow(m-1,n-1-i))%MOD*m)%MOD))%MOD;
	cout<<ans<<"\n";
	return 0;
}
//int
//array bounds
//special cases
//binary search

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

using namespace std;

int main(){
  string a;
  string b;
  int n=0;

  cin >> a;
  cin >>b;
  for(unsigned int i = 0; i < a.size(); ++i){
    if(a[i]==b[i])continue;
    n++;
  }
  cout << n <<endl;
  return 0;
}

Measured memory_bytes: 3888
import sys

p = 0
for line in sys.stdin:
    ls = line.strip('\n')
    if p == 0:
        if ls =='-': break
        letters = ls
        p = 1
    elif p == 1:
        m = int(ls)
        p =2
    elif p == 2:
        h = int(ls)
        letters = letters[h:] + letters[:h]
        if m > 1:
            m -= 1
        else:
            print letters
            p = 0

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

using namespace std;

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

int main() {
  ios:: sync_with_stdio(false);
  cin.tie();
  int n;
  string s;
  cin >> n >> s;
  set<string> st1, st2, st3;
  for (int i = 0; i < n; i++) {
    for (auto x : st2) {
      string cur = x + s[i];
      st3.insert(cur);
    }
    for (auto x : st1) {
      string cur = x + s[i];
      st2.insert(cur);
    }
    string cur;
    cur += s[i];
    st1.insert(cur);
  }
  cout << (int)st3.size();
  return 0;
}




Measured memory_bytes: 3768
#include <iostream>

using namespace std;

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	int sum = 0;
	while (a != 0 && k != 0  ) {
		k--;
		a--;
		sum++;
	}
	while ( b != 0 && k != 0 ) {
		k--;
		b--;
	} while (k != 0 && c != 0) {
		k--;
		c--;
		sum--;
	}



	cout << sum << endl;
	return 0;

}


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

int n, K;
long long cnt[201000];

int main(void) {
  scanf("%d%d", &n, &K);
  for(int i = 1; i <= n; i++)
    cnt[i % K]++;
  long long Ans = K % 2 == 0 ? cnt[K / 2] * cnt[K / 2] * cnt[K / 2] : 0;
  printf("%lld\n", cnt[0] * cnt[0] * cnt[0] + Ans);
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main () {
	int x1,y1,x2,y2;
	cin >> x1 >> y1 >> x2 >> y2;
	int vecX,vecY;
	vecX = x2 - x1;
	vecY = y2 - y1;
	cout <<x2 - vecY << " ";
	cout <<y2 + vecX << " ";
	cout <<x2 - vecY - vecX << " ";
	cout <<y2 + vecX - vecY << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace _0514
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
                if (x.Max() == 0) break;
                int[] safe = new int[x.Sum() + 1];
                for (int i = 0; i <= x.Sum(); i++) safe[i] = 2;
                int n = int.Parse(Console.ReadLine());
                List<int[]> list = new List<int[]>();
                for (int i = 0; i < n; i++)
                {
                    int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
                    if (a[3] == 1)
                    {
                        for (int j = 0; j < 3; j++) safe[a[j]] = 1;
                    }
                    else
                    {
                        list.Add(new int[] { a[0],a[1],a[2] });
                    }
                }
                foreach (var item in list)
                {
                    List<int> unknown = new List<int>();
                    bool flag = true;
                    foreach (var a in item)
                    {
                        if (safe[a] == 0) flag = false;
                        else if (safe[a] == 2) unknown.Add(a);
                    }
                    if (flag && unknown.Count == 1) safe[unknown[0]] = 0;
                }
                for (int i = 1; i <= x.Sum(); i++) Console.WriteLine(safe[i]);
            }
        }
    }
}


Measured memory_bytes: 9776
#include <bits/stdc++.h>
using namespace std;
using sint = int64_t;

template<class T> T read() {
	T t;
	cin >> t;
	return t;
}

template<class T> vector<T> read_vector(sint n) {
	vector<T> vs;
	for (sint i = 0; i < n; ++i) {
		vs.push_back(read<T>());
	}
	return vs;
}

inline void write() {
}

template<class T> void write(T const& t) {
	cout << t;
}

template<class T> void write(vector<T> const& ts) {
	if (ts.size() > 0) {
		cout << ts[0];
	}
	for (size_t i = 1; i < ts.size(); ++i) {
		cout << ' ' << ts[i];
	}
}

template<class T, class... Args> void write(T const& t, Args const&... args) {
	cout << t << ' ';
	write(args...);
}

template<class... Args> void writeln(Args const&... args) {
	write(args...);
	cout << '\n';
}

int main() {
	ios_base::sync_with_stdio(false);
	cin .exceptions(ios_base::badbit | ios_base::failbit);
	cout.exceptions(ios_base::badbit | ios_base::failbit);
	cin .tie(nullptr);
	cout.tie(nullptr);
	cout.precision(16);
	void run();
	run();
	return 0;
}

void run() {
	auto const N = read<sint>();
	auto const S = read<string>();
	if (S.substr(0, N / 2) == S.substr(N / 2, N)) {
		writeln("Yes");
	}
	else {
		writeln("No");
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007; 
typedef long long ll;
typedef string str;
#define rep(x, y) for(int x = 0; x < (y); x++)
#define REP(x, z, y) for(int x = (z); x < (y); x++)
#define all(x) x.begin(), x.end()
#define len(x) (sizeof(x) / sizeof(x[0]))
#define split_str(str, sp_word) istringstream stream(str); string res; for(int cnt = 0; getline(stream,res,sp_word); cnt++)
#define scanln(x) fgets(x, sizeof x, stdin)
#define down_queue(x) priority_queue<x>
#define up_queue(x) priority_queue<x, vector<x>, greater<x>>
#define i_str(x) atoi(x.c_str())
#define digit(x) ((int)log10((double)(x)) + 1)
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define out(x) cout << (x) << endl;
#define outs(x) for(auto i : x) cout << i << " ";
ll gcd(ll a,ll b){while(b){ll tmp = a % b;a = b;b = tmp;}return a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}

int main() {
  ll n; cin >> n;
  ll tmp,ans; cin >> ans;
  rep(i,n - 1){
    cin >> tmp;
    ans = lcm(ans,tmp);
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
// AtCoder template
// sabaより胡蝶しのぶさんの方が可愛いのではないか？
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < n; ++i)

vector<vector<int>> graph(2001);
vector<int> ans(2002,0);
int n;
vector<bool> visited(2001,false);

void bfs(int s){
    queue<pair<int,int>> que;
    que.emplace(s,0);
    vector<bool> visited(n);
    while(!que.empty()){
        int now = que.front().first;
        int depth = que.front().second;
        que.pop();
        if(visited[now]) continue;
        visited[now] = true;
        if(s < now) ans[depth]++;
        
        rep(i,graph[now].size()){
            int next = graph[now][i];
            que.emplace(next,depth+1);
        }
    }
}

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

    int x, y; cin >> n >> x >> y;
    x--; y--;

    rep(i,n-1){
        graph[i].push_back(i+1);
        graph[i+1].push_back(i);
    }
    graph[x].push_back(y);
    graph[y].push_back(x);

    rep(i,n) bfs(i);
    
    rep(i,n-1) cout << ans[i+1] << "\n";    
}

Measured memory_bytes: 384
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

fun main(args: Array<String>) {
    val (N, M) = readIntList()
    val lr = Array(M) {
        val list = readIntList()
        Pair(list[0], list[1])
    }

    var resRange = Pair(1, N)
    for (p in lr) {
        if (resRange.first < p.first) {
            resRange  = Pair(p.first, resRange.second)
        }
        if (resRange.second > p.second) {
            resRange = Pair(resRange.first, p.second)
        }
    }

    val res = (resRange.second - resRange.first + 1).coerceAtLeast(0)
    println(res)
}

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

bool flag(int a,int b,int c){
	return( (a < b+c) && (b < a+c) && (c < b+a)  );
}

int main(){
	ios_base ::sync_with_stdio(false);
	cin.tie(NULL);
	int n;cin>>n;
	int v[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>v[i];
	}
	sort(v,v+n);
	int count = 0;
	for (int i = 0; i < n-2; ++i)
	{
		
		for (int j = i+1; j <n-1 ; ++j)
		{
			for (int k = j+1; k < n; ++k)
			{
				if(flag(v[i],v[k],v[j]) )
					count++;
				
			}
		}
	}
	cout<<count<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>
#include<map>
#include<queue>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))


int main(){
	int n,h,l;
	char s[9];
	scanf("%d",&n);
	while(n--){
		scanf("%s",s);
		sort(s,s+8);
		l=atoi(s);
		sort(s,s+8,greater<char>());
		h=atoi(s);
		printf("%d\n",h-l);
	}
	return 0;
}

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

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound

int N;
string S[100100];

signed main() {
    cin >> N;
    rep(i, N) {
        cin >> S[i];
        sort(S[i].begin(), S[i].end());
    }
    sort(S, S + N);
    int ans = 0;
    rep(i, N) {
        ans += u_b(S, S + N, S[i]) - l_b(S, S + N, S[i]) - 1;
    }
    cout << ans / 2 << endl;
    return 0;
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
using ll = long long;
struct segtree{
	using D = long long;
	D inf = 1e18;

	int N;
	vector<D> val;

	segtree(){}
	segtree(int n){
		N=1;
		while(N<n) N*=2;
		val.assign(N*2,-inf);
	}
	segtree(const vector<D>& ds){
		int n = ds.size();
		N=1;
		while(N<n) N*=2;
		val.assign(N*2,-inf);
		rep(i,n) val[i+N] = ds[i];
		for(int i=N-1;i>0;i--) val[i] = max(val[i*2],val[i*2+1]);
	}
	void assign(int k,D d){
		k+=N;
		val[k]=d;
		k/=2;
		while(k){
			val[k] = max(val[k*2],val[k*2+1]);
			k/=2;
		}
	}
	D getmax(int a,int b){
		D res = -inf;
		a+=N,b+=N;
		while(a<b){
			if(a&1) chmax(res,val[a++]);
			if(b&1) chmax(res,val[--b]);
			a/=2,b/=2;
		}
		return res;
	}
};
int main(){
	int N;
	cin>>N;
	segtree seg(N+1);
	ll ans = 0;
	ll sump = 0;
	rep(i,N){
		ll x,p;
		cin>>x>>p;
		seg.assign(i,x-sump);
		sump += p;
		ll tmp = sump + seg.getmax(0,i+1) - x;
		chmax(ans,tmp);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 4480