akhauriyash/Code-Regression huggingface dataset:
//#define NDEBUG
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <vector>

namespace n91 {

using i8 = std::int_fast8_t;
using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u8 = std::uint_fast8_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

struct rep {
  struct itr {
    usize i;
    constexpr itr(const usize i) noexcept : i(i) {}
    void operator++() noexcept { ++i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  const itr f, l;
  constexpr rep(const usize f, const usize l) noexcept
      : f(std::min(f, l)), l(l) {}
  constexpr auto begin() const noexcept { return f; }
  constexpr auto end() const noexcept { return l; }
};
struct revrep {
  struct itr {
    usize i;
    constexpr itr(const usize i) noexcept : i(i) {}
    void operator++() noexcept { --i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  const itr f, l;
  constexpr revrep(const usize f, const usize l) noexcept
      : f(l - 1), l(std::min(f, l) - 1) {}
  constexpr auto begin() const noexcept { return f; }
  constexpr auto end() const noexcept { return l; }
};
template <class T> auto md_vec(const usize n, const T &value) {
  return std::vector<T>(n, value);
}
template <class... Args> auto md_vec(const usize n, Args... args) {
  return std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> constexpr T difference(const T &a, const T &b) noexcept {
  return a < b ? b - a : a - b;
}
template <class T> void chmin(T &a, const T &b) noexcept {
  if (b < a)
    a = b;
}
template <class T> void chmax(T &a, const T &b) noexcept {
  if (a < b)
    a = b;
}
template <class T> T scan() {
  T ret;
  std::cin >> ret;
  return ret;
}

} // namespace n91

#include <algorithm>
#include <iostream>
#include <map>
#include <utility>

namespace n91 {

void main_() {
  /*
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  //*/
  const usize n = scan<usize>();
  const u32 k = scan<u32>();
  std::vector<u32> a(n);
  for (auto &e : a) {
    std::cin >> e;
  }
  std::vector<u32> acc(n + 1);
  acc[0] = 0;
  for (const usize i : rep(0, n)) {
    acc[i + 1] = (acc[i] + a[i] + k - 1) % k;
  }
  std::map<u32, u64> mp;
  u64 ans = 0;
  for (const auto e : acc) {
    ans += mp[e];
    mp[e] += 1;
  }
  mp.clear();
  for (const usize i : rep(0, n + 1)) {
    if (i >= k) {
      mp[acc[i - k]] += 1;
    }
    ans -= mp[acc[i]];
  }
  std::cout << ans << std::endl;
}

} // namespace n91

int main() {
  n91::main_();
  return 0;
}


Measured memory_bytes: 15872
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
//#include <regex>

/* g++ -g -std=c++0x */
/* g++ -g -std=c++11 */

using namespace std;

// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

int main()
{
/* #ifndef ONLINE_JUDGE */
/*     freopen("foo", "rt", stdin); */
/* #endif */
    std::ios::sync_with_stdio(false);

    string s, t;
    while (cin >> s >> t) {
        int size = s.length();
        bool good = false;
        FOR(_,0,size+2) {
            for (int i = size - 1; i > 0; i--)
                swap(s[i], s[i-1]);
            if (s == t)
                good = true;
        }
        if (good)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

int n, dp[1 << 16];

int main(){
	while(cin >> n, n){
		memset(dp, 0, sizeof(dp));
		rep(i, n){
			int m, l, bit = 0;
			cin >> m >> l;
			rep(j, m){
				int s, e;
				cin >> s >> e;
				for(; s < e; s++) bit |= 1 << s - 6;
			}
			rep(j, 1 << 16) if(!(j & bit)) dp[j | bit] = max(dp[j | bit], dp[j] + l);
		}
		int ans = 0;
		rep(i, 1 << 16) ans = max(ans, dp[i]);
		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1424
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }

    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long a = scan.nextLong();
        long b = scan.nextLong();
        long c = scan.nextLong();
        if (c - a - b <= 0) {
            System.out.println("No");
            return;
        }
        long target = sqrt(a * b * 4);
        if (target < c - a - b) {
            System.out.println("Yes");
            return;
        }
        System.out.println("No");
    }
    public static long sqrt(long x) {
        BigInteger target = new BigInteger(Long.toString(x));
        long left = 0;
        long right = x;
        while (left + 1 < right) {
            long mid = (left + right) / 2;
            BigInteger m = new BigInteger(Long.toString(mid));
            if (m.multiply(m).compareTo(target) <= 0) {
                left = mid;
            } else {
                right = mid;
            }
        }
        BigInteger l = new BigInteger(Long.toString(left));
        BigInteger lone = l.add(BigInteger.ONE);
        if ((l.multiply(l)).compareTo(target) <= 0 && target.compareTo(lone.multiply(lone)) <= 0) {
            return left;
        }
        return left + 1;
    }
}


Measured memory_bytes: 21844
import java.util.Scanner;

 class Main {
 public static void main(String[] args) {
  Scanner scan = new Scanner(System.in);
  int a, b, c;
  a = scan.nextInt();
  b = scan.nextInt();
  c = scan.nextInt();
  int[] array = { a, b, c };
  for (int i = 0; i < array.length; i += 1) {
   for (int j = i + 1; j < array.length; j += 1) {
    if (array[j] < array[i]) {
     int temp = array[i];
     array[i] = array[j];
     array[j] = temp;
    }
   }
  }
  for (int n = 0; n < array.length; n += 1) {
   if (n == array.length - 1) {
    System.out.println(array[n]);
   } else {
    System.out.print(array[n] + " ");
   }
  }
 }
}

Measured memory_bytes: 17324
x,n = map(int,input().split())
if n != 0:
    p = list(map(int,input().split()))
else:
    p = []
ans = 1000
x1 = x
x2 = x
while ans == 1000:
    if p.count(x1) == 0:
        ans = x1
    if p.count(x2) == 0:
        ans = min(ans,x2)
    x1 += 1
    x2 -= 1
print(ans)

Measured memory_bytes: 9196
from fractions import gcd
 
N = int(input())
A = list(map(int, input().split()))
l = []
r = []
k = 0
for i in range(N):
    k = gcd(k , A[i])
    l.append(k)
k = 0
for i in range(N - 1, -1, -1):
    k = gcd(k, A[i])
    r.append(k)
ans = 0
for i in range(N):
    ans = max(ans, gcd(l[i - 1], r[N - i - 2]))

ans = max(ans, l[N - 2], r[N - 2])

print(ans)


Measured memory_bytes: 16136
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>

int Pow(int n, int m);
int Max(int N[], int n);
int Min(int N[], int n);
int Sum(int N[], int n);



int main()
{
	int K = 0;
	scanf("%d", &K);

	int gusu = K / 2;
	int kisu = (K + 1) / 2;

	printf("%d", gusu * kisu);

	return 0;
}

int Pow(int n, int m) {
	int ret = 1;

	for (int i = 0; i < m; i++) {
		ret *= n;
	}

	return ret;
}

int Max(int N[], int n) {
	int max = N[0];

	for (int i = 0; i < n; i++) {
		max = max < N[i] ? N[i]: max;
	}

	return max;
}

int Min(int N[], int n) {
	int min = N[0];

	for (int i = 0; i < n; i++) {
		min = min > N[i] ? N[i] : min;
	}

	return min;
}

int Sum(int N[], int n) {
	int sum = 0;

	for (int i = 0; i < n; i++) {
		sum += N[i];
	}

	return sum;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>

int digit_sum(int a){
  std::string b = std::to_string (a);
  int ans =0;
  for (auto x : b){
    ans += x - '0';
  }
  return ans;
}


int main(){
  int N;
  std::cin >> N;
  int ans = 1000000;
  for (int i = 1; i<N;i++){
    int j = N -i;
    int temp = digit_sum(i) + digit_sum(j);
    if (temp < ans)ans = temp;
  }
  std::cout << ans << std::endl;  
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

func (con *contest) main() error {
	var n int
	con.Scan(&n)
	a := make([]int, n)
	s := 0
	for i := 0; i < n; i++ {
		con.Scan(&a[i])
		s ^= a[i]
	}
	for i := 0; i < n; i++ {
		con.Print(int(a[i]^s), " ")
	}
	con.Println()
	return nil
}


Measured memory_bytes: 7292
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define deb(x) cout<< #x << " " << x << "\n";
const ll mod=1e9+7;


int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n;cin>>n;
    vector<ll> a(n+1);
    ll k;
    for(ll i=1;i<n;i++){
        cin>>k;
        a[k]++;
    }
    for(ll i=1;i<=n;i++)
        cout<<a[i]<<"\n";


    return 0;
}

Measured memory_bytes: 4784
#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M), b(M);
  for (int i = 0; i < M; ++i)
    cin >> a[i] >> b[i];
  
  vector<pair<int, int>> c(M);
  for (int i = 0; i < M; ++i)
    c[i] = make_pair(b[i], a[i]);
  sort(c.begin(), c.end());
  
  int ans = 0, p = -1;
  for (int i = 0; i < M; ++i)
    if (p < c[i].second || c[i].first <= p)
      ++ans, p = c[i].first - 1;
  
  cout << ans << endl;
}

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

int main(){
    
    int x,h,m,s;
    cin>>x;
    h=x/3600;
    m=(x/60)%60;
    s=x%60;
    
    cout<<h<<":"<<m<<":"<<s<<endl;
    
    
    return 0;
}


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

/* ソート関数 */
int int_sort( const void * a , const void * b ) {
  return *(const int *)a - *(const int *)b;
}

int main(void) {
    int N;
    scanf("%d", &N);

    int X[N], i;
    for(i=0;i<N;i++){
        scanf("%d", &X[i]);
    }

    int X_old[N];
    for(i=0;i<N;i++){
        X_old[i] = X[i];
    }

    qsort(X, N, sizeof(X[0]), int_sort);

    // 各中央値計算
    int B[N];
    for(i=0;i<N;i++){
        int center_index = ( (N-1) + 1 ) / 2 - 1;
        if(X_old[i] <= X[center_index]) {
            B[i] = X[center_index+1];
        } else {
            B[i] = X[center_index];
        }
    }

    // 各中央値表示
    for(i=0;i<N;i++){
        printf("%d\n", B[i]);
    }

    return 0;
}

Measured memory_bytes: 4460
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
const int64_t INF=9999999999999999;

int main() {
 double A,B,H,M;
 cin>>A>>B>>H>>M;
 double sh=(H*60+M)/720*2*M_PI;
 double sm=M/60*2*M_PI;
 double s=abs(sh-sm)*M_PI*2;
 double hy=A*sin(sh);double hx=A*cos(sh);
 double my=B*sin(sm);double mx=B*cos(sm);
 cout << fixed << setprecision(10);
 cout<<sqrt((hx-mx)*(hx-mx)+(hy-my)*(hy-my))<<endl;
 return 0;}

Measured memory_bytes: 4124
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstring>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int MOD = 998244353;
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void init_comb() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long comb(int n, int r) {
  if (n < r) return 0;
  if (n < 0 || r < 0) return 0;
  return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  init_comb();
  int k, n;
  cin >> k >> n;
  for (int i = 2; i <= k*2; i++) {
    ll ans = 0;
    int p = min(i/2, k-(i+1)/2+1);
    if (i%2) {
      rep(j, p+1) {
        ll tmp = comb(k-p*2+n-1, n-j);
        tmp = tmp*comb(p, j)%MOD;
        tmp = tmp*modpow(2, j)%MOD;
        ans = (ans+tmp)%MOD;
      }
    } else {
      rep(j, p) {
        ll tmp = comb(k-p*2+n, n-j);
        tmp = tmp*comb(p-1, j)%MOD;
        tmp = tmp*modpow(2, j)%MOD;
        ans = (ans+tmp)%MOD;
      }
      rep(j, p) {
        ll tmp = comb(k-p*2+n-1, n-j-1);
        tmp = tmp*comb(p-1, j)%MOD;
        tmp = tmp*modpow(2, j)%MOD;
        ans = (ans+tmp)%MOD;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

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

using ll = long long;
using ld = long double;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


int main(){
    FIN;
    ll n,q;
    cin >> n >> q;
    dsu d(n);
    for(ll i=0;i<q;i++){
        ll t,u,v;
        cin >> t >> u >> v;
        if(t == 0) d.merge(u,v);
        else cout << d.same(u,v) << endl;
    }

    return 0;
}

Measured memory_bytes: 3964
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)


int main() {

	string S[2];
	rep(i, 2) {
		char str[123];
		scanf("%s", str);
		S[i] = str;
	}

	rep(i, S[0].size()) {
		if (S[0] == S[1]) {
			printf("Yes\n");
			return 0;
		}
		char c = *(S[0].end() - 1);
		S[0].erase(S[0].end() - 1);
		S[0] = c + S[0];
	}

	printf("No\n");
	
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>


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

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)







int main(){
    int x;
    cin >> x;
    cout << x * x * x << endl;
}


Measured memory_bytes: 3100
#include <iostream>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
  long long a,b,x;
  cin>>a>>b>>x;
  long long answer=b/x-a/x;
  if(a%x==0) answer+=1;
  cout<<answer<<endl;
  
  return 0;
}

Measured memory_bytes: 3612
while (True):
    a,op,b = input().split()
    a = int(a)
    b = int(b)
    if op == "?":
        break
    elif op == "/":
        print(a//b)
    elif op == "+":
        print(a+b)
    elif op == "-":
        print(a-b)
    else :
        print(a*b)


Measured memory_bytes: 5596
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(long long i=(long long)(a);i<(long long)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int n, ans_a, ans_b, ans_c;
vi l(8);
int DFS(int i, int a, int b, int c){
	if(i==n&&a>0&&b>0&&c>0){
		return abs(ans_a-a)+abs(ans_b-b)+abs(ans_c-c)-30;
	} else if(i==n){
		return 1e9;
	}

	int ret0=DFS(i+1, a+l[i], b, c)+10;

	int ret1=DFS(i+1, a, b+l[i], c)+10;

	int ret2=DFS(i+1, a, b, c+l[i])+10;

	int ret3=DFS(i+1, a, b, c);

	return min(ret0, min(ret1, min(ret2, ret3)));
}
int main(void)
{
	cin>>n>>ans_a>>ans_b>>ans_c;

	rep(i, n) cin>>l[i];

	cout<<DFS(0, 0, 0, 0)<<endl;
}


Measured memory_bytes: 256
judge :: String -> Bool
judge c = head c == c !! 5 && c !! 1 == c !! 4 && c !! 2 == c !! 3

yesno :: Bool -> String
yesno b = if b then "YES" else "NO"

main :: IO ()
main = getContents >>= putStrLn . yesno . judge . concat . lines


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

int main(){
    int n, k;
    cin >> n >> k;
    bool judge[n];

    for(int i = 0; i < n; i++){
        judge[i] = false;
    }

    for(int i = 0; i < k; i++){
        int d;
        cin >> d;

        int sunuke[d];
        for(int j = 0; j < d; j++){
            cin >> sunuke[j];
            judge[sunuke[j] - 1] = true;
        }
    }

    int sum = 0;
    for(int i = 0; i < n; i++){
        if(judge[i] == false) sum++;
    }

    cout << sum << endl;

    return 0;
}

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

int main() {
	int n;
	cin >> n;
	long long ans = 0;
	vector< int> in_n;
	for (int i = 0; i < n; i++) {
		long h;
		cin >> h;
		in_n.push_back(h);
	}
	vector< int> b;
	for (int i = 0; i < n; i++) {
		long h;
		cin >> h;
		b.push_back(h);
	}
	vector< int> c;
	for (int i = 0; i < n-1; i++) {
		long h;
		cin >> h;
		c.push_back(h);
	}
	int pred = -4;
	for (int i = 0; i < n; i++) {
		ans += b.at(in_n.at(i) - 1);
		if (in_n.at(i) - 2 == pred) {
			ans += c.at(in_n.at(i) - 2);		
		}
		pred = in_n.at(i) - 1;
	}
	cout << ans;
}


Measured memory_bytes: 256
#include<stdio.h>
signed main(){
int a,b,c;
c = 0;
	scanf("%d %d",&a,&b);
	if(0<=a-13){
	printf("%d\n",b);
}
else{
	if(0<=a-6){
	printf("%d\n",b/2);
}
	else
	printf("%d\n",c);
}
return (0);
}


Measured memory_bytes: 128
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
template<class Read>void in(Read &x){
    x=0;
    int f=0;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        f|=(ch=='-');
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    x=f?-x:x;
    return;
}
int x,y;
int main(){
	in(x);in(y);
    cout<<(x+y-1)/y<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
inline long long mod(long long n,long long m){return(n%m+m)%m;}
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    int x,y,z,k; cin>>x>>y>>z>>k;
    long long a[x]; rep(i,x) cin>>a[i];
    long long b[y]; rep(i,y) cin>>b[i];
    long long c[z]; rep(i,z) cin>>c[i];
    vector<long long> sum;
    for(int i=0;i<x;i++){
        for(int j=0;j<y;j++){
            sum.push_back(a[i]+b[j]);
        }
    }
    sum.push_back(0);
    sort(all(sum));
    reverse(all(sum));
    sort(c,c+z);
    reverse(c,c+z);
    int cid[z]={};
    for(int i=0;i<k;i++){
        long long ans=0;
        int id;
        for(int j=0;j<z;j++){
            long long s=sum[cid[j]]+c[j];
            if(ans<=s){
                ans=s;
                id=j;
            }
        }
        cid[id]++;
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 10476
#pragma region RegionDefs
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,l,r) for(int i=(l),i##_len=(r);i<i##_len;++i)
#define all(x) begin(x),end(x)
using namespace std;
typedef long long ll;
const ll INF = 1e9;
template<class T=ll> using V = vector<T>;
template<class T=ll> using PQ = priority_queue<T>;
template<class T=ll> using PQG = priority_queue<T, V<T>, greater<T>>;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail) { cin >> head; in(move(tail)...); }
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define INS(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
template<class T>bool chmax(T &a, const T &b) {if (a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if (a>b) {a=b; return 1;} return 0;}
#define y0 y__0
#define y1 y__1
#define j0 j__0
#define j1 j__1
#define YN(e) cout << ((e) ? "YES" : "NO") << endl
#define yn(e) cout << ((e) ? "Yes" : "No") << endl
#pragma endregion RegionDefs

void solve()
{
    IN(n);
    VIN(ll, v, n);
    ll s = 0;
    rep(i, n) {
        s ^= v[i];
    }
    rep(i, n) {
        cout << (s ^ v[i]) << " ";
    }
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

Measured memory_bytes: 4764
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
   int a,b,c;
   cin>>a>>b>>c;
   if(c-(a-b)<0)
   {
   	cout<<0<<endl;
   }
   else
   {
   	cout<<c-(a-b)<<endl;
   }
}


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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using ii = pair<int, int>;
using vii = vector<ii>;

#define rep(i, n)   for (int i = 0; i < (n); i++)
#define sz(x)       (int)(x).size()
#define eb          emplace_back
#define pb          push_back
#define all(x)      (x).begin(), (x).end()
#define rall(x)     (x).rbegin(), (x).rend()
#define fi          first
#define se          second

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifdef LOCAL
    freopen("io\\in.txt", "r", stdin);
    freopen("io\\out.txt", "w", stdout);
#endif

    int n;
    cin >> n;
    vii a(n);
    rep(i, n) cin >> a[i].fi >> a[i].se;

    int l, r;
    vi t(n);

    sort(all(a));
    l = a[n / 2].fi;
    if (~n & 1) l += a[n / 2 - 1].fi;

    sort(all(a), [](ii& a, ii& b) {
        if (a.se < b.se) return true;
        return false;
    });
    r = a[n / 2].se;
    if (~n & 1) r += a[n / 2 - 1].se;

    cout << r - l + 1;

    return 0;
}


Measured memory_bytes: 5556
import sys

n = int(sys.stdin.readline().rstrip())
csf = list(zip(*[map(int, sys.stdin.read().split())] * 3))

def main(): 
    take_time = [None] * n

    for i in range(n):
        cur = i
        t = 0
        while cur < n - 1:
            c, s, f = csf[cur]
            if t < s:
                t = s
            else:
                t = s + f * ((t - s + f - 1) // f)
            t += c
            cur += 1
        take_time[i] = t
    return take_time
        
if __name__ == '__main__':
    ans = main()
    print(*ans, sep='\n')

Measured memory_bytes: 3188
/*Lucky_Glass*/
#include<queue>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

inline int Read(){
	register int r=0,c=getchar();
	while(c<'0' || '9'<c) c=getchar();
	while('0'<=c && c<='9') r=(r<<1)+(r<<3)+c-'0',c=getchar();
	return r;
}

#define cs const int &
const int N=5e5+10;

int n,m,num[N],ans[N];
priority_queue< int,vector<int>,greater<int> > que;

struct SEGTREE{
	int mn[N<<1],inf;
	SEGTREE(){memset(mn,0x3f,sizeof mn),inf=mn[0];}
	#define idx(l,r) (((l)+(r))|((l)!=(r)))
	inline void PushUp(cs le,cs ri){
		int mi=(le+ri)>>1;
		mn[idx(le,ri)]=min(mn[idx(le,mi)],mn[idx(mi+1,ri)]);
	}
	inline void Modify(cs le,cs ri,cs po,cs key){
		if(le==ri){mn[idx(le,ri)]=key;return;}
		int mi=(le+ri)>>1;
		if(po<=mi) Modify(le,mi,po,key);
		else Modify(mi+1,ri,po,key);
		PushUp(le,ri);
	}
	inline int Query(cs le,cs ri,cs Le,cs Ri){
		if(Le>Ri || ri<Le || Ri<le) return inf;
		if(Le<=le && ri<=Ri) return mn[idx(le,ri)];
		int mi=(le+ri)>>1;
		return min(Query(le,mi,Le,Ri),Query(mi+1,ri,Le,Ri));
	}
}Se;

struct GRAPH{
	int head[N],nxt[N<<1],to[N<<1],du[N],ncnt;
	void AddEdge(int u,int v){
		ncnt++;
		nxt[ncnt]=head[u],to[ncnt]=v,head[u]=ncnt;
		du[v]++;
	}
	int operator [](const int &u){return head[u];}
}Gr;

int main(){
	n=Read(),m=Read();
	for(int i=1;i<=n;i++) num[Read()]=i;
	for(int i=n;i>=1;i--){
		int j=Se.Query(1,n,num[i]+1,num[i]+m-1),k=Se.Query(1,n,num[i]-m+1,num[i]-1);
		if(j!=Se.inf) Gr.AddEdge(num[i],num[j]);
		if(k!=Se.inf) Gr.AddEdge(num[i],num[k]);
		Se.Modify(1,n,num[i],i);
	}
	for(int i=1;i<=n;i++)
		if(!Gr.du[i])
			que.push(i);
	int nans=0;
	while(!que.empty()){
		int u=que.top();que.pop();
		ans[u]=++nans;
		for(int it=Gr[u];it;it=Gr.nxt[it]){
			Gr.du[Gr.to[it]]--;
			if(!Gr.du[Gr.to[it]])
				que.push(Gr.to[it]);
		}
	}
	for(int i=1;i<=n;i++)
		printf("%d\n",ans[i]);
	return 0;
}

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

typedef long long ll;

int N;
ll A[200010];
map<ll,ll> mp;

int main()
{
    scanf("%d",&N);
    ll sum = 0;
    for(int i = 0; i < N; i++)
    {
        scanf("%lld",A + i);
        sum += A[i];
        mp[sum]++;
    }

    ll ans = 0;
    sum = 0;
    for(int i = 0; i < N; i++)
    {
        if(i)mp[sum]--;
        ans += mp[sum];
        sum += A[i];
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 14336
/*

                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                    prayer
*/

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(_,v.size())cout<<" "<<v[_];cout<<endl;
#define show2d(v) rep(__,v.size()){rep(_,v[__].size())cout<<" "<<v[__][_];cout<<endl;}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int> tp;
// typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
//nCr mod m
int MOD;
#define M 3100
vector<ll> fact;
bool h=false;
void init(){
	h=true;
	fact=vector<ll>(M);
	fact[0]=fact[1]=1;
	loop(i,2,M)fact[i]=fact[i-1]*i%MOD;
}
// a^b mod MOD
ll powmod(ll a,ll b,ll m=MOD){
	ll out=1;
	ll p=a%m;
	while(b){
		if(b&1)out=out*p%m;
		p=p*p%m;
		b>>=1;
	}
	return out;
}
//nCr
ll nCr(ll n,ll r,ll m=MOD){
	if(!h)init();
	if(n<0||r<0||n<r)return 1;//??????
	ll out=fact[n]*powmod(fact[r]*fact[n-r]%m,m-2,m)%m;
	return out;
}
int star[M][M];
signed main(){
	int n;
	cin>>n>>MOD;
	star[0][0]=1;
	loop(i,1,M)loop(j,1,i+1)star[i][j]=(star[i-1][j-1]+j*star[i-1][j]%MOD)%MOD;
	
	int out=0;
	rep(i,n+1){
		int sum=0;
		rep(j,i+1)(sum+=star[i+1][j+1]*powmod(2,(n-i)*j%MOD))%=MOD;
		(out+=(MOD+(i%2?-1:1)*(nCr(n,i)*sum%MOD*powmod(2,powmod(2,n-i,MOD-1))%MOD))%MOD)%=MOD;
	}
	cout<<out<<endl;
}















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

int main() {
    double a, b, C;
    cin >> a >> b >> C;
    double PI = acos(-1);
    double rad = C * PI / 180;

    double S = a * b * sin(rad) / 2;
    double c = sqrt(a * a + b * b - 2 * a * b * cos(rad));
    double L = a + b + c;
    double h = 2 * S / a;
    printf("%lf %lf %lf\n", S, L, h);
}

Measured memory_bytes: 1232
#include <iostream>
#include <string>
#include <set>
#include <cctype>
#include <vector>
#include <map>
#include <queue>
#include <list>
#include <algorithm>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <limits>
#include <cmath>
#include <typeinfo>

using namespace std;



int main() {
    int N = 0, K = 0;
    string S("");
    
    cin >> N >> K;
    cin >> S;
    
    S[K-1] += 32;
    
    cout << S << endl;

    return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
A = []

for _ in range(H):
    a = input()
    A.append(a)

result = []
temp = []

for a in A:
    flag = True
    for s in a:
        if s != '.':
            flag = False
            break
    if not flag:
        temp.append(a)

idx = []

for i in range(W):
    flag = True
    for s in temp:
        if s[i] != '.':
            flag = False
            break
    if not flag:
        idx.append(i)

for s in temp:
    t = ''
    for i in idx:
        t += s[i]
    result.append(t)

print(*result, sep='\n')




Measured memory_bytes: 3064
#include<iostream>

using namespace std;

int main(void){
  int n,i;
  long long sum;


  while(1){
    cin >> n;
    if(n==0)break;

    sum=0;
    for(int i=1;i*i<n;i++){
      if(n%i==0){
	sum+=i;   
	if(i!=1)sum+=n/i;
      }
    }
    if(n==sum)cout << "perfect number" << endl;
    else if(n<sum)cout << "abundant number" << endl;
    else cout << "deficient number" << endl;
  }

  return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
	int n,k;
	int i;
	
	scanf("%d %d",&n,&k);
	for(i=0;n!=0;i++){
		n=n/k;
	}
	printf("%d",i);
	return 0;
}


Measured memory_bytes: 128
import sys
import itertools
# import numpy as np
import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import permutations
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
S = input()
K = int(input())
ans = 0

S = list(S)
def f(T):
    ret = 0
    l = 0
    r = 1
    n = len(T)
    while l < n:
        while r < n and T[l] == T[r]:
            r += 1
        c = r - l
        ret += c // 2
        l = r
        r = l + 1
    return ret

first = f(S)
second = f(S + S)
diff = second - first

if len(set(S)) == 1:
    print(len(S) * K // 2)
else:
    print(first + diff * (K - 1))

Measured memory_bytes: 65248
n = int(input())
a = [0]
a += list(map(int, input().split()))
a.append(0)

a_sum = 0
for i in range(n + 1):
  a_sum += abs(a[i] - a[i+1])

for i in range(1, n+1):
  if (a[i-1] <= a[i] and a[i] <= a[i+1]) or (a[i-1] >= a[i] and a[i] >= a[i+1]):
    print(a_sum)
  else:
    print(a_sum - 2 * min(abs(a[i] - a[i+1]), abs(a[i-1] - a[i])))


Measured memory_bytes: 14048
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define N 100

int main(void){
  int i=0, ans=0, y;
  int num[N];
  char s[N];
  
  while(scanf("%s",s) != EOF){

    if(s[0] == '+'){
      ans = num[i-2] + num[i-1];
     num[i-2] = ans;
      i--;
    }

    else if(s[0] == '-'){
      ans = num[i-2] - num[i-1];
      num[i-2] = ans;
      i--;
    }

    else if(s[0] == '*'){
      ans = num[i-2] * num[i-1];
      num[i-2] = ans;
      i--;
    }

    else{
      y = atoi(s);
      num[i] = y;
      i++; 
    }
  
  }
  printf("%d\n", num[0]);
  return 0;
}

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

using namespace std;
using ll = long long;

#define rep(i, a) for (int (i) = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int (i) = (int) (a); (i) < (int) (b); (i)++)
#define MP(a, b) make_pair((a), (b))
#define pb(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define TRUE__ "Yes"
#define FALSE__ "No"
#define CIN(type, x) type x;cin >> x

#ifdef LOCAL
	#define lcout(a) cout << a;
	#define lcoutln(a) cout << a << endl;
	#define lcerr(a) cerr << a;
	#define lcerrln(a) cerr << a << endl;
#else
	#define lcout(a) 
	#define lcoutln(a) 
	#define lcerr(a) 
	#define lcerrln(a) 
#endif
#define int long long
int cost[200][200];
vector<int> r;
#define INF 1e18



void init()
{
	rep(i, 200) rep(j, 200) cost[i][j] = INF;
}

signed main()
{
	init();
	CIN(int, N);
	CIN(int, M);
	CIN(int, R);
	rep(i, R) {
		CIN(int, t);
		r.pb(t);
	}
	sort(all(r));
	rep(i, M) {
		CIN(int, A);
		CIN(int, B);
		CIN(int, C);
		cost[A-1][B-1] = cost[B-1][A-1] = C;
	}
	rep(k, N) rep(i, N) rep(j, N) {
		cost[i][j] = min(cost[i][j], cost[i][k]+cost[k][j]);
    }
	int res = INF;
	do {
		int t = 0;
		rep(i, R-1) {
			t += cost[r[i]-1][r[i+1]-1];
		}
		res = min(res, t);
	} while (next_permutation(all(r)));
	cout << res << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define inf 9223372036854775807
#define mini 9223372036854775807
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
pair<ll,ll>s4[4]={{-1,0},{1,0},{0,-1},{0,1}};
pair<ll,ll>s8[8]={{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,1},{1,0},{1,-1}};
ll power(ll a,ll b)
{
	if(b==0)
		return 1;
	ll c=power(a,b/2);
	if(b%2==0)
		return ((c%mod)*(c%mod))%mod;
	else
		return ((((c%mod)*(c%mod))%mod)*a)%mod;
}
ll dp[3000005];
ll a[105][105];
ll n,k;
ll func(ll i)
{
//	cout<<i<<endl;
	if(dp[i]!=-1)
		return dp[i];
	ll sum=0;
	ll r=__builtin_popcount(i);
	if(r>=n)
		return 1;
	ll j,k=1;
	for(j=0; j<n; j++)
	{
		if(a[r][j]==1 && (i&k)==0)
		{
			sum=((sum%mod)+(func(i|k)%mod))%mod;
		}
		k*=2;
	}
	return dp[i]=sum;
}
int main()
{
	boost
	cin>>n;
	ll i,j;
	for(i=0; i<3000005; i++)
		dp[i]=-1;
	for(i=0; i<n; i++)
	{
		for(j=0; j<n; j++)
			cin>>a[i][j];
	}
	ll ans=func(0);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 23680
import java.util.*;

public class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] member = new int[N];
    for(int i = 0 ; i < N - 1 ; i++){
      member[sc.nextInt() - 1]++; 
    }
      for(int j = 0 ; j < N ; j++){
        System.out.println(member[j]);
      }
        
	
	}
}

Measured memory_bytes: 61260
def main():
    K,S = map(int,input().split())

    count = 0
    for x in range(max(0,S - 2*K), K + 1):
        for y in range(max(0,S - x - K), K + 1):
            if 0 <= S - x - y <= K:
                count += 1
    print(count)

if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdio.h>

using namespace std;

typedef long long ll;

ll n, d;
ll x, y;
ll res;

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

	while (n--) {
		cin >> x >> y;
		if (x * x + y * y <= d * d) {
			res++;
		}
	}

	cout << res << endl;

	return 0;
}

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

int main() {
  string s; cin >> s;
  int N = s.size();
  int res = N;
  for (int i = 0; i < N-1; i++) {
    if (s[i]!=s[i+1]) {
      int x = max(i+1, N-i-1);
      res = min(x, res);
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <cmath>
using namespace std;
long long INF=1000000000000;
int main(){
	long long a,b,c,x,y,ans=INF,t;
	cin>>a>>b>>c>>x>>y;
	t=c*max(x,y)*2;
	ans=min(t,ans);
	t=a*x+b*y;
	ans=min(t,ans);
	t=c*min(x,y)*2;
	if(x>y){
		t+=a*(x-y);
	}
	else {
		t+=b*(y-x);
	}
	ans=min(t,ans);
	cout<<ans<<endl;
}

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

using namespace std;

int main()
{
	long long  k, a, b;
	cin >> k >> a >> b;

	if (k <= a)
	{
		k += 1;
		printf("%lld", k);
		return 0;
	}

	if (b <= a + 2)
	{
		k += 1;
		printf("%lld", k);
		return 0;
	}

	long long num = k - a - 1;
	int t = num % 2;
	num /= 2;
	num *= b - a;
	num += b;
	num += t;

	printf("%lld", num);

	return 0;
}


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

int main() {
	string S;
	cin >> S;
	int size = S.size();
	sort(S.begin(),S.end());
	S.erase(unique(S.begin(), S.end()), S.end());
	if (size == S.size()) {
		cout << "yes"<<endl;
	}
	else {
		cout << "no"<<endl;
	}
}


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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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

// a^n mod を計算する
lli modpow(lli a, lli n, lli mod) {
    lli res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^-1
lli modinv(lli a, lli mod) {
    lli b = mod, u = 1, v = 0;
    while (b) {
        lli t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= mod;
    if (u < 0) u += mod;
    return u;
}

lli popCount(lli now){
    lli cnt=0;
    while(now>0){
        if(now%2==1){
            cnt++;
        }
        now/=2;
    }
    return cnt;
}

void func(long long N, std::string X){

    lli start = 0;
    REP(i,0,N){
        if(X[i]=='1')start++;
    }

    lli modP = start+1;
    lli modL = start-1;

    lli baseP = 0;
    lli two = 1;

    for(lli i = N-1;i>=0;i--){
        if(modP<=0)break;
        if(X[i]=='1'){
            baseP += two;
            baseP %= modP;
        }
        two *= 2;
        two %= modP;
    }

    lli baseL = 0;
    two = 1;
    for(lli i = N-1;i>=0;i--){
        if(modL<=0)break;
        if(X[i]=='1'){
            baseL += two;
            baseL %= modL;
        }
        two *= 2;
        two %= modL;
    }

    LOG2(baseP,modP);
    LOG2(baseL,modL);
    REP(i,0,N){
        lli now;
        if(X[i]=='0'){
            if(modP<=0){
                cout<<0<<endl;
                continue;
            }
            now = baseP;
            now += modpow(2,(N-1-i),modP);
            now %= modP;
        }
        else{
            if(modL<=0){
                cout<<0<<endl;
                continue;
            }
            now = baseL;
            now = now + modL - modpow(2,(N-1-i),modL);
            now %= modL;
        }
        LOG2(i,now);
        if(now==0){
            cout<<1<<endl;
            continue;;
        }
        lli cnt = 1;
        while(now!=0){
            LOG2(i,now);
            now = now%popCount(now);
            cnt++;
        }
        cout<<cnt<<endl;
    }


}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    std::string X;
    std::cin >> X;
    func(N, X);
    return 0;
}


Measured memory_bytes: 4000
#include<stdio.h>
int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        int a[102];
        int i,j;
        for(i=0; i<n; i++)
        {
            scanf("%d",&a[i]);
        }
        int k;
        for(k=0; k<n; k++)
        {
            if(k==n-1)
                printf("%d\n",a[k]);
            else
                printf("%d ",a[k]);
        }
        for(i=1; i<n; i++)
        {
            int key=a[i];
            j=i-1;
            while(j>=0&&key<a[j])
            {
                a[j+1]=a[j];
                j--;
            }
            a[j+1]=key;
            for(k=0; k<n; k++)
            {
                if(k==n-1)
                    printf("%d\n",a[k]);
                else
                    printf("%d ",a[k]);
            }
        }

    }
    return 0;
}



Measured memory_bytes: 2044
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	
	public static void main(String[] args) {
		Main m = new Main();
		m.run();
	}
	
	void run() {
		
		int r = sc.nextInt();
		int g = sc.nextInt();
		int b = sc.nextInt();
		int n = sc.nextInt();
		
		long dp[] = new long[n+5000];
		dp[0] = 1;
		
		for(int i = 0; i < n ; i++) {
			dp[i+r] += dp[i]; 
		}
		for(int i = 0; i < n ; i++) {
			dp[i+g] += dp[i]; 
		}

		for(int i = 0; i < n ; i++) {
			dp[i+b] += dp[i]; 
		}
		
		System.out.println(dp[n]);
	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")


int main() {
    ll n; cin >> n;
    vector<ll> a(n);
    ll countZero = 0,countX = 0, countY = 0, countZ = 0;;
    ll x = -1;
    ll y = -1;
    ll z = -1;

    rep(i,n) {
        cin >> a[i];
        if(a[i] == 0) countZero ++;
        else{
            if(a[i] == x){
                countX ++;
            }else if(a[i] == y) {
                countY ++;
            }else if(a[i] == z){
                countZ ++;
            }else if(x == -1){
                x = a[i];
                countX ++;
            }else if(y == -1){
                y = a[i];
                countY ++;
            }else if(z == -1){
                z = a[i];
                countZ ++;
            }else {
                cout << "No";
                return 0;
            }
        }
    }

    if(countZero == n){
        cout << "Yes";
        return 0;
    }

    if(countZero == n/3 && countX == n/3*2){
        cout << "Yes";
        return 0;
    }

    int tmp = (x^y)^z;

    if(countX == n/3 && countY == n/3 && countZ == n/3 && (tmp == 0)){
        cout << "Yes";
        return 0;
    }


    cout << "No";


    return 0;
}


Measured memory_bytes: 4056
n = int(input())
sl = [int(input()) for i in range(n)]
c = sl[0] // 2
sl[0] %= 2
for i in range(1,n):
  if sl[i-1] and sl[i]:
    sl[i] -= 1
    c += 1
  c += sl[i] // 2
  sl[i] %= 2
print(c)

Measured memory_bytes: 7072
import Data.List
import Control.Monad

solve :: [[Int]] -> Int -> Double
solve xss n = (sum $ map dist $ permutations xss) / (fromIntegral $ product [1..n])
    where
        dist :: [[Int]] -> Double
        dist ([_,_]:[]) = 0
        dist ([a,b]:[c,d]:xs) = x + dist ([c,d]:xs)
            where
                x :: Double
                x = sqrt . fromIntegral $ ((a-c)^2) + ((b-d)^2)


main = do
    n <- readLn :: IO Int
    xss <- replicateM n (map read . words <$> getLine) :: IO [[Int]]
    print $ solve xss n

Measured memory_bytes: 2172
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;

int main()
{
    string s;
    cin >> s;

    int i = 0;
    int j = s.size()-1;
    int cnt = 0;
    while (i<j)
    {
        if (s[i]!=s[j]) ++cnt;
        ++i, --j;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int acm(int n)
{
    int rest=0;
    int ans=n;
    while(n!=0)
    {
       rest*=10;
       rest+=n%10;
       n/=10;
    }
    if(rest==ans)
        return 1;
    return 0;
}
int main()
{
    int a,b;
    int flag=0;
    scanf("%d%d",&a,&b);
    for(int i=a;i<=b;i++)
    {
        if(acm(i)==1)
            flag++;
    }
    printf("%d\n",flag);
    return 0;
}


Measured memory_bytes: 128