akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
typedef long long ll;
using namespace std;

int N;
int a[100];
int sum;
int temp;

signed main()
{
	cin >> N;
	rep(i,N) {
		cin >> a[i];
		sum += a[i];
	}
	temp = round(1.0 * sum / N);

	sum = 0;
	rep(i,N) {
		sum += pow(a[i] - temp, 2);
	}

	cout << sum << endl;
}


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

using namespace std;

int main(void){
int N, T, A, ans = 1;
int *H;
cin >> N;
cin >> T >> A;
H = new int[N];

for(int i = 0; i < N; i++){
    cin >> H[i];
}

for(int i = 1; i < N; i++){
    double temp = A - (T - H[ans - 1] * 0.006);
    double temp2 = A - (T - H[i] * 0.006);
    if(abs(temp) > abs(temp2)){
        ans = i + 1;
    }
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
int main(){
    double l;
    cin >>l;
    double m=l/3;
    double s;
    s=m*m*m;
   printf("%10.7f",s);
}

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

int main() {
    int n, m, sum = 0;
    cin >> n >> m;
    vector<int> a(n);
    rep(i, n) {
        cin >> a.at(i);
        sum += a.at(i);
        a.at(i) *= 4 * m;
    }
    int cnt = 0;
    rep(i, n) {
        if(a.at(i) >= sum) cnt++;
    }
    if(cnt >= m) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

int main() {
	char a, b; scanf("%c %c", &a, &b);
	
	if(a < b) printf("<\n");
	else if(a > b) printf(">\n");
	else printf("=\n");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<n; i++)
#define pb push_back
#define int long long
 
int a, b, c;

signed main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> a >> b >> c;
    cout << a*b/2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    bool a = false, b = false;
    rep(i, s.size()) {
        if (s[i] == 'A') a = true;
        if (s[i] == 'B') b = true;
    }
    (a && b) ? puts("Yes") : puts("No");
    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++) 
  bool hantei[9];
int main() {
  vector<vector<int>>card(3,vector<int>(3));
  rep(i,3){
    rep(j,3){
      cin>>card.at(i).at(j);
    }
  }
  int N;
  cin>>N;
  vector<int>kazu(N);
  rep(i,N){
    cin>>kazu.at(i);
  }

  rep(i,N){
    if(kazu.at(i)==card.at(0).at(0))hantei[0]=true;
    if(kazu.at(i)==card.at(0).at(1))hantei[1]=true;
    if(kazu.at(i)==card.at(0).at(2))hantei[2]=true;
    if(kazu.at(i)==card.at(1).at(0))hantei[3]=true;
    if(kazu.at(i)==card.at(1).at(1))hantei[4]=true;
    if(kazu.at(i)==card.at(1).at(2))hantei[5]=true;
    if(kazu.at(i)==card.at(2).at(0))hantei[6]=true;
    if(kazu.at(i)==card.at(2).at(1))hantei[7]=true;
    if(kazu.at(i)==card.at(2).at(2))hantei[8]=true;
  }
  if(hantei[0]==true&&hantei[1]==true){
    if(hantei[2]==true){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  if(hantei[3]==true&&hantei[4]==true){
    if(hantei[5]==true){
      cout<<"Yes"<<endl;
      return 0;
    }
  }  
  if(hantei[6]==true&&hantei[7]==true){
    if(hantei[8]==true){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  if(hantei[0]==true&&hantei[3]==true){
    if(hantei[6]==true){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  if(hantei[1]==true&&hantei[4]==true){
    if(hantei[7]==true){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  if(hantei[2]==true&&hantei[5]==true){
    if(hantei[8]==true){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  if(hantei[0]==true&&hantei[4]==true){
    if(hantei[8]==true){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  if(hantei[6]==true&&hantei[4]==true){
    if(hantei[2]==true){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int a[26] = {0};
    char c;
    int i;
    while((scanf("%c", &c)) != EOF){
        if('A' <= c && c <= 'Z'){
            a[c-65]++;
        }
        if('a' <= c && c <= 'z'){
            a[c-97]++;
        }
    }
    for(i = 0, c = 'a'; i < 26; i++,c++){
        printf("%c : %d\n",c, a[i]);            
    }
    return 0;
}


Measured memory_bytes: 2044
#include <iostream>
#include <vector>
#include <cstring>
#define N 8000
using namespace std;
string s;
int x[2], z, c;
bool d[4005][16005];
vector<int> vt[2];

bool f(int p) {
	int i, j, k;
	memset(d, 0, sizeof(d));
	d[0][vt[p][0]+N] = 1;
	for(i=1; i<vt[p].size(); i++) {
		k = vt[p][i];
		for(j=0; j<=2*N; j++) {
			if(j>=k && d[i-1][j-k]) d[i][j] = 1;
			if(j+k<=2*N && d[i-1][j+k]) d[i][j] = 1;
		}
	}
	return d[i-1][x[p]+N];
}

int main() {
	vt[1].push_back(0);
	cin>>s>>x[0]>>x[1];
	for(int i=0; s[i]; i++) {
		if(s[i]=='F') c++;
		else {
			vt[z].push_back(c);
			z = !z;
			c = 0;
		}
	}
	vt[z].push_back(c);
	cout<<(f(0)&&f(1) ? "Yes":"No");
	return 0;
}

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

using namespace std;

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

  int n;
  cin >> n;
  long long ans = 0;
  int x = 0;
  for (int i = 0; i < n; ++i) {
    int y;
    cin >> y;
    ans += max(0, x - y);
    x = max(x, y);
  }
  cout << ans;

  return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <map>
using namespace std;
typedef long long ll;
class UnionFind{
private:
    vector<int> p,s;
public:
	UnionFind(){}
	UnionFind(int N){
		p = s = vector<int>(N+1,0);
		for(int i=1;i<=N;i++){
			p[i] = i; s[i] = 1;
		}
	}
	int find(int x){
		if(p[x]==x) return x;
		else return p[x] = find(p[x]);
	}
	void unite(int x,int y){
		x = find(x); y = find(y);
		if(x==y) return;
		if(s[x]>s[y]){
			p[y] = x;
			s[x] += s[y];
		}else{
			p[x] = y;
			s[y] += s[x];
		}
	}
	bool is_same_set(int x,int y) {return find(x)==find(y);}
	ll size(int x) {return s[find(x)];}
};

int N,M,A[100010],B[100010];
ll ans[100010] = {};
int main(){
    cin >> N >> M;
    UnionFind uf(N);
    for(int i=1;i<=M;i++){
        cin >> A[i] >> B[i];
    }
    ll now = (ll)N*(N-1)/2;
    for(int i=M;i>=1;i--){
        ans[i] = now;
        if(!uf.is_same_set(A[i],B[i])){
            now -= uf.size(A[i])*uf.size(B[i]);
            uf.unite(A[i],B[i]);
        }
    }
    for(int i=1;i<=M;i++) cout << ans[i] << endl;
}

Measured memory_bytes: 3712
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main(){
  string st;cin>>st;
  ll N = st.size();
  vector<ll> c(N);
  // 前処理
  rep(i,N){
    ll d = st[i] - '0';
    c[i] = d * modpow(10,N-i-1,2019);
    c[i] %= 2019;
    // cout<<c[i]<<endl;
  }
  vector<ll> t(N);
  t[0] = c[N - 1];
  repn(i,N-1){
    t[i] = t[i - 1] + c[N - i - 1];
    t[i] %= 2019;
    // cout<<t[i]<<endl;
  }

  ll ans = 0;
  ll tmp = 0;
  map<ll,ll> m;
  m[0]++;
  for(ll i = N-1 ; i >= 0; i--){
    if(m[t[i]]){
      ans += m[t[i]];
    }
    m[t[i]]++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 6832
#include <iostream>
#include <string>

using namespace std;

int main(){
	string buf;
	//left = 0, right = 1
	int table[] = {0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0}, state, c;
	while(cin >> buf){
		c = 0;
		if(buf[0] == '#') break;
		state = table[buf[0] - 'a'];
		for(int i = 1;i < buf.length();++i){
			if(state != table[buf[i] - 'a']){
				state = table[buf[i] - 'a'];
				++c;
			}
		}
		cout << c << endl;
	}
	return 0;
}

Measured memory_bytes: 1180
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bits/stdc++.h>
using namespace std;
int ok=0;
long long lt[100551]= {0};
int main() {
	long long k,maxx=2,minn=2;
	scanf("%lld",&k);
	for(int i=0; i<k; i++) {
		scanf("%lld",&lt[i]);
	}
	for(int i=k-1; i>=0; i--) {
		minn=ceil((double)minn/lt[i])*lt[i];
		maxx=floor((double)maxx/lt[i])*lt[i]+lt[i]-1;
	}
	long long a=minn,b=maxx;
	for(int i=0; i<k; i++) {
		a=a-a%lt[i];
		b=b-b%lt[i];
	}
	if(a==2&&b==2)
		cout<<minn<<' '<<maxx<<endl;
	else puts("-1");
	return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int N;
        public long[] A1, A2;
        public long MOD = 1000000007;

        public void Run()
        {
            N = Input.ReadInt();
            A1 = Input.ReadLongArray();
            A2 = Input.ReadLongArray();

            bool[] F = new bool[N];
            long[] L = new long[N];

            // 矛盾が無い場合
            for (int i = 0; i < N; i++)
            {
                if (i == 0 || A1[i - 1] != A1[i])
                {
                    F[i] = true;
                    if (A2[i] < A1[i])
                    {
                        Console.WriteLine(0);
                        return;
                    }
                }
            }

            for (int i = N - 1; i >= 0; i--)
            {
                if (i == N - 1 || A2[i + 1] != A2[i])
                {
                    F[i] = true;
                    if (A1[i] < A2[i])
                    {
                        Console.WriteLine(0);
                        return;
                    }
                }
            }

            for (int i = 0; i < N; i++)
            {
                L[i] = Math.Min(A1[i], A2[i]);

                if (F[i]) L[i] = 1;
            }

            long ret = 1;
            for (int i = 0; i < N; i++)
            {
                ret *= L[i];
                ret %= MOD;
            }

            Console.WriteLine(ret);
        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 37652
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
	int n;scanf("%d",&n);
	int s=1;
	while(s<n)s<<=1;
	if(s==n){
		printf("No\n");
		return 0;
	}
	printf("Yes\n");
	for(int i=1;i<=2;i++)
		printf("%d %d\n",i,i+1);
	printf("3 %d\n",n+1);
	for(int i=1;i<=2;i++)
		printf("%d %d\n",n+i,n+i+1);
	for(int i=4;i<n;i+=2)
	{
		printf("1 %d\n",i);
		printf("1 %d\n",i+1);
		printf("%d %d\n",i,i+n+1);
		printf("%d %d\n",i+1,i+n);
	}
	if(n%2==0){
		for(int i=2;i<n;i++)
		{
			if(i==3)continue;
			int x=n^i^1;
			if(x>=n||x==3)continue;
			printf("%d %d\n",n,x);
			printf("%d %d\n",n*2,i);
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 2304
n,k = gets.split.map(&:to_i)
w = []
n.times{
  ii = gets.to_i
  w.push(ii)
}

def num(w,k,p)
  i = 0
  for j in 0..k-1
    s = 0
    while s + w[i] <= p
      s += w[i]
      i += 1
      return i if i == w.length
    end
  end
  return i
end

def binary(w,k)
  left = 0
  right = 100000 * 10000
  while right - left > 1
    mid = (left + right) / 2
    v = num(w,k,mid)
    if v >= w.length
      right = mid
    else
      left = mid
    end
  end
  return right
end

puts binary(w,k)

Measured memory_bytes: 9752
#include<bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define ll long long
const int N=200005;
const int mod=1e9+7;
const double eps=1e-8;
const double PI = acos(-1.0);
#define lowbit(x) (x&(-x))
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll qpow(ll a,ll b){ll res=1;while(b){if(b&1) res=res*a%mod;a=a*a%mod;b>>=1;}return res;}
ll inv(ll a,ll p){return qpow(a,p-2);}
int main()
{
    std::ios::sync_with_stdio(false);
    ll a,b,x;
    while(cin>>a>>b>>x)
    {
        if(a==0)
        {
            cout<<b/x+1<<endl;
        }
        else
            cout<<b/x-(a-1)/x<<endl;
    }
    return 0;
}


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

using namespace std;
using ll = long long;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((int)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back

bool compare_by_second(pair<ll,ll> a, pair<ll,ll> b)
{
    if(a.second != b.second) return a.second < b.second;
    else return a.first < b.first;
}

int main()
{
    ll N;
    cin >> N;
    
    ll A, B;
    vector<pair<ll,ll>> T;
    REP(i,0,N) {
        cin >> A >> B;
        T.pb(make_pair(A, B));
    }
    sort(ALL(T), compare_by_second);

    ll now = 0;
    ll dl = 0;
    bool f = true;
    REP(i,0,N) {
        now += T[i].first;
        dl = T[i].second;
        if(now > dl) {
            f = false;
            break;
        }
    }
    
    if(f) _PR("Yes");
    else _PR("No");

    return 0;
}

/*



*/

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

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

	int a, b;
	int flag = 0;

	rep(i, n)
	{
		cin >> a >> b;

		if (a == b)
		{
			flag++;
			if (flag == 3)
			{
				cout << "Yes";
				return 0;
			}
		}
		else
		{
			flag = 0;
		}
	}
	cout << "No";
}


Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a,b,c,d,e,i,ans=0;
	scanf("%lld %lld %lld",&a,&b,&c);
	for(i=1;i<=a;i++)
	{
		scanf("%lld %lld",&d,&e);
		if(d>=b&&e>=c)
			ans++;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define rep(a,b) for(long long i=a;i<b;i++)
#define vi vector<ll>
const ll MAX=1e3;
const ll mod=1e9+7;
const ll INF=1e18+12;
set< pair<ll,ll> >ss;
ll sum[500];
ll dp[MAX][MAX];
                                    //SAMEER KUMAR SINGH//
// ================================================================================================================================//
// ================================================================================================================================//
// ================================================================================================================================//

ll fun(ll a[],ll i,ll j){
    if(i==j)
     return 0;
    if(dp[i][j]!=0)
     return dp[i][j];
    ll ans=1e18;
    for(ll k=i;k<j;k++){
       ans=min(ans,fun(a,i,k)+fun(a,k+1,j)+sum[j+1]-sum[i]);
    }
    dp[i][j]=ans;
    return ans;

}

int main(){
   FASTIO;
   ll tt=1;
   //cin>>tt;

   while(tt--){
      ll n;cin>>n;
      ll a[n];
      rep(0,n){
      cin>>a[i];
      }
      ll fsum=0;
      for(ll i=1;i<=n;i++){
        fsum+=a[i-1];
        sum[i]=fsum;
      }
      cout<<fun(a,0,n-1);
   }

   return 0;
}


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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define INF LONG_LONG_MAX
#define MOD 1000000007
#define yn(f) cout << (f ? "Yes" : "No") << endl;
#define YN(f) cout << (f ? "YES" : "NO") << endl;



signed main() {
    int s,w;
    cin >> s >> w;
    cout << (s <= w ? "unsafe" : "safe") << endl;
}




Measured memory_bytes: 3616
using System;
class Program
{
	static void Main(string[] args)
	{
		string[] input = Console.ReadLine().Split(' ');
		for (int i = 0;i < 5;i++)
        {
			if(int.Parse(input[i]) == 0)
            {
				Console.WriteLine(i+1);
			}
        }
	}
}

Measured memory_bytes: 27328
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <string>
#include <string.h>
#include <bitset>
#include <map>
#include <climits>
#include <set>
#include <cmath>

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> Ls(N);
    for (int i = 0; i < N; ++i)
    {
        cin >> Ls[i];
    }
    std::sort(Ls.begin(), Ls.end());
    auto s = std::accumulate(Ls.begin(), Ls.end() - 1, 0);
    bool b = *(Ls.end() - 1) < s;
    cout << (b ? "Yes" : "No") << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;

const int MOD = 1e9+7;
const int MAXN = 1e5+10;
const int MAXM = 1e6;

bool isprime[MAXM];
ll dp[MAXN * 2];
vector<ll> prime;
ll n, m;

void init() {
  dp[0] = dp[1] = 1;
  for (int i=2;i<2*MAXN;i++) {
    dp[i] = dp[i-1] * i % MOD;
  }
  memset(isprime, true, sizeof(isprime));

  isprime[0] = isprime[1] = false;

  for (int i=2;i<=sqrt(m);i++) {
    if (isprime[i]) {
      prime.push_back(i);
      for (int j=2*i;j<MAXM;j+=i) {
        isprime[j] = false;
      }
    }
  }
}

ll mod_pow(ll x, ll n) {
  ll res = 1;
  while(n > 0) {
    if (n & 1) {
      res = res * x % MOD;
    }
    x = x * x % MOD;
    n >>= 1;
  }
  return res;
}

ll mod_inv(ll x) {
  return mod_pow(x, MOD - 2) % MOD;
}

ll nCr(ll n, ll r) {
  return (dp[n] * mod_inv(dp[r]) % MOD) * mod_inv(dp[n-r]) % MOD;
}


void solve() {
  init();

  ll ans = 1;
  for (int i=0;i<prime.size() && m > 1;i++) {
    int cnt = 0;
    while (m % prime[i] == 0) {
      m /= prime[i];
      cnt++;
    }
    ans = (ans * nCr(cnt + n - 1, cnt)) % MOD;
  }
  if (m > 1) {
    ans = (ans * n) % MOD;
  }
  cout << ans << endl;
}

int main() {
  cin >> n >> m;
  solve();
}


Measured memory_bytes: 2816
/**
	������������ Author : Avi J Patel ������������
	������������ University : DA-IICT ������������
**/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define mp make_pair 
#define mt make_tuple
#define ff first
#define ss second
#define si size()
#define MOD 1000000007
#define Mod 998244353
#define N 200001
#define large 10000000000000001

#define For(i,m,n) for(long long i=m;i<n;i++)
#define st(x) sort(x.begin(),x.end())
#define re(x,i) reverse(x.begin()+i,x.end())
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
/*
bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
}*/ 
int main()
{
	string s;
	cin>>s;
	if(s=="Sunny")
	cout<<"Cloudy";
	else if(s=="Rainy")
	cout<<"Sunny";
	else
	{
		cout<<"Rainy";
	}
	return 0;
}







Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define NIL -1

struct Node {
  int p,l,r;
};

Node T[100005];
int n,D[100005];

/*int setDepth(int u, int p){
  D[u] = p;
  if(T[u].r != -1)setDepth(T[u].r, p);
  if(T[u].l != -1)setDepth(T[u].l, p);
}*/

void printChild(int u){
  int i,c;
  cout << "node " << u << ": ";
  cout << "parent = " << T[u].p << ", ";
  cout << "depth = " << D[u] << ", ";

  if(T[u].p == NIL)cout << "root, ";
  else if(T[u].l == NIL)cout << "leaf, ";
  else cout << "internal node, ";

  cout << "[";

  for (i = 0,c = T[u].l; c != NIL; i++, c = T[c].r) {
    if (i) cout << ", ";
    cout << c;
  }
  cout << "]" << endl;
}

int rec(int u, int p){
  D[u] = p;
  if (T[u].r != NIL) rec(T[u].r, p);
  if (T[u].l != NIL) rec(T[u].l, p + 1);
}

int main() {
  int i,j,d,v,c,l,r;
  cin >> n;
  for (i = 0; i < n; i++) T[i].p = T[i].l = T[i].l = T[i].r = NIL;

  for (i = 0; i < n; i++) {
    cin >> v >> d;
    for (j = 0; j < d; j++) {
      cin >> c;
      if (j == 0) {
        T[v].l = c;
      }
      else T[l].r = c;
      l = c;
      T[c].p = v;
    }
  }
  for (i = 0; i < n; i++) {
    if (T[i].p == NIL) r = i;
  }

  rec(r,0);

  for (i = 0; i < n; i++) printChild(i);
  return 0;
}



Measured memory_bytes: 7736
n = int(input())
s = input()

e_right = 0
for i in range(1, n):
    if s[i] == 'E':
        e_right += 1

ans = e_right
prev = e_right
for i in range(1, n):
    tmp = prev
    if s[i] == 'E':
        tmp -= 1
        if s[i-1] == 'W':
            tmp += 1
    else:
        if s[i-1] == 'W':
            tmp += 1
    ans = min(ans, tmp)
    prev = tmp

print(ans)


Measured memory_bytes: 9592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
struct edge{long long to,cost;};
const int inf = 1 << 27;
const long long INF = 1LL << 60;
const int COMBMAX = 1001001;
const long long MOD = 1000000007;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define eachdo(v, e) for(const auto& e : (v))
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (long long)distance((v).begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (long long)distance((v).begin(), upper_bound((v).begin(), (v).end(), e))
long long mpow(long long a, long long n, long long mod = MOD){long long res = 1; while(n > 0){if(n & 1)res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
void yn(bool j){cout << (j ? "Yes" : "No") << endl; return;}
template<class Head> void pt(Head&& head){cout << head << endl; return;}
template<class Head, class... Tail> void pt(Head&& head, Tail&&... tail){cout << head << " "; pt(forward<Tail>(tail)...);}
template<class T> void debug(T v){rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void debug2(T v){rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T1, class T2> long long bcount(T1 v, T2 a){return upper_index(v, a) - lower_index(v, a);} 
template<class T1, class T2> inline bool chmin(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}
template<class T1, class T2> inline bool chmax(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}

int main(){
    ll N; cin >> N;
    vector<P> a(N);
    rep(i, N){
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(all(a));
    reverse(all(a));
    vector<vector<ll>> dp(N + 1, vector<ll>(N + 1, 0));
    for(ll i = 0; i < N; i++){
        for(ll j = 0; j < N; j++){
            if (N < i + j + 1) continue;
            chmax(dp[i + 1][j], dp[i][j] + (a[i + j].second - i) * a[i + j].first);
            chmax(dp[i][j + 1], dp[i][j] + (N - j - a[i + j].second - 1) * a[i + j].first);
        }
    }
    ll ans = 0;
    // debug2(dp);
    rep(i, N){
        chmax(ans, dp[i][N - i]);
    }
    pt(ans);
}

Measured memory_bytes: 34688
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	var Input = Number(input)
    
    if(Input % 2 == 1){
      var odd = (Input + 1) / 2
      
      console.log(odd / Input)
      return
    }
    
  console.log(0.5)
  
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include <bits/stdc++.h>
using namespace std;
#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++)


int main() {
  int n,m;
  cin >> n>>m;
  vector<int>a(m);
  int ans=0;
  rep(i,m){
    cin>>a.at(i);
    ans+=a.at(i);
  }
  if(n-ans>=0){
     cout<<n-ans<<endl;
  }
  else{
    cout<<-1<<endl;
  }
  
  
}






Measured memory_bytes: 3640
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
    vector<pair<int,int>> v;
    bool ansb = true;
    int n,r,l,total = 0;
    cin >> n;
    rep(i,n){
        cin >> r >> l;
        v.push_back({r,l});
    }
    sort(v.begin(),v.end(), [](pair<int,int>& x, pair<int,int>& y) { return x.second < y.second;});

    rep(i,n){
        total += v[i].first;
        //cout << total << "| " v[i].second << endl;
        if(total > v[i].second){
            ansb = false;
        }
    }
    if(ansb){
        cout << "Yes"<< endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 2420
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

string large(string s, string t){
    if (s.length() > t.length()) return s;
    if (s.length() < t.length()) return t;
    REP(i,s.length()){
        if (s[i] > t[i]) return s;
        if (s[i] < t[i]) return t;
    }
    return s;
}

int main() {
    int w, h;
    while (cin >> w >> h && w){
        vector<vector<string> > dp(h, vector<string>(w));
        REP(i,h){
            string s;
            cin >> s;
            REP(j,w){
                if (s[j] >= '0' && s[j] <= '9')
                    dp[i][j].push_back(s[j]);
            }
        }
        vector<vector<string> > a(dp);
        REP(i,h) REP(j,w) {
            if (dp[i][j] == "0" || a[i][j].empty()) continue;
            if (i < h-1)
                dp[i+1][j] = large(dp[i+1][j], dp[i][j]+a[i+1][j]);
            if (j < w-1)
                dp[i][j+1] = large(dp[i][j+1], dp[i][j]+a[i][j+1]);
        }
        string ans;
        REP(i,h) REP(j,w) {
            ans = large(ans, dp[i][j]);
        }
        cout << ans << endl;
    }
    return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
ld EPS = 1e-12;
int INF = numeric_limits<int>::max() / 2;
int MOD = 1e9 + 7;
#define rep(i,n) for(int i = 0; i < n; i++)
#define all(obj) (obj).begin(), (obj).end()
template<class T>
int print(T& x){ cout << x << '\n'; return 0;}
#define debug(x) cerr << #x << ": " << x << '\n'

class UnionFind
{
    std::vector<int> data;

  public:
    UnionFind(int size) : data(size, -1) {}
    bool unite(int x, int y)
    {
        x = root(x);
        y = root(y);
        if (x != y)
        {
            if (data[y] < data[x])
                std::swap(x, y);
            data[x] += data[y];
            data[y] = x;
        }
        return x != y;
    }
    bool find(int x, int y)
    {
        return root(x) == root(y);
    }
    int root(int x)
    {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    ll size(int x)
    {
        return -data[root(x)];
    }
};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
 
    ll n, m;
    cin >> n >> m;
    vector<P> es(m);
    for (int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        es[i] = P(a, b);
    }
    reverse(es.begin(), es.end());
    ll cnt = n * (n - 1) / 2;
    vector<ll> ans;
    ans.push_back(cnt);
    UnionFind uf(n);
    for (int i = 0; i < m; i++)
    {
        int a = es[i].first, b = es[i].second;
        if (!uf.find(a, b))
        {
            ll tmp = uf.size(a) * uf.size(b);
            uf.unite(a, b);
            cnt -= tmp;
        }
        ans.push_back(cnt);
    }
    reverse(ans.begin(), ans.end());
    for (int i = 1; i <= m; i++)
        cout << ans[i] << endl;
}


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

typedef long long int   ll;
#define cases           int t;cin>>t;while(t--)
#define FIO             ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define scan(n)         scanf("%d",&n)
#define pb              push_back
#define mod             1000000007
#define maxsz           200001
#define int             ll

using namespace std;

signed main(){
    int n,k;cin>>n>>k;
    int ar[n+1];
    for(int i=1;i<=n;i++){
        cin>>ar[i];
    }
    set<int> st;
    vector<int> cyc;
    int cycst;
    int ind=1;
    while(1){
        cyc.push_back(ar[ind]);
        st.insert(ar[ind]);
        ind=ar[ind];
        if(st.find(ar[ind])!=st.end()){
            cycst=ar[ind];
            break;
        }
    }
    int cycind;
    for(int i=0;i<(int)cyc.size();i++){
        if(cyc[i]==cycst){
            cycind=i;
            break;
        }
    }
    int sz=cyc.size()-cycind;

//    for(int i=0;i<cyc.size();i++){
//        cout<<cyc[i]<<" ";
//    }cout<<endl;
//    cout<<"cycind:"<<cycind<<endl;
//    cout<<"sz:"<<sz<<endl;

    int ans;
    if(k<=cycind){
        ans=k-1;
//        cout<<"ans:"<<ans<<endl;
        cout<<cyc[ans]<<endl;
    }else {
        k-=cycind;
        ans=(k%sz);
        if(ans==0)ans=sz;
        ans--;
//        cout<<"ans:"<<ans+cycind<<endl;
        cout<<cyc[ans+cycind];
    }
}


Measured memory_bytes: 15572
//Coded by Abhijay Mitra
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <numeric>
#include <vector>
#include <iterator> 
#include <map>
#include <set>
#include <climits>
#include <queue>
#include <cmath>
#include <stack>
#include <cctype>
#include <bitset>
// #include <bits/stdc++.h>
#define double long double
#define int long long int
#define ll int
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define bp __builtin_popcount
#define pb emplace_back
#define koto_memory(a) cout<<(sizeof(a)/1048576.0)<<" MB";
#define res(v) sort(all(v)),v.erase(unique(all(v)), v.end());
#define timer cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
#define deb(x) cout<<"\n["<<#x<<" = "<<x<<"]\n";
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using pii = std::pair<int,int>;
using vpii = std::vector<pii>;
using vvpii = std::vector<vpii>;
#define mp         make_pair
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define per(i,b,a) for (int i = b; i >= a; i--)
#define all(x)     x.begin(), x.end()
using namespace std;
const int N=2e6+10;
const int inf = /*0x3f3f3f3f*/1e18+10;
// const ll M = 998244353 ; // Mulo
// const int M = 1e9+7 ; // Mulo
const double Pi = 3.14159265;
#define F first
#define S second
void solve(){
  int d,t,s;cin>>d>>t>>s;
  int dis=s*t;
  if(dis>=d)cout<<"Yes";
  else cout<<"No";
}
int32_t main()
{
  ibs;cti;
  solve();return 0;
  /*,cout<<"\n"*/;
  // cout<<"\n";
  int xx=0;
  int t;cin>>t;while(t--){/*xx++;cout<<"Case "<<xx<<":\n"*/;solve();cout<<"\n";}
  return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll ,ll>;
const ll INF = 1LL<<61LL;

ll N;
vector<vector<ll> > es;

ll dfs(ll now){
	vector<ll> ret;
	for(auto &&e : es[now]){
		ret.push_back(dfs(e));
	}
	sort(ret.begin(), ret.end());
	ll ans = 0;
	for(int i=0;i<ret.size();i++){
		ans = max(ans, ret[i] + (int)ret.size() - i);
	}
	return ans;
}

int main(){
	cin >> N;
	es.resize(N);
	for(int i=1;i<N;i++){
		ll a;
		cin >> a;
		a--;
		es[a].push_back(i);
	}
	ll ans = 0;
	ans = dfs(0);
	cout << ans << endl;
}


Measured memory_bytes: 13568
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math;


void main()
{
    auto n = readln.chomp.to!int;
    int[] ms;
    ms.length = n;
    foreach (i; 0..n)
        ms[i] = readln.chomp.to!int;
    ms.sort();
    ms = ms.uniq.array;
    writeln(ms.length);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <map>
#include <iomanip>
#include <stdio.h>
#include <bitset>

typedef long long LL;

constexpr long long INFLL = 1e18;

using namespace std;

int main()
{
    int a, v, b, w, t;

    cin >> a >> v >> b >> w >> t;
    if (w >= v)
    {
        cout << "NO" << endl;
        return 0;
    }

    int dis = abs(a - b);

    if (v * t >= dis + w * t)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 3132
import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		int m = parseInt(sc.next());
		int[] c = new int[n+1];
		int a;
		int b;
		for (i = 0; i < m; i++) {
			a = parseInt(sc.next());
			b = parseInt(sc.next());
			c[a]++;
			c[b]++;
		}
		sc.close();
		PrintWriter pw = new PrintWriter(out);
		for(i=1;i<=n;i++) {
			pw.println(c[i]);
		}
		pw.flush();
	}
}


Measured memory_bytes: 23636
s = input()
ls = len(s)
alphabet = "abcdefghijklmnopqrstuvwxyz"
alphabet_list = [0 for i in range(26)]

ans = 1
for i, v in enumerate(s,1):
    a = alphabet.index(v)
    ans += (i - 1)  - alphabet_list[a]
    alphabet_list[a] += 1
print(ans)


Measured memory_bytes: 41436
S = list(input())
T = list(input())

cntS = [0 for _ in range(26)]
cntT = [0 for _ in range(26)]
Alph = list("abcdefghijklmnopqrstuvwxyz")

for i in range(26):
    for j in S:
        if j == Alph[i]:
            cntS[i] += 1

for i in range(26):
    for j in T:
        if j == Alph[i]:
            cntT[i] += 1
cntS.sort()
cntT.sort()

# print(cntS)
# print(cntT)
if cntS == cntT:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 6704
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;


int main() {
    char r, g, b;
    cin >> r >> g >> b;
    int num = (r - '0') * 100 + (g - '0') * 10 + (b - '0');
    if (num % 4 == 0) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
/*
	Copyright: razouq (c)
	Author: Anass BENDARSI
	Date: 20/08/2017 13:03:34
	flamers will **** you
*/
#include<bits/stdc++.h>
//#include<flamers.h>
#define ll long long
#define ull unsigned long long
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define POB pop_back
#define dist(a, b) sqrt(a*a + b*b)
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<pair<int, int>> vipi;
bool compare(pi p1, pi p2){
	 if(1) return true;
	 return false;
}

int main(){
//	freopen("input.in", "r", stdin);
//	freopen("output.out", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie();
	string str;
	cin>>str;
	int tab[26] = {0};
	for(int i = 0; i < str.size(); i++) tab[str[i]- 'a']++;
	bool flag = false;
	for(int i = 0; i < 26; i++){
		if(tab[i] == 0) {
			cout<<(char) ('a' + i)<<endl;
			flag = true;
			break;
		}
	}	
	if(flag == false) cout<<"None"<<endl;
	return 0;
}


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

#define fast ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for(int i = (int)a; i <= (int)b; ++i)
#define sz(s) (int)s.size()
#define all(v) v.begin(),v.end()
#define rall(x) (x).rbegin(), (x).rend()

typedef long long ll;
typedef long double ld;
const ll inf = (ll)1e18;
const int N = (int)2e5+77;
const ll mod = (ll)1e9+7;

int main() {
    fast;
    string s;
    cin >> s;
    int n = sz(s), ans = n;

    forn(i, n - 1)if (s[i] != s[i + 1]) ans = min(ans, max(i + 1, n - i - 1));

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

Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<cmath>
#define SZ(x) ((int)x.size())
#include<vector>
#include<set>
#include<map>
#define ll long long
#define lli long long int
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#include<string>
#include<cctype>
#include<queue>
#define ii pair<int,int>
#include <sstream>
#define lli long long int
#define pairs pair<int,int>
#define mod 1000000007
const double PI = 3.141592653589793238460;
typedef std::complex<double> Complex;
typedef std::valarray<Complex> CArray;
using namespace std;
ll pows(ll a,ll n,ll m)
{
	ll res=1;
	while(n)
	{
	if(n%2!=0)
	{
		res=(res*a)%m;
		n--;
		}
		else
		{
			a=(a*a)%m;
			n=n/2;
			}	
	}
	return res%m;
}
int  gcd(int a,int b)
{
	if(b==0)
	return a;
	else 
	return gcd(b,a%b);
}
bool isprime(ll n)
{
	if(n==1)
	{
		return false;
	}
	for(ll i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			return false;
		}
	}
	return true;
}
bool istrue(string s)
{
	int i=0;
	int j=s.size()-1;
	while(i<j)
	{
	if(s[i]==s[j])
	{
		i++;
		j--;
		}
		else
		{
			return false;
			}	
	}
	return true;
}
int a[1000001];
int main()
{
   ios::sync_with_stdio(false);
	 cin.tie(0);
    cout.tie(0);
int n;
cin>>n;
for(int i=0;i<n;i++)
{
	cin>>a[i];
}
set<int>vi;
int ans=0;
set<int>s;
for(int i=0;i<n;i++)
{
	int p=a[i];
	for(int j=2;j*j<=p;j++)
	{
		if(p%j==0)
		{
			s.insert(j);
			p=p/j;
			while(p%j==0)
			{
				p=p/j;
				if(p!=1)
				{
				s.insert(p);
			}
			}
		}
	}
	if(p>1)
	{
		s.insert(p);
	}
	ans=ans+s.size();
	for(int res:s)
	{
		vi.insert(res);
	}
	s.clear();
}
if(vi.size()==ans)
{
	cout<<"pairwise coprime"<<endl;
}
else
{
	int l=a[0];
	for(int i=1;i<n;i++)
	{
		l=gcd(a[i],l);
	}
	if(l==1)
	{
		cout<<"setwise coprime"<<endl;
	}
	else
	{
		cout<<"not coprime"<<endl;
	}
}
}
 
 

Measured memory_bytes: 21920
#include<bits/stdc++.h>
#define ll long long
#define db double
#define pb push_back
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define all(a) a.begin(),a.end()
using namespace std;

 ll mod=1e9 +7;
const ll M=500006;
ll f[M],inv[M];
ll expo(ll base,ll exponent){
    ll ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%mod;
        base=(1LL*base*base)%mod;
        exponent>>=1;
    }
    return ans%mod;
}
void compute(){
    f[0]=1;
    rep(i,1,M-1){
        f[i]=(1LL*i*f[i-1])%mod;
    }
    inv[M-1]=expo(f[M-1],mod-2);
    for(ll i=M-2;i>=0;i--){
        inv[i]=(1LL*(i+1)*inv[i+1])%mod;
    }
}
ll C(ll n,ll r){
    return (1LL*((1LL*f[n]*inv[r])%mod)*inv[n-r])%mod;
}

vector<bool>  prime(1000002,true);
void Sieve() 
{ 
   
    for (int p=2; p*p<=1000001; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=1000001; i += p) 
                prime[i] = false; 
        } 
    } 
}

bool check(string s,char c)
{
	for(auto x:s)
	{
		if(x==c) return true;
	}
	return false;
}

int main()
{
	// #ifndef ONLINE_JUDGE
 //    // for getting input from input.txt
 //    freopen("input.txt", "r", stdin);
 //    // for writing output to output.txt
 //    freopen("output.txt", "w", stdout);
 //    #endif
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // compute();
    ll tests=1;
   // cin>>tests;
    while(tests--)
    {
    	ll i,j,x;
    	cin>>x;
    	for(i=-1000;i<=1000;i++)
    	{
    		for(j=-1000;j<=1000;j++)
    		{
    			ll val1=i*i*i*i*i;
    			ll val2=j*j*j*j*j;
    			if(val1-val2==x)
    			{
    				cout<<i<<" "<<j;
    				return 0;
    			}
    		}
    	}
    }

	return 0;
}

Measured memory_bytes: 3784
import sys

class Shop:
  def __init__(self, A, B):
    self.price = A
    self.limit = B

def merge(a, b):
    """ Merge of two sorted arrays (iterative version)
    
    IN:  sorted arrays a and b
    OUT: merging of a and b into one sorted array
    """
    if not a or not b or a[-1].price < b[0].price:
        return a + b
    res = [ a[0] for i in range(len(a)+len(b)) ]
    next_a = 0
    last_a = len(a)-1
    last_b = len(b)-1
    for i in range(len(res)):
        next_b = i - next_a
        if (next_a > last_a) or ((next_b <= last_b) and (a[next_a].price > b[next_b].price)):
            res[i] = b[next_b]
        else:
            res[i] = a[next_a]
            next_a += 1
    return res


def mergeSort(array):
    """ Sorting function (merge sort)
    IN: arbitrary array
    OUT: sorted array
    """

    # replace the lines below with your own code (minimum requirement for project 2)
    unit_length = 2
    array = [[i] for i in array]
    while len(array) != 1:
        temp = []
        len_arr = len(array)
        for i in range(0, len_arr, unit_length):
            if i == len_arr - 1:
                temp.append(array[i])
            else:
                temp.append(merge(array[i], array[i+1]))
        array = temp
    return array[0]
  

a = list(map(int, input().split()))

shop = a[0]
drink = a[1]

shops = []
for i in range(shop):
  a = list(map(int, input().split()))
  shops.append(Shop(a[0], a[1]))

shops = mergeSort(shops)

ans = 0
tmp = 0
for i in shops:
  B = i.limit
  if B > drink:
    tmp = drink
    drink = 0
  else:
    tmp = B
    drink -= B
  
  ans += i.price * tmp
  if drink == 0:
    break

print(ans)


Measured memory_bytes: 43776
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <numeric>
#include <math.h>
using namespace std;
typedef long long ll;

int main(){
    int a,b;cin>>a>>b;
    char v[a][b];
    for(int i=0;i<a;i++)for(int j=0;j<b;j++)cin>>v[i][j];
    for(int i=0;i<a;i++)for(int j=0;j<b;j++){
        if(v[i][j]=='#'){
            if(v[max(0,i-1)][j]=='#')continue;
            else if(v[min(a-1,i+1)][j]=='#')continue;
            else if(v[i][max(0,j-1)]=='#')continue;
            else if(v[i][min(b-1,j+1)]=='#')continue;
            else {cout<<"No";return 0;}
        }
    }
    cout<<"Yes";return 0;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;

typedef long long Int;
typedef pair<Int,Int> P;
#define print(x) cout<<(x)<<endl

#define INF10 10000000000
#define INF5 100000
#define EPS 1e-10
#define MOD 1000000007


int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a == b && b == c)print("Yes");
	else print("No");






	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
int main(){
	cin>>s;
	int n=s.length();
	bool c=true;
	if (s[n-1]=='1')c=false;
	if (s[0]=='0')c=false;
	for (int i=1;i<=n/2;i++)if (s[i-1]!=s[n-i-1])c=false;
	if (!c){cout<<"-1"<<endl;}
	else{
		int no=1;
		for (int i=1;i<=n/2;i++){
			if (s[i-1]=='0'){
				cout<<no<<' '<<i+1<<endl;
			}else{
				cout<<no<<' '<<i+1<<endl;no=i+1;
			}
		}
		for (int i=n/2+2;i<=n;i++)cout<<no<<' '<<i<<endl;
	}
	return 0;
}

Measured memory_bytes: 1664
#define rep(i, n) for(int i = 0; i < (int)(n); i++) //定番のn回繰り返しを省略
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 

using namespace std;
 

//ここから書き始める
int main(int argc, char const *argv[])
{
	string s,t;
	int ato[26], mae[26];
	int flag = 0;

	cin >> s >> t;

	int strleng = SZ(t);

	rep(i, 26)
	{
		ato[i] = -1;
		mae[i] = -1;
	}


	rep(i, strleng)
	{
		int cas_a = s[i] - 'a';
		int cas_b = t[i] - 'a';
		if(ato[cas_a] != -1 || mae[cas_b] != -1)
		{
			if(ato[cas_a] != cas_b || mae[cas_b] != cas_a)
			{
				flag = 1;
				break;
			}

		}
		ato[cas_a] = cas_b;
		mae[cas_b] = cas_a;

	}

	cout << (flag == 0 ? "Yes" : "No") << endl;


    return 0;
}


Measured memory_bytes: 776