akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
using namespace std;

int main(){
    int N,p[20];cin>>N;
    p[0]=2,p[1]=3,p[2]=5,p[3]=7,p[4]=11,p[5]=13,p[6]=17,p[7]=19;
    p[8]=23,p[9]=29,p[10]=31,p[11]=37,p[12]=41,p[13]=43,p[14]=47;

    pair<int,int> pair[20];
    for(int i=0;i<15;++i){
        pair[i].first=p[i];
        pair[i].second=0;
        int k=1;
        while(N/pow(p[i],k)!=0){
            pair[i].second+=N/pow(p[i],k);
            ++k;
        }       
    }
    int n2=0,n4=0,n14=0,n24=0,n74=0;
    for(int i=0;i<15;++i){
        if(pair[i].second>=2)++n2;
        if(pair[i].second>=4)++n4;
        if(pair[i].second>=14)++n14;
        if(pair[i].second>=24)++n24;
        if(pair[i].second>=74)++n74;
    }
    int ans=0;
    ans+=n74;
    ans+=n24*(n2-1);
    ans+=n14*(n4-1);
    ans+=n4*(n4-1)*(n2-2)/2;

    cout<<ans<<endl;
    return 0;

}

Measured memory_bytes: 256
ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(map(int, input().split()))

import numpy as np

n = ii()
h = li()

h1 = np.array(h[1:])
h2 = np.array(h[:-1])

l = h2 - h1
l = l>=0

cnt=0
m=[]
for i in range(n-1):
    if l[i]==True:
        cnt+=1
    elif l[i]==False:
        m.append(cnt)
        cnt=0
m.append(cnt)

print(max(m))

Measured memory_bytes: 23392
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m; cin >> n >> m;
  vector<set<int>> G(n);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    G[a].insert(b);
    G[b].insert(a);
  }
  for(int i: G[0]) {
    if(G[n-1].count(i)) {
      cout << "POSSIBLE" << "\n";
      return 0;
    }
  }
  cout << "IMPOSSIBLE" << "\n";
  return 0;
}


Measured memory_bytes: 31448
def main():
    N = int(input())
    A = map(int, input().split())

    t = 1
    for x in A:
        t *= x
        if t > 10 ** 18:
            if 0 in A:
                print(0)
            else:
                print(-1)
            return
    print(t)


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok


Measured memory_bytes: 19384
#include <bits/stdc++.h>
#define N 502
using namespace std;
int n,a[N][N],v[N],d[N];
int prim() {int u=0;d[0]=2e9;
	for (int i=1;i<=n;i++) v[i]=0,d[i]=a[1][i];
	for (int i=1;i<=n;i++) {
		int t=0;
		for (int j=1;j<=n;j++)
			if (!v[j] && d[j]<d[t]) t=j;
		if (!t) break;
		cout<<d[t]<<endl;
		u+=d[t];v[t]=1;
		for (int j=1;j<=n;j++)
			d[j]=min(d[j],a[t][j]);
	}return u;
}
int main() {cin>>n;
	for (int i=1;i<=n;i++)
		for (int j=1;j<=n;j++) cin>>a[i][j];
	int gg=0;
	long long u=0;
	for (int i=1;i<=n && !gg;i++)
		for (int j=1;j<=n && !gg;j++) if (i^j) {int t=2e9;
			for (int k=1;k<=n;k++)
				if (k^i && k^j) t=min(t,a[i][k]+a[k][j]);
			//cout<<a[i][j]<<' '<<t<<endl;
			if (a[i][j]>t) {gg=1;break;}
			if (t>a[i][j]) u+=a[i][j];
		}
	if (gg) puts("-1");
	else {
		cout<<u/2<<endl;
		//cout<<prim()<<endl;
	}
	return 0;
}

Measured memory_bytes: 896
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        Map<Integer, List<Integer>> graph = new HashMap<>();
        for(int i = 0; i < n; i++){
            int u = Integer.parseInt(sc.next());
            graph.put(u, new ArrayList<>());
            int k = Integer.parseInt(sc.next());
            for(int j = 0; j < k; j++){
                graph.get(u).add(Integer.parseInt(sc.next()));
            }
        }
        
        ArrayDeque<Integer> queue = new ArrayDeque<>();
        int[] d = new int[n+1];
        Arrays.fill(d, -1);
        queue.add(1);
        d[1] = 0;
        while(!queue.isEmpty()){
            int u = queue.poll();
            graph.get(u).forEach((v) -> {
                if(d[v] == -1){
                    queue.add(v);
                    d[v] = d[u] +1;
                }
            });
        }
        
        StringBuilder sb = new StringBuilder();
        for(int i = 1; i <= n; i++){
            sb.append(i).append(" ").append(d[i]).append(System.lineSeparator());
        }
        System.out.print(sb);
    }
}


Measured memory_bytes: 32976
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main(){
    let nm:Vec<u32> = read_vec();
    let am:Vec<Vec<u32>> = read_vec2(nm[1]);
    let mut oi = vec![false;(nm[0]+ 1) as usize];
    let mut iton = vec![false;(nm[0] + 1) as usize];
    for i in 0..nm[1]{
        if am[i as usize][0] == 1 {
            oi[(am[i as usize][1]) as usize] = true;
        } else if am[i as usize][1] == nm[0] {
            iton[(am[i as usize][0]) as usize] = true; 
        }
    }
    for i in 0..nm[0] + 1 {
        if oi[i as usize] && iton[i as usize]{
            println!("POSSIBLE");
            return;
        }
    }
    println!("IMPOSSIBLE");
}

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

