akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll INF = 1LL << 30;

int main(void){
    int N, K; cin >> N >> K;
    vector<int> h(N); for(int i = 0; i < N; i++) cin >> h[i];
    
    int ans = 0;
    for(int i = 0; i < N; i++){
        if(h[i] >= K) ans++;
    }
    
    cout << ans << "\n";
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmax(a, b) a = max(a, b);
#define chmin(a, b) a = min(a, b);
using namespace std;
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;

//#define MOD 1000000007
#define MOD 998244353
#define mod 998244353
struct mint {
	int i;
	mint() : i(0) {}
	mint(int x) {
		i = int(x % MOD);
		if (i < 0) i += MOD;
	}
	template<class T> mint(T x) {
		i = int(x % MOD);
		if (i < 0) i += MOD;
	}
	mint operator+(const mint x) const {return i + x.i;}
	mint operator-(const mint x) const {return i - x.i;}
	mint operator*(const mint x) const {return (long long)i * x.i;}
	mint operator/(const mint x) const {return (long long)i * x.pow(MOD - 2).i;}
	mint inv() {return pow(MOD - 2);}
	template<class T> mint pow(T p) const {
		long long r = 1;
		long long t = i;
		for(; p > 0; p >>= 1) {
			if (p & 1) r = r * t % MOD;
			t = t * t % MOD;
		}
		return r;
	}
	template<class T1, class T2> static mint pow(T1 a, T2 b) {
		long long r = 1;
		long long t = (long long)(a % MOD);
		for(; b > 0; b >>= 1) {
			if (b & 1) r = r * t % MOD;
			t = t * t % MOD;
		}
		return r;
	}
	mint& operator+=(const mint x) {
		i = (i + x.i) % MOD;
		return *this;
	}
	mint& operator-=(const mint x) {
		i = i - x.i;
		if (i < 0) i += MOD;
		return *this;
	}
	mint& operator*=(const mint x) {
		i = (int)((long long)i * x.i % MOD);
		return *this;
	}
	mint& operator/=(const mint x) {
		i = (long long)i * x.pow(MOD - 2).i % MOD;
		return *this;
	}
};

std::ostream& operator<<(std::ostream& os, const mint& m) {
	return os << m.i;
}

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} comb(7000);

