akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int abs (int x,int y) {
	int s=x-y;
	if (s<0) return -s;
	else return s;
}
struct stu {
	int ai,bi;
}a[110],b[110];
int minn=0x7fffffff,n,m,i,j,k;
int main(){
	scanf ("%d%d",&n,&m);
	for (i=1;i<=n;i++)
		scanf ("%d%d",&a[i].ai,&a[i].bi);
	for (i=1;i<=m;i++)
		scanf ("%d%d",&b[i].ai,&b[i].bi);
	for(i=1;i<=n;i++){
	    for (j=1;j<=m;j++) {
		    if (minn>(abs(a[i].ai,b[j].ai)+abs(a[i].bi,b[j].bi)))
				minn=(abs(a[i].ai,b[j].ai)+abs(a[i].bi,b[j].bi)),k=j;
	    }
	    printf("%d\n",k);
	    minn=0x7fffffff;
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstring>
#define N 100005
using namespace std;
typedef long long ll;
struct edge{
	int k,next;
}e[500005];
int n,m,cnt=-1,fa[N<<1],F[N],home[N],col[N],D;
bool vis[N],used[N+N];
void add(int x,int y){
	cnt++;
	e[cnt].k=y;
	e[cnt].next=home[x];
	home[x]=cnt;
}
int find(int k){
	if(fa[k]!=k) fa[k]=find(fa[k]);
	return fa[k];
}
int FIND(int k){
	if(F[k]!=k) F[k]=FIND(F[k]);
	return F[k];
}
void dfs(int k){
	for(int i=home[k];~i;i=e[i].next){
		if(!col[e[i].k]){
			col[e[i].k]=3-col[k];
			dfs(e[i].k);
		}else{
			if(col[e[i].k]==col[k]) D=0;
		}
	}
}
int main(){
	memset(home,-1,sizeof(home));
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n+n;i++) fa[i]=i;
	for(int i=1;i<=n;i++) F[i]=i;
	for(int i=1,x,y;i<=m;i++){
		scanf("%d%d",&x,&y);
		vis[x]=vis[y]=1;
		int X=find(x),Y=find(y+n);
		fa[X]=Y;
		X=find(x+n),Y=find(y);
		fa[X]=Y;
		X=FIND(x),Y=FIND(y);
		F[X]=Y;
		add(x,y);add(y,x);
	}
	int tot=0,sum=0;ll ans=0;
	for(int i=1;i<=n;i++) if(!vis[i]) tot++;
	for(int i=1;i<=n;i++) if(!used[find(i)]){
		used[fa[i]]=1;
		sum++;
	}
	int G=0;
	for(int i=1;i<=n;i++) FIND(i),G+=F[i]==i;
	ans=1LL*tot*n;
	for(int i=1;i<=n;i++){
		if(F[i]==i&&vis[i]){
			col[i]=1;D=1;
			dfs(i);
			if(!D) ans+=G;
			else ans+=sum;
		}else if(vis[i]) ans+=tot;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
#define f(i,j,k) for(int i=j;i<k;i++)
#define f2(i,j,k) for(int i=j;i>k;i--)
using namespace std;
int main(){
    long long a=0,b=0;
    string n;
    cin>>n;
    f(i,0,n.size()){
        if(n[i]=='0'){
            a++;
        }
        else{
            b++;
        }
    }
    cout<<min(a,b)*2<<endl;
    return 0;
}


Measured memory_bytes: 3736
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define fill(x,v) memset(x, v, sizeof(x))
#define PI (ld)acos(-1)
#define endl '\n'
#define dbg(x) cout<<#x<<"="<<(x)<<endl;
#define dbg2(x,y) cout<<#x<<"="<<(x)<<" "<<#y<<"="<<(y)<<endl; 
#define fio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 
#define IO freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
const ld eps=(ld)1e-9;
const ll inf=(ll)1e18;
const ll mod=(ll)1e9+7;

void solve(){
	int n;
	cin>>n;
	ld p[n], d[n+1][n+1];
	for (int i = 0; i < n; ++i)
	{
		cin>>p[i];
	}
	fill(d,0);
	d[0][0]=1;
	for (int i = 1; i <=n; ++i)
	{
		for (int j = 0; j <=i; ++j)
		{
			d[i][j]=d[i-1][j]*(1-p[i-1])+(j>0?d[i-1][j-1]*p[i-1]:0);
		}
	}
	ld ans=0;
	for (int j = (n+1)/2; j <=n; ++j)
	{
		ans+=d[n][j];
	}
	cout<<setprecision(11)<<ans;

}

int main(){fio;
int test=1;
// cin>>test;
while(test--){
	solve();
	cout<<endl;
}
return 0;
}


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

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

using namespace std;

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

    int n;
    cin >> n;

    int total = 0, min = 101;
    REP(i, n) {
        int s;
        cin >> s;

        if (s % 10 != 0 && s < min) {
            min = s;
        }

        total += s;
    }

    cout << (total % 10 == 0 ? (min == 101 ? 0 : total - min) : total) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

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

static const double PI=6*asin(0.5);
typedef complex<double> P;
typedef long long ll;


int s[110];
string st;

int main(){
	while(cin>>st){
		rep(i,110) s[i]=0;
		rep(i,st.size()){
			if(st[i]=='I') s[i]=1;
			else if(st[i]=='V') s[i]=5;
			else if(st[i]=='X') s[i]=10;
			else if(st[i]=='L') s[i]=50;
			else if(st[i]=='C') s[i]=100;
			else if(st[i]=='D') s[i]=500;
			else if(st[i]=='M') s[i]=1000;
		}
		int MAX=s[0],num=0;
		int res=0;
		bool f[110];
		rep(i,110) f[i]=true;
		//rep(i,st.size()) cout<<s[i]<<" ";
		//cout<<endl;
		rep(i,st.size()-1){
			if(s[i]<s[i+1]){
				if(f[i]){
					res-=2*s[i];
					f[i]==false;
					f[i+1]=false;
				}
			}
		}
		rep(i,st.size()) res+=s[i];
		cout<<res<<endl;
	}
	return 0;
}

Measured memory_bytes: 1180
#include<iostream>
#include<vector>
#include<math.h>
using namespace std ;

int main(){
  int q ; cin >> q ;
  vector<int> prime = {2,3} ;
  vector<int> cnt(100001) ;
  cnt.at(3) = cnt.at(4) =  1 ;
  for(int i=5;i<=100000;i++){
    bool check = true ;
    for(int j=0;prime.at(j)<=sqrt(i);j++){
      if(i%prime.at(j)==0){
        check = false ;
        break ;
      }
    }
    if(check){
      prime.push_back(i) ;
      bool check_2 = false ;
      for(int j=0;j<prime.size();j++){
        if(prime.at(j)>(i+1)/2) break ;
        if(prime.at(j)==(i+1)/2){
          check_2 = true ;
          break ;
        }
      }
      if(check_2){
        cnt.at(i) = cnt.at(i-1)+1 ;
      }else{
        cnt.at(i) = cnt.at(i-1) ;
      }
    }else{
      cnt.at(i) = cnt.at(i-1) ;
    }
  }
  for(int i=0;i<q;i++){
    int l,r ;
    cin >> l >> r ;
    cout << cnt.at(r)-cnt.at(l-1) << endl ;
  }
}

Measured memory_bytes: 1152
package main

import (
	"bufio"
	"fmt"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()

}

func contains(list []string, val string) bool {
	for _, v := range list {
		if v == val {
			return true
		}
	}
	return false
}

func main() {
	N := next()
	hon_list := []string{"2", "4", "5", "7", "9"}
	pon_list := []string{"0", "1", "6", "8"}
	bon := "3"

	N_rune := []rune(N)
	last_value := string(N_rune[len(N_rune)-1])

	if last_value == bon {
		fmt.Println("bon")
	} else if contains(hon_list, last_value) {
		fmt.Println("hon")
	} else if contains(pon_list, last_value) {
		fmt.Println("pon")
	}

}

Measured memory_bytes: 1752
#include <iostream>
using namespace std;
int main(void){
    int X;
    cin >> X;
    if(X<9){
        if((9-X)%7==1){
            cout << "fri";
        }else if((9-X)%7==2){
            cout << "thu";
        }else if((9-X)%7==3){
            cout << "wed";
        }else if((9-X)%7==4){
            cout << "tue";
        }else if((9-X)%7==5){
            cout << "mon";
        }else if((9-X)%7==6){
            cout << "sun";
        }else if((9-X)%7==0){
            cout << "sat";
        }
    }else{
        if((X-9)%7==0){
            cout << "sat";
        }else if((X-9)%7==1){
            cout << "sun";
        }else if((X-9)%7==2){
            cout << "mon";
        }else if((X-9)%7==3){
            cout << "tue";
        }else if((X-9)%7==4){
            cout << "wed";
        }else if((X-9)%7==5){
            cout << "thu";
        }else if((X-9)%7==6){
            cout << "fri";
        }
    }cout << endl;
}



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

int main(){
  double a, b, x; cin >> a >> b >> x;
  double s = x / a;
  double ans;
  if (s >= a * b / 2) ans = atan2((a * b - s) * 2 / a, a) * 180 / M_PI;
  else ans = atan2(b, 2 * s / b) * 180 / M_PI;

  printf("%.10f\n", ans);
  return 0;
}


Measured memory_bytes: 256
/* ****mittal**** */
#include<bits/stdc++.h>
#define ll          long long int 
#define pb          push_back
#define endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define jell        998244353
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define repr(i,a,b)   for(ll int i=a;i>=b;i--)
#define lbnd    lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define DEC(N)  cout << std::fixed; cout << setprecision(N);
using namespace std;
ll add(ll x,ll y)
{
return (x%hell+y%hell)%hell;
}
ll mul(ll x,ll y)
{
return ((x%hell)*(y%hell))%hell;
}
ll sub(ll x,ll y)
{
return (x-y+hell)%hell;
}
#define N  100005
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
 //  cin>>t;
    for(int ok=1;ok<=t;ok++)
    {
          ll x,k,d;
          cin>>x>>k>>d;
          x=abs(x);
          ll o=x/d;
          if(o>=k)
          {
              cout<<x-k*d;
          }
          else
          {

              if((o+1)*d-x>=x-o*d)
              {
                 ll op=k-o;
                 if(op&1)
                  cout<<abs(x-o*d-d);
                else
                  cout<<x-o*d;
              }
              else
              {
                 ll op=k-o-1;
                 if(op&1)
                  cout<<abs(x-o*d);
                else
                  cout<<abs(x-o*d-d);
              }
          }
     
    }
    return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>
#include <cassert>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <iostream>
#include <math.h>
#include <time.h>
#include <unistd.h>
#include <algorithm>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <string>
#include <iomanip>
 
#ifdef LOCAL_CODE
	#define DEBUG(x) cerr << "[" << #x << '=' << x << "]" << endl;
#else
	#define DEBUG(x) do {} while(0);
#endif
 
#define pb push_back
#define mp make_pair
#define ALL(x) (x).begin(), (x).end()
#define PER(i, N) for(int i = (N)-1; i >= 0; i--)
#define REP(i, N) for(int i = 0; i < (int)(N); i++)
using namespace std;
typedef long long ll;
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }

template <typename T, typename U> std::istream&operator>>(std::istream&i, pair<T,U>&p) {i >> p.first >> p.second; return i;}
template<typename T>std::istream&operator>>(std::istream&i,vector<T>&t) {for(auto&v:t){i>>v;}return i;}
template <typename T, typename U> std::ostream&operator<<(std::ostream&o, const pair<T,U>&p) {o << p.first << ' ' << p.second; return o;}
template<typename T>std::ostream&operator<<(std::ostream&o,const vector<T>&t) {if(t.empty())o<<'\n';for(size_t i=0;i<t.size();++i){o<<t[i]<<" \n"[i == t.size()-1];}return o;}
template<typename T> using minheap = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using maxheap = priority_queue<T, vector<T>, less<T>>;
template<typename T> T gcd(T a,T b) { if (a<b) swap(a,b); return b?gcd(b,a%b):a; }

int n,m;
vector<int> nxt[222222];
int ans[222222];
void solve(istream& cin, ostream& cout) {
	cin >>n>>m;
	REP(i, m) {
		int u,v;
		cin >> u >> v;
		u--; v--;
		nxt[u].pb(v);
		nxt[v].pb(u);
	}
	memset(ans, -1, sizeof(ans));
	queue<int> Q;
	int F = 0;
	Q.push(0);
	ans[0] = 0;
	while(!Q.empty()) {
		int u = Q.front();
		Q.pop();
		for(int v : nxt[u]) {
			if(ans[v] == -1) {
				F++;
				ans[v] = u+1;
				Q.push(v);
			}
		}
	}
	if(F==n-1) {
		cout << "Yes"<<endl;
		REP(i, n-1) cout <<ans[i+1]<<endl;
	} else cout <<"No"<<endl;
}


int main() {
    ios_base::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	solve(cin, cout);
	/*
	{
		istringstream instr("2\n2\n14");
		solve(instr, cout);
	}
 */
	return 0;
}


Measured memory_bytes: 13372
#include<bits/stdc++.h>
using namespace std;
char c[10][10];
bool a[10];
bool b[10];
int main(){
	int n,m,k;
	cin>>n>>m>>k;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>c[i][j];
		}
	}
	int ans=0;
	for(int i=0;i<(1<<n);i++){
		for(int j=0;j<(1<<m);j++){
			int cnt=0;
			for(int ii=0;ii<n;ii++){
				a[ii]=0;
				if(i&(1<<ii)){
					a[ii]=1;
				}
			}
			for(int jj=0;jj<m;jj++){
				b[jj]=0;
				if(j&(1<<jj)){
					b[jj]=1;
				}
			}
			for(int ii=0;ii<n;ii++){
				for(int jj=0;jj<m;jj++){
					if(!a[ii]&&!b[jj]&&c[ii][jj]=='#')cnt++;
				}
			}
			if(cnt==k){
				ans++;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

int main()
{
	int n;
	long long ans = 0;
	map<pair<int,int>, long long> m;
	cin >> n;
	while(n > 0){
		int cur = n, st, end;
		n--;
		st = cur % 10;
		if(st == 0)
			continue;
		while(cur > 0){
			end = cur%10;
			cur /= 10;
		}
		ans += m[{end, st}] * 2;
		++m[{st, end}];
		if(st == end)
			++ans;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        System.out.println((n * (n - 1) / 2) + (m * (m - 1) / 2));
    }
}

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

int main() {

    int num_stones;
    vector<int> height(1000000);
    vector<int> cost(1000000);

    cin >> num_stones;
    for(int i = 0; i < num_stones; i++) cin >> height[i];

    cost[0] = 0;
    cost[1] = abs(height[1] - height[0]);

    for(int i = 2; i < num_stones; i++){
        cost[i] = min(cost[i-1] + abs(height[i-1] - height[i]) , cost[i-2] + abs(height[i-2] - height[i]));
    }

    cout << cost[num_stones-1];

    return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
#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++)

using namespace std;

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

  int input;
  vector<int> vec;
  rep (i, N) {
    cin >> input;
    vec.push_back(input);
  }
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  int A = 0, B = 0;
  rep(i, N) {
    if (i % 2 == 0) {
      A += vec.at(i);
    } else {
      B += vec.at(i);
    }
  }
  cout << A - B << endl;
}


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

int n, a[610][610];

void solve(int d)
{
	int num = 0;
	while(d % 4 == 0)
	{
		d /= 4;
		++num;
	}
	if(d % 4 == 1)
	{
		for(int i = 0; i < 2 * n; ++i)
			for(int j = 0; j < 2 * n; ++j)
				if(((i >> num) + (j >> num)) & 1) a[i][j] = 1;
	}
	else
	{
		for(int i = 0; i < 2 * n; ++i)
			for(int j = 0; j < 2 * n; ++j)
				if((i >> num) & 1) a[i][j] = 1;
	}
}

int main()
{
	int d1, d2, sum = 0, flag = 0;
	scanf("%d", &n);
	scanf("%d", &d1); solve(d1);
	scanf("%d", &d2); solve(d2);
	for(int i = 0; i < 2 * n && !flag; ++i)
		for(int j = 0; j < 2 * n && !flag; ++j)
			if(!a[i][j])
			{
				printf("%d %d\n", i, j);
				if(++sum == (n * n)) flag = 1;
			}
	return 0;
}

Measured memory_bytes: 2304
package main

import (
	"fmt"
)

func maxint(a int, b int) int {
	if a > b {
		return a
	}
	return b
}
func main() {
	prev := 0
	current := 1
	var n, limit, w, v int
	fmt.Scan(&n, &limit)
	var dp [][]int
	dp = append(dp, make([]int, limit+1))
	dp = append(dp, make([]int, limit+1))
	for i := 0; i < n; i++ {
		fmt.Scan(&w, &v)
		for j := 0; j < w; j++ {
			dp[current][j] = dp[prev][j]
		}
		for j := w; j <= limit; j++ {
			dp[current][j] = maxint(dp[prev][j-w]+v, dp[prev][j])
		}
		prev, current = current, prev
	}
	fmt.Println(dp[prev][limit])
}


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

using namespace std;

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// chmax, chmin
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;
}


long long dp[100010][2];
bool ok[100010][2];
vector<ll> A;

long long dfs(int p, int c) {
  if (p == A.size()) return c == 1 ? -1e18 : 0;

  if (ok[p][c]) {
    return dp[p][c];
  }

  long long v = c ? -A[p] : A[p];

  long long ans = dfs(p + 1, 0) + v;
  ans = max(ans, dfs(p + 1, 1) - v);


  ok[p][c] = true;
  return dp[p][c] = ans;
}


void solve(long long N, std::vector<long long> A) {
  ::A = A;
  cout << dfs(0, 0) << endl;

}

int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  solve(N, std::move(A));
  return 0;
}


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

int main(){
  int N,Q;
  cin>>N>>Q;
  int I=1100100100;
  vector<pair<int,int>> p;
  for(int i=0;i<N;i++){
    int a,b,c;
    cin>>a>>b>>c;
    p.push_back(make_pair(a-c,c));
    p.push_back(make_pair(b-c,-1*c));
  }
  for(int i=0;i<Q;i++){
    int a;
    cin>>a;
    p.push_back(make_pair(a,I));
  }
  sort(p.begin(),p.end());
  priority_queue<int, vector<int>, greater<int>> pq;
  priority_queue<int, vector<int>, greater<int>> end;
  for(int i=0;i<2*N+Q;i++){
    int a,b;
    tie(a,b)=p[i];
    if(b<0){
      end.push(b*-1);
    }
    else if(b<I){
      pq.push(b);
    }
    else{
      while(!pq.empty()&&!end.empty()){
        if(pq.top()!=end.top()){
          break;
        }
        pq.pop();
        end.pop();
      }
      if(pq.empty()){
        cout<<"-1"<<endl;
      }
      else{
        cout<<pq.top()<<endl;
      }
    }
  }
}

Measured memory_bytes: 11656
//#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#define MAX_INT 2100000000
using namespace std;
typedef long long int ll;
#ifdef COMPILE_IN_VCPP
#include <windows.h>
HWND GetConsoleHwnd(void)
{
#define MY_BUFSIZE 1024 // Buffer size for console window titles.
	HWND hwndFound;         // This is what is returned to the caller.
	char pszNewWindowTitle[MY_BUFSIZE]; // Contains fabricated// WindowTitle.
	char pszOldWindowTitle[MY_BUFSIZE]; // Contains original// WindowTitle.
	// Fetch current window title.
	GetConsoleTitle(pszOldWindowTitle, MY_BUFSIZE);
	// Format a "unique" NewWindowTitle.
	wsprintf(pszNewWindowTitle, "%d/%d",GetTickCount(),GetCurrentProcessId());
	// Change current window title.
	SetConsoleTitle(pszNewWindowTitle);
	// Ensure window title has been updated.
	Sleep(40);
	// Look for NewWindowTitle.
	hwndFound = FindWindow(NULL, pszNewWindowTitle);
	// Restore original window title.
	SetConsoleTitle(pszOldWindowTitle);
	return(hwndFound);
}
#endif
int main()
{
#ifdef COMPILE_IN_VCPP
	SetWindowPos(GetConsoleHwnd(), HWND_TOPMOST, 0, 0, 0, 0,
		(SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW));
#endif
	int r, g, b, n, i, j, k, ans = 0;
	cin >> r >> g >> b >> n;
	for (i = 0; i <= 3000; i++)
	{
		for (j = 0; j <= 3000; j++)
		{
			k = n - r * i - g * j;
			if (k >= 0)
			{
				if (!(k % b))
				{
					ans++;
					//printf("%d,%d,%d\n", i, j, k / b);
				}
			}
		}
	}
	cout << ans << endl;
}


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

constexpr int64_t INF = 1'010'000'000'000'000'017LL;
constexpr int64_t MOD = 1'000'000'007LL;
constexpr double EPS = 1e-12;
constexpr double PI = 3.14159265358979323846;

#define FOR(i, start, end) for(int64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

// 最小公倍数lcm=m*n/gcd
uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// nCm
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

signed main() {
  uint64_t n;
  cin >> n;
  n = n%10;
  switch(n){
    case 3:
      cout << "bon" << endl;
      break;
    case 0:
    case 1:
    case 6:
    case 8:
      cout << "pon" << endl;
      break;
    default:
      cout << "hon" << endl;
      break;
  }
  return 0;
}

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

using i64 = int_fast64_t;
using f64 = double;

constexpr i64 INF = INT_FAST64_MAX / 2;
constexpr f64 EPS = DBL_EPSILON;

void solve() {
    string s;
    cin >> s;

    i64 ans = 0;
    i64 b = 0;
    for (auto& e : s) {
        if (e == 'B') b++; else ans += b;
    }

    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


Measured memory_bytes: 720
#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 inf 1013161010
#define ninf -1013161010
#define mod 1000000007
#define ll long long
#define lf long double
#define in(x) scanf("%d",&x);
#define sz(x) ((int)x.size())
#define lld l64d
#define rep(i,n) for(i=0;i<n;i++)
#define rrep(i,n) for(i=n-1;i>=0;i--)
#define rep1(i,a,b) for(i=a;i<=b;i++)
#define rrep1(i,a,b) for(i=a;i>=b;i--)
#define stlfor(i,t) for(auto i =t.begin();i!=t.end();i++)
#define fr freopen("x.txt","r",stdin)
#define frc freopen("y.txt","w",stdout)
#define all(x) x.begin(),x.end()
#define set0(x) memset(x,0,sizeof(x))
#define dbg cout<<"yo "<<endl;
#define pset(n) fixed<<showpoint<<setprecision(n)

#define pii pair<int,int>
#define pll pair<ll,ll>
#define min_pq priority_queue<pll, vector<pll>, greater<pll> >
#define vpii vector<pair<int,int> >
#define vll vector<ll>
#define vpll vector<pair<ll,ll> >
#define si set<int>
#define mii map<int,int>
#define umii unordered_map<int,int>
#define vi vector<int>
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define modulo %
#define moduloe %=

typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> OST;

ll toint(const string &s) { stringstream ss; ss << s; ll x; ss >> x; return x; }
ll add(ll a, ll b) {a+=b; while(a >= mod) a-= mod; while(a<0) a+= mod;}
ll mul(ll a, ll b) {return (a * 1LL *b % mod);}
string tostring ( ll number ){  stringstream ss; ss<< number; return ss.str();}

const lf pi = 2*acos(0);
const int nn = 500006;
const lf EPS = 0.000000001;

ll gcd(ll a,ll b){return (b==0)? a:gcd(b,a%b); }
void nope(int num = 0){ if(num==0) cout<<"NO"; else cout<<"-1"; exit(0); }

ll dp[103][100010];
ll sum[103][100010];
ll a[103];

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    ll i,j,n,tt;
    tt=1;
    //cin>>tt;
    while(tt--)
    {
        ll k;
        cin>>n>>k;
        rep1(i, 1, n)
            cin>>a[i];

        for(i=0;i<=n;i++)
            dp[i][0] = 1LL;

        for(i=0;i<=k;i++)
            sum[0][i] = 1LL;

        for(i=1;i<=n;i++)
        {
            for(j=1;j<=k;j++)
            {
                if((j - a[i] - 1) < 0)
                    dp[i][j] = sum[i-1][j];
                else
                    dp[i][j] = ( sum[i-1][j] - sum[i-1][j - a[i] - 1] + 2*mod ) modulo mod;
            }

            sum[i][0] = 1LL;
            for(j=1; j<=k; j++)
            {
                sum[i][j] = sum[i][j-1] + dp[i][j];
                sum[i][j] moduloe mod;
            }
        }

        cout<<dp[n][k]<<endl;
    }
    return 0;
}

/*
10 100000
100000 100000 100000 100000 100000 100000 100000 100000 100000 100000
*/

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)


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

int main() {
  string N;
  vector<int> vec(4);
  
  cin >> N;
  
  if (N.at(0) == N.at(1) & N.at(1) == N.at(2)) {
    cout << "Yes" << endl;
  }
  
  else if (N.at(1) == N.at(2) & N.at(2) == N.at(3)) {
    cout << "Yes" << endl;
  }
  
  else {
    cout << "No" << endl;
  }
}


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

using namespace std;

struct Item {
  long w, v;
};

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

  Item items[n + 1];
  long vsum = 0;
  long wsum = 0;
  for (int i = 1; i <= n; i++) {
    cin >> items[i].w >> items[i].v;
    wsum += items[i].w;
    vsum += items[i].v;
  }

  long dp[n + 1][vsum + 1];
  for (int i = 0; i <= n; i++) {
    dp[i][0] = 0;
    for (int v = 1; v <= vsum; v++) { dp[i][v] = wsum; }
  }

  for (int i = 1; i <= n; i++) {
    for (int v = 1; v <= vsum; v++) {
      if (v - items[i].v < 0) {
        dp[i][v] = min(dp[i - 1][v], items[i].w);
      } else {
        dp[i][v] = min(dp[i - 1][v], dp[i - 1][v - items[i].v] + items[i].w);
      }
    }
  }

  for (int v = 0; v < vsum; v++) {
    if (dp[n][v + 1] > w) {
      cout << v << endl;
      return 0;
    }
  }
  cout << vsum << endl;
  return 0;
}



