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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) { os << p.first << " " << p.second; return os; }

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; }return false; }
template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	string S; cin >> S;
	int a = 0, b = 0;
	rep(i, 0, S.size()) {
		if (i % 2 == 0 and S[i] != '0')a++;
		else if (i % 2 == 1 and S[i] != '1')a++;
	}
	rep(i, 0, S.size()) {
		if (i % 2 == 0 and S[i] != '1')b++;
		else if (i % 2 == 1 and S[i] != '0')b++;
	}
	cout << min(a, b) << endl;
	return 0;
}


Measured memory_bytes: 512
main :: IO ()
main = do
  [n,l] <- map (read :: String -> Int) . words <$> getLine
  print $ ans n l

ans :: Int -> Int -> Int
ans n l
  | l < 0 && 0 < (l+n-1) = s
  | l >= 0 = s-l
  | l+n-1 <= 0 = s-(l+n-1)
  where s = (`div` 2) $ n*(2*l+n-1)

Measured memory_bytes: 508
#include <stdio.h>

int main(void) {
	
	
	int a;
	char b[4] = "ABC";
	char c[4] = "ABD";
	
	scanf("%d",&a);

	if(a <= 999) {
		printf("%s\n",b);
	}else if(1000 <= a){
		printf("%s\n",c);
	}
		
	return 0;
}


Measured memory_bytes: 128
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

t = 1000000000
lis = list()
for i in A:
    lis.append(B[i-1])
    #print(i,t)
    if i == t + 1:
        lis.append(C[i-2])
    t = i

print(sum(lis))

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <iomanip>
using namespace std;

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

  int a,b,c;
  cin >> a >> b >> c;

  cout << min(min(a+b,a+c),b+c) << endl;
  
}

