akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const int mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

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


// ll memo[2020][2020];
// int pascal_triangle(){
//   for(int i = 0; i < 2020; i++){
//     for(int j = 0; j < i+1; j++){
//       if(j == 0 || j == i) memo[i][j] = 1;
//       else{
// 	memo[i][j] = (memo[i-1][j-1]+memo[i-1][j]);
//       }
//     }
//   }
//   return 0;
// }


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

int divisor(int a){
  int cnt = 0;
  for(int i=1; i <= a; i++) if(a%i == 0) cnt++;
  return cnt;
}

int comb(int n, int k){
  return factorial(n) / (factorial(n-k)*factorial(k));
}

// int cans(bool f){
//   if(f) cout << "Yes" << endl;
//   else cout << "No" << endl;
//   return 0;
// }






int main(){
  int N,M,X;
  cin >> N >> M >> X;
  int f = 0;
  int p = 0;
  rep(i,M){
    int n;
    cin >> n;
    if(n<X) p++;
    else f++;
  }
  cout << min(p,f) << endl;
  
}









Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

class Main {

    public static void main( final String[] args ) {

	final Scanner stdin = new Scanner( System.in );

	while ( stdin.hasNextLine() ) {
	    final String[] input = stdin.nextLine().split( "," );
	    final int[] a = new int[10];
	    for ( int i = 0; i < 10; i++ ) {
		a[i] = Integer.parseInt( input[i] );
	    }
	    final int v1 = Integer.parseInt( input[10] );
	    final int v2 = Integer.parseInt( input[11] );
	    final double sum = sum( a );
	    final double v1dist = sum / ( v1 + v2 ) * v1;
	    double b = 0;
	    for ( int i = 0; i < 10; i++ ) {
		//System.err.println( b + " " + a[i] );
		if (  b + a[i] < v1dist ) {
		    b += a[i];
		} else {
		    System.out.println( i + 1 );
		    break;
		}
	    }
	}	
    }

    static double sum( int[] array ) {
	double sum = 0;
	for ( int i = 0; i < 10; i++ ) {
	    sum += array[i];
	}
	return sum;
    }
}

Measured memory_bytes: 17148
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		int z = sc.nextInt();

		int n = 0;

		while ((y + z) * n + z <= x) {
			n++;
		}
		System.out.println(n - 1);
		sc.close();
	}

}


Measured memory_bytes: 21844
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
int a[200005];
int main(){
  int n;
  scanf("%d",&n);
  for(int i=2,k;i<=n;++i)
    scanf("%d",&k),++a[k];
  for(int i=1;i<=n;++i)
    printf("%d\n",a[i]);
  return 0;
}

Measured memory_bytes: 4596
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in); 
    int n = Integer.parseInt(sc.next());
    Set<String> d = new HashSet<String>();
    for (int i=0; i<n; i++) {
      String q = sc.next();
      String s = sc.next();
//      if (q.equals("insert") && !d.contains(s)) 
      if (q.equals("insert")) 
        d.add(s);
      else
        System.out.println(d.contains(s) ? "yes" : "no");
    }
  }
}

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

int main(){
    int n,m;
    cin >> n >> m;
    int p[3] = {11,11,11};
    int s[m];
    int c[m];
    if(m == 0){
        if(n == 1){
            cout << 0 << endl;
            return 0;
        }
        if(n == 2){
            cout << 10 << endl;
            return 0;
        }
        if(n == 3){
            cout << 100 << endl;
            return 0;
        }        
    }
    for(int i=0;i<m;i++) cin >> s[i] >> c[i];
    for(int i=0;i<m;i++) p[s[i]-1] = c[i];
    for(int i=0;i<m;i++){
        if(p[s[i]-1] != c[i]){
            cout << -1 << endl;
            return 0;
        }
    }
    if(n != 1 && p[0] == 0){
        cout << -1 << endl;
        return 0;
    }
    if(p[0] == 11) p[0] = 1;    
    for(int i=0;i<n;i++){
        if(p[i] == 11){
            p[i] = 0;
        }
        cout << p[i];
    }
    cout << endl;
    return 0;
}

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

using Int = long long;
const char newl = '\n';

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}
template<typename T=int>
vector<T> read(size_t n){
  vector<T> ts(n);
  for(size_t i=0;i<n;i++) cin>>ts[i];
  return ts;
}


template<typename T,T MOD = 1000000007>
struct Mint{
  static constexpr T mod = MOD;
  T v;
  Mint():v(0){}
  Mint(signed v):v(v){}
  Mint(long long t){v=t%MOD;if(v<0) v+=MOD;}

  Mint pow(long long k){
    Mint res(1),tmp(v);
    while(k){
      if(k&1) res*=tmp;
      tmp*=tmp;
      k>>=1;
    }
    return res;
  }

  static Mint add_identity(){return Mint(0);}
  static Mint mul_identity(){return Mint(1);}

  Mint inv(){return pow(MOD-2);}

