akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
// aよりbの方が小さかったら、aの値をbの値に置き換える。(swapではない！)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
// aよりbの方が大きかったら、aの値をbの値に置き換える。
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
// 素数かどうか判定
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;
// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	vector<int>a(n), b(n); rep(i, n)cin >> a[i]; rep(i, n)cin >> b[i];
	int ans = 0;
	rep(i, n) {
		int now = a[i]+b[i];
		rep(j, i) {
			now += a[j];
		}
		for (int j = i+1; j < n; j++) {
			now += b[j];
		}
		chmax(ans, now);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
n,w=map(int,input().split())
cost=[[0 for i in range(w+1)] for j in range(n+1)] #DP配列です
value=[tuple(map(int,input().split())) for i in range(n)]#品物の情報を受けとります
for i in range(1,n+1):
  for j in range(w+1):
    weight_=value[i-1][0] #i-1番目の品物の重さ
    value_=value[i-1][1] #i-1番目の品物の価値
    if j < weight_:
      cost[i][j]=cost[i-1][j]
    else:
      cost[i][j]=max(cost[i-1][j-weight_]+value_,cost[i-1][j])
print(cost[n][w])


Measured memory_bytes: 175440
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#define N               100005
#define ff              first
#define ss              second
#define ll              long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<ll,ll>
#define vi              vector<ll>
#define mii             map<ll,ll>
#define pq_max          priority_queue<ll>
#define pq_min          priority_queue<ll,vi,greater<ll> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            ll x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void fio(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

int a[22][22];
ll dp[22][1<<22];

ll f(ll i, ll X, ll n){
    if(i > n){
        if(X == 0) return 1;
        return 0;
    }

    if(dp[i][X] != -1) return dp[i][X] % mod;

    ll ans = 0;
    for(ll z=0;z<n;z++){
        bool avail = (X & (1 << z)) != 0;

        if(avail and a[i][z+1] == 1){
            // setting that bit to 0
            ans = (ans + f(i+1, X ^ (1 << z), n) % mod) % mod;
        }
    }

    return dp[i][X] = ans % mod;
}

int main(){
    fio();

    ll n;
    cin>>n;

    for(ll x=1;x<=n;x++){
        for(ll y=1;y<=n;y++) cin>>a[x][y];
    }

    memset(dp ,-1, sizeof dp);

    cout<<f(1, (1 << n) - 1, n);

    return 0;
}

Measured memory_bytes: 724460
from sys import stdin

def main():
    N = int(input())
    V = map(int, input().split())

    v = sorted(V)
    l = len(v)
    while l > 1:
        n = (v[0] + v[1]) / 2
        v = sorted(v[2:] + [n])
        l -= 1
    print(*v)

input = lambda: stdin.readline()
main()


Measured memory_bytes: 3060
package main

import (
	"fmt"
)

func main() {
	var a, b, c int

	fmt.Scanf("%d %d %d", &a, &b, &c)

	if a == b {
		if a == 5 && c == 7 {
			fmt.Printf("YES\n")
		} else {
			fmt.Printf("NO\n")
		}
	} else if b == c {
		if b == 5 && a == 7 {
			fmt.Printf("YES\n")
		} else {
			fmt.Printf("NO\n")
		}
	} else if a == c {
		if a == 5 && b == 7 {
			fmt.Printf("YES\n")
		} else {
			fmt.Printf("NO\n")
		}
	} else {
		fmt.Printf("NO\n")
	}
}


Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
#include <numeric>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };



signed main() {
	int h, w;
	vector<bool>h2(1000, false), w2(1000, false);
	vector<string>slist;


	cin >> h >> w;

	for (int i = 0; i < h; i++) {
		string s;
		cin >> s;
		slist.push_back(s);
		bool flag = false;

		for (int j = 0; j < s.length(); j++) {
			if (s[j] == '#') {
				flag = true;
			}
		}

		if (flag == false) {
			h2[i] = true;
		}
	}

	for (int i = 0; i < w; i++) {
		bool flag = false;
		for (int j = 0; j < h; j++) {
			if (slist[j][i] == '#') {
				flag = true;
			}
		}
		if (flag == false) {
			w2[i] = true;
		}
	}

	for (int i = 0; i < h; i++) {
		if (h2[i] == true)continue;
		for (int j = 0; j < w; j++) {
			if (w2[j] == true)continue;
			cout << slist[i][j];
		}
		cout << endl;
	}


	return 0;
}

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

int main(void) {
  int x;
  cin >> x;
  if(x == 3){
  cout << "YES" << endl;
  }else if(x == 5){
    cout << "YES" << endl;
  }else if(x == 7){
    cout << "YES" <<endl;
  } else{
    cout << "NO" << endl;
  }
}


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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

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

  ll n, k;
  cin >> n >> k;

  vector<P> sushi;
  rep(i, n) {
    ll t, d;
    cin >> t >> d;
    sushi.emplace_back(d, t);
  }
  sort(all(sushi), greater<P>());

  vector<bool> exist(n + 1);
  vector<P> ori; // ダブりなし
  vector<P> dup; // ダブったやつ

  ll sum = 0;
  rep(i, n) {
    if (!exist[sushi[i].second]) {
      exist[sushi[i].second] = true;
      if (ori.size() < k) {
        sum += sushi[i].first;
        ori.push_back(sushi[i]);
      } else {
        dup.push_back(sushi[i]);
      }
    } else {
      dup.push_back(sushi[i]);
    }
  }

  ll type = ori.size();

  ll tmp = 0;
  if (ori.size() < k) {
    while (ori.size() < k) {
      sum += dup[tmp].first;
      ori.push_back(dup[tmp++]);
    }
  }

  ll ans = sum + type * type;
  while (tmp < min(k, (ll)dup.size())) {
    ll cand = sum - ori[type - 1].first + dup[tmp].first + (type - 1) * (type - 1);
    chmax(ans, cand);

    sum = sum - ori[type - 1].first + dup[tmp].first;
    ori[type - 1] = dup[tmp];

    type--;
    tmp++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 6000
N = int(input())
B = list(map(int,input().split()))
A = [0] * N
A[0] = B[0]
for i in range(1,N-1):
    A[i] = min(B[i-1],B[i])
A[N-1] = B[N-2]
ans = sum(A)
print(ans)

Measured memory_bytes: 3064
#include<iostream> 
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <sstream>
#include <vector>

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



int main() {
	int n,i=0,j=0,k=0,ans=0,ans2=0;
	vector<vector <int >> a(3, vector< int>(3));

	rep(i, 3) {
		rep(j, 3) {
			cin >> a.at(i).at(j);
		}
	}

	cin >> n;
	vector<int > b(n);

	rep(k, n) {
		cin >> b.at(k);
		rep(i, 3) {
			rep(j, 3) {
				if (a.at(i).at(j) == b.at(k)) {
					a.at(i).at(j) = 0;
					
				}
				
			}
			
		}

	}
	rep(i, 3) {
		rep(j, 3) {
			if (a.at(i).at(j) == 0) {
				ans++;
				if (ans == 3) {
					ans2++;
				}
			}
		}
		ans = 0;
	}

	rep(i, 3) {
		rep(j, 3) {
			if (a.at(j).at(i) == 0) {
				ans++;
				if (ans == 3) {
					ans2++;
					//cout << ans2 << "b" << endl;
				}
			}

		}
		ans = 0;
	}
	rep(i, 3) {
		if (a.at(i).at(i) == 0) {
			ans++;
			if (ans == 3) {
				ans2++;
				//cout << ans2 << "b" << endl;
			}
		}
	
	}
	ans = 0;
	rep(i, 3) {
		if (a.at(i).at(2 - i) == 0) {
			ans++;
			if (ans == 3) {
				ans2++;
			}
		}
	}
	ans = 0;
	if (ans2 == 0) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3584
while line = gets
    line = line.chomp
    atmark, multi = 0, 0
    line.each_char{|c|
        if c == '@'
            atmark = 1
        else
            if atmark == 0
                print c
            elsif atmark == 1
                multi = c.to_i
                atmark = 2
            else
                print c * multi
                atmark = 0
            end
        end
    }
    puts
end



Measured memory_bytes: 6856
// Problem : B - Mix Juice
// Contest : AtCoder - AtCoder Beginner Contest 171
// URL : https://atcoder.jp/contests/abc171/tasks/abc171_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 200001; //check the limits, dummy
 
int main() 
{
	ios_base::sync_with_stdio(0); cin.tie(0);    
	int N,K;
	cin>>N>>K;
	vi v(N);
	F0R(x,N)
		cin>>v[x];
	sort(all(v));
	ll sum=0;
	F0R(x,K)
		sum+=v[x];
	cout<<sum<<endl;
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 3664
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define showa(v) for(int iii = 0; iii < v.size(); iii++){ cout << v[iii] << " ";} cout << endl;
#define show(iiii) cout << iiii << endl; 
#define shows(iiiii) cout << iiiii << " ";
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <set>
#include <deque>
#include <numeric>
#include<tuple>
#include <utility>
#include <map>
#include <cassert>
using namespace std;
 
int main(){
    string s, t;
    cin >> s >> t;
    int ret = 0;
    rep(i, s.size()){
        if(s[i] != t[i]){
            ret++;
        }
    }
    cout << ret << endl;

}

Measured memory_bytes: 3852
<?php
  list($n) = explode(" ", trim(fgets(STDIN)));

  $x = sqrt($n);
  $ans = -1;

  for($i=1; $i<=$x; $i++){
    if($n % $i == 0){
      $ans = $i;
    }
  }

  if($ans == -1){
    echo $n - 1;
    exit;
  }
  $p = $n / $ans ;
  echo $ans + $p - 2;

Measured memory_bytes: 16324
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<sstream>
#include<stack>
#include<string>
#include<unordered_set>
#include<vector>

#define ll long long
#define P pair<int,int>
#define FOR(i,N) for(int i=0;i<(int)N;i++)
#define FORIN(i,a,b) for(int i=a;i<(int)b;i++)
#define ALL(x) (x).begin(),(x).end()
#define LAST(x) (x)[(x).size()-1]
#define GI(name) int (name);scanf("%d",&(name))
#define GI2(name1,name2) int (name1),(name2);scanf("%d %d",&(name1),&(name2))
#define GI3(name1,name2,name3) int (name1),(name2),(name3);scanf("%d %d %d",&(name1),&(name2),&(name3))
#define GVI(name,size) vector<int> (name)(size);FOR(i,(size))scanf("%d",&(name)[i])
#define MOD 1000000007

using namespace std;

string to_hex(int x){
    stringstream ss;
    ss<<hex<<x;
    return ss.str();
}

inline int get_int(){
    int ret;
    scanf("%d",&ret);
    return ret;
}

inline vector<int> get_ints(int n){
    vector<int> ret(n);
    FOR(i,n){
        scanf("%d",&ret[i]);
    }
    return ret;
}

inline string get_str(){
    string ret;
    cin>>ret;
    return ret;
}

bool is_prime(int n){
    int s=sqrt(n)+1;
    for(int i=2;i<=s;++i){
        if(n%i==0){
            return 0;
        }
    }
    return 1;
}

vector<P> prime_division(int n){
    vector<P> ret;
    int s=sqrt(n)+1;
    int c=0;
    for(int i=2;i<=n;++i){
        if(n%i==0){
            c=0;
            do{
                ++c;
                n/=i;
            }while(n%i==0);
            ret.push_back(P(i,c));
        }
    }
    return ret;
}

string to_string(string s){
    return s;
}

template<class T>
string to_string(vector<T> v){
    string ret="{";
    FOR(i,v.size()-1){
        ret+=to_string(v[i])+",";
    }
    if(v.size()>0){
        ret+=to_string(LAST(v));
    }
    ret+="}";
    return ret;
}

void debug_print(){
    cerr<<endl;
}

template<class Head,class... Tail>
void debug_print(Head head,Tail... tail){
    cerr<<to_string(head)<<" ";
    debug_print(tail...);
}

template<class... T>
void debug(T... args){
    cerr<<"["<<__LINE__<<"]: ";
    debug_print(args...);
}

void print(){
    cout<<endl;
}

template<class Head,class... Tail>
void print(Head head,Tail... tail){
    cout<<to_string(head);
    print(tail...);
}

int main(){
    GI2(N,T);
    int last;
    int ans=0;
    cin>>last;
    last+=T;
    ans+=T;
    FOR(i,N-1){
        GI(t);
        ans+=min(T,max(0,t+T-last));
        last=t+T;
    }
    print(ans);
    return 0;
}

Measured memory_bytes: 256
import math
import random
from operator import itemgetter
import re
import sys
from itertools import accumulate
from collections import defaultdict
from collections import deque
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
N = int(input())
S = [int(i) for i in input().split()]
num = 1
for i in range(N):
    if S[i] == num:
        num += 1
if num != 1:
    print(N-num+1)
else:
    print(-1)


Measured memory_bytes: 102600
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            var T = Console.ReadLine();

            for (var i = 0; i < S.Length; i++)
            {
                var tmp = S.Substring(S.Length - 1, 1);
                S = S.Remove(S.Length - 1, 1);
                S = S.Insert(0, tmp);
                if (S == T)
                {
                    Console.WriteLine("Yes");
                    return;
                }
            }

            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>  // This will work only for g++ compiler. 


#define for0(i, n) for (int i = 0; i < (int)(n); ++i) // 0 based indexing
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (int i = (int)(n); i >= 1; --i) // reverse 1 based

//short hand for usual tokens
#define pb push_back
#define fi first
#define se second

using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    long long answ = 0;
    int  h1,h2,m1,m2,k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int t1 = h1*60 + m1;
    int t2 = h2*60 + m2;
    answ = (t2-k)-t1;
    cout << answ << endl;
}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cctype>
#include <functional>
#include <map>
#include <cmath>

using namespace std;
typedef long long ll;

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

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

    int disA_B, disB_C ,disA_C;
    disA_B = abs(a-b);
    disB_C = abs(b-c);
    disA_C = abs(a-c);
    if(disA_C <= d || (disA_B <= d && disB_C <= d)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


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

using namespace std;

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef long long ll; typedef vector<int> VI; typedef pair<ll,int> pii;
const ll mod = 1e9+7;

struct Bitree {
	typedef ll btT;
	vector<btT> bv;
	Bitree(int n) : bv(n + 3) {}
	btT sum(int i) {
		btT res=0; for(i++; i>0; i -= i & -i) res += bv[i]; return res;
	}
	btT sum(int a, int b) {return sum(b) - (a? sum(a-1): 0);}
	void add(int i, btT x){for(i++; i<(int)bv.size(); i += i & -i) bv[i] += x; }
	void updt(int i, btT x){ add(i, x - sum(i,i));} //replace, update
};


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

	int n; ll k;
	cin >>n >>k;
	vector<ll> a(n+1);
	rep(i, n){
		ll wa; cin >> wa;
		a[i+1] = a[i] + wa - k;
	}
	Bitree bta(n);
	map<ll, int> mp;
	for(auto z: a) mp[z]=0;
	int c=0; for(auto& z: mp) z.second=c++;
	//for(auto x :mp) printf("%lld:%d , ",x.first,x.second); puts("");
	ll ans =0;
	rep(i,n+1){
		ans += bta.sum(mp[a[i]]);
		bta.add(mp[a[i]], 1);
	}
	cout << ans << "\n";
	return 0;
}




Measured memory_bytes: 15872
#include <iostream>
#include <math.h>
using namespace std;
double X[11][11];
int main(void)
{
  int N,D;
  int i,j,k;
  cin >> N >> D;
  int cnt=0;
  for(i=0;i<N;i++){
    for(j=0;j<D;j++){
      cin >> X[i][j];
    }
  }
  for(i=0;i<N-1;i++){
    for(j=i+1;j<N;j++){
      int d1=0,d2;
  //    cout << i << "," << j<< endl;
      for(k=0;k<D;k++){
        d1+=(X[j][k]-X[i][k])*(X[j][k]-X[i][k]);
      }
      d2=sqrt(d1);
      d2=d2*d2;
    //  cout << "   "<< d1 << " " << d2 << endl;
      if(d1==d2) cnt++;
    }
  }
  cout << cnt << endl;

}

Measured memory_bytes: 256
#include<iostream>

int main()
{
	int debt = 100000, n;
	std::cin >> n;
	for (int i = 0; i < n; ++i)
	{
		debt *= 1.05;
		if (debt % 1000)
			debt = debt - debt % 1000 + 1000;
	}

	std::cout << debt << std::endl;

	return 0;
}


Measured memory_bytes: 3068
while True:
    e = int(input())
    if e == 0:
        break
    z, ans = 0, float('inf')
    while z ** 3 <= e:
        r = e - z ** 3
        y = int(r ** 0.5)
        x = r - y ** 2
        ans = min(ans, x + y + z)
        z += 1
    print(ans)


Measured memory_bytes: 5720
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#include <random>
#include <list>
using namespace std;
 
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<int, ll> i_ll;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };
 
#define rep(i, N) for (int i = 0; i < (int)(N); i++)
#define pb push_back
 
int INF = INT_MAX / 10;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	int N; cin >> N;
	vector<int> d(N);
	rep(u, N) cin >> d[u];
	int D = 0;
	rep(u, N) D = max(D, d[u]);
	if (D == 1) {
		cout << (N == 2 ? "Possible" : "Impossible") << endl;
		return 0;
	}
	vector<int> a(N);
	rep(u, N) a[d[u]]++;
	rep(i, D + 1) a[max(i, D - i)]--;
	int lb = (D + 1) / 2 + 1;
	rep(k, N) if ((k < lb && a[k] > 0) || a[k] < 0) {
		cout << "Impossible" << endl;
		return 0;
	}
	cout << "Possible" << endl;
}


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

using int64 = long long;

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

  vector<int> dp(n + 1, 1000000000);
  dp[0] = 0;
  for (int64 i = 0; i < n; ++i) {
    int k = dp[i] + 1;
    for (int64 a = 1; i + a <= n; a *= 6) {
      int64 b = i + a;
      if (dp[b] > k)
        dp[b] = k;
    }
    for (int64 a = 1; i + a <= n; a *= 9) {
      int64 b = i + a;
      if (dp[b] > k)
        dp[b] = k;
    }
  }
  cout << dp[n] << "\n";

  return 0;
}


