akhauriyash/Code-Regression huggingface dataset:
#-------------------- fast io --------------------
import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0
 
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
 
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
 
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
 
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
 
 
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
 
# ------------------- fast io --------------------

from math import gcd, ceil

def pre(s):
    n = len(s)
    pi = [0] * n
    for i in range(1, n):
        j = pi[j - 1]
        while j and s[i] != s[j]:
            j = pi[j - 1]
        if s[i] == s[j]:
            j += 1
        pi[i] =  j
    return pi

def prod(a):
    ans = 1
    for each in a:
        ans = (ans * each)
    return ans

def lcm(a, b): return a * b // gcd(a, b)

def binary(x, length=16):
    y = bin(x)[2:]
    return y if len(y) >= length else '0' * (length - len(y)) + y

N = int(input())
print((1000 - N % 1000) % 1000)


Measured memory_bytes: 63100
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <atcoder/all>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#define PI 3.14159265359
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pai;
typedef pair<ll, ll> pal;
const int MOD = 1e9+7;
const int MODD = 998244353;
const ll LLINF = 1e18;


int main(){
	int n, m;
	cin >> n >> m;
	scc_graph graph(n);
	for (int i = 0; i < m; i++){
		int from, to;
		cin >> from >> to;
		graph.add_edge(from, to);
	}

	auto scc = graph.scc();

	int ans = scc.size();
	cout << ans << endl;

	for (auto x : scc){
		cout << x.size() << " ";
		for (auto y : x){
			cout << y << " ";
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 40604
#include <iostream>
#include <string>
#include <cstdio>
using namespace std;
int main(){
    int n,k;
    scanf("%d %d", &n, &k);

    if (n < k){
        cout << 1 << endl;
    } else if (n == k){
        cout << 0 << endl;
    } else {
        if (n % k == 0){
            cout << 0 << endl;
        } else {
            cout << 1 << endl;
        }
    }

    return 0;
}


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

#define ll long long
#define ii pair<int, int>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pi 3.14159265
#define oo 1000000001

using namespace std;
#define prime 1000000007

const ll N = 300005;

#define W(x) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << "\n";

using namespace std;

pair<string, int> v[100100];
map<pair<string, int>, int> ma;
string s;
int n, x;

bool f(pair<string, int> a, pair<string, int> b){
	if(a.ff != b.ff){
		return a.ff < b.ff;
	}else return a.ss > b.ss;
}

int main(){
	cin >> n;

	for (int i = 0; i < n; ++i){
		cin >> s >> x;
		v[i] = {s, x};
		ma[v[i]] = i+1;
	}

	sort(v, v+n, f);

	for (int i = 0; i < n; ++i){
		printf("%d\n", ma[v[i]]);
	}
			
	return 0;
}

Measured memory_bytes: 1792
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const double PI = acos(-1);
const ll MOD = 1000000007;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////

bool dpx[8010][16010];
bool dpy[8010][16010];

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    string S; cin >> S;
    int x,y; cin >> x >> y;
    int N = S.size();
    
    int count = 0;
    vector<int> A;
    rep(i,N) {
        if (S[i] == 'F') count++;
        else {
            A.emplace_back(count);
            count = 0;
        }
    }
    A.emplace_back(count);
    int M = A.size();
    dpx[0][8000] = dpy[0][8000] = true;
    rep(i,M) {
        if (i % 2 == 0) {
            rep(j,16001) {
                if (dpx[i][j]) {
                    dpx[i+1][j+A[i]] = true;
                    if (i != 0) dpx[i+1][j-A[i]] = true;
                }
                if (dpy[i][j]) dpy[i+1][j] = true;
            }
        } else {
            rep(j,16001) {
                if (dpy[i][j]) {
                    dpy[i+1][j+A[i]] = true;
                    dpy[i+1][j-A[i]] = true;
                }
                if (dpx[i][j]) dpx[i+1][j] = true;  
            }
        }
    }

    cout << ((dpx[M][8000+x] && dpy[M][8000+y]) ? "Yes" : "No") << endl;
}


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

int main()
{
    int N;
    cin >> N ;
    
    vector<pair<string, int>> res(N), store(N);
    string name;
    int score;
    

    for(int i = 0; i < N; i++){
        cin >> name >> score;
        res.at(i) = make_pair(name, -score);
        store.at(i) = make_pair(name, -score);
    }
    sort(res.begin(), res.end());


    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            if(res.at(i) == store.at(j)){
                cout << j + 1 << endl;
                break;
            }
        }
    }
}

Measured memory_bytes: 256
N, M = input().split()
X = input().split()
sum = 0
for i in range(0, int(N)):
  sum += int(X[i])
Y = sum / (4 * int(M))
count = 0
for i in range(0, int(N)):
  if int(X[i]) >= Y:
    count += 1
if count >= int(M):
  print("Yes")
else:
  print("No")

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

#define rep(i, n) for(int (i) = 0; i < (n); ++(i))

typedef long long ll;
const ll MOD = 1e9 + 7;

