akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

int main() {
  i64 A, B, K;
  std::cin >> A >> B >> K;
  std::cout << std::max<i64>(0, A - K) << ' ' << std::max<i64>(0, B + std::min<i64>(0, A - K)) << std::endl;
  return 0;
}

Measured memory_bytes: 256
n=int(input())
h=list(map(int,input().split()))
m=0
s=0
for j in range(100):
    for i in range(n):
        if h[i]==0:
            s=0
        elif s!=0:
            h[i]-=1
        else:
            h[i]-=1
            s+=1
            m+=1
    s=0
print(m)

Measured memory_bytes: 65716
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
 
using ll = long long;
using P = std::pair<ll, ll>;
 
#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " << i << std::endl
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
ll pow_mod(ll a, ll b, ll mod=-1) {
  if ((a == 0)||(mod!=-1&&a%mod==0)) {
    return 0;
  }
 
  ll x = 1;
 
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}
 
// const ll MOD = 998244353;
const ll MOD = 1e9 + 7;
 
 
 
int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);

  ll a,b;
  std::cin>>a>>b;

  if(1<=a&&a<=9&&1<=b&&b<=9){
    std::cout<<a*b<<"\n";
  }else{
    std::cout<<-1;
  }
 
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>                                        
using namespace std;                                            
                                                                
int main() {                                                    
  int n;                                                        
  cin >> n;                                                     
  int x=n;                                                      
  printf("%d:",n);                                              
  for (int i=2; i*i<=x; i++) {                                  
    while (n%i==0) {                                            
      printf(" %d",i);                                          
      n/=i;                                                     
    }                                                           
  }                                                             
  if (n!=1) {                                                   
    printf(" %d",n);                                            
  }                                                             
  printf("\n");                                                 
  return 0;                                                     
}                                                               
                                                                
                                                            

Measured memory_bytes: 3204
#include <bits/stdc++.h>
 
using namespace std;
 
#define endl '\n'
#define f first
#define s second
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define debug(...) cout << " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] " << endl

using ld = long double;
using ll = long long;
using pii = pair <int,int>;
using pll = pair <ll,ll>;
using vi = vector <int>;
using vll = vector <ll>;
using vpii = vector <pii>;
using vpll = vector<pll>;
using vs = vector <string>;


int main(){
  fastio;

  string a,b;

  cin >> a >> b;

  int n = a.size();
  int m = b.size();

  int mx = 0;

  for(int i=0;i<=n-m;i++){
    int cnt = 0;
    int k = i;
    for(int j=0;j<m;j++,k++){
      if(a[k] == b[j])
        cnt++;
    }
    mx = max(mx,cnt);
  }



  cout << m - mx << endl;

  return 0;
}

Measured memory_bytes: 3612
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using st=string;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
#define mp make_pair
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
st abc="abcdefghijklmnopqrstuvwxyz";
st ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

const int MX=2000001;
ll fac[MX],inv[MX],finv[MX];

void COMinit(){
    fac[0]=fac[1]=1;
    inv[1]=1;
    finv[1]=finv[0]=1;
    FOR(i,2,MX){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}

ll COM(ll x,ll y){
    return ((fac[x]*finv[y])%MOD*finv[x-y])%MOD;
}
ll pow_mod(ll x,ll y){
    if(y==0){
        return 1;
    }
    if (y%2==1){
        return pow_mod(x,y-1)*x%MOD;
    }
    else{
        ll k=pow_mod(x,y/2);
        return k*k%MOD;
    }
}

int main() {
    ll k;st s;
    ll ans=0;
    cin >> k >> s;
    ll x=s.size();
    COMinit();
    FOR(i,x,x+k+1){
      ans+=(COM(k+x,i)*pow_mod(25,k+x-i)%MOD)%MOD;
      ans%=MOD;
    }
    cout << ans << endl;
}

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


int main(){
  int n;
  cin >> n;
  int r[n];
  rep(i,n)cin >> r[i];

  int maxv = r[1]-r[0];
  int minv = r[0];

  for(int i=1;i<n;i++){
    maxv = max(maxv,r[i]-minv);
    minv = min(minv,r[i]);
  }

  cout << maxv << endl;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> AA(N);
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    A[i] = a;
    AA[i] = a;
  }
  sort(AA.begin(), AA.end());
  reverse(AA.begin(), AA.end());

  for (int i = 0; i < N; i++) {
    if (A[i] == AA[0]) {
      cout << AA[1] << endl;
    }
    else {
      cout << AA[0] << endl;
    }
  }
}

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

int main(){
	int n,i;
	cin>>n;
	int a[n];
	for(i=0; i<n; i++){
		cin>>a[i];
	}
	int b[n];
	for(i=0; i<n; i++){
		cout<<a[n-i-1];
		if(i!=n-1){
			cout<<" ";
		}
	}
	cout<<"\n";
	return 0;
}


Measured memory_bytes: 3036
#include <bits/stdc++.h>
using namespace std;
vector<long long> res1; 
vector<long long> res2;
long long mod=1e9+7;
long long fact[200010];
long long poww(long long x,long long n)
{
	if(n==0)
	return 1*1LL;
	else if(n%2==0)
	{
		return poww(x,n/2)*poww(x,n/2)%mod;
	}
	else if(n%2!=0)
	{
		return poww(x,n/2)*poww(x,n/2)%mod*x%mod;
	}
}
long long C(long long k,long long n)
{
	if(k==0||n==0) return 1*1LL;
	if(k>n) return 0*1LL;
	return poww(fact[k],mod-2)%mod * poww(fact[n-k],mod-2)%mod * fact[n]%mod;
}
int main()
{
	//ios_base::sync_with_stdio(0);
	//cin.tie(0);
	//cout.tie(0);
	fact[0]=1*1LL;
	for(long long i=1;i<=200000;i++)
	{
		fact[i]=(fact[i-1]*i)%mod;
	}
	long long h,w,a,b;
	long long ans=0;
	cin >> h>>w>>a>>b;
	for(int i=1;i<=w-b;i++){
		ans+=C(h-a-1,h-a+b+i-2)*C(a-1,a+w-b-i-1)%mod;
		ans=ans%mod;
	}
	cout<<ans%mod;
	//cout  << C(99,1000);
}

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main(){
    int e;
    while(cin >> e, e){
        int m = e;
        for(int z=0; z<m && z*z*z<=e; ++z){
            for(int y=0; y+z<m && y*y+z*z*z<=e; ++y){
                int x = e - z*z*z - y*y;
                if(x + y + z < m)m = x + y + z;
            }
        }
        cout << m << '\n';
    }
    return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
#define endl '\n'
#define ll long long
#define double long double
using namespace std;
const ll inf = 1000000000000000000;

ll d, t, s;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> d >> t >> s;
    if ((d / s) + (d % s != 0) <= t)
        cout << "Yes";
    else
        cout << "No";
    return 0;
}