int main() {
    int n, x;
    cin >> n >> x;
    mint ans(0);
    {
        vector<mint> dp(2*n+1);
        dp[0] = 1;
        rep(_, n) {
            for(int i = 2*n-2; i >= 0; i--) {
                dp[i+2] += dp[i];
                dp[i+1] += dp[i];
            }
        }
        for(int i = 0; i < x - 1; i++) ans += dp[i];
    }
    {
        vector<mint> dp(2*n+1);
        dp[0] = 1;
        for(int k = 1; k <= n; k++) {
            for(int i = 2*n-2; i >= 0; i--) {
                dp[i+2] += dp[i];
                dp[i+1] += dp[i];
                dp[i] = 0;
            }
            for(int t = x - 1; t >= 0; t -= 2) {
                int c = (x - 1 - t) / 2;
                int call = c * 2 + k;
                ans += dp[t] * comb(n, call);
            }
        }
    }
    if (x & 1) {
        for(int c = x - 1; c <= n; c++) {
            ans += comb(n, c);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3676
// SeeAlso: https://atcoder.jp/contests/abc126/tasks/abc126_c

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <limits>

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

using namespace std;

int N, K;

double win = 0;
double sum = 0;

int main() {
    cin >> N >> K;
    double ans = 0;

    for(int i = 1; i < (N+1); i++) {
        double prob = 1.0/N;
        int value = i;
        while(value<K){
            value *= 2;
            prob *= 0.5;
        }
        ans += prob;
    }

    cout << setprecision(10) << ans << endl;

    return 0;
}


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

int main()
{
    int n;
    cin >> n;
    int d[n];
    for(int i=0;i<n;++i){
        cin >> d[i];
    }
    int sum=0;
    for(int i=0;i<n;++i){
        for(int j=i+1;j<n;++j){
            sum += d[i]*d[j];
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
N = gets.to_i
ws = N.times.map{gets.chomp}
 
if ws.uniq.length != ws.length
    puts 'No'
    exit
end
 
(N-1).times do |i|
    if ws[i][-1] != ws[i+1][0]
        puts 'No'
        exit
    end
end
 
puts 'Yes'

Measured memory_bytes: 1916
#include<iostream>
using namespace std;
int main(){
  int s,t,i,length;
  string N;
  s = 0;
  t = 0;
  cin >> N;
  length = N.size();
  for(i=0;i<length;i++){
    if(N[i] == 'T'){
      t++;
      if(s>0)
        s--;
    }
    else
      s++;
  }
  cout << 2*s << "\n";
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main()
{   
    int n;
    cin>>n;
    string s[n];
    long long a[5];
    a[0]=0,a[1]=0,a[2]=0,a[3]=0,a[4]=0;
    for(int i=0;i<n;i++){
        cin>>s[i];
        if(s[i][0]=='M') a[0]++;
        if(s[i][0]=='A') a[1]++;
        if(s[i][0]=='R') a[2]++;
        if(s[i][0]=='C') a[3]++;
        if(s[i][0]=='H') a[4]++;
    }
    long long ans=0;
    for(int i=0;i<5;i++){
        for(int j=i+1;j<5;j++){
            for(int k=j+1;k<5;k++){
                ans+=a[i]*a[j]*a[k];
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 6144
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const double eps = 1E-18;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

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

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

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint operator^(const ll& t)const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

///////////////////////////

ll N;

void out(ll a, ll b) {
	cout << a << " " << b << endl;
}


int main() {
	cin >> N;

	for (ll i = 1; i <= N; i *= 2) {
		if (i == N) { cout << "No"<<endl; return 0; }
	}

	cout << "Yes" << endl;

	out(1, 2);
	out(2, 3);
	out(3, N+1);
	out(N+1, N+2);
	out(N+2, N+3);

	ll M = (N - 3) / 4;
	repn(i, M) {
		out(4 * i, 4 * i + 1);
		out(4 * i + 1, 4 * i + 2);
		out(4 * i + 2, 4 * i + 3);
		out(4 * i + 3, N + 4 * i);
		out(N + 4 * i, N + 4 * i + 1);
		out(N + 4 * i+1, N + 4 * i + 2);
		out(N + 4 * i + 2, N + 4 * i + 3);
	}

	if (N % 4 == 1) {
		out(2, N - 1);
		out(N - 1, N);
		out(3, 2*N);
		out(2 * N - 1, 2 * N);
	}

	if (N % 4 == 2) {
		out(2, N - 2);
		out(N - 2, N-1);
		out(2, N);
		out(3, 2*N - 1);
		out(2*N - 1, 2*N - 2);
		out(N-2, 2*N);
	}

	if (M > 0) {
		out(4 * M, 1);
		repn(i, M - 1) {
			out(4 * M, 4 * i);
		}
	}

	if (N % 4 == 0) {
		out(N, 4 * M);
		out((4 * M) ^ N, 2*N);
	}


	
	

	system("PAUSE");
}


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

void push(int);
int pop();

int s[10];
int top=0;

int main(){
  char A[10];
  int c,b;

  while(scanf("%s",A)!=EOF){
    if(A[0]=='+')push(pop()+pop());
    else if(A[0]=='-'){
      c=pop();
      b=pop();
      push(b-c);}
    else if(A[0]=='*')push(pop()*pop());
    else push(atoi(A));
  }
  printf("%d\n",pop());
  return 0;
}

void push(int x){
  top ++;
  s[top]=x;
}
int pop(){
  top--;
  return s[top+1];
}



Measured memory_bytes: 2108
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main() {
    int n; cin >> n;
    vector<int> x(n);
    rep(i, n) cin >> x[i];
    sort(x.begin(), x.end());
    int l = x[n-1];
    int r;
    int sa = l;
    rep(i, n-1) {
        if(abs(x[i]-(l+1)/2) < sa) {
            sa = abs(x[i]-(l+1)/2);
            r = x[i];
        }
    }
    printf("%d %d\n",l, r);
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<ll, int> P;

int main()
{
	ll n, p;
	cin>>n>>p;
	vector<P> v;
	for(ll i=2; i*i<=p; i++){
		if(p%i==0){
			int e=0;
			while(p%i==0){
				p/=i;
				e++;
			}
			v.push_back(P(i, e));
		}
	}
	if(p>1) v.push_back(P(p, 1));
	ll ans=1;
	for(int i=0; i<v.size(); i++){
		int e=v[i].second; ll q=v[i].first;
		for(int j=0; j<e/n; j++){
			ans*=q;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int a;
    
    scanf("%d",&a);
    for(int i= 1;i<10;i++){
        for(int j=1 ;j<10;j++){
            if(a == i*j){
                printf("Yes");
                return 0;
            }
        } 
    }
    printf("No");
    
    return 0;
}

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

using namespace std;

typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;

constexpr int MAXN = 21, MOD = 1000000007;

int dp[1 << MAXN];
int order[1 << MAXN];
bool compat[MAXN + 2];

int main() {
	int N;
	cin >> N;
	dp[0] = 1;
	for(int i = 0, j = 0, k = 1; i < N; i++) {
		for(int l = 0; l < N; l++)
			cin >> compat[l];
		for(int l = k; j < l; j++) {
			for(int m = 0, n; m < N; m++) {
				if((n = 1 << m ^ order[j]) < order[j])
					break;
				for(int o = 0, p; o < N; o++)
					if(n > (p = compat[o] << o ^ n))
						dp[n] = (dp[n] + dp[p]) % MOD;
				order[k++] = n;
			}
		}
	}
	cout << dp[(1 << N) - 1] << endl;
}


Measured memory_bytes: 16640
#include<stdio.h>
int min(int a,int b)
{
	if(a>b) return b;
	else    return a;
}
int main()
{
	int a,b,c;
	while(scanf("%d%d%d",&a,&b,&c)!=EOF)
	{
		int ans[999];
		int m=0;
		for(int i=1;i<=min(a,b);i++)
		{
			if(a%i==0&&b%i==0) ans[m++]=i;
		}
		printf("%d\n",ans[m-c]);
	}
	return 0;
}

Measured memory_bytes: 128
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class Minesweeper {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int h = in.nextInt();
            int w = in.nextInt();
            String[][] arr = new String[h][w];
            for (int i = 0; i < h; i++) {
                String str = in.next();
                for (int j = 0; j < w; j++) {
                    arr[i][j] = String.valueOf(str.charAt(j));
                }
            }

            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    if (arr[i][j].equals(".")) {
                        check(i, j, h, w, arr);
                    }
                }
            }

            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    out.print(arr[i][j]);
                }
                out.println();
            }

        }

        static void check(int x, int y, int h, int w, String[][] arr) {
            int count = 0;

            if (x - 1 >= 0 && y - 1 >= 0) {
                count += checkNum(x - 1, y - 1, arr);
            }
            if (x + 1 <= h - 1 && y + 1 <= w - 1) {
                count += checkNum(x + 1, y + 1, arr);
            }
            if (y - 1 >= 0 && x <= h - 1 && x >= 0) {
                count += checkNum(x, y - 1, arr);
            }
            if (x + 1 <= h - 1 && y - 1 >= 0) {
                count += checkNum(x + 1, y - 1, arr);
            }
            if (x - 1 >= 0 && y <= w - 1 && y >= 0) {
                count += checkNum(x - 1, y, arr);
            }
            if (x + 1 <= h - 1 && y <= w - 1 && y >= 0) {
                count += checkNum(x + 1, y, arr);
            }
            if (x - 1 >= 0 && y + 1 <= w - 1) {
                count += checkNum(x - 1, y + 1, arr);
            }
            if (x <= h - 1 && x >= 0 && y + 1 <= w - 1) {
                count += checkNum(x, y + 1, arr);
            }

            arr[x][y] = String.valueOf(count);

        }

        static int checkNum(int x, int y, String[][] arr) {
            if (arr[x][y].equals("#")) {
                return 1;
            } else
                return 0;

        }

    }
}



Measured memory_bytes: 24148
// Problem : D - Leaping Tak
// Contest : AtCoder - AtCoder Beginner Contest 179
// URL : https://atcoder.jp/contests/abc179/tasks/abc179_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
#define ff         first
#define ss         second
#define endl       '\n'
#define pb         push_back
#define int        long long
#define vi         vector<int>
#define mii        map<int, int>
#define pii        pair<int, int>
#define all(x)     (x).begin(), (x).end()
#define fill(a,b)  memset(a, b, sizeof(a))
#define setbits(x) __builtin_popcountll(x)
#define rep(i,x,y) for(int i=(int)x; i<y; i++)
#define px(a)      for(auto x: a) cout<<x<<" "; cout<<'\n';
#define pxy(a,n)   rep(i,0,n) {px(a[i])};
const long long MOD=998244353,N=1e5+5;
int power(int x, unsigned int y)  
{  
    int res = 1;
    x = x % MOD;
    if (x == 0) return 0;
  
    while (y > 0)  
    { 
        if (y & 1)  
            res = (res*x) % MOD;
        y = y>>1;
        x = (x*x) % MOD;  
    }  
    return res;  
}

/*_________________________________________________________*/

int solve()
{
	int n,k,ans=0;
	cin>>n>>k;
	int a[k],b[k];
	int dp[n]={0}; 
	rep(i,0,k) cin>>a[i]>>b[i];
	dp[0]=1;
	dp[1]=-1;
	int one=0;
	for(int i=0;i<n;i++){
		one+=dp[i];
		one%=MOD;
		if(one<=0) continue;
		rep(j,0,k){
			if(i+a[j]<n){
				dp[i+a[j]]+=one;
				dp[i+a[j]]%=MOD;
			}
			if((i+b[j]+1)<n){
				dp[i+b[j]+1]-=one;	
				dp[i+b[j]+1]%=MOD;
				dp[i+b[j]+1]+=MOD;
				dp[i+b[j]+1]%=MOD;
			}	
		}
	}
	return one;
}
int32_t main()
{	
	std::ios::sync_with_stdio(false); 
	cin.tie(NULL);
	cout.tie(NULL);
	int t=1; 
	//cin>>t;
	while(t--) 
	//solve();
	cout<<solve()<<endl;
	//cout<<(solve()?"YES":"NO")<<endl;
}

Measured memory_bytes: 5224
from itertools import permutations

N, M = map(int, input().split())
E = {i: set() for i in range(1, 1 + N)}
for _ in range(M):
    a, b = map(int, input().split())
    E[a].add(b)
    E[b].add(a)
ans = 0
for perm in permutations([i for i in range(2, 1 + N)]):
    perm = [1] + list(perm)
    ok = True
    for i in range(len(perm) - 1):
        prv = perm[i]
        nxt = perm[i + 1]
        if nxt not in E[prv]:
            ok = False
    if ok:
        ans += 1
print(ans)


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

namespace ALDS1_2_B
{
    class Program
    {
        /// <summary>
        /// 総交換回数
        /// </summary>
        static private int count = 0;

        static void Main(string[] args)
        {
            int intLength = int.Parse(Console.ReadLine());
            int[] aryIn = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

            for (int i = 0; i < aryIn.Length - 1; i++)
            {
                aryIn = Program.SelectionSort(aryIn, i);
            }

            Console.WriteLine(string.Join(" ", aryIn));
            Console.WriteLine(Program.count);
            Console.ReadLine();
        }

        /// <summary>
        /// index - 1番目までは整列しているとして、index番目の要素を整列させる
        /// </summary>
        /// <param name="aryIn"></param>
        /// <param name="index"></param>
        /// <returns></returns>
        static private int[] SelectionSort(int[] aryIn, int index)
        {
            int intMinIndex = index;
            for (int i = index + 1; i < aryIn.Length; i++)
            {
                if (aryIn[i] < aryIn[intMinIndex])
                {
                    intMinIndex = i;
                }
            }
            
            if (index != intMinIndex)
            {
                int tmp = aryIn[index];
                aryIn[index] = aryIn[intMinIndex];
                aryIn[intMinIndex] = tmp;

                count++;
            }

            return aryIn;
        }
    }
}



Measured memory_bytes: 18360
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;

int main() {
	int N, C;
	cin >> N >> C;

	VVI d(C, VI(C, 0));

	for (int i = 0; i < C; i++) {
		for (int j = 0; j < C; j++) {
			cin >> d[i][j];
		}
	}

	VVI colors(3, VI(C, 0));
	int color;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			cin >> color;
			color--;
			colors[(i+j)%3][color]++;
		}
	}

	long long ans = 1e18;
	for (int i = 0; i < C; i++) {
		for (int j = 0; j < C; j++) {
			for (int k = 0; k < C; k++) {
				if (i == j || j == k || k == i) {
					continue;
				}

				vector<int> to = {i, j, k};

				long long tmp = 0;
				for (int x = 0; x < 3; x++) {
					for (int y = 0; y < C; y++) {
						tmp += d[y][to[x]] * colors[x][y];
					}
				}
				// printf("ijk %d %d %d: %lld\n", i, j, k, tmp);
				ans = min(ans, tmp);
			}
		}
	}

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


Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <cstdio>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>
#include <random>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
#include<atcoder/all>
ll op(ll a, ll b){
    return a + b;
}
ll e(){
    return 0;
}
int main(void){
    ll n, q;
    cin >> n >> q;
    
    atcoder::segtree<ll, op, e> sgt(n);

    rep(i, n){
        ll a;
        cin >> a;
        sgt.set(i, a);
    }

    rep(i, q){
        ll t, a, b;
        cin >> t >> a >> b;
        if(t == 0){
            sgt.set(a, sgt.get(a) + b);
        } else {
            cout << sgt.prod(a, b) << endl;
        }
    }
}



Measured memory_bytes: 14956
#include<bits/stdc++.h>
#define MOD 1000000007
#define MOD2 1000000006
#define TEMPMOD1 998244353
#define TEMPMOD2 998244352
#define INF 1000000000000000007
#define NEGINF -1000000000000000007
#define vll vector<ll> 
#define vvll vector<vector<ll>>
#define pll pair<ll,ll>
#define plll pair<ll,pll>
#define vpll vector<pll>
using namespace std;
typedef long long int ll;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    ll n;
    cin>>n;
    ll arr1[n];
    for(ll i=0;i<n;i++)
    {
        cin>>arr1[i];
    }
    ll ans=0,count=0;
    for(ll i=1;i<(n-1);i++)
    {
        count=0;
        if(arr1[i]>arr1[i-1])
        {
            count++;
        }
        if(arr1[i]>arr1[i+1])
        {
            count++;
        }
        if(count==1)
        {
            ans++;
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
const int maxn = 1e5 + 5 ;
int n ;
struct seg
{
    int l , r ;
	bool operator <(const seg &s) const
	{
	    if(r != s.r)  return r < s.r ;
		else  return l < s.l ;	
	}	
} a[maxn] ;
int main()
{
    ios::sync_with_stdio(false) ;
    cin.tie(0) ;
    cin >> n ;
    for(int i = 1 ; i <= n ; i ++)
    {
    	int x , y ;
    	cin >> x >> y ;
    	a[i].l = x - y ;
    	a[i].r = x + y ; 
	}
	sort(a + 1 , a + n + 1) ;
	int ans = 1 ;
	int last = a[1].r ;
	for(int i = 2 ; i <= n ; i ++)
	   if(a[i].l >= last)  ans ++ , last = a[i].r ;	
    cout << ans << '\n' ;
    return 0 ;
}


Measured memory_bytes: 1024
n,m = [int(x) for x in input().split()]
lst = []
for _ in range(n):
    tmp = [int(x) for x in input().split()]
    lst.append(tmp)

ansset = set(lst[0][1:])

for i in range(1,n):
    tmpset = set(lst[i][1:])
    ansset = (ansset & tmpset)

print(len(ansset))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define tcase int _; cin >> _; while(_--)
const int MAX = 1e6;

ll n, v[MAX], a[MAX];
long long t, ans;

void solve() {
	memset(v, 0, sizeof v);
	cin >> n;
	for(int i=0; i<n; i++) {
		int x;
		cin >> x;
		v[x]++;
		a[i] = x;
	}
	
	t = 0ll;
       	for(int i=1; i<=n; i++) {
		t += (ll)((v[i] * (v[i]-1)) / 2);
	}
	
	for(int i=0; i<n; i++) {
		ans = (ll)(t) + 1ll - (ll)(v[a[i]]);
		cout << (ll)(ans) << "\n";
	}
}

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

 	solve();

  	return 0;
}



Measured memory_bytes: 13036
n = int(input())
listA = list(map(int, input().split()))

stA=""
if n%2 == 0:
    index = len(listA)-1
    while index > 0:
        if index== len(listA)-1:
            stA +=str(listA[index])
        else:
            stA+=" "+str(listA[index])
        index-=2
    index = 0
    while index < len(listA)-1:
        stA+=" "+str(listA[index])
        index+=2
else:
    index = len(listA)-1
    while index > -1:
        if index == len(listA)-1:
            stA += str(listA[index])
        else:
            stA += " "+str(listA[index])
        index -= 2
    index = 1
    while index < len(listA)-1:
        stA += " "+str(listA[index])
        index += 2
        
print(stA)

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

using namespace std;

int N;
string s[200010];
char tmp[1000010];
typedef long long LL;
bool vis[1000010][26];
int ch[1000010][26];
bool isend[1000010];
int tot = 1;
long long ans = 0;

void ins(string s) {
	int n = s.length();
	for (int i=0;i<26;i++) vis[0][i] = (s[0] - 'a' == i);
	for (int i=1;i<n;i++) {
		for (int j=0;j<26;j++) {
			vis[i][j] = (vis[i-1][j] | (s[i] - 'a' == j));
		}
	}
	int now = 1;
	for (int i=n-1;i>=0;i--) {
		for (int j=0;j<26;j++) {
			if (ch[now][j] && isend[ch[now][j]] && vis[i][j]) ans++;
		}
		int v = s[i] - 'a';
		if (!ch[now][v]) ch[now][v] = ++tot;
		now = ch[now][v];
	}
	isend[now] = true;
}

int main() {
	scanf("%d",&N);
	for (int i=1;i<=N;i++) {
		scanf("%s",tmp);
		s[i] = string(tmp);
	}
	sort(s + 1, s + N + 1, [&](string s1, string s2) {
		return s1.length() < s2.length();
	});
	for (int i=1;i<=N;i++) {
		ins(s[i]);
	}
	printf("%lld\n",ans);
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;

int main(){
    ll n;cin>>n;
    map<string,ll>memo;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >>s;
        memo[s]++;
    }
    ll mx=0;
    for(auto p:memo){
        mx=max(mx,p.second);
    }
    for(auto p:memo){
        if(p.second==mx){
            cout <<p.first<<endl;
        }
    }
    return 0;
}



Measured memory_bytes: 26880
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	static final Scanner stdin = new Scanner(System.in);
	public static void main (String[] args) throws java.lang.Exception
	{
		while(stdin.hasNext()){
			int n = stdin.nextInt();
			int sum = 0;
			int count = 0;
			for(int a = 0;a < 10;a++){//a
				for(int b = 0;b < 10;b++){//b
					for(int c = 0;c < 10;c++){//c
						for(int d = 0;d < 10;d++){//d
							sum = a + b + c + d;
							if(sum == n){
								count +=1;
							}
						}
					}
				}
			}
			System.out.println(count);
		}
	}
}

Measured memory_bytes: 26576
// author: Saman Mahdanian
#include <bits/stdc++.h>

using namespace std;
const int N = 5e5 + 10;
const int MOD = 1e9 + 7;

void merge (int, int);
int root (int);
int _sum (int, int);
int _mul (int, int);
int _pow (int, int);
int gcd (int, int);

int par[N], n, m;

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

	cin >> n >> m;
	iota (par, par + n, 0);
	for (int i = 0; i < m; i++) {
		int v, u, x;
		cin >> v >> u >> x;
		v--; u--;
		merge(v, u);
	}

	set <int> rt;
	for (int i = 0; i < n; i++)
		rt.insert(root(i));
	cout << rt.size() << endl;
}

void merge (int v, int u) {
	par[root(v)] = root(u);
}

int root (int v) {
	return par[v] == v? v : (par[v] = root(par[v]));
}

int gcd (int a, int b) {
	return !b? a : gcd (b, a % b);
}

// int choose (int r, int k) {
// 	return _mul (f[k], _mul(inv[r], inv[k - r]));
// }

int _sum (int a, int b) {
	return a + b - (a + b >= MOD? MOD : 0);
}

int _mul (int a, int b) {
	return 1LL * a * b % MOD;
}

int _pow (int a, int b) {
	if (!b) 
		return 1;
	int res = _pow (a, b >> 1);
	res = _mul (res, res);
	if (b & 1)
		res = _mul (res, a);
	return res;
}

// SamMHD :: Jun27-2019 :: Another Day with Shayan...

Measured memory_bytes: 5376
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace CSharp
{
    static class Program
    {
        static void Main(string[] args)
        {
            int n = ReadInt();
            string[] S = Enumerable.Repeat(0, n).Select(_ => ReadString()).ToArray();
            var groups = S.Select(s => new string(s.OrderBy(x => x).ToArray())).GroupBy(x => x);

            long ans = 0;
            foreach (var g in groups)
            {
                long count = g.Count();
                ans += count * (count - 1) / 2;
            }

            Console.WriteLine(ans);
        }

        #region Helpers

        static int[] ReadIntArray() => Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        static long[] ReadLongArray() => Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();

        static int[] ReadLineIntArray(int count) => Enumerable.Repeat(0, count).Select(_ => int.Parse(Console.ReadLine())).ToArray();
        static long[] ReadLineLongArray(int count) => Enumerable.Repeat(0, count).Select(_ => long.Parse(Console.ReadLine())).ToArray();

        static string ReadString() => Console.ReadLine();
        static int ReadInt() => int.Parse(Console.ReadLine());
        static long ReadLong() => long.Parse(Console.ReadLine());

        static void ReadInt(out int first)
        {
            var array = ReadIntArray();
            first = array[0];
        }

        static void ReadInt(out int first, out int second)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
        }

        static void ReadInt(out int first, out int second, out int third)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadInt(out int first, out int second, out int third, out int fourth)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        static void ReadLong(out long first)
        {
            var array = ReadLongArray();
            first = array[0];
        }

        static void ReadLong(out long first, out long second)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
        }

        static void ReadLong(out long first, out long second, out long third)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadLong(out long first, out long second, out long third, out long fourth)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        #endregion
    }
}

Measured memory_bytes: 38888
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            double a = sc.nextInt();
            double l = sc.nextInt();
            double x = sc.nextInt();
            double h = Math.sqrt(l * l - (a / 2) * (a / 2));
            double abc = h * a / 2;
            double hd = Math.sqrt(((l + x) / 2) * ((l + x) / 2) - (l / 2)
                    * (l / 2));
            double adc = hd * l / 2;
            System.out.printf("%.8f\n", abc + 2 * adc);
        }
    }

    public static void main(String[] args) throws Exception {
        new Main().run();
    }
}

Measured memory_bytes: 13000
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace().map(|c| c.parse::<u32>().unwrap());
    let n = iter.next().unwrap();
    let a = iter.next().unwrap();
    let b = iter.next().unwrap();

    if a * n < b {
        println!("{}", a * n);
    } else if a * n >= b { 
        println!("{}", b); 
    }
}

Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <numeric>
#include <bitset>
using namespace std;
#define lint long long
#define ll long long
#define pq priority_queue
long long INF = 1e10;
#define pii pair<long long,long long>
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
/******************************define*********************************/

