akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

ll x;

int main(){
	cin.sync_with_stdio(false);
	cin>>x;
	int cost;
	if(x%11==0)cost=0;
	else if(x%11>6)cost=2;
	else cost=1;
	cout<<(x/11)*2+cost<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cstdlib>
#define rep(i,n) for(int i = 0;i<(n);i++);
#define all(a) (a).begin(),(a).end()
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 100100100100100;
ll gcd(ll a,ll b) {//a>b
	if (a < b)swap(a, b);
	if (a % b == 0) return b;
	else return gcd(b, a % b);
}

int main() {
	ll N;
	cin >> N;
	vector<ll> num(N);
	vector<ll> P(N);
	vector<ll> Q(N);
	for (int i = 0; i < N; i++) {
		num[i] = i + 1;
		cin >> P[i];
	}
	ll p = 0; ll q = 0;
	ll cnt = 0;
	for (int i = 0; i < N; i++) cin >> Q[i];
	do {
		cnt++;
		bool okp = true;
		bool okq = true;
		for (int i = 0; i < N; i++) {
			if (num[i] != P[i])okp = false;
			if (num[i] != Q[i])okq = false;
		}
		if (okp) p = cnt;
		if (okq) q = cnt;
	} while (next_permutation(all(num)));
	cout << abs(p - q) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[200001], f[200001];
int main(){
    int n;
    long long k;
    scanf("%d%lld", &n, &k);
    for(int i=1;i<=n;i++) scanf("%d", &a[i]);
    for(int i=1;i<=n;i++) scanf("%d", &f[i]);
    sort(a+1, a+1+n);
    sort(f+1, f+1+n);
    reverse(f+1, f+1+n);

    long long ans = 0;
    long long lo = 0, hi = 1e12;
    while(lo <= hi){
        long long mid = (lo+hi)/2;

        long long kk = 0;
        for(int i=1;i<=n;i++){
            long long mx = mid/f[i];
            kk += max(0*1ll, a[i]-mx);
        }
        if(kk <= k) ans = mid, hi = mid-1;
        else lo = mid+1;
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 1792
n,k = map(int,input().split())
r,s,p = map(int,input().split())
T = input()

scores = {'r':p,'s':r,'p':s}


ans = 0
memo = []

for i in range(n):
  if i < k:
    ans += scores[T[i]]
    memo.append(T[i])
  else:
    if memo[i-k] == T[i]:
      memo.append('N')
    else:
      ans += scores[T[i]]
      memo.append(T[i])
print(ans)
      

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


struct Edge{
	int P1;
	int P2;
	int Wei;
};

int main(void){	

	vector<Edge> EdgeCol;
	int V, E;
	cin >> V >> E;
        if (V == 1){cout << 0<<endl;return 0;}
	vector<int>Select(V,0);
	for (int i = 0; i < E; ++i){
		int s, t, w;
		cin >> s >> t >> w;
		EdgeCol.push_back(Edge{ s, t, w });
	}
	sort(EdgeCol.begin(), EdgeCol.end(), [](Edge E1, Edge E2){return E1.Wei > E2.Wei; });
	int WeiSum = 0;
	int a=1;
	while (1){
		int aP1 = Select[EdgeCol.back().P1];
		int aP2 = Select[EdgeCol.back().P2];
		if (aP1 && aP2){
			if (aP1 != aP2){
				replace(Select.begin(), Select.end(), aP2, aP1);
				WeiSum += EdgeCol.back().Wei;
			}
		}
		else if (!aP1 && !aP2){
			Select[EdgeCol.back().P1] = a;
			Select[EdgeCol.back().P2] = a;
			a++;
			WeiSum += EdgeCol.back().Wei;
		}
		else{
			Select[EdgeCol.back().P1] = max(aP1, aP2);
			Select[EdgeCol.back().P2] = max(aP1, aP2);
			WeiSum += EdgeCol.back().Wei;
		}
		EdgeCol.pop_back();
		if (all_of(Select.cbegin(), Select.cend(), [=](int s){return s == *Select.cbegin();})){
			cout << WeiSum << endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 2760
import math

N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

def count_dict(N, P):
  sum_p = 1
  count = 0
  for p in P[:-1]:
    P_rest = sorted(P[count:])
    p_order = P_rest.index(p)
    sum_p += (p_order) * math.factorial(N-count-1)
    count += 1
  return sum_p

a = count_dict(N, P)
b = count_dict(N, Q)

print(abs(a-b))



Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <vector>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n,m;
vvi g;
vi a;

int dfs(int v){
	a[v]=1;
	int t=1;
	for(auto u:g[v]) if(!a[u]) t+=dfs(u);
	return t;
}

int main(){
	cin>>n>>m;
	g=vvi(n);
	a=vi(n);
	for(int i=0;i<m;i++){
		int u,v;
		cin>>u>>v;
		u--,v--;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	int t=0;
	for(int i=0;i<n;i++) if(!a[i]) t=max(t,dfs(i));
	cout<<t<<endl;
}

Measured memory_bytes: 21088
import java.io.*;
class Main{
	public static void main(String[]args)throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		int i,j;
		String[] nm=br.readLine().split(" ");
		int n=Integer.parseInt(nm[0]);
		int m=Integer.parseInt(nm[1]);
		
		int[][] A=new int[n][m];
		int[] b=new int[m];
		int []c=new int[n];
		
		for(i=0;i<n;i++){
			String[] numA=br.readLine().split(" ");
			for(j=0;j<m;j++){
				A[i][j]=Integer.parseInt(numA[j]);
			}
		}
		for(j=0;j<m;j++){
			String numB=br.readLine();
			b[j]=Integer.parseInt(numB);
			for(i=0;i<n;i++){
				c[i]+=(A[i][j])*(b[j]);
			}
		}
		for(i=0;i<n;i++){
			System.out.println(c[i]);
		}
	}
}

Measured memory_bytes: 27556
zipPath :: a -> b -> [a] -> [b] -> [(a, b)]
zipPath a b (x:xs) (y:ys) = (x,y) : zipPath a b xs ys
zipPath a _ [] ys = zip (repeat a) ys
zipPath _ b xs [] = zip xs (repeat b)

strip :: String -> String
strip l = if last l == ' ' then init l  else l

main :: IO ()
main = do
  o <- getLine
  e <- getLine
  let passwd = strip . concatMap (\(a, b) -> a : [b]) $ zipPath ' ' ' ' o e
  putStrLn passwd


Measured memory_bytes: 508
x,i,t;
a(x){
    if(x==2)return 1;
    if(x<2||x%2==0)return 0;
    for(i=3;i<=sqrt(x);i+=2){
        if(x%i==0)return 0;
    }
    return 1;
}
main(){
    for(scanf("%d",&x);~scanf("%d",&x);t+=a(x));
    printf("%d\n",t);
}

Measured memory_bytes: 1844
#include <iostream>
using namespace std;
#define MAX 100000

int parent(int i){return i/2;}
int left(int i){return 2*i;}
int right(int i){return 2*i +1;}

int main(){
  int H,i,A[MAX+1];
  cin >> H;
  for(i = 1;i<=H;i++) cin >> A[i];
  for(i = 1;i<=H;i++){
    cout << "node " << i << ": key = " << A[i] << ", ";
    if(parent(i) >= 1) cout << "parent key = " << A[parent(i)] << ", ";
    if(left(i) <= H) cout << "left key = " << A[left(i)] << ", ";
    if(right(i) <= H) cout << "right key = " << A[right(i)] << ", ";
    cout << endl;
  }
  return 0;
}



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

int main(){
    int n, k;
    vector<int> p(n);
    cin >> n >> k;
    rep(i,n) {
        int q;cin >> q;
        p.push_back(q);
    }
    sort(p.begin(),p.end());
    int ans = 0;
    rep(i,k) ans += p[i];
    cout << ans << endl;
    return 0;
}

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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second
#define lwb lower_bound
#define upb upper_bound
#define all(x) (x).begin(),(x).end()

signed main() {
#ifdef _DEBUG
  // freopen("in", "r", stdin);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  double n;
  cin >> n;
  cout << fixed << setprecision(10);
  cout << n * atan(1) * 8.0 << '\n';
}


Measured memory_bytes: 3792
use std::io::stdin;
use std::str::FromStr;

fn read_line<T>() -> Vec<T>
where
    T: FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect()
}

fn main() {
    const TARGET: usize = 2;

    let n: usize = read_line()[0];
    let mut a: Vec<usize> = Vec::new();

    a.push(0);
    for _i in 0..n {
        a.push(read_line()[0]);
    }

    let mut res = 0;
    let mut next = 1;
    while res < n + 1 {
        res += 1;
        next = a[next];
        if next == TARGET {
            break;
        }
    }

    if res >= n {
        println!("-1");
    } else {
        println!("{}", res);
    }
}


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

using namespace std;

int main(void){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	long n;
	cin>>n;
	
	vector<int> two(n, 0);
	
	int count[3] = {0, 0, 0};
	
	for(int i = 0; i < n; i++){
		long x;
		cin>>x;
		
		while(x%2 == 0){
			two[i]++;
			x /= 2;
		}
		
		if(two[i] > 2)
			two[i] = 2;
			
		count[two[i]]++;
	}

	if(count[2] < count[0] - 1){
		cout<<"No";
		return 0;
	}
	
	if(count[1] > 0 && count[2] < count[0]){
		cout<<"No";
		return 0;
	}
		
	cout<<"Yes";
	return 0;
}

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

int H, N;

int goukei = 0;
bool syouhai = false;

int main() {
	cin >> H >> N;
	vector<int> Attack(N);
	for (int i = 0; i < N; i++) {
		cin >> Attack.at(i);
	}
	
	for (int i = 0; i < N; i++) {
		goukei += Attack.at(i);
		if (goukei >= H) {
			syouhai = true;
			break;
		}
	}
	if (syouhai) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

// n回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii;  // 2次元配列
typedef vector<ll> vll;
typedef pair<int, int> PII;

template<typename T>
using vec = vector<T>;
template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

const ld Pi = std::acos(-1.0L);
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/
vec<vll> dp;

/*MAIN==================================================*/
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    // cout << fixed << setprecision(30);

    int n, weight; cin >> n >> weight;
    vi w(n), v(n); rep(i,n) cin >> w[i] >> v[i];
    dp.resize(n+1, vll(weight+1));
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j <= weight; ++j) {
            if(j-w[i] >= 0)chmax(dp[i+1][j], dp[i][j-w[i]] + v[i]);
            chmax(dp[i+1][j], dp[i][j]);
        }
    }
    cout << dp[n][weight] << '\n';

// 復元
    // int i = n-1, j = weight;
    // while(i >= 0 && j >= 0) {
    //     if(dp[i+1][j] == dp[i][j-w[i]] + v[i]) {
    //         cout << i+1 << '\n';
    //         j = j-w[i];
    //         --i;
    //     }
    //     else {
    //         --i;
    //     }
    // }
}

Measured memory_bytes: 80256
#include <iostream>
#include <vector>

int main()
{
    int n, m;
    std::cin >> n >> m;
    std::vector<int> vi(n);
    for (auto i = 0; i < m; ++i)
    {
        int a, b;
        std::cin >> a >> b;
        ++vi[a - 1];
        ++vi[b - 1];
    }
    for (auto v : vi)
    {
        std::cout << v << "\n";
    }
    return 0;
}


Measured memory_bytes: 768
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0; i<int(n); ++i)
#define X first
#define Y second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define maxn 200001

int n, m, x, y;
int a[maxn], b[maxn];
int tree[maxn * 20][2];

#define sgt int u, int l, int r
#define lef u<<1, l, mid
#define rig (u<<1)+1, mid, r
#define ul (u<<1)
#define ur ((u<<1)+1)
#define getmid int mid = (l+r)>>1
#define inf 10000000

void build(sgt){
	if (l + 1 == r){
		int o = l & 1;
		tree[u][o] = a[l];
		tree[u][o ^ 1] = inf;
		return;
	}
	getmid;
	build(u<<1, l, mid);
	build(rig);
	rep(o,2) tree[u][o] = min(tree[ul][o], tree[ur][o]);
	//cout << u << ' ' << tree[u][0] << tree[u][1] << endl;
}

int find(sgt, int x, int y, int o){
	getmid;
	if (x <= l && r <= y) return tree[u][o];
	if (x >= r || y <= l) return inf;
	return min(find(lef, x, y, o), find(rig, x, y, o));
}


deque<pair<int, int> > mg(const deque<pair<int, int> > &a, const deque<pair<int, int> > &b){
	deque<pair<int, int> > c;
	c.clear();
	for (int i = 0, j = 0; i < a.size() || j < b.size();){
		if (i == a.size()){
			c.push_back(b[j++]);
			continue;
		}
		if (j == b.size()){
			c.push_back(a[i++]);
			continue;
		}
		if (a[i] < b[j]){
			c.push_back(a[i++]);
		}
		else{
			c.push_back(b[j++]);
		}
	}
	return c;
}

deque<pair<int, int> > run(int l, int r){
	deque<pair<int, int> > res;
	vector<pair<int, int> > tmp;
	res.clear();
	if (l >= r){
		return  res;
	}
	int x = find(1, 0, n, l, r, l & 1);
	int pos_x = b[x];
	int y = find(1, 0, n, pos_x + 1, r, 1 ^ (l & 1));
	int pos_y = b[y];
	
	res = mg(res, run(l, pos_x));
	res = mg(res, run(pos_x + 1, pos_y));
	res = mg(res, run(pos_y + 1, r));
	
	res.push_front(mp(x ,y));
	//cout << l << ' ' << r << endl;
	//for (auto p : res) cout << "(" << p.X << "," << p.Y << ")" << " "; cout << endl;
	return res;
}

priority_queue<pair<int, pair<int, int> > > Q;
void solve(){
	cin >> n;
	rep(i, n){
		cin >> a[i];
		b[a[i]] = i;
	}
	build(1, 0, n);
	while (!Q.empty()) Q.pop();
	Q.push(mp(-find(1,0,n, 0, n, 0), mp(0, n)));

	vector<pair<int, int>> ans; ans.clear();
	while (!Q.empty()){
		pair<int, pair<int, int> > t = Q.top();
		Q.pop();

		int l = t.Y.X, r = t.Y.Y;
		int x = -t.X;
		//int x = find(1, 0, n, l, r, l & 1);
		int pos_x = b[x];
		int y = find(1, 0, n, pos_x + 1, r, 1 ^ (l & 1));
		int pos_y = b[y];

		ans.pb(mp(x, y));
		if (l < pos_x){
			Q.push(mp(-find(1, 0, n, l, pos_x, l&1), mp(l, pos_x)));
		}
		if (pos_x + 1 < pos_y){
			Q.push(mp(-find(1, 0, n, pos_x + 1, pos_y,  (pos_x + 1) & 1), mp(pos_x + 1, pos_y)));
		}
		if (pos_y + 1 < r){
			Q.push(mp(-find(1, 0, n, pos_y + 1, r, (pos_y + 1) & 1), mp(pos_y + 1, r)));
		}
		// 
	}


	int cnt = 0;
	for (auto p : ans){
		cout << p.X << ' ' << p.Y;
		if (++cnt < n / 2) cout << ' ';
	}
}

int main(int argc, char const *argv[])
{
    ios_base::sync_with_stdio(0);
	solve();	
}

Measured memory_bytes: 11276
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using vi = vector<int>;
const int maxn = 1<<18, rt = 1<<10;
int ra[maxn], a[maxn], rb[maxn], b[maxn], n;
int count(int x) {
	int res = 0;
	for(int j = n, i = 1; i <= n; i++) {
		while(j && b[j] + a[i] >= x) j--;
		res ^= n-j;
	}
	return res&1;
}
int solve(int i) {
	int msk = (1<<(i+1))-1;
	for(int i = 1; i <= n; i++) a[i] = ra[i]&msk;
	for(int i = 1; i <= n; i++) b[i] = rb[i]&msk;
	sort(a+1, a+n+1);
	sort(b+1, b+n+1);
	return count(1<<i)^count(1<<(i+1))^count(1<<i | 1<<(i+1));
}
void solve() {
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> ra[i];
	for(int i = 1; i <= n; i++) cin >> rb[i];
	int ans = 0;
	for(int i = 0; i < 29; i++) {
		ans += solve(i)<<i;
	}
	cout << ans << '\n';
}
int main() {
	cin.tie(0)->sync_with_stdio(0);
	solve();
}


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


using namespace std;
int mn;
long long DP[100005];
long long flog(int n, int arr[], int i )
{
     if (i>=n-1)
        return mn;
    if(DP[i]!=-1)
        return DP[i];
    long long wayo=flog(n,arr,i+1)+ abs(arr[i] - arr[i+1]);
    long long wayt=flog(n,arr,i+2)+ abs(arr[i] - arr[i+2]);
    return DP[i]=mn+min(wayo,wayt);


}
int main()
{
    int n;
    cin>>n;
    int arr[n];
    for(int i=0; i<n; i++)
        cin>>arr[i];
    memset(DP,-1,sizeof(DP));
    cout<<flog(n,arr,0);

}


Measured memory_bytes: 9216
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*
cout<<setprecision(20)
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1000000007LL;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
llint LBI(vector<int>&ar,int in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
llint UBI(vector<int>&ar,int in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,c,h,i,j,ans=mod;cin>>n>>c;
	int iwa[30][30]={};
	for(i=0;i<c;i++){
		for(j=0;j<c;j++){
			cin>>iwa[i][j];
		}
	}
	int col[3][30]={0};
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			int ca;cin>>ca;
			col[(i+j)%3][ca-1]++;
		}
	}
	//O(c^4)
	int ar[3]={0};
	for(ar[0]=0;ar[0]<c;ar[0]++){
		for(ar[1]=0;ar[1]<c;ar[1]++){
			for(ar[2]=0;ar[2]<c;ar[2]++){
				
				if(ar[0]==ar[1]||ar[0]==ar[2]||ar[1]==ar[2]){continue;}
				int now=0;
				
				for(i=0;i<c;i++){
					now+=iwa[i][ar[0]]*col[0][i];
					now+=iwa[i][ar[1]]*col[1][i];
					now+=iwa[i][ar[2]]*col[2][i];
				}
				mineq(ans,now);
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;cin>>n;
  vector<int> h(n);
  for(int i=0;i<n;i++)
    	cin>>h[i];
  vector<int> cost(n+1,-1);
  cost[0]=cost[1]=0;
  cost[2]=abs(h[0]-h[1]);
  for(int i=3;i<=n;i++)
  {
    if(cost[i-2]+abs(h[i-1]-h[i-3])<cost[i-1]+abs(h[i-1]-h[i-2]))
      cost[i]=cost[i-2]+abs(h[i-1]-h[i-3]);
    else
      cost[i]=cost[i-1]+abs(h[i-1]-h[i-2]);
  }
  cout<<cost[n]<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define Maxn 200007
int f[Maxn][3],n;
char s[Maxn];
int main()
{
    scanf("%s",s+1);
    n=strlen(s+1);
    for (int i=1;i<=n;i++)
        f[i][1]=-500007,f[i][2]=-500007;
    f[1][1]=1;
    f[2][2]=1;
    if (s[1]!=s[2]) f[2][1]=2;
    for (int i=3;i<=n;i++)
    {
        f[i][1]=max(f[i][1],f[i-1][2]+1);
        if (s[i]!=s[i-1]) f[i][1]=max(f[i][1],f[i-1][1]+1);
        f[i][2]=max(f[i][2],f[i-2][1]+1);
        if ((s[i]!=s[i-2])||(s[i-1]!=s[i-3])) f[i][2]=max(f[i][2],f[i-2][2]+1);
    }
    printf("%d\n",max(f[n][1],f[n][2]));
    return 0;
}

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

int main(){
    int w,d;
    while(1){
        int w,d;
        cin>>w>>d;
        if(w==0&&d==0){
            break;
        }
        int front[20]={0};
        int side[20]={0};
        int tmp;
        for(int i=0;i<w;i++){
            cin >> tmp;
            front[tmp-1]++;
        }
        for(int i=0;i<d;i++){
            cin>>tmp;
            side[tmp-1]++;
        }
        int rezult=0;
        for(int i=0;i<20;i++){
            rezult += max(side[i],front[i])*(i+1);
        }
        cout<<rezult<<endl;
    }
    return 0;
}


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

int main() {
  int64_t A, B, K;
  cin >> A >> B >> K;
  if (A>=K){
    A -= K;
  }
  else{
    K -= A;
    A = 0;
    if (B>=K){
      B -= K;
    }
    else{
      B = 0;
    }
  }
  cout << A << " " << B << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
const int mod=1e9+7;
const int maxn=2e5;
pair<int,int> a[maxn+5];
int n,D,A;
ll dp[maxn+5];
int l[maxn+5];
ll c[maxn+5];
int lowbit(int x)
{
    return x&(-x);
}
void add(int k,int x)
{
    for(;k<=n;k+=lowbit(k)) c[k]+=x;
}
ll query(int k)
{
    ll ans=0;
    for(;k;k-=lowbit(k)) ans+=c[k];
    return ans;
}
void modify(int l,int r,int x)
{
    add(l,x);
    add(r+1,-x);
}
int main()
{

    ios::sync_with_stdio(false);
    cin>>n>>D>>A;
    for(int i=1;i<=n;++i)
    {
        cin>>a[i].first>>a[i].second;
        a[i].second=(a[i].second+A-1)/A;
    }
    sort(a+1,a+n+1);
    for(int j=1,i=1;i<=n;++i)
    {
        j=max(j,i);
        while(j+1<=n&&a[j+1].first-a[i].first<=2*D) ++j;
        l[i]=j;
    }
    for(int i=1;i<=n;++i) modify(i,i,a[i].second);
    ll ans=0;
    for(int i=1;i<=n;++i)
    {
        ll num=query(i);
        if(num<=0) continue;
        ans+=num;
        modify(i,l[i],-num);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> T;
typedef pair<long double , ll> Ps;
typedef pair<ll, bool> Pb;
typedef pair<ll, vector<ll>> Pd;

const ll INF = 1e18;
const ll fact_table = 3200008;
long double Pi = 3.1415926535897932384626;

priority_queue <ll> pql;
priority_queue <P> pqp;
priority_queue <P> bag;
//big priority queue
priority_queue <ll, vector<ll>, greater<ll> > pqls;
priority_queue <P, vector<P>, greater<P> > pqps;
//small priority queue
//top pop

ll dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
ll dy[8] = {0, 1, 0, -1, 1, -1, -1, 1};
//↓,→,↑,←


#define endl "\n"
#ifdef ENJAPMA
#undef endl
#endif

#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)();
#define pc(x) cout << x << ",";
#define rep(i, n) for (ll i = 0; i < (n); i ++)

typedef vector<ll> vec;
typedef vector<vector<ll>> mat;

const ll mod = 998244353ll;
// const ll mod = 1000000007ll;

ll mypow(ll a, ll b, ll m = mod) {ll x = 1; while (b) {while (!(b & 1)) {(a *= a) %= m; b >>= 1;}(x *= a) %= m; b--;} return x;}
vec readvec(ll read) { vec res(read); for (int i = 0; i < read; i++) { cin >> res[i]; } return res;}
void YES(bool cond) { if (cond) { p("YES");} else { p("NO");} return;}
void Yes(bool cond) { if (cond) { p("Yes");} else { p("No");} return;}
void line() { p("--------------------"); return;}

/*
ll fact[fact_table + 5], rfact[fact_table + 5];

void c3_init() {
    fact[0] = rfact[0] = 1;
    for (ll i = 1; i <= fact_table; i++) {
        fact[i] = (fact[i - 1] * i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table], mod - 2, mod);
    for (ll i = fact_table; i >= 1; i--) {
        rfact[i - 1] = rfact[i] * i;
        rfact[i - 1] %= mod;
    }
    return;
}
ll c3(ll n, ll r) {
    return (((fact[n] * rfact[r]) % mod ) * rfact[n - r]) % mod;
}
*/



struct Timer {
    int64_t start; const int64_t CYCLES_PER_SEC = 2800000000;
    Timer() { reset(); }
    void reset() { start = getCycle(); }
    inline double get() { return (double)(getCycle() - start) / CYCLES_PER_SEC; }
    inline int64_t getCycle() {
        uint32_t low, high; __asm__ volatile ("rdtsc" : "=a" (low), "=d" (high));
        return ((int64_t)low) | ((int64_t)high << 32);
    }
};

bool multicase = false;
ll x[500005], y[500005], z[500005];

void solve() {
    ll n;
    cin >> n;
    ll ans = 0;
    for(int i=1;i<=n;i++){
        ll maxi = (n - 1) / i;
        ans += maxi;
    }
    p(ans);
    return;
}

int main() {
    // init();
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll q, testcase = 1;
    if (multicase) {
        cin >> q;
    } else {
        q = 1;
    }
    while (q--) {
        // pu("Case ");pu("#");pu(testcase);pu(": ");
        solve();
        testcase++;
    }

    // solve();
    return 0;
}






Measured memory_bytes: 3652
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Diagnostics;
using Enu = System.Linq.Enumerable;
using System.Numerics;

public class Program
{
    public void Solve()
    {
        int N = Reader.Int();
        var S = Reader.String();
        var T = Reader.String();
        for (int len = N; len >= 0; len--)
            if (S.Substring(N - len) == T.Substring(0, len))
            {
                Console.WriteLine(N * 2 - len);
                return;
            }
    }
}


class Entry { static void Main() { new Program().Solve(); } }
class Reader
{
    static TextReader reader = Console.In;
    static readonly char[] separator = { ' ' };
    static readonly StringSplitOptions op = StringSplitOptions.RemoveEmptyEntries;
    static string[] A = new string[0];
    static int i;
    static void Init() { A = new string[0]; }
    public static void Set(TextReader r) { reader = r; Init(); }
    public static void Set(string file) { reader = new StreamReader(file); Init(); }
    public static bool HasNext() { return CheckNext(); }
    public static string String() { return Next(); }
    public static int Int() { return int.Parse(Next()); }
    public static long Long() { return long.Parse(Next()); }
    public static double Double() { return double.Parse(Next()); }
    public static int[] IntLine() { return Array.ConvertAll(Split(Line()), int.Parse); }
    public static int[] IntArray(int N) { return Range(N, Int); }
    public static int[][] IntTable(int H) { return Range(H, IntLine); }
    public static string[] StringArray(int N) { return Range(N, Next); }
    public static string[][] StringTable(int N) { return Range(N, () => Split(Line())); }
    public static string Line() { return reader.ReadLine().Trim(); }
    static string[] Split(string s) { return s.Split(separator, op); }
    static T[] Range<T>(int N, Func<T> f) { var r = new T[N]; for (int i = 0; i < N; r[i++] = f()) ; return r; }
    static string Next() { CheckNext(); return A[i++]; }
    static bool CheckNext()
    {
        if (i < A.Length) return true;
        string line = reader.ReadLine();
        if (line == null) return false;
        if (line == "") return CheckNext();
        A = Split(line);
        i = 0;
        return true;
    }
}

Measured memory_bytes: 2648
import math

n = int(input())
word_list = []
for _ in range(n):
    word_list.append(str(input()))
for i, word in enumerate(word_list):
    # 各文字列をソート
    word_list[i] = ''.join(sorted(word))
# 全体をソート
word_list = sorted(word_list)+['']
temp_str = ''
temp_count = 1
result_count = 0
for word in word_list:
    if temp_str == word:
        temp_count += 1
    else:
        if temp_count > 1:
            # 組み合わせの計算
            result_count += math.factorial(temp_count) // (math.factorial(temp_count - 2) * 2)
        temp_count = 1
    temp_str = word
print(result_count)

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

int main(){
    string s, t;
    cin >> s;
    t = s;
    reverse(s.begin(), s.end());
    if(stoi(s) != stoi(t)) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

//#include "stdafx.h"
#include "iostream"
#include "fstream"
#include "algorithm"
#include "iomanip"
#include "stack"
#include "queue"
#include "string"
#include "vector"
#include "map"
#include "set"
#include "list"
#include "deque"
#include "complex"
#include "bitset"
#include "cmath"
#include "unordered_set"
#include "unordered_map"
#include "iterator"
#include <ctime>
#include <cassert>
#include "numeric"
#include <cstdio>
#include "random"
#include "chrono"
#include "cstring"

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target_ans("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;

//#define f(i,n) for(int i=0; i<n;i++)
//#define rf(i, n) for(int i=n-1;i>=0;i--)
//#define forn(i, j, n) for(int i=j; i<n; i++)
//#define ff(i, j, n) f(i, n)f(j, n)
#define pb push_back
#define maxi(a,b) a = max(a, b);
#define mini(a,b) a = min(a, b);
#define endl '\n'

#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sqr(x) ((x) * (x))
#define SZ(a) ((int)(a.size()))
#define watch(x) cout << (#x) << " = " << x << endl;
//typedef long long ll;
typedef long double ld;

#define int long long
//#define int unsigned int
#define double ld
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<pii> vpii;
typedef vector<char> vc;
typedef vector<vi> vvi;

template<class T>
void show(const vector<T> &a)
{
	for (T x : a)
		cout << x << " ";
	cout << endl;
}

vi xx = { 1, 0, -1, 0 };
vi yy = { 0, 1, 0, -1 };
string dir = "LRUD";

const int N = 2e5 + 50, oo = 5e18 + 500;
const int mod = 998244353;
//const int mod = 1e9 + 7;
//const int mod = 1e9 + 9;
const double eps = 1e-6, PI = 2 * acos(0.0);
int n, m, k;
int cnt = 0;
int lg = 18;
vi g[N];
vi rg[N];
vi visit(N, 0);


signed main()
{
	ios::sync_with_stdio(0);
	cout.tie(0); cin.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	string s;
	cin >> s;

	n = SZ(s);
	for (int i = 0; i < n; i++)
	{
		if (i + 1 < n && s[i] == s[i + 1])
		{
			return cout << i+1 << " " << i + 2, 0;
		}

		if (i + 2 < n && s[i] == s[i + 2])
		{
			return cout << i+1 << " " << i + 3, 0;
		}
	}
	
	return cout << -1 << " " << -1, 0;
}



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

int main() {
  std::string s;
  cin >> s;
  int max = 0;
  string max_s = "";
  for(int l = 0; l < s.size();l++){
      for(int r = l; r < s.size(); r++){
        string tmp = s.substr(l,r-l+1);
        // cout << tmp << endl;
        for(int i = 0; i < tmp.size(); i++){
            if(!(tmp[i] == 'A' || tmp[i] == 'C' || tmp[i] == 'G' ||tmp[i] == 'T' )){
                break;
            }
            if(i+1==tmp.size()){
                if(max < tmp.size()){
                    max = tmp.size();
                    max_s = tmp;
                }
            }
        }
      }
  }
  cout << max << endl;
//   cout << max_s << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int m = 1046527;
vector<string> T(m, "");
int h1(int key) { return key % m; }
int h2(int key) { return 1 + (key % (m - 1)); }
int h(int key, int i) { return (h1(key) + i * h2(key)) % m; }
auto str2key(string str) {
  int key = 0;
  for (size_t i = 0, n = str.size(); i < n; i++) {
    auto s = str.at(i);
    if (s == 'A') {
      key += 1 * pow(5, i);
    } else if (s == 'C') {
      key += 2 * pow(5, i);
    } else if (s == 'G') {
      key += 3 * pow(5, i);
    } else if (s == 'T') {
      key += 4 * pow(5, i);
    }
  }
  return key;
}
auto insert(string str) {
  auto key = str2key(str);

  int i = 0, hash;

  do {
    hash = h(key, i);
    i += 1;
  } while (!T[hash].empty());

  T[hash] = str;
}

auto find(string str) {
  auto key = str2key(str);

  int i = 0, hash;
  do {
    hash = h(key, i);
    i += 1;
  } while (i < m && !T[hash].empty() && T[hash] != str);

  if (T[hash] == str)
    return true;
  else
    return false;
}
int main() {
  int n;
  string op, str;
  cin >> n;
  for (size_t i = 0; i < n; i++) {
    cin >> op >> str;

    if (op == "insert") {
      insert(str);
    } else if (op == "find") {
      if (find(str)) {
        cout << "yes" << endl;
      } else {
        cout << "no" << endl;
      }
    }
  }
}



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

class Main {
  public static void main(String... args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    // String[] sp = br.readLine().split(" ");
    int t = Integer.valueOf(br.readLine());
    for (int k = 0; k < t; k++) {
      String[] a = br.readLine().split("");
      String[] b = br.readLine().split("");
      int n = a.length;
      int m = b.length;
      int[][] dp = new int[1001][1001];

      for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
          if (a[i].equals(b[j])){
            dp[i+1][j+1] = dp[i][j] + 1;
          } else {
            dp[i+1][j+1] = Math.max(dp[i][j+1], dp[i+1][j]);
          }
        }
      }

      System.out.println(dp[n][m]);
    }
  }
}



Measured memory_bytes: 161964
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INTINF = 1<<29;
const ll LLINF = 1LL<<61;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const int DY[8]={ 1, 0,-1, 0, 1,-1, 1,-1};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  int o = 0;
  int t = 0;
  int f = 0;
  int a;
  cin >> n;
  REP(i,n){
    cin >> a;
    if (a%2!=0){
      o++;
    }else if(a%4==0){
      f++;
    }else if(a%2==0){
      t++;
    }
  }
  if (t>0)o++;
  if (o <= f+1){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
int INF = 1 << 29;
int dp[800][800];
string s[800];
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int h, w, k;
int ans = INF;
queue<P> que;
bool fl;
int main()
{
    cin >> h >> w >> k;
    rep(i, h)
    {
        rep(j, w)
        {
            dp[i][j] = INF;
        }
    }
    rep(i, h)
    {
        cin >> s[i];
        rep(j, w)
        {
            if (s[i][j] == 'S')
            {
                que.push(P(i, j));
                if (i == 0 || j == 0 || i == h - 1 || j == w - 1)
                {
                    fl = true;
                }
                dp[i][j] = 0;
            }
        }
    }
    while (!que.empty())
    {
        P p = que.front();
        ans = min(ans, min(min(h - 1 - p.first, p.first), min(w - 1 - p.second, p.second)));
        que.pop();
        if (dp[p.first][p.second] == k)
            continue;
        rep(i, 4)
        {
            if (p.first + dy[i] < 0 || p.first + dy[i] >= h)
                continue;
            if (p.second + dx[i] < 0 || p.second + dx[i] >= w)
                continue;
            if (s[p.first + dy[i]][p.second + dx[i]] == '#')
                continue;
            if (dp[p.first + dy[i]][p.second + dx[i]] != INF)
                continue;
            dp[p.first + dy[i]][p.second + dx[i]] = dp[p.first][p.second] + 1;
            que.push(P(p.first + dy[i], p.second + dx[i]));
        }
    }
    if (fl)
        cout << 0 << endl;
    else
        cout << (ans + k - 1) / k + 1 << endl;
}


Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;


void solve()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	vector<vector<int>>rgb(3);
	string t="RGB";
	set<int>bnum;
	rep(i,n){
		rep(j,3){
			if(s[i]==t[j]){
				rgb[j].push_back(i);
				if(t[j]=='B'){
					bnum.insert(i);
				}
			}
		}
	}
	ll cnt=0;
	int mb=bnum.size();
	rep(i,rgb[0].size()){
		rep(j,size(rgb[1])){
			//int k=rgb[0][i]+rgb[1][j];
			int dis=abs(rgb[0][i]-rgb[1][j]);
			int a=max(rgb[0][i],rgb[1][j]);
			int b=min(rgb[0][i],rgb[1][j]);
			int delta=mb;
			if(dis%2==0){
				delta-=bnum.count(b+dis/2);
			}
			delta-=bnum.count(b-dis)+bnum.count(a+dis);
			cnt+=delta;
		}
	}
	cout<<cnt<<endl;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
	return 0;
}


Measured memory_bytes: 3700
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <stack>
using namespace std;
int main() {
    int N,K; cin >> N >> K;
    if(K==1) {
        cout << 0 << endl;
        return 0;
    }
    int M = N - K+1;
    cout << M-1 << endl;

    return 0;
}

Measured memory_bytes: 256
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
import itertools
import math
import numpy as np

def main():
    numbers=[]
    #n = int(input())
    n,m = map(int,input().split())
    #numbers=list(map(int,input().split()))
    numbers=np.array([list(map(int,input().split())) for _ in range(n)])
    ans=0
    length=0
    count=0

    for idx,pair in enumerate(itertools.combinations(numbers,2)):
        tmp_A=np.array(pair[0])
        tmp_B=np.array(pair[1])
        length=(tmp_A-tmp_B)**2
        ans=math.sqrt(sum(length))
        if ans.is_integer()==True:
            count+=1
        else:
            continue
    print(count)



if __name__=="__main__":
    main()  

Measured memory_bytes: 26960
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<cmath>
#include<cctype>
#include<set>
#include<queue>
#include<vector>
#include<map>
using namespace std;
typedef long long LL;

inline int read() {
	int x = 0, f = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar())if (ch == '-')f = -1;
	for (; isdigit(ch); ch = getchar())x = x * 10 + ch - '0'; return x * f;
}

const int N = 2e5 + 5;

int a[N], vis[N];
std::map<LL, int> Map;

int main() {
	int n = read(), ans = 0;
	for (int i = 1; i <= n; ++i) ++Map[a[i] = read()];
	std::sort(a + 1, a + 1 + n);
	for (int i = n; i; --i)
		if (Map[a[i]])
			for (int j = 31; ~j; --j) {
				LL pw = 1ll << j;
				if (pw == a[i] + a[i] && Map[a[i]] >= 2) {
					Map[a[i]] -= 2, ++ans;
					break;
				} else if (pw != a[i] + a[i] && pw > a[i] && Map[pw - a[i]]) {
					--Map[pw - a[i]], --Map[a[i]], ++ans;
					break;
				}
			}
	printf("%d\n", ans);

	return 0;
}



Measured memory_bytes: 51968
n = int(input())
a,b = map(int,input().split())
p = list(map(int,input().split()))
q = [0,0,0]
for i in p:
  if i <= a:
    q[0] += 1
  elif b < i:
    q[2] += 1
  else:
    q[1] += 1
q.sort()
print(q[0])
         

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

ll com[51][51];

int main(void){
  ll n, a, b;
  cin >> n >> a >> b;
  vector<ll> v(n);
  map<ll, ll> mp;
  REP(i, n) cin >> v[i], mp[v[i]]++;;
  sort(ALLr(v));
  double ave = 0;
  REP(i, a) ave += v[i];
  ave /= a;

  com[0][0] = 1;
  FORe(i, 1, n){
    REP(j, i+1){
      com[i][j] += com[i-1][j];
      if(j > 0) com[i][j] += com[i-1][j-1];
    }
  }

  ll ans = 0;
  if(v[0] != v[a-1]){
    ll m = 0;
    ll x = mp[v[a-1]];
    REP(i, a) if(v[i] == v[a-1]) m++;
    ans = com[x][m];
  }else{
    ll x = mp[v[0]];
    FORe(i, a, b) ans += com[x][i];
  }
  printf("%.10f\n", ave);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  int N; cin>>N;
  int a=0,b=0,c=0,d=0;
  int ans=0;
  string s;
  for(int i=0;i<N;i++){
    cin>>s;
    if(s.at(s.size()-1)=='A') a++;
    if(s.at(0)=='B') b++;
    if(s.at(s.size()-1)=='A' && s.at(0)=='B') c++;
    for(int j=0;j<s.size()-1;j++)
      if(s.at(j)=='A' && s.at(j+1)=='B') d++;
  }
  a-=c;b-=c;
  if(a==0&&b==0&&c!=0) ans=c+d-1;
  else if(a==0&&b==0&&c==0) ans=d;
  else if((a!=0&&b==0) or (a==0&&b!=0)) ans=c+d;
  else ans=c+d+min(a,b);
  cout<<ans<<endl;
}


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

typedef long long ll;
const double EPS = 1e-9;
typedef vector<ll> vecl;
typedef pair<ll, ll> pairl;

template<typename T, typename U>
using mapv = map<T,vector<U>>;

#define ALL(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

#define MOD097 1000000007

///// For Debug

#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}

// 提出時はコメントアウト
// #define LOCAL
#define DEBUG_

#ifndef LOCAL
#undef DEBUG_
#endif

#ifdef DEBUG_

#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)

#endif

//////////

int main() {
    #ifdef LOCAL
    ifstream in("../../Atcoder/input.txt");
    cin.rdbuf(in.rdbuf());
    #endif

    ll D,T,S;
    cin>>D>>T>>S;

    cout << (D <= T*S ? "Yes" : "No") << endl;


    return 0;
}


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

int main() {
    int X;
    cin >> X;
    int ans = 0;
    for (int i = 0; i <= X; ++i) {
        ans += i;
        if(ans >= X) {
            cout << i << "\n";
            break;
        }
    }
    return 0;
}

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

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

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

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, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

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

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

//
// # Examples
//
// # integers
// input! { n: usize, m: usize, ... }
//
// # array
// input! { n: usize, v: [i32; n], }
//
// # matrix
// input! { n: usize, m: usize, mat: [[]] }
//
// # string
// input! { s: chars }
//
// 3 4
// ####
// #..#
// .#.#
//
// input!{
//     h: usize,
//     w: usize,
//     board: [chars; h],
// }

// https://practice.contest.atcoder.jp/tasks/practice_1
//fn main() {
//    input!{
//        a: usize, b: usize, c: usize,
//        foo: chars,
//    }
//    let s: String = foo.into_iter().collect();
//    println!("{} {}", a+b+c, s);
//}
use std::cmp;
fn main() {
    input!{
        a: i32, b: i32
    }
    println!("{}", cmp::max(a+b, cmp::max(a-b, a*b)));
}

Measured memory_bytes: 4352