Measured memory_bytes: 640
stk=[]
data=(input().split())
for i in data:
    if i =='+':
        a=stk.pop()
        b=stk.pop()
        stk.append(a+b)
    elif i =='-':
        b=stk.pop()
        a=stk.pop()
        stk.append(a-b)
    elif i =='*':
        a=stk.pop()
        b=stk.pop()
        stk.append(a*b)
    else:
        stk.append(int(i))
print(stk.pop())


Measured memory_bytes: 5596
#include <stdio.h>

const int N = 2e5 + 10;

char a[N], b[N];

int main() {
  int h, w, n, sr, sc;
  scanf("%d %d %d", &h, &w, &n);
  scanf("%d %d", &sr, &sc);
  sr--; sc--;
  scanf("%s", a);
  scanf("%s", b);
  int right = 0, left = 0, up = 0, down = 0;
  for (int i = 0; i < n; i++) {
    right += (a[i] == 'R');
    left += (a[i] == 'L');
    up += (a[i] == 'U');
    down += (a[i] == 'D');
  }
  for (int i = 0; i < n + n; i++) {
    if (i % 2 == 0) {
      if (a[i / 2] == 'R') {
        if (right - (w - 1 - sc) > left - sc) {
          sc++;
        }
        right--;
      }
      if (a[i / 2] == 'L') {
        if (left - sc > right - (w - 1 - sc)) {
          sc--;
        }
        left--;
      }
      if (a[i / 2] == 'U') {
        if (up - sr > down - (h - 1 - sr)) {
          sr--;
        }
        up--;
      }
      if (a[i / 2] == 'D') {
        if (down - (h - 1 - sr) > up - sr) {
          sr++;
        }
        down--;
      }
    } else {
      if (b[i / 2] == 'L') {
        if (right - (w - 1 - sc) > left - sc && (sr < 0 || sc - 1 < 0 || sr >= h || sc >= w) == false) {
          sc--;
        }
      }
      if (b[i / 2] == 'R') {
        if (left - sc > right - (w - 1 - sc) && (sr < 0 || sc + 1 < 0 || sr >= h || sc >= w) == false) {
          sc++;
        }
      }
      if (b[i / 2] == 'D') {
        if (up - sr > down - (h - 1 - sr) && (sr + 1 < 0 || sc < 0 || sr + 1 >= h || sc >= w) == false) {
          sr++;
        }
      }
      if (b[i / 2] == 'U') {
        if (down - (h - 1 - sr) > up - sr && (sr - 1 < 0 || sc < 0 || sr - 1 >= h || sc >= w) == false) {
          sr--;
        }
      }
    }
    if (sr < 0 || sc < 0 || sr >= h || sc >= w) {
      puts("NO");
      return 0;
    }
  }
  puts("YES");
  return 0;
} 

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int A = in(),B = in(),C = in();
    cout << (A <= C && C <= B ? "Yes" : "No") << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x,y,z) max((x),max((y),(z)))