/*****************************functions********************************/
#define MAX_N 100001

int par[MAX_N];
int ufrank[MAX_N];
int ufsize[MAX_N];
void init(int ufsize_of_tree) {
		for (int i = 0; i < ufsize_of_tree; i++)
		{
			par[i] = i;
			ufrank[i] = 0;
			ufsize[i] = 1;
		}
	}
	int find(int x) {
		if (par[x] == x) return x;
		else return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) return;
		if (ufrank[x] < ufrank[y]) {
			par[x] = y;
			int sx = ufsize[x], sy = ufsize[y];
			ufsize[x] = ufsize[y] = sx + sy;
		}
		else {
			par[y] = x;
			if (ufrank[x] == ufrank[y]) ufrank[x]++;
			int sx = ufsize[x], sy = ufsize[y];
			ufsize[x] = ufsize[y] = sx + sy;
		}
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}

/****************************main function*****************************/
int main(void) {

    ll N, M; cin >> N >> M;
	init(N);

	vector<ll> ans(M + 1);
	vector<pii> b(M);
	for (int i = 0; i < M; i++)
	{
		int x, y; cin >> x >> y;
		b[i] = make_pair(x, y);
	}
	reverse(all(b));
	ans[0] = N * (N - 1) / 2;
	for (int i = 0; i < M; i++)
	{	
		ll d = ufsize[find(b[i].first)] * ufsize[find(b[i].second)];
		if(same(b[i].first,b[i].second)){
			ans[i + 1] = ans[i];
		}else{
			ans[i + 1] = ans[i] - d;
		}
		unite(b[i].first, b[i].second);

	}
	reverse(all(ans));
	for (int i = 0; i < M; i++)
	{
		cout << ans[i + 1] << endl;
	}
	return 0;
}

