akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n; cin>>n;
    cout<<(mint(10).pow(n)-mint(9).pow(n)*2+mint(8).pow(n)).x<<endl;
    return 0;
}

Measured memory_bytes: 3644
M=10**9+7
n,a,b=map(int,input().split())
def f(k):
 a=b=1;m=n
 for i in range(k):a=a*m%M;b=b*-~i%M;m-=1
 return a*pow(b,M-2,M)
print((~f(a)-f(b)+pow(2,n,M))%M)

Measured memory_bytes: 3060
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long k = sc.nextLong();
		int max = 0;
		int g = 0;
		for (int i = 0; i < n; i++) {
			int x = sc.nextInt();
			g = gcd(g, x);
			max = Math.max(max, x);
		}
		System.out.println(k%g==0 && max >= k ? "POSSIBLE" : "IMPOSSIBLE");
	}
	static int gcd(int a, int b) {
		return b>0 ? gcd(b, a%b) : a;
	}
}

Measured memory_bytes: 48248
#include<iostream>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a+b>=a-b&&a+b>=a*b)
		cout<<a+b<<endl;
	else if(a-b>=a+b&&a-b>=a*b)
		cout<<a-b<<endl;
	else
		cout<<a*b<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n; cin >> n;
	vector<long long> vals(n);
	const long long inf = 1ll<<60;
	const int magic = 3;
	vector<vector<long long> > f(magic + 1, vector<long long>(n + 1, -inf));
	vector<char> sig(n + 1, '+');
	cin >> vals[0];
	for(int i = 1; i < n; i++){
		cin >> sig[i] >> vals[i];
	}
	f[0][0] = 0;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < magic; j++){
			int csig = j%2 == 0?1:-1;
			if(sig[i] == '-'){
				f[j][i+1] = max(f[j][i+1], f[j][i] - csig * vals[i]);
				if(j) f[j-1][i+1] = max(f[j-1][i+1], f[j][i] - csig * vals[i]);
				f[j+1][i+1] = max(f[j+1][i+1], f[j][i] - csig * vals[i]);
			} else {
				f[j][i+1] = max(f[j][i+1], f[j][i] + csig * vals[i]);
				if(j) f[j-1][i+1] = max(f[j-1][i+1], f[j][i] + csig * vals[i]);
			}
		}
	}
	cout << f[0][n] << endl;
	return 0;
}


Measured memory_bytes: 4992
//C
//#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>


#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

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

#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//Hang in there!

using namespace std;


