akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N,n,ac,wa,tle,re;
  string l;
  cin >> N;
  n = 0;
  ac = 0;
  wa = 0;
  tle = 0;
  re = 0;
  while(n<N){
    cin >> l;
    if(l == "AC"){
      ac++;
    }
    if(l == "WA"){
      wa++;
    }
    if(l == "TLE"){
      tle++;
    }
    if(l == "RE"){
      re++;
    }
    n++;
  }
  cout << "AC x " << ac <<endl;
  cout << "WA x " << wa <<endl;
  cout << "TLE x " << tle <<endl;
  cout << "RE x " << re <<endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B,C,ans=3;
  cin >> A >> B >> C;
  if (A == B)
    ans--;
  if (B == C)
    ans--;
  if (C == A)
    ans--;
  if (A == B && B == C)
    ans = 1;
  cout << ans << endl;
}

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

int main() {
    stack<int> num;
    int ans = 1000000001;
    while (true) {
        string str;
        cin >> str;
        if (cin.eof()) {
            break;
        }
        int x, y;
        
        if (str == "+") {
            y = num.top();
            num.pop();
            x = num.top();
            num.pop();

            num.push(x + y);
        } else if (str == "-") {
            y = num.top();
            num.pop();
            x = num.top();
            num.pop();

            num.push(x - y);
        } else if (str == "*") {
            y = num.top();
            num.pop();
            x = num.top();
            num.pop();

            num.push(x * y);
        } else {
            num.push(stoi(str));
        }
        ans = num.top();
    }
    cout << ans << endl;
}


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

