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


using namespace std;

#define endl '\n'
#define PB push_back
#define MP make_pair
#define LL long long
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

typedef long long ll;

bool file=0,rt=1;
clock_t tStart ;
void FAST_IO();
////////////////////////

const double con =  380000.0;
int main() {

    //FAST_IO();
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout << setprecision(5);
    cout << fixed;

    int n;
    double x;
    string u;
    double total = 0.0;
    cin >> n;

    while(n--) {

        cin >> x >> u;

        if(u == "BTC") {

            total += x * con;
        }
        else total += x;
    }

    cout << total << endl;


    return 0;
}

void FAST_IO()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    //cout.tie(NULL);
    //cout.setf(ios::fixed);
    //cout.precision(2);
    if(rt && file){ tStart = clock(); }
    if(file){
    #ifndef _offline
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    }
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define rrep(i,j,n) for(ll i = (ll)(j); i < (ll)(n); i++)
#define mrep(i,n) for (ll i = (ll)(n); i > 0; i--)
#define be(v) (v).begin(), (v).end()
#define dcout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int main() {
	int n,m;
	cin >> n >> m;
	for(int i=n;i>=0;i--) {
		int a=n-i;
		if(i*4+a*2==m) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 3632
module Main where

solve :: Integer -> Integer -> Integer
solve n k = (\x -> x `mod` (10 ^ 9 + 7))
	$ sum $ map (\i -> (sumConsec (n - i + 1) n) - (sumConsec 0 (i - 1)) + 1) [k .. n + 1]

sumConsec :: Integer -> Integer -> Integer
sumConsec x1 x2 = (x1 + x2) * (x2 - x1 + 1) `div` 2

main :: IO ()
main = interact $ show . (\x -> solve (read $ head x) (read $ last x)) . words



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

using namespace std;
#define int long long
#define br cout<<"\n"
#define all(V) V.begin(),V.end()
#define rall(V) V.rbegin(),V.rend()
#define umap unordered_map
#define uset unordered_set

typedef vector<int> vi;
typedef vector<vi> vvi;

bool isPwrOf2(int x) { return x && (!(x&(x-1))); }
/*------------------------------------------------*/

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

signed main()
{
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    // #ifndef ONLINE_JUDGE
    //     freopen("./input.txt", "r", stdin);
    //     freopen("./output.txt", "w", stdout);
    // #endif
    /*------------------------------------------------*/
    int n; cin>>n;
    int arr[n];
    for(int i=0;i<n;i++){
        cin>>arr[i];
        arr[i] = arr[i] - (i+1);
    }
    sort(arr,arr+n);
    int mid = arr[n/2];
    int loss = 0;
    for(int i=0;i<n;i++){
        loss += abs(arr[i]-mid);
    }
    cout<<loss;
    /*------------------------------------------------*/
    return 0;
}


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

int main(void){
	int n, k, p = 1;

	cin >> n >> k;

	for (int i = 0; i < n; i++){
		if (i == 0) p *= k;
		else p *= (k - 1);
	}

	cout << p << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define il inline
#define RG register
#define ll long long
#define rhl (1000000007)
#define inf (1LL<<60)
#define N (500005)

using namespace std;

struct edge{ int nt,to,dis; }g[N];
struct data{
  int x; ll dis;
  il int operator < (const data &a) const{
    return dis>a.dis;
  }
};

priority_queue<data> Q;

int head[N],vis[N],f[N],h[N],S,T,n,m,num,ans;
ll dis1[N],dis2[N],len;

il int gi(){
  RG int x=0,q=1; RG char ch=getchar();
  while ((ch<'0' || ch>'9') && ch!='-') ch=getchar();
  if (ch=='-') q=-1,ch=getchar();
  while (ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
  return q*x;
}

il void insert(RG int from,RG int to,RG int dis){
  g[++num]=(edge){head[from],to,dis},head[from]=num; return;
}

il void dijkstra(ll *dis,RG int S,RG int T){
  for (RG int i=1;i<=n;++i) dis[i]=inf,vis[i]=0;
  dis[S]=0,Q.push((data){S,0});
  while (!Q.empty()){
    RG data now=Q.top(); Q.pop();
    if (vis[now.x]) continue; vis[now.x]=1;
    for (RG int i=head[now.x],v;i;i=g[i].nt){
      v=g[i].to;
      if (dis[v]>dis[now.x]+g[i].dis)
	dis[v]=dis[now.x]+g[i].dis,Q.push((data){v,dis[v]});
    }
  }
  return;
}

il int dfs1(RG int x){
  if (x==S) return f[x]=1;
  if (f[x]!=-1) return f[x]; f[x]=0;
  for (RG int i=head[x];i;i=g[i].nt)
    if (dis1[x]==dis1[g[i].to]+g[i].dis){
      f[x]+=dfs1(g[i].to);
      if (f[x]>=rhl) f[x]-=rhl;
    }
  return f[x];
}

il int dfs2(RG int x){
  if (x==T) return h[x]=1;
  if (h[x]!=-1) return h[x]; h[x]=0;
  for (RG int i=head[x];i;i=g[i].nt)
    if (dis2[x]==dis2[g[i].to]+g[i].dis){
      h[x]+=dfs2(g[i].to);
      if (h[x]>=rhl) h[x]-=rhl;
    }
  return h[x];
}

int main(){
  n=gi(),m=gi(),S=gi(),T=gi();
  memset(f,-1,sizeof(f)),memset(h,-1,sizeof(h));
  for (RG int i=1,u,v,w;i<=m;++i)
    u=gi(),v=gi(),w=gi(),insert(u,v,w),insert(v,u,w);
  dijkstra(dis1,S,T),dijkstra(dis2,T,S),len=dis1[T];
  dfs1(T),dfs2(S),ans=1LL*f[T]*f[T]%rhl;
  for (RG int i=1,tmp;i<=n;++i)
    if (dis1[i]*2==len && dis2[i]*2==len)
      tmp=1LL*f[i]*h[i]%rhl,ans=(ans-1LL*tmp*tmp)%rhl;
  for (RG int x=1;x<=n;++x)
    for (RG int i=head[x],tmp;i;i=g[i].nt)
      if (dis1[x]*2<len && dis2[g[i].to]*2<len && dis1[x]+dis2[g[i].to]+g[i].dis==len)
	tmp=1LL*f[x]*h[g[i].to]%rhl,ans=(ans-1LL*tmp*tmp)%rhl;
  cout<<(ans+rhl)%rhl; return 0;
}


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

int main() {

   int n;
   cin >> n;
   vector<int> t(n + 1);
   int total_time = 0;
   for(int i = 1; i <= n; i++){
     cin >> t[i];
     total_time += t[i];
   }

   int m;
   cin >> m;
   
   for(int i = 0; i < m; i++){
       int p, x;
       cin >> p >> x;
       cout << (total_time - t[p] + x) << endl;
   }
   
   return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n, a[100000], b[100000];
vector<pair<int, int>> e[100010];
int ans[100010];
int ma;
bool d[100010];

signed main() {
	cin >> n;
	for (int i = 0; i < n - 1; i++) {
		cin >> a[i] >> b[i];
		e[a[i]].push_back({ b[i], i });
		e[b[i]].push_back({ a[i], i });
	}
	queue<pair<int, int>> que;
	que.push({ 1, 0 });
	while ((int)que.size()) {
		pair<int, int> p = que.front(); que.pop();
		d[p.first] = true;
		bool bl = false;
		ma = max(ma, (int)e[p.first].size());
		int a = 0;
		for (int i = 0; i < (int)e[p.first].size(); i++) {
			if (d[e[p.first][i].first])continue;
			a++;
			if (a == p.second) {
				bl = true;
				a++;
				ans[e[p.first][i].second] = a;
				que.push({ e[p.first][i].first,a });
			}
			else if (!bl) {
				ans[e[p.first][i].second] = a;
				que.push({ e[p.first][i].first,a });
			}
			else {
				ans[e[p.first][i].second] = a;
				que.push({ e[p.first][i].first,a });
			}
		}
	}
	cout << ma << endl;
	for (int i = 0; i < n - 1; i++)cout << ans[i] << endl;
}

Measured memory_bytes: 10624
#coding: utf-8
#itp1_9d

def rev(s,a,b):
 b=b+1
 t=s[a:b]
 u=t[::-1]
 x=s[:a]
 y=s[b:]
 return x+u+y

def rep(s,a,b,w):
 b=b+1
 x=s[:a]
 y=s[b:]
 return x+w+y

s=raw_input()
n=int(raw_input())
for i in xrange(n):
 d=raw_input().split()
 a=int(d[1])
 b=int(d[2])
 if d[0]=="print":
  print s[a:b+1]
 elif d[0]=="reverse":
  s=rev(s,a,b)
 elif d[0]=="replace":
  w=d[3]
  s=rep(s,a,b,w)

Measured memory_bytes: 6464
#include <stdio.h>
#define N 100

int main(){
  int A[N];
  int a,v,i,j,k;

  scanf("%d",&a);
  for(i=0;i<a;i++) scanf("%d",&A[i]);
  for(i =0;i<a;i++){
    k=i;
    v = A[i];
    j=i-1;
    while(j>=0&&A[j]>v){
      A[j+1]=A[j];
      j--;
    }
    A[j+1]=v;
    for(k=0;k<a;k++){
      printf("%d",A[k]);
      if(k==a-1){
	printf("\n");
	break;
      }  
      printf(" ");
    }
  }
  
  return 0;
}

Measured memory_bytes: 604
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <string>
#include <limits>
#include <numeric>
#include <stack>
#include <queue>
#include <functional>

typedef long long ll;
typedef long double ld;

#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);

#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()

#define rep(i,a,b,c)            for(int i=(a);i<(b);i+=(c))
#define repb(i,a,b,c)           for(int i=(a);i>=(b);i-=(c))
#define ln '\n';
#define mod 1e9 + 7
#pragma warning(disable:4996)

using namespace std;

ll gcd(ll a, ll b) {
	while (a > 0 && b > 0) {
		if (a > b)
			a %= b;
		else
			b %= a;
	}

	return a + b;
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

int bitcount(int n) {
	int c = 0;
	while (n > 0) {
		if (n & 1)
			c++;
		n >>= 1;
	}
	return c;
}

struct cmp {
	constexpr bool operator()(pair<int, int>& a, pair<int, int>& b) const {
		return a.second > b.second;
	}
};


void solve() {
}

int main()
{
	fast
		ll x, k, d;
	cin >> x >> k >> d;
	 x = abs(x);
	ll steps = x / d;
	steps = min(steps, k);
	x -= steps * d;
	k -= steps;
	if (k > 0) {
		k %= 2;
		if (k == 1)
			x -= d;
	}

	cout << abs(x) << endl;
	return 0;
}

Measured memory_bytes: 3644
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>

using namespace std;

typedef long long LL;

const int N = 2010;

pair<int, int> A[N];
LL dp[N][N];

LL solve(int idx, int l, int r) {
    if (l > r) return 0;
    if (dp[l][r] != -1) return dp[l][r];
    LL res = max(
        1LL * A[idx].first * abs(A[idx].second - l) + solve(idx + 1, l + 1, r),
        1LL * A[idx].first * abs(A[idx].second - r) + solve(idx + 1, l, r - 1));
    dp[l][r] = res;
    return dp[l][r];
}

int main() {
    memset(dp, -1, sizeof(dp));
    // freopen("a.txt", "r", stdin);
    int n, t;
    cin >> n;

    for (int i = 1; i <= n; ++i) {
        cin >> t;
        A[i] = {t, i};
    }
    sort(A + 1, A + n + 1, [&](pair<int, int> &p1, pair<int, int> &p2) {
        return p1.first > p2.first;
    });

    cout << solve(1, 1, n) << endl;
    return 0;
}


Measured memory_bytes: 35336
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pi> vpi;
typedef vector<vi> vii;
typedef map<int, int> mp;
typedef multiset<int> mset;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
typedef vector<int64> vi64;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define form(i,j,k,l) for(int i=j;i<int(k);i+=l)
#define rform(i,j,k,l) for(int i=int(j);i>int(l);i-=l)
#define rep(i, j) for(int i=0;i<int(j);i++)
#define rrep(i, j) for(int i=int(j);i>=0;i--)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define forc(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define INF (int)1e9
#define INF64 (int64)1e18
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
#define F first
#define S  second
const double pie = acos(-1.0);
template <typename T>
T Max(T x, T y)
{
  return (x > y) ? x : y;
}
template <typename T>
T Min(T x, T y)
{
  return (x > y) ? y : x;
}
int gcd(int n1, int n2)
{
  if (n2 != 0) return gcd(n2, n1 % n2);
  else return n1;
}
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  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, ','); cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
clock_t time_p = clock();
void rtime() { time_p = clock() - time_p; cerr << "Time Taken : " << (float)1000 * (time_p) / CLOCKS_PER_SEC << "\n";}
int main()
{ fast;
  int n;
  long int x;
  cin >> n >> x;
  long int arr[n];
  for (int i = 0; i < n; i++)
    cin >> arr[i];
  long int cnt = 0;
  for (int i = 1; i < n; i++)
  { long int t = arr[i] + arr[i - 1];
    if (t <= x)
      continue;
    else
    { cnt = cnt + (t - x);
      arr[i] = Max((long int)0, arr[i] - (t - x));
    }
  }
  cout << cnt;

}



Measured memory_bytes: 4432
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define vlli vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vplli vector< pair< ll,ll> >
#define plli pair< ll,ll >
#define vps vector< pair< string, string> >
#define vpi vector< pair< int, int> >
#define all(x) x.begin(), x.end()
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n) for(ll i=a;i<n;i++)
#define scan(arr,a,n) for(ll i=(a);i<(n);i++)cin>>(arr)[i];
#define print(arr,a,n) for(ll i=(a);i<(n);i++)cout<<(arr)[i]<<" ";

ll add(ll x, ll y) {ll res = x + y; return (res >= mod ? res - mod : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= mod ? res % mod : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + mod : res);}
ll power(ll x, ll y) {ll res = 1; x %= mod; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
ll mod_inv(ll x) {return power(x, mod - 2);}


int main(){
    fast;
    ll n;
    cin>>n;
    ll a[n];
    set<ll> s;
    forn(i, 0, n){
        cin>>a[i];
        s.insert(a[i]);
    }
    if((ll)(s.size()) == n){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
}

Measured memory_bytes: 14524
/*
"Won't stop until I'm phenomenal."
- Phenomenal, Eminem
 */
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define ff first
#define Shazam ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);
#define ss second
#define all(c) c.begin(),c.end()
#define endl "\n"
#define test() int t; cin>>t; while(t--)
#define fl(i,a,b) for(int i = a ; i <b ;i++)
#define get(a) fl(i,0,a.size())  cin>>a[i];
#define pra(a) fl(i,0,a.size()) cout<<a[i]<<" ";	cout<<endl;
#define pr(a,n) fl(i,0,n) cout<<a[i]<<" ";	cout<<endl;
const ll INF = 2e18;
const int inf = 2e9;
const int mod1 = 1e9 + 7;



int main(){
    Shazam;
    int n,k; cin>>n>>k;
    string s; cin>>s;
    int ans = 0;
    for(int i =1; i <n; i++) ans += (s[i]==s[i-1]);
    cout<<min(n-1, ans + k*2)<<endl;
    return 0;
}

Measured memory_bytes: 3740
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<vector<pair<int, bool>>> vp(n);
  rep(i, n){
    int a;
    cin >> a;
    rep(j, a){
      int x;
      cin >> x;
      x--;
      bool y;
      cin >> y;
      vp.at(i).push_back({x, y});
    }
  }
  int ans = 0;
  rep(bit, 1 << n){
    int add = 0;
    bool f = false;
    rep(i, n){
      if((bit & (1 << i)) != 0){
        add++;
        for(auto p : vp.at(i)){
          if(p.second == false){
            if((bit & (1 << p.first)) != 0){
              f = true;
              break;
            }
          }else{
            if((bit & (1 << p.first)) == 0){
              f = true;
              break;
            }
          }
        }
        if(f == true) break;
      }
    }
    if(f == false){
      ans = max(ans, add);
    }
  }
  cout << ans << endl;
  return 0;
}

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1000000007;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

// MOD
//--------------------------------------------
#define MUL(a,b) (((a) % MOD) * ((b) % MOD)) % MOD

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//main code
int main(int argc, char const* argv[])
{
	LL x,a,b;
	cin >> a >> b >>x;
	LL c = max(x - b, (LL)0) / (a - b);
	LL ans = (MUL(b,c) + x) % MOD;
	cout << ans << endl;
	return 0;
}




Measured memory_bytes: 3148
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

#ifndef U_L_LONG
typedef unsigned long long U_L_LONG;
#endif
#ifndef L_LONG
typedef long long L_LONG;
#endif


static void ABC110C_StringTrans();

#if 1
int main()
{
	ABC110C_StringTrans();

	fflush(stdout);
	return 0;
}
#endif



static void ABC110C_StringTrans()
{
	const int AlphabetCount = 26;
	const int MaxSz = 2 * 100000;

	auto szS = new char[MaxSz + 1];
	auto szT = new char[MaxSz + 1];

	std::fill(szS, szS + MaxSz, 0);
	std::fill(szT, szT + MaxSz, 0);
	
	scanf(" %s %s", szS, szT);
	
	char unMatchT2S[AlphabetCount] = { 0 };
	char unMatchS2T[AlphabetCount] = { 0 };

	int szLen = strlen(szS);
	bool able = true;
	for (int i = 0; i < szLen; i++) {
		if (unMatchT2S[szS[i] - 'a'] == 0) {
			unMatchT2S[szS[i] - 'a'] = szT[i];
		}
		else if (unMatchT2S[szS[i] - 'a'] != szT[i]) {
			able = false;
			break;
		}

		if (unMatchS2T[szT[i] - 'a'] == 0) {
			unMatchS2T[szT[i] - 'a'] = szS[i];
		}
		else if (unMatchS2T[szT[i] - 'a'] != szS[i]) {
			able = false;
			break;
		}
	}

	const char* ans = "Yes\n";
	if (!able) {
		ans = "No\n";
	}

	printf(ans);

	delete[] szS;
	delete[] szT;
}



Measured memory_bytes: 640
import java.util.*;

public class Main{
	public static void main(String[]args){

		Scanner sc=new Scanner(System.in);

		int n=sc.nextInt(); //n人の人に聞いた
		int m=sc.nextInt(); //m種類の食べ物
		int ans[]=new int[m+1];
		for(int i=0;i<m+1;i++){
			ans[i]=0;
		}
		int k;
		int t;
		for(int i=0;i<n;i++){
			k=sc.nextInt();
			for(int s=0;s<k;s++){
				t=sc.nextInt();
				ans[t]++;
			}
		}
		int count=0;
		for(int i=0;i<m+1;i++){
			if(ans[i]==n){
				count++;
			}
		}

		System.out.println(count);
	}
}


Measured memory_bytes: 22868
n=int(input())
a=list(map(int,input().split()))
num=a[0]
for i in range(1,n):
    num=num^a[i]
if max(a)==(2**(n-3))+(2**(n-4)):
    print("No")
elif max(a)==min(a) and a[0]!=0:
    print("No")
elif num<=1:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 20696
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

require 'prime'

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

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

def small(a,b) return (a<b)? a:b end

a,b = inp
puts r_up(a,b)

Measured memory_bytes: 2044
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;
using static Prog;
using NX = System.Int64;

public class Solver
{
    public void Solve()
    {
        int N = NextInt();
        int M = NextInt();
        int ans = N * (N - 1) / 2 + M * (M - 1) / 2;
        Console.WriteLine(ans);
    }
}

public class Prog
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    public struct Pair { public int x, y; public Pair(int a, int b) { x = a; y = b; } }
    static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        new Solver().Solve();
        Console.Out.Flush();
        return;
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
    public long Abs(long a, long b) => Math.Abs(a - b);
}


Measured memory_bytes: 27648
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main() {
    string s;
    cin >> s;
    int n = s.size();
    
    if(n < 4) {
        cout << "No";
    }
    else if(s.substr(0, 4) == "YAKI") {
        cout << "Yes";
    }
    else {
        cout << "No";
    }

    cout << endl;
    return 0;
}

Measured memory_bytes: 256
function main(input: string) {
  const S = input.split("");
  let c = 0;
  for(let i = 0, bi = S.length - 1, l = Math.ceil(S.length / 2); i < l; i++, bi--) {
    if (S[i] !== S[bi]) c++
  }
  console.log(c);
}

main(
  require("fs")
    .readFileSync("/dev/stdin", "utf8")
    .trim()
);


Measured memory_bytes: 7372
#include <iostream>

using namespace std;
using ll = long long;

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;

  int ans = min(b / a, c);

  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,m = LI()
    r = set(list(range(1,m+1)))
    for _ in range(n):
        r &= set(LI()[1:])

    return len(r)



print(main())




Measured memory_bytes: 8140
#include <bits/stdc++.h>
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define vsort(v) sort(v.begin(), v.end())
#define vsortr(v) sort(v.begin(), v.end(), greater<ll>())
#define sz(x) x.size()
#define ceil(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
using namespace std;
template<typename T> inline bool chmax(T &a, T b){ if(a<b){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){ a=b; return true; } return false; }
template<typename T> T gcd(T a, T b){ if(b==0) return a; return gcd(b, a%b); }
template<typename T> T lcm(T a, T b){ return a*(b/gcd(a, b)); }
template<typename T> T keta(T num){ T k=0; while(num>0){ num/=10; k++; } return k; }
template<typename T> void vdebug(vector<T> v){ cout << "vdebug" << endl; for(auto vv : v){ cout << vv << " "; } cout << endl; }
template<typename T> void adebug(T arr[], ll n){ cout << "adebug" << endl; reps(i, 0, n){ cout << arr[i] << " "; } cout << endl; }
template<typename T1, typename T2> void mdebug(map<T1, T2> mp){ cout << "mdebug" << endl; for(auto const& m : mp){ cout << m.first sp m.second << endl; }}
void ans(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; }
void ans2(bool b){ if(b) cout << "YES" << endl; else cout << "NO" << endl; }
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};


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

    int n, b_in;
    vector<int> b;
    bool res = true;

    b.push_back(-1);

    cin >> n;
    reps(i, 1, n){
        cin >> b_in;
        b.push_back(b_in);
        if(b[i] > i) res = false;
    }

    if(!res){
        cout << -1 << endl;
        return 0;
    }else{
        stack<int> answer;
        while(b.size() > 1){
            repr(i, b.size()-1, 1){
                if(b[i] == i){
                    answer.push(b[i]);
                    b.erase(b.begin() + i);
                    break;
                }
            }
        }
        while(!answer.empty()){
            cout << answer.top() << endl;
            answer.pop();
        }
    }

    return 0;
}


Measured memory_bytes: 256
n, m = gets.to_s.split.map{|i| i.to_i }

bits = Array.new(n){|i| 2**i }
# p bits = Array.new(12){|i| 2**i } #=> [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
shops = Array.new(m) do
  a = gets.to_s.to_i
  c = gets.to_s.split.map{|i| i.to_i - 1 }
  [c.reduce(0){|s,t| s + bits[t] }, a]
end.sort_by{|(bit, _)| bit }

inf = 10 ** 12
state_size = 2 ** n
d = Array.new(state_size, inf)
d[0] = 0

state_max = 0
shops.each do |(bit, a)|
  state_max |= bit
  state_max.times do |k|
    new = k | bit
    d[new] = d[k] + a if d[new] > d[k] + a
  end
  
end

puts d[-1] == inf ?  -1 : d[-1]

Measured memory_bytes: 2172
#include <bits/stdc++.h>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
typedef long long ll;
typedef pair<int, int> P;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int A, B;
  cin >> A >> B;
  FOR(i,0,20000) {
    int a = i * 0.08;
    int b = i * 0.1;
    if (a == A && b == B) {
      cout << i << endl;
      exit(0);
    }
  }
  cout << -1 << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int n,x,i,l,now=0,cnt=1;
    cin >> n >> x;
    for(i=0;i<n;i++){
        cin >> l;
        now+=l;
        if(now<=x) cnt++;
        else break;
    }
    cout << cnt;
}

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

