akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define eb emplace_back
#define rep(i, a, b) for (long i = (a); i <= (b); ++i)
#define per(i, a, b) for (long i = (a); i >= (b); --i)
#define mmst(v) memset(v, 0, sizeof(v))

template<typename T1,typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 & a, T2 b) { if (a < b) a = b; }

const long kMax2 = 109;
const long kMax3 = 1009;
const long kMax4 = 10009;
const long kMax5 = 100009;
const long kMax6 = 1000009;
const long kMax9 = 1000000010;
const long kInfI = 0x3F3F3F3F;
const float kInfF = 1e15;
const long long kMod = 1000000007;

const long long kMAX = 1000000000;

using namespace std;
using ll = long long;

inline int readInt() {
  char c = getchar();
  while(!isdigit(c) && c != '-') c = getchar();
  int sigma = 1;
  if (c == '-') {
    sigma = -1;
    c = getchar();
  }
  int x = 0;
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * sigma;
}

template <class T>
void PrintVector(const vector<T> & v) {
  for (const auto & e: v) {
    cout << e << endl;
  }
}

template <class T>
void PrintVector(const vector<T> & v, int n) {
  rep(i, 0, n - 1) {
    cout << v[i] << endl;
  }
}

double dist(double lhs, double rhs) {
  return sqrt(lhs * lhs + rhs * rhs);
}

// int binary(int bina){
//   int ans = 0;
//   for (int i = 0; bina>0 ; i++)
//   {
//     ans = ans+(bina%2)*pow(10,i);
//     bina = bina/2;
//   }
//   return ans;
// }

long n, m, k, t;
string binary(int dec){
  string s;
  while (dec > 0) {
    s.pb((dec % 2) + '0');
    dec /= 2;
  }
  auto j = n - long(s.size());
  rep(i, 0, j - 1) { s.pb('0'); }
  reverse(s.begin(), s.end());
  return s;
}

int main() {
  long ans = 0;
  vector<long> a;
  vector<long> x[20];
  vector<long> y[20];

  cin >> n;
  rep(i, 0, n - 1) {
    int a0;
    cin >> a0;
    a.pb(a0);
    rep(j, 0, a0 - 1) {
      int x0, y0;
      cin >> x0 >> y0;
      x[i].pb(x0);
      y[i].pb(y0);
    }
  }

  int _cnt = int(exp2(n));
  long _max = 0;
  while (_cnt > 0) {
  loop:
    --_cnt;
    _max = 0;
    auto s = binary(_cnt);
    rep(j, 0, n - 1) {
      if (s[j] != '1') continue;
      ++_max;

      rep(k, 0, a[j] - 1) {
        if (s[x[j][k] - 1] - '0' != y[j][k]) { goto loop; }
      }
    }
    chmax(ans, _max);
  }

  cout << ans << endl;

  return 0;
}


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

int main() {
  int N,K,Z=0;
  cin>>N>>K;
  vector<int> p(N);
  for(int i=0;i<K;i++){
    int d;
    cin>>d;
    for(int j=0;j<d;j++){
      int a;
      cin>>a;
      a--;
      p.at(a)++;
    }
  }
  for(int i=0;i<N;i++){
    if(p.at(i)==0){
      Z++;
    }
  }
  cout<<Z<<endl;
    
}



Measured memory_bytes: 3628
import numpy as np
s = input()
N = len(s)
distance = np.zeros(N)
for i in range(N):
	if s[i] == "L":
		ell = i
		break
r = 0

for i in range(N):
	if i >= 1 and s[i] == "R" and s[i-1] == "L":
		for k in range(i+1,N):
			if s[k] == "L":
				ell = k
				break
		distance[i] = ell-i
		r = i
	elif s[i] == "R":
		distance[i] = ell-i
		r = i
	if s[i] == "L":
		distance[i] = i-r
ans = np.zeros(N).astype(int)

for i in range(N):
	d = int(distance[i])
	if s[i] == "R":
		if d %2 ==0:
			ans[i+d] += 1
		else:
			ans[i+d-1] += 1
	else:
		if d %2 == 0:
			ans[i-d] += 1
		else:
			ans[i-d+1] += 1
for i in range(N):
	print(str(ans[i])+" ",end = "")


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

typedef long long ll;
typedef vector <ll> v_ll;
typedef vector <vector <ll> > vv_ll;
typedef vector < pair <ll,ll> > vp_ll;
typedef pair <ll,ll> p_ll;

ll A,B;


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


Measured memory_bytes: 888
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        int x = Integer.parseInt(sc.next());
        int y = Integer.parseInt(sc.next());

        int[] xAr = new int[n];
        int[] yAr = new int[m];
        for (int i=0;i < n ;i++ ) {
            xAr[i] = Integer.parseInt(sc.next());
        }
        for (int i=0;i < m ;i++ ) {
            yAr[i] = Integer.parseInt(sc.next());
        }
        Arrays.sort(xAr);
        Arrays.sort(yAr);

        if(yAr[0] <= x){
            System.out.println("War");
        }else if(xAr[n-1] >= y){
            System.out.println("War");
        }else if(xAr[n-1] >= yAr[0] ) {
            System.out.println("War");
        }else{
            System.out.println("No War");
        }
    }
}

Measured memory_bytes: 23252
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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

func main() {
	A := []int{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}

	K := nextInt()
	fmt.Println(A[K-1])
}


Measured memory_bytes: 640
n,k,*a=map(int,open(0).read().split())
d=[0]*41 #1になってる
for i in range(n):
  for j in range(41):
    d[j]+=(a[i]>>j)&1
