akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cmath>
#include <tuple>
#include <bitset>
#include <utility>
#include <climits>
#include <iomanip>

#define push emplace_back
#define each(i, x) for (auto i=0; i < x; i++)
using ull = unsigned long long;
constexpr auto mod = 1000000007;
constexpr auto INF = ULLONG_MAX;

using namespace std;
template <typename T> inline void dump(const T& x) { cout << "[" << x << "]" << endl; }
template <typename T> inline void dump(const vector<T>& x) { for (const auto v : x) { cout << v << " "; } cout << endl; }
template <typename T> inline void sort_asc(vector<T>& x) { std::sort(x.begin(), x.end()); }
template <typename T> inline void sort_desc(vector<T>& x) { std::sort(x.begin(), x.end(), greater<T>()); }
template <typename T> inline T max_value(vector<T>& x) { return *max_element(x.begin(), x.end()); }
template <typename T> inline T min_value(vector<T>& x) { return *min_element(x.begin(), x.end()); }
template <typename T> inline T sum_value(vector<T>& x) { return accumulate(x.begin(), x.end(), 0ULL); }

int main() {
  ull n;
  vector<ull> a;
  cin >> n;
  each(i, n) {
    ull tmp;
    cin >> tmp;
    a.push(tmp);
  }

  vector<ull> r;
  ull tmp = 1;
  each(i, n) {
    if (a[i] == tmp) {
      r.push(a[i]);
      tmp++;
    }
  }

  if (r.size() == 0) {
    cout << -1 << endl;
  } else {
    cout << n - r.size() << endl;
  }


  /*
  sort_asc(a);

  if (a[0] != 1) {
    cout << -1 << endl;
    return 0;
  }
  dump(a);
  ull res = 0;
  ull tmp = 1;
  each(i, n) {
    if (i == 0) {
      continue;
    }

    if (a[i] == (tmp + 1)) {
      tmp++;
      continue;
    } else if (a[i] == (tmp)) {
      res++;
      continue;
    } else {
      res += (n - i);
      break;
    }
  }

  cout << res << endl;
  */

  return 0;
}


Measured memory_bytes: 4848
#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;

int main() {
    int N;
    cin >> N;
    int A[N+1], B[N], beat_here, beat_prev;
    ull ans=0;
    for (int i=0; i<N+1; i++) scanf("%d", &A[i]);
    for (int i=0; i<N; i++) scanf("%d", &B[i]);

    for (int i=N; i>=0; i--) {
        if (i<N) {
            beat_here = min(A[i], B[i]);
            ans += beat_here;
            A[i] -= beat_here;
        }
        if (i>0) {
            beat_prev = min(A[i], B[i-1]);
            ans += beat_prev;
            B[i-1] -= beat_prev;
        }
    }

    cout << ans << endl;

    return 0;
}



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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

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

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

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<" ";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

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

    ll n;
    cin>>n;
    vector<ll> p(n);
    for(ll i=0; i<n; i++) {
        cin>>p[i];
    }
    ll ans=0;
    ll min=p[0];
    for(ll i=0; i<n; i++) {
        if(min>=p[i]){
            ans++;
            min=p[i];
        }
    }
    cout<<ans<<endl;
    return  0;
}


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

#define repu(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a)    for(int i=0;i<a;i++)
#define ll long long
using namespace std;

int main() {
    int r, c, k;
    cin>>r>>c>>k;
    // long long a[r+1][c+1],b[r+1][c+1][4];
    vector<vector<ll>> a(r+1,vector<ll>(c+1,0LL));
    vector<vector<vector<ll>>> b(r+1,vector<vector<ll>>(c+1,vector<ll>(4,0LL)));
    rep(i,k)
    {
        int x, y, z;
        cin>>x>>y>>z;
        a[x][y]=z;
    }
    repu(i,1,r)
    {
        repu(j,1,c)
        {
            b[i][j][3]=max({b[i][j-1][3],b[i][j][3],max({b[i-1][j][3],b[i-1][j][1],b[i-1][j][0]})+a[i][j],b[i][j-1][2]+a[i][j]});
            b[i][j][2]=max({b[i][j-1][2],b[i][j][2],max({b[i-1][j][3],b[i-1][j][1],b[i-1][j][0]})+a[i][j],b[i][j-1][1]+a[i][j]});
            b[i][j][1]=max({b[i][j-1][1],b[i][j][1],max({b[i-1][j][3],b[i-1][j][1],b[i-1][j][0]})+a[i][j],b[i][j-1][0]+a[i][j]});
        }
    }
    // cout<<b[1][4][3]<<endl;
    cout<<max({b[r][c][3],b[r][c][2],b[r][c][1],b[r][c][0]})<<endl;
}

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

