akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>

#define MEW UINT64_C(1000000000)

#define INF UINT64_C(101010101010101010)

uint64_t kugyu(void) {
	char buffer[10240];
	char* nyan;
	uint64_t ret;
	if (scanf("%10000s", buffer) != 1) exit(1);
	nyan = strchr(buffer, '.');
	if (nyan == NULL) {
		strcat(buffer, ".");
		nyan = strchr(buffer, '.');
	}
	strcat(buffer, "00000000000000000000");
	memmove(nyan, nyan + 1, 10);
	nyan[9] = '\0';
	if (sscanf(buffer, "%" SCNu64, &ret) != 1) exit(1);
	return ret;
}

int N;
uint64_t asumisu[222222];
uint64_t k[222222];
uint64_t left[222222];
int count[20][20];

int main(void) {
	int i;
	uint64_t answer = 0;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		asumisu[i] = kugyu();
	}

#if 0
	for (i = 0; i < N; i++) {
		printf("%" PRIu64 "\n", asumisu[i]);
	}
#endif

	for (i = 0; i < N; i++) {
		int j, jj;
		int c2 = 0, c5 = 0;
		k[i] = asumisu[i];
		left[i] = 1;
		for (j = 0; j < 18; j++) {
			if (k[i] % 2 == 0) k[i] /= 2; else { left[i] *= 2; c2++; }
			if (k[i] % 5 == 0) k[i] /= 5; else { left[i] *= 5; c5++; }
			if (left[i] > INF) left[i] = INF;
		}
#if 0
		printf("%20" PRIu64 " %20" PRIu64 "\n", k[i], left[i]);
#endif
		answer += count[18 - c2][18 - c5];
		for (j = c2; j < 20; j++) {
			for (jj =c5; jj < 20; jj++) count[j][jj]++;
		}
	}

	printf("%" PRIu64 "\n", answer);
	return 0;
}

/*

掛け算して MEW*MEW の倍数になればおｋ
→ A_i * A_j = MEW*MEW*k (kは整数)
→ A_j = MEW*MEW/A_i * k

k → (MEW*MEW)/A_i を約分した時の分母の倍数
A_j → (MEW*MEW)/A_i を約分した時の分子の倍数

MEW*MEW は2と5だけからなる
→2と5がその数以上あればおｋ、を管理する

*/


Measured memory_bytes: 6384
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  vl A(N, 0);
  REP(i, N) {
    ll x;
    cin >> x;
    A[x - 1]++;
  }
  sort(ALL(A));
  vl sum(N, 0);
  sum[0] = A[0];
  FOR(i, 1, N) sum[i] = sum[i - 1] + A[i];
  ll ans = N;
  FOR(k, 1, N + 1) {
    while (true) {
      if (ans == 0)
        break;
      else {
        ll index = upper_bound(ALL(A), ans) - A.begin();
        ll x = sum[index - 1] + ans * (N - index);
        if (x >= ans * k)
          break;
      }
      ans--;
    }
    cout << ans << endl;
  }

  return 0;
}


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

#define FOR(i,b,e) for(int i=(b); i <= (e); ++i)
#define FORD(i,b,e) for(int i=(b); i >= (e); --i)
#define SIZE(c) (int) (c).size()
#define FORE(i,c) FOR(i,0,SIZE(c)-1)
#define FORDE(i,c) FORD(i,SIZE(c)-1,0)

#define pb push_back
#define mp make_pair
#define st first
#define nd second


using namespace std;

typedef long long ll;
typedef pair <int,int> pii;
typedef pair <ll,ll> pll;

typedef vector <int> VI;
typedef vector <bool> VB;
typedef vector <pii> VP;
typedef vector <ll> VL;
typedef vector <pll> VPL;

typedef vector <VI> VVI;
typedef vector <VL> VVL;
typedef vector <VB> VVB;
typedef vector <VP> VVP;

const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000000000000001LL;


/*************************************************************************/

int main() {
    ios_base::sync_with_stdio(0);
    
    int n, k;
    cin >> n >> k;
    
    VI a(n);
    FOR(i,0,n-1) {
        cin >> a[i];
    }
    
    const string YES = "POSSIBLE";
    const string NO = "IMPOSSIBLE";
    
    if (k > *max_element(a.begin(), a.end())) {
        cout << NO;
        return 0;
    }
    
    int gcd = a[0];
    for (int x : a) {
        gcd = __gcd(gcd, x);
    }
    
    if (k % gcd != 0) {
        cout << NO;
        return 0;
    }
    
    cout << YES;

    return 0;
}

/*************************************************************************/


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

using namespace std;
#define MAXN 100
vector<pair<int,int>> adj[MAXN + 5];

void djikstra(int s, vector<int>& dist, vector<bool>& proc) {
	priority_queue<pair<int,int>> q;
	dist[s] = 0;
	q.push({-dist[s], s});
	while(!q.empty()) {
		int t = q.top().second; q.pop();
		if (proc[t]) continue;
		for (auto& ei : adj[t]) {
			int u, w;
			tie(u, w) = ei;
			if (dist[u] > dist[t] + w) {
				dist[u] = dist[t] + w;
				q.push({-dist[u], u});
			}
		}
		proc[t] = true;
	}
}

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	
	int n, m, cnt = 0; cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int a, b, w; cin >> a >> b >> w;
		adj[a].push_back({b, w});
		adj[b].push_back({a, w});
	}

	for (int i = 1; i <= n; i++) {
		vector<int> dist(n+1, INT_MAX);
		vector<bool> proc(n+1, false);
		djikstra(i, dist, proc);
		for (auto& ei : adj[i]) {
			int u, w;
			tie(u, w) = ei;
			if (dist[u] < w) cnt++;
		}
	}

	cout << cnt/2 << "\n";
	return 0;
}

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