Measured memory_bytes: 896
#include "bits/stdc++.h"
using namespace std;
typedef long double ld;
#define int long long
typedef pair<int,int> pii;
#define RAGE ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,n) for(i=0; i <n; i++)
#define repv(i,k,n) for(int i=k; i<=n; i++)
#define pb push_back
#define mp make_pair
#define F  first
#define S  second
#define sz(x)  (int)x.size()
#define all(v) v.begin(),v.end()
#define endl '\n'
#define deb(x) cout<<#x<<" = "<<x<<endl
#define gcd   __gcd
#define inf   LLONG_MAX
#define minf  LLONG_MIN 
#define sp(n) fixed<<setprecision(n)
const int mod = (int)(1e9+7);
int power(int x,int n)
{   if(n==0)    return 1;
    if(n==1)    return x%mod;
    if(n%2==0)  {   int y = power(x,n/2)%mod;return (y*y)%mod;}
    if(n&1)     {   int y = power(x,n-1);return (x%mod * y%mod)%mod;}
    return 0;
}
int lcm(int a,int b){return a*b/gcd(a,b);}
bool is_power_2(int n){ return log2(n)==floor(log2(n));}
bool is_prime(int n){for(int i=2; i*i<=n; i++)if(n%i==0)return 0; return 1;}
void db()
{   
    #ifndef  ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}
void timeit()
{  
    #ifndef ONLINE_JUDGE
       cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    #endif
}
int  dx []    =  { -1 ,  0,  1,  0,  -1, -1, 1,  1};
int  dy []    =  { 0 ,  1,   0, -1,  -1,  1, 1, -1};
char dir[]    =  {'U', 'R', 'D','L' };
/* ------------------------------------------------------- */
const int maxn = 1e5;
void solve(int tc)
{
    int n,i,j,k,m,q;
    cin>>n;
    vector<int> ans(maxn , 0);
    repv(i,1,105)
    {
        repv(j,1,105)
        {
            repv(k,1,105)
            {
                m = i*i + j*j + k*k + i*j + j*k + k*i;
                if(m<10005)
                    ans[m]++;
            }
        }
    }
    repv(i,1,n)
        cout<<ans[i]<<endl;

}   
signed main()
{
    RAGE;
  //  db();    
    int t=1;
    //  cin>>t;
    for(int i=1; i<=t; i++)
    {
        solve(i);
    }
 //   timeit();
    return 0;
}

Measured memory_bytes: 3912
using System;
namespace Program
{
	class Sample
    {
    	static void Main()
        {
          	int Ans = 0;
            int count = 0;
        	var a = Console.ReadLine().Split();
          	int A = int.Parse(a[0]);
          	int B = int.Parse(a[1]);
          	int C = int.Parse(a[2]);
          	for(int i=0;i<C;i++)
            {
            	Ans = A * (i+1);
              		if(Ans<=B)
                    {
          	        	count = i+1;
                      	if(A*(i+2)>B)
                        {
                          break;
                        }
                    }
                    else{ 
                      count = i;
                      break;
                    }
            }
          	Console.WriteLine(count);
        }
    }
}

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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


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

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

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

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

int main() {
  int N;
  cin >> N;
  vector< int > A(N);
  cin >> A;

  vector< int > v(N + 1);
  int k = 0;
  for(int i = N - 1; i >= 0; i--) {
    k = __gcd(k, A[i]);
    v[i] = k;
  }
  int ret = k;
  k = 0;
  for(int i = 0; i < N; i++) {
    chmax(ret, __gcd(k, v[i + 1]));
    k = __gcd(k, A[i]);
  }
  cout << ret << endl;
}



Measured memory_bytes: 1024
N, x = map(int, input().split())
a_list = list(map(int, input().split()))
a_list.sort()
s = 0
i = 0
for a in a_list:
    s += a
    if s > x:
        print(i)
        break
    else:
        i += 1
else:
    if s == x:
        print(N)
    else:
        print(N-1)


Measured memory_bytes: 3060
import sys
x, n = map(int, input().split())
p = list(map(int, input().split()))
if n == 0:
    print(x)
    sys.exit()

not_in_p = []
for i in range(0, 102):
    if i not in p:
        not_in_p.append(abs(x-i))
    else:
        not_in_p.append(102)

address = not_in_p.index(min(not_in_p))
print(address)

Measured memory_bytes: 9200
n = int(input())
a = [0] * 8
b = 0
for x in input().split():
    x = int(x)
    if x >= 3200: b += 1
    else: a[x//400] += 1
m = 0
for x in a:
    if x > 0: m += 1
print(max(m, 1), m + b)


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

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

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

int main()
{
    cout << fixed << setprecision(15);
    ll H, W;
    cin >> H >> W;

    vector<vector<char>> A(H, vector<char>(W));

    REP(i, H){
        REP(j, W){
            cin >> A[i][j];
        }
    }

    // REP(i, H){
    //     REP(j, W){
    //         cout <<  A[i][j];
    //     }
    //     cout << endl;
    // }

    ll tmin = -1;
    REP(i, H){
        ll minj = -1;
        ll maxj = -1;
        ll count = 0;
        REP(j ,W){
            if(A[i][j] == '#'){
                if(minj == -1){
                    minj = j;
                    if(i != 0 && minj != tmin){
                        cout << "Impossible" << endl;
                        return 0;
                    }
                }
                maxj = j;
                count++;
            } 
        }
        if(maxj - minj + 1 != count){
            cout << "Impossible" << endl;
            return 0;
        }
        tmin = maxj;
    }
    cout << "Possible" << endl;
    return 0;
}

Measured memory_bytes: 3612
n = int(input())

ac = 0
wa = 0
tle = 0
re = 0

for i in range(n):
    s = input()
    if s == "AC":
        ac += 1
    elif s == "WA":
        wa += 1
    elif s == "TLE":
        tle += 1
    else:
        re += 1
print("AC x " + str(ac))
print("WA x " + str(wa))
print("TLE x " + str(tle))
print("RE x " + str(re))


Measured memory_bytes: 9052
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
//#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rev(i,b,a) for (ll i = b - 1; i >= a; i--)
#define all(v) v.begin(), v.end()
#define maxe(v) *max_element(v.begin(), v.end())
#define mine(v) *min_element(v.begin(), v.end())
#define pb push_back
#define pf push_front
#define rem 1000000007
#define cont continue
#define PI 3.141592653589793238462643383279502
#define debug(n1) cout<<"debug... "<<n1<<"\n"
const ll INF=(1ll<<60)-1;//ll ans = 3e18 + 5;
const int no_of_chars = 256; 
////////////////////////////////////////////////////////

////////////////////////////////////////////////////////
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll tc=1;
    //cin>>tc;
    while(tc--)
    {
       string s;
       cin>>s;
       ll n=s.size();
       if( s[n-1] == 's' )
       {
           cout<<s<<"es";
       }
       else 
       cout<<s<<"s";
    }
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string mozi;
  cin >> mozi;
  if (mozi.at(2) == mozi.at(3) && mozi.at(4) == mozi.at(5)) {
      cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x, ll y, ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}   


int main(){
  ll i,j,o;
  ll res1=0,res2=INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0;
  bool judge = true;
  ll x,a,b; cin>>x>>a>>b;
  if(abs(x-a)>abs(x-b))cout<<'B'<<endl;
  else cout<<'A'<<endl;


  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8

# In[8]:


def nCk(n, k, mod):
    a = 1
    for i in range(n, n-k, -1):
        a *= i
        a %= mod
    b = 1
    for i in range(1, k+1):
        b *= i
        b %= mod
    a *= pow(b, mod-2, mod)
    return a


# In[12]:


x,y = map(int,input().split())


# In[14]:


mod = 10**9+7
if (x+y)%3 != 0:
    ans = 0
else:
    right = x - (x+y)//3
    up = y - (x+y)//3
    if right < 0 or up < 0:
        ans = 0
    else:
        ans = nCk(right+up,right,mod)%mod
print(ans)


# In[ ]:






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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

bool operator< (const string s1, const string s2) {
  int res = -1;
  for(int i=0;i<min(SZ(s1), SZ(s2));++i) {
    if(s1[i] < s2[i]) {
      res = 1;
      break;
    } else if(s1[i] > s2[i]) {
      res = 0;
      break;
    }
  }
  if(res == -1) res = SZ(s1) < SZ(s2);

  return (bool)res;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n; cin >> n;
  map<string, int> mp;
  int ma = 0;
  for(int i=0;i<n;++i) {
    string tmp; cin >> tmp;
    mp[tmp]++;
    ma = max(ma, mp[tmp]);
  }

  set<string> st;
  for(auto &e: mp) {
    if(ma == e.second) {
      st.insert(e.first);
    }
  }
  

  for(auto &e: st) {
    cout << e << endl;
  }



}


Measured memory_bytes: 33280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi; 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
const int mod = 1e9+7;
const int maxn = 2e5+10;
const int inf = 0x3f3f3f3f;
ll qpow(ll a,int b) {
	ll ans=1;
	while(b) {
		if(b&1) ans=ans*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return ans;
}
ll jc[maxn],inv[maxn];
ll C(int n,int m) {
	return jc[n]*inv[m]%mod*inv[n-m]%mod;
}
vi g[maxn];
int n,fa[maxn],siz[maxn];
ll dp[maxn],ans[maxn];
void dfs(int now,int f) {
	siz[now]=1;
	fa[now]=f;
	dp[now]=1;
	for(int x:g[now]) {
		if(x==f) continue;
		dfs(x,now);
		siz[now]+=siz[x];
	}
	int num=siz[now]-1;
	for(int x:g[now]) {
		if(x==f) continue;
		dp[now]=dp[now]*C(num,siz[x])%mod;
		dp[now]=dp[now]*dp[x]%mod;
		num-=siz[x];
	}
}
void solve(int now) {
	if(now!=1) {
		int f=fa[now];
		ll x=ans[f],tmp=C(n-1,siz[now])%mod*dp[now]%mod;
		x=x*qpow(tmp,mod-2)%mod;
		int num=n-1;
		ans[now]=C(num,n-siz[now])*x%mod;
		num-=n-siz[now];
		for(int x:g[now]) {
			if(x==fa[now]) continue;
			ans[now]=ans[now]*C(num,siz[x])%mod;
			ans[now]=ans[now]*dp[x]%mod;
			num-=siz[x];
		}
	}
	for(int x:g[now]) {
		if(x==fa[now]) continue;
		solve(x);
	}
}
int main()
{
	ios::sync_with_stdio(false);cin.tie(0);
	cin>>n;
	jc[0]=1;
	rep(i,1,n) jc[i]=jc[i-1]*i%mod;
	rep(i,0,n) inv[i]=qpow(jc[i],mod-2);
	rep(i,1,n-1) {
		int u,v;	
		cin>>u>>v;
		g[u].pb(v);
		g[v].pb(u);
	}
	dfs(1,0);
	ans[1]=dp[1];
	solve(1);
	rep(i,1,n) {
		cout<<ans[i]<<'\n';
	}
	return 0;
}



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

int main() {
	string s;
  	cin >> s;
  	int j = (int) s.size() - 1;
  	for (int i = 0; i < j; i++,j--) {
    	if(s[i] != s[j]) {
        	cout << "No\n";
          	return 0;
        }
    }
  	j = ((int) s.size() - 1) / 2 - 1;
  	for (int i = 0; i < j; i++,j--) {
      	if(s[i] != s[j]) {
          	cout << "No\n";
          	return 0;
        }
    }
  	j = (int) s.size() - 1;
  	for (int i = ((int) s.size() + 3) / 2 - 1; j > i; i++, j--) {
		if(s[i] != s[j]) {
          	cout << "No\n";
          	return 0;
        }
    }
  	cout << "Yes\n";
}


Measured memory_bytes: 256
#include<iostream>
#include<unordered_map>
#include<bitset>
#include<math.h>
#include<vector>
#include<set>
#include<algorithm>
#include<ctype.h>
#include<unordered_set>
#include<string>
#include<iomanip>
#include<queue>
#include<limits>
#include<map>
#include<stack>
#include<iterator>
#include<cstring>
 
#include<deque>
#define pi 3.141592653589793238
#include<chrono>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define MOD 1000000007
#define INF 999999999999999999 
#define pb push_back
#define ff first
#define ss second
 
#define mt make_tuple
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
 
 
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    ll T = 1, i, j;
    
    //cin >> T;
    while (T--) {
        ll n;
        cin >> n;
        vector<string> s;
        for(i = 0; i < n; i++){
            string temp;
            cin >> temp;
            sort(temp.begin(), temp.end());
            s.pb(temp);
        }
        sort(s.begin(), s.end());
        ll cnt = 1;
        ll ans = 0;
        for(i = 1; i < n; i++){
            if(s[i] == s[i - 1]){
                cnt++;
            }
            else{
                ans += ((cnt) * (cnt - 1)) / 2;
                cnt = 1;
            }
        }
        ans += (cnt * (cnt - 1)) / 2;
        cout << ans;
    }
    return 0;
}

Measured memory_bytes: 7392
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#include<set>
#include<map>
#include<ctime>
#include<iostream>
using namespace std;

int a,x,b;

int main()
{
	scanf("%d",&x);
	scanf("%d",&a);
	scanf("%d",&b);
	x = x - a;
	while(x >= b)
	{
		x = x - b;
	}
	printf("%d\n",x);
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a[] = new int[n];
        int b[] = new int[n];
        int c[] = new int[n - 1];
        int ans = 0;

        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            b[i] = sc.nextInt();
        }
        for (int i = 0; i < n - 1; i++) {
            c[i] = sc.nextInt();
        }

        for (int i = 1; i < n; i++) {
            if (a[i] - a[i - 1] == 1) {
                b[i] += c[a[i - 1] - 1];
            }
        }

        for (int i = 0; i < n; i++) {
            ans += b[a[i] - 1];
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define llp 1000000007
#define mod 1000000007

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

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;


int32_t main(){
	ios::sync_with_stdio(false);
    int n, m;
    cin>>n>>m;
    vi l(m),r(m);
    int L=1,R=n;
    REP(i,0,m){
        cin>>l[i]>>r[i];
        L=max(L,l[i]);
        R=min(R,r[i]);
        if(L>R){
            L=-1;
            R=-1;
            break;
        }
    }
    if(L==-1 && R==-1){
        cout<<0<<"\n";
    }
    else{
        int ans=R-L+1;
        cout<<ans<<"\n";
    }




	return 0;
}

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

using namespace std;

int gcd(int a, int b) {
    
    int r = 0;
    int result = 0;
    while(1){
        r = a % b;
        a = b;
        b = r;
        if(r == 0){
            result = a;
            break;
        }
    }

    return result;
}

int main(void)
{
    int K;
    cin >> K;

    int sum = 0;
    for(int i = 1;i <= K;i++){
        for(int j = 1; j <= K;j++){
            for(int l = 1; l <= K;l++){  
                //cout << gcd(gcd(i,j),l) << endl;       
                sum += gcd(gcd(i,j),l);
            }        
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3592
import collections

def main():
    S = input()
    d = dict()
    for c in S:
        d[c] = d.get(c, 0) + 1
    if len(d) == 2 and d[S[0]] == 2:
        return "Yes"
    return "No"


if __name__ == '__main__':
    print(main())

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

int main(){
	ll i,j,n,W;
  cin>>n>>W;
  int val[n],wt[n];
  
  for(i=0;i<n;i++)
    cin>>wt[i]>>val[i];
  ll kp[n+1][W+1];
  for(i=0;i<=n;i++){
  	for(j=0;j<=W;j++){
    	if(i==0 || j==0)
          kp[i][j]=0;
      else if(wt[i-1]>j)
        kp[i][j]=kp[i-1][j];
      else kp[i][j]=max(kp[i-1][j],kp[i-1][j-wt[i-1]]+val[i-1]);
    }
  }
  cout<<kp[n][W]<<"\n";
  return 0;
}

Measured memory_bytes: 79104
#include <iostream>
#include <queue>
#include <stack>
#include <vector>

using namespace std;

int main() {
  int N;
  int M;
  cin >> N >> M;
  vector<vector<int>> edges(M);
  vector<vector<int>> adj(N);
  vector<int> indegree(N, 0);
  for (int i = 0; i < M; ++i) edges[i].resize(2);
  for (int i = 0; i < M; ++i) cin >> edges[i][0] >> edges[i][1];
  for (int i = 0; i < M; ++i) adj[edges[i][0] - 1].push_back(edges[i][1] - 1);
  for (int i = 0; i < M; ++i) indegree[edges[i][1] - 1]++;

  queue<int> q;
  vector<int> sortedId;
  for (int i = 0; i < N; ++i) {
    if (indegree[i] == 0) q.push(i);
  }
  while (!q.empty()) {
    int id = q.front();
    sortedId.push_back(id);
    q.pop();
    for (auto out : adj[id]) {
      indegree[out] -= 1;
      if (indegree[out] == 0) q.push(out);
    }
  }

  vector<int> level(N, 0);
  int maxLevel = 0;
  for (auto id : sortedId) {
    for (auto out : adj[id]) {
      level[out] = level[id] + 1;
      maxLevel = max(level[out], maxLevel);
    }
  }
  cout << maxLevel;
}


Measured memory_bytes: 12540
n=int(input())
w=list(map(int,input().split()))
ans=[]
for i in range(1,n-1):
    S1=w[0:i+1]
    S2=w[i+1:]
    #print(S1,S2)
    s1=sum(S1)
    s2=sum(S2)
    #print(s1,s2)
    x=abs(s1-s2)
    ans.append(x)
    S1=[]
    S2=[]
#print(ans)
c=0
for i in range(len(ans)):
    if ans[i-1]>=ans[i]:
        c=ans[i]
print(c)

Measured memory_bytes: 3064
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <string>
#include <iostream>
#include <stack>
#include <tuple>
#include <map>
#include <cassert>

using namespace std;
typedef long long ll;

struct mint{
    static const long long MOD = 1000000007;

    long long v;

    mint() : v(0) {}
    mint(long long x){
        x = x % MOD;
        if(x < 0){ x += MOD; }
        v = x;
    }
    mint& operator+=(mint a){
        v += a.v;
        if(v >= MOD){ v -= MOD; }
        return *this;
    }
    mint& operator*=(mint a){
        v *= a.v;
        v %= MOD;
        return *this;
    }
    mint& operator-=(mint a){
        v -= a.v;
        if(v < 0){ v += MOD; }
        return *this;
    }
    mint& operator/=(mint a){
        return (*this) *= a.inv();
    }

    mint operator*(mint a) const{
        return mint(v) *= a;
    }

    mint operator+(mint a) const {
        return mint(v) += a;
    }

    mint operator-(mint a) const {
        return mint(v) -= a;
    }

    mint pow(long long k) const {
        mint res(1),tmp(v);
        while(k){
            if(k&1) res *= tmp;
            tmp *= tmp;
            k >>= 1;
        }
        return res;
    }
    mint inv(){return pow(MOD - 2); }

    static mint comb(long long n, int k){
        if(n < k){ return mint(0); }

        mint res(1);
        for(int i = 0; i < k; ++i){
            res *= mint(n - i);
            res /= mint(i + 1);
        }
        return res;
    }

    static mint factorial(long long n){
        mint res(1);
        for(int i = n; i > 1; --i){
            res *= mint(i);
        }
        return res;
    }

    bool operator<(const mint &a) const {
        return v < a.v;
    };
};

int main(){
    ll n, k;
    cin >> n >> k;
    for(int i = 0; i < k; ++i){
        mint tmp = mint::comb(k - 1, i);
        mint tmp2 = mint::comb(n - k + 1, i + 1);
        cout << (tmp * tmp2).v << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fi first
#define se second
#define fr(i,l,r) for(int i=l;i<=r;i++)
signed main()
{   //freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
 reverse(s.begin(),s.end());
    int dp[s.size()][13]={0};
    int a[s.size()];
    a[0]=1;
    for(int i=1;i<s.size();i++)
    {
           a[i]=(10*(a[i-1]))%13;
    }
    
    for(int i=0;i<s.size();i++)
    {
    	for(int j=0;j<13;j++)
    	{ 
    		if(i==0)
    		{
    			if(s[i]=='?')
    			{
    				 if(j<10)
    				dp[i][j]=1;
    			}
    		else
    		{
    			dp[i][s[i]-'0']=1;
    		}
    			continue;
    		}
    		
    		if(s[i]!='?')
    		 {int m=(a[i]*(s[i]-'0'))%13;
    		dp[i][(j+m)%13]=dp[i-1][j];}
    		else
    		{
    			for(int k=0;k<=9;k++)
    			{
    				int y=(a[i]*k)%13;
    				dp[i][(j+y)%13]+=dp[i-1][j];
    				dp[i][(j+y)%13]%=1000000007;
    			}
    		}
    	}

    	
    }
    cout<<dp[s.size()-1][5]%1000000007<<endl;
    return 0;
}

Measured memory_bytes: 11472
#include<stdio.h>
#include<ctype.h>
#include<stdlib.h>

int main()
{
  int n,m,l;
  int i,j,k;
  int a[101][101],b[101][101];
  long long c[101][101],s;
  
  scanf("%d%d%d",&n,&m,&l);
  for(i=0;i<n;i++){
    for(j=0;j<m;j++) scanf("%d",&a[i][j]);    
  }
  for(i=0;i<m;i++){
    for(j=0;j<l;j++) scanf("%d",&b[i][j]);
      }
  
  for(i=0;i<n;i++){
    for(j=0;j<l;j++){
      s=0;
      for(k=0;k<m;k++){
	s+=a[i][k]*b[k][j];
      }
      c[i][j]=s;
    }
  }

  for(i=0;i<n;i++){
    printf("%lld",c[i][0]);
    for(j=1;j<l;j++) printf(" %lld",c[i][j]);
    putchar('\n');
  }
  return 0;
}



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

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout<<setprecision(15);

    //I don't care about anybody, and fuck ratings! I'll go to google!
    int a, b, x; cin>>a>>b>>x;

    long double y;
    if(2*x > a*a*b) y = atan((2.0*a*a*b - 2.0*x)/(1.0*a*a*a));
    else y = atan((1.0*a*b*b)/(2.0*x));
    y = y*180.0/M_PI;
    cout<<y<<"\n";
    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
int main(void){
  int k,a,b,i;
  scanf("%d%d%d",&k,&a,&b);
  for(i=1;i<1000;i++){
  if(a<=k*i&&k*i<=b){
  puts("OK");
  break;
  }
  else if(b<k*i){
  puts("NG");
  break;
  }
  }
  return 0;
 }

Measured memory_bytes: 1648
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long LL;

LL n,pls = 1,ans = 0;

int main(){
	cin >> n;
	if(n & 1) cout << 0 << endl;
	else{
		n >>= 1;
		for(LL i = 1;i <= 100;i ++){
			pls = pls * 5;
			if(pls > n) break;
			ans += n / pls;
		}
		cout << ans << endl;
	}
	return 0;
}

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

typedef long long ll;

bool prime[1000000];
ll likenum[1000000];
ll Q;

void eratos(ll n){
    if(n==0 || n==1){
        prime[n] = false;
    }
    for(ll i=2; i<=n; i++){
        if(prime[i]){
            ll j= 2*i;
            while(j<=n){
                prime[j] = false;
                j += i;
            }
        }
        if(prime[(i+1)/2] && prime[i] && i>2){
                likenum[i] = likenum[i-1]+1;
            }else{
                likenum[i] = likenum[i-1];
            }
    }

}
int main(){
    cin >> Q;
    ll l[Q], r[Q];
    ll max_r;
    max_r = 0;
    for(ll i=0; i<Q; i++){
        cin >> l[i] >> r[i];
        max_r = max(max_r, r[i]);
    }
    for(ll i=0; i<=max_r; i++){
        prime[i] = true;
        likenum[i] = 0;
    }
    eratos(max_r);
    for(ll i=0; i<Q; i++){
        cout << likenum[r[i]] - likenum[l[i]-1] << endl;
    }
}


Measured memory_bytes: 4992
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=1e9,maxm=1e5;
int n,k,s;
int main(){
    ios::sync_with_stdio(false);
    cin>>n>>k>>s;
    if(s<maxn){
        for(int i=1;i<=k;i++)
            cout<<s<<" ";
        for(int i=k+1;i<=n;i++)
            cout<<maxn<<" ";
    }
    else
    {
        for(int i=1;i<=k;i++)
            cout<<maxn<<" ";
        for(int i=k+1;i<=n;i++)
            cout<<2<<" ";
    }
    return 0;
}

Measured memory_bytes: 1280
using System;

namespace _20200328
{
    class Program
    {
        static void Main()
        {
            var s = Console.ReadLine();
            if (s[2] == s[3] && s[4] == s[5])
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
using namespace std;
int main(void){
    long long n;
    cin>>n;
    for(long long i=1;i<=3500;i++){
        for(long long j=1;j<=3500;j++){
            
            long long b = 4*i*j-n*i-n*j;
            if(b>0){
                if((n*i*j)%b==0){
                    cout<<i<<" "<<j<<" "<<n*i*j/b<<endl;
                    return 0;
                }
            }
            
        }
    }
}


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

#define lpsbd(i, s, b, d) for(size_t i = (s); i < (b); i+=(d))
#define lpsb(i, s, b) for(size_t i = (s); i < (b); i++)
#define lpn(i, n) for(size_t i = 0; i < (n); i++)
#define fa(i, x) for(auto &i: x)
#define vcd(t, n, d) vector<t>(n, d)
#define vc(t, n) vector<t>(n)
#define all(x) (x).begin(), (x).end()

using namespace std;
using ll = long long;

const ll MOD = 1000000007;

int main(void)
{
    int N, K, Q;
    cin >> N >> K >> Q;
    auto P = vcd(int, N, Q);
    int A;
    lpn(i, Q)
    {
        cin >> A;
        P[A-1]--;
    }
    fa(i, P) cout << (i < K ? "Yes" : "No") << endl;
    return 0;
}

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

int main(){
  int N, T, A;
  cin >> N >> T >> A;
  vector<double> H(N);
  for(int i=0; i<N;i++)
    cin >> H.at(i);
  for(int i=0; i<N;i++)
    H.at(i) = abs(A - (T - H.at(i) * 0.006));
/* test
  for(int i=0; i<N;i++)
    cout << H.at(i) << ' ';
*/
  double min = H.at(0);
  int min_i = 0;
  for(int i=0;i<N;i++){
    if(min > H.at(i)){
      min = H.at(i);
      min_i = i;
    }
  }
  cout << min_i +1<< endl;
}


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

public class Hello
{
    public static void Main()
    {
        while (true)
        {
            var n = int.Parse(Console.ReadLine().Trim());
            if (n == 0) break;
            var ret = generatePrime(n);
            Console.WriteLine(ret);
        }
    }
    public static int generatePrime(int n)
    {
        var hs = new HashSet<int>();
        var f = new bool[2 * n + 1];
        var pL = 2 * n + 1;                                      // prime :  false
        f[0] = true; f[1] = true;
        for (int i = 2; i < pL; i++)
            if (!f[i])
                for (int j = i + i; j < pL; j += i)
                {
                    f[j] = true;
                    if (j > n) hs.Add(j);
                }
        return n - hs.Count();
    }
}






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

namespace ABC
{
    class C043
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            List<int> nums = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();

            int unko = int.MaxValue;
            for(int i = nums.Min(); i < nums.Max(); i++)
            {
                unko = Math.Min(unko, nums.Select(x => x > i ? x - i : i - x).Select(x => x * x).Sum());
            }

            Console.WriteLine(nums.Min() == nums.Max() ? 0 : unko);
        }
    }
}

Measured memory_bytes: 3032
def weight
  master = Array.new(10) { |i| 2**i }
  while gets
    element = $_.to_i
    spindles = master.select { |i| i <= element }
    result = []
    while true
      break if element <= 0
      minus = spindles.delete(spindles.max)
      next if minus > element
      element -= minus
      result << minus
    end
    puts result.sort.join(' ')
  end
end

weight

Measured memory_bytes: 8636
#129C
n, m = map(int, input().split())
a = [int(input()) for i in range(m)]
s = [1] + [0 for i in range(1,n+1)]
p = 1000000007
if n==1:
    print(1)
else:
    ind = 0
    if ind < m:
        if a[0] != 1:
            s[1] = 1
        else:
            ind += 1
    else:
        s[1] = 1
    for i in range(2,n+1):
        if ind < m:
            if a[ind] != i:
                s[i] = (s[i-1] + s[i-2]) % p
            else:
                ind += 1
        else:
            s[i] = (s[i-1] + s[i-2]) % p
    print(s[-1])


Measured memory_bytes: 8624
import sys
import math
import fractions
import bisect
import queue
import heapq
import collections
import itertools
sys.setrecursionlimit(4100000)

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288
INF = 1e18

'''
1行のint=====================================
N, K = map(int, input().split())
N, M = map(int, input().split())
A, B = map(int, input().split())

H, W = map(int, input().split())

L, R = map(int, input().split())

1行のstring=================================
S, T = input().split()

1行の整数配列================================
P = list(map(int,input().split()))

A = list(map(int,input().split()))
B = list(map(int,input().split()))

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

L = list(map(int,input().split()))
R = list(map(int,input().split()))

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

改行あり整数==================================
X = []
Y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    X.append(x1)
    Y.append(y1)

A = []
for i in range(N):
    a=int(input())
    A.append(a)

Pair = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    Pair.append((x1, y1))
    
2次元整数配列=====================================
A = []
for i in range(N):
    tmp = list(map(int,input().split()))
    A.append(tmp)


N行M列の初期化====================================
dp = [[VAL] * RETU for i in range(GYO)]

'''



S = input()

S = S[::-1]



ans = int(S[0]) * (2**(len(S)-1))
for i in range(1, len(S)):
    final = 0    
    for keta in range(0, i+1):
        if keta == i:
            final = 1
        ans += int(S[i]) * (10**keta) * (2**int(len(S)-2-keta+final))
        #print(S[i], keta, int(S[i]) * (10**keta) * (2**int(len(S)-2-keta+final)))
print(ans)







Measured memory_bytes: 5088
#!/usr/bin/env python
# coding: utf-8

# In[7]:


H,W = map(int, input().split())
ans = ["#"*(W+2)]
for _ in range(H):
    ans.append("#"+input()+"#")
ans.append("#"*(W+2))
for col in ans:
    print(col)


# In[ ]:






Measured memory_bytes: 3060
#include <algorithm>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <queue>
#include <string>
#include <vector>

using ll = long long;
using namespace std;

const ll mod = 998244353;

int main() {
    int n = 0;
    cin >> n;
    string s = "";
    cin >> s;
    vector<int> str(3*n);
    for (int i=0; i<3*n; i++) {
        if (s.at(i) == 'R') {
            str.at(i) = 0;
        }
        else if (s.at(i) == 'G') {
            str.at(i) = 1;
        }
        else {
            str.at(i) = 2;
        }
    }
    ll ans = 1;
    for (ll i=1; i<=n; i++) {
        ans *= i;
        ans %= mod;
    }
    vector<vector<int>> cnt(2, vector<int>(3));
    for (int i=0; i<3*n; i++) {
        if (cnt.at(1).at(str.at(i)) != 0) {
            ans *= cnt.at(1).at(str.at(i));
            ans %= mod;
            cnt.at(1).at(str.at(i))--;
        }
        else if (cnt.at(0).at((str.at(i)+1)%3) != 0) {
            ans *= cnt.at(0).at((str.at(i)+1)%3);
            ans %= mod;
            cnt.at(0).at((str.at(i)+1)%3)--;
            cnt.at(1).at((str.at(i)+2)%3)++;
        }
        else if (cnt.at(0).at((str.at(i)+2)%3) != 0) {
            ans *= cnt.at(0).at((str.at(i)+2)%3);
            ans %= mod;
            cnt.at(0).at((str.at(i)+2)%3)--;
            cnt.at(1).at((str.at(i)+1)%3)++;
        }
        else {
            cnt.at(0).at(str.at(i))++;
        }
    }
    cout << ans % mod << endl;
    return 0;
}


Measured memory_bytes: 1796
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;

int gcd(int a,int b){
    if(a%b==0){
        return b;
    }
    else{
        return gcd(b,a%b);
    }
}

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


    return 0;
}

Measured memory_bytes: 256
module Main where
import qualified Control.Monad as C
import qualified Data.Char as C
import qualified Data.List as L
import qualified Data.Map as M
import qualified Data.Array as A

int = read :: String -> Int
getWord :: IO String
getWord = do
  c <- getChar
  if C.isSpace c
  then
    return []
  else do
    ws <- getWord
    return (c:ws)
getInt = fmap int getWord
replace pred a = map (\x -> if pred x then a else x)

main = interact $ printer . solver . parser
parser = map int . words
printer = unlines . (:[])

solver [a,b,c,d] = takahashi_turn a b c d

takahashi_turn a b c d = if c-b <= 0 then "Yes" else aoki_turn a b (c-b) d
aoki_turn a b c d = if a-d <= 0 then "No" else takahashi_turn (a-d) b c d

Measured memory_bytes: 3932
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int N, K; cin >> N >> K;
    int snuke[N] = {};
    while (K--) {
        int d; cin >> d;
        REP(i, 0, d) {
            int a; cin >> a;
            snuke[--a]++;
        }
    }
    int ans = 0;
    REP(i, 0, N) if (snuke[i] == 0) ans++;
    cout << ans << endl;
    return 0;
}

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

int main() {
    long n, ans = 0;
    cin >> n;
    long temp = n;
    for(long i = 2; i * i <= n; i++) {
        long t = 0;
        while(temp % i == 0) {
            temp /= i;
            t++;
        }
        if(t >= 36) {
            ans += 8;
        } else if(t >= 28) {
            ans += 7;
        } else if(t >= 21) {
            ans += 6;
        } else if(t >= 15) {
            ans += 5;
        } else if(t >= 10) {
            ans += 4;
        } else if(t >= 6) {
            ans += 3;
        } else if(t >= 3) {
            ans += 2;
        } else if(t >= 1) {
            ans += 1;
        }
    }
    if(temp != 1) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 3648
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const int mod=998244353;
const llint big=2.19e18+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}

int main(void){
	cin.tie(0);ios::sync_with_stdio(false);
	int n,i,j;cin>>n;
	vector<vector<int>>ko(n);
	vector<int>oya(n,-1);
	for(i=0;i<n;i++){
		int id;cin>>id;
		int k;cin>>k;
		ko[id].res(k);
		for(j=0;j<k;j++){cin>>ko[id][j];oya[ko[id][j]]=id;}
	}
	vector<int>fka(n);
	queue<pair<int,int>>que;
	for(i=0;i<n;i++){
		if(oya[i]<0){que.push(mp(i,0));}
	}
	while(que.size()){
		int id,d;
		tie(id,d)=que.front();que.pop();
		fka[id]=d;
		for(auto it:ko[id]){que.push(mp(it,d+1));}
	}
	for(i=0;i<n;i++){
		cout<<"node "<<i<<": parent = "<<oya[i]<<", depth = "<<fka[i]<<", "<<
		(oya[i]==-1?"root, [":(ko[i].size()?"internal node, [":"leaf, ["));
		for(j=0;j<ko[i].size();j++){cout<<(j>0?", ":"")<<ko[i][j];}cout<<"]\n";
	}
	return 0;
}


Measured memory_bytes: 7376
#include <algorithm>
#include <array>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>

#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

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

int main() {
    string S, T;
    cin >> S >> T;
//    cout << T.substr(0, S.size()) << endl;
    if(S == T.substr(0, S.size()))
        cout << "Yes";
    else
        cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3628
n = int(input())
a_list = list(map(int, input().split()))
counts = {}
for a in a_list:
	if a in counts:
		counts[a] += 1
	else:
		counts[a] = 1
counts = sorted(counts.items(), reverse=True, key=lambda x: x[0])
a = 0
b = 0
for key, value in counts:
	if value > 1:
		if a == 0:
			a = key
			if value > 3:
				b = key
				break
		else:
			b = key
			break
r = a*b
print(r)

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

int main()
{
	int n;
	string s;

	cin >> n;
	cin >> s;

	bool yes = false;
	if (n % 2 == 0) {
		string t = s.substr(n / 2);
		if (s == t + t) {
			yes = true;
		}
	}

	if (yes) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
Sa = input()
Sb = input()
Sc = input()

b = Sb
c = Sc
s = Sa[0]
a = Sa[1:]

for i in range(len(Sa)+len(Sb)+len(Sc)):
    if s == "a":
        if len(a) == 0:
            print("A")
            break
        s = a[0]
        a = a[1:]
    elif s == "b":
        if len(b) == 0:
            print("B")
            break
        s = b[0]
        b = b[1:]
    elif s == "c":
        if len(c) == 0:
            print("C")
            break
        s = c[0]
        c = c[1:]

Measured memory_bytes: 9156
#include<stdio.h>
int main()
{
	int a;
	int b;
	int c;
	scanf("%d%d",&a,&b);
	if(a<10&&b<10){
		c=a*b;
		printf("%d\n",c);
	}
	else{
		printf("-1\n");
	}
	
	
	return 0;
}

Measured memory_bytes: 760
//QWsin
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=nxt[i])
#define repvc(i,vc) for(int i=0,Sz=vc.size();i<Sz;++i)
using namespace std;
inline int read()
{
	char ch=getchar();int ret=0,f=1;
	while(ch<'0' || ch>'9') {if(ch=='-')f=-1;ch=getchar();}
	for(;ch>='0' && ch<='9';ch=getchar()) ret=ret*10+ch-'0';
	return ret*f;
}

typedef long long ll;
const int INF=1<<30;

int main()
{
//	freopen("std.in","r",stdin);
	int a,b;cin>>a>>b;
	if(a>b) swap(a,b);
	rep(i,1,b) putchar('0'+a);
	return 0;
}


Measured memory_bytes: 256