akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#define INF 2000000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=(n);i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

bool debug=false;
/*---------------------------------------------------*/

int main(){
  int n,a,b;
  int a_score,b_score;

  while(1){
    scanf("%d",&n);
    if(n==0)break;
    a_score=b_score=0;
    rep(i,n){
      scanf("%d%d",&a,&b);
      if(a==b){
	a_score+=a;
	b_score+=b;
      }else if(a>b){
	a_score+=a+b;
      }else if(a<b){
	b_score+=a+b;
      }
    }
    printf("%d %d\n",a_score,b_score);
  }
}

Measured memory_bytes: 3136
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N, result = 0;
	cin >> N;
	vector<int> P(N);

	int count = 0;
	int min = N;
	for (int i = 0; i < N; i++) {
		cin >> P[i];
		int j_calculator = 1;

		if (P[i] <= min) {
			min = P[i];
			result += 1;
			continue;
		}
	}

	cout << result << endl;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(){
  int N,count;
  cin >> N;
  count = 0;
  int ans = 0;
  int i,j;
  for(i = 1;i <= N; i+=2){
    for(j = 1; j <= i; j+=2){
      if(i % j == 0){
        count++;
      }
      if(count > 8){
        break;
      }
    }
    if(count == 8){
      ans++;
    }
    count = 0;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
int main(){
    ll n;
    string s;
    cin>>n>>s;
    ll sum=0;
    if(n<4){
        cout<<0;
        return 0;
    }
    ll rsum=0,gsum=0,bsum=0;
    
    for(ll i=0;i<n;i++){
        if('R'==s[i]){
            rsum++;
        }else if('G'==s[i]){
            gsum++;   
        }else{
            bsum++;
        }
    }
    ll max=rsum*gsum*bsum;
    ll b=0;
    for(ll i=0;i<n;i++){
        for(ll j=1;i+2*j<n;j++){
            if(s[i]!=s[i+j]&s[i]!=s[i+2*j]&s[i+j]!=s[i+2*j]){
                b++;    
            }
        }
    }
    cout<<max-b;
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
int op(int a, int b){
    return max(a, b);
}
int e(){ 
    return 0;
}
int main(){
    int n, k;
    cin >> n >> k;
    vector<int>v(n + 3);
    int mx = 0;
    for(int i = 1; i <= n; i++){
        cin >> v[i];
        mx = max(mx, v[i]);
    }
    segtree<int, op, e> seg(mx + 5);
    vector<int>dp(n + 3, 0);
    for(int i = 1; i <= n; i++){
        int x = max(v[i] - k, 0);
        int y = min(v[i] + k, mx);
        int p = seg.prod(x, v[i] + 1);
        int q = seg.prod(v[i], y + 1);
        int r = seg.prod(v[i], v[i] + 1);
        dp[i] = max(dp[p], dp[q]) + 1;
        dp[i] = max(dp[i], dp[r] + 1);
        seg.set(v[i], i);
    }
    int ans = 0;
    for(int i = 1; i <= n; i++){
        ans = max(ans, dp[i]);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 9764
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define db pop_back
#define q2(n) (n%2)==0
#define vp vector<pair <ll,ll> >
#define vctr vector<ll>
#define in(a) cin>>a;
#define out(a) cout<<a<<"\n";
#define nxt() cout<<"\n";
#define no() cout<<"No\n";
#define yes() cout<<"Yes\n";
#define bug1() cout<<"@ ";
#define bug2() cout<<"# ";
#define ff first
#define ss second
#define ip(n) ll n; cin>>n;
#define ipar(ar,n) ll ar[n]; loop(i,0,n) cin>>ar[i];
#define opar(ar,n) loop(i,0,n) cout<<ar[i]<<" ";
#define loop(i,m,p) for (ll i = m; i < p; i++)
#define loopn(i,m,p) for (ll i = p-1; i >=m; --i)

using namespace std;

int main()
{
     ll t=1;
  //ip(t)
  while(t--)
  {
      ip(n)
      ll a[n][2];
      loop(i,0,n)
      {
          cin>>a[i][0]>>a[i][1];

      }
      ll cn=0,mx=0;
      loop(i,0,n)
      {

          if(a[i][0]==a[i][1])
          {
              cn++;
          }
          else
            cn=0;

          mx=max(cn,mx);
      }

      if(mx>=3)
        yes()
      else
       no()


  }

return 0;
}




Measured memory_bytes: 3632
def main():
    R, G, B, N = map(int, input().split())

    cnt = 0
    for r in range(N//R + 1):
        for b in range(N//B + 1):
            res = (N - r*R - b*B)
            if res >= 0 and res%G == 0:
                cnt += 1
    print(cnt)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

int main() {
  int n; cin >> n;
  vector<ll> A(n), M(200001, 0);
  loop(i,0,n) cin >> A[i];
  for (auto&&a: A) M[a]++;
  ll sum = 0;
  for (ll b=1; b<=200000; b++) {
    if (M[b]<=1) continue;
    sum += (M[b])*(M[b]-1) / 2;
  }
  for (auto &&a: A) {
    if (M[a]==1) {
      cout << sum << endl;
      continue;
    }
    
    ll aSum = M[a] * (M[a]-1) / 2;
    if (M[a] == 2) {
      cout << sum - aSum << endl;
      continue;
    }
    
    ll newSum = (M[a]-2)*(M[a]-1)/2;
    cout << sum - aSum + newSum << endl;
  }
  return 0;
}


Measured memory_bytes: 6388
import heapq


n, m = [int(_) for _ in input().split()]
l = []
for i in range(n):
    a, b = [int(_) for _ in input().split()]
    l.append((a, b))
l = sorted(l, reverse=True)
# print(l)

ans = 0
que = []
heapq.heapify(que)
i = 1
while i <= m:
    if len(l) != 0:
        while l[-1][0] == i:
            a, b = l.pop()
            heapq.heappush(que, -b)
            if len(l) == 0:
                break
    # print('i', i)
    # print('que', que)
    # print('ans', ans)
    if len(que) != 0:
        ans += (-1) * heapq.heappop(que)
    i += 1
# print(que)
print(ans)

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

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

  if (a <= b)
  {
    for (int i = 0; i < b; i++)
    {
      cout << a;
    }
    cout << endl;
  }
  else
  {
    for (int i = 0; i < a; i++)
    {
      cout << b;
    }
    cout << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mod 1000000007
void solve()
{
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll x=min(max(a,b),d);
	ll y=max(min(c,d),a);
	if(x-y>0)
		cout<<x-y;
	else
		cout<<0;
		
	return;
}


int main()
{
	fast;
	ll q;
	q=1;
	// cin>>q;
	while(q--)
	{
		solve();
	}
	return 0;
}


Measured memory_bytes: 3636
l = int(input())
x = [[0,0,0] for i in range(l)]
x[0] = list(map(int,input().split()))

for i in range(1,l):
    z = list(map(int,input().split()))
    x[i][0] = max(z[0]+x[i-1][1],z[0]+x[i-1][2])
    x[i][1] = max(z[1]+x[i-1][0],z[1]+x[i-1][2])
    x[i][2] = max(z[2]+x[i-1][0],z[2]+x[i-1][1])

print(max(x[-1]))

Measured memory_bytes: 22840
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;


const int MAX_N = 1e5+10;
ll dp[MAX_N];

int main(){
    int n;
    cin >> n;
    vl h(n+1);
    rep(i, n) cin >> h[i];
    h.back() = 1e18;
    rep(i, MAX_N) dp[i] = 1e18;
    dp[0] = 0;
    rep(i, n-1) {
        dp[i+1] = min(dp[i+1], dp[i] + abs(h[i] - h[i+1]));
        dp[i+2] = min(dp[i+2], dp[i] + abs(h[i] - h[i+2]));
    }
    cout << dp[n-1] << endl;
    return 0;
}

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

using namespace std;

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

  int primes[] = {3, 13, 23, 43, 53, 73, 83, 103, 113, 163, 173, 193, 223, 233, 263, 283, 293, 313, 353, 373, 383, 433, 443, 463, 503, 523, 563, 593, 613, 643, 653, 673, 683, 733, 743, 773, 823, 853, 863, 883, 953, 983, 1013, 1033, 1063, 1093, 1103, 1123, 1153, 1163, 1193, 1213, 1223, 1283, 1303};

  int n;
  cin >> n;

  for (int i = 0; i < n; ++i) {
    cout << primes[i] << " ";
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

struct UF{
  std::vector<int> par, dep, sz;
  UF(int n){
    par.resize(n+1), dep.resize(n+1), sz.resize(n+1);
    init(n);
  }
  void init(int nu) {
    for(int iu=0;iu<=nu;iu++){
      par[iu] = iu;
      dep[iu] = 0;
      sz[iu] = 1;
    }
  }
  int find(int xu){
    if(par[xu] == xu) return xu;
    return par[xu] = find(par[xu]);
  }
  void unite(int xu, int yu){
    xu=find(xu);
    yu=find(yu);
    if(xu == yu) return;
    if(dep[xu] < dep[yu]){
      sz[yu] += sz[xu];
      par[xu] = yu;
    }else{
      par[yu] = xu;
      sz[xu] += sz[yu];
      if(dep[xu] == dep[yu]) dep[xu]++;
    }
  }
  bool same(int xu, int yu){ return find(xu) == find(yu);}
  int get_size(int x){return sz[find(x)];}
};

void err(){
  std::cout << "No" << '\n';
  exit(0);
}
int main(int argc, char const *argv[]) {
  ll n, m, q;std::cin >> n >> m >> q;
  vvl dat = VV(q, 3, 0, ll);
  for(int i=0;i<q;i++) scanf("%lld %lld %lld", &dat[i][1], &dat[i][2], &dat[i][0]);
  sort(all(dat));

  //c = 0
  UF uf(n+1);
  vll use(n+1, 0);
  for(int i=0;i<q;i++){
    if(dat[i][0]==0){
      uf.unite(dat[i][1], dat[i][2]);
    }else{
      if(uf.same(dat[i][1], dat[i][2])) err();
    }
  }
  //全ての0のグループに対し、1グループのみ隣接してはダメ
  ll g = 0, z = 0;
  //各グループはsize - 1 本の辺を消費
  for(int i=0;i<n;i++){
    if(use[uf.find(i)]) continue;
    g++;
    z += uf.sz[uf.find(i)] - 1;
    use[uf.find(i)] = 1;
  }

  //1グループの時、本数は一定(n-1)
  if(g==1){
    std::cout << (m==n-1?"Yes":"No") << '\n';
    return 0;
  }
  //2グループの時1があるとダメ、ない場合、本数は一定(n-1)
  if(g==2){
    std::cout << (dat[q-1][0]?"No":(m==n-1?"Yes":"No")) << '\n';
    return 0;
  }
  //連結成分同士のマージはグループ数x>=3に対し、最小x本、最大xC2本(完全グラフ)で達成できる
  //1がない場合、最小はn-1本
  ll min_edge = z + g;
  if(dat[q-1][0]==0) min_edge = n-1;
  ll max_edge = z + (g*(g-1))/2;
  //std::cout << g << " " << z << " " << m << '\n';
  if(min_edge<=m&&m<=max_edge) std::cout << "Yes" << '\n';
  else std::cout << "No" << '\n';
  return 0;
}


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

int main()
{
    long long int a, b, k;
    cin >> a >> b >> k;

   if(a >= k){
    a = a - k;
    cout << a << " " << b << endl;
   }
   else if(a < k){
    if((a+b) <= k){
        cout << "0 0" << endl;
    }
    else if((a+b) > k){
        k = k - a;
        if(k <= 0)
            cout << "0 0" << endl;
        else
            cout << "0 " << b - k << endl;
    }
   }

    return 0;
}


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

int main() {
    map<string, int> mp;
    int k;
    string s;
    cin >> s >> k;
    for(int i = 0; i < s.size(); ++i) {
        for(int j = i; j < i+k && j < s.size(); ++j) {
            mp[s.substr(i, j-i+1)]++;
        }
    }
    auto iter = mp.begin();
    cout << next(iter, k-1)->first << '\n';
}


Measured memory_bytes: 1920
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 10000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

int kai[100010];

void setkai() {
	kai[0] = 1;
	for (int i = 1; i <= 100005; i++) {
		kai[i] = kai[i - 1] * i;
		kai[i] %= MOD;
	}
}

int perm(int n, int r) {
	if (n < 0 || r < 0 || n < r) return 0;
	return kai[n] * modinv(kai[n - r], MOD) % MOD;
}

signed main() {
	int n, k, ans = 1;
	vector<int>vec[100005];
	queue<int>que;
	bool arrive[100005];
	cin >> n >> k;
	rep(i, n)  arrive[i] = false;
	setkai();
	rep(i, n - 1) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		vec[a].push_back(b);
		vec[b].push_back(a);
	}
	ans *= k;
	arrive[0] = true;;
	int cnt = 0;
	rep(i, vec[0].size()) {
		if (!arrive[vec[0][i]]) {
			que.push(vec[0][i]);
			arrive[vec[0][i]] = true;
			cnt++;
		}
	}
	ans *= perm(k - 1, cnt);
	ans %= MOD;
	while (!que.empty()) {
		int cnt = 0;
		int now = que.front();
		que.pop();
		rep(i, vec[now].size()) {
			if (!arrive[vec[now][i]]) {
				arrive[vec[now][i]] = true;
				cnt++;
				que.push(vec[now][i]);
			}
		}
		ans *= perm(k - 2, cnt);
		ans %= MOD;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 8180
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int main(){
  int R,G,B,N;
  cin>>R>>G>>B>>N;
  ll cnt=0;
  for(int i=0 ; i<=N ; i++){
    int b=i*R;
    for(int j=0 ; j*G<=N-b ; j++){
      int g=G*j;
      if((N-b-g)%B==0) cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}


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

using namespace std;


#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)


using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;


signed main() {
    long long x;
    cin >> x;
    bitset<32> a(x);
    cout << a << "\n" << ~a << "\n" << (a << 1) << "\n" << (a >> 1) << "\n";
    return 0;
}


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

using namespace std;

int N;
string S;
int ans=0;

void input(){
  cin >>N;
  cin >>S;
}

void solve(){
  for(int i=0;i<N-2;i++){
    if(S[i]=='A'){
      if(S[i+1]=='B'){
	if(S[i+2]=='C'){
	  ans++;
	}
      }
    }
  }
}

int main(){
  input();
  solve();
  cout << ans << endl;
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<int,int> p;


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
#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

#define int long long
using namespace std;
const int INF = 2e18;
const int MOD = 1e9 + 7;
const int MB = 60;

vector<vector<int>> dp, g;

void dfs(int v, int pr = -1) {
	dp[0][v] = dp[1][v] = 1;
	for (int u : g[v]) {
		if (u != pr) {
			dfs(u, v);
			dp[0][v] = dp[0][v] * (dp[1][u] + dp[0][u]) % MOD;
			dp[1][v] = dp[1][v] * dp[0][u] % MOD;
		}
	}
}

void solve() {
	int n;
	cin >> n;
	g.resize(n);
	for (int i = 0; i < n - 1; i++) {
		int x, y;
		cin >> x >> y;
		x--; y--;
		g[x].pb(y);
		g[y].pb(x);
	}

	dp.resize(2, vector<int>(n));
	dfs(0);
	cout << (dp[0][0] + dp[1][0]) % MOD;
}

signed main() {
	/*
	freopen("search.in", "r", stdin);
	freopen("search.out", "w", stdout);
	*/
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout << fixed;
	cout.precision(12);
	solve();
}


Measured memory_bytes: 14192
<?php
$N = trim(fgets(STDIN));
$K = trim(fgets(STDIN));
$X = trim(fgets(STDIN));
$Y = trim(fgets(STDIN));

if($N <= $K){
    $ans = $N * $X;
    echo $ans;
}else{
    $ans = $K * $X;
    $r = $N - $K;
    $ans += $r * $Y;
    echo $ans;
}
?>

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

int main() {
  
  long long N;
  
  cin >> N;
  
  vector<long long> A(N+1);
  vector<bool> li(1111111,true);
  
  long long ans = 0;
  
  
  for (int i=0; i<N; i++) {
    cin >> A[i];
  }
  
  A[N] = 10000000000000;
  
  sort(A.begin(),A.end());
  
  
  for (int i=0; i<N; i++) {
    if (li[A[i]]) {
      if (A[i] != A[i+1]) {
        ans++;
      }
      for (int j=1; A[i]*j < 1110000; j++) {
        li[A[i] * j] = false;
      }
    }
  }
 
  cout << ans << endl;
  return 0;
  
}

Measured memory_bytes: 5104
# ABC 067 B - Snake Toy

n_k = list(map(int,input().split()))
li = list(map(int,input().split()))
n=n_k[0]
k=n_k[1]

toy = 0
li.sort(reverse=True)

for i in range(k):
    toy += li[0]
    li.pop(0)
print(toy)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main(){
string s ,t;
cin>>s>>t;
int a,b;
cin>>a>>b;
string u;
cin>>u;
if(s==u){
    cout<<a-1<<' '<<b<<endl;

}
else{
    cout<<a<<' '<<b-1<<endl;
}
 return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Random;
import java.util.Arrays;

class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[3];
        for (int i = 0; i < 3; i++) {
        	 a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        System.out.println(a[0] + a[1]);
        
  
    
    
}
}

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


void solve(long long N){
    for(ll x = 0; x <= N; ++x){
        const ll cand = static_cast<long long>(static_cast<double>(x) * 1.08);
        if(cand == N){
            cout << x << endl;
            return;
        }
    }
    cout << ":(" << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 256
char s[100000], t[100000];
int  ptn[128];//ASCIIコード表分の要素数

int main()
{
	int i, N;

	scanf("%d%s%s", &N, s, t);//星の数、入口、出口
	ptn[s[0]] = 1;//アルゴリズムが理解できない
	for (N--, i = 1; i < N; i++)
	{
		ptn[s[i]] += ptn[t[i]];
		ptn[s[i]] %= 1000000007;
	}
	printf("%d\n", ptn[t[N]]);
	return 0;
}




Measured memory_bytes: 2104
# coding: utf-8
# Your code here!

num = int(input())

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

def get_max(sides):
    idx = 0
    _max = sides[idx]
    
    for i, side in enumerate(sides):
        if _max < side:
            _max = side
            idx = i
    return idx, _max
    
idx, _max = get_max(sides)

total = 0
for i, side in enumerate(sides):
    if i == idx:
        continue
    total += side
    
if _max < total:
    print('Yes')
else:
    print('No')

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

int main(){
    int n;
    cin >> n;
    string s="";
    int cur=n;
    while(cur!=0){
        int r=cur%2;
        if(r<0)r+=2;
        s+=(char)('0'+r);
        cur=(cur-r)/(-2);
    }
    reverse(s.begin(),s.end());
    if(s=="")s='0';
    cout << s << endl;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//{akari : 1D, yukari : 2D, maki : 3D} vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//{akane : ascending order, aoi : decending order} priority queue
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Libraries ---------------------------------//

//------------------------------- Dubug Functions ---------------------------//

inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}

//------------------------------- Solver ------------------------------------//

void solve()
{
    seika o, e;
    cin >> o >> e;
    auto os = o.begin(), es = e.begin();
    while (1)
    {
        if (os == o.end())
        {
            break;
        }
        cout << *os;
        os++;
        if (es == e.end())
        {
            continue;
        }
        cout << *es;
        es++;
    }
    cout << endl;
}

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


Measured memory_bytes: 256
n = int(input())
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
if n == 1:
    print(0)
    exit()
primes = prime_factorize(n)
max_primes = primes[-1]
dic = {}
tmp = 0
for i in primes:
    if i not in dic:
        dic[i] = 1
        tmp = 0
        continue
    if tmp == 0:
        tmp = i
    else:
        tmp *= i
        if tmp not in dic:
            dic[tmp] = 1
            tmp = 0
print(len(dic))

Measured memory_bytes: 9228
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,X,Y;
  cin >> N >> X >> Y;
  
  vector<vector<int>> dist(N, vector<int>(N, 0));
  vector<int> count(N - 1, 0);
  for (int i = 0; i < N; i++){
    for (int j = i + 1; j < N; j++){
      int d1 = max(Y - 1 - j, j - Y + 1);
      int d2 = max(i - X + 1, X - 1 - i);
      count.at(min(j - i, d1 + d2 + 1) - 1) += 1;
    }
  }
  
  for (int i = 0; i < N - 1; i++){
    cout << count.at(i) << endl;
  }
}

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

int main() {
    int N;
    cin >> N;
    string s, t;
    cin >> s >> t;
    int cnt = 0;
    rep(i, N) {
        if (s[i] != t[cnt]) cnt = 0;
        if (s[i] == t[cnt]) ++cnt;
    }
    cout << 2 * N - cnt << endl;
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(a);i<=(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(b);i>=(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T>
ll sum(const T& a){return accumulate(all(a),0LL);}

void solve(){
    ll n;cin>>n;
    vector<string> s;
    rep(i,n){
        string t;cin>>t;
        s.push_back(t);
    }

    map<string,ll> cnt;
    rep(i,n)cnt[s[i]]++;

    ll ma=-INF;
    for(auto t:cnt)chmax(ma,t.second);
    for(auto t:cnt){
        if(t.second==ma)cout<<t.first<<endl;
    }
}

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


Measured memory_bytes: 25456
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,f,n) for(int i=f; i<(n); i++)
int main()
{
  ll x, k, d, ans = 0;
  cin >> x >> k >> d;
  ll mazu = abs(x/d);
  if(k-mazu <= 0){
    ans = abs(x) - abs(k*d);
  }else{
    k -= mazu;
    ll kihon = abs(x) - abs(mazu*d);
    if(k%2==0){
      ans = kihon;
    }else{
      ans = abs(kihon - d);
    }
  }
  
  cout << ans << endl;
  //--debug : end_stoper
  string end_stoper; cin >> end_stoper;

  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
//For ordered_set
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define MOD 1000000007
#define MOD2 998244353
#define test int t; cin>>t; while(t--)
#define init(arr,val) memset(arr,val,sizeof(arr))
#define loop(i,a,b) for(int i=a;i<b;i++)
#define loopr(i,a,b) for(int i=a;i>=b;i--)
#define loops(i,a,b,step) for(int i=a;i<b;i+=step)
#define looprs(i,a,b,step) for(int i=a;i>=b;i-=step)
#define ull unsigned long long int
#define ll long long int
#define P pair
#define PLL pair<long long, long long>
#define PII pair<int, int>
#define PUU pair<unsigned long long int, unsigned long long int>
#define L list
#define V vector
#define D deque
#define ST set
#define MS multiset
#define M map
#define UM unordered_map
#define mp make_pair
#define pb push_back
#define pf push_front
#define MM multimap
#define F first
#define S second
#define IT iterator
#define RIT reverse_iterator
#define FAST ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define FILE_READ_IN freopen("input.txt","r",stdin);
#define FILE_READ_OUT freopen("output.txt","w",stdout);
#define all(a) a.begin(),a.end()
#define ld long double
using namespace std;
// For ordered_set
using namespace __gnu_pbds;

template <typename T>
using ord_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
const ll maxn = 1e5;
const ll inf = 1e9;
const double pi = acos(-1);

template<class T> ostream& operator<<(ostream &os, vector<T> V) {
    os << "[ ";
    for(auto v : V) os << v << " ";
    return os << "]";
}
template<class T> ostream& operator<<(ostream &os, set<T> S){
    os << "{ ";
    for(auto s:S) os<<s<<" ";
    return os<<"}";
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
    return os << "(" << P.first << "," << P.second << ")";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {
    os << "{ ";
    for(auto m:M) os<<"("<<m.F<<":"<<m.S<<") ";
    return os<<"}";
}

int main(){
    FAST;
    int x, y, z;
    cin >> x >> y >> z;
    cout << z << ' ' << x << ' ' << y << '\n';
    return 0;
}

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

#define ll long long
const int mod = 1e9+7;
vector<ll> digits;
ll add_self(ll& a, ll b){
  a+=b;
  if(a>mod){
    a-=mod;
  }
}
ll dp[10001][101][2];
ll d;
void get_digits(string n){
  for(int i=n.size()-1;i>=0;i--){
    digits.push_back(n[i]-'0');
  }
}

ll foo(ll idx, ll sum, ll tight){
  if(idx==-1){
    if(sum==0){
      return 1;
    }
    else return 0;
  }
  if(dp[idx][sum][tight]!=-1){
    return dp[idx][sum][tight];
  }
  ll ans = 0;
  ll k = tight?digits[idx]:9;
  for(ll i=0;i<=k;i++){
    ll newTight = digits[idx]==i?tight:0;
    //ans+=foo(idx-1,(sum+i)%d,newTight);
    add_self(ans,foo(idx-1,(sum+i)%d,newTight));
  }
  dp[idx][sum][tight] = ans;
  return ans;
}

void init(){
  for(ll i=0;i<10001;i++){
    for(ll j=0;j<101;j++){
      for(ll k=0;k<2;k++){
        dp[i][j][k]=-1;
      }
    }
  }
}

int main(){
    string a;
    digits.clear();
    cin >> a  >> d;
    get_digits(a);
    ll sz = digits.size();
    init();
    ll ans1 = foo(sz-1,0,1);
    ans1--;
    if(ans1==-1){
      ans1 = -1+mod;
    }
    cout<<ans1<<endl;
}


Measured memory_bytes: 17024
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>


using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 998244353; constexpr int MAX = 2000020;
const double pi = acos(-1); constexpr double EPS = 1e-8;
constexpr ll INF = 1e18;


bool isok(string S) {
	int N = S.size();
	REP(i, N) {
		if (S[i] != S[N - i - 1])return false;
	}
	return true;
}
void solve() {
	double L; cin >> L;
	cout << setprecision(10) << (L/3)*(L/3)*(L/3) << endl;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  unsigned int n;
  long int sum=0;
  cin>>n;
  unsigned int i=1;
  for (i=1;i<=n;i++){
    if(i%3==0||i%5==0)continue;
  	sum=sum+i;}
    cout<<sum;
  return 0;
}


Measured memory_bytes: 3636
from collections import defaultdict
from math import gcd
mod = 1000000007

n = int(input())
plus = defaultdict(int)
minus = defaultdict(int)
a_0 = 0
b_0 = 0
a_b_0 = 0
xxx = 10 ** 10
for _ in range(n):
    a, b = map(int, input().split())
    if a == 0 or b == 0:
        if a == 0 and b == 0:
            a_b_0 += 1
        elif a == 0:
            a_0 += 1
        else:
            b_0 += 1
        continue
    g = gcd(a, b)
    a //= g
    b //= g
    if a * b < 0:
        minus[(abs(a), abs(b))] += 1
    else:
        plus[(abs(b), abs(a))] += 1

total = 0
lst = []
for num, _ in minus.items():
    a1 = minus[num]
    a2 = plus[num]
    if a1 * a2 != 0:
        total += a1 + a2
        lst.append([a1, a2])
if a_0 > 0 and b_0 > 0:
    total += a_0 + b_0
    lst.append([a_0, b_0])
n -= a_b_0
ans = pow(2, n - total, mod)
for a, b in lst:
    ans = (ans * (pow(2, a, mod) + pow(2, b, mod) - 1)) % mod
ans = (ans - 1 + a_b_0) % mod
    
print(ans)
    


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

namespace CSharpSample01
{
	class Program
	{
		static void Main(string[] args)
		{
			var N = int.Parse(Console.ReadLine());

			if(N == 0)
			{
				Console.WriteLine(1);
			}
			else
			{
				Console.WriteLine(0);
			}

		}

	}
}

Measured memory_bytes: 17596
/**
 *    author:  tourist
 *    created: 24.01.2020 23:42:43       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<pair<int, int>> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a.begin(), a.end());
  int diff = 0;
  for (int i = 0; i < n; i++) {
    if (a[i].second % 2 != i % 2) {
      ++diff;
    }
  }
  cout << diff / 2 << '\n';
  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n;
int h[200005];
int a[200005];
int dp[200005];
int solve()
{
//We basically need to find the increading height subsequence with maximum beauty 
//Ending at i
//This is standard technique for any subsequence problem.

	map<int,int> mp;
	dp[0] = 0;
	dp[1] = a[1];
	mp[h[1]] = dp[1];
	int ans=dp[1];

	for(int i=2;i<=n;i++)
	{
		dp[i] = a[i];
		auto it = mp.lower_bound(h[i]+1);
		if(it!=mp.begin()){
			it--;
			dp[i]+=(it->second);
		}
		mp[h[i]] = dp[i];
		it = mp.upper_bound(h[i]);
		while(it!=mp.end() && it->second <= dp[i])
		{
			auto temp = it;
			temp++;
			mp.erase(it);
			it=temp;
		}


		ans = max(ans,dp[i]);

	}

return ans;
}
int32_t main(){
#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
#endif
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>h[i];
	for(int i=1;i<=n;i++)
		cin>>a[i];
	memset(dp,0,sizeof dp);

	cout<<solve()<<endl;










}

Measured memory_bytes: 20648
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;
#define REP(i,n) for(int i = 0; i < n; i++)

int main(void)
{
    string s;
    cin >> s;

    for(int i = 0; i < s.size(); i++)
    {
        if(i % 2 ==0)
            cout << s[i];
    }
    cout << endl;
}


Measured memory_bytes: 512
import sys
from collections import deque

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *AB = map(int, read().split())
    G = [[] for _ in range(N)]

    for a, b in zip(*[iter(AB)] * 2):
        G[a - 1].append(b - 1)
        G[b - 1].append(a - 1)

    queue = deque([0])
    parent = [-1] * N
    order = []

    while queue:
        v = queue.popleft()
        order.append(v)
        for nv in G[v]:
            if nv == parent[v]:
                continue
            parent[nv] = v
            queue.append(nv)

    color = [0] * N
    for v in order:
        c = 1
        for nv in G[v]:
            if nv == parent[v]:
                continue
            if c == color[v]:
                c += 1
            color[nv] = c
            c += 1

    ans = [0] * (N - 1)
    for i, (a, b) in enumerate(zip(*[iter(AB)] * 2)):
        if parent[a - 1] == b - 1:
            ans[i] = color[a - 1]
        else:
            ans[i] = color[b - 1]

    print(max(ans))
    print(*ans, sep='\n')
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 39284
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define until(x) while(!(x))
#define unless(x) if(!(x))
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pc __builtin_popcount

int a[100005];
int b[100005];
int A,B,M;

int32_t main(){
	cin>>A>>B>>M;
	int mn1=1e15,mn2=1e15;
	for(int i=1;i<=A;i++){
		cin>>a[i];
		mn1 = min(mn1,a[i]);
	}
	for(int i=1;i<=B;i++){
		cin>>b[i];
		mn2 = min(mn2,b[i]);
	}
	int mincost = mn1+mn2;
	for(int i=1;i<=M;i++){
		int x,y,z;
		cin>>x>>y>>z;
		mincost = min(mincost,a[x]+b[y]-z);
	}
	cout<<mincost;
}


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

int main(){
    int n;
    cin >> n;

    int p[n*n], a[n][n], vis[n][n];
    bool taken[n][n];
    int ans = 0;

    for(int i = 0; i<n; i++){
        for(int j = 0; j<n; j++){
            cin >> p[i*n + j];
            p[i*n + j]--;
            vis[i][j] = -1;
            taken[i][j] = 1;

            a[i][j] = min(min(i, n - 1 - i), min(j, n - 1 - j));
        }
    }

    for(int i = 0; i<n*n; i++){
        int x = p[i] / n;
        int y = p[i] % n;

        vector<pair<int, int> > dfs;

        dfs.push_back({x, y});
        vis[x][y] = i;
        taken[x][y] = 0;
        ans += a[x][y];

        while(!dfs.empty()){
            int xx = dfs.back().first;
            int yy = dfs.back().second;
            dfs.pop_back();

            int tox = xx - 1;
            int toy = yy;
            if(tox >= 0){
                if(vis[tox][toy] < i && a[tox][toy] > taken[xx][yy] + a[xx][yy]){
                    a[tox][toy] = taken[xx][yy] + a[xx][yy];
                    dfs.push_back({tox, toy});
                    vis[tox][toy] = i;
                }
            }

            tox = xx + 1;
            toy = yy;
            if(tox < n){
                if(vis[tox][toy] < i && a[tox][toy] > taken[xx][yy] + a[xx][yy]){
                    a[tox][toy] = taken[xx][yy] + a[xx][yy];
                    dfs.push_back({tox, toy});
                    vis[tox][toy] = i;
                }
            }

            tox = xx;
            toy = yy - 1;
            if(toy >= 0){
                if(vis[tox][toy] < i && a[tox][toy] > taken[xx][yy] + a[xx][yy]){
                    a[tox][toy] = taken[xx][yy] + a[xx][yy];
                    dfs.push_back({tox, toy});
                    vis[tox][toy] = 1;
                }
            }

            tox = xx;
            toy = yy + 1;
            if(toy < n){
                if(vis[tox][toy] < i && a[tox][toy] > taken[xx][yy] + a[xx][yy]){
                    a[tox][toy] = taken[xx][yy] + a[xx][yy];
                    dfs.push_back({tox, toy});
                    vis[tox][toy] = 1;
                }
            }
        }
    }

    cout << ans;

}


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

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

long long MOD = 1000000000 + 7;
long long MAX = 1000000000000000000;

int main(){
  cout << setprecision(10);
  int N;
  cin >> N;
  vector<ll> v(N);

  for(int i = 0; i < N; i++){
    ll tmp;
    cin >> tmp;
    v[i] = tmp;

    if(tmp == 0){
      cout << 0 << endl;
      return 0;
    }
  }
  long double t = 0;
  for(int i = 0; i < N; i++){
    long double x = log10((long double)v[i]);
    t += x;
    if(t - 18 > 0){
      cout << -1 << endl;
      return 0;
    }
  }
  
  ll ans = 1;
  for(int i = 0; i < N; i++){
    ans *= v[i];
    if(ans > 1000000000000000000){
      cout << -1 << endl;
      return 0;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 4112
#include <bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(int i=a,inc=(b-a)/abs(b-a); i!=b ; i+=inc)
#define deb(x) cout<<#x<<"->"<<x<<endl;
#define print(arr,a,b) for(int i=a;i!=b;i++){cout<<arr[i]<<" ";}cout<<endl;
using ll=long long int;
int arr_min(int arr[],int a,int b){ int min=arr[0]; for(int i=a;i!=b;i++){if(min>arr[i]) min=arr[i];}return min;}
int arr_max(int arr[],int a,int b){ int max=arr[0]; for(int i=a;i!=b;i++){if(max<arr[i]) max=arr[i];}return max;}

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

	#ifndef ONLINE_JUDGE
      	freopen("input.txt", "r", stdin);
      	freopen("output.txt", "w", stdout);
    #endif
    int t=1;
    // cin>>t;
    while(t-->0){
    	int n;
    	cin>>n;
    	string str;
    	map<string,int> mp;
    	for(int i=0;i<n;i++)
    	{
    		cin>>str;
    		mp[str]++;
    	}
    	cout<<mp.size()<<endl;
    	
    }
    return 0;
}

Measured memory_bytes: 19244
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def pop_count(i):
    i = i - ((i >> 1) & 0x55555555)
    i = (i & 0x33333333) + ((i >> 2) & 0x33333333)
    i = (i + (i >> 4)) & 0x0f0f0f0f
    i = i + (i >> 8)
    i = i + (i >> 16)
    return i & 0x3f

N = INT()
cards = [[]] * 2
cards[0] = LIST()
cards[1] = LIST()

ans = INF
for S in range(1<<N):
    # 無理なケース(奇数枚裏返す)を除外
    if pop_count(S) % 2 != 0:
        continue
    # 奇数位置と偶数位置で分けて保持する
    A1 = [[] for i in range(2)]
    for i in range(N):
        # カードiを青くする
        if S & 1<<i:
            A1[(i&1)^1].append((cards[1][i], i))
        # 赤のまま
        else:
            A1[i&1].append((cards[0][i], i))
    # 無理なケース(置きたい偶奇位置の数がおかしい)を除外
    if len(A1[0]) != ceil(N, 2) or len(A1[1]) != N // 2:
        continue
    # 偶奇が同じ位置同士は自由に動けるのでソートする
    A1[0].sort(reverse=1)
    A1[1].sort(reverse=1)
    cnt = 0
    A2 = [0] * N
    idxs = [0] * N
    for i in range(N):
        # 偶奇位置を交互に取り出す
        A2[i], idxs[i] = A1[i&1].pop()
    # ソート済と一致すればOK
    if A2 == sorted(A2):
        # 移動距離を転倒数数え上げで求める(Nが小さいのでN^2かけて大丈夫)
        cnt = 0
        for i, idx1 in enumerate(idxs):
            for j, idx2 in enumerate(idxs[i+1:], i+1):
                if idx1 > idx2:
                    cnt += 1
        ans = min(ans, cnt)
if ans == INF:
    print(-1)
else:
    print(ans)


Measured memory_bytes: 48348
import bisect
N = int(input())
A = [0] + [int(i) for i in input().split()]

sum_list = [i + A[i] for i in range(1, N+1)]
sum_list.sort()

count = 0
for i in range(1, N+1):
  v = i - A[i]
  idx_right = bisect.bisect_right(sum_list, v)
  idx_left = bisect.bisect_left(sum_list, v)
  if idx_right > 0 and sum_list[idx_right-1] == v:
    count += idx_right - idx_left
print(count)


Measured memory_bytes: 107876
#include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t k;
    cin >> k;
    if(k%2==0) cout << (k/2) * (k/2) << endl;
    if(k%2==1) cout << (k/2) * (k/2 + 1) << endl;
}


Measured memory_bytes: 256
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8').trim()

const [n, m, x] = stdin
  .split('\n')[0]
  .split(' ')
  .map(Number)

const a = stdin
  .split('\n')[1]
  .split(' ')
  .map(Number)

const ans = () => {
  const left = a.filter(v => v < x).length
  const right = a.filter(v => v > x).length

  return Math.min(left, right)
}

console.log(ans())


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

int main() {

  int N;
  cin >> N;
  
  vector<tuple<string,int,int>> vec;
  
  string st;
  int n;
  for (int i = 0; i < N; i++) {
    cin >> st >> n;    
    vec.push_back(make_tuple(st, n, i+1));
  }
  
  sort(vec.begin(), vec.end());
  
  tuple<string,int,int> m;
  for (int i = 0; i < N-1; i++) {
    for (int j = 0; j < N-1; j++) {
      if (get<0>(vec.at(j)) == get<0>(vec.at(j+1)) &&
          get<1>(vec.at(j)) < get<1>(vec.at(j+1))) {
        m = vec.at(j);
        vec.at(j) = vec.at(j+1);
        vec.at(j+1) = m;
      }
    }
  }
  
  for (int i = 0; i < N; i++) {
    cout << get<2>(vec.at(i)) << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string n;
    int count=0;
    cin>>n;
    for(int i=0;i<3;i++)
    {
        if(n[i]=='7')
        {
            count++;
            break;
        }
    }
    if(count==0)
    {
        cout<<"No"<<endl;
    }
    else
    {
        cout<<"Yes"<<endl;
    }
}

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

/*
 * @title BinaryIndexedTree
 */
template<class Operator> class BinaryIndexedTree {
	using TypeNode = typename Operator::TypeNode;
	size_t depth;         
	size_t length;
	size_t num;
	vector<TypeNode> node;
public:
	
	//[0,N) constructed, inplace [0,1) + [1,N+1)
	//you can ignore inplace offset
	BinaryIndexedTree(const size_t num) : num(num) {
		for (depth = 1,length = 1; length < num; depth++,length *= 2);
		node.resize(length+1, Operator::unit_node);
	}
 
	//[idx,idx+1) update 
	void update(size_t idx, TypeNode var) {
		assert(0 <= idx && idx < length);
		for (++idx; idx <= length; idx += idx & -idx) node[idx] = Operator::func_node(node[idx],var);
	}

	//[0,idx) get
	TypeNode get(size_t idx) {
		TypeNode ret = Operator::unit_node;
		for (idx = min(length,idx); idx > 0; idx -= idx & -idx) ret = Operator::func_node(ret,node[idx]);
		return ret;
	}

	//return [0,length]
	int binary_search(TypeNode var) {
		if(!Operator::func_check(node.back(),var)) return num;
		TypeNode ret = Operator::unit_node;
		size_t off = 0;
		for(size_t idx = length; idx; idx >>= 1){
			if(off + idx <= length && !Operator::func_check(Operator::func_node(ret,node[off+idx]),var)) {
				off += idx;
				ret = Operator::func_node(ret,node[off]);
			}
		}
		return min(off,num);
	}

	void print() {
		cout << "{ " << get(1);
		for(int i = 1; i < length; ++i) cout << ", " << get(i+1);
		cout << " }" << endl;
	}
};

template<class T> struct NodePrefixSumPointAdd {
	using TypeNode = T;
	inline static constexpr TypeNode unit_node = 0;
	inline static constexpr TypeNode func_node(TypeNode l,TypeNode r){return l+r;}
	// Binary Search for first index where func_check is true
	inline static constexpr bool func_check(TypeNode nodeVal,TypeNode val){return val <= nodeVal;}
};

template<class TypeNode> struct NodeUpdatePrefixGcd {
	TypeNode unit_node = 0;
	TypeNode func_node(TypeNode l,TypeNode r){return ((r == 0) ? l : func_node(r, l % r));}
	// Binary Search for first index at where func_check is true
	bool func_check(TypeNode nodeVal,TypeNode var){return var == nodeVal;}
};

//verify https://atcoder.jp/contests/chokudai_S001/tasks/chokudai_S001_j
//verify https://atcoder.jp/contests/abc130/tasks/abc130_d

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int N,Q; cin >> N >> Q;
	BinaryIndexedTree<NodePrefixSumPointAdd<long long>> bit(N);
	for(int i=0;i<N;++i) {
		int a; cin >> a; bit.update(i,a);
	}
    while(Q--){
        int t,l,r; cin >> t >> l >> r;
        if(t) cout << bit.get(r)-bit.get(l) << "\n";
        else bit.update(l,r);
    }
    return 0;
}


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

#define ll long long
#define pb push_back
#define mp make_pair


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   ll int value;
    cin>>value;
    const int a = (int)'a';
    value = value - 1;
    vector<char>returnValue;
    while (value > -1)
    {
        ll remainder = value % 26;
        returnValue.pb((char)(a + remainder));
        value = value / 26  - 1;
    }
  reverse(returnValue.begin(),returnValue.end());
  for(auto q:returnValue)
  cout<<q;
    
    
	
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#define Sheryang main
const int maxn=1e6+7;
typedef long long ll;
const int mod=1e9+7;
#define pi acos(-1)
ll read(){ll c = getchar(),Nig = 1,x = 0;while(!isdigit(c) && c!='-')c = getchar();if(c == '-')Nig = -1,c = getchar();while(isdigit(c))x = ((x<<1) + (x<<3)) + (c^'0'),c = getchar();return Nig*x;}
#define read read()
/* keep hungry and keep calm! */

int Sheryang(){

    ll k=read,a=read,b=read;
    ll t=k+1;

    k++;
    ll ans=a;
    k-=a;

    ans+=(b-a)*(k/2);
    k%=2;
    ans+=k;

    printf("%lld\n",max(ans,t));
    return 0;
}


Measured memory_bytes: 256