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

int dp[50];

int fibo(int n)
{
  if(n==0)return dp[n]=1;
  else if(n==1)return dp[n]=1;
  else if(dp[n]!=-1)return dp[n];
  else return dp[n]=fibo(n-1)+fibo(n-2);
}

int main()
{
  int n,i;
  for(i=0;i<50;i++)dp[i]=-1;
  scanf("%d",&n);
  printf("%d\n",fibo(n));

  return 0;
}



Measured memory_bytes: 2056
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
#include <tuple>
#include <random>

using namespace std;
typedef long long int ll;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()

#define inf 10000000000

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

    ll n, i;
    cin >> n >> i;
    cout << n - i + 1 << endl;
}

Measured memory_bytes: 256
let () = Scanf.scanf "%d\n" @@ fun n ->
    if n == 1 then Printf.printf "%d\n" 0 else
    let sqrtn = (int_of_float @@ sqrt @@ float_of_int n) + 1
    in let is_primes = Array.init (sqrtn + 1) @@ fun n -> (n, true)
    in let sieve (i, is_prime) =
        if i >= 2 && is_prime
        then
            let rec multiple_to_false j =
                if i * j <= sqrtn then (
                    Array.set is_primes (i * j) (i * j, false);
                    multiple_to_false @@ j + 1
                )
            in multiple_to_false 2
    in ignore @@ Array.map sieve is_primes;
    let rec get_exp e n p =
        if (n mod p) == 0 then get_exp (e + 1) (n / p) p else e
    in let rec get_pow p e =
        if e == 0 then 1 else p * (get_pow p @@ e - 1)
    in let rec get_res n p =
        let e = get_exp 0 n p
        in let rec get_val i =
            if (i + 1) * (i + 2) / 2 <= e then get_val (i + 1)
            else i
        in get_val 0
    in let quot = Array.fold_left
        (fun x y -> x / y) n @@
        Array.map (fun (i, is_prime) -> if i >= 2 && is_prime then get_pow i (get_exp 0 n i) else 1) is_primes
    in Printf.printf "%d\n" @@ Array.fold_left (+) (if quot > 1 then 1 else 0) @@
        Array.map (fun (i, is_prime) -> if i >= 2 && is_prime then get_res n i else 0) is_primes
    


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

using ll = int64_t;

signed main(){

  int n;
  cin>>n;
  vector<ll> a(n);
  for(auto& ai:a)cin>>ai;

  map<ll,ll> odd,eve;
  for(int i=0;i<n;++i){
    if(i&1)odd[a[i]]++;
    else eve[a[i]]++;
  }

  using pll = pair<ll,ll>;
  vector<pll> a_odd,a_eve;
  for(auto x:odd)a_odd.emplace_back(x);
  for(auto x:eve)a_eve.emplace_back(x);
  auto cmp = [](pll a,pll b){return a.second>b.second;};
  sort(begin(a_odd),end(a_odd),cmp);
  sort(begin(a_eve),end(a_eve),cmp);

  if(a_odd[0].first!=a_eve[0].first){
    cout<< n-a_odd[0].second-a_eve[0].second <<endl;
  }else{
    if(a_odd.size()==1&&a_eve.size()==1){
      cout<< n-max(a_odd[0].second,a_eve[0].second) <<endl;
    }
    else if(a_odd.size()==1){
      cout<< n-a_odd[0].second-a_eve[1].second <<endl;
    }
    else if(a_eve.size()==1){
      cout<< n-a_odd[1].second-a_eve[0].second <<endl;
    }
    else{
      ll tmp1 = a_odd[0].second+a_eve[1].second;
      ll tmp2 = a_odd[1].second+a_eve[0].second;
      cout<< min(n-tmp1,n-tmp2) <<endl;
    }
  }

}

Measured memory_bytes: 9592
import java.util.Scanner;


public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int input = sc.nextInt();
			
			if(input == 0){
				break;
			}
			
			int limit = (int)Math.sqrt(input);
			
			int count = 0;
			
			for(int i = 1; i <= limit; i++){
				if(i*i == input){
					count++;
					break;
				}
				
				for(int j = i; j <= limit; j++){
					if(i*i + j*j == input){
						count++;
						break;
					}
					
					for(int k = j; k <= limit; k++){
						if(i*i + j*j + k*k == input){
							count++;
							break;
						}
						
						for(int l = k; l <= limit; l++){
							if(i*i + j*j + k*k + l*l == input){
								count++;
								break;
							}
						}
							
					}
				}
			}
			
			System.out.println(count);
		}
	}

}



Measured memory_bytes: 27200
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 20)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね

//ここから編集する


int main() {

    string s;
    cin >> s;
    cout << s.substr(0,s.size() - 8) << endl;
    return 0;
}


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


int main(){
                                                                     

    int n, k;


    cin >> n;


    if( n % 2 == 0 ) k = n;

    else k = 2 * n;


    cout << k << endl;


    return 0;

    }

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

