akhauriyash/Code-Regression huggingface dataset:
//さすが解説は天才的ですねー
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const ll mod = 998244353;
ll modpow(ll A, ll B) {
	ll kotae = 1;
	while (B > 0) {
		if (B & 1) kotae = kotae * A % mod;
		A = A * A % mod;
		B >>= 1;
	}
	return kotae;
}

const int IMAX = 10000001;
ll fac[IMAX + 1], ifac[IMAX + 1];
inline ll comb(int A, int B) {
	return fac[A] * ifac[B] % mod * ifac[A - B] % mod;
}

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


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

	fac[0] = 1;
	rep1(i, IMAX) fac[i] = fac[i - 1] * i % mod;
	ifac[IMAX] = modpow(fac[IMAX], mod - 2);
	for (int i = IMAX; i > 0; i--) ifac[i - 1] = ifac[i] * i % mod;

	ll kotae = 1;
	rep(i, N) {
		kotae *= 3;
		if (!(i & 15)) kotae %= mod;
	}
	kotae %= mod;

	ll k = 1;
	rep(i, N / 2) {
		kotae -= 2 * fac[N] * ifac[i] % mod * ifac[N - i] % mod * k % mod;
		k = k * 2 % mod;
	}
	printf("%lld", (kotae % mod + mod) % mod);

	Would you please return 0;
}

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

const int mod = 1e9+7;

vector<long long> tree;
vector<int> lazy;
int n;
vector<long long> dp;
vector<int> beauty, height;

void update(int pos, int ind = 1, int l = 1, int r = n)
{
	if(l == r) {
		tree[ind] = dp[pos];
		return ;
	}
	int mid = (l+r)/2;
	if(pos <= mid) update(pos, 2*ind, l, mid);
	else update(pos, 2*ind+1, mid+1, r);
	tree[ind] = max(tree[2*ind], tree[2*ind+1]);
}

long long query(int ql, int qr, int ind = 1, int l = 1, int r = n)
{
	// printf("ql : %d qr : %d ind : %d l : %d r : %d\n", ql, qr, ind, l, r);
	if(ql > qr) return 0;
	if(l == r) return tree[ind];
	if(l == ql && r == qr) {
		return tree[ind];
	}
	int mid = (l+r)/2;
	return max(query(ql, min(qr, mid), 2*ind, l, mid), query(max(mid+1, ql), qr, 2*ind+1, mid+1, r));
}

int main() 
{
	scanf("%d", &n);
	beauty = vector<int>(n+1);
	height = vector<int>(n+1);
	dp = vector<long long>(n+1);
	tree = vector<long long>(100000000);
	for(int i = 0; i < n; i++) {
		scanf("%d", &height[i]);
	}
	for(int i = 0; i < n; i++) {
		scanf("%d", &beauty[i]);
	}
	long long ans = 0;
	for(int i = 0; i < n; i++) {
		long long max_ = query(0, height[i]);
		dp[height[i]] = max_ + beauty[i];
		update(height[i]);
		ans = max(ans, dp[height[i]]);
	}
	printf("%lld\n", ans);
 }

Measured memory_bytes: 787636
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.nextLine();
        StringBuilder sb = new StringBuilder();
 
        for (int i = 0; i < s1.length(); i++) {
            sb.append('x');
        }
        System.out.println(sb);
    }
}

Measured memory_bytes: 23124
using System;
using System.Collections.Generic;
using System.Linq;

class Progaram
{
    static void Main(string[] args)
    {
        var s = Console.ReadLine().ToCharArray();
        if (s[2] == s[3] && s[4] == s[5]) Console.WriteLine("Yes");
        else Console.WriteLine("No");
    }
}

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

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; }

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

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

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

	int kkt = 89;
	while (kkt) {
		int n; scanf("%d", &n); if (n == 0) break;
		vector<pair<long double, string>> vp(n);
		for (int i = 0; i < n; i++) {
			ll P;
			string L; cin >> L >> P;
			ll A, B, C, D, E, F, S, M; cin >> A >> B >> C >> D >> E >> F >> S >> M;
			ll t = A + B + C;
			ll money = F * S * M - P;
			ll st = t + (D+E) * M;
			vp[i] = make_pair(-(long double)money / st, L);

		}
		sort(vp.begin(), vp.end());
		for (int i = 0; i < n; i++) {
			cout << vp[i].second << "\n";
		}
		cout << "#" << "\n";
	}
	return 0;

}


Measured memory_bytes: 3228
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<cctype>
#include<string.h>
#include <stdlib.h>

#define PI 3.1415926
void swap(int* x, int* y) {
	int a = *x;
	int b = *y;
	*x = b;
	*y = a;
}
int factorial(int n);
int sum(int n, int*);
int ave(int n, int*);
int min(int n, int*), min(int n, int m);
int max(int n, int*), max(int n, int m);

int main() {
	int N, x[400][10];
	scanf("%d", &N);
	int flag = 0;
	int poi = 0;
	for (int i = 1; i <= N; i++) {
		scanf("%d %d %d", &x[i][1], &x[i][2], &x[i][3]);
	}
	//for (int i = 1; i <= N; i++) {
		//printf("%d %d %d\n", x[i][1], x[i][2], x[i][3]);
	//}
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= 3; j++) {
			for (int k = 1; k <= N; k++) {
				if (x[i][j] == x[k][j]) {
					flag++;
				}
				if (flag == 2)break;
			}
			if (flag == 1) {
				poi += x[i][j];
			}
			flag = 0;
		}
		printf("%d\n", poi);
		poi = 0;
	}
	return 0;
}

