akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
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);}
/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2706&lang=jp>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll p,q; cin >> p >> q;
    res = q/gcd(p,q);
    for(ll v = 2; v*v <= res; v++){
        while(res%(v*v)==0) res/=v;
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}



Measured memory_bytes: 3212
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a;
	cin >> a;
	for(long long i=sqrt(a);i>=1;i--){
		if(a%i==0){
			cout << i+(a/i)-2 << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  int n;
  cin>>n;
  std::vector<int64_t> num_plus,num_minus;
  for(int i=0;i<n;i++){
    int temp;
    cin>>temp;
    if(temp>=0) num_plus.push_back(temp);
    else num_minus.push_back(temp);
  }

  std::sort(num_plus.begin(),num_plus.end());
  std::sort(num_minus.begin(),num_minus.end());

  int64_t result=0;
  for(int i=1;i<num_plus.size();i++){
    result+=num_plus[i];
  }
  //num_minus==0,2,4...
  if(num_minus.size()%2==0){
    for(int i=0;i<num_minus.size();i++){
      result+=(-1)*num_minus[i];

    }
    if(num_plus.size()>0)result+=num_plus[0];
  }else{
    for(int i=0;i<num_minus.size()-1;i++){
      result+=(-1)*num_minus[i];

    }

    if (num_plus.size()>0) {
      if(num_minus.back()*-1>num_plus.front()){
        result+=num_minus.back()*-1;
        result-=num_plus.front();
      }else{
        result+=num_plus.front();
        result-=num_minus.back()*-1;
      }
    } else {
      result+=num_minus.back();
    }

  }
  cout<<result<<endl;


  return 0;
}


Measured memory_bytes: 1656
#include <iostream>
#include <vector>

using namespace std;
vector <vector <bool> > card (4,vector <bool>(13,false));
int n;
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        char a;
        int b;
        cin>>a>>b;
        if(a=='S') {card[0][b-1]=true;}
        if(a=='H') {card[1][b-1]=true;}
        if(a=='C') {card[2][b-1]=true;}
        if(a=='D') {card[3][b-1]=true;}
        
    }
    for(int i=0;i<4;i++){
        for(int j=0;j<13;j++){
            if(!card[i][j]){
                if(i==0) cout<<"S"<<" "<<j+1<<endl;
                if(i==1) cout<<"H"<<" "<<j+1<<endl;
                if(i==2) cout<<"C"<<" "<<j+1<<endl;
                if(i==3) cout<<"D"<<" "<<j+1<<endl;
            }
        }
    }
}

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


int main() {
  int K,S;
  cin >> K >> S;
  
  int ans=0;
  for(int i=0;i<=K;i++){
    for(int j=0;j<=K;j++){
      if(i+j<=S && i+j>=S-K){
        ans++;
      }
    }
  }
  cout << ans << endl;
    
  
}





Measured memory_bytes: 256
n = int(input())
x = [int(str) for str in input().split()]

y = max(x)
z = min(x)

s = 10**6
for test in range(z,y+1):
  case = list(map(lambda ex: (ex - test) ** 2 , x))
  t = sum(case)
  if t <= s:
    s = t
print(s)

Measured memory_bytes: 3060
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    h,w=map(int,input().split())
    A=[[int(_) for _ in input().split()] for i in range(h)]
    ans=[]
    for i in range(h):
        if i%2==0:
            for j in range(w):
                if A[i][j]%2==1:
                    if j<w-1:
                        A[i][j+1]+=1
                        A[i][j]-=1
                        ans.append((i+1,j+1,i+1,j+2))
                    else:
                        if i+1==h:break
                        A[i+1][j]+=1
                        A[i][j]-=1
                        ans.append((i+1,j+1,i+2,j+1))
        else:
            for j in range(w-1,-1,-1):
                if A[i][j]%2==1:
                    if j>0:
                        A[i][j-1]+=1
                        A[i][j]-=1
                        ans.append((i+1,j+1,i+1,j))
                    else:
                        if i+1==h:break
                        A[i+1][j]+=1
                        A[i][j]-=1
                        ans.append((i+1,j+1,i+2,j+1))
    print(len(ans))
    for a in ans:
        print(*a)

if __name__=='__main__':
    main()

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

using namespace std;

#define ll long long
#define fr(i,n) for(int i=0; i<n; ++i)
#define frr(i,n) for(int i=n; i>=0; --i)

int main(){

    int n;
    cin>>n;
    vector<int> A(n);
    fr(i, n) cin>>A[i];
    vector<int> dp(n, 0);
    dp[1]=abs(A[1]-A[0]);
    for(int i=2; i<n; i++){
        dp[i]=min(dp[i-1]+abs(A[i]-A[i-1]), dp[i-2]+abs(A[i]-A[i-2]));
    }
    cout<<dp[n-1];
    return 0;
}

Measured memory_bytes: 4056
S = input()
wordNum = [0 for i in range(26)]
for wordOne in S:
    idx = ord(wordOne) - ord('a')
    wordNum[idx] += 1

ans = "None"
for i in range(26):
    if wordNum[i] == 0:
        ans = chr(ord('a') + i)
        break;

print(ans)



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

#define INF (1 << 30)
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define out(x) cout << x << endl;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;

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

