akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

fn main() {
    input! {
        n: usize, m: usize
    };

    let mut res = Vec::new();
    if n % 2 == 0 {
        let mut i = 1;
        let mut changed = false;
        for _ in 0..m {
            let j = n - i + if changed { 1 } else { 0 };
            if !changed && n - j + i >= j - i {
                changed = true;
                i += 1;
            }
            res.push((i, j));
            i += 1;
        }
    } else {
        for i in 1..m + 1 {
            res.push((i, n - i));
        }
    }
    for (a, b) in res {
        println!("{} {}", a, b);
    }
}


Measured memory_bytes: 3328
from numba import njit

@njit(cache=True)
def aaa(n,k,a):
    for f in range(k):
        a1=[0]*(n+1)
        for x in range(n):
            y=max(0,x-a[x])
            a1[y]=a1[y]+1    
            z=min(n-1,x+a[x])
            a1[z+1]=a1[z+1]-1
        a[0]=a1[0]
        for x in range(1,n):    
            a[x]=a[x-1]+a1[x]
        if a==[n]*n:
            break
    return a

x=input()
x0=x.split()
n=int(x0[0])
k=int(x0[1])
a0=input()
a0=a0.split()
a=[int(s) for s in a0]

b=aaa(n,k,a)
for i in range(n):
    print(b[i])

Measured memory_bytes: 138732
#[allow(unused_imports)]
use std::cmp::{min,max};
#[allow(unused_imports)]
use std::collections::{BTreeMap,BTreeSet};
#[allow(unused_imports)]
use std::ops::*;
#[allow(unused_imports)]
use std::collections::BinaryHeap;

#[allow(unused_macros)]
macro_rules! tf {
    ($c:expr, $t:expr, $f:expr) => {{
        if $c { $t } else { $f }
    }};
}

fn main() {
    let n = read_i64() as usize;
    let xs = read_vec_i64();
    let even_sum = xs.iter().enumerate().filter(|&(i,&_)| i % 2 == 0).fold(0i64, |s,(_,&x)| s + x);
    let odd_sum  = xs.iter().enumerate().filter(|&(i,&_)| i % 2 == 1).fold(0i64, |s,(_,&x)| s + x);
    if n % 2 == 0 {
        println!("{} {}", max(even_sum, odd_sum), min(even_sum, odd_sum));
    }
    else {
        let mut lower = 0;
        let mut upper = 1i64 << 29;
        while upper - lower != 1 {
            let x = (lower+upper)/2;
            let mut l = 0;
            let mut r = n;
            let mut offset = 0;
            while r - l != 1 {
                if xs[l] + offset >= x && xs[l+1] >= xs[l] + offset {
                    l += 2;
                    offset = 0;
                }
                else {
                    offset = xs[l] + offset - xs[l+1];
                    l += 2;
                }
            }
            let yes = xs[l] + offset >= x;
            if yes {
                lower = x;
            }
            else {
                upper = x;
            }
        }
        let black = lower + odd_sum;
        let white = even_sum + odd_sum - black;
        println!("{} {}", black, white);
    }
}

#[allow(dead_code)]
fn read_line() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok();
    ret.pop();
    //ret.pop();
    return ret;
}

#[allow(dead_code)]
fn read_i64() -> i64 {
    let ss = read_line();
    return ss.parse::<i64>().unwrap();
}

#[allow(dead_code)]
fn read_vec_i64() -> Vec<i64> {
    let mut res = vec![];
    let ss = read_line();
    for ts in ss.split_whitespace() {
        let x = ts.parse::<i64>().unwrap();
        res.push(x);
    }
    return res;
}

use std::fmt::Display;
#[allow(dead_code)]
fn write_vec<T: Display>(xs: &Vec<T>) {
    if xs.len() == 0 {
        println!("");
        return;
    }
    print!("{}", xs[0]);
    for i in 1..xs.len() {
        print!(" {}", xs[i]);
    }
    println!("");
}


Measured memory_bytes: 12016
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 300010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
ll H[MAX_N];
ll dp[MAX_N];

void solve() {
	cin >> N;
	rep(i, 0, N) cin >> H[i];
	rep(i, 0, N) {
		dp[i] = linf;
	}
	dp[0] = 0;
	rep(i, 0, N) {
		MIN(dp[i + 1], dp[i] + abs(H[i] - H[i + 1]));
		MIN(dp[i + 2], dp[i] + abs(H[i] - H[i + 2]));
	}
	cout << dp[N - 1] << "\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 3072
#include<iostream>
#include<map>

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

    std::map<char, int> mp;
    for(char c = 'a'; c <= 'z'; c++){
        mp[c] = 0;
    }

    for(int i = 0; i < s.length(); i++){
        mp[s[i]]++;
    }

    for(char c = 'a'; c <= 'z'; c++){
        if(mp[c] == 0){
            std::cout << c << std::endl;
            return 0;
        }
    }

    std::cout << "None" << std::endl; 

}


Measured memory_bytes: 888
package main
import (
    "fmt"
)

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