f=0
la=len(bin(max(a)))-2
lk=len(bin(k))-2
b=[0]*41
for i in range(lk-1,-1,-1):
  if (k>>i)&1==1:
    if d[i]<n-d[i]:
      b[i]=1
    else:
      b[i]=0
      f=1
  if (k>>i)&1==0:
    if d[i]<n-d[i] and f==1:
      b[i]=1
    else:
      b[i]=0
ans=0
for i in range(max(lk,la)):
  ans+=(1<<i)*[d[i],n-d[i]][b[i]]
print(ans)

Measured memory_bytes: 20148
#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 ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string a,b,c;
  cin >> a >> b >> c;

  cout << (a.back()==b[0]&&b.back()==c[0] ? "YES" : "NO") << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
#define lP pair<ll, ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;

int N, x[200000], y[200000], tree[1 << 19], aaa[200000];
ll res;
vector<int>w;
vector<pair<int, int>>xy;

ll pw(ll x, int y) {
	ll a = 1;
	while (y) {
		if (y & 1) {
			a = a*x%mod998;
		}
		x = x*x%mod998;
		y >>= 1;
	}
	return a;
}

int calc(int l, int r, int p, int q, int k) {
	if (r < p || q < l)return 0;
	if (p <= l&&r <= q)return tree[k];
	return calc(l, (l + r) / 2, p, q, k * 2) + calc((l + r) / 2 + 1, r, p, q, k * 2 + 1);
}

void update(int x) {
	x += (1 << 18);
	while (x) {
		++tree[x];
		x >>= 1;
	}
}

int main() {
	cin >> N;
	res = (pw(2, N) - 1) * N;
	for (int i = 0; i < N; ++i) {
		cin >> x[i] >> y[i];
		w.push_back(y[i]);
		xy.push_back(mkp(x[i], y[i]));
	}
	sort(w.begin(), w.end());
	sort(xy.begin(), xy.end());
	for (int i = 0; i < N; ++i) {
		int t = lower_bound(w.begin(), w.end(), xy[i].second) - w.begin();
		res += pw(2, calc(0, (1 << 18) - 1, 0, t, 1)) - 1;
		res += pw(2, calc(0, (1 << 18) - 1, t, (1 << 18) - 1, 1)) - 1;
		res -= pw(2, i) - 1;
		aaa[i] = calc(0, (1 << 18) - 1, 0, t, 1);
		res += mod998;
		res %= mod998;
		update(t);
	}
	for (int i = 0; i < (1 << 19); ++i) {
		tree[i] = 0;
	}
	for (int i = N - 1; i >= 0; --i) {
		int t = lower_bound(w.begin(), w.end(), xy[i].second) - w.begin(); 
		res += pw(2, calc(0, (1 << 18) - 1, 0, t, 1)) - 1;
		res += pw(2, calc(0, (1 << 18) - 1, t, (1 << 18) - 1, 1)) - 1;
		res -= pw(2, (N - 1 - i)) - 1;
		aaa[i] += calc(0, (1 << 18) - 1, 0, t, 1);
		res -= pw(2, aaa[i]) - 1;
		res -= pw(2, N - 1 - aaa[i]) - 1;
		res += ll(mod998) * 7;
		res %= mod998;
		update(t);
	}
	cout << res << endl;
}

Measured memory_bytes: 7144
#include<bits/stdc++.h>
using namespace std;
#define I_O		ios::sync_with_stdio(false),cin.tie(0)
#define ll		long long
#define ff		first
#define ss		second
#define mod 		1000000007
#define rep(i,n)	for(ll i=1;i<=n;i++)
#define repv(i,a,n)	for(ll i=a;i<=n;i++)
#define pb 		push_back
#define newl		'\n'
#define deb(x)		cout<<x<<" "
int ac = 0,wa  = 0,tle = 0,re = 0;
int main() 
{  
	I_O;
	int n;	cin>>n;
	if(n%1000 == 0)	cout<<0;
	else
	{
		int num = n/1000;
		num++;
		int val = (num*1000) - n;
		cout<<val;
	}
} 


Measured memory_bytes: 3648
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string { sc.Scan(); return sc.Text() }
func scanInt() int { a,_ := strconv.Atoi(scanString()); return a }
func scanInt64() int64 { a,_ := strconv.ParseInt(scanString(),10,64); return a }
func scanFloat64() float64 { a,_ := strconv.ParseFloat(scanString(),64); return a }

func scanInts(n int) []int {
	res := make([]int, n); for i := 0; i < n; i++ { res[i] = scanInt() }; return res
}

func abs(a int) int { if a<0 { return -a }; return a }
func min(a,b int) int { if a<b { return a }; return b }
func max(a,b int) int { if a>b { return a }; return b }

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1000000)

	n := scanInt()

	s := make(map[string]int)

	for i := 0; i < n; i++ {
		in := scanString()
		s[in]++
	}

	ss := make(ts,0)
	for st, c := range s {
		ss = append(ss, t{st,c})
	}
	// fmt.Println(ss)
	sort.Sort(ss)

	cnt := ss[0].c
	for i := 0; i < len(ss); i++ {
		if cnt != ss[i].c {
			break
		}
		fmt.Println(ss[i].s)
	}
	// fmt.Println(ss)
}

type t struct {
	s string
	c int
}

type ts []t

func (a ts) Len() int           { return len(a) }
func (a ts) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a ts) Less(i, j int) bool { 
	if a[i].c == a[j].c {
		return a[i].s < a[j].s
	}
	return a[i].c > a[j].c
}