Measured memory_bytes: 79104
n = int(input())
A = [0]+ list(map(int, input().split())) + [0]
a = [0]
for i in range(1,n+2):
    a.append(abs(A[i-1]-A[i]))
ans = sum(a)
for i in range(1,n+1):
    x = ans - a[i] - a[i+1]
    x += abs(A[i-1]-A[i+1])
    print(x)

Measured memory_bytes: 20632
#include<iostream>
#define N 1000001
using namespace std;
int main(){
  int n;
  int p[N]={0};
  for(int i=3;i<=N;i+=2) p[i] = 1;
  p[2] = 1;
  for(int i=3;i<=1000;i+=2){
    if(p[i]==1){
      for(int j=2*i;j<=N;j+=i) p[j] = 0;
    }
  }
  while(cin>>n){
    int count = 0;
    if(2<=n) count++;
    for(int i=3;i<=n;i+=2){
      if(p[i]) count++;
    }
    cout << count << endl;
  }
  return 0;
}

Measured memory_bytes: 5072
#include <bits/stdc++.h>
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define ll long long
#define INF LLONG_MAX/3
#define P pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define prique priority_queue<int,vector<int>,greater<int>>
using namespace std;
int n,d,x,a;
signed main(){
	cin>>n>>d>>x;
	rep(i,n){
		cin>>a;
		for(int j=1;j<=d;j+=a)x++;
	}
	cout<<x<<endl;
	return 0;
}