Measured memory_bytes: 4864
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstdlib>
using namespace std;
int a[100001],b[100001];
int c[100001],x[100001],y[100001];
int main(){
	int A,B,M;//A种微波炉 B种冰箱 M张劵
	int m1=100001,m2=100001;
	int min;
	cin>>A>>B>>M;
	int i;
	for(i=1;i<=A;i++) {cin>>a[i];
	                   if(a[i]<=m1) m1=a[i];}
	for(i=1;i<=B;i++) {cin>>b[i];
	                   if(b[i]<=m2) m2=b[i];}
    min=m1+m2;
    
	for(i=1;i<=M;i++)  {cin>>x[i]>>y[i]>>c[i];
	                     if(a[x[i]]+b[y[i]]-c[i]<=min) min=a[x[i]]+b[y[i]]-c[i];
	                   }
	
	cout<<min;
	return 0;




}
	

Measured memory_bytes: 2176
#include <iostream>
#include <string>
#include <vector>

using namespace std;

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

		string a,b;
		cin >> a;
		b = a;
		reverse(b.begin(), b.end());

		if (a == b) {
			cout << "Yes";
		}
		else {
			cout << "No";
		}

		return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n-1;i>=0;i--)
#define Pool(i, m, n) for(ll i=n-1;i>=m;i--)
#define MAX 999999999ll
#define MIN -999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(x) cout<<x<<endl
#define gcd(x,y) __gcd(x,y) 
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*(y/z);
}
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
int main() {
  cout << fixed << setprecision(16);
  ll n;
  cin>>n;
  vec t(n);
  loop(i,n){
    cin>>t[i];
  }
  ll ans=t[0];
  loop(i,n){
    ans=lcm(ans,t[i]);
  }
  putout(ans);
}