#define LL long long
using namespace std;

int a[3];
int main(){
    cin >> a[0] >> a[1] >> a[2];
    sort(a,a+3);
    if(a[0] == 5 && a[1] == 5 && a[2] == 7)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
let () = Scanf.scanf "%d %d\n" @@ fun n k ->
  let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  for i = k to n - 1 do
    print_endline @@ if as_.(i - k) < as_.(i) then "Yes" else "No"
  done

Measured memory_bytes: 7452
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define fast ios::sync_with_stdio(0);cin.tie(0);
#define MAX 300005
#define endl '\n'
#define MOD 998244353

int mul(int a,int b)
{
    a%=MOD;
    b%=MOD;
    return (a*b)%MOD;
}
int add(int a,int b)
{
    a%=MOD;
    b%=MOD;
    return (a+b)%MOD;
}

int power(int a,int n)
{
    int res = 1;
    while(n>0)
    {
        if(n%2 == 1)
        {
            res= mul( res,a );
        }
        a = mul(a,a);
        n/=2;
    }
    return res;
}

void solve()
{
    int n;
    cin>>n;
    if(n%1000 == 0)
        cout<<0<<endl;
    else
        cout<< 1000 - n%1000 << endl;
    
}

int32_t main()
{
    fast
    // #ifndef ONLINE_JUDGE
    //  freopen("input.txt","r",stdin);
    //  freopen("output.txt","w",stdout);
    // #endif
    int test;
    test = 1;
    // cin>>test;
    while(test--)
    {
        solve();
    }

    return 0;
}

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

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define debug(x) cerr<<#x<<" -> "<<x<<'\n'
#define debug2(x,y) cerr<<#x<<" -> "<<x<<" "<<#y<<" -> "<<y<<'\n'
#define debug3(x,y,z) cerr<<#x<<" -> "<<x<<" "<<#y<<" -> "<<y<<" "<<#z<<" -> "<<z<<'\n'

 
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;

using ordered_set = tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>;

template<typename T>
struct CMP {
	bool operator() (const T& lhs, const T& rhs) const{
		return lhs < rhs;
	}
};

template <typename T>
T power(T a, T n){
	T res = 1;
	while(n > 0){
		if(n & 1) res = (res * a);
		a = (a * a);
		n >>= 1;
	}
	
	return res;
}

template <typename T>
T power(T a, T n, long long mm){
	T res = 1;
	while(n > 0){
		if(n & 1) res = (res * a) % mm;
		a = (a * a) % mm;
		n >>= 1;
	}
	
	return res;
}

const ll N = 2e5+7;
const ll MOD = 1e9+7;
const ll INF = 2e14+7;

int dp[3005][3005];

void testcase(){
	string s, t;
	cin>>s>>t;
	
	int sl = (int)s.size(), tl = (int)t.size();
	
	for(int i = 0; i <= sl; i++) dp[i][0] = 0;
	for(int i = 0; i <= tl; i++) dp[0][i] = 0;
	
	for(int i = 1; i <= sl; i++){
		for(int j = 1; j <= tl; j++){
			if(s[i - 1] == t[j - 1]){
				dp[i][j] = dp[i - 1][j - 1] + 1;
			} else {
				dp[i][j] = max(dp[i][j - 1], dp[i - 1][j]);
				dp[i][j] = max(dp[i][j], dp[i - 1][j - 1]);
			}
			
		}
	}
	
	string ans = "";
	int i = sl, j = tl;
	while(i && j){
		//debug3(i, j, ans);
		if(dp[i][j] == dp[i - 1][j]){
			i--;
		} else if(dp[i][j] == dp[i][j - 1]){
			j--;
		} else if(dp[i][j] == dp[i - 1][j - 1] + 1){
			ans = s[i - 1] + ans;
			i--;
			j--;
		}
	}
	cout<<ans<<'\n';
}

signed main(){
	fast;
	
	int t = 1;
	//cin>>t;
	while(t--){
		testcase();
	}
	
	return 0;
}


Measured memory_bytes: 35456
import sys
import numpy as np
import math
import collections
import copy
from collections import deque 
from functools import reduce
from itertools import product
from itertools import combinations

# input = sys.stdin.readline
N = int(input())
Cn = list(input())

Cc = copy.copy(Cn)
if (Cn[0] == "R"):
    Rflg = True
else:
    Rflg = False
ans = 0
K = N-1    
allw = False
for i in range(N):
    if Rflg and Cc[i] == "R":
        continue
    else:
        Rflg = True
    if Cc[i] == "W":
        for j in range(K, i, -1):
            if Cc[j] == "R":
#                 print("change")
                ans += 1
                Cc[i], Cc[j] = Cc[j], Cc[i]
                K = j
#                 print(Cc)
                break
        else:
            allw = True

    else:
#         print("replace")
        ans += 1
        Cc[i] = "W"
#         print(Cc)
    if allw:
        break

print(ans)


















Measured memory_bytes: 29848
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

int main(){
    int A,Z,a=0;
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(a==0){
            if(s.at(i)=='A'){
            A=i;
            a=1;
            }
        }else if(a<=i+1&&s.at(i)=='Z'){
            Z=i;
            a=i;
        }
    }
    cout<<Z-A+1<<"\n";
}