Measured memory_bytes: 256
N,T=map(int,input().split())
CT=[list(map(int,input().split())) for _ in range(N)]
sort_CT=sorted(CT,key=lambda x:x[0])
c=0
for i in range(N):
    if sort_CT[i][1]<=T:
        print(sort_CT[i][0])
        break
    else:
        c+=1
if c==N:
    print('TLE')

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

using namespace std;

const int MOD = 1e9+7;
const int NMAX = 22;

int a[NMAX][NMAX];
int dp[NMAX][1<<NMAX];

//dp[i][j] = the number of ways to pair the [1..i] men with the women represented by the bitmask j

int main()
{
    int N,i,j;

    cin>>N;

    for(i = 1 ; i <= N ; ++i)
        for(j = 1 ; j <= N ; ++j)
            cin>>a[i][j];

    for(i = 0 ; i < N ; ++i)
    {
        if(a[1][i+1])
            dp[1][(1<<i)] = 1;
    }
    int mask;
    for(i = 2 ; i <= N ; ++i)
        for(mask = 0 ; mask < (1<<N) ; mask++)
            if(dp[i-1][mask])
                for(j = 0 ; j < N ; ++j)
                    if(!(mask&(1<<j)) && a[i][j+1])
                        dp[i][(mask|(1<<j))] = (dp[i][(mask|(1<<j))] + dp[i-1][mask])%MOD;

    cout<<dp[N][(1<<N)-1];
    return 0;

}


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