const int maxn = 210;
int n, d[maxn], dep[maxn];
vector<int> G[maxn];

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        for (int j = 1, x; j <= n; j++) {
            scanf("%1d", &x);
            if (!x) continue;
            G[i].push_back(j), G[j].push_back(i);
        }
    }
    int ans = -1;
    for (int v = 1; v <= n; v++) {
        queue<int> q;
        memset(dep, 0, sizeof(dep));
        q.push(v), dep[v] = 1;
        int mx = 0;
        while (!q.empty()) {
            int v = q.front(); q.pop();
            mx = max(mx, dep[v]);
            for (int u : G[v]) if (!dep[u]) {
                q.push(u), dep[u] = dep[v] + 1;
            }
        }
        bool flag = 1;
        for (int i = 1; i <= n; i++) {
            for (int j : G[i]) if (abs(dep[i] - dep[j]) ^ 1) {
                flag = 0;
            }
        }
        if (flag) ans = max(ans, mx);
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>


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

    std::vector<int> monster(N);

    for (int i = 0; i < N; i++) {
        std::cin >> monster[i];
    }

    int cnt = 0;

    while (cnt < N - 1) {
        cnt = 0;
        int min_val = 1e9;
        int min_idx = 0;
        for (int i = 0; i < N; i++) {
            if (min_val > monster[i] && monster[i] > 0) {
                min_val = monster[i];
                min_idx = i;
            } 
        }

        for (int i = 0; i < N; i++) {
            if (i == min_idx) continue;
            if (monster[i] - monster[min_idx] > 0) {
                monster[i] = monster[i] % monster[min_idx];
            } else {
                monster[i] = 0;
            }
            if (monster[i] == 0) {
                cnt++;
            }
        }
    }

    for (auto && val : monster) {
        if (val != 0) {
            std::cout << val << std::endl;
            break;
        }
    }
}


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

int main() {
  int n ,d;
  cin>>n>>d;
  vector<vector<int>>x(n,vector<int>(d));
  for(int i=0;i<n;i++){
    for(int j=0;j<d;j++){
      cin>>x.at(i).at(j);
    }
  }
  int ans=0;
  for(int i=1;i<n;i++){
    for(int j=0;j<i;j++){
      int T=0;
      bool test=false;
      for(int k=0;k<d;k++){
        T+=(x.at(i).at(k)-x.at(j).at(k))*(x.at(i).at(k)-x.at(j).at(k));
      }
      for(int q=0;q<300;q++){
        if(T==q*q){
          test=true;
        }
      }
      if(test){
        ans++;
      }
    }
  }
  cout<<ans<< endl;
}
        
        


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


int main(){
    double l;
    cin >> l;
    double x = l/3;
    double ans = pow(x,3);
    printf("%.10f\n", ans);
 return 0;
}


Measured memory_bytes: 256
//Comparison.java
import java.util.Scanner;
class Main
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		String a=sc.next();
        String b=sc.next();

        if(a.length()>b.length()){
            System.out.println("GREATER");
        }
        else if(a.length()<b.length()){
            System.out.println("LESS");
        }
        else{
        
        if(a.compareTo(b)>0){
            System.out.println("GREATER");
        }
        else if(a.compareTo(b)<0){
            System.out.println("LESS");
        }
        else{
            System.out.println("EQUAL");
        }

        }
        sc.close();
    }
}

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

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

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

void doit(){
    ll n,i,c = 100;
    i = 0;
    cin >> n;
    while(c < n){
        c += (c/100);
        i++;
    }
    cout << i;
}

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


Measured memory_bytes: 3588
n = int(input())
v = []
c = []

v = [ int(e) for e in input().split(" ")]
c = [ int(e) for e in input().split(" ")]

value=[]

for i in range(n):
    value.append(v[i] -c[i])

result = 0

for i in value:
    if(i > 0):
        result += i

print(result)

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;

const int MOD = 1000000007;

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<int>> m(H, vector<int>(W, 0));


    rep(i, H) {
        string s;
        cin >> s;
        for (int j = 0; j < s.size(); j++) {
            if (s[j] == '#') m[i][j] = 1;
        }
    }

    vector<bool> h(H, false);
    vector<bool> w(W, false);

    rep(i, H) {
        bool ok = true;
        rep(j, W) {
            if (m[i][j] == 1) {
                ok = false;
                break;
            }
        }
        if (ok) h[i] = true;
    }

    rep(j, W) {
        bool ok = true;
        rep(i, H) {
            if (m[i][j] == 1) {
                ok = false;
                break;
            }
        }
        if (ok) w[j] = true;
    }

    rep(i, H) {
        if (h[i]) continue;
        rep(j, W) {
            if (w[j]) continue;
            if (m[i][j] == 1) {
                cout << "#";
            } else {
                cout << ".";
            }
        }
        cout << endl;
    }
}

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

int main(){
  string S, T;
  cin >> S >> T;
  int cnt = 0;
  int i =0;
  while(S[i])
  {
    if (S[i] != T[i])
      cnt++;
    i++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int n;
  cin >> n;
  vector<vi> a(n, vi(3));
  rep(i, n) rep(j, 3) cin >> a[i][j];
  vector<vi> dp(n + 1, vi(3, 0));
  rep(i, n) rep(j, 3) rep(k, 3) {
    if(j != k) dp[i + 1][j] = max(dp[i + 1][j], dp[i][k] + a[i][j]);
  }
  int ans = 0;
  rep(i, 3) ans = max(ans, dp[n][i]);
  cout << ans << endl;
}

Measured memory_bytes: 11136
#![allow(unused_imports)]

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

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

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

use std::cmp::{min, max};
use std::collections::{HashMap, HashSet, VecDeque, BinaryHeap};

fn main() {
    input!{
        n: usize
    }
    let mut ans = 0;
    for i in 1..n + 1 {
        ans += (n / i) * (i + n / i * i) / 2;
    }
    println!("{}", ans);
}


Measured memory_bytes: 2148
package main

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

const (
	initialBufSize = 10000
	maxBufSize     = 100000000
)

var sc *bufio.Scanner = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	return sc
}()