int main(){
    int n,count=0,k;
    cin >> n;
    vi ai(n);
    for (int i=1; i<=n; i++){
        cin >> k;
        if (i%2!=0 && k%2 != 0)count+= 1;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF 1e18
#define INF 1e9
using namespace std;

#define fs first
#define sc second

using P = pair<ll,ll>;
using Pll = pair<P,ll>;
using PQ = priority_queue<P,vector<P>,greater<P>>;


const ll MOD = 1e9+7;
ll n;
vector<char> c(10);

void dfs(ll k,ll memo){
    if(k == n){
        rep(i,0,n){
            cout << c[i];
        }
        cout << endl;
        return;
    }

    rep(i,0,memo+1){
        c[k] = 'a' + i;
        dfs(k+1,max(memo,i+1));
    }

    return;
}

signed main(){
    cin >> n;

    c[0] = 'a';
    dfs(1,1);

    return 0;
}


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

#include <cmath>
#include <cstdio>
#include <vector>
using namespace std;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

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

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

typedef long long ll;

int main() {
    int A, B, H, M;
    cin >> A >> B >> H >> M;
    double l = (H / 12.0 + M / 60.0 / 12.0) * 2 * M_PI;
    double s = M / 60.0 * 2 * M_PI;
    double theta = abs(l - s);
    theta = min(2 * M_PI - theta, theta);
    double ans = A * A + B * B - 2 * A * B * cos(theta);
    printf("%.20lf\n", sqrt(ans));
    return 0;
}

Measured memory_bytes: 4168
#include <bits/stdc++.h>
#define BPhuong ""
#define maxn 22
#define maxm
#define fi(i,a,b) for(int i = a; i<= b; i++)
#define fid(i,a,b) for(int i = a; i>= b; i--)
#define se second
#define f first
#define ll long long
#define pii pair<int, int>
#define pb push_back
#define bit(x, i) ((x>>i)&1)
#define oo 1e9
struct data{
    int x, y, z;
};
using namespace std;
int n, a[maxn][maxn], f[22][2100000], mod;
void nhap(){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);cout.tie(NULL);
    //freopen(BPhuong".inp","r",stdin);
    //freopen(BPhuong".out","w",stdout);
    cin >> n;
    fi(i, 0, n-1)
        fi(j, 0, n-1) cin >> a[i][j];
}

void xuli(){
    f[0][0] = 1; mod = 1e9 + 7;
    fi(i, 0, n-1)
    {
        if(a[0][i])
        {
            f[0][(1 << i)] = 1;
        }
    }
    fi(i, 1, n-1)
    {
        fi(j, 0, (1<<n)-1)
        {
            int cnt = j;
            if(f[i-1][j] == 0) continue;
            fi(k, 0, n-1)
            {
                if(a[i][k] && !bit(cnt, k))
                {
                    f[i][cnt + (1<<k)] += f[i-1][cnt];
                    f[i][cnt + (1<<k)] %= mod;
                }
            }
        }
    }
    cout << f[n-1][(1 << n)-1];
}

int main(){
    nhap();
    xuli();
}


Measured memory_bytes: 101836
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

class Edge
{
public:
    int to, cost;
    Edge(){};
    Edge(int to0, int cost0){to = to0; cost = cost0;}
};

void shortestPath(const vector<vector<Edge> >& edges, int start, vector<int>& dist)
{
    dist.assign(edges.size(), INT_MAX);
    dist[start] = 0;
    priority_queue<pair<int,int> ,vector<pair<int,int> >, greater<pair<int,int> > > q;
    q.push(make_pair(0, start));

    while(!q.empty()){
        pair<int, int> p = q.top();
        q.pop();
        int v = p.second;
        if(dist[v] < p.first)
            continue;
        for(unsigned i=0; i<edges[v].size(); ++i){
            Edge e = edges[v][i];
            if(dist[v] + e.cost < dist[e.to]){
                dist[e.to] = dist[v] + e.cost;
                q.push(make_pair(dist[e.to], e.to));
            }
        }
    }

    replace(dist.begin(), dist.end(), INT_MAX, -1);
}

int main()
{
    for(;;){
        int n, k;
        cin >> n >> k;
        if(n == 0)
            return 0;

        vector<vector<Edge> > edges(n+1);
        for(int i=0; i<k; ++i){
            int x;
            cin >> x;
            if(x == 0){
                int a, b;
                cin >> a >> b;
                vector<int> dist;
                shortestPath(edges, a, dist);
                cout << dist[b] << endl;
            }else{
                int c, d, e;
                cin >> c >> d >> e;
                edges[c].push_back(Edge(d, e));
                edges[d].push_back(Edge(c, e));
            }
        }
    }
}

Measured memory_bytes: 0
import math

n, k = map(int, input().split())
l = []
logk = math.log2(k)
for i in range(1, n + 1):
    p = math.ceil(logk - math.log2(i))
    p = p if p >= 0 else 0
    l.append(p)
maxl = max(l)
l = list(map(lambda x: 2**(maxl-x), l))
print(sum(l)/(n*2**maxl))

Measured memory_bytes: 10608
# 2019/10/02

n,k=map(int,input().split())

cnt=0
if k==0:
    print(n**2)
    exit()
for b in range(k+1,n+1):
    r=(n+1)%b
    p=(n+1)//b
    cnt+=p*(b-k)
    cnt+=max(r-k,0)
print(cnt)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mset(m,v) memset(m,v,sizeof(m))
#define pr(a,s) printf("Case #%lld: %lld\n",a,s)
#define mod 1000000007
#define mp make_pair
#define all(a)                a.begin(),a.end()
#define pb push_back
#define scan(a) scanf("%d",&a)
#define scanl(a) scanf("%lld",&a)
#define se second
#define fi first
#define pi 3.14159265358979323
#define pii pair<ll,ll>
 
const ll inf = 1e15;
const int MAXM = 3e3+4;
const int MAXN = 1e5+1;

ll arr[MAXM], dp[MAXM][MAXM];

ll solve(int st, int end)
{
	if (st == end)	return arr[st];
	if (dp[st][end] != -1)	return dp[st][end];
	ll ret = -inf;
	ret = max(ret, max(arr[st]-solve(st+1,end) , arr[end]-solve(st,end-1)));
	return dp[st][end] = ret;
}

int main()
{
	mset(dp,-1);
	int n;
	cin>>n;
	ll sum = 0;
	for (int i=1;i<=n;i++){
		cin>>arr[i];
	}
	ll x = solve(1,n);
	cout << x << endl;
}

Measured memory_bytes: 70912
def cmb(n,r,mod):
  if r<0 or r>n:
    return 0
  r=min(r,n-r)
  return g1[n]*g2[r]*g2[n-r]%mod

n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
ct=[0]*n
X=[]
for i in range(n+1):
  ct[a[i]-1]+=1
for i in range(n):
  if ct[i]==2:
    x=i+1
    break
for i in range(n+1):
  if a[i]==x:
    X.append(i)

g1=[1,1]
g2=[1,1]
inverse=[0,1]
 
for i in range(2,n+2):
  g1.append((g1[-1]*i)%mod)
  inverse.append((-inverse[mod%i]*(mod//i))%mod)
  g2.append((g2[-1]*inverse[-1])%mod)

for i in range(1,n+2):
    print((cmb(n+1,i,mod)-cmb(X[0]+n-X[1],i-1,mod)+mod)%mod)

Measured memory_bytes: 71660
if __name__ == '__main__':
	turn = int(input())
	taro, hanako = 0,0
	for i in range(turn):
		t_card, h_card = map(str,input().split())
		if t_card > h_card:
			taro += 3
		elif h_card > t_card:
			hanako += 3
		else:
			taro +=1
			hanako += 1
	print("%d %d" % (taro,hanako))


Measured memory_bytes: 5600
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

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

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

INF=Float::INFINITY

MOD=998244353
N=gets.to_i
D=get_i
unless D[0].zero?
    puts 0
    exit
end
kind=Hash.new(0)
D.each do|d|
    kind[d]+=1
end
kind=kind.sort{|x,y| x[0]<=>y[0]}
if kind[0][1]!=1
    puts 0
    exit
end
M=kind.size
ans=1
(M-1).times do|i|
    if kind[i][0]!=kind[i+1][0]-1
        puts 0
        exit
    end
  ans=(ans*kind[i][1]**kind[i+1][1])
  ans%=MOD
end
puts ans

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



int main()
{
	int N;
	int A[200000];
	int tmp1 = 0, tmp2 = 0, tmp3 = 0;
	int g = 0;
	cin >> N;

	for (int i = 0; i < N - 1; i++) {

		cin >> A[i];
	}

	sort(A, A + N - 1);


	if (A[0] != 1) {
		for (int i = 0; i < A[0] - 1; i++) {
			cout << "0" << "\n";
		}
	}
		for (int i = 0; i < N - 1; i++) {
			tmp1 = A[i];

			if (tmp1 != tmp2 && tmp2 != 0) {

				cout << tmp3 << "\n";
			}

			if (tmp1 != tmp2 && tmp2 != 0) {

				for (g = 0; g < tmp1 - tmp2 - 1; g++) {
					cout << "0" << "\n";
				}

				tmp3 = 0;
			}

			tmp2 = A[i];
			tmp3++;
		}

		cout << tmp3 << "\n";

		for (int i = 0; i < N - A[N - 2]; i++) {
			cout << "0" << "\n";
		}

}

Measured memory_bytes: 4380
#include<iostream>

using namespace std;

int main(){
	int a, b, c, ans = 0;
	cin >> a >> b >> c;
	if(a == b && b == c){ 
		cout << ((a % 2 == 0)? -1 : 0) << endl;
		return 0;
	}
	while(a % 2 == 0 && b % 2 == 0 && c % 2 == 0){
		int x = a, y = b, z = c;
		a = (y + z) / 2;
		b = (x + z) / 2;
		c = (z + y) / 2;
		ans++;
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
    
    size_t n, ans = 0;

    std::cin >> n;

    std::vector<int> v(n), c(n);

    for(auto&& e : v){
        std::cin >> e;
    }

    for(auto&& e : c){
        std::cin >> e;
    }

    for(size_t i = 0; i < n; i++){
        if(v[i] - c[i] >= 0){
            ans += v[i] - c[i];
        }
    }

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


Measured memory_bytes: 256
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
#define MAX_N 300000
bool ans = false;
vector<ll> G[MAX_N];
ll checked[MAX_N][2][2]={};
string s;
void solve(ll v,ll ch,ll cnt){
  if(ans) return;
  if(checked[v][ch][cnt]==2){
    return;
  }
  if(ch==0&&cnt==0&&checked[v][ch][cnt]==1){
    ans = true;
    return;
  }
  ll prech = ch,precnt = cnt;
  checked[v][ch][cnt] = 1;
  cnt++;
  if(cnt==2){
    cnt = 0;
    ch = (ch+1)%2;
  }
  for(auto nv:G[v]){
    if(ch==0&&s[nv]=='A'){
      solve(nv,ch,cnt);
    }
    if(ch==1&&s[nv]=='B'){
      solve(nv,ch,cnt);
    }
  }
  checked[v][prech][precnt] = 2;
}
signed main(){
  init_io();
  ll n,m;
  cin >> n >> m >> s;
  vector<ll> a(m),b(m);
  for(int i=0;i<m;i++){
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    G[a[i]].push_back(b[i]);
    G[b[i]].push_back(a[i]);
  }
  for(int i=0;i<n;i++){
    if(s[i]=='A'){
      solve(i,0,0);
    }
  }
  if(ans) cout <<"Yes"<<endl;
  else cout <<"No"<<endl;
}


Measured memory_bytes: 32336
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<unordered_set>
#include<unordered_map>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod;

int main(){
  ll n;cin>>n;
  cout<<(n-2)*180<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	int S, x, y;
	cin >> S;
	x = S / 100;
	y = S % 100;

	if (x <= 12 && y <= 12 && x>0 && y>0)
		cout << "AMBIGUOUS\n";
	else if ((x > 12|| x == 0) && y <= 12 && y>0)
		cout << "YYMM\n";
	else if (x <= 12 &&( y > 12 || y == 0) && x>0 )
		cout << "MMYY\n";
	else
		cout << "NA\n";

	return 0;
}

Measured memory_bytes: 256
/*
.   Bismillahir Rahmanir Rahim
.   Author - Marajul islam
.   created-Sat Mar 28 17:56:15 2020 

*/ 
#include<bits/stdc++.h>
using namespace std;


 
int sc1() {int x; scanf("%d", &x); return x;}
long long sc2() {long long x; scanf("%lld", &x); return x;}

const int mod= 1e9 + 7;
inline int add(int a, int b) {a += b; return a >= mod ? a - mod : a;}
inline int sub(int a, int b) {a -= b; return a < 0 ? a + mod : a;}
inline int mul(int a, int b) {return (long long)a * b % mod;}
 
#define F               first
#define S               second 
#define mp              make_pair
#define pb              push_back
#define pf              push_front
#define speed_up        ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define sz(x)           (int)x.size()
#define all(x)          x.begin(), x.end()
#define debug           cerr << "OK\n";
#define ub              upper_bound
#define lb              lower_bound
#define gcd(a,b)        __gcd(a,b)
#define lcm(a,b)        (a*b)/gcd(a,b)
#define Int             sc1()
#define LL              sc2()
#define For(n)          for(int i=0;i<n;i++)
#define Forj(n)         for(int j=0;j<n;j++)
#define Fork(n)         for(int k=0;k<n;k++)
#define For1(n)         for(int i=1;i<=n;i++)

typedef long long       ll;
typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<pii>     vpii;
typedef set <int>       si;
typedef set <ll>        sll;
typedef multiset <int>  msi;
typedef multiset <ll>   msll;
typedef map <int, int>  mi;
typedef map <ll, ll>    mll;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << ", ";
    err(++it, args...);
}
  
const int inf           = (int)2e9 + 5;
const ll  Inf           = (ll)1e18 + 5;
const int N             = 5e6 + 5;
 
 
 
int solve() {
 
	string s;
	cin>>s;
	if(sz(s)!=6){
		puts("No");
		return 0;
	}
	else{
		if(s[2]==s[3] && s[4]==s[5]){
			puts("Yes");
		}
		else
			puts("No");
	}
 
	return 0;
}
 
 
 
 
int main()
{
	//speed_up;
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
 
	int test = 1, tc = 0;
	//scanf("%d", &test);
	//cin >> test;
	while (test--) {
		//printf("Case %d: ", ++tc);
		solve();
	}
 
	return 0;
 
 
 
 
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    string in; cin >> in;
    int n = 4;
    vi a(n); rep(i, n) a[i] = in[i] - '0';

    rep(i_, 2){
        int i = 2 * i_ - 1;
        rep(j_, 2){
            int j = 2 * j_ - 1;
            rep(k_, 2){
                int k = 2 * k_ - 1;

                int cur = a[0] + i * a[1] + j * a[2] + k * a[3];
                if(cur == 7){
                    stringstream ss;
                    ss << a[0];
                    ss << (i == 1 ? '+':'-');
                    ss << a[1];
                    ss << (j == 1 ? '+':'-');
                    ss << a[2];
                    ss << (k == 1 ? '+':'-');
                    ss << a[3];
                    ss << "=7";
                    cout << ss.str() << endl;
                    return 0;
                }
            }
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define F first
#define S second
#define pss pair<string,string>
#define pcc pair<char,char>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define piii pair<int,pii>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define vs vector<string>
#define vl vector<ll>
#define vs vector<string>
#define vll vector<pll>
#define vss vector<pss>
#define vcc vector<pcc>
#define MP make_pair
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=n-1;i>=0;i--)
#define Very_fast std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
const int N = 1e5+5;
const int mod=1e9+7;
const int INF=0x3f3f3f3f;
inline ll gcd(ll a,ll b){if(b==0)return a;else return gcd(b,a%b);}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline ll lowbit(ll x){return (x&-x);}
int n;ll x,ans,sum;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>x;
		ans=(ans+x*sum%mod)%mod;
		sum=(sum+x)%mod;
	}
	cout<<ans;
	return 0;
}

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

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

}

signed main(){

    

    int n;
    cin>>n;
    int pos = 1;
    int noBreak = 0;
    for(int i=0;i<n;i++){
    	int temp;
    	cin>>temp;
    	if(temp == pos){
    		pos++;
    	}else noBreak++;
    }
    if(noBreak > n-1){
    	cout<<"-1";
    }else{
    	cout<<noBreak;
    }

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long a = sc.nextLong();
    long b = sc.nextLong();
   
    for(int i=0;i<=1000;i++){
      if((int)(i*0.08)==a&&(int)(i*0.1)==b){
        System.out.println(i);
        return;
      }
    }
    System.out.println("-1");
  }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

const int mod = 998244353;
int add(int a, int b) { return (a += b) < mod? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
void adds(int& a, int b) { a = add(a, b); }
void muls(int& a, int b) { a = mul(a, b); }
int pwr10[200005];
int ppwr10[200005];

int f(int p, int q, int val)
{
    if (val == -1) return 0;
    return mul(val, mul(ppwr10[q - p], pwr10[p - 1]));
}

int a[200005];
const int N = 1 << 18;
int tree[2 * N];
int fix[2 * N];

void upd(int node)
{
    tree[node] = add(tree[node * 2], tree[node * 2 + 1]);
}

void apply(int fval, int node, int p, int q)
{
    if (fval != -1)
    {
        tree[node] = 0;
        fix[node] = fval;
    }
    adds(tree[node], f(p, q, fval));
}

void prop(int node, int p, int q)
{
    if (node >= N)
        return;

    int mid = (p + q) / 2;
    apply(fix[node], 2 * node, p, mid);
    apply(fix[node], 2 * node + 1, mid + 1, q);
    fix[node] = -1;
}

void setf(int l, int r, int val, int node = 1, int p = 1, int q = N)
{
    if (q < l || p > r)
        return;

    if (p >= l && q <= r)
    {
        fix[node] = val;
        tree[node] = f(p, q, val);
        return;
    }

    int mid = (p + q) / 2;
    prop(node, p, q);
    setf(l, r, val, 2 * node, p, mid);
    setf(l, r, val, 2 * node + 1, mid + 1, q);
    upd(node);
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ppwr10[0] = pwr10[0] = 1;
    for (int i = 1; i <= 200000; ++i)
        ppwr10[i] = pwr10[i] = mul(pwr10[i - 1], 10);
    for (int i = 1; i <= 200000; ++i)
        adds(ppwr10[i], ppwr10[i - 1]);

    int n, q;
    cin >> n >> q;
    memset(fix, -1, sizeof fix);
    setf(1, n, 1);
    while (q--)
    {
        int e, a, b;
        cin >> a >> b >> e;
        setf(n - b + 1, n - a + 1, e);
        cout << tree[1] << '\n';
    }
}


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

int main() {
	int A,B;
	string o;
	
	cin >> A >> o >> B;
	if(o == "+") A += B;
	else if(o=="-") A-=B;
	
	
	
	cout << A;

	cout << endl;
	
	return 0;
}

Measured memory_bytes: 256
import itertools

s = input()
sum = 0

patern = [i for i in range(len(s)-1)]
pair = []
for i in range(0, len(patern)+1):
	pair += list(itertools.combinations(patern, i))

for lst in pair:
	start = 0
	for i in lst:
		sum += int(s[start:i+1])
		start = i+1
	sum += int(s[start:len(s)]) 


print(sum)

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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define MOD 1e9+7
#define sp ' '


using ll = long long;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    int cnt = 1;
    set<int> st;

    while(1){
        auto tmp = st.insert(n);
        if(!tmp.second){
            ppp(cnt);
            return 0;
        }
        ++cnt;
        if(n%2)
            n = 3*n+1;
        else
            n /= 2;


    }



    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;
double x[110000];
double y[110000];
pair<double,double>p[110000];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++){
		double X,Y;
		scanf("%lf%lf",&X,&Y);
		x[i]=cos(1)*X-sin(1)*Y;
		y[i]=sin(1)*X+cos(1)*Y;
		p[i]=make_pair(x[i],y[i]);
	}
	std::sort(p,p+a);
	double ret=99999999;
	for(int i=0;i<a;i++){
		for(int j=i-1;j>=0;j--){
			if(p[i].first-p[j].first>ret)break;
			ret=min(ret,sqrt((p[i].first-p[j].first)*(p[i].first-p[j].first)+(p[i].second-p[j].second)*(p[i].second-p[j].second)));
		}
	}
	printf("%.12f\n",ret);
}

Measured memory_bytes: 4384
import java.io.PrintWriter;
import java.util.*;

public class Main {
    private static int n, m;
    private static char[] s, t;
    private static int[][] sp, tp;
    private static short[][] dp;

    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out)) {
            s = in.next().toCharArray();
            t = in.next().toCharArray();
            n = s.length;
            m = t.length;
            sp = new int[2][n + 2];
            tp = new int[2][m + 2];
            dp = new short[n + 2][m + 2];
            sp[0][n] = sp[1][n] = n;
            tp[0][m] = tp[1][m] = m;

            // 不可能な遷移先
            sp[0][n + 1] = sp[1][n + 1] = n + 1;
            tp[0][m + 1] = tp[1][m + 1] = m + 1;
            // とり尽くした
            sp[0][n] = sp[1][n] = n + 1;
            tp[0][m] = tp[1][m] = m + 1;
            // 通常遷移
            for (int i = n - 1; i >= 0; i--) {
                for (int j = 0; j < 2; j++) sp[j][i] = sp[j][i + 1];
                sp[s[i] - '0'][i] = i + 1;
            }
            for (int i = m - 1; i >= 0; i--) {
                for (int j = 0; j < 2; j++) tp[j][i] = tp[j][i + 1];
                tp[t[i] - '0'][i] = i + 1;
            }


            int len = dp(0, 0);
            //Arrays.stream(dp).map(Arrays::toString).forEach(System.out::println);
            int i = 0, j = 0;
            StringBuilder ans = new StringBuilder();
            for (int k = 0; k < len; k++) {
                if (dp(sp[0][i], tp[0][j]) <= dp(sp[1][i], tp[1][j])) {
                    i = sp[0][i];
                    j = tp[0][j];
                    ans.append('0');
                } else {
                    i = sp[1][i];
                    j = tp[1][j];
                    ans.append('1');
                }
            }
            out.println(ans.toString());
        }
    }

    private static short dp(int i, int j) {
        if (i == n + 1 && j == m + 1) return 0;
        if (dp[i][j] > 0) return dp[i][j];
        short res = Short.MAX_VALUE;
        for (int k = 0; k < 2; k++) {
            int di = sp[k][i], dj = tp[k][j];
            short t = dp(di, dj);
            if (t < res) res = t;
        }
        res++;
        return dp[i][j] = res;
    }
}