func div2 (x int) int {
    ans := 0
    for x % 2 == 0 {
        x /= 2
        ans ++
    }
    return ans
}

func main(){
    var n int
    fmt.Scan(&n)
    arr := make([]int, n)
    for i := 0; i < n; i++ {
        fmt.Scan(&arr[i])
    }
    var ans int
    ans = 1e9
    for _, e := range arr {
        ans = min(ans, div2(e))
    }
    fmt.Println(ans)
}

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


int main() {
  int a,b,c,d,e;
  cin >> a>>b>>c>>d>>e;
  
  
  
    cout<<max(60*(c-a)+d-b-e,0)<<endl;
  
  
}







Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

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


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

using namespace std;

int res;

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

int main()
{
    long long a, b, c;
    cin >> a >> b;
    c = gcd(a, b);
    for (long long i = 2; i*i <= c; ++i) {
        if (c%i == 0) {
            ++res;
            while (c%i == 0)
                c /= i;
        }
    }
    if (c != 1) ++res;
    cout << res+1 << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;

public class Main {
	
	
    public static void main(String[] args) throws IOException {
    	Scanner s = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String[] input;
		int k = Integer.parseInt(reader.readLine());
		Set<Long> remainder = new HashSet<>();
		long num = 0;
		boolean possible = true;
		int count = 0;
		do {
			num = num * 10 + 7;
			count++;
			num %= k;
			if (remainder.contains(num)) {
				possible = false;
				break;
			}
			remainder.add(num);
		} while (num != 0);
		if (possible) {
			out.print(count);
		} else {
			out.print(-1);
		}
		out.flush();
		out.close();
    }

}


Measured memory_bytes: 132176
twoDiv :: Int -> Int
twoDiv x = if x `mod` 2 == 1
            then 0
            else 1 + twoDiv (x `div` 2)

main = do
 n <- readLn :: IO Int
 a <- map read . words <$> getLine :: IO [Int]
 putStrLn $ show $ minimum $ map twoDiv a

Measured memory_bytes: 1020
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < int(n); ++ (i))
#define ALL(x) begin(x), end(x)
using namespace std;

bitset<16001> get_dp(vector<int> const & delta) {
    assert (accumulate(ALL(delta), 0) <= 8000);
    bitset<16001> dp = {};
    dp[8000] = true;
    for (int d : delta) {
        dp = (dp << d) | (dp >> d);
    }
    return dp;
}

int main() {
    // input
    string s; cin >> s;
    int gx, gy; cin >> gx >> gy;
    // solve
    vector<int> dy;
    vector<int> dx;
    bool dir = false;  // is y
    for (int i = 0; i < s.length(); ) {
        int j = i + 1;
        while (j < s.length() and s[j] == s[i]) ++ j;
        if (s[i] == 'F') {
            if (i == 0) {
                gx -= (j - i);
            } else {
                (dir ? dy : dx).push_back(j - i);
            }
        } else if (s[i] == 'T') {
            if ((j - i) % 2 == 0) {
                // nop
            } else {
                dir = not dir;
            }
        }
        i = j;
    }
    auto dp_y = get_dp(dy);
    auto dp_x = get_dp(dx);
    bool result = dp_y[8000 + gy] and (8000 + gx >= 0 and dp_x[8000 + gx]);
    // output
    cout << (result ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#pragma gcc optimize("Ofast")

#include "bits/stdc++.h"
using namespace std;
typedef int64_t lld;
typedef pair<int,int> pii;
typedef pair<lld,lld> pll;
typedef pair<int,pll> pip;
typedef pair<pll,int> ppi;
typedef pair<lld,pll> plp;
typedef pair<pll,lld> ppl;
typedef pair<pll,pll> ppp;
template<typename T>
using maxHeap = priority_queue<T,vector<T>,less<T>>;
template<typename T>
using minHeap = priority_queue<T,vector<T>,greater<T>>;
#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define endl '\n'
#define jizz cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);
inline void input(int &_x) {
    _x = 0;
    int _tmp = 1; char _tc = getchar();
    while((_tc < '0' || _tc > '9') && _tc != '-') _tc = getchar();
    if(_tc == '-') _tc = getchar(), _tmp = -1;
    while(_tc >= '0' && _tc <= '9') _x = _x*10+(_tc-48), _tc = getchar();
    _x *= _tmp;
}
inline void output(int _x) {
    char _buff[20]; int _f = 0;
    if(_x == 0)putchar('0');
    while(_x > 0)
    {
        _buff[_f++] = _x%10+'0';
        _x /= 10;
    }
    for(_f-=1; _f >= 0; _f--)
        putchar(_buff[_f]);
    putchar('\n');
}
template<typename Iter>
ostream& _out(ostream &s, Iter b, Iter e) {
    s<<"[";
    for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
    s<<"]";
    return s;
}
template<class T1,class T2>
ostream& operator<<(ostream& out, pair<T1,T2> p) {
    return out << '(' << p.first << ", " << p.second << ')';
}
template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) {
     return _out(s,c.begin(),c.end());
 }
#ifdef erd1
    #define pprint(x) cerr<<__PRETTY_FUNCTION__<<":"<<__LINE__<<" - "<<(#x)<<"="<<(x)<<endl
#else
    #define pprint(x)
#endif
static constexpr double TAU = 2*acos(-1);
// code starts here
vector<pii> v;
signed main(){
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        int a,b;
        cin >> a >> b;
        v.pb({a, b});
    }
    int N = 1500000;
    lld ans = 0;
    long double dt = TAU/N;
    for(int i = 0; i < N; i++){
        long double c = cos(i*dt), s = sin(i*dt);
        lld x = 0, y = 0;
        for(auto i: v)
            if(i.ff*s+i.ss*c > 0)x += i.ff, y += i.ss;
        ans = max(ans, x*x+y*y);
    }
    cout << fixed << setprecision(50) << (long double)sqrt(ans) << endl;
}


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

