akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define rep(i,n) for (int i=0; i<n; i++)
#include<math.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i=0; i<N; i++) {
    cin >> a[i];
  }
  int sum = 0;
  for (int i=0; i<N; i++) {
    sum += a[i];
  }
  int mi = 100000;
  int mi1;
  for (int i=0; i<N; i++) {
    a[i] *= N;
    if (mi > abs(a[i]-sum)) {
      mi = abs(a[i]-sum);
      mi1 = i;
    }
  }
  cout << mi1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
constexpr int di[] = { 0, 1, 0, -1 }, dj[] = { 1, 0, -1, 0 };
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(), (v).end()
#define vmax 10000
constexpr ll inf = 100000000000000;
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/

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

//最小公倍数
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}

//素因数分解
map<int,int> prime_factor(int n,map<int,int> &res){
    for(int i=2;i*i<=n;i++){
        while(n%i==0){
            res[i]++;
            n/=i;
        }
    }
    if(n!=1){
        if(res[n]==0){
            res[n]=1;
        }else{
            res[n]++;
        }
    }
    return res;
}

//約数列挙
vector<ll> divisor(ll n){
    vector<ll> a;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            a.push_back(i);
            if(i*i!=n){
                a.push_back(n/i);
            }
        }
    }
    SORT(a);
    return a;
}

//拡張ユークリッドの互除法
int extgcd(int a,int b,int &x,int &y){
    if(b==0){
        x=1;
        y=0;
        return a;
    }else{
        int d=extgcd(b,a%b,y,x);
        y-=a/b*x;
        return d;
    }
}

//素数判定
void sieve(int n,vector<bool> &is_prime) {
	is_prime[0]=false;
	is_prime[1]=false;
	for (int i = 2; i * i <= n; i++) {
		if (is_prime[i]) {
			for (int j = i * i; j <= n; j += i) is_prime[j] = false;
		}
	}
	return;
}

//繰り返し2乗法
ll mod_pow(ll x,ll n,ll mod){
    x%=mod;
    ll res=1;
    while(n>0){
        if(n&1){
            res=res*x%mod;
        }
        x=x*x%mod;
        n>>=1;
    }
    return res;
}

//mod　m での a の逆元
int mod_inverse(int a,int m){
    int x,y;
    extgcd(a,m,x,y);
    return (m+x%m)%m;
}

//nCkの前計算
void init(ll n,ll m,vector<ll> &factrial,vector<ll> &inverse){
    factrial.resize(n+1);
    inverse.resize(n+1);
    factrial[0]=1;
    inverse[0]=1;
    for(ll i=1;i<=n;i++){
        factrial[i]=factrial[i-1]*i%m;
        inverse[i]=mod_inverse(factrial[i],m);
    }
}

//nCk
ll nCk(ll n,ll k,ll m,vector<ll> &factrial,vector<ll> &inverse){
    if(n<0||k<0||n<k){
        return 0;
    }
    return factrial[n]*inverse[k]%m*inverse[n-k]%m;
}

int main(){
    int n;
    cin>>n;
    vector<bool> a(1e6+10,true);
    sieve(1e6+3,a);
    for(int i=n;i<1e6+3;i++){
        if(a[i]){
            cout<<i<<endl;
            return 0;
        }
    }
}


Measured memory_bytes: 384
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<stdio.h>
using namespace std;
int main(){
	char a[2]={'H','D'};
	char b[2]={'H','D'};
	scanf("%c %c",&a,&b);
	if((a[0]=='H')&&(b[0]=='H'))
	printf("H");
	else if((a[0]=='H')&&(b[1]=='D'))
	printf("D");
	else if((a[1]=='D')&&(b[0]=='H'))
	printf("D");
	else if((a[1]=='D')&&(b[1]=='D'))
	printf("H");
	return 0;
	
}

Measured memory_bytes: 128
N = int(input())
A = [int(i) for i in input().split()]
f = 0
A.sort()
for i in range(len(A)):
    if i != len(A)-1:
        if A[i] == A[i+1]:
            f = 1
            break
        
if f > 0:
    print("NO")
else:
    print("YES")

Measured memory_bytes: 25932
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REP(a, b, m) for (ll a = (ll)(b); a < (ll)(m); a++)

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> d(k);
    vector<int> memo(n, 0);
    rep(
        i, k)
    {
        cin >> d[i];
        rep(j, d[i])
        {
            int a;
            cin >> a;
            memo[a - 1]++;
        }
    }
    int ans = 0;
    rep(i, n)
    {
        if (memo[i] == 0)
        {
            ans++;
        }
    }
    cout << ans << endl;
}

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

int main() {
    int MAX = 101010;

    // is_prime
    vector<int> is_prime(MAX, 1);
    is_prime[0] = 0, is_prime[1] = 0;
    for (int i = 2; i < MAX; i++) {
        if (!is_prime[i]) continue;
        for (int j = i * 2; j < MAX; j += i) is_prime[j] = 0;
    }

    int Q; cin >> Q;
    vector<int> L(Q), R(Q);
    for (int i = 0; i < Q; i++) {
        int l, r; cin >> l >> r; r++;
        L[i] = l;
        R[i] = r;
    }

    vector<int> s(100001);
    s[0] = 0;
    for (int i = 0; i < 100000; i++) {
        if (is_prime[i] && is_prime[(i + 1)/2]) s[i + 1] = s[i] + 1;
        else s[i + 1] = s[i];
    }

    for (int i = 0; i < Q; i++) {
        cout << s[R[i]] - s[L[i]] << endl;

    }
    
}