Measured memory_bytes: 256
import           Control.Applicative
import           Control.DeepSeq
import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                    as A
import qualified Data.Array.IArray             as IA
import qualified Data.Array.IO                 as AI
import qualified Data.Array.MArray             as MA
import qualified Data.Array.ST                 as STA
import qualified Data.Array.Unboxed            as AU
import           Data.Bits
import qualified Data.ByteString.Char8         as BS
import           Data.Char
import qualified Data.Graph                    as G
import           Data.Int
import qualified Data.IntMap                   as IM
import qualified Data.IntSet                   as IS
import           Data.List
import qualified Data.Map.Strict               as M
import           Data.Maybe
import           Data.Ord
import qualified Data.Sequence                 as SQ
import qualified Data.Set                      as S
import           Data.Time
import qualified Data.Tree                     as T
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as VM
import qualified Data.Vector.Unboxed           as VU
import qualified Data.Vector.Unboxed.Mutable   as VUM

readInt :: IO Int
readInt = fst . fromJust . BS.readInt <$> BS.getLine

readInts :: IO [Int]
readInts = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

readIntLists :: Int -> IO [[Int]]
readIntLists n = replicateM n readInts

readInteger :: IO Integer
readInteger = fst . fromJust . BS.readInteger <$> BS.getLine

readIntegers :: IO [Integer]
readIntegers = map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine

readIntegerLists :: Int -> IO [[Integer]]
readIntegerLists n = replicateM n readIntegers

readStrings :: IO [String]
readStrings = map BS.unpack . BS.words <$> BS.getLine

readStringLists :: Int -> IO [[String]]
readStringLists n = replicateM n <$> readStrings

toPair :: [a] -> (a, a)
toPair [x, y] = (x, y)

count :: Eq a => a -> [a] -> Int
count a as = length $ filter (== a) as

put :: Show a => a -> IO ()
put = putStr . show

putList :: Show a => [a] -> IO ()
putList [n     ] = print n
putList (n : ns) = do
  put n
  putStr " "
  putList ns

putStrList :: [String] -> IO ()
putStrList [n     ] = putStrLn n
putStrList (n : ns) = do
  putStr n
  putStr " "
  putStrList ns

yesNoUpper b | b         = putStrLn "YES"
             | otherwise = putStrLn "NO"

yesNo b | b         = putStrLn "Yes"
        | otherwise = putStrLn "No"

divCeiling x n | b == 0    = a
               | otherwise = a + 1
  where (a, b) = x `divMod` n

main = do
  [n, l] <- readInts
  print $ solve n l

solve n l = s -ans
 where
  apples = map (\x -> x + l - 1) [1 .. n]
  s      = sum apples
  ans    = minimumBy (\a b -> abs a `compare` abs b) apples


Measured memory_bytes: 508
fun main(args : Array<String>) {
    val N = readLine()!!.toInt()
    val H = readLine()!!.split(" ").map { it.toInt() }

    var max = 0
    var count = -1
    var before = Int.MAX_VALUE

    (0 until N).forEach { i ->
        val current = H[i]
        if (before >= current) {
            count++
        } else {
            max = Math.max(max, count)
            count = 0
        }
        before = current
    }
    max = Math.max(max, count)
    println(max)
}

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

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

for(int i=0;i<s.length();i++){
    if(s[i]=='B'){
        if(i<2){
            s=s.substr(i+1);
        }else{
            if(i==s.length()-1){
                s=s.substr(0,i-1);
            }else{
              s=s.substr(0,i-1)+s.substr(i+1);
            }
        }
        
        
        i=-1;
        
    }
}

cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
   int n, a[20], b[20], c[19], i, s=0;

   scanf("%d",&n);
   for(i=0;i<n;i++)
      scanf("%d",&a[i]);
   for(i=0;i<n;i++){
      scanf("%d",&b[i]);
      s+=b[i];
   }
   for(i=0;i<n-1;i++)
      scanf("%d",&c[i]);

   for(i=0;i<n-1;i++)
      if(a[i]==a[i+1]-1)
         s+=c[a[i]-1];

   printf("%d\n",s);
   return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main() {
    int n, m;
    int i, j;
    cin >> n >> m;
    int A[n][m];
    int b[m];
    for (i=0;i<n;i++) {
        for (j=0;j<m;j++) {
            cin >> A[i][j];
        }
    }
    for (j=0;j<m;j++) {
        cin >> b[j];
    }
    for (i=0;i<n;i++) {
        int sum = 0;
        for (j=0;j<m;j++) {
            sum += A[i][j]*b[j];
        }
        cout << sum << endl;
    }
    return 0;
}