using namespace std;

int main() {
	vector<int> furui(1000010, 0);
	furui[0] = furui[1] = 1;
	for (int i = 2; i * i < 1000010; i++) {
		if (furui[i] == 0) {
			for (int j = 2; j <= 1000010 / i; j++) {
				furui[i*j] = 1;
			}
		}
	}
	int n;
	while (cin >> n) {
		if (n == 0) {
			break;
		}
		int counter = 0;
		for (int i = 3; i <= n/2; i+=2) {
			if (furui[i] == 0) {
				if (furui[n-i] == 0) {
					counter++;
				}
			}
		}
		cout << counter << endl;
	}
	return 0;
}

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

#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define M_PI 3.14159265358979323846
#define ALL(X) (X).begin(),(X).end()

#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

ll N,K;
void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    cin >> N >> K;
}

void solve(){
    ll ans = floor(log(N)/log(K)+1);
    cout << ans << endl;
}   

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


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

int64_t luca(int n){
  vector<int64_t> lucas(n+1);
  lucas[0]=2;
  lucas[1]=1;
  for(int i=2;i<n+1;i++){
    lucas[i]=lucas[i-1]+lucas[i-2];
  }
  return lucas[n];
}


int main() {
  int N;
  cin>>N;
  cout<<luca(N)<<endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

class segtree:
    x_unit=0 # 単位元
    x_func=max  # 関数
    def __init__(self,n,seq): # 元のseqと要素数n
        self.n=n
        self.x=[self.x_unit]*(2*n)
        for i,j in enumerate(seq, self.n): # n番目からseqをx配列に移していく
            self.x[i] = j
        for i in range(self.n-1, 0, -1):
            self.x[i] = self.x_func(self.x[i*2], self.x[i*2+1])
    def update(self,i,j): # 1点更新
        i += self.n
        self.x[i]=j
        while i>1:
            i//=2 # 更新後、木の上へと登っていくついでに更新
            self.x[i]=self.x_func(self.x[i*2], self.x[i*2+1])
    def get(self, i): # 値を入手
        return self.x[i+self.n] 
    def fold(self,l,r): # 区間[l, r)の最小値などを取得 
        l+=self.n
        r+=self.n
        val_l=self.x_unit
        val_r=self.x_unit
        while l<r:
            if l & 1: # lが奇数
                val_l=self.x_func(val_l,self.x[l])
                l+=1 # 偶数に調節
            if r & 1: # rが奇数
                r-=1 # 開区間なので1個前は偶数番目の要素
                val_r=self.x_func(val_r,self.x[r])
            l //= 2
            r //= 2
        return self.x_func(val_l,val_r)
    def max_right(self, l, condition):
        r=self.n
        if condition(self.fold(l, r)):
            return r
        else:
            while r-l>1:
                l1=l
                r1=l+(r-l)//2
                l2=l+(r-l)//2
                r2=r
                if condition(self.fold(l1, r1))==False:
                    l=l1
                    r=r1
                else:
                    l=l2
                    r=r2
            return l

n,q=map(int,input().split()) 
*a,=map(int,input().split())
seg=segtree(n,a)

for i in range(q):
    t,x,y=map(int,input().split()) 
    if t==1:
        x-=1
        seg.update(x, y)
    elif t==2:
        print(seg.fold(x-1,y))
    else:
        def condition(X):
            return X<y
        print(seg.max_right(x-1, condition)+1)

Measured memory_bytes: 107960
#include<bits/stdc++.h>
using namespace std;
#define int long long
int N, Q;
vector<int> bit;

int get(int i){
  int s = 0;
  while(i < bit.size()){
    s += bit[i];
    i += i & -i;
  }
  return s;
}

void add(int i, int x){
  while(i > 0){
    bit[i] += x;
    i -= i & -i;
  }
}

signed main(){
  cin >> N >> Q;
  bit.resize(N + 1);
  for(int i = 0; i < Q; i++){
    int a; cin >> a;
    if(a == 0){
      int b, c, d; cin >> b >> c >> d;
      add(c, d); add(b - 1, -d);
    }
    if(a == 1){
      int b; cin >> b;
      cout << get(b) << endl;
    }
  }
}


Measured memory_bytes: 3632
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

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

using ll = long long;

ll N, K;
ll A[200010];
ll cnt[200010];
ll kind;

int main()
{
  std::cin >> N >> K;
  rep( i, N )
  {
    std::cin >> A[i];

    if( !cnt[A[i]] )
      ++kind;

    ++cnt[A[i]];
  }

  std::sort( cnt, cnt+N+1 );

  ll p = 0;

  while( !cnt[p] )
    ++p;

  ll ans = 0;

  rep( i, kind-K )
    ans += cnt[p+i];

  std::cout << ans << std::endl;

  return 0;
}

Measured memory_bytes: 3328
#include<stdio.h>
#include <iostream>
#include<string>
#include<vector>

using namespace std;

int main()
{
	int num;
	int ans;
	bool same = true;
	int cnt = 0;
	vector<int> v;

	cin >> num;

	while (count(v.begin(),v.end(),num)==0) {
		cnt++;

		v.push_back(num);
		if (num % 2 == 0) {
			num = num / 2;
		}
		else {
			num = 3 * num + 1;
		}
	}
	cout << cnt+1;
	return 0;
}


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


int main() {
 int H, N;
  cin >> H>>N;
  vector<int> hp(N);
  for(int i=0;i<N; ++i){
cin >> hp.at(i);
  }
  for(int i = 0; i<N;++i){
    H-=hp.at(i);
  }
  if(H<=0) cout << "Yes" << endl;
  else cout << "No" << endl;
    
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <iomanip>
#include <cmath>
#include <algorithm>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
template<class T> inline void chmin(T& a, T b) {if (a>b) a=b; }
template<class T> inline void chmax(T& a, T b) {if (a<b) a=b; }
inline void print() { cout << endl; }
template <class Head, class... Tail> inline void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " "; print(forward<Tail>(tail)...);}
template <class T> inline void print(vector<T>& vec) { for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " "; } cout << endl;}
template <class T> inline void print(vector<vector<T>>& df) { for (auto& vec : df) { print(vec); }}
typedef long long ll;
const ll LINF = 1e18;
const int INF = 1e9;


