akhauriyash/Code-Regression huggingface dataset:
import sys
input = sys.stdin.readline

def gcd(a: int, b: int):
    """ https://cocodrips.hateblo.jp/entry/2014/03/05/143623
    """
    while b:
        a, b = b, a%b
    return a

def lcm(a: int, b: int):
    return a * b // gcd(a, b)


def main():
    N = int(input())
    #K,X = map(int, input().split())
    #vA = list(map(int, input().split())
    S = input().rstrip()
    #print(S)
    #print(lcm(N, M))
    #print("Yes" if X<=500*K else "No")
    print(S.count("ABC"))


if __name__ == "__main__":
    main()


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

string S;

int main() {
    cin >> S;
    for (int i = 0; i < S.length() - 1; i++) {
        if (S[i] == S[i + 1]) {
            cout << i + 1 << " " << i + 2 << endl;
            return 0;
        }
    }
    for (int i = 0; i < S.length() - 2; i++) {
        if (S[i] == S[i + 2]) {
            cout << i + 1 << " " << i + 3 << endl;
            return 0;
        }
    }
    cout << -1 << " " << -1 << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#define ll long long
#define INF 1000000000000000001
#define MOD 1000000007
using namespace std;



int main(){
    while(1){
        int n;
        cin >> n;
        if(n==0){
            break;
        }
        
        string str[1000];
        int dots[10000]={};
        for(int i=0; i<n; i++){
            cin >> str[i];
            
            for(int k=0; k<str[i].length(); k++){
                if(str[i][k]=='.'){
                    dots[i]++;
                }
            }
        }

        for(int i=1; i<n; i++){
            if(dots[i]>0){
                str[i][dots[i]-1]='+';
            }

            for(int k=0; k<dots[i]; k++){
                
                if(str[i][k]=='.'){
                    str[i][k]=' ';
                }
                    
            }
 
        }
        
        for(int i=n-1; i>=1; i--){
            for(int k=0; k<str[i].length(); k++){
                if(str[i][k]=='+'){
                    
                    for(int j=i-1; j>=0; j--){
                        if(str[j][k]==' '){
                            str[j][k]='|';
                        }else{
                            break;
                        }
                    }
                    
                    
                }
            }
        }
        
        for(int i=0; i<n; i++){
            cout<<str[i]<<endl;
        }
        
    }
    return 0;
}



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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  
  if(((a==b)&&(a!=c))||((b==c)&&(b!=a))||((c==a)&&(c!=b))) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

vector<pair<int, int>> prime_fact(int n) {
  vector<pair<int, int>> ans;
  int posi = 2;
  int copy = n;
  while(posi*posi<=n) {
    if(copy%posi==0) {
      int times = 0;
      while(copy%posi==0) {
        copy = copy/posi;
        times++;
      }

      pair<int, int> add;
      add.first = posi;
      add.second = times;
      ans.push_back(add);
    }

    posi++;
  }

  if(copy!=1) {
    pair<int, int> add;
    add.first = copy;
    add.second = 1;
    ans.push_back(add);
  }

  return ans;
}


int64_t modpow(int64_t x, int64_t n) {
  const int MOD = 1000000007;
  x = x%MOD;
  if(n==0) return 1;  //再帰の終了条件

  else if(n%2==1) {
    return (x*modpow(x, n-1))%MOD;  //nが奇数ならnを1ずらす
  }
  else return modpow((x*x)%MOD, n/2)%MOD;  //nが偶数ならnが半分になる
}


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

  const int MOD = 1000000007;
  sort(a, a+n);

  int ma = a[n-1];
  bool isprime[ma+1];
  for(int i=0; i<=ma; i++) isprime[i] = true;
  isprime[0] = false;
  isprime[1] = false;

  int posi = 2;
  while(posi*posi<=ma) {
    if(isprime[posi]) {
      int times = posi;
      while(posi*times<=ma) {
        isprime[posi*times] = false;
        times++;
      }
    }
    posi++;
  }

  // for(int i=0; i<=ma; i++) cout<<isprime[i]<<endl;

  int lcm[ma+1];
  for(int i=0; i<=ma; i++) lcm[i]=0;

  for(int i=0; i<n; i++) {
    vector<pair<int, int>> tmp = prime_fact(a[i]);
    int m = tmp.size();
    for(int j=0; j<m; j++) {
      if(lcm[tmp[j].first] < tmp[j].second) lcm[tmp[j].first] = tmp[j].second;
    }
  }

  // for(int i=0; i<=ma; i++) cout<<lcm[i]<<endl;

  int64_t lmod = 1;
  for(int i=0; i<=ma; i++) {
    if(lcm[i]!=0) {
      lmod = (lmod * modpow(i, lcm[i]))%MOD;
    }
  }

  int ans = 0;
  for(int i=0; i<n; i++) {
    int64_t div = modpow(a[i], MOD-2);
    int64_t add = (lmod*div)%MOD;
    ans += add;
    ans = ans%MOD;
  }

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

Measured memory_bytes: 8524
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>	// upper_bound(A, A+N, num), lower_bound(A, A+N, num)
#include <functional>
#include <string>
#include <sstream>
#include <complex>
#include <vector>		// V[i],  push_back(x), pop_back(), insert(index, x), erase(index), sort(v.begin(), v.end(), greater<int>())
#include <list>			// push_front(x), push_back(x), pop_front(), pop_back(), insert(index, x)
#include <queue>		// push(x), front(), pop()
#include <deque>
#include <stack>		// push(x), top(), pop()
#include <map>			// M[key],  insert(key, val), erase(key), find(key), 
#include <set>			// insert(key), erase(key), find(key)

using namespace std;
typedef long long ll;
// typedef pair<int, int> P;

#define PI 3.141592653589793)
#define MOD 1000000007
#define REP(i, n) for(int i = 0; i < n; i++)

int N;
const int MAX_N = 1000000;

// エラトステネスの篩　n以下の素数の数
// O(N log log N)
int prime[MAX_N];			// i番目の素数
bool is_prime[MAX_N + 1];	// is_prime[i]がtrueならiは素数

							// n以下の素数の数を返す
int sieve(int n) {
	int p = 0;
	for (int i = 0; i <= n; i++) is_prime[i] = true;
	is_prime[0] = is_prime[1] = false;
	for (int i = 2; i <= n; i++) {
		if (is_prime[i]) {
			prime[p++] = i;
			for (int j = 2 * i; j <= n; j += i)is_prime[j] = false;
		}
	}
	return p;
}

void solve() {
	cin >> N;
	sieve(1000000);
	int cnt = 0;
	for (int i = 0; prime[i] <= 55555; i++) {
		if (prime[i] % 10 == 3) {
			cout << prime[i] << (cnt < N - 1 ? " " : "\n" );
			cnt++;
			if (cnt == N) break;
		}

	}
}

int main() {
	solve();
	return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;
const ll INF=1e18;

int main(){
    ll x,y;cin>>x>>y;
    if(abs(x-y)<=1)cout<<"Brown"<<endl;
    else cout<<"Alice"<<endl;
}

Measured memory_bytes: 3640
using System;
using System.Linq;
namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var list = parseIntList(Console.ReadLine().TrimEnd());
            Console.WriteLine(list[0] <= list[1] ? "unsafe" : "safe");
        }
        static int[] parseIntList(string obj){
            return (int[])obj.Split(" ").Select(x=> int.Parse(x)).ToArray();
        }
    }
}