Measured memory_bytes: 3700
#   B

N, L = map(int, input().split())

taste_all = N*L + int((N - 1)*N/2)
ans = 0

if L + N - 1 < 0:
    ans = taste_all - (L + N - 1)
elif L > 0:
    ans = taste_all - L
else:
    ans = taste_all



print(ans)




Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;

const int MAXN=1e6+1;

int t;

void solve(){
    int k, len;
    string s;
    cin>>k>>s;
    len=s.length();
    if(len>k){
        s.resize(k);
        s=s+"...";
        cout<<s<<endl;
        return;
    }
    cout<<s<<endl;
    return;
}

int main()
{
    //freopen("IN.txt","r",stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <climits>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <utility>
#include <vector>

#define MOD (int64)1000000007

using int32 = std::int_fast64_t;
using int64 = std::int_fast64_t;
using uint32 = std::int_fast64_t;
using uint64 = std::int_fast64_t;
uint32 n, m, s, t;
#define SIZ 100003
struct edge {
	uint32 to;
	uint64 cost;
};
std::vector<edge> G[SIZ];

int64 minus(int64 a, int64 b) {
	return (a >= b) ? (a - b) : (a + MOD - b);
}

using P = std::pair<uint64, uint32>;
int main(void) {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
#define INF UINT_FAST64_MAX/4
	std::cin >> n >> m >> s >> t;
	--s;--t;
	std::vector<uint32> u(m), v(m);
	std::vector<uint64> d(m);
	for (uint32 i = 0;i < m;++i) {
		std::cin >> u[i] >> v[i] >> d[i];
		--u[i];--v[i];
		G[u[i]].push_back({ v[i],d[i] });
		G[v[i]].push_back({ u[i],d[i] });
	}
	std::priority_queue<P, std::vector<P>, std::greater<P>> Q;
	std::vector<uint64> pas(n, 0),pat(n,0), ds(n, INF), dt(n, INF);
	ds[s] = 0;
	dt[t] = 0;
	pas[s] = 1;
	pat[t] = 1;
	Q.push(P(0, s));
	while (!Q.empty()) {
		P p = Q.top();Q.pop();
		uint32 vte = p.second;
		if (ds[vte] < p.first) continue;
		for (uint32 i = 0;i < G[vte].size();++i) {
			edge e = G[vte][i];
			if (ds[e.to] > ds[vte] + e.cost) {
				ds[e.to] = ds[vte] + e.cost;
				pas[e.to] = pas[vte];
				Q.push(P(ds[e.to], e.to));
			}
			else if (ds[e.to] == ds[vte] + e.cost) {
				pas[e.to] = (pas[e.to] + pas[vte]) % MOD;
			}
		}
	}
	Q.push(P(0, t));
	while (!Q.empty()) {
		P p = Q.top();Q.pop();
		uint32 vte = p.second;
		if (dt[vte] < p.first) continue;
		for (uint32 i = 0;i < G[vte].size();++i) {
			edge e = G[vte][i];
			if (dt[e.to] > dt[vte] + e.cost) {
				dt[e.to] = dt[vte] + e.cost;
				pat[e.to] = pat[vte];
				Q.push(P(dt[e.to], e.to));
			}
			else if (dt[e.to] == dt[vte] + e.cost) {
				pat[e.to] = (pat[e.to] + pat[vte]) % MOD;
			}
		}
	}
	int64 ans = pat[s] * pas[t] % MOD;
	uint64 len = ds[t];
	for (uint32 i = 0;i < n;++i) {
		if (ds[i] + dt[i] != len) continue;
		if (ds[i] == dt[i]) {
			int64 temp = pas[i] * pat[i] % MOD;
			temp = (temp*temp) % MOD;
			ans = minus(ans, temp);
		}
	}
	for (uint32 i = 0;i < m;++i) {
		if ((ds[u[i]] + dt[u[i]] != len) || (ds[v[i]] + dt[v[i]] != len)) continue;
		uint32 b = u[i], c = v[i];
		if (ds[b] > ds[c]) std::swap(b, c);
		if (ds[b] + d[i] != ds[c]) continue;
		if ((ds[b] * 2 < len)&&(dt[c] * 2 < len)) {
			int64 temp = pas[b] * pat[c] % MOD;
			temp = (temp*temp) % MOD;
			ans = minus(ans, temp);
		}
	}
	std::cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 23920
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

N = INT()
a = [0] + LIST()

ans = 0

for i in range(N+1):
	if i%2 == 1 and a[i]%2 == 1:
		ans += 1

print(ans)

Measured memory_bytes: 10596
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <iostream>
#include <sstream>
#include <string>
#include <iomanip>
#include <set>
#include <map>

using namespace std;

#define EPS 1e-14
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) FOR(i, 0, n)
#define PI 2*acos(0.0)
#define ALL(a) (a).begin(),(a).end()
#define DEBUG(x) cout<<#x <<": "<< x << "\n"
#define DEBUG_ARR(a) REP(i, size(a)){ cout << #a << "[" << i << "]: " << a[i] << "\n"; }
const int VX[] = { 0, 1, 0, -1 };
const int VY[] = { 1, 0, -1, 0 };
const long long MOD = 1000000000 + 7;
typedef long long ll;

int main() {
	//	--- I/O 高速化 ---
	cin.tie(0);
	ios::sync_with_stdio(false);
	// --- ここまで ---

	int N, a, b;
	ll K;
	cin >> N >> K;
	
	map<int, ll> arr;
	REP(i, N) {
		cin >> a >> b;
		auto itr = arr.find(a);
		if (itr != arr.end()) {
			arr[a] += b;
		}
		else {
			arr[a] = b;
		}
	}

	for (auto it : arr) {
		if (K <= it.second) {
			cout << it.first << endl;
			break;
		}
		else {
			K -= it.second;
		}
	}

	return 0;
}



Measured memory_bytes: 4224
#include<bits/stdc++.h>
#include<vector>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define CEVCOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define P pair<int , int>
#define V vector<int>
#define M map<int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void){

    int N;    cin >> N;
    V A(N), B(N), C(N);
    VECCIN(A);	VECCIN(B); VECCIN(C);

    int ans = B[A[0] - 1];
    for(int i = 1 ; i < N ; i++){
      ans += B[A[i] - 1];

      if(A[i] == A[i - 1] + 1)
        ans += C[A[i - 1] - 1];
    }

    SCOUT(ans) << endl;
    
    return 0;
}


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

