akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <numeric>
#include <string>

int main() {
  const int MOD = 1000000007;
  uint64_t N = 0, K = 0;
  std::cin >> N >> K;

  uint64_t result = 0;
  for (size_t k = K; k <= N + 1; k++) {
    // uint32_t k_min = (((k - 1) + 0) * k) / 2;
    // uint32_t k_max = (((N - k + 1) + N) * k) / 2;
    // result += (k_max - k_min) + 1;
    result += ((N - k + 1) * k % MOD) + 1;
  }

  std::cout << result % MOD << std::endl;

  return 0;
}

Measured memory_bytes: 3596
#[allow(unused_imports)]
use std::cmp;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    #[allow(unused_mut)]
    let mut s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn solve(pos: &mut Vec<i64>, neg: &mut Vec<i64>) -> i64 {
  if pos.len() == 1 && neg.len() == 1 {
    let n = neg[0];
    let p = pos[0];
    println!("{} {}", p, n);
    p - n
  } else if pos.len() >= neg.len() {
    let p = pos.pop().unwrap();
    let x = solve(neg, pos);
    println!("{} {}", p, x);
    p - x
  } else {
    let n = neg.pop().unwrap();
    let x = solve(pos, neg);
    println!("{} {}", x, n);
    x - n
  }
}

fn main() {
  input! {
    n: usize,
    aa: [i64; n],
  }
  let mut aa = aa;
  aa.sort();
  let sum: i64 = aa.iter().sum();
  let val;
  let mut pos;
  let mut neg;
  if *aa.last().unwrap() < 0 {
    val = - sum + 2 * *aa.last().unwrap();
    pos = vec![*aa.last().unwrap()];
    neg = aa.iter().cloned().take(n-1).collect();
  } else if *aa.first().unwrap() > 0 {
    val = sum - 2 * *aa.first().unwrap();
    pos = aa.iter().cloned().skip(1).collect();
    neg = vec![*aa.first().unwrap()];
  } else {
    val = aa.iter().map(|&x| x.abs()).sum();
    pos = aa.iter().cloned().filter(|&x| x > 0).collect();
    neg = aa.iter().cloned().filter(|&x| x <= 0).collect();
    if pos.len() == 0 {
      let x = neg.pop().unwrap();
      pos.push(x);
    }
  }
  println!("{}", val);
  let stack_size = 104_857_600;
  let thd = std::thread::Builder::new().stack_size(stack_size);
  thd.spawn(move || solve(&mut pos, &mut neg)).unwrap().join().unwrap();
}


Measured memory_bytes: 24316
N = int(input())
T = list(map(int,input().split()))
M = int(input())
P = [0]*M
X = [0]*M
for i in range(M):
    P[i],X[i] =map(int,input().split())
Sum = sum(T)
for i in range(M):
    print(Sum-(T[P[i]-1]-X[i]))

Measured memory_bytes: 62808
# -*- coding: utf-8 -*-
import sys

def main():
	N = int(input())
	
	mochi = []
	for i in range(N):
		tmp = int(input())
		mochi.append(tmp)
	
	new = list(set(mochi))
	new.sort()
	
	print(len(new))
	
		
if __name__ == "__main__":
	main()
	

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

//昇順に並べる挿入ソート
void insertionSort(vector<int> a, int n){
    for(int k=0; k<n; k++){
        cout << a[k];
        if(k!=n-1){
            cout << " ";
        }
    }
    cout << endl;
    
    int v, j;
    for(int i=1; i<n; i++){
        v = a[i];
        j = i-1;
        while(j>=0 && a.at(j)>v){
            a[j+1] = a[j];
            j--;
            a[j+1] = v;
        }
        for(int k=0; k<n; k++){
            cout << a[k];
            if(k!=n-1){
                cout << " ";
            }
        }
        cout << endl;
    }
}

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

    insertionSort(a,n);

}


Measured memory_bytes: 3140
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int len = S.length();
        int[] A = new int[len];
        for(int i = 0; i < len; i++){
            if(S.charAt(i) == 'B'){
                A[i] = 1; //黒は1
            } else {
                A[i] = 0; //白は0
            }
        }
        int ans = 0;
        while(true){
            int i = 0;
            if(A[0] == 1){
                for(i = 0; i < len && A[i] != 0; i++){
                    A[i] = 0;
                }
            } else {
                for(i = 0; i < len && A[i] != 1; i++){
                    A[i] = 1;
                }
                
            }
            ans++;
            if(i == len){
                ans--;
                break;
            }
            if(A[len - 1] == 1){
                for(i = len-1; i >= 0 && A[i] != 0; i--){
                    A[i] = 0;
                }
            } else {
                for(i = len - 1; i >= 0 && A[i] != 1; i--){
                    A[i] = 1;
                }
            }
            ans++;
            if(i == -1){
                ans--;
                break;
            }
        }
        System.out.println(ans);
    }
}


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

int main(){
  int N;
  cin>>N;
  std::vector<int> p(N);
  for(int i=0;i<N;i++)cin>>p[i];
  int ans=0;
  for(int i=0;i<N;i++){
    if(p[i]==i+1){
      if(i<N-1){
        if(p[i+1]==i+2){
          ans++;
          i++;
        }
        else ans++;
      }
      else ans++;
    }
  }
  cout<<ans<<endl;
}


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