Measured memory_bytes: 19056
#!/usr/bin/env python3
A, B, C, X, Y = map(int, input().split())

patterns = [0] * 4
patterns[0] = A * X + B * Y
patterns[1] = C * max(X, Y) * 2
patterns[2] = C * Y * 2 + A * (X - Y) if X > Y else float('inf')
patterns[3] = C * X * 2 + B * (Y - X) if X < Y else float('inf')

print(min(patterns))


Measured memory_bytes: 9020
#coding:utf-8
import numpy as np
import collections
N = 1000000
_ = int(input())
ls = list(map(int,input().split()))
ls.append(N)
ls.append(N)
array = np.array(ls).reshape(-1,2).T
c_even = collections.Counter(array[0])
c_odd = collections.Counter(array[1])
if len(set(ls))==2:
    print (int((len(ls)-2)/2))
elif c_even.most_common()[0][0] != c_odd.most_common()[0][0]:
    print (len(ls)-c_even.most_common()[0][1]-c_odd.most_common()[0][1]-2)
else:
    print (min(len(ls)-c_even.most_common()[0][1]-c_odd.most_common()[1][1]-2,len(ls)-c_even.most_common()[1][1]-c_odd.most_common()[0][1]-2))


Measured memory_bytes: 33976
K=int(input())
x=[0]*11
p=0
def f(p):
    if x[p]<9:
        x[p]+=1
        g(p)
    else:
        p+=1
        x[:p+1]=[0]*p+[1]
    return p
def g(p):
    y=x[p]
    for i in range(p-1,-1,-1):
        y=max(y-1,0)
        x[i]=y
for i in range(K):
    z=0
    if p==0:
        p=f(p)
    else:
        for q in range(p):
            if x[q]<x[q+1]+1 and x[q]<9:
                x[q]+=1
                g(q)
                z=1
                break
        if z==0:
            p=f(p)
while x[-1]==0:
    x.pop()
print("".join(reversed([str(n) for n in x])))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;string s;
int dp[5005][5005];
int main(){
    ios::sync_with_stdio(false);
    cin>>n>>s;
    for(int i=n-1;i>=0;i--){
        for(int j=n-1;j>i;j--){
            if(s[i]==s[j])
                dp[i][j]=min(dp[i+1][j+1]+1,j-i);
            else
                dp[i][j]=0;
        }
    }
    int ans=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            ans = max(ans,dp[i][j]);
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 96896
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <string>
#include <numeric>
#include <queue>
#include <cstdio>
#include <cstring>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define all(a) (a).begin(),(a).end()
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define pl pair<ll,ll>
#define inf 1001001001001001000
//#define mod 1000000007
#define mod 998244353
#define pi 3.1415926535
using namespace std;
struct __INIT {
	__INIT() {
		cin.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(15);
	}
}__init;

map<ll,ll> primefact(ll n){
    ll a = 2;
    map<ll,ll> ret;
    if(n == 1) return ret;
    while(a*a <= n){
        if(n%a == 0){
            n /= a;
            ret[a]++;
        }
        else{
            a++;
        }
    }
    ret[n]++;
    return ret;
}


int main(void) {
    ll n;
    cin>>n;
    map<ll,ll> pitsu = primefact(n);
    ll ans = 0;
    for(pair<ll,ll> ngo:pitsu){
        ll i = 1;
        ll ngoo = 0;
        while(ngo.second-(i+ngoo) > 0){
            ngoo += i;
            i++;
        }
        if(ngo.second-(i+ngoo) == 0) ans += i;
        else ans += (i-1);
    }
    cout<<ans<<endl;
	return 0;
}


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

using namespace std;

#define f first
#define s second
#define ll long long
#define pb push_back

const int INF = 1e7;

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

int n, m, d[1005][1005], nx, ny, ma;

char a[1005][1005];

queue <pair <int, int> > q;

pair <int, int> x;

int main(){
    cin >> n >> m;
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= m; j++){
            cin >> a[i][j];
            d[i][j] = INF;
        }
    }
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= m; j++){
            if (a[i][j] == '#'){
                q.push({i, j});
                d[i][j] = 0;
            }
        }
    }

    while (!q.empty()){
        x = q.front();
        q.pop();

        for (int i = 1; i <= 4; i++){
            nx = x.f + dx[i];
            ny = x.s + dy[i];
            if (d[nx][ny] > d[x.f][x.s] + 1){
                q.push({nx, ny});
                d[nx][ny] = d[x.f][x.s] + 1;
            }
        }
    }

    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= m; j++){
            ma = max(ma, d[i][j]);
        }
    }

    cout << ma;
}


