akhauriyash/Code-Regression huggingface dataset:
//B - Distance
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>

#define LL long long
#define Lowbit(X) (X&(-X))
#define Lson (X<<1)
#define Rson (X<<1|1)
#define Cl(X,Y) memset((X),(Y),sizeof(X))
#define FOR(i,A,B) for(LL i=A;i<=B;i++)
#define BOR(i,A,B) for(LL i=A;i>=B;i--)
#define FOR_SIDE(i,A) for(LL i=Head[A];i;i=Next[i])
#define INF 0x7fffffff
using namespace std;
const int MAXN=2e5+10;

int Total,X[MAXN],Y[MAXN],Cnt;
double Limit;

inline void File() {
    freopen(".in","r",stdin);
    freopen(".out","w",stdout);
}

int main() {
    //File();
    scanf("%d %lf",&Total,&Limit);
    FOR(i,1,Total) { 
        scanf("%d %d",&X[i],&Y[i]);
        double Dist=sqrt(1.0*X[i]*X[i]+1.0*Y[i]*Y[i]);
        if(Dist<=Limit) Cnt++;
    }
    printf("%d\n",Cnt);
    //fclose(stdin); fclose(stdout);
    //system("pause");
    return 0;
}

Measured memory_bytes: 5412
use proconio::input;
use std::collections::BTreeSet;
use std::ops::Bound::{Included, Excluded};

fn solve(n: usize, m: usize, h: Vec<i32>, ab: Vec<(usize, usize)>) -> usize {
    let mut e = BTreeSet::new();
    for (a, b) in ab {
        e.insert((a - 1, b - 1));
        e.insert((b - 1, a - 1));
    }
    (0..n)
        .filter(|&i|
            e.range((Included(&(i, 0)), Excluded(&(i + 1, 0))))
                .all(|&(_, b)| h[i] > h[b])
        )
        .count()
}

fn main() {
    input! {
        n: usize,
        m: usize,
        h: [i32; n],
        ab: [(usize, usize); m],
    }
    let r = solve(n, m, h, ab);
    println!("{}", r);
}


Measured memory_bytes: 11964
from operator import itemgetter
n, m = map(int, input().split())
py = []
for i in range(m):
    a, b = map(int, input().split())
    py.append([a, b, i])
py.sort()
py[0][1] = 1
for i in range(m-1):  
    if py[i+1][0] == py[i][0]:
        py[i+1][1] = py[i][1] + 1
    else:
        py[i+1][1] = 1
py.sort(key=itemgetter(2))

for i in range(m):
    a, b = str(py[i][0]), str(py[i][1])
    print(a.zfill(6)+b.zfill(6))

Measured memory_bytes: 24884
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
  int x, n;
  cin >> x >> n;
  int p[n];
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  
  for (int d = 0; d < 100; d++) {
    if (find(p, p + n, x - d) != p + n) {
      if (find(p, p + n, x + d) != p + n) {
        continue;
      } else {
        cout << x + d;
        return 0;
      }
    } else {
      cout << x - d;
      return 0;
    }
  }
  
  return 0;
}

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

int main(){
  int n;
  cin>>n;
  int arr[n];
  for (int i=0;i<n;++i){
    cin>>arr[i];
  }
  int index = 1;
  for (int i=0;i<n;++i){
    if (arr[i]==index){
      index++;
    }
  }
  if (index-1==0){
      cout<<-1;
  }
  else{
      cout<<n-index+1;
  }
  
}

Measured memory_bytes: 1024
#include <stdio.h>
  int main ()
    {

        int a[30];

        int i, j, n;
        for (i = 0; i < 10; ++i)
	        scanf("%d", &a[i]);

        for (i = 0; i < 10; ++i)
        {
            for (j = i + 1; j < 10; ++j)
            {
                if (a[i] < a[j])
                {
                    n = a[i];
                    a[i] = a[j];
                    a[j] = n;
                }
            }
        }
        for (i = 0; i <3; ++i)
        {
            printf("%d\n", a[i]);
        }
    return 0;
    }



Measured memory_bytes: 2048
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

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

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input!(s: chars);
    for i in 0..s.len() - 1 {
        if s[i] == s[i + 1] {
            println!("{} {}", i+1, i + 2);
            return;
        }
    }
    for i in 0..s.len() - 2 {
        if s[i] == s[i + 2] {
            println!("{} {}", i+1, i + 3);
            return;
        }
    }
    println!("-1 -1");
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)

const string YES = "Yes";
const string NO = "No";

void solve(long long N){
    for(ll i=1; i<= 9; i++){
        for(ll j=1; j<= 9; j++)
            if(i*j == N){
                cout << YES << endl;
                return;
            }
    }
    cout << NO << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


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

/*
code credits : ਜ਼ੈਲਦਾਰ
dashan jot singh
*/
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL)
#define pb push_back
#define mp make_pair
#define inf LLONG_MAX
#define p pair<ll,ll>
ll n;
ll arr[100010];
ll dp[100010];
ll k;
ll solve(ll i){
	// if(i==n){
		// return 0;
	// }
	if(i>=n){
		return INT_MAX;
	}
	if(i==n-1){
		return 0;
	}
	if(dp[i]!=-1){
		return dp[i];
	}
	ll ans=INT_MAX;
	for(ll i1=1;i1<=k;i1++){
		if(i+i1<n){
			ans=min(ans,abs(arr[i+i1]-arr[i])+solve(i+i1));
		}
		else{
			break;
		}
	}
	dp[i]=ans;
	return dp[i];
}
int main(){
	fast;
	memset(dp,-1,sizeof(dp));
	cin>>n>>k;
	for(ll i=0;i<n;i++){
		cin>>arr[i];
	}
	cout<<solve(0)<<endl;
	return 0;
}

