akhauriyash/Code-Regression huggingface dataset:
/* basic header */
#include <bits/stdc++.h>
/* define */
#define ll long long
#define dou double
#define pb emplace_back
#define mp make_pair
#define sot(a,b) sort(a+1,a+1+b)
#define rep1(i,a,b) for(int i=a;i<=b;++i)
#define rep0(i,a,b) for(int i=a;i<b;++i)
#define eps 1e-8
#define int_inf 0x3f3f3f3f
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lson curPos<<1
#define rson curPos<<1|1
/* namespace */
using namespace std;
/* header end */

int a, p;

int main() {
    cin >> a >> p;
    cout << (a * 3 + p) / 2 << endl;
    return 0;
}

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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

#define P pair<lli,lli>

signed main(){

	lli x,y;
	cin>>x>>y;

	lli cnt=0;
	while(x<=y){
		cnt++;
		x*=2;
	}
	cout<<cnt<<endl;

	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
    static PrintWriter out = new PrintWriter(System.out);
    static Scanner sc = new Scanner(System.in);
    static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    long mod = 1000000000+7;

    public static void main(String[] args) throws IOException {
        Main main = new Main();
        main.solve();
//        out.println(main.solve());
        out.flush();
    }
    void solve() throws IOException {
        int n = sc.nextInt();
        long[] a = new long[n], b = new long[n];
        for(int i=0; i<n; i++){
            a[i] = sc.nextLong(); b[i] = sc.nextLong();
        }
        Arrays.sort(a); Arrays.sort(b);
        long ans;
        if(n%2==1) ans = solveOdd(a,b);
        else ans = solveEven(a,b);
        out.println(ans);
    }
    long solveOdd(long[] a, long[] b){
        int n = a.length;
        long lo = a[n/2], hi = b[n/2];
        return Math.abs(hi-lo)+1;
    }
    long solveEven(long[] a, long[] b){
        int n = a.length;
        long lo = a[n/2-1]+a[n/2], hi = b[n/2-1]+b[n/2];
        return Math.abs(hi-lo)+1;
    }
}

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

const int maxn = 2005, oo = 2e9+9;
int N, Z, W;
int a[maxn];

int dp[2][maxn][maxn];

void amax(int& a, int b) {
    a = max(a,b);
}

void amin(int& a, int b) {
    a = min(a,b);
}

int mx[maxn][maxn], mn[maxn][maxn];

int main()
{
    //ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin >> N >> Z >> W;
    for (int i = 1; i <= N; i++) {
        cin >> a[i];
    }
    if (N == 1) {
        cout << abs(a[1]-W) << '\n';
    }
    else {
        cout << max(abs(a[N]-W),abs(a[N]-a[N-1])) << '\n';
    }
}



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

#define INF INT_MAX
#define UINF UINT_MAX
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef std::pair<int,int> pii;

using namespace std;