int factorial(int n) {
	if (n > 0) {
		return n * factorial(n - 1);
	}
	else {
		return 1;
	}
}
int sum(int n, int *all) {
	int total = 0;
	for (int i = 0; i < n; ++i) {
		total += all[i];
	}
	return total;
}
int ave(int n, int *all) {
	int total = 0;
	for (int i = 0; i<n; ++i) {
		total += all[i];
	}
	return total / n;
}
int min(int n, int *all) {

	int min = all[0];
	for (int i = 1; i < n; ++i) {
		if (all[0] > all[i]) {
			min = all[i];
		}
	}
	return min;
}
int max(int n, int *all) {
	int max = all[0];
	for (int i = 1; i<n; ++i) {
		if (all[0]<all[i]) {
			max = all[i];
		}
	}
	return max;
}
int max(int n, int m) {
	if (n >= m) {
		return n;
	}
	else {
		return m;
	}
}
int min(int n, int m) {
	if (n >= m) {
		return m;
	}
	else {
		return n;
	}
}

Measured memory_bytes: 2732
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
int main() {
	int a = 0;
	for (int i = 0; i < 4; ++i) {
		int n;
		std::cin >> n;
		a += n;
	}
	std::cout << a / 60 << std::endl;
	std::cout << a % 60 << std::endl;
}

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

ll quickmodpow(ll a,ll b,ll mod){
	ll ans=1%mod;
	while(b){
		if(b&1) ans=(ans*a)%mod;
		a=(a*a)%mod;
		b=b>>1;
	}
	return ans;
	}

int main(){
  ll N,K;
  ll mod = 1e9+7;
  cin >> N >> K;
  map<ll,ll> cnt_gcd{};
  cnt_gcd = {};
  ll ans = 0;
  cnt_gcd[K] = 1;
  for(ll i=K-1;i>=1;--i){
    cnt_gcd[i] = quickmodpow(ll(K/i),N,mod);
    for(ll j=2*i;j<=K;j=j+i){
      if(cnt_gcd[j]>=1) cnt_gcd[i] = (cnt_gcd[i] - cnt_gcd[j] + mod)%mod;
    }
  }
  for(ll i=1;i<=K;++i){
    ans = (ans + (cnt_gcd[i] * i)) % mod;
  }
  cout << ans << endl;
}

Measured memory_bytes: 9696
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()

	i := 0
	for sc.Scan() {
		v, _ := strconv.Atoi(sc.Text())
		if v%2 == 0 && v != 2 {
			continue
		}

		if judgePrime(v) {
			i++
		}
	}
	fmt.Println(i)
}

func judgePrime(v int) bool {
	root := math.Sqrt(float64(v))
	for j := 3; float64(j) <= root; j = j + 2 {
		if v%j == 0 {
			return false
		}
	}
	return true
}



Measured memory_bytes: 1168
#include<stdio.h>

int main(void)
{
int W,H,x,y,r;
	scanf( "%d %d %d %d %d",&W,&H,&x,&y,&r);
	
	if( W>=x+r && H>=y+r && x>=0 && y>=0 )
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	
	return 0;
}


Measured memory_bytes: 2104
import scala.io.StdIn.readLine

object Main {
  val gesIndex = Map("Rock"->0,"Fire"-> 1, "Scissors" -> 2, "Snake" -> 3,
                    "Human"->4, "Tree"->5, "Wolf"->6, "Sponge"->7,
                    "Paper"->8, "Air"->9, "Water"->10, "Dragon"->11,
                    "Devil"->12, "Lightning"->13, "Gun" -> 14)

  def scan(list:Array[Int],i:Int,n:Int):String = {
    if(i==n) "Draw"
    else {
      val win = (list((i+1)%n)-list(i)+15)%15
      val lose = (list(i)-list((i+n-1)%n)+15)%15
      if(win<=7 && lose>7) gesIndex.find(_._2==list(i)).map(_._1).get
      else scan(list,i+1,n)
    }
  }

  def main(args:Array[String]) = {
    var n = 0
    while({n=readLine.trim.toInt;n}!=0) {
      val list = {for(i<-1 to n) yield gesIndex(readLine.trim)}.toArray.sorted
      println(scan(list,0,list.length))
    }
  }
}

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

#define MAX_N 100000
#define MAX_A 100000

using namespace std;

int main(void)
{
    int N;
    int *b = (new int[MAX_A + 2]()) + 1;
    cin >> N;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        for (int j = -1; j <= 1; j++) {
            b[a + j]++;
        }
    }
    cout << *max_element(b, b + MAX_A + 2) << endl;
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using ll = long long;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define ALL(x) x.begin(),x.end()

#define INF (ll)1e9 //10^9:∞
#define LLINF (ll)1e12
#define MOD (ll)(1e9+7) //10^9+7:合同式の法
#define PI 3.141592653589
#define PB push_back
#define F first
#define S second
#define __MAGIC__ ios::sync_with_stdio(false);cin.tie(nullptr);

#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

#define Graph vector<vector<int>>
#define PII pair<int,int>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VPII vector<pair<int,int>>

#define DDD fixed<<setprecision(10)
#define endl "\n"

using namespace std;
/*..................DEFINE GLOBAL VARIABLES...................*/


/*.....................DEFINE FUNCTIONS ......................*/