Measured memory_bytes: 6528
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
class Val{
    public:
        long long a, b, c;
        Val(long long x, long long y, long long z){
            a = x;
            b = y;
            c = z;
        }
        bool operator<(const Val &o) const{
            return (a-b) > (o.a-o.b);
        }
};
int main() {
    std::ios::sync_with_stdio(false);
    
    long x, y, z;
    cin >> x >> y >> z;
    long n = x+y+z;
    long long a[n];
    long long b[n];
    long long c[n];
    vector<Val> li;
    for(long i = 0; i<n; i++){
        cin >> a[i] >> b[i] >> c[i];
        li.push_back(Val(a[i],b[i],c[i]));
    }
    sort(li.begin(),li.end());
    for(long i = 0; i<n; i++){
        a[i] = li[i].a;
        b[i] = li[i].b;
        c[i] = li[i].c;
    }
    priority_queue<long long > pq1;
    long long left[n];
    for(long i = 0; i<n; i++){
        if(i==0){
            left[i] = 0;
        }
        else{
            left[i] = left[i-1];
        }
        left[i] += a[i];
        pq1.push(c[i]-a[i]);
        if(i>=x){
            left[i] += pq1.top();
            pq1.pop();
        }
    }
    priority_queue<long long> pq2;
    long long right[n];
    long len = 0;
    for(long i = n-1; i>=0; i--){
        if(i+1==n){
            right[i] = 0;
        }
        else{
            right[i] = right[i+1];
        }
        right[i] += b[i];
        pq2.push(c[i]-b[i]);
        if(len>=y){
            right[i] += pq2.top();
            pq2.pop();
        }
        len++;
    }
    long long ans = 0;
    for(long i = x-1; i+1<n; i++){
        long long now = left[i];
        long len = n-(i+1);
        if(len>=y){
            now += right[i+1];
            ans = max(ans,now);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8688
use std::io::{self, Read};

fn read_stdin() -> String {
    let mut buffer = String::new();
    io::stdin().read_to_string(&mut buffer).unwrap();
    buffer
}

fn parse_params(s: &str) -> &str {
    let mut it = s.split_whitespace();
    it.next();

    it.next().unwrap()
}

fn main() {
    let buffer = read_stdin();
    let s = parse_params(&buffer);

    let mut prev = 0;
    let mut count = 0;

    for c in s.bytes() {
        if c != prev {
            prev = c;
            count += 1;
        }
    }

    println!("{}", count);
}


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

int main(){
  ll a , b , c , d ;
  cin >> a >> b >> c >> d ;
  ll n ;
  cin >> n ;
  ll one = min(4*a,2*b) ;
  one = min(one,c) ;
  if(n%2 == 0 ) cout << min( (n/2)*d ,n*one ) << endl ;
  if(n%2 == 1 ) cout << min( (n/2)*d + one , n*one ) << endl;
}

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

typedef long long int ll;

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

	ll n, d;
	cin >> n >> d;
	int cnt = 0;
	for (int i = 0; i < n; i++){
		ll x, y;
		cin >> x >> y;
		if (x*x + y*y <= d*d) cnt++;
	}
	cout << cnt << '\n';
}

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

namespace ConsoleApp
{
     class Program
     {
          static void Main(string[] args)
          {
          var s = Console.ReadLine().Split();
          int i = int.Parse(s[0]);
          int j = int.Parse(s[1]);
          int k = int.Parse(s[2]);
          Console.WriteLine((i - k)/(k + j));
          }
     }
}

Measured memory_bytes: 11092
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
#define MAX 100100
inline int read()
{
	int x=0;bool t=false;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-')t=true,ch=getchar();
	while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
	return t?-x:x;
}
int n,a[MAX],b[MAX],ans;
int main()
{
	n=read();
	for(int i=1;i<=n;++i)b[i]=a[i]=read();
	sort(&b[1],&b[n+1]);
	for(int i=1;i<=n;++i)a[i]=lower_bound(&b[1],&b[n+1],a[i])-b;
	for(int i=1;i<=n;++i)ans+=abs(a[i]-i)&1;
	printf("%d\n",ans>>1);
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repn(i, n) for(int i = 1; i <= n; i++)
#define repr(i, n) for(int i = n-1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define lint long long

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

    long max_a = -1e7, min_a = 1e7;
    int max_i, min_i;
    rep(i, n){
        int x; cin >> x;
        if(x > max_a){
            max_a = x;
            max_i = i;
        }
        if(x < min_a){
            min_a = x;
            min_i = i;
        }
    }

    if(max_a > 0 && min_a < 0){
        cout << n * 2 - 1 << endl;
        if(max_a + min_a > 0){
            min_a = 1;
            rep(i, n){
                cout << max_i+1 << " " << (i+1) << endl;
            }
        }
        else{
            max_a = -1;
            rep(i, n){
                cout << min_i+1 << " " << (i+1) << endl;
            }
        }
    }
    else cout << n - 1 << endl;

    if(max_a >= 0 && min_a >= 0){
        rep(i, n-1){
            cout << (i+1) << " " << (i+2) << endl;
        }
    }
    else{
        rep(i, n-1){
            cout << (n-i) << " " << (n-i-1) << endl;
        }
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *a,int n,char middle=' '){
	for(int i=0;i<n;i++)printf("%d%c",a[i],(i!=n-1?middle:'\n'));
}
void array_show(LL *a,int n,char middle=' '){
	for(int i=0;i<n;i++)printf("%lld%c",a[i],(i!=n-1?middle:'\n'));
}

int main(){
	char ca;
	cin>>ca;
	if(ca=='A')cout<<'T'<<endl;
	if(ca=='T')cout<<'A'<<endl;
	if(ca=='G')cout<<'C'<<endl;
	if(ca=='C')cout<<'G'<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define MAX 100
#define MOD 1000000007
#define pb push_back

// 別解法, aを決め打つ
int main() {
  int n,k;
  cin >> n >> k;

  vector<ll> num(k,0);

  ll ans = 0;
  for (int i = 1; i <= n; ++i) num[i%k]++;

  for (int a = 0; a < k; ++a) {
    int b = (k-a) % k;
    int c = (k-a) % k;
    if ((b+c) % k != 0) continue;
    ans += num[a] * num[b] * num[c];
  }

  cout << ans << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;

vector<int> fac, finv, inv;

void comb_init(int n) {
  fac  = vector<int>(n);
  finv = vector<int>(n);
  inv  = vector<int>(n);
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < n; 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;
  }
}
 
int comb(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

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

  sort(ALL(A));

  comb_init(100010);


  int MAX = 0;
  int MIN = 0;
  REP(i, N){
    (MAX += A[i]*comb(i, K-1)) %= MOD;
    (MIN += A[i]*comb(N-i-1, K-1)) %= MOD;
  }

  cout << ((MAX-MIN)%MOD+MOD)%MOD << endl;

  return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define FOR1(i, n) FOR(i, 1, n+1)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define int long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));
#define myCeil(dividend, divisor) ceil((double)(dividend) / (double)(divisor))
#define myFloor(dividend, divisor) floor((double)(dividend) / (double)(divisor))
#define calcDigits(num) floor(log10(num))+1

#define dl(line) cerr << "RUN: until " << (line) << "th line." << endl;
#define dv(name, value) cerr << (name) << " is " << (value) << endl;
#define da(v)  cerr << "["; REPI(itr, v){cerr << *itr << (itr != --v.end() ? ", " : "");} cerr << "]" << endl;
#define dpa(v) cerr << "[ " << endl;REPI(itr, v) { cerr << "  [" << (*itr).first << ", " << (*itr).second << ']' << (itr != --v.end() ? "," : "") << endl; } cerr << "]" << endl;

signed main(){
  string inpS; cin >> inpS;
  int N = inpS.size();
  deque<char> S;
  REP(x, N){S.push_back(inpS.at(x));} 

  bool isReversed = false;

  int q; cin >> q;
  REP(x, q) {
    int T; cin >> T;
    if (T == 1) {
      isReversed = !isReversed;
    } else
    if (T == 2){
      int a; cin >> a;
      char b; cin >> b;
      if ((!isReversed and a == 1) or (isReversed and a == 2)) {
        S.push_front(b);
      } else
      if ((!isReversed and a == 2) or (isReversed and a == 1)) {
        dv("isRe" ,isReversed);
        S.push_back(b);
      }
    }
  }

  if(isReversed) reverse(S.begin(), S.end());
  REP(x, (ll)S.size()){
    cout << S.at(x); 
  }
  cout << endl;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define MN 200000
long long s[MN+5],S[4],ans=1e18;
int main()
{
	int n,i,j,k,x,y;
	scanf("%d",&n);
	for(i=1;i<=n;++i)scanf("%lld",&s[i]),s[i]+=s[i-1];
	for(i=2;i<n;++i)
	{
		x=lower_bound(s+1,s+n+1,s[i]/2)-s;
		y=lower_bound(s+1,s+n+1,s[i]+(s[n]-s[i])/2)-s;
		for(j=max(1,x-10);j<=min(x+10,i-1);++j)
			for(k=max(i+1,y-10);k<=min(y+10,n-1);++k)
			{
				S[0]=s[j];
				S[1]=s[i]-s[j];
				S[2]=s[k]-s[i];
				S[3]=s[n]-s[k];
				sort(S,S+4);
				ans=min(ans,S[3]-S[0]);
			}
	}
	printf("%lld",ans);
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const long long INF = 1e15;

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

    int n,x;
    cin >> n >> x;
    vector<int> a(n);
    ll ans = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(a[i] > x){
            ans += a[i]-x;
            a[i] = x;
        }
    }
    for(int i = 0; i < n-1; i++){
        if(a[i]+a[i+1] > x){
            ans += a[i]+a[i+1]-x;
            a[i+1] -= a[i]+a[i+1]-x;
        }
    }

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

Measured memory_bytes: 3652
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int L = sc.nextInt();
		String[] input = new String[N];
		for (int i = 0; i < N; i++) {
			input[i] = sc.next();
		}
		Arrays.sort(input);
		for (int i = 0; i < N; i++) {
			System.out.print(input[i]);
		}
	}
}

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

int main() {
	cin.tie(0);
    ios::sync_with_stdio(false);
    
	int n,q,r = 0;
	
	cin >> n;
	int s[n];
	for(int i = 0;i < n;i++){
		cin >> s[i];
	}
	cin >> q;
	int t[n];
	for(int i = 0;i < q;i++){
		cin >> t[i];
	}
	
	for(int i = 0;i < n;i++){
		for(int j = 0;j < q;j++){
			if(s[i] == t[j]){
				r++;
				t[j] = -114514;
			}
		}
	}
    
    cout << r << "\n";
    
    return 0;
}

Measured memory_bytes: 3140
from collections import defaultdict, deque


N, M = map(int, input().split())
heights = [None] + [int(x) for x in input().split()]

G = [[] for _ in range(N + 1)]

for _ in range(M):
  a, b = map(int, input().split())
  G[a].append(b)
  G[b].append(a)


# 連結する枝をすべて調べて良い展望台があれば True
def is_good(tower):
  return heights[tower] > max([heights[t] for t in G[tower]], default=0)


print(sum([is_good(t) for t in range(1, N + 1)]))

Measured memory_bytes: 99884
//--------ROMAN ITERATION -------------
#include <bits/stdc++.h>
#define ll  long long int
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define br cout <<"\n";
#define all(x)  (x).begin(),(x).end()
#define rall(x)  (x).rbegin(),(x).rend()
#define tr(c,i) for(auto i :c)
#define pii pair< int,int >
#define Fast_IO() ios_base::sync_with_stdio(false);cin.tie(0)
#define pq priority_queue< pair<ll,pii> ,vector<pair<ll,pii>>,greater <pair<ll,pii>> >p;//container adapter makes ascending q
#define er(x) cout << x << " "
#define err(x,y) cout << x << " "<<y
#define fix( x ) cout << fixed << setprecision( x ) ;
const int MOD = 1000 * 1000 * 1000 + 7; // odd modulus
const int eps = 1e-9;
using namespace std;
clock_t time_p=clock();
void dem()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
int main()
{
    Fast_IO();
    fix ( 10 );
    double  w ,h , x , y  ;
    cin >> w >> h >> x >> y ;
    cout <<  (w * h )/ 2  <<" "<< (x == w / 2  && y == h / 2  ) ? 1 : 0 ;


    return 0 ;
}



Measured memory_bytes: 256
#Ai/Aj not integer
#5
#24 11 8 3 16
#のときは、24は8,3があるからダメ　16も8があるからダメ
N=int(input())
A=[int(i) for i in input().split()]
D=set()
S=set()
for i in range(N):
    if A[i] in S:
        D.add(A[i])
    else:
        S.add(A[i])
M=max(S)
X=[1 for i in range(M+1)]
for a in S:
    if a in D:
        X[a]=0
    for i in range(2*a,M+1,a):
        X[i]=0
ans=0
for i in range(N):
    if X[A[i]]==1:
        ans+=1
print(ans)


Measured memory_bytes: 39768
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

const int mod = 998244353;
struct mint {
    ll x;
    mint (ll x = 0) : x((x%mod+mod)%mod) {}
    mint operator -() const {return mint(-x);}
    mint& operator +=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator -=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator *=(const mint a) {(x *= a.x) %= mod; return *this;}
    mint operator +(const mint a) const {return mint(*this) += a;}
    mint operator -(const mint a) const {return mint(*this) -= a;}
    mint operator *(const mint a) const {return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    mint inv() const {return pow(mod-2);}
    mint operator /=(const mint a) {return *this *= a.inv();}
    mint operator /(const mint a) {return mint(*this) /= a;}
};
istream& operator >>(istream &is, const mint &a) {return is >> a.x;}
ostream& operator <<(ostream &os, const mint &a) {return os << a.x;}

int main() {
    int n; cin >> n;
    map<int,int> mp;
    int init;
    rep(i,n) {
        int d; cin >> d;
        if (i == 0 && d != 0) {cout << 0 << endl; return 0;} 
        mp[d]++;
    }
    if (mp[0] > 1) {cout << 0 << endl; return 0;}
    mint ans = 1;
    for (P p : mp) {
        if (p.first == 0) continue;
        ans *= mint(mp[p.first-1]).pow(p.second);
    }
    cout << ans << endl;
}

Measured memory_bytes: 8284
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstdlib>
#include <stack>
#include <vector>
#define INF 0x3f3f3f3f
#define MOD 1000000009
# define FOR(i,a,n) for(register int i=a; i<=n; ++i)
# define FDR(i,a,n) for(register int i=a; i>=n; --i)
typedef long long ll;
typedef unsigned long long ull;

inline int scan() {
    int x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}
inline void Out(int a) {
    if(a<0) {putchar('-'); a=-a;}
    if(a>=10) Out(a/10);
    putchar(a%10+'0');
}
using namespace std;
char str[100];
char str1[100] = "azyxwvtlkjihgfedcbusrqponm";
int a[30];
int main()
{
    cin >> str;
    int len = strlen(str);
    if(len < 26)
    {
        for(int i = 0; i < len; i++)
        {
            a[str[i]-'a']++;
        }
        int ji = -1;
        for(int i = 0; i < 26; i++)
        if(a[i] == 0)
        {
            cout << str;
            cout << (char)(i+'a') << endl;
            return 0;
        }
    }
    else
    {
        char str1[100];
        for(int i = 0; i < len; i++)
        {
            a[str[i]-'a']++;
        }
        int j = -1;
        for(int i = len-1; i >= 0; i--)
        {
            for(int j = str[i]-'a'; j < 26; j++)
            if(a[j] == 0)
            {
                str[i] = j+'a';
                for(int j = 0; j <= i; j++)
                cout << str[j];
                cout << endl;
                return 0;
            }
            a[str[i]-'a']--;

//            if(i)
        }
        cout << -1;
        cout << endl;

    }
    return 0;
}
/*
                 ___====-_  _-====___
           _--^^^#####//      \\#####^^^--_
        _-^##########// (    ) \\##########^-_
       -############//  |\^^/|  \\############-
     _/############//   (@::@)   \\############\_
    /#############((     \\//     ))#############\
   -###############\\    (oo)    //###############-
  -#################\\  / VV \  //#################-
 -###################\\/      \//###################-
_#/|##########/\######(   /\   )######/\##########|\#_
|/ |#/\#/\#/\/  \#/\##\  |  |  /##/\#/  \/\#/\#/\#| \|
`  |/  V  V  `   V  \#\| |  | |/#/  V   '  V  V  \|  '
   `   `  `      `   / | |  | | \   '      '  '   '
                    (  | |  | |  )
                   __\ | |  | | /__
                  (vvv(VVV)(VVV)vvv)
                  ÁúÉñ±£ÓÓ ÓÀÎÞbug
*/


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
// constexpr int mod = 1000000007;
constexpr int mod = 998244353;

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

template<typename Monoid>
struct SegmentTree{
    using F = function<Monoid(Monoid, Monoid)>;

    int sz;
    vector<Monoid> seg;

    const F f;      // モノイドに対して二項演算を行う関数オブジェクト
    const Monoid M1;

    SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1){
        sz = 1;
        while(sz < n)   sz <<= 1;
        seg.assign(2 * sz, M1);
    }

    void set(int k, const Monoid &x){
        seg[k + sz] = x;
    }

    void build(){
        for(int k = sz - 1; k > 0; --k){
            seg[k] = f(seg[k << 1], seg[k << 1 | 1]);
        }
    }

    void update(int k, const Monoid &x){
        k += sz;
        seg[k] = x;
        while(k >>= 1){
            seg[k] = f(seg[k << 1], seg[k << 1 | 1]);
        }
    }

    Monoid query(int a, int b){
        Monoid L = M1, R = M1;
        for(a += sz, b += sz; a < b; a >>= 1, b >>= 1){
            if(a & 1)   L = f(L, seg[a++]);
            if(b & 1)   R = f(seg[--b], R);
        }
        return f(L, R);
    }

    Monoid operator[](const int &k) const{
        return seg[k + sz];
    }
};

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

    int n;
    cin >> n;
    SegmentTree<int> seg(n, [](int a, int b){return __gcd(a, b);}, 0);
    for(int i = 0; i < n; ++i){
        int a;
        cin >> a;
        seg.set(i, a);
    }
    seg.build();
    int ans = seg.query(0, n);
    for(int i = 0; i < n; ++i){
        int g = __gcd(seg.query(0, i), seg.query(i + 1, n));
        chmax(ans, g);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1280
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    auto S = sread();
    foreach (i; 0 .. S.length)
        if (i % 2 == 0)
            write(S[i]);
    writeln();
}


Measured memory_bytes: 508
#include<bits/stdc++.h>
using namespace std;
vector<long long> arr;
#define mod 1000000007
bool sudah[1000010];
vector<vector<int> > node;
int cek(int now){
	int x;
	int ans=1;
	sudah[now]=1;

	for(x=0;x<node[now].size();x++){
		if(!sudah[node[now][x]]){
			ans+=cek(node[now][x]);
		}
	}
	return ans;
}
int main(){
	int n,m;
	cin>>n>>m;
	node.resize(n+10);
	while(m--){
		int a,b;
		cin>>a>>b;
		node[a].push_back(b);
		node[b].push_back(a);
	}
	int x;
	int ans=0;
	for(x=1;x<=n;x++){
		if(!sudah[x]){
		ans=max(ans,cek(x));
		}
	}
	cout<<ans<<endl;
}

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

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    string S;
    cin >> N >> S;
    int ans = 0;
    REP(i,10) REP(j,10) REP(k,10){
        int cnt = 0;
        vector<char> c(3);
        c[0] = i + '0', c[1] = j + '0', c[2] = k + '0';
        REP(l,S.size()){
            if(S[l] == c[cnt]){
                cnt++;
                if(cnt >= 3) break;
            }
        }
        if(cnt >= 3) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
N = int(input())
an = [int(i) % 4 for i in input().split()]


def main():
    two = an.count(2)
    four = an.count(0)
    other = N - two - four

    if 0 < two:
        other += 1

    print("Yes" if other - 1 <= four else "No")
    return


main()


Measured memory_bytes: 11100
#include<bits/stdc++.h>
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define popcnt(x) __builtin_popcount(x)
#define inf 0x3f3f3f3f
#define watch(x) cout << (#x) << " is " << (x) << endl
#define rand() (rand() << 15 | rand())
using namespace std;
typedef long long  ll;
#define EPS 1e-9
#define PI acos(-1.0)
set<int> pos[26];
int main() {
   ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
   int n;
   cin >> n;
   string s;
   cin >> s;
   for(int i = 0 ; i < n ; ++i){
      pos[s[i] - 'a'].insert(i);
   }
   int q;
   cin >> q;
   while(q--){
      int t;
      cin >> t;
      if(t == 1){
         int p;
         char c;
         cin >> p >> c;
         p--;
         if(c == s[p])continue;

         pos[s[p] - 'a'].erase(p);
         s[p] = c;
         pos[s[p] - 'a'].insert(p);
      }
      else{
         int l , r;
         cin >> l >> r;
         l-- , r--;
         int ans = 0;
         for(int i = 0 ; i < 26 ; ++i){
            auto it = pos[i].lower_bound(l);
            if(it == pos[i].end() || *it > r)
               continue;
            ans++;
         }
         cout << ans << "\n";
      }
   }
}

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

namespace ABC118D
{
    class MainClass
    {
        static int[] s;
        static int[] a;
        static string[] dp;
        static int[] w = new int[10] { 0, 2, 5, 5, 4, 5, 6, 3, 7, 6 };

        public static void Main(string[] args)
        {

            s = Array.ConvertAll(Console.ReadLine().Split().ToArray(), int.Parse);
            a = Array.ConvertAll(Console.ReadLine().Split().ToArray(), int.Parse);

            Array.Sort(a, delegate (int x, int y)
            {
                return w[x].CompareTo(w[y]);
            });

            dp = new string[s[0] + 1];


           Console.WriteLine(Dp(s[0]));
    



        }



        public static string Dp(int m)
        {
            //Console.WriteLine(m);
            if (dp[m] != null)//calcurated
            {
                return dp[m];
            }
            else
            {
                string tmp = "-1";


                string ans = "-1";
                for (int i = 0; i < a.Length; i++)
                {
                    //Console.WriteLine("now a , w , aleng, i , m: " + a[i] + " " + w[a[i]] + " " + a.Length + " " + i + " " + m);
                    if (m - w[a[i]] == 0)
                    {
                        tmp = a[i].ToString();
                        dp[m] = tmp;
                    }
                    else if (m - w[a[i]] > 0)
                    {
                        int wt = m - w[a[i]];
                        string res = Dp(wt);
                        if (res != "-1")
                        {
                            res = a[i].ToString()+res;
                            tmp = res;
                        }
                    }
                    if (tmp == "-1" && ans == "-1") {
                        ans = "-1"; 
                    }else if (tmp == "-1")
                    {
                        
                    }else if (ans == "-1")
                    {
                        ans = tmp;
                    }
                    else
                    {
                        if (ans.Length == tmp.Length)
                        {
                            if (string.Compare(ans, tmp, StringComparison.Ordinal) > 0)
                            {

                            }
                            else
                            {
                                ans = tmp;
                            }
                        }
                        else if(ans.Length>tmp.Length)
                        {

                        }
                        else
                        {
                            ans = tmp;
                        }
                    }

                }
                dp[m] = ans;
                return ans;
            }
        }
    }
}


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

using namespace std;
const long long INF = 1LL <<60;

int main(void){
  string s,t;
  cin>>s;
  cin>>t;
  long long i,j,k;
  int flg=0;

  int s_len=s.length();
  int t_len=t.length();
  
  if(s_len==t_len-1){
    for(i=0;i<s_len;i++){
      if(s[i]!=t[i]){
        break;
      }
    }
    if(i==s_len){
      cout<<"Yes"<<endl;
      return 0;  
    }
  }
  cout<<"No"<<endl;
  return 0;
  
}    


Measured memory_bytes: 3624
a = int(input())
b = int(input())
c = int(input())
x = int(input())

ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i*500+j*100+k*50 == x:
                ans += 1
print(ans)

Measured memory_bytes: 3060
//Date and time of submission: 
 
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll N=1e5+5;
string s;
int main() {
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	cin>>s;
	for(char ch: s)
	{
	    if(ch==',')
	    cout<<" ";
	    else
	    cout<<ch;
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

#define MOD 1000000007

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

int d[100000 * 3];

int main() {
	int n;
	cin >> n;
	string str;
	cin >> str;
	int a = 0, b = 0;
	int m = 0;
	string ostr = str;
	for (int i = 0; i < n; i++)
	{
		if (str[i] == '(')
			for (int j = 0; j < n - i; j++)
			{
				if (str[i + j] == ')')
				{
					str[i + j] = ' ';
					str[i] = ' ';
					break;
				}
			}
	}
	for (int i = 0; i < str.length(); i++)
	{
		if (str[i] == '(')a++;
		if (str[i] == ')')b++;
	}
	for (int i = 0; i < a; i++)
	{
		ostr = ostr + ")";
	}
	for (int i = 0; i < b; i++)
	{
		ostr = "(" + ostr;
	}
	cout << ostr << endl;
}

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


int main() {
    int k, s;
    cin >> k >> s;

    int res = 0;
    for (int x = 0; x <= k ; ++x) {
        for (int y = 0; y <= k ; ++y) {
            if (s - x - y <= k && s - x - y >= 0) ++res;
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 3488
#include<stdio.h>
#include<algorithm>
using namespace std;

#define MAX 100

void Print(int A[MAX], int N)
{
    for(int i = 0;i < N;i++) {
        if(i == N-1)
            printf("%d",A[i]);
        else
            printf("%d ", A[i]);
    }
    printf("\n");
}

int bubble(int *A,int N)
{
    int counter = 0;
    int flag = 1;
    while(flag) {
        flag = 0;
        for(int j = N-1;j > 0;j--) {
            if(A[j] < A[j-1]) {
                swap(A[j],A[j-1]);
                flag = 1;
                counter++;
            }
        }
    }
    return counter;
}

int main()
{
    int N;
    int A[MAX];

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

    int num = bubble(A,N);
    Print(A,N);
    printf("%d\n",num);

    return 0;
}



Measured memory_bytes: 2696
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define endl '\n'
#define ll long long
#define pi pair<int, int>
#define f first
#define s second

const int mxn = 100002;
int n, k;
ll a[mxn];
ll s[2][mxn];

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> k;
	
	for(int i = 1; i <= n; i++) cin >> a[i];
	
	for(int t = 0; t < 2; t++){
		for(int i = 1; i <= n; i++){
			s[t][i] = max(0ll, a[i]) + s[t][i - 1];
		}
		reverse(a, a + n + 2);
	}
	reverse(s[1], s[1] + n + 2);
	
	for(int i = 1; i <= n; i++) a[i] += a[i - 1];
	
	ll ret = 0xcfcfcfcfcfcfcfcf;
	for(int i = 1; i <= n - k + 1; i++){
		ret = max(ret, s[0][i - 1] + s[1][i + k] + max(0ll, a[i + k - 1] - a[i - 1]));
	}
	
	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 5964
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
 
int main(){
   int n;
   bool ans = false;
   cin >> n;
   int a[n];
   map<int,int> M;
   rep(i,n){
      cin >> a[i];
      M[a[i]]++;
   }
   int val[3];
   int key = 0;
   int i = 0;
   if(M.size() == 3){
      for (auto itr = M.begin(); itr != M.end();++itr){
         key ^= itr -> first;
         val[i] = itr -> second;
         i++;
      }
      if((val[0] == val[2])&&(key == 0))ans = true;
   }
   else if(M.size() == 2){
      for (auto itr = M.begin(); itr != M.end();++itr){
         val[i] = itr -> second;
         i++;
      }
      if(val[0]*2 == val[1])ans = true;
   }
   else if(M.size() == 1){
      map<int,int>::iterator iter = begin(M);
      P p = *iter;
      val[0] = p.first;
      if(val[0] == 0)ans = true;
   }
   (ans)? puts("Yes"):puts("No");
   return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n); i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)	
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define REVSORT(c) SORT(c);REVERSE(c)
#define ALL(x) (x).begin(),(x).end()
#define LOOP while(true)
#define INF 1e9
const long long MOD = 1000000007;
typedef long long ll;

int main(void){
	int A, B, X;
	cin >> A >> B >> X;
	cout << ((A <= X && X <= A + B) ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
import math

N = int(input())
a = sorted(list(map(int,input().split())))

count = 0

b = {}
for i in range(len(a)):
    if a[i] in b:
        b[a[i]] += 1
    else:
        b[a[i]] = 1

for i in range(len(a) - 1, -1, -1):
    if  b[a[i]] == 0:
        continue
    temp = a[i]
    b[a[i]] -= 1
    s=2**math.floor(math.log2(temp))
    st = 2*s - temp 
    if a ==[]:
        break
    if st in b and b[st] > 0:
        b[2*s-temp] -= 1
        count += 1
    
print(count)



Measured memory_bytes: 33168
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const LL LLINF = 1e16;

struct UnionFind{
    vector<int> dat;

    UnionFind(int sz){
        dat.assign(sz, -1);
    }

    bool unite(int x, int y){
        x = root(x), y = root(y);
        if(x == y) return(false);
        if(dat[x] > dat[y]) swap(x, y);
        dat[x] += dat[y];
        dat[y] = x;
        return(true);
    }

    int root(int k){
        if(dat[k] < 0) return(k);
        return(dat[k] = root(dat[k]));
    }

    int size(int k){
        return(-dat[root(k)]);
    }
};


int main(){
    fastcin();

    int n, m, k;
    cin >> n >> m >> k;
    UnionFind UF(n);
    vector<vector<int>> fr(n),block(n);

    rep(i, m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        fr[a].push_back(b);
        fr[b].push_back(a);
        UF.unite(a, b);
    }
    rep(i, k){
        int c, d;
        cin >> c >> d;
        c--; d--;
        block[c].push_back(d);
        block[d].push_back(c);
    }

    vector<int> ans(n, 0);
    rep(i, n){
        ans[i] = UF.size(i)-1;
        ans[i] -= fr[i].size();
        repe(j, block[i]){
            if(UF.root(j) == UF.root(i)) ans[i]--;
        }
    }
    rep(i, n) cout << ans[i] << (i==n-1 ? "\n":" ");
}

Measured memory_bytes: 12664
s = input()
t = input()
n = len(s)
m = len(t)
dp = [[0 for _ in range(len(s) + 1)] for _ in range(len(t) + 1)]

for i in range(len(t)):
    for j in range(len(s)):
        if t[i] == s[j]:
            dp[i + 1][j + 1] = dp[i][j] + 1
        else:
            dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j])
cnt = dp[m][n]
ans = ''
while n > 0 and m > 0:
    if dp[m][n] == dp[m][n - 1]:
        n -= 1
    elif dp[m][n] == dp[m - 1][n]:
        m -= 1
    else:
        ans = s[n - 1] + ans
        n -= 1
        m -= 1

print(ans)

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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  int d = a-b;
  if (c <= d) cout << 0 << endl;
  else cout << (c-d) << endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())

def divisor(N):
    l = []
    for i in range(1,N+1):
        if N % i == 0:
            l.append(i)
    return len(l)
ans =0
for i in range(N+1):
    if divisor(i)==8 and i % 2 == 1:
        ans += 1
print(ans)

Measured memory_bytes: 3060
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

public class Main {

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

	private void run() {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		Node[] T = new Node[n];

		for (int i = 0; i < n; i++) {
			T[i] = new Node();
		}
		int l = 0;
		for (int i = 0; i < n; i++) {
			int v = scanner.nextInt();
			T[v].id = v;
			int d = scanner.nextInt();
			for (int j = 0; j < d; j++) {
				int c = scanner.nextInt();

				if (j == 0) {
					T[v].l = c;
				} else {
					T[l].r = c;
				}
				l = c;
				T[c].p = v;
			}
		}
		int r = -1;
		for (int i = 0; i < n; i++) {
			if (T[i].p == -1) {
				r = i;
				break;
			}
		}
		int[] D = new int[n];
		rec(r, 0, D, T);
		StringBuilder builder = new StringBuilder();
		for (int i = 0; i < n; i++) {
			print(i, T, D, builder);
		}
		System.out.print(builder);
	}

	private void print(int u, Node[] T, int[] D, StringBuilder builder) {
		builder.append("node ").append(u).append(": parent = ").append(T[u].p)
				.append(", depth = ").append(D[u]).append(", ");
		if (T[u].p == -1)
			builder.append("root, ");
		else if (T[u].l == -1)
			builder.append("leaf, ");
		else
			builder.append("internal node, ");
		builder.append("[");
		for (int i = 0, c = T[u].l; c != -1; i++, c = T[c].r) {
			if (i != 0)
				builder.append(", ");
			builder.append(c);
		}
		builder.append("]\n");
	}

	private void rec(int u, int p, int[] D, Node[] T) {
		Deque<Node> deque = new ArrayDeque<Node>();
		deque.offer(T[u]);
		while (!deque.isEmpty()) {
			int t = deque.size();
			for (int i = 0; i < t; i++) {
				Node node = deque.poll();
				D[node.id] = p;
				if (node.l != -1) {
					node = T[node.l];
					while (true) {
						deque.offer(T[node.id]);
						if (node.r != -1) {
							node = T[node.r];
						} else {
							break;
						}
					}
				}
			}
			p++;
		}
	}

	class Node {
		int id = -1;
		int p = -1;
		int l = -1;
		int r = -1;
	}
}

Measured memory_bytes: 108760
def loop(a,b,n):
    add = 0
    if(n==0):
        return 0
    if(a<2**n and b<2**n):
        return loop(a,b,n-1)
    if(a>=2**n):
        add = (add+(2**(n+1)-a))%2
        a-=2**n
    if(b>=2**n):
        add = (add+(b-2**n+1))%2
        b-=2**n
    return add*2**n+loop(a,b,n-1)

A,B = [int(x) for x in input().split()]
last_num = 0
if(((B-A+1)%4 == 1 and A%2 == 1) or (B-A+1)%4 == 2 or ((B-A+1)%4 == 3 and A%2 == 0)):
    last_num = 1
print(loop(A,B,41)+last_num)


Measured memory_bytes: 3064
#include <iostream>
#define  N  101
using namespace std;

int main(){
	int n, m, l, A[N][N], B[N][N];
	long C[N][N] = {0};

	cin>>n>>m>>l;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>A[i][j];
		}
	}
	for(int j=0;j<m;j++){
		for(int k=0;k<l;k++){
			cin>>B[j][k];
		}
	}

	for(int i=0;i<n;i++){
		for(int k=0;k<l;k++){
			for(int h=0;h<m;h++){
				C[i][k] += A[i][h] * B[h][k];
			}
		}
	}

	for(int i=0;i<n;i++){
		for(int k=0;k<l;k++){
			if(k != 0) cout<<" ";
			cout<<C[i][k];
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1328
#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;
using pll = pair<ll, ll>;

int main()
{
    ll w, h;
    cin >> w >> h;

    priority_queue<pll, vector<pll>, greater<pll>> que; 
    rep(i, 0, w)
    {
        int p;
        cin >> p;
        que.push(make_pair(p, 0));
    }
    rep(i, 0, h)
    {
        int p;
        cin >> p;
        que.push(make_pair(p, 1));
    }
    
    ll ans = 0;
    while (que.size() > 0)
    {
        ll weight, wh;
        tie(weight, wh) = que.top();
        que.pop();

        // cout << weight << ' ' << wh << ' ' << ans << endl;
        if (wh == 0)
        {
            ans += (h + 1) * weight;
            --w;
        }
        else
        {
            ans += (w + 1) * weight;
            --h;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6256