Measured memory_bytes: 2176
N=int(input())
A=list(map(int,input().split()))
Q=int(input())
S=sum(A)
dic={}
for i in A:
    if i in dic:
        dic[i]+=1
    else:
        dic[i]=1
for i in range(Q):
    B,C=map(int,input().split())
    if B in dic:
        x=dic[B]
        dic[B]=0
        if C in dic:
            dic[C]+=x
        else:
            dic[C]=x
        dif=C-B
        dif=dif*x
        S+=dif
    print(S)


Measured memory_bytes: 20916
def main():
    N = int(input())
    N_len = len(str(N))
    if N_len < 3:
        return print(0)
    from itertools import product
    ans_set = set()
    for k in range(3, min(N_len, 9)+1):
        ans_set = ans_set.union({s for s in product("753", repeat=k)
                                 if int("".join(s)) <= N and
                                 len(set(s) & set("753")) == 3})
    print(len(ans_set))


if __name__ == '__main__':
    main()


Measured memory_bytes: 51676
from math import radians, cos

A, B, H, M = map(int, input().split())

angle_h = (H + M/60) * 30
angle_m = M * 6
theta = min(abs(angle_h-angle_m), 360 - abs(angle_h-angle_m))
r2 = A**2 + B**2 - 2*A*B*cos(radians(theta))
print(r2**(1/2))

Measured memory_bytes: 9512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define ub upper_bound
#define lb lower_bound
#define all(v) ((v).begin()),((v).end())
#define allr(v) ((v).rbegin()),((v).rend())
#define ff first
#define ss second
#define mp make_pair
#define pll pair<ll,ll> 
#define fo(i,n) for(ll i=0;i<n;i++)
#define foa(i,s,e) for(ll i=(s);i<=e;i++)
#define fod(i,s,e) for(ll i= (s);i>=(e);i--)
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
#define sz(x) (ll)(x.size())
#define ANS cout<<ans<<'\n'
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define Yes cout<<"Yes\n"
#define No cout<<"No\n"
const ld pi = 3.14159265358979323846;
ll MOD = (ll)1e9 + 7;
//ll MOD = 998244353;
const char nl = '\n';
const ll inf = 1e15;
#define fill(a,b) memset(a, b, sizeof(a))
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) fo(i, n){fo(j, m)cout<<dp[i][j]<<" ";cout<<"\n";}
ll nxt(){ll x; cin >> x; return x;}
ll mul(ll x,ll y){
    return (1ll* (x%MOD)*(y%MOD));
}
ll modpow(ll x,ll y){ll z=1;while(y>0){if(y%2)z=mul(z,x);x =mul(x,x) ;y/=2;}return z;}
ll power(ll x,ll y){ll z=1;while(y>0){if(y%2)z=z*x;x =x*x ;y/=2;}return z;}
ll gcd(ll a,ll b){if(a<b) return gcd(b,a);if(b==0) return a;return gcd(b,a%b);} 
ll min(ll a,ll b){if(a<b)return a;return b;}
ll max(ll a,ll b){if(a>b)return a;return b;}
ll sq(ll a){
    ll ans = (1ll*a*a);
    return ans;
}

