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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 29;
const ll INF64 = 1ll << 45;
const int mod = 1000000007;
//const int mod = 998244353;


template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};


int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  set<int> st;
  rep(i, n) {
    cin >> a[i];
    if(a[i] != 0) st.insert(a[i]);
  }
  sort(ALL(a));
  if(st.size() == 0) {
    cout << "Yes" << endl;
    return 0;
  }
  else if(st.size() == 1 && n%3==0) {
    if(distance(upper_bound(ALL(a), 0), a.end()) == 2*n/3) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
  }
  else if(st.size() == 3 && n%3 == 0) {
    int check = 0;
    for(auto x: st) check ^= x;
    if(check != 0) {
      cout << "No" << endl;
      return 0;
    }
    for(auto x : st) {
      if(distance(lower_bound(ALL(a), x), upper_bound(ALL(a), x)) != n/3) {
        cout << "No" << endl;
        return 0;
      }
    }
    cout << "Yes" << endl;
    return 0;
  }
  else cout << "No" << endl;
}

Measured memory_bytes: 7196
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
#define all(v) v.begin(),v.end()


ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}
 
int main(){
  double n;
  cin >> n;
  for(int i=1;i<=50000;i++){
    double cost=floor(i*1.08);
    if(cost==n){
      cout << i << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
  
  return 0;
}


Measured memory_bytes: 256
N = int(input())
a = list(map(int, input().split()))
normal = set()
choku = 0

for i in range(N):
  if a[i] // 400  >= 8:
    choku += 1
  else:
    normal.add(a[i]//400)
    
if len(normal) == 0:
  print(1, choku)
else:
  print(len(normal), len(normal)+choku)

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

queue<int>que[1000];
int main() {
	int r,T;
	cin >>r>> T;
	while (T--)
	{
		int a, b, c;
		scanf("%d", &a);
		switch (a)
		{
		case 0:
			cin >> b >> c;
			que[b].push(c);
			break;
		case 1:
			cin >> b;
			if (!que[b].empty())cout << que[b].front() << endl;
			break;
		case 2:
			cin >> b;
			if (!que[b].empty())que[b].pop();
		default:
			break;
		}
	}
 
	return 0;
}




Measured memory_bytes: 4448
<?php
    $n = trim(fgets(STDIN));
    $e = 0;
    $o = 0;
    
    $data = explode(" ", trim(fgets(STDIN)));
    for($i=0;$i<$n;$i++){
        if($data[$i] % 2 == 1) $o++;
        else $e++;
    }
    
    if($o % 2 == 1) echo "NO";
    else echo "YES";
 
?>

Measured memory_bytes: 12920
// スタックサイズ: 100MB

#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
using namespace std;

typedef int64_t ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
const ll INF = 1000000000000000000;
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define all(v) (v).begin(), (v).end()
ll pw(ll x, ll y) { ll r = 1;  rep(i, y) { r *= x; }; return r; }


int main() {

	ll N, M;
	cin >> N >> M;
	cout << (100 * (N - M) + 1900 * M) * pw(2, M) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N;
  cin>> N;
  vector<int> A(N);
  for (int i=0; i<N; i++){
  	cin >> A.at(i);
  }
  
  int max=-1;
  
  int flag=0;
  
  while(flag==0){
  
  for (int i=0; i<N; i++){
  	if (A.at(i)%2 != 0){
    	flag=1;
       //1-tudemo kisuunara flag=1
    }
    A.at(i) /= 2;
  }
  
    max++;
    
  }
  
  cout << max << endl;
}

Measured memory_bytes: 256
/*
@Author
   Sujeet Kushwaha
*/
 
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
 
#define ll long long int
#define fast ios_base::sync_with_stdio(false)
#define fast_input cin.tie(NULL)
#define fast_output cout.tie(NULL)
#define vi vector<long long int> 
#define vp vector<pair<long long int ,long long int>>
#define pb push_back
#define mp make_pair
#define pp pop_back
#define iter vector<int>::iterator
#define pa pair<long long int ,long long int> 
#define f(a,b) for(int a=0;a<b;a++)
#define mod 1000000007
#define F first
#define S second
#define sett set<long long int>
#define um unordered_map<ll,ll>
#define ordered_set tree<pa, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
// ll powmod(ll a, ll b)
// {
//     ll res = 1;
//     while (b) {
//         if (b&1) {
//             res *= a;
//             res %= mod;
//         }
//         b >>= 1;
//         a = (a * a) % mod;
//     }
 
//     return res;
// }
 
// ll modInv(ll a)
// {
//     return powmod(a, mod - 2);
// }
// int fastread(){
//     int x=0;
//     int c = getchar_unlocked();
//     while(c<48)
//         c = getchar_unlocked();
//     while(c>=48){
//         x = x*10 + (c - 48);
//         c = getchar_unlocked();
//     }
//     return x;
// }
void solve()
{
  ll a,b;
  cin>>a>>b;
  ll ans=a*b;
  ans=ans/__gcd(a,b);
  cout<<ans;
  
}
int main() {
	fast;
	fast_input;
	fast_output;
	
	  solve();
	
	return 0;
}

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


#define FSCNd64 "%" SCNd64
#define FPRId64 "%" PRId64

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vpii=vector<pii>;

#define PI 3.1415926535897932384626433832795

template<typename X>
bool max_u(X&m, X v)
{
	if(m<v)
	{
		m=v;
		return true;
	}
	return false;
}


template<typename X>
bool min_u(X&m, X v)
{
	if(m>v)
	{
		m=v;
		return true;
	}
	return false;
}


struct solve
{
	solve(){}
	ll operator()() {
		return 0;
	}
};


int bit_count(ll v)
{
	int ret=0;

	for(;v>0;v>>=1)
	{
		if(v&1) ret++;
	}

	return ret;
}


int popcount(int n)
{
	static map<int,int> memo;
	if(n==0) return 0;
//cout << "popcount(" << n << ")\n";
	if(memo.find(n)==memo.end())
	{
		memo[n]=1+popcount(n%bit_count(n));
	}
	return memo[n];
}


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

	for(;;)
	{
		int n;
		cin >> n;
		if(cin.fail()) break;
		string s;
		cin >> s;

		int sb=0;
		for(int i=0;i<n;i++)
		{
			if(s[i]=='1') sb++;
		}
		vi up(n+1), un(n+1);

		int sbp=sb+1;
		int sbn=sb-1;
		if(sbn<=0) sbn=1;

		up[0]=1%sbp;
		un[0]=1%sbn;
		for(int i=1;i<n;i++)
		{
			up[i]=(up[i-1]*2)%sbp;
			un[i]=(un[i-1]*2)%sbn;
		}

		ll ssp=0, ssn=0;
		for(int i=0;i<n;i++)
		{
			if(s[n-1-i]=='1')
			{
				ssp+=up[i];
				ssn+=un[i];
			}
		}
//		cout << "(ssp, ssn)=(" << ssp << "," << ssn << ")\n";

		vi ans(n, 1);
		for(int i=0;i<n;i++)
		{
			if(s[n-1-i]=='0')
			{
//			cout << "ssp+up[i]=" << ssp+up[i] << "\n";
				ans[i]=1+popcount((ssp+up[i])%sbp);
			}
			else
			{
//			cout << "ssp-un[i]=" << ssn-un[i] << "\n";
				ans[i]=1+popcount((ssn-un[i])%sbn);
				if(sb==1) ans[i]=0;
			}
		}

		for(int i=n-1;i>=0;i--) cout << ans[i] << "\n";
	}
	return 0;
}


Measured memory_bytes: 6728
a,b,c,d=input()
for i in range(2**3):
    ls = ["+","+","+"]
    for j in range(3):
        if (i >> j) & 1:
            ls[j] = "-"
    if eval(a+ls[0]+b+ls[1]+c+ls[2]+d) == 7:
        print(a+ls[0]+b+ls[1]+c+ls[2]+d+"=7")
        break

Measured memory_bytes: 3064
A,B,C,D = map(int,input().split())

MOD=998244353

#dp[i][j]たてにi回、横にj回追加したときの数
DP=[[0]*(D-B+1) for _ in range(C-A+1)]
DP[0][0]=1

for i in range(1,C-A+1):
    DP[i][0]=DP[i-1][0]*B
    DP[i][0]%=MOD
for i in range(1,D-B+1):
    DP[0][i]=DP[0][i-1]*A
    DP[0][i]%=MOD

for i in range(1,min(C-A,D-B)+1):
    for j in range(i,C-A+1):
        DP[j][i] = DP[j-1][i]*(B+i) + DP[j][i-1]*(A+j)-DP[j-1][i-1]*(B+i-1)*(A+j-1)
        DP[j][i]%=MOD
    for j in range(i+1,D-B+1):
        DP[i][j] = DP[i-1][j]*(B+j) + DP[i][j-1]*(A+i)-DP[i-1][j-1]*(B+j-1)*(A+i-1)
        DP[i][j]%=MOD


print(DP[-1][-1])


Measured memory_bytes: 136384
#include <iostream>

int main()
{
	std::string str;
	std::cin >> str;
	if (str.size() > str.find("RRR"))
	{
		std::cout << 3 << std::endl;
	}
	else if (str.size() > str.find("RR"))
	{
		std::cout << 2 << std::endl;
	}
	else if (str.size() > str.find("R"))
	{
		std::cout << 1 << std::endl;
	}
	else
	{
		std::cout << 0 << std::endl;
	}

	return 0;
}


Measured memory_bytes: 3584
num_s = [1,2,3,4,5,6,7,8,9,10,11,12,13]
num_h = [1,2,3,4,5,6,7,8,9,10,11,12,13]
num_c = [1,2,3,4,5,6,7,8,9,10,11,12,13]
num_d = [1,2,3,4,5,6,7,8,9,10,11,12,13]

n = int(input())
for i in range(n):
	suits, number = map(str, input().split())
	if suits == "S":
		num_s.remove(int(number))
	if suits == "H":
		num_h.remove(int(number))
	if suits == "C":
		num_c.remove(int(number))
	if suits == "D":
		num_d.remove(int(number))

if not num_s:
	pass
else:
	for i_s in num_s:
		print("S %d" % (i_s))

if not num_h:
	pass
else:
	for i_h in num_h:
		print("H %d" % (i_h))

if not num_c:
	pass
else:
	for i_c in num_c:
		print("C %d" % (i_c))

if not num_d:
	pass
else:
	for i_d in num_d:
		print("D %d" % (i_d))


Measured memory_bytes: 5612
N,W = map(int,input().split())
Data = []
for _ in range(N):
    v,w = map(int,input().split())
    Data.append([v,w])
Data.sort(key=lambda x:x[1])
DP = [[0]*(W+1) for _ in range(N+1)]

for n in range(1,N+1):
    for w in range(1,W+1):
        tv,tw = Data[n-1]
        if tw <= w:
            DP[n][w] = max(DP[n][w],DP[n-1][w-tw]+tv)
        DP[n][w] = max(DP[n][w],DP[n-1][w])
print(DP[N][W])


Measured memory_bytes: 41888
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


int main() {
    vector<string> v {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    string s;
    cin >> s;
    int ind = find(v.begin(), v.end(), s) - v.begin();
    cout << 7 - ind;
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std ;
const int N = 1e7 + 4;
void FastInputOutput()
{
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}
inline ll LLD()
{
    ll ret;
    scanf("%lld", &ret);
    return ret;
}
inline int D()
{
    int ret;
    scanf("%d", &ret);
    return ret;
}
void bin( int x )
{
    if(!x)
        return;
    bin( x / 2 );
    cout << x % 2 ;
}
bool checkPrimeNumber(int n)
{
    bool flag = true;
    for(int j = 2 ; j <= n ; ++j)
    {
        if (n % j == 0)
        {
            flag = false;
            break;
        }
    }
    return flag;
}
bool cmp(string last, string first)
{
    if(last.size() < first.size())
        return 1;
    return 0;
}
int calculateDigit(int n)
{
    double temp = (double)(n);
    double a = 0.39908-(0.434294 * n);
    double b = log10( n ) ;
    double c = ( n + 0.5 ) * b ;
    double ans = c - abs( a ) ;
    return ceil(ans) ;
}
int findDigits(int n)
{
    double E = 2.71828182845904523536;
    double PI = 3.141592654;

    if (n < 0)
        return 0;
    if (n <= 1)
        return 1;

    double x = ((n * log10(n / E) +
                 log10(2.0 * PI * n) /
                 2.0));

    return floor(x) + 1;
}
ll fact(ll n)
{
    ll ans = 1 ;
    for(ll i = 1 ; i <= n ; ++i)
        ans *= i ;
    return ans ;
}

int arr[ N ];
int main()
{
    FastInputOutput() ;
    int n ;
    map < int, int > mp ;
    cin >> n ;
    for(int i = 0 ; i < n ; ++i)
    {
        cin >> arr[ i ] ;
        ++mp[arr[ i ]] ;
    }
    int cnt = 0 , cnt1 = 0 ;
    map < int, int > ::iterator it ;
    for(it = mp.begin() ; it != mp.end() ; ++it)
        if(it->first > it->second)
            cnt += it->second ;
            else
                cnt += (it->second - it->first);
    cout << cnt << endl ;

}

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

int main(void){
	int a[100][100], b[100], ans[100]={0}, n, m;
	cin >>n >>m;
	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			cin >>a[i][j];
		}
	}
	for(int i=0; i<m; i++){
		cin >>b[i];
	}
	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			ans[i]+=a[i][j]*b[j];
		}
		cout <<ans[i] <<endl;
	}
    return 0;
}

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

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