#define ft first
#define sd second
#define pb push_back
#define all(x) x.begin(),x.end()

#define ll long long int
#define vi vector<int>
#define vii vector<pair<int,int> >
#define pii pair<int,int>
#define plii pair<pair<ll, int>, int>
#define piii pair<pii, int>
#define viii vector<pair<pii, int> >
#define vl vector<ll>
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define mp make_pair
#define ms(x, v) memset(x, v, sizeof x)
#define pr_vec(v) for(int i=0;i<v.size();i++) cout << v[i] << " " ;

#define f_in(st) freopen(st,"r",stdin)
#define f_out(st) freopen(st,"w",stdout)

#define fr(i, a, b) for(i=a; i<=b; i++)
#define fb(i, a, b) for(i=a; i>=b; i--)
#define ASST(x, l, r) assert( x <= r && x >= l )
const int  p=31,po=1,N=1e5+10, M=(ll)1e9+1 ;
const int mod = 1e9+7 ;
vl compute(string s){
        vl has(s.length());
        ll i;

        for(i=0;i<s.length();i++){
            if(i==0){
                has[i]=((s[i]-'a'+1))%mod;
            }
            else
                has[i]=(has[i-1]*p + (s[i]-'a'+1))%mod;
        }
        return has;
}
// vl ed[N],g[N],in(N),vis(N,0),cost(N,0);
vl g[N],vis(N,0),ans;
vl check;
priority_queue<ll,vl,greater<ll>> pq;