Measured memory_bytes: 256
<?php /*atcoder.php*/

$at = new Atcoder();
$at->main();
unset($at);

class Atcoder{
	private function arrayIn(){
		$buf = explode(" ", fgets(STDIN));
		return $this->killNewLine($buf);
	}
	private function killNewLine($buf = null){
		$buf = str_replace("\r\n", "", $buf);
		$buf = str_replace("\n", "", $buf);
		$buf = str_replace("\r", "", $buf);
		return $buf;
	}

	public function main(){
		$n = $this->arrayIn();
		
		sort($n);

		if(1 == $n[0] &&
		   4 == $n[1] && 
		   7 == $n[2] && 
		   9 == $n[3] ){
			echo "YES\n";
		   }else{
			echo "NO\n";
		   }
	}
}
?>

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

using namespace std;

typedef double D;
typedef long long int LL;

#define st first
#define nd second
#define pb push_back
#define PLL pair <LL, LL>
#define PII pair <int, int>

const int N = 1e6 + 7;
const int MX = 1e9 + 7;
const LL INF = 1e18 + 9LL;

int k;
string s;
string tab[10];

void add(string &a){
	for(int i = 1; i <= k; ++i)
		if(tab[i] == a)
			return;
	
	if(tab[k] > a)
		tab[k] = a;
	
	int last = k;
	while(last > 1 && tab[last] < tab[last - 1]){
		swap(tab[last], tab[last - 1]);
		--last;
	}
}