Measured memory_bytes: 89476
#include<stdio.h>
int main(void){
  int a[3];
  int five = 0,seven = 0;
  scanf("%d%d%d",a,a+1,a+2);
    for(int cnt = 0;cnt < 3;cnt++){
      if(a[cnt] == 5) five += 1;
      else if(a[cnt] == 7) seven += 1;
    }
    if(five == 2 && seven == 1) printf("YES");
    else printf("NO");
  return 0;
}


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

typedef long long ll;

const ll mod = 1000000007;

int main() {
    int H, W, A;
    cin >> H >> W;
    int c[10][10];
    for (int i = 0; i < 10; i++) {
        for (int j = 0; j < 10; j++) {
            cin >> c[i][j];
        }
    }
    for (int k = 0; k < 10; k++) {
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                c[i][j] = min(c[i][j], c[i][k]+c[k][j]);
            }
        }
    }

    int ans = 0;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> A;
            if (A >= 0) {
                ans += c[A][1];
            }
        }
    }
    cout << ans << endl;

}


Measured memory_bytes: 256
li = input().split('/')

if int(li[0]) >= 2020:
    print("TBD")
if int(li[0]) <= 2018:
    print("Heisei")
if int(li[0]) == 2019:
    if int(li[1]) >= 5:
        print("TBD")
    if int(li[1]) <= 3:
        print("Heisei")
    if int(li[1]) == 4:
        print("Heisei")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n;
  	cin>>n;
  	long long start = 100;
  int n_years=0;
  while(start<n){
  	n_years++;
    start*=1.01;
  }
  cout<<n_years<<endl;
}