int main() {
  int n,a,b;cin>>n>>a>>b;
  int allpass=0,outpass=0;
  string s;cin>>s;
  for(int i=0;i<n;i++){
  	if(s[i]=='a' && a+b>allpass){
      	cout<<"Yes"<<endl;
    	allpass++;
    }else if(s[i]=='b' && a+b>allpass && b>outpass){
      	cout<<"Yes"<<endl;
    	allpass++;
      	outpass++;
    }else{
    	cout<<"No"<<endl;
    }    
  }
  	
}

Measured memory_bytes: 896
# coding: utf-8

import sys
import math
import collections
import itertools
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def PL(L) : print(*L, sep="\n")

N, M = LI()
A = LI()

X = sum(A)

ans = 0
for a in A:
    if a >= X * (1/(4*M)):
        ans += 1

print("Yes" if ans >= M else "No")


Measured memory_bytes: 38384
#include <iostream>

using namespace std;

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


Measured memory_bytes: 256
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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

func getInts(N int) []int {
	ret := make([]int, N)
	for i := 0; i < N; i++ {
		ret[i] = getInt()
	}
	return ret
}

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

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

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

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

// 約数を列挙
func divisor(n int) []int {
	ret := []int{}
	for i := 1; i*i <= n; i++ {
		if n%i == 0 {
			ret = append(ret, i)
			if i*i != n {
				ret = append(ret, n/i)
			}
		}
	}
	return ret
}