// var sc = bufio.NewScanner(os.Stdin)
// var buff []byte
//
// func init() {
// 	sc.Split(bufio.ScanWords)
// 	sc.Buffer(buff, 100000000)
// 	log.SetFlags(log.Lshortfile)
// }

func main() {
	input := nextString()
	remSumArray := make([]int, 2019)
	remSumArray[0] = 1
	var num int
	digit := 1
	for i := len(input) - 1; i >= 0; i-- {
		num += int(input[i]-48) * digit
		digit *= 10
		digit %= 2019
		remSumArray[num%2019]++
	}
	var result int
	for _, num := range remSumArray {
		result += num * (num - 1) / 2
	}
	fmt.Println(result)
}

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

func nextFloat64() float64 {
	sc.Scan()
	f, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

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

func nextInts(n int) (r []int) {
	r = make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}

var dy = []int{0, 1, 0, -1}
var dx = []int{1, 0, -1, 0}
var MAX = math.MaxInt32

func pow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}


Measured memory_bytes: 2584
#include <bits/stdc++.h>
#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

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

    int64_t n = s.size();
    int64_t ans = 0;
    for (auto i : irange(0L, n / 2)) {
        if (s[i] != s[n - i - 1]) {
            ++ans;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    a = list(map(int, input().split()))
    l1 = [0]*61
    mod = 10**9+7
    for cnt in range(61):
        l1[cnt] = sum([i % 2 for i in a])
        a = [i//2 for i in a]
    l0 = [n-i for i in l1]
    ans = 0
    for i in range(len(l1)):
        ans = (ans+l0[i]*l1[i]*pow(2, i, mod)) % mod
    print(ans)


main()


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

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

 cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }


long long N;
string M;

map<long long, long long> prime_factor(long long n) {
    map<long long, long long> res;
    for (long long i = 2; i*i <= n; ++i) {
        while (n%i == 0) {
            ++res[i];
            n /= i;
        }
    }
    if (n != 1) res[n] = 1;
    return res;
}

int main() {
    while (cin >> N >> M) {
        if (N == 0) break;
        
        long long num = 0;
        for (int i = 0; i < M.size(); ++i) {
            num *= N;
            if (M[i] <= '9') num += M[i] - '0';
            else num += M[i] - 'A' + 10;
        }
        
        //COUT(num);
        
        map<ll, ll> ma = prime_factor(N);
        long long res = 1LL<<62;
        
        //COUT(res);
        
        EACH(it, ma) {
            long long pr = it->first;
            long long ex = it->second;
            
            long long tmp = 0;
            long long tnum = num;
            while (tnum) {
                tmp += tnum / pr;
                tnum /= pr;
            }
            
            //cout << pr << " : " << tmp << endl;
            
            chmin(res, tmp/ex);
        }
        
        cout << res << endl;
    }
    
    return 0;
}


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

int main(){
	int a[1000000]{};
	bool b[1000000]{};
	a[1]=0;
	int s=0;
	for(int c=2;c<1000000;c++){
		if(b[c]==false){
			s++;
			for(int d=c*2;d<1000000;d+=c)b[d]=true;
		}
		a[c]=s;
	}
	int k;
	while(cin>>k){
	printf("%d\n",a[k]);	
	}}

Measured memory_bytes: 7976
H, W = map(int, input().split())
INF = 10**9
maze = []
for i in range(H):
    maze.append(input())

dist = [[INF for j in range(W)] for i in range(H)]

sy, sx = 0, 0
gy, gx = H - 1, W - 1

dirc = [[0, 1], [1, 0], [0, -1], [-1, 0]]

togo = []
togo.append([sy, sx])
dist[sy][sx] = 0
def bfs():
    while len(togo) > 0:
        y, x = togo.pop(0)
        if y == gy and x == gx:
            break
        for dy, dx in dirc:
            ny = y + dy
            nx = x + dx
            if 0 <= ny < H and 0 <= nx < W and maze[ny][nx] == '.' and dist[ny][nx] == INF:
                togo.append([ny, nx])
                dist[ny][nx] = dist[y][x] + 1
    
    return dist[gy][gx]

ret = bfs()

cnt = 0
for i in range(H):
    for j in range(W):
        if maze[i][j] == '.':
            cnt += 1

if ret == INF:
    print(-1)
else:
    res = cnt-ret-1
    print(res)


Measured memory_bytes: 3064
<?php
fscanf(STDIN, "%d", $n);
fscanf(STDIN, "%s", $s);

$alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

for ($i=0; $i < strlen($s); $i++) { 
    $tmp =  ord($s[$i]) + $n;
    if($tmp > 90){
        $tmp = 65 + ($tmp - 91);
    }
    echo chr($tmp);
}
echo "\n";

?>

Measured memory_bytes: 4604
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

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

    int N;
    string s, t;
    cin >> N >> s >> t;

    for (int i = N; i > 0; --i) {
        if (s.substr(N - i, i) == t.substr(0, i)) {
            cout << 2 * N - i << endl;
            exit(0);
        }
    }
    cout << 2 * N << endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
 
class Program {
    static void Main(string[] args) {
        var N  = int.Parse(Console.ReadLine());
        var A = Console.ReadLine().Split().Select(a => int.Parse(a)).ToArray();
        
        //可能な組み合わせがある場合true
        var flag　=　true;
        
        var dic = new Dictionary<int,int>();
        
        //可能な絶対値の集合
        for(int i = N-1;i >= 0;i -=2){
            dic.Add(i,0);
        }
        
        //それぞれの絶対値となるものが何個あるか
        for(int i = 0;i < A.Length;i++){
            if(dic.ContainsKey(A[i])){
                dic[A[i]] +=1;
            }else{
                flag = false;
                break;
            }
        }
        
        //中央値以外の絶対値が2個あるか
        foreach(KeyValuePair<int, int> item in dic) {
            if(item.Value == 2){
                
            }else if(item.Value ==1 && N%2 == 1 && item.Key == 0){
                
            }else{
                flag = false;
                break; 
            }
        }
        
        if(flag){
            var ans = 1L;
           for(int i = 1; i <= N/2;i++){
               ans = (ans*2)%1000000007;
           } Console.WriteLine(ans);
        }else{
            Console.WriteLine(0);
        }
        
     }
}


Measured memory_bytes: 22624
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
typedef long long ull;
/*
void solver(){

}*/

int main(){

/*    int t;
    cin >> t;
    while(t--){
        solver();
    }
*/

int a,b;
cin >> a >> b;
cout << a*b;

    return 0;
}









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

#define ll long long
//~ #define endl '\n'

void solve(){
	int a[3];
	cin>>a[0]>>a[1]>>a[2];
	for(int i = 0; i<3; i++){
		if(a[i] == a[(i + 1)%3] && a[i] != a[(i + 2)%3]){
			cout<<"Yes"<<endl;
			return;
		}
	}
	cout<<"No"<<endl;
}

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int t = 1;// cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


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

int main(void) {

	int N, A, B;
	cin >> N >> A >> B;
	if (abs(A-B)%2 == 0) {
		cout << "Alice" << endl;
	} else {
		cout << "Borys" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
cin>>a>>b>>c;
int t=max(abs(a-b),abs(b-c));
//int t2=abs(b-c);
int t3=min(abs(a-c),t);
cout<<min(abs(a-b),abs(b-c))+t3<<endl;
return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long int
#define rep(a,b,c) for(int a=b;a<c;a++)
#define repm(a,b,c) for(int a=(b-1);a>=c;a--)
#define pb push_back
#define str string
#define INF 1<<64
#define sf(a) scanf("%d",&a)
using namespace std;
int replac(str s){double ans=0;rep(i,0,s.length()){ans+=(s[i]-'0')*pow(10,s.length()-i-1);}return (int)ans;}
typedef pair<int,int> pii;
vector<pii> vii;
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c,ma;
    cin >> a >> b >> c;
    if(!(a%2)||!(b%2)||!(c%2)){
        cout << 0 << endl;
    }else{
        ma=max(max(a,b),c);
        //int mi=min(min(a,b),c);
        //int cen=max(min(max(a,b),max(b,c)),min(max(a,b),max(a,c)));
        int ans=0;
        if(a==ma){
            ans=b*c;
        }else if(b==ma){
            ans=c*a;
        }else{
            ans=a*b;
        }
        //cout << ma << mi << cen;
        cout << ans << endl;
    }
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

#define INF_LL (ll)1e18
#define INF (int)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
using ll = long long;
using PII = pair<int, int>;

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

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

	int find(int x){
		if(par[x] == x){
			return x;
		}else{
			return par[x] = find(par[x]);
		}
	}

	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;

		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}
};

class LazySegTree{
private:
	int n;
	vector<ll> node, lazy;
	vector<bool> lazyFlag;
public:
	LazySegTree(vector<ll> v){
		int sz = (int)v.size();
		n = 1; while(n < sz) n*=2;
		node.resize(2*n-1, 0);
		lazy.resize(2*n-1, 0);
		lazyFlag.resize(2*n-1, 0);

		REP(i, sz) node[i+n-1] = v[i];
		for(int i = n-2;i >= 0;i--) node[i] = node[i*2+1] + node[i*2+2];
	}

	void eval(int k, int l, int r){
		if(lazyFlag[k]){
			node[k] += lazy[k] * (r-l);
			
			if(r - l > 1){
				lazy[2*k+1] += lazy[k];
				lazy[2*k+2] += lazy[k];
				lazyFlag[2*k+1] = lazyFlag[2*k+2] = 1;
			}

			lazy[k] = 0;
			lazyFlag[k] = false;
		}
	}

	void add(int a, int b, ll x, int k=0, int l=0, int r=-1){
		if(r < 0) r = n;
		eval(k, l, r);
		
		if(b <= l || r <= a) return;

		if(a <= l && r <= b){
			lazyFlag[k] = true;
			lazy[k] += x;
			eval(k, l, r);
		}else{
			add(a, b, x, k*2+1, l, (l+r)/2);
			add(a, b, x, k*2+2, (l+r)/2, r);
			node[k] = node[k*2+1]+node[k*2+2];
		}
	}

	ll query(int a, int b, int k=0, int l=0, int r=-1){
		if(r < 0) r = n;
		eval(k, l, r);

		if(b <= l || r <= a) return 0;
		if(a <= l && r <= b) return node[k];
		return query(a, b, 2*k+1, l, (l+r)/2) + query(a, b, 2*k+2, (l+r)/2, r);
	}
};

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n, q;
	cin >> n >> q;
	
	vector<ll> v(n, 0);
	LazySegTree sg(v);
	REP(i, q){
		int k;
		cin >> k;
		if(k == 0){
			int s, t, k;
			cin >> s >> t >> k;
			sg.add(s-1, t, k);
		}else{
			int k;
			cin >> k;
			cout << sg.query(k-1, k) << endl;
		}
	}
}

Measured memory_bytes: 8612
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int main()
{
	string s;
	cin >> s;
	int n = s.length();

	for(int i = 0; i < n / 2; i++){
		if(s[i] != s[n - i - 2]){
			cout << -1 << endl;
			return 0;
		}
	}
	if(s[n - 1] == '1' || s[0] == '0'){
		cout << -1 << endl;
		return 0;
	}

	// ここまでくると、
	// - サイズnの連結成分はない
	// - サイズ1とサイズn - 1の連結成分がある
	// - サイズiとn - iの連結成分が両方ある(or ない)
	// となる
	int now = 1;
	for(int i = 1; i < s.length(); i++){
		if(s[i] == '0') continue;
		// サイズiの部分木の親ノードはi
		while(now < i + 1){
			cout << now << " " << i + 1 << endl;
			now++;
		}
	}
	while(now < n){
		cout << now << " " << n << endl;
		now++;
	}
}

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

int main(){
    int n;
    cin >> n;
    int count = 0;
    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        if(a%2!=0)count++;
    }
    if(count%2!=0) cout << "NO" << endl;
    else cout << "YES" << endl;
}