Measured memory_bytes: 3600
import numpy as np


def solve(string):
    num_max = 100000
    primes = np.asarray([True for _ in range(num_max + 1)])
    primes[:2] = False
    for i in range(2, num_max + 1):
        if primes[i]:
            primes[i * 2::i] = False
    primes = set(np.arange(num_max + 1)[primes])
    like2017 = [1 if i in primes and (i + 1) // 2 in primes else 0 for i in range(num_max + 1)]
    cumsum = np.cumsum(like2017)

    q, *lr = map(int, string.split())
    return "\n".join([str(cumsum[r] - cumsum[l - 1]) for l, r in zip(lr[::2], lr[1::2])])


if __name__ == '__main__':
    n = int(input())
    print(solve('{}\n'.format(n) + '\n'.join([input() for _ in range(n)])))


Measured memory_bytes: 36936
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
      int k = scan.nextInt();
      String s = scan.next();
      if (k>=s.length()){
        System.out.println(s);
      }
      else{
        for (int i=0;i<k;i++){
          System.out.print(s.charAt(i));
        }
        System.out.println("...");
      }

  }
}


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

// Optimization

//#pragma GCC optimize("O3")
#define endl '\n'

// Shortcut

#define int long long
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define mp make_pair
#define upb upper_bound
#define lwb lower_bound
#define fi first
#define se second
#define For(i, l, r) for (int i = l; i < r; i++)
#define ForE(i, l, r) for (int i = l; i <= r; i++)
#define Ford(i, r, l) for (int i = r; i > l; i--)
#define FordE(i, r, l) for (int i = r; i >= l; i--)
#define Fora(i, a) for (auto i : a)