int main(){
	cin >> s >> k;
	for(int i = 1; i <= k; ++i)
		tab[i] = char(250);

	for(int i = 0; i < s.size(); ++i){
		string cur;
		for(int j = i; j < s.size(); ++j){
			if(cur.size() > k)
				break;

			cur.push_back(s[j]);
			add(cur);
		}
	}
	
	cout << tab[k];
	return 0;
}

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

int main() {
  int times, answer = 1;
  cin >> times;
  for (int roop = 0; roop < times; roop++) {
    string color;
    cin >> color;
    if (color == "P"){
    answer = (answer * 2) % 210;
    }
    else if (color == "W"){
    answer = (answer * 3) % 210;
    }
    else if (color == "G"){
    answer = (answer * 5) % 210;
    }
    else if (color == "Y"){
    answer = (answer * 7) % 210;
    }
  }
  if (answer == 0){
    cout << "Four" << endl;
  }
  else {
    cout << "Three" << endl;
  }
}

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

def main():
    formula=[]
    formula = list(input().split())
    stack=[]
    value1=0
    value2=0
    for value in formula:
        if "+" in value or "-" in value or "*" in value:
            value2=stack.pop()
            value1=stack.pop()
            stack.append(str(eval(value1 + value + value2)))
        else:
            stack.append(value)
    print(stack[0])