using ll = long long;
// #define int long long

#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))

bool pro_red[100005];
/***** MAIN *****/
signed main() {
  int n, m;
  cin >> n >> m;
  vector<int> counter(n,1);
  pro_red[0] = true;
  REP(i,m) {
    int src, dst;
    cin >> src >> dst;
    --src, --dst;
    if(counter[src] == 0) continue;
    --counter[src], ++counter[dst];
    if(pro_red[src]) pro_red[dst] = true;
    if(counter[src] == 0) pro_red[src] = false;
  }
  int ans = 0;
  REP(i,n) {
    if(pro_red[i]) ++ans;
  }
  cout << ans;
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 768
S = input()
K = int(input())
N = len(S)

alpha = [0] * 27
for s in S:
  alpha[ord(s) - ord("a")] += 1

answer = []
for a in range(27):
  if alpha[a]:
    for i in range(N):
      if S[i] == chr(a+ord("a")):
        for j in range(1, 6):
          if i + j > N:
            break
          answer.append(S[i:i+j])
    answer = list(set(answer))
    if len(answer) >= K:
      answer.sort()
      print(answer[K-1])
      exit()

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

int main() {
  int n;
  string s;
  cin>>n>>s;
  string x;
  for(int i=0;i<s.size();i++){
    s[i]=(s[i]-'A'+n)%26+'A';
  }
  cout<<s<<endl;
}

Measured memory_bytes: 256
H,W,M = map(int, input().split())

hs = [0] * H
ws = [0] * W
s = set()
for i in range(M):
  h,w = map(int, input().split())
  h -= 1
  w -= 1
  hs[h] += 1
  ws[w] += 1
  s.add((h,w))
  
mh = 0
mw = 0
for i in range(H):
  mh = max(mh, hs[i])
for j in range(W):
  mw = max(mw, ws[j])
  
i_s = list()
j_s = list()
for i in range(H):
  if hs[i] == mh:
    i_s.append(i)
for j in range(W):
  if ws[j] == mw:
    j_s.append(j)
    
ans = mh + mw
for i in i_s:
  for j in j_s:
    if (i,j) in s:
      continue
    print(ans)
    exit()
ans -= 1
print(ans)

Measured memory_bytes: 176548
#include <iostream>
#include <vector>
using namespace std;
#define N 101000
#define M 1000000007

inline long long MOD (long long x){
    if (x < M)
        return x;
    return x % M;
}

vector <int> a[N];
int n, x, y, i;
long long d[N][2];

void df (int k, int p){
    d[k][0] = d[k][1] = 1;
    for (int it = 0; it < a[k].size(); ++it)
    if (a[k][it] != p){
        df (a[k][it], k);
        d[k][0] = MOD (d[k][0] * (d[a[k][it]][0] + d[a[k][it]][1]));
        d[k][1] = MOD (d[k][1] * (d[a[k][it]][0]));
    }
}

int main()
{
    cin >> n;
    for (i = 1; i < n; ++i){
        cin >> x >> y;
        --x;
        --y;
        a[x].push_back(y);
        a[y].push_back(x);
    }
    df (0,0);
    cout << MOD (d[0][0] + d[0][1]);
    return 0;
}


Measured memory_bytes: 14208
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char s[500005];
    cin>>(s+200000);
    int l=200000;
    int r=strlen(s+200000)+l-1;
    int t;
    scanf("%d",&t);
    int ok=1;
    while(t--)
    {
        int x;
        scanf("%d",&x);
        if(x==1)    ok=(ok+1)%2;
        else
        {
            scanf("%d",&x);
            char c;
            cin>>c;
            if(x==1)
            {
                if(ok)
                {
                    l--;
                    s[l]=c;
                }
                else    {r++;s[r]=c;}
            }
            else
            {
                if(ok)
                {r++;s[r]=c;}
                else
                {
                    l--;
                    s[l]=c;
                }
            }
        }
    }
    if(ok)
    for(int i=l;i<=r;i++)
        printf("%c",s[i]);
    else
        for(int i=r;i>=l;i--)
        printf("%c",s[i]);
}


