akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long LL;

template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar.size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}


int main(int argc, char const* argv[])
{
    string s;
    cin >> s;
    int n=0;
    for (int i = 0; i < 3; i++) {
        if (s[i] == '1') n++;
    }
    cout << n << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
int main(){ 
    string s;
    cin>>s;
    int a=0;
    int b=0;
    REP(i,s.size()){
        if(s[i]=='0'){
            a++;
        }else{
            b++;
        }
    }
    int c;
    c=s.size()-abs(a-b);
    cout<<c;
    return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        String S = sc.nextLine();
        
        long ans = 0;
        long wCount = 0;
        for (int i = S.length()-1; i >= 0; i--) {
        	if (S.charAt(i) == 'B') {
        		ans += wCount;
        	} else {
        		wCount++;
        	}
        }
        
        System.out.println(ans);
    }
}	

Measured memory_bytes: 27460
import java.util.Scanner

fun main(args:Array<String>){
    val sc = Scanner(System.`in`);
    val n: Int = sc.nextInt()
    val m: Int = sc.nextInt()
    var xmax: Int = sc.nextInt()
    var ymin: Int = sc.nextInt()
    for(i in 1 .. n){
        var x = sc.nextInt()
        xmax = if(x > xmax) x else xmax
    }
    for(i in 1 .. m){
        var y = sc.nextInt()
        ymin = if(y < ymin) y else ymin
    }
    println(if(xmax < ymin) "No War" else "War")
}

Measured memory_bytes: 31248
class UnionFind:
    __slots__ = ["_data_size", "_roots"]

    def __init__(self, data_size: int) -> None:
        self._data_size = data_size
        self._roots = [-1] * data_size

    def __getitem__(self, x: int) -> int:
        while self._roots[x] >= 0:
            x = self._roots[x]
        return x

    def is_connected(self, x: int, y: int) -> bool:
        return self[x] == self[y]

    def unite(self, x: int, y: int) -> None:
        x, y = self[x], self[y]
        if x == y:
            return
        if self._roots[x] > self._roots[y]:
            x, y = y, x
        self._roots[x] += self._roots[y]
        self._roots[y] = x


def main():
    N, Q = map(int, input().split())
    tree = UnionFind(N)
    res = []
    for _ in range(Q):
        t, u, v = map(int, input().split())
        if t:
            res.append(int(tree.is_connected(u, v)))
        else:
            tree.unite(u, v)
    print("\n".join(map(str, res)))


if __name__ == "__main__":
    main()


Measured memory_bytes: 88124
var n,res:integer;
    a:array[1..9] of integer;

procedure try2(i:integer);
var j:integer;
begin
  if i>3 then res+=1
  else
  for j:=1 to n do 
    begin
      a[i]:=j;
      try2(i+1);
    end;
end;
begin
  readln(n);
  try2(1);
  write(res)
end.

Measured memory_bytes: 128
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Integer> list = new ArrayList<Integer>();
        for (int i = 0; i < n; i++) {
            list.add(sc.nextInt());
        }

        boolean flag = true;
        int ans = 0;
        while (flag) {
            for (int i = 0; i < list.size(); i++) {
                if (list.get(i)%2 == 0) {
                    list.set(i, list.get(i)/2);
                } else {
                    flag = false;
                }
            }
            if (flag) ans++;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 21844
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner scanner = new Scanner(System.in);
        int X = scanner.nextInt();
        
        int A = X/500;
        int B = (X%500)/5;
        
        System.out.println(1000*A+5*B);
    }
}


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

int main() {
 int d; cin>>d;
  
  
 if(d==7) cout<<"YES"<<endl;
   else if(d==5) cout<<"YES"<<endl;
 else if(d==3) cout<<"YES"<<endl;

  
else cout<<"NO"<<endl;




}




Measured memory_bytes: 256
i = list(map(int, input().split()))
a=i[0]
b=i[1]
c=i[2]
if a+b>c:
    print('No')
elif a**2+b**2+c**2<=2*(a*c+a*b+b*c):
    print('No')
else:
    print('Yes')
    



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint INF = 1e18;

signed main(){
  lint N; cin >> N;
  lint sum = 0;
  vector<lint> rui(N + 1, 0);
  for(lint i = 0; i < N; i++){
    lint a; cin >> a; sum += a;
    rui[i + 1] = rui[i] + a;
  }
  lint ans = INF;
  for(lint i = 1; i < N; i++) ans = min(ans, abs(rui[i] - (sum - rui[i])));
  cout << ans << endl;
}


Measured memory_bytes: 1792
#define _CRT_SECURE_NO_WARNINGS
//#define _USE_MATH_DEFINES
#include<stdio.h>
//#include<stdlib.h>
//#include<math.h>
#include<string.h>
//#include<time.h>
#define P(type,x) fprintf(stdout,"%"#type"\n",x)
#define N 1000000
int main() {
	int a, b, f = 1, n;
	char s[3];
	a = b = 0;
	fscanf(stdin, "%d", &n);
	while (n--) {
		fscanf(stdin, "%s", s), getchar();
		if (f) {
			if (strcmp(s, "A") == 0) a++;
			else if (strcmp(s, "Un") == 0) b++;
			if (a < b) f = 0;
		}
	}
	if (a != b) f = 0;
	if (f) puts("YES");
	else puts("NO");
	return 0;
}

Measured memory_bytes: 588
H,W=map(int,input().split())
L=[]
for i in range(H):
    l=list(input())
    L.append(l)