Measured memory_bytes: 3144
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdlib.h>
#include<stack>
#include<set>
#include<string.h>
#include<map>
#include<vector>
#define pb push_back
#define ins insert 
#define mp make_pair
#define fi first
#define se second
#define ll long long 
#define max3(a,b,c) max(c,max(a,b))
#define min3(a,b,c) min(c,min(a,b))
#define M 10000000000000000
using namespace std;
int main(){
    //double start_time = clock();
    ll n,k,q;
    cin>>n>>k;
    ll a[n],dp[n]={0};
    for (int i = 0; i < n; ++i)
    {
        cin>>a[i];
        dp[i]=M;
    }
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
    for (ll i = 2; i < n; ++i)
        {
            q=0;
            for (ll j = i-1;j>=0 && q<k; --j ,q++)
            {
                dp[i] = min(dp[i],dp[j]+abs(a[j]-a[i]));
            }
        }
    //double end_time = clock();
    //printf( "Time = %lf ms\n", ( (end_time - start_time) / CLOCKS_PER_SEC)*1000);
    cout<<dp[n-1];
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#define N 100
#define INF 100000

int min(int a,int b){
  if(a < b) return a;
  else return b;
}

int main(){
  int i,l,j,k,n,p[N + 1],m[N + 1][N + 1];
  scanf("%d",&n);
  for(i = 1;i <= n;i++) scanf("%d %d",&p[i - 1],&p[i]);
  for(i = 1;i <= n;i++) m[i][i] = 0;
  for(l = 2;l <= n;l++){
    for(i = 1;i <= n - l + 1;i++){
      j = i + l - 1;
      m[i][j] = INF;
      for(k = i;k <= j - 1;k++) m[i][j] = min(m[i][j],m[i][k] + m[k + 1][j] + p[i - 1]*p[k]*p[j]);
    }
  }
  printf("%d\n",m[1][n]);
  return 0;
}

Measured memory_bytes: 636
#include<iostream>
#include<bits/stdc++.h>
#include<string>
#include<bitset>
#include<map>
#include<algorithm>
using namespace std ;
#define ll  long long int 
int main(){
    ll a ;
    cin >> a ;
    map<string , int> m ;
    while (a--)
    {
        string s ;
        cin >>s ;
        m[s]++ ;
    }
    cout << m.size() << endl ;
    return 0 ; 
} 


Measured memory_bytes: 19228
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        double[] aArr = new double[n];

        for (int i = 0; i < n; i++) {
            aArr[i] = (double)sc.nextInt();
        }

        double sum = 0.0d;
        for (int i = 0; i < n; i++) {
            sum += 1.0d/aArr[i];
        }

        System.out.println(1.0d/sum);
    }
}


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

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

  ll ans = 0;
  rep(i, n) {
    ll node = (n - i) * (i + 1);
    ans += node;
  }

  rep(i, n - 1) {
    ll u, v;
    cin >> u >> v;
    ll edge = min(u, v) * (n - max(u, v) + 1);
    ans -= edge;
  }

  cout << ans << endl;

  return 0;
}
/*
*/


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

int n, m;
vector < vector < int > > g;
vector < int > clr, p;
vector < deque < int > > cycles;

void dfs (int u) {
	++clr[u];
	for (int v: g[u]) {
		if (clr[v] == 0) {
			p[v] = u;
			dfs(v);
		}
		else if (clr[v] == 1) {
			deque < int > cycle;
			cycle.push_front(u);
			while (cycle.front() != v) 
				cycle.push_front(p[cycle.front()]);
			cycles.emplace_back(cycle);
		}
	}
	++clr[u];
}

signed main () {
	cin >> n >> m;
	g.resize(n + 1);
	for (int i = 0; i < m; ++i) {
		int a, b;
		cin >> a >> b;
		g[a].push_back(b);
	}
	for (int root = 1; root <= n; ++root) {
		clr.assign(n + 1, 0);
		p.assign(n + 1, -1);
		dfs(root);
	}
	bool found = 0;
	for (auto cycle: cycles) {
		unordered_set < int > uniq;
		for (int u: cycle) 
			uniq.insert(u);
		bool cap = 0;
		for (int u: cycle) {
			int in_cyc = 0;
			for (int v: g[u]) {
				if (uniq.find(v) != uniq.end())
					++in_cyc;
			}
			if (in_cyc != 1) {
				cap = 1;
				break;
			}
		}
		if (uniq.size() == cycle.size() && !cap) {
			cout << int(cycle.size()) << '\n';
			for (int u: cycle) 
				cout << u << '\n';
			found = 1;
			break;
		}
	}
	if (!found)
		cout << "-1\n";
}


Measured memory_bytes: 238088
n, m = map(int, input().split())
h = list(map(int, input().split()))

d = [[] for i in range(n)]

for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    d[a].append(h[b])
    d[b].append(h[a])

ans = 0
for i in range(n):
    flag = True
    for j in d[i]:
        if j >= h[i]:
            flag = False
    if flag:
        ans += 1

print(ans)

Measured memory_bytes: 23040
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
    const int MAX =200002;
const int MOD = 1000000007;


     signed main(){
   int n,k;
   cin>>n>>k;
   int a[n];
   for(int i=0;i<n;i++)cin>>a[i];
   for(int i=k;i<n;i++){
       if(a[i-k]<a[i])cout<<"Yes"<<endl;
       else cout<<"No"<<endl;
   }
  
  

     }


 


 






    





      

        


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

#define num_max(p,q)((p)>(q)?(p):(q))
#define num_min(p,q)((p)<(q)?(p):(q))
int cmp(const void *a, const void *b)
{
	return *(int*)a - *(int*)b;//昇順
	 //降順ならreturn *(int*)b - *(int*)a;
}
int main()
{
	long long N,i,ans=0;
	
	scanf("%lld", &N);
	char(*s) = (char(*))malloc(N* sizeof(char));
	scanf("%s", s);
	for (i = 0;i < N;i++)
	{
	
		if (s[i] != s[i + 1])
		{
			ans++;
		}
	}
	
	printf("%lld\n", ans);
	free(s);
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;
const int kmax = 510000;

long long fact[kmax], fact_inv[kmax], inv[kmax];

int gcd(int a, int b)
{
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
}

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < kmax; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int r)
{
    if (n < r) {
        return 0;
    }

    if (n < 0 || r < 0) {
        return 0;
    }

    return fact[n] * (fact_inv[r] * fact_inv[n - r] % mod) % mod;
}

template <typename T, T N>
class UnionFind {
    T parent_[N];
    T rank_[N];
    T size_[N];

public:
    UnionFind();
    T Root(T idx);
    bool IsSame(T x, T y);
    void Unite(T x, T y);
    T GetSize(T idx);
};

template <typename T, T N>
UnionFind<T, N>::UnionFind()
{
    for (T i = 0; i < N; i++) {
        parent_[i] = i;
        rank_[i] = 0;
        size_[i] = 1;
    }
}

template <typename T, T N>
T UnionFind<T, N>::Root(T idx)
{
    return parent_[idx] == idx ? idx : parent_[idx] = Root(parent_[idx]);
}