int main() {
  string s, t;
  cin >> s >> t;
  int n = s.size();
  int m = t.size();
  int mx = 0;
  for (int i = 0; i < n - m + 1; ++i) {
    int cnt = 0;
    for (int j = 0; j < m; ++j) {
      if (s[i + j] == t[j]) {
        ++cnt;
      }
    }
    mx = max(mx, cnt);
  }
  cout << m - mx << endl;
}


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

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef pair<ll, ll> pair_t;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
/***** define constant start *******/
const ll MOD = 1000000007;
const double PI = 3.1415926535897932;
const ll INF = 1<<29;
/****** define constant end ********/


/****** define variable start ******/
string s;
/******* define variable end *******/

ll solve(){
    cin >> s;
    REP(i ,s.size()){
        cout << "x";
    }
    cout << endl;
    return 0;
}
int main(){
    //clock_t start = clock();
    cout << std::fixed << std::setprecision(10);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll end_solve = solve();
    /*
    clock_t end = clock();
    const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;
    printf("time %lf[ms]\n", time);
    */
    return (int)end_solve;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define ub upper_bound
#define lb lower_bound
#define all(v) ((v).begin()),((v).end())
#define allr(v) ((v).rbegin()),((v).rend())
#define ff first
#define ss second
#define mp make_pair
#define pll pair<ll,ll> 
#define fo(i,n) for(ll i=0;i<n;i++)
#define foa(i,s,e) for(ll i=(s);i<e;i++)
#define fod(i,s,e) for(ll i= (s);i>=(e);i--)
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
#define sz(x) (ll)(x.size())
#define ANS cout<<ans<<'\n'
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define Yes cout<<"Yes\n"
#define No cout<<"No\n"
const ld pi = 3.14159265358979323846;
ll MOD = 1e9 + 7;
//ll MOD = 998244353;
const char nl = '\n';
const ll inf = 1e15;
#define fill(a,b) memset(a, b, sizeof(a))
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) fo(i, n){fo(j, m)cout<<dp[i][j]<<" ";cout<<"\n";}
ll nxt(){ll x; cin >> x; return x;}
ll mul(ll x,ll y){
    return (1ll* (x%MOD)*(y%MOD));
}
ll modpow(ll x,ll y){ll z=1;while(y>0){if(y%2)z=mul(z,x);x =mul(x,x) ;y/=2;}return z;}
ll power(ll x,ll y){ll z=1;while(y>0){if(y%2)z=z*x;x =x*x ;y/=2;}return z;}
ll gcd(ll a,ll b){if(a<b) return gcd(b,a);if(b==0) return a;return gcd(b,a%b);} 
ll min(ll a,ll b){if(a<b)return a;return b;}
ll max(ll a,ll b){if(a>b)return a;return b;}
ll sq(ll a){
    ll ans = (1ll*a*a);
    return ans;
}
const ll N = 2e5 + 5;
vll g[N];
ll vis[N];
ll mx, ans;
void dfs(ll u, ll par){
    vis[u] = 1;
    mx++;
    for(ll x : g[u]){
        if(x != par && !vis[x]){
            dfs(x, u);
        }
    }
}
void solve(){
    ll n, m;
    cin >> n >> m;
    set<pll> s;
    fo(i, m){
        ll a, b;
        cin >> a >> b;
        s.insert(mp(a, b));
    }
    for(pll x : s){
        g[x.ff].pb(x.ss), g[x.ss].pb(x.ff);
    }
    for(ll i = 1; i <= n; i++){
        if(!vis[i]){
            mx = 0;
            dfs(i, 0);
            ans = max(ans, mx);
        }
    }
    cout << ans << nl;
}
int main(){ 
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("inputf.txt" , "r" , stdin) ;
    freopen("outputf.txt" , "w" , stdout) ;
    freopen("error.txt" , "w" , stderr) ;
    #endif
    ll TC = 1;
    //cin>>TC;
    fo(TT, TC){
        // Google,FB cout << "Case #"<< TT + 1 << ": ";
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


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

int main() {
  int N,i;
  string S;
  cin>>N>>S;
  vector<int> W(N+1,0),R(N+1,0);
  for (i=0;i<N;i++) {
    if (S[i]=='W') {
      W[i+1]=W[i]+1;
      R[i+1]=R[i];
    } else {
      W[i+1]=W[i];
      R[i+1]=R[i]+1;
    }
  }
  cout<<W[R[N]]<<endl;
  return 0;
}


Measured memory_bytes: 4576
#include <iostream>
#include "string.h"
#include <vector>
#include <cstdlib>
#include <cmath>
#include <algorithm>

using namespace std;

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

unsigned long long lcm(unsigned long long a,unsigned long long b){
	if(a == b) return a;
	return  a / gcd(a,b) * b;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<unsigned long long> T(N);
	for(int i = 0;i < N;i++) cin >> T[i];
	unsigned long long tmp ;
	if(N == 1){
		cout << T[0] << endl;
		return 0;
	}else{
		if(T[0] > T[1])	tmp = lcm(T[0],T[1]);
		else if(T[0] < T[1]) tmp = lcm(T[1],T[0]);
		else tmp = T[0];
		for(int i = 2;i < N;i++){
			if(tmp > T[i]) tmp = lcm(tmp,T[i]);
			else if(tmp < T[i]) tmp = lcm(T[i],tmp);
		}
	}
	if(tmp == 0) cout << T[0] << endl;
	else cout << tmp << endl;
	
	return 0;
}

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

// 公約数
long long int gcd(long long int a, long long int b){
  if(b == 0){
    return a;
  }else{
    return gcd(b, a % b);
  }
}
// 最小公倍数 = a * b / 最大公約数
// 公倍数
long long int lcm(long long int a, long long int b){
  return a * b / gcd(a, b);
}

// abc148 c
int main(void){
    long long int a = 0, b = 0; 

    scanf("%lld%lld", &a, &b);

    printf("%lld\n", lcm(a, b));

    return 0;

} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define uint unsigned long long
#define ll long long
#define db double
#define ls rt << 1
#define rs rt << 1 | 1
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define X first
#define Y second
#define pcc pair<char, char>
#define vi vector<int>
#define vl vector<ll>
#define rep(i, x, y) for(int i = x; i <= y; i ++)
#define rrep(i, x, y) for(int i = x; i >= y; i --)
#define eps 1e-9
using namespace std;
const db pi = acos(-1.0);
inline int read()
{
    int x = 0, f = 1; char ch = getchar();
    while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
    while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
    return x * f;
}

const int N = 100010;
char s[N];
int n;
int main()
{
	scanf("%s",s + 1);
	n = strlen(s + 1);
	int cur = 0 , ans = 0;
	rep(i, 1, n)
		if (cur)
		{
				cur --;
				if (s[i] == 'g') ans ++;
		}
		else
		{
				cur ++;
				if (s[i] == 'p') ans --;
		}

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


Measured memory_bytes: 384
#include <stdio.h>

int main(void) {
	int i;
	int n, a[100000];
	int cnt;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", a + i);
		a[i]--;
	}

	cnt = 0;
	for (i = 0; i < n; i++)
		cnt += i == a[a[i]];

	printf("%d\n", cnt / 2);

	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <random>

using namespace std;
 
#define mod 1000000007
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define long long long
inline int rei(){int x;cin>>x;return x;}
inline long rel(){long x;cin>>x;return x;}
inline string res(){string x;cin>>x;return x;}
//------------------------------------------------------- 
void Calc(){
	long N = rel();
	long ans = N*(N-1)/2;
	cout << ans << endl;
}
int main(int argc,char** argv){
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0); Calc(); return 0;
}

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

int main() {
    int n; cin >> n;
    vector<int64_t> a(n), b(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i];
    }

    int64_t ans = 0;
    for (int i = n - 1; 0 <= i; --i) {
        // 0は倍数なのか？
        if (a[i] + ans == 0) {
            continue;
        }

        if (a[i] + ans <= b[i]) {
            ans += b[i] - (a[i] + ans);
        }
        else {
            int64_t mod = (a[i] + ans) % b[i];
            if (mod) ans += b[i] - mod;
        }
    }

    cout << ans << endl;
}



Measured memory_bytes: 4840
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())




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

	int a, b;
	cin >> a >> b;
	cout << a*b - a - b + 1 << endl;


	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define ll long long