using namespace std;

typedef long long LL;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "[ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "]";

    return os;
}

template <typename T> inline
void chmin(T &a, T b){
    if (a > b) {
        a = b;
    }
}

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

    return false;
}

#define inf_value 100010
#define inf_weight (1LL) << 30

LL memo[110][inf_value];

void dp(int N, LL W, const vector<LL> &w, const vector<int> &v) {
    REP(i, 110) {
        REP(j, inf_value) memo[i][j] = inf_weight;
    }

    memo[0][0] = 0;

    REP(i, N) {
        REP(j, inf_value) {
            LL next_w = memo[i][j] + w[i];

            if (next_w <= W) {
                LL next_v = j + v[i];
                chmin(memo[i + 1][next_v], next_w);
            }

            chmin(memo[i + 1][j], memo[i][j]);
        }
    }

    LL res = 0;

    REP(i, inf_value) {
        if (memo[N][i] <= W) {
            res = i;
        }
    }

    cout << res << endl;
}



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

    int N;
    LL W;
    cin >> N >> W;

    vector<LL> w(N);
    vector<int> v(N);
    REP(i, N) cin >> w[i] >> v[i];

    dp(N, W, w, v);
}


Measured memory_bytes: 86272
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
//#pragma GCC optimize("Ofast")
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
//#define int ll
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define invar(typ, var) typ var; cin >> var;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX / 2;
const ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
const double EPS = 1e-9;

