akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long llu;
const ll inf = 1e9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const ll MAX = 1e7 + 20;
#define fast ios_base:: sync_with_stdio( false ); cin.tie(0); cout.tie(0);
#define eb              emplace_back
#define em              emplace
#define pb              push_back
#define Mp              make_pair
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define rep(i,n)        for(int i=0;i<n;i++)
#define rep1(i,n)       for(int i=1;i<=n;i++)
#define rrep(i,a,n)     for(int i=a;i<=n;i++)
#define per(i,n,a)      for(int i=n;i>=a;i--)
#define pf(n)           printf("%lld",n)
#define pfi(n)          printf("%d",n)
#define sp              printf(" ")
#define ln              "\n"

#define pi acos(-1.0)
#define mod 1000000007

///Library
#define mem(a,b) memset(a,b,sizeof(a))
#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define SortA(ar,s) sort(ar,ar+s)
#define SortD(ar,s) sort(ar,ar+s,greater<int>())
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sq(x) (x)*(x)


///vector
#define Lower_bound(vec,value) lower_bound(vec.begin(),vec.end(),value)
#define Upper_bound(vec,value) upper_bound(vec.begin(),vec.end(),value)


//template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
//template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }


int main()
{
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/

    fast
    ll a,b;
    string c,d,e;
    cin>>c>>d>>a>>b;
    cin>>e;
    if(e==c)
    {
        a--;
        cout<<a<<" "<<b<<endl;
    }
    else
    {
        cout<<a<<" "<<--b<<endl;
    }
}


Measured memory_bytes: 256
N,M,C = map(int,input().split())
B = list(map(int,input().split()))

count = 0

for i in range(N):
    tmp = C
    A = list(map(int,input().split()))
    for i in range(M):
        tmp += B[i]*A[i]
    if tmp > 0:
        count += 1

print(count)

Measured memory_bytes: 3060
s = str(input())
n = len(s)
ans = [0] * n
tmp = -1
for i in range(n-1):
  if s[i]=='R' and s[i+1]=='L':
    a=i-tmp    
    if i==n-2:
      ans[i+1]+=1
    tmp=i
    ans[i]+=-(-a//2)
    ans[i+1]+=a//2
  elif s[i]=='L' and s[i+1]=='R':
    a=i-tmp
    ans[tmp]+= a//2
    ans[tmp+1]+= -(-a//2)
    tmp=i
  elif i==n-2:
    a=n-tmp-1
    ans[tmp]+= a//2
    ans[tmp+1]+= -(-a//2)
print(*ans)

Measured memory_bytes: 6528
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = str(sys.stdin.readline().rstrip())
    T = [N[i: i + 2] for i in range(0, len(N), 2)]

    for t in T:
        if t != 'hi':
            print('No')
            exit()

    print('Yes')


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e19;
const int MOD = (int)1e9 + 7;

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

    int n, m;
    cin >> n >> m;
    vector<int> x(m), y(m-1);
    REP(i, m) cin >> x[i];

    sort(all(x));

    REP(i, m-1){
        y[i] = x[i+1] - x[i];
    }

    //REP(i, m-1) cout << y[i] << " \n"[i == m-2];

    sort(all(y));
    LL ans = 0;
    REP(i, m-n) ans += y[i];
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,count=0,max=0;
  char a[100]={};
  cin>>N;
  for(int n=0;n<N;n++){
    cin>>a[n];
  }
  for(int t=0;t<N;t++){
    if(a[t]=='I'){
      count++;
    }else{
      count--;
    }
    if(count>max){
      max=count;
    }
  }
  cout<<max<<endl;
  return 0;

}


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

const int maxn = 1e6 + 10;
int vis[maxn];

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		if (vis[a[i]]) {
			vis[a[i]]++;
			continue;
		}
		for (int j = 1; j*a[i] < maxn; j++) {
			vis[a[i]*j]++;
		}
	}
	
	int res = 0;
	for (int i = 0; i < n; i++) {
		if (vis[a[i]] == 1) {
			res++;
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 8072
package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"math"
	"os"
	"strconv"
	"strings"
)

var (
	// ErrLineNotFound -
	ErrLineNotFound = errors.New("lines: line not found")
)

type onError int

const (
	onErrorPanic onError = iota
	onErrorError
)

// Lines represents multi line.
type Lines struct {
	r       io.Reader
	w       io.Writer
	onError onError

	store []string
}

// NewLines create lines from provided input reader.
func New(r io.Reader) *Lines {
	lines, err := newLines(r, ioutil.Discard, onErrorPanic)
	if err != nil {
		panic(err)
	}
	return lines
}

// Line represents single line.
type Line struct {
	store string
	field int
}

// Line return given n line.
func (ls *Lines) Line(n int) *Line {
	line, err := ls.line(n)
	if err != nil {
		panic(err)
	}
	return line
}

func (ls *Lines) line(n int) (*Line, error) {
	if n >= len(ls.store) {
		return nil, ErrLineNotFound
	}
	return &Line{store: ls.store[n]}, nil
}

func (l *Line) Ints() []int {
	ints, err := l.ints()
	if err != nil {
		panic(err)
	}
	return ints
}

func (l *Line) ints() ([]int, error) {
	var ints []int
	fields := strings.Fields(l.store)
	for _, s := range fields {
		i, err := strconv.Atoi(s)
		if err != nil {
			return nil, err
		}
		ints = append(ints, i)
	}
	return ints, nil
}

// Field specify current field scope.
func (l *Line) Field(n int) *Line {
	clone := l.clone()
	clone.field = n
	return clone
}

func (l *Line) Int() int {
	ints, err := l.ints()
	if err != nil {
		panic(err)
	}
	return ints[l.field]
}

func newLines(r io.Reader, w io.Writer, onError onError) (*Lines, error) {
	lines := &Lines{
		r:       r,
		w:       w,
		onError: onErrorError,
	}
	return lines, lines.init()
}

func (ls *Lines) init() error {
	s := bufio.NewScanner(ls.r)
	s.Buffer([]byte{}, math.MaxInt64)
	for s.Scan() {
		ls.store = append(ls.store, s.Text())
	}
	return s.Err()
}

func (l *Line) clone() *Line {
	clone := *l
	return &clone
}

type Route struct {
	Cost int
	Time int
}

func main() {
	lines := New(os.Stdin)

	routes := generateRoutes(lines)
	limitTime := lines.Line(0).Field(1).Int()

	r, found := findRoute(limitTime, routes)
	if !found {
		fmt.Println("TLE")
		return
	}
	fmt.Println(r.Cost)
}

func findRoute(limit int, routes []Route) (Route, bool) {
	var best Route
	var found bool
	var minCost int = 1001

	for _, r := range routes {
		r = r
		if r.Time > limit {
			continue
		}
		if r.Cost < minCost {
			found = true
			best = r
			minCost = r.Cost
		}
	}
	return best, found
}

func generateRoutes(lines *Lines) []Route {
	n := lines.Line(0).Ints()[0]

	var routes []Route
	for i := 1; i <= n; i++ {
		l := lines.Line(i)
		routes = append(routes, Route{
			Cost: l.Field(0).Int(),
			Time: l.Field(1).Int(),
		})
	}
	return routes
}


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

using namespace std;


using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
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);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int R;
  cin >> R;
  cout << R * R << endl;
}

