akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(void)
{
	double y;
	int sum=0,x,N=0;
	
	scanf("%d",&N);
	for (x=1;x<=N;x++)
		{
			if(x%2==1) sum++;
		}
	y=sum;	   
	y/=N;
 	sum=0;
	printf("%.10lf\n",y);
	   
	return 0;	
 } 

Measured memory_bytes: 128
#include<bits/stdc++.h>
                using namespace std;
                int main()
                {
                  string s;
                  int n;
                  cin>>n>>s;
                  int cnt=0;
                  for(int i =0; i < n; i++)
                  {
                    if((s[i]=='A')&&(s[i+1]=='B')&&(s[i+2]=='C'))
                    {
                      cnt++;
                    }
                    
                }
                  cout<<cnt<<"\n";
                }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct po{int y,x;};
int w,h,dx[]={0,0,1,-1},dy[]={1,-1,0,0};
string mp[61];
queue <po> Q;
int xl,xr;
double sum,cnt;

void dfs(int y,int x,int used[62][11]){
  if(used[y][x]++)return;
  sum+=x+0.5,cnt++;

  int ch=mp[y][x];
  if(mp[y+1][x]!=ch&&mp[y+1][x]!='.')xl=min(xl,x),xr=max(xr,x);
  if(y-1>=0&&mp[y-1][x]!=ch&&mp[y-1][x]!='.') Q.push(po{y-1,x});
  for(int i=0;i<4;i++){
    int nx=x+dx[i],ny=y+dy[i];
    if(!(nx<0||ny<0||nx>=w||ny>=h||mp[ny][nx]!=ch))dfs(ny,nx,used);
  }
}

bool check(int l,int r){
  int used[62][11]={};
  while(!Q.empty())dfs(Q.front().y,Q.front().x,used),Q.pop();
  double g=sum/cnt;
  return l<g&&g<r;
}

string solve(){
  int used[62][11]={};
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++){
      if(mp[i][j]=='.'||used[i][j])continue;
      xl=100,xr=-1;
      sum=cnt=0;
      dfs(i,j,used);
      if(!check(xl,xr+1))return "UN";
    }
  return "";
}