Measured memory_bytes: 896
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
using namespace std;
int a[100010],n,l;
int main(){
	int pos=0;
	scanf("%d%d",&n,&l);
	for (int i=1; i<=n; i++){
		scanf("%d",&a[i]);
		if (a[i]+a[i-1]>=l) pos=i;
	}
	if (!pos) printf("Impossible\n");
	else{
		printf("Possible\n");
		for(int i=n-1;i>=pos;i--)
            printf("%d\n",i);
		for(int i=1;i<pos;i++)
            printf("%d\n",i);
	}
	return 0;
}

Measured memory_bytes: 3604
n = int(input())
r = [ list(map(int,input().split())) for i in range(n)]
b = [ list(map(int,input().split())) for i in range(n)]
b.sort()
ans = 0
for i in range(n):
    Bx = b[i][0]
    By = b[i][1]
    tmp = []
    for j in range(len(r)):
        if r[j][0] <= Bx and r[j][1] <= By:
            dis = (Bx - r[j][0])**2 + (By - r[j][1])**2
            tmp.append([r[j][1],[r[j][0],r[j][1]]])
    if len(tmp) == 0:
        continue
    else:
        tmp.sort(reverse=True)
        ans += 1
        r.remove(tmp[0][1])
print(ans)


Measured memory_bytes: 3188
def create_fact_mod(num_max)
    $fmod = Array.new(num_max + 1)
    $fmod[0] = 1
    $fmod[1] = 1
    (2..num_max).each do |i|
        $fmod[i] = ($fmod[i - 1] * i) % MOD
    end
end

def create_seq_inv_mod(num_max)
    $simod = Array.new(num_max + 1)
    $simod[0] = 1
    $simod[1] = 1
    (2..num_max).each do |i|
        $simod[i] = (MOD - MOD / i) * $simod[MOD % i] % MOD
    end
end

def create_fact_inv_mod(num_max)
    $fimod = Array.new(num_max + 1)
    $fimod[0] = 1
    $fimod[1] = 1
    (2..num_max).each do |i|
        $fimod[i] = ($fimod[i - 1] * $simod[i]) % MOD
    end
end

def create_mod_tables(n)
    create_fact_mod(n)
    create_seq_inv_mod(n)
    create_fact_inv_mod(n)
end

def comb_mod(n, k)
    return $fmod[n] * $fimod[n - k] * $fimod[k] % MOD
end

N, A, B, K = gets.split.map(&:to_i)
a_max = [N, K/A].min
a_min = [0, (K-N*B)/A].max
ans = 0
MOD = 998244353

create_mod_tables(N)

(a_min..a_max).each do |a|
    next if (K - a*A) % B > 0
    b = (K - a*A)/B
    next unless a.between?(0, N) && b.between?(0, N)
    ans += comb_mod(N, a) * comb_mod(N, b) % MOD
    ans %= MOD
end
puts ans

Measured memory_bytes: 8828
try:
    while True:
        ame = int(input())
        num1 = ame % 39
        if num1 == 0:
            num1 = 39
        if num1 < 10:
            print("3C0" + str(num1))
        else:
            print("3C" + str(num1))
except EOFError as e:
    num = 0


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

int a[101];

int main()
{
	int n, x;
	
	cin >> n;
	
	for (int i=1; i<=n; i++)
	{
		cin >> x;
		a[x]=1;
	}
	int s=0;
	for(int i=1; i<=100; i++)
	{
		if (a[i]==1) s++;
	}
	
	cout << s;
	return 0;
}

Measured memory_bytes: 764
import math

def combi(n ,k):
    return math.factorial(n)//(math.factorial(k)*math.factorial(n-k))

N, K = map(int, input().split())

cnt_list = []
for i in range(1,K+1):
    if N-K+1 >= i:
        cnt = int(combi(N-K+1,i)*combi(K-1,i-1))
    else:
        cnt =0
    cnt_list.append(cnt%(10**9+7))

for i in range(len(cnt_list)):
    print(cnt_list[i])

Measured memory_bytes: 3444
#include <bits/stdc++.h>
#define int long long
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define rep(i,l,r) for(int i=l;i<r;i++)
#define bep(i,l,r) for(int i=l;i>=r;i--)
#define ff first
#define ss second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define el '\n'
#define sz(s) s.size()
#define all(v) v.begin(),v.end()
#define mii map<int,int>
#define mr  make_pair
using namespace std;
int mod = 1e9+7;
int inf = 1e18;
const int N = 5e5+999;
int powmod(int a,int b) {int res=1;if(a>=mod)a%=mod;for(;b;b>>=1){if(b&1)res=res*a;if(res>=mod)res%=mod;a=a*a;if(a>=mod)a%=mod;}return res;}
int n,d;

signed main()
{
    io
    int tt = 1;
    //cin>>tt;
    while(tt--)
    {
        int n;
        cin>>n;
        vi arr(n);
        for(int&i:arr)
        cin>>i;
        vi dp(n+5,inf);
        dp[0] = 0;
        dp[1] = abs(arr[1]-arr[0]);
        for(int i=2;i<n;++i)
        {
            dp[i] = min(dp[i-1]+abs(arr[i]-arr[i-1]),abs(arr[i]-arr[i-2])+dp[i-2]);
        }
        cout<<dp[n-1]<<el;

    }
   return 0;
}