Measured memory_bytes: 13328
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<math.h>
#include<unordered_map>
using namespace std;
typedef long long ll;
const long double pi = 3.14159265358979323846264338327950288;
int main() {
	int n;
	while (cin >> n) {
		int sum = 0;
		for (int i = 0; i < n; i++) {
			ll a;
			cin >> a;
			if (a % 2 == 1)
				sum++;
		}
		if ((sum % 2 == 1) && ((n - sum+(int)floor(sum/2.0)) % 2 == 1)) {
			cout << "NO" << endl;
		}
		else {
			cout << "YES" << endl;
		}
	}
}

Measured memory_bytes: 256
result = {}
while True:
    try: n = input()
    except: break
    word, number = n.split()
    if word in result:
        result[word].append(number)
    else:
        result[word] = [number]
    
for k, v in sorted(result.items()):
    val = sorted(list(map(int, v)))
    print(k + '\n' + ' '.join(map(str, val)))



Measured memory_bytes: 5600
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	if (s[0] == s[1] && s[1] == s[2]) ||
		(s[1] == s[2] && s[2] == s[3]) {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}


Measured memory_bytes: 512
import math
a, b, x = map(int, input().split())
if a*a*b/2 < x:
  q = (2*x-a*a*b)/(a*a)
  theta = math.atan((b-q)/a)
  print(theta/math.pi*180)
else:
  a_ = 2*x /(a*b)
  theta = math.atan(b/a_)
  print(theta/math.pi*180)

Measured memory_bytes: 3188
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <utility>
#include <algorithm>
#include <cassert>

using namespace std;

typedef long long int LLI;
typedef pair<int,int> PII;

#define _ ios_base::sync_with_stdio(0);
#define debug
#define x first
#define y second
#define MXN 200005

const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;
const double eps = 1e-8; 

vector<PII> v;
int cnt[MXN], res[2], n;
int a[MXN], b[MXN];
int after[MXN], before[MXN];
bool used[MXN];


int main() { _
    while (cin >> n) {
        memset(cnt, 0, sizeof(cnt));
        memset(used, 0, sizeof(used));
        memset(after, 0, sizeof(after));
        memset(before, 0, sizeof(before));
        for (int i = 1; i <= n; ++i) {
            cin >> a[i] >> b[i];
            v.push_back({a[i], i});
            v.push_back({b[i], -i});
            cnt[a[i]]++;
            cnt[b[i]]--;
        }
        int cur = 0, tmp = n;
        res[0] = res[1] = 0;
        for (int i = 1; i <= 1e5; ++i) {
            cur += cnt[i];
            res[1] = max(res[1], cur);
        }
        sort(v.begin(), v.end());
        cur = 0;
        for (int i = 0; i < v.size(); ++i) {
            if (v[i].y < 0) {
                after[-v[i].y] = tmp;
                ++cur;
            } else {
                before[v[i].y] = cur;
                --tmp;
            }
        }
        for (int i = 1; i <= n; ++i)
            res[0] = max(res[0], n-after[i]-before[i]);
        cout << res[0] << " " << res[1] << "\n";
        v.clear();
    }

    return 0;
}



Measured memory_bytes: 10632
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
using namespace std;
int main() {
  int n; cin>>n;
  int a[n];
  for(int i=0;i<n;i++) cin>>a[i];
  sort(a,a+n,greater<int>());
  int A=0,B=0;
  for(int i=0;i<n;i+=2) A+=a[i];
  for(int i=1;i<n;i+=2) B+=a[i];
  cout<<A-B<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    int p[n];
    for(int i=0;i<n;i++)
        cin>>p[i];
    sort(p,p+n);
    int ans=0;
    for(int i=0;i<k;i++)
        ans+=p[i];
    cout<<ans<<endl;
}

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

// repetition
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

// typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

// const value
// const ll MOD = 1e9 + 7;
// const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
// const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
inline ll toLL(string s) {
  ll v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T> inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
  return a < b && (a = b, true);
}

template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
  return a > b && (a = b, true);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  VLL a(n);
  rep(i, n) cin >> a[i];
  map<ll, ll> prev;
  ll ans = 0;
  rep(i, n) {
    ans += prev[i - a[i]];
    prev[a[i] + i]++;
  }
  cout << ans << endl;
  return 0;
}


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

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

    int x = 1;
    while (x < n)
        x <<= 1;
    
    if (x > n)
        x >>= 1;

    cout << x << endl;
}