signed main(void) {
  cin.tie(0); ios::sync_with_stdio(false);
  
  int N;
  cin >> N;
  
  
  rep(i, N) {
    rep(j, N) {
      if(i*4 + j*7 == N) {
        fin("Yes");
        return 0;
      }
    }  
  }
  fin("No");
}

Measured memory_bytes: 256
import java.util.Scanner;
      public class Main{
             public static void main(String[] args){
                    Scanner stdin = new Scanner(System.in);
                    int a = stdin.nextInt();
                    int b = stdin.nextInt();
                    System.out.print(a*b+" ");
                    System.out.println(2*(a+b));
    } 
}


Measured memory_bytes: 26060
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: u32,
        m: u32,
    }
    if n == m {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define str string
#define fi first
#define se second
#define pb push_back
#define SET(a, b) memset(a, b, sizeof(a))
#define eps 1e-6
#define pi atan(1) * 4
#define mod 1000000007
#define inf 1000000000
#define llinf 1000000000000000000
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
#define FORl(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORDl(i, a, b) for (ll i = (a); i >= (b); i--)
using namespace std;
int dp[200005][2];
int main () {
  ios::sync_with_stdio(false); cin.tie(0);
  string S;
  cin >> S;
  int s = S.length(); S = "?" + S;
  FOR(i, 1, s) FOR(j, 0, 1) dp[i][j] = -inf;
  FOR(i, 1, s) {
    dp[i][0] = max(dp[i][0], dp[i - 1][1] + 1);
    if (i >= 2) dp[i][1] = max(dp[i][1], dp[i - 2][0] + 1);

    if (i == 1 || i > 1 && S[i] != S[i - 1]) {
      dp[i][0] = max(dp[i][0], dp[i - 1][0] + 1);
    }
    if (i == 2 || i > 2 && S[i] != S[i - 2] && (i == 3 || S[i - 1] != S[i - 3])) {
      dp[i][1] = max(dp[i][1], dp[i - 2][1] + 1);
    }
  }
  printf("%d\n", max(dp[s][0], dp[s][1]));
  return 0;
}

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

██╗    ██╗██████╗ ██╗████████╗████████╗███████╗███╗   ██╗    ██████╗ ██╗   ██╗
██║    ██║██╔══██╗██║╚══██╔══╝╚══██╔══╝██╔════╝████╗  ██║    ██╔══██╗╚██╗ ██╔╝
██║ █╗ ██║██████╔╝██║   ██║      ██║   █████╗  ██╔██╗ ██║    ██████╔╝ ╚████╔╝
██║███╗██║██╔══██╗██║   ██║      ██║   ██╔══╝  ██║╚██╗██║    ██╔══██╗  ╚██╔╝
╚███╔███╔╝██║  ██║██║   ██║      ██║   ███████╗██║ ╚████║    ██████╔╝   ██║
 ╚══╝╚══╝ ╚═╝  ╚═╝╚═╝   ╚═╝      ╚═╝   ╚══════╝╚═╝  ╚═══╝    ╚═════╝    ╚═╝

     ███╗   ███╗   ██╗██████╗ ██████╗  █████╗ ██╗  ██╗██╗███╗   ███╗
     ████╗ ████║   ██║██╔══██╗██╔══██╗██╔══██╗██║  ██║██║████╗ ████║
     ██╔████╔██║   ██║██████╔╝██████╔╝███████║███████║██║██╔████╔██║
     ██║╚██╔╝██║   ██║██╔══██╗██╔══██╗██╔══██║██╔══██║██║██║╚██╔╝██║
     ██║ ╚═╝ ██║██╗██║██████╔╝██║  ██║██║  ██║██║  ██║██║██║ ╚═╝ ██║
     ╚═╝     ╚═╝╚═╝╚═╝╚═════╝ ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝╚═╝     ╚═╝
*/
#define speed  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FOR(n) for(int i=0;i<n;i++)
#define For(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define E "\n"
#define all(e) e.begin(),e.end()
#define F first
#define S second
#define pi (acos(-1))
#define rad(x) ((x*pi)/(ld)(180))
#define perc(x) fixed<<setprecision(x)
/*****
#define cross(a, b) ((conj(a) * (b)).Y)
#define dot(a, b) ((conj(a) * (b)).X)
#define vec(a,b) ((b) - (a))
#define rot(p,angle) (p)*polar((double)(1),angle)
#define rot2(p,angle,a) ((p)-(a)) *(polar((ld)(1),angle)+ (a))
#define x real()
#define y imag()
*****/
typedef long long int ll; typedef unsigned long long ull; typedef long double ld;typedef complex<ld> point; typedef tuple<double,double,double> line;
ll gcd(ll x,ll y){if(!y)return x; return gcd(y,x%y);};   ll lcm(ll x,ll y){return (x*y)/__gcd(x,y);}
const int N=3e3+1;
ll dp[N][N],n,k,mod=1e9+7;
string s1,s2;
ll arr[N];

ll solve(int i,int j)
{
    if(dp[i][j] != -1)return dp[i][j];
    if(i == s1.size() or j == s2.size())return 0;

    ll ret ;
    if(s1[i] == s2[j])
        ret = 1 + solve(i+1,j+1);

    else{
        ret = max(solve(i+1,j), solve(i,j+1));
    }
    return dp[i][j] = ret ;
}

void print(int i,int j)
{
    if(i == s1.size() or j == s2.size())
        return;

    ll ret ;
    if(s1[i] == s2[j]){

        cout<< s1[i] ;

        print(i+1,j+1);
    }

    else{

        ll ret2 = solve(i+1,j);
        ret = solve(i,j+1);

        if(ret > ret2)
            print(i,j+1);

        else
            print(i+1,j);
    }
}
int main(){ speed;
memset(dp,-1,sizeof dp);

cin>> s1 >> s2;
//cout<<dp[0][-1]<<E;
solve(0,0);
//cout<< solve(0,0) << E;
print(0,0);

return 0;}


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

using namespace std;
#define sz(x) (int)((x).size())
#define forn(i,n) for (int i=0; i < n; i++)
#define forse(i,s,e) for (int i=s; i < e; i++)
#define pb push_back
#define fi first
#define se second
#define all(vec) vec.begin(), vec.end()
#define time() ((double)clock() / CLOCKS_PER_SEC)

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

double PI=3.141592653589793;


void solve(){
	ll a;
	cin >> a;
	string b;
	cin >> b;
	ll bv=(b[0]-'0')*100+(b[2]-'0')*10+(b[3]-'0');
	a*=bv;
	a/=100;
	cout << a;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); 
	int T=1;
//	cin >> T;
	forse(c,1,T+1){
	//	cout << "Case #" << cid << ": ";
		solve();
	}
}