Measured memory_bytes: 36864
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define int long long
signed main(){
    int n;
    cin >> n;
    vector<int>x(n),l(n);
    rep(i,n){
        cin >> x[i] >> l[i];
    }
    vector<pair<int,int> > p;
    rep(i,n){
        p.push_back(MP(l[i]+x[i],x[i]-l[i]));
    }
    sort(p.begin(),p.end());
    int r = -inf;
    int c = 0;
    rep(i,n){
        if(p[i].second >= r){
            r = p[i].first;
            c++;
        }
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 4588
fn main() {
    let mut ny = String::new();
    std::io::stdin().read_line(&mut ny).unwrap();
    let v: Vec<u32> = ny.trim().split_whitespace()
        .map(|x| x.parse().unwrap()).collect();

    for i in 0..v[0]+1 {
        for j in 0..v[0]+1-i {
            if (10000 * i + 5000 * j + 1000 * (v[0]-i-j) == v[1]) {
                println!("{} {} {}", i, j, v[0]-i-j);
                return;
            }
        }
    }
    println!("-1 -1 -1");
}

Measured memory_bytes: 4352
n,m=map(int,input().split()) #<=2*10**3
#n
s=list(map(int,input().split()))
#m
t=list(map(int,input().split()))
mod=10**9+7
ans=[0]*m

for u in s:
    h=[0]*m
    if u==t[0]:
        h[0]=1
    for i in range(1,m):
        if t[i]==u:
            h[i]+=ans[i-1]+1
        h[i]+=h[i-1]
    for i in range(m):
        ans[i]=(ans[i]+h[i])%mod
print((ans[-1]+1)%mod)

Measured memory_bytes: 42220
#include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

int main(void)
{
	vector<string> s(3);
	for(int i=0; i<3; i++)
		cin >> s[i];

	for(int i=0; i<3; i++)
		cout << (char)toupper(s[i][0]);
	cout << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
using namespace std;
int intinput() {
	int x;
	cin >> x;
	return x;
}
vector<int> forintinput(int n) {
	vector<int> x(100000);
	for(int i = 0;i < n;i++) cin >> x[i];
	return x;
}
int main(){
	int n;
	n = intinput();
	if(n % 10 == 2||n % 10 == 4||n % 10 == 5||n % 10 == 7||n % 10 == 9){
		cout << "hon" << endl;
	}else if(n % 10 == 0||n % 10 == 1||n % 10 == 6||n % 10 == 8){
		cout << "pon" << endl;
	}else{
		cout << "bon" << endl;
	}
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector<int> b(9);
  for(int i=0;i<9;i++){
    cin >> b.at(i);
  }
  int N;
  cin >> N;
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin >> vec.at(i);
    for(int j=0;j<9;j++){
      if(vec.at(i) == b.at(j)){
        b.at(j) = 0;
      }
    }
  }
  
  // bingoは8通り
  // 3つの数字の合計が0になっているものが1ラインでもあればBINGO。
  // (0,1,2)(3,4,5)(6,7,8)(0,3,6)(1,4,7)(2,5,8)(0,4,8)(2,4,6)

  int isBingo;
  isBingo = (b.at(0)+b.at(1)+b.at(2))*(b.at(3)+b.at(4)+b.at(5))*(b.at(6)+b.at(7)+b.at(8))*(b.at(0)+b.at(3)+b.at(6))*(b.at(1)+b.at(4)+b.at(7))*(b.at(2)+b.at(5)+b.at(8))*(b.at(0)+b.at(4)+b.at(8))*(b.at(2)+b.at(4)+b.at(6));
  if(isBingo == 0){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }


}

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

#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define F first
#define S second
#define mp make_pair
#define all(x) (x).begin(), (x).end()

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;



int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	ll n, a, b;
	cin >> n >> a >> b;
	ll num = n / (a + b);
	ll ans = num * a;
	ans += min(a, n % (a + b));
	cout << ans;
}


Measured memory_bytes: 256
/*
ID: arthurc4
TASK: test
LANG: C++11
*/

#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <queue>
#include <bitset>

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;

typedef vector<string> vs;
typedef vector<vs> vvs;

typedef vector<bool> vb;
typedef vector<vb> vvb;

typedef map<string,int> msi;
typedef map<int,int> mii;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll; // note 'single' ls

#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++)

#define pb \
push_back

#define ff \
first

#define ss \
second

int main()
{
	//ifstream cin("input.txt");
	//ifstream cin("test.in");
	//ofstream cout("test.out");

	int n;
	cin >> n;

	string s;
	cin >> s;

	vi west_count={0};

	REP(i, 0, n-1)
	{
		if (s[i] == 'W') west_count.pb(west_count.back()+1);
		else west_count.pb(west_count.back());
	} 

	// for (auto w:west_count)
	// {
	// 	cout << w << " ";
	// }

	int max_facing = 0;

	REP(i, 1, n)
	{
		//cout << i << " ";

		max_facing = max(max_facing, i-1 - west_count[i-1] + west_count.back()-west_count[i]);
		//cout << i-1 - west_count[i-1] << " and " << west_count.back()-west_count[i] << endl;
	}

	cout << n-1-max_facing << endl;

	return 0;
}

Measured memory_bytes: 2812
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <map>
using namespace std;

int main(){
  int A,B;
  cin >> A >> B;
  int max_num;
  int counter = 0;

  for(int i = 0;i < 2;i++){
    max_num=max(A,B);
    counter += max_num;
    if(max_num == A) A -= 1;
    else B -= 1;
  }

  cout << counter << endl;
}

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

#define debug(x) cout <<"DEBUG"<<" "<<#x<<":"<<x<<'\n'

//↓0-indexか1-indexでn回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   //0-index昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) //1-index昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  //0-index降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   //1-index降順
//rep2 -> 第二引数 m から n 回繰り返し ex) m=5 n=3 なら i=5,i=6,i=7 まで
#define rep2(i,m,n) for(int i = ((int)(m)); i < ((int)(n))+((int)(m)); i++)
#define SIZE(x) ((int)((x).size()))
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;
template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

/* 円周率は M_PI を使おうね */
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;

/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    //cout << fixed << setprecision(10);

    string s; cin >> s;
    sort(all(s));
    if(s[0]==s[1] && s[1]!=s[2] && s[2]==s[3]) cout << "Yes" << '\n';
    else cout << "No" << '\n';
}

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