Measured memory_bytes: 256
h,w=map(int,input().split())
l=[list(input()) for i in range(h)]
f=0
for i in range(h):
  for j in range(w):
    c=0
    if l[i][j]=="#":
      if i>0 and l[i-1][j]=="#":
        c+=1
      if i<h-1 and l[i+1][j]=="#":
        c+=1
      if j>0 and l[i][j-1]=="#":
        c+=1
      if j<w-1 and l[i][j+1]=="#":
        c+=1
      if c==0:
        f=1
        break
if f==1:
  print("No")
else:
  print("Yes")

Measured memory_bytes: 3064
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n,a,b,c = list(map(int, input().split()))

M = 10**9+7 # 出力の制限
N = max(200, 2*n+10) # 必要なテーブルサイズ

g1 = [None] * (N+1) # 元テーブル
g2 = [None] * (N+1) #逆元テーブル
inverse = [None] * (N+1) #逆元テーブル計算用テーブル
g1[0] = g1[1] = g2[0] = g2[1] = 1
inverse[0], inverse[1] = [0, 1] 

for i in range( 2, N + 1 ):
    g1[i] = ( g1[i-1] * i ) % M 
    inverse[i] = ( -inverse[M % i] * (M//i) ) % M # ai+b==0 mod M <=> i==-b*a^(-1) <=> i^(-1)==-b^(-1)*aより
    g2[i] = (g2[i-1] * inverse[i]) % M 

def cmb(n, r, M):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return (g1[n] * g2[r] * g2[n-r]) % M

inv = inverse[100]
ans = 0
a,b = 100*a*inverse[100-c], 100*b*inverse[100-c]
for k in range(n):
    pa = (cmb(n+k-1, k, M) * pow(b, k, M) * pow(a, n, M) * pow(inv, n+k, M)) % M
    pb = (cmb(n+k-1, k, M) * pow(a, k, M) * pow(b, n, M) * pow(inv, n+k, M)) % M
    ans += (n+k) * (pa + pb)
    ans %= M
ans *= 100*inverse[100-c]
ans %= M
print(ans%M)

Measured memory_bytes: 88196
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		double a = N;
		double b = N/2 + ((N%2==0)?0:1);
		System.out.println(b/a);
	}

}