int main() {
	vector<int>data(2);
	for (int i = 0; i < 2; i++) {
		cin >> data[i];
	}
	int ans = 0;
	for (int i = 0; i < 2; i++) {
		sort(data.begin(), data.end());
		ans += data[1];
		data[1]--;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#!python3

import sys

iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def resolve():
    N = int(input())
    S = list(input())
    Q = int(input())

    c0 = ord('a')
    smap = [1<<(i-c0) for i in range(c0, ord('z')+1)]

    T = [0]*N + [smap[ord(S[i])-c0] for i in range(N)]

    for i in range(N-1, 0, -1):
        i2 = i << 1
        T[i] = T[i2] | T[i2|1]

    ans = []
    #print(T)
    for cmd, i, j in zip(*[iter(sys.stdin.read().split())]*3):
        i = int(i) - 1
        if cmd == "1":
            if S[i] == j:
                continue

            S[i] = j
            i0 = N + i
            T[i0] = smap[ord(j)-c0]
            while i0 > 1:
                i0 = i0 >> 1
                T[i0] = T[i0+i0] | T[i0-~i0]
        elif cmd == "2":
            i += N
            j = int(j) + N

            d1 = 0
            while i < j:
                if i & 1:
                    d1 |= T[i]
                    i += 1
                if j & 1:
                    j -= 1
                    d1 |= T[j]

                i >>= 1; j >>=1

            ans.append(bin(d1).count('1'))

    print(*ans, sep="\n")

if __name__ == "__main__":
    resolve()


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

int main() {
	string s;
	cin >> s;
	int t[4] = { 0,4,6,8 };
	if (s.size() >= 5) {
		for (int i = 0;i < 4;i++) {
			if (s[t[i]] != 'A'&&i != 3)s.insert(s.begin() + t[i], 'A');
			else if (s.size()==8)s.push_back('A');
		}
	}
	if (s == "AKIHABARA")cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repn(i,n) for(ll i=0;i<=(ll)(n);i++)
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
//cin.tie(0);
//ios::sync_with_stdio(false);



signed main(){
  ll n;cin>>n;
  vector<ll> v(n);//index
  vector<bool> flag(n,false);//見たならtrue

  for(int i=0;i < n;i++)
  {
    cin>>v[i];
  }

  vector<ll> table(0);
  table.pb(v[0]);

  for(int i=1;i < n;i++)
  {
    int itr=lower_bound(all(table),v[i])-table.begin();

    if(itr==0)table.insert(table.begin(),v[i]);

    else table[itr-1]=v[i];

  }
  cout<<siz(table)<<endl;
}



Measured memory_bytes: 2172
#include<stdio.h>
int main(void){
    int n,i,max,min;
    int house[200];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&house[i]);
    }
    min=10000;
    max=-1;
    for(i=0;i<n;i++){
        if(house[i]<min){
            min=house[i];
        }
    }
    for(i=0;i<n;i++){
        if(house[i]>max){
            max=house[i];
        }
    }
    printf("%d\n",max-min);
    return 0;
}



Measured memory_bytes: 128
#include <stdio.h>

int main(void) {
  int m, f, r;

  for (; scanf("%d %d %d", &m, &f, &r) != EOF && !(m == f && f == r && m == -1);) {
    if (m == -1 || f == -1 || (m + f) < 30) { puts("F"); continue; }
    if ((m + f) >= 80) { puts("A"); continue; }
    if ((m + f) >= 65) { puts("B"); continue; }
    if ((m + f) >= 50 || r >= 50) { puts("C"); continue; }
    if ((m + f) >= 30) { puts("D"); continue; }
  }

  return 0;
}

Measured memory_bytes: 584
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

int asc(const void* a, const void* b) {
	return *(int*)a- *(int*)b;
}

int main()
{
	int n, m, x;
	int le = 0, ri = 0;
	int a[105];
	cin >> n >> m >> x;
	rep(i, m) cin >> a[i];
	for (int i = 0; i < m; i++) {
		if (a[i] < x) {
			le++;
		}
		else {
			ri++;
		}
	}
	//cout << le << ' ' << ri << endl;
	cout << min(le, ri) << endl;
}

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

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

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int n;cin >> n;
    vector<int> a(n);
    inc(i, 0, n) cin >> a[i];
    int b = 0;
    int ans = 0;
    int cnt = 0;
    inc(i, 0, n){
        if(b == a[i]){
            cnt++;
        }else{
            ans += cnt/2;
            cnt=1;
        }
        b = a[i];
    }
    ans += cnt/2;
    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 256
h,w,m=map(int,input().split())
HW=[list(map(int,input().split())) for _ in range(m)]

H,W=[0]*h,[0]*w
for i,j in HW:
    H[i-1] +=1
    W[j-1] +=1

max_h,max_w=max(H),max(W)
ans=max_h+max_w
cnt=H.count(max_h)*W.count(max_w)
for i,j in HW:
    if H[i-1]==max_h and W[j-1]==max_w:
        cnt -=1
print(ans if cnt!=0 else ans-1)

Measured memory_bytes: 130180
import sys


h, w = map(int, input().split())
while h != 0:
    print("#"*w)
    for _ in range(h-2):
        for i in range(w):
            if i == 0 or i == w-1:
                sys.stdout.write("#")
            else:
                sys.stdout.write(".")
        print()
    print("#" * w)
    print()
    h, w = map(int, input().split())



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

void solve()
{
    ll n;
    cin >> n;
    ll ans = 0;
    for (ll i = 0; i < n; i++)
    {
        ll a, b;
        cin >> a >> b;
        if (a == b)
        {
            ++ans;
        }
        else
        {
            ans = 0;
        }
        if (ans == 3)
        {
            cout << "Yes" << endl;
            return;
        }
    }
    cout << "No" << endl;
}

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
    auto t1 = high_resolution_clock::now();
    ll test = 1;
    // cin >> test;
    for (ll i = 0; i < test; i++)
    {
        // cout << "Case #" << (i + 1) << ": ";
        solve();
    }
    auto t2 = high_resolution_clock::now();
    auto duration = duration_cast<milliseconds>(t2 - t1).count();
    // cout << duration << endl;
    return 0;
}

Measured memory_bytes: 3644
/*
* @Author: Samson
* @Date:   2018-06-12 18:24:44
* @Last Modified by:   Samson
* @Last Modified time: 2018-06-13 11:59:44
*/
//   @URL : http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_12_A
#include<bits/stdc++.h>
#include<algorithm>
#include <cstdlib>
#define white 0
#define gray 1
#define black 2
#define INF 0x3f3f3f3f
using namespace std;
typedef long long LL;
const int MAXN = 1e3+10;

int p[MAXN],color[MAXN],a[MAXN][MAXN],t,n,d[MAXN];

int prim()
{
	int minv,u,v;
	for(int i = 0; i < n; ++i)
	{
		d[i] = INF;
		p[i] = -1;
		color[i] = white;
	}
	
	d[0] = 0;

	while(1)
	{
		minv = INF;
		u = -1;
		for(int i = 0; i < n; ++i)
		{
			if(minv > d[i] && color[i] != black)
				minv = d[i],u = i;
		}
		if(u == -1)	break;
		color[u] = black;
		for(int v = 0; v < n; ++v)
		{
			if(color[v] != black && a[u][v] != INF)
			{
				if(d[v] > a[u][v])
				{
					d[v] = a[u][v];
					p[v] = u;
					color[v] = gray;
				}
			}
		}
	}
	int ans = 0;
	for(int i = 0; i < n; ++i)
		if(p[i] != -1)
			ans += a[i][p[i]];
	return ans;
}

int main(void)
{
	ios::sync_with_stdio(false); 
	//cin.tie(0);
	cin>>n;
	for(int i = 0; i < n; ++i)
	{
		for(int j = 0; j < n; ++j)
		{
			cin>>t;
			a[i][j] = t==-1?INF:t;
		}
	}
	cout<<prim()<<'\n';
	return 0;
}


Measured memory_bytes: 3500
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>  // sort, 二分探索, etc
#include <iomanip>  // setprecision (浮動小数点の出力の誤差)
#include <map>
#include <queue>
#include <set>
#include <stack>

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=a,i##_len=(b);i<i##_len;++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define cauto const auto&
#define UNIQUE(v) (v).erase( unique(all(v), (v).end() );
#define SZ(x) ((ll)(x).size()) // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define INF 1000000000000
#define MOD 1000000007
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