#define faster  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define sq(x)   (x)*(x)
#define PI      acos(-1.0)
#define nl      '\n'

typedef long long int ll;
typedef unsigned long long int  llu;

long long int gcd(long long int a,long long int b)
{
    if(b==0)
        return a;
    else return gcd(b,a%b);

}

 long long int lcm(long long int a,long long int b)
 {
    return (a*b)/gcd(a, b);
 }

int main()
{
    ll a,b;
    cin>>a>>b;
    cout<<lcm(a,b)<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int i;
    long long a[n+1],dp[n+1];
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    dp[1]=a[1];
    for(i=2;i<=n;i++)
    {
        dp[i]=dp[i-1];
        if(a[i]>a[i-1])
        {
            dp[i]+=(a[i]-a[i-1]);
        }
    }
    cout<<dp[n]<<endl;
}



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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

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

	ll a, b;cin >> a >> b;

	if(a <= 5){
		cout << 0 << endl;
	}
	else if(a <= 12){
		cout << b / 2 << endl;
	}
	else {
		cout << b << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
	int n;
	scanf("%d", &n);
	vector<int> a(n);
	for(auto& i : a) scanf("%d", &i);
	sort(a.begin(), a.end());
	int c = 0;
	vector<bool> e(1000001);
	for(int i = 0; i < n; i++)
	{
		if(e[a[i]] == false)
		{
			if(!(i + 1 < n && a[i] == a[i + 1]))
			{
				c++;
			}
			for(int j = 1; a[i] * j <= 1000000; j++)
			{
				e[a[i] * j] = true;
			}
		}
	}
	printf("%d\n", c);
	return 0;
}

Measured memory_bytes: 4344
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
//#include <conio.h>
using namespace std;

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

#define rep(i,n)	for(ll i=0;i<(n);i++)
#define SZ(x) ((ll)x.size())
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define F first
#define S second
#define int ll
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll MOD = INT_MAX;
const double PI = acos(-1);

void openfile(){
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
}
const int N = 2005;
vector<int> a;
int n,k;

int count(int x){
	int cnt = 0;
	rep(i,n){
		if(a[i] * a[i] < x)	cnt--;

		// if(a[i] == 0 && x >= 0)	cnt += n;
		// else if(a[i] < 0){
		// 	cnt += n - (lower_bound(a.begin(), a.end(), (long double)x / a[i]) - a.begin());
		// }
		// else if(a[i] > 0){
		// 	int pos = upper_bound(a.begin(), a.end(), (long double)x / a[i]) - a.begin();
		// 	cnt += pos;
		// }

		if(a[i] <= 0){ // negative or zero
			int l = -1,r = n;
			while(r-l > 1){
				int mid = (l+r) / 2;
				if(a[i] * a[mid] < x)	r = mid;
				else	l = mid;
			}
			cnt += n-r;
		}
		else{			// positive
			int l = -1,r = n;
			while(r-l > 1){
				int mid = (l+r) / 2;
				if(a[i] * a[mid] < x)	l = mid;
				else	r = mid;
			}
			cnt += r;
		}
		// cout << cnt << ' ';
	}
	// cout << endl << x << ' ' << cnt << endl;

	return cnt / 2;
}

signed main(){
	IOS
	cin >> n >> k;
	rep(i,n){
		int b;	cin >> b;
		a.pb(b);
	}
	sort(a.begin(), a.end());
	int l = -1e18+7, r = 1e18+7;
	while(r-l > 1){
		int mid = (l+r) / 2;
		if(count(mid) < k)	l = mid;
		else		r = mid;
	}
	cout << l << endl;
}


Measured memory_bytes: 2420
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define bg begin()
#define en end()

using namespace std;

typedef long long ll;

int H, W;
int a[505][505];

vector<pair<int, int>> src, dst;


int main() {
  
  scanf("%d %d", &H, &W);
  
  rep(i, 1, H+1) {
    rep(j, 1, W+1) {
      scanf("%d", &a[i][j]);
    }
  }
  
  rep(i, 1, H+1) {
    rep(j, 1, W+1) {
      if (a[i][j]%2==1){
        if ( j != W) {
          src.pb(make_pair(i, j));
          dst.pb(make_pair(i, j+1));
          a[i][j+1]++;          
         } else if ( j == W && i != H) {
          src.pb(make_pair(i, j));
          dst.pb(make_pair(i+1, j));
          a[i+1][j]++; 
         }   
       }     
     }
  
  }
  printf("%d\n", (int)src.size());
  for (int i = 0; i < src.size(); i++) {
    printf("%d %d %d %d\n", src[i].first, src[i].second, dst[i].first, dst[i].second);
  }
  
  return 0;
}
 


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