/*.........................kemkemG0...........................*/
signed main() {
	__MAGIC__


	ll N, W;
	cin >> N >> W;
	VI w(110), v(110);

	FOR(i, 1, N)cin >> w[i] >> v[i];

	//dp[i][j]:=i番目までを使って重さがj以下の時の最大値

	vector<vector<ll>> dp(110, vector<ll>(110000, 0));

	FOR(i, 1, N)FOR(j, 0, W) {
		if (j - w[i] >= 0)	dp[i][j] = max(dp[i-1][j], dp[i-1][j - w[i]] + v[i]);
		else	dp[i][j] = dp[i-1][j];
	}

	cout << dp[N][W] << endl;;



	return 0;
}


Measured memory_bytes: 98716
/* author ::  ubc_123 */
#include<bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
// using namespace boost::multiprecision; //cpp_int a;

#define find_bug(x) cout <<'>' << #x << " : " << x << endl;
#define ff first
#define ss second
#define pf push_front
#define pb push_back
#define popf pop_front
#define popb pop_back
#define mp make_pair
#define pu push
#define in insert
typedef long long int ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll MOD = 1e9+7;
const ll SMOD = 998244353;
const ll N_MAX = 100100;
const ll INF = 1e18;
const ld PI = ld(3.1415926535897932384626433832795);
#define fr(i,n) for(ll i=0;i<(n);++i)
#define rfr(i,n) for(ll i=(n-1);i>=0;i--)
#define frs(i,s,n) for(ll i=s;i<(n);++i)
#define frb(i,s,e) for(ll i=s;i<=(e);++i)
#define frbr(i,e,s) for(ll i=e;i>=(s);i--)
#define mset(m,v) memset(m,v,sizeof(m))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
//-------------------------------------------------------------------------------
void solve()
{
  ll n;
  cin>>n;
  string s;
  cin>>s;
  if(n%2 == 1)
  {
    cout<<"No"<<endl;
    return;
  }
  else
  {
    ll t = (n/2);
    ll i = 0;
    ll j = t;
    while(t--)
    {
      if(s[i] == s[j])
        {
          i++;
          j++;
        }
      else
      {
            cout<<"No"<<endl;
             return;
      }
    }
    cout<<"Yes"<<endl;
    return;
  }
}

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

    ll test = 1;
    // cin>>test;
    fr(i,test)
    {
      // cout << "Case #" << i + 1 << ": ";
      // cout << '>' << "Case #" << i+1 << endl;
      solve();
    }
    return 0;
}           



Measured memory_bytes: 256
using System;
class Program
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        long a = long.Parse(input[0]);
        long v = long.Parse(input[1]);

        input = Console.ReadLine().Split(' ');
        long b = long.Parse(input[0]);
        long w = long.Parse(input[1]);

        long t = long.Parse(Console.ReadLine());

        if (v <= w)
        {
            Console.WriteLine("NO");
            return;
        }

        if (Math.Abs(a - b) <= (v - w) * t)
        {
            Console.WriteLine("YES");
            return;
        }
        else
        {
            Console.WriteLine("NO");
            return;
        }
    }
}

Measured memory_bytes: 27436
#include <iostream>
#include <vector>
#include <map>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IN(v) int v;cin>>v;
#define OUT(v) cout<<v<<endl

int main() {
  IN(N);

  map<int, int> odd;
  map<int, int> even;
  int max_odd = 0, max_even = 0;
  REP(i, N) {
    IN(v);
    if (i % 2 == 0) {
      if (even.find(v) == even.end())
        even[v] = 0;
      ++even[v];
      max_even = v;
    } else {
      if (odd.find(v) == odd.end())
        odd[v] = 0;
      ++odd[v];
      max_odd = v;
    }
  }
  int second_odd = -1, second_even = -1;
  for (const auto& e : odd) {
    if (odd[max_odd] <= e.second && max_odd != e.first) {
      second_odd = max_odd;
      max_odd = e.first;
    }
  }
  for (const auto& e : even) {
    if (even[max_even] <= e.second && max_even != e.first) {
      second_even = max_even;
      max_even = e.first;
    }
  }
  if (max_odd == max_even) {
    if (second_odd == -1 && second_even == -1)
      OUT(N - max(odd[max_odd], even[max_even]));
    else if (second_odd == -1)
      OUT(N - odd[max_odd] - even[second_even]);
    else if (second_even == -1)
      OUT(N - odd[second_odd] - even[max_even]);
    else
      OUT(min(N - odd[second_odd] - even[max_even], N - odd[max_odd]- even[second_even]));
  } else
    OUT(N - odd[max_odd] - even[max_even]);

  return 0;
}


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

string s;

int cou;