#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n - 1; i > -1; --i)
#define all(a) begin(a), end(a)
#define rall(a) rbegin(a), rend(a)
using namespace std;
const long long INF = 1000000000;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<int, int> P;

const int MAX = 210000;

ll 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;
    }
}

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

ll 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;
}

int main() {
    ll n, m;
    cin >> n >> m;
    if(n == 1 || m == 1){
        cout << 1 << endl;
        return 0;
    }
    ll ans = 1;
    COMinit();
    vector<pair<ll, ll>> v = prime_factorize(m);
    rep(i, v.size()){
            ans = (ans * COM(v[i].second + n - 1, n - 1)) % MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 5120
s = input()
t = input()

idx = -1
count = 0
if set(t) <= set(s):
    for i in t:
        idx = s.find(i, idx+1)
        if idx == -1:
            idx = s.find(i)
            count += 1
    pdc = count * len(s)
    print((idx + 1) + pdc)
else:
    print(-1)

Measured memory_bytes: 3444
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char[] w = in.next().toCharArray();
        int[] v = new int[26];
        for (char x : w) ++v[x - 'a'];
        for (int x : v) {
            if (x % 2 != 0) {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }

}


Measured memory_bytes: 21844
#include <algorithm>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;

int main() {
  int n;
  cin >> n;
  map<string, ll> ma;

  rep(i, n) {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if (ma.count(s) == 0)
      ma[s]++;
    else
      ma[s] += 1;
  }

  ll res = 0;
  for (auto it : ma) res += it.second * (it.second - 1) / 2;
  cout << res;
  return 0;
}


Measured memory_bytes: 11136
#include <stdio.h>

int main(void)
{
	int N,i,j;
	scanf("%d",&N);

	int point[N+1], //point[]????????????????????????????????\????????´???
	    a,b,c,d,
	    rank[N+1]; //rank[]?????????????????????????????\????????´??? 
	for(i=1;i<N+1;i++)
	{
		point[i]=0;
		rank[i]=1;
	}
	for(i=1;i<=N*(N-1)/2;i++)
	{
		scanf("%d %d %d %d",&a,&b,&c,&d);
		if(c>d)point[a]=point[a]+3;
		if(c==d)
		{
			point[a]++;
			point[b]++;
		}
		if(c<d)point[b]=point[b]+3;
	}
	
	for(i=1;i<=N;i++)
	{
		for(j=1;j<=N;j++)if(point[i]<point[j])rank[i]++;
	}
	for(i=1;i<=N;i++)printf("%d\n",rank[i]);
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  
  vector<int> A(N);
  for (int i = 0; i < N; i++){
    cin >> A.at(i);
  }
  
  long long int ans = 0; 
  for (int i = 1; i < N; i++){
    if (A.at(i - 1) > A.at(i)){
      ans += A.at(i - 1) - A.at(i);
      A.at(i) = A.at(i - 1);
    }
  }
  
  cout << ans << endl;
}

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

int main(){
   string str;
   while(cin >> str){
      for(int i=0;i<str.length();i++){
	 str[i] = (str[i] - 'A' +23)%26 + 'A';
      }
      cout << str << endl;
   }
   return 0;
}

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

using namespace std;

const double PI = 3.141592653589;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define int long long
#define ll long long
#define ll long long
#define all(c) (c).begin(),(c).end()
#define M 1000000007
#define INF LLONG_MAX
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ", "; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
// Use pr(a,b,c,d,e) or cerr<<anything or prc(v.begin(),v.end()) or prc(v,v+n)
//  


int32_t main()
{
    fastio;
    //freopen("file.in", "r", stdin);
    //freopen("file.out", "w", stdout);
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); ++i)
    {
    	/* code */
    	if(s[i] == '?') cout << 'D';
    	else cout << s[i];
    }
    cout << "\n";
    return 0;
}



Measured memory_bytes: 3740
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

typedef long long ll;
constexpr double PI = 3.141592653589793;
constexpr ll INF = 1e18 + 10;
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;
}

using namespace std;
//    cout << setprecision(20) << ans << "\n";

int main()
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n;
    cin >> n;
    ll result = 1;
    ll a[n];
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        if (a[i] == 0)
        {
            cout << 0 << "\n";
            return 0;
        }
    }

    for (int i = 0; i < n; i++)
    {
        if (log10(result) + log10(a[i]) > 18 || result * a[i] > ll(1e+18))
        {
            cout << -1 << "\n";
            return 0;
        }
        result *= a[i];
    }

    cout << result << "\n";
    return 0;
}


Measured memory_bytes: 4696
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <set>   
//#include <boost/math/common_factor_rt.hpp>

#define ll long long

using namespace std;

int main() {
	int n, ans = 0;
	int s[105] = {};

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

	for (int i = 0; i < n; i++)
	{
		ans += s[i];
	}
	sort(begin(s), end(s) , greater<int>());

	if (ans % 10 != 0) {
		cout << ans << endl;
		return 0;
	}
	
	for (int i = n - 1; i >= 0; i--)
	{
		if (s[i] % 10 != 0) {
			ans -= s[i];
			break;
		}
	}

	if (ans % 10 != 0) {
		cout << ans << endl;
	}
	else {
		cout << 0 << endl;
	}
	

}