Measured memory_bytes: 23380
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<double> p(n);
	for (int i = 0; i < n; i++)
	{
		cin >> p[i];
	}
	vector<double> dp(n + 1, 0.0);
	dp[0] = 1.0;
	for (int i = 1; i <= n; i++) {
		for (int j = n; j >= 0; j--) {

			if (j - 1 >= 0)
				dp[j] = dp[j - 1] * p[i - 1] + dp[j] * (1 - p[i - 1]);
			else
				dp[j] = dp[j] * (1 - p[i - 1]);
		}
	}
	double ans = 0.0;
	for (int i = n / 2 + 1; i <= n; i++) {
		ans += dp[i];
	}
	printf("%.14f\n", ans);
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb(in,tmp) in.push_back(tmp)
#define all(in) in.begin(),n.end()
#define PI acos(-1)
using namespace std;
int main(){
  int m;
  while(cin>>m,m){
  int co=0;
  int o=1000-m;
  if(o>500){co++;o-=500;}
  while(o>=100){co++;o-=100;}
  while(o>=50){co++;o-=50;}
  while(o>=10){co++;o-=10;}
  while(o>=5){co++;o-=5;}
  while(o>=1){co++;o--;}

  cout<<co<<endl;
  }
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#include <bits/stdc++.h>
using namespace std;

const double TL = 1.5 * CLOCKS_PER_SEC;
mt19937 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());
#define clr(x, y) memset(x, y, sizeof(x))
#define forn(i, n) for (int i = 0; i < n; i++)
#define LL long long