Measured memory_bytes: 3688
#pragma target("avx")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using PP = std::pair<ll,P>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define REP(i,b,e) for(ll i=b; i<e; i++)
#define ALL(vec) vec.begin(),vec.end()
#define PRINT(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define SCAN(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};


int main(){
	int n;
	scanf("%d", &n);
	int h[n];
	REP(i, 0, n) scanf("%d", &h[i]);

	V dp(n, 1e9);
	dp[0] = 0;
	REP(i, 0, n-1){
		dp[i+1] = std::min(dp[i+1], dp[i]+abs(h[i]-h[i+1]));
		if(i<n-2) dp[i+2] = std::min(dp[i+2], dp[i]+abs(h[i]-h[i+2]));
	}
	printf("%d\n", dp[n-1]);
	return 0;
}



Measured memory_bytes: 4552
n = int(input())
v_list = list(map(int, input().split()))
v_list.sort()
sum = 0
for index in range(len(v_list)):
  if not index == 0:
    keisuu = pow(0.5, n-index)
  else:
    keisuu = pow(0.5, n-1)
  sum += (keisuu * v_list[index])
print(sum)

Measured memory_bytes: 38256
import sys,heapq
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG =  True
def ddprint(x):
  if DBG:
    print(x)

b = input()
if b == 'A':
    print('T')
elif b == 'T':
    print('A')
elif b == 'C':
    print('G')
elif b == 'G':
    print('C')


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

#define ll long long
#define ull unsigned long long

using namespace std;

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

	vector <int> a(n);
	vector <int> b(n);
	vector <int> c(n-1);
	for (int ii = 0; ii < n; ++ii){
		cin >> a[ii];
		a[ii]--;
	}
	for (int ii = 0; ii < n; ++ii){
		cin >> b[ii];
	}
	for (int ii = 0; ii < n-1; ++ii){
		cin >> c[ii];
	}

	int ans = 0;
	int pre = -1;
	for (int ii = 0; ii < n; ++ii){
		int idx = a[ii];
		ans += b[idx];
		if (idx == pre + 1){
			ans += c[pre];
		}
		pre = idx;
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
sx, sy, tx, ty = map(int, input().split())

ans = []
ans += (ty-sy) * "U" + (tx-sx) * "R" + (ty-sy) * "D" + (tx-sx) * "L"

ans += "L" + (ty-sy+1) * "U" + (tx-sx+1) * "R" + "D"
ans += "R" + (ty-sy+1) * "D" + (tx-sx+1) * "L" + "U"

print("".join(ans))

Measured memory_bytes: 3188
#include <iostream>
using namespace std;
int main()
{
    int a, b, c;
    cin >> a >> b >> c;

    if (a + b + c >= 22)
    {
        cout << "bust\n"
             << endl;
    }
    else
    {
        cout << "win\n"
             << endl;
    }
    return 0;
}

Measured memory_bytes: 256
input = gets.chomp.split(" ").map(&:to_i)

def swap(input, index1, index2)
    output = input.dup
    output[index1] = input[index2]
    output[index2] = input[index1]
    output
end

swap1 = swap(input, 0, 1)
swap2 = swap(swap1, 0, 2)
print swap2.join(' ')

Measured memory_bytes: 1788
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0

for a in range(a + 1):
    for b in range(b + 1):
        for c in range(c + 1):
            sum = 500 * a + 100 * b + 50 * c
            if sum == x:
                ans += 1

print(ans)


Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
	int N,M,a;
	while(1){
		vector<int> map,deme;
		int hoge=0,ans;
		cin>>N>>M;
		if(N==0&&M==0)break;
		for(int i=0;i<N;i++){
			cin>>a;
			map.push_back(a);
		}
		for(int i=0;i<M;i++){
			cin>>a;
			deme.push_back(a);
		}
		//cout<<endl;
		for(int i=0;i<M;i++){
			hoge+=deme[i];
			hoge+=map[hoge];
			//cout<<hoge<<endl;
			if(hoge>=N-1){ans=i+1;break;}
		}
		cout<<ans<<endl;
	}	
}

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

using namespace std;

long long dp[200000];

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

	int n;
	int k;
	cin >> n;
	cin >> k;
	vector<int> h(n);
	for(int i = 0; i < n; ++i){
		cin >> h[i];
	}
	for(int i = 0; i < 200000; ++i){
		dp[i] = 0;
	}


	for(int i = 1; i < n; ++i)
	{	long long cur_res = 2000000000;
		for(int j = 1; j <=k; ++j)
		{
			if(i - j >= 0)
			{
				cur_res = min(cur_res,dp[i - j] + abs(h[i] - h[i- j]));
			}
		}
		dp[i] = cur_res;
	}
	cout << dp[n-1];
	return 0;
}

Measured memory_bytes: 2176
#include<iostream>

using namespace std;

int main() {
	int d, n;

	cin >> d >> n;

	if (n == 100)
		n++;
	if (d == 0) {
		cout << n;
	}
	else {
		while (d > 0) {
			n = n * 100;
			d--;
		}
		cout << n;
	}

	return 0;
}