Measured memory_bytes: 256
import bisect
import copy
n = int(input())
L = []
zahyou = []
for i in range(n):
    L.append(int(input()))
C = copy.deepcopy(L)
C.sort()
for i in range(n):
    t = L[i]
    k = bisect.bisect_left(C,t)
    zahyou.append(k)
ans = 0
for i in range(n):
    if zahyou[i]%2 != i%2:
        ans += 1
print(ans//2)

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


void solve(long long X){
  for(long long i = 1; i < 10; i++) {
    if(2000-(200*i) <= X) {
      cout << i << endl;
      break;
    }
  }
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long X;
  scanf("%lld",&X);
    solve(X);
    return 0;
}


Measured memory_bytes: 3760
//
//  abc167_Registrations.cpp
//  learningCplusplus
//
//  Created by Tran Duc Chinh on 2020/04/04.
//  Copyright © 2020 Tran Duc Chinh. All rights reserved.
//

#include <iostream>
#include <queue>
#include <map>
#include <algorithm>
#include <math.h>
using namespace std;
typedef unsigned long long ll;
ll mod = 1000000007;
ll INF = 1000000007;
#define PI 3.14159265

std::map<int, int> factorization (int n) {
  std::map<int, int> f;
  for (int i = 2; i*i <= n; i++) {
    while (n%i == 0) {
      f[i] += 1;
      n /= i;
    }
  }
  if (n > 1) {
    f[n] += 1;
  }
  return f;
}

ll modpow (int x, int n) {
  if (n==0) return 1%mod;
  ll u = modpow(x, n/2);
  u = (u*u)%mod;
  if (n%2==1) u = (u*x)%mod;
  return u;
}

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

  s.push_back(t[t.size()-1]);
  if (s == t) {
    std::cout << "Yes" << std::endl;
  }
  else {
    std::cout << "No" << std::endl;
  }

  return 0;
}

Measured memory_bytes: 3628
#![allow(unused_imports)]
#![allow(clippy::many_single_char_names)]

// language: Rust(1.42.0)
// check available crates on AtCoder at "https://atcoder.jp/contests/language-test-202001"
// My Library Repo' is at "https://github.com/Loptall/prcn_lib"

/*
    そう甘くはないんだな〜w
*/

// from std...
use std::cmp::{
    max, min,
    Ordering::{Equal, Greater, Less},
    Reverse,
};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::convert::TryInto;
use std::mem::swap;
use std::ops::*;
use std::process::exit;
use std::{f32, f64, i128, i16, i32, i64, i8, isize, u128, u16, u32, u64, u8, usize};

// Dep' crates are...
use itertools::*;
use itertools_num::*;
use lazy_static::lazy_static;
use maplit::{btreemap, btreeset, hashmap, hashset};
use num_bigint::{BigInt, BigUint};
use num_complex::Complex;
use num_integer::{binomial, gcd, lcm, Integer};
use num_rational::Rational;
use num_traits::{clamp, one, pow, zero, One, Pow, Zero};
use permutohedron::Heap;
use petgraph::unionfind::UnionFind;
use proconio::{fastout, input, is_stdin_empty, marker::*};
use rand::rngs::SmallRng;
use rand::{random, Rng, SeedableRng};

pub const MOD: usize = 1000000007;
pub const MAX: usize = 1usize << 63usize;
pub const MIN: i64 = i64::MIN;
pub const PI: f64 = f64::consts::PI;
pub const A: u8 = 'A' as u8;

use std::time::{Duration, Instant};