Measured memory_bytes: 3652
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n)]
        self.rank = [0] * n
        self.size = [1] * n

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.rank[x] < self.rank[y]:
            self.par[x] = y
            self.size[y] += self.size[x]
            self.size[x] = 0
        else:
            self.par[y] = x
            self.size[x] += self.size[y]
            self.size[y] = 0
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same(self, x, y):
        return self.find(x) == self.find(y)

    # すべての頂点に対して親を検索する
    def all_find(self):
        for n in range(len(self.par)):
            self.find(n)


def main():
    N, M = map(int, input().split())
    Edge = []
    for i in range(M):
        a, b = map(int, input().split())
        a, b = a - 1, b - 1
        Edge.append([a, b])

    uf = UnionFind(N)
    Score = N * (N - 1) // 2
    ans = []
    while Edge:
        ans.append(Score)
        a, b = Edge.pop()
        pa, pb = uf.find(a), uf.find(b)
        if not uf.same(pa, pb):
            Score -= (uf.size[pa] * uf.size[pb])
        uf.union(a, b)

    print(*ans[::-1], sep='\n')

if __name__ == '__main__':
    main()
 

Measured memory_bytes: 26352
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

N = int(input())
As = list(map(int, input().split()))

# peak = n - 1
# for n in range(N - 2, -1, -1):
#     if As[n] > As[n + 1]:
#         peak = n
#     else:
#         break