Measured memory_bytes: 384
'use strict'

const main = (input) => {
    input = input.split('\n')
    let temp = input[0].split(' ').map(i => parseInt(i))
    const N = temp[0]
    const T = temp[1]
    temp = input.slice(1, N + 1)
    let minc = 10000
    let mint = 10000
    temp.forEach(t => {
        let temp = t.split(' ').map(i => parseInt(i))
        if(temp[1] <= T && temp[0] < minc){
            minc = temp[0] 
            mint = temp[1] 
        }
    })

    if(minc === 10000){
        console.log('TLE')
    }else{
        console.log(minc)
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))

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

using namespace std;
#define int long long
int MOD = 1000000007;

signed main(){
    string S;
    int w;
    cin >> S >> w;
    
    for(int i=0;i<S.length();i+=w){
        cout << S[i];
    }
    
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdlib.h>
int asc(const void* a, const void* b) { return *(int*)a - *(int*)b; }
int desc(const void* a, const void* b) { return *(int*)b - *(int*)a; }

//qsort(data,10,sizeof(int),compare_int);

int main(void)
{
	char s[200001];
	char t[4];

	scanf("%s %s", s, t);
	int cnt = 0;
	for (int i = 0; i < 3; i++) {
		if (s[i] == t[i])cnt++;
	}
	printf("%d\n", cnt);
	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

using ll = long long;
using ld = long double;

const ld pi = 3.141592653589793;

ll n, d, br = 0, r = 26;
string ans;

ll lpow(ll x, ll y) {
  ll ans = 1;
  for (int i = 0; i < y; i++) {
    ans *= x;
  }
  return ans;
}

int main() {
  cin >> n;

  for (d = 2; n > r; d++) {
    br = r;
    r = r + lpow(26, d);
  }
  d--;
  // cout << d << " " << br << " " << r << endl;

  n -= br + 1;
  for (int i = 0; i < d; i++) {
    char nc = 'a' + n % 26;
    string ns{nc};
    ans = ns + ans;
    n /= 26;
  }

  cout << ans << endl;
}

Measured memory_bytes: 3628
(a,b) = $stdin.read.split(" ").map { |e| e.to_i }
i1 = (a / 0.08).ceil
i2 = ((a+1) / 0.08).ceil

j1 = (b / 0.1).ceil
j2 = ((b+1) / 0.1).ceil

res = -1
if i1 <= j1 && j1 < i2 then
  res = j1
elsif j1 <= i1 && i1 < j2 then
  res = i1
end

puts res

Measured memory_bytes: 1788
// https://atcoder.jp/contests/abc042/tasks/abc042_b
"use strict";
function Main(input) {
  const params = input.split("\n");
  // const [N, L] = params[0].split(" ");

  const s = params.slice(1);

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


Measured memory_bytes: 7628
N = int(input())
S = input()
data = set()
xd,yd = set(),set()
for i in range(N-2):
  x = S[i]
  if x in xd:
    continue
  else:
    xd.add(x)
    yd = set()
  for j in range(i+1,N-1):
    y = S[j]
    if y in yd:
      continue
    else:
      yd.add(y)
    for k in range(j+1,N):
      z = S[k]
      data.add(x+y+z)
print(len(data))

Measured memory_bytes: 3188
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
typedef long long ll;
#define rep(i,n) for(ll i=0; i<(ll)(n); i++)
#define REP(i,l,r) for(ll i=l; i<(ll)(r); i++)
#define max(l,r) ((l)>(r)?l:r)
#define min(l,r) ((l)<(r)?l:r)
#define swap(l,r) {ll tp=l;l=r;r=tp;}
const ll MOD = 1000000007;
ll gcd(ll a,ll b){if(b==0)return abs(a);return gcd(b,a%b);}
ll lcm(ll a,ll b){if(a==b&&a==0) return 0;else return a/gcd(a,b)*b;}
int upcmpll(const void *a,const void *b){
    return (*(ll*)a == *(ll*)b?0:(*(ll*)a > *(ll*)b?1:-1));
}
void sort_u(ll *a,int n){qsort(a,n,sizeof(ll),upcmpll);}

int main() {
    int n;
    scanf("%d", &n);
    int a[101010], b[101010];
    rep(i, n) scanf("%d%d", a+i, b+i);
    ll ans = 0;
    rep(i, n){
        ans += (b[n-1-i] - ((a[n-1-i]+ans) % b[n-1-i])) % b[n-1-i];
    }
    printf("%lld",ans);
}

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

typedef unsigned long long ll;
typedef pair <int, int> pii;

#define fr first
#define sc second
#define pb push_back
#define mpr make_pair
#define ppb pop_back()
#define ins insert
#define sz(s) int(s.size())
#define all(x) x.begin(), x.end()
#define lb lower_bound
#define ub upper_bound
ll f(ll l1, ll r1, ll l2, ll r2){
	if(l1 <= l2 && r2 <= r1)return r2 - l2 + 1;
	if(l1 <= l2)return r1 - l2 + 1;
	return r2 - l1 + 1;
}
ll st(ll a){
	ll lvl = 0;
	while((a / 2) > 0)a /= 2, ++lvl;
	return lvl;
}
ll rec(ll a, ll b){
	if(a == b)return 1ll;
	ll pw = 1, ans = 0, c = 0, x = 0, c1 = 0, c2 = 0, x2 = 0, pw2 = 0, sum = 0, lvl = 0, mul = 0;
	vector <ll> g;
	g.clear();
	while(pw * 2 <= a)pw *= 2;
	while(pw <= b){
		g.pb(pw);
		pw *= 2;
	}
	if(a < 2)return pw - a;
	if(sz(g) > 2){
		for(auto to : g){
			ans += f(a, b, to, to * 2 - 1);
		}
		c = g[sz(g) - 1];
		x = b - c;
		ans -= x + 1;
		lvl = 0;
		if(x) {
			pw = 1;
			while(pw * 2 <= x)pw *= 2, ++ lvl;
			ans += pw * 2;
			if(pw * 2 == c)return ans;
			++lvl;
		}
		for(int i = sz(g) - 2;st(g[i]) >= lvl && i > 0; -- i)ans += g[i];
		if(st(g[1]) > lvl)ans += f(a, b, g[0], g[0] * 2 - 1);
		return ans;
	}
	if(sz(g) == 2){
		c1 = g[0];
		c2 = g[1];
		ans = f(a, b, c1, c1 * 2 - 1);
		x = b - c2;
		if(x > 0){
			pw = 1;
			while(pw * 2 <= x)pw *= 2;
			if(pw * 2 == c2){
				ans += c2;
				return ans;
			}
		}
		else pw = 0;
		pw2 = 1, lvl = 0;
		while(pw2 * 2 <= a){
			pw2 *= 2;
			++lvl;
		}
		sum = c1;
		for(int i = lvl - 1; i >= 0 ;--i){
			lvl = -1;
			if((a >> i) % 2 == 1){
				sum += pow(2, i);
				lvl = i;
				break;
			}
		}
		if(lvl != -1){
			ans += f(a, b, c1, c1 * 2 - 1);
			if(pw)ans += pw * 2;
			else ++ans;
			return ans;
		}
		ans += c1;
		return ans;
	}
	return rec(a - g[0], b - g[0]);
}
ll a, b, ans;
bool u[100000];
int main()
{
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> a >> b;
	cout << rec(a, b);
	return 0;
}

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

int main(){

	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif

	ios::sync_with_stdio(false),cin.tie(0);

	long long n; cin >> n;

	long long sum = 0;

	for(int i=1;i<n+1;i++){
		sum+= (n-n%i)*(1+n/i)/2;
	}

	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3596
#!/usr/bin/env python3
import sys

N, M = map(int, input().rstrip().split())

L = []
R = []
for _ in range(M):
    l, r = map(int, input().rstrip().split())
    L.append(l)
    R.append(r)

Ans = min(R) - max(L) + 1
if Ans < 0:
    Ans = 0
print(Ans)


Measured memory_bytes: 10996
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

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

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}



int main(){
    int a,b;cin>>a>>b;
    cout<<a*b-(a+b)+1;
}



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

char a[2005], b[2005];
int n;

vector<pair<int, int> > solsRL;

vector<int> occs[2], maxRL;

int getRight(int ind) {
	if (occs[1].empty())
		return -1;
	vector<int>::iterator it = lower_bound(occs[1].begin(), occs[1].end(), ind);
	if (it == occs[1].end())
		return n - ind + (*occs[1].begin());
	return (*it) - ind;
}
int getLeft(int ind) {
	if (occs[1].empty())
		return -1;
	vector<int>::iterator it = lower_bound(occs[1].begin(), occs[1].end(), ind);
	if (it == occs[1].begin())
		return ind + 1 + (n - 1) - *occs[1].rbegin();
	--it;
	return ind - (*it);
}
void process(vector<pair<int, int> > &v, vector<int> &m) {
	if (v.empty())return;
	m[int(v.size()) - 1] = v.back().second;
	for (int i = int(v.size()) - 2; i >= 0; i--)
		m[i] = max(v[i].second, m[i + 1]);
}

int main() {
	ios::sync_with_stdio(false);

	scanf("%s", a);
	scanf("%s", b);
	n = strlen(a);

	for (int i = 0; i < n; i++)
		occs[b[i] - '0'].push_back(i);

	int best = -1;
	for (int startPos = 0; startPos < n; startPos++) {

		int ans = 0;
		solsRL.clear();
		maxRL.clear();
		for (int i = 0; i < n; i++) {
			char c = a[(startPos + i) % n];
			char d = b[i];
			if (c == d) continue;
			ans++;
			int left = getLeft((startPos + i) % n);
			int right = getRight((startPos + i) % n);
			if (left == -1 && right == -1) {
				cout << -1 << endl;
				return 0;
			}

			solsRL.push_back(make_pair(right, left));
			maxRL.push_back(0);
		}
		sort(solsRL.begin(), solsRL.end());
		process(solsRL, maxRL);

		// hanet7arrak shwaya left we shwaya right
		for (int moveRight = 0; moveRight < n; moveRight++) {
			int sz = solsRL.size();

			int ind = lower_bound(solsRL.begin(), solsRL.end(), make_pair(moveRight + 1, -1)) - solsRL.begin();
			int moveLeft = ind >= sz ? 0 : maxRL[ind];


			int tmp = 2 * moveRight + moveLeft + ans;
			tmp += abs(moveLeft - startPos);

			if (best == -1 || tmp < best)
				best = tmp;

			tmp = 2 * moveLeft + moveRight + ans;
			tmp += abs(moveRight - ((n - startPos) % n));
			if (best == -1 || tmp < best)
				best = tmp;
		}

	}
	cout << best << endl;





	return 0;
}




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

using namespace std;

#define forn for (ll i = 0; i < n; i++)
#define form for (ll j = 0; j < m; j++)
#define NO cout << "NO\n";
#define YES cout << "YES\n";
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for (ll i = a; i < b; i++)

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> pi;

ll gcd(ll a, ll b){
    ll r;
    while (b != 0){
        r = a % b;
        a = b;
        b = r;
    }
    return a;
}


ll *calc_z(string s){
    ll n = s.size();
    ll *z = new ll[n] {0};
    ll l = 0, r = 0;
    for (ll i = 1; i < n; i++){
        if (r >= i) z[i] = min(z[i-l], r-i+1);
        while (z[i]+i < n && s[z[i]] == s[z[i]+i]) z[i]++;
        if (i + z[i] - 1 > r){
            l = i;
            r = i+z[i]-1;
        }
    }
    return z;
}

ll find_lower(ll *a, ll n, ll v){
    ll l = -1, r = n;

    while (r>l+1){
        ll m = (l+r)/2;

        if (a[m] >= v) r = m;
        else l = m;
    }
    if (r == n) return n-1;
    if (a[r] == v) return r;
    return r == 0 ? 0 : r-1;
}

void init(){
}

int bin(int *p, int n, int x){
    int l = 0, r = n-1;
    while (r >= l){
        int m = (l+r)/2;
        if (p[m] == x) return m;
        if (p[m] > x) r = m-1;
        else l = m+1;
    }
    return -1;
}

void solve(){
    int n;
    cin >> n;
    int d = n%10;
    if (d == 2 || d == 4 || d == 5 || d == 7 || d == 9) cout << "hon\n";
    else if (d == 3) cout << "bon\n";
    else cout << "pon\n";
}

int main(){
    //init();

    ios::sync_with_stdio(0);
    cin.tie(0);

    //ll t; cin >> t; while (t--)
        solve();
    return 0;
}


Measured memory_bytes: 3568
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
// #include<C:\Users\J\Desktop\AC\athead.h>
#define showa(v) for(int iii = 0; iii < v.size(); iii++){ cout << v[iii] << " ";} cout << endl;
#define show(iiii) cout << iiii << endl; 
#define shows(iiiii) cout << iiiii << " ";
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <set>
#include <deque>
#include <numeric>
#include<tuple>
#include <utility>
#include <map>
using namespace std;

int ex(int n){
    int res = 1;
    for(int i= 1; i < n+1; i++){
        res = res*i;
    }
    return res;
}
 
int main(){
    int n;
    cin >> n;
    vector<int> x(n), y(n);
    rep(i,n){
        cin >> x[i] >> y[i];
    }
    double sum = 0.0;
    rep(i,n){
        for(int j = i+1; j < n; j++){
            double dist = sqrt((x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]) );
            sum += dist;
        }
    }
    printf("%.10f", sum*ex(n-1)*2/ex(n));
    // cout << sum*ex(n-1)*2/ex(n) << endl;
    
}

Measured memory_bytes: 256
N = int(input())						# 5

T=[0]
X=[0]
Y=[0]

for i in range(N):
	t, x, y = map(int, input().split())		# 5 7 2
	T.append(t)
	X.append(x)
	Y.append(y)

#print(T)
#print(X)
#print(Y)

x0 = 0
y0 = 0
ans = 'No'
#ans = 'No_0'

#時間的に移動可能か？ →
# 秒数の差、距離、残り秒数
for i in range(N):
	t = T[i+1] - T[i]
	x = abs(X[i+1] - X[i])
	y = abs(Y[i+1] - Y[i])
	
	# 時間に対して距離が遠い
	if t < (x+y):
		#ans = "No_1"
		break
	
	#
	a = t - (x+y)
	if a%2==0:
		continue
	else:
		#ans = "No_2"
		break

else:
	ans='Yes'


print(ans)


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

using namespace std;

int a[105], nul, cur, n, k, cnt;
string s;

int main() {
	memset(a, 0, sizeof(a));
	cin >> n >> k;
	for (int i = 0; i < k; i++) {
		cin >> nul;
		for (int j = 0; j < nul; j++) {
			cin >> cur;
			a[cur] = 1;
		}
	}
	cnt = 0;
	for (int i = 1; i <= n; i++) {
		if (a[i] == 0) cnt++;
	}
	cout << cnt;
}

Measured memory_bytes: 3636
#include <string>
#include <vector>
#include<iostream>
#include <cstdlib>
#include<stdlib.h>
using namespace std;
    

int main(){
    int a, b;
    cin >> a >> b;
    string s;
    cin >> s;
    
    for (int i = 0; i < s.length(); i++) {
        if (i == a && s[i] != '-'){
            cout << "No" << endl;
            return 0;
        }
        else if (i == a && s[a] == '-')
            continue ;
        
        if ( !('0' <= s[i] && s[i] <= '9') ) {
            cout << "No" << endl;
            return 0;
        }
    }
    
    cout << "Yes" << endl;
    
    return 0;
}


Measured memory_bytes: 764
N, M = map(int, input().split())
X = list(map(int, input().split()))
dist = list()

if M-N <= 0:
  print(0)
else:
  X.sort()

  for i in range(M-1):
    dist.append(X[i+1]-X[i])

  dist.sort()
  
  cnt = 0
  for i in range(M-N):
    cnt += dist[i]
    
  print(cnt)

Measured memory_bytes: 13964
#include<bits/stdc++.h>
using namespace std;
int n,A,B;
long long s[100010],t[100010],p;
int l,r,mid,k;
long long ti,si,tj,sj,ans;

int main(){
	scanf("%d %d %d",&A,&B,&n);
	for(int i=1;i<=A;i++) scanf("%lld",&s[i]);
	for(int i=1;i<=B;i++) scanf("%lld",&t[i]);
	sort(s+1,s+A+1);
	sort(t+1,t+B+1);
	s[0]=t[0]=-1;
	s[A+1]=t[B+1]=-1;
	for(int i=1;i<=n;i++){
		scanf("%lld",&p);
		l=1,r=A,k=0;
		while(l<=r){
			mid=(l+r)/2;
			if(s[mid]>p) r=mid-1;
			else k=max(k,mid),l=mid+1;
		}
		si=s[k];
		l=1,r=B,k=0;
		while(l<=r){
			mid=(l+r)/2;
			if(t[mid]>p) r=mid-1;
			else k=max(k,mid),l=mid+1;
		}
		ti=t[k];
		l=1,r=A,k=A+1;
		while(l<=r){
			mid=(l+r)/2;
			if(s[mid]<p) l=mid+1;
			else k=min(k,mid),r=mid-1;
		}
		sj=s[k];
		l=1,r=B,k=B+1;
		while(l<=r){
			mid=(l+r)/2;
			if(t[mid]<p) l=mid+1;
			else k=min(k,mid),r=mid-1;
		}
		tj=t[k];
		ans=1e18;
		if(ti!=-1&&si!=-1){
			ans=min(ans,p-min(ti,si));
		}
		if(tj!=-1&&sj!=-1){
			ans=min(ans,max(tj,sj)-p);
		}
		if(ti!=-1&&sj!=-1){
			ans=min(ans,2*min(p-ti,sj-p)+max(p-ti,sj-p));
		}
		if(si!=-1&&tj!=-1){
			ans=min(ans,2*min(p-si,tj-p)+max(p-si,tj-p));
		}
		printf("%lld\n",ans);
	}
	
	return 0;
}

Measured memory_bytes: 2816
using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
      string[] input = ReadLine().Split();
      int a = int.Parse(input[0]);
      int b = int.Parse(input[1]);
      int k = int.Parse(input[2]);
      List<int> ans = new List<int>();
      
      for (int i=a;i<a+Math.Min(k,b-a);i++)
      {
        if (!ans.Contains(i)){
          ans.Add(i);
        }
      }
      for (int i=b-Math.Min(k,b-a)+1;i<=b;i++)
      {
        if (!ans.Contains(i)){
          ans.Add(i);
        }
      }
      ans.Sort();
      if (ans.Count==0)
      {
        ans.Add(a);
      }
      for(int i=0;i<ans.Count;i++)
      {
        WriteLine(ans[i]);
      }
    }
}



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