int main() { 
    int N; cin >> N;
    int res = 0;
    for(int i=1; i<=N; i++) {
        if(i%2==1) res++;

    }
    print((double)res/(double)N);
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        int count = 0;
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int array[] = new int[n];
        

        for(int i=0; i < n; i++){
	    	int a = sc.nextInt();
	    	array[i] = a;
	    }

	    boolean flag=true;
        
        while(true){
            
    	    for(int i=0; i < n; i++){
	    	    if ( array[i] % 2 == 1){
	    	        flag=false;
	    	        break;
	    	    }else{
	    	        array[i]=array[i]/2;
	    	    }
    	    }
	    	
	    	if(!flag)break;
	    	
	    	count++;
	    }

        System.out.println(count);
        sc.close();
    }
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;


int main(){
    int a;cin >>a;
    string s;cin >>s;
    if(a>=3200)cout <<s<<endl;
    else puts("red");
    return 0;
}

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

using namespace std;
typedef long long ll;

int main() {
	ll l, r;
	cin >> l >> r;
	
	ll res = 0;
	if(l % 2 == 1) {
		res = l;
		l++;
	}
	if(r % 2 == 0) {
		res ^= r;
		r--;
	}
	
	ll diff = (r-l+1)/2;
	if(diff % 2 == 1) res^=1;
	cout << res;
	
	return 0;
}

