akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;

#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second
#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>void println(T a){if(cout.precision()!=12)cout<<setprecision(12);cout<<a<<endl;}
//lambda: [](int x, int y){return x<y;}


signed main(void){
    int k,n;cin>>k>>n;
    vint a(n);vin(a);
    int d=0;
    rep(i,n-1){
        chmax(d,(int)a[i+1]-a[i]);
    }
    chmax(d,(int)k-a[n-1]+a[0]);
    cout << k-d << endl;


    return 0;
}


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

int main() {
	int N;
	cin >> N;
    vector<string> S(N);
    for (int i = 0; i < N; i++)
    {
        cin >> S[i];
    }
    
    int res = 0;
    unordered_set<string> found;
    for (int i = 0; i < N; i++)
    {
        if(!found.count(S[i])){
            found.insert(S[i]);
            res++;
        }
    }
    
    cout << res << endl;
}

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

int main() {
    ll n,k;cin>>n>>k;
    ll ans=0;
    const ll MOD = 1000000007;
    for(ll i=k;i<=n+1;++i){
        ans+= i*(2*n-i+1)/2 - i*(i-1)/2 +1;
        ans%=MOD;
    }
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3636
N = int(input())
P = [int(p) for p in input().split()]

count = 1  # i = 1 は OK
acc_min = P[0]
for i in range(1, N):
    if acc_min >= P[i]:
        count += 1
    acc_min = min(acc_min, P[i])
print(count)


Measured memory_bytes: 25768
fn main() {
    let (a, b): (u64, u64) = readln();
    let c: u64 = a * b;
    let ans = match c % 2 {
        0 => "Even",
        1 => "Odd",
        _ => unreachable!(),
    };
    println!("{}", ans);
}

// --- template ---
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::HashSet;

pub trait FromLn {
    fn fromln(s: &str) -> Self;
}
pub fn readln<T: FromLn>() -> T {
    let mut buf = String::new();
    let _ = ::std::io::stdin().read_line(&mut buf).unwrap();
    T::fromln(buf.trim())
}
pub fn readlns<T: FromLn>(n: usize) -> Vec<T> {
    let mut vs = vec![];
    for _ in 0..n {
        vs.push(readln());
    }
    vs
}
macro_rules! fromln_primitives {
    ($($t:ty),*) => { $(
        impl FromLn for $t {
            fn fromln(s: &str) -> $t {
                s.parse().unwrap()
            }
        }
    )* }
}
fromln_primitives!(
    String,
    bool,
    f32,
    f64,
    isize,
    i8,
    i16,
    i32,
    i64,
    usize,
    u8,
    u16,
    u32,
    u64
);
impl<T> FromLn for Vec<T>
where
    T: FromLn,
{
    fn fromln(s: &str) -> Vec<T> {
        s.split_whitespace().map(T::fromln).collect()
    }
}
impl FromLn for Vec<char> {
    fn fromln(s: &str) -> Vec<char> {
        s.chars().collect()
    }
}
macro_rules! fromln_tuple {
    ($($t:ident),*) => {
        impl<$($t),*> FromLn for ($($t),*) where $($t: FromLn),* {
            fn fromln(s: &str) -> ($($t),*) {
                let mut it = s.split_whitespace();
                let t = ($($t::fromln(it.next().unwrap())),*);
                assert_eq!(it.next(), None);
                t
            }
        }
    }
}
fromln_tuple!(A, B);
fromln_tuple!(A, B, C);
fromln_tuple!(A, B, C, D);
fromln_tuple!(A, B, C, D, E);
fromln_tuple!(A, B, C, D, E, F);


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main(){
	string n;
	cin>>n;
	int r=0,maxr=0;
	char p=0;
	for(int i=0;i<4;i++){
		if(n[i]==p){
			r++;
		}
		else{
			r=1;
			p=n[i];
		}
		if(r>maxr)maxr=r;
	}
	if(maxr>=3)cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 256
import java.io.*;

public class Main {

	//@0205 Rock, Paper, Scissors
	public static void main(String[] args) throws IOException {
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
//		String data = "1\n"+
//		BufferedReader reader = new BufferedReader(new StringReader(data));

		loo:
		for(int loop = 0;;loop++) {
			
			int[] t = new int[5];
			
			int c1 = 0;
			int c2 = 0;
			int c3 = 0;
			
			for(int i = 0; i < 5; i++) {
				String s = reader.readLine();
				t[i] = Integer.parseInt(s);
				if (t[i] == 0)
					break loo;
				if (t[i] == 1)
					c1++;
				else if (t[i] == 2)
					c2++;
				else
					c3++;
			}
			
			int res = 0;
			if (c1 == 5 || c2 == 5 || c3 == 5) {
				res = -1; //  ¢±
			}
			else if (c1 != 0 && c2 != 0 && c3 != 0) {
				res = -1; //  ¢±
			}
			else if (c1 == 0) {
				res = 2; // 1®[ªÈ¢ÌÅ2¿å«ª©¿
			}
			else if (c2 == 0) {
				res = 3;
			}
			else {
				res = 1;
			}

			for(int i = 0; i < 5; i++) {
				if (res == -1)
					System.out.printf("3\n"); //  ¢±
				else if (t[i] == res) {
					System.out.printf("1\n");
				}
				else {
					System.out.printf("2\n");
				}
			}
		}
		
		reader.close();
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
int dp[1000001][2];
 
int main() {
  string s; cin >> s;
  int n = s.size();
  vector<int> ld(n);
  for (int i = 0; i < n; ++i) {
    ld[i] = s[i]-'0';
  }
  dp[0][1] = 1;
  for (int i = 0; i < n; ++i) {
    int d = ld[i];
    dp[i+1][0] = min(dp[i][0]+d, dp[i][1]+10-d);
    dp[i+1][1] = min(dp[i][0]+d+1, dp[i][1]+9-d);
  }
  cout << dp[n][0] << endl;
  return 0;
}
//DP啊DP，帮帮我，过这一关吧（*_* ლ）

Measured memory_bytes: 13060
#include <bits/stdc++.h>
#define For(i,n) for(int i=0; i<n; i++)
#define foR(i,n) for(int i=n-1; i>=0; i--)
#define M0D 1000000007
using namespace std;

int dp[550][550];

void chmin(int &a, int b){
  a = a > b ? b : a;
}

int main(){

  int N,Ma,Mb;
  int ans=1000000;
  cin >> N >> Ma >> Mb;
  int a[N],b[N],c[N];
  For(i,N) cin >> a[i] >> b[i] >> c[i];
  For(i,550) For(j,550) dp[i][j] = 1000000;
  dp[0][0] = 0;

  For(i,N) foR(j,500) foR(k,500){
    if(j<a[i]||k<b[i]) continue;
    else chmin(dp[j][k], dp[j-a[i]][k-b[i]]+c[i]);
  }

  for(int i=1;i<=min(500/Ma,500/Mb);i++) ans = min(ans, dp[Ma*i][Mb*i]);
  if(ans==1000000) ans=-1;

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 1408
#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#undef min
#undef max
#else
#define NDEBUG
#include <bits/stdc++.h>
#endif

using namespace std;
using large = long long;

int main()
{
    int y, m, d;
    char c;
    cin >> y >> c >> m >> c >> d;

    int r = y - 2019;
    if (!r) {
        r = m - 4;
    }
    if (!r) {
        r = d - 30;
    }


    cout << (r <= 0 ? "Heisei" : "TBD") << endl;
    return 0;
}


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

int func(int x,int y,int z){
  return x*x+y*y+z*z+x*y+y*z+z*x;
}


int main() {
  int N;
  cin>>N;
  int x,y,z;
  vector<int> Ans(N);
  
  int c=0;
  
  rep(i,100){
    rep(j,100){
      rep(k,100){c=func(i+1,j+1,k+1);
                 if(c>N){break;}else{Ans.at(c-1)++;}
                }
    }
  }
  
  rep(i,N){cout<<Ans.at(i)<<endl;}
}

Measured memory_bytes: 3584
#include <algorithm>
#include <bitset>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define MOD (1000000007l)
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)

using namespace std;

void solve() {
  while (true) {
    ll H, W;
    cin >> H >> W;
    if (H == 0 and W == 0) return;
    rep (h, H) {
      rep (w, W) cout << ((w == 0 or w == W-1 or h == 0 or h == H-1) ? "#" : ".");
      cout << endl;
    }
    cout << endl;
  }
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  cout << fixed;
  solve();
  return 0;
}



Measured memory_bytes: 3164
#include <bits/stdc++.h>
#define siz (int)3e5 + 8
using namespace std;

const long long mod = 998244353;
long long a, b, c, d;
long long dp[4000][4000];
int main(){
    scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
    for(long long i = a; i <= c; i++){
        for(long long j = b; j <= d; j++){
            if(i == a && j == b){
                dp[i][j] = 1LL;
            }else if(i == a){
                dp[i][j] = (dp[i][j - 1] * i) % mod;
            }else if(j == b){
                dp[i][j] = (dp[i - 1][j] * j) % mod;
            }else{
                dp[i][j] = ((dp[i - 1][j] * j) % mod + (dp[i][j - 1] * i) % mod + mod - ((((i - 1) * (j - 1)) % mod) * (dp[i - 1][j - 1] % mod)) % mod) % mod;
            }
        }
    }
    printf("%lld", dp[c][d]);
}


Measured memory_bytes: 86120
import sys
sys.setrecursionlimit(100000)

def ins(): return input().split()
def ii(): return int(input())
def iil(): return list(map(int,ins()))
def lin(): return list(input())
def iin(): return map(int,ins())

n,k = iin()
l = iil()
c = 0
for i in l:
    c = c+1 if i>=k else c
print(c)

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

int main() {
	int h, w;
	cin >> h >> w;
	vector<string>Grid(h);
	for (int i = 0; i < h; i++) {
		cin >> Grid[i];
	}
	string ret = "Yes";
	const int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (Grid[i][j] == '#') {
				bool flag = false;
				for (int k = 0; k < 4; k++) {
					int nx = i + dx[k], ny = j + dy[k];
					if (nx >= 0 && nx < h && ny >= 0 && ny < w)if (Grid[nx][ny] == '#')flag = true;
				}
				if (!flag) {
					ret = "No";
					break;
				}
			}
		}
	}
	cout << ret;
	return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque
sys.setrecursionlimit(10000)
a,b=map(int,input().split())
List=[]
sumup=0
for i in range(a):
  l=list(input())
  p=l.count(".")
  sumup+=p
  List.append(l)
List[0][0]=1
q=deque([[0,0]])
while q:
  h,w=q.popleft()
  aaa=[[0,1],[0,-1],[1,0],[-1,0]]
  for x,y in aaa:
    if 0<=h+x<a and 0<=w+y<b:
      if List[h+x][w+y]==".":
        List[h+x][w+y]=List[h][w]+1
        q.append([h+x,w+y])
if List[a-1][b-1]==".":
  print(-1)
else:  
  print(sumup-List[a-1][b-1])

Measured memory_bytes: 3316
#include<bits/stdc++.h>
#include <algorithm>
#include <cctype>
#include <iostream>
#include <string>
using namespace std;

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

const ll MOD = 1e9+7;

// Combinationの使い方
// vector<vector<ll>> v(N+1, vector<ll>(N+1, 0));
// comb(v);
void comb(vector<vector<ll>> &v){
    for(int i = 0; i < v.size(); i++){
        v[i][0] = 1;
        v[i][i] = 1;
    }
    for(int k = 1; k < v.size(); k++){
        for(int j = 1; j < k; j++){
            v[k][j] = (v[k-1][j-1] + v[k-1][j]);
            //余りを求める問題は毎回計算ごとにやる
            // v[k][j] = (v[k-1][j-1] + v[k-1][j]) % MOD;
        }
    }
}

// Union Find
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

// vector<tuple<long,long>> items; // (value, weight)
// auto item = items[i];
// long v = get<0>(item);
// long w = get<1>(item);
// long v, w;
//   for( int i = 0; i < N; i++ ){
//     cin >> v >> w;
//     items.push_back( make_tuple(v, w) ); // item : (value, weight)
//   }

// 1 << 3 : int "3" change to bit "100"
// rep(pattern, 1 << N) if (pattern & (1 << x)) cnt++

// 過去問第3問ABC113Bまでdone
vector<ll> A(1000100, 0);
vector<ll> B(1000010, 0);
ll N;

ll search(int i, ll a){
    ll sum = 0;
    if(i>N) return 0;

    // ll attack = B[i] + a;

    if(A[i] <= B[i]+a){
        sum += A[i];
        if(A[i]-a>=0) a = B[i] - (A[i]-a);
        else a = B[i];
    }else{
        sum += B[i] + a;
        a = 0;
    }


    // cout << sum << " " << a << endl;

    sum += search(i+1, a);

    return sum;
}

int main(){
    cin >> N;
    
    rep(i,N+1){
        cin >> A[i];
    }
    rep(i,N){
        cin >> B[i];
    }

    cout << search(0, 0) << endl;
    
    return 0;
}

Measured memory_bytes: 15872
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;

unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

ll ll_gcd(ll a, ll b) {
    if (a < b) return ll_gcd(b, a);
    ll r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

int main() {
    ll n;
    cin >> n;
    ll ans = 0;
    map<pair<ll,ll>,ll> z;
    vector<ll> a(n);
    vector<ll> b(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i == j)continue;
            z[make_pair(a[i] - a[j], b[i] - b[j])]++;
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            ans = max(ans, z[make_pair(a[i] - a[j], b[i] - b[j])]);
        }
    }
    cout << n - ans << endl;
}

Measured memory_bytes: 3596
// +build ignore
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []byte {
	return []byte(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

func gcd(x, y int) int {
	if x%y != 0 {
		return gcd(y, x%y)
	}
	return y
}

func run(input io.Reader, output io.Writer) int {
	sc := NewScanner()
	a := sc.nextRuneSlice()
	b := sc.nextRuneSlice()
	c := sc.nextRuneSlice()

	if a[len(a)-1] == b[0] && b[len(b)-1] == c[0] {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}

	return 0
}

func main() {
	os.Exit(run(os.Stdin, os.Stdout))
}


Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args)  {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		System.out.println(b - a == c - b ? "YES" : "NO");
	}
}

Measured memory_bytes: 21844
from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import product, combinations,permutations
from copy import deepcopy
import sys
import numpy as np
sys.setrecursionlimit(4100000)



if __name__ == '__main__':
    N = int(input()) 
    S = input()
    Z = ord('Z')
    ans = ''
    for s in S:
        if ord(s)+N>ord('Z'):
            ans += chr(ord('A')+ord(s)+N-ord('Z')-1)
        else:
            ans += chr(ord(s)+N)
    print(ans)

Measured memory_bytes: 27104
#include <cstdio>
#include <cmath>
#include <iostream>
#include <complex>
#include <vector>
using namespace std;

typedef complex<double> point;
double cross(const point& a, const point& b) {
	return imag(conj(a)*b);
}

typedef vector<point> polygon;
double convex_diameter(const polygon &P) {
	auto diff = [&P](int i) {return P[(i+1)%P.size()] - P[i];};
	const int n = P.size();
	int is = 0, js = 0;
	for (int i = 1; i < n; ++i) {
		if (imag(P[i]) > imag(P[is])) is = i;
		if (imag(P[i]) < imag(P[js])) js = i;
	}
	double maxd = norm(P[is]-P[js]);

	int i, maxi, j, maxj;
	i = maxi = is;
	j = maxj = js;
	do {
		if (cross(diff(i), diff(j)) >= 0) j = (j+1) % n;
		else i = (i+1) % n;
		if (norm(P[i]-P[j]) > maxd) {
			maxd = norm(P[i]-P[j]);
			maxi = i; maxj = j;
		}
	} while (i != is || j != js);
	return maxd; /* farthest pair is (maxi, maxj). */
}

int main() {
	int n;
	while (cin >> n) {
		polygon pol(n);
		for (auto& p : pol) {
			double x, y;
			cin >> x >> y;
			p = point(x, y);
		}
		printf("%.10lf\n", sqrt(convex_diameter(pol)));
	}
	return 0;
}

Measured memory_bytes: 2316
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define repin(a, n)  \
	vector<ll> a(n); \
	rep(i, n) { cin >> a[i]; }
#define repins(a, n)     \
	vector<string> a(n); \
	rep(i, n) { cin >> a[i]; }
#define repind(a, n)     \
	vector<double> a(n); \
	rep(i, n) { cin >> a[i]; }
#define in(a) \
	ll a;     \
	cin >> a;
#define ins(a) \
	string a;  \
	cin >> a;
#define ind(a) \
	double a;  \
	cin >> a;
template <class T>
inline void out(T a)
{
	cout << a << endl;
}
inline void out(double a) { printf("%.10f\n", a); }
#define all(x) (x).begin(), (x).end()
#define rep2(i, a, b) for (ll i = (a); i < (b); ++i)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
#define yes out("Yes")
#define no out("No")
#define degtorad(deg) (deg * M_PI / 180.0)
#define radtodeg(rad) (rad * 180.0 / PI)

int main()
{
	in(a);
	in(b);
	in(h);
	in(m);

	double l = 6*m;
	double s = 30*h+0.5*m;
	double t = abs(l-s);
	if(t>180){
		t = 360-t;
	}
	out(sqrt(a*a+b*b-2*a*b*cos(degtorad(t))));
}

Measured memory_bytes: 4192
#include<bits/stdc++.h>
#include<inttypes.h>//__int64,__int128..
#define MAX_N 200005
//vector&pair
#define pb push_back
#define mp make_pair
//math
#define sq(x) ((x)*(x))
#define abs(x) ((x)>0?(x):(-(x)))//Regardless of type
//for pair
#define fi first
#define se second
//infinit
#define LL_inf (1LL<<60)
#define full_inf 0x7fffffff
#define half_inf 0x3fffffff
//MOD
#define MOD 1000000007LL
using namespace std;
//type
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pil;
typedef long double LD;
LL n,ans,arr[MAX_N];
int main(){
	LL i,j,x,y,z,k;
	scanf("%lld",&n);
	for(i=1;i<=n;i++)	scanf("%lld",&arr[i]);
	j=0;
	k=1;
	x=y=0;
	for(i=1;i<=n;i++){
		for(j=max(i,k);j<=n;j++){
			if(x+arr[j]!=(y^arr[j]))	break;
			x+=arr[j];
			y^=arr[j];
		}
		k=j;
		ans+=(k-i);
		x-=arr[i];
		y^=arr[i];
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i ,m, n) for(int i = m; i >= n; i--)
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define ll long long
#define INF 999999999
#define IOS cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<ll,ll> LP;
typedef pair<ll,LP> LPP;

int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main() {
    int N; cin >> N; 
    ll t; cin >> t;
    ll ans=t;
    rep(i,N-1){
        ll t; cin >> t;
        ans=lcm(t,ans);
    }
    cout << ans << endl;
    

    return 0;
}

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


template<typename T>
std::vector<size_t> argsort(T array){
    vector<size_t> indices(array.size());
    std::iota(indices.begin(),indices.end(),0); //range
    std::sort(indices.begin(), indices.end(), [&array](size_t i1, size_t i2) {
        return array[i1] < array[i2];
    });
    return indices;
}



void solve(long long N, long long M, std::vector<long long> A, std::vector<long long> B, std::vector<long long> C){
    std::sort(A.begin(),A.end());//Aは破壊的にソート
    std::vector<size_t> sorted_idx = argsort(C);//Cはargsort
    long long idx = 0;
    bool break_flag = false;
    for (auto i=M-1;i>=0;i--){
        for (auto j = 0;j<B[sorted_idx[i]];j++){
            if (idx <=N-1 && A[idx] < C[sorted_idx[i]]){
                A[idx] = C[sorted_idx[i]];
                idx+=1;
            }else{
                break_flag= true;
                break;
            }
        }
        if (break_flag) break;
    }
    long long sum = 0;
    for (int i=0;i<N;i++){
        sum += A[i];
    }
    printf("%lld\n",sum);

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    std::vector<long long> B(M);
    std::vector<long long> C(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&B[i]);
        scanf("%lld",&C[i]);
    }
    solve(N, M, std::move(A), std::move(B), std::move(C));
    return 0;
}


Measured memory_bytes: 4096
#include <iostream>
#include <string>
#include <map>
using namespace std;

int n;
string ins, s;

int main() {
    cin >> n;
    map<string, bool> dict;
    while (n--) {
        cin >> ins >> s;
        if (ins[0] == 'i') { //insert
            dict[s] = true;
        } else {
            cout << (dict.count(s) ? "yes" : "no") << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 34928
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <random>
#include <queue>

using namespace std;



int main()
{
	int N;
	vector<int> Ws;

	cin >> N;

	int n;
	int sum = 0;
	for (int ni = 0; ni < N; ni++){
		cin >> n;
		Ws.push_back(n);
		sum += n;
	}

	int buf=0;
	int ls = 0;
	int rs;
	int ans;
	for (int ni = 0; ni < N; ni++){
		if( (ls + Ws[ni]) * 2 >= sum){
			rs = sum - ls - Ws[ni];
			ans = Ws[ni]- abs(ls - rs);
			break;
		}
		ls += Ws[ni];
	}

	printf("%d",ans);

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#define ALL(a) (a).begin(), (a).end()

const ll mod = 1000000007;
const ll LINF = 1e13;
const ll LLINF = 1e18;
const ll ALPHABET = 26;

template <class T>
void Swap(T &r, T &l)
{
    T tmp = r;
    r = l;
    l = tmp;
}

template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
    for (T &x : vec)
        is >> x; //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいい
    return is;
}


// 3  4  9 a
//  3  13  b


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

    vector<ll> a(n+1);
    vector<ll> b(n);
    cin >> a;
    cin >> b;

    ll ans = 0;

    for (ll i = n-1; i >=0 ; i--){
        if (a[i+1] > 0){
            if (a[i+1] < b[i]){
                ans+=a[i+1];
                b[i] -=a[i+1];
                
            }else{
                a[i+1] -=b[i];
                ans+=b[i];
                b[i] = 0;
            }
        }

        if (a[i] >0 && b[i]>0){
            if (a[i] < b[i]){
                ans+=a[i];
                a[i] = 0;
            }else{
                ans+=b[i];
                a[i]-= b[i];
            }
        }
        // cerr << ans <<endl;

    }
    cout<< ans<<endl;

}


Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
struct BIT {
	int n;
	vector<int>d;
	BIT(int m) :n(m) {
		d.assign(n + 1, 0);
	}
	void add(int i, int x) {
		for (int j = i; j <= n; j += j&(-j))d[j] += x;
	}
	int getsum(int i) {
		int ret(0);
		for (int j = i; j > 0; j -= j&(-j))ret += d[j];
		return ret;
	}
	int getsum(int s, int t) {
		return getsum(t) - getsum(s - 1);
	}
};
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, q; cin >> n >> q;
	BIT bit(n);
	rep(i, 0, q) {
		int com, x, y; cin >> com >> x >> y;
		if (com)cout << bit.getsum(x, y) << endl;
		else bit.add(x, y);
	}
	return 0;
}

Measured memory_bytes: 3512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int num = 0;

		for(int i = a ; i <= b ; i++) {
			if(c % i ==0)num++;
		}

		System.out.println(num);

	}

}


Measured memory_bytes: 26272
#include<iostream>
#include<algorithm>
#include<climits>
#include<vector>
#include<utility>
#include<cmath>
#include<cstring>
#include<map>
using namespace std;
 
int main(){
 
int a,b,c;
int max,min;
cin>>a>>b>>c;

if(a < b){
    max = b;
    min = a;
}else{
    max = a;
    min = b;
}

if(c > max || c < min){
    cout << "No" << endl;
    return 0;
}
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
def factorization(n):
    m=n
    counter_map={}
    i=2
    tmp=1
    while n!=1:
        #因数に持つか判定
        if n%i==0:
            n=n//i
            #素数判定
            for j in range(2,int(i**(1/2))+1):
                if i%j==0:
                    break
            else:
                tmp*=i
                if i not in counter_map:
                    counter_map[i]=1
                    tmp=1
                else:
                    if tmp not in counter_map:
                        counter_map[tmp]=1
                        tmp=1
        else:
            i+=1
            tmp=1
        if i>int(m**(1/2)) and n!=1:
            counter_map[n]=1
            break
    return counter_map


a=int(input())
b=factorization(a)
sum=0

for i in b.keys():
    counter=0
    for j in range(1,41):
        if b[i]>=1+(j+2)*(j-1)//2:
            counter=j
        else:
            break
    sum+=counter

print(sum)



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

using namespace std;

int main(){
	int n, t; cin >> n >> t;
	
	vector<int> a(n);
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	
	int sum = t;
	for(int i = 0; i < n - 1; i++){
		int x1 = a[i], y1 = a[i] + t;
		int x2 = a[i + 1], y2 = a[i + 1] + t;
		if(x2 < y1){
			sum += (x2 - x1);
		}
		else sum += t;
	}
	
	cout << sum;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#include <thread>
#include <atomic>
#include <mutex>
#include <future>
#define int long long
#define endre getchar();getchar();return 0
#define INF 1000000007
using namespace std;
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return (y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int n) {
	if (n == 0)return 1;
	return (kai(n - 1)*n) % INF;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int mystoi(string s) {
	int cnt = 0;
	for (int i = 0; i < s.size(); i++) {
		cnt += (int)(s[i] - '0') * pow(10, s.size() - i - 1);
	}
	return cnt;
}
int n;
signed main() {
	cin >> n;
	int cnt = 0, memo;
	for (int i = 1;; i++) {
		cnt += i;
		if (n <= cnt) {
			memo = i;
			break;
		}
	}
	for (int i = memo; i >= 1; i--) {
		if (i <= n) {
			n -= i;
			cout << i << endl;
		}
		if (!n)break;
	}
	endre;
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 62;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  int n; cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  map<int, int> mp;
  mp[0] = mp[2] = mp[4] = 0;
  rep(i, n) {
    if(a[i] % 4 == 0) ++mp[4];
    else if(a[i] % 2 == 0) ++mp[2];
    else ++mp[0];
  }

  if(mp[2] != 0) {
    if(mp[4] >= mp[0]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  else {
    if(mp[0] - mp[4] <= 1) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int x,y;
    char op;
    while(1){
    scanf("%d %c %d",&x,&op,&y);
        if(op=='+'){
            printf("%d\n",x+y);
        }else  if(op=='-'){
            printf("%d\n",x-y);
        }else  if(op=='*'){
            printf("%d\n",x*y);
        }else  if(op=='/'){
            printf("%d\n",x/y);
        }else{
            break;
        }
    }

    return 0;
}



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

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

    int count = 0, max = 0;
    for(int i = 0; i < 3; i++){
        count = 0;
        if(in[i] == 'R'){
            count += 1;
            int j = i + 1;
            while(in[j] == 'R'){
                count += 1;
                j += 1;
            }
            i = j - 1;
            if(count > max)
                max = count;
        }
    }
    cout << max << endl;
}


Measured memory_bytes: 3624
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: i64 = input();
    let a: i64 = input();
    let b: i64 = input();
    println!(
        "{}",
        (1..n + 1)
            .filter_map(|n| {
                let mut m = n;
                let mut s = 0;
                while m > 0 {
                    s += m % 10;
                    m /= 10;
                }
                if a <= s && s <= b {
                    Some(n)
                } else {
                    None
                }
            })
            .sum::<i64>()
    );
}


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

class Program
{
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		var positions = new position[N];
		double total = 0,result;

		for(int i = 0;i < N;i++)
		{
			var p = Console.ReadLine().Split(' '); //positionストラクトにxPos,yPosを入れ込む
			positions[i].xPos = int.Parse(p[0]);
			positions[i].yPos = int.Parse(p[1]);
		}
		for(int i = 0;i < N - 1;i++)
		{
			for(int j = i + 1;j < N;j++)
			{
				total += Math.Sqrt(Math.Pow(positions[i].xPos - positions[j].xPos, 2) + Math.Pow(positions[i].yPos - positions[j].yPos, 2));
			}
		}
		//totalは各地点間の距離の和
		result = total * 2 / N;
		Console.Write(result);
	}
	struct position
	{
		public int xPos;
		public int yPos;
	}
}



Measured memory_bytes: 11092
#include "bits/stdc++.h"
#define ed cout<<"\n";
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;
int main(){
   SPEED;
   int s;
   cin>>s;
   int L=s/100;
   int R=s%100;
   string ans;
    
    if(0<L&&L<13){
        if(0<R&&R<13)ans="AMBIGUOUS";
        else ans="MMYY";
    }else{
        if(0<R&&R<13)ans="YYMM";
        else ans="NA";
    }
    cout<<ans;
   
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<cctype>
#define qmin(x,y) (x=min(x,y))
#define qmax(x,y) (x=max(x,y))
using namespace std;

inline char gc() {
//	static char buf[100000],*p1,*p2;
//	return (p1==p2)&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
	return getchar();
}

template<class T>
int read(T &ans) {
	ans=0;char ch=gc();T f=1;
	while(!isdigit(ch)) {
		if(ch==EOF) return -1;
		if(ch=='-') f=-1;
		ch=gc();
	}
	while(isdigit(ch))
		ans=ans*10+ch-'0',ch=gc();
	ans*=f;return 1;
}

template<class T1,class T2>
int read(T1 &a,T2 &b) {
	return read(a)!=EOF&&read(b)!=EOF?2:EOF;
}

template<class T1,class T2,class T3>
int read(T1 &a,T2 &b,T3 &c) {
	return read(a,b)!=EOF&&read(c)!=EOF?3:EOF;
}

typedef long long ll;
const int Maxn=1100000;
const int inf=0x3f3f3f3f;

signed main() {
//	freopen("test.in","r",stdin);
	int n,l,r;read(n,l,r);
	int b1=0,b2=0,b3=0,x;
	for(int i=1;i<=n;i++) {
		read(x);
		if(x<=l) b1++;
		else if(x<=r) b2++;
		else b3++;
	}
	printf("%d",min(min(b1,b2),b3));
	return 0;
}



Measured memory_bytes: 128
#include<stdio.h>
#include<math.h>

int isPrime(int);

int main()
{
  int a[10000];
  int n=0,i,j,x;

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

  for(i = 0;i < x;i++){
    if(isPrime(a[i]) == 1) n++;
  }

  printf("%d\n",n);

  return 0;
}

int isPrime(int x)
{
  int count=0,i=3;
  if(x == 2) return 1;
  else if(x < 2 || x % 2 == 0) return 0;

  else{
    while(i <= sqrt(x)){
      if(x % i == 0) return 0;
      i = i+2;
    }
  }
  return 1;
}



Measured memory_bytes: 2032
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int N=610;
int n,m;
bool w[N][N];
inline void solve() {
    int x,d=0;
    cin>>x;
    while(x%4==0) x/=4,++d;
    if(x&1) {
	for(int i=0;i<m;i++)
	    for(int j=0;j<m;j++)
		if(((i>>d)+(j>>d))&1) w[i][j]=1;
    }
    else {
	for(int i=0;i<m;i++)
	    if(i>>d&1)
		for(int j=0;j<m;j++) w[i][j]=1;
    }
}
int main() {
    cin>>n,m=n+n;
    solve(),solve(),n*=n;
    for(int i=0;i<m;i++)
	for(int j=0;j<m;j++)
	    if(!w[i][j]) {
		printf("%d %d\n",i,j);
		if(!--n) return 0;
	    }
    return 0;
}

Measured memory_bytes: 1280
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

n = int(input())
d = {}
for i in range(n - 1):
  u, v, w = map(int, input().split())
  u -= 1
  v -= 1
  if u in d:
    d[u].append([v, w])
  else:
    d[u] = [[v, w]]
  if v in d:
    d[v].append([u, w])
  else:
    d[v] = [[u, w]]

rem = {}

for i in range(n):
  rem[i] = 1
  
ans = [0 for _ in range(n)]

def check(p, tmp):
  rem.pop(p)
  for n, w in d[p]:
    if n in rem:
      ntmp = (tmp + w) % 2
      ans[n] = ntmp
      check(n, ntmp)
      
check(0, 0)

for res in ans:
  print(res)


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

int main() {
  int n, x;
  cin >> n >> x;
  vector<int> a(n);
  
  for(int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  
  int count = 0;
  for (int i = 0; i < n; i++) {
    x -= a[i];
    if (x < 0) break;
    count++;
    if (i==n-1 && x>0) count--;
  }
  cout << count << endl;
  
}



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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set
#define l_l pair<ll, ll>
#define vll vector<ll>
#define mll map<ll, ll>

using namespace std;

const ll MOD = 1000000007LL;
const ll INF = (1LL << 60LL);

int main() {
  // std::cout << std::fixed << std::setprecision(10);

  string S;
  cin >> S;

  string T;
  cin >> T;

  ll ans = INF;

  for (ll start = 0; start < S.size() - T.size() + 1; start++) {
    ll count = 0;
    for (ll i = 0; i < T.size(); i++) {
      ll index = start + i;
      if (T[i] != S[index]) {
        count++;
      }
    }

    ans = min(ans, count);
  }

  cout << ans << endl;
}


Measured memory_bytes: 3628
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:usize = read();
    let mut arr:Vec<usize> = (0..n).map(|_| read()).collect();
    arr.sort();
    let last = arr.pop().unwrap();
    let sum:usize = arr.iter().sum();
    let ans = if last < sum {"Yes"} else {"No"};
    println!("{}", ans);
}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define ll long long
#define endl "\n"
#define print_array(name,n) for(ll o=0;o<n;o++) cout<<name[o]<<" "
#define fr(i,f,t) for(ll i=(f);i<t;i++)
#define fb(i,f,t) for(ll i=(f);i>=t;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 2e18
bool sortbysecond(const pair<int,int> &a,const pair<int,int> &b){
	return (a.ss>b.ss);
}
template <typename T>
string NumberTostring(T Number )
{
	ostringstream ss;
	ss<<Number;
	return ss.str();
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int k,n;
    cin>>k>>n;
    int arr[n] = {0};
    for(int i=0;i<n;i++){
    	cin>>arr[i];
    }
    sort(arr,arr+n);
    int mini = k;
    for(int i=0;i<n;i++){
    	int ck;
    	int ak;
    	if(i==0){
    		// cout<<(i-1)%k<<endl;
    		// cout<<arr[(i-1)%k]<<endl;
    		ck = abs(arr[i]-arr[n-1]);
    		ak = k -abs(arr[i]-arr[(i+1)%n]);
    	}
    	else if(i==n-1){
    		ck = k - abs(arr[i]-arr[(i-1)%n]);
    		ak = abs(arr[i]-arr[(i+1)%n]);
    		// cout<<(i+1)%n<<endl;
    	}
    	else{
    		ck = k - abs(arr[i]-arr[(i-1)%n]);
    		ak = k -abs(arr[i]-arr[(i+1)%n]);

    	}
    	if(ck<mini){
    		mini = ck;
    	}
    	if(ak<mini){
    		mini=ak;
    	}

    	// cout<<ck<<" "<<ak<<" "<<mini<<endl;
    }
    cout<<mini<<endl;


    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
int read()
{
	int out = 0, sgn = 1;
	char jp = getchar();
	while (jp != '-' && (jp < '0' || jp > '9'))
		jp = getchar();
	if (jp == '-')
		sgn = -1, jp = getchar();
	while (jp >= '0' && jp <= '9')
		out = out * 10 + jp - '0', jp = getchar();
	return out * sgn;
}
const int P = 1e9 + 7;
int add(int a, int b)
{
	return a + b >= P ? a + b - P : a + b;
}
void inc(int &a, int b)
{
	a = add(a, b);
}
int mul(int a, int b)
{
	return 1LL * a * b % P;
}
int fpow(int a, int b)
{
	int res = 1;
	while (b)
	{
		if (b & 1)
			res = mul(res, a);
		a = mul(a, a);
		b >>= 1;
	}
	return res;
}
const int N = 300 + 10;
int n, deg, fac[N], invfac[N], dp[N][N][2], ans;
int main()
{
	n = read();
	fac[0] = 1;
	for (int i = 1; i <= n; ++i)
		fac[i] = mul(fac[i - 1], i);
	invfac[n] = fpow(fac[n], P - 2);
	for (int i = n - 1; i >= 0; --i)
		invfac[i] = mul(invfac[i + 1], i + 1);
	dp[0][0][0] = 1;
	bool flag = true;
	for (int i = 1; i <= n; ++i)
	{
		deg = read();
		flag &= (deg == 2);
		for (int j = 0; j < i; ++j)	
			for (int p = 0; p < 2; ++p) if (dp[i - 1][j][p])
			{
				int t = dp[i - 1][j][p];
				inc(dp[i][j][p], mul(t, invfac[deg - 1]));
				if (deg >= 2)
					inc(dp[i][j + 1][p], mul(t, invfac[deg - 2]));
				if (!p && deg >= 3)
					inc(dp[i][j + 1][p + 1], mul(t, invfac[deg - 3]));
			}
	}
	if (flag)
		ans = mul(invfac[2], fac[n - 1]);
	for (int k = 3; k < n; ++k)
		inc(ans, mul(mul(invfac[2], mul(fac[n - k - 1], fac[k - 1])), dp[n][k][1]));
	printf("%d\n", ans);
	return 0;
}


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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
#define chmax(x, v) do { x = max(x, v); } while (0)
#define chmin(x, v) do { x = min(x, v); } while (0)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

struct S {
  ll val;
  char c;
  ll bi, bj;
};

string s, t;
ll N, M;

// dp[i][j]: s[i], t[j]まで見たときに一致している部分文字列の数
S dp[4000][4000];
vector<ll> vs[1000];
vector<ll> vt[1000];

signed main() {
  cin >> s >> t;
  N = s.size();
  M = t.size();
  s = " " + s;
  t = " " + t;
  rep(i, 4000) rep(j, 4000) dp[i][j] = {-1, '#', -1, -1};
  for (ll i=1; i<=N; i++) vs[s[i]].push_back(i);
  for (ll j=1; j<=M; j++) vt[t[j]].push_back(j);
  dp[0][0] = {0, '#', -1, -1};
  for (ll i=0; i<=N; i++) for (ll j=0; j<=M; j++) {
    // s[i+1] と一致させる
    {
      ll ni = i+1;
      if (ni <= N) {
        char c = s[ni];
        auto &v = vt[c];
        auto it = lower_bound(begin(v), end(v), j+1);
        if (it != end(v)) {
          ll nj = *it;
          // printf("match c=%c s[%ld]=%c t[%ld]=%c\n", c, ni, s[ni], nj, t[nj]);
          if (dp[i][j].val+1 > dp[ni][nj].val) {
            dp[ni][nj] = {dp[i][j].val + 1, c, i, j};
          }
        }
      }
    }
    // t[j+1] と一致させる
    {
      ll nj = j+1;
      if (nj <= M) {
        char c = t[nj];
        auto &v = vs[c];
        auto it = lower_bound(begin(v), end(v), i+1);
        if (it != end(v)) {
          ll ni = *it;
          // printf("match c=%c s[%ld]=%c t[%ld]=%c\n", c, ni, s[ni], nj, t[nj]);
          if (dp[i][j].val+1 > dp[ni][nj].val) {
            dp[ni][nj] = {dp[i][j].val + 1, c, i, j};
          }
        }
      }
    }
    // s[i+1] と一致させない
    {
      ll ni = i+1, nj = j;
      if (dp[i][j].val+1 > dp[ni][nj].val) {
        dp[ni][nj] = {dp[i][j].val, '#', i, j};
      }
    }
    // t[j+1] と一致させない
    {
      ll nj = j+1, ni = i;
      if (dp[i][j].val+1 > dp[ni][nj].val) {
        dp[ni][nj] = {dp[i][j].val, '#', i, j};
      }
    }
  }
  // cout << dp[N][M].val << endl;
  ll i = N, j = M;
  string ans = "";
  while (i != -1 && j != -1) {
    auto &d = dp[i][j];
    if (d.c != '#') ans = d.c + ans;
    i = d.bi, j = d.bj;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 500480
#!/usr/local/bin/python3
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n = f()[0]

    print('Christmas', end ='')

    for i in range(25 - n):
        print(" Eve", end = '')
    
    print()

solve()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main(){
  string s ;
  cin >> s;
  int n = s.size();
  int ans = INF32;
  for(int i = 0; i < n; ){
    int j = i;
    for(; j < n; ++j){
      if(s[j]!=s[i])break;
    }
    int tmp = max(j, n-j);
    ans = min(ans, tmp);
    i=j;
  }
  cout << ans << endl;
  return 0;
}

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

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}


int main() {
string x,y;cin >> x >> y;
if(x<y)cout << '<' << endl;
else if(x>y) cout << '>' << endl;
else cout << '=' << endl;


        return 0;
}


Measured memory_bytes: 256
import numpy as np

h, w = map(int, input().split())
a = np.array([list(input()) for _ in range(h)])

for i in range(h):
    if np.count_nonzero(a[i] == '#') == 0:
        a[i] = 'x'
for i in range(w):
    if np.count_nonzero(a[:, i] == '#') == 0:
        a[:, i] = 'x'

for i in range(h):
    if res := ''.join(filter(lambda x: x != 'x', a[i])):
        print(res)


Measured memory_bytes: 27280
import sys
input = sys.stdin.readline

s = input()[:-1]

a = [0]*(len(s)+1)
l = [0]*len(a)
r = [0]*len(a)

for i in range(1, len(a)):
    if s[i-1] == '<':
        l[i] = l[i-1] + 1
        
for i in range(len(a)-2, -1, -1):
    if s[i] == '>':
        r[i] = r[i+1] + 1

for i in range(len(a)):
    a[i] = max(l[i], r[i])

print(sum(a))

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

using namespace std;

typedef pair<int, int> ii;
typedef long long ll;
const int oo = 1e9 + 7;

const int N = 1e5 + 5;
int n, m;
bool mask[N];

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  memset(mask, 0, sizeof mask);
  map<int, int> mp, wa;
  int cnt = 0;
  for (int i = 1; i <= m; ++i) {
    int p;
    string s;
    cin >> p >> s;
    if (s[0] == 'A') {
      mp[p]++;
      mask[p] = true;
    }
    else {
      if (!mask[p])
        wa[p]++;
    }
  }
  for (int i = 1; i <= n; ++i)
    if (mp.find(i) != mp.end()) {
      cnt += wa[i];
    }
  cout << int(mp.size()) << ' ' << cnt << '\n';
  return 0;
}


Measured memory_bytes: 9728