#define tmin(x,y,z) min((x),min((y),(z)))
typedef long long ll; ll MM = 1000000000;ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y) {if (y == 0) return x;else return GCD(y, x % y);}
ll LCM(ll x, ll y) { return x / GCD(x, y) * y;}
//cout << fixed << setprecision(10);
ll fac(ll x){if(x==0) return 1;  return x*fac(x-1);}

int main(){
//中途半端に問題を解く難易度は1種のみである
//全完する難易度をbit全探索する
    ll d, g; cin>>d>>g;
    vector<ll> p(d), c(d);
    rep(i,d) cin>>p[i]>>c[i];
    ll ans=10000;
    for(ll bit=0;bit<(1<<d);bit++){
        ll sum=0, num=0;
        for(ll i=0;i<d;i++){
            if(bit&(1<<i)){
                sum+=p[i]*100*(i+1)+c[i];
                num+=p[i];
            }
        }
        if(sum<g){
            for(ll k=d-1;k>=0;k--){
                if(bit&(1<<k)) continue;
                for(ll j=1;j<=p[k];j++){
                    sum+=100*(k+1);
                    num++;
                    if(sum>=g) break;
                }
                break;
            }
        }
        if(sum>=g) ans=min(ans,num);
    }
    cout<<ans<<endl;
}

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