// code...
#[fastout]
fn main() {
    input! {
        d: usize,
        c: [i64; 26],
        s: [[i64; 26]; d]
    }

    let start = Instant::now();

    let mut rng = SmallRng::from_entropy();

    let mut ans = Vec::with_capacity(d);
    for day in 0..d {
        let w = s[day].iter().enumerate().max_by_key(|x| x.1).unwrap().0 + 1;
        ans.push(w);
    }
    let mut scr = score(d, &c, &s, &ans);

    dbg!(scr);

    let mut count = 0usize;

    while start.elapsed().as_millis() < 1984 {
        let prev = ans.clone();
        ch(&mut ans, &c, &s, &mut rng);
        let new = score(d, &c, &s, &ans);
        if new <= scr {
            ans = prev;
        } else {
            scr = new;
        }
        count += 1;
    }

    dbg!(score(d, &c, &s, &ans));
    dbg!(count);

    for i in ans {
        println!("{}", i);
    }
}

fn score(d: usize, c: &Vec<i64>, s: &Vec<Vec<i64>>, ans: &Vec<usize>) -> i64 {
    let mut last = vec![0usize; 26];
    let mut a = 0i64;

    for day in 0..d {
        a += s[day][ans[day] - 1];
        last.iter_mut().for_each(|x| *x += 1);
        last[ans[day] - 1] = 0;
        a -= last
            .iter()
            .enumerate()
            .map(|(i, l)| c[i] * *l as i64)
            .sum::<i64>();
    }
    a
}

fn ch(ans: &mut Vec<usize>, c: &Vec<i64>, s: &Vec<Vec<i64>>, rng: &mut SmallRng) {
    for (d, i) in ans.iter_mut().enumerate() {
        if rng.gen_bool(0.005) {
            let g = s[d]
                .iter()
                .enumerate()
                .map(|x| (x, c[x.0]))
                .sorted_by(|a, b| ((b.0).1, a.1).cmp(&((a.0).1, b.1)))
                .skip(1)
                .take(3)
                .collect_vec();
            *i = (g[rng.gen_range(0, g.len())].0).0 + 1;
        }
    }
}


Measured memory_bytes: 2320
#include <bits/stdc++.h>
#define mp make_pair
#define pii pair<int,int>
#define ss second
#define ff first
using namespace std ;
int mn_dist = 100000000 ;

int row , col , hx , hy , px,  py;

char g[405][405] ;
int vis[405][405] , d[405][405] ;

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


bool valid (int x,int y) {

    if (x >= 0 and x < row and y >= 0  and y < col and vis[x][y] == 0 and g[x][y] != '#' ) return 1 ;
    return  0 ;


}

void bfs (int sx, int sy) {

    memset (vis, 0 , sizeof vis) ;


    vis[sx][sy] = 1 ;

    d[sx][sy] = 0 ;


    queue <pair<int,int > > q ;
    q.push(mp(sx,sy)) ;

    while(!q.empty()) {
        pii u = q.front() ;
        int x = u.ff , y = u.ss ;
        q.pop() ;

        for(int i = 0 ; i < 4 ; i++) {
            int x_ = x+dx[i] , y_ = y+ dy[i] ;

            if (valid(x_,y_)) {
                vis[x_][y_] = 1 ;
                d[x_][y_] = d[x][y] + 1 ;
                q.push(mp(x_,y_)) ;
            }
        }
    }
}






