akhauriyash/Code-Regression huggingface dataset:
/* 
 Author:N_o_o_B 
 Created:September 28 2019 17:08:04
*/
#include <bits/stdc++.h>
using namespace std;

#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define endl '\n'
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;

    int n;
    cin >> n;
    vii a(n);
    fori(i,n) {cin >> a[i].first;a[i].second=i+1;}
    sort(all(a));
    for(pii x:a){
        cout << x.second << " ";
    }
    cout << endl;

    time_taken();
    return 0;
}

Measured memory_bytes: 1664
a,b,c,d = input()
for i in range(2**3):
  ls = ["+","+","+"]
  for j in range(len(ls)):
    if (i>>j) & 1:
      ls[j]="-"
  if eval(a+ls[0]+b+ls[1]+c+ls[2]+d) == 7:
        print(a+ls[0]+b+ls[1]+c+ls[2]+d+"=7")
        break

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

#define fi first
#define se second
#define pb push_back
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define FOR(i, a, b) for (int i = a; i <= (b); i++)
#define ROF(i, a, b) for (int i = a; i >= (b); i--)

using pii = pair<int, int>; using vpii = vector<pii>;
using vi = vector<int>; using vvi = vector<vi>;
using ll = long long;
using pll = pair<ll, ll>; using vpll = vector<pll>;
using vll = vector<ll>; using vvll = vector<vll>;

int main() {
    map <string, bool> ok;
    
    function <void(string)> dfs = [&] (string a) {
        // cout << a << endl;
        ok[a] = 1;
        FOR(i, 0, sz(a) - 1) {
            if (a[i] == 'A') {
                string b = a;
                b.erase(b.begin() + i);
                dfs(b);
            }
        }
    };

    dfs("AKIHABARA");

    string s; cin >> s;
    if (ok[s]) cout << "YES\n";
    else cout  << "NO\n";
}

Measured memory_bytes: 3588
#include<iostream>
#define rep(i, n) for(int i = 0; i < n; i++)
#define INF 1<<30

#include<algorithm>

using namespace std;

const int MAX_N = 100;
int N, T;
int c[MAX_N], t[MAX_N];
int a[MAX_N];  //時間t以内のコストを格納する
int x = 0;


int main(){
	cin >> N >> T;
	rep(i, N){
		cin >> c[i] >> t[i];
		if(t[i] <= T){
			a[x] = c[i];
			x++;
		}
	}
	if(x == 0){
		cout << "TLE" << endl;
		return 0;
	}
	sort(a, a + x);
	cout << a[0] << endl;

	return 0;
}



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

int main(){
    int N;
    cin>>N;
    int X[200000],tmp[200000];
    for(int i=0;i<N;i++){
        cin>>X[i];
        tmp[i]=X[i];
    }
    sort(tmp,tmp+N);
    int r=tmp[N/2];
    int l=tmp[N/2-1];
    for(int i=0;i<N;i++){
        if(r<=X[i]) cout<<l<<endl;
        else cout<<r<<endl;
    }
    return 0;
}

Measured memory_bytes: 3712
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    k, x = geta(int)

    if k * 500 >= x:
        print('Yes')
    else:
        print("No")


if __name__ == "__main__":
    main()

Measured memory_bytes: 38256
#include<stdio.h>

int sort(int A[], int N);

int main()
{
	int i = 0, N=0;
	int A[1000];

	scanf("%d", &N);

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

	sort(A, N);



	return 0;
}

int sort(int A[], int N){
	int i, j, k, tmp;
	for(i = 0; i < N; i++){
		tmp = A[i];
		j = i-1;
		while(j >= 0 && A[j] > tmp){
			A[j+1] = A[j];
			j--;
		}
		A[j+1] = tmp;
		for(k = 0; k < N; k++){
			printf("%d", A[k]);
			if(k!=N-1){
				printf(" ");
			}
		}
		printf("\n");
	}
	return 0;
}



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


using namespace std;
constexpr long long int mod = 1000000007,MOD= 998244353,MAX=200000;
const double PI = 3.14159265358979323846;
int main() {
    int N, M,a,b;
	cin >> N >> M;
    vector<vector<int>>connected(N);
	for (size_t i = 0; i < M; i++)
	{
		cin >> a >> b;
		a--;
		b--;
		connected.at(a).push_back(b);
		connected.at(b).push_back(a);
	}
	vector<pair<int, int>>unit(N);
	for (size_t i = 1; i < N; i++)
	{
		unit.at(i).first = mod;
		unit.at(i).second = mod;
	}
	queue <int>lis;
	for (size_t i = 0; i < connected.at(0).size(); i++)
	{
		lis.push(connected.at(0).at(i));
		unit.at(connected.at(0).at(i)) = make_pair(0, 0);
	}
	while(!lis.empty()){
		int i = lis.front();
		for (size_t j = 0; j < connected.at(i).size(); j++)
		{
			if (unit.at(connected.at(i).at(j)).second > unit.at(i).second + 1) {
				unit.at(connected.at(i).at(j)).second = unit.at(i).second;
				unit.at(connected.at(i).at(j)).first = i;
				lis.push(connected.at(i).at(j));
			}
		}
		lis.pop();
	}
	for (size_t i = 1; i < N; i++)if (unit.at(i).first == mod) { cout << "No"<<endl; return 0; }
	cout << "Yes"<<endl;
	for (size_t i = 1; i < N; i++)
	{
		cout << unit.at(i).first+1<<endl;
	}
}