Measured memory_bytes: 3644
import java.util.*;

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

Measured memory_bytes: 46220
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 300300;
int n ;
char s[N];
int pre[N] ;

int main(){

scanf("%d",&n);
scanf("%s",s);
for(int i=0;i<n;i++){
    if(i)pre[i]=pre[i-1];
    pre[i]+=( s[i]=='E' );
}

int ans=n-1;
for(int i=0;i<n;i++){
    int x=0;
    if(i)x=i-pre[i-1];
    int y=0;
    if(i+1<n)y=pre[n-1]-pre[i];
    ans=min(ans,(x+y));
}
cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

class UnionFind {
public:
    
    vl parent;  // 親ノード
    vl Siz;  // 集合の大きさ

    // コンストラクタ
    UnionFind(ll n): parent(n), Siz(n, 1) {
        rep(i, n) {
            parent[i] = i;
        }
    }

    // n要素で初期化
    void init(ll n) {
        parent.resize(n);
        Siz.assign(n, 1);
        rep(i, n) {
            parent[i] = i;
        }
    }

    // xの属する集合の根を求める
    ll root(ll x) {
        if(parent[x] == x) {
            return x;
        }
        else {
            return parent[x] = root(parent[x]);
        }
    }

    // xとyの属する集合を併合
    void unite(ll x, ll y) {
        x = root(x);
        y = root(y);
        if(x == y) {
            return;
        }
        if(Siz[x] < Siz[y]) {
            swap(x, y);
        }
        Siz[x] += Siz[y];
        parent[y] = x;
    }
    
    // xとyが同じ集合に属するかどうか
    bool same(ll x, ll y) {
        return root(x) == root(y);
    }

    // xの属する集合の要素数を求める
    ll size(ll x) {
        return Siz[root(x)];
    }
    
};

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

    vl p(n);
    rep(i, n) {
        cin >> p[i];
        p[i]--;
    }

    UnionFind Uni(n);
    Uni.init(n);

    rep(i, m) {
        ll x, y;
        cin >> x >> y;
        x--;  y--;
        Uni.unite(x, y);
    }

    ll ans = 0;
    rep(i, n) {
        if(Uni.same(p[i], i)) {
            ans++;
        }
    }
    
    out(ans);
    re0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;
int main(void){
  int N,M,C;
  cin>>N>>M>>C;
  int B[M];
  vector<vector<int>> A(N,vector<int>(M));
  rep(i,M){
      cin>>B[i];
  }
  rep(i,N){
      rep(j,M){
          cin>>A[i][j];
      }
  }
  int cnt=0;
  rep(i,N){
      int sum=C;
      rep(j,M){
          sum+=A[i][j]*B[j];
      }
      if(sum>0){
          cnt++;
      }
  }
  cout<<cnt<<endl;
  
}

Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>
#include <set>
#include <cstdlib>
#include <queue>
#include <map>

using namespace std;

typedef long long llint;
typedef long double ld;
#define inf 1e18
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint>> que;
//priority_queue<llint> q;

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

string s;

void solve(){
  cin >> s;
  for(char x='a';x<='z';x++){
    int y=count(s.begin(),s.end(),x);
    if(y==0){
      cout << x << endl;
      return;
    }
  }
  cout << "None" << endl;
}

int main() {
  solve();
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
using namespace std;

int main()
{
	unsigned long long N, M;
	cin >> N >> M;

	auto high = M - N + 1;
	auto low = 1llu;
	while (high > low)
	{
		auto mid = (high + low) / 2;
		if (M / mid >= N)
		{
			low = mid + 1;
		}
		else
		{
			high = mid - 1;
		}
	}

	for (; high > 1; --high)
	{
		if (M % high == 0)
		{
			break;
		}
	}

	cout << high << endl;

	return 0;
}


Measured memory_bytes: 256
N,M = map(int,input().split(" "))
list = []
for i in range(N):
    A,B = map(int,input().split(" "))
    list.append([A,B])
#print(list)
list = sorted(list)
#print(list)
cost = 0
while True:
    #print(cost)
    M -= list[0][1]
    if M <= 0:
        cost += list[0][0] * (list[0][1]+M)
        break
    else:
        cost += list[0][0] * list[0][1]
        list.remove(list[0])
print(cost)


Measured memory_bytes: 20832
//nani?
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
#define pi acos(-1);
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define f(i,a,b) for( int i = a; i < b ; i++ ) 
#define sor(a) sort( a.begin(), a.end() )
#define rsor(a) sort( a.rbegin(), a.rend() )
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
//#define inf 1LL<<62
typedef long long ll;
typedef double ld;
using namespace std;
const int inf=1e7;
const ll MOD=1e9+7;
const ll mod=998244353;
// ac cmtr;
const int MAX_N = 1e5+5;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << endl;}
 
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1<<" | ";
  __f(comma+1, args...);}
#else
#define trace(...)
#endif
//---------------------------

ll a[MAX_N];