void solve(){
    ll n;
    cin >> n;
    ll p = modpow(10, n)%MOD;
    ll ans = p - mul(2, modpow(9,n)) + modpow(8,n);
    cout << (ans % MOD + MOD) % MOD << nl;
}
int main(){ 
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("inputf.txt" , "r" , stdin) ;
    freopen("outputf.txt" , "w" , stdout) ;
    freopen("error.txt" , "w" , stderr) ;
    #endif
    ll TC = 1;
    //cin>>TC;
    fo(TT, TC){
        // Google,FB cout << "Case #"<< TT + 1 << ": ";
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


Measured memory_bytes: 3800
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
using namespace std;

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


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

	string str = s.substr(0, s.size()-2);
	while (str.size() > 1) {
		string first = str.substr(0, str.size()/2);
		string second = str.substr(str.size()/2, str.size());
		if (first == second) {
			cout << str.size() << endl;
			return 0;
		}
 		str = str.substr(0, str.size()-2);
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<vector>
#include<cmath>
using namespace std;
inline int re_ad()
{
	int x=0,f=1;char ch=getchar();
	while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')x=x*10+(ch^48),ch=getchar();
	return x*f;
}
const long long inf=10000000010ll;
inline long long ma(long long x,long long y){return x>y?x:y;}
inline long long mi(long long x,long long y){return x<y?x:y;}
int n;
struct node{int to,cost;};
vector<node> g[140010];
node fa[140010];
int fro[140010],to[140010];
long long ans,mid;
bool fla;
int cnt,top1,top2;
struct zt
{long long l,r;
bool friend operator <(zt x,zt y){if(x.l!=y.l)return x.l<y.l;return x.r<y.r;}
bool friend operator ==(zt x,zt y){return (x.l==y.l)&&(x.r==y.r);}
}A[6000010],z1[140010],z2[140010];
inline void merge1(int x,int y,long long yx)
{
	register int i,j=fro[y]-1;
	bool fla;
	top1=0;
	if(fro[y]>to[y])return;
	for(i=fro[x];i<=to[x]&&j<to[y];++i)
	{
	fla=false;
	while(j<to[y]&&(A[i].r+A[j+1].l<=yx)){++j;fla=true;}
	if(fla)z1[++top1]=(zt){A[i].l,A[j].r};
	}
}
inline void merge2(int x,int y,long long yx)
{
	register int i,j=fro[y]-1;
	bool fla;
	top2=0;
	if(fro[y]>to[y])return;
	for(i=fro[x];i<=to[x]&&j<to[y];++i)
	{
	fla=false;
	while(j<to[y]&&(A[i].r+A[j+1].l<=yx)){++j;fla=true;}
	if(fla)z2[++top2]=(zt){A[i].l,A[j].r};
	}
}
void dfs(int x)
{//cout<<x<<endl;
	register int i,j,sz=g[x].size(),v;
	register long long yx;
	if(!sz){fro[x]=to[x]=++cnt;A[cnt]=(zt){0,0};return ;}
	
	int x1=g[x][0].to,x2=g[x][1].to,co1=g[x][0].cost,co2=g[x][1].cost;
	yx=mid-co1-co2;
	dfs(x1);dfs(x2);
	fro[x]=cnt+1;to[x]=cnt;
	merge1(x1,x2,yx);merge2(x2,x1,yx);
	
	for(i=1;i<=top1;++i)z1[i].l+=co1,z1[i].r+=co2;
	for(i=1;i<=top2;++i)z2[i].l+=co2,z2[i].r+=co1;
	if(!top1){for(i=1;i<=top2;++i)A[++cnt]=z2[i];to[x]=cnt;return;}
	if(!top2){for(i=1;i<=top1;++i)A[++cnt]=z1[i];to[x]=cnt;return;}
	i=1;j=1;
	//for(i=1;i<=n;++i)
	/*if(z1[1]<z2[1])A[++cnt]=z1[i++];
	else if(z2[1]<z1[1])A[++cnt]=z2[j++];
	else ++i,A[++cnt]=z2[j++];*/
	while(i<=top1&&j<=top2)
	{
	if(z1[i]<z2[j])A[++cnt]=z1[i++];else A[++cnt]=z2[j++];
	while(i<=top1&&A[cnt].l<=z1[i].l&&A[cnt].r<=z1[i].r)++i;
	while(j<=top2&&A[cnt].l<=z2[j].l&&A[cnt].r<=z2[j].r)++j;
	}
	if(i>top1){for(;j<=top2;++j)A[++cnt]=z2[j];}
	else {for(;i<=top1;++i)A[++cnt]=z1[i];}
	to[x]=cnt;return;
}
int main()
{
	register int i,j,x,a;
	register long long l=0,r=0;
	n=re_ad();
	for(i=2;i<=n;++i)
	{
	x=re_ad();a=re_ad();g[x].push_back((node){i,a});
	fa[i]=(node){x,a};r=r+a;
	}//cout<<52378<<endl;
	while(l<=r)
	{
	mid=l+r>>1;cnt=0;
	dfs(1);
	/*cout<<endl<<mid<<endl;
	for(i=1;i<=n;++i)
	{
	cout<<i<<" ";for(j=fro[i];j<=to[i];++j)cout<<A[j].l<<" "<<A[j].r<<"   ";cout<<endl;
	}
	cout<<endl;*/
	if(fro[1]<=to[1])ans=mid,r=mid-1;else l=mid+1;
	}
	cout<<ans<<endl;return 0;
	
	
}

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

#define int long long

using namespace std;

int b[100001];
int a[200001];
stack <int> st;
int l[200001];
int r[200001];

 main () {
    int n;
    cin >> n;
    for (int i = 1;i <= n;i ++) {
    	cin >> a[i];
    }
    for (int i = 1;i <= n;i ++) {
    	l[i] = i;
    	while (st.size () && a[st.top ()] > a[i]) {
			l[i] = l[st.top ()];
			st.pop ();
    	}
    	st.push (i);
    }
    while (st.size ()) st.pop ();
    for (int i = n;i >= 1;i --) {
    	r[i] = i;
    	while (st.size () && a[st.top ()] > a[i]) {
			r[i] = r[st.top ()];
			st.pop ();
    	}
    	st.push (i);
    }
    int ans = 0;
    for (int i = 1;i <= n;i ++) {
    	int qwe = (i - l[i] + 1) * (r[i] - i + 1);
    	ans += qwe * a[i];
    }
    cout << ans;
    return 0;
}

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

using namespace std;
using ll = long long;

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

    int n, m;
    ll k;
    cin >> n >> m >> k;
    vector<int> a(n + 1), b(m + 1);
    for(int i = 1; i <= n; ++i) cin >> a[i];
    for(int i = 1; i <= m; ++i) cin >> b[i];

    for(int i = 1; i <= n; ++i) k -= a[i];

    int ans = 0, ia = n;

    for(int ib = 0; ib <= m; ++ib) {
        while(k < 0 && ia > 0) {
            k += a[ia];
            ia--;
        }
        if(k < 0) break;
        ans = max(ans, ia + ib);
        k -= b[ib + 1];
    }

    printf("%d\n", ans);

    return 0;
}

Measured memory_bytes: 4780
#include <cstdio>
#include <iostream>
#include <cmath>
#define maxn
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
inline void read(int& x)
{	char c=getchar();x=0;int y=1;
	while(c<'0'||c>'9'){if(c=='-') y=-1;c=getchar();}
	while(c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	x*=y;
}
int n;
int main()
{  	read(n);
	int edg=sqrt(n);
	printf("%d",edg*edg);
	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict

N, M = map(int, input().split())
iPY = []
D = defaultdict(list)
E = defaultdict(int)

for i in range(M):
  P, Y = map(int, input().split())
  iPY.append((i, P, Y))

iPY.sort(key = lambda x: x[2])

for i, P, Y in iPY:
  D[P].append(Y)

for P, Ys in D.items():
  for i, Y in enumerate(Ys):
    E[Y] = "000000"+str(i+1)

iPY.sort()

for i, P, Y in iPY:
  U = "000000"+str(P)
  L = E[Y]
  print(U[-6:]+L[-6:])

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

int main() {
    long long N,A,B;
    cin >> N >> A >> B;

    if(N == 1) {
        if(A == B) cout << 1 << endl;
        else cout << 0 << endl;
    }
    if(N == 2) {
        if(A <= B) cout << 1 << endl;
        else cout << 0 << endl;
    }
    if(N > 2) {
        if(A <= B) cout << (N - 2) * (B - A) + 1 << endl;
        else cout << 0 << endl; 
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b, h, m;
  cin >> a >> b >> h >> m;
  double s = 2*M_PI/12*h+2*M_PI/12/60*m;
  double l = 2*M_PI/60*m;
  if (s > l) swap(s, l);
  double d = min(abs(l-s), abs(s+2*M_PI-l));
  cout << fixed << setprecision(11) << sqrt(a*a+b*b-2*a*b*cos(d)) << endl;
  return 0;
}

Measured memory_bytes: 4240
#include <iostream>
#include <string>
using namespace std;
int main(){
    int n;
    cin >> n;
    int tar = 0, han = 0;
    for (int i = 0; i < n; i++){
        string taro, hanako;
        cin >> taro >> hanako;
        if (taro > hanako){
            tar += 3;
        }
        if (taro < hanako){
            han += 3;
        }
        if (taro == hanako){
            tar += 1;
            han += 1;
        }
    }
    cout << tar << " " << han << endl;
}


Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) begin(a),end(a)
#define MS(m,v) memset(m,v,sizeof(m))
#define D10  fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> P;
typedef long long ll;
const ll INF = 114514810;
const ll MOD = 1000000007;
const double EPS = 1e-8;
const double PI = acos(-1.0);
struct edge
{
	int from, to, cost;
	bool operator < (const edge& e) const { return cost < e.cost; }
	bool operator >(const edge& e) const { return cost > e.cost; }
};
int dx[] = { -1, 0, 0, 1 }; int dy[] = { 0, -1, 1, 0 };
bool valid(int x, int y, int h, int w) { return (x >= 0 && y >= 0 && x < h&&y < w); }
///*************************************************************************************///
///*************************************************************************************///
///*************************************************************************************///

struct union_find
{
	vector<int> par;
	union_find(int n) :par(n, -1) {}
	int find(int x) { return par[x] < 0 ? x : par[x] = find(par[x]); }
	void unite(int x, int y)
	{
		x = find(x); y = find(y);
		if (x == y) return;
		if (par[y] < par[x]) swap(x, y);
		if (par[x] == par[y]) par[x]--;
		par[y] = x;
		if (find(x) != find(y)) par[find(y)] = x;
	}
	int count()
	{
		int cnt = 0;
		REP(i, par.size()) if (par[i] < 0) cnt++;
		return cnt;
	}
};

int main()
{
	int n, q;
	cin >> n >> q;
	union_find uf(n);
	while (q--)
	{
		int c, x, y;
		cin >> c >> x >> y;
		if (c) puts(uf.find(x) == uf.find(y) ? "1" : "0");
		else uf.unite(x, y);
	}
}

/*
int main()
{
	int h, w;
	while (cin >> h >> w, h)
	{
		union_find uft(h*w);
		vs fld(h);
		REP(i, h) cin >> fld[i];
		REP(i, h)REP(j, w)
		{
			REP(k, 4)
			{
				int nx = i + dx[k];
				int ny = j + dy[k];
				if (valid(nx, ny, h, w) && fld[i][j] == fld[nx][ny])
				{
					uft.unite(i*h + j, nx*h + ny);
				}
			}
		}
		cout << uft.count() << endl;
	}
	return 0;
}
*/

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

int main() {
	string temp;
	cin >> temp;
	for (int i = 0; i < temp.size(); ++i) {
		if (temp[i] <= 'Z' && temp[i] >= 'A') {
			temp[i] += 'a' - 'A';
		}
	}

	string str;
	int cnt = 0;
	while (cin >> str && str != "END_OF_TEXT") {
		for (int i = 0; i < str.size(); ++i) {
			if (str[i] <= 'Z' && str[i] >= 'A') {
				str[i] += 'a' - 'A';
			}
		}
		if (str == temp) {
			cnt++;
		}
	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 3172
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define INF 1000000007
//S.size()

using namespace std;


typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<bool> VB;
typedef unsigned long long ll;

int ctoi(char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}

int main(void){
  int N ,A,B;cin>>N>>A>>B;
  int wa = 0,cnt = 0;
  string num ;
  int ans = 0;

  for(int i = 1;i <= N;i++){
    wa = 0;
    num = to_string(i);
    if(num.size() == 5){

      wa += (ctoi(num[0]) + ctoi(num[1]) + ctoi(num[2]) +ctoi(num[3])
                + ctoi(num[4]));
      if(wa >= A && wa <= B)ans += i;

    }
    else if(num.size() == 4){

      wa += (ctoi(num[0]) + ctoi(num[1]) + ctoi(num[2]) +ctoi(num[3]));
      if(wa >= A && wa <= B)ans += i;

    }
    else if(num.size() == 3){

      wa += (ctoi(num[0]) + ctoi(num[1]) + ctoi(num[2]) );
      if(wa >= A && wa <= B)ans += i;

    }
    else if(num.size() == 2){

      wa += (ctoi(num[0]) + ctoi(num[1]) );
      if(wa >= A && wa <= B)ans += i;

    }
    else if(num.size() == 1){

      wa += (ctoi(num[0]) );
      if(wa >= A && wa <= B)ans += i;

    }

  }
  cout<<ans;
}


Measured memory_bytes: 256
eval"N,K,S,T,*A="+`dd`.split*?,
A.select!{1>~_1&S|_1&~T}
c=[1]*-~N
c.map{$*<<c[K]-1
t=0
c.map!{t+t=_1}}
p (S..T).sum{|u|~u&S|u&~T<1?A.map{_1&u}.tally.sum{$*[_2]}*(1-('%b'.%u-S).count(?1)%2*2):0}

Measured memory_bytes: 14560
#pragma region kyomukyomupurin

/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-05-01 15:07:58
 **/

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

using int64 = long long;

template <class T>
using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int flag = 0;
  for (auto e : vec) os << (flag++ ? ", " : "{") << e;
  return os << (vec.empty() ? "{}" : "}");
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& st) {
  int flag = 0;
  for (auto e : st) os << (flag++ ? ", " : "{") << e;
  return os << (st.empty() ? "{}" : "}");
}

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) {
  int flag = 0;
  for (auto e : mp) os << (flag++ ? ", " : "{") << e;
  return os << (mp.empty() ? "{}" : "}");
}

template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& e : vec) is >> e;
  return is;
}

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

#pragma endregion kyomukyomupurin

class Combination {
 public:
  static constexpr int mod_ = 1000000007;
  static constexpr int n_ = 2000 + 5;

  Combination() { build(); }

  std::array<int64, n_> fact_;
  std::array<int64, n_> inv_;
  std::array<int64, n_> finv_;

  // return nCk
  int64 get(int n, int k) const noexcept {
    if (n < k || n < 0 || k < 0) return 0;
    return fact_[n] * (finv_[k] * finv_[n - k] % mod_) % mod_;
  }

 private:
  void build() noexcept {
    fact_[0] = 1;
    fact_[1] = 1;
    finv_[0] = 1;
    finv_[1] = 1;
    inv_[1] = 1;
    for (int i = 2; i < n_; ++i) {
      fact_[i] = fact_[i - 1] * i % mod_;
      inv_[i] = mod_ - inv_[mod_ % i] * (mod_ / i) % mod_;
      finv_[i] = finv_[i - 1] * inv_[i] % mod_;
    }
  }
};

Combination kyomu;

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

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

  // k * (k - 1) * ... * (k - n + 1)
  // k! / (k - n)!
  if (k - n < 0) {
    cout << 0 << endl;
  } else {
    cout << kyomu.fact_[k] * kyomu.finv_[k - n] % kyomu.mod_ << endl;
  }

  return 0;
}


Measured memory_bytes: 3256
open Batteries
module EnumL = Enum.Labels
module ListL = List.Labels
module ArrayL = Array.Labels

let dbg0 x = Printf.eprintf "[debug]%s\n" @@ dump x
let dbg1 x = dbg0 x; x

let id = identity

let (++) n m = if n <= m then  List.range n `To m else []
let (++-) n m = if n >= m then List.range n `Downto m else []
let (++^) n m = if n < m then List.range n `To (pred m) else []

module ModOp = struct
  let prime = 1_000_000_007
  let (-) a b = (a + prime - b) mod prime
  let (+) a b = (a + b) mod prime
  let ( * ) a b = (a * b) mod prime

  let rec pow x n =
    if n = 0 then 1
    else if n mod 2 = 0 then pow (x*x) (n/2)
    else x * pow (x*x) (n/2)
end

let scan fmt = Scanf.sscanf (read_line ()) fmt

let scan_lines n fmt f =
  if n = 0 then []
  else List.map (fun _ -> scan fmt f) (1 ++ n)

let scan_list ?sep cnv =
  let line = read_line () in
  (match sep with
   | None -> List.map String.of_char @@ String.to_list line
   | Some sep -> String.split_on_char sep line)
  |> List.map cnv

let scan_array ?sep cnv = Array.of_list @@ scan_list ?sep cnv

let scan_matrix n m e ?sep conv =
  let arr = Array.make_matrix n m e in
  ListL.iter (0 ++^ n)
    ~f:(fun i -> arr.(i) <- Array.of_list @@ scan_list ?sep conv);
  arr

let atoi c = Char.code c - Char.code '0'
let itoa n = Char.chr (n + Char.code '0')

let rec powerset = function
  | [] -> [[]]
  | hd::tl ->
    let pws =  powerset tl in
    pws @ ListL.map pws ~f:(fun pw -> hd::pw)

let permutations l =
  let rec interleave x = function
    | [] -> [[x]]
    | (hd::tl) as l ->
      (x::l) :: (interleave x tl |> ListL.map ~f:(fun l -> hd::l)) in
  let rec aux = function
    | [] -> [[]]
    | a::rest ->
      aux rest |> ListL.map ~f:(interleave a) |> List.concat in
  aux l

let intersection l =
  EnumL.filter ~f:(fun x -> EnumL.exists ~f:((=) x) @@ Enum.clone l)

let zip l m =
  let n = min (List.length l) (List.length m) in
  List.combine (List.take n l) (List.take n m)

let lower_bound n f =
  let rec aux l u =
    if u - l > 1 then
      let m = (l + u) / 2 in
      if f m then aux l m
      else aux m u
    else u in aux (-1) n

let between n x m = n <= x && x < m

let n = scan "%Ld" id

let () =
  let s = "zabcdefghijklmnopqrstuvwxy" in
  let rec aux n acc =
    if Int64.equal n 0L then String.of_list acc
    else
      let i = Int64.to_int @@ Int64.modulo n 26L in
      if i = 0 then
        aux (Int64.pred (Int64.div n 26L))
          (String.get s i::acc)
      else
        aux (Int64.div n 26L)
          (String.get s i::acc)
  in
  Printf.printf "%s\n" @@ aux n []


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

int a,b,c;
int cnt1=0,cnt2=0;
int num[100][100];

int main (){
    int n;
    string str;
    map<string,int>mp;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>str;
        mp[str]++;
    }
    int m;
    cin>>m;
    for(int i=0;i<m;i++){
        cin>>str;
        mp[str]--;
    }
    int ans=0;
    for(auto i=mp.begin();i!=mp.end();i++) ans=max(ans,(*i).second);
    cout<<ans<<endl;
    return 0;
}


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

#define ll          long long
#define pb          push_back
#define endl        '\n'
#define mii         map<ll,ll>
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define INF         (1ll<<60)
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
const int N=100005;
void solve(){
    ll n,x;
    cin>>n;
    mii m;
    vi v(n);
    rep(i,0,n-1){
        cin>>x;
        v[i]=x;
        m[x]++;
    }
    ll ans=0;
    for(auto i:m){
        ans+=(i.S*(i.S-1))/2;
    }
    ll temp;
    rep(i,0,n-1){
        x=m[v[i]];
        temp=ans-(x*(x-1))/2;
        if(x) temp+=((x-1)*(x-2))/2;
        cout<<temp<<endl;
    }
}
signed main()
{
    ios
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        solve();
    }
    time
    return 0;
}

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

int main()
{
    int n, x, num, j;
    j = 0;
    num = 0;
    cin >> n >> x;
    int a[110] = {};
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a, a + n);
    for (j = 0; j < n; j++)
    {
        x -= a[j];
        if (x == 0)
        {
            cout << j + 1 << endl;
            break;
        }
        else if (x <= 0)
        {
            cout << j << endl;
            break;
        }
        else if (j == n - 1 && x > 0)
        {
            cout << j << endl;
        }
    }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int A[51][51], B[51][51];
int d[51][2510];
typedef pair<int, int> P;
typedef pair<int, P> PP;
vector<int> G[51];
int N, M, S;
int C[110], D[110];
void dijkstra(int s) {
    priority_queue<PP, vector<PP>, greater<PP>> que;
    rep(i, 51) rep(j, 2510) d[i][j] = INF2;
    que.push({0, {s, S}});
    while(que.size()) {
        PP p = que.top(); que.pop();
        int tmp_d = p.first;
        int u = p.second.first;
        int medal = p.second.second;
        if(d[u][medal] < tmp_d) continue;
        for(auto to: G[u]) {
            int nxt_medal = medal - A[u][to];
            if (nxt_medal < 0) continue;
            int nx_d = tmp_d + B[u][to];
            if(nx_d < d[to][nxt_medal]) {
                d[to][nxt_medal]  = nx_d;
                que.push({nx_d, {to, nxt_medal}});
            }
        }
        if(medal >= 2500) continue;
        int nxt_medal = min(2500LL, medal + C[u]);
        int nx_d = tmp_d + D[u];
        if(d[u][nxt_medal] > nx_d) {
            d[u][nxt_medal]  = nx_d;
            que.push({nx_d, {u, nxt_medal}});
        }
    }
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> M >> S;
    S = min(2500LL, S);
    rep(i, M) {
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        u--; v--;
        G[u].push_back(v);
        G[v].push_back(u);
        A[u][v] = A[v][u] = a;
        B[u][v] = B[v][u] = b;
    }
    rep(i, N) cin >> C[i] >> D[i];
    dijkstra(0);
    // rep(i, N) {
    //     rep(j, 50 * N) {
    //         cout << d[i][j] << " ";
    //     } 
    //     cout << endl;
    // }
    REP(i, 1, N - 1) {
        int tmp = INF2;
        rep(j, 2501) tmp = min(tmp, d[i][j]);
        cout << tmp << endl;
    }

    return 0;
}


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

if (b - a) % 2 == 0:
	print((b - a) // 2)
elif (b - a) % 2 == 1:
	na = n - a
	nb = n - b
	a1 = a - 1
	b1 = b - 1
	if na + nb <= a1 + b1:
		print((na + nb + 1) // 2)
	else:
		print((a1 + b1 + 1) // 2)

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

using namespace std;

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

    int a, b;
    cin >> a >> b;
    if (a > 9 || b > 9) {
        cout << "-1\n";
    } else {
        cout << a * b << '\n';
    }

    return 0;
}

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

using namespace std;

int main(){
    int n;
    int K;
    scanf("%d %d", &n, &K);

    vector<int> v(n);
    for(int i = 0; i < n; i++){
        int h;
        scanf("%d", &h);
        v[i] = h;
    }
    sort(v.begin(), v.end());

    // for(int i = 0; i < n; i++){
    //     printf("%d ", v[i]);
    // }
    int min_diff;
    min_diff = v[K - 1] - v[0];
    for(int i = 0; i <= n - K; i++){
        int tmp;
        tmp = v[K - 1 + i] - v[i];
        if(min_diff > tmp){
            min_diff = tmp;
        }
    }

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

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

int main(){
    
    vector<int> vec(3);
    for(int i = 0;i < 3;i++){
        cin >> vec.at(i);
    }
    sort(vec.begin(), vec.end());
    cout << vec.at(0) + vec.at(1);
    
}

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



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i,0,a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)
#define trav(a, x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9 + 7; // 998244353; // = (119<<23)+1
const int MX = 2e5 + 5;

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

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

mt19937 rng((uint32_t) chrono::steady_clock::now().time_since_epoch().count());


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template<typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template<typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
    for (T &element: vec) {
        is >> element;
    }
    return is;
}

template<typename T, typename U>
std::istream &operator>>(std::istream &is, std::pair<T, U> &p) {
    is >> p.first;
    is >> p.second;
    return is;
}

template<class X, class Y>
std::ostream &operator<<(std::ostream &os, std::pair<X, Y> const &p) {
    return os << p.first << " " << p.second;
}

template<class Ch, class Tr, class Container>
std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, Container const &x) {
    bool first = true;
    for (auto &y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class BNotFound {
public:
    void solve(std::istream &in, std::ostream &out) {
        string str;
        in >> str;
        string res = "None";
        unordered_set<char> S(all(str));
        FOR(i, 'a', 'z' + 1) {
            if (not S.count(i)) {
                res = i;
                break;
            }
        }
        out << res << '\n';
    }

    void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
    BNotFound solver;
    solver.setup();
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 4180
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <utility>
#include <string>
#include <stack>
#include <regex>

#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

int main()
{
  int d, n;
  cin >> d >> n;
  int res;
  if (d == 0)
  {
    if (n == 100)
    {
      res = 101;
    }
    else
    {
      res = n;
    }
  }
  else if (d == 1)
  {
    if (n == 100)
    {
      res = 100 * 101;
    }
    else
    {
      res = 100 * n;
    }
  }
  else if (d == 2)
  {
    if (n == 100)
    {
      res = 10000 * 101;
    }
    else
    {
      res = 10000 * n;
    }
  }
  cout << res << endl;
  return 0;
}

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

int main() {
  int n;
  cin >> n;
  int h[n];
  string ans="Yes";
  rep(i,n)
  cin >> h[i];
  for(int i=1;i<n;i++){
    if(h[i]-1>=h[i-1])
    h[i]--;
    if(h[i]<h[i-1])
    ans="No";
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		String[] s = readLine().split(" ");
		int a = Integer.parseInt(s[0]);
		int b = Integer.parseInt(s[1]);
		if(b%a==0){
			System.out.println(a+b);
		}else{
			System.out.println(b-a);
		}
		return;
	}

	private static String readLine(){
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		try{
			return reader.readLine();
		}catch(Exception e){
			return e.getMessage();
		}
	}
}


Measured memory_bytes: 20692
package main

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

func main() {
	strN := nextString()
	n, _ := strconv.Atoi(strN)
	var sum int
	for i := 0; i < len(strN); i++ {
		tmp, _ := strconv.Atoi(strN[i : i+1])
		sum += tmp
	}
	if n%sum == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

}

var nextReader func() string

func init() {
	nextReader = NewScanner()
}

func NewScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}
func nextString() string {
	return nextReader()
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(nextReader(), 64)
	return f
}

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

int n,a[100005];
int ef(int x){
	int i=0,j=n-1,m;
	while(i<=j){
		m=(i+j)/2;
		if(x>a[m])
			i=m+1;
		else if(x<a[m])
			j=m-1;
		else
			return 1;
	}
	return 0;
}
int main(){
	int b,q,ans=0;
	cin>>n;
	for(int i=0;i<n;i++)
		scanf("%d",&a[i]);
	cin>>q;
	for(int i=0;i<q;i++){
		scanf("%d",&b);
		if(ef(b))
			ans++;
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 3516
N = gets.chomp.to_i
A = gets.chomp.split().map(&:to_i)
A.unshift(0)
A.push(0)

sum_fee = 0
1.upto(N+1) do |n|
  sum_fee += (A[n-1] - A[n]).abs
end

1.upto(N) do |n|
  droped_fee = sum_fee
  droped_fee = droped_fee - (A[n-1] - A[n]).abs - (A[n] - A[n+1]).abs + (A[n-1] - A[n+1]).abs
  puts droped_fee
end


Measured memory_bytes: 22084
#l=list(map(int, input().split()))
a,b=map(int, input().split())
#l=list(map(int, input().split()))
#n = int(input())
def divisor(n): #nの約数を全て求める
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table
def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1



ans = 1
temp1 = divisor(a)
temp2 = divisor(b)
hoge = []
if len(temp1) < len(temp2):
    hoge = temp1
    hoge2 = temp2
else:
    hoge = temp2
    hoge2 = temp1

temp = []
for i in hoge:
    if i in hoge2:
        temp.append(i)

#print (temp)
for i in temp:
    if is_prime(i):
        ans += 1

print (ans)



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

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var n = int.Parse(Console.ReadLine());
			Console.WriteLine((1 + n) * n / 2);
		}
	}
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
#include <iostream>
#include <numeric>
#include <math.h>
#define ll long long 
#define ull long
#define mpa make_pair
#define pb push_back
#define ff first
#define pii pair<ll,ll>
#define dd long long
#define trace(x) cerr << #x << " : " << x << endl
#define ss second
#define boost ios_base::sync_with_stdio(0)
#define forp(i,a,b) for(ll i=a;i<=b;i++)
#define rep(i,n)    for(ll i=0;i<n;++i)
#define ren(i,n)    for(ll i=n-1;i>=0;i--)
#define forn(i,a,b) for(ll i=a;i>=b;i--)
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end();
#define sc(x) scanf("%lld",&x)
#define clr(x,val) memset(x,val,sizeof(x))
#define pr(x) printf("%lld\n",x) 
#define gc getchar
#define pdd pair<dd,dd>
#define prec(x) cout<<fixed<<setprecision(x)
#define fre freopen("input.txt","r",stdin),freopen("output.txt","w",stdout)
using namespace std;
ll a[200005];
ll suff[200005];
int main(){
	ll n,m;
	ll mod=1e9+7;
	ll ans=0;
	cin>>n;
	for(ll i=1;i<=n;i++)cin>>a[i];
	for(ll i=n;i>=1;i--)suff[i]=(suff[i+1]+a[i])%mod;;
	
	for(ll i=1;i<=n;i++){
	   ans=ans+(a[i]*suff[i+1])%mod;
	   ans%=mod;
	}
	cout<<ans;
}
  
  
  
   


    

Measured memory_bytes: 6716
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
#define PI 3.1415926535897932384626433832795028
#define INF (1<<29)
#define LINF (1LL<<60)
using namespace std;
using INT = long long;
using P = pair<int,int> ;

int main(){
    int n,k;
    cin >> n >> k;
    vector<vector<int>> K;
    K.resize(k);
    vector<int> cnt(n+1,0);
    int ans=0;
    cnt[0]=1;
    rep(i,k){
        int d;
        cin >> d;
        rep(j,d){
            int a;
            cin >> a;
            K[i].emplace_back(a);
        }
    }
    rep(i,k){
        rep(j,K[i].size()){
            cnt[K[i][j]]++;
        }
    }
    rep(i,n+1){
        if(cnt[i]==0) ans++;
    }
    cout << ans << endl;
	return 0;
}



Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <algorithm>
#include <set>
#include <string>
#include <queue>

using namespace std;

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

int main(){
    int N, C;
    cin >> N >> C;
    vector<vector<int>> cnts(3, vector<int>(C));
    vector<vector<int>> ds(C, vector<int>(C));
    rep(i, C){
        rep(j, C){
            cin >> ds[i][j];
        }
    }

    rep(i, N){
        rep(j, N){
            int clr;
            cin >> clr;
            clr --;
            cnts[(i + j) % 3][clr] ++;
        }
    }

    ll ans = 1e18;

    vector<int> clrs(3);

    rep(i, C) {
        rep(j, C) {
            rep(k, C) {
                if (i == j || j == k || i == k) {
                    continue;
                }
                clrs[0] = i;
                clrs[1] = j;
                clrs[2] = k;
                ll tmp = 0;
                rep(m, clrs.size()) {
                    rep(l, C) {
                        tmp += ds[l][clrs[m]] * cnts[m][l];
                    }
                }
                ans = min(tmp, ans);
            }
        }
    }
    cout << ans << endl;

    return 0;
}


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

const int mod = 1e9 + 7;

long long inv(long long x){
  long long m = mod, u = 1, v = 0;
  while(m){
    long long t = x / m;
    x -= t * m; std::swap(x, m);
    u -= t * v; std::swap(u, v);
  }
  u %= mod;
  if(u < 0) u += mod;
  return u;
}

int main(){
  int N, M;
  scanf("%d%d", &N, &M);
  int K;
  scanf("%d", &K);
  
  long long fact[N * M + 1];
  fact[0] = 1;
  for(int i = 1; i <= N * M; i++){
    fact[i] = fact[i - 1] * i % mod;
  }
  
  long long all_costs = 0;
  
  for(long long dx = 1; dx < N; dx++){
    long long cost = dx * M * M * (N - dx) % mod * (fact[N * M - 2] * inv(fact[K - 2] * fact[N * M - K] % mod) % mod) % mod;
    all_costs += cost;
    all_costs %= mod;
  }
  
  for(long long dy = 1; dy < M; dy++){
    long long cost = dy * N * N * (M - dy) % mod * (fact[N * M - 2] * inv(fact[K - 2] * fact[N * M - K] % mod) % mod) % mod;
    all_costs += cost;
    all_costs %= mod;
  }
  
  printf("%lld\n", all_costs);
  
  return 0;
}

Measured memory_bytes: 1664
import math

N = int(input())

divisor=[]
for i in range(1, math.floor(math.sqrt(N))+1):
    if N % i == 0:
        divisor.append(i)
#print(divisor)

M=max(divisor)
left=len(str(M))
right=len(str(N//M))
print(max(left, right))

Measured memory_bytes: 3060
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
      
      //入力
      int N =sc.nextInt();//文字列の長さ
      String S =sc.next();//文字列  
      char[] T =S.toCharArray();
      int count = 0;
      
      //いくつABCが含まれているか
   	  for(int i =0; i<N-2; i++){
        if(T[i] =='A' && T[i+1] =='B' && T[i+2] =='C'){
       	  	count++;
        }	
      }
       //出力
      	System.out.println(count); 
    }
}

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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q>
ostream& operator << (ostream& os, pair<P, Q> p)
{
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

int main(int argc, char *argv[])
{
  string s;
  while (cin >> s) {
    pair<int, int> p = make_pair(-1, -1);
    if (s.size() == 2) {
      if (s[0] == s[1]) cout << 1 << ' ' << 2 << endl;
      else cout << -1 << ' ' << -1 << endl;
      continue;
    }
    for (int i = 0; i + 2 < s.size(); ++i) {
      set<char> t;
      t.insert(s[i]);
      t.insert(s[i + 1]);
      t.insert(s[i + 2]);
      if (t.size() <= 2) {
        p = make_pair(i + 1, i + 3);
      }
    }
    cout << p.first << ' ' << p.second << endl;
  }
  return 0;
}


Measured memory_bytes: 512
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():

    a,b=map(int,input().split())
    s=str(input())

    for i in range(len(s)):
        if i==a:
            if s[i]!='-':
                print('No')
                break
        elif i!=len(s)-1:
            try:
                int(s[i])
            except:
                print('No')
                break
        else:
            print('Yes')



resolve()

Measured memory_bytes: 3060
#include<stdio.h>
int main()
{
    double r,area,circum;
    scanf("%lf",&r);
    area = 3.141592653589*r*r;
    circum = 2*3.141592653589*r;
    printf("%.6lf %.6lf\n",area,circum);
    return 0;
}


Measured memory_bytes: 2120