Measured memory_bytes: 256
n = int(input())
l = list(map(int, input().split()))
d = {}
for i in l:
    if i not in d:
        d[i] = 1
    else:
        d[i] += 1
sumz = sum(l)
for _ in range(int(input())):
    b,c = map(int, input().split())
    if b in d:
        sumz = sumz +( ((d[b]*c) - (d[b]*b)) )
        if c not in d:
            d[c] = d[b]
        else:
            d[c] += d[b]
        del d[b]
    print(sumz)
    

Measured memory_bytes: 83496
package main

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

func process(in int) (ret int) {
	if in == 1 {
		return 0
	}
	return 1

}

func scanNum() (n int) {
	fmt.Scanf("%d\n", &n)
	return
}

func scanStrings(n int) []string {
	sc := bufio.NewScanner(os.Stdin)

	ret := make([]string, n)
	for i := 0; i < n; i++ {
		if sc.Scan() {
			ret[i] = sc.Text()
		}
	}
	return ret
}

func main() {

	ret := process(scanNum())
	fmt.Println(ret)
}


Measured memory_bytes: 1840
#include<iostream>
#include<sstream>
#include<stdio.h>
#include<stack>
#include<string>
#include<string.h>
#include<math.h>
#include <algorithm>
#include<cctype>			
#include<iomanip>
#include <time.h>
#include <map>
#include <stdlib.h>
#include <vector>
#include <set>
#include <iterator>
#include<fstream>
#include <queue>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define rep(i, a, b) for(int i=a; i<b; i++)
#define per(i, a, b) for(int i=b-1; i>=a; i--)
#define ifor(n) for(int i=0;i<n;i++) 
#define jfor(n) for(int j=0;j<n;j++)
#define Ifor(n) for(int i=1;i<n;i++) 
#define Jfor(n) for(int j=1;j<n;j++)
const int inf=0x3f3f3f3f;
int main(){
	char s[3];
	scanf("%s",&s);
	if(s[0]=='S'&&s[1]=='U')cout<<7<<endl;
	else if(s[0]=='M')cout<<6<<endl;
	else if(s[0]=='T'&&s[1]== 'U')cout<<5<<endl;
	else if(s[0]=='W')cout<<4<<endl;
	else if(s[0]=='T'&&s[1]=='H')cout<<3<<endl;
	else if(s[0]=='F')cout<<2<<endl;
	else cout<<1<<endl;
}

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

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const ll MAXH=1010;
ll h,w,dp[MAXH][MAXH];
char a[MAXH][MAXH];