  Mint& operator+=(Mint a){v+=a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator-=(Mint a){v+=MOD-a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator*=(Mint a){v=1LL*v*a.v%MOD;return *this;}
  Mint& operator/=(Mint a){return (*this)*=a.inv();}

  Mint operator+(Mint a) const{return Mint(v)+=a;}
  Mint operator-(Mint a) const{return Mint(v)-=a;}
  Mint operator*(Mint a) const{return Mint(v)*=a;}
  Mint operator/(Mint a) const{return Mint(v)/=a;}

  Mint operator-() const{return v?Mint(MOD-v):Mint(v);}

  bool operator==(const Mint a)const{return v==a.v;}
  bool operator!=(const Mint a)const{return v!=a.v;}
  bool operator <(const Mint a)const{return v <a.v;}

  static Mint comb(long long n,int k){
    Mint num(1),dom(1);
    for(int i=0;i<k;i++){
      num*=Mint(n-i);
      dom*=Mint(i+1);
    }
    return num/dom;
  }
};
template<typename T,T MOD> constexpr T Mint<T, MOD>::mod;
template<typename T,T MOD>
ostream& operator<<(ostream &os,Mint<T, MOD> m){os<<m.v;return os;}

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  int n;
  cin>>n;
  using M = Mint<int>;

  M dp[4]={};
  dp[0]=1;

  for(int i=0;i<n;i++){
    M nx[4]={};
    for(int j=0;j<10;j++)
      for(int k=0;k<4;k++)
        nx[k|(j==0)|((j==9)*2)]+=dp[k];
    for(int k=0;k<4;k++) dp[k]=nx[k];
  }
  cout<<dp[3]<<newl;
  return 0;
}


Measured memory_bytes: 3632
import java.util.Scanner;

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


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

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>(b);i--)

long long int n,cnt=0,ans=0,a[55],b[55],c[55],cmp,data[100000],d[55],m,x,y;

string s,w;

int main(void){
      cin >> n >> m;
      rep(i,n){
          cin >> a[i] >> b[i];
      }
      rep(i,m){
          cin >> c[i] >> d[i];
      }
      
      rep(i,n){
          rep(j,m){
              x=a[i]-c[j];
              y=b[i]-d[j];
              if(x<0){
                  x*=-1;
              }
              if(y<0){
                  y*=-1;
              }
              if(x+y<cmp || j==0){
                  cmp=x+y;
                  ans=j+1;
                  if(j==m-1){
                      cout << ans << endl;
                      cmp=0;
                  }
              }
              else if(j==m-1){
                  cout << ans << endl;
                  cmp=0;
              }
          }
      }
return 0;
}


Measured memory_bytes: 256
package main

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

var s = bufio.NewScanner(os.Stdin)

func getInt() int {
	s.Scan()
	a, _ := strconv.Atoi(s.Text())
	return a
}

func main() {
	s.Split(bufio.ScanWords)
	a, b := getInt(), getInt()

	num := []int{a + b, a - b, a * b}

	sort.Ints(num)

	n := len(num)

	fmt.Println(num[n-1])

}


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

using ll = long long;
using pii = pair<int, int>;

int main() {
    int n;
    cin >> n;
    vector<int> res(n);
    vector<int> a(n);
    for(int i=0; i<n; ++i) {
        cin >> a[i];
    }
    if(n & 1) {
        for(int i=0; i<(n+1)/2; ++i) {
            res[i] = a[n-1-i*2];
        }
        for(int i=(n+1)/2; i<n; ++i) {
            res[i] = a[1+(i - (n+1)/2)*2];
        }
    } else {
        for(int i=0; i<n; ++i) {
            if(i < n/2) {
                res[i] = a[n-1-2*i];
            } else {
                res[i] = a[2*(i-n/2)];
            }
        }
    }
    for(int i=0; i<n; ++i) {
        cout << res[i] << " \n"[i == n-1] << flush;
    }
}


Measured memory_bytes: 3712
program atcoder
    implicit none
    integer(8) n,ans,i,j,k
    integer(8) x(101)
    read*,n
    x = 0
    do i=2,n
      ans = i
      do j = 2,i
        do while(mod(ans,j)==0)
          ans = ans/j
          x(j) = x(j) + 1
        enddo
      enddo
    enddo
    ans = 0
    do i = 2,n
      if(x(i)>=74)ans=ans+1
      do j = 2,n
        if(i==j)cycle
        if(x(i)>=4.and.x(j)>=14)ans=ans+1
        if(x(i)>=2.and.x(j)>=24)ans=ans+1
        do k = j+1,n
          if(i==k)cycle
          if(x(i)>=2 .and. x(j)>=4 .and. x(k)>=4)ans=ans+1
        enddo
      enddo
    enddo
    write(*,'(I0)')ans
!----------------------functions--------------------------
contains

end program atcoder