int main() {
	long long n, num[200000];
	long long temp, nmax = -1000000000, nmin;

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> num[i];
	}

	nmin = num[0];
	for (int i = 1; i < n; i++) {
		nmax = max(nmax, num[i] - nmin);
		nmin = min(nmin, num[i]);
	}

	cout << nmax << endl;

	return 0;
}

Measured memory_bytes: 2716
#include <bits/stdc++.h>
using namespace std;
#define fast                                                                   \
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define ll long long
#define f(i, n) for (int i = 0; i < n; i++)
#define F first
#define S second
#define pii pair<int,int>
#define sz size()
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front    
#define PB pop_back
#define pll pair<long long, long long>
#define vl vector<int>
#define mp make_pair
#define mod 1000000007
typedef unsigned long long ull;
const int N = 200005;
const int MOD = 998244353 ;



void solve(){
    int a, b;
    cin>>a>>b;
    if(a > b)swap(a,b);
    if(a == 1){
        if(b == 2)cout<<"3";
        else cout<<"2";
    }
    if(a == 2)cout<<"1";
}


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


Measured memory_bytes: 256
from collections import defaultdict
import heapq
N = int(input())
graph = defaultdict(list)
for i in range(N-1):
    a, b = map(int, input().split())
    graph[a] += [b]
    graph[b] += [a]