template <typename T, T N>
bool UnionFind<T, N>::IsSame(T x, T y)
{
    return Root(x) == Root(y);
}

template <typename T, T N>
void UnionFind<T, N>::Unite(T x, T y)
{
    x = Root(x);
    y = Root(y);
    if (x == y) {
        return;
    }

    if (rank_[x] < rank_[y]) {
        parent_[x] = y;
        size_[y] += size_[x];
    } else {
        parent_[y] = x;
        size_[x] += size_[y];
        if (rank_[x] == rank_[y]) {
            rank_[x]++;
        }
    }
}

template <typename T, T N>
T UnionFind<T, N>::GetSize(T idx)
{
    return size_[Root(idx)];
}

int main(void)
{
    std::string s;
    std::cin >> s;

    int n;
    std::cin >> n;

    for (int i = 0; i < n; i++) {
        if (s[i] != '1') {
            for (auto c : s) {
                if (c != '1') {
                    std::cout << c << std::endl;
                    return 0;
                }
            }
            std::cout << s.back() << std::endl;
            return 0;
        }
    }

    std::cout << s[n - 1] << std::endl;
}


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

namespace AtTest.ABC_146
{
    class A
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            string[] pats = new string[7] { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
            string s = Read();
            for (int i = 0; i < 7; i++)
            {
                if (pats[i].Equals(s))
                {
                    WriteLine(7 - i);
                    return;
                }
            }
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


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

int main(){
	int n;
	int k = 0;
	set<int> s;
	cin >> n;
	for(int i=0;i<n;i++){
		int a = 0;
		cin >> a;
		auto it = s.find(a);
		if(it != s.end()){
			s.erase(it);
			k--;
		}else{
			s.insert(a);
			k++;
		}
	}
	cout << k;
	return 0;
}

Measured memory_bytes: 4864
coin500 = int(input())
coin100 = int(input())
coin50 = int(input())
price = int(input())

count = 0

i = 0
while i <= coin500:
    j = 0
    while j <= coin100:
        k = 0
        while k <= coin50:
            if i * 500 + j * 100 + k * 50 == price:
                count += 1
            k += 1
        j += 1
    i += 1

print(count)


Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<cmath>
#include<cstdio>
using namespace std;
typedef long long ll;
const int INF=1e9;

int main(){
    int N,K; cin >> N >> K;
    double odd;
    double ans=0;
    if(N<=K-1){
        for(int i=1;i<=N;i++){
            int k=0;
            long long n=i;
            bool flag=true;
            while(flag==true){    
                k++;
                n*=2;
                if(n>=K) flag=false;
            }
            odd=pow(0.5,k);
            odd*=1.0/N;
            ans+=odd;
        }
    }else{
        for(int i=1;i<=K-1;i++){
            int k=0;
            long long n=i;
            bool flag=true;
            while(flag==true){    
                k++;
                n*=2;
                if(n>=K) flag=false;
            }
            odd=pow(0.5,k);
            odd*=1.0/N;
            ans+=odd;
        }
        for(int i=K;i<=N;i++){
            ans+=1.0/N;
        }
    }
    printf("%.10f\n",ans);
}

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

using namespace std;
#include <vector>
#define rep(i,n) for (ll i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define base10_4 10000      //1e4
#define base10_5 100000     //1e5
#define base10_6 1000000    //1e6
#define base10_7 10000000   //1e7
#define base10_8 100000000  //1e8
#define base10_9 1000000000 //1e9

#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

ll N;
ll K;
vll H;

ll ltmp;
string stmp;
double dtmp;

ll llmin(ll a,ll b){
    if(a>=b) return b;
    return a;
}
ll llmax(ll a,ll b){
    if(a<=b) return b;
    return a;
}
int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin >> N;
    cin >> K;

    rep(ni,N){
        cin >> ltmp;
        H.push_back(ltmp);
    }
    sort(H.rbegin(), H.rend());

    ll ans = 0;
    for( ll ki = K+1 ; ki <=N ; ki++ ){
        ans += H[ki-1];
    }
    cout << ans << endl;


    

}

Measured memory_bytes: 2420
/*
...........__________    							 |										    ___  __
.............|       |     						     |											 |   /
.............|       |     						     |									  		 |  /
.............|       |                               |                         __                | /      _______
.............|_______|  _______            _______   |______   ________   /|  /  |               |/       |      |
.............| \               | |      | |          |      |          | / | /   |               |\       |
.............|  \       _______| |      | |_______   |      |   _______|   |/    |               | \      |
.............|   \      |      | |      |         |  |      |  |       |   |     |               |  \     |
.........  __|    \__|  |______| |______| ________|  |      |_ |_______|   |     |__|           _|   \__ _|        .

*/
#include<bits/stdc++.h>
using namespace std ;
#define int 				long long
#define ull 				unsigned long long int
#define ld 					long double
#define vi 					vector<int>
#define vii 				vector<pair<int,int>>
#define vvi 				vector<vector<int>>
#define pf 					push_front
#define popb 				pop_back
#define pb 					push_back
#define eb 					emplace_back
#define pii 				pair<int,int>
#define prec(x) 			fixed<<setprecision(15)<<x
#define all(x) 				x.begin(),x.end()
#define rall(x) 			x.rbegin(),x.rend()
#define mset(a,b) 			memset(a,b,sizeof(a))
#define mcpy(a,b) 			memcpy(a,b,sizeof(a))
#define fo0(i,n) 			for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n) 			for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b) 			for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)			for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)			for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define inf 1e18
const int mod=1e9+7;
const int N=4e5+10;

void raushan_kumar(){
	int a[3][3];
	fo0(i,3){
		fo0(j,3){
			cin>>a[i][j];
		}
	}
	int b[3][3];
	mset(b,0);
	int n;cin>>n;
	fo0(i,n){
		int x;cin>>x;
		fo0(i,3){
			fo0(j,3){
				if(a[i][j]==x){
					b[i][j]=1;
				}
			}
		}
	}

	// int flag=0,flag2=0,flag3=0;
	// fo0(i,3){
	// 	flag=0;
	// 	fo0(j,3){
	// 		if(b[i][j]!=1){
	// 			flag=1;
	// 		}
	// 	}
	// 	if(!flag){
	// 		cout<<"Yes";
	// 		return;
	// 	}
	// }
	// fo0(j,3){
	// 	flag2=0;
	// 	fo0(i,3){
	// 		if(b[i][j]!=1){
	// 			flag2=1;
	// 		}
	// 	}
	// 	if(!flag2){
	// 		cout<<"Yes";
	// 		return;
	// 	}
	// }
	// fo0(i,3){
	// 	flag3=0;
	// 	if(b[i][i]!=1){
	// 		flag3=1;
	// 	}
	// 	if(!flag3){
	// 		cout<<"Yes";
	// 		return;
	// 	}
	// }
	// cout<<"No";
	int sum=0;
	fo0(i,3){
		sum=0;
		fo0(j,3){
			sum+=b[i][j];
		}
		if(sum==3){
			cout<<"Yes";
			return;
		}
	}
sum=0;
	fo0(j,3){
		sum=0;
		fo0(i,3){
			sum+=b[i][j];
		}
		if(sum==3){
			cout<<"Yes";
			return;
		}
	}
sum=0;
	fo0(i,3){
		sum+=b[i][i];
		if(sum==3){
			cout<<"Yes";
			return;
		}
	}
sum=0;
	sum=b[2][0]+b[1][1]+b[0][2];
	if(sum==3){
		cout<<"Yes";
		return;
	}
	cout<<"No";

}

int32_t main()
{
	
	fast;int t=1;
	//cin>>t;
	while(t--){
		raushan_kumar();
	}

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>

constexpr long long int MOD = 1000000007;

int main() {
	int n; std::cin >> n;
	std::vector<long long int> factorial(n, 1), inverse(n, 1);
	for (auto i = 2; i < factorial.size(); ++i) {
		factorial[i] = i * factorial[i - 1] % MOD;
		inverse[i] = (MOD - MOD / i) * inverse[MOD % i] % MOD;
	}
	std::vector<long long int> positions(n);
	for (auto& x : positions) std::cin >> x;
	long long int sum = 0;
	long long int result = 0;
	for (auto i = 1; i < n; ++i) {
		sum += factorial[n - 1] * inverse[i] % MOD;
		sum %= MOD;
		result += (positions[i] - positions[i - 1]) * sum % MOD;
		result %= MOD;
	}
	std::cout << result << '\n';
}


Measured memory_bytes: 3192
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
#include<set>
#include<queue>

typedef long long ll;


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

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 long long INF = 1000000000000000;
typedef pair<int, int> P;
ll ma = 1000000000 + 7;
ll h, w, n, m,k,l; string s;
char maze[60][60];
int dis[101][101];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };

int main() {
	ll a, b, c;
	cin >> a >> b >> c;
	cout << (c / a) * b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll K, N; cin >> K >> N;
  ll maxA = 0, tmp = 0;
  vector<ll> A(N, 0);
  REP(i, N){
    cin >> A[i];
    if(i){
      maxA = max(maxA, A[i]-A[i-1]);
    }
  }
  maxA = max(K-A[N-1]+A[0], maxA);
  cout << K-maxA << endl;
}

Measured memory_bytes: 1792
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		int max = 0;
		for (int i = 0; i < n; i++) {
		    arr[i] = sc.nextInt();
		    max = Math.max(max, arr[i]);
		}
		int[] ans = new int[n];
		countingSort(arr, ans, max);
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
		    if (i > 0) {
		        sb.append(" ");
		    }
		    sb.append(ans[i]);
		}
		System.out.println(sb);
	}
	
	static void countingSort(int[] arr, int[] ans, int k) {
	    int[] counts = new int[k + 1];
	    for (int x : arr) {
	        counts[x]++;
	    }
	    for (int i = 1; i <= k; i++) {
	        counts[i] += counts[i - 1];
	    }
	    for (int i = arr.length - 1; i >= 0; i--) {
	        ans[counts[arr[i]] - 1] = arr[i];
	        counts[arr[i]]--;
	    }
	}
}