#define ull unsigned long long
#define ld long double
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rrep(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define pll pair<long long,long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vvc vector<vector<char>>
#define vc vector<char>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define maxe(x) *max_element(all(x))
#define mine(x) *min_element(all(x))
#define Size(x) ((int)(x).size())
#define umap unordered_map
const long long INF = 1LL << 60;
const long double pi = 3.1415926535897932;
long long MOD = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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

//lis,modpow,uf,modncr,soinsubunkai,yakusurekkyo,gyakugen
//mint,dijkstra
    signed main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        ll a;
        string b;
        cin>>a>>b;
        ll c=(b[0]-'0')*100+(b[2]-'0')*10+(b[3]-'0');
        cout<<a*c/100<<endl;
    }

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

using namespace std;

const int N = 111;

int w[N];
int v[N];
long long dp[100010][N];

long long f(int W , int idx) {
    if(dp[W][idx] != -1) 
        return dp[W][idx];
    if(idx < 0)
        return 0;
    else if(W == 0){ 
        return dp[W][idx] = 1;
    }
    else if(w[idx] > W) 
        return dp[W][idx] = f(W,idx - 1);
    else 
        return dp[W][idx] = max(v[idx] + f(W - w[idx], idx - 1) , f(W, idx - 1));
}

int main() {

    int n , W;
    cin >> n >> W;
    for(int i = 0 ; i < n ; i++)
        cin >> w[i] >> v[i];


    memset(dp, -1, sizeof(dp));

    cout << f(W,n - 1) << '\n';

    return 0;
}

Measured memory_bytes: 87040
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
 
#define N 100000
 
typedef struct que{
  char name[10];
  int num;
}que;
 