int main(){
    fastio;
    ll n,m;
    cin>>n>>m;
    ll sum=0;
    ll cont=0;
    f(i,0,n) {cin>>a[i];sum+=a[i];}
    ll val = (sum+4*m-1)/(4*m);
    bool ok=true;
    f(i,0,n){
        if(a[i]>=val) {cont++;}
    }
    if(cont>=m) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>

using namespace std;
int main(){
    while(1){
        int n,r;
        cin >> n >> r;
        if(n==0){
            break;
        }
        vector<int> vec(n,0);
        vector<int> vec1(n,0);
        for(int i=0;i<n;i++){
            vec[i]=n-i;
            vec1[i]=vec[i];
        }
        for(int i=0;i<r;i++){
            int p,c;
            cin >> p >> c;
            p--;
            for(int j=0;j<c;j++){
                vec1[j]=vec[j+p];
            }
            for(int j=c;j<p+c;j++){
                vec1[j]=vec[j-c];
            }
            for(int j=0;j<n;j++){
                vec[j]=vec1[j];
               // cout<< vec[j]<<endl;
            }
          //  cout<<endl;
        }
        cout<< vec[0]<<endl;
        //cout<<endl<<endl;
    }
}


Measured memory_bytes: 3008
#include <cstdio>
#include <queue>
#include <utility>
#include <tuple>
#include <cmath>

using namespace std;

typedef pair <double, int> di;

#define INF 1000000000
#define EPS 1e-9

class UnionFind
{
private:
	vector <int> p, ranks, root;
public:
	int initialise(int n)
	{
		p.assign(n, 1); ranks.assign(n, 1); root.assign(n, 1);
		for (int i = 0; i <= n; i++) p[i] = i, root[i] = i;
	}
	int findSet(int a)
	{
		if (p[a] == a) return a;
		else return p[a] = findSet(p[a]);
	}
	bool isSameSet(int a, int b)
	{
		return findSet(a) == findSet(b);
	}
	//a is child b is parent
	void unionSet(int a, int b)
	{
		if (!isSameSet(a, b))
		{
			int pa = findSet(a), pb = findSet(b);
			if (ranks[pa] > ranks[pb])
			{
				p[pb] = pa;
				root[pa] = root[pb];
			}
			else
			{
				p[pa] = pb;
				if (ranks[pa] == ranks[pb]) ranks[pb]++;
			}
		}
	}
	int getRoot(int a)
	{
		return root[findSet(a)];
	}
};

int N;
vector <int> adjList[200005];
int P[200005], V[200005];
priority_queue <di> pq;
int zeroes[200005], ones[200005];
UnionFind ufds;
long long ans = 0;

int main()
{
	scanf("%d", &N);
	if (N == 1)
    {
        int v; scanf("%d", &v);
        ans = 0;
    }
    else
    {
        for (int i = 2; i <= N; i++)
        {
            scanf("%d", &P[i]);
            adjList[i].push_back(P[i]);
            adjList[P[i]].push_back(i);
        }
        for (int i = 1; i <= N; i++)
        {
            scanf("%d", &V[i]);
            if (V[i] == 0) zeroes[i]++;
            else ones[i]++;
        }
        ufds.initialise(N + 5);
        for (int i = 2; i <= N; i++) pq.emplace(V[i] == 0 ? INF : 1, i);
        while (!pq.empty())
        {
            double r; int u; tie(r, u) = pq.top(); pq.pop();
            if (u == 1 || ufds.getRoot(u) != u || (r == INF && ones[u] != 0) || (ones[u] != 0 && fabs(r - (double) zeroes[u] / ones[u]) > EPS)) continue;
            //printf("%f %d\n", r, u);
            int p = P[u];
            ufds.unionSet(u, p);
            int root = ufds.getRoot(u);
            ans += (long long) ones[root] * zeroes[u];
            zeroes[root] += zeroes[u]; ones[root] += ones[u];
            pq.emplace(ones[root] == 0 ? INF : (double) zeroes[root] / ones[root], root);
        }
    }
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 23028
#include <bits/stdc++.h>
#define int long long
#define moder (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % moder;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), moder - 2, moder) % moder * mod_pow(kai(y), moder - 2, moder) % moder;
}
/*--------Library Zone!--------*/

int n, a[114514];
vector<int>vec;
void f(int x) {
	for (int i = 1; i * i <= x; i++) {
		if (x % i == 0) {
			if (i * i == x)vec.push_back(i);
			else {
				vec.push_back(i);
				vec.push_back(x / i);
			}
		}
	}
}
signed main() {
	cin >> n;
	rep(i, n)cin >> a[i];
	f(a[0]); f(a[1]);
	sort(all(vec));
	for (int i = vec.size() - 1; i >= 0; i--) {
		int cnt = 0;
		rep(j, n) {
			if (a[j] % vec[i] == 0)cnt++;
		}
		if (cnt >= n - 1) {
			cout << vec[i] << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 1024
/* --- author: dxm --- */
#include<bits/stdc++.h>
using namespace std;

#define INF 1e9
#define Inf 1e18
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
typedef long long ll;
inline void Fail(){printf("0");exit(0);}

const int maxn=200005;
int n,q,ans=INF;
int b[maxn],l[maxn],r[maxn],id[maxn],cnt[maxn][2],dp[maxn];

bool cmp(int a,int b){return l[a]<l[b];}

class segtree{
public:
	int sz;
	int t[maxn*4];
	void _init(int tot){sz=1;for(sz=1;sz<=tot;sz<<=1);rep(i,sz<<1)t[i]=INF;}
	void upd(int pos,int val){
		pos+=sz-1;t[pos]=val;
		for(pos>>=1;pos;pos>>=1)t[pos]=min(t[pos<<1],t[pos<<1|1]);
	}
	int qry(int l,int r){
		int res=INF;
		for(l+=sz-1,r+=sz-1;l<=r;l>>=1,r>>=1){
			if(l&1)res=min(res,t[l]),l++;
			if((r+1)&1)res=min(res,t[r]),r--;
		}
		return res;
	}
}T[2];

int main(){
	scanf("%d",&n);
	REP(i,n){
		scanf("%d",&b[i]);
		rep(j,2)cnt[i][j]=cnt[i-1][j]+(b[i]==j);
	}
	scanf("%d",&q);
	rep(i,q){
		scanf("%d%d",&l[i],&r[i]);
		id[i]=i;
	}
	sort(id,id+q,cmp);
	rep(i,2)T[i]._init(n);
	ans=cnt[n][1];
	rep(i,q){
		int cur=id[i];
//		cout<<cur<<endl;
		dp[cur]=cnt[l[cur]-1][1]+cnt[r[cur]][0]-cnt[l[cur]-1][0];
		dp[cur]=min(dp[cur],T[0].qry(l[cur],r[cur])+cnt[r[cur]][0]);
		dp[cur]=min(dp[cur],T[1].qry(1,l[cur]-1)+cnt[r[cur]][0]-cnt[l[cur]-1][0]+cnt[l[cur]-1][1]);
		T[0].upd(r[cur],dp[cur]-cnt[r[cur]][0]);
		T[1].upd(r[cur],dp[cur]-cnt[r[cur]][1]);
		ans=min(ans,dp[cur]+cnt[n][1]-cnt[r[cur]][1]);
	}
	printf("%d",ans);
	return 0;
}

/*
Input:
-----------------
Output:
*/

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

int main() {
  long long N;
  cin >> N;
  long long L[100];
  L[0] = 2, L[1] = 1;
  
  for(int i=2;i<=N;i++){
    L[i] = L[i-2] + L[i-1];
  }
  cout << L[N] << endl;
  return 0;
}


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

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll a, b;
  cin >> a >> b;

  cout << a * a - b << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cassert>
#include <ctime>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define all(x) (x).begin(), (x).end()

#ifdef LOCAL
#define dbg(x) cerr << #x " = " << x << endl;
#define idbg(x) #x " = " << x
#include "pretty_print.h"
#else
#define dbg(x)
#define idbg(x) ""
#endif

#ifdef _WIN32
#  define LLD "%I64d"
#else
#  define LLD "%lld"
#endif

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;

template <typename T> T sqr(T x) { return x * x; }
template <typename T> T abs(T x) { return x < 0? -x : x; }
template <typename T> T gcd(T a, T b) { return b? gcd(b, a % b) : a; }
template <typename T> bool chmin(T &x, const T& y) { if (x > y) { x = y; return true; } return false; }
template <typename T> bool chmax(T &x, const T& y) { if (x < y) { x = y; return true; } return false; }


int main(int /* argc */, char** /* argv */)
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifdef LOCAL
    assert(freopen("inp", "r", stdin));
    assert(freopen("out", "w", stdout));
    #endif


    int n, k;
    while (cin >> n >> k) {
        vector<int> a(n);
        for (int i = 0; i < n; ++i) {
            cin >> a[i];
        }
        while (k--) {
            vector<int> b(n + 1, 0);
            for (int i = 0; i < n; ++i) {
                b[max(i - a[i], 0)] += 1;
                b[min(i + a[i] + 1, n)] -= 1;
            }
            for (int i = 1; i < n; ++i) {
                b[i] += b[i - 1];
            }
            b.resize(n);
            if (a == b) {
                break;
            }
            a.swap(b);
        }

        for (int i = 0; i < n; ++i) {
            if (i) {
                cout << " ";
            }
            cout << a[i];
        }
        cout << "\n";
    }

    cerr << "Time execute: " << clock() / (double)CLOCKS_PER_SEC << " sec" << endl;
    return 0;
}


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

using namespace std;

const int N = 1e5 + 1;
int dp[N], h[N];

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


Measured memory_bytes: 1024
#include <stdio.h>
int main(){
    int a,b;
    char x;
while(1){
    scanf("%d %c %d",&a,&x,&b);
    if(x=='?'){
      break;
    }
    else if(x=='+'){
        printf("%d\n",a+b);
    }
    else if(x=='-'){
        printf("%d\n",a-b);
    }
    else if(x=='*'){
        printf("%d\n",a*b);
    }
    else if(x=='/'){
        printf("%d\n",a/b);
    }
}
return 0;
}

Measured memory_bytes: 600
#include <cstdio>
#include <iostream>
#include <algorithm>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define outl(x) cout<< (x) << '\n'
using namespace std;

signed main()
{
   int n;
   cin >> n;
   int h = n / 3600; n %= 3600;
   int m = n / 60; n %= 60;
   printf("%d:%d:%d\n", h, m, n );
}




Measured memory_bytes: 3220
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	int A=in(),B=in(),C=in();
	int maxX = max({A,B,C});
	array<int,3> V={maxX-A,maxX-B,maxX-C};
	sort(ALL(V));
	if(V[1]%2 && V[2]%2){
		out((V[1]/2)+(V[2]/2)+1);
	}
	else if(!(V[1]%2) && !(V[2]%2)){
		out((V[1]/2)+(V[2]/2));
	}
	else{
		out((V[1]/2)+(V[2]/2)+2);
	}

	return 0;
}


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

#define MAX_N 100

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<pair<pair<string,int>,int> > p(N);
    for (int i=0; i<N; i++){
        cin >> p[i].first.first >> p[i].first.second;
        p[i].first.second *= -1;
        p[i].second = i+1;
    }
    sort(p.begin(),p.end());
    for (int i=0; i<N;i++){
        cout << p[i].second << endl;
    }

    return 0;
    
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int a[3];
	while (cin >> a[0] >> a[1] >> a[2])
	{
		sort(a, a + 3);
		int sum = a[1] - a[0] + a[2] - a[1];
		cout << sum << endl;
	}
	
    return 0;
}


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

using namespace std;

int main() {
  int n,a,b, sum=0, temp, j;
  scanf("%d %d %d", &n, &a, &b);
  for(int i=1; i<=n;i++){
    j=i;
    temp=0;
    for(int dig=10000; dig>0;  dig/=10){
      temp+=(j/dig);
      j%=dig;
    }
    if(temp>=a && temp<=b){
      sum+=i;
    }
  }
  printf("%d\n", sum);
  return 0;
}

Measured memory_bytes: 256
import math
n=int(input())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
a=[1,2,3,4]
for i in a:
	num=0
	if i==1:
		for j in range(len(x)):
			num+=abs(x[j]-y[j])
		print(num)
			
	elif i==2 or i==3:
		for j in range(len(x)):
			num+=(abs(x[j]-y[j]))**i
		num=math.pow(num,1/i)
		print(num)
	
	else:
		b=[]
		for j in range(len(x)):
			b.append(abs(x[j]-y[j]))
		print(float(max(b)))
		
	
			
		
		


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

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, N) FOR(i, 0, N)
#define RREP(i, N) RFOR(i, N, 0)
#define FILL(A,value) memset(A,value,sizeof(A))
#define endl '\n'