Measured memory_bytes: 10688
# solution
import io

nim,mike=map(int,input().split())

abc=[list(map(int,input().split())) for _ in [0]*mike]

g=[[] for _ in [0]*nim]
[g[a-1].append([b-1,c]) for a,b,c in abc]

dist=[-10**15 for _ in [0]*nim]
dist[0]=0
a,b=-10**15,-10**15

for _ in range(nim):
    for p in range(nim):
        for i,j in g[p]:
            dist[i]=max(dist[i],dist[p]+j)
    a,b=b,dist[nim-1]

if a==b:
    print(a)
else:
    print("inf")

Measured memory_bytes: 3856
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()
next_r = [1] * N
next_s = [1] * N
next_p = [1] * N
ans = 0
for i in range(len(T)):
        if T[i] == 'r' and next_r[i - K]:
                ans += P
                next_r[i] = 0
        elif T[i] == 's' and next_s[i - K]:
                ans += R
                next_s[i] = 0
        elif T[i] == 'p' and next_p[i - K] :
                ans += S
                next_p[i] = 0
print(ans)




Measured memory_bytes: 43760
#include <bits/stdc++.h>
using namespace std;
int main(){
  int W,a,b,ans;
  cin>>W>>a>>b;
  if(a<b-W) ans=b-a-W;
  else if(a>W+b) ans=a-b-W;
  cout<<(ans?ans:0)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1000000007;
int dp[100003]={},vis[100003]={},ans=0;
vector<int> adj[100003];
int dfs(int curr)
{
  if(vis[curr]==1) { return dp[curr]; }
  else
    {
      // cout<<curr<<"\n";
      vis[curr]=1;
    }
      for(int child:adj[curr])
      {
        dp[curr]=max(dp[curr],1+dfs(child));
      }
      ans=max(ans,dp[curr]);
      // cout<<"curr="<<curr<<"dp="<<dp[curr]<<"\n";
      return dp[curr];
     // }
}
int32_t main()
// int main()
{  ios_base::sync_with_stdio(false); cin.tie(NULL);
   int i,n,m,x,y;cin>>n>>m;
   for(i=0;i<m;i++)
  {
    cin>>x>>y;
    adj[x].push_back(y);
  }
  for(i=1;i<=n;i++)
  {if(vis[i]!=1) dfs(i);}
  cout<<ans;
}


Measured memory_bytes: 7936
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB push_back
#define PF push_front
#define FILL(a,b) memset(a,b,sizeof(a))
using namespace std;
int main(){
	string s;
	cin>>s;
	int sum=0;
	for(auto u:s)sum+=u-'0';
	if(sum%9==0){
		cout<<"Yes";
	}else cout<<"No";
	RE 0;
}


Measured memory_bytes: 3748
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <numeric>
#include <queue>
using namespace std;

int64_t min(int64_t a,int64_t b) {
    if (a > b)
    {
        return b ;
    }else
    {
        return a ;
    }
}

int main(){
    int n ;
    cin >> n ;
    vector<int64_t> a(n) ;
    for (int i = 0; i < n; i++)
    {
        cin >> a.at(i) ;
    }
    sort(a.begin(),a.end()) ;
    if (a.at(0) == 0)
    {
        cout << 0 << endl ;
        return 0 ;
    }
    
    long double an = 1000000000000000000 ;
    int64_t ans = 1 ;
    for (int i = 0; i < n; i++)
    {        
        ans *= a.at(i) ;
        an /= a.at(i) ;
        if (ans > 1000000000000000000 || an < 0.5)
        {
            cout << -1 << endl ;
            return 0 ;
        }
        
    }
    
    if (ans <= 1000000000000000000 && ans >= 0)
    {
        cout << ans << endl ;
    }else
    {
        cout << -1 << endl ;
    }
    
    

    
}


Measured memory_bytes: 3960
#include<bits/stdc++.h>
using namespace std;
typedef  long long  ll;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
typedef pair<ll,ll>pll;
const  ll MAX=100000;
const  ll MOD=1e9+7;
vector<ll>sot,unsot;
ll f[MAX+100];
int main()
{

   ll n;

   cin>>n;

  double ara[n+3];

   for(ll i=0;i<n;i++)cin>>ara[i];

  double sum=0,a;

   for(ll i=0;i<n;i++)
   {
       a=ara[i];

       sum+=(1/a);

   }

   sum=1/sum;


   cout<<sum<<endl;


}




Measured memory_bytes: 3752
#include <algorithm>
#include <string>
#include <array>
#include <vector>
#include <iostream>

using namespace std;

int main() {

  int n, q;
  int l, r;
  int tmp = 0;

  string str;
  cin >> n >> q;
  cin >> str;

  vector<int> cnt(n, 0);

  for (int i = 1; i < n; i++) {
    if (str[i - 1] == 'A' && str[i] == 'C')
      tmp ++;
    cnt[i] = tmp;
  }

  for (int i = 0; i < q; i++) {
    cin >> l >> r;
    cout << cnt[r - 1] - cnt[l - 1] << endl;
  }
}


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

typedef struct{
	double x;
	double y;
} vec2D;

void setVec(vec2D &v,double x,double y){
	v.x=x;v.y=y;;
}

int main(){
	double x1,y1,x2,y2,x3,y3,xp,yp;
	vec2D v1,v2,v3,vp1,vp2,vp3;
	double z1,z2,z3;

	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		setVec(v1,x2-x1,y2-y1);
		setVec(v2,x3-x2,y3-y2);
		setVec(v3,x1-x3,y1-y3);
		setVec(vp1,xp-x1,yp-y1);
		setVec(vp2,xp-x2,yp-y2);
		setVec(vp3,xp-x3,yp-y3);

		z1=v1.x*vp2.y-v1.y*vp2.x;
		z2=v2.x*vp3.y-v2.y*vp3.x;
		z3=v3.x*vp1.y-v3.y*vp1.x;

		if((z1>0 && z2>0 && z3>0) || (z1<0 && z2<0 && z3<0)){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}

	return 0;
}

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


int main() {
    ll n,l;
    cin >> n >> l;
    vector<string> s(n);
    for (int i=0;i<n;i++) cin >> s[i];
    sort(s.begin(),s.end());
    for (int i=0;i<n;i++) cout << s[i];
    cout << endl;
}

Measured memory_bytes: 256
n=int(input())
S=list(map(int,input().split()))
q=int(input())
T=list(map(int,input().split()))

list=[]
for i in range(pow(2,n)):
    num=0
    for j in range(n):
        if((i>>j) & 1):
            num+=S[j]
    list.append(num)

S=sorted(list)
n=len(S)
#print(S)

def isOK(index,key):
    if S[index]>=key:
        return True
    else:
        return False


def binary_search(key):
    left=0
    right=n-1

    while(right-left>1):
        mid = int(left+(right-left)/2)
        if isOK(mid,key):
            right = mid
        else:
            left = mid

    return right

ans=0
for x in T:
    #print("x",x)
    index=binary_search(x)
    if x==S[index]:
        print("yes")
    else:
        print("no")



Measured memory_bytes: 55996
import java.util.ArrayList;
import java.util.List;
import java.util.OptionalInt;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int round = sc.nextInt();
			int houseNum = sc.nextInt();
			List<Integer> tmpLength = new ArrayList<Integer>(houseNum);
			for(int i=0; i<houseNum; i++) {
				tmpLength.add(sc.nextInt());
			}

			List<Integer> houseLength = new ArrayList<>(houseNum);
			for (int i = 0; i < tmpLength.size() - 1; i++) {
				houseLength.add(tmpLength.get(i + 1) - tmpLength.get(i));
			}
			int firstToLast = tmpLength.get(0) + (round - tmpLength.get(tmpLength.size() - 1));
			houseLength.add(firstToLast);
			
			OptionalInt max = houseLength.stream().mapToInt(i -> i.intValue()).max();
			int minLength  = houseLength.stream().mapToInt(i -> i.intValue()).sum() - max.getAsInt();
			System.out.println(minLength);
		}

	}
}