def solve_slow(N, As):
    nums = [0, 1, 2]

    ans = 0
    for comb in product(nums, repeat=N):
        money = 1000
        stock = 0
        for c, a in zip(comb, As):
            # sell
            if c == 0:
                money += a * stock
                stock = 0
            # buy
            elif c == 1:
                stock += money // a
                money = money % a
            else:
                pass
            # print("c, money, stock = ", c, money, stock)
        # print()
        ans = max(ans, money)

    return ans
                

def solve_fast(N, As):
    def uniq(As):
        ret = []
        for a in As:
            if not ret:
                ret.append(a)
            else:
                if ret[-1] != a:
                    ret.append(a)
        return ret
    
    As = uniq(As)
    N = len(As)
    
    ans = 0
    money = 1000
    stock = 0
    for n in range(N):
        ans = max(ans, money + stock * As[n])
    
        if n == N - 1:
            break
    
        if As[n] < As[n + 1]:
            stock_diff, money = divmod(money, As[n])
            stock += stock_diff
            # stock, money = divmod(money, As[n])
        elif As[n] > As[n + 1]:
            money += stock * As[n]
            stock = 0
        # print("m, s = ", money, stock)
    
    return ans

print(solve_fast(N, As))
# print(solve_slow(N, As))

# while True:
#     N = 10
#     As = [random.randint(1, 10) for _ in range(N)]
#     s = solve_slow(N, As)
#     f = solve_fast(N, As)
#     if s != f:
#         print(N)
#         print(As)
#         s = solve_slow(N, As)
#         f = solve_fast(N, As)
#         break
#     else:
#         print("ok")





Measured memory_bytes: 10824
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
using namespace std;
namespace mine
{
	typedef long long ll;
	#define pr pair<int,int>
	#define FR first
	#define SE second
	#define MP make_pair
	#define PB push_back
	#define vc vector
	void chmax(int &x,const ll y) {x=(x>y?x:y);}
	void chmin(int &x,const ll y) {x=(x<y?x:y);}
	ll qread()
	{
		ll ans=0,f=1;char c=getchar();
		while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num)
	{
		if(num<0) putchar('-'),num=-num;
		if(num>=10) write(num/10);
		putchar('0'+num%10);
	}
	void write1(ll num){write(num);putchar(' ');}
	void write2(ll num){write(num);putchar('\n');}
	const int INF=0x3f3f3f3f;
	const int MOD=1e9+7;
	void add(ll &a,ll b){a+=b;if(a>=MOD)a-=MOD;if(a<=-MOD)a+=MOD;}
	ll qpower(ll x,int e)
	{
		ll ans=1;
		while(e)
		{
			if(e&1) ans=ans*x%MOD;
			x=x*x%MOD;e>>=1;
		}
		return ans;
	}
	ll invm(ll x){return qpower(x,MOD-2);}
	const int N=50+10;

	ll f[N][N][N*N*2];
	#define F(a,b,c) f[a][b][c+N*N]
	void main()
	{
		int n=qread(),K=qread();F(0,0,0)=1;
		for(int i=0;i<n;i++) for(int j=0;j<=i;j++) for(int k=-2500;k<=2500;k++) if(F(i,j,k))
		{
			add(F(i+1,j+1,k),F(i,j,k)*( (i-j)*2+1 )%MOD);//【1左1右】、【竖线】
			add(F(i+1,j+2,k+i),F(i,j,k)*(i-j)%MOD*(i-j)%MOD);//左+左
			add(F(i+1,j,k-i),F(i,j,k));//右+右
		}
		if(K&1) puts("0"); else write( F(n,n,K/2) );
	}
};
int main()
{
	srand(time(0));
	mine::main();
}


Measured memory_bytes: 157952
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;
const int N = 1e5+10;

int n,m,dp[N];
string s;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	cin >> n >> m >> s;
	int i=n-1,lst=n;
	while(i>=0 && lst-i<=m){
		int l = lst;
		for(int k=lst-i;k<=m&&i>=0;++k,--i){
			if(s[i]=='0'){
				dp[i] = l;
				lst = i;
			}
		}
	}
	if(dp[0] == 0) puts("-1");
	else{
		int i = 0;
		while(i<n){
			printf("%d ", dp[i]-i);
			i = dp[i];
		}
		printf("\n");
	}
	
	return 0;
}



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


int main() {
  string S;cin>>S;
  long MOD=1000000007;
  vector<vector<long>> dp(S.length(),vector<long>(13,0));
  //dp[i][j]=:i+1桁目までで13で割った余りがjの数
  for(int i=0;i<13;i++)dp[0][i]=0;
  if(S[0]=='?'){
    for(int i=0;i<=9;i++)dp[0][i]=1;
  }else{
    dp[0][S[0]-'0']=1;
  }
  for(int i=1;i<S.length();i++){
    int n=S[i]-'0';
    if(S[i]=='?'){
      for(int j=0;j<13;j++){
        for(int n=0;n<=9;n++){
          dp[i][(j*10+n)%13]=(dp[i][(j*10+n)%13]+dp[i-1][j])%MOD;
      	}
      }
    }else{
      for(int j=0;j<13;j++){
        dp[i][(j*10+n)%13]=(dp[i][(j*10+n)%13]+dp[i-1][j])%MOD;
      }
    }
  }
  cout<<dp[S.length()-1][5]<<endl;
}