int main () {

    cin >> row >> col ;
    for(int i = 0 ; i < row ; i++) scanf ("%s" , g[i]) ;

    for(int i = 0 ; i < row ; i++) {
        for(int j = 0 ; j < col ; j++) {
            if (g[i][j] == '@') px = i , py = j ;
            if (g[i][j] == '%') hx = i , hy = j ;
        }
    }

    bfs(hx,hy) ;
    int p_dist = d[px][py] ;
    for(int i = 0 ; i < row ; i++) {
        for(int j = 0 ; j < col ; j++) {
            if (g[i][j] == '$' and vis[i][j] == 1) {
                mn_dist = min(d[i][j],mn_dist) ;
            }
        }
    }

    if (mn_dist <= p_dist) {
        printf ("No\n") ;
    } else {
        printf ("Yes\n" ) ;
    }
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

int diameter(const Graph &G) {
    int n = (int)G.size();
    vector<int> dis(n, -1);
    dis.at(0) = 1;
    queue<int> que;
    que.push(0);
    while (!que.empty()) {
        int cur = que.front(); que.pop();
        for (int nx : G.at(cur)) {
            if (dis.at(nx) == -1) {
                dis.at(nx) = dis.at(cur) + 1;
                que.push(nx);
            }
        }
    }
    int maxi = -1, ind = -1;
    for (int i=0; i<n; ++i) if (chmax(maxi, dis.at(i))) ind = i;

    dis.assign(n, -1);
    dis.at(ind) = 1;
    que.push(ind);
    while (!que.empty()) {
        int cur = que.front(); que.pop();
        for (int nx : G.at(cur)) {
            if (dis.at(nx) == -1) {
                dis.at(nx) = dis.at(cur) + 1;
                que.push(nx);
            }
        }
    }
    int res = -1;
    for (int i=0; i<n; ++i) chmax(res, dis.at(i));
    return res;
}

void solve() {
    int n;
    cin >> n;
    Graph G(n);
    for (int i=0; i<n-1; ++i) {
        int a, b;
        cin >> a >> b;
        G.at(a-1).push_back(b-1);
        G.at(b-1).push_back(a-1);
    }

    int dia = diameter(G);
    vector<bool> dp(dia+1);
    for (int i=1; i<dia+1; ++i) {
        if (i == 1) {
            dp.at(i) = true;
        } else if (i == 2) {
            dp.at(i) = false;
        } else {
            dp.at(i) = !(dp.at(i-1) && dp.at(i-2));
        }
    }
    if (dp.at(dia)) cout << "First" << '\n';
    else cout << "Second" << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}


Measured memory_bytes: 13556
#include <bits/stdc++.h> 
using namespace std; 
vector<int> factorize(long long n) 
{ 
    std::vector<int> vn;
    int count = 0; 
    while (!(n % 2)) { 
        n >>= 1; 
        count++; 
    } 
    if (count) 
        vn.push_back(count);
    for (long long i = 3; i <= sqrt(n); i += 2) { 
        count = 0; 
        while (n % i == 0) { 
            count++; 
            n = n / i; 
        } 
        if (count) 
            vn.push_back(count);
    } 
    if (n > 2) {
        vn.push_back(1);
    }
    return vn;
} 
int solve(int val) {
    val *= 2;
    int a = sqrt((1+4*val));
    a = a - 1;
    a /= 2;
    return a;
}
int main() 
{ 
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    long long n;
    cin >> n;
    std::vector<int> v; 
    v = factorize(n); 
    long long cnt = 0;
    // cout << v[0] << '\n';
    for(int i  = 0; i < v.size(); i++) {
        cnt += solve(v[i]);
    }
    cout << cnt << '\n';
    return 0; 
} 



Measured memory_bytes: 3752
import java.util.*;

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

        String str = sc.nextLine();
        str = str + str;


        if(str.contains(sc.nextLine()))
            System.out.println("Yes");
        else
            System.out.println("No");


    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N, A, B;
  cin >> N >> A >> B;
  vector<int> vec(N);
  for(int i=0; i<N; i++){
    cin >> vec.at(i);
  }
  int count_no1 = 0;
  int count_no2 = 0;
  int count_no3 = 0;
  
  for(int j=0; j<N; j++){
    if(vec.at(j) <= A){
      count_no1++;
    }
    else if(vec.at(j) <= B){
      count_no2++;
    }
    else{
      count_no3++;
    }
  }
  int ans = min(count_no1,count_no2);
  ans = min(ans, count_no3);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int a[3];
	for(int i=1;i<=2;i++)
	{
		cin >> a[i];
	}
	if(a[1]>=a[2])a[0]=a[2];
	else a[0]=a[1];
	for(int i=1;i<=2;i++)
	{
		cin >> a[i];
	}
	if(a[1]>=a[2])a[0]+=a[2];
	else a[0]+=a[1];
	cout << a[0] << endl;
	system("pause");
	return 0;
}

Measured memory_bytes: 504
package main
import (
	"bufio"
	"fmt"
	"io"
	"os"
	"runtime/debug"
	"sort"
	"strconv"
)
var in = NewScanner(os.Stdin, 0)
func main(){
	debug.SetGCPercent(-1)
	N := in.Int()
	a, b := in.ArrayInt(N), in.ArrayInt(N)
	t := 0
	ans := 0
	c := make([]int, N)
	for i := 0; i < N; i++{
		c[i] = b[i] - a[i]
		if c[i] > 0{
			t += c[i]
			ans++
		}
	}
	Eln(c)
	sort.Ints(c)
	Eln(c)
	for i := 0; i < N; i++{
		if c[i] < 0 && t > 0{
			t += c[i]
			ans++
		}
	}
	if t > 0{
		Pln(-1)
	} else{
		Pln(ans)
	}
}
const M7 = 1000000007
type Scanner struct{
	*bufio.Scanner
}
func NewScanner(r io.Reader, x int) *Scanner{
	s := bufio.NewScanner(r)
	s.Split(scanWords)
	if x <= 0{
		x = 1048576
	}
	s.Buffer([]byte{}, x)
	return &Scanner{s}
}
func (s *Scanner) Int() int{
	s.Scan()
	i, e := strconv.ParseInt(s.Text(), 10, 64)
	if e != nil{
		panic(e)
	}
	return int(i)
}
func (s *Scanner) ArrayInt(n int) IntSlice{
	r := make(IntSlice, n)
	for i := 0; i < n; i++{
		r[i] = s.Int()
	}
	return r
}
func isSpace(b byte) bool{
	return b == ' ' || b == '\n' || b == '\r' || b == '\t'
}
func scanWords(d []byte, e bool) (int, []byte, error){
	s := 0
	for s < len(d) && isSpace(d[s]){
		s++
	}
	for i := s; i < len(d); i++{
		if isSpace(d[i]){
			return i + 1, d[s:i], nil
		}
	}
	if e && len(d) > s{
		return len(d), d[s:], nil
	}
	return s, nil, nil
}
func Eln(s ...interface{}){
	fmt.Fprintln(os.Stderr, s...)
}
func Pln(s ...interface{}){
	fmt.Println(s...)
}
type ByteSlice []byte
type IntSlice []int


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

const long long MOD = 1000000007;
const int INF = 1<<29;
const double EPS = 1e-8;
typedef vector<int> vec;
typedef pair<int,int> P;
typedef long long ll;

long long modpow(long long a, long long p = MOD - 2) {
    if (p == 0) return 1;
    long long tmp = modpow(a, p / 2);
    tmp = tmp * tmp % MOD;
    if (p % 2 == 1) tmp = tmp * a % MOD;
    return tmp;
}

long long fact[202020], frev[202020];

long long C(int p, int q){
    if (q < 0 || p < q) return 0;
    return fact[p] * frev[q] % MOD * frev[p - q] % MOD;
}