int main(){
 ios_base::sync_with_stdio(0);
  ll n,k;
  cin >> n >> k;
  if(ceil(n/2.0)>=k){
      cout << "YES";
  }
  else
    cout << "NO";
  return 0;
}

Measured memory_bytes: 3328
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author ParsaAlizadeh
 */

#include <bits/stdc++.h>
using namespace std;

typedef long long int   ll;
typedef long double     ld;
typedef pair<ll, ll>    pll;
typedef pair<int, int>  pii;

#define all(x)          x.begin(), x.end()
#define kill(x)         return cout << x << endl, 0;
#define X               first
#define Y               second
#define sep             ' '
#define endl            '\n'
#define file_io         freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

ll pw(ll a, ll b, ll mod) {
    if (!b)    return 1;
    if (b & 1) return a * pw(a * a % mod, b / 2, mod) % mod;
    return pw(a * a % mod, b / 2, mod) % mod;
}

const ll MAXN  = 5e3 + 10;
const ll INF   = 8e18;
const ll MOD   = 1e9 + 7; // 998244353;

ll n, m, a[MAXN], b[MAXN], dp[MAXN][MAXN];

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    cin >> n >> m;
    for (ll i = 1; i <= m; i++) {
        ll t, x;
        cin >> a[i] >> t;
        for (ll j = 0; j < t; j++) {
            cin >> x;
            b[i] |= (1LL << (x - 1));
        }
    }
    for (ll i = 0; i < MAXN; i++) {
        fill(dp[i], dp[i] + MAXN, INF);
    }
    dp[0][0] = 0;
    for (ll i = 1; i <= m; i++) {
        for (ll j = 0; j < (1LL << n); j++) {
            dp[i][j] = min(dp[i - 1][j], dp[i - 1][j & (~b[i])] + a[i]);
        }
    }
    ll ind = (1LL << n) - 1;
    if (dp[m][ind] == INF)
        dp[m][ind] = -1;
    cout << dp[m][ind] << endl;

    return 0;
}



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