int main() {
    double n;
    cin >> n;
    int temp = (int)n % 2 == 0 ? n/2 : n/2 + 1; 
    printf("%.7lf\n", (double)temp/n);

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
// #include<map>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin >> n;
    // vector<int> num(n);
    // map<int, int> mp;
    const int all = 100001;
    vector<int> nums(all, 0);
    uint64_t sum = 0;
    for(int i=0; i<n; i++){
        uint64_t tmp;
        cin >> tmp;
        sum += tmp;
        nums[tmp]++;
    }
    int q;
    cin >> q;
    for(int k=0; k<q; k++){
        uint64_t b, c;
        cin >> b >> c;
        
        int bs = nums[b];
        sum = sum-b*bs + c*bs;
        nums[b] = 0;
        nums[c] += bs;

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

Measured memory_bytes: 3704
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,t=0;
    cin>>a>>b>>c;
    if(a<b) swap(a,b);
    if(a<c) swap(a,c);
    while(a-b>1)
    {
        t++;b+=2;
    }
    while(a-c>1)
    {
        t++;c+=2;
    }
    if(a!=b&&a!=c) cout<<t+1;
    else if(a==b&&b==c) cout<<t;
    else cout<<t+2;
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';

/////////////////////////////////////////////////////////////////////////////////

template <typename F, typename Monoid, typename H, typename T>
struct Rerooting {
    int N;
    vector<vector<int>> G;
    vector<T> subdp,dpL,dpR,dp;
    F f;
    Monoid merge;
    H h;
    T unity;

    Rerooting(int N, F f, Monoid merge, H h, T unity) : 
        N(N), G(N), subdp(N), dpL(N), dpR(N), dp(N), 
        f(f), merge(merge), h(h), unity(unity) {}

    void add_edge(int u, int v) {
        G[u].emplace_back(v);
        G[v].emplace_back(u);
    }

    void build(int r = 0) {
        dfs_sub(r,-1);
        dfs_all(r, unity);
    }

private:
    void dfs_sub(int v, int pv) {
        for (int &nv : G[v]) {
            if (nv == pv) swap(nv,G[v].back());
        }
        if (~pv) G[v].pop_back();
        subdp[v] = unity;
        for (int nv : G[v]) {
            dfs_sub(nv,v);
            subdp[v] = merge(subdp[v],f(subdp[nv],nv));
        }
        subdp[v] = h(subdp[v],v);
    }

    //valは親を子と見立てたときのf(subdp[pv],pv)の値
    void dfs_all(int v, T val) {
        dp[v] = val;
        T left = unity;
        for (int i = 0; i < (int)G[v].size(); i++) {
            int nv = G[v][i];
            dpL[nv] = left = merge(left,f(subdp[nv],nv));
            dp[v] = merge(dp[v],f(subdp[nv],nv)); 
        }
        T right = unity;
        for (int i = (int)G[v].size()-1; i >= 0; i--) {
            int nv = G[v][i];
            dpR[nv] = right = merge(right,f(subdp[nv],nv));
        }
        for (int i = 0; i < (int)G[v].size(); i++) {
            int nv = G[v][i];
            T L = i == 0 ? unity : dpL[G[v][i-1]];
            T R = i == (int)G[v].size()-1 ? unity : dpR[G[v][i+1]];
            dfs_all(nv,f(h(merge(val,merge(L,R)),v),v));
        }
    }
};

/////////////////////////////////////////////////////////////////////////////////////

void EDPC_V() {
    ll N,M; cin >> N >> M;
    auto f=[&](ll a, int v) {(void)v; return (a+1)%M;};
    ll unity = 1;
    auto g=[&](ll a, ll b) {return a*b%M;};
    auto h=[](ll a, int v) {(void)v; return a;};
    Rerooting R(N,f,g,h,unity);
    rep(i,N-1) {
        int u,v; cin >> u >> v;
        --u; --v;
        R.add_edge(u,v);
    }
    R.build();
    rep(i,N) {
        cout << R.dp[i] << ln;
    }
}
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    EDPC_V();
}

/*
  verified on 2020/08/10
  https://atcoder.jp/contests/dp/tasks/dp_v
*/

Measured memory_bytes: 18420
#include <iostream>
#include <cstdio>
using namespace std; 
typedef long long ll; 
int n; 
ll arr[55]; 
inline bool chk(ll num)
{
	ll res = 0; 
	for (int i = 0; i < n; i++)
		res += (arr[i] + num) / (n + 1); 
	return res >= num; 
}
int main()
{
	// freopen("ARC079-C.in", "r", stdin); 
	scanf("%d", &n); 
	for (int i = 0; i < n; i++)
		scanf("%lld", arr + i); 
	ll ans = 1e18; 
	for (int i = 0; i <= n; i++)
	{
		ll l = 0, r = 1e16, res; 
		while (l <= r)
		{
			ll m = l + r >> 1; 
			if (chk(m * (n + 1) + i))
				l = m + 1; 
			else
			{
				res = m; 
				r = m - 1; 
			}
		}
		// cout << i << " " << res << endl; 
		ans = min(ans, res * (n + 1) + i); 
	}
	printf("%lld\n", ans - 1);
	return 0; 
}


Measured memory_bytes: 256
program judge

 implicit none
 integer::n,ans1,ans2,ans3,ans4,i
 character,allocatable::s(:)*3

 read*,n
 allocate(s(n))

 read*,s

! print*,s

ans1=0
ans2=0
ans3=0
ans4=0


do i=1,n
 if(s(i)=='AC') then
  ans1=ans1+1
 end if
 
 if(s(i)=='WA') then 
   ans2=ans2+1
 end if

 if(s(i)=='TLE') then
   ans3=ans3+1
 end if

 if(s(i)=='RE') then 
   ans4=ans4+1
 end if


end do


print*,'AC x ',ans1
print*,'WA x ',ans2
print*,'TLE x ',ans3
print*,'RE x ',ans4

end program judge

Measured memory_bytes: 3228
#include<iostream>
#include<string>
using namespace std;
int main(){
	string message;
	cin>>message;
	int l=message.length();
	for(int i=0;i<l/2;i++)
	{if(message[i]!=message[l-i-1])
	{cout<<"No"<<endl;
	return 0;
	}
	} l=(l-1)/2;
		for(int i=0;i<l/2;i++)
	{if(message[i]!=message[l-1-i])
	{cout<<"No"<<endl;
	return 0;
	}
	}
	l=(message.length()+3)/2;
		for(int i=l-1;i<message.length();i++)
	{if(message[i]!=message[message.length()-1-i])
	{cout<<"No"<<endl;
	return 0;
	}
	}cout<<"Yes"<<endl;}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

int main(){
  ll n,t,ans=0,res=0; cin>>n>>t;
  vector<ll> d(n);
  cin>>d[0];
  for(ll i=1; i<n; i++) {
    ll x; cin>>x;
    d[i] = x-res;
    res = x;
  }
  for(ll i=1; i<d.size(); i++) {
    if(d[i]>t) ans += t;
    else ans += d[i];
  }
  ans += t;
  cout<<ans;
}

Measured memory_bytes: 1792
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int n = 0, m = 0;
		int b = 0;
		int temp1 = 0;
		int temp2 = 0;
		int sum = 0;
		int count1 = 0;
		int count2 = 0;
		String str;
		ArrayList<String> st = new ArrayList<String>(); // ??\?????????????????????b,f,r,v
		ArrayList<Integer> parse = new ArrayList<Integer>(); // int??????
		/**
		 * ???????????\???(n*m??????)
		 */
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt(); // n,m????±????
		m = scan.nextInt();
		int matrix[][] = new int[n][m];
		int vector[] = new int[m];
		int anser[] = new int[n];
		// System.out.println(n+" "+m);
		for (int a = 0; a < n; ++a) { // ??\?????¶??°????????????
			for (int t = 0; t < m; ++t) { // ??\??????????????????????????????????????????????´?
				st.add(scan.next());
			}
			for (int p = count1; p < st.size(); ++p) { // String???Int??????
				str = st.get(p);
				temp1 = Integer.parseInt(str);
				parse.add(temp1);
				//System.out.println("parse[" + p + "] = " + parse.get(p));
			}
			count1 += m;
		}
		for (int k = 0; k < n; ++k) { // n*m??????????????????????????\
			for (int l = 0; l < m; ++l) {
				matrix[k][l] = parse.get(count2++);
				//System.out.println("matrix[" + k + "][" + l + "] : " + matrix[k][l]);
			}
		}
		/**
		 * ???????????\???(m*1????????????)
		 */
		for (int i = 0; i < m; ++i) {
			b = scan.nextInt();
			vector[i] = b;
		}
		/**
		 * ?¨???? n*m???????????¨m*1????????????????????????n*1????§£????±?????????????
		 */
			for (int d = 0; d < n; ++d) {
				for (int f = 0; f < m; ++f) {
					sum += matrix[d][f] * vector[f];
				}
				anser[d] = sum;
				System.out.println(anser[d]);
				sum = 0;
		}

	}
}