int dsum(ll a) {
	int ans = 0;
	while (a != 0) {
		ans += a % 10;
		a /= 10;
	}
	return ans;
}


Measured memory_bytes: 888
import java.util.Scanner;

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

        if ( a < b ) {
        	System.out.println("a < b");
        }else if ( a > b ) {
        	System.out.println("a > b");
        }else {
        	System.out.println("a == b");
        }


		sc.close();

	}
}



Measured memory_bytes: 26140
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<55;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const vi emp;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,-0};
const int DX[8]={-1,-1,-1,0,0,1,1,1},DY[8]={1,0,-1,1,-1,1,0,-1};

int n,l,q;
vi a;

int main(){
	cin>>n;
	a=vi(n);
	for(int i=0;i<n;i++) cin>>a[i];
	cin>>l;
	vvi dp(18,vi(n));
	for(int i=0;i<18;i++) for(int j=n-1;j>=0;j--){
		if(!i) dp[i][j]=upper_bound(a.begin(),a.end(),a[j]+l)-a.begin()-1;
		else dp[i][j]=dp[i-1][dp[i-1][j]];
	}
	cin>>q;
	for(int i=0;i<q;i++){
		int A,B;
		cin>>A>>B;
		A--;B--;
		if(A>B) swap(A,B);
		int ans=0,now=A;
		for(int i=17;i>=0;i--) if(dp[i][now]<B){
			now=dp[i][now];
			ans+=1<<i;
		}
		cout<<ans+1<<endl;
	}
}