Measured memory_bytes: 94728
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin(), v.end()
bool chmin(ll & a, ll  b) { if (b < a) { a = b; return 1; } return 0; }
bool chmax(ll & a, ll b) { if (b > a) { a = b; return 1; } return 0; }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N=500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
int main() {
    cin >> n;
    cin>>m;
    vl A(n);
    rep(i, n) cin >> A[i];
 
    sort(all(A));
 
    x = accumulate(all(A), 0);
 
    rep(i, n) if (A[i] * 4 * m >= x) ans++;
 
    if(ans>=m)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a,b) ((a<b)?a:b)
#define _max(a,b) ((a<b)?b:a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a)?1:-1)
#define SORT(v) sort(v.begin(),v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380


int main() {
	cout << fixed << setprecision(10);
	LLI h, w;
	cin >> h >> w;

	if (w == 1||h==1) {
		cout << 1;
		return 0;
	}

	cout << (h + 1) / 2 * ((w + 1) / 2) + (h / 2) * (w / 2);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
    using namespace std;
     
    int main(){
      int n, m;
      cin >> n >> m;
      
      if((n + m) % 3 == 0 || n % 3 == 0 || m % 3 == 0){
        cout << "Possible" << endl;
      } else {
    	cout << "Impossible" << endl;
      }
      return 0;
    }

Measured memory_bytes: 256
program main
 
  implicit none
 
  integer(8) :: a, b, c, i,j,k
  
  read(*,*) a, b, c
  
  i = c**2
  j = -2*(a+b)*c
  k = (a-b)**2
  if ( i+j+k>0 .and. (c-(a+b)) > 0  ) then
    print*, "Yes"
  else
    print*, "No"
  end if
  
  
end program main


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

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

  ll x = 0;
  rep(i, b) { x += a * pow(10, i); }
  ll y = 0;
  rep(i, a) { y += b * pow(10, i); }

  vector<string> tmp(2);
  tmp[0] = to_string(x);
  tmp[1] = to_string(y);
  sort(tmp.begin(), tmp.end());

  cout << tmp[0] << endl;
  return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<unordered_map>
#include <queue>

struct myless {
	bool operator()(int x, int y) const {
		return x<y;
	}
};

typedef long long int MYINT;
typedef std::priority_queue<MYINT,std::vector<MYINT>,myless> P_Queue;
typedef std::unordered_map<MYINT,unsigned int> SET;


//////////////////////////////////
int main(void) {
	unsigned int N;
	P_Queue Q;

	std::cin >> N;

	//inputfase
	//binary insert
	for (int i = 0; i < N; i++) {
		MYINT temp;
		std::cin >> temp;
		Q.push(temp);
	}
	SET set;
	MYINT max1, max2;

	int count = 0;
	while (!Q.empty()) {
		MYINT temp=Q.top();

		if (set.find(temp) != set.end()) {
			if (count == 0) {
				//max1,max1,...
				max1 = temp;
				set[temp]++;
			}

			if (count >= 1) {
				if (max1 != temp) {
					//max1,max1,max2,max2
					max2 = temp;
					break;
				}
				else {
					//max1,max1,max1,...
					set[temp]++;
				}
			}

			if (set[max1] == 4) {
				//max1,max1,max1,max1
				max2 = max1;
				break;
			}
			count++;
		}
		else set[temp] = 1;

		Q.pop();
	}

	std::cout << max1*max2 << std::endl;

	return 0;
}


Measured memory_bytes: 4596
#include <stdio.h>

long main(){
  long a[200001],b[200001];
  long n,i;
  scanf("%ld",&n);
  for(i=0;i<n;i++){
    scanf("%ld",&a[i]);
  }
  if(n%2==0){
    for(i=n/2;i<n;i++){
      b[i] = a[2*(i-n/2)];
    }
    for(i=0;i<n/2;i++){
      b[i] = a[n-2*i-1];
    }
  }
  else{
    for(i=0;i<n;i++){
      if(i<=(n-1)/2){
        b[i] = a[n-2*i-1];
      }else{
        b[i] = a[(i-(n-1)/2)*2-1];
      }
    }
  }
  for(i=0;i<n;i++){
    printf("%ld ",b[i]);
  }  
  return 0;
}

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

typedef long long ll;
typedef int64_t i6;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define Sort(x) sort(x.begin(), x.end())
#define Sort_rev(x) sort(x.begin(), x.end(), greater<int>())
#define ALL(v) (v).begin(), (v).end()

// π M_PI
// deg = rad*180/M_PI

int main() {
    ll n, k;
    cin >> n >> k;
    ll ans = 0;

    if ( n < k ) {
        cout << 1 << endl;
    } else {
        while ( n >= pow(k, ans) ) {
            // cout << ans << " " << pow(k, ans) << endl;
            ans++;
        }
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 512
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DBannedK solver = new DBannedK();
        solver.solve(1, in, out);
        out.close();
    }

    static class DBannedK {
        PrintWriter out;
        InputReader in;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            this.out = out;
            this.in = in;
            int n = ni();
            int[] arr = new int[n];
            int i = 0;
            long[] freq = new long[n + 1];
            for (i = 0; i < n; i++) {
                arr[i] = ni();
                freq[arr[i]]++;
            }
            long sum = 0;
            for (i = 0; i <= n; i++) {
                sum += (freq[i] * (freq[i] - 1)) / 2;
            }
            for (i = 0; i < n; i++) {
                sum -= (freq[arr[i]] * (freq[arr[i]] - 1)) / 2;
                freq[arr[i]]--;
                sum += (freq[arr[i]] * (freq[arr[i]] - 1)) / 2;
                pn(sum);
                sum -= (freq[arr[i]] * (freq[arr[i]] - 1)) / 2;
                freq[arr[i]]++;
                sum += (freq[arr[i]] * (freq[arr[i]] - 1)) / 2;
            }

        }

        int ni() {
            return in.nextInt();
        }

        void pn(long zx) {
            out.println(zx);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}



Measured memory_bytes: 50276
#pragma GCC optimize("O3") 
 
#include <bits/stdc++.h>
using namespace std;
 
typedef long long int           ll;
typedef unsigned long long int  ull;
typedef long double             ld;
 
typedef pair<int, int>          pii;
typedef pair<ll,ll>             pll;
typedef vector<int>             vi;
typedef vector<ll>              vll;
typedef vector<pii>             vpii;
typedef vector<pll>             vpll;
 
#define test(t)		        int t; cin >> t; while(t--)
#define f(i, a, b)	        for(int (i) = (a); (i) < (b); ++(i))
#define all(a)		        (a).begin(), (a).end()
#define endl 		        "\n"
#define maxvec(vec)             *max_element(all(vec))
#define minvec(vec)             *min_element(all(vec))
#define maxarr(arr)             *max_element(arr, arr + n)
#define minarr(arr)             *min_element(arr, arr + n)
#define deb(x)		        cout << #x << ": " << x << endl;
#define deb2(x,y)	        cout << #x << ": " << x << " ~ " <<  #y << ": " << y << endl;
#define deba(arr)	        cout << #arr << " ~ [ "; for(auto n: arr) cout << n << " "; cout << "]" << endl;
#define debap(arr)	        cout << #arr << " ~ [ "; for(auto n: arr) cout << n.first << "-" << n.second << " "; cout << "]" << endl;
#define fast 		        ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
 
#define mx9		1000000007
#define mx7		10000007
#define mx6		1000006
#define mx5		200005
#define inf		1<<30                                 
#define eps		1e-9
#define mod		1000000007
#define PI		3.141592653589793238462643383279502884L
 
void solve()
{
    ll n, ct = 0;
    ld d;
    cin >> n >> d;
    f(i, 0, n)
    {
        ld x, y;
        cin >> x >> y;
        ld t = (sqrt((x * x)+ (y * y)));
        // deb2(t, d)
        if(t <= d)
            ct += 1;
    }
    cout << ct << endl;
}
 
int main()
{
    fast;
    // test(t)
        solve();
    return 0;
}

Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, N, a, b) for(int i = a; i < N; i += b)

int main(){
	string T;
	cin >> T;
	int count;
	rep(i, T.size()){
		if (T.at(i) == '?')
			T.at(i) = 'D';
	}
	// rep(i, T.size()){
	// 	if (T.at(i) == 'D'){
	// 		count++;
	// 		if (i > 0 && T.at(i - 1) == 'P')
	// 			count++;
	// }
	rep(i, T.size()) cout << T.at(i);
	cout << endl;
}

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

public class Solution
{
    static bool[] GetVisited(string way, int start, int goal)
    {
        var n = way.Length;
        var points = new HashSet<int>();
        var visited = new bool[n];
        var result = new bool[n];
        visited[start] = true;
        for (int i = start; i <= goal; i++)
        {
            if (visited[i])
            {
                for (int j = i + 1; j <= i + 2 && j < n; j++)
                {
                    if (way[j] == '.')
                    {
                        visited[j] = true;
                    }
                }
            }
        }
        result[goal] = visited[goal];
        for (int i = goal; i >= start; i--)
        {
            if (result[i])
            {
                for (int j = i - 1; j >= i - 2 && j >= 0; j--)
                {
                    result[j] = visited[j];
                }
            }
        }
        return result;
    }

    public static void Main()
    {
        var vals = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var N = vals[0];
        var A = vals[1] - 1;
        var B = vals[2] - 1;
        var C = vals[3] - 1;
        var D = vals[4] - 1;
        var S = Console.ReadLine();

        var aVisited = GetVisited(S, A, C);
        var bVisited = GetVisited(S, B, D);
        bool ok = false;
        if (C < D)
        {
            ok = aVisited[C] && bVisited[D];
        }
        else
        {
            for (int i = 0; i < N - 2; i++)
            {
                if (aVisited[i] && bVisited[i + 1] && aVisited[i + 2])
                {
                    ok = true;
                    break;
                }
            }
        }

        Console.WriteLine(ok ? "Yes" : "No");
    }
}

Measured memory_bytes: 14816
import sys

readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

N, M, Q = map(int, readline().split())

kumi = []
for _ in range(Q):
    tmp = list(map(int, readline().split()))
    kumi.append(tmp)

ans = 0
res = []
def F(l):
    if len(l) == N:
        ans = 0
        for i in range(Q):
            a, b, c, d = kumi[i]
            if l[b-1] - l[a-1] == c:
                ans += d
        return ans
    ans = 0
    start = l[-1] if len(l) else 0
    for i in range(start, M):
        l.append(i)
        ans = max(ans, F(l))
        l.pop()
    return ans
    
ans = F([])
print(ans)

Measured memory_bytes: 9188
from itertools import starmap


def solve(n, a):
    max_a, min_a = float('-inf'), float('inf')
    max_i, min_i = 0, 0
    for i, b in enumerate(a):
        if b > max_a:
            max_i, max_a = i + 1, b
        if b < min_a:
            min_i, min_a = i + 1, b

    if max_a >= 0 and min_a >= 0:
        return [(i, i + 1) for i in range(1, n)]
    if max_a <= 0 and min_a <= 0:
        return [(i, i - 1) for i in range(n, 1, -1)]
    buf = []
    if max_a >= -min_a:
        for i, b in enumerate(a):
            if b < 0:
                buf.append((max_i, i + 1))
        buf.extend((i, i + 1) for i in range(1, n))
    else:
        for i, b in enumerate(a):
            if b > 0:
                buf.append((min_i, i + 1))
        buf.extend((i, i - 1) for i in range(n, 1, -1))
    return buf


n = int(input())
a = list(map(int, input().split()))
buf = solve(n, a)
print(len(buf))
print(''.join(starmap('{} {}\n'.format, buf)))


Measured memory_bytes: 3064
import sys
input = sys.stdin.readline
import heapq
import math

def main():
    N,M = map(int,input().split())
    c = list(map(int,input().split()))
    c = list(map(lambda x:-x,c))
    heapq.heapify(c)

    for i in range(M):
        use = heapq.heappop(c)
        use = math.ceil(use/2)
        heapq.heappush(c,use)

    print(-sum(c))

if __name__ == "__main__":
    main()

Measured memory_bytes: 14380
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll a,b,m;
    cin>>a>>b>>m;
    ll arr[a],arm[b];
    for(ll i=0;i<a;i++)
        cin>>arr[i];
    for(ll j=0;j<b;j++)
        cin>>arm[j];
    ll mini=INT_MAX;
    for(ll i=0;i<m;i++)
    {
        ll x,y,c;
        cin>>x>>y>>c;
        x--;
        y--;
        if(arr[x]+arm[y]-c<mini)
            mini=arr[x]+arm[y]-c;
    }
    ll mina=arr[0];
    ll minb=arm[0];
    for(ll i=0;i<a;i++)
        mina=min(mina,arr[i]);
    for(ll i=0;i<b;i++)
        minb=min(minb,arm[i]);
    mini=min(mini,mina+minb);
    cout<<mini;
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace ABC121C
{
    public partial class Program
    {
        void Solve(StreamScanner ss, StreamWriter sw)
        {
            //---------------------------------
            var N = ss.Next(int.Parse);
            var M = ss.Next(long.Parse);
            var shops = ss.Next(long.Parse, 2, N).Select(a => new {A = a[0], B = a[1]}).OrderBy(x => x.A);

            var ans = 0L;
            foreach (var shop in shops)
            {
                ans += shop.A * Math.Min(shop.B, M);
                M -= shop.B;
                if (M <= 0) break;
            }
            sw.WriteLine(ans);
            //---------------------------------
        }
    }

    public class StreamScanner
    {
        static readonly char[] Separator = { ' ' };
        readonly StreamReader streamReader;

        string[] line = new string[0];
        int index = 0;

        public StreamScanner(Stream stream)
        {
            this.streamReader = new StreamReader(stream);
        }

        public string Next()
        {
            return Next(s => s);
        }

        public string[] Next(int x)
        {
            return Next(s => s, x);
        }

        public string[][] Next(int x, int y)
        {
            return Next(s => s, x, y);
        }

        public T Next<T>(Func<string, T> parser)
        {
            if (index < line.Length) return parser(line[index++]);
            index = 0;
            line = streamReader.ReadLine()?.Split(Separator, StringSplitOptions.RemoveEmptyEntries);
            return Next(parser);
        }

        public T[] Next<T>(Func<string, T> parser, int x)
        {
            var ret = new T[x];
            for (var i = 0; i < x; ++i) ret[i] = Next(parser);
            return ret;
        }

        public T[][] Next<T>(Func<string, T> parser, int x, int y)
        {
            var ret = new T[y][];
            for (var i = 0; i < y; ++i) ret[i] = Next(parser, x);
            return ret;
        }
    }

    public partial class Program
    {
        static void Main()
        {
            Excute(Console.OpenStandardInput(), Console.OpenStandardOutput());
        }

        public static void Excute(Stream input, Stream output)
        {
            var ss = new StreamScanner(input);
            var sw = new StreamWriter(output);
            new Program().Solve(ss, sw);
            sw.Flush();
        }
    }
}

Measured memory_bytes: 26684
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    string s;
    cin>>n>>s;
    int ans=0;
    for(int i=1;i<n;i++){
        int cnt=0;
        int a[30]={0};
        for(int j=0;j<i;j++){
            a[s[j]-'a']++;
        }
        for(int k=i;k<n;k++){
            if(a[s[k]-'a']){
                cnt++;
                a[s[k]-'a']=0;
            }
        }
        ans=max(ans,cnt);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;


const int INF = 10000000;
const long long INFL = (1LL<<40);
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}

template< typename T >
struct edge{
    int src, to;T cost;
    edge(int to,T cost) :src(-1),to(to),cost(cost){}
    edge(int src, int to, T cost) :src(src),to(to),cost(cost){}edge
    &operator=(const int &x){
        to =x;
        return *this;
    }
    operator int() const{ return to;}
};



int main() {
    string s;cin>>s;
    bool flag = true;
    
    if(s[0]!='A')flag = false;
    int count[127]={0};
    for(auto i = 2; i<s.size()-1;i++){
        count[s[i]]++;
    }
    if(count['C']!=1) flag = false;
    
    int c = 0;
    for(auto j :s){
        c += (j<'a');
    }
    if(c!=2) flag = false;
    
    if(flag)cout<<"AC"<<endl;
    else cout<<"WA"<<endl;
    
    return 0;
}





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

int main()
{
    int N;
    cin >> N;
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        int begin, end;
        cin >> begin >> end;
        ans += (end - begin) + 1;
    }
    cout << ans;
}

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