int main(){
    fact[0] = frev[0] = 1;
    for(int i=1;i<=200000;i++){
        fact[i] = (fact[i - 1] * i) % MOD;
        frev[i] = modpow(fact[i]);
    }

    ll H, W, A, B;
    cin >> H >> W >> A >> B;

    ll ans = 0;
    for(int i=0;i<H-A;i++){
        ll p = C(i+B-1, i);
        ans += (p * C(W-B-1 + H-1-i, H-1-i)) % MOD;
        ans %= MOD;
    }
    cout << ans << endl;

    return 0;
}


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

int main()
{
    string str;
    cin>>str;
    for(int i=0;i<str.size()-1;i++)
    {
        if(str[i]==str[i+1])
        {
            cout<<"Bad"<<"\n";
            return 0;
        }
    }
    cout<<"Good"<<"\n";
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int a,b,c,sum=0;
    scanf("%d %d %d",&a,&b,&c);
    if(a*7+b<=c){
    for(sum=0;c>=a*7+b;sum+=7){
        c-=(a*7+b);
    }
    }
    if(c>a*7){sum+=7;}
    else{
        sum+=c/a;
         if(c%a>0){sum++;}
    }
   
    printf("%d\n",sum);
}


Measured memory_bytes: 2104
def root(x):
    if parent[x] == x:
        return(x)
    else:
        parent[x] = root(parent[x])
        return(parent[x])


def same(x, y):
    return(root(x) == root(y))


def union(x, y):
    x = root(x)
    y = root(y)
    if(x == y):
        return

    parent[x] = min(x, y)
    parent[y] = min(x, y)
    return


n, q = map(int, input().split())

parent = {i: i for i in range(n)}
for _ in range(q):
    com, x, y = map(int, input().split())

    if com == 1:
        print(int(same(x, y)))

    else:
        union(x, y)


Measured memory_bytes: 6204
n = int(input())
d = [input() for i in range(n)]
c = 0
ans = "No"
for i in range(n):
    if d[i][0] == d[i][-1]:
        c += 1
    else:
        c = 0
    if c == 3:
        ans = "Yes"
        break
print(ans)

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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

int n;
int a[100010];
int cnt[100010];