Measured memory_bytes: 1792
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    H, W, K = map(int, input().split())
    grid = [list(input().rstrip()) for _ in range(H)]

    cnt = 0
    res = [[0] * W for _ in range(H)]
    for h in range(H):
        num = 0
        for w in range(W):
            if grid[h][w] == "#":
                cnt += 1
                num = cnt
            res[h][w] = num

    for h in range(H):
        num = 0
        for w in reversed(range(W)):
            if res[h][w]:
                num = res[h][w]
            res[h][w] = num

    for w in range(W):
        for h in range(1, H):
            if res[h][w] == 0:
                res[h][w] = res[h - 1][w]

    for w in range(W):
        for h in reversed(range(H)):
            if res[h][w] == 0:
                res[h][w] = res[h + 1][w]

    for i in res:
        print(*i)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 13348
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
		int r = sc.nextInt();
		int d = sc.nextInt();

		int count = 0;
		for (int i = l; i <= r; i++) {
			if (i % d == 0) {
				count++;
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 35632
def main():
    N, A, B = map(int, input().split())
    counter = 0

    for n in range(1, N+1):
        sum = 0
        for digit in str(n):
            sum += int(digit)
        if A <= sum and sum <= B:
            counter += n

    print(counter)


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
import math

N, M = map(int, input().split())
a = 1
if N == M:
    print(((math.factorial(N) % (10 ** 9 + 7)) ** 2 * 2) % (10 ** 9 + 7))
elif N == M + 1 or N + 1 == M:
    M, N = max(N, M), min(N, M)
    print(((math.factorial(N) % (10 ** 9 + 7)) ** 2 * M) % (10 ** 9 + 7))
else:
    print(0)


Measured memory_bytes: 4092
#include<stdio.h>
#include<math.h>
int main(){
	long long int a,b,n;
	scanf("%lld %lld %lld",&a,&b,&n);
	int i;
	long long int sum=0;

 if(b-1<n){
 	 sum=floor(a*(b-1)/b)-a*floor((b-1)/b);
 }
 else{
 	 sum=floor(a*n/b)-a*floor(n/b);
 }
	printf("%lld",sum);
	
}

Measured memory_bytes: 1692
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) SORT(var); REVERSE(var)
#define OPTIMIZE_STDIO ios::sync_with_stdio(false); cin.tie(0); cout.precision(10); cout << fixed
#define endl '\n'

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

void solve(istream& cin, ostream& cout) {
  int a, b;
  cin >> a >> b;
  int cnt = 1;
  int ans = 0;
  while (cnt < b) {
    cnt--;
    cnt += a;
    ans++;
  }
  cout << ans << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
  return 0;
}
#endif


Measured memory_bytes: 3596
h,w,n = gets.chomp.split(" ").map(&:to_i)
coord = Hash.new{|h,k|h[k] = Hash.new(0)}
dot = n.times.map{gets.chomp.split(" ").map{|i|i.to_i-1}}
ans = Array.new(10,0)
dot.each do |a,b|
  o = [1-a,-1].max
  p = [h-a-2,1].min
  q = [1-b,-1].max
  r = [w-b-2,1].min
  for i in o..p
    for j in q..r
      ans[coord[a+i][b+j]] -= 1
      coord[a+i][b+j] += 1
      ans[coord[a+i][b+j]] += 1
    end
  end
end
ans[0] = (h-2)*(w-2)-ans[1..-1].inject(:+)
puts ans

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

int main() {
    int x, a500, a5;
    cin >> x;
    a500 = x / 500;
    a5 = x % 500 / 5;

    cout << a500 * 1000 + a5 * 5 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int a;
  cin >> a;
  
  int a1,a10,a100;
  a1 = a % 10;
  a10 = ((a - a1) % 100) / 10;
  a100 = (a - a1 - a10)/100;
  
  cout << (a1 + a10 + a100) % 4 << endl;
}

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define int long long
#define itn int
#define pb push_back
#define m_p make_pair
#define m_t meke_tuple
#define p_p(a,b) pb(m_p(a,b))
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(all(a));reverse(all(a))
#define UNIQUE(a) a.erase(unique(all(a)),a.end())
#define debg(a) cout<<#a<<" "<<a<<endl;
#define call(a) for(auto i:a)cout<<i<<" ";cout<<endl
#define out(a) cout<<(a)<<endl
#define fi first
#define se second
#define Vec vector
#define P pair
typedef long long ll;
typedef string str;
typedef vector<ll> V;
typedef pair<ll,ll> Pi;
typedef vector<Pi> VP;
const long long INF = 1LL<<60;
const long long MOD = 1e9+7;
int gcd(int a,int b){if(b==0)return a;return gcd(b,a%b);}
int lcm(int a,int b){return a/gcd(a,b)*b;}
int max(int a,int b){if(a>b)return a; return b;}
int min(int a,int b){if(a>b)return b; return a;}
void Yes(){cout<<"Yes"<<endl;}
void No(){cout<<"No"<<endl;}
void YN(bool b){cout<<(b?"Yes":"No")<<endl;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

int a[510][510],sum[510][510];

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n,m,q;
  cin>>n>>m>>q;
  V l(m),r(m);
  Vec<V> sum=Vec<V>(n+2,V(n+2,0));
  
  rep(i,m)cin>>l[i]>>r[i],sum[l[i]][r[i]]++;
  
  reps(i,n)reps(j,n)sum[i][j]+=sum[i][j-1];

  V a(q),b(q);
  rep(i,q)cin>>a[i]>>b[i];
  
  rep(i,q){
    int res=0;
    for(int j=a[i];j<=b[i];++j)res+=sum[j][b[i]]-sum[j][a[i]-1];
    out(res);
  }
  
  /*
  reps(i,n){
    reps(j,n){
      cout<<sum[i][j]<<" ";
    }
    cout<<endl;
  }
  */
  
  return 0;
}



Measured memory_bytes: 7680
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner2();
			int n = cin.Int();
			int m = cin.Int();

			int ans = n * (n - 1) / 2 + m * (m - 1) / 2;
			Console.WriteLine(ans);
		}
	}

	public static class Helper
	{
		public static void UpdateMin32<T>(T array, int index, int value) where T : IList<int>
			=> array[index] = Math.Min(array[index], value);
		public static void UpdateMax32<T>(T array, int index, int value) where T : IList<int>
			=> array[index] = Math.Max(array[index], value);
		public static void UpdateMin64<T>(T array, int index, long value) where T : IList<long>
			=> array[index] = Math.Min(array[index], value);
		public static void UpdateMax64<T>(T array, int index, long value) where T : IList<long>
			=> array[index] = Math.Max(array[index], value);

		public static T[] Array<T>(int n, Func<int, T> init)
			=> Enumerable.Range(0, n).Select(x => init(x)).ToArray();
		public static List<T> List<T>(int n, Func<int, T> init)
			=> Enumerable.Range(0, n).Select(x => init(x)).ToList();
	}

	public class Scanner2
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private readonly string filePath_;
		private readonly Func<string> reader_;
		private string[] buf_;
		private int index_;

		public Scanner2(string file = "")
		{
			if (string.IsNullOrWhiteSpace(file)) {
				reader_ = Console.ReadLine;
			} else {
				filePath_ = file;
				var fs = new StreamReader(file);
				reader_ = fs.ReadLine;
			}
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = reader_();
			while (st == "") {
				st = reader_();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

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

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

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

		public void Save(string text)
		{
			if (string.IsNullOrWhiteSpace(filePath_)) {
				return;
			}

			File.WriteAllText(filePath_ + "_output.txt", text);
		}
	}
}