int main(){
    #ifdef Javier
        freopen(".in", "r", stdin);
    #endif // Javier

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);


    cin>>h>>w;
    for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=w;j++)
        {
            cin>>a[i][j];
        }
    }

    dp[1][1]=1;
    for(int i=1;i<=h;i++)
    {
        for(int j=((i==1) ? 2:1);j<=w;j++)
        {
            if(a[i][j]=='#')
                continue;
            dp[i][j]=(dp[i-1][j]+dp[i][j-1])%(1000000007);
        }

    }

    cout<<dp[h][w]%(1000000007);

    return 0;
}



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

using namespace std;

int main(){

  string str;
  int emp = 0, flag = 0,j = 0;
  string keyence = "keyence";
  cin >> str;

  string sub = str.substr(0, 7);
  if(keyence == sub){
   cout << "YES\n";
   return 0;
  }

  sub = str.substr(str.length() - 7);
  if(keyence == sub){
   cout << "YES\n";
   return 0;
  }
 
  
  for(int i = 0; i < str.length(); i++){
    if(str[i] == keyence[j]){
      j++;
      flag = 0;
    }
    else{
      if(!flag){
	if(!emp){
	  sub = str.substr(str.length() - (7 - i));
	  string key_sub = keyence.substr(i);
	  if(sub == key_sub){
	    cout << "YES\n";
	    return 0;
	  }	    
	}
	emp++;
	flag = 1;
      }
    }
  }

  if(j == 7 && emp <= 1){
    cout << "YES\n";
  }
  else{
    cout << "NO\n";
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl; 有効桁数指定
// *min_element(c + l, c + r) *max_element(c + l, c + r) 配列の中のmin-max
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// ~ は、-1の時だけfalse
// struct Edge {
//   int to, id;
//   Edge(int a, int b): to(a), id(b) {}
// };

vector<int> g[100010];

int dp[100010];
bool done[100010];

int func(int v) {
	if (done[v]) return dp[v];
	int ma=0;
	for (auto next : g[v]) {
		ma = max(ma,func(next)+1);
	}
	done[v]=true;
	return dp[v]=ma;
}


int main () {

	int n,m;cin>>n>>m;

	rep(i,m) {
		int x,y;cin>>x>>y;
		x--;y--;
		g[x].emplace_back(y);
	}

	int ans =0;

	rep(i,n) {
		ans = max(ans,func(i));
	}

	cout<<ans<<endl;

}

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

using namespace std;




void solve(long long N, std::vector<long long> a){
    vector<long long > sleft(N+1), sright(N+1);
    priority_queue<long long, vector<long long>, greater<int> > pqleft;
    priority_queue<long long> pqright;
    long long tmp, maxscore=LLONG_MIN;
    //* initilization
    rep(i, N){
        sleft[0] += a[i];
        pqleft.push(a[i]);
        sright[N] += a[i+2*N];
        pqright.push(a[i+2*N]);
    }
    //* update left part
    rep(i, N){
        pqleft.push(a[i+N]);
        tmp = pqleft.top();
        pqleft.pop();
        sleft[i+1] = sleft[i] + a[i+N] - tmp;
    }
    //* update right part
    rep(i, N){
        pqright.push(a[2*N-i-1]);
        tmp = pqright.top();
        pqright.pop();
        sright[N-i-1] = sright[N-i] + a[2*N-i-1] - tmp;
    }
    //* get max score
    rep(i, N+1){
        maxscore = max(maxscore, sleft[i] - sright[i]);
    }
    cout << maxscore << endl;

}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> a(3*N);
    for(int i = 0 ; i < 3*N ; i++){
        scanf("%lld",&a[i]);
    }
    solve(N, std::move(a));
    return 0;
}


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

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


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, char const *argv[]) {
	char str[101];
	int n, m;

	fgets(str, 100, stdin);
	sscanf(str, "%d %d\n", &n, &m);

	if (n <= 8 && m <= 8) {
		printf("Yay!\n");
	} else {
		printf(":(\n");
	}

	return 0;
}


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