int main(){
  cin>>n;
  rep(i,n){
    cin>>a[i];
    cnt[a[i]-1]++; cnt[a[i]]++; cnt[a[i]+1]++; 
  }
  int res=0;
  rep(i,100010){
    maxch(res,cnt[i]);
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(void)
{
   int n,reverse=0,t;
   scanf("%d",&n);
   t=n;
   while(t!=0)
   {
      reverse=reverse*10;
      reverse=reverse+t%10;
      t=t/10;
   }
   if(n==reverse){
      printf("Yes");
   }
   else{
      printf("No");
   }
   return 0;
}

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

using namespace std;

int main() {
    int n;
    while(cin>>n)
    {
        stack<int> s;
        if(n==0) cout<<"0";
        while(n)
        {
            //cout<<"N="<<n<<endl;
            if(n%2!=0)
            {
                s.push(1);
                n--;
            }
            else s.push(0);
            n=n/(-2);
        }
        while(!s.empty())
        {
            cout<<s.top();
            s.pop();
        }
        cout<<"\n";
    }
    return 0;
}



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

using namespace std;
typedef long long int ll;

int main()
{
    int k, x;
    scanf("%d %d", &k, &x);
    for (int i=x-k+1; i<x+k-1; i++) printf("%d ", i);
    printf("%d\n", x+k-1);
    return 0;
}


Measured memory_bytes: 256
o=input()
e=input()
ans=str()
if len(o)==len(e):
    for i in range(len(o)):
        ans+=o[i]
        ans+=e[i]
    print(ans)
else:
    for i in range(len(o)-1):
        ans+=o[i]
        ans+=e[i]
    ans+=o[-1]
    print(ans)

Measured memory_bytes: 3060
using System;

namespace _111_A
{
    class Program
    {
        static void Main(string[] args)
        {
           string hoge = Console.ReadLine();
            int[] fuge = new int[hoge.Length];
           for(int i = 0; i < hoge.Length; i++)
            {
                fuge[i] = int.Parse(hoge.Substring(i, 1));         
            }
            string answer ="";
            for(int j = 0; j < hoge.Length; j++)
            {
                if (fuge[j] == 1) answer += "9";
                else if (fuge[j] == 9) answer += "1";
            }
            Console.WriteLine(answer);
        }
    }
}


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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repp(i, n, m) for(int (i) = (n); (i) < (m); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define ldou long double
#define fi first
#define se second
#define setpre(x) std::cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ std::cout << " [LOGGER] " << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 100005;

/* ...o(^-^)o... */

vector<int> to[MAX], rev[MAX];
bool used[MAX];
int dp[MAX];

int main(){
    int n, m; cin >> n >> m;
    rep(i, m){
        int x, y; cin >> x >> y;
        x--; y--;
        to[x].push_back(y);
        rev[y].push_back(x);
    }

    vector<int> tps; queue<int> que;
    rep(i, n) if(rev[i].empty()) que.push(i);

    while(!que.empty()){
        int s = que.front(); que.pop();
        tps.push_back(s); used[s] = true;
        for(int t : to[s]){
            bool ok = true;
            for(int u : rev[t]) if(!used[u]) ok = false;
            if(ok) que.push(t);
        }
    }

    rep(i_, n){
        int i = tps[i_];
        for(int j : rev[i]) dp[i] = max(dp[i], dp[j]+1);
    }

    int ans = 0;
    rep(i, n) ans = max(dp[i], ans);
    out(ans);
}

Measured memory_bytes: 12156
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
	int n,i,x=0;
	double k,a;
	cin>>n>>k;
	for(i=1;i<=n;i++)
	{
		cin>>a;
		if(a>=k)
		x++;
	}
	cout<<x;
	return 0;
}

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

using namespace std;

int main(void) {
    int N;
    cin >> N;
    int X[N];
    for (int i = 0; i < N; ++i) {
        cin >> X[i];
    }
    int Y[N];
    for (int i = 0; i < N; ++i) {
        Y[i] = X[i];
    }
    sort(X, X + N);

    double mid = ((double) (X[(N / 2) - 1] + X[N / 2])) / 2;
//    cout << mid << endl;
    for (int i = 0; i < N; ++i) {
        if (Y[i] <= mid) {
            cout << X[N / 2] << endl;
        } else {
            cout << X[(N / 2) - 1] << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3712
#include<stdio.h>
#include<string.h>

int main(void){

    unsigned long int a, b, x;
    long long  int a5, b5;
    scanf("%ld", &x);

    for(long long int i = -200; i< 200; i++){
        for (long long int j= -200; j < 200; j++)
        {
            a5 = i * i * i * i * i;
            b5 = j * j * j * j * j;
             if (x == (a5-b5))
            {
                printf("%lld %lld", i, j);
                return 0;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 1736
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>
#include <tuple>
#include <new>

using namespace std;

#define EPS (1e-9)
#define INF (1e9)
#define MOD (ll)(1e9 + 7)
#define PI (acos(-1))
#define REP(i,a,n) for(int i=a;i<n;i++)
#define rep(i, n) REP(i,0,n)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" ; "IMPOSSIBLE")

using ll = long long int;

ll gcd(ll a, ll b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll beki(ll a, ll b) {
    ll tmp = 1;
    rep(i, b) tmp *= a;
    return tmp;
}

ll modPow(ll x, ll a) {
    if (a == 1) return x;
    if (a % 2) return (x * modPow(x, a - 1)) % MOD;
    ll t = modPow(x, a / 2);
    return ((t % MOD) * (t % MOD)) % MOD;
}

ll modInv(ll x) {
    return modPow(x, MOD - 2);
}

int main() {
    string S;
    cin >> S;
    int ans = 0, tmp = 0;
    rep(i, 3) {
        if (S[i] == 'R') tmp++;
        else tmp = 0;
        ans = max(ans, tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3592
function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    N = Number(input.split(" ")[0]);
    Y = Number(input.split(" ")[1]);
    output = "-1 -1 -1";
   
    for(i =0;i < N+1; i++){
        for(j =0;j < N+1; j++){
            pattern = 10000*i + 5000*j + 1000*(N - i -j);    
            k = N-i-j;
            if(pattern == Y && k >=0){
                output = i + " " + j + " "+ k;
                break;
            }
        }
        if(output !== "-1 -1 -1"){
            break;
        }
    }
    console.log(output);
}
    

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
h, w = map(int, input().split())
mass = []
for i in range(h):
    x = input()
    mass.append([])
    for j in range(w):
        mass[i].append(x[j])

init = []
for i in range(h):
    # x = input()
    init.append([])
    for j in range(w):
        init[i].append(0)

for i in range(h):
    for j in range(w):
        if mass[i][j] != "#":
            # up
            if i + 1 < h and mass[i + 1][j] == "#":
                init[i][j] += 1
                # down
            if i - 1 >= 0 and mass[i - 1][j] == "#":
                init[i][j] += 1
                # right
            if j + 1 < w and mass[i][j + 1] == "#":
                init[i][j] += 1
                # left
            if j - 1 >= 0 and mass[i][j - 1] == "#":
                init[i][j] += 1
            if j + 1 < w and i + 1 < h and mass[i + 1][j + 1] == "#":
                init[i][j] += 1

            if i - 1 >= 0 and j - 1 >= 0 and mass[i - 1][j - 1] == "#":
                init[i][j] += 1

            if i + 1 < h and j - 1 >= 0 and mass[i + 1][j - 1] == "#":
                init[i][j] += 1

            if i - 1 >= 0 and j + 1 < w and mass[i - 1][j + 1] == "#":
                init[i][j] += 1
        else:
            init[i][j] = "#"
res = []
for i in range(h):
    for j in range(w):
        res.append(str(init[i][j]))
    print(''.join(res))
    res = []


Measured memory_bytes: 3188
#include <iostream>

int main(int argc, char const* argv[])
{
    int n;
    std::string s,t;
    std::cin >> n >> s >> t;

    for (int i = 0; i < n; i++) {
        std::cout << s[i] << t[i];
    }
    std::cout << std::endl;

    return 0;
}


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

int main() {
  char a[20] = "000";
  cin >> a;
  int x = 0;
  for(int i = 0; i < 20 && a[i] != '\0'; i++) {
    if(a[i] == '1') {
      x++;
    }
  }
  cout << x << endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.util.Arrays;
import java.util.Collections;
// import java.io.BufferedReader;
// import java.io.IOException;
// import java.io.InputStreamReader;
// import java.util.ArrayList;
// import java.util.Arrays;
// import java.util.Collections;
// import java.util.List;
// import java.util.HashSet;
// import java.util.Set;
// import java.util.Map;
// import java.util.HashMap;

import java.math.*;

public class Main {
    private static Scanner sc;
    private static final long mod = 1000000007;

    public static void main(final String[] args) {
        final Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private static String getUpperAlpha(int i) {
        return String.valueOf((char) (i + 64));
    }

    /* i=1 return a */
    private static String getLowerAlpha(int i) {
        return String.valueOf((char) (i + 96));
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null)
                br.close();
        }

        public String next() throws IOException {
            if (i < s.length)
                return s[i++];
            String st = br.readLine();
            while (st == "")
                st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }

        public long[] nextLongArray(int n) throws NumberFormatException, IOException {
            long[] ret = new long[n];
            for (int i = 0; i < n; i++) {
                ret[i] = nextLong();
            }
            return ret;
        }

        public int[] nextIntArray(int n) throws NumberFormatException, IOException {
            int[] ret = new int[n];
            for (int i = 0; i < n; i++) {
                ret[i] = nextInt();
            }
            return ret;
        }
    }

    private void solve() {
        try {
            int n = sc.nextInt();
            if(n>=30){
                System.out.println("Yes");  
            }else{
                System.out.println("No");
            }


    

        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}


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

using namespace std;

int main() {

    int age,price,pay;
    cin >> age >> price;

    if(age >= 13){ pay = price;}
    else if(age >= 6){ pay = price/2;}
    else {pay = 0;} 

    cout << pay << endl;
    return 0;
}

Measured memory_bytes: 256
import heapq
t = int(input())
for _ in range(t):
    n = int(input())
    lefts = [[] for _ in range(n)]
    rights = [[] for _ in range(n)]
    ans = 0
    for i in range(n):
        k, l, r = map(int, input().split())
        k -= 1
        if l >= r:
            ans += r
            lefts[k].append(l-r)
        else:
            ans += l
            rights[k].append(r-l)
    l_queue = []
    heapq.heapify(l_queue)
    for i in range(n):
        for j in range(len(lefts[i])):
            ans += lefts[i][j]
            heapq.heappush(l_queue,lefts[i][j])
        while len(l_queue) > i+1:
            m = heapq.heappop(l_queue)
            ans -= m
    r_queue = []
    heapq.heapify(r_queue)
    for i in range(n):
        for j in range(len(rights[n-i-1])):
            ans += rights[n-i-1][j]
            heapq.heappush(r_queue, rights[n-i-1][j])
        while len(r_queue) > i:
            m = heapq.heappop(r_queue)
            ans -= m
    print(ans)

Measured memory_bytes: 108144
class Union_Find():
  def __init__(self, n):
    self.par = list(range(n))
    self.size = [-1] * n
    self.rank = [0] * n
  def root(self, x):
    if self.par[x] == x:
      return x
    else:
      self.par[x] = self.root(self.par[x])
      return self.par[x]
  def unite(self, x, y):
    root_x = self.root(x)
    root_y = self.root(y)
    if root_x == root_y:
      pass
    else:
      if self.rank[root_x] > self.rank[root_y]:
        self.par[root_y] = root_x
        self.rank[root_x] += 1
        self.size[root_x] += self.size[root_y]
      else:
        self.par[root_x] = root_y
        self.rank[root_y] += 1
        self.size[root_y] += self.size[root_x]
        
        
  def same(self, x, y):
    root_x = self.root(x)
    root_y = self.root(y)
    return root_x == root_y
  def count_size(self, x):
    # 根を共有している要素の数を数える。
    return self.size[self.root(x)]
 
N, M = list(map(int, input().split()))
uf = Union_Find(N)
bridge_list = []
inconv_list = [0] * (M + 1)
inconv_list[0] = N * (N - 1) //2
for _ in range(M):
  a, b = list(map(int, input().split()))
  bridge_list.append((a-1, b-1))
bridge_list.reverse()
for i in range(M):
  x, y = bridge_list[i]
  if uf.same(x, y):
    inconv_list[i+1] = inconv_list[i]
  else:
    Nx = uf.count_size(x)
    Ny = uf.count_size(y)
    inconv_list[i+1] = inconv_list[i] - Nx * Ny
    uf.unite(x, y)
 
inconv_list.sort()  
 
for i in range(1, M+1):
  print(inconv_list[i])

Measured memory_bytes: 24320
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a[2020],l,r;
	cin>>l>>r;
	if((r-l+1)>=2019)
	{
		cout<<"0";
		return 0;
	}
/*	for(int i=l;i<=r;i++)
	{
		a[i-l]=i%2019;
	}
	sort(a,a+r-l+1);
	cout<<(a[0]*a[1])%2019;
*/	
    int min = 2019;
    int modResult;
	for(int i = l;i<r;i++)
	{
		for(int j = i+1;j<=r;j++)
		{
			modResult = (((i%2019)*(j%2019))%2019);
			if(modResult<min)
			{
				min = modResult;
			}
		}
	}
	cout<<min;
	return 0;	
}

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

int length();

char x[1001], y[1001];

int length() {
	int i, j;
	int m = strlen(x);
	int n = strlen(y);
	int c[1001][1001];
	
	
	for ( i = 1; i <= m; i++) {
		c[i][0] = 0;
	}
	for ( j = 0; j <= n; j++) {
		c[0][j] = 0;
	}
	for ( i = 1; i <= m; i++) {
		for ( j = 1; j <= n; j++) {
			if ( x[i - 1] == y[j - 1]) {
				c[i][j] = c[i - 1][j - 1] + 1;
			} else if (c[i - 1][j] >= c[i][j -1]) {
				c[i][j] = c[i - 1][j];
			} else {
				c[i][j] = c[i][j - 1];
			}
		}
	}
	return c[m][n];
}

int main() {
	int i, l;
	
	scanf("%d", &l);
	for( i = 0; i < l; i++) {
		scanf("%s", &x);
		scanf("%s", &y);
		printf("%d\n" ,length());
	}
	return 0;
}

Measured memory_bytes: 5620
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define sci(x) scanf("%d",&x);
#define scd(x) scanf("%lf",&x);

int main()
{
    int n,k,ans=0;
    cin>>n>>k;
    while(n!=0)
    {
        ans++;
        n=n/k;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <random>
#include <numeric>

using namespace std;
typedef long long ll;

const int MOD = 1000000007;
const int MAX = 500000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++){
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
long long COM(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

long long FAC(int n){
  return fac[n];
}

long long FINV(int n){
  return finv[n];
}

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main() {
  ll N,M,K;
  cin>>N>>M>>K;

  COMinit();

  ll sum=0ll;
  for(int d=0;d<N;d++){
    sum+=d*(N-d)*M*M;
    sum%=MOD;
  };
  for(int d=0;d<M;d++){
    sum+=d*(M-d)*N*N;
    sum%=MOD;
  };
  cout<<sum*COM(N*M-2,K-2)%MOD<<endl;

}

Measured memory_bytes: 11904
#include <stdio.h>


int main()
{
    int n,i,a=0;
    char c[100];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%c",&c[i]);
    }
    for(i=0;i<=n;i++){
        if(c[i]=='Y'){printf("Four\n");return 0;}
    
    }
    printf("Three\n");
    

    return 0;
}

Measured memory_bytes: 128
def max(a,b)
  if a<b
    return b
  else
    return a
  end
end

n,w=gets.chomp.split(/ /).map{|i| i.to_i}
vi=Array.new(n+1)
wi=Array.new(n+1)
for i in 1..n
  vi[i],wi[i]=gets.chomp.split(/ /).map{|i| i.to_i}
end
d=Array.new(n+1).map{Array.new(w+1,0)}
for i in 0..w
  d[0][i]=0
end
for i in 0..n
  d[i][0]=0
end
for i in 1..n
  for j in 1..w
    if j>=wi[i]
      d[i][j]=max(d[i-1][j-wi[i]]+vi[i],d[i-1][j])
    else
      d[i][j]=d[i-1][j]
    end

  end
end
print d[n][w],"\n"

Measured memory_bytes: 16596
#include<bits/stdc++.h>
 
using namespace std;
 
//container util
//------------------------------------------
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
 
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define REACH(i,c) for(typeof((c).end()) i=(c).end(); i!=(c).begin(); --i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).begin(),(c).end(),greater<int>())
 
#define PB(a) push_back(a)
#define PF(a) pop_front(a)
 
#define MP(a,b) make_pair(a,b)
 
#define FS first
#define SE second
 
#define ALL(x) (x).begin(),(x).end()
#define MAX_EL(c) *max_element((c).begin(),(c).end())
#define MIN_EL(c) *min_element((c).begin(),(c).end())
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<long long> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef string str;
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 
//grobal var
//------------------------------------------
const int MAX = 100000*2;
const LL MOD = 100003;
LL fac[MAX],inv[MAX],finv[MAX];


// ---------------calculate combination nCk-----------
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


template< typename T > void modMul(T& a, T b, T mod) { a = (a * b) % mod; }
long long modPow(long long x, long long k) {
	long long ret = 1;	
	while (k > 0) {
		if (k & 1) modMul(ret, x, MOD);
		modMul(x, x, MOD);
		k >>= 1;
	}
	return ret;
}

int main(){
// magic spell------------------------------
  cin.tie(0);
  ios::sync_with_stdio(false);
//------------------------------------------
  int N,X;
  while(cin >> N >> X){
    int ans=1;
    int cur=0;
    REP(i,N){
      int l;
      cin >> l;
      cur += l;
      if(cur<=X) ans++;
    }

    cout << ans << endl;

  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>
int main() {
  long N,A,b,c,d,e,i,ans;
  cin>>N>>A>>b>>c>>d>>e;
 i=min(A,min(b,min(c,min(d,e))));
  
 ans=N/i+5; 
  if(N%i==0) ans--;
  cout<<ans<<endl;
  
}

Measured memory_bytes: 256
S = input()
S = sorted(set(S))
S.append("0")
B =  ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
i = 0
while True:
    if S[i] != B[i]:
        print(B[i])
        break
    i += 1
    if i == 26:
        print("None"  )
        break


Measured memory_bytes: 3316
s = input()
n = len(s)
dp = [0 for _ in range(n)]
dp[-1] = int(s[-1])
memo = 0
cnt_dic = {}
tmp = 1
ans = 0
cnt_dic[0] = 1
for i in range(n-1, -1, -1):
    memo = (memo + int(s[i]) * pow(10, n-i-1, 2019)) % 2019
    if not memo in cnt_dic:
        cnt_dic[memo] = 0
    ans += cnt_dic[memo]
    cnt_dic[memo] += 1

print(ans)

Measured memory_bytes: 87196
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.*;
import java.text.DecimalFormat;

public class Main {
    public static void main(String[] args) throws Exception {
        
        try {
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String buf = br.readLine();
            
            int n = Integer.parseInt(buf);
            
            int result = n / 3;
            
            System.out.println(result);
            
        } catch (Exception e) {
          e.getStackTrace();
          System.exit(-1); // プログラムを終了
        }
        
    }
}


Measured memory_bytes: 22996
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main(){
    int n, i, j, cnt = 0;

    scanf("%d", &n);

    for(i = 1;i < n;i++){
        for(j = 1;j < n;j++){
            if(i * j < n) cnt++;
            else break;
        }
    }

    printf("%d", cnt);

    return 0;
}

Measured memory_bytes: 2152