Measured memory_bytes: 13140
#ifndef DEBUG
#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i <= i##_len; ++i)
#define rep3(i, l, r) for (int i = l, i##_len = (r); i < i##_len; ++i)
#define REP3(i, l, r) for (int i = l, i##_len = (r); i <= i##_len; ++i)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
typedef int64_t Int;
typedef long double Ld;

using namespace std;
template <class T>
using Graph = vector<vector<T>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;
const Int INF = 1LL << 62;

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

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

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

template <typename T>
inline T Gcd(T a, T b) {
    T c;
    while (b) {
        c = b;
        b = a % b;
        a = c;
    }
    return a;
}

Int Lcm(Int a, Int b) {
    if (a < b) {
        swap(a, b);
    }

    return a / Gcd(a, b) * b;
}

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

    int H, W;
    cin >> H >> W;
    vector<string> fi(H);
    for (int i = 0; i < H; i++) {
        cin >> fi[i];
    }

    bool ans = true;
    for (int h = 0; h < H && ans; h++) {
        for (int w = 0; w < W && ans; w++) {
            if (fi[h][w] == '.') {
                continue;
            }

            if (w + 1 < W && h + 1 < H) {
                if (fi[h][w + 1] == '#' && fi[h + 1][w] == '#') {
                    ans = false;
                    break;
                }
            }

            if (0 <= w - 1 && 0 <= h - 1) {
                if (fi[h][w - 1] == '#' && fi[h - 1][w] == '#') {
                    ans = false;
                    break;
                }
            }
        }
    }

    if (ans) {
        cout << "Possible" << endl;
    } else {
        cout << "Impossible" << endl;
    }

    return 0;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll arr[5];
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    ll mn=1e18,n;
    cin>>n;
    for(int i=0; i<5; i++){
        cin>>arr[i];
       mn=min(mn,arr[i]);
    }
    ll div=(n/mn)+5ll;
    if(n%mn==0)
        div--;

    cout<<div<<endl;




    return 0;
}


Measured memory_bytes: 3596
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>
#include<deque>

using namespace std;
typedef long long int ll;

#define C cout<<
#define E <<endl
#define CE cout<<endl

ll n,m,a,b,c,x,y,z,aa[200010],ab[200010],ac[1010][1010];
bool r,ra,rb,rc;
string s,sa,sb,sc;
char ca,cb,cc,cd[1010][1010];
vector<ll> va,vb,vc;
map<ll,ll> mpa;

int main(){
    cin>>n;
    z=0;
    for(int i=0;i<n;i++){
        cin>>aa[i];
        mpa[aa[i]]++;
    }
    for(auto it=mpa.begin();it!=mpa.end();++it){
        z+=(it->second)%2;
    }
    C z E;
}



Measured memory_bytes: 7296
#include <stdio.h>
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <list>
#include <algorithm>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;