using namespace std;
using ll = long long;
using ull = unsigned long long;

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

const char newl = '\n';

ll qp(ll a,ull b){ll ans=1;do{if(b&1u)ans*=a;a*=a;}while(b>>=1u);return ans;}
ll qp(ll a,ull b,ll mod){ll ans=1;do{if(b&1u)ans=ans*a%mod;a=a*a%mod;}while(b>>=1u);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll comb(int n, int r) {
    vector<vector<ll> > v(n+1, vector<ll>(r+1, 0));
    for(int i=0;i<n+1;i++) {v[i][0]=1; if(i < r+1)v[i][i]=1; }
    for(int i=1;i<n+1;i++) {for(int j=1;j<min(i,r+1);j++) {v[i][j]=v[i-1][j-1]+v[i-1][j];}}
    return v[n][r];
}

// INT_MAX   = 2.1e+09 (2147483647)
// LONG_MAX  = 9.2e+18 (9223372036854775807)
// LLONG_MAX = 9.2e+18 (9223372036854775807)


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

    for (const auto &ch : s) {
        if (ch == 'P') {
            cout << 'P';
        } else if (ch == 'D' || ch == '?') {
            cout << 'D';
        }
    }


    return 0;
}


Measured memory_bytes: 3484
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0; i < (ll)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1LL << 60;
int main(){
    int k;
    cin >> k;
    ll ans = 0;
    for(int a=1; a<=k; a++){
        ans += a;
        for(int b=1; b<a; b++){
            int gcdab = __gcd(a,b);
            ans += 6*gcdab;
            for(int c=1; c<b; c++){
                ans += 6*__gcd(gcdab, c);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
//B - Varied 2017/06/03
#include <bits/stdc++.h>
using namespace std;

int main(){
    string s;
    cin >> s;
    for(int i=0;i<s.length();++i){
        int cnt=0;
        for(int j=i+1;j<s.length();++j){
            if(s[i]==s[j]) {cout << "no" << endl; return 0;}
        }
    }
    cout << "yes" << endl;
}

Measured memory_bytes: 256
fn calc_min_left(p: usize, ts_ps: &Vec<usize>) -> Option<usize> {
    let mut lb = -1;
    let mut ub = ts_ps.len() as i64;

    let mut min: Option<usize> = None;

    while ub - lb > 1 {
        let mid = (lb + ub)/2;
        let ts_p = ts_ps[mid as usize];
        if p < ts_p {
            ub = mid;
        }
        else {
            min = Some(p-ts_p);
            lb = mid;
        }
    }

    match min {
        Some(_) => Some(ts_ps[lb as usize]),
        None => None,
    }
}

fn calc_min_right(p: usize, ts_ps: &Vec<usize>) -> Option<usize> {
    let mut lb = -1;
    let mut ub = ts_ps.len() as i64;

    let mut min: Option<usize> = None;

    while ub - lb > 1 {
        let mid = (lb + ub)/2;
        let ts_p = ts_ps[mid as usize];
        if ts_p < p {
            lb = mid;
        }
        else {
            min = Some(ts_p-p);
            ub = mid;
        }
    }

    match min {
        Some(_) => Some(ts_ps[ub as usize]),
        None => None,
    }
}

fn calc_dist(a: usize, b: usize, c: usize) -> i64 {
    ((a as i64) - (b as i64)).abs() + ((b as i64) - (c as i64)).abs()
}

fn calc_min(x: usize, fst: &Vec<usize>, snd: &Vec<usize>) -> i64 {
    let mut min_v: Vec<i64> = Vec::new();

    if let Some(l_p) = calc_min_left(x, fst) {
        if let Some(ll_p) = calc_min_left(l_p, snd) {
            min_v.push(calc_dist(x, l_p, ll_p));
        }
        if let Some(lr_p) = calc_min_right(l_p, snd) {
            min_v.push(calc_dist(x, l_p, lr_p));
        }
    }

    if let Some(r_p) = calc_min_right(x, fst) {
        if let Some(rl_p) = calc_min_left(r_p, snd) {
            min_v.push(calc_dist(x, r_p, rl_p));
        }
        if let Some(rr_p) = calc_min_right(r_p, snd) {
            min_v.push(calc_dist(x, r_p, rr_p));
        }
    }

    *(min_v.iter().min().unwrap())
}

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let a: usize = iter.next().unwrap().parse().unwrap();
    let b: usize = iter.next().unwrap().parse().unwrap();
    let q: usize = iter.next().unwrap().parse().unwrap();

    let mut shrines = Vec::<usize>::new();
    for _ in 0..a {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        shrines.push(buf.trim().parse().unwrap());
    }

    let mut temples = Vec::<usize>::new();
    for _ in 0..b {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        temples.push(buf.trim().parse().unwrap());
    }

    for _ in 0..q {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let x: usize = buf.trim().parse().unwrap();

        let d1 = calc_min(x, &shrines, &temples);
        let d2 = calc_min(x, &temples, &shrines);

        println!("{}", std::cmp::min(d1, d2));
    }
}


Measured memory_bytes: 7420
//Krunal_Mathukiya
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define li long int
#define pb push_back
#define mkp make_pair
#define nikalL return
#define chalavo continue
#define basHo break
#define umap unordered_map
#define fr(i,s,n) for(int i=s;i<=n;++i)
#define frr(i,s,n) for(int i=s;i>=n;--i)
#define jaldiKarNe ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
int n;
lli arr[3003];
lli dp[3003][3003][2];
int vis[3003][3003][2];
lli fn(int i,int j,int turn) {
	if(i>j) return 0;
	if(vis[i][j][turn]) return dp[i][j][turn];
	vis[i][j][turn]=1;
	if(turn) { //taro
		lli first=arr[i]+fn(i+1,j,1-turn);
		lli last=arr[j]+fn(i,j-1,1-turn);
		return dp[i][j][turn]=max(first,last);
	}
	else { //jiro
		lli first=fn(i+1,j,1-turn);
		lli last=fn(i,j-1,1-turn);
		return dp[i][j][turn]=min(first,last);
	}
}
int main(){
	jaldiKarNe;
	lli sum=0;
	cin>>n;
	fr(i,1,n) cin>>arr[i],sum+=arr[i];
	lli taro=fn(1,n,1);
	lli jiro=sum-taro;
	cout<<taro-jiro;
}


Measured memory_bytes: 131596
#include <iostream>
#include <climits>
#include <algorithm>
using namespace std;

// 入力
int n, W;
int weight[110], value[110];

// DPテーブル
int dp[110][10010];

int main() {
	cin >> n >> W;
	for (int i = 0; i < n; ++i) cin >> value[i] >> weight[i];

	// DP初期条件: dp[0][w] = 0
	for (int w = 0; w <= W; ++w) dp[0][w] = 0;

	// DPループ
	for (int i = 0; i < n; ++i) {
		for (int w = 0; w <= W; ++w) {
			if (w >= weight[i]) dp[i + 1][w] = max(dp[i][w - weight[i]] + value[i], dp[i][w]);
			else dp[i + 1][w] = dp[i][w];
		}
	}

	cout << dp[n][W] << endl;
}


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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
#define PER(i,n) for(int i = n; i > 0; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



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

  int n, m, q;
  cin >> n >> m >> q;
  vii l(n);
  vector<P> e(m);
  rep(i,m) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    l[a].push_back(i);
    e[i] = make_pair(a,b);
  }

  vii cnt(n, vi(n));
  for(int i = n-1; i >= 0; i--) {
    for(int x : l[i]) {
      cnt[i][e[x].se]++;
    }
    for(int j = i+1; j < n; j++) {
      cnt[i][j] += cnt[i][j-1];
      if(i != n-1) {
        cnt[i][j] += cnt[i+1][j];
        cnt[i][j] -= cnt[i+1][j-1];
      }
    }
  }
  rep(i,q) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    cout << cnt[a][b] << endl;
  }
}

