akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int ans = 0;
	int cnt[30];
	for (int i = 1; i < n; i++) {
		memset(cnt, 0, sizeof(cnt));
		for (int k = 0; k < i; k++) {
			cnt[s[k] - 'a'] |= 1;
		}
		for (int k = i; k < n; k++) {
			cnt[s[k] - 'a'] |= 2;
		}
		int tmp = 0;
		for (int k = 0; k < 26; k++) {
			tmp += (cnt[k] & 1) && (cnt[k] & 2);
		}
		ans = max(ans, tmp);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
//おまじない
#include <iostream>
#include<iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
#define P pair<int,int>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

const int maxn=100000;

ll dig(char c){
    return int(c)-'0';
}

string s;
ll dp[100001][13]={0};
ll mod = INF;
ll n;

int main(){
    
    cin >> s;
    n = s.size();
    
    dp[0][0]=1;
    rep(i,n){
        ll c = dig(s[i]);
        rep(j,10){
            if(c==dig('?')||c==j){
                rep(k,13){
                    dp[i+1][(10*k+j)%13]=(dp[i+1][(10*k+j)%13]+dp[i][k])%mod;
                }
            }
        }
    }
    
    cout << dp[n][5]<<endl;
    
    return 0;
}


Measured memory_bytes: 10624
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

signed main(){
	int n,m,k,r;
	int b[51],feel[51]={};
	cin>>n>>k;
	rep(i,0,k){
		cin>>m;
		rep(j,0,m){
			int bunny;
			cin>>bunny;
			b[bunny-1]=i;
		}
	}
	cin>>r;
	rep(i,0,r){
		int p,q;
		cin>>p>>q;
		if(b[p-1]==b[q-1]){
			feel[p-1]=1;
			feel[q-1]=1;
		}
	}
	int ans=0;
	rep(i,0,n){
		ans+=feel[i];
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){

	int n, cnt=0;
	vector<int> v, v2;

	cin>> n;
	v.resize(n);
	v2.resize(n);
	for(int i=0;i<n;i++){
		cin>> v[i];
		v2[i]=v[i];
	}

	sort(v.begin(), v.end());

	for(int i=0;i<n;i++){
		if(v[i]!=v2[i]) cnt++;
	}

	if(cnt<=2) cout<< "YES" << endl;
	else cout<< "NO" <<endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include<algorithm>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i =0;i < n;i++){
        cin >> a[i];
    }
    
    sort(a.begin(),a.end());
    
    cout << a[n-1] - a[0] << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String args []){
        Scanner sc = new Scanner(System.in);
        int N  = sc.nextInt();
        int [] X = new int[N];
        int [] Y = new int[N];
        double sum = 0;
        int time = 1;
        int n =1;
        for(int i=N-1;i>0;i--) time*=i;
        for(int i=N;i>0;i--) n*=i;
        time*=2;
        for(int i=0;i<N;i++){
            X[i] = sc.nextInt();
            Y[i] = sc.nextInt();
        }
        for(int i=0;i<N;i++){
            for(int j=i+1;j<N;j++){
                double x = Math.pow(X[i]-X[j],2);
                double y = Math.pow(Y[i]-Y[j],2);
                double dis = Math.sqrt(x+y)*time;
                sum+=dis;
            }
        }
        sum/=n;
        System.out.println(sum);
    }
}

Measured memory_bytes: 23764
h = int(input())
def pow(n, p): #繰り返し二乗法
    res = 1
    while p > 0:
        if p % 2 == 0:
            n = n ** 2
            p //= 2
        else:
            res = res * n
            p -= 1
    return res

for i in range(1,10*100):
    if h < pow(2,i):
        p = i-1
        break
ans = 0
for i in range(p+1):
    ans += 2**i
print(ans)

Measured memory_bytes: 38384
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

const long long mod = 1E9 + 7;

long long modpow(long long a, int n)
{
	if(n == 0)
		return 1;

	long long half = modpow(a, n/2);
	long long ans = half * half % mod;

	if(n%2 == 1){
		ans *= a;
		ans %= mod;
	}

	return ans;
}

long long nCr(int n, int r)
{
	if(r > n-r)
		return nCr(n, n-r);

	long long mul = 1;
	long long div = 1;
	for(int i=0; i<r; i++){
		mul *= n - i;
		mul %= mod;

		div *= i + 1;
		div %= mod;
	}

	long long ans = mul * modpow(div, mod-2) % mod;

	return ans;
}