if __name__=="__main__":
    main()


Measured memory_bytes: 5576
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;

const int MAX = 105;
const int INF = 1000000007;
const int white = 0;
const int gray = 1;
const int black = 2;

int n, M[MAX][MAX];

int prim() {
  int u, minv;
  int d[MAX], p[MAX], color[MAX];
  rep(i, n) {
    d[i] = INF;
    p[i] = -1;
    color[i] = white;
  }
  d[0] = 0;
  while (1) {
    minv = INF;
    u = -1;
    rep(i, n) {
      if (minv > d[i] && color[i] != black) {
        u = i;
        minv = d[i];
      }
    }
    if (u == -1) break;
    color[u] = black;
    rep(v, n) {
      if (color[v] != black && M[u][v] != INF) {
        if (d[v] > M[u][v]) {
          d[v] = M[u][v];
          p[v] = u;
          color[v] = gray;
        }
      }
    }
  }
  int sum = 0;
  rep(i, n) {
    if (p[i] != -1) {
      sum += M[i][p[i]];
    }
  }
  return sum;
}

int main() {
  cin >> n;
  rep(i, n) {
    rep(j, n) {
      int e;
      cin >> e;
      M[i][j] = (e == -1) ? INF : e;
    }
  }
  cout << prim() << endl;

  
  return 0;
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if (A+B > C+D){
    cout << "Left" << endl;
  }
  else if (A+B == C+D){
    cout << "Balanced" << endl;
  }
  else{
    cout << "Right" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sz(x) (int((x).size()))
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
template<typename T> bool domax(T &a, T b) { return (b > a ? (a = b, true) : false); }
template<typename T> bool domin(T &a, T b) { return (b < a ? (a = b, true) : false); }
typedef long long ll;

const int maxn = 100*1000+5;

int n, m, c[maxn];
bool p[maxn];

int main() {
    scanf("%d%d", &n, &m);
    p[0] = true;
    for (int i = 0; i < n; i++) {
        c[i] = 1;
    }
    for (int i = 0; i < m; i++) {
        int x, y;
        scanf("%d%d", &x, &y);
        x--; y--;
        if (p[x]) {
            if (c[x] == 1) {
                p[y] = true;
                p[x] = false;
            } else {
                p[y] = true;
            }
        }
        c[x]--;
        c[y]++;
    }
    int ans = 0;
    for (int i = 0; i < n; i++) if (p[i]) ans++;
    printf("%d\n", ans);
}


Measured memory_bytes: 768
#include <iostream>
#include <cmath>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++) //これを宣言
#include <set>


int main() {
    int num;
    cin >> num;
    set<string>st;



    rep(i, num) {
        string s;
        cin >> s;
        st.insert(s);
    }
    cout << st.size();

  return 0;
}
//1000000000000000000

Measured memory_bytes: 19184
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ldouble = long double;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s) cout << fixed << setprecision(10) << s << endl;


int main()
{
	for (ll i = 0; i < 3; i++)
	{
		string s;
		cin >> s;
		print(s[i]);
	}
	println("");

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));
set<int> st;
vector<ll> vec[100010], pos[100010];
vector<ll> g[100010];