Measured memory_bytes: 16672
n=int(input())
s=input()
e=s.count("E")
w=n-e
wc=0
ec=0
min1=300001
for i in range(len(s)):
    if s[i]=="W":
        wc+=1
        el=e-ec
        wl=wc-1
        ans=el+wl
        min1=min(min1,el+wl)    
    else:
        ec+=1
        el=e-ec
        wl=wc
        ans=el+wl
        min1=min(min1,el+wl)
print(min1)

Measured memory_bytes: 3828
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
typedef pair<ll, ll> PL;

const int N = 100100;
int rr[N], cc[N];
ll a[N];

vector<PL> cons[N];

int r, c, n;
vector<PL> edges[N];
ll dp[N];
int root[N];
void update_cons(int c1, int c2, ll d) {
  edges[c1].push_back(PL(c2, d));
  edges[c2].push_back(PL(c1, -d));
}

ll inf = -1e16;
bool dfs(int v, ll c, int r) {
  root[v] = r;
  if (dp[v] > inf) {
    return dp[v] == c;
  }
  dp[v] = c;
  REP(i, 0, edges[v].size()) {
    PL e = edges[v][i];
    bool res = dfs(e.first, c + e.second, r);
    if (!res) {
      return false;
    }
  }
  return true;
}

int main(void){
  cin >> r >> c >> n;
  REP(i, 0, n) {
    cin >> rr[i] >> cc[i] >> a[i];
    rr[i]--, cc[i]--;
    cons[rr[i]].push_back(PL(cc[i], a[i]));
  }
  REP(i, 0, r) {
    sort(cons[i].begin(), cons[i].end());
    if (cons[i].size() <= 1) {
      continue; // no constraints
    }
    REP(j, 0, cons[i].size() - 1) {
      update_cons(cons[i][j].first, cons[i][j + 1].first,
			     cons[i][j + 1].second - cons[i][j].second);
    }
  }
  REP(i, 0, c) {
    dp[i] = inf;
  }
  REP(i, 0, c) {
    bool res = 1;
    if (dp[i] <= inf) {
      res = dfs(i, 0, i);
    }
    if (!res) {
      cout << "No" << endl; // contradiction!!
      return 0;
    }
  }
  // no obvious contradiction found.
  VL mi(c, 0);
  REP(i, 0, c) {
    if (dp[i] > inf) {
      mi[root[i]] = min(mi[root[i]], dp[i]);
    }
  }
  /*
  REP(i, 0, c) {
    cerr << i << " dp " << dp[i] << " root " << root[i] << endl;
    if (root[i] == i) {
      cerr << "min[" << i << "]: " << mi[i] << endl;
    }
  }
  */
  bool ok = 1;
  REP(i, 0, n) {
    if (dp[cc[i]] > inf && a[i] - dp[cc[i]] + mi[root[cc[i]]] < 0) {
      ok = 0; // row rr[i] went wrong
    }
  }
  cout << (ok ? "Yes" : "No") << endl;
}


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

using namespace std;

int n,m,ans;

int main(){
	while(1){
	char s[1000004];
	cin >> n;
	ans = 0;
	if(n == 0)break;
	cin >> m;
	scanf("%s",s);
	int ren=0;
	for(int i = 0;i < m-2;i++){
		if(s[i] == 'I' && s[i+1] == 'O' && s[i+2] == 'I'){
			ren++;
			i++;
		}else{
			ans += max(ren - n + 1,0);
			ren = 0;
		}
	}
	ans += max(ren - n + 1,0);
	printf("%d\n",ans);
	}
	return 0;
}


Measured memory_bytes: 2148
#include <bits/stdc++.h>
using namespace std;
#define rep(i,s,n) for(int i=s;i<n;i++)
 
int main()
{
    int N;
    cin >> N;
  	int a=1000;
  	while(N>1000)
      N-=1000;
    cout << a-N << endl;
}

Measured memory_bytes: 3632
import sys,bisect
input = sys.stdin.readline

def main():
    n,k = map(int,input().split())
    a = list(map(int,input().split()))
    a.sort()

    #~A[p-1]:negative, A[q]~:positive
    p = bisect.bisect_left(a,0)
    q = bisect.bisect_right(a,0)
    zeros = q-p

    ok = 10**18
    ng = -ok-1
    while ok-ng > 1:
        mid = (ok+ng)//2

        #count
        cnt = 0
        if mid == 0:
            #{(negative),(zero,positive)}
            cnt += p*(n-p)
            #{(zero,positive),(zero,positive)}
            cnt += (n-p)*(n-p-1)//2
        elif mid > 0:
            #{(negative),(negative)}
            #{(A[j]~A[p-1]),A[i]) >>> clear!
            j = 0
            for i in range(p-1,-1,-1):
                while j <= p-1:
                    if a[i]*a[j] > mid:
                        j += 1
                    else:
                        break
                cnt += p-1-j+1
                if j <= i:
                    cnt -= 1
            
            #{(positive),(positive)}
            #{(A[q]~A[j]),A[i]} >>> clear!
            j = n-1
            for i in range(q,n):
                while j >= q:
                    if a[i]*a[j] >  mid:
                        j -= 1
                    else:
                        break
                cnt += j-q+1
                if i <= j:
                    cnt -= 1
            
            cnt = cnt//2

            #{(negative),(zero,positive)}
            cnt += p*(n-p)
            
            #{(zero),(zero)}
            cnt += zeros*(zeros-1)//2

            #{(positive),(zero)}
            cnt += zeros*(n-q)
        else:
            #{(negative),(positive)}
            #{(A[j]~A[n-1]),A[i]} >>> clear!
            j = q
            for i in range(p):
                while j < n:
                    if a[i]*a[j] >  mid:
                        j += 1
                    else:
                        break
                cnt += n-1-j+1

        if cnt >= k:
            ok = mid
        else:
            ng = mid
    print(ok)