template<typename T>
ostream& operator << (ostream& os, vector<T>& vec) {
	for (int i = 0; i<vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	}
	return os;
}

int SumDigitValues(int x)
{
	int sum = 0;
	while (x)
	{
		sum += x % 10;
		x = x / 10;
	}

	return sum;
}

int Factorial(int n)
{
	if (n < 0) return 0;
	if (n == 0) return 1;
	return n * Factorial(n - 1);
}

int factorial(int n)
{
	if (n > 1)
	{
		return n * factorial(n - 1);
	}
	else
	{
		return 1;
	}
}

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

	int cnt = 0;
	for (int i = 1; i <= N; i++)
	{
		int h;
		cin >> h;
		if (h >= K) cnt++;
	}

	cout << cnt << endl;
}

Measured memory_bytes: 256
#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
#define INF 1e9

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef vector < pair<int, int> > vii;
typedef long double ld;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

ll ori[300001];
ll a[300001];
ll s[300001];
int n, k;
 
void calcs()
{
	s[0] = a[0];
	for(int i = 1; i < n; i++)
	{
		s[i] = s[i-1]+a[i];
	}
}

struct PBDS
{
	tree<pair<ld,int>, null_type, less<pair<ld,int> >, rb_tree_tag, tree_order_statistics_node_update> t;
	int timer;
 
	PBDS(){timer = 0;}
	void insert(ld x)
	{
		t.insert(mp(x, timer));
		timer++;
	}
 
	int lower(ld x)
	{
		return t.order_of_key(mp(x, -1));
	}
 
	void del(ld x) //make sure x exists
	{
		pair<ld,int> tmp = (*t.find_by_order(lower(x)));
		t.erase(tmp);
	}
 
	int higher(ld x)
	{
		int tmp = lower(x);
		return (int(t.size()) - tmp);
	}
};

int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n >> k;
	for(int i = 0; i < n; i++){
		cin >> ori[i];
	}
	for(int i = 0; i < n; i++)
	{
		a[i] = ori[i] - k;
	}
	calcs();
	PBDS t;
		t.insert(0);
		ll cnt = 0; //count subsegments <= mid
		for(int i = 1 - 1; i < n; i++)
		{
			if(i >= n)
			{
				if(i>n) t.del(s[i-n-1]);
				else t.del(ld(0));
			}
			//cerr<<i<<' '<<t.t.size()<<'\n';
			cnt += t.lower(s[i]+1);
			t.insert(s[i-1+1]);
			//cerr<<i<<' '<<cnt<<'\n';
		}
	cout << cnt;
	return 0;
}


Measured memory_bytes: 24832
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
ans = 0
for i in range(N):
    A = list(map(int, input().split()))
    total = 0
    for j in range(M):
        total += A[j] * B[j]
    if total + C > 0:
        ans += 1
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 2e9
#define LINF 1e18
#define mod 1000000007
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> P;
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};


int main() {
    int n; cin >> n;
    set<int> st;
    rep(i,n) {
        int a; cin >> a;
        st.insert(a);
    }
    if (sz(st) == n) cout << "YES" << endl;
    else cout << "NO" << endl;
}   

Measured memory_bytes: 12928
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a>b?a:b
#define REP(i,x,n) for(int i=x;i<n;i++)
#define REPR(i,x,n) for(int i=n-1;i>=x;i--)
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD =1e9 + 7;



int main(){
	int a,b,v;
    cin>>a>>b>>v;
    if(a+b+v>=22){
        cout<<"bust"<<endl;
    }else cout<<"win"<<endl;
}

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

int main() {
  double n, m, sum = 0;
  cin >> n >> m;
  vector<double> a(n);
  rep(i, n) {
    cin >> a[i];
    sum += a[i];
  }
  sort(a.rbegin(), a.rend());
  
  if (a[m - 1] < sum/(4*m))
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;

int main(){
    
    string imput;
    getline(cin, imput);
    for (int i = 0; i < imput.size(); i++) {
        if (islower(imput[i])) {
            imput[i] = toupper(imput[i]);
        }
    }
    cout << imput << endl;
    return 0;
}

Measured memory_bytes: 1180
#include<stdio.h>
int main()
{
  int a,b,i,j;
  while(1)
	   {
  scanf("%d%d",&a,&b);
  if(a==0&&b==0){break;}

  for(i=1;i<=a;i++)
    {
      for(j=1;j<=b;j++)
	{
	  if(j%2==1)
	    {
	      if(i%2==1)printf("#");
	      else printf(".");
	    }
	  else 
	    {
              if(i%2==1)printf(".");
	      else printf("#");
	    }
	}
      printf("\n");
    }
  printf("\n");
    
	   }
  return 0;
}



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

Measured memory_bytes: 7284
a, b = map(int, input().split())
if a == b:
    print(a)
elif b - a <= 3:
    result = a
    for i in range(a + 1, b + 1):
        result = result ^ i
    print(result)
else:
    period = [0] * 4
    x = a
    period[x % 4] = x
    for i in range(a + 1, a + 4):
        x = x ^ i
        period[i % 4] = x
    if b % 4 == 0:
        result = period[3]
        result = result ^ b
        print(result)
    elif b % 4 == 1:
        print(period[1])
    elif  b % 4 == 2:
        result = period[1]
        result = result ^ b
        print(result)
    else:
        print(period[3])

Measured memory_bytes: 3064