//////全探索したいときに開けよ////////
/*
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}
*/

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}*/


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/
vector<int64_t> pat(51);
vector<int64_t> true_pat(51);
int64_t saiki(int64_t n,int64_t x){
  if(x == 0){
    return 0;
  }else if(n==0){
    return 1;
  }else{
    if(x == 1){
      return 0;
    }else if(x <= pat.at(n-1)+1){
      return saiki(n-1,x-1);
    }else if(x == pat.at(n-1)+2){
      return saiki(n-1,x-1)+1;
    }else if (x <= 2*pat.at(n-1)+2){
      return true_pat.at(n-1)+saiki(n-1,x-pat.at(n-1)-2)+1;
    }else{
      return true_pat.at(n-1)+saiki(n-1,x-pat.at(n-1)-2)+1;
    }
  }
}
  
int main(){
  int64_t n,x;
  cin >> n >> x;
  pat.at(0) = 1;
  for(int i=1;i<=50;i++){
    pat.at(i) = 2*pat.at(i-1)+3;
    //cout << pat.at(i) <<",";
  }
  //cout << endl;
  true_pat.at(0) = 1;
  for(int i=1;i<=50;i++){
    true_pat.at(i) = 2*true_pat.at(i-1)+1;
    //cout << true_pat.at(i) <<",";
  }
  //cout << endl;
  cout << saiki(n,x);
}

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

typedef long long ll;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(a);i>=(b);i--)

#define ALL(obj) (obj).begin(),(obj).end()

#define pii pair<int,int>

#define pb(a) push_back(a)
#define mp make_pair

int main()
{
	int n,m;
	cin >> n >> m;
	bool to1[n];
	bool ton[n];
	FOR(i,0,n){
		to1[i] = ton[i] = false;
	}
	FOR(i,0,m){
		int a,b;
		cin >> a >> b;
		if(a == 1)to1[b-1] = true;
		if(b == n)ton[a-1] = true;
	}
	bool ans = false;
	FOR(i,1,n-1){
		if(to1[i] && ton[i]){
			ans = true;
			break;
		}
	}
	ANS( (ans)?"POSSIBLE":"IMPOSSIBLE" );
	return 0;
}


Measured memory_bytes: 640
T = list(input())
if len(T) == 1:
  if T[0] == "?":
    print("D")
  else:
    print("".join(T))
else:
  for i in range(len(T)):
    if i > 0 and T[i] == "?" and T[i-1] == "P":
      T[i] = "D"
    elif i < len(T) -1 and T[i] == "?" and (T[i+1] == "D" or T[i+1] == "?"):
      T[i] = "P"
    elif T[i] == "?":
      T[i] = "D"
  print("".join(T))

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

using namespace std;

#define lp(i,n) for(int i = 0; i <n;i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define MP make_pair
#define SZ(v) ((int)((v).size()))
typedef long long ll;

const ll MOD = 1e9 + 7;
const int OO = (int)1e6;
const int N = (int)1e7;

void init(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

int main() {
	#   ifdef LOCAL_PROJECT
        freopen("in.txt", "r", stdin);
    #   endif
    ll l,r;
    ll mn =1e12;
    scanf("%lld%lld",&l,&r);
    for(ll i=l;i<=min(l+2019,r);i++){
        for(ll j=i+1;j<=min(i+2019,r);j++){
            mn = min(mn,(i*j)%2019);
        }
    }
    printf("%lld",mn);
    return 0;
}

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

int x[100000], d[100000];
int main() {
	int t; scanf("%d", &t);
	rep(i, t) {
		int n, k; scanf("%d%d", &n, &k);
		rep(j, n)scanf("%d", &x[j]);
		rep(j, n - 1)d[j] = x[j + 1] - x[j];
		int sum = x[n - 1] - x[0];
		sort(d, d + n - 1, greater<>());
		rep(j, min(k - 1, n - 1))sum -= d[j];
		printf("%d\n", sum);
	}
}

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

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  for(int i = 0; i < h; i++){
    cin >> s.at(i);
  }
  
  vector<int> dx(8);
  vector<int> dy(8);
  dx = {1, 0, -1, 0, 1, -1, 1, -1};
  dy = {0, -1, 0, 1, -1, -1, 1, 1};
  
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(s.at(i).at(j) == '#') continue;
      int c = 0;
      for(int d = 0; d < 8; d++){
        int di = i + dy.at(d);
        int dj = j + dx.at(d);
        
        if(di < 0 || di >= h) continue;
        if(dj < 0 || dj >= w) continue;
        if(s.at(di).at(dj) == '#') c++;
      }
      s.at(i).at(j) = (char)('0' + c);
    }
  }
  
  for(int i = 0; i < h; i++) cout << s.at(i) << endl;
  
}

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