int main(){
	char moji[2][27]={"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
	char uketori[1202];
	int i,j,mojisuu,count[26]={0};
	while(fgets(uketori,sizeof(uketori),stdin)!=NULL){
		mojisuu=strlen(uketori);
		
		for(i=0;i<mojisuu;i++){
			for(j=0;j<26;j++){
				if(uketori[i]==moji[0][j]){
					count[j]++;
				}else if(uketori[i]==moji[1][j]){
					count[j]++;
				}
				
			}
			
		}
		
		
	}
	
	
	for(i=0;i<26;i++){
		printf("%c : %d\n",moji[0][i],count[i]);
	}
	
	return 0;
}

Measured memory_bytes: 524
program answer
  implicit none
  integer(8) :: i, j, D, teika, su
  integer, parameter :: n = 26
  integer :: c(n), last(n)
  integer, allocatable :: s(:,:), t(:), v(:)

  read(*,*) D
  read(*,*) c
  allocate(s(D,n))
  do i = 1, D
     read(*,*) s(i,1:n)
  end do
  allocate(t(D))
  do i = 1, D
     read(*,*) t(i)
  end do
  allocate(v(D))

  su=sum(c)
  teika=su-c(t(1))
  v(1)=s(1,t(1))-teika
  last=0
  last(t(1))=1
  do i = 2, D
     teika=0
     do j = 1, 26
        teika=teika+c(j)*(i-last(j))
     end do
     teika=teika-c(t(i))*(i-last(t(i)))
     v(i)=v(i-1)+s(i,t(i))-teika
     last(t(i))=i
  end do

  do i = 1, D
     write(*,*) v(i)
  end do
  
  deallocate(s)
  deallocate(t)
  deallocate(v)

  stop
 end program answer


Measured memory_bytes: 2896
/*
    @uthor: Amit Kumar
    user -->GitHub: drviruses ; CodeChef: dr_virus_ ; Codeforces,AtCoder,Hackerearth,Hakerrank: dr_virus;
*/
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
using namespace std::chrono;
/* #include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
#define ln mp::cpp_int  */
#define ll    long long
#define ld    long double
#define ull   unsigned long long
#define endl "\n"
ll google_itr = 1;
#define google(x) cout<<"\Case #"<<x<<"\:"
#define pi 3.14159265358979323846264338327950L

const ll mod = 1e9+7;
const ll inf = 1e18;

ll popcount(ll num){
    num = num - ((num >> 1) & 0x55555555);
    num = (num & 0x33333333) + ((num >> 2) & 0x33333333);
    return ((num + (num >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}

void virus(){
    ll mul = 1;
    ll n;
    cin>>n;
    vector<ll> arr(n);
    for(auto &i:arr) cin>>i;
    
    ll z = 0;
    for(auto i:arr){
        if(i==0) z+=1;
    }
    if(z>0){
        cout<<"0";
        return;
    }
    for(auto  i=0;i<n;i++){
        if(arr[i ] <=1000000000000000000/ mul ){
        // This condition is equivalent to prod*a[i] <=10ˆ18
        mul *=arr[i];
        }else{
        cout<<"-1";
        return;
        }   
        }
  
 cout<<mul;
}


int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
  /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/

    ll t=1;
   // cin>>t;
    while(t--){
           auto start = high_resolution_clock::now();
           virus();
           auto stop = high_resolution_clock::now();
           auto duration = duration_cast<seconds>(stop - start);
         //cout << "Time: "<<duration.count()<<endl;
        //your code goes here
    }
    return 0;
}

Measured memory_bytes: 4004
/*AMETHYSTS*/
#pragma comment(linker, "/STACK:1000000000")
#include <cstdio>
#include <iostream>
#include <ctime>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <set>
#include <map>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <bitset>
#include <deque>
#include <stack>
#include <climits>
#include <string>
#include <queue>
#include <memory.h>
#include <unordered_map>
#include <random>

#define ll long long
#define ld double
#define pii pair <int, int>
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define mp make_pair
#define ui unsigned ll
#define pll pair <ll, ll>

using namespace std;

int main() {
	ll q, h, s, d, n;

	cin >> q >> h >> s >> d >> n;

	n *= 4;

	h = min(h, 2 * q);
	s = min(s, 2 * h);
	d = min(d, 2 * s);

	ll ans = (n / 8) * d;
	n %= 8;
	ans += (n / 4) * s;
	n %= 4;
	ans += (n / 2) * h;
	n %= 2;
	ans += n * q;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
num = int(input())

def nextPrime(x):
  a = []
  for i in range(1, x + 1):
      if x % i == 0:
          a.append(i)
  return a

f = (nextPrime(num))

if (len(f) != 2): 
  while (len(f) != 2): 
    num += 1
    f = nextPrime(num)
print (num)

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

int main() {
  int M, N;
  cin >> N >> M;
  vector<int> data(N);
  for (int i = 0; i < N; i++) {
    cin >> data.at(i);
  }
  sort(data.begin(), data.end());
  reverse(data.begin(), data.end());
  int sum = 0;
  for (int i = 0; i < N; i++) {
    sum += data.at(i);
  }
  
  if (data.at(M - 1)*4*M < sum) {
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}




Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n1,n2) for(int i=n1;i<n2;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define RREP(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

int main(){
    int n;
    cin >> n;
    put(n*800-n/15*200);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int n;
	cin>>n;
	int h[n];
	int ans=-1;
	int sna=0;
	for(int i=0;i<n;i++)
	{
		cin>>h[i];
	}
	for(int i=1;i<n;i++)
	{
		if(h[i]<=h[i-1])
		sna++;
		else{
			ans=max(ans,sna);
			sna=0;
		}
	}
	ans=max(ans,sna); 
	cout<<ans<<endl;
}


Measured memory_bytes: 640
X = int(input())

# B < 0
a_max = int(X**0.2) + 1
b_min = - a_max
for a in range(a_max + 1):
    for b in range(0, b_min - 1, -1):
        if a**5 == X + b**5:
            print(a, b)
            exit()

# B > 0
a_max = int(X**0.25) + 1
b_max = a_max

for a in range(a_max + 1):
    for b in range(b_max + 1):
        if a**5 == X + b**5:
            print(a,b)
            exit()


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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll X;
    cin >> X;
    ll ans = 1;
    FOR(i, X, 1) {
        ll n = i + 1;
        ll b = n * n;
        while (b <= X) {
            ans = std::max(ans, b);
            b *= n;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys

input = lambda: sys.stdin.readline().rstrip()


def solve():
    N = int(input())
    A = [0] + list(map(int, input().split()))
    B = [0] + list(map(int, input().split()))
    C = [0] + list(map(int, input().split()))

    ans = 0
    t = -10
    for i in range(1, N + 1):
        ans += B[A[i]]
        if A[i] == t + 1:
            ans += C[t]
        t = A[i]

    print(ans)


if __name__ == '__main__':
    solve()


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

    printf("%d %d %d", a, b, c);
    return 0;
}

Measured memory_bytes: 1708
N = int(input())
B = False
count = 0
array = list(map(int,input().split()))

def calc(n):
  return n / 2
  
  
while not B:
  for i in array:
    if i % 2 == 1:
      B = True
  if not B:
    array = list(map(calc, array))
    count += 1
  else:
    break
        
print(count)

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

static const int MAX=200000;

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a*b*c==5*5*7) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
const int MAX=1000010;
int dp[MAX];
string str;

int rec(int at,int end,int n){
	if(at>=end)return 0;
//	cout<<"    rec:string["<<at<<"] "<<str[at]<<endl;
	if(str[at]=='O')return 0;
	if(str[at]=='I'&& str[at+1]=='O'&& str[at+2]=='I'){
	//	cout<<"IOI"<<endl;
		dp[at]++;
		if(dp[at+2]!=0){
			dp[at]+=dp[at+2];
			return dp[at];
		}
		else {
			return (dp[at]+=rec(at+2,end,n));
		}
	}
	return 0;
}

int
main(){
	while(true){
		int n,_len,len;
		int ans;
		cin>>n;
		if(!n)break;
		cin>>len>>str;

/*		for(int i=0;i<len;i++)printf("%2d",i);
		cout<<endl;
		for(int i=0;i<len;i++){
			cout<<" "<<str[i];
		}
		cout<<endl;
		for(int i=0;i<len;i++){
			cout<<" "<<dp[i];
		}
		cout<<endl;
*/
		_len=len;
		int count=0;
		for(--len;true;len--){
			//cout<<"now:string["<<len<<"] "<<str[len]<<endl;
			if(len-(n*2)<0)break;
			if(str[len]=='O')continue;
			if(rec(len-(n*2),len,n)>=n){
				count++;
			}
		}
		cout<<count<<endl;
		for(int i=0;i<_len;i++)dp[i]=0;
	}
	return 0;
}

Measured memory_bytes: 3904
H,W,K = map(int, input().split())
C = [input() for _ in range(H)]

ans = 0
for a in range(2**H):
    for b in range(2**W):
        cnt = 0
        for i in range(H):
            if a & (1<<i) > 0:
                continue
            for j in range(W):
                if b & (1<<j) > 0:
                    continue
                if C[i][j] == "#":
                    cnt += 1
        if cnt == K:
            ans += 1
print(ans)

Measured memory_bytes: 9208
N = 10**4
primes = range(2, N+1)
for d in range(2, int(N**.5)+1):
  primes = [x for x in primes if x % d or x == d]

count = 0
for _ in range(int(input())):
    x = int(input())
    if x <= N:
        count += (x in primes)
    else:
        for prime in primes:
            if x % prime == 0:
                break
        else:
            count += 1
print(count)


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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 vector_finder(std::vector<int> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
  string S; cin >> S;
  string ans = "Yes";
  string a = S.substr(0, (S.size() - 1) / 2);
  string b = S.substr((S.size() + 3) / 2 - 1, (S.size() - 1) / 2);

  for(int i = 0; i < a.size()/2; ++i) {
    if(a[i] != a[a.size() - i - 1]) ans = "No";
  }

  for(int i = 0; i < b.size()/2; ++i) {
    if(b[i] != b[b.size() - i - 1]) ans = "No";
  }

  for(int i = 0; i < S.size()/2; ++i) {
    if(S[i] != S[S.size() - i - 1]) ans = "No";
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int a,b,d,r;
	double f;
	scanf("%d %d",&a,&b);
	d = a/b;
	r = a%b;
	f = (double)a/(double)b;
	printf("%d %d %lf\n",d,r,f);
	return 0;
}

Measured memory_bytes: 636
dp, n = [0, 0, 0], int(input())
for i in range(n):
  a, b, c = map(int, input().split ())
  dp = [max(dp[1], dp[2]) + a,
        max(dp[0], dp[2]) + b,
        max(dp[1], dp[0]) + c]
print(max(dp))

Measured memory_bytes: 3060
#include <cstdio>
#include <cmath>
#include <cstdint>
#include <cinttypes>
#include <iostream>
#include <vector>
#include <algorithm>
#include <tuple>
#include <numeric>

using namespace std;

int main()
{
    long k,x;
    cin >> k >> x;

    long begin = x - (k - 1);
    long end = x + (k - 1);

    for(long i = begin ; i <= end ; i++){
        cout << i << " ";
    }
    cout << endl;

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cstdio>
#include<string.h>
#include<vector>
using namespace std;
const int N=110;

int main ()
{
    int n;
    cin>>n;
    if(n>=30){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3616
#include <stdio.h>

int main(){
    double r = 0;
    double area = 0;
    double circle = 0;
    double en = 3.1415926535897;
    
    scanf("%lf",&r);
    
    area = r * r * en;
    circle = 2 * (double)r * en;
    printf("%.5lf %.5lf",area,circle);
    
    return 0;
}


Measured memory_bytes: 2112
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int t[60];
string S[60];
int main()
{
	int N;
	string X;
	cin >> N;
	int ans = 0;
	for (int i = 0; i < N; i++) {
		cin >> S[i] >> t[i];
		ans += t[i];
	}
	cin >> X;
	for (int i = 0; i < N; i++) {
		ans -= t[i];
		if (S[i] == X) break;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#define E(n,e)else if(!(k&n))for(x=0;x<5;x++)puts(k&1<<(e+x)?"1":"2");
i,k;main(x){for(;;i++){scanf("%d",&x);if(!x)return 0;k+=1<<(5*x+i);if(i==4){if((k&992&&k&31744&&k&1015808)||(k&992)==992||(k&31744)==31744||(k&1015808)==1015808)for(x=5;x--;)puts("3");E(992,10)E(31744,15)E(1015808,5)k=0,i=-1;}}}

Measured memory_bytes: 0
N,M,C = list(map(int,input().split()))
import numpy as np
B = np.array(input().split() ,dtype=np.int64)
ret =0
for i in range(N):
    if( np.sum(B * np.array(input().split() ,dtype=np.int64)) +C>0):
        ret += 1
print(ret)

Measured memory_bytes: 14432
#include <stdio.h>
#include <stack>
 
int main(void) {
  std::stack<int> st;
  int n;
  while(scanf("%d", &n) != EOF) {
    if(n) st.push(n);
    else {
      printf("%d\n", st.top());
      st.pop();
    }
  }
  return 0;
}


Measured memory_bytes: 2616
def main():
    n, m = map(int, input().split())

    pairs = []
    for i in range(m):
        a, b = map(int, input().split())
        pairs.append((a, b))

    pairs.sort(key=lambda tup: tup[0])

    cnt = 1
    left, right = -1, 100001
    for i in range(m):
        if right <= pairs[i][0]:
            cnt += 1
            left, right = pairs[i][0], pairs[i][1]
        else:
            if left < pairs[i][0]:
                left = pairs[i][0]
            if pairs[i][1] < right:
                right = pairs[i][1]

    print(cnt)


if __name__ == '__main__':
    main()


Measured memory_bytes: 18180
#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <algorithm>
#include <iomanip>

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define MOD 1000000007

typedef long long ll;

// 二項係数計算用配列
ll comb[51][51];

// パスカルの三角形を用いて二項係数を計算
void cal_comb(int N) {
	for (int i = 0; i <= N; ++i) {
		for(int j = 0; j <= i; ++j) {
			if (j == 0 || j == i) {
				comb[i][j] = 1;
			}
			else {
				comb[i][j] = comb[i - 1][j - 1] + comb[i - 1][j];
			}
		}
	}
}

using namespace std;
int main(){
    int N, A, B;
    cin >> N >> A >> B;
    vector<ll> v;
    REP(i, N) {
    	ll tmp;
    	cin >> tmp;
    	v.push_back(tmp);
    }

    cal_comb(N);
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());

    double max_ave = 0.0f;
    REP(i, A) {
    	max_ave += v[i];
    }
    max_ave /= A;

    // 平均値が最大となる集合のなかで価値が最小の要素
    ll min_element = v[A - 1];
    // count_min_element_in_A : 降順にソードした集合のうち、先頭からA個以内にmin_element が何個あるか
    // count_min_element_in_N : 降順にソードした集合のうち、min_element が何個あるか
    int count_min_element_in_A = 0, count_min_element_in_N = 0;
    REP(i, N) {
    	if (v[i] == min_element) {
    		count_min_element_in_N++;
    		if (i < A) count_min_element_in_A++;
    	}
    }

    // 平均値が最大となる組み合わせは、もとの集合にmin_element がA 個以上あったとき
    // sum_(i=A)^B comb[count_min_element_in_N][i]
    // A個未満のとき
    // comb[count_min_element_in_N][count_min_element_in_A]
    ll count_max_comb = 0;
    if (count_min_element_in_A == A) {
    	for (int i = A; i <= B; ++i) count_max_comb += comb[count_min_element_in_N][i];
    }
    else {
    	count_max_comb += comb[count_min_element_in_N][count_min_element_in_A];
    }

    cout.precision(20);
    cout << fixed << max_ave << endl;
    cout << count_max_comb << endl;
    
}


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

mod = int(10**9 + 7)

a = 1
b = n - k + 1
print((a * b) % mod)
for i in range(1, k):
    if i >= min(k, n - k + 1):
        print(0)
    else:
        a *= k - i
        b *= n - k + 1 - i
        a //= i
        b //= i + 1
        print((a * b) % mod)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  string S,T;
  cin>>S;
  for(int i=0;i<S.size();i+=2)
    T+=S[i];
  cout<<T;
  }


Measured memory_bytes: 512