int main(){
  int n;
  cin>>n;
  double p[n+1];
  p[0] = 0;
  for(int i=1; i<=n; i++) cin>>p[i];
  //cout<<"a";
  double dp[n+1][n+1];
  for(int i=0; i<=n; i++){
    for(int j=0; j<=i; j++){
      if(i == 0){
        dp[i][j] = 1;
      }
      else if(j == 0){
        dp[i][j] = dp[i-1][j]*(1-p[i]);
      }
      else if(j == i){
        dp[i][j] = dp[i-1][j-1]*(p[i]);
      }
      else{
        dp[i][j] = ((dp[i-1][j])*(1-p[i]))+((dp[i-1][j-1])*p[i]);
      }
      //cout<<setprecision(8)<<dp[i][j]<<" ";
      //cout<<"b";
    }
    //cout<<"c";
    //cout<<endl<<endl;
  }
  double ans = 0.0;
  for(int i = (n/2)+1; i <= n; i++) ans += dp[n][i];
  cout<<setprecision(20)<<ans;
  return 0;
}


Measured memory_bytes: 70528
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    ll N, K;
    cin >> N >> K;
    ll ans = 0;
    if (K % 2 == 0) {
        ll d = 0;
        for (int i = 1; i <= N; i++) if (i % K == K/2) d++;
        ans += d * d * d;
    }
    ans += pow(N / K, 3);
    cout << ans << '\n';
}


Measured memory_bytes: 256
//----------ACCIDENTAL COMPETITIVE PROGRAMMER---------------------

#include<bits/stdc++.h>

/*
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
*/
using namespace std;

#define LL long long
#define LD long double
#define PB push_back
#define MP make_pair


const LL MOD = (1e9) + 7 ;
const LD EPS = 0.0000001 ;

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

    int arr[5];
    for (int i = 0; i < 5; i++)
    	cin >> arr[i];
    vector<pair<int,int> > v;
    for (int i = 0; i < 5; i++){
    	int temp = arr[i] % 10;
    	if (temp == 0)
    		temp = 10;
    	v.PB(MP(temp, arr[i]));
    }
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    int ans = 0;
    int tim = 0;
    for (int i = 0; i < 5; i++){
    	if (i == 4)
    		tim = tim + v[i].second;
    	else {
    		int x = v[i].second;
    		if (x % 10){
    			x = x / 10;
    			x++;
    		} else {
    			x = x / 10;
    		}
    		tim += x * 10;
    	}
    }
    cout << tim << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int, nuint_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set; 
#define int long long
#define MOD 1000000007
#define what_is(x) cerr << #x << " is " << x << endl;
#define loop(i,a,n) for(int i=a;i<n;i++)
#define pb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, szof(x))
#define sortall(x) sort(aint(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626 
 
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef pair<int, int> pt;
int arr[17][17];
vector<int> dp(1<<17+2);
vector<int> pre((1<<17));
void solve(vector<int> &nottaken,int mask,int cur,int prevmask)
{
	if(cur==nottaken.size())
	{
		dp[mask]=max(dp[mask],dp[(mask^prevmask)]+pre[prevmask]);
		return;
	}
	solve(nottaken,mask|(1<<nottaken[cur]),cur+1,prevmask|(1<<nottaken[cur]));
	solve(nottaken,mask,cur+1,prevmask);
}
signed main() {

	fastio();
	//#define LOCAL_DEFINE	
	#ifdef LOCAL_DEFINE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
			cin>>arr[i][j];
	}
	for(int mask=0;mask<(1<<n);mask++)
	{
		for(int i=0;i<n;i++)
		{
			for(int j=i;j<n;j++)
			{
				if((mask&(1<<i)) && (mask&(1<<j)))
					pre[mask]+=arr[i][j];
			}
		}
		//cout<<mask<<" ";
		//cout<<pre[mask]<<endl;
	}
	for(int mask=0;mask<((1<<n)-1);mask++)
	{
		int res=mask;
		vector<int> nottaken;

		for(int j=0;j<n;j++)
		{
			if(!(mask&(1<<j)))
			{
				nottaken.push_back(j);
			}
		}
		solve(nottaken,mask,0LL,0LL);
	}
	cout<<dp[(1<<n)-1]<<endl;
	return 0;
 
 }

Measured memory_bytes: 5376
import java.util.*;
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();
    if((c-a+b)>0){System.out.println( c-a+b );}
    else{System.out.println(0);}
  }
}

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

int main(){
    string line;
    
    map<char, char> bracket;
    bracket[')'] = '(';
    bracket[']'] = '[';
    
    while(getline(cin, line)){
        if(line == ".") break;
        
        bool ans = true;
        stack<char> s;
        for(int i = 0;i < line.size();i++){
            char c = line[i];
            if(c == '(' || c == '[') s.push(c);
            if(c == ')' || c == ']'){
                if(s.empty() || s.top() != bracket[c]){
                    ans = false;
                    break;
                }
                s.pop();
            }
        }
        if(ans && s.empty()) cout << "yes";
        else cout << "no";
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1176
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	as := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&as[i])
	}

	if as[0] != 0 {
		fmt.Println(-1)
		return
	}

	ans := 0
	pre := as[n-1]
	for i := n - 1; i >= 0; i-- {
		a := as[i]
		if pre-a > 1 {
			ans = -1
			break
		}

		if pre <= a {
			ans += a
		}
		pre = a
	}

	fmt.Println(ans)
}


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

int main(){
    int n,k; cin >> n >> k;
    vector<ll> h(n);
    rep(i,n) cin >> h[i];
    sort(h.begin(),h.end());
    reverse(h.begin(),h.end());
    ll ans = 0;
    for(int i=k;i<n;++i) ans += h[i];
    cout << ans << endl;
    return 0;
}

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

#define endl "\n"

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


    long double n,r;
    cin>>n>>r;

    cout<<ceil(n/(2*r+1));
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a, b;
		String s;
		a = sc.nextInt();
		b = sc.nextInt();
		s = sc.next();

		for (int i = 0; i < a + b + 1; i++) {
			if(i != a && s.charAt(i) == '-') {
				System.out.print("No");
				return;
			} else if(i == a && s.charAt(i) != '-') {
				System.out.print("No");
				return;
			}
		}

		System.out.print("Yes");
	}
}

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