using namespace std;

int main() {
	string S;
	cin >> S;
	long long ans = 0;
	for (int i = 0; i < (1 << (S.size()-1)); i++)
	{
		string now = "";
		now += S[0];
		for (int j = 0; j < S.size()-1; j++)
		{
			if (i&(1 << j)) {
				now += "+";
			}
			now += S[j + 1];
		}
		long long sum = 0;
		int pos = 0;
		while (now.find("+", pos) != string::npos) {
			int nextpos = now.find("+", pos);
			ans += stoll(now.substr(pos, nextpos - pos));
			pos = nextpos + 1;
		}
		ans += stoll(now.substr(pos));
	}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,n) for (int i = 0;i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int INF = 1e9;


int main(){
    int n;cin >> n;
    vector<int> x(n),d(n);
    ll total = 0;
    rep(i,n) {
        cin >> d[i];
        total += d[i];
    }
    total;
    for(int i = 1;i<n-1;i+=2) total -= 2*d[i];
    x[0] = total;
    for(int i = 1;i<n;i++){
        x[i] = d[i-1]*2 - x[i-1];
    }

    rep(i,n) cout << x[i] << endl;
}

Measured memory_bytes: 4020
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=1000005;
const ll INF=1LL<<50;

int par[MAX],size[MAX];

void init(int n){
    for(int i=0;i<n;i++){
        par[i]=i;
        size[i]=1;
    }
}

int root(int a){
    if(par[a]==a) return a;
    else return par[a]=root(par[a]);
}

void unite(int a,int b){
    if(root(a)!=root(b)){
        size[root(a)]+=size[root(b)];
        par[root(b)]=root(a);
    }
}

bool check(int a,int b){
    return root(a)==root(b);
}

struct edge{
    int from;
    int to;
    int dis;
};

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        int N,M;cin>>N>>M;
        if(N+M==0) break;
        vector<edge> S(M);
        for(int i=0;i<M;i++){
            int a,b,c;cin>>a>>b>>c;
            a--;b--;
            S[i]={a,b,c};
        }
        sort(all(S),[](edge a,edge b){
            return a.dis<b.dis;
        });
        
        int cnt=0;
        init(N);
        
        for(int i=0;i<M;i++){
            int a=S[i].from,b=S[i].to;
            if(!check(a,b)){
                cnt++;
                unite(a,b);
            }
            if(cnt==N/2){
                cout<<S[i].dis<<endl;
                break;
            }
        }
    }
}