is_visited = [False for i in range(N+1)]
q = []
heapq.heappush(q, (0, 0, 1))
t2f = {}
while q:
    c, f, t = heapq.heappop(q)
    t2f[t] = f
    if t == N:
        break
    for nt in graph[t]:
        if is_visited[nt]:
            continue
        heapq.heappush(q, (c+1, t, nt))
        is_visited[nt] = True
is_visited = [False for i in range(N+1)]
is_visited[1] = True
is_visited[N] = True
for i in range((c-1)//2):
    t = t2f[t]
    is_visited[t] = True
q = []
heapq.heappush(q, (0, 1))
ans = 0
while q:
    c, t = heapq.heappop(q)
    ans += 1
    for nt in graph[t]:
        if is_visited[nt]:
            continue
        heapq.heappush(q, (c+1, nt))
        is_visited[nt] = True
if N // 2 < ans:
    print('Fennec')
else:
    print('Snuke')

Measured memory_bytes: 119364
import math  # noqa
import bisect  # noqa
import queue  # noqa


if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))

    cnt_neg = 0
    abs_min = 1000000005
    for a in A:
        abs_min = min(abs_min, abs(a))
        if a < 0:
            cnt_neg += 1

    ans = 0
    for a in A:
        ans += abs(a)

    if cnt_neg % 2 != 0:
        ans -= 2 * abs_min

    print(ans)


Measured memory_bytes: 65132
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000007
const int INF = 1LL<<30;