int main() {
  std::string S;
  std::cin >> S;

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

  std::cout << ans << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <map>
using namespace std;
#define min(a,b) (a>b?b:a);
int main(){
	int n;
	cin>>n;
	vector<int> path(n);
	for(int i=0;i<n;i++) cin>>path[i];
	vector<int> dp(n);
	dp[0]=0;
	dp[1]=abs(path[1]-path[0]);
	if(n==2){
		cout<<dp[1]<<endl;
		return 0;
	}
	for(int i=2;i<n;i++){
		dp[i]=min(abs(path[i]-path[i-1])+dp[i-1],abs(path[i]-path[i-2])+dp[i-2]);
	}
	cout<<dp[n-1]<<endl;
	return 0;
}

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

using namespace std;

int main(int argc, const char *argv[]) {
  int n;
  cin >> n;
  vector<int> va(n);
  for (int i = 0; i < n; ++i) {
    cin >> va[i];
  }

  vector<int> gcds(n), rev_gcds(n);
  gcds[0] = va.front();
  rev_gcds[0] = va.back();
  for (int i = 1; i < va.size(); ++i) {
    gcds[i] = gcd(gcds[i - 1], va[i]);
    rev_gcds[i] = gcd(rev_gcds[i - 1], va[n - i - 1]);
  }

  auto except_gcd = [&](int idx) {
    if (idx == 0) {
      return rev_gcds[n - 2];
    } else if (idx == n - 1) {
      return gcds[n - 2];
    } else {
      return gcd(gcds[idx - 1], rev_gcds[n - idx - 2]);
    }
  };

  int ans = except_gcd(0);
  for (int i = 0; i < n; ++i) {
    ans = max(ans, except_gcd(i));
  }

  cout << ans << '\n';

  return 0;
}

Measured memory_bytes: 4588
//g++ -std=c++14 test.cpp -o test.out
 
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (LL)(1e18)+1;
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;
 
LL N;
string S;
 
int ans = INF_INT;
 
void solve(){
    //最終的に......######みたいな列ができれば良い
    //各石について、色を黒→白にするか白→黒にするかを
    //考えようとするとTLEする

    //なのでN+1通りの境界について考えていく
    //sum[BLACK][LEFT] = 境界より左側の、黒の個数
    //sum[BLACK][RIGHT] = 境界より右側の、黒の個数
    //WHITEについても同様
    const int BLACK = 0;
    const int WHITE = 1;
    const int LEFT = 0;
    const int RIGHT = 1;
    vector<vector<int>> sum(2,vector<int>(2,0));
    for(int i=0;i<N;i++){
        if(S[i]=='#') sum[BLACK][RIGHT]++;
        if(S[i]=='.') sum[WHITE][RIGHT]++;
    }
    //左から順に調べる
    //i-1個目とi個目に境界を配置する
    for(int i=0;;i++){
        // for(int j=0;j<N;j++){
        //     if(i==j) cout << "|";
        //     cout << S[j];
        // }
        // cout << endl;
        // cout << sum[WHITE][LEFT] << " " << sum[WHITE][RIGHT] << endl;
        // cout << sum[BLACK][LEFT] << " " << sum[BLACK][RIGHT] << endl << endl;
        ans = min(ans,sum[BLACK][LEFT]+sum[WHITE][RIGHT]);
        if(i>=N) break;
        if(S[i]=='#'){
            sum[BLACK][LEFT]++;
            sum[BLACK][RIGHT]--;
        }
        if(S[i]=='.'){
            sum[WHITE][LEFT]++;
            sum[WHITE][RIGHT]--;
        }
    }
}
 
int main(){
    cin >> N;
    cin >> S;
 
    solve();
 
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define pdi pair<db,int>
#define mp make_pair
#define pb push_back
#define enter putchar('\n')
#define space putchar(' ')
#define eps 1e-8
#define mo 974711
#define MAXN 200005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;char c = getchar();T f = 1;
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 + c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
struct node {
    int to,next;
}E[MAXN * 10];
map<int,int> mm;
int val[MAXN],A[MAXN],N,tot,ans;
int head[MAXN],sumE,dp[MAXN];
bool vis[MAXN];
int lowbit(int x) {
    return x & (-x);
}
void add(int u,int v) {
    E[++sumE].to = v;
    E[sumE].next = head[u];
    head[u] = sumE;
}
void Init() {
    read(N);
    for(int i = 1 ; i <= N ; ++i) {
        read(A[i]);
        val[i] = A[i];
        mm[A[i]]++;
    }
    sort(val + 1,val + N + 1);
    tot = unique(val + 1,val + N + 1) - val - 1;
    for(int i = 1 ; i <= N ; ++i) {
        int a = val[i];
        int k = lower_bound(val + 1,val + tot + 1,a) - val;
        for(int64 t = 1 ; t <= 1073741824 ; t <<= 1) {
            if(t > 2 * a) {
                if(mm[t - a] == 0) continue;
                int h = lower_bound(val + 1,val + tot + 1,t - a) - val;
                add(k,h);
            }
        }
    }

}
void dfs(int u) {
    vis[u] = 1;
    dp[u] = mm[val[u]];
    for(int i = head[u] ; i ; i = E[i].next) {
        int v = E[i].to;
        if(!vis[v]) {
            dfs(v);
            int t = min(dp[u],dp[v]);
            dp[u] -= t;
            dp[v] -= t;
            ans += t;
        }
    }
}
void Solve() {
    for(int i = 1 ; i <= tot ; ++i) {
        if(!vis[i]) dfs(i);
        if(lowbit(val[i]) == val[i]) ans += dp[i] / 2;
    }
    out(ans);enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Init();
    Solve();
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll N, A, B;
	cin >> N >> A >> B;
	vector<ll> h(N);
	REP(i, N) cin >> h[i];

	ll l = 0;
	ll u = 1e10;
	while(u-l>1){
		ll m = (l+u)/2;
		ll tmp = 0;
		REP(i, N){
			ll resid = h[i] - B*m;
			if(resid>0) tmp += ((resid+A-B-1)/(A-B));
		}
		if(tmp<=m) u = m;
		else l = m;
	}
	cout << u << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define ALL(v) (v).begin(),(v).end()
#define MP(a,b) make_pair(a,b)
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = 999999999;

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

    queue< pair<string, int> > Q;

    int n, qu;
    cin >> n >> qu;
    REP(i, n){
        string nm;
        int tm;
        cin >> nm >> tm;
        Q.push(MP(nm, tm));
    }
    int nowtm = 0;
    while(Q.size() > 0){
        Q.front().second -= qu;
        nowtm += qu;
        if(Q.front().second <= 0){
            nowtm += Q.front().second;
            cout << Q.front().first << " " << nowtm << "\n";
        }else{
            Q.push(Q.front());
        }
        Q.pop();
    }

    return 0;
}

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

int main(){
	int N, M;
	cin >> N;
	vector<string> s(N);
	for(int i=0; i<N; i++){
		cin >> s.at(i);
	}
	cin >> M;
	vector<string> t(M);
	for(int i=0; i<M; i++){
		cin >> t.at(i);
	}

	vector<int> ans(N);
	for(int i=0; i<N; i++){
		for(int j=0; j<N; j++){
			if(s.at(i)==s.at(j)){
				ans.at(i)++;
			}
		}
		for(int j=0; j<M; j++){
			if(s.at(i)==t.at(j)){
				ans.at(i)--;
			}
		}
	}

	int max=0;
	for(int i=0; i<N; i++){
		if(max < ans.at(i)){
			max = ans.at(i);
		}
	}
	cout << max << endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include <sstream>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include <iomanip>
#include <regex>
#include <initializer_list>
#define DBL_MIN 0.000000000000001
#define A_P(n,a,d) (n/2)*(2*a + (n-1)*d)
using namespace std;


int main(void){
  double a,b,c;
  cin >> a >> b >> c;
  cout << (int)ceil(a/b)*(int)c << endl;
  return 0;
}

Measured memory_bytes: 3736
#include <iostream>
#include <string>
#define rep(i, n)for(int i=0; i<n; i++)
using ll = long long int;
using namespace std;

string tosmall(string s){
    rep(i, s.size()){
        if(s[i]>='A' && s[i]<='Z') s[i] += 'a'-'A';
    }
    return s;
}

int main(){
    string w, t;
    cin >> w;
    int ans = 0;
    while(cin>>t && t!="END_OF_TEXT"){
        if(w==tosmall(t)) ans++;
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
#define int long long 
#define inf 1e18
using namespace std;
const int N=1e5+100;
int n,a[N],b[N],w,ans,sh[N*2];
signed main()
{
	scanf("%lld",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%lld%lld",&a[i],&b[i]);
		sh[++w]=a[i];
		sh[++w]=b[i];
	}
	sort(sh+1,sh+1+n+n);
	int sum=0;ans=inf;
	for (int i=1;i<=n;i++) sum+=a[i];
	ans=min(ans,sum);
	sum=0;
	for (int i=1;i<=n;i++) sum+=b[i];
	ans=min(ans,sum);
	sum=0;
	for (int i=1;i<=n-2;i++) sum+=sh[i];
	for (int i=1;i<=n;i++)
	{
		int tmp=sum+a[i]+b[i],pa,pb;
		pa=lower_bound(sh+1,sh+1+2*n,a[i])-sh;
		pb=lower_bound(sh+1,sh+1+2*n,b[i])-sh;
		if (pa>pb) swap(pa,pb),swap(a[i],b[i]);
		if (pa<=n-2)
		{
			tmp-=a[i];
			if (pb<=n-1)
			{
				tmp-=b[i];
				tmp+=sh[n-1]+sh[n];
			}
			else tmp+=sh[n-1];
		}
		ans=min(ans,tmp);
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 6900
#include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(int i=(a);i<=(b);++i)
#define rep(i,n) rep2(i,0,n-1)
int INF=1000000000;

using namespace std;
string alphabet("abcdefghijklmnopqrstuvwxyz");
main(){
    int n;
    int a[51]={},b[51]={};
    cin>>n;
    rep(i,n){
        cin>>a[i];
    }
    rep(i,n){
        cin>>b[i];
    }
    rep(i,n){
        if(a[i]!=b[i]&&a[i]<=b[i]*2) {cout<<-1; return 0;} 
    }
    int s[51]={};
    for(int i=50;i>0;i--){
        int t[51]={};
        rep(j,51){
            if(j<i||s[j]) t[j]=1;
        }
        ll int map[51][51]={};
        rep(j,51){
            rep(k,51){
                if(j!=k)
                map[j][k]=INF;
            }
        }
        rep2(j,1,50){
            if(t[j]){
                rep(k,51){
                    map[k][k%j]=0;
                }
            }
        }
        rep(k1,51){
            rep(k2,51){
                rep(k3,51){
                    map[k2][k3]=min(map[k2][k3],map[k2][k1]+map[k1][k3]);
                }
            }
        }
        int flag=0;
        rep(j,n){
            if(map[a[j]][b[j]]) flag=1;

        }
        if(flag) s[i]=1;
    }
    ll int ans=0;
    rep2(i,1,50) if(s[i]) ans+=pow(2,i);
    cout<<ans;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;

int main() {
    int N;
    cin >> N ;
    vector<int> vec(N);
    for (int i = 0; i < N; i++) {
        cin >> vec.at(i);
    }
    sort(vec.begin(), vec.end());
    reverse(vec.begin(), vec.end());

    int sa;
    sa = 0;
    for (int i = 0; i < N; i++) {
        sa += (i%2-0.5)*(-2)*vec.at(i);
    }
    cout << sa << endl;
}


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

typedef long long ll;
typedef unsigned long long llu;

int main(int argc, char *argv[]) {
  ll a, b;
  cin >> a >> b;
  
  ll ans = a + b;
  if (ans < a-b) {
    ans = a - b;
  }
  if (ans < a*b) {
    ans = a * b;
  }

  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
from collections import defaultdict, deque
import sys
import heapq
import bisect
import math
import itertools
import string
import queue
import copy
import time
from fractions import gcd

sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7

def inp(): return int(sys.stdin.readline())
 
def inp_list(): return list(map(int, sys.stdin.readline().split()))

def lcm(x, y): return (x * y) // gcd(x, y)


K, N = inp_list()
A = inp_list()

max_dist = 0
for i in range(N):
    if i == N - 1:
        max_dist = max(max_dist, A[0] + K - A[i])
    else:
        max_dist = max(max_dist, A[i + 1] - A[i])

print(K - max_dist)


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

int main(){
  int a,b;
  cin >> a >> b ;
  int c = a + b;
  if(c % 2 == 0){
    int x = c / 2;
    cout << x << endl;
  }
  else{
    int x = (c / 2) + 1;
    cout << x << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}
map<int, int> prime;

void primecalc(int n)
{
    int a = 2;
    while (n >= a * a)
    {
        if (n % a == 0)
        {
            prime[a]++;
            n /= a;
        }
        else
        {
            a++;
        }
    }
    prime[n]++;
}

void solve(long long N)
{
    for (int i = 2; i <= N; i++)
    {
        primecalc(i);
    }

    for (auto &&i : prime)
    {
        i.second++;
    
    }

    int seventyfive = 0, twentyfive = 0, fifteen = 0, five = 0, three = 0;
    for (auto &&i : prime)
    {
        if (i.second >= 75)
        {
            seventyfive++;
        }
        if (i.second >= 25)
        {
            twentyfive++;
        }
        if (i.second >= 15)
        {
            fifteen++;
        }
        if (i.second >= 5)
        {
            five++;
        }
        if (i.second >= 3)
        {
            three++;
        }
    }
    ll ans = 0;
    if (seventyfive > 0)
    {
        ans++;
    }
    if (twentyfive > 0)
    {
        ans += twentyfive * (three - 1);
    }
    if (fifteen > 0)
    {
        ans += fifteen * (five - 1);
    }
    if (five > 1)
    {
        ans += five * (five - 1) * (three - 2) / 2;
    }
    cout << ans << endl;
}

int main()
{
    long long N;
    scanf("%lld", &N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
H, W, K = map(int, input().split())
c = []
for i in range(H):
    c.append(input().strip())
    
out = 0
import itertools

def getset(n):
    l = []
    curr = 0
    while n:
        if n & 1:
            l.append(curr)
        curr += 1
        n //= 2
    return l

for hSet in range(2 ** H):
    hL = getset(hSet)
    for cSet in range(2 ** W):
        cL = getset(cSet)
        cnt = 0
        for i in hL:
            for j in cL:
                if c[i][j] == '#':
                    cnt += 1
        if cnt == K:
            out += 1
print(out)


Measured memory_bytes: 68704
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_159
{
    class F
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int[] ns = ReadInts();
            int n = ns[0];
            int s = ns[1];
            int[] array = ReadInts();

            long[] dp = new long[s + 2];
            long mask = 998244353;
            long res = 0;
            for(int i = 0; i < n; i++)
            {
                long[] next = new long[s + 2];

                for (int j = 0; j <= s; j++)
                {
                    next[j] += dp[j];
                    next[j] %= mask;
                }

                for(int j = 0; j <= s; j++)
                {
                    int nextVal = Min(j + array[i], s + 1);
                    next[nextVal] += dp[j];
                    next[nextVal] %= mask;
                }

                if (array[i] <= s)
                {
                    next[array[i]] += i + 1;
                    next[array[i]] %= mask;
                }

                res += next[s];
                res %= mask;
                dp = next;
            }

            WriteLine(res);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

#define ll long long
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define vi vector<int>
#define vl vector<long long>
#define sz size()
#define x first
#define y second
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;
int n;
int a[100100];
int dp[100100];

int main() {
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	sort(a + 1, a + n + 1);
	
	dp[0] = 1;
	for(int i = 1; i <= n; i++) {
		for(int w = 10001; w >= 0; w--) {
			if(dp[w]) {
				dp[w + a[i]] = 1;
			}
		}
	}	
	
	for(int i = 100000; i >= 0; i--) {
		if(i % 10 != 0) {
			if(dp[i]) {
				cout << i;
				return 0;
			}
		}
	}

	cout << 0;
	return 0;
}

Measured memory_bytes: 256
import sys
 
def f(x):
    return x ** 2
 
def integral(d):
    s = 0
    for i in range(600 // d - 1):
        s += f(d * (i + 1)) * d
    return s
 
lines = sys.stdin.readlines()
for line in lines:
    print(integral(int(line)))

Measured memory_bytes: 7468
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <iomanip>
using namespace std;
const int N=10005;
char a[N];
int main ()
{
	scanf("%s",&a);
	int len=strlen(a);
	for(int i=0;i<len;i++)
	    if(a[i]=='C')
	        for(int j=i+1;j<len;j++)
	            if(a[j]=='F'){
	            	printf("Yes\n");
	            	return 0;
				}
				printf("No\n");
	return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;
static const ll MOD = (ll)1e9 + 7;
static const double EPS = 1e-9;

#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define RANGE(i, m, n) for(ll i = (m); i <= (n); ++i)
#define RRANGE(i, m, n) for(ll i = (m); i >= (n); --i)
#define POSITIVE(x) (x)=((x) < 0) ? 0 : (x)

ll power(ll x, ll y) {
    ll ret = 1;
    while(y-- > 0) ret *= x;
    return ret;
}

ll gcd(ll a, ll b) {
    assert(a >= 0);
    assert(b >= 0);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll extgcd(ll a, ll b, ll& x, ll& y) {
    x = 1; y = 0;
    assert(a >= 0);
    assert(b >= 0);
    if (b == 0) return a;
    ll X, Y;
    auto d = extgcd(b, a % b, X, Y);
    x = Y;
    y = X - (a / b) * Y;
    return d;
}

int run(istream& in, ostream& out) {
    string S, T;
    in >> S;
    in >> T;
    ll ans = 0;
    REP(i, S.size()) {
        if (S[i] == T[i]) {
            ans++;
        }
    }
    out << ans << endl;
    return 0;
}

int main() {
    return run(cin, cout);
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

int main(){
    long N, K;
    cin >> N >> K;

    long ans;
    if (K == 0){
        ans = N;
    }
    else{
        ans = N % K;
        ans = min(((N / K) + 1) * K - N, N % K);
    }
    
    cout << ans << endl;
    
    return 0;
}


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

using namespace std;

int n;
int main(){

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

cin>>n;

deque<int> dq;

for(int i=1; i<=n; i++){
  int c;
  cin>>c;
  if(i%2) dq.push_front(c);
  else dq.push_back(c);
}

if(n%2){
  for(int i=0; i<n; i++){
    cout<<dq[i]<<" ";
  }
  cout<<endl;
}
else{
  for(int i=n-1; i>=0; i--){
    cout<<dq[i]<<" ";
  }
  cout<<endl;
}


}


Measured memory_bytes: 3072
#include<stdio.h>
#define MAX 100000
#define SE 2000000000

struct Card{
  char su;
  int nb;
};

struct Card A[MAX/2+2],B[MAX/2+2];

void mg(struct Card C[],int n,int l,int ce,int r){
  int i,j,k;
  int a1 = ce -l;
  int a2 = r - ce;
  for(i = 0;i<a1;i++)
    A[i] = C[l +i];
  for(i = 0;i<a2;i++)
    B[i] = C[ce + i];
  A[a1].nb = B[a2].nb = SE;
  i = j = 0;
  for(k = l;k<r;k++){
    if(A[i].nb<=B[j].nb){
      C[k] = A[i++];
    }else{
      C[k] = B[j++];
    }
  }
}

void mgsort(struct Card C[],int x,int le,int ri){
  int mid;
  if(le +1<ri){
    mid = (le+ri)/2;
    mgsort(C,x,le,mid);
    mgsort(C,x,mid,ri);
    mg(C,x,le,mid,ri);
  }
}

int par(struct Card C[],int x,int p,int q){
  int i,j;
  struct Card s,t;
  t = C[q];
  i = p-1;
  for(j = p;j<q;j++){
    if(C[j].nb<=t.nb){
      i++;
      s = C[i];
      C[i] = C[j];
      C[j] = s;
    }
  }
  s = C[i+1];
  C[i+1] = C[q];
  C[q] = s;
  return i+1;
}

void qsort(struct Card C[],int x,int p,int q){
  int w;
  if(p<q){
    w = par(C,x,p,q);
    qsort(C,x,p,w-1);
    qsort(C,x,w+1,q);
  }
}

int main(){

  int x,i,v;
  struct Card C[MAX],D[MAX];
  char  Z[10];
  int sb = 1;

  scanf("%d",&x);

  for(i = 0;i<x;i++){
    scanf("%s %d",Z,&v);
    C[i].su = D[i].su = Z[0];
    C[i].nb = D[i].nb = v;
  }
  mgsort(C,x,0,x);
  qsort(D,x,0,x-1);

  for(i = 0;i<x;i++){
    if(C[i].su!=D[i].su) sb = 0;
  }

  if(sb == 1) printf("Stable\n");
  else printf("Not stable\n");
  for(i = 0;i<x;i++){
    printf("%c %d\n",D[i].su,D[i].nb);
  }
  return 0;
}


Measured memory_bytes: 4044
program OE1G
    implicit none
    integer(8)::n,i,count
    integer(8),allocatable,dimension(:)::A,output

    read(5,*)n
    allocate(A(n))
    allocate(output(n))
    read(5,*)(A(i),i=1,n)

    if(mod(n,2)==0)then
        output(1)=A(n)
        count=2
        do i=1,N/2-1
            output(count)=A(n-2*i)
            count=count+1
        end do

        do i=1,N/2
            output(count)=A(2*i-1)
            count=count+1
        end do

    else
        output(1)=A(n)
        count=2
        do i=1,N/2
            output(count)=A(n-2*i)
            count=count+1
        end do

        do i=1,N/2
            output(count)=A(2*i)
            count=count+1
        end do
    end if

    write(*,*)output(:)
    
end program OE1G

Measured memory_bytes: 8576
#include <iostream>
#include <vector>
#include <map>
#include <climits>
#include <iomanip>
#include <cmath>
#include <algorithm>

using namespace std;

#define eb emplace_back
#define sz(s) (int)(s.size())
#define all(s) s.begin(), s.end()
#define ll long long

const int N = 2e6 + 123;
const int NN = 2e3 + 500;
const int INF = INT_MAX;

#define int ll
main () {
	cerr << "Ready";
	
	ll a, b, k;
	cin >> a >> b >> k;
	if (k <= a) {
		cout << a - k << " " << b << '\n';
	}
	else {
		k -= a;
		if (b - k < 0)
			cout << 0 << " " << 0 << '\n';
		else
			cout << 0 << " " << b - k << '\n';
	}
	
	cerr << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Rep(i,n) for(int i = 0; i < (n); i++)
#define For(i,start,end) for(i64 i = start, i <= end, i++)
using namespace std;
typedef long long ll;
typedef unsigned long ul;

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;

//----------------library in this time--------------------------------
uint gcd(const uint a,const uint b){
    return (b == 0) ? a : gcd (b, a % b);
}
uint lcm (const uint a, const uint b){
    return a * b / gcd(a,b);
}
//------------------------main function-------------------------------
void Main(){
    uint n, l = 1, denominator = 0;
    cin >> n;
    vector<uint>a(n);
    Rep(i, n){
        cin >> a[i];
        l = lcm(a[i], l);
    }
    Rep(i, n){
        denominator += l / a[i];
    }
    f64 ans = 0;
    ans = static_cast<f64>(l) /denominator;
    cout << ans << endl;
    
    
}
//--------------------------------------------------------------------
int main(){
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    
    Main();
    return 0;
}


Measured memory_bytes: 256
import numpy as np

def main():
    a=inputList()
    w,h,x,y=a[0],a[1],a[2],a[3]

    ans=w*h/2
    judge=0
    if(x*2==w and y*2==h):
        judge=1

    print(str(ans)+" "+str(judge))

def inputList():
    a=list(map(int,input().split()))
    return a

def multisort(li,index):
    return sorted(li,key=lambda x: x[index])

if(__name__=='__main__'):
    main()


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

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

  int x1 = n / 1000;
//cout << x1 << endl;
  int x2 = (n - x1 * 1000) / 100;
//cout << x2 << endl;
  int x3 = (n - x1 * 1000 - x2 * 100) / 10;
//cout << x3 << endl;
  int x4 = n - x1 * 1000 - x2 * 100 - x3 * 10;
//cout << x4 << endl;

  if (x1 == x2 && x2 == x3) {
//    cout << "aaa-" << endl;
    cout << "Yes" << endl;
  }
  else if (x2 == x3 && x3 == x4) {
//    cout << "-aaa" << endl;
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 9223372036854775807LL
#define mod 1000000007
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define lol long long
#define mp make_pair
#define fi first
#define se second
using namespace std;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b;
  cin >>a>>b;
  for(int i=1;i<=10000;i++){
    int j=i*8/100;
    int r=i*10/100;
    if(j==a&&r==b){
      cout <<i<<'\n';
      return (0);
    }
  }
  cout <<"-1\n";
  return (0);
}


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

#define pb push_back
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#define MAXN 10005
#define MAXM 100005
#define pi 3.14159265359

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int>> vpii;
typedef long long ll;
typedef priority_queue<int> pqi;
typedef priority_queue<pii, vpii, greater<pii> > dij;

int N;

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

	cin >> N;

	int x = ceil(N/1.08);
	
	if(floor(x*1.08) == N)
		cout << x << "\n";
	else
		cout << ":(\n";

	return 0;		
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <complex>
#include <bitset>
#include <chrono>
#include <random>
#include <assert.h>
#include <array>

using namespace std;

template<typename M, typename N>
istream& operator>>(istream&is, pair<M,N> & p){is >> p.first >> p.second; return is;}
template<typename M>
istream& operator>>(istream&is, vector<M> & v){for(auto &it:v) is >> it; return is; }
template<typename M>
istream& operator>>(istream&is, vector<vector<M>> & v){for(auto &it:v) is >> it; return is; }
template<typename M, typename N>
ostream& operator<<(ostream&os, const pair<M,N> &p){os << p.fi << ' ' << p.se << '\n';return os;}
template<typename M>
ostream& operator<<(ostream&os, const vector<M> &v){for(auto it: v)os << it << ' ';cout << '\n';return os;}
template<typename M>
ostream& operator<<(ostream&os, const vector<vector<M>> &v){for(auto it: v)os << it;return os;}

#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mn(x) *min_element((x).begin(),(x).end())
#define mx(x) *max_element((x).begin(),(x).end())
#define acc(x) accumulate((x).begin(),(x).end(),0ll)
#define eb emplace_back
#define el '\n'
typedef  long long  ll;
typedef  unsigned long long  ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<string> vs;

const ld pi=acos(-1);
const ll inf=(ll)1e9+10;
//const int mod=1000000007;
const int mod=998244353;

int n,m,k;
const int N=3e5+10;




int main()
{   ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n, k;
    cin >> n >> k;
    vpi v(k);
    for(int i=0; i<k; i++){
        cin >> v[i].fi >> v[i].se;
    }
    vll dp(n+1);
    dp[1]=1;
    auto f = [&](int l, int r){
        l=max(l,1);
        r=max(r,0);
        return dp[r]-dp[l-1];
    };
    for(int i=2; i<=n; i++){
        for(int j=0; j<k; j++){
            (dp[i]+=f(i-v[j].se, i-v[j].fi))%=mod;
        }
        if(i==n){
            cout << dp[i] << el;
        }
        dp[i]+=dp[i-1];
    }
    return 0;
}








Measured memory_bytes: 4780
#include<iostream>
#include<cstdio>
#include<algorithm>
#define ll long long
using namespace std;
const int maxn=3e3+15; 
ll n,mod;
ll g[maxn][maxn],c[maxn][maxn];
ll mul(ll a,ll b,ll p){
    ll r=0;
    for (;b;b>>=1,a=(a+a)%p) if (b&1) r=(r+a)%p;
    return r;
}
ll qpow(ll a,ll b,ll p){
    ll r=1;
    for (;b;b>>=1,a=mul(a,a,p)) if (b&1) r=mul(r,a,p);
    return r;
}
int main()
{
    scanf("%lld%lld",&n,&mod);    
    for (int i=1;i<=n;i++){
        c[i][0]=c[i][i]=1;
        for (int j=1;j<i;j++)
            c[i][j]=(c[i-1][j]+c[i-1][j-1])%mod;
    }
    for (int i=0;i<=n;i++){
        g[i][0]=1;
        for (int j=1;j<=i;j++)
            g[i][j]=(g[i-1][j-1]+g[i-1][j]*(j+1)%mod)%mod;    
    }
    ll ans=0;
    for (int i=0;i<=n;i++){
        ll k=c[n][i];
        if (i&1) k=(mod-k)%mod;
        ll x=qpow(2,n-i,mod-1);
        x=qpow(2,x,mod);
        ll kind=qpow(2,n-i,mod);
        ll cnt=0,y=1;
        for (int j=0;j<=i;j++){
            cnt=(cnt+(g[i][j]*y%mod))%mod;
            y=kind*y%mod;
        } 
        ans=(ans+(k*cnt%mod*x%mod))%mod;
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 96220
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

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

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

template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
  for (const T &t : v) s << t << endl;
  return s;
}

int main() {
  int a, b, k = 0;
  cin >> a >> b;
  for (int i = a; i <= b; ++i) {
    auto s = to_string(i);
    auto r = s;
    reverse(r.begin(), r.end());
    if (s == r) ++k;
  }
  cout << k << endl;
}



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

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn dfs_any(n: usize, i: &str) -> usize {
    let mut count = 0;
    if n >= i.parse::<usize>().unwrap() {
        if i.chars().any(|c| c == '3') && i.chars().any(|c| c == '5') && i.chars().any(|c| c == '7')
        {
            count += 1;
        }
    } else {
        return count;
    }
    count += dfs_any(n, &(i.to_string() + "3"));
    count += dfs_any(n, &(i.to_string() + "5"));
    count += dfs_any(n, &(i.to_string() + "7"));
    count
}

fn main() {
    input! {
        n: usize,
    }
    let ans = dfs_any(n, &0.to_string());
    println!("{}", ans);
}


Measured memory_bytes: 4352
import sys
input = sys.stdin.readline

N, W = [int(i) for i in input().split()]

def ans(N, W):
    d = [float("inf")] * (N * 1000 + 1)
    d[0] = 0
    V = 0

    for i in range(N):
        wi, vi = [int(i) for i in input().split()]
        V = V + vi

        for v in range(V, vi-1, -1):
            w_ = d[v - vi] + wi
            if w_ < d[v]:
                d[v] = w_

    for v in range(V, -1, -1):
        if d[v] <= W:
            return v

print(ans(N, W))

Measured memory_bytes: 5740
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ll long long
#define ull unsigned long long
#define ld long double
#define zeros(x) x^(x-1)&x
#define pii pair<ll,ll>
#define cd complex<double>
#define dbg(x) cerr<<x<<endl;
#define Nmax 500005
using namespace std;

ll n, v[Nmax], d[Nmax], l, t, nr, val, fin[Nmax], fin2[Nmax], fin3[Nmax];


int main()
{
    cin >> n;
    for (int i=1;i<=n;i++){
        cin >> v[i];
    }
    int dir = 0,nr=1;
    for (int i=2;i<=n;i++){
        if (v[i] > v[i-1]){
            if (dir == -1){
                nr++;
                dir = 0;
            }
            else dir = 1;
        }
        else if (v[i] < v[i-1]){
            if (dir==1){
                nr++;
                dir = 0;
            }
            else dir = -1;
        }
    }
    cout << nr << '\n';
    return 0;
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000000;
constexpr ll INF= 1e18;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<int,int> P;

int main() {
    int A,B,X;
    cin >> A >> B >> X;
    if(A <= X && X <= A + B) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int b=0,i;
	int d[10000];
	int n=0,a=0,c=0;
	
	scanf("%d",&a);
		
	for(i=0; i<a; ++i)
		scanf("%d",&d[i]);
	
	for(i=0; i<a; ++i){
		for(n=i+1; n<a; ++n){
			if(d[i] > d[n]) {
				b = d[i];
				d[i] = d[n];
				d[n] = b;
			}
		}
	}
	

c = d[a-1] - d[0];

printf("%d\n",c);
    
	return 0;
}
	

Measured memory_bytes: 128
#include <iostream>
#include <math.h>
using namespace std;
string StxInt(string str, int inputI){
    string resultStr = "";
    for(int i = 0;i < inputI; i++){
        resultStr += str;
    }
    return resultStr;
}

int main(){
    string s;
    cin >> s;
    string output = "No";
    if(s.size() / 2 == floor(s.size() / 2)){
        if(s == StxInt("hi", s.size() / 2)){
            output = "Yes";
        }
    }
    cout << output << '\n';
    return 0;
}

Measured memory_bytes: 888
n,m = map(int,input().split())
a = []

for i in range(m):
    a.append(int(input()))
    
a = set(a)

dp = [0] * (n+1)
dp[0] = 1

if 1 not in a:
    dp[1] = 1
    
for i in range(2,n+1):
    if i not in a:
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= 1000000007
        
print(dp[n])


Measured memory_bytes: 19008
#include<stdio.h>
int main(void)
{
	int w,h,x,y,r;
	scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);
	if(x-r>=0 && x+r<=w && y-r>=0 && y+r<=h)	printf("Yes\n");
	else printf("No\n");
	return 0;
}


Measured memory_bytes: 2096
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int dataset = scanner.nextInt();
		double[] input = new double[8];
		for(int i=0; i<dataset; i++){
			for(int j=0; j<8; j++){
				input[j] = scanner.nextDouble();
			}
			double vec1x = input[2] - input[0];
			double vec1y = input[3] - input[1];
			double vec2x = input[6] - input[4];
			double vec2y = input[7] - input[5];
			if( Math.abs((vec1x*vec2y)-(vec1y*vec2x)) < 1e-10 ){
				System.out.println("YES");
//				if(vec1x == 0.0 || vec2x == 0.0){
//					if(Math.abs(input[0] - input[4]) < 1e-9){
//						System.out.println("NO");
//					}else{
//						System.out.println("YES");
//					}
//				}else if(Math.abs(vec1y) < 1e-9 || Math.abs(vec2y) < 1e-9){
//					if(Math.abs(input[1] - input[5]) < 1e-9){
//						System.out.println("NO");
//					}else{
//						System.out.println("YES");
//					}
//				}
//				else if(Math.abs(input[4] - ((vec1y/vec1x)*(input[5]-input[0])+input[1])) < 1e-9){
//					System.out.println("NO");
//				}
//				else{
//					System.out.println("YES");
//				}
			}else{
				System.out.println("NO");
			}
		}
	}
}

Measured memory_bytes: 23388
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		String ch = sc.next();
		
		if(ch.charAt(0)>=65 && ch.charAt(0)<=90)
			System.out.println("A");
		
		else if(ch.charAt(0)>=97 && ch.charAt(0)<=122)
			System.out.println("a");
	}

}

Measured memory_bytes: 26984
#include <iostream>
using namespace std;
int main(void){
    long long A,B,C,D;
    cin>>A;
    cin>>B;
    cin>>C;
    cin>>D;
    long long cc,dd,g;
    cc=C;
    dd=D;
    if(C>D){
        g=cc;
        cc=dd;
        dd=g;//C<Dにした
    }
    g=dd%cc;
    while(g!=0){
        dd=cc;
        cc=g;
        g=dd%cc;
    }
    g=cc;
    long long E;
    E=C*D/g;
    long long ccca,ddda,eeea,AA;
    ccca=(A-1)/C;
    ddda=(A-1)/D;
    eeea=(A-1)/E;
    AA=A-1-ccca-ddda+eeea;
    
    long long cccb,dddb,eeeb,BB;
    cccb=B/C;
    dddb=B/D;
    eeeb=B/E;
    BB=B-cccb-dddb+eeeb;
    
    cout<<BB-AA<<endl;
    
    return 0;
    
}

Measured memory_bytes: 256