int main(void){
  int i,n,q,sum=0,head,tail;
  que Q[N];
 
  scanf("%d %d",&n,&q);
  if(n>N||n<=0) exit(1);
 
     
 
  for(i=1;i<=n;i++){
    scanf("%s",Q[i].name);
    scanf("%d",&Q[i].num);
  }
 
  head=1;
  tail=n+1;
 
  while(head!=tail){
    if(Q[head].num<=q && Q[head].num!=0){
      sum+=Q[head].num;
      printf("%s ",Q[head].name);
      printf("%d\n",sum);
      if(head==N-1) head=0;
      head++;
       
    }
    else {
      Q[head].num-=q;
      sum+=q;
      Q[tail]=Q[head];
      if(head==N-1) head=0;
      if(tail==N-1) tail=0;
      tail++;
      head++;
    }
  }
 
   
  return 0;
}

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

int main(){

    int n;
    int cntmax=0;
    int ans=1;
    cin>>n;
    for(int i=1;i<=n;i++){
        int check=i,cnt=0;
        while(check%2==0){
            check/=2;
            cnt++;
        }
        if(cnt>cntmax){
            ans=i;
            cntmax=cnt;
        }
    }
    cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 256
n, m = map(int,input().split())
a = []
b = []
for i in range(n):
  a.append([int(i) for i in input().split()])
for j in range(m):
  b.append(int(input()))
for a_row in a:
  print(sum([x*y for x,y in zip(a_row, b)]))


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

bool is_prime(int k)
{
	for(int j=2;j*j<=k;j++){
		if(k%j==0) {
			return false;
		}
	}
    return true;
}

int main()
{
    // 入力
    int D,N;
    cin>>D>>N;
    if(N==100) cout<<(int)pow(100,D)*(N+1)<<endl;
    else cout<<(int)pow(100,D)*N<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys,collections;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

n = I()
a = Is()

dic = collections.defaultdict(int)
tmp = 0
dic[0] = 1
for e in a:
    tmp += e
    dic[tmp] += 1
def calc(x):
    return x*(x-1)//2
ans = 0
for e in dic.values():
    ans += calc(e)
print(ans)
    

Measured memory_bytes: 39424
X, Y, A, B, C = map(int, input().split())
P = sorted(list(map(int, input().split())), reverse = True)
Q = sorted(list(map(int, input().split())), reverse = True)
R = list(map(int, input().split()))

a = sorted(P[:X] + Q[:Y] + R, reverse  = True)
print(sum(a[:(X+Y)]))


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

int main() {
  string sa, sb, sc; cin >> sa >> sb >> sc;
  int cnta, cntb, cntc;
  cnta=0; cntb=0; cntc=0;
  char turn = 'a';
  sa += " "; sb += " "; sc += " ";
  
  while (cnta!=sa.size() && cntb!=sb.size() && cntc!=sc.size()){
    if (turn == 'a')     {cnta++; turn = sa.at(cnta-1);}
    else if (turn == 'b'){cntb++; turn = sb.at(cntb-1);}
    else if (turn == 'c'){cntc++; turn = sc.at(cntc-1);}
  }
  
  if (cnta == sa.size()) cout <<"A";
  else if (cntb == sb.size()) cout <<"B";
  else if (cntc == sc.size()) cout <<"C";
  cout <<endl;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		String[] moji = new String[N];
		List<String> list = new ArrayList<String>();
		//HashMap<String,String> map = new HashMap<String,String>();
		for(int i = 0; i <= N; i++) {
			list.add(sc.nextLine());
		}
		Map<String, Long> map2 =
		          list.stream().collect(
		                    Collectors.groupingBy(x -> x, Collectors.counting())
		            );
		//文字が入っている
		         List<String> Moji = new ArrayList(map2.keySet());
		         List<Long> count = new ArrayList(map2.values());
		         List<String> anser = new ArrayList<String>();
		         long max = Collections.max(count);

		         for(int i = 0; i< count.size(); i++) {
		        	 if(max == count.get(i)) {
		        		 anser.add(Moji.get(i));
		        	 }
		         }
		         Collections.sort(anser);
		         for(String val : anser) {
		        	 System.out.println(val);
		         }
		         //System.out.println(anser);
		 //list.stream().collect(Collectors.groupingBy(x -> x, Collectors.counting()));
	}
}


Measured memory_bytes: 170128
#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define rep(i,s,e) for (int64_t i=s; i<e; i++)
#define pi 3.14159265358979323846264338327950L
using namespace std;

int main() {
  int N;
  cin >> N;
  cout << fixed << setprecision(18);
  vector<long double> x(N);
  vector<long double> y(N);
  rep(i,0,N) {
    cin >> x[i] >> y[i];
  }
  long double S=0, ans;
  rep(i,0,N) {
    rep(j,0,N) {
      S+=sqrt(pow((x[i]-x[j]),2)+pow((y[i]-y[j]),2));
    }
  }
  ans=S/N;
  cout << ans << endl;
}

Measured memory_bytes: 3824
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

c = [0]
d = [0]
for i in range(n):
    c.append(c[i] + a[i])
for i in range(m):
    d.append(d[i] + b[i])

ans = 0
j = m
for i in range(n + 1):
    if c[i] > k:
        break
    while c[i] + d[j] > k:
        j -= 1
    ans = max(ans, i + j)

print(ans)


Measured memory_bytes: 47488
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
#include <cctype>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <utility>
#include <fstream>

using namespace std;
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { a = abs(a), b = abs(b); while (b > 0) { tie(a, b) = make_pair(b, a % b); } return a; }
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
//constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353;
constexpr int MAX = 5000000;

vector<ll> enumdiv(ll x) {
	vector<ll> res;
	for (ll i = 1; i * i <= x; i++) {
		if (x % i == 0) {
			res.emplace_back(i);
			if (i != x / i) res.emplace_back(x / i);
		}
	}
	sort(res.begin(), res.end());
	return res;
}

int main()
{

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

	ll n; cin >> n;
	vector<ll> v;

	{
		auto d = enumdiv(n);
		for (auto e : d) {
			if (e == 1) continue;
			ll t = n;
			while (t % e == 0) {
				t /= e;
			}
			t %= e;
			if (t == 1) {
				v.emplace_back(e);
			}
		}
	}
	{
		auto d = enumdiv(n - 1);
		for (auto e : d) {
			if (e == 1) continue;
			ll t = n;
			while (t % e == 0) {
				t /= e;
			}
			t %= e;
			if (t == 1) {
				v.emplace_back(e);
			}
		}
	}
	sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end());
	cout << v.size() << "\n";
	return 0;
}


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