int k;
LL ten[20];
vector<LL> ans;

void dfs(LL w, int d, int last) {
  if (d == 11) {
    return;
  }
  if (last != 0) {
    ans.push_back(w);
  }

  dfs(w + last * ten[d], d + 1, last);
  if(last > 0) dfs(w + (last - 1) * ten[d], d + 1, last - 1);
  if(last < 9) dfs(w + (last + 1) * ten[d], d + 1, last + 1);
}
int main() {
  //auto start_clock = clock();
#ifdef LOCAL
  freopen("in", "r", stdin);
#endif
  scanf("%d", &k);

  ten[0] = 1;
  for (int i = 1; i <= 10; i += 1) {
    ten[i] = ten[i - 1] * 10;
  }

  for (int i = 0; i <= 9; i++) {
    dfs(i, 1, i);
  }
  sort(ans.begin(), ans.end());
  cout << ans[k - 1] << endl;
  return 0;
}


Measured memory_bytes: 2420
s = input()
alpha = ["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"]
l = list(set(alpha) - set(s))
l.sort()
print(l[0] if len(l) != 0 else "None")

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

int main() {
  ll k,n;
  cin >> k >> n;
  
  if(500 * k >= n)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 3648
s=int(input())
x=[]
for i in range(1000000):
  if len(list(set(x)))!=len(x):
    print(len(x))
    break
  elif s%2==0:
  	x.append(s)
  	s=int(s/2)
  else:
  	x.append(s)
  	s=3*s+1
  

Measured memory_bytes: 9100
/* *****fireice**** */

#include<bits/stdc++.h>

#define ll long long int
#define ld long double
#define vi vector<int>
#define vc vector<char>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define vll vector<pair<ll,ll>>
#define pii pair<int,int>
#define pb push_back
#define eb emplace_back
#define el '\n'
#define N 1000000007
#define re return
#define F first
#define S second
#define L length
#define deb(x) cout<<#x<<" "<<x<<el;
#define mp make_pair
#define PI 3.14159265
#define all(a) (a).begin(),(a).end()
#define forup(i,n) for(int i=0;i<n;i++)
#define forf(i,x,n) for(int i=x;i<n;i++)
#define ford(i,n) for(int (i)=(n)-1;i>=0;(i)--)
#define take(a,n) forup(i,n) cin>>a[i];
using namespace std;

int gcdExtended(int a, int b, int *x, int *y)
{
    // Base Case
    if (a == 0)
    {
        *x = 0, *y = 1;
        return b;
    }

    int x1, y1; // To store results of recursive call
    int gcd = gcdExtended(b%a, a, &x1, &y1);

    // Update x and y using results of recursive
    // call
    *x = y1 - (b/a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(int a, int m)
{
    int x, y;
    int g = gcdExtended(a, m, &x, &y);
        // m is added to handle negative x
    ll res = ((ll)x%m + (ll)m) % m;

    return res;
}

ll poww(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n==1) return x;
    else if(n%2 == 0)        //n is even
        return poww(x*x,n/2);
    else                              //n is odd
        return x*poww(x*x,(n-1)/2);
}

ll modularExponentiation(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}

template<typename T>
T maxx(T a,T b)
{
  if(a<b) re b;
  re b;
}
template<typename T, typename... Args>
T maxx(T a,T b, Args... args)
{
    re(maxx(maxx(a,b),args...));
}

template<typename T>
T minn(T a,T b)
{
  if(a<b) re a;
  re b;
}
template<typename T, typename... Args>
T minn(T a,T b, Args... args)
{
    re(minn(minn(a,b),args...));
}

template<typename T>
void read(T& a)
{
  cin>>a;
}
template<typename T, typename... Args>
void read(T& a,Args&... args)
{
  cin>>a; read(args...);
}

template<typename T>
void write(T a)
{
  cout<<a<<' ';
}
template<typename T, typename... Args>
void write(T a,Args... args)
{
  cout<<a<<' '; write(args...);
}

inline ll min(ll a,ll b)
{
  if(a<b) re a;
  else re b;
}
inline ll max(ll a,ll b)
{
  if(a<b) re b;
  else re a;
}

ll gcd(ll a, ll b)
{
    if (a == 0)
       return b;
    if (b == 0)
       return a;

    if (a == b)
        return a;

    if (a > b)
        return gcd(a-b, b);
    else return gcd(a, b-a);
}

ll ncr(int n,int r)
{
  ll ans=1;
  r=min(r,n-r);
  forup(i,r)
  {
    ans=((ans*((n-i)%N))%N*modInverse(i+1,N))%N;
  }
  re ans;
}

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

  int t=1;
  //cin>>t;
  while(t--)
  {
    ld n,m,k;
    cin>>n;
    cout<<fixed<<setprecision(6);
    cout<<2*PI*n;

  }


  return 0;
}


Measured memory_bytes: 3836
#include<bits/stdc++.h>
#define LL long long
#define N 100005
#define Ms(a,b) memset(a,b,sizeof a)
#define db(x) cout<<#x<<"="<<x<<endl;
#define db2(x,y) cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl;
#define db3(x,y,z) cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl;
using namespace std;
int n,m;
char s[N<<1],t[N];
int nxt[N<<1][26];
int main() {
	scanf("%s%s",s+1,t+1);
	n=strlen(s+1),m=strlen(t+1);
	for(int i=1; i<=n; i++)s[i+n]=s[i];
	Ms(nxt,-1);
	for(int i=(n<<1)-1; i>=1; i--)
		for(int j=0; j<26; j++)
			if(s[i+1]-'a'==j)nxt[i][j]=i+1;
			else nxt[i][j]=nxt[i+1][j];
	int now=1;
	LL ans=0;
	if(s[1]==t[1])now=1,ans=1;
	else now=nxt[1][t[1]-'a'],ans=nxt[1][t[1]-'a'];
	for(int i=2; i<=m; i++) {
		if(now==-1)return !puts("-1");
		if(now>n)now-=n;
		ans+=nxt[now][t[i]-'a']-now;
		now=nxt[now][t[i]-'a'];
	}
	if(now==-1)return !puts("-1");
	printf("%lld\n",ans);
	return 0;
}


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

int main() {

  int n,q;
  
  cin >> n ;

  vector<int> A(n);

  for (int i = 0; i < n; i++) cin >> A.at(i);

  cin >> q ;

  vector<int> m(q);
  vector<bool> ans(q,false);

  for(int i = 0; i < q; i++) cin >> m.at(i);//入力終了

    for(int bit=0;bit<(1<<n);bit++){
      int sum=0;
      for(int j=0;j<n;j++){
        if(bit&(1<<j)) sum+=A.at(j);
      }

      for(int i = 0; i < q; i++){
        if(sum== m.at(i)) ans.at(i)=true;
      }
    }

  for(int i = 0; i < q; i++){
    if(ans.at(i)) cout << "yes" << endl;
    else cout << "no" << endl; 
  }
  

  return 0;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,a[110]={0},p,x1=0,x2=0,x3=0,sum=0;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		sum+=a[i];
	}
	p=sum/n;
	for(int i=1;i<=n;i++)
	{
		x1+=pow(a[i]-p,2);
		x2+=pow(a[i]-p-1,2);
		x3+=pow(a[i]-p+1,2);
	}
	cout<<min(x1,(min(x2,x3)))<<endl;
	return 0;
 } 

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#define mod 1000000007
#define ten5 100005
#define PI 3.1415926
using namespace std;