func solve(x int) []int {
	ret := make([]int, x+1)

	for i := 1; i <= x; i++ {
		for j := i; j <= x; j += i {
			ret[j]++
		}
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	N := getInt()
	ret := solve(N)
	ans := 0
	for k := 1; k <= N; k++ {
		ans += k * ret[k]
	}
	out(ans)
}


Measured memory_bytes: 82564
#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int, int> P;
const int INF = 1e15;

signed main(){
    vector<int> a(3);
    for(int i = 0; i < 3; i++) cin >> a[i];
    sort(a.rbegin(), a.rend());
    int MAX = a[0];
    for(int i = 0; i < 3; i++) a[i] = MAX - a[i];
    int ans = 0, cnt = 0;
    for(int i = 0; i < 3; i++){
        ans += a[i] / 2;
        cnt += !(a[i] % 2);
    }
    ans += cnt % 3;
    cout << ans << endl;
}

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

signed main(){
  
  int a, b;
  cin>>a>>b;
  
  if( a > b ) swap( a, b );

  if( a == 1 && b == 2 ) cout<<3<<endl;
  if( a == 1 && b == 3 ) cout<<2<<endl;
  if( a == 2 && b == 3 ) cout<<1<<endl;
  
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, x, n) for (int i = x; i < (n); ++i)
using namespace std;

int main() {
    int N;
    cin >> N;

    int X;
    cin >> X;

    int m[110];
    rep(i, N) cin >> m[i];

    // 一個ずつ作った場合の消費質量
    int sum1 = 0;
    rep(i, N) sum1 += m[i];

    // 余った素の質量
    int rest = X - sum1;

    // 昇順にソート
    sort(m, m + N);

    // 残りの材料からもっとも消費質量が少ないドーナツを作れる個数
    int rest_count = rest / m[0];

    cout << N + rest_count << endl;
    return 0;
}



Measured memory_bytes: 256
package main

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

func main() {
	io := newIo()
	defer io.Flush()
	A, B := io.NextInt(), io.NextInt()
	if A >= 10 || B >= 10 {
		fmt.Println(-1)
	} else {
		fmt.Println(A * B)
	}
}

type io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func newIo() *io {
	return &io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *io) PrintIntLn(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func (io *io) PrintStringLn(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}


Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define max(a, b)	(((a) > (b)) ? (a) : (b))		/* ２個の値の最大値 */
#define min(a, b)	(((a) < (b)) ? (a) : (b))		/* ２個の値の最小値 */
#define ENTER		printf("\n")					/* 改行プリント */

/* 最大公約数 */
long gcd(long m, long n) {
	long temp;
	while (m % n != 0)
	{
		temp = n;
		n = m % n;
		m = temp;
	}
	return n;
}

/* 最小公倍数 */
long lcm(long m, long n) {
	return m*n/gcd(m,n);
}

/********************************************************************************************************************************/
/* main *************************************************************************************************************************/
/********************************************************************************************************************************/
int DEBUG = 1;										/* デバッグプリント 提出時は0 */
int main()
{
	long long		i,a,b,c,d,x,y,r,m,ans = 0;
	
	scanf("%lld %lld %lld %lld", &a, &b, &c, &d);

	ans = b - a +1;
	ans -= (b/c) - (a-1)/c;
	ans -= (b/d) - (a-1)/d;

	m = lcm(c,d);
	ans += (b/m) - (a-1)/m;

	printf("%lld\n",ans);


	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
static const int INF (1<<30);

int main() {
  ll x; cin >> x;

  ll div = x / 11LL;

  ll mod = x - div * 11LL;

  ll ans = div * 2LL;
  if (1LL <= mod && mod <= 6LL) {
    ans++;
  } else if (mod > 6LL) {
    ans += 2LL;
  }

  cout << ans << endl;

  return 0;
}

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

int main(void){
    int n, k;
    cin >> n >> k;
    map<int,int> mp;
    for(int i=0; i<n; i++){
        int m;
        cin >> m;
        mp[m]++;
    }

    vector<int> v;
    auto itr = mp.begin();
    while(itr != mp.end()){
        v.push_back(itr->second);
        itr++;
    }
    sort(v.rbegin(), v.rend());

    int ans = 0;
    while(v.size() > k){
        ans += v.back();
        v.pop_back();
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 10748
#include <iostream>
#include <cstdio>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define MOD1 1000000007;
#define MOD2 1000007
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
/* ここからが本編 */
/*  */
 
ull pow(ull x,ull n) {
  ull res = 1;
  while(n > 0) {
    if(n&1) res = res * x;
    x = x * x;
    n >>= 1;
  }
  return res;
}
int dic_op(char str[14])
{
  int j;
  long long f = 1;
  long long g = 0;
  for(j = 0;;j++) {
    if(str[j] == 'A')
      g += f * 1;
    else if(str[j] == 'C')
      g += f * 2;
    else if(str[j] == 'G')
      g += f * 3;
    else if(str[j] == 'T')
      g += f * 4;
    else break;
    f *= 5;
  }
  return g; 
}
 
int main()
{
  int i,j,k,l;
  int n;
  long ans = 0;
  static char dic[200000000];
  char opstr[7];
  char str[13];
  cin >> n;
  for (i = 0; i < n; i++) {
    scanf("%s %s",opstr,str);
    if(opstr[0] == 'i') {
      dic[dic_op(str)] = 1;
    }
    else if(opstr[0] == 'f') {
      if(dic[dic_op(str)] == 1)
        puts("yes");
      else
        puts("no");
      j++;
    }
  }
  return 0;
}

Measured memory_bytes: 10632
n = int(input())
a = list(map(int,input().split()))

now = 1000
kabu = 0

li = "-"

no = a[0]

for i in range(1,n):
    if a[i] <= no:
        li += "-"
        no = a[i]
    else:
        li += "+"
        no = a[i]

li += "-"

for i in range(n):
    # 買う
    if li[i] == "-" and li[i+1] == "+":
        kabu += now//a[i]
        now -= a[i]*(now//a[i])
    elif li[i] == "+" and li[i+1] == "-":
        now += kabu*a[i]
        kabu = 0

print(now)

Measured memory_bytes: 9196
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
const ll INF = 1LL << 60;
const ll MOD = (ll) 1e9 + 7;

int main(){
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        double x = (double)i * 1.08;
        int xx = (int)floor(x);
        if (xx == n) {
            cout << i << "\n";
            return 0;
        }
    }
    cout << ":(" << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <tuple>
#include <cassert>
#include <exception>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
static const int INF = 1e+9+7;
ll n,m,l;
string s,t;
int d[200010],dp[1010][1010];
double w[1000],v[1000];
double box[200010];
char field[200][200];

vi vec;

void hurui(){
  clr(d,0);
  d[0] = d[1] = 1;
  for(int i = 2;i <= 100000/2;i++){
    if(!d[i]){
      vec.pb(i);
      for(int j = 2;j * i <= 100000;j++)d[i*j] = 1;
    }
  }
}

int main(){
  hurui();
  int x,y;
  while(1){
    cin >> n >> m >> l;
    if(n + m + l == 0)break;
    x = y = 2;
    rep(i,0,vec.sz){
      rep(j,i,vec.sz){
        if(vec[i] * vec[j] > n)break;
        if(m * vec[j] <= l * vec[i]){
          if(x * y < vec[i] * vec[j]){
            x = vec[i];
            y = vec[j];
          }
        }else{
          continue;
        }
      }
    }
    cout << x << " " << y << endl;
  }
  return 0;
}


Measured memory_bytes: 3952
#include <iostream>
#include <vector>

#include <tuple>
#include <queue>
#include <algorithm>
#include <unordered_set>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ALL(a) (a).begin(), (a).end()

using namespace std;

int main()
{
    int N; cin >> N;
    unordered_set<int> unordered_set;

    REP(i, N)
    {
        int a;
        cin >> a;

        auto it = unordered_set.find(a);

        if( it == unordered_set.end() )
        {
            unordered_set.insert(a);
        }
        else
        {
            unordered_set.erase(a);
        }
    }

    cout << unordered_set.size() << endl;

    return 0;
}

Measured memory_bytes: 4388
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

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

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let n =  get!(usize);
    let h = get!([usize]);

    let mut count = 0;
    let mut mx = 0;
    for e in h {
        if mx <= e {
            count += 1;
            mx = e;
        }
    }
    println!("{}", count);
}


Measured memory_bytes: 8572
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
  string N;
  cin >> N;
  if(N[2]==N[3]&&N[4]==N[5]){
    cout << "Yes";
  }
  else{
    cout << "No";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <ctype.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;

int main() {
	int s;
	cin >> s;

	map<int, int>map;
	
	int n = s;
	int ans = 0;

	map[n] = 1;

	while (1) {
		if (n % 2 == 0) {
			n = n / 2;
		}
		else {
			n = (3 * n) + 1;
		}

		if (map[n] != 1) {
			map[n] = 1;
		}
		else {
			map[n] = 2;
			ans = map.size();
			break;
		}
	}
	cout << ans + 1<< endl;
}

Measured memory_bytes: 256
def cost(h_i, h_j):
    return abs(h_i - h_j)


def main():
    INF = 10 ** 9
    N, K = [int(i) for i in input().split()]
    H = [int(i) for i in input().split()]

    dp = [INF] * N
    dp[0] = 0
    for i in range(N):
        for k in range(1, K+1):
            if i + k >= N:
                break
            dp[i + k] = min(dp[i + k], dp[i] + cost(H[i], H[i + k]))

    ans = dp[-1]
    print(ans)


if __name__ == '__main__':
    main()

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

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long int ans=0;
    long long m,n,a,b;
    cin>>n>>m;
    vector<pair<long long,long long>>v;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        v.push_back(make_pair(a,b));
    }
    sort(v.begin(),v.end());
    for(auto x:v)
    {
        if(x.second<=m)
            {ans+=x.first*x.second;m-=x.second;}
        else
            {ans+=x.first*m;m=0;break;}
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5304
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

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

  int n = s.size();
  ll ans = 0;

  for (int i = 0; i < (1 << n - 1); i++) {
    bitset<10> b(i);
    string t = s;
    for (int j = 0; j < n - 1; j++) {
      if (b.test(j)) t.insert(n - 1 - j, "+");
    }

    int j = 0;
    while (t.size() != 0) {
      if (t[j] == '+') {
        ans += stol(t.substr(0, j));
        t.erase(0, j + 1);
        j = 0;
      } else if (t[j] != '+' && j == t.size()) {
        ans += stol(t);
        break;
      } else
        j++;
    }
  }
  cout << ans << endl;
}

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

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

  for (int i=0; i<n; i++){
    int a;
    cin >> a;
   
    int x=0;
    while (a%2==0){
      x++;
      a/=2;
    }
    
    
    if (i==0){
      ans=x;
    }
    
    else if (x<ans){
      ans=x;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		int min = 400000001;
		int count = 0;
		int n = scan.nextInt();
		int m = scan.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		int[] c = new int[m];
		int[] d = new int[m];
		for(int i=0; i<n; i++){
			a[i] = scan.nextInt();
			b[i] = scan.nextInt();
		}
		for(int i=0; i<m; i++){
			c[i] = scan.nextInt();
			d[i] = scan.nextInt();
		}
		for(int i=0; i<n; i++){
			for(int j=0; j<m; j++){
				int x = Math.abs(a[i]-c[j]);
				int y = Math.abs(b[i]-d[j]);
				int z = x+y;
				if(z<min){
					min = z;
					count = j+1;
				}
			}
			min = 400000001;
			System.out.println(count);
		}
	}
}

Measured memory_bytes: 22868
class WeightedUnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)
        # 根への距離を管理
        self.weight = [0] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            y = self.find(self.par[x])
            # 親への重みを追加しながら根まで走査
            self.weight[x] += self.weight[self.par[x]]
            self.par[x] = y
            return y

    # 併合
    def union(self, x, y, w):
        rx = self.find(x)
        ry = self.find(y)
        # xの木の高さ < yの木の高さ
        if self.rank[rx] < self.rank[ry]:
            self.par[rx] = ry
            self.weight[rx] = w - self.weight[x] + self.weight[y]
        # xの木の高さ ≧ yの木の高さ
        else:
            self.par[ry] = rx
            self.weight[ry] = -w - self.weight[y] + self.weight[x]
            # 木の高さが同じだった場合の処理
            if self.rank[rx] == self.rank[ry]:
                self.rank[rx] += 1

    # 同じ集合に属するか
    def same(self, x, y):
        return self.find(x) == self.find(y)

    # xからyへのコスト
    def diff(self, x, y):
        return self.weight[x] - self.weight[y]

def main():
    n, m = map(int, input().split())
    wuf = WeightedUnionFind(n)
    for _ in range(m):
        l, r, d = map(int, input().split())
        if not wuf.same(l, r):
            wuf.union(l, r, d)
        else:
            if wuf.diff(l, r) != d:
                print('No')
                return
    print('Yes')

if __name__ == '__main__':
    main()

Measured memory_bytes: 11636
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int mod = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1.0);

int main()
{
    int a[3];
    for(int i = 0; i < 3; i++) cin >> a[i];
    sort(a,a+3);
    cout << a[0]*a[1]/2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int n,k,ans=0,d,temp;
    string s;
    cin>>n>>k;
    int all[105]={0};
    for(int i = 1;i<=k;i++)
    {
        cin>>d;
        for(int j = 1;j<=d;j++)
        {
            cin>>temp;
            all[temp]++;
        }
    }
    for(int i=1;i<=n;i++)
    {
        if(all[i]==0)
            ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3628
#include<iostream>
using namespace std;
typedef long long ll;
ll a[16];
int n,k;
int main(){
	ios::sync_with_stdio(false);
	cin >> n >> k;
	for(int i=0; i<n ;i++) cin >> a[i];
	ll ans=8e18;
	for(int i=0; i<(1<<n) ;i++){
		ll cost=0;
		int cnt=0;
		ll prv=0;
		for(int j=0; j<n ;j++){
			if(i&(1<<j)){
				cnt++;
				cost+=max(0LL,prv+1-a[j]);
				prv++;
			}
			prv=max(prv,a[j]);
		}
		if(cnt==k) ans=min(ans,cost);
	}
	cout << ans << endl;
}

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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, W; cin >> N >> W;
  vector<int> v(N, 0);
  vector<int> w(N, 0);
  REP(i, N){
    cin >> v[i] >> w[i];
  }
  vector<vector<int> > dp(N+1, vector<int>(W+1, 0));
  for(int i = 0; i < N; i++){
    for(int j = 0; j < W+1; j++){
      int ni = i + 1;
      chmax(dp[ni][j], dp[i][j]);
      int nj = j + w[i];
      if(nj > W) continue;
      chmax(dp[ni][nj], dp[i][j] + v[i]);
    }
  }
  cout << dp[N][W] << endl;
}


Measured memory_bytes: 6824
#include<iostream>
using namespace std;
int main(){

int a, b, k;

cin >>a>>b>>k;
for(int i=0; i<k; i++){
 if(i%2==0){
  if(a%2==1)
   a--;

 int h =a/2;
 a-=h;
 b+=h;
}
 else{
  if(b%2==1)
   b--;

int  h=b/2;
 a+=h;
 b-=h;
}
}

cout<<a<<" "<<b<<endl;

return 0;
}

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

class Program {
	static void Main(string[] args) {




		const int INPUT_COUNT = 2;
		var lstInput = new List<string>();
		for (int i = 0; i < INPUT_COUNT; i++) {
			lstInput.Add(Console.ReadLine());
		}

		int count = int.Parse(lstInput[1]);

		char[] ary = lstInput[0].ToCharArray();

		for (int i = 0; i < ary.Length; i++) {
			if ((ary[i] != 'a') &&  ('z' - ary[i] + 1) <= count) {
				count -= ('z' - ary[i] + 1);
				ary[i] = 'a';
				if (count == 0) break;
			}
		}

		// 余ったカウントを末尾に対して利用する
		count = count % 26;
		for (int i = 0; i < count; i++) {
			ary[ary.Length - 1]++;
			if (ary[ary.Length - 1] > 'z') {
				ary[ary.Length - 1] = 'a';
			}
		}



		Console.WriteLine("{0}", new String(ary));	


	
	}
}

Measured memory_bytes: 4184
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}void pr(){ln;}
template<class A,class...B>void pr(const A &a,const B&...b){cout<<a<<(sizeof...(b)?" ":"");pr(b...);}
template<class A>void PR(A a,ll n){rep(i,n)cout<<(i?" ":"")<<a[i];ln;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[8]={-1,0,1,0,-1,-1,1,1},dy[8]={0,1,0,-1,-1,1,1,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n,k;
  cin >> n >> k;
  ll a[n];
  rep(i,n) R a[i];
  ll l=0,r=MAX;
  while(l+1<r) {
    ll m=(l+r)/2;
    ll c=0;
    rep(i,n) {
      ll x=a[i]/m;
      if(a[i]%m==0) x--;
      c+=x;
    }
    if(c<=k) r=m;
    else l=m;
  }
  pr(r);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 5212
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>

using namespace std;

#define LL long long

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

LL mod(LL x, LL md) {
	return ((x % md) + md) % md;
}

class Mint {
public:
	static LL md;
	LL x;
	Mint(LL _x) {
		x = mod(_x, md);
	}
	Mint(const Mint &y) {
		x = mod(y.x, md);
	}
};

void MintMyExgcd(LL a, LL b, LL &x, LL &y) {
	// solve equation ax + by = 1 (mod m)
	LL md = Mint::md;
	if (b == 0) {
		y = 0;
		x = 1;
		return ;
	}
	MintMyExgcd(b, a % b, x, y);
	LL t = y;
	y = mod(x - (a / b) * y, md);
	x = t;
}

LL MintNY(LL x) {
	if (x == 0) {
		return 1;
	}
	LL md = Mint::md;
	LL a, b;
	MintMyExgcd(x, md, a, b);
	while (a < 0) {
		a += md;
	}
	return a;
}

/* LL gcd(LL a, LL b) {
	if (b == 0) {
		return a;
	}
	return gcd(b, a % b);
} */

Mint operator+(Mint a, Mint b) {
	return Mint(mod(a.x + b.x, Mint::md));
}
Mint operator-(Mint a, Mint b) {
	return Mint(mod(a.x - b.x, Mint::md));
}
Mint operator*(Mint a, Mint b) {
	return Mint(mod(a.x * b.x, Mint::md));
}
Mint operator/(Mint a, Mint b) {
	Mint c = Mint(MintNY(b.x));
	return Mint(mod(a.x * c.x, Mint::md));
}

Mint operator-(Mint a) {
	return Mint(-a.x);
}
bool operator==(Mint a, Mint b) {
	return a.x == b.x;
}
bool operator!=(Mint a, Mint b) {
	return a.x != b.x;
}
bool operator>(Mint a, Mint b) {
	return a.x > b.x;
}
bool operator<(Mint a, Mint b) {
	return a.x < b.x;
}
bool operator>=(Mint a, Mint b) {
	return a.x >= b.x;
}
bool operator<=(Mint a, Mint b) {
	return a.x <= b.x;
}

void operator+=(Mint &a, Mint b) {
	a = a + b;
}
void operator-=(Mint &a, Mint b) {
	a = a - b;
}
void operator*=(Mint &a, Mint b) {
	a = a * b;
}
void operator/=(Mint &a, Mint b) {
	a = a / b;
}

ostream& operator<<(ostream &out, Mint a) {
	out << a.x;
	return out;
}

istream& operator>>(istream &in, Mint &a) {
	in >> a.x;
	return in;
}

Mint factorial(LL n) {
	if (n == 0) {
		return Mint(1);
	}
	Mint res = 1;
	for (LL i = 1; i <= n; ++i) {
		res *= i;
	}
	return res;
}
Mint multiRange(LL s, LL t) {
	Mint res = 1;
	for (LL i = s; i <= t; ++i) {
		res *= i;
	}
	return res;
}

Mint getC(LL n, LL k) {
	if (n - k < k) {
		return getC(n, n - k);
	}
	return multiRange(n - k + 1, n) / factorial(k);
}

Mint getA(LL n, LL k) {
	return multiRange(n - k + 1, n);
}

Mint countNonNegativeDivision(LL n, LL k) {
	return getC(n + k - 1, k - 1);
}
Mint countPositiveDivision(LL n, LL k) {
	if (n < k) {
		return 0;
	}
	if (k <= 0) {
		return 0;
	}
	return getC(n - 1, k - 1);
}
Mint quickMod(Mint a, LL b) {
	Mint res = 1;
	while (b > 0) {
		if (b % 2) {
			res *= a;
		}
		a *= a;
		b /= 2;
	}
	return res;
}

LL Mint::md = 1000000007;

string s, t;
int main() {
	cin >> s >> t;
	for (char c = 'a'; c <= 'z'; ++c) {
		string ss = s;
		ss.push_back(c);
		if (ss == t) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3632
from fractions import gcd

a, b, c, d = map(int, input().split())

a -= 1
cd = c*d//gcd(c, d)

b_c = b - (b // c + b // d - b // (cd))
a_c = a - (a // c + a // d - a // (cd))
print(b_c- a_c)


Measured memory_bytes: 5048
n = int(input())
x = list(map(int, input().split()))
x.sort()

def calc(p):
    global x
    ans = 0
    for xx in x:
        ans += (xx - p) * (xx - p)
    return ans

answers = []
for i in range(1, 100):
    answers.append(calc(i))

print(min(answers))


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

int main(){
  using psi=pair<string,int>;
  int N;
  cin >> N;
  vector<pair<psi,int>> R(N);
  for(int i=0;i<N;i++){
    string s;
    int p;
    cin >> s >> p;
    R.at(i)=make_pair(make_pair(s,p),i);
  }
  for(int i=0;i<N;i++){
    pair<psi,int> min=R.at(i);
    for(int j=i;j<N;j++){
      if(R.at(j).first.first<min.first.first){
        swap(R.at(j),min);
      }
      else if(R.at(j).first.first==min.first.first && R.at(j).first.second>min.first.second){
        swap(R.at(j),min);
      }
    }
    R.at(i)=min;
  }
  for(int i=0;i<N;i++){
    cout << R.at(i).second+1 << endl;
  }
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}


fn solve(x: i64) -> &'static str {
    if x >= 1200 {
        "ARC"
    } else {
        "ABC"
    }
}

fn main() {
    input!{
        x: i64,
    }
    println!{"{}", solve(x)};
}


Measured memory_bytes: 4352
#include<stdio.h>
int main(){
   int A,B,C,K;
   scanf("%d %d %d %d",&A,&B,&C,&K);

if (A >= K){

   printf("%d",K);
}else if (A + B >= K){

   printf("%d",A);
}else{
  
    int  a = A - (K-A-B);
    printf("%d",a);
}
return 0;
}


Measured memory_bytes: 1724
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
	int n;
	cin >> n;
	vector<ll> a(n);
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
	}
	auto solve = [&](int k) {
		int res = 0;
		for (auto x : a)
		{
			if (x % k == 0)
			{
				res++;
			}
		}
		return res;
	};
	int ans0 = 0, ans1 = 0;
	for (ll i = 1; i * i <= a[0]; ++i)
	{
		if (a[0] % i == 0)
		{
			if (n - 1 <= solve(i))
			{
				ans0 = i;
			}
			if (n - 1 <= solve(a[0] / i))
			{
				ans0 = a[0] / i;
				break;
			}
		}
	}
	for (ll i = 1; i * i <= a[1]; ++i)
	{
		if (a[1] % i == 0)
		{
			if (n - 1 <= solve(i))
			{
				ans1 = i;
			}
			if (n - 1 <= solve(a[1] / i))
			{
				ans1 = a[1] / i;
				break;
			}
		}
	}
	cout << max(ans0, ans1) << endl;
}

Measured memory_bytes: 1024
#include<stdio.h>

#define N 100

int main(){
  int n, p[N+1], m[N+1][N+1];

  scanf("%d",&n);

  for(int i = 1; i <= n; i++){
    scanf("%d",&p[i-1]);
    scanf("%d",&p[i]);
  }

  for(int i = 1; i <= n; i++) m[i][i] = 0;
  for(int l = 2; l <= n; l++){
    for(int i = 1; i <= n - l + 1; i++){
      int j = i + l - 1;
      m[i][j] = (1 << 21); //1の21bit左シフト
      for(int k = i; k <= j - 1; k++){
	if(m[i][j] < m[i][k] + m[k+1][j] + p[i-1] * p[k] * p[j]) m[i][j] = m[i][j];
	else m[i][j] = m[i][k] + m[k+1][j] + p[i-1] * p[k] * p[j];
      }
    }
  }

  printf("%d\n",m[1][n]);
  
  return 0;
}



Measured memory_bytes: 2052
### main

loop do
  a, b, c = gets.strip.split(' ').map{|s| s.to_i}
  break if (a | b | c) == 0

  n = gets.strip.to_i

  abc = a + b + c
  qcs = abc.times.map{2}

  fails = []

  n.times do
    i, j, k, r = gets.strip.split(' ').map{|s| s.to_i}
    i -= 1
    j -= 1
    k -= 1

    if r == 1
      qcs[i] = qcs[j] = qcs[k] = 1
    else
      fails << [i, j, k]
    end
  end

  for fail in fails
    i, j, k = fail

    if qcs[i] == 1 && qcs[j] == 1
      qcs[k] = 0
    elsif qcs[j] == 1 && qcs[k] == 1
      qcs[i] = 0
    elsif qcs[k] == 1 && qcs[i] == 1
      qcs[j] = 0
    end
  end

  for qc in qcs
    puts qc
  end
end

Measured memory_bytes: 6124
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    a, b, c = map(int,input().split())
    k = int(input())
    cunt = 0
    while a >= b:
        b *= 2
        cunt += 1
    while b >= c:
        c *= 2
        cunt += 1
    if cunt > k:
        print("No")
    else:
        print("Yes")
    


if __name__=='__main__':
    main()

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	string a,b;
	cin >> n >> a >> b;
	int alen=(int)a.size(),blen=(int)b.size();
	int ans=alen+blen;
	int same=0;
	if(alen<=blen){
		rep(i,alen){
			bool flg=true;
			for(int j=0;i+j<alen;++j){
				if(a[i+j]!=b[j]){
					flg=false;
					break;
				}
			}
			if(flg){
				same=alen-i;
				break;
			}
		}
	}
	else{
		rep(i,blen){
			bool flg=true;
			for(int j=0;i+j<blen;++j){
				if(a[j]!=b[i+j]){
					flg=false;
					break;
				}
			}
			if(flg){
				same=blen-i;
				break;
			}
		}
	}
	cout << ans-same << endl;
}

Measured memory_bytes: 256
//This code was made by Chinese_zjc_.
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<map>
#define int long long
#define INF 0x3fffffffffffffff
using namespace std;
int a,b,c,n,ans;
signed main()
{
	std::ios::sync_with_stdio(false);
	cin>>a>>b>>c>>n;
	ans+=min(a,n);
	n-=a+b;
	n=max(n,0ll);
	ans-=min(c,n);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3652
N = int(input())
x = list(map(int,input().split()))
count = 0
K = None

while True:
  for j in range(N):
    if x[j] % 2 == 0:
      x[j] /= 2
    else:
      K = 0
      break
  
  else:
    count += 1
  if K==0:
    break

print(count)
  
  


Measured memory_bytes: 3060
def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [[input().split()] for _ in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

s=s0()

ans=0
c=0
for x in s:
    if x in "ACGT":
        c+=1
    else:
        c=0
    ans=max(ans,c)
print(ans)

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

struct node {
	char name[22];
	int level;
	int year;
	node (int level = 0, int year = 0)
		:level(level), year(year) {
		strcpy(name, "");
	}
	bool operator < (const node &rhs) const {
		if (level != rhs.level) return level < rhs.level;
		return year < rhs.year;
	}
};

const int N = 1e5 + 10;

set<node> P, Q;
int totc, pos[N];
map<string, int> NameToPos;
map<string, node> NameToNode;

int getnum(int totc) {
	return totc / 5;
}

vector<pair<string, int> > Ans;

int find(node cur) {
	if (P.count(cur) > 0) return 0;
	if (Q.count(cur) > 0) return 1;
	assert (0 == 1);
	return -1;
}

int find(char* name) {
	return find(NameToNode[name]);
}

void makeLog(vector<string> &Mname) {
	set<string> check;
	for (int i = 0; i < Mname.size(); i++) if (check.count(Mname[i]) == 0) {
		check.insert(Mname[i]);
		int iswhere = find(NameToNode[Mname[i]]);
		if (NameToPos.count(Mname[i]) > 0) {
			if (iswhere != NameToPos[Mname[i]]) 
				Ans.push_back(make_pair(Mname[i], iswhere));
		} else {
			Ans.push_back(make_pair(Mname[i], iswhere));
		}
		NameToPos[Mname[i]] = iswhere;
	}
}

void push(node cur) {
	++ totc;
	vector<string> Mname;
	Mname.push_back((string)cur.name);
	if (P.size() > 0) {
		set<node>::iterator it = P.begin();
		node T = *it;
		if (T < cur) {
			Mname.push_back((string)T.name);
			Q.insert(*it);
			P.erase(it);
			P.insert(cur);
		} else {
			Q.insert(cur);
		}
	} else {
		Q.insert(cur);
	}
	if (totc / 5 > P.size()) {
		assert (Q.size() > 0);
		set<node>::iterator it = Q.end();
		-- it;
		Mname.push_back(it->name);
		P.insert(*it);
		Q.erase(it);
	}
	NameToNode[cur.name] = cur;
	makeLog(Mname);
}

void erase(char *name) {
	vector<string> Mname;
	-- totc;
	node cur = NameToNode[name];
	int iswhere = find(name);
	if (iswhere == 0) {
		P.erase(cur);
		if (P.size() < totc / 5) {
			if (Q.size() > 0) {
				set<node>::iterator it = Q.end();
				-- it;
				Mname.push_back(it->name);
				P.insert(*it);
				Q.erase(it);
			} else {
				assert (0 == 1);				
			}
		}
	} else {
		Q.erase(cur);
		if (P.size() > totc / 5) {
			if (P.size() > 0) {
				set<node>::iterator it = P.begin();
				Mname.push_back(it->name);
				Q.insert(*it);
				P.erase(it);
			} else {
				assert (0 == 1);
			}
		}
	}
	makeLog(Mname);
	NameToNode.erase(name);
	NameToPos.erase(name);
}

int main() {
	int n; scanf("%d", &n);
	totc = 0;
	for (int i = 0; i < n; i++) {
		node cur;
		scanf("%s%d", cur.name, &cur.level);
		cur.year = i;
		push(cur);
	}
	Ans.clear();
	int m; scanf("%d", &m);
	for (int i = 0; i < m; i++) {
		char op[2]; scanf("%s", op);
		if (op[0] == '+') {
			char name[33]; int level;
			scanf("%s%d", name, &level);
			node cur;
			strcpy(cur.name, name);
			cur.level = level;
			cur.year = i + n;
			push(cur);
		} else {
			char name[33];
			scanf("%s", name);
			erase(name);
		}
	}
	for (int i = 0; i < Ans.size(); i++) {
		if (Ans[i].second == 0) {
			printf("%s is working hard now.\n", Ans[i].first.c_str());
		} else {
			printf("%s is not working now.\n", Ans[i].first.c_str());
		}
	}
	return 0;
}


Measured memory_bytes: 21228
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  ll N;
  cin >> N;
  vec<ll> a(3 * N);
  REP(i, 3 * N) cin >> a[i];

  sort(ALL(a));
  ll answer = 0;
  for (ll i = N; i < 3 * N; i += 2) {
    answer += a[i];
  }
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 5464
N=int(input())
H=list(map(int,input().split()))

move=0
move_max=0
h_before=0

for h in H:
    if h_before >= h:
        move += 1
    else:
        move = 0
        
    if move_max < move:
        move_max = move
        
    h_before = h
    
print(move_max)

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

bool visited[100005];

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

    visited[0] = 1;
    queue<int> q;
    q.push(0);
    while(!q.empty()){
        int u = q.front(); q.pop();
        for(int i = 100; i < 106; i ++){
            int v = u+i;
            if(v > 100000){continue;}
            if(!visited[v]){
                visited[v] = 1;
                q.push(v);
            }
        }
    }

    printf("%d", (int)visited[X]);
    return 0;
}


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

int main() {
  int  N;
  cin >> N;
  
  int P = 0, W = 0, G = 0, Y = 0;
  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;
    if (S == "P") {
      P = 1;
    }
    if (S == "W") {
      W = 1;
    }    
    if (S == "G") {
      G = 1;
    }    
    if (S == "Y") {
      Y = 1;
    }
  }
  int kind = P + W + G + Y;
  if (kind == 3) {
    cout << "Three" << endl;
  }
  else {
    cout << "Four" << endl;
  }
}


Measured memory_bytes: 3588
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <iomanip>
#include <cstring>
#include <climits>
#include <cstdio>
 
#define nl '\n'
 
using namespace std;
 
double n, d, x, t, p;

int main(){

    cin >> n >> d;

    int arr[15][15];

    for(int i = 0; i < n; i++){
        for(int j = 0; j < d; j++){
            cin >> x;
            arr[i][j] = x;
        }
    }

    for(int i = 0; i < n; i++){
        for(int j = i; j < n; j++){
            if(i != j){
                t = 0;
                for(int y = 0; y < d; y++){
                    t += pow((arr[i][y] - arr[j][y]), 2);
                }
                if(ceil(sqrt(t)) == sqrt(t)){
                    p++;
                }
            }
        }
    }

    cout << p;


}
 
//g++ -std=c++14 comp.cpp -o b; ./b.exe
//g++ -std=c++14 comp.cpp && ./a.out
 
//Surely this will AC

Measured memory_bytes: 256