#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define watch(x) cout << (#x) << " is " << (x) << endl
#define pb push_back
#define mp make_pair
#define Pi 3.14159265358979
#define A first
#define B second

typedef long long ll;
typedef vector <int> vi;
typedef vector<ll> vl;
typedef pair <int, int> pi;
typedef pair <ll, int> pl;
typedef pair <ll, ll> pll;
typedef pair <double, double> pd;

//change these according to prob constraints
const int INF = 0x3f3f3f3f;
const int MAX = 100005;
const int MAX1 = 1005;
const int MAX2 = 105;
const int LEN = 105;
const int BASE = 1000000000;
const double EPS = 1e-7;
const int MOD = 1000000007;
//g++ -std=c++11 your_file.cpp -o your_program

ll mypow(ll a, ll b){
	ll ans=1;
	while(b){
		if(b&1)
			ans=(ans*a)%MOD;
		b/=2;
		a=(a*a)%MOD;
	}
	return ans;
}

int main(void){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ifstream in("");
	ofstream out("");
	clock_t begin = clock();
	int n, k, q;
  	cin >> n >> k >> q;
  	int arr[n + 1];
  	FILL(arr, 0);
  	while (q--){
      	int tmp;
      	cin >> tmp;
      	if (tmp != 1) {
          	arr[1]--;
          	arr[tmp]++;
        }
      	if (tmp != n){
          	arr[tmp + 1]--;
        }
    }
    FOR(i, 2, n + 1) arr[i] = arr[i - 1] + arr[i];
  	FOR(i, 1, n + 1){
     	if (arr[i] <= -k) cout << "No" << endl;
      	else cout << "Yes" << endl;
    }     	
	clock_t end = clock();
    double esecs = double(end - begin) / CLOCKS_PER_SEC;
    //cout << esecs << " seconds" << endl;
	return 0;	
}