T=[[0 for i in range(W)] for l in range(H)]
T[0][0]=1
S=[[0,0]]
SS=[[0,0]]
v=0
count=0
while 1:
    count+=1
    S=SS
    SS=[]
    while 1:
        x=S[0][1]
        y=S[0][0]
        if 0<=y and y<H-1:
            if L[y+1][x]=="." and T[y+1][x]==0:
                s=[y+1,x]
                T[y+1][x]=1
                SS.append(s)
                if y+1==H-1 and x==W-1:
                    v=1
                    break
        if 0<y and y<=H-1:
            if L[y-1][x]=="." and T[y-1][x]==0:
                s=[y-1,x]
                T[y-1][x]=1
                SS.append(s)
                if y-1==H-1 and x==W-1:
                    v=1
                    break
        if 0<=x and x<W-1:
            if L[y][x+1]=='.' and T[y][x+1]==0:
                s=[y,x+1]
                T[y][x+1]=1
                SS.append(s)
                if y==H-1 and x+1==W-1:
                    v=1
                    break
        if 0<x and x<=W-1:
            if L[y][x-1]=='.' and T[y][x-1]==0:
                s=[y,x-1]
                T[y][x-1]=1
                SS.append(s)
                if y==H-1 and x-1==W-1:
                    v=1
                    break
        S.pop(0)
        if len(S)==0:
            break
    if v==1:
        break
    if len(SS)==0:
        v=0
        break
x=0
if v==0:
    print(-1)
else:
    for i in range(H):
        for l in range(W):
            if L[i][l]=='#':
                x+=1
    print(W*H-x-count-1)


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

int cnt[105];

int main() {
  int n;
  cin>>n;
  for (int i=2; i<=n; i++) {
    int tmp=i;
    for (int j=2; j<=i; j++) {
      if (tmp%j) continue;
      while (tmp%j==0) {
	cnt[j]++;
	tmp/=j;
      }
    }
  }
  int a1=0,a2=0,a3=0,a4=0,a5=0;
  for (int i=2; i<=n; i++) {
    if (cnt[i]>=2) a1++;
    if (cnt[i]>=4) a2++;
    if (cnt[i]>=14) a3++;
    if (cnt[i]>=24) a4++;
    if (cnt[i]>=74) a5++;
  }
  cout<<a5+(a2-1)*a3+a4*(a1-1)+a2*(a2-1)/2*(a1-2)<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};

int main() {

	int n,h,w;
	int total=0;

	cin>>n>>h>>w;

	if(w==1&&h==1){
		cout<<n*n<<endl;
		return 0;
	}
	if((n-w)==0){
		cout<<n-h+1<<endl;
	}else if((n-h)==0){
		cout<<n-w+1<<endl;
	}else{
		total=1+n-h;
		cout<<total+(n-h+1)*(n-w)<<endl;
	}

	return 0;
}


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

int d;
vector<int> c;
vector<vector<int>> s;

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

pair<int, int> from_b_a(set<int> &s, int k) {
    auto before = s.lower_bound(k);
    before--;
    auto after = s.lower_bound(k);
    after++;
    return {*before, *after};
}

pair<int, int> next_b_a(set<int> &s, int k) {
    auto before = s.lower_bound(k);
    before--;
    auto after = s.lower_bound(k);
    return {*before, *after};
}

int main() {
    cin >> d;
    c.resize(26);
    s.resize(d, vector<int>(26));
    for (int i = 0; i < 26; i++) {
        cin >> c[i];
    }
    for (int i = 0; i < d; i++) {
        for (int j = 0; j < 26; j++) {
            cin >> s[i][j];
        }
    }
    vector<int> last(26, -1);
    vector<int> ans(d);
    for (int i = 0; i < d; i++) {
        int happiness_max = INT_MIN;
        for (int j = 0; j < 26; j++) {
            int happiness = 0;
            for (int k = 0; k < 26; k++) {
                if (j == k) {
                    happiness += s[i][k];
                } else {
                    happiness -= c[k] * (i - last[k]);
                }
            }
            if (chmax(happiness_max, happiness)) {
                ans[i] = j;
            }
        }
    }
    vector<set<int>> contests(26);
    for (int i = 0; i < 26; i++) {
        contests[i].insert(-1);
        contests[i].insert(d);
    }
    for (int i = 0; i < d; i++) {
        contests[ans[i]].insert(i);
    }
    int iter = 10000;
    while (iter--) {
        int day = rand() % d;
        int from = ans[day];
        int next = rand() % 26;
        if (ans[day] == next) {
            continue;
            next = (next + 1) % 26;
        }
        auto fromba = from_b_a(contests[from], day);
        auto nextba = next_b_a(contests[next], day);
        int gain = s[day][next] + c[next] * (nextba.second - day) * (day - nextba.first);
        int loss = s[day][from] + c[from] * (fromba.second - day) * (day - fromba.first);
        if (gain > loss) {
            contests[from].erase(day);
            contests[next].insert(day);
            ans[day] = next;
        }
    }
    for (int i = 0; i < d; i++) {
        cout << ans[i] + 1 << endl;
    }
}

Measured memory_bytes: 3684
#include <stdio.h>
  
int main(){
  
    int S = 0;
  
    scanf("%d", &S);
  
 
    int h = (int)(S / 3600);
    int m = (int)((S - (h * 3600)) / 60);

    printf("%d:%d:%d\n", h, m, (S % 60));
  
  
    return 0;
  
}

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

typedef long long ll;
const ll mod=1e9+7;
const ll N=1e5+1;
const ll INF=1e10;
const double PI=acos(-1.0);

int n,m;
vector<vector<int>> adj(N);
vector<bool> visited(N);
vector<int> parent(N);