Measured memory_bytes: 4736
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1e9 + 7;
int main() {
	int X, Y;
	cin >> X >> Y;
	int ans = 0;
	if (X == 1) ans += 300000;
	else if (X == 2) ans += 200000;
	else if (X == 3) ans += 100000;
	if (Y == 1) ans += 300000;
	else if (Y == 2) ans += 200000;
	else if (Y == 3) ans += 100000;
	if (X == 1 && Y == 1) ans += 400000;
	cout << ans << endl;
}


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

class program{

  static void Main(){
    int N=int.Parse(Console.ReadLine());
    int[] p=new int[N];
    for(int i=0;i<N;i++){
      p[i]=int.Parse(Console.ReadLine());
    }
    Array.Sort(p);
    Array.Reverse(p);
    
    int sum=0;
    for(int i=0;i<N;i++){
      if(i==0){
        sum+=p[0]/2; 
      }else{
        sum+=p[i];
      }      
    }
    
    Console.WriteLine(sum);
  }
}


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

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using db = double;
using vi = vector<int>;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define debug(x) cout << #x <<"\t" << x <<endl
const int inf = 0x3f3f3f3f;
const db eps = 1e-8;
const int mod = 1e9+7;
ll qpow(ll a, ll b){
	ll ret = 1;
	while(b){
		if(b&1)ret = ret*a%mod;
		a = a*a%mod;
		b>>=1;
	}
	return ret;
}
int a[] = {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}; 
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int k;
	cin >> k;
	cout << a[k-1] <<endl;
}





Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char const *argv[]) {
  int h, w;
  cin >> h >> w;
  char s[h][w];
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> s[i][j];
    }
  }

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (s[i][j] == '.') {
        int cnt = 0;
        for (int tx = -1; tx <= 1; tx++) {
          for (int ty = -1; ty <= 1; ty++) {
            if ((0 <= i + tx) && (i + tx <= h - 1) && (0 <= j + ty) &&
                (j + ty <= w - 1) && (s[i + tx][j + ty] == '#')) {
              cnt++;
            }
          }
        }
        cout << cnt;
      } else {
        cout << "#";
      }
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
	static Scanner s=new Scanner(System.in);
	static int gInt(){
		return Integer.parseInt(s.next());
	}
	public static void main(String[] A){
		int a=gInt(),b=gInt(),c=gInt(),d=gInt();
		System.out.println(
				Math.abs(a-c)<=d||
				(Math.abs(a-b)<=d&&Math.abs(b-c)<=d)
				?"Yes":"No"
				);
	}
}