Measured memory_bytes: 1024
//  Created by Vignesh Manoharan

#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <cstring>
#include <cassert>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<vi> vvi;

const int INF = 1000000000;
const ll LINF = 1e17;
const double PI =3.141592653589793238;
#pragma unused(INF,PI,LINF)
#define F(i,a,n) for(int i=(a);i<(n);i++)

template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){
    for(int i=0;i<(t).size();i++)s<<t[i]<<((i<(t).size()-1)?" ":"");return s; }
template<typename T> ostream& operator<<(ostream &s,set<T> t){for(T x:t) s<<x<<" ";return s; }
template<typename T> istream& operator>>(istream &s,vector<T> &t){
    for(int _i=0;_i<t.size();_i++) s>>t[_i];return s; }

#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()

vector<int> low,idx,visited,parent;
int counter=0,root,root_children;
vector<vector<int>> graph;
vector<int> cut_verts;
void find_cut_verts(int u){
    low[u]=idx[u]=counter++;
    for(int v:graph[u]){
        if(!visited[v]){
            parent[v]=u;
            visited[v]=1;
            if(u==root) root_children++;
            find_cut_verts(v);
            if(low[v]>=idx[u])
                cut_verts[u]=1;
            low[u]=min(low[u],low[v]);
        } else if(v!=parent[u])
            low[u]=min(low[u],idx[v]);
    }
}
int main(int argc, const char * argv[]) {
#ifdef local_test
    //    input
    //    freopen("input","w",stdout);
    //    cout<<"1 \n 100 10 \n";
     freopen("input","r",stdin);
     freopen("output","w",stdout);
#endif
    int n,m;
    cin>>n>>m;
    graph = vvi(n,vi());
    low=vi(n);
    idx=vi(n);
    visited=vi(n,0);
    parent=vi(n,-1);
    cut_verts=vi(n,0);
    F(i,0,m){
        int u,v;
        cin>>u>>v;
        graph[u].pb(v);
        graph[v].pb(u);
    }
    for(int i=0;i<n;i++){
        if(!visited[i]){
            visited[i]=1;
            root=i;
            root_children=0;
            find_cut_verts(i);
            cut_verts[root]=(root_children>1);
        }
    }
    F(i,0,n) if(cut_verts[i]) cout<<i<<'\n';
}