// I/O & Debug

#define PrintV(a) Fora(iiii, a) cout << iiii << ' ';
#define PrintVl(a) Fora(iiii, a) cout << iiii << endl;
#define PrintA(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << ' ';
#define PrintAl(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << endl;
#define Ptest(x) return cout << x, 0;
#define gl(s) getline(cin, s);
#define setpre(x) fixed << setprecision(x)
/*
#define debug(args...){ string _sDEB = #args; replace(_sDEB.begin(), _sDEB.end(), ',', ' '); stringstream _ssDEB(_sDEB); istream_iterator<string> _itDEB(_ssDEB); DEB(_itDEB, args); }
void DEB(istream_iterator<string> it) {}
template<typename T, typename... Args>
void DEB(istream_iterator<string> it, T a, Args... args){
    cout << *it << " = " << a << endl;
    DEB(++it, args...);
}
*/

// Functions

//#define isvowel(a) (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define bend(a) a.begin(), a.end()
#define rbend(a) a.rbegin(), a.rend()
#define mset(a) memset(a, 0, sizeof(a))
#define mset1(a) memset(a, 1, sizeof(a))
#define msetn1(a) memset(a, -1, sizeof(a))
#define msetinf(a) memset(a, 0x3f, sizeof(a))
#define gcd __gcd
#define __builtin_popcount __builtin_popcountll
//mt19937 rando(chrono::steady_clock::now().time_since_epoch().count());