int main () {
    int N,W;
    cin>>N>>W;
    const ll INF = 1e18L + 5;
    vector<ll> wt(N), val(N);
    for (int i=0; i<N; i++) {
        scanf("%lld%lld", &wt[i], &val[i]);
    }
    ll tot=0;
    for (int i=0;i<N;i++)tot+=val[i];
    
    vector<ll> dp(tot+1, INF); // 0....Val+10
    dp[0]=0;
    for (int i=0; i<N; i++) {
        for (int j=tot-val[i]; j>=0; j--){
            dp[j+val[i]] = min(dp[j+val[i]], dp[j] + wt[i] );
        }
    }
    
    ll ans=0;
    for (ll i=0;i<=tot;i++) {
        if (dp[i] <= W) ans=max(ans, i);
    }
    cout<<ans;
    return 0;
}

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

N=int(input())
L=list(map(int,input().split()))

L.sort()

ANS=0

for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if L[i]==L[j] or L[j]==L[k]:
                continue
            if L[i]+L[j]>L[k]:
                ANS+=1

print(ANS)


Measured memory_bytes: 9180
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
// #include<deque>
// #include<multiset>
// #include<bitset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

/// --- math {{{ ///
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll extgcd(ll a, ll b, ll &x, ll &y) {
  ll d;
  return b == 0 ? (x = 1, y = 0, a) : (d = extgcd(b, a % b, y, x), y -= a / b * x, d);
}
ll modinv(ll a, ll mod) {
  ll x, y;
  extgcd(a, mod, x, y);
  if(x < 0) x += mod;
  return x;
}
ll modpow(ll a, ll b, ll mod) {
  ll r = 1;
  a %= mod;
  while(b) {
    if(b & 1) r = r * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return r;
}
/// }}}--- ///

const int mod = 998244353;

int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n;
  cin >> n;
  int a[112345];
  for(int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  ll ans = 1;
  for(int i = 0; i < n; i++) ans = ans * gcd(a[i], i) % mod;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
import Data.Bits (xor)
import Data.Bool (bool)

main :: IO ()
main = do
    s <- getLine
    answer $ solve s

type Answer = Bool
answer :: Answer -> IO ()
answer = putStrLn . bool "First" "Second"

solve :: String -> Answer
solve = last . flip (zipWith . ((.) xor . (==)) . head <*> id) (iterate not False)


Measured memory_bytes: 12668
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <map>
#include <vector>

using namespace std;

int main(){
	string s;
    cin >> s;
    int n = s.length();
    for(int i =0; i < n; i++){
    	s[i] = 'x';
    }

    cout << s << endl;
    return 0;
}

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

bool check(const std::vector<int>& path,
           const std::vector<std::vector<int>>& g) {
  int cur = 1;
  std::vector<bool> used(g.size(), false);
  used[1] = true;
  for (auto p : path) {
    if (!used[p] &&
        std::find(g[cur].begin(), g[cur].end(), p) != g[cur].end()) {
      cur = p;
      used[p] = true;
    } else {
      return false;
    }
  }
  return true;
}

int main() {
  int n, m;
  std::cin >> n >> m;
  std::vector<std::vector<int>> g(n + 1);
  for (int i = 0; i < m; i++) {
    int a, b;
    std::cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  std::vector<int> path(n - 1);
  std::iota(path.begin(), path.end(), 2);
  int ans = 0;
  do {
    if (check(path, g)) ans++;
  } while (std::next_permutation(path.begin(), path.end()));
  std::cout << ans << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr long long INF = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    string S;
    cin>>S;
    string ans="Yes";
    if(S.size()%2==1)ans="No";

    rep(i,S.size()){
        if(i%2==0&&S[i]!='h') ans="No";
        if(i%2==1&&S[i]!='i')ans="No";
    }
    cout << ans << endl;
    



}


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

    vector<char> a(2);
      rep(i,3){
          cin >> a[i];
          if(a[i]=='7'){
              cout << "Yes" << endl;
              break;
          }
          if(i+1==3){
              cout << "No" << endl;
              break;
          }
      }
return 0;
    
  }

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

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	array<int,3> a,b;
	a={5,5,7};
	cin>>b[0]>>b[1]>>b[2];
	sort(b.begin(),b.end());
	cout<<(a==b?"YES\n":"NO\n");
}




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

int main(){
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
// #ifndef ONLINE_JUDGE 
//     freopen("input.txt", "r", stdin); 
//     freopen("output.txt", "w", stdout); 
// #endif
    int n;
    cin>> n;
    int a[n];
    for(int i=0;i<n;i++){
    	cin>>a[i];
    }
    int dp1[n] ;
    for(int i=0;i<n;i++){
        if (i==0)
            dp1[i]=0;
        else if (i==1)
            dp1[i]=dp1[i-1]+abs(a[i]-a[i-1]);
        else
            dp1[i]=min(dp1[i-1]+abs(a[i]-a[i-1]),dp1[i-2]+abs(a[i]-a[i-2]));
        //cout<< dp1[i]<<"\n";
    }
    cout<< dp1[n-1]<<"\n";
	return 0;

}

Measured memory_bytes: 1024
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n = int(input())
X = list(map(int,input().split()))
Y = sorted(X)
a = Y[n//2-1]
b = Y[n//2]
for  xi in X:
  if xi <= a:print(b)
  else:
    print(a)

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

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

using ll = long long;

// using namespace std;

template <class T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i < vec.size() - 1) os << " ";
  }
  return os;
}