int main(){
  while(1){
    cin>>w>>h;
    if(!h&&!w)break;
    for(int i=0;i<h;i++)cin>>mp[i];
    mp[h]="###########";
    cout <<solve()<<"STABLE"<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--) 
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define downque(que) priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;
typedef vector<vector<int>> Matrix;
const int MOD = 1e9 + 7;
const int MAX = 1e7;
const int INF = numeric_limits<int>::max();

bool kaibun(string s){
  string s1,s2;
  REP(i,s.size())s1+=s[i];
  REPR(i,s.size()-1)s2+=s[i];
  return s1==s2;
}

int main(){
string s; cin>>s; 
bool res=0;
int n=s.size();

if(kaibun(s)){
  if(kaibun(s.substr(0,(n-1)/2))&&kaibun(s.substr((n+3)/2-1)))res=1;
  //cout<<s.substr(0,(n-1)/2)<<" "<<s.substr((n+3)/2-1)<<endl;
}

    if(res)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define sp(x) setprecision(x)
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define mex 1000005
int sei[mex],pri[mex];

inline ll binex(ll a,ll b)
{
    ll ans=1,temp=a%mod;
    while(b!=0){
        if(b&1) ans=(ans*temp)%mod;
        temp=(temp*temp)%mod;
        b=b>>1;
    }
    return ans;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    for(int i=0;i<mex;i++) sei[i]=i;
    sei[0]=-1; sei[1]=-1;
    for(int i=0;i<mex;i++){
        if(sei[i]==i){
            for(int j=2*i;j<mex;j+=i) sei[j]=i;
        }
    }
    int n; cin>>n;
    int arr[n];
    for(int i=0;i<n;i++){
        cin>>arr[i];
        int x=arr[i];
        while(x!=1){
            int y=sei[x],cnt=0;
            while(x%y==0){
                x/=y;
                cnt++;
            }
            pri[y]=max(pri[y],cnt);
        }
    }
    //for(int i=0;i<100;i++) cerr<<pri[i]<<" "; cerr<<endl;
    ll lcm=1;
    for(int i=1;i<mex;i++){
        if(sei[i]==i) lcm=(lcm*binex(i,pri[i]))%mod;
    }
    ll ans=0;
    for(int i=0;i<n;i++){
        ll x=lcm*binex(arr[i],mod-2);
        ans=(ans+x)%mod;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 7808
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>
#include <iomanip>
#include <unordered_map>
#include <map>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
typedef long double ld;
const char sp = ' ';

using namespace boost::multiprecision;
using namespace std;

int main(void){
    ll N, Q;
    string S;
    cin>>N>>Q>>S;
    ll l, r;
    ll L[200000], R[200000];
    ll flag=0;
    L[0]=0;
    R[0]=0;
    rep1(i, N){
        bool changedr=false, changedl=false;
        if(i!=1) if(S[i-2]=='A' && S[i-1]=='C'){
            R[i]=R[i-1]+1; changedr=true;
        }
        if(i!=N-1) if(S[i-1]=='A' && S[i]=='C'){
            L[i]=L[i-1]+1; changedl=true;
        }
        if(!changedr) R[i]=R[i-1];
        if(!changedl) L[i]=L[i-1];
        //cout<<L[i]<<sp<<R[i]<<endl;
    }
    rep(i, Q){
        ll l, r;
        cin>>l>>r;
        cout<<R[r]-L[l-1]<<endl;
    }
    return 0;
}


Measured memory_bytes: 3712
#include <iostream>
using namespace std;
int main(){
  string s;
  cin>>s;
  if((s[0]==s[1]&s[0]==s[2])||s[1]==s[2]&s[1]==s[3]){
    cout<<"Yes";
  }else{
    cout<<"No";
  }
  return 0;
}
  
  

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <deque>
#include <bitset>
#include <climits>
using namespace std;

#define ll long long int
#define F(a,n) for(int i=0;i<n;i++){cin>>a[i];}
#define F1(a,n) for(int i=1;i<=n;i++){cin>>a[i];}
#define P(a,n) for(int i=0;i<n;i++){cout<<a[i]<<' ';}cout<<endl;
#define P1(a,n) for(int i=1;i<=n;i++){cout<<a[i]<<' ';}cout<<endl;
#define NF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cin>>a[i][j];}}
#define NF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cin>>a[i][j];}}
#define PNF(a,n,m) for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define PNF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define AS 200001
#define Size 100001
ll *weight,*price;
ll dp[101][Size];
ll n,capacity;

ll Knapsack2(ll max_profit){

	ll inf = 1e11;
	for(ll N = 0;N<=n;N++){
		for(ll Profit = 0;Profit<=max_profit;Profit++){
			if(N == 0 && Profit == 0){
				dp[N][Profit] = 0;
			}
			else if (N == 0) dp[N][Profit] = inf;
			else if(price[N-1]<=Profit){
				dp[N][Profit] = min(weight[N-1]+dp[N-1][Profit-price[N-1]],dp[N-1][Profit]);
			}	
			else{
				dp[N][Profit] = dp[N-1][Profit];
			}
		}
	}

	ll ans = 0;
	for(ll Profit=0;Profit<=max_profit;Profit++){
		if(dp[n][Profit]<=capacity) ans = Profit;
	}
	return ans;
}

int main(){
	cin>>n>>capacity;
	weight = new ll[n];
	price = new ll[n];
	ll max_profit = 0;
	for(int i=0;i<n;i++){
		cin>>weight[i]>>price[i];
		max_profit += price[i];
	}

	cout<<Knapsack2(max_profit)<<endl;

	return 0;
}

Measured memory_bytes: 79104
// #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2")

#include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <chrono>
#include <vector>
#include <map>
#include <random>
#include <set>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <deque>
#include <cassert>
#include <stack>
using namespace std;

#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ppb pop_back
#define ll long long
#define ull unsigned long long
#define cntbit(x) __builtin_popcount(x)
#define endl '\n'
#define uset unordered_set
#define umap unordered_map
#define all(x) x.begin(), x.end()
#define pii pair<int, int>
#define ld long double
#define pll pair<long long, long long>

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

inline void setin(string s) {
	freopen(s.c_str(), "r", stdin);
}

inline void setout(string s) {
	freopen(s.c_str(), "w", stdout);
}

template <typename T> inline T range(T l, T r) {
	return uniform_int_distribution <T>(l, r)(rng);
}

template <typename T> void Min(T &a, T b) {
    a = min(a, b);
}
 
template <typename T> void Max(T &a, T b) {
    a = max(a, b);
}

struct edge {
	int u, v, c;
};

const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const int N = 5e5 + 15;
int n, m, a[N];
vector <edge> e;
vector <int> is[N];
vector <pii> g[N], gr[N];
map <int, int> ind[N];
pii back[N];

int cnt;

int uniq[N];

set <pii> q;
int d[N];

main() {
	ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
	// setin("input.txt");
	cin >> n >> m;
	for(int i = 1; i <= m; ++i) {
		int u, v, c;
		cin >> u >> v >> c;
		is[u].pb(c);
		is[v].pb(c);
		e.pb({u, v, c});
	}
	for(int i = 1; i <= n; ++i) {
		uniq[i] = ++cnt;
		back[cnt] = {inf, inf};
	}
	for(int i = 1; i <= n; ++i) {
		if(is[i].empty())
			continue;
		sort(is[i].begin(), is[i].end());
		is[i].erase(unique(is[i].begin(), is[i].end()), is[i].end());
		for(int j : is[i]) {
			back[++cnt] = {i, j};
			ind[i][j] = cnt;
		}
	}
	for(int i = 0; i < m; ++i) {
		int u = e[i].u, v = e[i].v, c = e[i].c;
		g[ind[u][c]].pb({ind[v][c], 0});
		g[ind[v][c]].pb({ind[u][c], 0});
	}
	for(int i = 1; i <= n; ++i) {
		for(pii it : ind[i]) {
			g[it.se].pb({uniq[i], 0});
			g[uniq[i]].pb({it.se, 1});
		}
	}
	q.insert({0, uniq[1]});
	memset(d, 0x3f, sizeof(d));
	d[uniq[1]] = 0;
	while(!q.empty()) {
		int v = q.begin()->se;
		q.erase(q.begin());
		for(int i = 0; i < g[v].size(); ++i) {
			int to = g[v][i].f, w = g[v][i].se;
			if(d[to] > d[v] + w) {
				q.erase({d[to], to});
				d[to] = d[v] + w;
				q.insert({d[to], to});
			}
		}
	}
	int ans = inf;
	for(int i = 1; i <= cnt; ++i)
		if(back[i].f == n)
			Min(ans, d[i]);
	cout << (ans == inf ? -1 : ans) << endl;
	return 0;
}

Measured memory_bytes: 118192
#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define debug  freopen("in.txt","r",stdin),freopen("out.txt","w",stdout);
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn = 1e6+10;
using namespace std;

int N;
ll w[maxn];
ll f[3030][3030]; // = X-Y

ll solve(){
    for(int i = 1;i<=N;i++) f[i][i] = w[i];
    for(int len = 2;len<=N;len++){
        for(int i = 1;i<=N-len+1;i++){
            int j = i+len-1;
            f[i][j] = max(f[i][j],w[i] - f[i+1][j]);
            f[i][j] = max(f[i][j],w[j] - f[i][j-1]);
        }
    }
    return f[1][N];
}

int main(){
    // debug;
    ios;

    cin>>N;
    for(int i = 1;i<=N;i++) cin>>w[i];
    for(int i = 1;i<=N;i++) for(int j = 1;j<=N;j++) f[i][j] = -1e18;
    cout<<solve()<<'\n';
    
    return 0;
}


Measured memory_bytes: 73984
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

int main(){
    int64_t X,Y,A,B,C;
    cin >> X >> Y >> A >> B >> C;
    vector<int64_t> p(A);
    vector<int64_t> q(B);
    vector<int64_t> r(C);
    for ( int64_t i = 0; i < A; ++ i){
        cin >> p.at(i);
    }
    for ( int64_t i = 0; i < B; ++ i){
        cin >> q.at(i);
    }
    for ( int64_t i = 0; i < C; ++ i){
        cin >> r.at(i);
    }
    
    sort(p.begin(),p.end(),greater<int64_t>());
    sort(q.begin(),q.end(),greater<int64_t>());
    
    for ( int64_t i = 0; i < X; ++ i){
        r.push_back(p.at(i));
    }
    for ( int64_t i = 0; i < Y; ++i){
        r.push_back(q.at(i));
    }
    int64_t res = 0;
    sort(r.begin(),r.end(),greater<int64_t>());
    
    for ( int64_t i = 0; i < ( X + Y ); ++i ){
        res += r.at(i);
    }
    cout << res << endl;
    
    return 0;
}


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

int main() {
	int a, b;
	int c, d;
	cin >> a >> b >> c >> d;
	if (a*b > c*d) {
		cout << a * b;
	}
	else {
		cout << c * d;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {

fast();

{int a,b;
cin>>a>>b;
if(a<=b)
{
  cout<<a<<endl;
}
else
{
  cout<<a-1<<endl;
}
}
return 0;
}


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

int main(){
    int q; cin >> q;
    set<int> a;
    decltype(a)::iterator itr1;
    decltype(a)::iterator itr2;
    rep(i ,q){
        int m , x , y;
        cin >> m >> x;
        switch (m)
        {
        case 0: 
            a.insert(x);
            cout << a.size() << endl; 
            break;
        case 1:
            itr1 = a.find(x);
            cout << (itr1!=a.cend() ? 1 : 0) << endl;
            break;
        case 2:
            a.erase(x);
            break;
        case 3:
            cin >> y;
            if(a.empty()) break;
            else { 
                set<int>::iterator itr1,itr2;
                itr1 = a.lower_bound(x);
                itr2 = a.upper_bound(y);
                set<int>::iterator it = itr1;
                while(it != itr2){
                    cout << *(it++) << endl;
                }
            }
            break;
        }
    }
}


Measured memory_bytes: 12444
n = int(input())
x = list(map(int, input().split()))

goal = 2019

v = [i in x for i in range(goal+1)]

int(input())
for a in map(int, input().split()):
    count = 0
    for i in range(goal + 1):
        if v[i]:
            count += 1
            if count == a:
                break

    if i < goal and v[i + 1] is False:
        v[i] = False
        v[i+1] = True

for i in range(goal + 1):
    if v[i]:
        print(i)



Measured memory_bytes: 5628
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<stdlib.h>
#include<queue>
#include<stack>
#include<cstring>
#include<math.h>
#include<string>
#include<vector>
#include<map>
#include<numeric>
#include<set>
#include<unordered_map>
using namespace std;
typedef long long ll;
int main()
{
   ll a[20][20];
   int n,m;
   cin>>n>>m;
   for(int i=1;i<=n;i++)
   {
       for(int j=1;j<=m;j++)
        scanf("%d",&a[i][j]);
   }
   int ans=0;
   for(int i=1;i<=n;i++)
   {
       for(int j=i+1;j<=n;j++)
       {
           int num=0;
           for(int k=1;k<=m;k++)
           {
               num+=(a[i][k]-a[j][k])*(a[i][k]-a[j][k]);
           }
//           cout<<sqrt(num)<<" "<<num<<endl;
           if(sqrt(num)==(int)sqrt(num))
            ans++;
       }
   }
   cout<<ans<<endl;
}


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

int main(){
    ll a, b, v, w,t;
    cin >>a>>v>>b>>w>>t;
    
    if(a>b){
        ll c =a;
        a=b;
        b=c;
    }
    
    if(w>v)
        cout << "NO" <<endl;
    else{
        if(b-a <= t*(v-w))
            cout << "YES" <<endl;
        else
            cout << "NO"<<endl;
        
    }
    
    
}


Measured memory_bytes: 3596
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var list = new List<int>();
            var continuous = 1;
            
            for (var i = 1; i < n; i++) {
                if (a[i] == a[i - 1]) continuous++;
                else {
                   list.Add(continuous);
                   continuous = 1; 
                }
            }
            list.Add(continuous);
            var ans = list.Where(z => z >= 2).Select(z => z / 2).Sum();
            
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13396
using System;
using System.Threading;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var n = Int32.Parse(input[0]);
            var a = Int32.Parse(input[1]);
            var b = Int32.Parse(input[2]);
            var count = 0;
            var result = 0;

            for(int i = 1; i < n + 1; i++)
            {
                count = 0;
                var charArray = i.ToString().ToCharArray();
                foreach(char c in charArray)
                {
                    count += Int32.Parse(c.ToString());
                }
                if (count >= a && count <= b) result += i;
            }

            Console.WriteLine(result);
        }
    }
}


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

int main() {
    
    int N;
    string S;
    cin >> N >> S;
    
    int ans = 0;
    
    
    while( S.find("ABC") != string::npos ){
        ans++;
        int posi_ABC = S.find("ABC");
        S.erase(posi_ABC, 3);
    }
    
    cout << ans << endl;
    
}

Measured memory_bytes: 256
ans=[]
a,b,c,d,e,f=map(int,input().split())
for i in range(31):
	for j in range(16):
		for k in range(101):
			for l in range(51):
				if (i*a+j*b)*100+(c*k+d*l)<=f and \
				c*k+d*l<=e*(i*a+j*b):
					p=c*k+d*l
					q=p+100*(i*a+j*b)
					if 100*(i*a+j*b)!=0:
						ans.append([100*p/q,p,q])
ans.sort()
print(ans[-1][2],ans[-1][1])





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

int V;
int d[101];
int s; 
vector<edge> es[101];

void dijkstra(int s)
{
	fill(ALL(d), INF);
	d[s] = 0;
	priority_queue<P, vector<P>, greater<P>> que;
	que.push(P(0, s));
	while (!que.empty())
	{
		P p = que.top(); que.pop();
		int v = p.second;
		if (d[v] < p.first) continue;
		REP(i, es[v].size())
		{
			edge e = es[v][i];
			if (d[e.to] > d[v] + e.cost)
			{
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}

int main()
{
	int n;
	scanf("%d\n", &n);
	map<string, int> m;
	vs code;
	REP(i, n)
	{
		string s;
		cin >> s;
		if (s == "goto")
		{
			string lab;
			cin >> lab;
			code.push_back(lab);
		}
		else
		{
			s[s.size() - 1] = ';';
			m[s] = i;
			code.push_back("");
		}
	}
	REP(i, n)
	{
		if (code[i] == "")
		{
			es[i].push_back(edge{ i, i + 1, 0 });
		}
		else
		{
			es[i].push_back(edge{ i, i + 1, 1 });
			es[i].push_back(edge{ i, m[code[i]], 0 });
		}
	}
	dijkstra(0);
	cout << d[n] << endl;
	return 0;
}

Measured memory_bytes: 1280
#include "bits/stdc++.h"
using namespace std;

#define show(x) cerr << #x << " = " << x << endl ;
#define input_from_file freopen("input.txt","r",stdin)
#define output_to_file freopen("output.txt" , "w",stdout)
#define fastio ios_base::sync_with_stdio(0)
#define endl '\n'

const int N = 22 , mod = 1e9+7;
bool aij[N][N];
int dp[1 << N];
int main()
{
	 #ifdef LOCAL
        input_from_file;
        output_to_file;
    #endif
	fastio;cin.tie(0);cout.tie(0);
	int n ; cin >> n ;
	for(int i = 1 ; i <= n ; ++i)
		for(int j = 0 ; j < n ; ++j)
			cin >> aij[i][j];
		dp[0] = 1;
	for(int i = 0 ; i < (1 << n) ; ++i)
	{
		int x = __builtin_popcount(i);
		for(int j = 0 ; j < n ; ++j)
		{
			if(!(i&(1<<j)) && aij[x+1][j])
				dp[i^(1<<j)] = ((long long)(dp[i^(1<<j)] + dp[i]))%mod;
		}
	
	}

	cout << dp[(1<<n) - 1];




	return 0;
}

Measured memory_bytes: 10496
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <cmath>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long 

int main() {
 int N;
 ll D;
  cin >> N >> D;
  D = D * D;
  ll x, y;
  int cnt = 0;
  rep(i, N){
    cin >> x >> y;
    if(x*x + y*y <= D)
      cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3604
from functools import reduce
def nCr(n,r,DIV):
  if r<n-r:
    r=n-r
  if r==0:
    return 1
  f=lambda x,y:x*y%DIV
  X=reduce(f,range(n-r+1,n+1))
  Y=reduce(f,range(1,r+1))
  return X*pow(Y,DIV-2,DIV)%DIV

n, k = map(int, input().split())
mod = pow(10, 9) + 7
for i in range(k):
    ans = -1
    if i+1 > n-k+1:
        ans = 0
    else:
        ans = (nCr(k - 1, i, mod) * nCr(n - k + 1, i + 1, mod)) % mod

    print(ans)

Measured memory_bytes: 9488
#include <bits/stdc++.h>
 
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
typedef std::vector<long> LI;
typedef std::queue<long> QI;
#define rep(i,n) for(long i = 0; i < (long)n; ++i)
const double pi = M_PI;
// const long mod = 1000000007;
const long mod = 1777777777;
 
template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(long& x) { if( scanf("%ld", &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
template<> void scan1(LI& xs) { for(long &x : xs) scan1(x); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}
 
struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   void solve() {
      long q, h, s, d; scan(q, h, s, d);
      long n; scan(n);
      long x = std::min(std::min(q*4, h*2), s);
      long y = d;
      long res = 0;
      if( 2 * x <= y ) {
         res = n * x;
      }
      else {
         res = (n / 2 * y) + (n % 2) * x;
      }
      printf("%ld\n", res);
   }
};
 
int main() {
   loop std::unique_ptr<Solver>(new Solver())->solve();
}
 

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
ans=1
zero=0
for i in range(n):
    if (ans!=-1): ans*=a[i]
    if (ans>pow(10,18)): ans=-1
    if (a[i]==0): zero=1
if (zero==0): print(ans)
else: print(0)


Measured memory_bytes: 21652
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# sys.setrecursionlimit(int(pow(10, 2)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]
# @lru_cache(None)






n,m=l()
T=1900*m+100*(n-m)
p=2**m
ans=T*p
print(ans)


Measured memory_bytes: 5120
#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;




int main(void) {
  ll N;
  cin >> N;
  ll i;
  ll a[MAX*2];
  
  for(i=0; i<N; i++) {
    cin >> a[i];
  }
  a[N]=a[N-1];
  
  if(a[0]) {
    pt(-1);
    return 0;
  }
  
  for(i=0; i<N-1; i++) {
    if(a[i+1]-a[i]>1) {
      pt(-1);
      return 0;
    }
  }
  
  ll ans=0;
  ll t=0;
  for(i=N-1; i>=1; i--) {
    if(a[i]>=a[i+1]) {
      ans+=a[i];
    }
  }
  
  pt(ans);
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 0; i < n; ++i)
#define rep3(i, a, b) for (ll i = a; i < b; ++i)
#define rep4(i, a, b, c) for (ll i = a; i < b; i += c)
#define erep(n) for (ll i = 0; i <= n; ++i)
#define erep2(i, n) for (ll i = 0; i <= n; ++i)
#define erep3(i, a, b) for (ll i = a; i <= b; ++i)
#define erep4(i, a, b, c) for (ll i = a; i <= b; i += c)
#define rrep(i, a, b) for (ll i = a; i > b; --i)
#define rrep2(i, a, b, c) for (ll i = a; i > b; i -= c)
#define errep(i, a, b) for (ll i = a; i >= b; --i)
#define errep2(i, a, b, c) for (ll i = a; i >= b; i -= c)
#define print(a) cout << a << endl;
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define cin(x) cin >> x;
const ll MOD = 1000000007;
inline int newline() { putchar('\n'); return 0; }

int main() {
    ll n, m;
    cin(n);
    cin(m);

    if (n == m) {
        print("Yes");
    } else {
        print("No");
    }

    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())


N,M = inpl()
lines = defaultdict(set)
incnts = [0]*N
for _ in range(N+M-1):
    x,y = inpl()
    x,y = x-1,y-1
    lines[x].add(y)
    incnts[y] += 1

s = incnts.index(0)
ans = [-1]*N
ans[s] = -1

q = queue.Queue()
q.put(s)
while not q.empty():
    s = q.get()
    for t in lines[s]:
        incnts[t] -= 1
        if incnts[t] == 0:
            ans[t] = s
            q.put(t)

for a in ans:
    print(a+1)


Measured memory_bytes: 87256
#include <iostream>
using namespace std;
int main(void){
  int a,b,x,e,f,w;
  cin>>a>>b>>x;

  e=0;
  f=0;
  w=0;
  if((a*1)==(b*2)){
        if(x<=500){
    f=1;
    
  }
  if(x>500){
  if(x%1000==0){
      e=x/1000;
  }
  if((x%1000)>0&&(x%1000)<=500){
      f=f+1; 
  }
  if(x<1000&&x>=500){
      e=1;
  }
  if(x>=1000){
  if(x%1000>0){
      e=x/1000;
  }
  }

  }
  w=(e*a)+(f*b);
  cout<<w<<endl;
  }
  
  
  
  
  
  
  
  if(a==b){
      if(x<=1000){
          e=1;
      }
  if(x>1000){
      if(x%1000==0){
      e=x/1000;    
      }
      if(x%1000>0){
          e=(x/1000)+1;
      }
  }
  cout<<e*a<<endl;
  }
  
  
  
  
  else{
            if(a<b){
                if(x<=999){
                    e=e+1;
                }
          if(x%1000==0){
              e=x/1000;
          }
          if(x%1000>0){
              e=(x/1000)+1;
          }
          cout<<e*a<<endl;
            }
            
            
            
            
            
            
  if((a*1)<(b*2)&&a>b){
      if(a<b){
          if(x/1000==0){
              e=e+1;
          }
          if(x%1000){
              e=(x/1000)+1;
          }
      }
      
  
  if(x<=500){
    f=1;
    
  }
  if(x<=1000&&x>500){
      e=e+1;
  }
  else if(x>500){
    e=x/1000;
  
  if(x%1000>0&&x%1000<=500){
    f=f+1;
  }
  if(x%1000>500){
      e=e+1;
  }
  }
  w=(f*b)+(e*a);

cout<<w<<endl;
  }
  
  
  
  
  
  

 if((a*1)>(b*2)){
    if(x%500==0){
      f=x/500;
    }
    else if(x%500>0){
      f=(x/500)+1;
    }
    if(x<=500){
      f=1;
    }
    cout<<f*b<<endl;
  }
  }
}


Measured memory_bytes: 3092
// by adiforluls
#pragma GCC optimize ("-O2")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define FAST         ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll           long long
#define ld           long double
#define pb           push_back
#define mp           make_pair
#define pii          pair<int,int>
#define mii          map<int,int>
#define vi           vector<int>
#define vll          vector<long long>
#define all(a)       (a).begin(),(a).end()
#define clz(a)       __builtin_clz(a) // count leading zeroes
#define ctz(a)       __builtin_ctz(a) // count trailing zeroes
#define popc(a)      __builtin_popcount(a) // count set bits (for ints only diff for ll)
#define lul          1000000007
#define rep(i,a,b)   for(int i=a;i<b;i++)
#define rfor(i,a,b)  for(int i=a; i>=b; i--)
#define SIZE         1000005
#define F            first
#define S            second
#define mod          998244353
 
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " = " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " = " << arg1<<" |";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define endl         '\n'
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
// order_of_key(k)
// find_by_order(k)
const ld PI = acos(-1.0);
const int INF = 0x3f3f3f3f;

void solve()
{
    int n; cin>>n;
    vi a(n);
    rep(i,0,n) cin>>a[i];
    vi dp(n);
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
    rep(i,2,n) dp[i] = min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
    cout<<dp[n-1];
}
int main()
{   
    FAST;
   //  #ifndef ONLINE_JUDGE
     // freopen("input.txt", "r", stdin);
     // freopen("output.txt", "w", stdout);
   //  #endif
    int t; t=1; //cin>>t;
    while(t--){
       solve();
    }
    return 0;
}

Measured memory_bytes: 1024
import java.util.*;
import java.io.*;
public class Main{

     public static void main(String []args) throws IOException{
       
       BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
       
        String a[] = br.readLine().split(" ");
       
        int n = Integer.parseInt(a[0]);
        int m = Integer.parseInt(a[1]);
        Set<Integer> set = new HashSet<>();
        int height[] = new int[n];
        a = br.readLine().split(" ");
        int i=0;
        for(String x:a) height[i++] = Integer.parseInt(x);
        
        int maxHeight[] = new int[n];
        while(m-->0) {
            String temp = br.readLine();
            a = temp.split(" ");
            int x = Integer.parseInt(a[0]);
            int y = Integer.parseInt(a[1]);
            maxHeight[x-1] = Math.max(maxHeight[x-1],height[y-1]);
            maxHeight[y-1] = Math.max(maxHeight[y-1],height[x-1]);
        }
        int count = 0;
        for( i=0;i<maxHeight.length;i++) if(maxHeight[i]<height[i])count++;
        
      
        System.out.println(count);
       
     }
}


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

typedef long long ll;
#define reg register
#define rep(i,a,b) for(int i=a,i##end=b;i<=i##end;++i)
#define drep(i,a,b) for(int i=a,i##end=b;i>=i##end;--i)

char IO;
int rd(){
	int s=0,f=0;
	while(!isdigit(IO=getchar())) if(IO=='-') f=1;
	do s=(s<<1)+(s<<3)+(IO^'0');
	while(isdigit(IO=getchar()));
	return f?-s:s;
}

const int N=5e5+10;

int n;
int a[N];
int b[N];

vector <int> V;

int main(){
	rep(i,1,n=rd()) a[i]=rd();
	drep(i,n,1){
		if(a[i]!=b[i]) {
			V.push_back(i);
			rep(j,1,sqrt(i)) if(i%j==0){
				b[j]^=1;
				if(j*j!=i) b[i/j]^=1;
			}
		}
	}
	sort(V.begin(),V.end());
	cout<<V.size()<<endl;
	rep(i,0,V.size()-1) {
		printf("%d",V[i]);
		putchar(i==(int)V.size()-1?'\n':' ');
	}
}



















Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;

using Graph = vector<vector<ll>>;

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; }

#define MAX_N 2010

const long long INF = 1LL << 60;

//境界値に注意！！！

int main() {
    ll n,ans=0;
    cin >> n;
    if (n%2!=0){
        ans=n;
        ans=ans*((n-1)/2);
        cout << ans << endl;
        return 0;
    }
    ans=n+1;
    ans=ans*((n)/2);
    ans=ans-n;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int i,n;
	char x[1050];
	
	x[0]='1';
	for(;x[0]!='0';){
		
		n=0;
		scanf("%s",x);
		
		for(i=0;x[i]!='\0';i++){
			
			if(x[i]=='1'){
				
				n=n+1;
			}
			else if(x[i]=='2'){
				
				n=n+2;
			}
			else if(x[i]=='3'){
				
				n=n+3;
			}
			else if(x[i]=='4'){
				
				n=n+4;
			}
			else if(x[i]=='5'){
				
				n=n+5;
			}
			else if(x[i]=='6'){
				
				n=n+6;
			}
			else if(x[i]=='7'){
				
				n=n+7;
			}
			else if(x[i]=='8'){
				
				n=n+8;
			}
			else if(x[i]=='9'){
				
				n=n+9;
			}
			else n=n;
		}
		if(n!=0){
			
			printf("%d\n",n);
		}
	}
	return 0;
}

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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using P = pair<int, int>;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

void solve() {
  int h, w, k;
  cin >> h >> w >> k;
  vvi c(h, vi(w));
  rep(i, h) {
    string s;
    cin >> s;
    rep(j, w) if (s[j] == '#') c[i][j] = 1;
  }
  ll ans = 0;
  for (int i = 0; i < (1 << h); i++) {
    for (int j = 0; j < (1 << w); j++) {
      int cnt = 0;
      rep(y, h) rep(x, w) {
        if ((i >> y) & 1) continue;
        if ((j >> x) & 1) continue;
        if (c[y][x]) cnt++;
      }
      if (cnt == k) ans++;
      dump(i, j, cnt, ans);
    }
  }
  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

Measured memory_bytes: 3656
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

A, B, N = mi()

if N >= B:
    print(A*(B-1)//B)
else:
    print(A*N//B)

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

void solve(std::string S, std::string T) { cout << T + S << endl; }

int main() {
    std::string S;
    std::cin >> S;
    std::string T;
    std::cin >> T;
    solve(S, T);
    return 0;
}


Measured memory_bytes: 3608
class Array
def insert k
x,l,r=self
x ?(k<x ?l:r).insert(k):self<<k<<[]<<[]
end
def find k
puts f(k) ?:yes: :no
end
def f k
x,l,r=self
x&&(k==x||(k<x ?l:r).f(k))
end
def print
$x,$y=[p],[p]
w
puts $y*" ",$x*" "
end
def w
x,l,r=self
x&&($x<<x
l.w
$y<<x
r.w)
end
end
t=[]
gets
eval"t.#$_"while gets

Measured memory_bytes: 94472
#include<bits/stdc++.h>
#define ll long long
#define f  first
#define s  second
#define Tsetso ios_base::sync_with_stdio(0) ; cin.tie(0) ;
using namespace std;
const int  N = 3010, mod = 1e9+7, inf = 2e9 ;
ll dp[N][N], mx = 0, vis1[N], vis2[N];
int main()
{
    Tsetso
    string s, t ;
    cin >> s >> t ;
    int n =s.size(), m =t.size();
    for ( int i = 1 ; i <= n ; i++)
        for ( int j = 1 ; j <= m;  j++)
        {
            if ( s[i-1] == t[j-1])
                dp[i][j] = dp[i-1][j-1]+1;
            else
                dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
        }
    int z = dp[n][m] ;
    string ans ;
    for ( int i = n; i >= 1 ; i-- )
        for ( int j = m ; j >= 1 ; j--)
            if ( t[j-1] == s[i-1] && dp[i][j] == z && !vis1[i] && !vis2[j])
                ans += t[j-1], z--, vis1[i] = 1, vis2[j] = 1 ;
    reverse(ans.begin(),ans.end());
    cout << ans ;
}


Measured memory_bytes: 74232
def check():
  N = int(input())
  A = list(map(int, input().split()))
  B = list(map(int, input().split()))
  diff = sum(B)-sum(A)
  if diff < 0:
    return 'No'
  cnt = 0
  for i in range(N):
    cnt += max((B[i]-A[i]+1)//2,0)
  if diff < cnt:
    return 'No'
  return 'Yes'
print(check())

Measured memory_bytes: 10596
S =list(input())
#print(S)
wdict = {}
for w in S:
    if w in wdict:
        wdict[w] += 1
    else:
        wdict[w] = 1
#print(wdict.values())
cnt = 0
for i in wdict.values():
    if i == 2:
        cnt +=1

if len(wdict.keys()) == 2 and cnt == 2:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int n, c;
	cin >> n >> c;
	n++;
	int sum = 0;
	for(int i = 0; i < c; i++){
		int p;
		cin >> p;
		sum += p;
	}
	int ans = sum / n;
	if(sum % n > 0) ans++;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3092
#include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <math.h>
#include <algorithm>
using namespace std;
#define ll long long
int main()
{
    ll sum=0,h,t=0;
    cin>>h;
    while(h!=0)
    {
        h/=2;
        t++;
    }
    sum=pow(2,t)-1;
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MOD=1e9+7;
static const ll MAX=101010;

/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/

ll mem[111][111];

ll C(ll n, ll k) {
  if(n<k||n<0||k<0) return 0;
  if(k==0) return 1;
  if(n==k) return 1;
  if(mem[n][k]!=-1) return mem[n][k];
  return mem[n][k]=C(n-1, k)+C(n-1, k-1);
}


int main(void) {
  ll i, j, k, l;
  
  memset(mem, -1, sizeof(mem));
  
  ll N, A, B;
  cin >> N >> A >> B;
  ll v[55];
  
  for(i=0; i<N; i++) cin >> v[i];
  sort(v, v+N);
  reverse(v, v+N);
  
  ll ans=0;
  ll s=0, t=0;
  for(i=0; v[i]!=v[A-1]; i++) {
    ans+=v[i];
    s++;
  }
  for(i=0; i<N; i++) if(v[i]==v[A-1]) t++;
  
  ans+=v[A-1]*(A-s);
  printf("%.10f\n", (double)ans/A);
  
  if(s) {
    pt(C(t, A-s));
  }else {
    ll c=0;
    for(i=A; i<=min(B, t); i++) c+=C(t, i);
    pt(c);
  }
  
  
  
}




Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main(){
  string k;
  cin>>k;
  if(k=="MON"){
  cout<<"6";
  }
   else if(k=="TUE"){
  cout<<"5";
  }
   else if(k=="WED"){
  cout<<"4";
  }
  else if(k=="THU"){
  cout<<"3";
  }
  else if(k=="FRI"){
  cout<<"2";
  }
  else if(k=="SAT"){
  cout<<"1";
  } 
  else {
  cout<<"7";
  }
  return 0;
  
}

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

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

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

//https://atcoder.jp/contests/keyence2020/tasks/keyence2020_d

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;

#define rep(a,n) for(int a = 0;a < n;a++)
#define repi(a,b,n) for(int a = b;a < n;a++)

const ull mod = (ull)1e9 + 7;

int main(void)
{
	ll n, m;
	cin >> n >> m;
	cout << (n == m ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
#define inf 0x3f3f3f3f
const ll N = 500030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =    998244353;


int main()
{
	ios_base::sync_with_stdio(false);
	    cin.tie(NULL);
string s;
ll x1,y1;
cin>>s>>x1>>y1;
int n=s.size();
bool Bool=false;
if(s[0]=='T')
Bool=true;
set<ll> s1,s2;
int y=0;
int x=0;
while(x<n)
{

	if(s[x]=='T')
	{

	y^=1;
	x++;}
	else
	{
		ll cnt=0;
		while(x<n&&s[x]!='T')
		{
			cnt++;
			x++;
		}
	//	cout<<y<<" "<<cnt<<endl;
		if(y==0)
		{
	   bool bo=false;
	    vector<ll> v;
		for(auto it=s1.begin();it!=s1.end();it++)
		{

			v.push_back(*it+cnt);

			v.push_back(*it-cnt);
		  bo=true;
		}
		set<ll> sett;
		for(int i=0;i<v.size();i++)
		{
		sett.insert(v[i]);

		}
		s1=sett;
		if(!bo)
		{
		 if(Bool )
		 s1.insert(-cnt);
		s1.insert(cnt);}
	}
	else
	{
		bool bo=false;
			vector<ll> v;
		for(auto it=s2.begin();it!=s2.end();it++)
		{
			bo=true;

			v.push_back(*it+cnt);
			v.push_back(*it-cnt);
		}
		set<ll> sett;
		for(int i=0;i<v.size();i++)
		sett.insert(v[i]);
		s2=sett;
		if(!bo)
		{
			s2.insert(cnt);
			s2.insert(-cnt);
		}

	}
}
}
bool c=false; bool d=false;
if(s1.find(x1)!=s1.end()||(s1.size()==0&&x1==0))
c=true;
if(s2.find(y1)!=s2.end()||(s2.size()==0&&y1==0))
d=true;
if(c&&d)
cout<<"Yes";
else
cout<<"No";

}


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

int main() {
	int N,L; cin >> N >> L;
	vector<int> a(N);
    for(auto&e:a) cin >> e;
	for(int i=1;i<N;++i) {
		if(a[i-1]+a[i]>=L) {
			cout << "Possible" << endl;
			for(int j=1;j<i;++j) cout << j << endl;
			for(int j=N-1;j>=i;--j) cout << j << endl;
			return 0;
		}
	}
	cout << "Impossible" << endl;
	
	return 0;
}


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

int main()
{
	int n;
	while(cin >> n){
		int area=0;
		if(n==0)
			area = 0;
		else if(n==1)
			area = 2;
		else if(n==2)
			area = 4;
		else if(n==3)
			area = 7;
		else{
			area = 7;
			for(int i=3;i<n;i++){
				area += i+1;
			}
		}
		cout << area << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    int n;
    cin >> n;
    unordered_map<int, int> memo;
    rrep(i, n) {
        int a;
        cin >> a;
        memo[i] = a;
    }
    int key = 1, value = memo[1];
    int ans = -1;
    rrep(i, n) {
        if(value == 2) {
            ans = i;
            break;
        } else {
            key = memo[key];
            value = memo[key];
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4388
#include <bits/stdc++.h>
using namespace std;
 
#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define INFINITO 1000000000
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define fo(i, n) for( int i = 0; i < n; i++ )


int main() {

    int k, a, b;
    cin >> k >> a >> b;

    while ( a <= b ) {
        if ( a % k ) a++;
        else {
            cout << "OK\n";
            return 0;
        }
    }
    cout << "NG\n";

    return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define mk make_pair
#define all(a) a.begin(), a.end()
#define len(a) (int)a.size()

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef pair <int, int> pii;

void solve(){
	int n;
	cin >> n;
	
	vector <int> d(n);
	for(int i = 0; i < n; i++)
		cin >> d[i];
	
	sort(all(d));
		
	int cnt = 0;
	vector <bool> used(1e6+1, false);
	for(int i = 0; i < n; i++)
		if(!used[d[i]]){
			if(i == n - 1 || d[i] != d[i+1])
			cnt++;
			
			for(int j = d[i]; j <= 1e6; j += d[i])
				used[j] = true;
		}
	
	cout << cnt << endl;	
}

int main(){
	solve();
	return 0;
}


Measured memory_bytes: 4308
M, D =  map(int, input().split())
count = 0
for d in range(D - 1):
    d += 2
    d1 = int(d/10)
    d2 = d - d1 * 10
    if d1 * d2 <= M and d1 > 1 and d2 > 1:
        count += 1
print(count)

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

#define int long long
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i,n) for(int i=0; i<(int)n; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define COUT(x) cout << x << endl;
#define PB(x) push_back(x)
#define MP make_pair
int gcd(int a,int b){return b?gcd(b,a%b):a;}
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int INF = 1e9;
const int MOD = 1e9+7;

vector<vector<int>> g;
vector<int> dist;
int n,x,y; 

signed main(){
    cin >> n >> x >> y;
    vector<int> a(n,0);
    for(int i=1; i<n; i++){
        for(int j=i+1; j<=n; j++){
            int dist;
            dist=min(j-i,abs(x-i)+1+abs(y-j));
            a[dist]++;
        }
    }
    for(int i=1; i<n; i++){
        cout<<a[i]<<endl;
    }

}

Measured memory_bytes: 256
#include<stdio.h>


int main(){
	int a, b, c, x, i=0;
	scanf("%d %d %d",&a ,&b ,&c);
	if(a > b){
		return 0;
	}
	for(x = a ; x <= b ; x++){
		if(c % x == 0){
			i++;
		}
	}
	printf("%d\n",i);
	
	return 0;
}

Measured memory_bytes: 596