Measured memory_bytes: 21972
A,B,C,X,Y=map(int,input().split())
ans=A*X+B*Y
for i in range(max(X,Y)*2+1):
  if(i%2==0):
    ans=min(ans,A*max(0,X-i//2)+B*max(0,Y-i//2)+C*i)
print(ans)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  double a,b,c,d,e,f;
  cin >> a >> b >> c >> d >> e >> f;
  
  double dens=0,ww=0,ws=0;
  for(int i=0;100*a*i<=f;i++){
    for(int j=0;100*a*i+100*b*j<=f;j++){
      double w=100*a*i+100*b*j;
      for(int k=0;c*k+w<=f;k++){
        if(c*k>e*w/100)continue;
        for(int l=0;c*k+d*l+w<=f;l++){
          double s=c*k+d*l;
          if(s>e*w/100)continue;
          if(dens<100*s/(s+w)){
            dens=100*s/(s+w);
            ww=w;
            ws=s;
          }            
        }
      }
    }
  }
  if(ww==0)cout << 100*a << " " <<0<<endl;
  else cout << ww+ws << " " <<ws << endl;
          
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define putchar putchar_unlocked
#define Would
#define you
#define please

const int cm = 1 << 19;
char cn[cm], *ci = cn, ct;

inline int getint() {
	int A = 0;
	while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}
inline bool getA() {
	bool A = *ci++ & 1;
	ci++;
	return A;
}

const int dm = 1 << 21;
char dn[dm], *di = dn, dt;

inline void putints(int X) {
	int keta = 0;
	char C[3];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--) *di++ = (*(C + i));
	*di++ = ' ';
}
inline void putint(int X) {
	int keta = 0;
	char C[3];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--) *di++ = (*(C + i));
	*di++ = '\n';
}

inline void putk(int X) {
	if (X == 0) putchar('0');
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--) putchar(*(C + i));
	putchar('\n');
}