int main(void)
{
	int N;
	long long M;
	cin >> N >> M;

	long long ret = 1;
	for(long long i=2; i*i<=M; i++){
		int cnt = 0;
		while(M%i == 0){
			cnt++;
			M /= i;
		}
		if(cnt == 0)
			continue;

		ret *= nCr(cnt+N-1, N-1);
		ret %= mod;
	}
	if(M != 1){
		ret *= N;
		ret %= mod;
	}

	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 256
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

#二分探索
N = ir()
S = sr()

def check(x):
    # x文字右側にずらした場所を調べる
    candidate = set()
    for i in range(N - 2*x + 1):
        candidate.add(S[i:i+x])
        if S[i+x:i+2*x] in candidate:
            return True
    return False

ok = 0; ng = N
while abs(ng-ok) > 1:
    mid = (ok+ng) // 2
    if check(mid):
        ok = mid
    else:
        ng = mid

print(ok)


Measured memory_bytes: 6388
#include<stdio.h>

int main(void){
	int a[3],b[3];
	int count[5] = {}; 
	int i;

	scanf("%d %d",&a[0],&b[0]);
	scanf("%d %d",&a[1],&b[1]);
	scanf("%d %d",&a[2],&b[2]);

	
	for(i=0;i<3;i++){
		count[a[i]]++;
		count[b[i]]++;
	}

	for(i=1;i<5;i++){
		if(count[i] == 3){
			printf("NO\n");
			return 0;
		}
	}
	printf("YES\n");
	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// #include <unordered_set>
// #include <unordered_map>

#define rep(i, a, n) for (int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for (int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define SORT(c) sort((c).begin(), (c).end())
#define RSORT(c) sort((c).rbegin(), (c).rend())

#define pb push_back
#define mp make_pair

int gcd(int a, int b) {
  int c;
  while (b != 0) {
    c = a % b;
    a = b;
    b = c; } return a; }
int lcm(int a, int b) {
  int c = gcd(a, b);
  a /= c;
  return a * b;
}

typedef std::pair<int, int> P;
typedef long long ll;
typedef long double ld;

const int MOD = 1000000007;
const int INF = 1e9;
const ll LINF = INF * 1ll * INF;
const ld DINF = 1e200;
const double EPS = 1e-10;
const double PI = acos(-1.0);

using namespace std;

// #define int long long

signed main() {

  ios::sync_with_stdio(false);
  cin.tie(0);
  // cin高速化

  string s;
  cin >> s;

  int z = 0;
  int o = 0;

  for (int index = 0; index < s.size(); index++) {
    if (s[index] == '0') {
      z++;
    } else if (s[index] == '1') {
      o++;
    }
  }

  cout << 2 * min(z, o) << endl;
  return 0;
}


Measured memory_bytes: 512
import sys
sys.setrecursionlimit(300000)
from collections import defaultdict

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


N = I()
A = LMI()

d = defaultdict(int)
for a in A:
    d[a] += 1

for i in range(1, N + 1):
    print(d[i])

Measured memory_bytes: 116828
#include <stdio.h>

int n, A[50];

int solve(int i, int m){
    if(m == 0) return 1;
    if(i >= n) return 0;
    int res = solve(i + 1, m) || solve(i + 1, m - A[i]);
    return res;
}

int main(){
    int q, M, i;
    scanf("%d", &n);
    for(i = 0; i < n; i++) scanf("%d", &A[i]);
    scanf("%d", &q);
    for(int i = 0; i < q; i++){
        scanf("%d", &M);
        if(solve(0, M)) printf("yes\n");
        else printf("no\n");
    }

    return 0;
}

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

int main(){
	string s;
	cin >> s;
	while(s!="ABC"){
		int use[3] = {0,0,0};
		string tmp = "";
		bool nochange = true;
		for(int i=0; i<(int)s.length(); i++){
			if(i+2<(int)s.length() && s[i]=='A' && s[i+1]=='B' && s[i+2]=='C'){
				tmp += "D";
				i+=2;
				nochange = false;
			}else{
				tmp += s[i];
				use[s[i]-'A'] = 1;
			}
		}
		if(nochange) break;
		
		char rplc='D';
		for(int i=0; i<3; i++){
			if(use[i]==0 && use[(i+1)%3]==1 && use[(i+2)%3]==1){
				rplc = 'A'+i;
			}
		}
		if(rplc=='D') break;
		for(int i=0; i<(int)tmp.length(); i++){
			if(tmp[i]=='D'){
				tmp[i] = rplc;
			}
		}
		s = tmp;
	}
	
	if(s=="ABC"){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 3216
// SeeAlso: 

#include <bits/stdc++.h>

using namespace std;

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

#define MAX 10

typedef int _loop_int;
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }

int N;

int main() {

    cin >> N;

    double ans = 0;

    REP(i, N) {
        double m;
        string s;
        cin >> m >> s;
        double price;
        if (s=="BTC") {
            price = m * 380000;
        } else {
            price = m;
        }
        ans += price;
    }    
    print(ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <math.h>
#include <cstdlib>
#include <iostream>
#include <cstdlib>
using namespace std;

int main(){
	string s;
	cin>>s;
	if(s[0]!=s[1] && s[0]!= s[2] && s[0]!=s[4] && s[1]!= s[2] && s[1]!=s[4] && s[2]==s[3] && s[4]==s[5]){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
	
	
	return 0;
}

Measured memory_bytes: 256
N = int(input())
S = input()
ans = 0
alphabets = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
for i in range(N + 1):
    former = S[:i + 1]
    latter = S[i + 1:]
    count = 0
    for j in alphabets:
        if (j in former) and (j in latter):
            count += 1
    if count > ans:
        ans = count
print(ans)



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

int main(){
    long MOD = 1000000007;
    long N;
    cin >> N;
    long dp{N};
    vector<long> sum(N + 3, (N - 1) * N % MOD);
    sum[0] = 0;
    for(long i = 3; i != N + 3; ++i)sum[i] = (sum[i - 1] - 1 + ((dp += sum[i - 3]) %= MOD)) % MOD;
    cout << dp << endl;
    return 0;
}

Measured memory_bytes: 8064
from collections import defaultdict, Counter

N = int(input())
A = list(map(int, input().split()))

d = defaultdict(int)
for a in A:
    d[a] += 1

all = 0
for val in d.values():
    all += val * (val - 1) / 2

all = int(all)
val_cnt = Counter(A)
for a in A:
    print(all - (val_cnt[a] - 1))


Measured memory_bytes: 97612
d1=input().split()
d2=input().split()
m=[[1,2,4,3,1],[5,2,0,3,5],[5,4,0,1,5],[5,1,0,4,5],[5,3,0,2,5],[4,2,1,3,4]]
ans='No'

if sorted(d1)==sorted(d2):
    if len(set(d1))>=4:
        for i in range(3):
            if d1[5-i]==d2[5-d2.index(d1[i])]:
                mae,migi=[d1[m[i][s]] for s in range(2)]
                for j in range(4):
                    if mae==d2[m[d2.index(d1[i])][j]] and migi==d2[m[d2.index(d1[i])][j+1]]:
                        ans='Yes'
                        break
            else:
                ans='No'
                break
    else:
        ans='Yes'

print(ans)


Measured memory_bytes: 5584
#!/usr/bin/env python3
import sys

class UnionFind:
    def __init__(self, n):
        self.n = n
        self.root = [-1] * (n+1)
        self.rnk = [0] * (n+1)
    
    def find_root(self, x):
        if self.root[x] < 0:
            return x
        else:
            self.root[x] = self.find_root(self.root[x])
            return self.root[x]

    def unite(self, x, y):
        x = self.find_root(x)
        y = self.find_root(y)
        if x == y:
            return
        elif self.rnk[x] > self.rnk[y]:
            self.root[x] += self.root[y]
            self.root[y] = x
        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            if self.rnk[x] == self.rnk[y]:
                self.rnk[y] += 1
        
    def same(self, x, y):
        return self.find_root(x) == self.find_root(y)

    def size(self, x):
        return -self.root[self.find_root(x)]

def solve(N: int, M: int, X: "List[int]", Y: "List[int]", Z: "List[int]"):
    uf = UnionFind(N)
    for i in range(M):
        uf.unite(X[i], Y[i])
    v = []
    for i in range(N):
        v.append(uf.find_root(i))
    print(len(set(v)))
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    X = [int()] * (M)  # type: "List[int]"
    Y = [int()] * (M)  # type: "List[int]"
    Z = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        X[i] = int(next(tokens)) - 1
        Y[i] = int(next(tokens)) - 1
        Z[i] = int(next(tokens)) % 2
    solve(N, M, X, Y, Z)

if __name__ == '__main__':
    main()


Measured memory_bytes: 23464
class UnionFind():
    def __init__(self, N):
        self.N = N
        self.parents = [-1] * N

    def root(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.root(self.parents[x])
            return self.parents[x]

    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)

        if x == y:
            return False
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.root(x)]

n, m = map(int, input().split())

uf = UnionFind(n)

for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    uf.unite(a, b)

ans = 0
for i in range(n):
    ans = max(ans, uf.size(i))

print(str(ans))

Measured memory_bytes: 14472
import sys
input=sys.stdin.readline
#input = open(sys.argv[1], "r").readline

def main():
    _ = int(input())
    A = list(map(int, input().split()))
    s = 0
    for a in A:
        s += 1/a
    print(1/s)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;

    cin>>n>>m;
    int arr[m];
    for(int i=0; i<m; i++)
    {
        cin>>arr[i];
    }
    int sum=0;
    for(int i=0; i<m; i++)
    {
        sum=sum+arr[i];
    }
    if(sum>n)
        cout<<-1<<"\n";
    else
        cout<<abs(sum-n)<<"\n";
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b;
    cin>>a>>b;
    puta(max(0, a-2*b));
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	long long int n,m,ans=0;
	scanf("%lld %lld",&n,&m);
	
	
	if(m<n*2){
		printf("%lld\n",m/2);
	} else{
		ans=n;
	
		m=m-n*2;
	
		ans+=m/4;
	
		printf("%lld\n",ans);
	}
	return 0;
}

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

using namespace std;

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

  int L_max=0, R_min=N;
  for (int i = 0; i < M; ++i)
  {
    int L, R;
    cin >> L >> R;
    L_max = max(L_max, L);
    R_min = min(R_min, R);
  }
  int ans = R_min - L_max+1;
  ans = max(ans, 0);

  cout << ans << endl;
}

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

int main(){
	int H, W;
	cin >> H >> W;
	string S0 = "", S1 = "", S2;
	for(int i = 0; i < H; i++){
		S0 = S1;
		if(S1.empty())
			cin >> S1;
		else
			S1 = S2;
		if(i+1 < H)
			cin >> S2;
		else
			S2 = "";
		for(int j = 0; j < W; j++){
			if(S1.at(j) == '#'){
				cout << '#';
				continue;
			}
			int count = 0;
			for(int k = -1; k <= 1; k++){
				if((j+k == -1) || (j+k == W))
					continue;
				if(!S0.empty())
					if(S0.at(j+k) == '#')
						count++;
				if(S1.at(j+k) == '#')
					count++;
				if(!S2.empty())	
					if(S2.at(j+k) == '#')
						count++;
			}
			cout << count;
		}
		cout << endl;
	}
}

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

namespace abc_164c
{
    class Program
    {
        static void Main(string[] args)
        {
            int kuji = int.Parse(Console.ReadLine());
            List<string> moji = new List<string>();
 
            for(int i = 0; i < kuji; i++)
            {
                moji.Add(Console.ReadLine());
            }

            int result = moji.Distinct().Count(); 
            Console.WriteLine(result);
            Console.Read();

        }
    }
}


Measured memory_bytes: 47912
#include <chrono>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << " ";
    return a;
}

#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
    const int INF = 1e18;
//    const int mod = 2600000069;
//    const int p = 10;
//    const ld PI = 3.1415926535;
#else
    #define dbg(x)
    const int INF = 1e18;
//    const int mod = 2600000069;
//    const int p = 179;
//    const ld PI = 3.1415926535;
#endif

//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,sse3,sse4")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("fast-math")
//#pragma GCC target("avx2")
//#pragma GCC optimize("section-anchors")
//#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
//#pragma GCC optimize("vpt")
//#pragma GCC optimize("rename-registers")
//#pragma GCC optimize("move-loop-invariants")
//#pragma GCC optimize("unswitch-loops")
//#pragma GCC optimize("function-sections")
//#pragma GCC optimize("data-sections")

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
    #else
//        freopen("capitals.in", "r", stdin);
//        freopen("capitals.out", "w", stdout);
    #endif
    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    n++;
    vector<int> dp(n, INF), p(n, -1);
    dp[0] = 0;
    set<pii> from;
    from.insert({dp[0], 0});
    for (int i = 1; i < n; i++) {
        if (i > m) {
            from.erase({dp[i - m - 1], i - m - 1});
        }
        if (from.empty()) {
            cout << -1;
            return 0;
        }
        if (s[i] == '1') continue;
        pii kek = *from.begin();
        dp[i] = kek.first + 1;
        p[i] = kek.second;
        from.insert({dp[i], i});
    }
    if (dp[n - 1] == INF) cout << -1;
    else {
        vector<int> ans;
        int cur = n - 1;
        while (cur > 0) {
            ans.pb(cur - p[cur]);
            cur = p[cur];
        }
        reverse(all(ans));
        cout << ans;
    }
}
/*

*/


Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, j, n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 1e9 + 7;
 
typedef long long i64;
typedef pair<int, int> pi;
 
template <class T> using vt = vector<T>;
template <class T> using vvt = vector<vector<T>>;
 
i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));}
i64 lcm(i64 n, i64 m) {return (n / gcd(n, m) * m);}
int dx[] = {0, -1, 0, 1, 1, 1, -1, -1};
int dy[] = {-1, 0, 1, 0, 1, -1, 1, -1};

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

  string s;
  cin >> s;
  map<char, int> mp;
  rep(i, 0, s.size()) mp[s[i]]++;

  if(abs(mp['a'] - mp['b']) <= 1 && abs(mp['b'] - mp['c']) <= 1 && abs(mp['c'] - mp['a']) <= 1) cout << "YES\n";
  else cout << "NO\n";
}


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