Measured memory_bytes: 512
#include <iostream>
#include <string>
using namespace std;
int main(){
    string S;
    cin>>S;
    int a =0;
    for (int i = 0; i <S.size() ; ++i) {
        if(isupper(S[i])){
            ++a;
        }
    }
    if(S[2]==S[3]&& S[4]==S[5]&&a==0&&S.size()==6){
        cout<<"Yes";
    } else{
        cout<<"No";
    }
   return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		long x = 1;
		for(int i=0;i<=X;i++){
			x = x*2+1;
		}
		Console.WriteLine(x-1);
		
	}
	int X;
	public Sol(){
		X = ri();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


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

bool isPrime(int n) {
  if (n <= 1) return false;
  if (n == 2) return true;
  for (int d = 2; d * d <= n; d++) {
    if (n % d == 0) return false;
  }
  return true;
}

int f(int N, int d) {
  int res = 0;
  while (N > 0) {
    res += N / d;
    N /= d;
  }
  return res;
}

int main2() {
  int N; cin >> N;
  ll ans = 1;
  for (int d = 1; d <= N; d++) {
    if (isPrime(d)) {
      int cnt = f(N, d);
      ans = (ans * (cnt + 1)) % MOD;
    }
  }
  cout << ans << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int a, b;
  string c = "", d = "";
  cin >> a >> b;

  REP(i, a) { c += to_string(b); }
  REP(i, b) { d += to_string(a); }

  if (a >= b) {
    cout << c << endl;
  } else {
    cout << d << endl;
  }

  return 0;
}


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

//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")

using namespace std;
template<class T, class T2> inline int chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline int chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }
const int MAXN = (1 << 20);

int n;
int a[MAXN];

void read()
{
	cin >> n;
	for(int i = 0; i < n; i++)
	{
		cin >> a[i];
		a[i] -= (i + 1);
	}
}

void solve()
{
	sort(a, a + n);

	int mid = a[n >> 1];
	int64_t ret = 0;

	for(int i = 0; i < n; i++)
		ret += abs(mid - a[i]);

	cout << ret << endl;
}

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

	read();
	solve();
	return 0;
}



Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        PrintWriter pw = new PrintWriter(System.out);

        st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int base = Integer.parseInt(st.nextToken());

        int count = 0;
        while(n != 0) {
            n /= base;
            count++;
        }

        pw.println(count);
        
        
        
        
        
        pw.flush();
        pw.close();
    }
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int x, y;
  cin >> x >> y;
  int ans = 0;
  if (x == 1)
    ans += 300000;
  else
    if (x == 2)
      ans += 200000;
    else
      if (x == 3)
        ans += 100000;
  if (y == 1)
    ans += 300000;
  else
    if (y == 2 )
      ans += 200000;
    else if (y == 3) ans += 100000;

  if (x == 1 && y == 1)
    ans += 400000;
  cout << ans << '\n';
  return 0;
}


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

LL fac[SIZE], finv[SIZE], inv[SIZE];
void combInit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for( int i = 2; i < SIZE; ++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;

    }
}

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

}

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

    int k, x;
    cin >> k >> x;
    if( k * 500 >= x ) cout << "Yes";
    else cout << "No";
    cout << endl;

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int K,S,ans=0;
  cin>>K>>S;
  for(int i=0;i<=K;i++)
    for(int j=0;j<=K;j++)
      if(S>=i+j && S<=i+j+K)ans++;
  cout<<ans<<endl;
}

Measured memory_bytes: 3572
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;