Measured memory_bytes: 4276
#include<bits/stdc++.h>
#define ll long long
#define N 20
#define M (1 << 20)
using namespace std;

ll n, a[N][N], costmask[M], dp[M];

int main(){
    ios::sync_with_stdio(false); 
    cin >> n;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++) cin >> a[i][j];
    for (int mask = 0; mask < (1 << n); mask++){
        for (int i = 0; i < n; i++){
            if ((mask&(1 << i)) == 0) continue;
            for (int j = i + 1; j < n; j++){
                if ((mask&(1 << j)) == 0) continue;
                costmask[mask] += a[i][j];
            }
        }
    }
    for (int mask = 0; mask < (1 << n); mask++){
        for (int x = mask; x > 0; x = (x - 1) & mask){
            dp[mask] = max(dp[mask], costmask[x] + dp[mask ^ x]);
        }
    }
    cout << dp[(1 << n) - 1];
    return 0;
}

Measured memory_bytes: 2816
#include <iostream>
using namespace std;
static const int MAX = 100;
static const int INF = (1 << 21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n, M[MAX][MAX];

int prim() {
  int u, minv;
  // d: TとT-Vをつなぐ重みが最小の辺の重み
  // p: p[v]に頂点vの親
  int d[MAX], p[MAX], color[MAX];

  for (int i = 0; i < n; i++) {
    d[i] = INF;
    p[i] = -1;
    color[i] = WHITE;
  }

  d[0] = 0;

  while (1) {
    minv = INF;
    u = -1;
    for (int i = 0; i < n; i++) {
      if (minv > d[i] && color[i] != BLACK) {
        u = i;
        minv = d[i];
      }
    }
    if (u == -1) break;
    color[u] = BLACK;
    for (int v = 0; v < n; v++) {
      if (color[v] != BLACK && M[u][v] != INF) {
        if (d[v] > M[u][v]) {
          d[v] = M[u][v];
          p[v] = u;
          color[v] = GRAY;
        }
      }
    }
  }
  int sum = 0;
  for (int i = 0; i < n; i++) {
    if (p[i] != -1) sum += M[i][p[i]];
  }

  return sum;
}

int main() {
  cin >> n;

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      int e;
      cin >> e;
      M[i][j] = (e == -1) ? INF : e;
    }
  }

  cout << prim() << endl;
}


Measured memory_bytes: 3096
import math
import itertools

n = int(input())
l = [i for i in range(1,n+1)]
l = itertools.product(l,l)


ans = 0
for x,y in l:
    g = math.gcd(x,y)
    for j in range(1,n+1):
        ans += math.gcd(j,g)
    
print(ans)



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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

  LL a, b; cin >> a >> b;
  if(a * b <= 0){
	cout << "Zero" << endl;
  }
  else if(0 < a){
	cout << "Positive" << endl;
  }
  else if((b-a+1) % 2 == 0){
	cout << "Positive" << endl;
  }
  else
	cout << "Negative" << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
int p[10000]={0},k=0,b[10000];
p[0]=p[1]=1;
for(int i=2;i<=100;i++){
if(p[i]==0){
    for(int j=i*i;j<10000;j+=i)p[j]=1;
        
}   
}
for(int i=0;i<10000;i++)if(p[i]==0)b[k++]=i;
int cnt=0,a,n;
cin >> n;
for(int i=0;i<n;i++){
 cin >> a;
 cnt++;
 for(int j=0;j<k;j++){
if(a==b[j])break;
if(a%b[j]==0){cnt--;break;}
}
}
cout << cnt << endl;
}

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

int main(){
	long n;cin >> n;
  	vector<long> a;
  	for(int i=0;i<n;i++){
    	long b;
      	cin >> b;
      	if(b%2==0)a.push_back(b);
    }
  	long c=0;
  	for(int i=0;i<a.size();i++){
    	while(1){
          	if(a[i]%2==0)a[i]=a[i]/2;
          	else break;
            c++;
        }
    }
  	cout << c;
  	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e5 + 7;

#include <math.h>
#define PI 3.14159265358979323846264338327950L

int main() {
    int n;
    cin >> n;
    int a, b;
    cin >> a >> b;
    bool flag = false;
    if (n >= a && n <= b) {
        cout << "OK" << endl;
        return 0;
    }
    int prod = 1;
    while (n*prod < a) {
        prod++;
    }
    if (n*prod >= a && n*prod <= b) {
        cout << "OK" << endl;
        return 0;
    }
    else {
        cout << "NG";
    }
    return 0;
}

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

int digit(int n)
{
    int d = 0;
    while (n > 0) {
        d++; n /= 10;
    }
    return d;
}

int main()
{
    int n; cin >> n;
    
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        if (digit(i) % 2 == 1) ans++;
    }

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

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
    int cake=0;
  int people;
  int cakePeople;
  cin>>people>>cakePeople;
  people++;
  for(int i=0;i<cakePeople;i++){
    int c=0;
    cin>>c;
    cake+=c;
  }
  if(cake%people!=0)
    cout<<(cake/people)+1<<endl;
  else
  cout<<cake/people<<endl;
}



Measured memory_bytes: 3088