int main(){
    int n,k;
    cin>>n>>k;
    vector<ll> a(n);

    rep(i,n) cin>>a[i];
    vector<ll> s(n+1,0);
    rep(i,n) s[i+1]=s[i]+a[i];

    vector<ll> v;
    rep(l,n){
        for(int r=l;r<n;r++){
            v.push_back(s[r+1]-s[l]);
        }
    }

    int m=v.size();
    sort(all(v));
    //rep(i,m) cout<<v[i]<<" ";
    //cout<<endl;
    vector<int> ok(m,1);

    ll ans=0;
    for(int d=60;d>=0;d--){
        ll msk=1LL<<d;
        int cnt=0;
        rep(i,m){
            if((v[i] & msk) && ok[i]) cnt++;
        }
        //cout<<d<<" "<<cnt<<endl;
        if(k<=cnt){
            ans+=msk;
            rep(i,m){
                if(!(v[i] & msk) && ok[i]) ok[i]=0;
            }
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 9296
#import re
N, Q = map(int, input().split())
S = input()
#iter = re.finditer("AC", S)
#indices_C = [m.start(0)+1 for m in iter]
#total = len(indices_C)
#
#dec_l_list = []
#dec_l = 0
#dec_r_list = []
#dec_r = total
#for i in range(N):
#    if i in indices_C:
#        dec_l += 1
#        dec_r -= 1
#    dec_l_list.append(dec_l)
#    dec_r_list.append(dec_r)

flag = False
dec_l_list = []
total = 0
for i in range(N):
    if flag and S[i] == "C":
        total += 1
    dec_l_list.append(total)
    flag = True if S[i] == "A" else False
dec_r_list = [total - x for x in dec_l_list]

for i in range(Q):
    l, r = map(int, input().split())
    print(total - dec_l_list[l-1] - dec_r_list[r-1])

Measured memory_bytes: 10100
#include <iostream>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int N, H;
  cin >> N;
  int M = 0;
  int ret = 0;
  for (int i=0; i<N; i++) {
    cin >> H;
    if (M <= H) {
      ret++;
      M = H;
    }
  }
  cout << ret << endl;
}

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

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    ll n;
    cin>>n;
    ll s;
    set<ll> ar;
    for(auto i=0;i<n;++i)
    {
        cin>>s;
        ar.insert(s);
    }
    if(ar.size()==n)
    {
        cout<<"YES\n";
    }
    else
    {
        cout<<"NO\n";
    }
    return 0;
}

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

using namespace std;


int main() {
	char a, b, c, d;
	cin >> a >> b >> c >> d;
	string ans = "No";
	if (a == b) {
		if (c == d && c != a) {
			ans = "Yes";
		}
	}
	if (a == c) {
		if (b == d && b != a) {
			ans = "Yes";
		}
	}
	if (a == d) {
		if (b == c && a != b) {
			ans = "Yes";
		}
	}
	cout << ans;
}

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

#define rep(i,a,b) for(long long int i=a; i<b; i++ )
#define REP(i,n) rep(i,0,n)
typedef pair<int,int> P;

vector<int> bfs(vector< vector<int> > adj_list, int start){
  int N = adj_list.size(); // Number of Vertex
  queue<int> que;
  vector<int> dist(N, -1); // distance
  
  // init
  dist[start] = 0;
  que.push( start );
  
  // main loop
  while( !que.empty() ){
    int v = que.front(); que.pop();
    
    REP(i, adj_list[v].size()){
      int nv = adj_list[v][i];
      if(dist[nv] != -1) continue;
      
      dist[nv] = dist[v] + 1;
      que.push(nv);
    }
  }
  
  return dist;
}

int main()
{
  int N, X, Y; cin >> N >> X >> Y;
  vector< vector<int> > adj_list(N);
  REP(i,N-1){
    adj_list[i].push_back(i+1);
    adj_list[i+1].push_back(i);
  }
  adj_list[X-1].push_back(Y-1);
  adj_list[Y-1].push_back(X-1);

  vector< vector<int> > dist_matrix(N);
  REP(start, N){
    dist_matrix[start] = bfs(adj_list, start);
  }

  vector<int> counts(N);
  REP(i, N){
    rep(j,i+1,N){
      counts.at( dist_matrix[i][j] ) += 1;
    }
  }
  
  rep(i,1,N){
    cout << counts[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 16128
#include<bits/stdc++.h>
using namespace std; 
#define ll long long int
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define INF LLONG_MAX
#define PI acos(-1)
const ll MOD = 1e9 + 7;
#define fir first
#define sec second
#define all(x) x.begin(),x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(c,a,b) for(ll c=a;c<b;c++)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define min_heap priority_queue<pll,vector<pll>,greater<pll> >
ll dx4[]={-1,1,0,0};
ll dy4[]={0,0,-1,1};
ll dx8[]={-1,-1,-1,0,1,1,1,0};
ll dy8[]={-1,0,1,1,1,0,-1,-1};
bool isvalid(ll x,ll y,ll n,ll m)
{
	return (x>=0 and y>=0 and x<n and y<m);
}
ll isprime[1000];
vector<ll> prime;
void sievetoprime(ll n)
{
	mem(isprime,true);
	for(ll p=2;p*p<=n;p++)
	{
		if(isprime[p]==true)
		{
			for(ll i=p*p;i<=n;i+=p)
				isprime[i]=false;
		}
	}
}
ll lcm(ll a,ll b)
{
	return (a/__gcd(a,b))*b;
}
void solve()
{
	ll n,W;
	cin>>n>>W;
	ll dp[n+1][W+1];
	ll w[n],v[n];
	for(ll i=0;i<n;i++)
	{
		cin>>w[i]>>v[i];
	}
	for(ll i=0;i<=n;i++)
	{
		for(ll wt=0;wt<=W;wt++)
		{
			if(i==0 or wt==0)
				dp[i][wt]=0;
			else if(w[i-1]<=wt)
			{
				dp[i][wt]=max(v[i-1]+dp[i-1][wt-w[i-1]],dp[i-1][wt]);
			}
			else
				dp[i][wt]=dp[i-1][wt];
		}
	}
	cout<<dp[n][W];
}
int main()
{
	IOS
	ll t;
	t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
}

Measured memory_bytes: 79232
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;
typedef long long ll;
using namespace std;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  ll a,b;
  cin >> a >> b;
  cout << (a * b) / gcd(a,b) << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    #define REP(i,n) for(long long i=0;i<(long long)n;i++)
    //#define _GLIBCXX_DEBUG
    using namespace std;
    using ll = long long;
    using Pi = pair<int,int>;
    using Pl = pair<ll,ll>;
    using Vl = vector<ll>;
    using vi = vector<int>;
    using Graph = vector<vi>;
    
    int main(){
        cin.tie(0);
        ios::sync_with_stdio(false);
        //std::cout << std::fixed << std::setprecision(15); //"for float-base problem"
        int N,A,B;
      cin>>N;
      if(N==1){
        cout << "Hello World" << endl;
        return 0;
        }else{
        cin >> A >> B;
        cout << A+B<< endl;
      }
      return 0;}

Measured memory_bytes: 256
using System;

public class Program
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        for (int i = 1; i <= n; i++)
        {
            Console.WriteLine("Case {0}:", i);
            int m = int.Parse(Console.ReadLine());
            for (int j = 0; j < 10; j++)
            {
                m = int.Parse((string.Format("{0:00000000}", m*m)).Substring(2, 4));
                Console.WriteLine(m);
            }
        }
    }
}

Measured memory_bytes: 9116
#include <algorithm>
#include <bitset>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/

int main() {
  // freopen("input.txt", "r", stdin);

  int n; cin >> n;
  int one, two, three;
  one = two = three = 0;
  REP(i, n) {
    int a; cin >> a;
    if (a == 1) ++one;
    else if (a == 2) ++two;
    else ++three;
  }
  // dp[i][j][k] = 1貫の寿司を置いている皿が i 枚
  //               2                         j
  //               3                         k   あるときの操作回数の期待値
  // dp[i][j][k] = 1 + (i / n) * dp[i - 1][j][k]
  //                 + (j / n) * dp[i + 1][j - 1][k]
  //                 + (k / n) * dp[i][j + 1][k - 1]
  //                 + (1 - (i + j + k) / n ) * dp[i][j][k]
  //             = (n + i * dp[i - 1][j][k] + j * dp[i + 1][j - 1][k] k * dp[i][j + 1][k - 1]) / (i + j + k)
  vector<vector<vector<double>>> dp(302, vector<vector<double>>(302, vector<double>(301, 0)));
  // 皿は n 枚しかない
  // i + 1 や j + 1 が登場するので i -> j -> k の順で計算する
  for (int k = 0; k <= n; ++k) for (int j = 0; k + j <= n; ++j) for (int i = 0; k + j + i <= n; ++i) {
    if (i == 0 && j == 0 && k == 0) continue;
    dp[i][j][k] = n;
    if (i - 1 >= 0) dp[i][j][k] += i * dp[i - 1][j][k];
    if (j - 1 >= 0) dp[i][j][k] += j * dp[i + 1][j - 1][k];
    if (k - 1 >= 0) dp[i][j][k] += k * dp[i][j + 1][k - 1];
    dp[i][j][k] /= i + j + k;
  }
  printf("%.10f\n", dp[one][two][three]);
  return 0;
}


Measured memory_bytes: 220416
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
/*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
ll modpow(ll a,ll n, ll mod){ll res = 1;while(n>0){if (n%2==1){res = res * a % mod;}a = a * a % mod;n/=2;}return res;}
int main() {
    int n;
    cin >> n;
    vector<string>s(n);
    for(int i=0;i<n;i++){
        cin >> s.at(i);
    }
    sort(s.begin(),s.end());
    ll ans =1;
    for(int i=1;i<n;i++){
        if(s.at(i-1)!=s.at(i))ans++;
    }
    cout << ans << endl;
}
    



Measured memory_bytes: 9596
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_multiset tree<long long , null_type,less_equal<long long >, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_set tree<long long , null_type,less<long long >, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
#define ll long long
#define f(i,a,b) for(ll i=a;i<=b;++i)
#define mod 1000000007
const double pi =3.14159265358979323846;
bool isprime(ll n)
{
    if(n<2) return false;
    for(ll i=2;i*i<=n;++i)
    {
        if(n%i==0) return false;
    }
    return true;
}
int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll n; cin>>n;
    ll arr[n]; for(auto &x:arr) cin>>x;
    ll sum=accumulate(arr,arr+n,0LL);
    ll m; cin>>m;
    while(m--)
    {
        ll p,x; cin>>p>>x;
        p--;
        ll ans=sum-arr[p]+x;
        cout<<ans<<"\n";
    }
    return 0;
}
/**
pair<ll,ll>fib(ll n)
{
    if(n==0) return {0,1};
    pair<ll , ll >p=fib(n/2);
    ll c=p.first*(2*p.second - p.first) ;
    ll d=p.second*p.second + p.first*p.first;
    if(n&1) return {d,c+d};
    else return {c,d};
}
**/
/**
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout);
**/
/**check for perfect square.
ll is_perfect_square(ll n)
{
    ll tp=floor(sqrt(n));
    if(n==(tp*tp)) return tp;
    else return -1;
}
**/
/**
ll biexp(ll a,ll n)
{
    if(n==0) return 1;
    ll res=1;
    while(n>0)
    {
        if(n%2!=0) res*=a;
        a=a*a;
        n=n/2;
    }
    return res;
}
**/
/** sieve implementation**/
/**
    ll N=1299827; // first 100008 primes;
    vector<ll>lp(N+1,0);
    vector<ll>pr;
    for(ll i=2;i<=N;++i)
    {
        if(lp[i]==0)
        {
            lp[i]=i;
            pr.push_back(i);
        }
        for(ll j=0;j<pr.size() and i*pr[j]<=N ;++j)
        {
            lp[i*pr[j]]=pr[j];
        }
    }
**/
/**
bool isprime(ll n)
{
    if(n<2) return false;
    for(ll i=2;i*i<=n;++i)
    {
        if(n%i==0) return false;
    }
    return true;
}
**/
/**factors in sqrt(n);
    ll N=100000;
    vector<vector<ll> >factors(N+1);
    for(ll j=1;j<=N;++j)
    {
        for(ll x=1;x*x<=j;++x)
         {
            if(j%x==0)
            {
                factors[j].push_back(x);
                if(j/x != x) factors[j].push_back(j/x);
            }
         }
    }
**/
/**
vector<pair<ll,ll> >prime_factors(ll n)
{
    vector<pair<ll,ll> >res; ll ct=0;
    if(!(n&1))
    {
        while(!(n&1))
        {
            ct++; n/=2;
        }
        res.push_back({2,ct});
    }
    ct=0;
    for(ll i=3;i*i<=n;i+=2)
    {
        while(n%i==0)
        {
            ct++; n/=i;
        }
        if(ct>0) res.push_back({i,ct});
        ct=0;
    }
    if(n!=1) res.push_back({n,1});
    return res;
}
**/
/** calculating n_C_r();
ll ncr(ll n, ll k) {
    ll res = 1;
    for (ll i = 1; i <= k; ++i)
        res = (res*(n-k+i))/i;

    return res;
}
**/


Measured memory_bytes: 256
function main(input) {
  input = input.trim().split("\n");
  const [s, t] = input;
  let result;
  for(let i = 0; i <= s.length - t.length; i++) {
    let isPossible = true;
    for(let j = 0; j < t.length; j++) {
      const sChar = s[i + j];
      const tChar = t[j];
      if (sChar !== "?" && sChar !== tChar) {
        isPossible = false;
        break;
      }
    }
    if(isPossible) {
      const str = s.substr(0, i) + t + s.substr(t.length + i);
      const replacedStr = str.replace(/\?/g, "a");
      if (!result || replacedStr < result) {
        result = replacedStr;
      }
    }
  }
  result = result || "UNRESTORABLE";
  console.log(result);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

const ll MOD = 998244353;

ll modpow(ll x, ll n){
    ll res = 1;
    ll mul = x;
    while(n){
        if(n % 2) res = res * mul % MOD;
        mul = mul * mul % MOD;
        n /= 2;
    }
    return res;
}

struct Combination
{
    int maxn;
    vector<ll> fmemo;
    vector<ll> imemo;
    vector<ll> ifmemo;
    
    Combination(int maxn) : maxn(maxn){
        fmemo.resize(maxn + 1);
        imemo.resize(maxn + 1);
        ifmemo.resize(maxn + 1);
        for(ll i = 1; i <= maxn; i++){
            imemo[i] = modpow(i, MOD - 2);
        }
    }

    ll fact(ll n){
        if(n == 0) return 1;
        if(fmemo[n]) return fmemo[n];
        return fmemo[n] = n * fact(n - 1) % MOD;
    }

    ll ifact(ll n){
        if(n == 0) return 1;
        if(ifmemo[n]) return ifmemo[n];
        return ifmemo[n] = imemo[n] * ifact(n - 1) % MOD;
    }

    ll com(ll n, ll k){
        if(k > n) return 0;
        if(k == n || k == 0) return 1;
        return (fact(n) * ifact(k) % MOD) * ifact(n - k) % MOD;
    }
};

int main()
{
    ll n, m, k;
    cin >> n >> m >> k;
    Combination com(200005);
    ll p[200005];
    p[0] = 1;
    for(int i = 1; i <= n; i++) p[i] = p[i - 1] * (m - 1) % MOD;
    ll ans = 0;
    for(int i = 0; i <= k; i++){
        ans = (ans + com.com(n - 1, i) * m % MOD * p[n - i - 1]) % MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 15436
#include <stdio.h>
#include <stdlib.h>
#define NUM 100000

typedef struct kk{
    struct kk *child;
    struct kk *sibling;
    struct kk *parent;
    int node;
} P;

P x[NUM];

int depth(P );

int main()
{
    int n,id,k,depth1,parent = 0;
    int i,j;
    int node1,node2;
    
    struct kk *N,*L = NULL;
    
    scanf("%d",&n);
    
    for(i = 0;i < n;i++){
        scanf("%d",&id);
        x[id].node = id;
        
        scanf("%d",&k);
        if(k == 0) continue;
        for(j = 0;j < k;j++){
            if(j == 0){
                scanf("%d",&node1);
                x[node1].node = node1;
                x[id].child = &x[node1];
                x[node1].parent = &x[id];
                L = x[id].child;
            }
            else{
                scanf("%d",&node2);
                x[node2].node = node2;
                L->sibling = &x[node2];
                L->sibling->parent = &x[id];
                L = L->sibling;
            }
        }
    }
    
    for(i = 0;i < n;i++){
        printf("node %d: ",i);
        if(x[i].parent == NULL){
            parent = -1;
            printf("parent = %d, ",parent);
        }
        else printf("parent = %d, ",x[i].parent->node);
        
        depth1 = depth(x[i]);
        printf("depth = %d, ",depth1);
        
        if(x[i].parent == NULL) printf("root, ");
        else if(x[i].child != NULL) printf("internal node, ");
        else printf("leaf, ");
        
        if(x[i].child == NULL) printf("[]\n");
        else{
            printf("[%d",x[i].child->node);
            N = x[i].child->sibling;
            while(N != NULL){
                printf(", %d",N->node);
                N = N->sibling;
            }
            printf("]\n");
        }
    }
    
    return 0;
}

int depth(P a)
{
    int i = 0;
    struct kk *M;
    M = a.parent;
    
    while(M != NULL){
        i++;
        M = M->parent;
    }
    
    return i;
}



Measured memory_bytes: 4868