int main()
{
    //int m,n,o=0,i,j,k;
    long long int sum=0,sum2=0,small=-1,big=0;
    double ans=0.0,half;
    long long int m,n,o,i,j,k=0,start=0;
    //vector <int> v;
    //float f,g,h;
    char now,pre;
    //string a;
    cin>>n;
    while(n>0)
    {
        cin>>m;
        while(m%2==0)
        {
            sum++;
            m/=2;
        }
        n--;
    }
    cout<<sum;
    return 0;
}





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

int main(void){
	int h,w;
	cin >> h >> w;
	vector<string> s(h);
	for(int i = 0; i < h; ++i){
		cin >> s[i];
	}
	for(int i = 0; i < h; ++i){
		int count = 0;
		for(int j = 0; j < w; ++j){
			if(s[i][j]=='.')count++;
		}
		if(count == w){
			for(int j = 0; j < w; ++j){
				s[i][j]='d';
			}
		}
	}
	for(int j = 0; j < w; ++j){
		int count = 0;
		for(int i = 0; i < h; ++i){
			if(s[i][j] == '.' || s[i][j] == 'd')count++;
		}
		if(count == h){
			for(int i = 0; i < h; ++i){
				s[i][j]='d';
			}
		}
	}
	for(int i = 0; i < h; ++i){
		int count = 0;
		for(int j = 0; j < w; ++j){
			if(s[i][j] != 'd'){
				cout << s[i][j];
				count++;
			}

		}
		if(count != 0){
			cout << endl;
		}
	}
	return 0;
}

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

#define INF 1000010000
#define nl '\n'
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pdd pair<double,double>
#define all(c) (c).begin(), (c).end()
#define SORT(c) sort(all(c))
#define sz(c) (c).size()
#define rep(i,n) for( int i = 0; i < n; ++i )
#define repi(i,n) for( int i = 1 ; i <= n; ++i )
#define repn(i,n) for( int i = n - 1 ; i >= 0 ; --i )
#define repf(j,i,n) for( int j = i ; j < n ; ++j )
#define die(s) {std::cout << s << nl;}
#define dier(s) {std::cout << s; return 0;}
#define dbg(var) {std::cout << #var << "  = " << var << nl;}
#define vi vector<int>
typedef long long ll;

using namespace std;



