akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

int main() {
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  vector<int> xa(n);
  rep(i, n) cin >> xa[i];
  vector<int> ya(m);
  rep(i, m) cin >> ya[i];
  sort(xa.begin(), xa.end());
  sort(ya.begin(), ya.end());

  int maxx = xa[n-1];
  int miny = ya[0];

  int i = -101;
  while(true) {
    if(x<i && i<=y) {
      if(maxx < i && i <= miny) {
        cout << "No War" << endl;
        return 0;
      }
    }
    i++;
    if(i == 101) {
      cout << "War" << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 256
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    ct=0
    for i in str(n):
        ct+=int(i)
    if n%ct==0:
        print('Yes')
    else:
        print('No')
if __name__ == '__main__':
    do()

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<pair<int,int>, null_type,less<pair<int, int> >, rb_tree_tag,tree_order_statistics_node_update>

#define NEWLINE         cerr << "\n";
#define HOISE           cerr << "hoise " << __LINE__ << "\n"
#define PAUSE           system("pause")
#define DEBUG(x)        cerr << #x << " = " << x << "\n"
#define READ            freopen("D:\\moidda CPP\\alu.txt", "r", stdin)
#define WRITE           freopen("D:\\moidda CPP\\vorta.txt", "w", stdout)
#define FASTIO          ios_base::sync_with_stdio(false);cin.tie(NULL)
#define MASK(x)         for(int i = 0; i < 8; i++){ if(x&(1<<i)){ cout << i << " "; } } cout << endl;

#define INF             1e9
#define INFL            8e18
#define XX              first
#define YY              second
#define PB              push_back
#define MP              make_pair

typedef long long ll;
typedef pair<int, int > pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pff;

const int MAX = 1e5 + 5;
const int MAXLOG = log2(MAX) + 2;
const int MAXN = 1e6 + 2;
const int MOD = 998244353 ;
const double PY = acos(-1.0);
const double EPS = 1E-9;

int32_t main()
{
#ifndef ONLINE_JUDGE
//    READ;
//    WRITE;
#endif // ONLINE_JUDGE

    FASTIO;

    int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

    int k;
    cin >> k;
    cout << a[k-1];

    return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
#pragma GCC optimize("Ofast")

// Begin {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}

constexpr int INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;

constexpr size_t    operator""_sz(unsigned long long value) { return value; };
constexpr intmax_t  operator""_im(unsigned long long value) { return value; };
constexpr uintmax_t operator""_um(unsigned long long value) { return value; };
// }}} End

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

    size_t N; cin >> N;

    for (size_t i = 0; i <= 25; ++i) {
        for (size_t j = 0; j <= 15; ++j) {
            if (4 * i + 7 * j == N) {
                return cout << "Yes" << "\n", 0;
            }
        }
    }

    cout << "No" << "\n";

    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main() {
  string MOMI="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
  int N;
  cin>>N;
  string S;
  cin>>S;
  
  for(int i=0;i<S.size();i++) {
    for(int j=0;j<27;j++) {
      if(S.at(i)==MOMI.at(j)) {
        S.at(i)=MOMI.at(j+N);
          break;
      }
    }
  }
  cout<<S<<endl;
  return 0;
}


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

int main() {
  int X,ans=1,x=1800;
  cin >> X;
  
  while(x>X){
    x = x-200;
    ans++;
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

template <typename T, typename U> T pow_fast(T x, U n) {
    T ret = (T)1;
    while(n) {
        if(n & (U)1) ret *= x;
        x *= x;
        n >>= 1;
    }
    return ret;
}

template <typename ModType, ModType MOD> struct ModInt {
    ModType val;
    ModInt() : val(0) {}
    ModInt(ModType x) : val(x % MOD) {
        if(val < 0) val += MOD;
    };
    operator ModType() const { return val; }
    ModInt &operator+=(const ModInt &m) {
        val += m.val;
        if(val >= MOD) val -= MOD;
        return *this;
    }
    ModInt &operator-=(const ModInt &m) {
        val -= m.val;
        if(val < 0) val += MOD;
        return *this;
    }
    ModInt &operator*=(const ModInt &m) {
        (val *= m.val) %= MOD;
        return *this;
    }
    ModInt &operator/=(const ModInt &m) {
        *this *= m.inverse();
        return *this;
    }
    ModInt operator+(const ModInt &m) const { return ModInt(*this) += m; }
    ModInt operator-(const ModInt &m) const { return ModInt(*this) -= m; }
    ModInt operator*(const ModInt &m) const { return ModInt(*this) *= m; }
    ModInt operator/(const ModInt &m) const { return ModInt(*this) /= m; }
    ModInt inverse() const { return pow_fast(*this, MOD - 2); }
    ModInt pow(ModType n) const {return pow_fast(*this, n); }

    friend std::ostream &operator<<(std::ostream &os, const ModInt &rhs) {
        os << rhs.val;
        return os;
    }
    friend std::istream &operator>>(std::istream &is, ModInt &rhs) {
        ModType value;
        is >> value;
        rhs = ModInt(value);
        return is;
    }
};
template <class mint> struct Comb {
    vector<mint> fact;
    vector<mint> ifact;
    const int N;
    Comb(int n) : N(n + 1), fact(n + 1), ifact(n + 1) { makeFact(); }
    void makeFact() {
        fact[0] = ifact[0] = 1LL;
        for(int i = 1; i < N; i++) {
            fact[i] = fact[i - 1] * (mint)i;
            ifact[i] = fact[i].inverse();
        }
    }
    mint operator()(int n, int r) {
        if(n < 0 || r < 0 || r > n) return 0;
        if(r > n / 2) r = n - r;
        return fact[n] * ifact[n - r] * ifact[r];
    }
};

using mint = ModInt<ll, 998244353>;

int main(){
    Comb<mint> comb(1e6);
    int n, m, k;
    cin >> n >> m >> k;
    mint ans = 0;
    REP(i, n-k, n+1) {
        ans += mint(m)*mint(m-1).pow(i-1) * comb(n-1, i-1);
        // cout << mint(m)*mint(m-1).pow(i-1) << " " << comb(n-1, i-1) << '\n';
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 18656
#include<bits/stdc++.h>
using namespace std;
int n, m, a, b;
char o[1005][1005];

int main()
{
	scanf("%d%d%d%d",&n,&m,&a,&b);
	for(int i=1;i<=n;i++) {
		for(int j=1;j<=m;j++) {
			o[i][j] = '.';
		}
	}
	if(n%2 == 1) {
		for(int i=1;i+1<=m;i+=2) {
			if(!a) break;
			a--;
			o[1][i] = '<';
			o[1][i+1] = '>';
		}
	}
	if(m%2 == 1) {
		for(int i=1;i+1<=n;i+=2) {
			if(!b) break;
			b--;
			o[i][m] = '^';
			o[i+1][m] = 'v';
		}
	}
	for(int i=1+n%2;i+1<=n;i+=2) {
		for(int j=1;j+1<=m/2*2;) {
			if(b >= 2) {
				o[i][j] = '^';
				o[i+1][j] = 'v';
				o[i][j+1] = '^';
				o[i+1][j+1] = 'v';
				b -= 2; j += 2;
			}
			else if(a >= 2) {
				o[i][j] = '<';
				o[i][j+1] = '>';
				o[i+1][j] = '<';
				o[i+1][j+1] = '>';
				a -= 2; j += 2;
			}
			else if(b) {
				o[i][j] = '^';
				o[i+1][j] = 'v';
				b--; j++;
			}
			else if(a) {
				o[i][j] = '<';
				o[i][j+1] = '>';
				a--; j += 2;
			}
			else j += 2;
		}
	}
	if(a && o[n][m] == '.' && o[n][m-1] == '.') {
		a--;
		o[n][m-1] = '<';
		o[n][m] = '>';
	}
	if(a || b) puts("NO");
	else {
		puts("YES");
		for(int i=1;i<=n;i++) printf("%s\n",o[i]+1);
	}
}


Measured memory_bytes: 2176
#include<stdio.h>

int main(){
	int harga, modulo, hasil;
	scanf("%d", &harga);
	modulo = harga % 1000;
	hasil = 1000 - modulo;
	if(hasil == 1000){
		hasil = 0;
	}
	printf("%d\n", hasil);
	return 0;
}

Measured memory_bytes: 1736
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
#include <deque>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
    return (ull)rng() % B;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int a,b,c,k; cin >> a >> b >> c >> k;
    int cnt=0;
    while(a>=b){
        b*=2;
        cnt++;
    }
    while(b>=c){
        c*=2;
        cnt++;
    }
    if(cnt<=k){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
}


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

int b[100], x1[100][100], Y1[100][100], x2[100][100], y2[100][100];
string link[100][100];
map<string, int>mp;
int main() {
	int n;
	while (scanf("%d", &n), n) {
		mp.clear();
		int w, h; scanf("%d%d", &w, &h);
		vector<string>v;
		rep(i, n) {
			string s; cin >> s >> b[i]; mp[s] = i;
			if (i == 0)v.push_back(s);
			rep(j, b[i])cin >> x1[i][j] >> Y1[i][j] >> x2[i][j] >> y2[i][j] >> link[i][j];
		}
		int pos = 0;
		int m; scanf("%d", &m);
		rep(i, m) {
			string s; cin >> s;
			if (s == "click") {
				int x, y; cin >> x >> y;
				int a = mp[v[pos]];
				rep(i, b[a]) {
					if (x1[a][i] <= x&&x <= x2[a][i] && Y1[a][i] <= y&&y <= y2[a][i]) {
						v.erase(v.begin() + pos + 1, v.end());
						v.push_back(link[a][i]); pos = v.size() - 1; break;
					}
				}
			}
			if (s == "back") {
				if (pos)pos--;
			}
			if (s == "forward") {
				if (pos < v.size() - 1)pos++;
			}
			if (s == "show")cout << v[pos] << endl;
		}
	}
}

Measured memory_bytes: 3360
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int main(){
    int n,q,ans; ans=0;
    cin >> n;
    int s[n];
    for(int i=0;i<n;i++){
        cin >> s[i];
    }
    cin >> q;
    int t[q];
    for(int i=0;i<q;i++){
        cin >> t[i];
    }
    for(int i=0;i<q;i++){
        int left=0;
        int right =n;
        int mid;
        while(left<right){
            mid = (left+right)/2;
            if(s[mid]==t[i]) {
                ans++;
                goto l;
            }
            else if(t[i]<s[mid]) right = mid;
            else if(s[mid]<t[i]) left = mid+1;
        }
    l:;
    }
    cout << ans << endl;
}



Measured memory_bytes: 3680
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
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; }
using ll = long long;
using vi = vector<int>; using vvi = vector<vi>;
const ll MOD = 1e9+7; int INF=INT_MAX; ll LLINF = 1LL << 60;
const vi d8x = {1, 0, -1, 0, 1, -1, -1, 1}; vi d8y = {0, 1, 0, -1, 1, 1, -1, -1};
const vi d4x = {1, 0, -1, 0}; vi d4y = {0, 1, 0, -1};
//---------------------------------------

int main(){
    ll a,b,c,d; cin>>a>>b>>c>>d;
    ll upper = b - b/c - b/d + b /(c/__gcd(c,d)*d);
    ll lower = (a-1) - (a-1)/c - (a-1)/d + (a-1) /(c/ __gcd(c,d)*d);
    cout<<upper-lower<<endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        String s = in.next();

        int count = 0;
        for(int i = 0; i < s.length(); i++){
            count = (count + Integer.parseInt("" + s.charAt(i))) % 9;
        }
        if(count == 0)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}


Measured memory_bytes: 51708
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int N, x, a[110], s=0;
	cin >> N >> x;
	for (int i = 0; i < N; i++) cin >> a[i];
	sort(a, a + N);
	for (int i = 0; i < N; i++) {
		s += a[i];
		if (x < s) {
			cout << i << endl;
			break;
		}
	}
	if (s == x)cout << N << endl;
	if (s < x) cout << N - 1 << endl;
	return 0;
}

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

void bfs(int s, vector<int> *to, vector<int>& d){
    queue<int> q;
    q.push(s);
    while(!q.empty()){
        int i = q.front();
        q.pop();
        for(auto e: to[i]){
            if(d[e] != 1e9) continue;
            d[e] = d[i] + 1;
            q.push(e);
        }
    }
}

int main()
{
    int n,u,v;
    cin >> n >> u >> v;
    u--;
    v--;
    vector<int> to[n] = {};
    for(int i=0; i<n-1; i++){
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    
    vector<int> du(n, 1e9);
    du[u] = 0;
    vector<int> dv(n, 1e9);
    dv[v] = 0;
    bfs(u, to, du);
    bfs(v, to, dv);

    int ans = 0;
    for(int i=0; i<n;i++){
        if(dv[i] == 1e9 || du[i] == 1e9) continue;
        if(dv[i] <= du[i] ) continue;
        ans = max(ans, dv[i] -1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6656
#include <bits/stdc++.h>
#include <sys/types.h>
#include <unistd.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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 pid_t pid = getpid();
// Problem Specific Parameter:

int main(void){
	int n;
	cin >> n;
	vector<int> b(n);
	rep(i, n) cin >> b[i];

	vector<int> ans;
	rep(loop, n){
		bool ok = false;
		const int m = b.size();
		rrep(i, m){
			if(b[i] == i + 1){
				ok = true;
				ans.push_back(i + 1);
				b.erase(begin(b) + i, begin(b) + i + 1);
				break;
			}
		}

		if(ok == false){
			puts("-1");
			return 0;
		}
	}

	reverse(begin(ans), end(ans));
	rep(i, n) cout << ans[i] << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <float.h>
#include <queue>
#include <cstdio>
#include <iomanip>

using namespace std;
typedef long long ll;
#define loop(i, N) for(int i=0; i<N; ++i)

int n;
string s;
int a[110];
int cnt = 1;


int main(void) {
	cin >> n >> s;
	for (int i = 1; i < n; i++)
	{
		if (s[i] != s[i - 1]) ++cnt;
	}


	cout << cnt << endl;
	
	
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(void){
  unsigned long long n,m=0,mx=0;
  vector<unsigned long long> h;
  cin>>n;
  h.resize(n);
  cin>>h[0];
  for(unsigned long long i=1;i<n;i++){
    cin>>h[i];
    if(h[i-1]>=h[i]){
      m++;
    }
    else{
      if(m>mx)mx=m;
      m=0;
    }
  }
  if(m>mx)mx=m;
  cout<<mx<<endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
const ll INF = 1e10;

int main() {
    ll h,w; cin >> h >> w;
    ll ans;
    if (h%3 == 0 | w%3 == 0)  ans = 0;
    else ans = min(h,w);

    ll h2 = h/2;
    for (ll i = 1; i < w ; i ++ ) {
        vector<ll> S = {h2 * i, (h - h2) * i, h * (w - i)};
        sort(S.begin(),S.end());
        ans = min(ans, S[2] - S[0]);
    }

    ll w2 = w/2;
    for (ll i = 1; i < h ; i ++) {
        vector<ll> S = {w2 * i, (w - w2) * i, w * (h - i)};
        sort(S.begin(),S.end());
        ans = min(ans,S[2] - S[0]);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <map>
#include <bitset>

const int MOD = 998244353;
using Mask = __int128;

std::map<Mask, int> map[100 + 1];

int rec(Mask mask, int n)
{
    if (n == 0)
        return 1;

    if (map[n].find(mask) != map[n].end())
        return map[n][mask];

    int ret = (1 + (mask & 1)) * 1LL * rec(mask >> 1, n - 1) % MOD;
    for (int a = 1; a <= n; ++ a) {
        for (int k = 2; k <= n / a; ++ k) {
            Mask w = 0;
            for (int i = 0; i < a; ++ i)
                if (mask >> i & 1)
                    w |= (Mask)1 << i;
            for (int i = 1; i < k; ++ i)
                w &= mask >> i * a;
            ret += rec(w, a) * 1LL * rec(mask >> k * a, n - k * a) % MOD;
            if (ret >= MOD) ret -= MOD;
        }
    }
    return map[n][mask] = ret;
}

int main()
{
    char s[100 + 1];
    scanf("%s", s);
    int n = strlen(s);
    Mask mask = 0;
    for (int i = 0; i < n; ++ i)
        if (s[i] == '1')
            mask |= (Mask)1 << i;
    printf("%d\n", rec(mask, n));
}


Measured memory_bytes: 4608
n,k=map(int,input().split())
d=[];a=[];s=[0]*n
for i in range(k):
    d.append(int(input()))
    a.append(list(map(int,input().split())))
for i in range(k):
    for z in a:
        for x in z:
            s[x-1]+=1
print(s.count(0))

Measured memory_bytes: 9200
#include <stdio.h>
int main(void){
  int i,j,N,A[100],v,k;
  
  scanf("%d",&N);
  for(i = 0; i < N; i++){
    scanf("%d",&A[i]);
  }
  
  for(i=1;i < N;i++){
    
    for(k=0;k < N;k++){
      printf("%d",A[k]);
       if(k != N-1) printf(" ");
    }
    printf("\n");
    
    v=A[i];
    j=i-1;
    while(j>=0 && A[j]>v){
      A[j+1]=A[j];
      j--;
    }
    A[j+1]=v;
  }
  
  for(k=0;k < N;k++){
      printf("%d",A[k]);
       if(k != N-1) printf(" ");
    }
    printf("\n");

  return 0;
}
      



Measured memory_bytes: 2120
from collections import Counter

def main(H, W, M, obj_h, obj_w, obj):
    c_h = Counter(obj_h)
    c_w = Counter(obj_w)
    max_h = max(c_h.values())
    max_w = max(c_w.values())
    lst_h = [kv[0] for kv in c_h.items() if kv[1] == max_h]
    lst_w = [kv[0] for kv in c_w.items() if kv[1] == max_w]
    for h in lst_h:
        for w in lst_w:
            if (h, w) not in obj:
                print(max_h + max_w)
                exit()
    else:
        print(max_h + max_w - 1)



if __name__ == '__main__':
    H, W, M = list(map(int, input().split()))
    obj = set()
    obj_h = []
    obj_w = []
    for _ in range(M):
        i = list(map(int, input().split()))
        obj.add(tuple(i))
        obj_h.append(i[0])
        obj_w.append(i[1])
    main(H, W, M, obj_h, obj_w, obj)

Measured memory_bytes: 255792
#include <iostream>
#include <cstring>
#include <map>
#include <cmath>
#include <algorithm>
using namespace std;
void abc17d()
{
  int64_t N, M;
  cin >> N >> M;

  int64_t f[N];
  for (int64_t i = 0; i < N; i++)
    cin >> f[i];

  int64_t dp[N];
  memset(dp, 0, N);

  map<int64_t, int64_t> check;
  int64_t start = -1;
  int64_t end = 0;
  int64_t sum = 1;
  int64_t mod = 1000000007;
  while (end < N)
  {
    if (check.count(f[end]) == 0)
    {
      dp[end] = sum;
      sum = (dp[end] + sum) % mod;
    }
    else
    {
      if (start >= check[f[end]])
      {
        dp[end] = sum;
        sum = (dp[end] + sum) % mod;
      }
      else
      {
        while (start != check[f[end]])
        {
          if (start == -1ll)
            sum = (sum - 1 + mod) % mod;
          else
          {
            sum = (sum - dp[start] + mod) % mod;
          }
          start++;
        }
        dp[end] = sum;
        sum = (dp[end] + sum) % mod;
      }
    }
    check[f[end]] = end;
    end++;
  }
  cout << dp[N - 1] % mod << endl;
}
int64_t max(int64_t a, int64_t b)
{
  if (a < b)
    return b;
  else
    return a;
}
void abc48c()
{
  int64_t N, x;
  cin >> N >> x;
  int64_t a[N];
  int64_t sum = 0;
  cin >> a[0];
  if (a[0] > x)
  {
    sum += a[0] - x;
    a[0] = x;
  }
  for (int i = 1; i < N; i++)
  {
    cin >> a[i];
    if (a[i] + a[i - 1] <= x)
      continue;
    sum += a[i] + a[i - 1] - x;
    a[i] = x - a[i - 1];
  }
  cout << sum;
}

int main(void)
{
  abc48c();
  //abc17d();
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <numeric>
#include <iomanip>
#include <math.h>
#include <stdio.h>

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

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; }
template<class T> inline bool chmin(T a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long INF = 1LL << 60;
typedef long long int ll ;


#define INF 2000000000


int main(){
    int N,M;
    cin>>N>>M;
    int AC[100100];
    int WA[100100];
    for(int i=1;i<=N;i++){
        AC[i]=0;
        WA[i]=0;
    }
 
    int ac=0,wa=0;
    int p;
    string S;
    for(int i=0;i<M;i++){
        cin>>p>>S;
        if(AC[p]==0){
            if(S=="AC"){
                AC[p]=1;
                ac++;
                wa+=WA[p];
            }else{
                WA[p]++;
            }
        }
    }
 
    cout<<ac<<' '<<wa<<endl;
}


Measured memory_bytes: 1024
import java.util.*;
public class Main{
	static int[] ans;
	static ArrayList<State>[] list;
	static int max=0;
	static int n;
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		n=sc.nextInt();
		ans=new int[n-1];
		list=new ArrayList[n];
		for(int i=0; i<n; i++){
			list[i]=new ArrayList<>();
		}
		for(int i=0; i<n-1; i++){
			int a=sc.nextInt()-1;
			int b=sc.nextInt()-1;
			list[a].add(new State(b,i));
			list[b].add(new State(a,i));
		}
		dfs(-1,-1,0);
		System.out.println(max);
		for(int i=0; i<n-1;i++){
			System.out.println(ans[i]);
		}
		
	}
	static void dfs(int front,int no,int now){
		int count=1;
		for(State i:list[now]){
			if(i.g==front){
				continue;
			}
			if(count==no){
				count++;
			}
			max=Math.max(max,count);
			ans[i.ind]=count;
			dfs(now,count++,i.g);
		}
	}
	static class State{
		int g,ind;
		State(int g,int ind){
			this.g=g;
			this.ind=ind;
		}
	}
}


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

int main() {
    int n,m;
    cin>>n;
    vector<int> t(n);
    rep(i,n) cin>>t[i];
    cin>>m;
    rep(i,m) {
        int p,x,ans=0;
        cin>>p>>x;
        p--;
        rep(j,n) {
            if (j==p) ans+=x;
            else ans+=t[j];
        } 
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
 
public class Main{
 
	public static void main(String[] $){
		Scanner s = new Scanner(System.in);
        int N = s.nextInt();
        int M = s.nextInt();
        int[] H = new int[N];
        int[] A = new int[M];
        int[] B = new int[M];
        for(int i = 0; i < N; i++){
            H[i] = s.nextInt();
        }
        for(int i = 0; i < M; i++){
            A[i] = s.nextInt();
            B[i] = s.nextInt();
        }

        boolean[] check = new boolean[N];
        for(int i = 0; i < M; i++){
            if(H[A[i]-1] < H[B[i]-1]){
                if(check[B[i]-1] == false) check[B[i]-1] = false;
                check[A[i]-1] = true;
            }else if(H[A[i]-1] > H[B[i]-1]){
                check[B[i]-1] = true;
                if(check[A[i]-1] == false) check[A[i]-1] = false;
            }else{
                check[B[i]-1] = true;
                check[A[i]-1] = true;
            }
        }
        
        int T = 0;
        for(int i = 0; i < N; i++){
            if(check[i] == false){
                T++;
            }
        }
        
        System.out.println(T);
        
        
	}
} 

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

int main()
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    long long x,br=0;
    cin >> x;
    br+=x/500*1000;
    x=x%500;
    br+=x/5*5;
    cout << br;
}


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

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

  int cnt =0;
  
  while(1){
    h -=  a;
    cnt++;
    if(h <= 0) break;
  }

  cout << cnt;
}

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

const int t[8] = { 0, 1, 2, 3, 5, 7, 8, 9 };

/*void solve(int n){
    if(n >= 8)
        solve(n / 8);
    cout << table[n % 8] ;
}*/

long long int solve(int n){
	long long int s=0;
	for(int i=1 ; n >0; i *= 10 , n /= 8)
		s += (long long int)t[n%8]*i;
	return s;
}
int main(){
    int n;
    
    while( cin >> n , n ){
		cout << solve(n) << endl;
    }
    
}

Measured memory_bytes: 864
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>

#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define MAX 1000000007

using namespace std;

int main(void){
  ll x;
  cin >> x;
  ll ans = 0;
  ans += (x/500)*1000;
  x -= (x/500)*500;
  ans += (x/5)*5;

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define M 1000000007
using namespace std;
int main()
{  //freopen("in.txt","r",stdin);
   //freopen("out.txt","w",stdout);
  int n,m;
  cin>>n>>m;
  vector<int>v[m];
  for(int i=1;i<=n;i++)
  {  int x;cin>>x;
  	  for(int j=0;j<x;j++)
  	  { int xx;cin>>xx;
  	    v[xx-1].push_back(i);
		  }
  }
  int c=0;
  for(int i=0;i<m;i++)
   if(v[i].size()==n)
    c++;
  	cout<<c;
}


Measured memory_bytes: 256
#include<cstdio>

#define MAX 1200000
using namespace std;
int prim[1200100];
int prima[1200100];
int main() {
    int n, i, x = 0;
    for (i = 2; i <= MAX; i++) {
        prim[i] = i;
    }
    for (i = 2; i <= MAX; i++) {
        if (prim[i] != 0) {
                  prima[x] = prim[i];
                  x+= 1;
                  int j = i;
                  while ( j <= MAX) {
                        prim[j] = 0;
                        j+= i;
                  }
        }
    }
    while (scanf("%d", &n) != EOF) {
          int a = 0;
          while ( prima[a] <= n) {
                a++;
          }
          printf("%d\n", a);
    }
    return 0;
}

Measured memory_bytes: 6672
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = Array.ConvertAll(Console.ReadLine().Split(), double.Parse);
            Console.WriteLine(Math.Ceiling((x[0]+x[1])/2));
        }
    }
}

Measured memory_bytes: 13140
#include<stdio.h>
#include<stdlib.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
int compare(const void *a, const void *b){
    return *(int*)a - *(int*)b;
}
int main(void){
  int a,b,c,sum=0;
  scanf("%d %d",&a,&b);
  FOR(b){
    scanf("%d",&c);
    sum+=c;
  }
  PRN((sum-1)/(a+1)+1);
  return 0;
}


Measured memory_bytes: 2136
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define allR(x) (x).rbegin(), (x).rend()
using ll = long long;
using P = pair<int, int>;
const int INF (1<<30);
const double pi = 3.14159265359;

int main() {
  int A, B, H, M;
  cin >> A >> B >> H >> M;

  int nmin = 60*H + M;


  double thA = (double)nmin * 2.0 * pi / (60.0*12.0);
  
  double thB = (double)M * 2.0 * pi / 60.0;

  if (thB > thA) swap(thB, thA);

  double theta = min(abs(thA-thB), abs(thA-2.0*pi-thB));

  double ans = sqrt(A*A + B*B - 2.0*A*B*cos(theta));

  printf("%.10f\n", ans);

  return 0;
}


Measured memory_bytes: 4152
from math import inf

A=26

D=int(input())

C=[0]+list(map(int,input().split())) #減る満足度のベース
S=[0]*(D+1) #S[d][i] :(d+1)日目にコンテストiを開催した時の満足度

for i in range(1,D+1):
    S[i]=[0]+list(map(int,input().split()))

L=[0]*(A+1)
for d in range(1,D+1):
    Y=-inf
    E=0
    for a in range(1,A+1):
        X=S[d][a]
        for s in range(1,A+1):
            if a!=s:
                X-=C[s]*(d-L[s])

        if X>Y:
            Y=X
            E=a
    print(E)
            


Measured memory_bytes: 68696
#include <iostream>
using namespace std;
int main(){
  int n;
  cin >>n;
  int a[n];
  int ma=-100001;
  int mi=100001;
  int na ,ni;
  
  for(int i=1;i<=n;i++){
    cin >>a[i];
    if(a[i]>ma){
      ma=a[i];
      na=i;
      }
     if(a[i]<mi){
      mi=a[i];
      ni=i;
      }
    }
  if(ma+mi>=0){
    cout<<2*n-1<<endl;
    for(int i=1; i<=n;i++){
      cout <<na<<" "<<i<<endl;
      }
     for(int i=1; i<n;i++){
      cout <<i<<" "<<i+1<<endl;
      }
    }
  else{
    cout <<2*n-1<<endl;
     for(int i=1; i<=n;i++){
      cout <<ni<<" "<<i<<endl;
      }
     for(int i=n; i>1;i--){
      cout <<i<<" "<<i-1<<endl;
      }
    }
  return 0;
  }


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
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++)
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<long long>;
using vpii = vector<pair<int,int>>;
using vivi = vector<vector<int>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};



int main(void) {
  int r;
  cin >> r ;
  cout << 3*r*r << endl;
    
}


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

int main()
{
    int n, m, x, tmp, cost_m = 0, cost_p = 0;
    int a[101] = {0};
    cin >> n >> m >> x;
    for(int i=0; i<m; i++) {
        cin >> tmp;
        a[tmp] = 1;
    }

    for(int i=x; i>0; i--) {
        cost_m += a[i];
    }
    for(int i=x; i<n; i++) {
        cost_p += a[i];
    }
    cout << min(cost_p, cost_m) << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int gcd(int, int);
main()
{
        int i, n, gc, lc, *a;
        scanf("%d", &n);
        a = (int*)malloc(sizeof(int) * n);
        scanf("%d", &a[0]);
        lc = a[0];
        for(i = 1; i < n; i++){
                scanf(" %d", &a[i]);
                gc = gcd(lc, a[i]);
                lc = lc * a[i] / gc;
        }
        printf("%d\n", lc);
        free(a);
}
int gcd(int x, int y)
{
        if(x % y == 0){
                return y;
        }
        return gcd(y, x % y);
}

Measured memory_bytes: 1816
#include <iostream>
#include <cmath>
using namespace std;
int E;
int main(){
  while(cin >> E && E>0){
    int m = 1000000;
    for (int z=0; z*z*z<=E; z++){
      //if(z >= m) break;
        for(int y=0; y*y<= E-z*z*z;y++){
	 //if (y+z >= m) break;
	    int x = E - z*z*z - y*y;
	    if (x >= 0){
	      if(x+y+z < m){
		m = x+y+z;
	      }
	    }
      }
    }
    cout << m << endl;
  }
}

Measured memory_bytes: 3016
#bit全探索を用いて全組み合わせを列挙していく

n,m,x = map(int, input().split())
ca = [list(map(int, input().split())) for i in range(n)]
c = [ca[i][0] for i in range(n)]
a = [ca[i][1:] for i in range(n)]

INF = 100000000001
ans = INF

for i in range(2**n):
    price = 0
    level = [0]*m
    for j in range(n):
        if  ((i >> j) & 1):
            for k in range(m):
                level[k] += a[j][k]
            price += c[j]
    if min(level) >= x and price <= ans:
        ans = price

if ans == INF:
    print(-1)
else:
    print(ans)






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

int main(void){
  int A[3];
  cin >> A[0] >> A[1] >> A[2] ;
  int M = 0;
  int m = 100;
  for(int i = 0;i < 3;i++){
      if(M < A[i]){
        M = A[i];
      }
      if(m > A[i]){
        m = A[i];
      }
  }
  cout << M-m << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


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


	int A, B;
	cin >> A >> B;

	if (A < 10 && B < 10) co(A * B);
	else co(-1);


	Would you please return 0;
}

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

int main() {
	int N;
  	cin >> N;
  int64_t l[N];
  
  l[0] = 2, l[1] = 1;
    for(int i = 2; i <= N;++i){
    	l[i] = l[i-2] + l[i-1];
    }
  cout << l[N] << endl;
}






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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;

ll m,n_min,n_max;
vl p;

int main(){
  while(cin >> m >> n_min >> n_max){
    if(m == 0 && n_min == 0 && n_max == 0) return 0;
    p = vl(m);
    for(ll i = 0;i < m;i++) cin >> p[i];
    sort(p.rbegin(),p.rend());
    ll gap = 0;
    ll ans = 0;
    for(ll i = n_min;i <= n_max;i++){
      if(p[i-1]-p[i] >= gap){
        ans = i;
        gap = p[i-1]-p[i];
      }
    }
    cout << ans << endl;
  }
}



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

using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define REP(i, n) for(int i=1;i<=n;i++)
typedef long long ll;

int main() {
	ll n;
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		ll ans = 0;
		for (int x = 1; 6 * x * x <= n; ++x) {
			for (int y = x; y*y <= n; ++y) {
				for (int z = y; z*z <= n; ++z) {
					if (x * x + y * y + z * z + x * y + y * z + z * x == i){
						if(x == y && z == y){
							ans++;
						} else if (x != y && y != z && z != x){
							ans += 6;
						}else{
							ans += 3;
						}
					}
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}



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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<P> VP;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define dbgmint(n,arr) rep(i,n){cerr<<arr[i].x<<" ";}cerr<<endl;
#define Uniq(v) v.erase(unique(v.begin(), v.end()), v.end())
#define fi first
#define se second

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

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

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

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

    ll n;
    cin>>n;

    vector<VP> g(n);
    rep(i,n-1){
        ll a,b,c;
        cin>>a>>b>>c;
        a--;b--;
        g[a].pb(mp(b, c));
        g[b].pb(mp(a, c));
    }

    Vec dist(n,INF);
    ll Q,k;
    cin>>Q>>k;
    k--;
    dist[k] = 0;
    priority_queue<ll, vector<P>, function<bool(P, P)>> q([](P a, P b)->ll {
        return a.second>b.second;
    });
    q.push(mp(k,0));
    while(!q.empty()){
        P now = q.top();
        q.pop();
        Each(nxt,g[now.fi]){
            if(chmin(dist[nxt.fi],dist[now.fi]+nxt.se)){
                q.push(mp(nxt.fi,dist[nxt.fi]));
            }
        }
    }
    //dbg(dist);
    while (Q--){
        ll x,y;
        cin>>x>>y;
        x--;y--;
        ll ans=dist[x]+dist[y];
        cout<<ans<<endl;
    }

    return  0;
}


Measured memory_bytes: 11120
import java.util.Scanner;

public class Main {
    //ROT N
    //
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        System.out.println(helper(s, n));
        sc.close();
    }

    static String helper(String s, int n) {
        char[] A = new char[52];
        for (int i = 0; i < 26; i++) {
            A[i] = (char) (65 + i);
        }
        for (int i = 26; i < 52; i++) {
            A[i] = (char) (65 + i - 26);
        }
        char[] B = s.toCharArray();
        for (int i = 0; i < B.length; i++) {
            int index = B[i] - 'A';
            B[i] = A[index + n];
        }
        StringBuilder sb = new StringBuilder();
        for (char c : B) sb.append(c);
        return sb.toString();
    }
}


Measured memory_bytes: 22100
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef vector<int>Vl;
typedef pair<int,int>pii;
typedef vector<pii>Vll;
typedef vector<pair<int,pair<int,int> > >Vlll;
#define S second
#define F first
#define mp make_pair
#define ms(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define sl(n) cin>>n 
#define pl(n) cout<<n<<" "
const int Nx=2e5+2;
const int inf=(int)(1e19+10LL);
void solve()
{
 set<string>st;
 int n;
 sl(n);
 for(int i=0;i<n;i++){
 	string str;
 	sl(str);
 	st.insert(str);
 	
 }
 cout<<st.size();
  
}

signed main(){
  int test=1;
// sl(test);
 while(test--){
 	solve();
 }
 
}

Measured memory_bytes: 19028
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  string s;
  cin >> s;
  
  if (s.size() == 2 && s[0] == s[1]) {
    cout << 1 << " " << 2 << endl;
  } else if (s.size() == 2 && s[0] != s[1]) {
    cout << -1 << " " << -1 << endl;
  }
  
  for (int i = 0; i < s.size()-2; i++) {
    if (s.size() > 2 && s[i] == s[i+2]) {
      cout << i+1 << " " << i+3 << endl;
      break;
    } else if (s.size() > 2 && s[i+1] == s[i+2]) {
      cout << i+2 << " " << i+3 << endl;
      break;
    } else if (s.size() > 2 && i == s.size()-3) {
      cout << -1 << " " << -1 << endl;
      break;
    }
  }
}

Measured memory_bytes: 512
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String args[]) {
		FastScanner scanner = new FastScanner();
		int n = scanner.nextInt();
		int h=scanner.nextInt();
		int w=scanner.nextInt();
		System.out.println((n-h+1)*(n-w+1));
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}


Measured memory_bytes: 21204
<?php 
fscanf(STDIN, "%d %d %d %d %d", $h1, $m1, $h2, $m2, $k);
$num1 = ($h2 - $h1) * 60;
$num2 = $m2 - $m1;
$num3 = $num1 + $num2 - $k;

echo $num3;

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

using namespace std;

int main(void) {
	int num, m, a, b, i = 0;
	cin >> num >> m;
	vector<bool> s(num + 1, false), g(num + 1, false);
	for (; i < m; i++) {
		scanf("%d%d", &a, &b);
		if (a == 1)
			s[b] = true;
		if (b == num)
			g[a] = true;
	}
	for (i = 1; i <= num; i++) {
		if (s[i] && g[i]) {
			cout << "POSSIBLE\n";
			break;
		}
	}
	if (i == num + 1)
		cout << "IMPOSSIBLE\n";
	return 0;
}

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

int bubbleSort(int* A, int N);

int main(void){
	int n;
	scanf("%d",&n);
	
	int *num;
	num = (int *)malloc(sizeof(int)*n);
	if(num == NULL){
		printf("failure\n");
		exit(1);
	}
	
	//int num[100];
	int i,chnum;

	for(i=0;i<n;i++){
		scanf("%d",(num+i));
	}

	chnum=bubbleSort(num,n);

	printf("%d",num[0]);
	for(i=1;i<n;i++){
		printf(" %d",*(num+i));
	}
	printf("\n%d\n",chnum);

	free(num);

	return 0;
}

int bubbleSort(int *num,int n){
	int esc,j,flag=1,chnum=0;
	while(flag){
		flag=0;
		for(j=n-1;j>0;j--){
			if(num[j]<num[j-1]){
				esc=num[j];
				num[j]=num[j-1];
				num[j-1]=esc;
				flag=1;
				chnum++;
			}
		}
	}
	return chnum;
}

Measured memory_bytes: 1760
/**
 * Title: C - Vacation
 * Url: https://atcoder.jp/contests/dp/tasks/dp_c
 */
#include<bits/stdc++.h>

using namespace std;

#define ll long long

const int MAX_N = 100000;
int a[MAX_N+1], b[MAX_N+1], c[MAX_N+1];

int main() {
    int n; cin >> n;
    for(int i=0; i<n; i++) cin >> a[i] >> b[i] >> c[i];
    int ha[MAX_N+1], hb[MAX_N+1], hc[MAX_N+1];
    for(int i=0; i<n; i++) {
        if(i==0) {
            ha[i] = a[i];
            hb[i] = b[i];
            hc[i] = c[i];
        } else {
            ha[i] = max(hb[i-1], hc[i-1])+a[i];
            hb[i] = max(ha[i-1], hc[i-1])+b[i];
            hc[i] = max(ha[i-1], hb[i-1])+c[i];
        }
    }
    cout << max(ha[n-1], max(hb[n-1], hc[n-1])) << endl;;

    return 0;
}

Measured memory_bytes: 2560
'''
https://atcoder.jp/contests/abc134/tasks/abc134_e
'''
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    N = int(input())
    A = [int(input()) for _ in range(N)]
    d = deque()
    for i in A:
        pos = bisect_left(d, i)
        if pos == 0:
            d.appendleft(i)
        else:
            d[pos-1] = i
    print(len(d))

if __name__ == '__main__':
    main()

Measured memory_bytes: 8064
/* *
 *
 * Author: Hamkor
 *
 * */
 
#include <bits/stdc++.h>

using namespace std;

/* * * *   * * *   	* * * */
typedef long long ll;
const int oo = 1e9;
const ll mod = 100000000;
typedef complex<ll> P;
#define X real()
#define Y imag()
/* * * *   * * *   	* * * */

int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n; cin>>n;
	long double c = 0.0;
	while (n--){
		long double j; cin>>j;
		string x; cin>>x;
		if (x == "JPY") c+=j;
		else c+=(j*380000.0);
	}
	printf("%Lf", c);
	return 0;
}


Measured memory_bytes: 256