Measured memory_bytes: 40388
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;


template<typename T, typename U>
std::enable_if_t<std::rank<T>::value == 0> fill_all(T& arr, const U& v) {
	arr = v;
}
template<typename ARR, typename U>
std::enable_if_t<std::rank<ARR>::value != 0> fill_all(ARR& arr, const U& v) {
	for (auto& i : arr) {
		fill_all(i, v);
	}
}

int32_t N;
constexpr int64_t INF = 30001000000000555;
int64_t A[3100];
int64_t dp[3100][3100];
//[]
int64_t func(int l, int r)
{
	if (r < l) { return 0; }

	auto& memo = dp[l][r];
	if (memo != INF) {
		return memo;
	}
	return memo = std::max(
		A[l] - func(l + 1, r),
		A[r] - func(l, r - 1)
	);
}


int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);
	fill_all(dp, INF);
	in >> N;
	for (size_t i = 0; i < N; i++)
	{
		in >> A[i];
	}

	out << func(0, N - 1) << endl;

	return 0;
}
#endif


Measured memory_bytes: 75520
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		in.nextLine();
		String[] line = in.nextLine().split(" ");
		StringBuilder sb = new StringBuilder();

		for (int i = line.length -1; i >= 0; i--) {
			sb.append(" ").append(line[i]);
		}
		System.out.println(sb.delete(0, 1).toString());
	}
}

Measured memory_bytes: 17304
#include<stdio.h>

static const int N = 1000;

void trace (int *,int);

int main(){
  int n, i, j,v;
  int A[N+1];

  
  scanf("%d", &n);

  for ( i = 1; i <= n; i++ ) {
    scanf("%d", &A[i]);
  }  
  for(i=1;i<=n;i++){
   v=A[i];
   j=i-1;
   while(j>=0 && A[j] > v){
   	  A[j+1] = A[j];
	  j--;
	  A[j+1]=v;
	  }
   trace(A,n);
}

  return 0;
}