int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.precision(0); 

	int n , q;
	cin >> n >> q;
	
	vector<tuple<int,int,int>> w(n);
	auto getS = [](auto& e)->int& { return get<0>(e); }; 
	auto getT = [](auto& e)->int& { return get<1>(e); }; 
	auto getX = [](auto& e)->int& { return get<2>(e); };
	for(auto& el : w) cin >> getS(el) >> getT(el) >> getX(el);
	
	
	map<int, multiset<int>> blockers;
	map<int, multiset<int>> unblockers;
	
	rep(i , n)
	{
		int s = getS(w[i]);
		int t = getT(w[i]);
		int x = getX(w[i]);
		
		blockers[max(s - x , 0)].insert(x);
		//cout << "Added blocker " << x << " " << max(s - x , 0) << endl;
		unblockers[max(t - x ,0)].insert(x);
		//cout << "Added unblocker " << x << " " << max(t - x , 0) << endl;
	}
	
	vi d(q);
	for(auto& el : d) cin >> el;
	
	set<int> times;
	for(auto& el : blockers) times.insert(el.fi);
	for(auto& el : unblockers) times.insert(el.fi);
	for(auto& el : d) times.insert(el);
	times.insert(0);
	
	//cout << "Times: "; for(auto t : times) cout << t << " ";cout << nl;
	
	multiset<int> cur;
	map<int,int> blocked;
	for(auto t : times)
	{
		for(auto el : blockers[t])
			cur.insert(el);
		for(auto el : unblockers[t])
			cur.erase(cur.find(el));
		if(cur.empty())
			blocked[t] = -1;
		else
			blocked[t] = *cur.begin();
	}
	
	rep(i , q) cout << blocked[d[i]] << endl;
	
	
	return 0;
}

Measured memory_bytes: 191876
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define mod 998244353
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
#define ff first
#define endl "\n"
#define ss second
#define all(v) v.begin(), v.end()
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int power(int x, unsigned int y, int p)
{
  int res = 1;
  x = x % p;
  while (y > 0)
  {
    if (y & 1)
      res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res % p;
}
 
int32_t main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  
  int tc;
  tc = 1;
  //cin >> tc;
  while (tc--)
  {
    int n;
    cin >> n;
    set<string> se;
    for (int i = 0; i < n;i++){
      string s;
      cin >> s;
      se.insert(s);
    }
    cout << (int)se.size() << endl;
  }

  return 0;
}

Measured memory_bytes: 19236
N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
first = 1
X = K
Y = 0
for i in range(K,N):
    P = A[X]
    Q = A[Y]
    if P>Q:
        print("Yes")
    else:
        print("No")
    X+=1
    Y+=1


Measured memory_bytes: 105464
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel.Design;
using System.Globalization;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Xml.Schema;
using static System.Console;

namespace ConsoleApp2
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<int> Slist() { return new List<int>(ReadLine().Split().Select(int.Parse)); }
        static bool[,] graph = new bool[8, 8];
        static void Main(string[] args)
        {
            var NMK = Sarray();
            var N = NMK[0];
            var M = NMK[1];
            var K = NMK[2];
            var an = Sarray();
            var bm = Sarray();
            long t = 0;
            for (var i = 0; i < M; i++) t += bm[i]; ;
            long ans = 0;
            var j= M;
            for (var i = 0; i < N+1;i++)
            {
                while (j > 0 && t>K)
                {
                    j--;
                    t -= bm[j];
                }
                if (t > K) break;
                ans = Math.Max(ans, i + j);
                if (i == N) break;
                t += an[i];
            }
            WriteLine(ans);
        }
    }
}

Measured memory_bytes: 62448
#include <stdio.h>
#include <math.h>
#define PI acos(-1)

//三角関数　余弦定理等を勉強しなおす
int main(void)
{
    double rad,a,b,c,s,l,h;
    
    scanf("%lf %lf %lf",&a,&b,&c);
    rad=c*PI/180;//度をラジアンに変換
    
    h=b*sin(rad);//高さを求める
    s=a*h/2;//面積を求める
    l=a+b+sqrt(pow(a,2)+pow(b,2)-2*a*b*cos(rad));//周の長さを求める
    
    printf("%f\n %f\n %f\n",s,l,h);
    return 0;
}


Measured memory_bytes: 2104
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>

using namespace std;

bool palindromeCheck(string S);

int main(){
    string S;
    string S_first;
    string S_last;
    int N;
    bool result;

    cin >> S;
    N = S.size();

    S_first = S.substr(0, ((N + 1) / 2) - 1); 
    S_last = S.substr(((N + 3) / 2) - 1); 

    result = true;

    result = palindromeCheck(S) && palindromeCheck(S_first) && palindromeCheck(S_last);

    if(result == true) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}

bool palindromeCheck(string S){
    string S_inverse;
    S_inverse = "";

    for(int i=0; i<S.size();i++){
        S_inverse += S.substr(S.size()-1-i,1);
    }

    if(S_inverse == S) return true;
    else return false;
}


Measured memory_bytes: 888
#include<iostream>
using namespace std;
int main(){
  int a,b,sum = 0;
  cin >> a >> b;
  for(int i=0;i<2;i++){
  if(a>=b){
    sum+=a;
    a--;
  }else if(b>a){
    sum+=b;
    b--;
  }
  }
  cout << sum;
  return 0;
}

Measured memory_bytes: 256