// Data Structure

#define pque priority_queue
#define mts multiset
#define y0 _y0_
#define y1 _y1_
#define div divi
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <ld> vld;
typedef vector <string> vs;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <vi > vvi;
typedef vector <vll > vvll;
typedef vector <pii > vpii;
typedef vector <pll > vpll;

const int N = 2e5 + 5, M = 1e6 + 5, mod = 1e9 + 7, mod1 = 998244353, mod2 = 1e9 + 9, inf = 1e9 + 7;
const ll infll = 1e18 + 7;

int n, ans;
map <pii, int> mpp;

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n;
    ForE(i, 1, n){
        int ti = i;
        int x, y = i % 10;
        while (ti >= 10){
            ti /= 10;
        }
        x = ti;
        mpp[{x, y}]++;
    }
    Fora(v, mpp){
        ans += v.se * mpp[{v.fi.se, v.fi.fi}];
    }
    cout << ans;
}

/*
==================================+
INPUT:                            |
------------------------------    |

------------------------------    |
==================================+
OUTPUT:                           |
------------------------------    |

------------------------------    |
==================================+
*/

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>

int s[100000];

int main() {
	int n, q;
	int cnt = 0;

	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", &s[i]);
	}
	std::sort(s, s + n);
	scanf("%d", &q);
	for (int i = 0; i < q; ++i) {
		int t;
		scanf("%d", &t);
		int top = 0, end = n;
		while (top < end) {
			int i2 = top + (end - top) / 2;
			if (t == s[i2]) {
				++cnt;
				break;
			}
			if (t < s[i2]) {
				end = i2;
			}
			else {
				top = i2 + 1;
			}
		}
	}

	printf("%d\n", cnt);
}

Measured memory_bytes: 3124
fun main() {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(' ').map { it.toInt() }

    var sum = 0L
    val cnt = IntArray(100001)
    for (i in a) {
        cnt[i]++
        sum += i
    }

    val q = readLine()!!.toInt()
    (0 until q)
            .map {
                val (b, c) = readLine()!!.split(' ').map { it.toInt() }
                sum += (c - b) * cnt[b]
                cnt[c] += cnt[b]
                cnt[b] = 0
                sum
            }
            .joinToString("\n")
            .let { println(it) }
}