void bfs(){
	queue<int> q;
	q.push(1);
	visited[1]=true;
	while(!q.empty()){
		int t=q.front();
		q.pop();
		for(int v:adj[t]){
			if(!visited[v]){
				visited[v]=true;
				q.push(v);
				parent[v]=t;
			}
		}
	}
	for(int i=1;i<=n;i++){
		if(!visited[i]){
			cout<<"No";
			return;
		}
	}
	cout<<"Yes\n";
	for(int i=2;i<=n;i++) cout<<parent[i]<<'\n';
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cin>>n>>m;
	while(m--){
		int u,v;
		cin>>u>>v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	bfs();
}


Measured memory_bytes: 10116
#include<stdio.h>
int main()
{
	int n;
	scanf("%d",&n);
	int i;
	int h[25];
	for(i=0;i<n;i++)
		scanf("%d",&h[i]);
	int ans=1,max=h[0];
	for(i=1;i<n;i++)
	{
		if(h[i]>=max)
		{
			ans++;
			max=h[i];
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;

inline long long collatz(long long n)
{
    if (n % 2) {
        return 3 * n + 1;
    }
    return n / 2;
}

int main()
{
    long long n;
    std::cin >> n;

    std::unordered_map<long long, int> m;

    int count = 0;
    while (1) {
        count++;
        if (m[n] == 1) {
            std::cout << count << std::endl;
            return 0;
        }

        m[n]++;
        n = collatz(n);
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;


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

    map<int,int> m;
    int n,t;
    cin>>n>>t;
    vi a(n);
    rep(i,n)cin>>a[i];

    int minn=a[0];
    for(int i=1;i<n;i++){
        if(minn<a[i])m[a[i]-minn]++;
        else if(minn>a[i])minn=a[i];
    }
    int ans=0;
    for(auto&& it:m){
        ans=max(ans,it.first);
    }
    fin(m[ans]);

//////////////////////////////////////////////////////
return 0;}

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

using namespace std;

int main() {
    double h;
    double maxval = 0, minval = 1e30;
    while(cin >> h) {
        maxval = max(h, maxval);
        minval = min(h, minval);
    }
    cout << maxval-minval << endl;
    return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define llong long long
const llong inf=0x3f3f3f3f3f3f3f3f;
int n,Q;
int A,B;
int pos[200200];
llong ADD;
struct SEG{
	llong mi[1000100];
	void build(int rt,int l,int r,int sym)
	{
		if(l==r)
		{
			mi[rt]=inf;
			if(l==A)mi[rt]=abs(B-pos[1])+sym*l;
			else if(l==B)mi[rt]=abs(A-pos[1])+sym*l;
			return;
		}
		int mid=(l+r)/2;
		build(rt*2,l,mid,sym);
		build(rt*2+1,mid+1,r,sym);
		mi[rt]=min(mi[rt*2],mi[rt*2+1]);
	}
	void ins(int rt,int l,int r,int p,llong v)
	{
		if(l==r)
		{
			mi[rt]=min(v,mi[rt]);
			return;
		}
		int mid=(l+r)/2;
		if(mid>=p)ins(rt*2,l,mid,p,v);
		else ins(rt*2+1,mid+1,r,p,v);
		mi[rt]=min(mi[rt*2],mi[rt*2+1]);
	}
	llong ask(int rt,int l,int r,int st,int ed)
	{
		if(l>ed||r<st)return inf;
		if(l>=st&&r<=ed)return mi[rt];
		int mid=(l+r)/2;
		return min(ask(rt*2,l,mid,st,ed),ask(rt*2+1,mid+1,r,st,ed));
	}
}seg1,seg2;
int main()
{
	scanf("%d%d",&n,&Q);
	scanf("%d%d",&A,&B);
	for(int i=1;i<=Q;++i)scanf("%d",&pos[i]);
	seg1.build(1,1,n,-1);
	seg2.build(1,1,n,1);
	llong tmp;
	llong m1,m2;
	/*
	for(int j=1;j<=n;++j)
	{
		int t=seg1.ask(1,1,n,j,j)+ADD+j;
		if(t<=239718)cout<<t<<" ";
		else cout<<"inf ";
	}
	cout<<endl;
	*/
	/*
	for(int j=1;j<=n;++j)
	{
		int t=seg2.ask(1,1,n,j,j)+ADD-j;
		if(t<=239718)cout<<t<<" ";
		else cout<<"inf ";
	}
	cout<<endl;
	cout<<endl;
	*/
	for(int i=2;i<=Q;++i)
	{
		m1=seg1.ask(1,1,n,1,pos[i])+ADD+pos[i];
		m2=seg2.ask(1,1,n,pos[i],n)+ADD-pos[i];
		m1=min(m1,m2);
		ADD+=abs(pos[i]-pos[i-1]);
		m1-=ADD;
//		cout<<"i: "<<i<<" m1: "<<m1<<endl;
		seg1.ins(1,1,n,pos[i-1],m1-pos[i-1]);
		seg2.ins(1,1,n,pos[i-1],m1+pos[i-1]);
		/*
		for(int j=1;j<=n;++j)
		{
			int t=seg1.ask(1,1,n,j,j)+ADD+j;
			if(t<=239718)cout<<t<<" ";
			else cout<<"inf ";
		}
		cout<<endl;
		for(int j=1;j<=n;++j)
		{
			int t=seg2.ask(1,1,n,j,j)+ADD-j;
			if(t<=239718)cout<<t<<" ";
			else cout<<"inf ";
		}
		cout<<endl;
		cout<<endl;
		*/
	}
	llong ans=inf;
	for(int i=1;i<=n;++i)ans=min(ans,seg1.ask(1,1,n,i,i)+ADD+i);
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 14592
#include<bits/stdc++.h>
using namespace std;
const int maxn=2005;
int n,m,q,ans;
int a[maxn][maxn],s[maxn][maxn],up[maxn][maxn],lf[maxn][maxn];
inline int read()
{
	int ret=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-') f=-f;ch=getchar();}
	while(ch>=48&&ch<=57){ret=ret*10+ch-48;ch=getchar();}
	return ret*f;
}
char fstchar()
{
	char ch=getchar();
	while(ch!='0'&&ch!='1') ch=getchar();
	return ch;
}
int main()
{
	n=read();m=read();q=read();
	for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) a[i][j]=fstchar()-'0',s[i][j]=a[i][j]+s[i-1][j]+s[i][j-1]-s[i-1][j-1];
	for(int i=1;i<=n;i++) for(int j=1;j<=m;j++)
	{
		up[i][j]=up[i][j-1]+up[i-1][j]-up[i-1][j-1];
		lf[i][j]=lf[i-1][j]+lf[i][j-1]-lf[i-1][j-1];
		if(a[i][j]&&a[i-1][j]) up[i][j]++;
		if(a[i][j]&&a[i][j-1]) lf[i][j]++;
	}
	while(q--)
	{
		int x=read(),y=read(),xx=read(),yy=read();
		ans=s[xx][yy]-s[x-1][yy]-s[xx][y-1]+s[x-1][y-1];
		ans-=up[xx][yy]-up[x][yy]-up[xx][y-1]+up[x][y-1];
		ans-=lf[xx][yy]-lf[xx][y]-lf[x-1][yy]+lf[x-1][y];
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 64640
#include <iostream>
using namespace std;
int main(){
  int x,y;
  cin>>x>>y;
  int a[]={1,3,5,7,8,10,12};
  int b[]={4,6,9,11};
  int c[]={2};
  int xflag=0;
  int yflag=0;
  for(int i=0;i<7;i++){
    if(x==a[i]){
      xflag=1;
    }
    if(y==a[i]){
      yflag=1;
    }
  }
  for(int i=0;i<4;i++){
    if(x==b[i]){
      xflag=2;
    }
    if(y==b[i]){
      yflag=2;
    }
  }
  for(int i=0;i<1;i++){
    if(x==c[i]){
      xflag=3;
    }
    if(y==c[i]){
      yflag=3;
    }
  }
  if(xflag==yflag){
    cout<<"Yes";
  }else{
    cout<<"No";
  }
  return 0;
}
      

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

struct Solver {
	void solve() {
		int N, K;
		cin >> N >> K;

		vector<bool> x( N );
		for( int i = 0; i < K; ++i ) {
			int d;
			cin >> d;

			while( d-- ) {
				int a;
				cin >> a;
				x[a-1] = true;
			}
		}

		cout << count( x.begin(), x.end(), false ) << endl;
	}
};

int main() {
	ios::sync_with_stdio( false );
	cout << fixed << setprecision( 10 );
	Solver().solve();

	return 0;
}


Measured memory_bytes: 3660
#include <cstdio>
#include <cstdlib>
#include <cstring>

char buf[64], buf2[64];
int main()
{
	scanf("%s", buf);
	int i, len, flag=0;
	len = strlen(buf);
	for(i=0;i<len;i++)
		buf2[i]=buf[len-i-1];
	char *r=strstr(buf2, "LAVITSEF");
	if(r==buf2)
	{
		buf[len-8]=0;
		puts(buf);
	}
	else
	{
		
		puts("Rng is going to a festival of what?");
	}
	return 0;
}

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

using namespace std;

#define all(x) (x).begin(), (x).end()
#define sz(x) ( (int)(x).size() )
using LL = long long;

const int mod = 998244353;
mt19937 rng( (int)chrono::steady_clock::now().time_since_epoch().count() );

struct Mint {
  int a;
  Mint(int _a = 0) : a(_a) {}
  friend ostream& operator << (ostream &out, const Mint &_) {
    out << _.a;
    return out;
  }

  bool operator == (const Mint &_) const { return a == _.a; }
  bool operator ! () const { return !a; }

  Mint operator + (const Mint &_) const {
    int ret = a + _.a;
    return ret < mod ? Mint(ret) : Mint(ret - mod);
  }
  Mint operator - (const Mint &_) const { return *this + Mint(mod - _.a); }
  Mint operator * (const Mint &_) const { return Mint( (int)( (LL)a * _.a % mod) ); }
  friend Mint& operator += (Mint &a, const Mint &b) { return a = a + b; }
  friend Mint& operator -= (Mint &a, const Mint &b) { return a = a - b; }
  friend Mint& operator *= (Mint &a, const Mint &b) { return a = a * b; }
  Mint& operator ++ () { return *this = *this + Mint(1); }
  Mint& operator -- () { return *this = *this - Mint(1); }

  template<class T> Mint binPow(T exp) const {
    Mint ret(1), c = *this;
    for (; exp; exp >>= 1, c *= c) if (exp & 1) ret *= c;
    return ret;
  }
};
vector<Mint> fact, invFact, pw2;
Mint C(int n, int k) { return (n < 0 || k > n || k < 0 ? Mint(0) : fact[n] * invFact[k] * invFact[n - k] ); }
Mint candy(int n, int k) { return C(n - 1, k - 1); }

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

  #ifdef FourLeafClover
  freopen("input", "r", stdin);
  #endif // FourLeafClover

  int k, n; cin >> k >> n;

  pw2.assign(k + 1, Mint() ); pw2[0] = Mint(1);
  for (int i = 1; i < sz(pw2); ++i) pw2[i] = pw2[i - 1] + pw2[i - 1];
  fact.assign(n + k + 1, Mint() ); fact[0] = Mint(1);
  for (int i = 1; i < sz(fact); ++i) fact[i] = fact[i - 1] * Mint(i);
  invFact.assign(sz(fact), Mint() ); invFact.back() = fact.back().binPow<int>(mod - 2);
  for (int i = sz(invFact) - 2; ~i; --i) invFact[i] = invFact[i + 1] * Mint(i + 1);

  for (int i = 1; i <= k; ++i) {
    Mint ans;
    if (i & 1) {
      for (int j = 0; j <= i >> 1; ++j) {
        ans += candy(n + k - i, j + k - i) * pw2[j] * C(i >> 1, j);
        ans += candy(n - 1 + k - i, j + k - i) * pw2[j] * C(i >> 1, j);
      }
    }
    else {
      for (int j = 0; j <= i >> 1; ++j) ans += candy(n + k - i, j + k - i) * pw2[j] * C(i >> 1, j);
    }

    cout << ans << '\n';
  }

  for (int i = 2; i <= k; ++i) {
    Mint ans;
    if ( (i & 1) ^ (k & 1) ) {
      for (int j = 0; j <= (k - i + 1) >> 1; ++j) ans += C( (k - i + 1) >> 1, j) * candy(n + i - 1, j + i - 1) * pw2[j];
    }
    else {
      for (int j = 0; j <= (k - i + 1) >> 1; ++j) {
        ans += C( (k - i + 1) >> 1, j) * candy(n + i - 1, j + i - 1) * pw2[j];
        ans += C( (k - i + 1) >> 1, j) * candy(n - 1 + i - 1, j + i - 1) * pw2[j];
      }
    }

    cout << ans << '\n';
  }

  return 0;
}



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

int main() {
    int N, M;
    std::cin >> N >> M;

    std::vector<int> H(N);
    for (int i = 0; i < N; i++) std::cin >> H[i];

    std::vector<bool> v(N, true);
    for (int i = 0; i < M; i++) {
        int A, B;
        std::cin >> A >> B;
        A--;
        B--;

        if (H[A] < H[B])
            v[A] = false;
        else if (H[A] > H[B])
            v[B] = false;
        else {
            v[A] = false;
            v[B] = false;
        }
    }

    int ans = 0;
    for (int i = 0; i < N; i++) if (v[i]) ans++;
    std::cout << ans << "\n";
}

Measured memory_bytes: 3784
#include <iostream>

using namespace std;

int main()
{
    string n, _n;
    cin >> n;
    int num;
    int count = 0;

    for (int i = 0; i < n.length(); i++)
    {
        _n = n[i];
        num = stoi(_n);
        count += num;
    }
    if (count % 9 == 0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3696
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int u32;
typedef pair<int, int> p;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int Inf = (1<<30);
ll inf = (1LL<<60);
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main() {
	int n;
	cin >> n;
	int i;
	vector<int> ans(27, Inf);
	for (i = 0; i < n; i++) {
		string s;
		cin >> s;
		vector<int> ch(27, 0);
		for (int j = 0; j < s.size(); j++) {
			ch[s[j] - 'a']++;
		}
		for (int j = 0; j <= 25; j++) {
			ans[j] = min(ans[j], ch[j]);
		}
	}
	for (i = 0; i <= 25; i++) {
		for (int j = 0; j < ans[i]; j++) {
			char C = 'a' + i;
			cout << C;
		}
	}
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
const ll INF =99999999999;

//最大公約数
ll gcd(ll a, ll b){
   if (a%b==0){
       return(b);
   }else{
       return(gcd(b,a%b));
   }
}
//最小公倍数
ll lcm(ll a, ll b){
   return a*b/gcd(a,b);
}

//素数判定
ll isprime(ll n){
  bool prime=true;
  for(int i=2;i<n;i++){
    if(n%i==0){
      prime=false; break;
    }
  }
if(prime){cout<<n<<" is prime"<<endl;
         }else{cout<<n<<" is not prime"<<endl;}

}
//階乗　20くらいが限界
ll factorial(ll n){
  ll a=1;ll b=n;
  for(int i=0;i<n;i++){
    a*=b;
    b--;
  }
  return a;
}

//組み合わせ　nCr
ll comb(ll a,ll b){
  ll c;
  c=factorial(a)/(factorial(a-b)*factorial(b));
  return c; 
}




//10億7。　　　100000007
//2*2行列 H*W
//vector<vector<int>> vec(H,vector<int>(W));
//for(int i=0;i<H;i++){
//for(int j=0;j<W;j++){
//cin>>vec[i][j];
//  }
//}

//文字列→数列
//string S;int A=atoi(S.c_str());
//数列→文字列
//int A;string S=to_string(A);
//数字判定　isdigit(a)
//pair宣言　pair<int,int> p(5,7);
//ソート　sort(vec.begin(),vec.end());



int main(){
cout<<fixed<<setprecision(10);

ll N;cin>>N;
  vector<ll> vec(N);
  for(int i=0;i<N;i++){
cin>>vec[i];
  }
  int counter=0;
  
  for(int i=0;i<N;i++){
    while(vec[i]%2==0){
      vec[i]/=2;
      counter++;
    }
  }
  cout<<counter<<endl;
  
  
}


Measured memory_bytes: 384
#include<stdio.h>
int main()
{
    int x, y, w=1;
    scanf("%d%d",&x, &y);
    for(int i=0; i<x+1; i++)
    {
        if(4*x-2*i==y)
        {printf("Yes"); w=0; break;}
    }
    if(w) printf("No");
    return 0;
}


Measured memory_bytes: 1704
from collections import deque

h, w = map(int, input().split())
s = ['#' * (w + 2)] + ['#' + input() + '#' for i in range(h)] + ['#' * (w + 2)]
# print(*s, sep='\n')

di = [1, 0, -1, 0]
dj = [0, 1, 0, -1]


def bfs(si, sj):
    queue = deque([(si, sj, 0)])
    cost = [[-1] * (w + 2) for _ in range(h + 2)]
    cost[si][sj] = 0
    while queue:
        ci, cj, cc = queue.popleft()
        for k in range(4):
            ni = ci + di[k]
            nj = cj + dj[k]
            if s[ni][nj] == '#':
                continue
            if cost[ni][nj] != -1:
                continue
            queue.append((ni, nj, cc + 1))
            cost[ni][nj] = cc + 1

    return max(map(lambda x: max(x), cost))


ans = 0
for i in range(1, h + 1):
    for j in range(1, w + 1):
        if s[i][j] == '.':
            ans = max(ans, bfs(i, j))
print(ans)


Measured memory_bytes: 45404
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k;
  cin>>n;
  cin>>k;
  int a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  sort(a,a+n);
  int res=0;
  for(int i=0;i<k;i++)
  {
    res+=a[i];
  }
  cout<<res;
}

Measured memory_bytes: 3640
# instead of AVLTree
class BITbisect():
    def __init__(self, max):
        self.max = max
        self.data = [0]*(self.max+1)
    
    # 0からiまでの区間和
    # 立っているビットを下から処理
    def query_sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= i & -i
        return s

    # i番目の要素にxを足す
    # 覆ってる区間すべてに足す
    def add(self, i, x):
        while i <= self.max:
            self.data[i] += x
            i += i & -i

    def insert(self, x):
        self.add(x, 1)

    def delete(self, x):
        self.add(x, -1)

    def count(self, x):
        return self.query_sum(x) - self.query_sum(x-1)
    
    def length(self):
        return self.query_sum(self.max)
    
    # O(log(N))
    def search(self, c):
        s = 0
        ind = 0
        l = self.max.bit_length()
        for i in reversed(range(l)):
            if ind + (1<<i) <= self.max:
                if s + self.data[ind+(1<<i)] < c:
                    s += self.data[ind+(1<<i)]
                    ind += (1<<i)
        return ind
    
    def bisect_right(self, x):
        return self.query_sum(x)

    def bisect_left(self, x):
        if x == 1:
            return 0
        return self.query_sum(x-1)

    # listみたいに表示
    def display(self):
        print('inside BIT:', end=' ')
        for x in range(1, self.max+1):
            if self.count(x):
                c = self.count(x)
                for _ in range(c):
                    print(x, end=' ')
        print()


import sys
input = sys.stdin.readline

Q = int(input())
Query = [list(map(int, input().split())) for _ in range(Q)]

A = []
for i in range(Q):
    if Query[i][0] == 1:
        A.append(Query[i][1])

# 座標圧縮
ind_to_co = sorted(A)
co_to_ind = {}
for i, x in enumerate(ind_to_co):
    co_to_ind[x] = i+1

bit1 = BITbisect(Q+1) #傾き
bit2 = BITbisect(Q) #合計

b = 0
for q in range(Q):
    if Query[q][0] == 1:
        b += Query[q][2]
        a = Query[q][1]
        bit2.add(co_to_ind[a], a)
        bit1.add(1, -1)
        bit1.add(co_to_ind[a]+1, 2)
    else:
        i1 = bit1.search(0)
        a1 = ind_to_co[i1-1]
        #print(bit1.query_sum(i1), bit1.query_sum(1), bit1.query_sum(i1+1), bit1.query_sum(Q))
        delta = (bit1.query_sum(i1) - bit1.query_sum(1) + bit1.query_sum(i1+1) - bit1.query_sum(Q))//2
        a2 = bit2.query_sum(Q) - bit2.query_sum(i1-1) - bit2.query_sum(i1) + a1*delta + b
        print(a1, a2)


Measured memory_bytes: 103772
#include<iostream>
#include<algorithm>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int const MAXN = 1e5;
int const INF = 1e9+1;
int tmp[MAXN];

int main() {
  int N; std::cin >> N;
  std::fill_n(tmp, N, -1);
  for(int i = 0; i < N; ++i) {
    int A; std::cin >> A;
    auto it = std::partition_point(tmp, tmp+N, [&](int x){ return x >= A; });
    *it = A;
  }
  int ans = std::partition_point(tmp, tmp+N,
              [&](int x) { return x > -1; }) - tmp;
  fin(ans);
  return 0;
}


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

struct edge {
	int u, v, w;
	edge(int u = 0, int v = 0, int w = 0) : u(u), v(v), w(w) {}
};

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int l; cin >> l;
	int n = 32 - __builtin_clz(l);
	vector<edge> g;
	int u = 1;
	for (int i = 1; i < n; i++) {
		g.emplace_back(i, i + 1, u);
		g.emplace_back(i, i + 1, 0);
		u <<= 1;
	}
	for (int i = 0; i < n - 1; i++) {
		if (l >> i & 1) {
			g.emplace_back(i + 1, n, l >> (i + 1) << (i + 1));
		}
	}
	cout << n << ' ' << g.size() << endl;
	for (auto e : g) {
		cout << e.u << ' ' << e.v << ' ' << e.w << "\n";
	}
	return 0;
}


Measured memory_bytes: 3592
N, P=map(int, input().split())

temp = int(P**(1/N)+0.5)

output=1
for i in range(temp, 0, -1):
    t =(i**N)
    p = P//t
    if t*p ==P:
        output=i
        break


if P==1:
    output=1
print(output)

Measured memory_bytes: 40044
import itertools
import math
n = int(input())
town_lis = []

for i in range(n):
    town_lis.append(list(map(int,input().split())))

permutation_lis = itertools.permutations(town_lis)
ans = 0
cnt = 0
for one_case in permutation_lis:
    dist = 0
    cnt += 1
    for j in range(len(one_case)-1):         #one_caseのなかのリストのアイテム-1分の距離を数え上げる。jは各ループの始点となる町ナンバー
        dist += math.sqrt((one_case[j][0]-one_case[j+1][0]) ** 2 + (one_case[j][1]-one_case[j+1][1]) ** 2)
    ans += dist

print(ans/cnt)


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

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

    std::vector<int> h(n);
    for (int i = 0; i < n; i++) {
        std::cin >> h[i];
    }

    int ans = 1;
    int max = h[0];
    for (int i = 1; i < n; i++) {
        if (max <= h[i]) {
            ans++;
            max = h[i];
        }
    }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
 
const double EPS = 1e-10;
const ll INF = 100000000;
const ll MOD = 1000000007;

ll n, k;
ll a[100];
ll dp[101][100001];

int main() {
    cin >> n >> k;
    rep(i,n) cin >> a[i];
    dp[0][k] = 1;
    rep(i,n) {
        ll sum = 0, cnt = 0;
        for (int j = k; j >= 0; j--) {
            sum = (sum + dp[i][j])%MOD;
            if (cnt > a[i]) sum = (sum - dp[i][j+a[i]+1] + MOD) % MOD;
            dp[i+1][j] = (dp[i+1][j]+sum)%MOD;
            cnt++;
        }
    }
    cout << dp[n][0] << endl;
}



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

using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int>P(N);
	for (int n = 0;n<N;++n) {
		cin >> P[n];
	}
	int ans = 1;
	int mini = P[0];
	for (int n = 1;n < N;++n) {
		if (mini >= P[n]) {
			ans++;
		}
		mini = min(mini,P[n]);
	}
	cout << ans <<  endl;
	return 0;
}


Measured memory_bytes: 4020
fun main(args: Array<String>) {
    abc142e()
}

fun abc142e() {
    val (n, m) = readLine()!!.split(" ").map { it.toInt() }
    val keys = (1..m).map {
        val (a, b) = readLine()!!.split(" ").map { it.toInt() }
        val c = readLine()!!.split(" ").map { 1 shl (it.toInt() - 1) }.reduce { acc, i -> acc or i }
        Key(a, c)
    }
    val inf = Long.MAX_VALUE / 100000

    val dp = LongArray(5000) { inf }
    dp[0] = 0

    for (key in keys) {
        for (boxes in 0 until (1 shl n)) {
            val canOpenBoxes = boxes or key.targetAsBit
            dp[canOpenBoxes] = Math.min(dp[canOpenBoxes], dp[boxes] + key.price)
        }
    }

    val answer = dp[(1 shl n) - 1].let { if (it < inf) it else -1 }

    println(answer)
}

private data class Key(val price: Int, val targetAsBit: Int)


Measured memory_bytes: 42380
import sys
import heapq
if sys.version[0] == '2':
    range, input = xrange, raw_input
MAX_SPEED = 30
while True:
    N, M = map(int, input().split())
    if not (N | M):
        break
    S, G = map(lambda x: int(x) - 1, input().split())
    edge = [[] for _ in range(N)]
    for _ in range(M):
        x, y, d, c = map(int, input().split())
        edge[x - 1].append((y - 1, d, c))
        edge[y - 1].append((x - 1, d, c))
    INF = float('inf')
    dist = [[[INF for _ in range(N)] for _ in range(MAX_SPEED + 1)] for _ in range(N)]
    que = [(0.0, S, 0, S)]
    while que:
        cost, now, v, prev = heapq.heappop(que)
        if cost > dist[now][v][prev]:
            continue
        if now == G and v == 1:
            print("{:.20f}".format(cost))
            break
        dist[now][v][prev] = cost
        for x, d, c in edge[now]:
            if x == prev:
                continue
            if 0 < v <= c and dist[x][v][now] > dist[now][v][prev] + d / v:
                dist[x][v][now] = dist[now][v][prev] + d / v
                heapq.heappush(que, (dist[x][v][now], x, v, now))
            if v < c and dist[x][v + 1][now] > dist[now][v][prev] + d / (v + 1):
                dist[x][v + 1][now] = dist[now][v][prev] + d / (v + 1)
                heapq.heappush(que, (dist[x][v + 1][now], x, v + 1, now))
            if 1 < v <= c + 1 and dist[x][v - 1][now] > dist[now][v][prev] + d / (v - 1):
                dist[x][v - 1][now] = dist[now][v][prev] + d / (v - 1)
                heapq.heappush(que, (dist[x][v - 1][now], x, v - 1, now))
    else:
        print("unreachable")

Measured memory_bytes: 9836
#!/usr/bin/env python3

import sys

def solve(n):
    s = 0
    for i in range(1,n+1):
        s += i
    print(s)

def readQuestion():
    ws = sys.stdin.readline().strip().split()
    n = int(ws[0])
    return (n,)

def main():
    solve(*readQuestion())

# Uncomment before submission
main()


Measured memory_bytes: 2940
//#define _GRIBCXX_DEBUG
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <string>
#include <utility>
#include <vector>
using namespace std;

// ?????¬???????????¬??????
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), c.end()

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<double> vd;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<long, long> pil;


// ??°?????????????????¬??????
typedef int Weight;

struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) :
    src(src), dst(dst), weight(weight) {}
};

bool operator < (const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight :
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;


int main() {
  int a, b;
  char op;
  while(true) {
    scanf("%d %c %d", &a, &op, &b);
    if(op=='+') printf("%d\n", a+b);
    else if(op=='-') printf("%d\n", a-b);
    else if(op=='*') printf("%d\n", a*b);
    else if(op=='/') printf("%d\n", a/b);
    else break;
  }
  return 0;
}

Measured memory_bytes: 3176
#include<iostream>
#include<cmath>
#include<cstdio>

using namespace std;

int main(void){

  int D,E;
  while(cin >> D >> E, D|E){
    double d = D,e = E,ans = 100000.0;
    for(double x=0;x<=d;x++){
      for(double y=0;y<=d;y++){
	double cost = abs(sqrt(x*x+y*y)-e);
	if(abs(x+y-d)<1e-8 && cost < ans - 1e-8){
	  ans=cost;
	}
      }
    }
    printf("%0.4f\n",ans);
  }
  
  return 0;
}

Measured memory_bytes: 3144
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

using Pair = System.Collections.Generic.KeyValuePair<int, int>;

class Program
{
	public Program() { }

	static void Main(string[] args)
	{
		new Program().prog();
	}
	Scanner cin;
	const int MOD = 1000000007;
	const int INF = int.MaxValue;
	const double EPS = 1e-7;
	
	void prog()
	{
		cin = new Scanner();

		long n = cin.nextLong();

		Console.WriteLine(n*n*n);
	}
}

class Scanner
{
	string[] s;
	int i;

	char[] cs = new char[] { ' ' };

	public Scanner()
	{
		s = new string[0];
		i = 0;
	}

	public string next()
	{
		if (i < s.Length) return s[i++];
		string st = Console.ReadLine();
		while (st == "") st = Console.ReadLine();
		s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
		i = 0;
		return next();
	}

	public int nextInt()
	{
		return int.Parse(next());
	}

	public long nextLong()
	{
		return long.Parse(next());
	}

	public double nextDouble()
	{
		return double.Parse(next());
	}
}

Measured memory_bytes: 9140
n=gets.to_i
s=gets.chomp
c=s.count("R")*s.count("G")*s.count("B")
n.times do |i|
  next if i==0
  ((i-1)/2+1).upto(i-1) do |j|
    if s[i]!=s[j]&&s[i]!=s[j*2-i]&&s[j*2-i]!=s[j]
      c-=1
    end
  end
end
puts c


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

int asc(const void *a, const void *b) {
  long long int *A = (long long int *)a;
  long long int *B = (long long int *)b;
  if (*A > *B) return 1;
  if (*A < *B) return -1;
  return 0;
}

int main(void){
    long long int n, k, i, j, min, ans=0, leng=0, po=0, popo=0;
    scanf("%lld %lld", &n, &k);
    long long int a[n], f[n];
    for(i=0; i<n; i++) scanf("%lld", &a[i]);
    for(i=0; i<n; i++) scanf("%lld", &f[i]);

    qsort(a, sizeof(a) / sizeof(long long int), sizeof(long long int), asc);
    qsort(f, sizeof(f) / sizeof(long long int), sizeof(long long int), asc);
    long long int l=0, r=a[n-1]*f[n-1], m;
    
    while(1){
        po = 0;
        popo = 0;
        m = (l+r)/2;
        if(l == r) break;
        for(i=0; i<n; i++){
            if(m<(a[i]*f[n-1-i])) po += a[i] - (m/f[n-1-i]);
            if(po>k){
                popo++;
                break;
            }
        }

        if(r-l<=1){
            if(popo == 0) ans = l;
            else ans = r;
            break;
        }

        if(popo == 0) r = m;
        else l = m;
    }
    printf("%lld", ans);
}

Measured memory_bytes: 4860
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
using namespace std;

int main(){
    int N,L[20],M=0,sum=0;cin>>N;
    for(int i=0;i<N;++i){
        cin>>L[i];
        M=max(M,L[i]);
        sum+=L[i];
    }
    sum-=M;
    if(M<sum)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

int main() {
	int i;
	int n;

	cin >> n;


	for (i = 1; i <= n ; i++){

		int x = i;
	if (x % 3 == 0) {
		cout << " " << i;
	}
	else
	{
		while (x) {
			if (x % 10 == 3) {
				cout << " " << i;
				break;
			}


			x /= 10;
		}

	}

}




	cout << endl;
	return 0;
}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long, long long>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define mod2 998244353LL
#define INF 1000000000007
 

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> o_tree;


void solve()
{
    ll n;
    cin>>n;
    ll i,j;
    ll a[n];
    ll res=0;
    mll m;
    for(i=0;i<n;i++)
    {
       cin>>a[i];
       m[a[i]]++;
    }

    for(i=0;i<n;i++)
    {
        m[a[i]]--;
        ll no=0;
        ll f=0;
        for(j=1;j*j<=a[i];j++)
        {
            if(a[i]%j==0)
            {
                ll no1 = j;
                ll no2 = a[i]/j;
                if(m.find(no1)!=m.end())
                {
                    ll noo = m[no1];
                    if(noo>0)
                    {
                       f=1;
                       break;
                    }
                }
                if(m.find(no2)!=m.end())
                {
                    ll noo = m[no2];
                    if(noo>0)
                    {
                        f=1;
                        break;
                    }
                }
            }
        }
        if(f==0)
        {
            res++;
        }
        m[a[i]]++;
    }
    cout<<res<<"\n";
    

}


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


if (fopen("input.txt","r" ))
  {
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
  }
cout<<setprecision(20);


ll t=1;


// cin>>t;


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


return 0;
}

Measured memory_bytes: 17636
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <map>
#include <list>
#include <cmath>
using namespace std;
typedef long long ll;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define mp make_pair
#define pb push_back
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9+7;

int x[10], y[10];

double dist(int i, int j) {
	double dx = x[i] - x[j];
	double dy = y[i] - y[j];
	return pow(dx*dx + dy*dy, 0.5);
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) cin >> x[i] >> y[i];

	double ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			ans += dist(i, j);
		}
	}

	ans /= n;
	printf("%8lf", ans);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
int a[200005];
double e[200005];
int main()
{
  int n,k;cin>>n>>k;
  for(int i=1;i<=n;i++)
  {
  	cin>>a[i];
  	e[i]=(1+a[i])*1.0/2;
  }
  e[0]=0;
  for(int i=1;i<=n;i++)
  e[i]+=e[i-1];
  //for(int i=1;i<=n;i++)
  //cout<<e[i]<<endl;
  double maxn=0;
  for(int i=k;i<=n;i++)
  maxn=max(maxn,e[i]-e[i-k]);
  printf("%.012lf",maxn);
}

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

using namespace std;



int main(){
    int N;
    long long A,B,C;
    cin >> N >> A >> B >> C;
    string ans;
    vector<string> str(N);
    for(int i=0;i<N;i++){
        cin >> str[i];
    }
    for(int i=0;i<N;i++){
        string s=str[i];
        if(s=="AB"){
            if(A==0 && B==0){
                cout << "No" << endl;
                return 0;
            }
            else if (A==1 && B==1 && i != N-1)
            {
                if(str[i+1]=="AC"){
                    A++;
                    B--;
                    ans += "A";  
                }
                else{
                    B++;
                    A--;
                    ans += "B";                      
                }
            }
            else{
                if(A<B){
                    A++;
                    B--;
                    ans += "A";
                }
                else{
                    B++;
                    A--;
                    ans += "B";                   
                }

            }
        }
        if(s=="AC"){
            if(A==0 && C==0){
                cout << "No" << endl;
                return 0;
            }
            else if (A==1 && C==1 && i != N-1)
            {
                if(str[i+1]=="AB"){
                    A++;
                    C--;
                    ans += "A";  
                }
                else{
                    C++;
                    A--;
                    ans += "C";                      
                }
            }
            else{
                if(A<C){
                    A++;
                    C--;
                    ans += "A";
                }
                else{
                    C++;
                    A--;
                    ans += "C";                   
                }

            }
        }
        if(s=="BC"){
            if(C==0 && B==0){
                cout << "No" << endl;
                return 0;
            }
            else if (C==1 && B==1 && i != N-1)
            {
                if(str[i+1]=="AC"){
                    C++;
                    B--;
                    ans += "C";  
                }
                else{
                    B++;
                    C--;
                    ans += "B";                      
                }
            }
            else{
                if(C<B){
                    C++;
                    B--;
                    ans += "C";
                }
                else{
                    B++;
                    C--;
                    ans += "B";                   
                }

            }
        }
    }
    cout << "Yes" << endl;
    for(int i=0;i<ans.length();i++){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 6700
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ll N, K;
    cin >> N >> K;
    ll ans = 0;
    for (ll b = K + 1; b <= N; b++) {
        for (ll k = 0; b * k + K <= N; k++) {
            ans += min(N, b * (k + 1) - 1) - max(1LL, (b * k + K)) + 1;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256