if __name__ == "__main__":
    main()

Measured memory_bytes: 80468
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double eps = 1e-6;
const int INF = 0x3f3f3f3f;
const int N = 200000 + 5;
const int mod = 1e9+7;
struct node{
	int money;
	int a[15];
}c[15];
 
int main(){
	int n,m,x;
	cin >> n >> m >> x;
	for(int i = 0; i < n; i++){
		cin >> c[i].money;
		for(int j = 0; j < m; j++)
			cin >> c[i].a[j];
	}
	int minn = INF;
	for(int i = 0; i < (1<<n); i++){
		node p;
		p.money = 0;
		for(int j = 0; j < m; j++)
			p.a[j] = 0;
		for(int j = 0; j < n; j++){
			if(i&(1<<j)){
				p.money += c[j].money;
				for(int k = 0;k < m; k++){
					p.a[k] += c[j].a[k];
				}
			}
		}
		int f = 0;
		for(int j = 0;j < m; j++)
			if(p.a[j] < x) 
				f = 1;
		if(f == 0){
			minn = min(minn,p.money);
		}
	}
	if(minn == INF)
		minn = -1;
	cout << minn << endl;
	return 0;
}

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

#define ll long long
#define INF_LL 1LL << 60
#define INF 99999999
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

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


int main()
{
    int A,B,C;
    cin >> A >> B >> C;

    if( A == 7 && B == C && B == 5 ) cout << "YES" << endl;
    else if( B == 7 && A == C && A == 5 )cout << "YES" << endl;
    else if( C == 7 && A == B && A == 5 )cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int i,n,a=0;
    double p;
    scanf("%d",&n);
    for(i=1; i<=n; i++) {
        if(i%2==1) {
            a++;
        }
    }
    p=n;
    printf("%.10e",a/p);
    return 0;
}