template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& a : vec) is >> a;
  return is;
}

#include <atcoder/dsu>

int main() {
  ll n, m;
  std::cin >> n >> m;
  atcoder::dsu dsu = n;
  for (int i = 0; i < m; i++) {
    ll a, b;
    std::cin >> a >> b;
    a--;
    b--;
    dsu.merge(a, b);
  }
  std::cout << dsu.groups().size() - 1 << std::endl;
}

Measured memory_bytes: 8976
lst_c = [list(map(int, input().split())) for _ in range(3)]


lst_diff_i = []
for i in range(3):
    diff1 = lst_c[i][0] - lst_c[i][1]
    diff2 = lst_c[i][1] - lst_c[i][2]
    diff3 = lst_c[i][2] - lst_c[i][0]
    lst_diff_i.append([diff1, diff2, diff3])
if lst_diff_i[0] == lst_diff_i[1] == lst_diff_i[2]:
    ans = "Yes"
else:
    print("No")
    exit()


print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
//#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10; //1e-9?
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    string s, t; cin >> s >> t;
    int n = s.length(), m = t.length();

    auto dp = defvec<int>(INF, n + 1, m + 1);
    dp[0][0] = 0;
    eFOR(i, 0, n)eFOR(j, 0, m) {
        if (i < n)chmin(dp[i + 1][j], dp[i][j] + 1);
        if (j < m)chmin(dp[i][j + 1], dp[i][j] + 1);
        if (i < n && j < m)chmin(dp[i + 1][j + 1], dp[i][j] + (s[i] == t[j] ? 0 : 1));
    }

    cout << dp[n][m] << "\n";
}


Measured memory_bytes: 6764
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <queue>
#include <map>
using namespace std;
#define pb          emplace_back
#define fi          first
#define se          second
#define show(...)   fprintf(stderr, __VA_ARGS__ )
#define outl(x)     cout << (x) << '\n'
#define rep(i,n)    for(int i=0; i<(n); ++i)
#define inside(x,y,w,h) ((x)>=0 && (y)>=0 && (x)<(w) && (y)<(h))
template<class A, class B>inline bool chmax(A &a, B b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, B b){return b<a ? a=b,1 : 0;}
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
constexpr int       INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int dx[] = {1, 0, -1, 0};
constexpr int dy[] = {0, 1, 0, -1};


int N;
int six[20] = {1};
int nine[20] = {1};

vector<int> a(1,1);

int mem[100][100010];

int slv(int ix, int sum)
{
    if (sum == N) return 0;
    if (ix == a.size() || sum > N) return INF;

    if (mem[ix][sum] != -1) return mem[ix][sum];

    int ret = 0;
    ret = min( slv(ix+1, sum), slv(ix, sum+a[ix])+1 );

    return mem[ix][sum] = ret;
}

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

    cin >> N;

    int si, ni;
    for (si=1; six[si-1]*6 <= N; ++si) {
        six[si] = six[si-1] * 6;
        a.pb(six[si]);
    }

    for (ni=1; nine[ni-1]*9 <= N; ++ni) {
        nine[ni] = nine[ni-1] * 9;
        a.pb(nine[ni]);
    }

    --si, --ni;

    int cnt = 0;

    sort(a.begin(), a.end());
    a.erase(unique(a.begin(), a.end()), a.end());
    reverse(a.begin(), a.end());

    memset(mem, -1, sizeof(mem));

    outl(slv(0, 0));

}



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

using namespace std;

int main() {
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int& x : a) {
    cin >> x;
  }
  map<int, int> c;
  for (int i = 0; i < n; ++i) {
    c[a[i] - i]++;
  }
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    c[a[i] - i]--;
    ans += c[-i - a[i]];
  }
  cout << ans << "\n";
  return 0;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++)
    cin >> a.at(i);
  sort(a.begin(), a.end());
  for(int i = 1; i < a.size(); i++) {
    if(a[i - 1] == a[i]) {
      cout << "NO\n";
      return 0;
    }
  }
  cout << "YES\n";
}

Measured memory_bytes: 1024
import math
s = input()
li = []
moji = s[0]
k=0
for i  in range(len(s)):
  if moji != s[i]:
    li.append(s[k:i])
    moji = s[i]
    k=i
  if i == len(s)-1:
    li.append(s[k:])