int main()
{
	cin >> s;

	int s_c = 0;

	for(int i = 0;i < s.size();i++)
	{
		if(s[i] == 'S')
		{
			s_c++;
		}
		else
		{
			if(s_c > 0)
			{
				cou += 2;
				s_c--;
			}
		}
	}

	cout << s.size() - cou << endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define sol (k+k)
#define sag (k+k+1)
#define orta ((bas+son)/2)
#define coc g[node][i]
#define mod 1000000007
#define inf 1000000009
#define N 1000005
using namespace std;

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

ll n;

ll bul(ll n, ll kac){
	if(n == 1)
		return kac;
	return kac + bul(n/2, 2*kac);

}

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	scanf("%lld",&n);
	printf("%lld\n", bul(n, 1));
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int main(){
	scanf("%d",&n);
	if((n&-n)==n)	puts("No");
	else{
		puts("Yes");
		for(int i=3;i<=n;i+=2){
			printf("%d %d\n",1,i-1);
			printf("%d %d\n",1,i+n);
			printf("%d %d\n",i-1,i);
			printf("%d %d\n",i+n,i+n-1);
		}
		printf("%d %d\n",n+1,3);
		if(n%2==0){
			int k=n&-n;
			printf("%d %d\n",n,k);
			printf("%d %d\n",n+n,(n-k+1)+n);
		}
	}
	return 0;
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int n,m,a,b,c,d;
    cin>>n>>m;
    std::deque<long long int> X;
    std::deque<long long int> Y;
    for (int i=0;i<n;i++) {
        cin>>a;
        X.emplace_back(a);
        cin>>b;
        Y.emplace_back(b);
    }
    std::deque<long long int> x;
    std::deque<long long int> y;
    for (int j=0;j<m;j++) {
        cin>>c;
        x.emplace_back(c);
        cin>>d;
        y.emplace_back(d);
    }
    for (int k=0;k<n;k++) {
        long long int min=600000001;
        int ans;
        for (int l=0;l<m;l++) {
            long long int tmp=abs(X[k]-x[l])+abs(Y[k]-y[l]);
            if (tmp<min) {
                min=tmp;
                ans=l+1;
            }
        }
        cout<<ans<<endl;
    }
}

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


int main(){

    int X;
    cin >> X;


    int ans;
    for( int i = 1; i*i <= X; i++ ){
        int exp = i;
        while( exp <= X && exp != 1 ) exp *= i;;
        if( ans*i < exp ) ans = exp/i; 
    }

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen(".in.txt", "r", stdin);
	freopen(".out.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll x, k, d; cin >> x >> k >> d;
	x = abs(x);
	ll y = min(x/d, k);
	x -= y * d;
	k -= y;
	cout << (k & 1 ? abs(x - d) : x);

	return 0;
}

Measured memory_bytes: 3648
t = input().rstrip().split(' ')
switch = int(t[0])
lamp = int(t[1])
s = [list(map(int, input().split())) for _ in range(lamp)]
p = list(map(int, input().split()))
ans = 0

for i in range(2 ** switch):
    ptn = bin(i)[2:].rjust(switch, '0')
    light = True
    for j in range(lamp):
        temp = 0
        for n in range(1, s[j][0] + 1):
            if ptn[s[j][n] - 1] == '1':
                temp += 1
        if temp % 2 != p[j] % 2:
            light = False
    if light:
        ans += 1

print(ans)

Measured memory_bytes: 3064
# -*- coding:utf-8 -*-

def determine_color(rate):
    if rate >= 1 and rate <= 399:
        return 0
    elif rate >= 400 and rate <= 799:
        return 1
    elif rate >= 800 and rate <= 1199:
        return 2
    elif rate >= 1200 and rate <= 1599:
        return 3
    elif rate >= 1600 and rate <= 1999:
        return 4
    elif rate >= 2000 and rate <= 2399:
        return 5
    elif rate >= 2400 and rate <= 2799:
        return 6
    elif rate >= 2800 and rate <= 3199:
        return 7
    else:
        return 8


def solve():
    N = int(input())
    A = list(map(int, input().split()))

    """方針
    色が8のとき、何色にもなれる。

    先に0~7の色を埋める(Trueにして)。これが最小の数。
    
    その後、最小の数に、色が8の数を足す。それが最大の数。

    問題文に書かれている色以外にもなれることに注意。黒色とか。
    """
    min_colors = [False] * 8
    color8_cnt = 0
    for i, a in enumerate(A):
        color = determine_color(a)
        if color == 8:
            color8_cnt += 1
            continue
        min_colors[color] = True
    
    min_ans = 0
    for i, c in enumerate(min_colors):
        if c:
            min_ans += 1
    
    max_ans = min_ans
    max_ans += color8_cnt

    if min_ans == 0 and color8_cnt != 0:
        min_ans = 1

    print("{} {}".format(min_ans, max_ans))



if __name__ == "__main__":
    solve()


Measured memory_bytes: 3064
import java.util.HashSet;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        HashSet<Long> hs = new HashSet<>();
        long a = 0;
        boolean containFlag = false;
        for(int i = 0; i < n; i++){
            a = sc.nextLong();
            if(hs.contains(a)){
                containFlag = true;
            }
            hs.add(a);
        }
        if (!containFlag){
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}

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

int main(){
    int n,k;
    cin>>n>>k;
    int dp[n];
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    dp[0]=0; dp[1]=abs(a[0]-a[1]);
    
    for(int i=2;i<n;i++)
    {  dp[i]=INT_MAX;
       for(int j=i-1;j>=i-min(i,k);j--) 
       { dp[i]=min(dp[j]+abs(a[i]-a[j]) , dp[i] ); } 
    }
    cout<<dp[n-1]<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
int N;
ll A[100005];

int main() {
  INCANT;
  cin >> N;
  rep(i, N) cin >> A[i];
  rep(i, N) {
    if (A[i]==0) {
      cout << 0 << "\n";
      return 0;
    } 
  }
  ll b18 = 1e18;
  ll a = 1ll;
  int idx=0;
  while(idx<N && b18/a>=A[idx]) {
    a*=A[idx];
    idx++;
  }
  if (idx==N) {
    cout << a << endl;
  } else cout << -1 << "\n";
  return 0;
}

Measured memory_bytes: 4420
program main
  implicit none
  integer :: n, k, j, l=2, res=1
  integer :: i(1000000)
  character(100000) :: s

  read *, n, k
  read *, s
  i(:) = n + 1
  i(1) = 1

  do j = 2, n
    if (s(j:j) /= s(j-1:j-1)) then
      i(l) = j
      l = l + 1
    end if
  end do

  do j = 1, n-1
    if (i(j) > n) exit
    if (s(i(j):i(j)) == '0') res = max(res, i(j+2*k)-i(j))
    if (s(i(j):i(j)) == '1') res = max(res, i(j+2*k+1)-i(j))
  end do

  print '(i0)', res

end program

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

int main(void){
    int ec=0,wc=0,nc=0,sc=0;
    int flagew=0,flagns=0;
    char s[1000];
    scanf("%s",s);
    for(int i=0;i<=strlen(s);i++){
        if(s[i] == 'E')ec++;
        else if(s[i] == 'W')wc++;
        else if(s[i] == 'N')nc++;
        else if(s[i] == 'S')sc++;
    }
    if(ec == wc){
        flagew = 1;
    }else if(ec != 0 && wc != 0){
        flagew = 1;
    }
    if(nc == sc){
        flagns = 1;
    }else if(nc != 0 && sc != 0){
        flagns = 1;
    }
    if(flagns && flagew){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 128
import sys
from itertools import accumulate, combinations

read = sys.stdin.read

N, K, *a = map(int, read().split())

a = accumulate([0] + a)
seq = []
for i, j in combinations(a, 2):
    seq.append(j - i)

m = (10 ** 9 * 1000).bit_length()
answer = 0
bit = 1 << (m - 1)
for _ in range(m):
    tmp = [i for i in seq if i & bit == bit]
    if len(tmp) >= K:
        answer += bit
        seq = tmp
    bit >>= 1

print(answer)


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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset

typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;

#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'

char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 122)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 122)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 122)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
bool isect (int l1, int r1, int l2, int r2){
    pii p1,p2;
    p1 = mp(l1,r1); p2 = mp(l2,r2);
    if(p1>p2)swap(p1,p2);
    if(p2.fi <= p1.se)return true;
    else return false;
}
ll fexp (ll num1, ll num2, ll MOD){
    if(num2==0)return 1;
    else if(num2==1)return num1;
    else{
        ll temp = fexp (num1,num2/2,MOD); ll res = ((temp%MOD) * (temp%MOD))%MOD;
        if(num2%2==1) res = ((res%MOD)*(num1%MOD))%MOD; return res;
    }
}
ll invmod (ll num, ll MOD){return fexp (num,MOD-2,MOD);}
ll gcd (ll num1, ll num2){
    if(num1 < num2) swap(num1,num2); ll num3 = num1 % num2 ;
    while(num3 > 0){ num1 = num2; num2 = num3; num3 = num1 % num2;}
    return num2;
}
ll lcm (ll num1 , ll num2){return (ll) (num1/gcd(num1,num2))*num2;}
// end of Template

int n,m;
ll res;
priority_queue <int> q;
int main(){

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n>>m;
    for(int i=1;i<=n;i++){
        int temp; cin>>temp;
        q.push(temp);
    }
    for(int i=1;i<=m;i++){
        int temp = q.top(); q.pop();
        temp/=2; q.push(temp);
    }
    while(!q.empty()){
        res += q.top();
        q.pop();
    }
    cout<<res<<newl;
}


Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    ll n; cin >> n;
    ll ans = 0;
    for(ll i = 1; i < n; i++) {
        for(ll j = 1; (i * j) < n; j++) {
            ans++;
        }
    }

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


Measured memory_bytes: 3644
using System;
using System.Collections.Generic;
using System.Linq;

namespace Contest
{
    class Program
    {
        static void Main()
        {
            int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            
            int personCount = input[0];
            int point = input[1];
            int quizCount = input[2];
            int[] person = new int[personCount];
            
            for(int i = 0; i < quizCount; i++)
            {
                int a = int.Parse(Console.ReadLine());
                person[a - 1]++;
            }

            foreach(var p in person)
            {
                if(p + point - quizCount <= 0)
                {
                    Console.WriteLine("No");
                }
                else
                {
                    Console.WriteLine("Yes");
                }
            }
        }

    }
}


Measured memory_bytes: 17884
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<queue>
using namespace std;
const int N = 100010;
const int M = 200010;
int dir[N];
struct edge{
	int v;
	int next;
}e[2*M];
int p[N],eid;
void init(){
	memset(p,-1,sizeof(p));
	eid=0;
}
void insert(int u,int v){
	e[eid].v=v;
	e[eid].next=p[u];
	p[u]=eid++;
}
queue<int> q;
void bfs(int s){
	memset(dir,0,sizeof(dir));
	q.push(s);
	while(!q.empty()){
		int u=q.front();
		q.pop();
		for(int i=p[u];i!=-1;i=e[i].next){
			int v=e[i].v;
			if(!dir[v] && v!=s){
				dir[v]=u;
				q.push(v);
			}
		}
	}
}
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	ios::sync_with_stdio(false);
	init();
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		int a,b;
		cin>>a>>b;
		insert(a,b);
		insert(b,a);
	}
	bfs(1);
	for(int i=2;i<=n;i++){
		if(!dir[i]){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	for(int i=2;i<=n;i++){
		cout<<dir[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 7544
def main():
    a, b = input().split(' ')
    if a == 'H' and b == 'H':
        print('H')
    elif a == 'D' and b == 'H':
        print('D')
    elif a == 'H' and b == 'D':
        print('D')
    elif a == 'D' and b == 'D':
        print('H')
main()

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

int main(){
	int n,k;
	cin>>n>>k;
	int h[n]={};
	rep(i,n) cin>>h[i];
	sort(h,h+n);
	if(k>=n){
		cout<<"0"<<endl;
		return 0;
	}
	k=n-k;
	ll ans={};
	rep(i,k) ans+=h[i];
	cout<<ans<<endl;
}

Measured memory_bytes: 4340
class Atcoder
  MAX_N = 9

  def initialize
    _n, m, _r = gets.chomp.split.map(&:to_i)
    r = [0] + gets.chomp.split.map(&:to_i)
    @rsize = r.size
    @dp = Array.new(1 << MAX_N) { Array.new(MAX_N, -1) }

    d = Hash.new { |h, k| h[k] = {} }
    dist = Hash.new { |h, k| h[k] = {} }
    @table = Array.new(@rsize) { Array.new(@rsize, 0) }

    m.times do
      a, b, c = gets.chomp.split.map(&:to_i)
      d[a][b] = c
      d[b][a] = c
    end

    r[1..-1].each do |s|
      queue = []
      queue << [s, 0]
      check_list = Hash.new { |h, k| h[k] = Hash.new(Float::INFINITY) }

      until queue.empty?
        node = queue.shift
        next if check_list[s][node.first] <= node.last
        check_list[s][node.first] = node.last

        dist[s][node.first] = node.last
        dist[node.first][s] = node.last

        d[node.first].each_key do |n|
          queue << [n, node.last + d[node.first][n]]
        end
      end
    end

    r.each_with_index do |a, i|
      r.each_with_index do |b, j|
        next if i == j
        if i == 0 || j == 0
          @table[i][j] = 0
        else
          @table[i][j] = dist[a][b]
        end
      end
    end

=begin
    puts r.permutation.map { |list|
      cost = 0

      list.each_cons(2) do |a, b|
        cost += dist[a][b]
      end

      cost
    }.min
=end

    puts rec(0, 0)
  end

  def rec(s, v)
    if @dp[s][v] >= 0
      return @dp[s][v]
    end

    if s == (1 << @rsize) - 1 && v == 0
      return @dp[s][v] = 0
    end

    res = Float::INFINITY

    @rsize.times do |u|
      if (s >> u & 1) == 0
        val = rec(s | 1 << u, u)

        res = [res, val + @table[v][u]].min
      end
    end

    @dp[s][v] = res
  end
end

Atcoder.new


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> a(N);
  REP(i, N) cin >> a[i];
  vector<int> b(100010, 0);
  for(int i = 0; i < N; i++) {
    if(a[i] == 0) {
      b[0]++;
      b[1]++;
      continue;
    }
    b[a[i] - 1]++;
    b[a[i]]++;
    b[a[i] + 1]++;
  }
  sort(b.rbegin(), b.rend());
  cout << b[0] << endl;
  return 0;
}

Measured memory_bytes: 1024
using System;

namespace dp
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var t = Console.ReadLine();

            // init dp
            var dp = new int[s.Length + 1][];
            for (var i = 0; i < dp.Length; ++i)
            {
                dp[i] = new int[t.Length + 1];
            }

            for (var i = 1; i < dp.Length; ++i)
            {
                for (var j = 1; j < dp[i].Length; ++j)
                {
                    if (s[i - 1] == t[j - 1])
                    {
                        dp[i][j] = dp[i - 1][j - 1] + 1;
                    }
                    dp[i][j] = Math.Max(Math.Max(dp[i][j], dp[i - 1][j]), dp[i][j - 1]);
                }
            }

            // restore
            var length = dp[s.Length][t.Length];
            var x = s.Length;
            var y = t.Length;
            var str = new char[length];
            while (length > 0)
            {
                if (x > 0 && dp[x - 1][y] == length)
                {
                    --x;
                }
                else if (y > 0 && dp[x][y - 1] == length)
                {
                    --y;
                }
                else
                {
                    --x;
                    --y;
                    --length;
                    str[length] = s[x];
                }
            }
            Console.WriteLine(new string(str));
        }
    }
}


Measured memory_bytes: 61504
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
typedef int64_t Int;
typedef pair<Int,Int> P;


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

    vector<int> A(N);
    rep(i,N) cin >> A[i];

    int ans = 0;
    rep(i,N){
        if(i % 2 == 0 && A[i] % 2 == 1) ans++;
    }
    cout << ans << endl;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define Decimal fixed << setpresicion(20)


typedef long long ll;
typedef pair<ll, ll> P;

ll A[60][60];
ll B[60][60];
ll An[60][60];
ll mat[60][60];

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

  REP(i, N) REP(j, N) cin >> An[i][j];
  REP(i, N) mat[i][i] = 1;
  while(K > 0) {
    if (K % 2 == 1) {
      REP(i, N) {
        REP(j, N) {
          A[i][j] = An[i][j];
          B[i][j] = mat[i][j];
          mat[i][j] = 0;
        }
      }
      REP(i, N) REP(j, N) REP(k, N)
        (mat[i][j] += A[i][k] * B[k][j])%=MOD;
    }

    REP(i, N) {
      REP(j, N) {
        A[i][j] = B[i][j] = An[i][j];
        An[i][j] = 0;
      }
    }
    REP(i, N) REP(j, N) REP(k, N)
      (An[i][j] += A[i][k] * B[k][j])%=MOD;
    K /= 2;
  }

  ll ans = 0;
  REP(i, N) {
    REP(j, N) {
      (ans += mat[i][j])%=MOD;
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
const ll MOD = 1000000007;

int main() {
  long double l;
  cin >> l;
  l /= 3;
  cout << fixed << setprecision(10) << l * l * l << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){
	for(;;){
            int ans=10000;
            int n;
            cin>>n;

            if(n==0)break;
            int puyo[11000]={0};
            for(int i=0;i<n;i++){
                cin>>puyo[i];
            }
            //in
            int sub;
            for(int a=0;a<n;a++){
                for(int b=1;b<=3;b++){
                    sub=puyo[a];
                    puyo[a]=b;
                    int mem=-1,cnt=1;
                    int meml=0;
                    int left=n;
                    //つながり検出
                        for(int i=1;i<n;i++){
                            if(puyo[i]==puyo[i-1]){
                                cnt++;
                            }
                            else cnt=1;
                            if(cnt>=4){
                                meml=max(meml,cnt);
                                mem=i-meml;
                                //memは連鎖するぷよの一つ上
                                //memeは連鎖するぷよの一つ下

                            }
                        }
                        left-=meml;

                    int rem=meml;
                    //つながり検出
                    //連鎖計算
                    //cout<<"-"<<meml<<endl;

                    for(;;){
                    int meme=mem+meml+1;
                    int kem=mem;
                    rem=1;
                   // cout<<mem<<" "<<meme<<endl;
                        for(int i=mem-1;i>=0;i--){
                            if(puyo[i]==puyo[kem]){
                                rem++;
                        //        cout<<rem<<"-"<<i<<endl;

                            }
                            else {
                                mem=i;
                                break;
                            }
                        }
                        for(int j=meme;j<n;j++){
                            if(puyo[j]==puyo[kem]){
                                rem++;
                         //       cout<<rem<<"+"<<j<<endl;

                            }
                            else {
                                meme=j;
                                break;
                            }
                        }
                        if(rem>=4){
                       //     cout<<"0";
                        }
                        else break;
                        left-=rem;
                        meml+=rem;
                    }
                    ans=min(ans,left);
                    puyo[a]=sub;
                }
            }
            //連鎖計算
            cout<<ans<<endl;

	}


	return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
#define mod2 1000000007
#define MOD 1000000037
#define mod1 998244353
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define INF 2e9

int main()
{
    int n;
    cin >> n;
    lli ans1=0;
    for(int i=1;i<n;i++)
    {
        int x,y;
        cin >> x >> y;
        ans1+=min(x,y)*1LL*(n+1-max(x,y));
    }
    lli ans=0;
    for(int i=1;i<=n;i++)
    {
        ans+=(n-i+1)*1LL*i;
    }
    cout << ans-ans1 << endl;
}

Measured memory_bytes: 3648
import sys
import math
def v():
    pt=[5,0,1,2]
    N=100000
    s=list(map(lambda x: '0' if x=='g' else '1', list(sys.stdin.readline().strip())))
    n,x=len(s),int(''.join(s),2)
    s=list(format(x<<(N-n),'0100000b'))
    p=pt[n%4]
    for _ in range(n//4):p=(p<<4)+5
    ss=list(format(p<<(N-n),'010000b'))
    res=0
    for _,a,b in zip(range(n),s,ss):
        d=int(b)-int(a)
        res = res if d==0 else res+d
    print(res)
if __name__=='__main__':v()


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

int gcd(int a, int b) {
    while(b)
        swap(a %= b, b);
    return a;
}
int main() {
    long a, b;
    cin >> a >> b;
    cout << a * b / gcd(a, b) << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  int N; scanf("%d", &N);
  set<int> s;
  int d;
  for (int i = 0; i < N; ++i) {
    scanf("%d", &d);
    s.insert(d);
  }
  int ans = s.size();
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
      	long[] a = new long[n];
        long std = 1000000000000000000L;
      	for (int i=0; i < n; i++) {
          a[i]= sc.nextLong();
          if (a[i] == 0) {
            System.out.println(0);
            return;
          }
        }
      
        long seki = a[0];
        for(int i=1; i < n; i++) {
          if (a[i] <= (std / seki)) {
            seki *= a[i];
          } else {
            System.out.println(-1);
          	return;
          }
        }
        System.out.println(seki);
    }
}

Measured memory_bytes: 61044
#include <stdio.h>

int main()
{
    int N;
    int L[201] = {};
    int S = 0;
    scanf("%d",&N);
    
    for (int i = 0; i < N * 2; i++) {
        scanf("%d", &L[i]);
    }
    
    for (int i = 0; i < N * 2 - 1; i++) {
        for (int j = N * 2 - 1; j > i; j--) {
            if(L[j - 1] > L[j]) {
                int t = L[j - 1];    
                L[j - 1] = L[j];
                L[j] = t;
            }
        }
    }
    
    for (int i = 0; i < N * 2; i += 2) {
        S += L[i];
    }
    
    printf("%d", S);
    
    return 0;
}


Measured memory_bytes: 128
buf[20000];char*p=buf;
i,w;
main(){
	read(0,buf,20000);
	while(*p>32)p++;
	for(p++;*p>10;p++)w=w*10+*p-48;
	for(;i++<w+1;)putchar_unlocked('#');
	for(;*p>0;p++){
		if(*p==10)putchar_unlocked('#'),putchar_unlocked(10),putchar_unlocked('#');
		else putchar_unlocked(*p);
	}
	for(i=0;i++<w+1;)putchar_unlocked('#');
}

Measured memory_bytes: 128
#include <iostream>
#include<cstdio>
#include <string>
#include <map>
#include <algorithm>
using namespace std;



int main()
{
	map<int, int> record;
	int n;
	int x;
	cin >> n;
	while (n--)
	{
		cin >> x;
		if (record[x] == 0)
			record[x] = 1;
		else
			record[x] = 0;
	}
	int k = 0;
	for (auto it : record)
	{
		if (it.second == 1)
			k++;
	}
	cout << k << endl;
}


Measured memory_bytes: 4992
N, M = map(int, input().split())
MOD = 10 ** 9 + 7
# 素因数分解 O(√N)


def prime_decomposition(n):
    i = 2
    prime2exponent = {}  # key:prime --> value:its exponent
    while i*i <= n:
        while n % i == 0:
            n //= i
            if i in prime2exponent:
                prime2exponent[i] += 1
            else:
                prime2exponent[i] = 1
        i += 1
    if n > 1:
        if n in prime2exponent:
            prime2exponent[n] += 1
        else:
            prime2exponent[n] = 1
    return prime2exponent


class Combination:
    """
  O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
  n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
  使用例：
  comb = Combination(1000000)
  print(comb(5, 3))  # 10
  """

    def __init__(self, n_max, mod=10 ** 9 + 7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n - r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n + 1):
            fac.append(fac[i - 1] * i % self.mod)
            facinv.append(facinv[i - 1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n + 1)
        modinv[1] = 1
        for i in range(2, n + 1):
            modinv[i] = self.mod - self.mod // i * \
                modinv[self.mod % i] % self.mod
        return modinv


comb = Combination(1000000)
pd = prime_decomposition(M)
ans = 1
for v in pd.values():
    c = comb(N + v - 1, N-1)
    ans = ans * c % MOD
print(ans)


Measured memory_bytes: 127876
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <set>

#define lowbit(x) (x&(-x))
#define MAX(a,b) (a<b?b:a)
#define MIN(a,b) ((a)<(b)?(a):(b))
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int N = 2e5;
const int maxn = 2e5 + 5;
ll mod = 1e9 + 7;

int n, m, a[maxn], cnt[maxn], vis[maxn];

int main()
{
	scanf("%d%d", &n, &m);
	int ans = n;
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", a + i);
		++cnt[a[i]];
		int pos = a[i] - cnt[a[i]] + 1;
		if (pos > 0)
		{
			if (!vis[pos]) --ans;
			++vis[pos];
		}
	}

	while (m--)
	{
		int x, y;
		scanf("%d%d", &x, &y);
		int pos = a[x] - cnt[a[x]] + 1;
		if (pos > 0)
		{
			--vis[pos];
			if (!vis[pos]) ++ans;
		}
		--cnt[a[x]];
		++cnt[a[x] = y];
		pos = a[x] - cnt[a[x]] + 1;
		if (pos > 0)
		{
			if (!vis[pos]) --ans;
			++vis[pos];
		}
		printf("%d\n", ans);
	}
}


Measured memory_bytes: 3712
//FIRST THINK THEN CODE.

#include <bits/stdc++.h>
 
 
using namespace std;
 
typedef long long ll;
 
//#define MOD 998244353
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define FOR(i,n)  for(ll i=0;i<n;i++)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define rev(p) reverse(p.begin(),p.end());
#define endl "\n"
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define popcount(x) __builtin_popcountll(x)
#define sz(x) ((ll)x.size())
const int M=1000000007;
const int MM=998244353;
int begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";

 
ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}
 
 
ll powM(ll a,ll b,ll m )
{ 
  if(m<=1)return 0;
  a%=m;
  ll ans=1LL;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }
 
return ans;
}


 
ll poww(ll a,ll b)
{ 
  
  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }
 
return ans;

}

template<typename T,typename F>
void chmax( T &a,F b){
  if(b>a)a=b;
}

template<typename T,typename F>
void chmin( T &a,F b){
  if(b<a)a=b;
}

const ll N=5e5+5;


ll f(ll a,ll b){
  ll c=0;
  while(a||b){
    a/=10;
    b/=10;
    c++;
  }
  return c;
}


int main()
{ 

IOS;


ll n;cin>>n;

vl a(n),b(n),c(n);

FOR(i,n)cin>>a[i];

sort(all(a));

FOR(i,n)cin>>b[i];

sort(all(b));


FOR(i,n)cin>>c[i];

sort(all(c));

vl bb(n+1);

ll cnt=0;

for(int i=n-1;i>=0;i--){
  ll ind=ub(all(c),b[i])-c.begin();
  bb[i]=bb[i+1]+n-ind;
}

for(int i=0;i<n;i++){
  ll ind=ub(all(b),a[i])-b.begin();
  cnt+=bb[ind];
}

cout<<cnt;


//end_routine();

return 0;
 
}


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

int main() {
  int a, b;
  cin >> a >> b;
  cout << max(a-2*b, 0) << endl;
  return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int a,b,c;
    cin>>a>>b>>c;
    if(c>=a && c<=b){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256