Measured memory_bytes: 508904
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define ll_MAX LONG_LONG_MAX
#define ll_MIN LONG_LONG_MIN
#define pi pair<int,int>
#define endl "\n"
#define MAXN 100005
#define mod 1000000007
using namespace std;

void solve()
{
    
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	cout.tie(NULL);
    solve();
    ll k,x;
    cin>>k>>x;
    if(500*k >= x)
    {
        cout<<"Yes"<<'\n';
    }
    else
    {
        cout<<"No"<<'\n';
    }
    
}

Measured memory_bytes: 3604
#include <iostream>
#include <algorithm>
#include <string>
typedef long long ll;
using namespace std;


typedef struct Node {
	int key;
	Node *parent, *lchild, *rchild;
	Node(int k, Node *p = NULL, Node *l = NULL, Node *r = NULL) : key(k), parent(p), lchild(l), rchild(r) {}
} *Tree;

void insert(Tree& T,  int k)
{
	Tree p = NULL;
	Tree x = T;
	Tree z;
	while (x != NULL)
	{
		p = x;
		if (x->key > k)
			x = x->lchild;
		else
			x = x->rchild;
	}
	z = new Node(k, p);
	if (p == NULL)
	{
		T = z;
	}
	else if (z->key > p->key)
		p->rchild = z;
	else
		p->lchild = z;
}