#define LL long long

#define FOR(INDEX, START, END) for (LL INDEX = (START); INDEX < (END); ++INDEX)
#define REP(INDEX, COUNT) for (LL INDEX = 0; INDEX < (COUNT); ++INDEX)

int main()
{
	LL N, X;
	cin >> N >> X;

	LL p = 0;
	LL cnt = 1;
	REP(i, N) {
		LL L;
		cin >> L;

		p += L;

		if (p <= X) {
			++cnt;
		}
		else {
			break;
		}
	}

	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 256
import sys
import math
import itertools
import collections
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    A,B = NMI()
    
    xA , xB = 0,0
    
    if A == 0 or A == 1:
        xA = 0
    else:
        if A % 4 == 1:
            xA = A - 1
        elif A % 4 == 2:
            xA = 1
        elif A % 4 == 3:
            xA = A
        else:
            xA = 0
    
    if B == 0:
        xB = 0
    else:
        if B % 4 == 1:
            xB = 1
        elif B % 4 == 2:
            xB = B + 1
        elif B % 4 == 3:
            xB = 0
        else:
            xB = B
           
    A_bin = format(xA, '040b')
    B_bin = format(xB, '040b')
    
    ans = ['0' for _ in range(40)]
    
    for i in range(39,-1,-1):
        if int(A_bin[i])+int(B_bin[i])==1:
            ans[i] = '1'
    
    print(int("".join(ans),2))
        
    ###################ここに処理を書く################

if __name__ == '__main__':
    main()

Measured memory_bytes: 9456
n = int(input())
# print(n)

s = str(n)
# print(s[-1])
# print(int(s[-1]))

if int(s[-1]) == 2 or int(s[-1]) == 4 or int(s[-1]) == 5 or int(s[-1]) == 7 or int(s[-1]) == 9:
  print("hon")
elif int(s[-1]) == 3:
  print("bon")
else:
  print("pon")

Measured memory_bytes: 9136
#include<cstdio>
#include<algorithm>

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

using namespace std;

const int INF=1<<29;

struct point{ int x,y; };

int m,n;
point p[100],q[100];

double f(double x){
	double yl=INF,yr=-INF;
	rep(i,m){
		point a=p[i],b=p[(i+1)%m];
		if(a.x>b.x) swap(a,b);
		if(a.x<=x && x<=b.x && a.x!=b.x){
			double y=a.y+(x-a.x)/(b.x-a.x)*(b.y-a.y);
			yl=min(yl,y);
			yr=max(yr,y);
		}
	}

	double zl=INF,zr=-INF;
	rep(i,n){
		point a=q[i],b=q[(i+1)%n];
		if(a.x>b.x) swap(a,b);
		if(a.x<=x && x<=b.x && a.x!=b.x){
			double z=a.y+(x-a.x)/(b.x-a.x)*(b.y-a.y);
			zl=min(zl,z);
			zr=max(zr,z);
		}
	}

	return max(yr-yl,0.0)*max(zr-zl,0.0);
}

int main(){
	for(;scanf("%d%d",&m,&n),m;){
		rep(i,m) scanf("%d%d",&p[i].x,&p[i].y);
		rep(i,n) scanf("%d%d",&q[i].x,&q[i].y);

		int p_min=INF,p_max=-INF;
		int q_min=INF,q_max=-INF;
		rep(i,m) p_min=min(p_min,p[i].x), p_max=max(p_max,p[i].x);
		rep(i,n) q_min=min(q_min,q[i].x), q_max=max(q_max,q[i].x);

		int X[200];
		rep(i,m) X[ i ]=p[i].x;
		rep(i,n) X[i+m]=q[i].x;
		sort(X,X+m+n);

		double ans=0;
		rep(i,m+n-1){
			double a=X[i],b=X[i+1];
			if(max(p_min,q_min)<=a && b<=min(p_max,q_max)){ // 境界だけは線形じゃない ( がたっと落ちる )
				ans+=(b-a)/6*(f(a)+4*f((a+b)/2)+f(b));
			}
		}
		printf("%.9f\n",ans);
	}

	return 0;
}

Measured memory_bytes: 1080
n,m = map(int,input().split())
num = [1 for c in range(n)]
red = [False for d in range(n)]
red[0] = True
counter = 0
for i in range(m):
    x,y = map(int,input().split())
    if red[x-1]:
        red[y-1] = True
    num[x-1] = num[x-1] - 1
    num[y-1] = num[y-1] + 1
    if num[x-1] == 0:
        red[x-1] = False
for j in range(n):
    if (red[j] == True)&(num[j]>0):
        counter += 1
print(counter)

Measured memory_bytes: 4784
//ALL GLORY TO JESUS CHRIST 
#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<vector<int>> vvi;

#define clr(a, b) memset(a, b, sizeof(a))
#define pb push_back
#define frpn(x) freopen(#x ".in","r",stdin);freopen(#x ".out","w",stdout);
#define all(a) a.begin(), a.end()
#define mkp make_pair
#define forn(i, n) for(int i=0; i<(int)(n); ++i)
#define forab(i, a, b) for(int i=(int)(a); i<=(int)(b); ++i)
#define fornd(i, n) for(int i=(int)(n-1); i>=0; --i)
#define FOR(it,c) for ( __typeof((c).begin()) it=(c).begin(); it!=(c).end(); it++ )

const int MOD = (int)1e9+7;

template <class T>
inline void rem(T &n){
   n = (-MOD <= n && n <= MOD) ? n : n%MOD ;
  if(n < 0) n += MOD; 
}
//modular inverse
//inv(a,m) - inverse of a mod m
template <class T>
inline T inv(T a, T m){
 return 1<a ? m - inv(m%a, a)*m/a : 1;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifdef LOCAL
    clock_t tStart = clock();
#endif
    double a, b, x; cin >> a >> b >> x;
    const double pi = acos(-1); 
    double res = 0.0;
    if(0.5*a*a*b <= x) {
      double a_ = x/a;
        a_ /= a;
        a_ = b - a_;
        res = atan(2*a_/a);
    } else {
        double a_ = 2*x;
        a_ /= a;
        a_ /= b;
        res = atan(b/a_);
    }
    res = 180.0*res/pi;
    cout << setprecision(10) << res << "\n"; 
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * (clock() - tStart)/ CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
#include <stdlib.h>


//クイックソート用　昇順
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}
//qsort(配列の先頭ポインタ, データ数, 1データのサイズ, compare_int);

int main()
{
    int k = 0;
    int a,b = 0;
    int x = 0;
    
    scanf("%d",&k);
    scanf("%d %d",&a,&b);
    x = b/k;
    x = x * k;
  
   if(x >= a)
   {
     
    printf("OK");
   }
  else
  {
         
    printf("NG");
   }
    return 0;
}

Measured memory_bytes: 1684
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int k,a,b;
  cin>>k>>a>>b;
  int t=k;
  while(k<a){
    k+=t;
  }
  if(a<=k&&k<=b){
    cout<<"OK";
  }
  else{
    cout<<"NG";
  }
  
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#define int long long 
using namespace std;

signed main(){
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    priority_queue<int> q;
    int sum = 0;
    int max = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        sum += a[i];
        q.push(a[i]);
    }
    //
    //sort(a.begin(), a.end(), greater<int>());
    int k = m;
    
    for (int i = 0; 0 < m; i++)
    {
            max =q.top();
            q.pop();
            max /= 2;
            q.push(max);
            m--;
    }

    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        ans += q.top();
        q.pop();
        // cout << a[i] << endl;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {

    int a, b, c, d; cin >> a >> b >> c >> d;

    int cnt = 0;
    for (int i = a; i <= b; i++) {
        if (c <= i && i <= d) {
            cnt++;
        }
    }

    cout << max(0, cnt - 1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline bool Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+" ";
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e17;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 200005;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s,t;
    cin >> s >> t;
    int m = s.length(),n = t.length();
    vector<char> a(m),b(n);
    rep(i,m) a[i] = s[i];
    rep(i,n) b[i] = t[i];
    SORT(a);
    RSORT(b);
    bool same = 1,ok = 0;
    rep(i,min(m,n)){
        if (a[i] < b[i]) ok = 1;
        if (a[i] != b[i]) same = 0;
    }
    Yes(ok or (same and m < n));
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int M = 1000000007;

int main() {
    int n, m, r;
    cin >> n >> m >> r;
    vector<int> vr(r);
    vector<int> ind(r);
    for (int i = 0; i < r; ++i) {
        cin >> vr[i];
        --vr[i];
        ind[i] = i;
    }
    vector<vector<int>> d(n, vector<int>(n, M));
    for (int i = 0; i < n; ++i) {
        d[i][i] = 0;
    }
    for (int i = 0; i < m; ++i) {
        int a, b, c;
        cin >> a >> b >> c;
        --a;
        --b;
        d[a][b] = d[b][a] = c;
    }
    for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) for (int k = 0; k < n; ++k) d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
    int ans = M;
    do {
        int sum = 0;
        for (int i = 0; i < r - 1; ++i) {
            sum += d[vr[ind[i]]][vr[ind[i + 1]]];
        }
        ans = min(ans, sum);
    } while(next_permutation(ind.begin(), ind.end()));
    cout << ans << "\n";
    return 0;
}


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

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

    int x = -1;
    int y = -1;
    int z = -1;

    for(int i = 0; i <= N; i++){
        for(int j = 0; j <= N-i; j++){
            if(10000*i + 5000*j + 1000*(N-i-j) == Y){
                x = i;
                y = j;
                z = N-i-j;
                break;
            }
        }
    }

    cout << x << ' ' << y << ' ' << z << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;




int main(){

	int N,Y;

	scanf("%d %d",&N,&Y);

	int c;

	for(int a = 0; a <= N; a++){
		for(int b = 0; b+a <= N;b++){
			c = N-(a+b);

			if(10000*a+5000*b+1000*c == Y){

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

	printf("-1 -1 -1\n");

	return 0;
}


Measured memory_bytes: 256
d = list(map(int, input().split(' ')))
s = input()
L = [0,1,2]
for i in s:
    if i == 'E':
        a = 5 - L[2]
        b = L[1]
        c = L[0]
        L = [a, b, c]
    elif i == 'W':
        a = L[2]
        b = L[1]
        c = 5 - L[0]
        L = [a, b, c]
    elif i == 'N':
        a = L[1]
        b = 5 - L[0]
        c = L[2]
        L = [a, b, c]
    elif i == 'S':
        a = 5 - L[1]
        b = L[0]
        c = L[2]
        L = [a, b, c]
print(d[L[0]])


Measured memory_bytes: 5600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)n; ++i)
#define all(obj) (obj).begin(), (obj).end()
static const int dx[4] = {0, 1, 0, -1};
static const int dy[4] = {1, 0, -1, 0};
static const char dir[4] = {'u', 'r', 'd', 'l'};
static const ll INF = 1 << 21;
static const ll MOD = 1e9 + 7;

signed main() {
  int H, W, N;
  cin >> H;
  cin >> W;
  cin >> N;
  int cnt = 0;
  while (N > 0) {
    N -= max(H, W);
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

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

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N;
  cin >> N;
  ll ans = 0;
  FOR(i, 1, N+1){
    ll tmp = 0;
    if(i%2==0)continue;
    FOR(j, 1, i+1){
      if(i%j==0){
        tmp++;
      }
    }
    if(tmp==8){
      ans++;
    }
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define ll long long
#define ull unsigned long long
#define ld long double
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rrep(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define pll pair<long long,long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vvc vector<vector<char>>
#define vc vector<char>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define maxe(x) *max_element(all(x))
#define mine(x) *min_element(all(x))
#define Size(x) ((int)(x).size())
#define umap unordered_map
const long long INF = 1LL << 60;
const long double pi = 3.1415926535897932;
long long MOD = 1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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

//lis,modpow,uf,modncr,soinsubunkai,yakusurekkyo,gyakugen
//mint

    signed main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        ll N;
        cin>>N;
        vl X(N);
        vl C(N);
        rep(i,N){
            cin>>X[i];
            C[i]=X[i];
        }
        sort(all(C));
        ll r=C[N/2];
        ll l=C[N/2-1];
        rep(i,N){
            if(X[i]<=l){
                cout<<r<<endl;
            }else{
                cout<<l<<endl;
            }
        }
    }

Measured memory_bytes: 5376
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
ll N;
int K;
int m[11][5];

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

	for(int i=0; i<3; i++){
		for(int j=0; j<3; j++){
			m[0][0] += 7*i+j+1;
		}
	}
	m[0][0] %= 11;
	for(int j=1; j<5; j++){
		m[0][j] = (m[0][j-1]+9)%11;
	}
	for(int i=1; i<11; i++){
		for(int j=0; j<5; j++){
			m[i][j] = (m[i-1][j]+8)%11;
		}
	}

	N = max(0LL, N-2);
	ll a = 0;
	for(int i=0; i<11; i++){
		for(int j=0; j<5; j++){
			if(m[i][j] == K) a++;
		}
	}

	ll b = 0;
	for(int i=0; i<N%11; i++){
		for(int j=0; j<5; j++){
			if(m[i][j] == K) b++;
		}
	}

	cout << a*(N/11)+b << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define int ll
#define Endl endl

int gcd(int a,int b){
    if(a<b)swap(a,b);
    if(a<=0)return 0;
    if(b<=0)return a;
    int r=a%b;
    while(r){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}


const int MAX_N=200010;
int n,dat[4*MAX_N-1];
int Seg_init(int n_){
    n=1;
    while(n<n_)n*=2;
    for(int i=0;i<2*n-1;++i)dat[i]=0;
    return n;
}
int Seg_calc(int a,int b){
    return gcd(a,b);
}
void Seg_update(int k,int a){
    k+=n-1;
    dat[k]=a;
    while(k>0){
        k=(k-1)/2;
        dat[k]=Seg_calc(dat[2*k+1],dat[2*k+2]);
    }
}
int Seg_query(int a,int b,int k,int l,int r){
    if(r<=a||b<=l)return 0;
    if(a<=l&&r<=b)return dat[k];
    int vl=Seg_query(a,b,2*k+1,l,(l+r)/2);
    int vr=Seg_query(a,b,2*k+2,(l+r)/2,r);
    return Seg_calc(vl,vr);
}


signed main(){
    int N;
    int A[214514];
    cin >> N;
    REP(i,N){cin >> A[i];}
    int M = Seg_init(N);
    REP(i,N){
        Seg_update(i,A[i]);
    }
    
    
    int Ans=0;
    for(int i=0;i<N;i++){
        int l=Seg_query(0,i,0,0,M);
        int r=Seg_query(i+1,N,0,0,M); 
        Ans=max(Ans,Seg_calc(l,r));
    }
    cout << Ans << endl;
    return 0;
}


Measured memory_bytes: 5120
let () =
  let rec prime n m = if n = m then true else if n mod m = 0 then false else prime n (m+1) in
  let rec check n m = if prime n 2 then n else if n = m then n else check (n+1) m  in
  let n = read_int () in
  Printf.printf "%d\n" (check n (n*2))

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define max 100005
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;

char s[4001];

bool isDiff(int i,int j,int k){
    if((s[i]!=s[j])&&(s[j]!=s[k])&&(s[k]!=s[i])){
        return true; 
    }else{
        return false;
    }
}

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

    ll r=0,g=0,b=0;
    rep(i,n){
        cin>>s[i];
        if(s[i]=='R'){
            r++;
        }else if(s[i]=='G'){
            g++;
        }else{
            b++;
        }
    }
    ll comb=r*g*b;

    rep(i,n-2){
        for(int j=i+1;j<n-1;j++){
            int  k=2*j-i;
            if(k<n&&isDiff(i,j,k)){
                comb--;
            }
        }
    }
    cout<<comb<<endl;
    return 0;
}


Measured memory_bytes: 3588
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            var A = input[0];
            var B = input[1];
            var C = input[2];

            Console.WriteLine(A + B >= C ? "Yes" : "No");
        }
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll N=1e5+5;
ll n,a,b,dist[2][N];
vector<ll> adj[N];
void dfs(ll u,ll pr,ll d,ll idx){
    dist[idx][u]=d;
    for(auto &v:adj[u])if(v!=pr)dfs(v,u,d+1,idx);
}
int main(){
    cin.tie(NULL); cout.tie(NULL);
    ios_base:: sync_with_stdio(false);
    cin>>n;
    for(ll i=0,u,v;i<n-1;i++)cin>>u>>v,adj[u].push_back(v),adj[v].push_back(u);
    dfs(1,1,0,0);dfs(n,n,0,1);
    for(ll i=1;i<=n;i++)if(dist[0][i]<=dist[1][i])a++;
    cout<<(a>n-a?"Fennec":"Snuke");
}

Measured memory_bytes: 13568
#include <bits/stdc++.h>
#define maxN 205

using namespace std;

bool BFS(int ways[maxN][maxN], int * parent, bool * visited, int n, int s, int t){

    queue<int> q;

    parent[s] = -1;
    q.push(s);

    while (!q.empty()) {
        
        int u = q.front();
        q.pop();
        
        for (int i = 0; i < n ; ++i) {
            if (!visited[i] && ways[u][i] > 0) {
                q.push(i);
                parent[i] = u;
                visited[i] = true;
            }
        }
    }

    return visited[t];
}

bool DFS(int rGraph[maxN][maxN], int * parent, bool * visited, int n, int x, int t){

	// cout << x << " ";
	if(x == t) return true;
	visited[x] = true;

	for(int i = 0; i < n; ++i){
		if(rGraph[x][i] > 0 && !visited[i]){
			parent[i] = x;
			if(DFS(rGraph, parent, visited, n, i, t))
				return true;
		}
	}
	return false;

}

int FordFulkerson(int graph[maxN][maxN], int n, int s, int t){

	int rGraph[maxN][maxN];
	int parent[maxN];
	bool visited[maxN];

	// Replicate the graph for residual one
	for(int i = 0; i < n; ++i)
		for(int j = 0; j < n; ++j)
			rGraph[i][j] = graph[i][j];

	int max_flow = 0;

	while(BFS(rGraph, parent, visited, n, s, t)){ 
	// while(DFS(rGraph, parent, visited, n, s, t)){
		memset(visited, false, sizeof(visited));
		int path_flow = 0xfffffff; // Current flow to add on the max flow later

		for(int v = t; v != s; v = parent[v]){
			int u = parent[v];
			path_flow = min(path_flow, rGraph[u][v]);
		}

		for(int v = t; v != s; v = parent[v]){
			int u = parent[v];
			rGraph[u][v] -= path_flow;
			rGraph[v][u] += path_flow;
		}

		max_flow += path_flow;
	}

	return max_flow;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int h,w; cin >> h >> w;
	int n=h+w+2;
	
	int g[maxN][maxN];
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			char c; cin >> c;
			
			if(c=='o'){
				g[i][j+h] = 1;
				g[j+h][i] = 1;
			}
			else if(c=='S'){
				g[h+w][i]=1000;
				g[i][h+w]=1000;
				
				g[h+w][j+h]=1000;
				g[j+h][h+w]=1000;
			}
			else if(c=='T'){
				g[h+w+1][i]=1000;
				g[i][h+w+1]=1000;
				
				g[h+w+1][j+h]=1000;
				g[j+h][h+w+1]=1000;				
			}
		}
	}
	
	int flow = FordFulkerson(g,n,h+w,h+w+1);
	
	if(flow>=1000){
		cout << -1 << endl;
	}
	else{
		cout << flow << endl;
	}
	return 0;
}

Measured memory_bytes: 640