Measured memory_bytes: 8312
/********************************************************************************
	
	Code by a weak man who named CYJian, and he hopes the code can get more points.

	Algorithm: 

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

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

//{{{ FAST IO AND SOME FUNCTIONS
const int __SIZE = 1 << 18;
char ibuf[__SIZE], *iS, *iT;

#define ge (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS++)) : *iS++)
#define ri read_int()
#define rl read_ll()
#define ra read_alpha()
#define FILE(s) freopen(s"in", "r", stdin), freopen(s"out", "w", stdout)

template<typename T>
inline void read(T &x) {
	char ch, t = 0; x = 0;
	while(!isdigit(ch = ge)) t |= ch == '-';
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = ge;
	x = t ? -x : x;
}
inline char read_alpha() { char c = ge; while(!isalpha(c) && c != EOF) c = ge; return c; }
inline int read_int() { int x; return read(x), x; }
inline ll read_ll() { ll x; return read(x), x; }

template<typename T> inline void chkmin(T&a, T b) { a = a < b ? a : b; }
template<typename T> inline void chkmax(T&a, T b) { a = a > b ? a : b; }
//}}}

const int MAXN = 200010;

int main() {
#ifdef LOCAL
	FILE("");
#endif
	int n = ri;
	if(!(n ^ (n & -n))) return puts("No"), 0;
	printf("Yes\n%d %d\n", n + 1, 2);
	for(int i = 3; i <= n; i += 2)
		printf("1 %d\n%d %d\n1 %d\n%d %d\n", i, i, i - 1, i - 1 + n, i - 1 + n, i + n);
	if(!(n & 1)) {
		int t1 = n & -n, t2 = n - t1 + 1;
		printf("%d %d\n%d %d\n", t2, n, t1 + n, n << 1);
	}
	return 0;
}

Measured memory_bytes: 2304
l,r=map(int,input().split())
if r-l>=2018:
    print(0)
else:
    L=l%2019
    R=r%2019
    if L<R:
        ans=2020
        for i in range(L,R+1):
            for j in range(i+1,R+1):
                temp=(i*j)%2019
                ans=min(ans,temp)
        print(ans)
    else:
        print(0)


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

using namespace std;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15);
  }
} initializer;

int main() {
  int n;
  cin >> n;
  cout << n * (n + 1) / 2 << endl;
}


Measured memory_bytes: 256
a,b,c,x,y = map(int,input().split())
if x > y:
	z = a
else:
	z = b

ans1 = min(x,y) * min(a + b,c*2) + abs(x-y) * z
ans2 = c * max(x,y) * 2
print(min(ans1,ans2))

Measured memory_bytes: 3060
from itertools import combinations as comb


def main():

    # N = int(input())
    H, W, K = map(int, input().split())
    lst = [[i for i in input()] for _ in range(H)]
    ans = 0

    for h in range(H):
        for w in range(W):
            for i in comb(range(H), h):
                for j in comb(range(W), w):
                    black_sum = 0
                    for k1 in range(H):
                        if k1 in i:
                            continue
                        for k2 in range(W):
                            if k2 in j or lst[k1][k2] == ".":
                                continue
                            black_sum += 1
                    if black_sum == K:
                        # print(f"{i = }, {j = }, {black_sum = }, {ans = }")
                        ans += 1

    print(ans)


if __name__ == '__main__':
    main()

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

using namespace std;

int main(){
  int H1, M1, H2, M2, K;
  cin >> H1 >> M1 >> H2 >> M2 >> K;
  M1 += H1 * 60;
  M2 += H2 * 60;
  M2 -= K;
  
  cout << M2 - M1 << endl;
  
  return 0;
}

Measured memory_bytes: 3592
n = int(input())

if n == 1:
    print(1)
else:
    res_v = [0]*(n + 1)
    res_v_cumsum = [0]*(n + 1)
    res_v[0] = 0
    res_v[1] = 1
    res_v[2] = 1
    res_v_cumsum[0] = 0
    res_v_cumsum[1] = 1
    res_v_cumsum[2] = 2

    M = 1000000007

    for k in range(3, n):
        res_v[k] = (1 + res_v_cumsum[k-1] - res_v[k-2]) % M
        res_v_cumsum[k] = (res_v_cumsum[k-1] + res_v[k]) % M
    #print(res_v)
    print((((res_v_cumsum[n-2] * (((n-1) * (n-1)) % M)) % M) + ((res_v_cumsum[n-1] * (n-1)) % M) + n + (n-1)*(n-1)%M) % M)

Measured memory_bytes: 82164
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int N = in.nextInt();
            for (int i = 0; i <= N; i += 4) {
                for (int j = 0; j <= N; j += 7) {
                    if (i + j == N) {
                        out.println("Yes");
                        return;
                    }
                }
            }
            out.println("No");
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21460
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll divi[129];
ll vis[129];
map<long double,ll>mp1;
map<ll,ll>mp2;
vector<int>stp[29];
string str1;
string str2;
ll arra[100007];
deque<ll>save;
ll ans1[100005];
ll ans2[100005];
ll inp1[200009];
ll inp2[200009];
pair<ll,ll>sol;
//map<pair<ll, ll>, ll> mp3;
map<char,ll>mp3;
map<ll,ll>L;
map<ll,ll>R;
vector<ll>c_pg[1009];
ll x_p[1009];
ll y_p[1009];
ll x_last[1009];
ll y_last[1009];
int main()
{
  ll i,j,k,l,p=0,q=0,r=0,s=0,t,m,n,check=1,x=0,y=1,z=0,a=0,b=0,c=0,zero=0;
  cin>>x>>n;
  for(i=1;i<=n;i++)
  {
     cin>>j;
     a=a+j;	
  }
  if(x>a)
   cout<<"No"<<'\n';
   else
   cout<<"Yes"<<'\n';
 
     
  
   
  
    	
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> // sort
#include <map> // pair
#include <queue>
#include<iomanip>
#include <cmath>
#include <set>

#define ABS(x) ((x)>0?(x):-(x))
#define MIN(x,y) ((x)>(y)?(y):(x))

using namespace std;
typedef long long ll;

ll newton(long long int a, long long int  b)
{
	if(a==b)
		return a;
	while(a != 0 && b != 0)
	{
		if(a > b)
		{
			b += a;
			a = b-a;
			b -= a;
		}
		b %= a;
	}
	return a;
}

struct UnionFind {
	vector<int> p;
	UnionFind(int N):p(N)
	{
		for(int i=0; i< N; i++)
		{
			p[i] = i;
		}
	}
	int root(int x)
	{
		if(p[x] == x)
			return x;
		return p[x] = root(p[x]);
	}
	void unite(int x, int y)
	{
		int rx = root(x);
		int ry = root(y);
		if(rx == ry) return;
		p[rx] = ry;
	}
	bool issame(int x, int y)
	{
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};

//大きな数に対する割り算をするとき、MODを指定することで掛け算の値に変換できる

ll div2mul_calc(ll a, ll b, ll m)
{
	if (b == 0) {
        return 1;
    } else if (b % 2 == 0) {
        ll d = div2mul_calc(a, b / 2, m);
        return (d * d) % m;
    } else {
        return (a * div2mul_calc(a, b - 1, m)) % m;
    }
}
ll div2mul(ll n, ll mod)
{
	return div2mul_calc(n, mod-2, mod);
}

	int mp[2010][2010] = {0};
	int tot[2010][2010] = {0};
	int tot2[2010][2010] = {0};
int main()
{
	int H,W;
	int i,j,k,n;
	cin >> H >> W;
	for(i=0;i<H;++i)
	{
		string s;
		cin >> s;
		for(j=0;j<W;++j)
		{
			if(s[j]=='#')
				mp[i][j] = 1;
		}
	}
	for(i=0;i<H;++i)
	{
		k = 0;
		for(j=0;j<W;++j)
		{
			if(mp[i][j] == 1)
			{
				for(n=0;n<k;++n)
				{
					tot[i][j-n-1] = k;
				}
				k = 0;
			}
			else
			{
				++k;
			}
		}
		for(n=0;n<k;++n)
		{
			tot[i][W-n-1] = k;
		}
		k = 0;
	}
	for(i=0;i<W;++i)
	{
		k = 0;
		for(j=0;j<H;++j)
		{
			if(mp[j][i] == 1)
			{
				for(n=0;n<k;++n)
				{
					tot2[j-n-1][i] = k;
				}
				k = 0;
			}
			else
			{
				++k;
			}
		}
		for(n=0;n<k;++n)
		{
			tot2[H-n-1][i] = k;
		}
		k = 0;
	}
	int ans = 0;
	for(i=0;i<H;++i)
	{
		for(j=0;j<W;++j)
		{
			if(ans < tot[i][j]+tot2[i][j] && mp[i][j] == 0)
			{
				ans = tot[i][j]+tot2[i][j];
			}
		}
	}
	cout << ans-1 << endl;

	return 0;
}




































Measured memory_bytes: 47488
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
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;
}
vector<vector<ll>> mul(vector<vector<ll>> &a, vector<vector<ll>> &b, int n){
    vector<vector<ll>> c(n,vector<ll>(n,0));
    rep(i,n)rep(j,n)rep(k,n){ (c[i][k] += a[i][j]*b[j][k]) %= MOD;}
    return c;
}

int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k;cin>>n>>k;
    vector<vector<ll>> mat(n,vector<ll>(n)), res(n,vector<ll>(n,0));
    rep(i,n) res[i][i] = 1;
    rep(i,n){
        rep(j,n){
            cin>>mat[i][j];
        }
    }
    while(k){
        if(k&1) {res = mul(res, mat, n);}
        mat = mul(mat, mat, n);
        k /= 2;
    }
    ll ans = 0;
    rep(i,n) rep(j,n) {(ans += res[i][j]) %= MOD;}
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#AGC016-A
from collections import Counter 
s = input()
alphabet = "abcdefghijklmnopqrstuvwxyz"

result = []
if len(set(s)) == 1:
    result.append(0)
for i in alphabet:
    s_tmp = s 
    cnt = 0
    for k in range(len(s_tmp)):
        s_new= ""
        for j in range(len(s_tmp)-1):
            if s_tmp[j] == i or s_tmp[j+1] == i:
                s_new += i
            else:
                s_new += s_tmp[j]
        cnt += 1
        if len(set(s_new)) == 1:
            result.append(cnt)
            break        

        s_tmp = s_new
        
            
 

#print(result)
print(min(result))



Measured memory_bytes: 9196
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

public class Main {

	public static void main(String[] args) throws IOException {

		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

			String inputLine;
			Integer line = 1;
			while ((inputLine = br.readLine()) != null) {

				if(line.equals(1)) {
					line++;
					continue;
				}

				final String[] inputs = inputLine.split(" ");

				final List<String> inputsList = Arrays.asList(inputs);

				final List<Long> numbers = inputsList.stream()
						.map(e -> Long.valueOf(e)).collect(Collectors.toList());

				final Long min = numbers.stream().min(Comparator.naturalOrder()).get();
				final Long max = numbers.stream().max(Comparator.naturalOrder()).get();
				final Long sum = numbers.stream().reduce((x, y) -> x + y).get();

				System.out.format("%d %d %d\n", min, max, sum);
			}
		}
	}
}


Measured memory_bytes: 33980
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N, M int
	fmt.Scan(&N, &M)
	m := make(map[int]int)
	for i := 0; i < N; i++ {
		var a, b int
		fmt.Scan(&a, &b)
		m[a] += b
	}
	var ks []int
	for k := range m {
		ks = append(ks, k)
	}
	sort.Ints(ks)
	rest := M
	sum := 0
	for _, v := range ks {
		if rest <= m[v] {
			sum += v * rest
			break
		} else {
			sum += v * m[v]
			rest -= m[v]
		}
	}
	fmt.Println(sum)
}


Measured memory_bytes: 10752
#include<stdio.h>
#include<math.h>
long long int arr[1000002];
int main(){
	long long int n,q,l=1000000000000,i,r;
	 
	scanf("%lld",&n);
	for(i=1;i<=sqrt(n);i++){
		r=n%i;
		q=n/i;
		if(r==0){
			arr[i]=q+i;
arr[i]=arr[i]-2;

	if(arr[i]<l){
		l=arr[i];
	}
		}
	}
	printf("%lld",l);


return 0;
	


}

Measured memory_bytes: 6656
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

struct NodeRoute {
	const unsigned int next_node;
	const int cost;
	NodeRoute(const unsigned int& nn, const int& co) : next_node(nn), cost(co) {};
};

enum Color {
	NONE = -1,
	WHITE = 0,
	BLACK = 1,
};

bool ColorCheckBLACK(const Color& cu_color, int cost) {
	int t_cost = (static_cast<int>(cu_color) + cost) % 2;
	return (t_cost == 1) ? true : false;
}

int main() {
	int N;
	cin >> N;

	vector<vector<NodeRoute>> v_node_route(N);
	for (int i = 0; i < N - 1; i++) {
		unsigned int u;
		cin >> u;
		unsigned int v;
		cin >> v;
		int cost;
		cin >> cost;
		v_node_route[u - 1].push_back(NodeRoute(v - 1, cost));
		v_node_route[v - 1].push_back(NodeRoute(u - 1, cost));
	}

	vector<Color> answer(N, NONE);

	queue <unsigned int> q_current_pos;
	q_current_pos.push(0);
	unsigned int current_pos = q_current_pos.front();
	answer[0] = WHITE;

	while (!q_current_pos.empty()) {
		current_pos = q_current_pos.front();
		q_current_pos.pop();
		for (size_t i = 0; i < v_node_route[current_pos].size(); i++) {
			unsigned int next_pos = v_node_route[current_pos][i].next_node;
			int route_cost = v_node_route[current_pos][i].cost;
			if (answer[next_pos] == NONE) {
				q_current_pos.push(next_pos);
				answer[next_pos] = ColorCheckBLACK(answer[current_pos], route_cost) ? BLACK : WHITE;
			}
			else{
				continue;
			}
		}
	}
	for (auto itr = answer.begin(); itr != answer.end(); itr++) {
		cout << *itr << endl;
	}
	return 0;
}

Measured memory_bytes: 6784
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

int main() {
    int N, K;
    cin >> N >> K;
    vector<Int> H;
    for (int i = 0; i < N; i++) {
        Int h;
        cin >> h;
        H.push_back(h);
    }
    sort(H.begin(), H.end());
    Int ans = 0;
    for (int i = 0; i < N - K; i++) {
        ans += H[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2420
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset

#include <math.h>
#include <stdlib.h>


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

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_MAX	2,147,483,647 = 2*1.0e9

int main(){
  int A, B;
  cin >> A >> B;

  cout << (A-1) * (B-1) << endl;
  
  return 0;
}


Measured memory_bytes: 256
#ALDS1_2_A
n = int(input())
a = [int(i) for i in input().split()]
cnt = 0
for ni in range(n):
  for ii in range(n-1,ni,-1):
    if a[ii] < a[ii-1]:
      a[ii], a[ii-1] = a[ii-1], a[ii]
      cnt += 1
print(" ".join([str(i) for i in a]))
print(cnt)


Measured memory_bytes: 5604
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;
#pragma endregion

#pragma region const
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#pragma endregion

#pragma region util
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}
#pragma endregion

#pragma region init
struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

int main()
{
	i64 N,i;
	cin >> N >> i;
	cout << N-i+1 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int num,count;
  count=0;
  cin>>num;
  vector<int> v;
  for(int i=0; i<num;i++){
    int tmp;
    cin>>tmp;
    v.push_back(tmp);
  }
  sort(v.begin(),v.end());
  for(int i=0;i<num-2;i++){
    for(int j=i+1;j<num;j++){
      for(int k=j+1;k<num;k++){
        if(v[i]+v[j]>v[k]){
          count++;
        }else{
          break;
        }
      }
    }
  }
  cout<<count<<endl;
}




Measured memory_bytes: 256
n, m = map(int, input().split())

l = []
r = []

for i in range(m):
  ln, rn = map(int, input().split())
  l.append(ln)
  r.append(rn)
  
lmax = max(l)
rmin = min(r)


ans = rmin - lmax + 1
if (ans < 0):
  ans = 0

print(ans)


Measured memory_bytes: 10996
S = input()

head = S[:2]
tail = S[2:]

s = [head, tail]
i = [int(si) for si in s]
MM = [True, True]

for j in range(2):
    if i[j] > 12:
        MM[j] = False
    if i[j] < 1:
        MM[j] = False

if MM[0] is True and MM[1] is False:
    print('MMYY')
elif MM[0] is False and MM[1] is True:
    print('YYMM')
elif MM[0] is True and MM[1] is True:
    print('AMBIGUOUS')
else:
    print('NA')


Measured memory_bytes: 3064
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
t = 10**6
index = 1

for i in range(N):
    if t > abs(A - (T - (H[i] * 0.006))):
        t = abs(A - (T - (H[i] * 0.006)))
        index = i + 1

print(index)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define leading zero str.erase(0, min(str.find_first_not_of('0'), str.size()-1));
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
string text="abcdefghijklmnopqrstuvwxyz";
const int maxn=1e6+7;
//        .--------------.
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'
bool ugly[100005];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b;
    cin>>a>>b;
    ll n=__gcd(a,b);
    int cnt=0;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0){
            cnt++;
            while(n%i==0)n/=i;
        }
    }
    if(n>1)cnt++;
   if(cnt==0)cout<<cnt+1<<endl;
   else cout<<cnt+1<<endl;
}


Measured memory_bytes: 3628
#[allow(unused_macros)]
macro_rules! invec {
    ( $t:ty ) => {{
        let mut s = String::new();
        match std::io::stdin().read_line(&mut s) {
            Ok(0) => Vec::<$t>::new(),
            Ok(n) => s.trim().split_whitespace().map(|s| s.parse::<$t>().unwrap()).collect::<Vec<$t>>(),
            Err(_) => Vec::<$t>::new(),
        }
    }}
}

#[allow(unused_macros)]
macro_rules! input {
    ( $($t:ty),* ) => {{
        let mut s = String::new();
        std::io::stdin().read_line(&mut s);
        let mut splits = s.trim().split_whitespace();
        ($(
            {
                 splits.next().unwrap().parse::<$t>().unwrap()
            },
        )*)
    }}
}

#[allow(unused_must_use)]
#[allow(unused_variables)]
fn solve() {
    let (a, b) = input!(u32, u32);

    if a == b {
        println!("{}", a + b);
    } else if a < b {
        println!("{}", b * 2 - 1);
    } else {
        println!("{}", a * 2 - 1);
    }
}

fn main() {
    solve();
}


Measured memory_bytes: 4352
#include <cctype>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long int64;
inline int read(int f = 1, int x = 0, char ch = ' ')
{
    while(!isdigit(ch = getchar())) if(ch == '-') f = -1;
    while(isdigit(ch)) x = x*10+ch-'0', ch = getchar();
    return f*x; 
}
const int N = 131072+5;
int n, w[N], ch[2][N], c[N];
int64 d[N], l = 0, r = 1e10, mid, ans, pre[N], dfn[N];
vector<pair<int64, int64> > f[N];
inline bool cmpx(pair<int64, int64> a, pair<int64, int64> b) { return a.first < b.first; }
inline bool cmpy(pair<int64, int64> a, pair<int64, int64> b) { return a.second < b.second; }
void insert(vector<pair<int64, int64> > &ls, vector<pair<int64, int64> > &rs, vector<pair<int64, int64> > &s)
{
    int sy = ls.size(), sz = rs.size();
    if(sy > sz) swap(sy, sz), swap(ls, rs);
    sort(ls.begin(), ls.end(), cmpy);
    sort(rs.begin(), rs.end(), cmpx);
    pre[0] = rs[0].second;
    for(int i = 1; i < sz; ++i) pre[i] = min(pre[i-1], rs[i].second);
    for(int i = 0, j = sz-1; i < sy; ++i)
    {
        while(j >= 0&&ls[i].second+rs[j].first > mid) --j;
        if(j >= 0) s.push_back(make_pair(ls[i].first, pre[j]));
    }
    sort(ls.begin(), ls.end(), cmpx);
    sort(rs.begin(), rs.end(), cmpy);
    pre[0] = rs[0].first;
    for(int i = 1; i < sz; ++i) pre[i] = min(pre[i-1], rs[i].first);
    for(int i = 0, j = sz-1; i < sy; ++i)
    {
        while(j >= 0&&ls[i].first+rs[j].second > mid) --j;
        if(j >= 0) s.push_back(make_pair(pre[j], ls[i].second));
    }
}
bool valid()
{
    for(int i = n; i; --i)
    {
        int x = dfn[i]; if(f[x].size()) f[x].clear();
        if(!c[x]) f[x].push_back(make_pair(d[x], d[x]));
        else
        {
            int y = ch[0][x], z = ch[1][x];
            mid += d[x]<<1;
            insert(f[y], f[z], f[x]);
            mid -= d[x]<<1; f[y].clear(), f[z].clear();
        }       
        if(f[x].empty()) return false; 
    }
    return true;
}
void dfs(int x)
{
    d[x] += w[x], dfn[++n] = x;
    if(!c[x]) return;
    d[ch[0][x]] = d[ch[1][x]] = d[x];
    dfs(ch[0][x]), dfs(ch[1][x]);
}
int main()
{
    n = read(); 
    for(int i = 2; i <= n; ++i)
    {
        int x = read(); w[i] = read();
        ch[c[x]++][x] = i;
    }
    n = 0, dfs(1);
    while(l <= r)
    {
        mid = (l+r)>>1;
        if(valid()) ans = mid, r = mid-1;
        else l = mid+1;
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 30452
object Main {
  def main(args: Array[String]): Unit = {
    val inputs = scala.io.StdIn.readLine.split( " " ).map{ _.toInt }
    var count = 0

    ( inputs( 0 ) to inputs( 1 ) ).foreach{ i =>
      if( i%inputs( 2 ) == 0 ) count += 1
    }
    println( count )
  }
}

Measured memory_bytes: 54616
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <limits>
#include <memory>
#include <queue>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

#define all(a) (a).begin(), (a).end()
#define sz(a) static_cast<int>((a).size())
#define fillchar(a, x) memset(a, x, sizeof(a))
#define rep(i, a, b) for(int i=int(a); i<=int(b); ++i)
#define irep(i, a, b) for(int i=int(a); i>=int(b); --i)
#define replr(i, a, b) rep(i, a, (b)-1)
#define reprl(i, a, b) irep(i, (b)-1, a)
#define repn(i, n) rep(i, 0, (n)-1)
#define irepn(i, n) irep(i, (n)-1, 0)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef long long LL;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
typedef pair<double,double> PDD;
typedef vector<LL> VL;
typedef vector<int> VI;
typedef vector<PII> VPI;
typedef vector<string> VS;
template<class T, class S> ostream& operator<<(ostream& os, const pair<T, S>& v) { return os<<"("<<v.first<<", "<<v.second<<")"; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& v) { os<<"["; repn(i, sz(v)) { if(i) os<<", "; os<<v[i]; } return os<<"]"; }
template<class T> bool setmax(T &_a, T _b) { if(_b>_a) { _a=_b; return true; } return false; }
template<class T> bool setmin(T &_a, T _b) { if(_b<_a) { _a=_b; return true; } return false; }
template<class T> T gcd(T _a, T _b) { return _b==0?_a:gcd(_b,_a%_b); }

int main() {
    int n, a, b;
    string s;
    cin>>n>>a>>b>>s;
    for(char c: s) {
        bool ok=false;
        if(c=='a') {
            if(a>0) --a, ok=true;
            else if(b>0) --b, ok=true;
        } else if(c=='b') {
            if(b>0) --b, ok=true;
        }
        printf("%s\n", ok?"Yes":"No");
    }
    
    return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;
typedef std::pair<double, double> pdd;
using namespace std;

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define loopr(i,a,b) for(ll i=b-1;i>=a;i--)
#define test() ull testcase;cin>>testcase;while(testcase--)
#define pb push_back
#define mkp make_pair
#define nl cout<<"\n"
#define prime 1000000007
#define debug(x) cout<<(#x)<<" : "<<x,nl
#define debug2(x,y) cout<<(#x)<<" : "<<x<<" "<<(#y)<<" : "<<y,nl
#define debug3(x,y,z) cout<<(#x)<<" : "<<x<<" "<<(#y)<<" : "<<y<<" "<<(#z)<<" : "<<z,nl
#define F first
#define S second
#define oa(a,n) loop(i,0,n)cout<<a[i]<<" ";nl;
#define ov(a) loop(i,0,a.size()) cout<<a[i]<<" ";nl;
#define MOD(a) (((a%prime)+prime)%prime)

int MAX = 100005;
int main() 
{
	fastio();
	int n,W;
	cin>>n>>W;
	int wt[n],val[n];
	ll dp[n+1][MAX+1];
	loop(i,0,n)
		cin>>wt[i]>>val[i];
	// memset(dp,0,sizeof(dp));
	loop(i,0,n+1)
		loop(j,0,MAX+1)
			dp[i][j]=INT_MAX;
	loop(i,0,n+1)
		dp[i][0]=0;
	loop(i,0,n)
	{
		loop(j,0,MAX+1)
		{
			dp[i+1][j] = dp[i][j];
			if(j-val[i]>=0)
				dp[i+1][j] = min(dp[i][j-val[i]]+wt[i],dp[i+1][j]);
		}
	}
	for(int j = MAX;j>=0;j--)
	{
		if(dp[n][j]<=W)
		{
			cout<<j,nl;
			break;
		}
	}
	// cout<<W<<" "<<(dp[n][9]),nl;
	// loop(i,0,20)
	// 	cout<<i%10<<" ";nl;
	// loop(i,0,n+1)
	// {
	// 	loop(j,0,20)
	// 	{
	// 		if(dp[i][j]>50)
	// 			cout<<"x ";
	// 		else
	// 			cout<<dp[i][j]<<" ";
	// 	}
	// 		nl;
	// }
	return 0;
}

Measured memory_bytes: 79232
x = 0.0
y = 0.0
c = 0
d = 0
n = 0

t = list(map(int, input().split()))
n = t[0]
d = t[1] * t[1]

for i in range(0, n):
  t = list(map(int, input().split()))
  x = t[0]
  y = t[1]
  t = x * x + y * y
  if t < d or t == d:
    c += 1

print(c)


Measured memory_bytes: 9204
n = gets.to_i
a = []
n.times do
  a << gets.chomp
end
m = gets.to_i
b = []
m.times do
  b << gets.chomp
end
ans = 0
while a != []
  c = a.count(a[0]) - b.count(a[0])
  ans = c if c > ans
  a.delete(a[0])
end
p ans

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

int main(){
    unsigned long long int tf=0,n,a,ans=1,i,MAXLEN=1000000000000000000;

    scanf("%lld",&n);
    for(i=-0;i<n;i++){
        scanf("%lld",&a);
        //printf("%lld\n",a);
        if(a==0){
            printf("0");
            return 0;
        }
        if(MAXLEN/a<ans){ 
            tf=1;
        }
        ans*=a;
    }

    if(tf==1){
            printf("-1");
    }else{
        printf("%lld",ans);
    }


    return 0;
}

Measured memory_bytes: 1736
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.util.*;

public class Main {

    private static FastReader in = new FastReader(System.in);
    private static PrintWriter out = new PrintWriter(System.out);

    private static final long MOD = (long) 1e9 + 7;

    public static void main(String[] args) {
        solve();
        out.flush();
    }

    private static void solve() {
        long a = in.nextLong();
        String b = in.next();
        BigDecimal ba = BigDecimal.valueOf(a);
        ba = ba.multiply(new BigDecimal(b)).divide(BigDecimal.ONE, RoundingMode.FLOOR);
        out.println(ba.longValue());
    }

    // https://www.geeksforgeeks.org/fast-io-in-java-in-competitive-programming/
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        FastReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        // https://qiita.com/masakinpo/items/5f77f2a879578a85a0bb
        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


Measured memory_bytes: 25680
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10**9)
mod = 10**9+7

A,B = I()
if A > 8 or B > 8:
    print(':(')
else:
    print('Yay!')

Measured memory_bytes: 77460
import numpy as np

N, K = map(int, input().split())
A = np.array(input().split(), np.int64)
F = np.array(input().split(), np.int64)
A.sort()
F.sort()
F = F[::-1]
dig = A.sum()


def judge(x):
    return dig - np.minimum(A, x // F).sum() <= K


l = -1
r = 10 ** 18 + 1

while l + 1 < r:
    test = (l + r) // 2
    if judge(test):
        r = test
    else:
        l = test

print(r)

Measured memory_bytes: 37180