void trace(int A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

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

int main() {
	int A, B, K;
	cin >> A >> B >> K;
	for (int i = A;i <= B;++i) {
		if (A + K <= i && i <= B - K) {
			continue;
		}
		cout << i << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		int h= 0;
		int result = 1;

		for (int i = 0; i< n; i++) {
			h += sc.nextInt();
			if (h <= x) {
				result += 1;
			} else {
				break;
			}
		}

		System.out.println(result);
	}

}


Measured memory_bytes: 21972
def main():
    N_keta = int(input())
    S = input()

    total = 0

    for n in range(0, 1000):
        FLAG = True
        n_str = "{:03}".format(n)
        pos = 0
        
        for i in n_str:
            numberS = S[pos:]
            if (i not in numberS):
                FLAG = False
                break
            else:
                pos += numberS.index(i) + 1
        
        if (FLAG):
            total += 1

    print(total)


if __name__ == '__main__':
    main()

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

int main(void) {
	int n, x, i, j, k, count;
	while (1) {
		cin >> n >> x;
		if (!n && !x)
			break;
		for (i = 1, count = 0; i <= n; i++) {
			for (j = i + 1; j <= n; j++) {
				for (k = j + 1; k <= n; k++) {
					if (i + j + k == x)
						count++;
				}
			}
		}
		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
import numpy as np

N = int(input())
lst = []
for j in range(2):
    lst.append([int(i) for i in input().split()])

arr = np.array(lst)
col1 = arr[0,0]
col2 = np.sum(arr[1,:])
max_v = col1 + col2

for i in range(N-1):
    col1 += arr[0, i+1]
    col2 -= arr[1, i]
    if (max_v < col1 + col2):
        max_v = col1 + col2

print(max_v)


Measured memory_bytes: 20904
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    int X, A, B;
    cin >> X >> A >> B;
    if (A - B >= 0) {
        cout << "delicious" << endl;
    } else if (B - A <= X) {
        cout << "safe" << endl;
    } else {
        cout << "dangerous" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
W,H,N = map(int, input().split())
l = 0
r = W
row = 0
up = H
for i in range(N):
    x,y,a = map(int, input().split())
    if a == 1:
        if x > l:
            l = x
    elif a == 2:
        if x < r:
            r = x
    elif a == 3:
        if y > row:
            row = y
    elif a == 4:
        if y < up:
            up = y
print(max(max((r-l),0)*max((up-row),0),0))

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

int main(){
  int n,k;
  cin >> n >> k;
  vector<int> h(n);
  for(int i=0;i<n;i++) cin >> h.at(i);
  sort(h.begin(),h.end());
  int ans=h.at(k-1)-h.at(0);
  for(int i=0;i<=n-k;i++) ans=min(ans,h.at(i+k-1)-h.at(i));
  cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <cmath>
#include <ios>
#include <ctype.h>
#include <stack>
#include <istream>
#include <stdio.h>
#include <map>
#include <set>
#include <queue>
#include <unordered_map>
#include <functional>
#include <bitset>
#include <list>
#include <deque>
#include <time.h>
#include <random>
#include <iomanip>
#include <fstream>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define pint pair<int,int>
#define SEG_LEN (1 << 18)
const int INF = 1000000007;
const long double EPS = 1e-15;
const long double PI = acos(-1);
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
using Graph_weighted = vector<vector<pair<int,int>>>;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
ll ceil(const ll a, const ll b) { return (a + b - 1) / b; }
void Prime_Factor(ll n,map<ll,ll> &ans){
  for(ll i = 2; i * i <= n; i++){
    while(n % i == 0){
      ans[i]++;
      n /= i;
    }
  }
  if(n != 1)ans[n]++;
  return;
}
int main(){
  ll n;
  cin >> n;
  map<ll,ll> ans;
  rep(i,n)Prime_Factor(i + 1,ans);
  ll a = 1;
  for(auto i : ans)a = a * (i.second + 1) % INF;
  cout << a << endl;
  return 0;
}


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

using namespace std;

int main() {
	string s; cin >> s;
	int maxi = 0, tmp = 0;
	for (int i = 0; i < s.size(); ++i) {
		if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') tmp++;
		else tmp = 0;

		maxi = max(maxi, tmp);	
	}
	cout << maxi << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main (void)
{
    int j,i,a[31],c[31],r,n,s[31];
    char b;
    scanf("%d%d",&r,&n);
    for(i=1;i<r+1;i++)
    {
        s[i]=i;
    }
    for(i=1;i<n+1;i++)
    {
        scanf("%d%c%d",&a[i],&b,&c[i]);
    }
    for(i=1;i<n+1;i++)
    {
        j=s[a[i]];
        s[a[i]]=s[c[i]];
        s[c[i]]=j;
    }
    for(i=1;i<r+1;i++)
    {
        printf("%d\n",s[i]);
    }
    return 0;


}

Measured memory_bytes: 596
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        new Program().Calc();
    }

    Scanner cin;

    public Program() { }

    bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }

    void Calc()
    {
        cin = new Scanner();

        long h = cin.nextLong();

        double l = Math.Log(h) / Math.Log(2);

        long ans = (long)Math.Pow(2, (int) l + 1) - 1;

        WriteLine(ans);
    }
}

public static class StringExtension
{
    public static char GetChar1(this string str, int indexOneBase)
    {
        return str[indexOneBase - 1];
    }
}

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 11092
// Code by Nguyen Huu Lam
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

typedef long long LL;

#define y0 Sword_Art_Online
#define y1 Your_lie_in_April
#define yn Darling_in_the_Franxx
#define tm Plastic_Memories
#define lr Charlotte
#define norm Weathering_with_you
#define left Violet_Evergarden
#define have Date_a_live
#define ends Your_name
#define prev Five_centimeters_per_second
#define hash Slient_voice

#define ordered_set tree<LL, null_type, less<LL>, rb_tree_tag, tree_order_statistics_node_update>
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

LL Rand(LL l, LL h){
    return uniform_int_distribution<LL>(l, h)(rng);
}

template <typename T> void read(T &t){
    t = 0; char ch = getchar(); int f = 1;
    while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); }
    do { (t *= 10) += ch - '0'; ch = getchar(); } while (isdigit(ch)); t *= f;
}

const LL MaxN = 1 + 1e5;

LL n, a[MaxN], kq;
string s;

void InOut(){
    #define TASK "ABC"
    freopen(TASK".inp","r",stdin);
    freopen(TASK".out","w",stdout);
}

int main(){
    #ifdef LOCAL
        InOut();
        auto st = chrono::high_resolution_clock::now();
    #endif

    cin >> n;
    cin >> s;
    for(int i = 0 ; i < n - 2 ; ++i){
        string s1 =  s.substr(i, 3);
        if(s1 == "ABC") kq++;
    }
    cout << kq << endl;

    #ifdef LOCAL
        auto ed = chrono::high_resolution_clock::now();
        auto diff = ed - st;
        cerr << chrono::duration <double, milli> (diff).count() << " ms" << endl;
    #endif

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define req(i,n,m) for(int i=n;i<m;i++)
#define REQ(i,n,m,l) for(int i=n;i<m;i+=l) 
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
signed gcd(int x, int y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
signed lcm(int x, int y) {
    return x / gcd(x, y) * y;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
    int N; cin >> N;
    string A, B, C; cin >> A >> B >> C;
    int ans = 0;
    rep(i, N) {
        if (A.at(i) != B.at(i) && C.at(i) != B.at(i) && A.at(i) != C.at(i))ans += 2;
        else if (A.at(i) == B.at(i) && A.at(i) == C.at(i)) {}
        else ans += 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3620
#include<iostream>
#include<vector>
typedef long long ll;

std::vector<ll> nums(87);

ll lucas(ll n){
        if(n==0) return 2;
        if(n==1) return 1;
        if(nums[n]) return nums[n];
        nums[n] = lucas(n-1) + lucas(n-2);
        return nums[n];
}

int main(){
        nums[0] = 2;
        nums[1] = 1;
        ll n; scanf("%lld", &n);
        printf("%lld\n", lucas(n));
        return 0;
}

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

int A[ 5010 ];

int main()
{
int i;
int iCnt;
int N, K;
long long iSum;

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

	cin >> N;
	cin >> K;

	for( i = 0; i < N; i++ ) cin >> A[ i ];

	sort( A, A + N );

	iSum = 0;
	iCnt = 0;
	for( i = N - 1; i >= 0; i-- )
	{
		if( iSum + A[ i ] >= K )
			iCnt = 0;
		else
		{
			iCnt++;
			iSum += A[ i ];
		}
	}

	cout << iCnt << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  
  int n; cin >> n;
  vector<lint> a(n);
  vector<lint> acc(n + 1, 0);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    acc[i + 1] = acc[i] + a[i];
    acc[i + 1] %= MOD;
  }

  lint ans = 0;
  for (int i = 0; i < n; i++) {
    ans += a[i] % MOD * (MOD + acc[n] - acc[i + 1]) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5936
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
static const double EPS = 0.0000001;
static const double C = 3.14159265358979323846 / 180;

int main() {
    int a, b, x; cin >> a >> b >> x;
    double min = 0.0, max = 90.0;

    while (max - min > EPS) {
        double mid = (max + min) / 2;
        double ha = a * sin(mid * C);
        double hb = b * sin((90 - mid) * C);
        double v;

        if (ha > hb) {
            double t = tan((90 - mid) * C);
            double h = b * t;
            v = h * a * b / 2;
        } else {
            double t = tan(mid * C);
            double h = a * t;
            v = a * a * b - (a * a * h / 2);
        }

        if (v > x) min = mid;
        else max = mid;
    }

    double out = (max + min) / 2.0;
    cout << setprecision(13) << out << endl;

    return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<string>
#include<vector>
using namespace std;

const long mod = 1000000007;
const long indlim = 5368709119;
long gcd(long x, long y) { if (x > y) { return gcd(y, x); } long r; while (y != 0) { r = x % y; x = y; y = r; }return x; }
long lcm(long x, long y) { return(x / gcd(x, y)) * y; }
long fact(long x) { if (x == 0) return 1; else return((fact(x - 1) * x) % mod); }
long mybase(long N, long B) { if (N == 0) return 0; string S = ""; while (N != 0) { string M = to_string(N % B); N -= N % B; N /= B; S = M + S; }return stol(S); }
void indexsort(long* first, long* last, long* func) { sort(first, last, [&](long a, long b) {return func[a] < func[b]; }); }
//--------------------

int main() {

	long N; cin >> N;
	string stn = to_string(N);
	long stnlen = stn.length();
	long stnsum = 0;

	for (int i = 0; i < stnlen; i++) stnsum += (long)(stn[i] - '1' + 1);

	string res = (N % stnsum == 0) ? "Yes" : "No";

	cout << res << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
using namespace std;
#define MAX_N 100000
long double x[MAX_N];
long double y[MAX_N];
int N;
bool solve(long double a, int b) {
	for (int i = 0; i < b; i++) {
		long double X1 = a, Y1 = x[b];
		long double X2 = y[i], Y2 = x[i];
		long double dist = (X2 - X1)*(X2 - X1) + (Y2 - Y1)*(Y2 - Y1);
		if (a < y[i]) { return false; }
		if (dist < (x[i] + x[b])*(x[i] + x[b])) { return false; }
	}
	if (x[b] > a) { return false; }
	return true;
}
int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> x[i];
		if (i == 0) { y[i] = x[i]; }
		else {
			long double L = 0, R = 1000000000.00, M;
			for (int k = 0; k < 1500; k++) {
				M = (L + R) / 2;
				bool a1 = solve(M, i);
				if (a1 == true) { R = M; }
				else { L = M; }
			}
			y[i] = M;
		}
	}
	long double minx = 0;
	for (int i = 0; i < N; i++) {
		long double dis = y[i] + x[i];
		if (dis > minx) { minx = dis; }
	}
	cout << fixed << setprecision(14) << minx << endl;
	return 0;
}

Measured memory_bytes: 1316
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;

int n;
ll a[18];

ll solve (int l, int r, int xl, int xr) {
    if (l+1 == r) return 0;
    ll ret = linf;
    for (int i = l+1; i < r; i++) {
        ret = min(ret, solve(l, i, xl, xl+xr) + solve(i, r, xl+xr, xr) + a[i] * (xl+xr));
    }
    return ret;
}

int main() {
    cin >> n;
    rep(i,n) cin >> a[i];
    cout << solve(0, n-1, 1, 1) + a[0] + a[n-1] << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
long long x[100000005];
long long ans=400000000;
int main(void){
    int n,k;cin>>n>>k;
    
    for(int i=0;i<n;i++){
        cin>>x[i];
    }
    for(int i=0;i<n-k+1;i++){
        
        if(x[i]*x[i+k-1]<0)ans=min(ans,min(abs(x[i]),abs(x[i+k-1]))*2+max(abs(x[i]),abs(x[i+k-1])));
        else ans=min(ans,max(abs(x[i]),abs(x[i+k-1])));
        
    }
    cout<<ans<<endl;
    
    return 0;
}


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

using namespace std;

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

    unsigned int a = 0;
    for (int i = 0; i < N; ++i) {
        unsigned int b;
        cin >> b;
        a ^= b;
    }

    if (a == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int n, c, val, x[209], match[209]; bool p[10000009], used[209]; vector<int> g[209];
bool augment(int pos) {
	used[pos] = true;
	for (int i : g[pos]) {
		if (match[i] < 0 || !used[match[i]] && augment(match[i])) {
			match[pos] = i;
			match[i] = pos;
			return true;
		}
	}
	return false;
}
int bipartite_matching() {
	int res = 0;
	fill(match, match + c, -1);
	for (int i = 0; i < c; i++) {
		if (match[i] < 0) {
			fill(used, used + c, false);
			if (augment(i)) res++;
		}
	}
	return res;
}
int main() {
	for (int i = 3; i <= 10000000; i += 2) p[i] = true;
	for (int i = 3; i * i <= 10000000; i += 2) {
		if (!p[i]) continue;
		for (int j = i * i; j <= 10000000; j += i) p[j] = false;
	}
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> val;
		if (c == 0 || val != x[c - 1]) x[c++] = val;
		else c--;
		x[c++] = val + 1;
	}
	int cnt = 0;
	for (int i = 0; i < c; i++) {
		if (x[i] % 2 == 0) cnt++;
	}
	for (int i = 0; i < c; i++) {
		for (int j = i + 1; j < c; j++) {
			if (p[x[j] - x[i]]) {
				g[i].push_back(j);
				g[j].push_back(i);
			}
		}
	}
	int ret = bipartite_matching();
	cout << c / 2 + (c / 2 - ret) + (cnt - ret) % 2 << endl;
	return 0;
}

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

using namespace std;

int main(){
    ios::sync_with_stdio(false);
    int a,b;
    cin>>a>>b;
    vector<int> v{a+b,a-b,a*b};
    sort(v.rbegin(), v.rend());
    cout<<v[0]<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int H,W;
    cin>>H>>W;
    
    for(int i=0;i<W+2;i++) cout<<"#";
    
    cout<<"\n";
    
    for(int i=0;i<H;i++){
        string s;
        cin>>s;
        cout<<"#"<<s<<"#\n";
    }
    
    for(int i=0;i<W+2;i++) cout<<"#";
    
    cout<<"\n";
    

}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner I = new Scanner(System.in);
    int a =I.nextInt();
    int b =I.nextInt();
    int c=1; int d=1;
    if(a>=b){
      for(int i=0;i<a;i++){
         c = 10*c;}
      int e = (c-1)*b/9;
      System.out.println(e);}
    else{
      for(int i=0;i<b;i++){
         d = 10*d;}
      int f = (d-1)*a/9;
      System.out.println(f);}
  }
}
      

Measured memory_bytes: 20564
#include <stdio.h>
 
int main(){
    int tr[10],v1,v2;
   
    while(~scanf("%d",&tr[0])){
        double a = 0;
        int sum = tr[0];
        for(int i = 1 ; i < 10 ; i++){
            scanf(",%d",&tr[i]);
            sum += tr[i];
        }
        scanf(",%d,%d",&v1,&v2);
         
        a = v1*((double)sum/(v1+v2));
         
        sum = 0;
        for(int i = 0 ; i < 10 ; i++){
            sum += tr[i];
            if(a <= sum){
                printf("%d\n" ,i+1);
                break;
            }
        }
    }
    return 0;
}

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

int main() {
   int N;
   cin >> N;
   int count=0;
   for (int i=1;i<=N; i++) {
       int coun=0;
       for (int j=1; j<=i; j++) {
           if (i%j==0) coun++;
       }
       if (coun==8 && i%2!=0) count++;
   }
   cout << count << endl;
}

Measured memory_bytes: 256
function equal(a, b) {
    var aP = Object.getOwnPropertyNames(a);
    var bP = Object.getOwnPropertyNames(b);
    if (aP.length != bP.length)
        return false;
    for (var i = 0; i < aP.length; i++)
        if (a[aP[i]] !== b[aP[i]])
            return false;
    return true;
}
function pi(text) {
    return parseInt(text, 10);
}
function main(input) {
    console.log(pi(input) <= 999 ? "ABC" : "ABD");
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }

bool ng[10000][4];
int dp[10000][1 << 4];

bool check(int y, int bit) {
    FOR(x, 0, 4)if (ng[y][x] && !(bit & (1 << x))) {
        return false;
    }
    return true;
}

int main() {
    init();

    int h, n;
    cin >> h >> n;
    int x, y;
    FOR(i, 0, n) {
        cin >> x >> y;
        ng[y][x] = true;
    }

    FOR(i, 0, h - 1)FOR(u, 0, 1 << 4)if (check(i, u)) {
        FOR(d, 0, 1 << 4)if (check(i + 1, d)) {
            FOR(x, 0, 3) {
                if (u & (1 << x)) continue;
                if (u & (1 << (x + 1))) continue;
                if (d & (1 << x)) continue;
                if (d & (1 << (x + 1))) continue;
                chmax(dp[i + 1][d + (1 << x) + (1 << (x + 1))], dp[i][u] + 1);
            }

            if (!(u || d))chmax(dp[i + 1][(1 << 4) - 1], dp[i][0] + 2);
            chmax(dp[i + 1][d], dp[i][u]);
        }
    }

    int ans = 0;
    FOR(d, 0, 1 << 4)if (check(h - 1, d))chmax(ans, dp[h - 1][d]);
    cout << ans << "\n";
}



Measured memory_bytes: 3840
n, m = map(int, input().split())
A = [False for i in range(n+1)]
for i in range(m):
    a = int(input())
    A[a] = True

dp = [0 for i in range(n+1)]
dp[0] = 1

for i in range(1, n+1):
    if A[i]:
        dp[i] = 0
    else:
        dp[i] = (dp[i-1] + dp[i-2]) % 1000000007

print(dp[-1])


Measured memory_bytes: 7832
function Main(input){
  var inp = input.split('\n');
  var h = parseInt(inp[0].split(' ')[0]); // 列数
  var w = parseInt(inp[0].split(' ')[1]); // 行数

  var board = [];
  for(var i = 0; i < h; i++){
    board.push(inp[i + 1].split(''));
  }

  // 主マスからの差分量
  //     　右、下、左、上、右下、左下、左上、右上
  var dx = [1, 0, -1,  0,  1,   -1,  -1,   1];
  var dy = [0, 1,  0, -1,  1,    1,  -1,  -1];

  for(var i = 0; i < h; i++){
    for(var j = 0; j < w; j++){
      if(board[i][j] === '#') continue; // 主マスが#のとき

      var num = 0;
      for(var d = 0; d < 8; d++){ // 主マスを囲む8マス
        var di = i + dy[d]; // 列方向
        var dj = j + dx[d]; // 行方向
        if(di < 0 || h <= di) continue; // board枠外のとき
        if(dj < 0 || w <= dj) continue; // board枠外のとき
        if(board[di][dj] === '#') num++;
      }
      board[i][j] = num;
    }
  }
  for(var i = 0; i < h; i++){
    console.log(board[i].join(''));
  }
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main() {
	int N,M;
	cin >> N >> M;
	
	vector<int> X(M, 0);
	vector<int> sa(M, -1); 
	
	
	int ma = 0;
	int sum = 0;
		
	for(int i=0; i<M; i++) {
		cin >> X[i];
	}
	
	if (M > N) {
		sort(X.begin(), X.end() );
		
		for(int i=0; i<M; i++) {
			cerr << X[i]  <<  " ";
		}
		cerr <<  endl;

	//	sa[0] = abs(X[0] - X[1]);
		for(int i=0; i<M-1; i++) {  // 駒の置く位置を決めるのに差を求める
			sa[i] = abs(X[i] - X[i+1]);
		}

		for(int i=0; i<M; i++) {
			cerr <<  " " << sa[i] ;
		}
		cerr <<  endl;

		
		sort(sa.begin(), sa.end(),  std::greater<int>() );
		
		int ans = abs( X[0] - X[M-1]);
		for(int i=0; i<N-1; i++) {
			ans -= sa[i];
		}

		cout << ans;
	} else { 
		cout << 0;
	}	

}


Measured memory_bytes: 1024
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};
fn main() {
    input! {//
        n:i64,
    }
    let mut st = BTreeSet::new();
    let mut c = 0;
    for i in 1i64.. {
        let k = i * (i + 1) / 2;
        if k > 111111 {
            break;
        }
        st.insert(k);
        if k == n {
            c = i;
        }
    }

    if !st.contains(&n) {
        yn(false);
        return;
    } else {
        yn(true);
    }
    println!("{}", c + 1);
    let mut c = c as usize;
    let mut ans = vec![vec![]; c + 1];

    let mut sum = 1;
    for k in (1..=c).rev() {
        for i in 0..k {
            ans[c - k].push(sum + i);
            ans[c + i + 1 - k].push(sum + i);
        }
        sum += k;
    }

    for v in ans.iter() {
        print!("{} ", c);
        for &x in v.clone().iter() {
            print!("{} ", x);
        }
        println!("");
    }
}
pub fn yn(ans: bool) {
    if ans {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 3852
import std.algorithm;
import std.bigint;
import std.bitmanip;
import std.concurrency;
import std.container;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.meta;
import std.numeric;
import std.random;
import std.range;
import std.stdio;
import std.string;
import std.traits;
import std.typecons;


immutable string YES = "Yes";
immutable string NO = "No";


auto solve(long N) {
    foreach (a; 1 .. 10)
        foreach (b; 1 .. 10)
            if (a * b == N)
                return YES;
    return NO;
}


void main() {
    auto input = stdin.byLine.map!split.joiner;

    long N;
    N = input.front.to!long;
    input.popFront;

    static if (is(ReturnType!solve == void))
        solve(N);
    else
        solve(N).writeln;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int n,count;
	int a,b,c,d;
	while(scanf("%d",&n) != EOF){
		count = 0;
		for(a=0;a<=9;a++){
			for(b=0;b<=9;b++){
				for(c=0;c<=9;c++){
					for(d=0;d<=9;d++){
						if(a+b+c+d == n)
							count++;
					}
				}
			}
		}
		printf("%d\n",count);
	}
	return 0;
}

Measured memory_bytes: 592
#include<cstdio>
using namespace std;
int main()
{
	int n;
	scanf("%d",&n);
	double od=0,even=0;
	for(int i=1;i<=n;i++)
	{
	     if(i%2==0)	even++;
	     else od++;
	} 
    double ans=od/n;
	printf("%lf",ans);
	return 0;
}

Measured memory_bytes: 128
import java.util.*;
public class Main {


    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);
        String N = scan.next();
        String d;
        String ans = "";

        for(int i = 0; i < 3; i++){

            d = N.substring(i,i+1);

            if( d.equals("9") ){

                d = "1";

            }else if( d.equals("1") ){

                d ="9";

            }

           ans = ans.concat(d);
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 20948
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <queue>
#include <deque>

using namespace std;

int const N = 1e5+5;

int main(){

int a,b;
cin>>a>>b;
if(a>0 && a<10 && b>0 && b<10) cout<<a*b;
else cout<<-1;

return 0;

}

Measured memory_bytes: 888
'use strict'
function main(input) {
	let s = input.split('\n');
  	let N = s[0].split(' ').map((a)=>Number(a));
  	let m = [];
  	for(let i = 1;i < s.length-1; i++) {
    	m.push(Number(s[i]));
    }
  
  	let re = N[1] - m.reduce((a,b) => a+b);
  	console.log(N[0] + Math.floor(re / Math.min(...m)))
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include<cstring>
#include<sstream>
#include<algorithm>
#include<iomanip>
#include<string>
#include<string.h>
#include<cmath>
#include<iostream>
long long a[200000];
using namespace std;
int main()
{
	long long n, k,sum=0;
	
	cin >> n >> k;
	for (long long i = 0; i < n; i++)
		cin >> a[i];
	if (k >= n) cout << 0;
	else {
		sort(a, a + n);
		for (long long i = 0; i < n - k; i++)
			sum += a[i];
		cout << sum;
	}
}

Measured memory_bytes: 1792
#include<cstdio>
#include<algorithm>
using namespace std;
int n,ans;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		int x=i,d=0;
		while(x){
			x/=10;
			d++;
		}
		if(d&1)
			ans++;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
def f(s,t):
    j=0;i=0
    while i<len(t) and j<len(s):
        if t[i]==s[j]:j+=2
        i+=1
    return j>=len(s)
I=input
s=I()
t=I()
print(['No','Yes'][f(s,t) or f(s[1:],t)])

Measured memory_bytes: 7556
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static long minCost(int[] size){
        long[][] dp = new long[size.length][size.length];
        for (int L = size.length-1; L >= 0; L--) {
            for (int R = L; R < size.length; R++) {
                if (L == R){
                    dp[L][R] = 0;
                }else {
                    dp[L][R] = (long) (1e18+9);
                    long sum = 0;
                    for (int i = L; i <= R; i++) {
                        sum += size[i];
                    }
                    for (int i = L; i < R; i++) {
                        dp[L][R] = Math.min(dp[L][R], dp[L][i]+dp[i+1][R]+sum);
                    }
                }
            }
        }
        return dp[0][size.length - 1];
    }

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(reader.readLine());
        int[] slime = new int[N];
        StringTokenizer st = new StringTokenizer(reader.readLine());
        for (int i = 0; i < N; i++) {
            slime[i] = Integer.parseInt(st.nextToken());
        }
        System.out.println(minCost(slime));
    }
}


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

int main(void) {
	int n, i = 0, a[100];
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (i = n - 1; i > 0; i--) {
		cout << a[i] << ' ';
	}
	cout << a[0] << endl;
	return 0;
}

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

#define FOR(a, b, c) for (int a = (b), _for = (c); a < _for; ++a)
#define REP(a, n) FOR(a, 0, n)
#define x first
#define y second
#define pb push_back
#define pii pair<int, int>
#define ll long long
#define lf double

using namespace std;

void NO(){
	puts ("-1");
	exit(0);
}

const int MAX = (int)1e6+5;

int n,m;
set<int>v[MAX];
vector<pii>out;

int bio[MAX];
int tajm;

bool dfs2(int cx,int par,int is){
	bio[cx]=++tajm;
	int ra=cx;
	int rb=par;
	if (is) swap(ra,rb);
	for (auto nx:v[cx]){
		if (nx==par) continue;
		if (bio[nx]){
			if (bio[nx]>bio[cx]){
				out.pb({cx,nx});
				is^=1;
			}
			continue;
		}
		if (dfs2(nx,cx,!is)){
			is=1;
		}
		else{
			is=0;
		}
	}
	if (par>=0){
		if (is) out.pb({ra,rb});
		else out.pb({rb,ra});
	}
	return is;
}

int main(){
	scanf ("%d%d",&n,&m);
	if (m&1) NO();
	REP(i,m){
		int a,b;
		scanf ("%d%d",&a,&b);
		a--;b--;
		v[a].insert(b);
		v[b].insert(a);
	}
	dfs2(0,-1,0);
	for (auto x:out){
		printf ("%d %d\n",x.x+1,x.y+1);
	}
	
	
	
	return 0;
}


Measured memory_bytes: 70136
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  
  if(n%2==0){
    cout << 0.500000000 <<endl;
    return 0;
  }
  double x;
  x=n;
  cout << (x+1)/2/x <<endl;
  
  return 0;
}

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

int main() {
    int n,m;
    cin >> n >> m;
    int ans=0;
    if(n>=2){
        ans+=n*(n-1)/2;
    }
    if(m>=2){
        ans+=m*(m-1)/2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
# 引数nが持つ正の約数の数を調べる
def divisor_count(n:int) -> int:
  count = 0
  for x in range(1, n+1):
    if n % x == 0:
      count += 1
  
  return count

def solve(n: int) -> int:
  # [1..N]内で奇数かつ約数をちょうど8個持つ数字の数
  result = 0
  for x in range(1, n+1, 2):
    if divisor_count(x) == 8:
      result += 1
  return result
  
N = int(input())
print(solve(N))

Measured memory_bytes: 9152
#include<math.h>
#include<ctype.h>
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#define rg register
#define il inline
using namespace std;
int n,l;
int main(){
	scanf("%d%d",&n,&l);
	if(l>=0)return printf("%d\n",(n+l*2)*(n-1)/2)&0;
	if(n+l>0)printf("%d\n",(n+l*2-1)*n/2);
	else printf("%d\n",(n+l*2-2)*(n-1)/2);
	return 0;
}


Measured memory_bytes: 256