void dfs(int p, int q){
	if(st.count(p)) return ; st.insert(p);
	vec[q].push_back(p);
	
	for(auto e:g[p]) dfs(e, q);
}

int main(){
	ll n, m, a[100010];
	cin >> n >> m;
	REP(i,0,n) cin >> a[i];
	REP(i,0,m){
		int x, y; cin >> x >> y;
		g[x].push_back(y);
		g[y].push_back(x);
	}
	
	pq<P2, vector<P2>, greater<P2>> qu;
	ll cou = 0, count = 0, li[100010]; ll s = 0, ma = 0;
	REP(i,0,n) if(!st.count(i)) dfs(i, cou++);
	REP(i,0,cou) REP(j,0,vec[i].size()) pos[i].push_back(a[vec[i][j]]);
	REP(i,0,cou) sort(pos[i].begin(), pos[i].end());
	REP(i,0,cou) s += pos[i][0];
	REP(i,0,cou) REP(j,1,pos[i].size()) qu.push({pos[i][j], {i, j}});
	
	int c = cou - 2;
	while(c and !qu.empty()){
		s += qu.top().first;
		ma = max<int>(ma, qu.top().first);
		qu.pop();
		c--;
	}
	if(cou == 1) cout << 0 << endl;
	else if(c) cout << "Impossible" << endl;
	else cout << s << endl;
	return 0;
}


Measured memory_bytes: 20340
#include <inttypes.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
    intmax_t A, B, N;
    intmax_t x, ans = 0;

    scanf("%jd%jd%jd", &A, &B, &N);

    if (N >= (B - 1)) {
        x = B - 1;
    } else {
        x = N;
    }

    ans = A * x / B;

    printf("%jd\n", ans);

    return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> l;
  for (int i = 0; i<n; i++){
    int x;
    cin >> x;
    l.push_back(x);
  }
  sort(l.begin(), l.end());
  int db=0;
  for (int i = 0; i<n; i++) {
    for (int j = i+1; j<n; j++) {
      for (int k = j+1; k<n; k++) {
        if (l[i]+l[j]>l[k]){
          if ((l[i]!=l[j]) && (l[i]!=l[k]) && (l[j]!=l[k])) {
            db = db + 1;
          }
        }
      }
    }
  }
  
  cout << db<<endl;
	return 0;
}


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

int v[101][101];
int n;
int a, b, c, d;
int ans = (1<<29);


void solve(int x, int y){
  int cnt = 1;
  memset(v,-1,sizeof(v));

  for(int i = 0; i < y; i++){
    for(int j = 0; j < x; j++){
      v[i][j] = cnt;
      cnt++;
      if(cnt == n+1) break;
    }
      if(cnt == n+1) break;
  }
  cnt = 1;
  /*
  for(int i = 0; i < y; i++){
    for(int j = 0; j < x; j++){
      cout << v[i][j] << " ";
      cnt++;
      if(cnt == n+1) break;
    }
    cout << endl;
      if(cnt == n+1) break;
  }
  */




  pair<int, int> p1, p2, p3, p4;
  cnt = 1;
  int ju = 0;
  for(int i = 0; i < y; i++){
    for(int j = 0; j < x; j++){
      if(v[i][j] == a){
	p1.first = i;
	p1.second = j;
	ju++;
      }else if(v[i][j] == b){
	p2.first = i;
	p2.second = j;
	ju++;
      }else if(v[i][j] == c){
	p3.first = i;
	p3.second = j;
	ju++;
      }else if(v[i][j] == d){
	p4.first = i;
	p4.second = j;
	ju++;
      }
      cnt++;
      if(cnt == n+1 || ju== 4) break;
    }

      if(cnt == n+1 || ju == 4) break;
  }
  ans = min(ans,abs(p1.first-p2.first)+abs(p1.second-p2.second)+abs(p3.first-p4.first)+abs(p3.second-p4.second));
}

int main(){


  cin >> n;
  cin >> a >> b >> c >> d;

  for(int i = 1; i <= n; i++){
    int k = (double)((double)n/i)+0.9;
    // cout << k << endl;
    solve(i,k);
  }
  cout << ans << endl;;



}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef pair<int, int> ii;
typedef pair<int, bool> ib;

#define FOR(a, b, c) for(int a = b; a < c; ++a)
#define RFOR(a, b, c) for(int a = b; a >= c; --a)
#define mp(a, b) make_pair(a, b)
#define all(v) v.begin(), v.end()

#define ii pair<int, int>
#define vi vector<int>
#define vii vector<ii>
#define vvi vector<vi>
#define vb vector<bool>
#define fst first
#define snd second
#define MAXN 100010
#define LOGMAXN 20
#define MAXM 44100
#define LOGMAXN 20
#define INF 1000000007
#define INFLL 1000000000000000000LL
#define EPS 1e-9
#define MOD 1000000007LL

ll n;

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0);
	int a, b;
	while(cin >> n)
	{
		ll ans = INFLL;
		for(ll i = 1; i*i <= n; ++i)
		{
			if(n%i == 0)
			{				
				ans = min(ans, i + (n/i) - 2);
			}
		}
		printf("%lld\n", ans);
	}
	return 0;
}


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

dp = [0] + [float("inf")]*(n-1)

for i in range(1, n):
    for j in range(max(0, i-k), i):
        dp[i] = min(dp[i], dp[j]+abs(h[i]-h[j]))

print(dp[-1])

Measured memory_bytes: 55520