void preorder(Tree T)
{
	if (T == NULL)
		return;
	cout << ' ' << T->key;
	preorder(T->lchild);
	preorder(T->rchild);
}

void inorder(Tree T)
{
	if (T == NULL)
		return;
	inorder(T->lchild);
	cout << ' ' << T->key;
	inorder(T->rchild);
}

void Print(Tree T)
{
	inorder(T);
	cout << endl;
	preorder(T);
	cout << endl;
}

int main()
{
	int n, key;
	char op[10];
	Tree T = NULL;
	Tree *temp;

	cin >> n;
	while (n--)
	{
		cin >> op;
		if (op[0] == 'i')
		{
			cin >> key;			
			insert(T, key);
		}
		else
			Print(T);
	}

	return 0;
}

Measured memory_bytes: 26544
// AtCoder My Practice
// author: Leonardone @ NEETSDKASU

fn main() {
	let mut stdin = String::new();
    std::io::Read::read_to_string(
    	&mut std::io::stdin(),
        &mut stdin).unwrap();
	let mut stdin = stdin.split_whitespace();
	let mut get = || stdin.next().unwrap();
    macro_rules! get {
    	() => (get().parse::<i64>().unwrap());
    }
    
    let n = get!() as usize;
    let mut sum = vec![];
    let mut ans = 0_i64;
    sum.push(0);
    for _ in 0..n {
    	let x = get!();
        let e = sum.last().unwrap() + x;
        sum.push(e);
    }
    sum.sort();
    let mut p = sum[0];
    let mut c = 1_i64;
    for i in 1..sum.len() {
    	if p == sum[i] {
        	c += 1;
        } else {
            ans += c * (c - 1) / 2;
            c = 1;
            p = sum[i];
        }
    }
    ans += c * (c - 1) / 2;
    // println!("{:?}", sum);
    println!("{}", ans);
}

Measured memory_bytes: 10492
#include<stdio.h>
#include<math.h>

int main()
{
	int x[100], y[100],n;
	double p;
/*?°???\??¨???*/
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &x[i]);
	}
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &y[i]);
	}
/*??????????????????????????¢*/
	for (p = 1; p < 4; p++)
	{
		double minkohu = 0;
		for (int a=0; a < n; a++)
		{
			minkohu = minkohu + pow(fabs(x[a] - y[a]), p);
		}
		minkohu = pow(minkohu, 1 / p);
		printf("%lf\n", minkohu);
		minkohu = 0;
	}
/*?????§????????§????????¢*/
	double distance,num;
	distance = fabs(x[0] - y[0]);
	for (int j = 1; j < n; j++)
	{
		num = fabs(x[j] - y[j]);
		if (num > distance)
		{
			distance = num;
		}
	}
	printf("%lf\n", distance);
	return 0;
}