for i in range(len(li)//2):
  r_num = len(li[2*i])
  l_num = len(li[2*i+1])
  r_count=0
  l_count=0
  r_count += math.ceil(r_num/2) 
  l_count += r_num//2
  l_count += math.ceil(l_num/2)
  r_count += l_num//2
  for i in range(r_num-1):
    print(0)
  print(r_count)
  print(l_count)
  for i in range(l_num-1):
    print(0)

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

#define FOR(i,b,e) for(int i=(b); i <= (e); ++i)
#define FORD(i,b,e) for(int i=(b); i >= (e); --i)
#define SIZE(c) (int) (c).size()
#define FORE(i,c) FOR(i,0,SIZE(c)-1)
#define FORDE(i,c) FORD(i,SIZE(c)-1,0)

#define pb push_back
#define mp make_pair
#define st first
#define nd second


using namespace std;

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

typedef vector <int> VI;
typedef vector <bool> VB;
typedef vector <pii> VP;
typedef vector <ll> VL;
typedef vector <pll> VPL;

typedef vector <VI> VVI;
typedef vector <VL> VVL;
typedef vector <VB> VVB;
typedef vector <VP> VVP;

const int MOD = 1000000007;
const ll LINF = 2000000000000000001LL;

/*************************************************************************/

VI getMaxLeft(int n, VL &s, ll a) {
    VI res(n);
    FOR(i,0,n-1) {
        res[i] = i;
    }
    
    FOR(i,1,n-1) if (s[i] - s[i-1] >= a) {
        res[i] = res[i-1];
    }
    
    return res;
}

/*************************************************************************/

int main() {
    ios_base::sync_with_stdio(0);
    
    int n;
    ll thresh[2];
    
    cin >> n;
    FOR(i,0,1) {
        cin >> thresh[i];
    }
    
    VL s(n);
    FOR(i,0,n-1) {
        cin >> s[i];
    }
    
    n++;
    s.pb(LINF);
    
    VI maxLeft[2];
    FOR(i,0,1) {
        maxLeft[i] = getMaxLeft(n, s, thresh[i]);
    }
    
    VI firstGood[2];
    FOR(i,0,1) {
        firstGood[i].resize(n);
        
        FOR(j,0,n-1) {
            ll atMost = s[j] - thresh[i];
            firstGood[i][j] = upper_bound(s.begin(), s.end(), atMost) - s.begin();
        }
    }
    
    ll dp[n][2], dpPref[n][2];
    FOR(i,0,1) FOR(j,0,1) {
        dp[i][j] = 1;
        dpPref[i][j] = i + 1;
    }
    
    FOR(i,2,n-1) FOR(j,0,1) {
        dp[i][j] = 0;
        
        int l = maxLeft[1-j][i-1];
        int r = min(i-1, firstGood[j][i]);
        
        if (l <= r) {
            dp[i][j] = (dpPref[r][1-j] + MOD - (l ? dpPref[l-1][1-j] : 0)) % MOD;
        }
        
        dpPref[i][j] = (dpPref[i-1][j] + dp[i][j]) % MOD;
    }
    
    ll ans = 0;
    FOR(j,0,1) {
        ans = (ans + dp[n-1][j]) % MOD;
    }
    
    cout << ans;

    return 0;
}

/*************************************************************************/


Measured memory_bytes: 5748
#include "bits/stdc++.h"
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
typedef long long ll;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef set<int> SI;
typedef map<string, int> MSI;
typedef map<int, int> MII;
typedef pair<ll, ll> PLL;
typedef pair<ll, pair<ll, ll>> PLLL;

#define flash ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define MP make_pair
#define PB push_back
#define FF first
#define SS second
#define MOD 1000000007
#define test ll t;cin>>t;while(t--)
ll M(ll x)
{
	return ((x%MOD)+MOD)%MOD;
}
ll poww(ll n,ll x)
{
	ll r;
	if(x==0)return 0;
	else if(x==1)return M(n);
	else 
	{
		r=M(poww(n,x/2));
		if(x%2)
			return M(M(M(r*r)*M(n)))%MOD;
		else return M(M(r)*M(r))%MOD;
	}
}
void solve()
{
	ll n;
	cin >> n;
	ll a=M(poww(10,n));
	ll b=M(2*M(poww(9,n)))%MOD;
	ll c=M(poww(8,n))%MOD;
//	cout << a << " " << b << " " << c << "\n";
	cout << M((a-b)+c) << "\n";
	//cout << c << "\n";
	return;
}

int main()
{
	flash;

	// test
	// {
	// 	solve();
	// }
	solve();

	return 0;
}


Measured memory_bytes: 3648
#include <stdio.h>
int main()
{
int x,t;
scanf("%d",&x);
for(int i=2;i<=x;i++)
{
    if(i%3==0)printf(" %d",i);
    else {
        t=i;
        while(1){
        if(t%10==3){printf(" %d",i);break;}
        t=t/10;
        if(t==0)break;
        }
    }
 
 
     
 
}
printf("\n");
return 0;
}

Measured memory_bytes: 1028
let n, k, s = Scanf.scanf " %d %d %d" @@ fun a b c -> a, b, c
let _ = Array.(append (make k s) @@ make (n - k) (if s = 1000000000 then s - 1 else s + 1) |> to_list |> List.map string_of_int |> String.concat " " |> print_endline)

Measured memory_bytes: 15232
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>

using namespace std;

#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 = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 999999999
#define MINF -999999999
#define ALL(n) n.begin(),n.end()


int main() {
	int h, w, a[11][11],b,ans = 0;
	cin >> h >> w;
	REP(i, 10) REP(j, 10) cin >> a[i][j];
	REP(k, 10)REP(i, 10) REP(j, 10) a[i][j] = min(a[i][j], a[i][k] + a[k][j]);
	REP(i, h) REP(j, w) {
		cin >> b;
		if (b >= 0) ans += a[b][1];
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
n,l = map(int,input().split())
a_list = []
for i in range(1,n+1):
    #print(i)
    a_list.append(l+i-1)

if int(a_list[n-1])<0:
    a_list.remove(a_list[n-1])

if int(a_list[0])>0:
    a_list.remove(a_list[0])

if 0 in a_list:
    a_list.remove(0)
'''
エラーコード    if int(a_list[n])<0:
               IndexError: list index out of range
if int(a_list[n-2])<0:
    a_list.remove(a_list[n-1])
'''
print(sum(a_list))

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

int main (){
  int a, b, c;
  cin >> a >> b >> c;
  
  if (a + b == c || b + c == a ||
      c + a == b)
  {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

int main(void){

    string s;
    int ns,n,i;
    cin>>s;
    ns = s.size();
  	if(ns%2==1){
      cout<<"No";
      return 0;
    }
  	rep(i,floor(ns/2)){
      if(s.at(i*2)!='h'||s.at(i*2+1)!='i'){
        cout<<"No";
        return 0;
      }
    }
    cout<<"Yes";
    return 0;
}


Measured memory_bytes: 256