int main() {
  int H, W;
  cin >> H >> W;

  vector<vector<char>> S(H + 2, vector<char>(W + 2, '.'));
  for (int i = 1; i <= H; i++)
    for (int j = 1; j <= W; j++)
      cin >> S[i][j];

  for (int i = 1; i <= H; i++)
    for (int j = 1; j <= W; j++) {
      if (S[i][j] == '.') {
        S[i][j] = '0';
        for (int r = i - 1; r <= i + 1; r++) {
          for (int c = j - 1; c <= j + 1; c++) {
            if (!(r == i && c == j) && S[r][c] == '#')
              S[i][j]++;
          }
        }
      }
    }

  for (int i = 1; i <= H; i++) {
    for (int j = 1; j <= W; j++) {
      cout << S[i][j];
    }
    cout << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LLI long long int
#define pii pair<int,int>
#define fst first
#define sec second
#define ULTRA 2134567890
#define de(x) if(x!=0 && MODE==x)
#define MODE 1
using namespace std;

int N,M;
int H[100007];
vector<int> adj[100007];
bool v[100007] = {};

int main()
{
    int i,j;

    scanf("%d %d", &N, &M);
    for( i=1; i<=N; i++)
    {
        scanf("%d", &H[i]);
    }
    for( i=1; i<=M; i++)
    {
        int A,B;
        scanf("%d %d", &A, &B);
        adj[A].push_back(B);
        adj[B].push_back(A);
    }

    int ans = 0;
    for( i=1; i<=N; i++)
    {
        bool flag = 0;
        for( auto y:adj[i])
        {
            if( H[y] >= H[i])
                flag = 1;
        }
        if(!flag)
            ans++;
    }

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


    return 0;
}

//
//          ___ ___  __________  __________
//         /////\  \/\   ______\/\\\\\\\\\\\  Code by ~Ice Tea~ of
//        //// \ \  \ \  \_____/\ \\\\_____/      New Empire of CHSH ...
//       ////   \ \  \ \  \      \ \\\\\\\\\\\
//      ////__   \ \  \ \  \      \ \\\\_____/
//     ///////\   \ \  \ \  \______\ \\\\_______   ________
//    ////____/    \ \__\ \___   ___\ \\\\\\\\\\\ _\  ___  \_
//   /__/           \/__/\/__/\  \__/\ \\\\_____//\  .\_/\_  \
//                           \ \  \   \ \\\\\\\\\\\\  \_\/_\  \
// ... with the AC Power of   \ \  \   \ \\\\_____/ \   _____  \
//   The Great Tsundere Doggy. \ \  \   \ \\\\     \ \  \  \ \  \
//                              \ \__\   \ \\\\\\\\\\ \__\  \ \__\
//                               \/__/    \/________/\/__/   \/__/
//


Measured memory_bytes: 9336
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long LL;
LL n,a,b,f[1000001];
int main() {
    scanf("%lld%lld%lld",&n,&a,&b);
    if (a+b>n+1||a*b<n) {
	printf("-1\n");
	return 0;
    }
    for (int i=1;i<=a;i++) f[i]=1;
    LL sum=n-a;
    for (int i=1;i<=a;i++) {
	LL now=b-f[i];
	now=min(now,sum);
	f[i]+=now;
	sum-=now;
    }
    LL cnt=0;
    for (int i=1;i<=a;i++) {
	for (int j=cnt+f[i];j>=cnt+1;j--) printf("%d ",j);
	cnt+=f[i];
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 6016
#include<bits/stdc++.h>
#define MOD 1000000007
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define forf(i,a,b) for(i=a;i<b;i++)
#define forr(i,a,b) for(i=a;i>b;i--)
#define mp make_pair
#define f first
#define s second
#define pb(x) push_back(x)
typedef  long long  int ll;
typedef std::vector<ll> vi;

#define input(vec,a,b) for(ll i =a;i<b;i++) cin>>vec[i]
#define print(vec,a,b) for(ll i=a;i<b;i++) cout<<vec[i]<<" " ;cout<<endl;
#define all(a) a.begin(),a.end()
using namespace std;


void solve(){
        char s[3001],t[3001];
        cin>>s>>t;
        ll n,m,i,j;
        for(n=0;s[n]!='\0';n++);
        for(m=0;t[m]!='\0';m++);
        
        ll mx[n+1][m+1]={0};
        for(i=0;i<=n;i++)
        {
                 for(j=0;j<=m;j++)
                 mx[i][j]=0;
            
        }
        for(i=1;i<=n;i++)
        {
                 for(j=1;j<=m;j++)
                 {
                          if(s[i-1]==t[j-1])
                          {
                                   mx[i][j]=mx[i-1][j-1]+1;
                                   
                          }
                          else
                          {
                                   mx[i][j]=max(mx[i-1][j],mx[i][j-1]);
                          }
                 }
        }
        ll out=mx[n][m];
        stack<char> st;
        while(out>0)
        {
                 if(s[n-1]==t[m-1])
                 {
                    out--;
                    st.push(s[n-1]);
                    n--;
                    m--;
                 }
                 else
                 {
                          if(mx[n][m-1]>mx[n-1][m])
                          {
                                   m--;
                          }
                          else
                          {
                                   n--;
                          }
                 }
        }
        while(!st.empty())
        {
                 cout<<st.top();
                 st.pop();
        }
}

int main()
{
      IO;
      ll t=1;
      //cin>>t;


      while(t--)
      {

          solve();
      }
    return 0;
}

Measured memory_bytes: 73928
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
using ll=long long;
using P=pair<ll,ll>;
using PP=tuple<ll,ll,ll>;
using S=multiset<ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
void decimal(int x){cout<<fixed<<setprecision(x);}
//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/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*POW(a,b-1)%mod;ll k=POW(a,b/2);return k*k%mod;}
vi calc(ll x){vi res;while(x>0){res.eb(x%10);x/=10;}reverse(all(res));return res;}

void solve() {
  int k,a,b;
  cin>>k>>a>>b;
  bool f=false;
  REP(i,a,b+1){
    if(i%k==0) f=true;
  }
  if(f) out("OK");
  else out("NG");
}

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


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
 
typedef long long ll;
typedef vector<int> vi;
typedef unsigned long ul;
typedef vector<ll> vl;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef set<int> si;
typedef multiset<int> mi;
 
const ll INF = 1e18;
const int MOD = 1e9+7;


int main() {
	
	cin.tie(NULL);
	ios_base::sync_with_stdio(false);
	
	
	ll a,b,c;
	cin >> a >> b >> c;
	if(b*c>=a) cout << "Yes\n";
	else cout << "No\n";
	
	return 0;
}


Measured memory_bytes: 3648
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
 
//
// # Examples
//
// # integers
// input! { n: usize, m: usize, ... }
//
// # array
// input! { n: usize, v: [i32; n], }
//
// # matrix
// input! { n: usize, m: usize, mat: [[]] }
//
// # string
// input! { s: chars }
//
// 3 4
// ####
// #..#
// .#.#
//
// input!{
//     h: usize,
//     w: usize,
//     board: [chars; h],
// }
 
// https://practice.contest.atcoder.jp/tasks/practice_1

use std::collections::HashSet;

fn num_to_digits(n: i32) -> Vec<u32> {
    n.to_string().chars().map(|d| d.to_digit(10).unwrap()).collect::<Vec<u32>>()
}

fn main() {
    input!{
        n: i32,
    }
    let mut ret: i32 = 0;
    for &x in &[3,5,7] {
        dfs(x, n as usize, &mut ret);
    }
    println!("{}", ret);
}

fn dfs(x: usize, n: usize, ret: &mut i32) {
    if x > n { return; }
    let nums = num_to_digits(x as i32);
    let mut uniq :HashSet<u32> = HashSet::new();
    for &i in nums.iter() {
        uniq.insert(i);
    }
    if uniq.len() == 3 {
        *ret += 1;
    }
    for &i in &[3,5,7] {
        dfs(10*x + i, n, ret);
    }
}

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

using namespace std;
using ll = long long;
using vl = vector<ll>;
using pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0, xxx_rep_end = (n); i < xxx_rep_end; ++i)
#define all(x) (x).begin(), (x).end()

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

constexpr ll INF = 0x3f3f3f3f3f3f3f3fLL;
constexpr ll mod = 1000000007;

int main() {
    string S;
    cin >> S;

    const ll N = S.size(); for (int i = 0; i < N / 2; ++i) {
        if (S[i] != S[N - 1 - i]) {
            cout << "No" << endl;
            return 0;
        }
    }

    for (int i = 0; i < (N - 1) / 2 - 1; ++i) {
        if (S[i] != S[(N - 1) / 2 - 1 - i]) {
            cout << "No" << endl;
            return 0;
        }
    }

    for (int i = (N + 3) / 2 - 1; i < N; ++i) {
        if (S[i] != S[N - 1 - i]) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
}

Measured memory_bytes: 3628
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!
 
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize ("Ofast,unroll-loops,-ffloat-store,no-stack-protector")
// #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")

#include <bits/stdc++.h>
using namespace std;

string to_string(const string& s) { return '"' + s + '"'; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cout << " " << to_string(H);
    debug_out(T...);
}
#ifdef LOCAL
    #define debug(...) cout << "#" << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
    #define debug(...) 3
#endif
 
#define cin_exception cin.exceptions(cin.failbit);
#define cout_precision cout.setf(ios::fixed); cout.precision(15);
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
using ld = long double;  using ui = uint_fast32_t;
using ll = int_fast64_t; using ul = uint_fast64_t;

// -----------------------------------------------------------------------------

void solve() {
    int s, w;
    cin >> s >> w;
    if (w >= s) {
        cout << "unsafe\n";
    } else {
        cout << "safe\n";
    }
}

// -----------------------------------------------------------------------------

int main() {
    fast_io; // cout_precision;
#ifdef LOCAL
    cin_exception;
#endif
    int t = 1;
    // cin >> t;
    for (int i = 1; i <= t; ++i) {
        solve();
    }
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int cot=0;
ll n,p,a[10000005];
bool judge(ll m)
{
    ll ans=1;
    ll t=n;
    while(t)
    {
        if(m>p) return false;
        if(t&1) ans*=m;
        if(ans>p||p%ans) return false;
        if(m>1e8&&(t>>1)) return false;
        m*=m;
        t>>=1;
    }
    if(p%ans) return false;
    return true;
}
int main()
{
    a[cot++]=1;
    scanf("%lld%lld",&n,&p);
    ll k=sqrt(p);
    for(int i=1;i<=k;i++)
        if(p%i==0)
        {
            a[cot++]=i;
            a[cot++]=p/i;
        }
    sort(a,a+cot);
    ll ans=1;
    for(int i=cot-1;i>=0;i--)
    if(judge(a[i])) {ans=a[i];break;}
    printf("%lld\n",ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <numeric>

int main() {
    int n, m;
    std::cin >> n >> m;
    
    std::vector<int> cards(n * 2);
    std::iota(cards.begin(), cards.end(), 1);
    
    for (int i = 0; i < m; ++i) {
        int k;
        std::cin >> k;
        if (k == 0) {
            for (auto&& v : cards)
                v = (v <= n ? v*2 - 1 : (v - n)*2);
        }
        else {
            for (auto&& v : cards)
                v = (v <= k ? v + n*2 - k : v - k);
        }
    }
    
    std::map<int, size_t> output;
    for (size_t i = 0; i < cards.size(); ++i)
        output[cards[i]] = i + 1;
    
    for (auto&& p : output)
        std::cout << p.second << std::endl;
}

Measured memory_bytes: 3052
from collections import deque
while 1:
    n, a, s, g = map(int, raw_input().split())
    if n == a == s == g == 0:
        break
    G = [[] for i in xrange(n)]
    H = [[] for i in xrange(n)]
    for i in xrange(a):
        x, y, lab = raw_input().split()
        x = int(x); y = int(y)
        G[y].append((x, lab))
        H[x].append(y)
    can = [0]*n
    deq = deque()
    can[s] = 1
    deq.append(s)
    while deq:
        v = deq.popleft()
        for t in H[v]:
            if not can[t]:
                can[t] = 1
                deq.append(t)

    state = [None]*n
    state[g] = ""
    step = 0; prev_s = None; LIM = 5*n+1; ok = 0
    for c in xrange(LIM*2):
        update = 0
        for v in xrange(n):
            if state[v] is None or not can[v]:
                continue
            for t, l in G[v]:
                if state[t] is None or l + state[v] < state[t]:
                    state[t] = l + state[v]
                    update = 1
        if prev_s == state[s]:
            step += 1
        else:
            prev_s = state[s]
            step = 0
        if step == LIM:
            ok = 1
            break
    if state[s] is None or not ok:
        print "NO"
    else:
        print state[s]

Measured memory_bytes: 7628
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define REP(var, s, n) for (int var = (s); var < (n); ++var)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()

class UnionFind {
 protected:
  vector<int> data;

 public:
  UnionFind(int size) : data(size, -1) {}

  bool unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x != y) {
      if (data[y] < data[x]) {
        swap(x, y);
      }
      data[x] += data[y];
      data[y] = x;
    }
    return x != y;
  }

  bool same(int x, int y) { return root(x) == root(y); }

  int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }

  int size(int x) { return -data[root(x)]; }
};

int main() {
  //
  int n, m;
  cin >> n >> m;
  UnionFind uf(n);
  vi p(n);
  rep(i, n) {
    cin >> p[i];
    p[i]--;
  }
  rep(i, m) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    uf.unite(x, y);
  }
  int cnt = 0;
  rep(i, n) {
    if (uf.same(p[i], i)) {
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

     static Scanner scanner;

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

         long N=gl();
         long a=gl();
         long b=gl();
         long ans=modpow(2,N,1000000007)-1;
         long nca=1;
         long ncb=1;
         a=Math.min(a, N-a);
         b=Math.min(b, N-b);
         long now=N;
         while(now>N-a) {
        	 nca*=now;
        	 nca=nca%1000000007;
        	 now--;
         }

         now=a;
         while(now>0) {
        	 nca*=modpow(now, 1000000005, 1000000007);
        	 nca=nca%1000000007;
        	 now--;
         }

         now=N;
         while(now>N-b) {
        	 ncb*=now;
        	 ncb=ncb%1000000007;
        	 now--;
         }

         now=b;
         while(now>0) {
        	 ncb*=modpow(now, 1000000005, 1000000007);
        	 ncb=ncb%1000000007;
        	 now--;
         }
         ans=(ans+2*1000000007-nca-ncb)%1000000007;

         System.out.println(ans);
     }

  // a^nをmodで割ったあまり
 	public static long modpow(long a, long n, long mod) {
 		long res=1;
 		while(n>0) {
 			if((n & 1) == 1) res=res*a%mod;
 			a=a*a%mod;
 			n=n>>1;
 		}

 		return res;
 	}

     public static long f(long n) {
    	 if(n==1)return 1;
    	 return 2*f(n>>1);
     }

     // 文字列として入力を取得
     public static String gs() {
          return scanner.next();
     }

     // intとして入力を取得
     public static int gi() {
          return Integer.parseInt(scanner.next());
     }

     // longとして入力を取得
     public static long gl() {
          return Long.parseLong(scanner.next());
     }

     // doubleとして入力を取得
     public static double gd() {
          return Double.parseDouble(scanner.next());
     }
}

Measured memory_bytes: 35544
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define PI 3.14159265358979323846
#define int64 long long
#define uint64 unsigned long long
#define coutfix(i) cout << fixed << setprecision(i)		//coutの浮動小数出力の桁数設定
using namespace std;

int main()
{
	int64 rr;
	cin >> rr;
	cout << (3 * rr * rr) << endl;
	return 0;
}

Measured memory_bytes: 3548
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cstring>
using namespace std;

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define DEB 0
#define all(x) x.begin(), x.end()


const int s1[] = {1,0,0,2}; // north, east, south, west
const int s2[] = {0,2,1,0};
void dieswap(int *die, int k){
  int t;
  t = die[s1[k]];
  die[s1[k]] = 7-die[s2[k]];
  die[s2[k]] = t;
}

int main(){
  int n;
  char in[8];
  const char *dirstr[] = {"north", "east", "south", "west"};
  while(scanf(" %d ",&n),n){
    int die[] = {1,5,4}; // top, south, east
    rep(i,n){
      scanf("%s",in);
      rep(k,4){
	if( !strcmp(in,dirstr[k]) ){
	  dieswap(die,k);
	}
      }
    }
    printf("%d\n",die[0]);
#if DEB
    printf("{%d,%d,%d}\n",die[0],die[1],die[2]);
#endif
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    ll a, b, c, d;
    cin >> a >> b >> c >> d;

    ll ans = max({a * c, a * d, b * c, b * d});

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

Measured memory_bytes: 3636
#ifdef __cplusplus
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
#else
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#endif

#define rep(i,n) for(ll i = 0; i < (n); ++i)
#define rep1(i, n) for(ll i = 1; i < (n); ++i)
#define rep4(i, start, end, step) for (ll i = (start); i < (end); i += (step))

#define BIG_PRIME 1000000007
#define BP_remainder(x) ((x) % BIG_PRIME)

#define INF (1 << 30)
#define INF_NEG (INF * -1)
#define INF_LONG (1LL << 62)
#define INF_LONG_NEG (INF_LONG * -1L)

typedef long long ll;
typedef char str255[256];
ll StrLen(char *s) { for(ll ptr = 0L;; ++ptr) if(!s[ptr]) return ptr; } 
// char * の後ろから n 文字削除, 削除後の文字数を返す
ll StrDel(char *s, int n) { ll l = StrLen(s); s[l - n + 1L] = '\0'; return l - n; }

ll NumDigits(ll l){ char s[30]; sprintf(s, "%lld", l); return StrLen(s); }

int is1stAns = 1;
void printI(int    i) { if (is1stAns) printf(  "%d", i), is1stAns = 0; else printf(  " %d", i); }
void printL(ll     l) { if (is1stAns) printf("%lld", l), is1stAns = 0; else printf(" %lld", l); }
void print (ll     l) { if (is1stAns) printf("%lld", l), is1stAns = 0; else printf(" %lld", l); }
void printD(double d) { if (is1stAns) printf("%.9f", d), is1stAns = 0; else printf(" %.9f", d); }
void printC(char   c) { if (is1stAns) printf(  "%c", c), is1stAns = 0; else printf(  " %c", c); }
void printS(char  *s) { if (is1stAns) printf(  "%s", s), is1stAns = 0; else printf(  " %s", s); }

#ifndef __cplusplus // C 版 min, max
ll min(ll a, ll b){ if (a < b) return a; else return b; }
ll max(ll a, ll b){ if (a > b) return a; else return b; }
#endif
#define chmin(a, b) func_chmin(&(a), (b))
void func_chmin(ll *a, ll b) { if (*a > b) *a = b; }
#define chmax(a, b) func_chmax(&(a), (b))
void func_chmax(ll *a, ll b) { if (*a < b) *a = b; }

// 入力用
#ifndef __cplusplus // C の配列動的確保用
#define newchar(n) (char *)malloc(sizeof(char) * (n))
#define newint(n) (int *)malloc(sizeof(int) * (n))
#define newll(n) (ll *)malloc(sizeof(ll) * (n))
#define newstr(n) (str255 *)malloc(sizeof(str255) * (n))
#endif

#define INPUT_LL(x) scanf("%lld", &x)
#define INPUT_CHAR(x) scanf("%c", &c)
#define INPUT_STRING(x) scanf("%s", x)

#define inll(x) ll x; INPUT_LL(x)
#define incc(x) char x; INPUT_CHAR(x)
#define inss(x) str255 x; INPUT_STRING(x)
#ifdef __cplusplus
#define invecll(x, n) vector<ll> x ((n)); rep(i, n) cin >> x [i]
#define inveccc(x, n) vector<char> x ((n)); rep(i, n) cin >> x [i]
#define invecss(x, n) vector<str255> x ((n)); rep(i, n) cin >> x [i]
#else
#define invecll(x, n) ll * x = newll(n); rep(i, n) INPUT_LL(x [i])
#define inveccc(x, n) char * x = newchar(n); rep(i, n) INPUT_CHAR(x [i])
#define invecss(x, n) str255 * x = newstr(n); rep(i, n) INPUT_STRING(x [i])
#endif

#define putll(x) printf("%lld\n", (x))
#define putcc(x) printf("%c\n", (x))

signed main()
{
#ifdef __cplusplus
    cout << fixed << setprecision(9);
#endif

    inll(N); inll(A); inll(B);
    putll(min(N * A, B));

    return 0;
}


Measured memory_bytes: 128
import java.util.*;
import java.math.*;
public class Main {
	static int r; 
	static int c;
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long r = in.nextLong();
		long c = in.nextLong();
		long ans = 0L;
		if(c % 2 == 0) {
			ans += (c / 2) * r;
		}else {
			long cc = c / 2;
			if(r % 2 == 0) {
				ans += (cc) * (r / 2);
				ans += (cc + 1) * (r / 2);
			}else {
				long rr = r / 2;
				ans += cc * rr;
				ans += (cc + 1) * (rr + 1);
			}
		}
		if(r == 1 || c == 1) {
			System.out.println(1);
		}else {
			System.out.println(ans);
		}
	}
} 


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

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


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

    vector<ll> h(n);
    rep(i,n){
        cin>>h.at(i);
    }

    ll sum=0;
    sort(h.begin(),h.end(),greater<ll>());

    for(int i=0;i<n;i++){
        if(i<k) {
            h.at(i) = 0;
        }
        sum += h.at(i);
    }

    cout<<sum<<endl;


}





Measured memory_bytes: 1792