Measured memory_bytes: 3192
#include<bits/stdc++.h>
using namespace std;
string a,b;
int main()
{
	cin>>a;
	b=a;
	reverse(a.begin(),a.end());
	for(int i=0;i<a.size();i++)
	{
		if(a[i]=='b') a[i]='d';
		else if(a[i]=='d') a[i]='b';
		else if(a[i]=='p') a[i]='q';
		else if(a[i]=='q') a[i]='p';
	}
	if(a==b) printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(void){
   int n,d,x;
   cin >> n;
   cin >> d >> x;
   vector<int> a(n);
   int ans = 0;
   for(int i = 0;i < n;i++){
       cin >> a[i];
       ans += (d + a[i] - 1) / a[i];
   }
   ans += x;
   cout << ans << endl;
   
   
}


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

int main(){
    int N,K,Q;
    cin >> N >> K >> Q;
    multiset<int> A;
    int temp;
    rep(i,Q){
        cin >> temp;
        A.insert(temp-1);
    }
    int tempp;
    rep(i,N){
        tempp = A.count(i);
        if(A.find(i) == A.end()){
            tempp = 0;
        }
        if((K-Q+tempp)>0){
            printf("Yes\n");
        }
        else{
            printf("No\n");
        }
    }

    return 0;
}

Measured memory_bytes: 5248
#include <iostream>
using namespace std;
int main(void){
  int N;
  cin >> N;
  string S = "Three";
  
  for(int i=0; i<N; i++){
    string X;
    cin >> X;
    if(X=="Y"){
      S = "Four";
      break;
    }
  }
  cout << S << endl;
}


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

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define rep(i,a,b) for(i=a;i<b;i++)
#define pii pair<ll , ll>
#define all(x) x.begin(),x.end()
#define nl "\n"
#define ump unordered_map
#define mtv(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)

vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out( 
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cout << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    stringstream ss; ss << H;
    cout << args[idx] << "- " << ss.str() << ", ";
    debug_out(args, idx + 1, LINE_NUM, T...);
}

void doit(){
	ll r = 0,w = 0,n,i,j,ans;
	cin >> n;
	string s;
	cin >> s;
	rep(i,0,n){
		if(s[i] == 'R')r++;
		else w++;
	}
	ans = min(r,w);
	ll cou = r;
	rep(i,0,r){
		if(s[i] == 'R')cou--;
	}
	ans = min(ans , cou);
	cout << ans << nl;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input1.txt","r",stdin);
    freopen("output1.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t = 1;
    // cin >> t;
    for(ll i = 1; i <= t; i++){
        doit();
    }
}


Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
//Aの倍数を一つ以上選び、その総和をBで割った余りをCにできるか
int main() {
    int A,B,C;
    cin >> A >> B >> C;
    bool flag = false;
    for(int i = A;i<=A+A*B;i++){
      if(i%B == C && i%A == 0){
          flag = true;
          break;
      }
    }
    if(flag) cout << "YES" <<endl;
    else cout << "NO" <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
const int N=5010,M=1000010,P=1e9+7;
const int inf=0x3f3f3f3f;
const int INF=0xcfcfcfcf;
const double eps=1e-6,pi=asin(1)*2;
inline ll read();
#define cmax(a,b) a=max(a,b)
#define cmin(a,b) a=min(a,b)
inline int ADD(int a,int b) { return a+b>=P?a+b-P:a+b; }
inline int MINUS(int a,int b) { return a-b<0?a-b+P:a-b; }
#define plus(a,b) a=ADD(a,b)
#define minus(a,b) a=MINUS(a,b)
#define mul(a,b) a=(a*(b))%P
#define mem(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define mp(x,y) make_pair(x,y)

int head[N],ver[M],nxt[M];
int n,m,tot=1;
inline void add(int x,int y)
{
	ver[++tot]=y,nxt[tot]=head[x],head[x]=tot;
}

int g[N];
int size[N],dp[N][N],tmp[N];
inline void dfs(int x,int fa)
{
	size[x]=dp[x][1]=1;
	for(int i=head[x];i;i=nxt[i])
	{
		int y=ver[i];
		if(y==fa) continue;
		dfs(y,x);
		for(int j=0;j<=size[x];j++)
			for(int k=0;k<=size[y];k++)
				plus(tmp[j+k],1ll*dp[x][j]*dp[y][k]%P);
		size[x]+=size[y];
		for(int j=0;j<=size[x];j++) dp[x][j]=tmp[j],tmp[j]=0;
	}
	dp[x][0]=0;
	for(int i=1;i<=size[x];i++) minus(dp[x][0],1ll*dp[x][i]*g[i]%P);
}

inline void init(int n=5000)
{
	g[2]=1;
	for(int i=4;i<=n;i+=2) g[i]=1ll*g[i-2]*(i-1)%P;
}

#ifdef FILE
char buf[1<<25],*p1=buf,*p2=buf;
#define getchar() p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<25,stdin),p1==p2)?EOF:*p1++
#endif
inline ll read()
{
	ll s=0;
	bool flag=false;
	char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar()) if(ch=='-') flag=true;
	for(;'0'<=ch&&ch<='9';ch=getchar()) s=(s<<3)+(s<<1)+(ch^'0');
	if(flag) return -s;
	return s;
}

int main()
{
#ifdef FILE
	freopen(FILE ".in","r",stdin);
	freopen(FILE ".out","w",stdout);
#endif
	n=read();
	for(int i=1;i<n;i++)
	{
		int x=read(),y=read();
		add(x,y),add(y,x);
	}
	init();
	dfs(1,0);
/*
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<=size[i];j++) cerr<<dp[i][j]<<" ";
		cerr<<"\n";
	}
//*/
	printf("%d\n",MINUS(0,dp[1][0]%P));
	return 0;
}

Measured memory_bytes: 99968
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

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

#define MOD 1000000007

void solve(int test_case) {
	int n;
	cin>>n;
	int last = -1;
	while(n--) {
		int val;
		cin>>val;
		if(last==-1)last=val;
		if(last<val) {
			val--;
		}
		if(val<last) {
			cout<<"No";
			return;
		}
		last = val;
	}
	cout<<"Yes";
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


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

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

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

int main()
{
    int n,k;
    int sum[105] = {0};

    cin >> n >> k;
    for (int i = 0; i < k; i++)
    {
        int d;
        cin >> d;
        for (int j = 0; j < d; j++)
        {
            int a;
            cin >> a;
            sum[a]++;
        }
    }
    int ans=0;

    for (int i = 1; i <= n; i++)
    {
        if (sum[i] == 0)
        {
            ans++;
        }
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 3652
a = list(input())
b = list(input())
a.sort()
b = sorted(b, reverse=True)
for i in range(min(len(a), len(b))):
    if a[i] < b[i]:
        print("Yes")
        exit()
    elif a[i] > b[i]:
        print("No")
        exit()
if len(a) >= len(b):
    print("No")
else:
    print("Yes")


Measured memory_bytes: 3060
def solve():
    N = int(input())
    Ps = list(map(int, input().split()))

    def makeBIT(numEle):
        numPow2 = 2 ** (numEle-1).bit_length()
        data = [0] * (numPow2+1)
        return data, numPow2
    def addValue(iA, A):
        iB = iA + 1
        while iB <= numPow2:
            data[iB] += A
            iB += iB & -iB
    def getSum(iA):
        iB = iA + 1
        ans = 0
        while iB > 0:
            ans += data[iB]
            iB -= iB & -iB
        return ans

    data, numPow2 = makeBIT(N)

    iPs = list(range(N))
    iPs.sort(key=lambda iP: Ps[iP])

    ans = 0
    for iP in reversed(iPs):
        v = getSum(iP)
        Bs = []
        for x in range(v-1, v+3):
            if x <= 0:
                L = -1
            elif getSum(numPow2-1) < x:
                L = N
            else:
                maxD = numPow2.bit_length()-1
                L = 0
                S = 0
                for d in reversed(range(maxD)):
                    if S+data[L+(1<<d)] < x:
                        S += data[L+(1<<d)]
                        L += 1<<d
            Bs.append(L)

        num = (Bs[1]-Bs[0])*(Bs[2]-iP) + (iP-Bs[1])*(Bs[3]-Bs[2])
        ans += Ps[iP] * num
        addValue(iP, 1)

    print(ans)


solve()


Measured memory_bytes: 60908
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<cstdlib>
using namespace std;

struct aaa {
  int ten;
  int num;
  int jun;
};

int main() {
  int a;
  cin >> a;
  vector<aaa> b(a);
  for(int i = 0; i < a; i++) {
    b[i].ten = 0;
    b[i].num = i;
  }
  int c, d, e, f;
  for(int i = 0; i < a * (a - 1) / 2; i++) {
    cin >> c >> d >> e >> f;
    if(e == f) {
      b[c - 1].ten++;
      b[d - 1].ten++;
    }else if(e < f) {
      b[d - 1].ten += 3;
    }else {
      b[c - 1].ten += 3;
    }
  }
  for(int i = 0; i < a; i++) {
    for(int j = 0; j < a - 1; j++) {
      if(b[j].ten < b[j + 1].ten) {
        swap(b[j], b[j + 1]);
      }
    }
  }
  int mai = 0, mae = -1;
  for(int i = 0; i < a; i++) {
    if(b[i].ten == mae) {
      mai++;
    }else {
      mai = 0;
      mae = b[i].ten;
    }
    b[i].jun = i - mai + 1;
  }
  for(int i = 0; i < a; i++) {
    for(int j = 0; j < a; j++) {
      if(b[j].num == i) {
        cout << b[j].jun << endl;
        break;
      }
    }
  }
}

Measured memory_bytes: 3080
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define MAX 1000000007
using namespace std;

int main(void){
  int a,b;
  cin >> a >> b;
  if(a < 10 && b < 10) cout << a*b << endl;
  else cout << -1 << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<lint, lint> P;

lint H, W, N, cnt[10];
map<P, lint> mp;

int main(){
    ios::sync_with_stdio(false); cin.tie(0);
    cin >> H >> W >> N;
    for(int i=0;i<N;i++){
        lint a, b; cin >> a >> b;
        for(lint j=max(1LL, a-2);j<=min(a, H-2);j++) for(lint k=max(1LL, b-2);k<=min(b, W-2);k++) mp[P(j, k)]++;
    }

    cnt[0] = (H-2) * (W-2);
    for(auto it : mp) {cnt[it.second]++; cnt[0]--;}

    for(int i=0;i<10;i++) cout << cnt[i] << endl;
    return 0;
}

Measured memory_bytes: 56576
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
int main()
{
    int n,i,j;
    long long ans = 1;
    cin>>n;
    bool temp[n + 1] = {};
    int factor[n + 1] = {},t,f;
    vector<int> prime;
    temp[2] = true;
    for(i = 3; i <= n; i+=2)
        temp[i] = true;
    for(i = 3; i*i <= n; i+=2)
    {
        if(temp[i])
        {
            for(j = i*i; j <= n; j+=i)
                temp[j] = false;
        }
    }
    for(i = 2; i <= n; i++)
        if(temp[i])
            prime.push_back(i);
    for(i = 0; i < prime.size(); i++)
    {
        f = prime[i];
        t = n;
        while(t > 0)
        {
            t = n;
            factor[prime[i]] += (t/f);
            t/=f;
            f = f*prime[i];
        }
    }
    for(i = 0; i < prime.size(); i++)
        if(factor[prime[i]])
            ans = (ans*(factor[prime[i]] + 1))%M;
    cout<<ans<<endl;
    return 0;
}


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

string fn(string s)
{
    string ret;
    int id = 'a';
    map<char, int> m;
    for (auto c : s) {
        if (m[c]) {
            ret += m[c];
        } else {
            m[c] = id++;
        }
    }
    return ret;
}
int main()
{
    string s, t;
    cin >> s >> t;

    cout << (fn(s) == fn(t) ? "Yes" : "No") << endl;

    return 0;
}


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

int main() {
  int A, B;
  cin >> A >> B;
  if (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0) {
    cout << "Possible" << endl;
  } else {
    cout << "Impossible" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <list>
#include <cmath>
#include <stack>
#include <iomanip>

using namespace std;
typedef long long ll;
using Pll = pair<ll,ll>;

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

//cout << fixed << setprecision(10);

int main() {
    ll N, Q;
    cin >> N >> Q;
    vector<vector<ll>> Tree(N,vector<ll>());
    for(int i=0;i<N-1;i++){
        ll a,b;
        cin >> a >> b;
        a--;
        b--;
        Tree[a].push_back(b);
        Tree[b].push_back(a);
    }
    vector<ll> pos(N,0);
    for(int i=0;i<Q;i++){
        ll p,x;
        cin >> p >> x;
        p--;
        pos[p]+=x;
    }
    ll s = 0;
    queue<ll> que;
    que.push(s);
    vector<ll> seen(N,0);
    while(!que.empty()){
        ll s = que.front();
        que.pop();
        seen[s]=1;
        for(auto e : Tree[s]){
            if(seen[e]==1)continue;
            else{
                pos[e]+=pos[s];
                que.push(e);
            }
        }
    }
    for(int i=0;i<N;i++){
        cout << pos[i] << " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 19440
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

void solve(){
    ll h,w;
    cin >> h >> w;
    matrix change(10,Vi(10));
    rp(i,10){
        rp(j,10){
            cin >> change[i][j];
        }
    }
    Vi val(10,INF);
    Vi v={0,1,2,3,4,5,6,7,8,9};
    do{
        ll start=v[0];
        if(start==1) continue;
        ll sum=0;
        ll pos=1;
        do{
            sum+=change[v[pos-1]][v[pos]];
            pos++;
        }while(v[pos-1]!=1);
        chmin(val[start],sum);
    }while(next_permutation(all(v)));
    val[1]=0;
    ll ans=0;
    rp(i,h){
        rp(j,w){
            ll a;
            cin >> a;
            if(a==-1) continue;
            ans+=val[a];
        }
    }
    print(ans);
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define all(x) (x).begin(),(x).end()
const int INF=1e9+5;
const int N=2e5+5;
const int mod=1e9+7;
const ll oo=3e18L+5;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	ll d;
	cin>>n>>d;
	int cnt=0;
	for(int i=0;i<n;++i){
		ll x,y;
		cin>>x>>y;
		if(x*x+y*y<=d*d) ++cnt;
	}
	cout<<cnt;
	return 0;
}


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

void solve() {
    int N; cin >> N;
    vector<int> A(N);
    for(auto &e : A) cin >> e;
    int64_t S = accumulate(A.begin(), A.end(), 0LL);
    int64_t T = 0;
    for(int i = 1; i < N; i += 2) T += A[i];
    vector<int> B(N);
    B[0] = S - 2LL * T;
    rep(i, N - 1) B[i + 1] = 2 * (A[i] - B[i] / 2);
    rep(i, N) cout << B[i] << " ";
}

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


Measured memory_bytes: 3984
#include <iostream>
using namespace std;
int main(void){
    int H, W, i, j;
    while(1){
        cin >> H >> W;
        if((H == 0) && (W == 0)) break;
        for(j=0; j<H; j++){
            for(i=0; i<W; i++){
                if((i+j) % 2 == 0){
                    cout << '#';
                }
                else cout << '.';
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}








Measured memory_bytes: 3052
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://atcoder.jp/contests/abc127/tasks/abc127_a>
 問題文============================================================
 =================================================================
 解説=============================================================
 はい
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll A,B; cin >> A >> B;
    return A >= 13?B:A>=6?B/2:0;
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


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

using namespace std;

int main() {
  int K;
  string S;
  cin >> K >> S;
  if ((int)S.length() <= K) {
    cout << S << endl;
  } else {
    cout << S.substr(0, K) << "..." << endl;
  }
  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(long long int i = K; i < N; i++)
#define ll long long int
using namespace std;

int main(){
ll M, m, A, B, C, X, Y, Ans = 0;cin >> X >> Y >> A >> B >> C;
m = X + Y;

deque<ll> P(A);
deque<ll> Q(B);
deque<ll> R(C);

rep(i, 0, A)cin >> P[i];
rep(i, 0, B)cin >> Q[i];
rep(i, 0, C)cin >> R[i];

sort(ALL(P));sort(ALL(Q));sort(ALL(R));

rep(i, 0, A - X)P[i] = 0;
rep(i, 0, B - Y)Q[i] = 0;

reverse(ALL(P));reverse(ALL(Q));reverse(ALL(R));
  
rep(i, 0, m){

    M = max(max(P[0], Q[0]), R[0]);
    
    Ans += M;

    if(M == P[0]){P.pop_front();continue;}

    if(M == Q[0]){Q.pop_front();continue;}

    if(M == R[0]){R.pop_front();continue;}
}
cout << Ans;
}

Measured memory_bytes: 6096
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define rep(i,n) for(int i = 0; i < (int)(n);i++)
typedef long long ll;
using namespace std;
int main() {
	int d, n;
	cin >> d >> n;
	if (d == 0 && n!= 100) {
		cout << n << endl;
	}
	else if (d == 1 && n != 100) {
		cout << n * 100 << endl;
	}
	else if (d == 1 && n == 100) {
		cout << "10100" << endl;
	}
	else if (d == 2 && n != 100) {
		cout << n * 10000 << endl;
	}
	else if (d == 2 && n == 100) {
		cout << "1010000" << endl;
	}
	else if (d == 0 && n == 100) {
		cout << "101" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
N,K=map(int,input().split())
a =[0]*N
b =[0]*N
for i in range(0,N):
    a[i],b[i] =map(int,input().split())
c=[0]*(10**6)
for i in range(0,N):
    c[a[i]]=c[a[i]]+b[i]
s=0
i=1
while s<K:
    s=s+c[i]
    x=i
    i=i+1
print(x)


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

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


Measured memory_bytes: 3100
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int N, K;
LL num[11];

LL pow10(LL x){
  if(x == 0) return 1;
  return 10LL*pow10(x-1);
}
int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  /*
  string check;
  for(int i=0;i<=1000;++i){
	stringstream ss; ss << i;
	string s; ss >> s;
	check += s;
  }
  */
  for(LL d=1;d<=10;++d){
	num[d] = pow10(d);
	REP(i,d) num[d] -= num[i];
  }

  while(cin>>N>>K,!(N==0&&K==0)){
	//string ans = check.substr(N,K);
	
	LL acc = 0, d;
	for(d=1;;++d){
	  acc += num[d]*d;
	  if(acc > N) break;
	}
	acc -= num[d] * d;

	N -= acc;
	LL x = pow10(d-1);
	if(d == 1) x = 0;
	x += N / d;
	N %= d;

	//cout<<N<<","<<K<<","<<x<<endl;
	string res;
	for(;SZ(res)<=N+K;++x){
	  stringstream ss; ss << x;
	  string s; ss >> s;
	  res += s;
	}
	cout << res.substr(N,K) << endl;
	//cout << ans << endl<<endl;
  }

  return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> a(n + 1);
	a[0] = 2;
	a[1] = 1;
	for(int i = 2; i <= n; i++){
		a[i] = a[i - 1] + a[i - 2];
	}
	cout << a[n] << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
#define ll long long
#define ld long double
using namespace std;

int main() {
	int N, K;
	cin >> N >> K;
	string S;
	cin >> S;
	for(int i=1; i<K; ++i){
	    string T=S;
	    reverse(S.begin(), S.end());
	    T += S;
	    reverse(T.begin(), T.end());
	    string now=T.substr(0, N);
	    for(int i=1; i<N; ++i) now=min(now, T.substr(i, N));
	    if(now==S){
	        S=now;
	        break;
	    }
	    S=now;
	    reverse(S.begin(), S.end());
	}
	string T=S;
	reverse(S.begin(), S.end());
	T += S;
	string now=T.substr(0, N);
	for(int i=1; i<N; ++i) now=min(now, T.substr(i, N));
	cout << now << endl;
	return 0;
}


Measured memory_bytes: 256
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

const ll INF = 1LL << 50;

static const long long mod = 1000000007;

int main() {
  ll a, b;
  cin >> a >> b;
  cout << (a + b - 1) / b << endl;
  return 0;
}


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

int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector <set <int> > adj(n);
    for(int i=0;i<n-1;i++){
    	int a,b;
    	cin>>a>>b;
    	a-=1;
		b-=1;
    	adj[a].insert(b);
    	adj[b].insert(a);	
	}
	if(n==1){
		cout<<"First"<<endl;
		return 0;
	}
	queue <int> q;
	for(int i=0;i<n;i++){
		if(adj[i].size()==1){
			q.push(i);
			
		}
	}
	vector <int> val;
	while(1){
		int count=0;
		queue <int> q1;
		while(!q.empty()){
			int v=q.front();
			int p=v;
			for(auto x:adj[v]){
				p=x;
			}
		
			adj[v].erase(p);
			adj[p].erase(v);
			if(adj[p].size()==1){
				q1.push(p);
			}
			q.pop();
			count++;
		}
		swap(q1,q);
		if(count==0){
			break;
		}
		val.push_back(count);
	}
	int k=val.size()-1;
	if(val.size()%3==2){
		cout<<"First"<<endl;
		return 0;
	}
	if(val.size()%3==1){
		if(val[k]==1){
			cout<<"First"<<endl;
		}
		else{
			cout<<"Second"<<endl;
		}
		return 0;
	}
	if(val.size()%3==0){
		if(val[k]==1){
			cout<<"Second"<<endl;
		}
		else{
			cout<<"First"<<endl;
		}
		return 0;
	}

	
}

Measured memory_bytes: 29184