int main() {
  unsigned long int L, R;
  unsigned long int x;
  int y=2018;
   cin >> L >> R;
 
  if (R-L>=2018) {
        cout << 0 << endl;
        return 0;}
  for (  unsigned long int i=L; i< R; i++) {
	for (  unsigned long int j=i+1; j < R+1; j++) {
      x=i*j%2019;
      if (x<y) {
          y = x;
          //    cout << y << i << j<< endl;
        }

    }
  }

      cout << y << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(i=0;i<n;i++)
int main(){
  int i;
  char fugou[4];
  int ans = 0;
  rep0(i,4){ 
    cin >> fugou[i];
    if(fugou[i] == '+')
      ans += 1;
    else
      ans -= 1;    
  }
  
  cout << ans << endl;
  //rep0(i,4) cout << fugou[i];
}

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

int main()
{
    
    while(1)
    {
        
        int n;
        cin >> n;
        if(n == 0) break;
        int s[n];
        double m=0, v=0;
        for(int i=0;i<n;i++)
        {
            cin >> s[i];
            m += s[i];
        }
        m /= n;
        for(int i=0;i<n;i++)
        {
            v += pow(s[i]-m, 2);
        }
        v /= n;
        
        cout << fixed << sqrt(v) << endl;
    }
    
    return 0;
}



Measured memory_bytes: 3236
#include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define ll long long
#define coYes cout << "Yes" << endl;
#define coYES cout << "YES" << endl;
#define coyes cout << "yes" << endl;
#define coNo cout << "No" << endl;
#define coNO cout << "NO" << endl;
#define cono cout << "no" << endl;
#define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001
int gcd(int a, int b){
    if(a%b == 0){
        return b;
    }else{
    return gcd(b, a%b);
    }
}

int main(){
    int n,l,temp,min=999999;
    cin >> n >> l;
    vector<int> a(n+1);
    ll sum=0;
    a[0]=999999;
    rep1(i,n)
        a[i]=l+i-1;
    sort(a.begin(),a.end());
    rep0(i,n){
        if(min>abs(a[i])){ 
            min=abs(a[i]);
            temp=a[i];
        }
    }
    rep0(i,n)  
        sum+=a[i];
    sum-=temp;
    
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include<algorithm>
#include<cstring>
#include<cmath>

using namespace std;

int Combination(int n, int m)
{
 int ans = 1;
 for(int i=n; i>=(n-m+1); --i)
  ans *= i;
 while(m)
  ans /= m--;
 return ans;
}
int main()
{
        int n, m;
        cin >> n >> m;
        int sum = 0;
        sum += Combination(n, 2);
        sum += Combination(m, 2);
        cout << sum << endl;
        return 0;
}


Measured memory_bytes: 256
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <iomanip>       // fixed, setprecision
using namespace std;

int main()
{
  double N;
  int D;
  cin >> N >> D;
  cout << ceil(N / (2 * D + 1)) << endl;
}


Measured memory_bytes: 3272
# include <cstdio>
# define N 200010
char s[20];
int a[N],b[N],f[100][100];
int max(int x,int y) {return x>y?x:y;}
int min(int x,int y) {return x<y?x:y;}
int main() {
	int n,i,j,cnt,maxa=0,maxb=0;
	long long x,ans=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++) {
		scanf("%s",s);
		x=0;
		for(j=0;s[j] && s[j]!='.';j++) x=x*10+s[j]-'0';
		cnt=0;
		if(s[j]) {
			for(j++;s[j];j++,cnt++) x=x*10+s[j]-'0';
		}
		cnt=9-cnt;
		while(cnt--) x*=10;
		while(!(x%2)) a[i]++, x/=2;
		while(!(x%5)) b[i]++, x/=5;
		maxa=max(maxa,a[i]);
		maxb=max(maxb,b[i]);
		f[a[i]][b[i]]++;
	}
	for(i=maxa;i>=0;i--) {
		for(j=maxb;j>=0;j--) f[i][j]+=f[i+1][j]+f[i][j+1]-f[i+1][j+1];
	}
	for(i=1;i<=n;i++) {
		ans+=f[18-a[i]<0?0:18-a[i]][18-b[i]<0?0:18-b[i]];
		if(min(a[i]*2,b[i]*2)>=18) ans--;
	}
	printf("%lld",ans/2);
	return 0;
}

Measured memory_bytes: 3304
N,A,B = map(int,input().split())
S = list(input())
cnt = [0,0]
ans = [False]*N
for i in range(N):
    if (S[i] == "c"):
        continue

    if (S[i] == "a"):
        if (sum(cnt) < A+B):
            cnt[0] += 1
            ans[i] = True
    
    if (S[i] == "b"):
        if (sum(cnt) < A+B):
            if (cnt[1] < B):
                cnt[1] += 1
                ans[i] = True

for i in range(N):
    if (ans[i]):
        print("Yes")
    else:
        print("No")

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

using namespace std;

int main() {
    
    ios_base::sync_with_stdio(false); 
 
    cin.tie(NULL);
 
    cin.tie(NULL);
  int n;
  cin>>n;
  int ac=0,wa=0,tle=0,re=0;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    if(s=="AC"){ac++;}
    else if(s=="WA"){wa++;}
    else if(s=="TLE"){tle++;}
    else{re++;}
  }
 cout<<"AC x "<<ac<<"\n";
  cout<<"WA x "<<wa<<"\n";
  cout<<"TLE x "<<tle<<"\n";
  cout<<"RE x "<<re<<"\n";
  return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; --i)