Measured memory_bytes: 64628
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
const int N=2e5+5;
priority_queue< pair<int,int> > q;
int n,c[N],a[N];
int le(int u){
	return u==1?n:u-1;
}
int re(int u){
	return u==n?1:u+1;
}
signed main(){
	///freopen("in01.txt","r",stdin);
	cin>>n;
	for(int i=1;i<=n;++i)
		cin>>a[i];
	for(int i=1;i<=n;++i)
		cin>>c[i];
	for(int i=1;i<=n;++i)
		if(c[i]!=a[i]) q.push(make_pair(c[i],i));
	int ans=0;
	while(!q.empty()){
		int u=q.top().se,tmp=0; q.pop();
		tmp=c[le(u)]+c[re(u)];
		if(q.empty()){
			if((c[u]-a[u])%tmp!=0) return puts("-1"),0;
			ans+=(c[u]-a[u])/tmp; c[u]=a[u]; break;
		}
		int t=(c[u]-a[u])/tmp;t=max(t,1ll);
		c[u]-=t*tmp; ans+=t;
		if(c[u]<a[u]) return puts("-1"),0;
		if(c[u]>a[u]) q.push(make_pair(c[u],u));
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 10524
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end())
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 1e5;
ll n, g;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  FOR(i, 1, 3501){
    ll a = i*4-n, b = n*i;
    if(a <= 0) continue;
    g = gcd(a, b);
    a /= g;
    b /= g;
    FOR(j, i, 3501){
      ll aa = a*j-b, bb = b*j;
      if(aa>0 && bb%aa==0){
        cout << i << " " << j << " " << bb/aa << endl;
        return 0;
      }
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  cin>>N;
  if(N==13){
    cout<<":("<<endl;
    return 0;
  }
  if(N<=12){
    cout<<N<<endl;
    return 0;
  }
  for(int i=0;i<N;i++){
    if(i*108/100==N){
      cout<<i<<endl;
      return 0;
    }
  }
  cout<<":("<<endl;
}

Measured memory_bytes: 3596
#include <iostream>
using namespace std;
int main(void){
  int m,f,r;
  while(cin>>m>>f>>r,m!=-1||f!=-1||r!=-1){
		const string ANS = "ABCDF";
		int ans = 0;
		if(m==-1 || f==-1) ans = 4;
		else if(m+f>=80) ans = 0;
		else if(m+f>=65) ans = 1;
		else if(m+f>=50) ans = 2;
		else if(m+f>=30){
			if(r>=50) ans = 2;
			else ans = 3;
		}else ans = 4;
    cout<<ANS[ans]<<endl;
  }
  return 0;
}

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

int main(){
  int a,b;
  cin >> a >> b;
  
  int count = 1;
  int saisyo = a;
  if(b == 1)count = 0;
  
  while(a < b){
    a = a - 1 + saisyo;
    count ++;
  }
  
  cout << count << endl;
}

Measured memory_bytes: 256
/******************************************************************************
 
рассвет. 
 
*******************************************************************************/
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define rapgame ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define eb emplace_back
#define vi vector <int>
#define vlli vector <lli>
#define vulli vector <ulli>
#define vchar vector <char>
#define vstr vector <string>
#define vb vector <bool>
#define fst first
#define sec second
#define srt(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define vpii vector <pair <int,int> >
#define pii pair <int,int> 
#define vplli vector <pair <lli,lli> >
#define vpulli vector <pair <ulli,ulli> >
#define vvi vector <vector <int> >
#define vvlli vector <vector <lli> >
#define vvpii vector <vector <pair <int,int>> >
#define fr(i,n) for (int i = 0; i < (n); ++i)
#define frbig(i,n) for (lli i = 0; i < (n); ++i)
#define fra(i,a,n) for (lli i = a; i < (n); ++i)
#define run(c,s) for(auto c:s) 
#define read(n) int n; cin >> n;
#define readchar(n) char n; cin >> n;
#define readstr(n) string n; cin >> n;
#define readarr(a,n) fr(i,n) cin >> a[i];
#define read2(x,y) int x,y; cin >> x >> y;
#define read2ll(x,y) long long int x,y; cin >> x >> y;
#define readll(n) lli n; cin >> n;
#define watch(x) cout << (#x) << " is " << (x) << endl
#define print_array(x) fr(i,x.size()) cout << x[i] << " ";
using namespace std;
 
const lli MOD=1e9+7;
const lli MAXN=1e6+1;
const ld PI=acos(-1);
 
int main(){
    rapgame
    read(n);
    int ans=0;
    set <string> k;
    fr(i,n){
        string s;
        cin >> s;
        if(k.find(s)==k.end()){
            ans++;
            k.insert(s);
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 19232
#include <stdio.h>

int n, d1, d2, n2, vis[600][600], p;
void run(int d) {
	int b = 0;
	while (!(d & 3)) d >>= 2, b++;
	if (d & 1) {
		for (int i = 0; i < n2; i++)
			for (int j = 0; j < n2; j++) 
				if (((i >> b) + (j >> b)) & 1) vis[i][j] = 1;
	} else {
		for (int i = 0; i < n2; i++)
			for (int j = 0; j < n2; j++) 
				if ((i >> b) & 1) vis[i][j] = 1;
	}
}
int main() {
	scanf("%d%d%d", &n, &d1, &d2); n2 = n * 2;
	run(d1), run(d2);	
	for (int i = 0; i < n2; i++)
		for (int j = 0; j < n2; j++)
			if (p < n * n && !vis[i][j])
				printf("%d %d\n", i, j), p++;
//	for (int i = 0; i < n2; i++, puts(""))
//		for (int j = 0; j < n2; j++)
//			printf("%d", vis[i][j]);
	return 0;
} 

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
signed main()
{
    SPEED;
  	int n;
  	string s,t;
  	cin>>s;
  	n=s.length();
  	for(int i=0;i<n/2;++i)
      	t+="hi";
  	if(s==t)
      	cout<<"Yes";
  	else
      	cout<<"No";
}

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

typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1e9+7,INF=mod*mod*3;
#define rep(i,N) for(ll i=0; i<(N); i++)
#define rep1(i,N) for(ll i=1; i<(N); i++)
#define pb push_back

ll A,B;
int main(){

cin.tie(0);
ios::sync_with_stdio(false);

cin>>A>>B; 

ll XorB;
if(B%4==0) XorB=B;
if(B%4==1) XorB=1;
if(B%4==2) XorB=B+1;
if(B%4==3) XorB=0;
ll XorA;
if(A-1>=0){
	if((A-1)%4==0) XorA=A-1;
	if((A-1)%4==1) XorA=1;
	if((A-1)%4==2) XorA=A;
	if((A-1)%4==3) XorA=0;
}

if(A-1>=0){
	cout<<(XorA^XorB)<<endl;
}else{
	cout<<XorB<<endl;
}


}
	


Measured memory_bytes: 256
/*      ░░█ ▄▀█ █   █▀ █░█ █▀█ █▀▀ █▀▀   █▀█ ▄▀█ █▀▄▀█
        █▄█ █▀█ █   ▄█ █▀█ █▀▄ ██▄ ██▄   █▀▄ █▀█ █░▀░█     */

// Author : Udit "luctivud" Gupta @ (https://www.linkedin.com/in/udit-gupta-1b7863135/)


#include <bits/stdc++.h>
#pragma GCC optimize "trapv"

using namespace std;

typedef long long int lld;
typedef unsigned long long int llu;


#define       TESTCASES()  cin >> (T3X0); T353 = T3X0; while(T3X0--)
#define       _input(V3C)  for(auto &V3C_I7 : (V3C)) cin >> (V3C_I7)
#define mems(A77AY, V4LU)  memset((A77AY), (V4LU), sizeof((A77AY)))
#define  CH3K(I7, E4, S7)  (((S7)<0) ? (I7)>(E4) : (I7)<(E4))
#define for4(I7,S4,E4,S7)  for(auto I7=(S4); CH3K(I7,E4,S7); (I7)+=(S7))




void solveEachTest(lld T35TC453N = 1) {

	string s; cin >> s;
	vector<lld>arr(26, false);

	for (auto i : s) {
		arr[i - 'a'] = true;
	}

	char ans = '$';
	for4 (i, 0ll, 26, 1ll) {
		if (arr[i] == false) {
			ans = char(i + 'a');
			break;
		}
	}

	if (ans == '$') {
		cout << "None";
	} else {
		cout << ans;
	}

	return;
}


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

	lld T3X0 = 0, T353 = 1;

	// TESTCASES()
	solveEachTest(T353 - T3X0);
	return 0;
}
// Random Thought :  null

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define rsort(v) sort(all(v)); reverse(all(v))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template<typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template<typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template<typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template<typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template<typename T> inline T power(T x, i64 n) { T r = 1; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template<typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }

void solve() {
  i64 N; cin >> N;
  i64 ma;
  for (i64 i = 1; i * i <= N; i++) {
    if (N % i == 0) ma = i;
  }
  int k1 = 0, k2 = 0;
  {
    i64 m = ma;
    while (m) m /= 10, k1++;
  }
  {
    i64 m = N / ma;
    while (m) m /= 10, k2++;
  }
  cout << max(k1, k2) << '\n';
}


Measured memory_bytes: 256
n = int(input())
given_a = list(map(int, input().split()))

money = 1000
kabu = 0

a = []
for kabuka in given_a:
    if len(a) > 0 and a[-1] == kabuka:
        continue
    else:
        a.append(kabuka)

n = len(a)
if n == 1:
    print(money)
    exit()


for i in range(n):
    if i == 0:
        if a[i+1] < a[i]:
            continue
        else:
            kabu += money // a[i]
            money %= a[i]
    elif i == n-1:
        money += kabu * a[i]
        kabu = 0
    else:
        if a[i-1] < a[i] and a[i] > a[i+1]:
            money += kabu * a[i]
            kabu = 0
        if a[i-1] > a[i] and a[i] < a[i+1]:
            kabu += money // a[i]
            money %= a[i]

print(money)




Measured memory_bytes: 9080
import sys
s = sys.stdin.readline().rstrip()
num = [0 for i in range(ord("z")-ord("a")+1)] #バケット(a-z)
for i in range(len(s)):
    num[ord(s[i])-ord("a")] += 1
for i in range(26):
    if num[i] == 0:
        print(chr(i+ord("a")))
        break
else:
    print("None")


Measured memory_bytes: 3188
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int main()
{
	int a, b;
	cin >> a >> b;
	cout << max(max(a + a - 1, b + b - 1), a + b) << endl;
	return 0;
}

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

int main() {
  int a, b; cin >> a >> b;
  //a口電源タップ一個→a-1個増える
  //b口以上にしたい
  // rep(i,1000) {
  //   if (1 + i*(a-1) >= b) {
  //     cout << i << endl;
  //     break;
  //   }
  // }
  //x = 1 + n(a-1) >= b
  //n(a-1) >= b-1
  //n >= (b-1)/(a-1)
  //a/bの繰り上げは(a+b-1)/b
  cout << (a+b-3)/(a-1) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

int n, A[100000];

int main(void) {

    scanf("%d", &n);

    for (int i = 0; i < n; ++i) {
        scanf("%d", &A[i]);
    }

    // partition 
    int i = -1;
    for (int j = 0, x = A[n - 1]; j < n - 1; ++j) {
        if (A[j] <= x) {
            ++i;
            int tmp = A[i];
            A[i] = A[j];
            A[j] = tmp;
        }
    }
    int tmp = A[++i];
    A[i] = A[n - 1];
    A[n-1] = tmp;

    printf("%d", A[0]);
    for (int j = 1; j < n; ++j) {
        if (j != i) {
            printf(" %d", A[j]);
        }
        else {
            printf(" [%d]", A[j]);
        }
    }
    printf("\n");

    return 0;
}

Measured memory_bytes: 1580