Measured memory_bytes: 128
// C++ program to compute LCM of array elements modulo M 
#include <bits/stdc++.h> 
#define f first 
#define s second 
#define MAXXX 1000010 
using namespace std; 
typedef long long ll; 
const ll mod = 1000000007; 
ll prime[MAXXX]; 
unordered_map<ll, ll> max_map;
ll powers(ll a,ll b)
{
	ll ans=1;
	a%=mod;
	b%=mod-1;
	while(b){
		if(b%2)ans=(ans*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return ans;
}
ll divix(ll a,ll b){
	return (a*powers(b,mod-2))%mod;
}
void sieve() 
{ 
	prime[0] = prime[1] = 1; 
	for (ll i = 2; i < MAXXX; i++)
		if (prime[i] == 0)
		{ 
			for (ll j = i * 2; j < MAXXX; j += i)
				if (prime[j] == 0)
					prime[j] = i; 
			prime[i] = i; 
		}
} 
ll findlcm(const ll* ar, ll n) 
{ 
	for (ll i = 0; i < n; i++)
	{ 
		ll num = ar[i]; 
		unordered_map<ll, ll> temp; 
		while (num > 1) 
		{ 
		ll factor = prime[num]; 
			temp[factor]++; 
			num /= factor; 
		}
		for (auto it : temp)
			max_map[it.first] = max(max_map[it.first], it.second); 
	} 
	ll ans = 1; 
	for (auto it : max_map)ans = (ans * powers(it.f,it.s)) % mod; 
	return ans; 
}
int main() 
{
	sieve(); 
	ll n;
	cin>>n;
	ll arr[n];
	for(ll i=0;i<n;i++)cin>>arr[i];
	ll lcm=findlcm(arr,n);
	ll ans=0;
	for(ll i=0;i<n;i++)ans=(ans+divix(lcm,arr[i]))%mod;
	cout<<ans<<"\n";
	return 0; 
} 


Measured memory_bytes: 8576
# include <algorithm>
using namespace std;

int main() {
    int n; scanf("%d", &n);
    int a[n]; for (int i = 0; i < n; ++i) scanf("%d", a + i);
    int num_query; scanf("%d", &num_query);
    int begin, mid, end;
    
    for (int i = 0; i < num_query; ++i) {
        scanf("%d%d%d", &begin, &mid, &end);
        rotate(a + begin, a + mid, a + end);
    }
    
    printf("%d", a[0]);
    for (int i = 1; i < n; ++i) printf(" %d", a[i]);
    printf("\n");
    
    return 0;
}


Measured memory_bytes: 2776
fn permutations<T: Clone>(list: Vec<T>) -> Vec<Vec<T>> {
    if list.len() == 1 {
        return vec![list];
    }
    let mut ret = Vec::new();
    for (i, x) in list.iter().enumerate() {
        let ys = {
            let mut ys = list.clone();
            ys.remove(i);
            ys
        };
        for mut y in permutations(ys) {
            y.push(x.clone());
            ret.push(y);
        }
    }
    ret
}

fn func(input_str: &str) -> u32 {
    let mut iter = input_str.split("\n");
    let mut a_s = [0_u32; 5];
    for i in 0..5 {
        a_s[i] = iter.next().unwrap().parse().unwrap();
    }
    permutations(a_s.to_vec()).iter()
        .map( |pat| pat[..4].iter()
                .map(|x| (*x as f32 / 10.0).ceil() as u32 * 10)
                .sum::<u32>() + pat[4] )
        .min().unwrap()
}

use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    println!("{}", func(&buf[..]));
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
using namespace std;
struct Node {
    int key;
    Node *parent, *left, *right;
};

Node *root, *NIL;

void preOrder(Node *n) {
    if (n == NIL) {
        return;
    }

    cout << " " << n->key;
    preOrder(n->left);
    preOrder(n->right);
}

void inOrder(Node *n) {
    if (n == NIL) {
        return;
    }

    inOrder(n->left);
    cout << " " << n->key;
    inOrder(n->right);
}

void print() {
    inOrder(root);
    cout << endl;
    preOrder(root);
    cout << endl;
}

void insert(int k) {
    Node *y = NIL;
    Node *x = root;
    Node *z;

    z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;

    while (x != NIL) {
        y = x;
        if (z->key < x->key) {
            x = x->left;
        } else {
            x = x->right;
        }
    }

    z->parent = y;
    if (y == NIL) {
        root = z;
    } else if (z->key < y->key) {
        y->left = z;
    } else {
        y->right = z;
    }
}

int main() {
    int64_t N;
    cin >> N;
    for (int i=0; i < N; i++) {
        string op;
        cin >> op;
        if (op == "insert") {
            int64_t num;
            cin >> num;
            insert(num);
        } else {
            print();
        }
    }
    return 0;
}


Measured memory_bytes: 26652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
 
int main() {
  ll k,n,ans;
  cin >>n >>k;
  for(int i=0;i<n;i++){
    if(i==0) ans =k;
    else ans *= (k-1);
  }
  cout << ans <<endl;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc175/tasks/abc175_d
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define CEIL(a, b) ((a - 1) / b + 1)

void solve() {
    int32_t N, K;
    cin >> N >> K;
    vector<int> P(N), C(N);
    REP(i, N) cin >> P[i], P[i]--;
    REP(i, N) cin >> C[i];

    int ans = -1e12;
    // スタート位置
    REP(i, N) {
        vector<int> v;
        int now = i;
        while (true) {
            now = P[now];
            v.emplace_back(C[now]);
            if (now == i) {
                break;
            }
        }
        int loopSum = accumulate(ALL(v), 0LL);
        int32_t cnt = v.size();
        int t = 0;
        REP(j, min(cnt, K)) {
            t += v[j];
            // ループ内の合計x残りループ回数を加算する
            // ループ内の合計が負なら無視
            ans = max(ans, t + max(0LL, loopSum) * ((K - j - 1) / cnt));
        }
    }
    cout << ans << endl;
}

signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    solve();
}


Measured memory_bytes: 3824
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define dump(x)  cout << #x << " = " << (x) << endl;

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

struct DSU {
    vl pa;
    vl ra;

    DSU(ll n){
        pa.resize(n);
        ra.resize(n);
        rp(i,n) {
            pa[i] = i;
            ra[i] = 0;
        }
    }

    ll getParent(ll x){
        if(pa[x] == x) return x;
        return pa[x] = getParent(pa[x]);
    }

    void merge(ll a, ll b){
        a = getParent(a);
        b = getParent(b);
        if(a == b) return;
        if(ra[a] < ra[b]) swap(a,b);
        ra[a] += ra[b];
        pa[b] = a;
    }
};
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(0);
    cout << std::fixed;

    ll n,k,l;
    cin >> n >> k >> l;
    DSU road(n);
    DSU rail(n);

    ll x,y;
    rp(i,k) {
        cin >> x >> y;
        road.merge(x-1,y-1);
    }
    rp(i,l){
        cin >> x >> y;
        rail.merge(x-1,y-1);
    }

    vpl v;
    rp(i,n){
        ll ro = road.getParent(i);
        ll ra = rail.getParent(i);
        v.pb(mp(ro*MX + ra, i));
    }
    sort(all(v));
    vl ans(n,0);
    ll cur = -1;
    ll cnt = 0;
    rp(i,v.size()){
        if(cur != v[i].first){
            rp(j,cnt){
                ans[v[i-j-1].second] = cnt;
            }
            cur = v[i].first;
            cnt = 1;
        } else
        cnt ++;
    }
    rp(j,cnt){
        ans[v[v.size()-j-1].second] = cnt;
    }

    rp(i,n) cout << ans[i]<<" ";
    cout << "\n";

    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 12272
#include<iostream>
#include<queue>
#include<vector>
#include<algorithm>

using namespace std;
using ll = long long;


int main() {
	int v, e, r;
	cin >> v >> e >> r;
	vector<pair<int, int> >* children = new vector<pair<int, int> >[v];
	for (int i = 0;i < e;i++) {
		int moto, saki, w;
		cin >> moto >> saki >> w;
		children[moto].push_back(make_pair(w, saki));
	}
	ll* dist = new ll[v];
	for (int i = 0;i < v;i++) {
		dist[i] = -1;
	}
	priority_queue<pair<ll, int>,vector<pair<ll,int> >,greater<pair<ll,int> > > pq;
	pq.push(make_pair(0, r));
	while (!pq.empty()) {
		pair<ll, int> p = pq.top();
		pq.pop();
		if (dist[p.second] == -1) {
			dist[p.second] = p.first;
			for (int i = 0;i < children[p.second].size();i++) {
				pq.push(make_pair(p.first + children[p.second][i].first, children[p.second][i].second));
			}
		}
	}
	for (int i = 0;i < v;i++) {
		if (dist[i] == -1) {
			cout << "INF\n";
		}
		else {
			cout << dist[i] << endl;
		}
	}
}


Measured memory_bytes: 16472
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm> 
#include <cmath>

using namespace std;

typedef long long LL;

string str;
LL a[15];

int main() {
	cin >> str;
	int n = str.size();
	for (int i = 0; i < n; i++) {
		a[i] = str[i] - '0';
	}

	LL ans = 0;
	for (int i = 0; i < (1 << (n - 1)); i++) {
		LL sum = 0;
		LL cur = a[0];
		for (int j = 0; j < n - 1; j++) {
			if (i & (1 << j)) {
				sum += cur;
				cur = a[j + 1];
			} else {
				cur = (cur * 10 + a[j + 1]);
			}
		}
		sum += cur;
		ans += sum;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256