int main() {
	int n; cin >> n;
	vector<long long> A(n + 1);
	vector<long long> B(n);
	for (int i = 0; i < n + 1; i++) cin >> A[i];
	for (int i = 0; i < n; i++) cin >> B[i];
	long long ans = 0;
	for (int i = 0; i < n; i++) {
		if (B[i] >= A[i]) {
			ans += A[i];
			B[i] -= A[i];

			if (B[i] >= A[i + 1]) {
				ans += A[i + 1];
				A[i + 1] = 0;
			}
			else {
				ans += B[i];
				A[i + 1] -= B[i];
			}
		}
		else ans += B[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 4748
#include <algorithm>
#include <bitset>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define MOD (1000000007l)
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)

using namespace std;

void solve() {
  vector<ll> A(9);
  rep (i, 9) cin >> A[i];
  ll N;
  cin >> N;
  rep (i, N) {
    ll b;
    cin >> b;
    rep (i, 9) if (A[i] == b) A[i] = 0;
  }

  if (
    (A[0] == 0 and A[1] == 0 and A[2] == 0) or
    (A[3] == 0 and A[4] == 0 and A[5] == 0) or
    (A[6] == 0 and A[7] == 0 and A[8] == 0) or
    (A[0] == 0 and A[3] == 0 and A[6] == 0) or
    (A[1] == 0 and A[4] == 0 and A[7] == 0) or
    (A[2] == 0 and A[5] == 0 and A[8] == 0) or
    (A[0] == 0 and A[4] == 0 and A[8] == 0) or
    (A[2] == 0 and A[4] == 0 and A[6] == 0)
  ) cout << "Yes" << endl;
  else cout << "No" << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  cout << fixed;
  solve();
  return 0;
}


Measured memory_bytes: 256
#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;

const ll MOD=LLONG_MAX;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

int h[200000];
vector<int>E[200000];

int main(){
	int n,m;cin>>n>>m;
	rep(i,n)scanf("%d",&h[i]);
	rep(i,m){
		int a,b;scanf("%d%d",&a,&b);a--;b--;
		E[a].push_back(b);
		E[b].push_back(a);
	}
	int cnt=0;
	rep(i,n){
		bool ok=true;
		for(int u:E[i]){
			if(h[i]<=h[u])ok=false;
		}
		if(ok)cnt++;
	}
	cout<<cnt<<endl;
}

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

int n, l, r;

int solve(int year, vector<int> v) {
    for (int i = 0; i < v.size(); i++) {
        if (year % v[i] == 0) {
            return i + 1;
        }
    }
    return -v.size();
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    while (1) {
        cin >> n >> l >> r;
        if (!n & !l & !r) break;
        vector<int> furui;
        int t;
        for (int i = 0; i < n; i++) {
            cin >> t;
            furui.push_back(t);
        }
        int ans = 0, res;
        for (int i = l; i <= r; i++) {
            res = solve(i, furui);
            if (res < 0) {
                if ((-res) % 2 == 0) ans++;
            } else {
                if (res % 2 == 1) ans++;
            }
        }
        cout << ans << endl;
    }
}


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

#ifdef DEBUG
    #include "debug.h"
    #define dump(...)                                                              \
        DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
                << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
                << endl                                                            \
                << "    ",                                                         \
            dump_func(__VA_ARGS__)
#else
    #define dump(...)
#endif


// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//////////////////

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

#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
#define ALL(v) (v).begin(), (v).end()
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
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 mod 1000000007 /*/
#define mod 998244353 //*/

typedef pair<int, int> P;
#define INF (1LL<<60)

void solve(){
    int N, D;
    cin >> N >> D;
    int ans = 0;
    while(N--){
        int x, y;
        cin >> x >> y;
        if(x*x+y*y<=D*D) ans++;
    }
    cout << ans << endl;
}


signed main(){
    cout << fixed << setprecision(18);
//    cerr << fixed << setprecision(18);
    solve();
}


Measured memory_bytes: 3460
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
using P = pair<int ,int>;
const int INF = 1001001001;
const int MOD = 1000000007;
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 (b<a) {a=b; return 1;} return 0;}

#ifdef _DEBUG
#include "debug.h"
#else
#define debug(...)
#define print(...)
#endif

int main() {
    int n; cin >> n;
    vector<string> s(n); rep(i, n) cin >> s[i];
    vector<vector<int>> mat(n, vector<int>(n, 0));
    rep(i, n) rep(j, n) {
        if (i==j) continue;
        if (s[i][j] == '1') mat[i][j] = 1;
        else mat[i][j] = INF;
    }

    rep(k, n) rep(i, n) rep(j, n) {
        if (i==j || j==k || i==k) continue;
        chmin(mat[i][j], mat[i][k]+mat[k][j]);
    }
    print(mat);

    int top, maxd = 0;
    rep(i, n) rep(j, n) {
        if (chmax(maxd, mat[i][j])) top = i;
    }
    debug(top, maxd);
    map<int, vector<int>> mp;
    rep(j, n) {
        mp[mat[top][j]].push_back(j);
    }
    bool ok = true;
    for(const auto& m: mp) {
        if (sz(m.se)>1) {
            rep(i, sz(m.se)) FOR(j, i+1, sz(m.se)) {
                if (mat[m.se[i]][m.se[j]]==1) ok = false;
            }
        }
    }
    if (!ok) cout << -1 << endl;
    else cout << maxd+1 << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<queue>
#include<climits>
using namespace std;

typedef long long ll;

const ll INF = 2000000000000;
const int dmax = 2000000001;

int main(){
	
	ll V,E,s,t,cost;
	cin >> V >> E;
	
	ll A[V][V];
	
	for (int i=0;i<V;i++){
		for (int j=0;j<V;j++){
			A[i][j]=INF;
		}
	}
	
	for (int i=0;i<E;i++){
		cin >>  s >> t >> cost;
		A[s][t]=cost;
	}
	
	ll d[V][V][V];
	
	for (int i=0;i<V;i++){
		for (int j=0;j<V;j++){
			if(i!=j){
				d[i][j][0]=min(A[i][j],A[i][0]+A[0][j]);
			}else{
				d[i][j][0]=0;
			}
		}
	}
	
	for (int k=1;k<V;k++){
		for (int i=0;i<V;i++){
			for (int j=0;j<V;j++){
				d[i][j][k]=min(d[i][j][k-1],d[i][k][k-1]+d[k][j][k-1]);
			}
		}
	}
	
	for (int i=0;i<V;i++){
		for (int j=0;j<V;j++){
			if(d[i][j][V-1]<0 && d[j][i][V-1]<0){
				cout <<"NEGATIVE CYCLE" <<endl;
				return 0;
			}
		}
	}
	
	for (int i=0;i<V;i++){
		for (int j=0;j<V;j++){
			if(d[i][j][V-1]>dmax){
				cout << "INF";
			}else{
				cout << d[i][j][V-1];
			}
			if(j!=V-1){
				cout << " ";
			}
		}
		cout << endl;
	}
	
	return 0;
}

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

int main() {

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

    if(a == b) {
      cout << c << endl;
    }
    else if(a == c) {
      cout << b << endl;
    }
    else {
       cout << a << endl;
    }
   }


Measured memory_bytes: 256
MOD = 10**9+7
gets
S1 = gets.chomp
S2 = gets.chomp

s = S1.each_char.map.with_index{|c1, i|
  c2 = S2[i]
  [c1 == c2, c1]
}.chunk(&:itself).map{|ch| ch[0][0]}

prev_vert = nil
m = s.map.with_index{|vert, i|
  if i == 0
    vert ? 3 : 6
  else
    prev_vert = s[i-1]
    case
    when prev_vert && vert
      2
    when prev_vert
      2
    when vert
      1
    else
      3
    end
  end
}

p m.inject{|a, b| a*b%MOD}


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

int eachAns(vector<vector<int> > c, int k) {
  int j0 = 0;
  int ans = 0;
  while (j0 < c[0].size()) {
    int min = c[0].size();
    for (int i = 0; i < c.size(); i++) {
      int sum = 0;
      for (int j1 = j0; j1 < min; j1++) {
        if (sum + c[i][j1] <= k) {
          sum += c[i][j1];
        } else if (c[i][j1] > k) {
          return 99999;
        } else {
          min = j1;
          break;
        }
      }
    }
    j0 = min;
    // cout << j0;
    ans++;
  }
  ans--;
  return ans;
}

vector<vector<int> > divide(vector<vector<int> > s, vector<int> d) {
  int h = s.size();
  int w = s[0].size();
  vector<int> e = s[0];
  vector<vector<int> > v = {};
  for (int i = 1; i < h; i++) {
    if (d[i] == 0) {
      for (int j = 0; j < w; j++) {
        e[j] += s[i][j];
      }
    } else {
      v.push_back(e);
      e = s[i];
    }
  }
  v.push_back(e);

  // for (int i = 0; i < v.size(); i++) {
  //   for (int j = 0; j < v[0].size(); j++) {
  //     cout << v[i][j] << " ";
  //   }
  //   cout << endl;
  // }
  // cout << endl;

  return v;
}

vector<int> solve(vector<vector<int> > s, vector<int> d, int i, int k) {
  vector<vector<int> > c0, c1;
  int ans0, ans1;

  if (i == 1) {
    d[1] = 0;
    // cout << "d";
    // for (int j = 0; j < d.size(); j++) {
    //   cout << d[j] << " ";
    // }
    // cout << endl;
    c0 = divide(s, d);
    ans0 = eachAns(c0, k);
    d[1] = 1;
    // cout << "d";
    // for (int j = 0; j < d.size(); j++) {
    //   cout << d[j] << " ";
    // }
    // cout << endl;
    c1 = divide(s, d);
    ans1 = eachAns(c1, k) + 1;
  } else {
    d[i] = 0;
    ans0 = solve(s, d, i-1, k)[0];
    d[i] = 1;
    ans1 = solve(s, d, i-1, k)[0] + 1;
  }
  d[0] = min(ans0, ans1);
  return d;
}

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  vector<vector<int> > s(h, vector<int>(w, 0));
  for (int i = 0; i < h; i++) {
    string in;
    cin >> in;
    for (int j = 0; j < w; j++) {
      s[i][j] = (int)(in[j] - '0');
    }
  }
  vector<int> d(h, 0);
  d[0] = h + w - 2;
  int ans = 0;

  ans = solve(s, d, h-1, k)[0];

  cout << ans << endl;
}


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

namespace AOJALDS13D
{
    class Program
    {
        static void Main(string[] args)
        {
            Stack<int> first = new Stack<int>();
            Stack<int[]> second = new Stack<int[]>();

            var str = Console.ReadLine();
            var i = 1;
            var sumArea = 0;
            foreach (var cha in str)
            {
                if (cha == '\\')
                {
                    first.Push(i);
                }
                else if(cha =='/')
                {
                    if (first.Count != 0)
                    {
                        int j = first.Pop();
                        int partArea = i - j;
                        int eachArea = partArea;
                        sumArea += partArea;

                        var l = second.Count;
                        for (int k = 0; k < l; k++)
                        {
                            if (second.Peek()[0] > j)
                            {
                                eachArea += second.Pop()[1];
                            }
                        }

                        var tempArea = new int[] { j, eachArea };
                        second.Push(tempArea);
                    }
                }
                ++i;
            }

            var sumArea2 = 0;
            foreach (var Si in second)
            {
                sumArea2 += Si[1];
            }

            var secondarray = second.ToArray();

            Console.WriteLine("{0}",sumArea);
            Console.Write("{0}",second.Count);
            if (second.Count == 0)
            {
                Console.WriteLine();
            }
            else
            {
                Console.Write(" ");
                for (int j = second.Count - 1; j >= 0; j--)
                {
                    Console.Write(secondarray[j][1]);
                    if (j != 0)
                    {
                        Console.Write(" ");
                    }
                    else
                    {
                        Console.WriteLine();
                    }
                }
            }
            Console.ReadLine();
        }
    }
}



Measured memory_bytes: 20484
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <functional>
 
using namespace std;
typedef long long int ll;
 
#define repi(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define rrep(i,a) for(int i=a-1;i>=0;i--)
 
ll llmax(ll a, ll b){
  return a > b ? a : b;
}
 
int main(){
  ll N, M;
  cin >> N >> M;
 
  ll ans = 1;
  ll n = 1;
  while(n*n<=M){
    if(M%n==0){
      if(n<=M/N) ans=llmax(ans, n);
      if(M/n<=M/N) ans=llmax(ans, M/n);
    }
    n++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int n,zan = 100000;

	scanf("%d",&n);
	for(int i = 0; i < n; i++){
		zan += zan * 0.05;
		if(zan%1000 > 0){
			zan /= 1000;
			zan++;
			zan *= 1000;
		}
	}
	printf("%d\n",zan);

	return 0;
}

Measured memory_bytes: 1020
n, a, b = map(int, input().split())

if (a - b) % 2 == 0:
    print(abs((a - b)//2))
    exit()

if a > b:
    a, b = b, a

print(min(a + (b-a-1)//2, n - b + 1 + (n - (a + (n - b + 1)))//2))

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

using namespace std;

int gcm(int a, int b) {
    int ans = 1;
    for(int i = 2; i <= min(a, b); i++) {
        if(a % i == 0 && b % i == 0) {
            ans = i;
        }
    }
    return ans;
}

int main() {
    long long int A, B;
    cin >> A >> B;
    long long int C = gcm(A, B);
    cout << (A / C) * (B / C) * C << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<vector>
#include<map>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define sz size()
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> P;

const int adj[4] = {6,1,3,8};

ll encode(vi v){
  ll res = 0;
  rep(i,9)res |= v[i]<<(4*i);
  return res;
}

vi decode(ll l){
  vi res(9);
  rep(i,9)res[i] = (l>>(4*i))&15LL;
  return res;
}

int main(){
  int ch,cv;
  vi s(9),t(9);

  while(cin>>ch>>cv,ch){
    rep(i,9)cin >> s[i];
    rep(i,9)cin >> t[i];

    map<ll,ll> d;
    ll ds = encode(s), dt = encode(t);
    d[ds] = 0;
    priority_queue<P, vector<P>, greater<P> > q;
    q.push(P(0,ds));

    while(q.sz){
      P p = q.top(); q.pop();
      ll dis = p.fs;
      ds = p.sc;
      if(d[ds] < dis)continue;
      if(ds==dt)break;
      s = decode(ds);

      int pos = 0;
      rep(i,9){
	if(s[i] == 0)pos = i;
      }

      rep(i,4){
	int nxt = (adj[i] + pos) % 9;
	ll cost = (i&1?ch:cv) + dis;
	swap(s[pos],s[nxt]);
	ds = encode(s);

	if(d.find(ds)==d.end() || d[ds] > cost){
	  d[ds] = cost;
	  q.push(P(cost,ds));
	}
	swap(s[pos],s[nxt]);
      }
    }
    cout << d[dt] << endl;
  }
}

      

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

int main() {
	int N, match = 0;
	string s, t;
	cin >> N >> s >> t;
	for (int i = 1; i <= N; i++) {
		if (s.substr(N - i,i) == t.substr(0, i)) match = i;
	}
	cout << N + N - match << endl;
}

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

int main() {
  char c;
  int n, r = 1;
  string s;
  cin >> n >> s;
  if (n == 1) {
    cout << r << endl;
    return 0;
  }

  c = s[0];
  for (int i = 1; i < n; ++i) {
    if (s[i] != c) {
      c = s[i];
      r++;
    }
  }
  cout << r << endl;
  return 0;
}

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

int main(){
    int n,x; cin >> n >> x;
    ll a[n];
    for(int i = 0; i < n; i++) cin >> a[i];

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

    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX=200000;

int main(){

    int R[MAX],n;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> R[i];
    }
    int maxv =-1000000000;
    int minv = R[0];
    
    for(int i=1;i<n;i++){
        maxv = max(maxv, R[i] - minv);
        minv = min(minv, R[i]);
    }
    cout << maxv << endl;
}



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

using namespace std;

int main() {
	int a , b;
	scanf("%d %d", &a, &b);
	int ans = -1;
	for (int x = 0; x < 2000; x++) {
		if ((x * 8 / 100 == a) && (x * 10 / 100 == b)) {
			ans = x;
			break;
		}
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <queue>
#include <stack>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
int main() {
	string W, T;
	int n = 0,m;
	m = 'A' - 'a';
	cin >> W;
	for (int i = 0; i < W.size(); i++) {
		if (W[i] >= 'A'&&W[i] <= 'Z') {
			W[i] = W[i] - m;
		}
	}
	while (cin >> T) {
		if (T=="END_OF_TEXT") {
			break;
		}
		for (int i = 0; i < T.size(); i++) {
			if (T[i] >= 'A'&&T[i] <= 'Z') {
				T[i] = T[i] - m;
			}
		}
		if (W.size() == T.size()) {
        	if (T.find(W, 0) != string::npos) {
				n++;
			}
		}
	}
	cout << n << endl;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#define FPEN freopen("in.txt", "r", stdin);
#define debug(...) \
    { cerr << "# " << __VA_ARGS__ << "\n"; }
#else
#define debug(...)
#define FPEN
#endif
const int maxn = 200009;
typedef long long i64;
typedef pair<i64, i64> pi64;
typedef pair<int, int> pi;
const i64 MOD = 119 << 23 | 1;
class {
   public:
    int f[11][11];
    void solve() {
        int n, ans = 0;
        cin >> n;
        for (int i = 1; i <= n; ++i) {
            int X = i % 10, I = i, Y;
            while (I) {
                Y = I;
                I /= 10;
            }
            f[Y][X]++;
        }
        for (int i = 1; i <= n; ++i) {
            int X = i % 10, I = i, Y;
            while (I) {
                Y = I;
                I /= 10;
            }
            ans += f[X][Y];
        }
        cout << ans << '\n';
    }
} NSPACE;
int main() {
    FPEN;
    ios_base::sync_with_stdio(false);
    cout.tie(0);
    cin.tie(0);
    NSPACE.solve();
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>

void solve() {
    int w, h, n;
    std::cin >> w >> h >> n;

    int px, py;
    std::cin >> px >> py;
    --n;

    int ans = 0;
    while (n--) {
        int x, y;
        std::cin >> x >> y;

        if ((x >= px) == (y >= py)) {
            ans += std::max(std::abs(x - px), std::abs(y - py));
        } else {
            ans += std::abs(x - px) + std::abs(y - py);
        }

        px = x, py = y;
    }

    std::cout << ans << std::endl;
}

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

    solve();

    return 0;
}



Measured memory_bytes: 3172
fn main() {
    let s = read_string();
    let mut sc = Scanner::new(&s);

    let a: i8 = sc.next();
    let b: i8 = sc.next();
    let c: i8 = sc.next();
    let d: i8 = sc.next();

    if (a-c).abs() <= d {
        println!("Yes");
    } else if (a-b).abs() <= d && (b-c).abs() <= d {
        println!("Yes");
    } else {
        println!("No");
    }
}

// 以下、たなこふ先生からぱくったやつ (´･_･`)

struct Scanner<'a> {
    iter: std::str::SplitWhitespace<'a>,
}

impl<'a> Scanner<'a> {
    fn new(s: &str) -> Scanner {
        Scanner {
            iter: s.split_whitespace(),
        }
    }

    fn next<T>(&mut self) -> T
        where T: std::str::FromStr,
              <T as std::str::FromStr>::Err: std::fmt::Debug,
    {
        let s = self.iter.next().unwrap();
        s.parse().unwrap()
    }
}

fn read_string() -> String {
    use std::io::Read;

    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    buf
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void solve(){
  ll a,b,c,k;
  cin>>a>>b>>c>>k;
  if(a+b>=k){
    if(a>k) cout<<k<<endl;
    else cout<<a<<endl;
  }
  else{
    k-=(a+b);
    a-=k;
    cout<<a<<endl;
  }
}
int main(){
    optimizeIO();
    // tc
    string s;
    cin>>s;
    rep(i,0,s.length()){
      if(s[i]=='?') s[i]='D';
    }
    cout<<s<<endl;
}


Measured memory_bytes: 3736
N,M,C = map(int,input().split())
B = list(map(int,input().split()))

cnt = 0
for _ in range(N):
  A = list(map(int,input().split()))
  val = sum([a*b for a,b in zip(A,B)])
  if val > -C:
    cnt += 1
    
print(cnt)

Measured memory_bytes: 9176
using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        string[] s = Console.ReadLine().Split(' ');
        List<double> ns = new List<double>();

        foreach (var i in s)
            ns.Add(int.Parse(i));
        ns.Sort();

        double one = 0;
        double two = 0;
        double ave = 0;
        while (ns.Count > 1)
        {
            one = ns[0];
            two = ns[1];
            ns.RemoveAt(0);
            ns.RemoveAt(0);
            ave = (one + two) / 2;
            ns.Add(ave);
            ns.Sort();
        }
        Console.WriteLine(ns[0]);
    }
}

Measured memory_bytes: 11348
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
s=0
for i in range(n-1):
    s+=b[a[i]-1]
    if a[i+1]==a[i]+1:
        s+=c[a[i]-1]
s+=b[a[n-1]-1]
print(s)

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

using namespace std;

int main()
{
    string W;
    vector<string> T;

    cin >> W;
    for(;;){
        string s;
        cin >> s;
        if(s == "END_OF_TEXT"){
            break;
        }
        string ss = "";
        for(int i = 0; i < s.size(); i++){
            char c = s.at(i);
            if('A' <= c && c <= 'Z'){
                c = c - 'A' + 'a';
            }
            if('a' <= c && c <= 'z' || c == '-'){
                ss += (char)c;
            }
        }
        T.push_back(ss);
    }

    int sum = 0;
    for(int i = 0; i < T.size(); i++){
        if(W == T.at(i)) sum++;
    }
    cout << sum << endl;
}


Measured memory_bytes: 3200
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var N = Sarray()[0];
            var ai = Sarray().OrderByDescending(a => a).ToArray();
            var alice = ai.Where((a, i) => i % 2 == 0).Sum();
            var bob = ai.Where((a, i) => i % 2 == 1).Sum();

            WriteLine(alice - bob);
        }
        static long Mod = 998244353;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 28448
#include <cstdio>
#include <queue>
#include <algorithm>
struct Pair2{
	long long X, Y;
	bool operator < (const Pair2 &p)const{
		return (X - Y) > (p.X - p.Y);
	}
};
Pair2 p[112345];
long long v1[112345], v2[112345];
int main(){
	int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z);
	int n = X + Y + Z;
	long long ans(0);
	for(int i(1); i <= n; ++i){
		long long a, b, c;
		scanf("%lld%lld%lld", &a, &b, &c); ans += c;
		p[i].X = a - c; p[i].Y = b - c; 
	} 
	std::sort(p + 1, p + n + 1);
	std::priority_queue<int> q1, q2;
	long long s1(0), s2(0);
	for(int i(1); i <= X; ++i){
		s1 += p[i].X; q1.push(-p[i].X);
	}
	v1[X] = s1;
	for(int i(X + 1); i <= n - Y; ++i){
		if(-q1.top() < p[i].X){
			s1 += q1.top() + p[i].X;
			q1.pop(); q1.push(-p[i].X);
		}
		v1[i] = s1;
	}
	for(int i(n); i >= n - Y + 1; --i){
		s2 += p[i].Y; q2.push(-p[i].Y);
	}
	v2[n - Y + 1] = s2;
	for(int i(n - Y); i >= X + 1; --i){
		if(-q2.top() < p[i].Y){
			s2 += q2.top() + p[i].Y;
			q2.pop(); q2.push(-p[i].Y);
		}
		v2[i] = s2;
	}
	long long ans2(-1e18);
	for(int i(X); i <= n - Y; ++i){
		ans2 = std::max(ans2, v1[i] + v2[i + 1]);
	}
	printf("%lld\n", ans + ans2);
	return 0;
} 


Measured memory_bytes: 3072
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <vector>
#include <bitset>
#include <cmath>
#include <utility>
#include <ctime>
#define Maxn 100005
#define Maxm 1000005
#define Mod 9973
#define lowbit(x) x&(-x)
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define PI acos(-1.0)
#define random(x) (rand()%x)
#define LL long long
#define Inf (1LL<<62)
#define inf 0x3f3f3f3f
#define input freopen("input.txt","r",stdin)
#define output freopen("output.txt","w",stdout)
using namespace std;
map<char,int> mp;
int main()
{
	int k;
	char str[Maxn];
	//input;output;
	for(int i=0;i<26;i++)
		mp['a'+i]=i;
	while(~scanf("%s",str))
	{
		//cout<<mp['b']<<endl;
		scanf("%d",&k);
		int len=strlen(str);
		for(int i=0;i<len;i++)
		{
			if(k==0)
				break;
			if(i==len-1)
			{
				while(k--)
				{
					if(str[i]=='z')
						str[i]='a';
					else
						str[i]++;
				}
			}
			else
			{
				if(str[i]=='a')
					continue;
				else
				{
					if(k>=26-mp[str[i]])
					{
						k-=26-mp[str[i]];
						str[i]='a';
					}
				}
			}
		}
		printf("%s\n",str);
	}
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;
const double pi = acos(-1.0);

int main() {
    ll n; cin >> n;
    vector<ll> x(n);
    rep(i, n) cin >> x[i];
    vector<ll> xx = x;
    sort(all(x));
    double mean = (x[n/2] + x[n/2-1]) / 2.;
    rep(i, n) {
        if(xx[i] < mean) cout << x[n/2] << endl;
        else cout << x[n/2-1] << endl;
    }
}

Measured memory_bytes: 6440
# -*- coding: utf-8 -*-
"""
AtCoder A
"""

import sys, math, random
import numpy as np

# N = int(input())
# A = list(map(int,input().split())) # N row 1 column
# A = [int(input()) for _ in range(N)] # 1 row N column
# S = str(input()) # str(input()) == input() -> 'abc'
# S = list(input()) # abc -> ['a','b','c']
# S.replace('ABC','X') # "testABCABC" -> "testXX"
 
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
 
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    N, D = list(map(int,input().split()))
    X=[]
    for i in range(N):
        X.append(LI())
    out=0
    for i in range(N-1):
        for j in range(N-1-i):
            tmp=0
            for d in range(D):
                tmp+=(X[i][d]-X[N-1-j][d])**2
            tmp=math.sqrt(tmp)
            if tmp%1==0:
                out+=1
    print(out)
    # print(A,B)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 24376
//g++ -std=c++14 test.cpp -o test.out
 
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;
 
LL N;
 
LL ans = 0;
 
void solve(){
	for(int i=1;i<=N;i++){
		if(i%3==0 || i%5==0)continue;
		ans += i;
	}
}
 
int main(){
    cin >> N;
 
    solve();
 
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3192