int main() {
	fread(cn, 1, cm, stdin);
	ci = cn;

	int H, W;
	bool a = 0, b = 0;
	H = getint();
	W = getint();
	int k = 0;
	rep1(i, H) {
		rep1(ii, W - 1) {
			a ^= getA();
			if (a) {
				k++;
				putints(i);
				putints(ii);
				putints(i);
				putint(ii + 1);
			}
		}
		if (i != H) {
			b ^= a ^ getA();
			if (b) {
				k++;
				putints(i);
				putints(W);
				putints(i + 1);
				putint(W);
			}
		}
		a = false;
	}

	putk(k);
	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

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

int main(){
  int N; cin >> N;
  vector<pair<int, int> > a(N);
  int ans = 0;
  for(int i = 1; i <= N; i++){
    int tmp; cin >> tmp;
    a[i-1] = make_pair(tmp, i);
  }
  sort(a.begin(), a.end());
  for(int i = 1; i <= N; i++){
    if(a[i-1].second%2 != i%2) ans++;
  }
  cout << ans / 2;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main()
{
	int total=1;
	int i=0;
	int num=0;
	char y;
	scanf("%d",&num);
	char color[num];
	scanf("%s",&color);
	for(i=0;i<(num-1);i++){
		if(color[i]!=color[i+1]){
			total++;
		}
	}
	printf("%d",total);
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#include<math.h>
#include<limits.h>
#define MAX 200002

typedef long long ll;

int max(int a,int b){
    if(a>b) return a;
    else return b;
}

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

/*qsort(array,num_of_index,sizeof(int),compare_int); */
 int compare_int(const void *a,const void *b){
     return *(int*) a - *(int *) b; 
 } 
 
int main(){
    int N;
    scanf("%d",&N);
    int ans=0;
    for(int i=1;i<=N-1;i++)
        ans += (N%i == 0 ? N/i - 1:N/i);
    printf("%d",ans);
}


Measured memory_bytes: 1732
N = int(input())
A = list(map(int,input().split()))
if N == 1:
  print(1)
elif N == 2:
  if abs(A[1]-A[0]) <= 2:
    print(2)
  else:
    print(1)
else:
  L = [0]*(10**5+1)
  for i in range(N):
    L[A[i]+1] += 1
  for j in range(1,len(L)):
    L[j] = L[j-1]+L[j]
  ans = 0
  for k in range(3,len(L)):
    S = L[k]-L[k-3]
    if ans <= S:
      ans = S
  print(ans)

Measured memory_bytes: 14008
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 2 - 170;

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    c = min({a*4, b*2, c});
    int n;
    cin >> n;
    ll ans = (ll)n/2*min(c*2, d) + (n%2)*c;
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dbl;
#define sqr(int) (int * int)
#define sqr3(int) (int * int * int)
#define pi M_PI
#define nl "\n"


string a,b;
int main() {
	int ans=0;
    cin >> a >> b;
    for(int i = 0; i<a.length(); i++){
		if(a[i] != b[i]){
			ans+=1;
		}
	}
    cout << ans;
}


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

#define int long long
#define pii pair<int, int>
#define pb push_back

signed main(){

    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  
    string s;
    cin >> s;
    for(int i = 0 ;i < s.size(); i++){
        cout << 'x';
    }

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int a[5]={0},i,n;
  for(i=1;i<=2;i++){
    scanf("%d",&n);
    a[n]=n;
  }
  for(i=1;i<=3;i++)
	if(a[i]==0){
  	printf("%d",i);
  	break;
  }
  return 0;
}

Measured memory_bytes: 128
def count_dot(lis):
    c=0
    for i in lis:
        if not(i=='.'):
            return c
        c+=1

def solve(N):
    a=[]
    dot =[]
    for i in range(N):
        a.append([char for char in input()])
        dot.append(count_dot(a[i]))

    for i in range(N):
        for j in range(len(a[i])):
            if a[i][j]=='.':
                a[i][j]=' '

    for i in range(1,N):
        #print(type(dot[i]))
        a[i][dot[i]-1]='+'
        k=1
        while True:
#            print(i-k,dot[i]-1)
            if a[i-k][dot[i]-1] == ' ':
                a[i-k][dot[i]-1]='|'
                k += 1
            else:
                break

    for i in range(N):
        for char in a[i]:
            print(char,end='')
        print()

while True:
    N=int(input())
#    print(N)
    if N==0:
        break
    solve(N)



Measured memory_bytes: 11628
#include <stdio.h>

int main() {
  int N, M;
  int i;
  int T[100];
  int P[100], X[100];
  scanf("%d", &N);
  for (i = 0; i < N; i++) {
    scanf("%d", T + i);
  }
  scanf("%d", &M);
  for (i = 0; i < M; i++) {
    scanf("%d %d", P + i, X + i);
  }

  int sum = 0;
  for (i = 0; i < N; i++) {
    sum += T[i];
  }

  for (i = 0; i < M; i++) {
    printf("%d\n", sum + X[i] - T[P[i] - 1]);
  }
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#include <fstream>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define LL long long
#define LI long int
#define LLI long long int
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define POS(i) cout<<(i?"POSSIBLE":"IMPOSSIBLE")<<endl
using namespace std;
//
const int INF=1e9+7;
const int MOD=1e9+7;
//
int main(){
    int n; cin>>n;
    vector<int> v;
    FOR(i,0,n){
        int a; cin>>a;
        v.PB(a);
    }
    sort(v.rbegin(),v.rend());
    long int h=0,w=0;
    int c1=v[0],c2,i=1;
    while(i<n&&h==0){
        c2=v[i];
        if(c1==c2){
            h=c2;
            i++;
        }
        i++;
        c1=c2;
    }
    c1=v[i-1];
    while(i<n&&w==0){
        c2=v[i];
        if(c1==c2){
            w=c2;
            i++;
        }
        i++;
        c1=c2;
    }    
    cout<<h*w<<endl;
}

Measured memory_bytes: 892
import Control.Monad
import Data.List
import Data.Functor

main = do
  n <- readLn
  s <- map (map (read :: (String -> Int)) . words) <$> replicateM n getLine
  mapM_ putStrLn $ map (\x -> if x then "YES" else "NO") $ map (\x -> (x !! 2) ^ 2 == (x !! 0) ^ 2 + (x !! 1) ^ 2)  $ map (sort) s

Measured memory_bytes: 4376
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<bitset>
#define nl n<<1
#define nr (n<<1)|1
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int>P;
const int INF=0x3f3f3f3f;
const ll INFF=0x3f3f3f3f3f3f3f3f;
const double pi=acos(-1.0);
const double eps=1e-9;
const ll mod=100000073;
int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0' | ch>'9') {if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0' && ch<='9') {x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
void Out(ll aa)
{
    if(aa>9)
        Out(aa/10);
    putchar(aa%10+'0');
}
int main()
{
    int a=read(),b=read(),c=read(),d=read();
    if(c>b||a>d)
        printf("0\n");
    else
    {
        printf("%d\n",abs(min(b,d)-max(a,c)));
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{

     public static void main(String []args){
       int N, Y, x, y, z;
       Scanner sc = new Scanner(System.in);
       N = sc.nextInt();
       Y = sc.nextInt();
       
       for(x = 0; x <= N; x++){
           for(y = 0; y <= N-x; y++){
               if(10000 * x + 5000 * y + 1000 * (N-(x+y)) == Y){
                   System.out.println(x + " " + y + " " + (N-(x+y)));
                   return;
               }
           }
       }
       
       System.out.println(-1 + " " + -1 + " " + -1);
      
     }
}

Measured memory_bytes: 23764
def possible(l, a, k):
    for x in a:
        k -= x//l
        if x%l==0:
            k += 1
    return k>=0

n, k = map(int, input().split())
a = [int(x) for x in input().split()]
mini = 1
maxi = 10**9+7
while(mini!=maxi):
    mid = (mini+maxi)//2
    if possible(mid, a, k):
        maxi = mid
    else:
        mini = mid + 1
print(mini)


Measured memory_bytes: 31016
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>
#include <map>
#include <iomanip>

using namespace std;
typedef long long  ll;

int main()
{
	ll N, K, S;
	cin >> N >> K >> S;
	if (S < 1000000000)
	{
		for (ll i = 0; i < K; i++)
		{
			if (i == 0) {
				cout << S;
				continue;
			}
			cout << " " << S;
		}
		for (ll i = K; i < N; i++)
		{
			cout << " " << S + 1;
		}
	}
	else
	{
		for (ll i = 0; i < K; i++)
		{
			if (i == 0) {
				cout << S;
				continue;
			}
			cout << " " << S;
		}
		for (ll i = K; i < N; i++)
		{
			cout <<" " << 1;
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
const int mod = 1e9 + 7;
const int maxn = 2000005;

void solve() {
    ll n, m, tot;
    vector<int>v1,v2;
    cin >> n >> m >> tot;
    ll cur = 0;
    f(n) {
        int x; cin >> x;
        v1.pb(x);
        cur += x;
    }
    f(m) {
        int x; cin >> x;
        v2.pb(x);
    }
    int p1 = n, p2 = 0;
    int ans = 0;
    while (p1 >= 0 && p2 <= m) {
        //cout << cur <<' '<<p1 <<' '<<p2 << endl;
        if (cur > tot) {
            if (p1) {
                cur -= v1[--p1];
            }
            else {
                break;
            }
        }
        else {
            ans = max(ans, p1 + p2);
            if (p2 != m)
                cur += v2[p2++];
            else {
                break;
            }
        }
    }
    cout << ans << '\n';
}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int c = 0;
    int t;
    if (!c) {
        t = 1;
    }
    else {
        cin >> t;
    }
    while (t--) {
        solve();
    }
}

Measured memory_bytes: 5592
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
	ll n; cin >> n;
	bool seki[n];
	cout << 0 << endl;
	string s;
	ll low = 0; cin >> s;
	if(s == "Vacant") return 0;
	cout << n - 1 << endl;
	for(ll i = 0; i < n; i++){
		if(s == "Male") seki[i] = (i & 1 ? 1 : 0);
		else seki[i] = (i & 1 ? 0 : 1);
	}
	ll up = n - 1; cin >> s;
	if(s == "Vacant") return 0;
	for(ll i = 0; i < 17; i++){
		ll mid = (up + low) / 2;
		cout << mid << endl;
		cin >> s;
		if(s == "Vacant") return 0;
		bool po = (s == "Male" ? 0 : 1);
		if(seki[mid] == po){
		   	low = mid;
		}else{
		   	up = mid;
		}
	}
	cout << low << endl;
	return 0;
}

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

int n, k;
vector<int> a, b;

long long f(int msk){
    long long res = 0;
    for(int i=0;i<n;i++){
        if((a[i]&(~msk)) == 0) res += b[i];
    }
    return res;
}

int main(void){
    cin >> n >> k;
    a.assign(n, 0);
    b.assign(n, 0);
    for(int i=0;i<n;i++) cin >> a[i] >> b[i];

    long long ans = f(k);
    for(int i=0;i<30;i++){
        if(((k>>i)&1) == 1){
            int msk = ((k>>i) << i) - 1;
            long long t = f(msk);
            if(ans < t) ans = t;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<bitset>
#include<math.h>
using namespace std;
#define ll long long

int main(){
    ll N,A,B,C,D,E;
    cin >> N >> A >> B >> C >> D >> E;
    cout << (N-1)/min({A,B,C,D,E})+5 <<endl;
    return 0;
}


Measured memory_bytes: 256
#!python3

iim = lambda: map(int, input().rstrip().split())

from bisect import bisect

def resolve():
    def find(i):
        x = S[i]
        if x < 0:
            return i
        S[i] = find(x)
        return S[i]

    def join(i, j):
        ai = find(i)
        aj = find(j)
        diff = ai - aj
        if diff == 0:
            return
        elif diff > 0:
            ai, aj = aj, ai
        S[ai] += S[aj]
        S[aj] = ai
    def same(i, j):
        ai = find(i)
        aj = find(j)
        return ai == aj
    def size(i):
        return -S[find(i)]

    N, M, K = iim()
    S = [-1] * N
    T = [1] * N
    for i in range(M):
        ai, bi = iim()
        ai -= 1; bi -= 1
        join(ai, bi)
        T[ai] += 1
        T[bi] += 1
        #print(ai, bi, S)

    for i in range(K):
        ai, bi = iim()
        ai -= 1; bi -= 1
        if same(ai, bi):
            T[ai] += 1
            T[bi] += 1
    #print(S)
    #print(T)

    ans = [size(i) - T[i] for i in range(N)]
    print(*ans)


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 10992
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define mod 1000000007LL
#define eps 0.0001
#define pi acos(-1)
#define INF 10000000000000000

#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    // ---------------------
    // コーディング開始
    // ---------------------
    string n;
    cin >> n;
    
    while(n.size()!=0){
        n = n.substr(0,n.size()-2);
        if (n.substr(0,n.size()/2) == n.substr(n.size()/2,n.size())){
            pri(n.size());
            return 0;
        }
    }

    


    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int a ,b ,x=0 ,y=0 ,z=0 ,ans;
  while( scanf( "%d %d" ,&a ,&b ) ){

    if( a == 0 && b == 0 ){
      break;
    }

    ans = b - a;

    if( ans >= 1000 ){
      while( ans >= 1000 ){
	x++;
	ans = ans - 1000;
      }
    }

    if( ans >= 500 ){
      while( ans >= 500 ){
	y++;
	ans = ans - 500;
      }
    }

    if( ans >= 100 ){
      while( ans >= 100 ){
	z++;
	ans = ans - 100;
      }
    }

    printf( "%d %d %d\n" ,z ,y ,x );
    x = 0;
    y = 0;
    z = 0;
  }

  return 0;
}

Measured memory_bytes: 600
#include <stdio.h>
 
int main(void){
  
  int a, b, c, temp;
  
  scanf("%d %d %d", &a, &b, &c);
  
  temp = a;
  a = b;
  b = temp;
  
  
  temp = a;
  a = c;
  c = temp;
 
  
  printf("%d %d %d", a, b, c);
  
  return 0;
}

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

int main() {
  string s,t;
  cin>>s>>t;
  bool ans=false;
  for(int i=0;i<s.size();i++){
    if(s[i]!=t[i]){
      ans=true;
    }
  }
  if(ans){
    cout<<"No"<<endl;
  }
  else{
    cout<<"Yes"<<endl;
  }
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
#define MOD 1000000007LL
#define endl "\n"
#define fst first
#define snd second
const ll UNDEF = -1;
const ll INF=LLONG_MAX/4;
template<typename T> inline bool chkmax(T &aa, T bb) { return aa < bb ? aa = bb, true : false; }
template<typename T> inline bool chkmin(T &aa, T bb) { return aa > bb ? aa = bb, true : false; }
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef vector<int> vi;
int Rjump,Ljump;
const int mn=5004;
int a[mn];
// f(p,b) is the minimum cost such that:
// Position [1,p] with value within [1,b] are sorted
// Position [1,p] with value within [b+1,n] have jumped right
// f(p,b) = min f(p-1,[0,b]) + Ljump if a[p]<b + Rjump if a[p]>b
ll f[mn][mn],g[mn][mn];
int main(){	
	ios::sync_with_stdio(false);
	for (int x=0;x<mn;x++) for (int y=0;y<mn;y++) {
		f[x][y]=g[x][y]=INF;
	}
	int n; cin>>n>>Rjump>>Ljump;
	for (int p=1;p<=n;p++) {
		cin>>a[p];
	}
	for (int b=0;b<mn;b++) f[0][b]=g[0][b]=0;
	for (int p=1;p<=n;p++) {
		for (int b=1;b<=n;b++) {
			f[p][b]=g[p-1][b]+(a[p]<b?Ljump:0)+(a[p]>b?Rjump:0);
		}
		ll lof=f[p][1];
		for (int b=1;b<=n;b++) {
			chkmin(lof,f[p][b]);
			g[p][b]=lof;
		}
	}
	ll final=INF; for (int b=1;b<=n;b++) chkmin(final,f[n][b]);
	printf("%lld\n",final);
}


Measured memory_bytes: 391552
#include<bits/stdc++.h>
using namespace std;
int a[105],b[105];
int main()
{
	int n;
	cin>>n;
	int cnt=0;
	int maxx=0;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i]>>b[i];
		if(a[i]==b[i]) cnt++;
		else maxx=max(cnt,maxx),cnt=0;
	}
	maxx=max(maxx,cnt);
	if(maxx<3)
	cout<<"No";
	else cout<<"Yes";
	return 0;
}

Measured memory_bytes: 3560
N, Yen_target = map(int, input().split(" "))

flag = False
for i in range(N+1):
    for j in range(N+1-i):
            if Yen_target == i*10000 + j*5000 + (N-i-j)*1000:
                print(i, j, N-i-j)
                flag = True
            else:
                continue
            if flag:
                break
    if flag:
        break
if flag == False:
    print(-1, -1, -1)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
 
using namespace std;
typedef long long ll;
const int MOD=2019;

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

  const int moda=3,modb=673;
  int inva=1,invb;
  for(int i=0;i<modb;i++){
    if(i*10%modb==1){
      invb=i;break;
    }
  }

  vector<int> m(s.size()+1,0);
  vector<int> ma(s.size()+1,0),mb(s.size()+1,0);
  int inva_=1,invb_=1;
  for(int i=1;i<=s.size();i++){
    m[i]=m[i-1]*10+(s[i-1]-'0');
    m[i]%=MOD;
    ma[i]=m[i]*inva_;
    ma[i]%=moda;
    mb[i]=m[i]*invb_;
    mb[i]%=modb;
    inva_*=inva; inva_%=moda;
    invb_*=invb; invb_%=modb;
  }
  vector<vector<int>> r(moda, vector<int>(modb,0));
  for(int i=0;i<=s.size();i++){
    r[ma[i]][mb[i]]++;
  }

  ll ans=0;
  for(int i=0;i<moda;i++){
    for(int j=0;j<modb;j++){
      ans+=r[i][j]*(r[i][j]-1)/2;
    }
  }

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


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

ifstream in ( "test.in"  );
ofstream out( "test.out" );

const int DIM = 1e5 + 5;
const int MOD = 1e9 + 7;

int pos[DIM], ans[DIM];
int fct[DIM], inv[DIM];

int lgput( int x, int n ) {
    if( n == 0 )
        return 1;
    
    int y = lgput( x, n >> 1 );
    y = ( 1LL * y * y ) % MOD;
    
    if( n & 1 )
        y = ( 1LL * y * x ) % MOD;
    
    return y;
}

inline int comb( int n, int k ) {
    if( n < k ) return 0;
    return 1LL * fct[n] * inv[k] % MOD * inv[n - k] % MOD;
}

int main() {
    
    int n;
    cin >> n;
    
    int p1 = 0, p2 = 0; n ++;
    for( int i = 1; i <= n; i ++ ) {
        int x;
        cin >> x;
        
        if( pos[x] == 0 )
            pos[x] = i;
        else
            p1 = pos[x], p2 = i;
    }
    
    fct[0] = inv[0] = 1;
    for( int i = 1; i <= n; i ++ ) {
        fct[i] = ( 1LL * fct[i - 1] * i ) % MOD;
        inv[i] = lgput( fct[i], MOD - 2 );
    }
    
    ans[1] = n - 1;
    for( int i = 2; i <= n; i ++ )
        ans[i] = ( comb( n, i ) - comb( n - (p2 - p1 + 1), i - 1 ) + MOD ) % MOD;
    
    for( int i = 1; i <= n; i ++ )
        cout << ans[i] << "\n";
    
    return 0;
}


Measured memory_bytes: 2816
#include <unordered_set>
#include <string>
#include <iostream>
using namespace std;
int main(){
	unordered_set<string> A;
	int counter;
	string order, word;
	cin >> counter;
	for (int i = 0; i < counter; i++){
		cin >> order;
		if(order == "insert"){
			cin >> word;
			A.insert(word);
		}
		else if(order == "find"){
			cin >> word;
			if(A.count(word) == 0)
				cout << "no" << endl;					
			else
				cout << "yes" << endl;
		}
	}
}

Measured memory_bytes: 32148