Measured memory_bytes: 1128
#include <stdio.h>
#include <stdlib.h>
int main(void){
    // Your code here!
    int H,A,W,B;
    int matrix[1001][1001];
    int i,j;
    int change_flag=1;
    scanf("%d %d %d %d\n",&H,&W,&A,&B);
    for(i=1;H>=i;i++){
        if(i==B+1)    change_flag = 0;
        for(j=1;W>=j;j++){
            if(change_flag){
                if(j<=A){
                    matrix[i][j] = 1;
                }
                else{
                    matrix[i][j] = 0;
                }
            }
            else{
                if(j<=A){
                    matrix[i][j] = 0;
                }
                else{
                    matrix[i][j] = 1;
                }
            }
        }
    }
    
    for(i=1;H>=i;i++){
        for(j=1;W>=j;j++){
            printf("%d",matrix[i][j]);
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int N;
  vector<int> P, Q;
  cin >> N;
  for (int i=0; i<N; i++) {
    int d;
    cin >> d;
    P.push_back(d);
  }
  for (int i=0; i<N; i++) {
    int d;
    cin >> d;
    Q.push_back(d);
  }
  if (Q < P) {
    swap(P, Q);
  }
  int ret = 0;
  do {
    if (P == Q) break;
    ret++;
  } while (next_permutation(P.begin(), P.end()));
  cout << ret << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <numeric>
#include <map>
#define fail return puts("-1"), 0

const int N = 1e5 + 5, M = 2e5 + 5;

int n, tot, lnk[N], ter[M], nxt[M], sz[N], fa[N];
long long dep[N], d[N], D[N];
std::map<long long, int> mp;

void add(int u, int v) {
	ter[++tot] = v, nxt[tot] = lnk[u], lnk[u] = tot;
}
void dfs1(int u, int p) {
	sz[u] = 1;
	for (int i = lnk[u]; i; i = nxt[i]) {
		int v = ter[i];
		if (v == p) continue;
		dep[v] = dep[u] + 1;
		dfs1(v, u);
		sz[u] += sz[v];
	}
}
void dfs2(int u, int p) {
	for (int i = lnk[u]; i; i = nxt[i]) {
		int v = ter[i];
		if (v == p) continue;
		D[v] = D[u] - 2 * sz[v] + n;
		dfs2(v, u);
	}
}
int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%lld", &d[i]);
		mp[d[i]] = i;
		sz[i] = 1;
	}
	int cnt = 0;
	for (auto it = mp.rbegin(); it != mp.rend(); it++) {
		int v = it->second;
		long long now = it->first;
		long long s = now + 2 * sz[v] - n;
		if (!mp.count(s)) fail;
		int u = mp[s];
		if (u == v) fail;
		fa[v] = u, sz[u] += sz[v];
		add(u, v), add(v, u);
		if (++cnt == n - 1) break;
	}
	dfs1(1, 0);
	D[1] = std::accumulate(dep + 1, dep + n + 1, 0LL);
	dfs2(1, 0);
	for (int i = 1; i <= n; i++) {
		if (D[i] != d[i]) fail;
	}
	for (int i = 1; i <= n; i++) {
		if (fa[i]) printf("%d %d\n", i, fa[i]);
	}
	return 0;
}

Measured memory_bytes: 17280
#include <bits/stdc++.h>
 using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
 int main(){
  int a,b,c,d;
   cin>>a>>b;
   c=min(a,b);
   d=max(a,b);
   rep(i,d){
   cout<<c;
   }
   cout<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
using namespace std;
int main()
{
	int a,i;
	char s[105];
	scanf("%s",s);
	a=strlen(s);
	if(a==2)
	{
		for(i=0;i<2;i++)
		{
			printf("%c",s[i]);
		}
		printf("\n");
	}
	else if(a==3)
	{
		for(i=2;i>=0;i--)
		{
			printf("%c",s[i]);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n, m;
	while(cin >> n >> m, n){
		int ans = -1;
		vi v(n);
		for(auto &p : v) cin >> p;
		rep(i, n) rep(j, i) if(v[i] + v[j] <= m){
			ans = max(ans, v[i] + v[j]);
		}
		
		if(ans < 0) cout << "NONE" << endl;
		else cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3208
// Problem : B - Distance
// Contest : AtCoder - AtCoder Beginner Contest 174
// URL : https://atcoder.jp/contests/abc174/tasks/abc174_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb push_back
#define mk make_pair
#define fast                    \
  ios_base::sync_with_stdio(0); \
  cin.tie(0);                   \
  cout.tie(0);
#define rep(i, a, b) for (ll i = a; i < b; i++)
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define sz(x) (int)x.size()
#define mem(a, val) memset(a, val, sizeof(a))
#define deci(x) cout << fixed << setprecision(x);
#define bitcount(x) __builtin_popcountll(x)

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

const long long int mod = 1e9 + 7;
const long double EPS = 1e-12;
const int N = 1e5 + 20;

void solve() {
  ll n, d;
  cin >> n >> d;
  d = d * d;
  ll ans = 0;
  rep(i, 0, n) {
    ll x, y;
    cin >> x >> y;
    if ((x * x + y * y) <= d) ans++;
  }
  cout << ans;
}
int main() {
  fast;
  ll t;
  t = 1;

  // cin>>t;

  while (t--) {
    solve();
  }

  return 0;
}


Measured memory_bytes: 3612
s = input().split()
N = int(s[0])
K = int(s[1])

ans = N // K 
ans = ans ** 3

ans_ev = 0
if K % 2 == 0:
  ans_ev = (N+(K//2)) // (K)
  ans_ev = ans_ev ** 3
                         

print(ans+ ans_ev ) 

Measured memory_bytes: 3060
import numpy as np


n = int(input())
a = np.array(list(map(int, input().split())))
a.sort()
a_cum = a.cumsum()
ng = a_cum[:-1] * 2 < a[1:]
ng = np.logical_or.accumulate(ng[::-1])[::-1]
x = (~ng).sum() + 1
print(x)


Measured memory_bytes: 38668
import math

loopnum = int(input())
cnt = 0
for i in range(loopnum):

	chknum = int(input())
	rootnum = int(math.sqrt(chknum))

	for j in range(2,rootnum+1):
		if chknum % j == 0:
			break
	else:
		cnt += 1

	# TLE
	#for j in range(2,chknum):
	#	if chknum % j == 0:
	#		break
	#else:
	#	cnt += 1

print(cnt)



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

#define PI 3.14159265358979323846264338327950288419

using namespace std;

int h, w, n;

int main(){
	scanf("%d %d %d", &h, &w, &n);
	int ans = 999;
	for(int i = 0; i <= h; i++){
		for(int j = 0; j <= w; j++){
			if(i * j + n <= h * w){
				ans = min(ans, (h - i) + (w - j));
			}
		}
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 256
#include<iostream>
using std::cin;
using std::cout;
using std::endl;

int main(void){
  int N,R;
  cin >> N >> R;
  if(N < 10){
    R += (100 * (10 - N));
    cout << R << endl;
  }
  else{
    cout << R << endl;
  }
}

Measured memory_bytes: 256
n,a,b,c,d=map(int,input().split())
s=n//a
t=n//c
if n%a!=0:
    C=s+1
else:
    C=s
if n%c!=0:
    D=t+1
else:
    D=t
X=C*b
Y=D*d
if X<=Y:
    print(X)
else:
    print(Y)


Measured memory_bytes: 5596
#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		N;
	string	S;
	cin >> N >> S;
	int		count;
	count = 0;
	rep(i, 1000)
	{
		vector<int> vec(3);
		vec.at(0) = i / 100;
		vec.at(1) = (i / 10) % 10;
		vec.at(2) = i % 10;
		int	d;
		d = 0;
		rep(j, N)
		{
			if (S.at(j) == vec.at(d) + '0')
				d++;
			if (d == 3)
			{
				count++;
				break;
			}
		}
	}
	cout << count << endl;
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int A, B;
    cin >> A >> B;
    int ans = A + B;
    ans = max(ans, A + A - 1);
    ans = max(ans, B + B - 1);
    cout << ans;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
string s;

cin>>s;
int n=s.length();						
if(n==2)
{
cout<<s<<endl;
}
else
{
for(int i=n-1;i>=0;i--)
cout<<s[i];
}
return 0;
}

Measured memory_bytes: 256
w=str(input())
for i in range(len(w)):
    if i>len(w):break
    if w[i]=="a" and w[i+1]=="p" and w[i+2]=="p" and w[i+3]=="l" and w[i+4]=="e":
        w=w[:i]+"peach"+w[i+5:]
        continue
    if w[i]=="p" and w[i+1]=="e" and w[i+2]=="a" and w[i+3]=="c" and w[i+4]=="h":
        w=w[:i]+"apple"+w[i+5:]
print(w)


Measured memory_bytes: 5556
# include <iostream>
# include <vector>
# include <limits>
# include <algorithm>
# include <map>
# include <string>
# include <functional>
using namespace std;

int main() {
	int n,m;
	cin >> n >> m;
	int ans = n + m;
	if (ans >= 24) {
		ans -= 24;
	}
	cout << ans << endl;
}

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

struct Node{
	int key;
	Node *right,*left,*parent;
};

Node *root,*NIL;

Node * find(Node *u,int k){
	while(u!=NIL&&k!=u->key){
		if(k<u->key)u=u->left;
		else u=u->right;
	}
	return u;
}

void insert(int k){
	Node *y=NIL;
	Node *x=root;
	Node *z;
	
	z=(Node *)malloc(sizeof(Node));
	z->key=k;
	z->left=NIL;
	z->right=NIL;
	
	while(x!=NIL){
		y=x;
		if(z->key<x->key){
			x=x->left;
		}else{
			x=x->right;
		}
	}
	
	z->parent=y;
	if(y==NIL){
		root=z;
	}else{
		if(z->key<y->key){
			y->left=z;
		}else{
		y->right=z;
		}
	}
}

void inorder(Node *u){
	if(u==NIL)return;
	inorder(u->left);
	printf(" %d",u->key);
	inorder(u->right);
}
void preorder(Node *u){
	if(u==NIL)return;
	printf(" %d",u->key);
	preorder(u->left);
	preorder(u->right);
}

int main(){
	int n,i,x;
	string com;
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		cin>>com;
		if(com[0]=='f'){
			scanf("%d",&x);
			Node *t=find(root,x);
			if(t!=NIL)printf("yes\n");
			else printf("no\n");
		}else if(com=="insert"){
			scanf("%d",&x);
			insert(x);
		}else if(com=="print"){
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}
	}
	
	return 0;
}


Measured memory_bytes: 22072
#include <bits/stdc++.h>
using namespace std;
#pragma region Macros
typedef long long ll;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
const long long MOD=1e9+7;
// const long long MOD=998244353;
const int INF=1e9;
const long long IINF=1e18;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
const char dir[4]={'D','R','U','L'};
#define LOCAL

template<typename T>
istream &operator>>(istream &is,vector<T> &v){
    for (T &x:v) is >> x;
    return is;
}
template<typename T>
ostream &operator<<(ostream &os,const vector<T> &v){
    for (int i=0;i<v.size();++i){
        os << v[i] << (i+1==v.size()?"": " ");
    }
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const pair<T,U> &p){
    cout << '(' << p.first << ',' << p.second << ')';
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const map<T,U> &m){
    os << '{';
    for (auto itr=m.begin();itr!=m.end();++itr){
        os << '(' << itr->first << ',' << itr->second << ')';
        if (++itr!=m.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os,const set<T> &s){
    os << '{';
    for (auto itr=s.begin();itr!=s.end();++itr){
        os << *itr;
        if (++itr!=s.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}

void debug_out(){cerr << '\n';}
template<class Head,class... Tail>
void debug_out(Head&& head,Tail&&... tail){
    cerr << head;
    if (sizeof...(Tail)>0) cerr << ", ";
    debug_out(move(tail)...);
}
#ifdef LOCAL
#define debug(...) cerr << " ";\
cerr << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << '\n';\
cerr << " ";\
debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<typename T> T gcd(T x,T y){return y!=0?gcd(y,x%y):x;}
template<typename T> T lcm(T x,T y){return x/gcd(x,y)*y;}

template<class T1,class T2> inline bool chmin(T1 &a,T2 b){
    if (a>b){a=b; return true;} return false;
}
template<class T1,class T2> inline bool chmax(T1 &a,T2 b){
    if (a<b){a=b; return true;} return false;
}
#pragma endregion

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S,T; cin >> S >> T;
    int ans=0;
    for (int i=0;i<S.size();++i) ans+=(S[i]!=T[i]);
    cout << ans << '\n';
}

Measured memory_bytes: 3804
#include <iostream>
#include <vector>
#include <string>

using namespace::std;



int main()
{

	int N, Q, S;

	cin >> N;
	cin >> Q;
	


	string str;
	cin >> str;

	//cout << str << endl;
	string AC = "AC";
	
	
	vector<int> M(N);
	vector<int> L(Q);
	vector<int> R(Q);

	for (int i = 0; i < Q; i++) {
		cin >> L[i];
		cin >> R[i];

	}

	int num = 0;
	for (int i = 0; i < N; i++) {
		if (str[i] == AC[0]) {
			if (str[i+1] == AC[1]) {
				M[i] = num;
				i++;
				num++;
				M[i] = num;
			}
			else {
				M[i] = num;
			}
		}
		else {
			M[i] = num;
		}
	}

	for (int i = 0; i < N; i++) {
		//cout << M[i];
	}
	//cout << endl;

	for (int i = 0; i < Q; i++) {
		int sum = 0;
		
		sum = M[R[i] - 1] - M[L[i] - 1];

		cout << sum << endl;
	}



	return 0;

}

Measured memory_bytes: 2176