int main() {
    int n,k;
    cin >> n >> k;
    int b[n];
    for(int i=0;i<n;i++) b[i]=0;
    for(int i=0;i<k;i++){
        int d;
        cin >> d;
        for(int j=0;j<d;j++){
            int a;
            cin >> a;
            b[a-1]++;
        }
    }
    int count=0;
    for(int i=0;i<n;i++){
        if(b[i]==0) count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 3624
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	static public void main(String args[]) {

		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int[] array = new int[n];
		for(int i=0; i<n; i++) {
			array[i] = scan.nextInt();
		}

		int m = scan.nextInt();
		int[] array2 = new int[m];
		for(int i=0; i<m; i++) {
			array2[i] = scan.nextInt();
		}
		
		boolean flag = true;
		
		for(int c : array2) {

			int reaction = Arrays.binarySearch(array, c);
			if(reaction < 0) {
				flag = false;
				// System.out.println("debug");
				break;
			}
		}
		System.out.println(flag ? "1" : "0");
	}
}




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

int main(){
	int n,s=0,maxp=-1,maxn=-1;
	cin>>n;
	int a[n+1];
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(a[i]>maxn){
			maxn=a[i];
			maxp=i;
		} 
	}
	for(int i=1;i<=n;i++){
		if(i==maxp) a[i]/=2;
		s+=a[i];
	}
	cout<<s;
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define rpz(i,e) rp(i,0,e)

int main(){
	string S; cin>>S;
	int n = S.size();
	int s = 0;
	rp(i,0,n){
		s += S[i]-'0';
	}
	// ote(s);
	// ote(stoi(S));
	ote(stoi(S)%s==0?"Yes":"No");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using Pt = pair<int, int>;

void ABC172D()
{
	int N;
	cin >> N;
	ll sum = 0;
	for (int i = 1; i <= N; ++i)
	{
		ll n = N / i;
		sum += (n * (n + 1) / 2) * i;
	}
	cout << sum << endl;
}
int main()
{
	ABC172D();
	return 0;
}


Measured memory_bytes: 3624