using namespace std;
#define rep(i, N) for(int i=0;i<int(N);++i)
#define rep1(i, N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;

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

template<class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

const int INF = (ll) 1e9;
const ll INFLL = (ll) 1e18 + 1;
const ll MOD = (ll) 1e9 + 7;
const double PI = acos(-1.0);

/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int K;
    cin >> K;
    int a,b;
    cin >> a >> b;
    for(int i = a; i <= b;i++){
        if(i % K == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
}

Measured memory_bytes: 3608
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
using Graph=vector<vector<int>>;
using edge= struct{int to;ll cost;};


template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main(){
  ll N;
  cin>>N;
  ll ans=0;
  ll ans1=0;

  ll tmp=0;
  ll tmp1=0;


  if(N%2==1){
    cout<<0<<endl;
    return 0;
  }
  for(int i=1;i<27;i++){
    tmp=pow(5,i);
    ans=ans+N/tmp/2;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<int>>;
const int MOD = 1e9 + 7;

ll solve(int level, ll x) {
    if (x <= 0)
        return 0;
    if (level == 0)
        return !!x;
    ll cnt = (1LL << (level + 2)) - 3, pcnt = (1LL << level) - 1;
    ll tmp = 0;
    if (x <= cnt / 2 + 1)
        return solve(level - 1, x - 1) + (x == cnt / 2 + 1);
    else
        return solve(level - 1, x - cnt / 2 - 1) + pcnt + 1;
}

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

    int N;
    ll X;
    cin >> N >> X;

    cout << solve(N, X) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#define mod (1000000000+7)
using namespace std;

int n,m,i,j,a[1010][1010];
char c[1010][1010];

int main()
{
    cin>>n>>m;
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=m;j++)
            cin>>c[i][j];
    }

    a[1][1]=1;
    for(i=1;i<=n;i++)
        for(j=1;j<=m;j++)
            if(c[i][j]=='.')a[i][j]+=(a[i-1][j]+a[i][j-1])%mod;

    cout<<a[n][m];
    return 0;
}


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

int main()
{
    int N, Z, W;
    int A[2005];
    cin >> N >> Z >> W;

    for(int i = 0; i < N; i++) cin >> A[i];

    cout << max(abs(A[N - 1] - W), abs(A[N - 2] - A[N - 1])) << endl;

    return (0);
}

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

using namespace std;

struct Apple {
    int taste;
    int color;
    Apple() {}
    bool operator < (const Apple& o) const {
        return taste > o.taste;
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    vector<Apple> apples(a + b + c);
    for (int i = 0; i < a; ++i) {
        apples[i].color = 1;
        cin >> apples[i].taste;
    }
    for (int i = a; i < a + b; ++i) {
        apples[i].color = 2;
        cin >> apples[i].taste;
    }
    for (int i = a + b; i < a + b + c; ++i) {
        apples[i].color = 0;
        cin >> apples[i].taste;
    }
    sort(apples.begin(), apples.end());
    int chosen_red = 0, chosen_green = 0, chosen_total = 0;
    long long total_taste = 0;
    for (auto& apple : apples) {
        if (chosen_total == x + y) {
            continue;
        }
        if (apple.color == 0 || (apple.color == 1 && chosen_red < x) || (apple.color == 2 && chosen_green < y)) {
            ++chosen_total;
            total_taste += apple.taste;
            if (apple.color == 1) {
                ++chosen_red;
            }
            if (apple.color == 2) {
                ++chosen_green;
            }
        }
    }
    cout << total_taste << endl;
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define show(x) cerr << #x << " = " << x << endl
using namespace std;
using ll = long long;
using ld = long double;
constexpr ll MOD = 1000000007LL;
template <typename T>
constexpr T INF = numeric_limits<T>::max() / 10;

int main()
{
    int N;
    cin >> N;
    vector<ll> A(N);
    vector<ll> B(N);
    vector<ll> sa(N);
    ll asum = 0;
    ll neg = 0;
    ll mini = INF<ll>;
    for (int i = 0; i < N; i++) {
        cin >> A[i] >> B[i];
        if (A[i] > B[i]) {
            mini = min(mini, B[i]);
        }
        asum += A[i];
    }
    cout << (A == B ? 0 : asum - mini) << endl;
    return 0;
}


Measured memory_bytes: 768
# coding: utf-8

s = input().rstrip()

def isValid(s:str):
    if s[0] != "A":
        return False
    if s[1] == s[1].upper():
        return False
    sub = s[2:-1]
    if len([i for i in sub if i == "C"]) != 1:
        return False

    sub2 = s[1] + sub.replace("C", "") + s[-1]
    if sub2 != sub2.lower():
        return False
    return True

ans = "AC"

if not isValid(s):
    ans = "WA"

print(ans)


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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(ll i = 0; i<n; i++)
#define rep_s(i, start, n) for(ll i= start;  i<n; i++)
#define rep_down(i, n) for(ll i = n-1; i>=0; i--)
#define rep_down_s(i, n, start) for(ll i = n-1; i>=start; i--)
#define ALL(a) (a).begin(), (a).end()
#define ALL_str(a) (a).cbegin(), (a).cend()
#define print(ans) cout << ans << endl;
#define MOD 1000000007
string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";

/*
for (iterator = hash.begin(); iterator != hash.end(); iterator++)
{
// ここで、要素毎の操作を行います。
std::pair<std::string, CMyClass> element = *iterator;

}
*/
/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}

ll keta_num(ll num){
  ll total = 0;
  while(num){
    num /= 10;
    total++;
  }
}


ll binary_search(ll left_key, ll border, ll low, ll high) {
     // 配列 a の左端と右端
    ll mid = (low+high)/2;
    while (high > low+1) {
       mid = (low+high)/2;
        if (left_key*mid>border) high = mid;
        else if (left_key*mid<border) low = mid;
        else {
          mid =mid-1;
          break;
        }
    }
    return mid;
}

bool IsPrime(ll a){
  ll b = sqrt(a);
  b++;
  while(b-->=2){
    if (a%b==0) return false;
  }
  return true;
}

ll gcd(ll a, ll b){
  ll tmp;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }

  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

ll fibonacchi(ll num){
  ll f0 = 0, f1 = 1, f2;
  ll count = 0;
  while(count<num){
    f2 = f0+f1;
    f0 = f1;
    f1 = f2;
    count++;
  }
  return f2;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(void){
  ll N, M, A, B, C, D, E, F, G, K,L, W, H, P, Q, R, V, X, Y;
  string S, T;
  cin >>N;
  map<string, int> st;
  rep(i, N){
    cin >> S;
    st[S]+=1;
  }
  cout << st.size() << endl;


}


Measured memory_bytes: 19356
#include<iostream>
#include<vector>
#include<stack>
#include<algorithm>
#include<string>
#include<set>
#include<numeric>
#include<functional>
#include<unordered_map>
#include<cmath>
#include<cstdlib>
#include<cassert>

int main() {
	int N, K;
	std::cin >> N >> K;
	std::vector<int> l(N);
	for (int i = 0; i < N; i++)
		std::cin >> l[i];
	std::sort(l.begin(), l.end(), std::greater<int>());
	std::cout << std::accumulate(l.begin(), l.begin() + K, 0);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  string s;
  cin >> s;
  int i;
  string t="Yes";
  if(s.at(a)!='-'){
    t="No";
  }
  for(i=0;i<s.size();i++){
    if(i==a){
      continue;
    }
    if(s.at(i)>'9' || s.at(i)<'0'){
      t="No";
    }
  }
  cout << t;
}
    
    


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
//setprecision(12)
#include <cassert>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define Cout(x) cout << x << endl;
#define check(v) rep(i,v.size()) cout << v[i] << endl;
#define vint(x) vector<int> x
#define vll(x) vector<long long> x
#define vstr(x) vector<string> x
const long long LLINF = 1LL<<60;
const int INF = 1e9;
const long long MOD = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
#define pint pair<int,int>
#define pll pair<ll,ll>
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    double l; cin >> l;
    double ans = l*l*l/27.0;
    cout << setprecision(12) << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
 
#define endl '\n'
#define loop(i, m, n) for (ll i = m; i < n; i++)
#define loope(i, m, n) for (ll i = m; i <= n; i++)
#define epool(i, m, n) for (ll i = m; i >= n; i--)
#define mod 1000000007
#define mod2 998244353
#define vi vector<ll>
#define fi first
#define se second
#define pb push_back
#define MP make_pair
#define empf emplace_front
#define empb emplace_back
#define ret(x) return cout << x,0;
#define all(v) v.begin(),v.end()
const ll INF=1e18;
const double PI=4*atan(1);

#define SpeedForce                    \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
using namespace std;

ll mpow(ll base,ll exp);
void solve();
ll POW(ll base,ll exp);
ll gcd(ll a,ll b);

int32_t main(){
    SpeedForce
    ll i = 0,j = 0;
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif

    int t;
    t=1;
    //cin >> t;
    while (t--){
        //cout << fixed << setprecision(10);
        solve();
    }
}

void solve(){
    char c;
    cin >> c;
    if(c>=65 && c<=90) cout << "A";
    else cout << "a" << endl;

}

ll POW(ll base,ll exp){
    ll result = 1;
    while (exp > 0){
        if (exp & 1)
            result = ((ll)result * base);
        base = ((ll)base * base);
        exp >>= 1;
    }
    return result;
}

ll mpow(ll base, ll exp){
    base %= mod;
    ll result = 1;
    while (exp > 0){
        if (exp & 1)
            result = ((ll)result * base) % mod;
        base = ((ll)base * base) % mod;
        exp >>= 1;
    }
    return result;
}

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

Measured memory_bytes: 3656