#define FOR(i, n, m) for (int i = m; i < n; i++)
#define MM(i, n, m) for (int i = m; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

typedef long long ll;

/**
 * C問以降は ll を使う.
 * double型にするのを忘れない.
 * nC2の求め方 (1/2)*n*(n-1)
 * vector<型> 変数名(要素数, 初期値)
 * pair<型, 型> 変数名
 * map<型, 型> 変数名  // 連想配列
 * priority_queue<型> 変数名  // 最大値から出てくるヒープ
*/
int main()
{
    int N;
    cin >> N;
    vector<int> P(N, 0);
    REP(i, N)
    {
        cin >> P.at(i);
    }
    sort(ALL(P));
    // int mid = P.at(N - 1) - P.at(0) + 0.5;
    // cout << mid << endl;
    // int value = 0;
    ll ans = INF;
    for (int i = P.at(0); i <= P.at(N - 1); i++)
    {
        ll value = 0;
        REP(j, N)
        {
            value += abs(i - P.at(j)) * abs(i - P.at(j));
        }
        ans = min(ans, value);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char maze[55][55];
int vis[55][55];
int n,m;
int d[4][2]={{1,0},{-1,0},{0,1},{0,-1}};
int ans;
int main()
{
    for(int i=0;i<4;i++)
    {
        //cout<<d[i][0]<<" "<<d[i][1]<<endl;
    }
    cin>>n>>m;
        for(int i=0;i<n;i++)
        cin>>maze[i];
        for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
        {
            //cout<<i<<" "<<j<<" "<<11111<<endl;
            if(maze[i][j]=='#')
            {
                //cout<<i<<" "<<j<<" "<<11111<<endl;
                int flag=0;
                int c=0;
                for(int k=0;k<4;k++)
                {
                    int a=d[k][0]+i;
                    int b=d[k][1]+j;
                    //cout<<a<<" "<<b<<endl;
                    if(a>=0&&b>=0&&a<n&&b<m)
                    {
                        c++;
                        //cout<<a<<" "<<b<<endl;
                        if(maze[a][b]=='.')
                        {
                            flag++;
                        }
                    }
                }
                if(c==flag)
                    {
                        //cout<<i<<" "<<j<<endl;
                        cout<<"No"<<endl;
                        return 0;
                    }
            }
        }
        cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=1e6+5;
int main() {
	std::vector<int> pre(maxn),cnt(maxn);
	int n,ans=0;cin>>n;
	for(int i=1;i<=n;i++) cin>>pre[i],cnt[pre[i]]++;
	for(int i=1;i<=n;i++) {
		bool ok=1;
		for(int j=1;j*j<=pre[i];j++) {
			if(pre[i]%j==0) {
				if(j==pre[i]) {
					if(cnt[j]>1) ok=0;
				}else {
					if(cnt[j]) ok=0;
				}
				if(pre[i]/j==pre[i]) {
					if(cnt[pre[i]/j]>1) ok=0;
				}else {
					if(cnt[pre[i]/j]) ok=0;
				}
			}
		}
		if(ok) ans++;
	}
	cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 10988
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<int >    vecint;
typedef vector<string > vecstr;
int main()
{
  string a, b;
  cin >> a >> b ;
  if(a.size() == b.size()){
    if(a == b){
      cout << "EQUAL" << endl;
    }else {
      cout << ((a < b)?"LESS":"GREATER") << endl;
    }
  }else{
    cout << ((a.size() < b.size())?"LESS":"GREATER") << endl;
  }
} 

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

A = list(map(int,input().split()))
chk = []

for i in range(N-1):
    if A[i+1] > A[i]:
        chk.append(1)
    else:
        chk.append(0)

ans = 1000 
for i in range(N-1):
    if chk[i] == 1:
        ans += (A[i+1] - A[i]) * (ans//A[i])
print(ans)

Measured memory_bytes: 61960
#include <iostream>
#include <cmath>
#include <iomanip>
#include <cstdio>

using namespace std;

typedef unsigned long long int ulli;
typedef long long int lli;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

    int A, B;
    cin >> A >> B;

    if (A >= 13)
    {
        cout << B << "\n";
    }
    else if (A >= 6 && A <= 12)
    {
        cout << B / 2 << "\n";
    }
    else
    {
        cout << 0 << "\n";
    }

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define ff              first
#define ss              second
#define ll 				long long
#define int             long long int
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define modp            998244353
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define FIO           	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl 			'\n'
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
// void aks()
// {
// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// #endif
// }


void solve()
{
    string s, t;
    cin >> s >> t;
    int n = s.length();
    int cc= 0;
    for(int i = 0; i < n; i++)
    {
        if(s[i] != t[i])
        cc++;
    }
    cout << cc;
}
 
int32_t main()
{
	FIO
    //aks();
    // w(t)
    {
    	solve();
    }
    return 0;
}
	

	

Measured memory_bytes: 3796
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(15000)
n = int(sys.stdin.readline())

ret = []
inp = sys.stdin.readlines()
G = [[0]*n for _ in range(n)]
for i in range(n):
  v = list(map(int,inp[i].split()))
  for j in v[2:]:
    G[v[0]-1][j-1] = 1
  print(" ".join(map(str,G[i])))


Measured memory_bytes: 5672
#include <iostream>
#include <vector>
#include <algorithm>

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

    std::vector<int> m(N);

    int sum = 0;
    for (int i = 0; i < N; i++) {
        std::cin >> m[i];
        sum += m[i];
    }

    std::sort(std::begin(m), std::end(m));
    int n = m.front();
    
    std::cout << (N + (X - sum) / n) << std::endl;

    return 0;
}

Measured memory_bytes: 256
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

A,B,C=get_i
x=A+B
n=min(x,C)
if n==C
    puts B+C
else
    puts x+B+1
end

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

int main() 
{
    string s, t;
    cin >> s >> t;
    int ans = 0;
    rep(i,3) {
        if (s[i] == t[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<cmath>
#define endl '\n'
using namespace std;
int main()
{
    long long int h,w;
    cin>>h>>w;
    if(h==1 || w==1)cout<<"1"<<endl;
    else{
            long long m = ceil((long double)(h*w)/2);
        cout<<m<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
use std::io;

fn read_line() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s
}

macro_rules! from_line {
    ($($a:ident : $t:ty),+) => {
        $(let $a: $t;)+
        {
            let _line = read_line();
            let mut _it = _line.trim().split_whitespace();
            $($a = _it.next().unwrap().parse().unwrap();)+
                assert!(_it.next().is_none());
        }
    };
}

fn main() {
    from_line!(a: i32);
    println!("{}", a * a * a);
}



Measured memory_bytes: 5028
#include <bits/stdc++.h>
//#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#define pb push_back
#define IOS                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0);cout<<fixed<<setprecision(16);
#define ll long long int
#define ld long double
#define el '\n'
#define El '\n'
#define PI (ld)3.141592653589793238462643383279502884197169399375105820974944
#define inf (ll)1000000000
#define mod (ll)1000000007
#define mod1 (ll)998244353
#define fo(i, n) for (long long i = 0; i < n; i++)
#define pll pair<ll, ll>
#define ml map<ll,ll>
#define vpl vector<pll>
#define vvl vector<vector<ll> >
#define vvpl vector< vector<pll> >
#define ff first
#define ss second
#define pqueue priority_queue< ll >
#define pdqueue priority_queue< ll,vl ,greater< ll > >
#define mem(a,b) memset(a,b,sizeof(a));
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define sz(a) (ll)a.size()
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define vl vector<ll>
//#define x ff
//#define y ss
#define pt(a) for(auto it:a)cout<<it<<" ";cout<<endl;
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
using namespace std;

// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << t<<" "; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << v.first << " " << v.second ; }

double gcd(double a, double b) { return a < 0.01 ? b : gcd(fmod(b, a), a); }

long long bpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1)

      res = res * a % m;
      a = a * a % m;
      b >>= 1;
  }
  return res;
}


ll kv;
ll t,n,x,y,h,k,z,p,q,w,r;
string s,s1,s2;
//vvl v;
//vl vis,d;

int main() {
    IOS;
    ld x,y,z,h;
    cin>>x>>y>>z;
    h=y-z/(x*x);
    if(h<=y/2){
        cout<<atan(2*h/x)*180/PI;
    }
    else{
        cout<<atan(x*y*y/(2*z))*180/PI;
    }
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using pii  = pair<int,int>;
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

int main(){
    ll  N,ans=0;
    cin >> N;
    map<string,ll> M;
    string s;
    rep(i,N){
        cin >> s;
        sort(s.begin(),s.end());
        M[s]++;
    }
    for(auto P : M){
        ans+=P.second*(P.second-1)/2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define lp(i,a,n) for(int i=(a);i<=(int)(n);++i)
#define lpd(i,a,n) for(int i=(a);i>=(int)(n);--i)
#define mem(a,b) memset(a,b,sizeof a)
#define all(v) v.begin(),v.end()
#define println(a) cout <<(a) <<endl
#define sz(x) ((int)(x).size())
#define readi(x) scanf("%d",&x)
#define read2i(x,y) scanf("%d%d",&x,&y)
#define read3i(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define mod 1000000007
#define eps 1e-8
#define infi 1000000000
#define infll 1000000000000000000ll
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef set<int> si;
typedef map<int,int> mii;

const int N = 100002;
int n,a[N],f[N];
si uniq;

int main(){
    readi(n);
    lp(i,1,n) readi(a[i]), ++f[a[i]], uniq.insert(a[i]);

    sort(a+1, a+1+n);

    int i = 1, j = n, ans = sz(uniq);
    while(i < j){
        while(f[a[i]] == 1 and i <= n) ++i;
        while(f[a[j]] == 1 and j >= 1) --j;
        if(i < j){
            if(a[i] == a[j]){
                if(f[a[i]] <= 2) --ans;
            }
            --f[a[i]], --f[a[j]];
        }
        ++i, --j;
    }
    cout <<ans;
}

/*
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/


Measured memory_bytes: 5760