akhauriyash/Code-Regression huggingface dataset:
// Tenshi ni Fureta yo!

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef unsigned int UI;
typedef pair<int, int> pii;

#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define MP make_pair
#define fst first
#define snd second
#define SZ(u) ((int) (u).size())
#define ALL(u) (u).begin(), (u).end()

inline void proc_status()
{
	ifstream t("/proc/self/status");
	cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>()) << endl;
}

template<typename T> inline int chkmin(T &a, const T &b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline int chkmax(T &a, const T &b) { return b > a ? a = b, 1 : 0; }
template<typename T> inline T sqr(const T &val) { return val * val; }

namespace fastIO
{
	const int MAX_BUFFER_SIZE = 1 << 16;

	char buffer[MAX_BUFFER_SIZE], *cur = buffer, *ed = buffer;

	inline char getc() { return *(cur == ed ? ed = buffer + fread(buffer, 1, MAX_BUFFER_SIZE, stdin), cur = buffer : cur)++; }
}
using fastIO::getc;

template<typename T> inline T read()
{
	register T sum(0), fg(1);
	register char ch(getc());
	for(; !isdigit(ch); ch = getc()) if(ch == '-') fg = -1;
	for(;  isdigit(ch); ch = getc()) sum = sum * 10 - '0' + ch;
	return sum * fg;
}

// END tpl.

const int MAXN = 500;

int MOD;

int n;

inline void input()
{
	n = read<int>(), MOD = read<int>();
}

inline void solve()
{
	static pii a[MAXN +5];

	for(int i = 0; i < 2 * n; ++i)
		if(i < n)
		{
			for(a[i].fst = 0; a[i].fst < 2 * n && sqr(a[i].fst) + sqr(i) < sqr(n); ++a[i].fst);
			--a[i].fst;
			for(a[i].snd = 0; a[i].snd < 2 * n && sqr(a[i].snd) + sqr(i) <= sqr(2 * n); ++a[i].snd);
			--a[i].snd;
		}
		else
		{
			for(a[i].fst = 0; a[i].fst < 2 * n && sqr(a[i].fst) + sqr(i) <= sqr(2 * n); ++a[i].fst);
			--a[i].fst;
			a[i].snd = 0;
		}

	sort(a, a + 2 * n);

	auto calc = [&] (int k)
	{
		static int f[MAXN + 5][MAXN + 5];
		memset(f, 0, sizeof f);

		f[0][0] = 1;
		for(int cnt1 = 0, cnt2 = 0, i = 0; i < 2 * n; ++i)
			if(a[i].snd == 0)
			{
				for(int j = 0; j <= n; ++j) (f[i + 1][j] += (LL) f[i][j] * (a[i].fst + 1 - cnt1 - j) % MOD) %= MOD;
				++cnt1;
			}
			else
			{
				for(int j = 0; j <= n; ++j)
				{
					(f[i + 1][j + 1] += (LL) f[i][j] * (a[i].fst + 1 - cnt1 - j) % MOD) %= MOD;
					(f[i + 1][j] += (LL) f[i][j] * (a[i].snd + 1 - (n + cnt2 - j + k)) % MOD) %= MOD;
				}
				++cnt2;
			}
		return f[2 * n][k];
	};

	int ans = 0;
	for(int i = 0; i <= n; ++i) (ans += (i & 1 ? -1 : +1) * calc(i)) %= MOD;
	printf("%d\n", (ans + MOD) % MOD);
}

int main()
{
#ifdef K_ON
	freopen("F.in", "r", stdin);
	freopen("F.out", "w", stdout);
#endif

	input();
	solve();

	return 0;
}




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

vector<int64_t> memo(87, 0);

int64_t luca(int num) {
  if (num == 0) return 2;
  if (num == 1) return 1;
  
  if (memo.at(num) != 0) {
    return memo.at(num);
  }
  memo.at(num) = luca(num-1) + luca(num-2);
  return memo.at(num);
}

int main() {
  int n;
  cin >> n;
  cout << luca(n) << endl;
} 

Measured memory_bytes: 256
#include <stdio.h>
    int main(void)
    {
    char O[999],E[999];
    int i;
    scanf("%s%s", O,E);
    for(i = 0 ; O[i] ; i++)
    {
    if(O[i]>10) putchar(O[i]);
    if(E[i]>10) putchar(E[i]);
    }
    puts("");
    return 0;}

Measured memory_bytes: 128
w = input()
alpha_dic = {}
for i in range(97,97+26):
    alpha_dic[chr(i)] = 0
for character in w:
    alpha_dic[character] +=1
counter = 0
for key in alpha_dic:
    if alpha_dic[key]%2 == 0:
        counter += 1
    else:
        print('No')
        break
if counter == 26:
    print('Yes')
    

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

using namespace std;

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

void Solve() {
    int n, k;
    cin >> n >> k;

    int comb = (n - 1) * (n - 2) / 2;
    if (comb < k) {
        cout << "-1" << endl;
        return ;
    }

    vector<vector<bool>> adj(n, vector<bool>(n, true));
    for (int i = 0; i < n; ++i) adj[i][i] = false;

    for (int i = 1; i < n; ++i) {
        for (int j = 1; j < n; ++j) {
            if (adj[i][j]) {
                --k;
                adj[i][j] = adj[j][i] = false;
            }
            if (k == 0) break;
        }
        if (k == 0) break;
    }

    int m = 0;
    for (int i = 0; i < n; ++i)
        for (int j = i + 1; j < n; ++j)
            if (adj[i][j]) ++m;

    cout << m << endl;
    for (int i = 0; i < n; ++i)
        for (int j = i + 1; j < n; ++j) {
            if (adj[i][j])
                cout << i + 1 << " " << j + 1 << '\n';
        }
}

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    // cout << setprecision(8) << setiosflags(ios::fixed);

    Solve();

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<algorithm>

using namespace std;

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

    if (n < 1000) {
        cout << "ABC" << endl;
    } else {
        cout << "ABD" << endl;
    }


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T> constexpr bool chmax(T &a, const T &b) {
    if(a >= b) return false;
    a = b;
    return true;
}
template <typename T> constexpr bool chmin(T &a, const T &b) {
    if(a <= b) return false;
    a = b;
    return true;
}

/*-------------------------------------------*/

ll n;
ll t[200009];

void mul(ll *a, ll *b) {
    FOR(i, 1, n + 1) t[i] = a[b[i]];
    memcpy(a + 1, t + 1, sizeof(ll) * n);
}

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

    ll a[200009], p[200009];
    cin >> n;
    FOR(i, 1, n + 1) {
        cin >> a[i];
        p[i] = i;
    }

    FORR(i, n) a[i + 1] -= a[i];

    ll m;
    ll k;
    cin >> m >> k;

    rep(i, m) {
        ll x;
        cin >> x;
        swap(p[x], p[x + 1]);
    }

    ll pos[200009];
    FOR(i, 1, n + 1) pos[i] = i;
    while(k > 0) {
        if(k & 1) mul(pos, p);
        mul(p, p);
        k >>= 1;
    }

    FOR(i, 1, n + 1) p[i] = a[pos[i]];
    FOR(i, 1, n + 1) cout << (p[i] += p[i - 1]) << endl;

    return 0;
}

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


int main() {

  	cin.tie(0);
    ios::sync_with_stdio(false);

    int N, i;
    int sum = 0;
    cin >> N;
	for (i = 1; i <= N; ++i){
    sum += i;
    }
    cout << sum << "\n";
}

Measured memory_bytes: 256
X = int(input())

def isSosu(x):
    if x == 2:
        return True
    if x % 2 == 0:
        return False
    for i in range(3, x - 1, 2):
        if x % i == 0:
            return False
    return True

while True:
    if isSosu(X):
        print(X)
        break
    X += 1

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

int main(int argc, char *argv[])
{
  int N, n, sum = 0;
  vector<int> answer;
  
  while(cin >> N, N) {
    for (int i = 0; i < N/4; i++) {
      cin >> n;
      sum += n;
    }
    answer.push_back(sum);
    sum = 0;
  }

  for (int i = 0; i < answer.size(); i++) {
    cout << answer[i] << endl;
  }
  
  return 0;
}

Measured memory_bytes: 2988
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
typedef complex<double> com;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }


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

	string s, t;
	cin >> s >> t;
	int ans = 0;
	rep(i, 3) if (s[i] == t[i]) ans++;
	cout << ans << endl;
}

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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

const double EPS = 1e-14;
const double PI  = acos(-1.0);


int main(){
  string s;

  cin >> s;

  LL w = 0;
  LL ans = 0;
  RREP(i, s.size()) {
    if (s[i] == 'W') w++;
    else ans += w;
  }

  cout << ans << endl;
}


Measured memory_bytes: 640
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

int main(){
  char s[5];
  scanf("%s",s);
  int a,b,c,d,i;
  a=s[0]-'0';
  b=s[1]-'0';
  c=s[2]-'0';
  d=s[3]-'0';
  if(a+b+c+d==7) printf("%d+%d+%d+%d=7",a,b,c,d);
  else if(a+b+c-d==7) printf("%d+%d+%d-%d=7",a,b,c,d);
  else if(a+b-c+d==7) printf("%d+%d-%d+%d=7",a,b,c,d);
  else if(a+b-c-d==7) printf("%d+%d-%d-%d=7",a,b,c,d);
  else if(a-b+c+d==7) printf("%d-%d+%d+%d=7",a,b,c,d);
  else if(a-b+c-d==7) printf("%d-%d+%d-%d=7",a,b,c,d);
  else if(a-b-c+d==7) printf("%d-%d-%d+%d=7",a,b,c,d);
  else if(a-b-c-d==7) printf("%d-%d-%d-%d=7",a,b,c,d);
}

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

int main()
{
	int A, B, C;
	cin >> A >> B >> C;

	string ans = "NO";
	for( int i = 1; i < 100000; i++ ) {
		if( A * i % B == C ) {
			ans = "YES";
			break;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define P 1000000007
using namespace std;
int n;
int a[222];
char s[120000];
int main(){
	scanf("%d",&n);
	scanf("%s",s+1);
	for(int i=1;i<=n;i++)a[s[i]-'a']++;
	int ans=1;
	for(int i=0;i<26;i++)ans=1LL*ans*(a[i]+1)%P;
	ans-=1;
	ans+=P;
	ans-=P;
	printf("%d\n",ans);
}

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

#define PI acos(-1)
#define pb push_back
#define int long long int
#define mp make_pair
#define pi pair<int, int>
#define pii pair<pi, int>
#define fir first
#define sec second
#define MAXN 200001
#define MAXL 20
#define mod 1000000007

signed main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  // c > b > a;
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  int ans = 0;
  while (b <= a)
    ans++, b = b * 2;
  while (c <= b)
    ans++, c = c * 2;
  (ans <= k) ? cout << "Yes\n" : cout << "No\n";
  return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,A,B;
  string S;
  cin >> N >> A >> B;
  cin >> S;
  int a=0,b=0;
  int n=0;
  vector<string> ans;
  for(int i=0;i<N;i++){
  if(S[i]=='a'){ 
    if(n<(A+B)) {n++;a++;ans.push_back("Yes");}
    else ans.push_back("No");
  }
  else if(S[i]=='b'){
    if(n<(A+B) && b<B) {n++;b++;ans.push_back("Yes");}
    else ans.push_back("No");
  }
  else{ans.push_back("No");}
  }
  for(auto s:ans) cout << s << endl;
  return 0;
}


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

int main() {
  
  int a,b,c;
  cin >> a >> b >> c;
  
  if(c >= a && c <= b) cout << "Yes" << endl;
  else cout << "No" << endl;
  
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
template<class T, class Compare = less<T> >
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template<class T, class Compare = greater<T> >
using MinHeap = priority_queue<T, vector<T>, Compare>;
using llong = long long;

llong n, a, b;
llong h[100005];

bool check(llong k) {
    llong t = k;
    for (int i = 0; i < n; i++) {
        llong valid = k;
        llong invalid = -1;

        while (valid - invalid > 1) {
            llong mid = (valid + invalid) >> 1;
            
            if (mid * a + (t - mid) * b >= h[i]) {
                valid = mid;
            }
            else {
                invalid = mid;
            }
        }

        if (valid * a + (t - valid) * b < h[i]) return false;

        k -= valid;
    }

    return true;
}

int main() {

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

    llong valid = 1ll << 31ll;
    llong invalid = -1;
    while (valid - invalid > 1) {
        llong mid = (valid + invalid) >> 1;
        if (check(mid)) {
            valid = mid;
        }
        else {
            invalid = mid;
        }
    }

    cout << valid << endl;

    return 0;
}


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

using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); ++i)
double const PI = 3.1415926535897932384626433;
using P = pair<int, int>;

int main() {
    int a[3][3];
    bool masu[3][3];
    int n;
    rep(i, 3) rep(j, 3) {
        cin >> a[i][j];
        masu[i][j] = false;
    }
    cin >> n;
    rep(i, n) {
        int b;
        cin >> b;
        rep(j, 3) {
            rep(k, 3) {
                if (b == a[j][k])
                    masu[j][k] = true;
            }
        }
    }
    rep(i, 3) {
        if (masu[0][i] && masu[1][i] && masu[2][i]) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    rep(i, 3) {
        if (masu[i][0] && masu[i][1] && masu[i][2]) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    if (masu[0][0] && masu[1][1] && masu[2][2]) {
        cout << "Yes" << endl;
        return 0;
    }
    if (masu[0][2] && masu[1][1] && masu[2][0]) {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <iomanip>
#include <string>
#include <queue>
#include <numeric>
#include <functional>
#include <array>
#include <map>
#include <set>

using namespace std;
using P = pair<int, int>;
using T = tuple<long, long, long>;

long long MOD = 1000000007;
long long dp[100005][4];

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

	int count = 0;
	for (int i = 9; i < 55555; i+=5) {
		int max = sqrt(i);
		bool sosu = true;
		for (int j = 2; j <= max; ++j) {
			if (i%j == 0) {
				sosu = false;
				break;
			}
		}
		if (sosu) {
			cout << i << " ";
			count++;
		}
		if (N <= count)return 0;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define vector2(a,b,c) vector<vector<int>> a(b/*縦！w*/,vector<int>(c/*横！w*/))
#define INF 1e10
#define MOD 1e9+7
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
signed main(){
  int a,b;
  cin>>a>>b;
  int c=min(a,b);
  int d=max(a,b);
  rep(i,d)
    cout<<c;
}

Measured memory_bytes: 256
#include <iostream>
#include <bitset>

using namespace std;

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

    string S[H];
    for(int i=0; i<H; i++){
        cin >> S[i];
    }

    int ans = 1000000005;
    for(int div=0; div<1<<(H-1); div++){
        int g = 1;
        int id[H];
        for(int i=0; i<H-1; i++){
            id[i] = g-1;
            if(div>>i & 1) g++;
        }
        id[H-1] = g-1;

        int c[g][W];
        for(int i=0; i<g; i++){
            for(int j=0; j<W; j++){
                c[i][j] = 0;
            }
        }
        for(int i=0; i<H; i++){
            for(int j=0; j<W; j++){
                if(S[i][j] == '1') c[id[i]][j]++;
            }
        }

        bool f = true;
        for(int i=0; i<g; i++){
            for(int j=0; j<W; j++){
                if(c[i][j] > K) f = false;
            }
        }
        if(!f) continue;

        int num[g];
        fill(num, num+g, 0);
        int ta = g-1;
        for(int i=0; i<W; i++){
            bool fl = true;
            for(int j=0; j<g; j++){
                if(num[j]+c[j][i] > K){
                    fl = false;
                    break;
                }
                num[j] += c[j][i];
            }
            if(!fl){
                ta++;
                for(int j=0; j<g; j++){
                    num[j] = c[j][i];
                }
            }
        }
        ans = min(ans, ta);
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;

typedef long long lint;

lint sum[1000009];

lint a[1000001];

lint v[1000009][2];
lint n;
lint  k;

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

    for(lint i = 1; i <= n; i ++)
    {
        cin >> a[i];
        sum[i] = sum[i - 1] + a[i];
    }

    lint i, j;
    lint cr = 0;
    for(i = 1; i <= n; i ++)
    {
        for(lint j = i + 1; j <= n; j ++)
        {
            v[++ cr][0] = sum[j] - sum[i - 1];
        }
    }

    lint rez = 0;
    lint CR = 0;
    lint kant = cr;
    for(lint p = 60; p >= 0; p --)
    {
        lint k2 = 0;
        for(lint i = 1; i <= kant; i ++)
        {
            if((v[i][CR] & (1LL << p)) != 0)
            {
                v[++ k2][1 - CR] = v[i][CR];
            }
        }

       // cout << k2 << " " << k << " < < "\n";

        if(k2 >= k)
        {
            rez += (1LL << p);
            CR = 1 - CR;
            kant = k2;
        }
    }

    cout << (rez) << "\n";

    return 0;
}


Measured memory_bytes: 12544
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>
 
#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--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> P;
typedef long long int ll;
typedef pair<ll,ll> LLP;
#define INF 1000000007
 
#define ARRAY_MAX 100005

int n;
int d[3] = {3,5,7};
int ans = 0;
int len = 0;

void dfs(int now,int sum){

    string s = to_string(sum);
    if(sum > n || s.length() > len){
        return;
    }

    bool three = false,five = false,seven = false;
    REP(i,s.length()){
        if(s[i] == '3'){
            three = true;
        }
        if(s[i] == '5'){
            five = true;
        }
        if(s[i] == '7'){
            seven = true;
        }
    }

    if(three && five && seven){
        ans++;
    }


    REP(i,3){
        dfs(now+1,sum*10 + d[i]);
    }

}
 
int main(){

    cin >> n;
    string tmp = to_string(n);
    len = tmp.length();
    dfs(0,0);
    cout << ans << endl;

    return 0;
}

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

int main(){
    int x,n,i,j,sum=0;
    string s;
    cin>>n>>s;
    for(i=0;i<n;i++){
        for(j=i+1,x=0;s[i]==s[j];j++,x++){
        }
        i=i+x;sum++;
    }
    cout<<sum;
    return 0;
}



Measured memory_bytes: 512
while True:
  n,x=map(int,input().split())
  if n==0:break
  ans=0
  for i in range(1,n+1):
    for j in range(i+1,n+1):
      for k in range(j+1,n+1):
        if i+j+k==x:ans+=1
  print(ans)


Measured memory_bytes: 5592
//abc113_b.cpp
//Sat Nov 10 12:21:07 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	int n;
	double t,a;
	cin >> n >> t >> a;

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

	double dif = a-t+h[0]*0.006;
	if (dif < 0){
		dif = dif * (-1);
	}
	int ans = 1;

	for (int i=1;i<n;i++){
		double temp = a-t+h[i]*0.006;
		if (temp < 0){
			temp = temp * (-1);
		}
		if (dif > temp){
			dif = temp;
			ans = i+1;
		}
	}


	cout << ans << endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
#define SEGMAX 131072
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
//重み付きグラフの場合
//隣接リストを格納する構造体
struct listc{
	ll to;
	ll cost;
};
vector<vector<listc>> LC1(100000), LC2(100000), LC;
vector<ll> Dist1(100000, 1e9), Dist2(100000, 1e9);
//頂点数n, 枝数mのグラフの入力(重み付き)
void Graph_Input_cost(int n, int m)
{
	for(int i=0; i<m; i++){
		ll from, to, cost, cost2;
		cin>>from>>to>>cost>>cost2;
		from--; to--;
		listc e;

		e.to=to; e.cost=cost;
		LC1[from].push_back(e);
		e.cost=cost2;
		LC2[from].push_back(e);

		e.to=from; e.cost=cost;
		LC1[to].push_back(e);
		e.cost=cost2;
		LC2[to].push_back(e);
	}
}
//Dijkstra法(sは始点, nは頂点数)
vector<ll> Dijkstra(int s, int n)
{
	//greater<pair>を指定することでfirstが小さい順に取り出せるようにする
	priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> que;

	vector<ll> Dist(n, 1e18);

	//始点へのコストは0
	Dist[s]=0;
	que.push(pair<int, int>(0, s));

	//queが空になるまでループ
	while(!que.empty()){
		//queの先頭要素(節点)を取り出す
		pair<int, int> p=que.top(); que.pop();
		int v=p.second;
		//取り出した要素が最短コストでなければ何もしない
		if(Dist[v]<p.first) continue;

		//vに接続している節点へのコストを計算し，queにpushする
		for(int i=0; i<LC[v].size(); i++){
			listc e=LC[v][i];
			if(Dist[e.to]>Dist[v]+e.cost){
				Dist[e.to]=Dist[v]+e.cost;
				que.push(pair<int, int>(Dist[e.to], e.to));
			}
		}
	}
	return Dist;
}
int main(void)
{
	ll n, m, s, t;

	cin>>n>>m>>s>>t;

	Graph_Input_cost(n, m);

	LC=LC1;
	Dist1=Dijkstra(s-1, n);

	LC=LC2;
	Dist2=Dijkstra(t-1, n);

	vll p(n), min(n);

	rep(i, n) p[i]=Dist1[i]+Dist2[i];

	ll minp=1e18;
	reprev(i, n){
		if(minp>p[i]){
			minp=p[i];
		}
		min[i]=minp;
	}
	rep(i, n){
		cout<<(ll)(1e15-min[i])<<endl;
	}
}


Measured memory_bytes: 26848
import Data.List.Split

calc :: Int -> Int -> Int -> String
calc a b x
		| (a + b) < x = "NO"
		| a > x = "NO"
		| otherwise = "YES"

main = do
	str <- getLine
	let str' = splitOn " " str
	let nums = map (read :: String -> Int) str'
	let a = nums !! 0
	let b = nums !! 1
	let c = nums !! 2
	putStrLn $ calc a b c

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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b)-1; i >= (a); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second

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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pii> vii;

int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin.exceptions(cin.failbit);

  int n;
  cin >> n;

  int tot = 0;
  vector<string> bracks;
  rep(i,0,n) {
    string s;
    cin >> s;
    bracks.pb(s);
    rep(j,0,sz(s))
      if (s[j] == ')') --tot;
      else ++tot;
  }

  if (tot != 0) return cout << "No\n", 0;

  vii pos, neg;
  rep(i,0,n) {
    int t = 0;
    int mt = 0;
    for (auto c: bracks[i]) {
      if (c==')') {
        --t;
        ckmin(mt,t);
      }
      else ++t;
    }

    if (t <= 0) {
      neg.eb(-mt, -t);
    } else {
      pos.eb(mt, t);
    }
  }

  sort(all(pos));
  priority_queue<int, vector<int>, greater<int>> pq;

  auto ad = [&]() {
    while (not pos.empty() and -pos.back().fst <= tot) {
      pq.push(pos.back().snd);
      pos.pop_back();   
    }
  };

  ad();
  while (not pq.empty()) {
    int u = pq.top(); pq.pop();
    tot += u;
    ad();
  }

  sort(all(neg), [&](pii a, pii b) { return a.fst-a.snd > b.fst-b.snd; });
  bool suc = pos.empty();
  for (auto [mn, tk] : neg) {
    suc &= mn <= tot;
    tot -= tk;
  }

  if (suc) cout << "Yes\n";
  else cout << "No\n";

}

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

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

    string s = "No";
    for(int i = 0; i <= N; i++){
        for(int j = 0; j <= N; j++){
            if(N == 4*i + 7*j){
                s = "Yes";
            }
        }
    }
    if(s == "No"){
        cout << s << endl;
    }else{
      	cout << s << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5+5;
const int mod = 1e9+7;
ll qpow(ll a,ll b){ll res=1;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

int main()
{
    string a;
    cin>>a;
    if(a=="ARC")cout<<"ABC"<<endl;
    else cout<<"ARC"<<endl;
    return 0;
}


Measured memory_bytes: 3552
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(){
    char s[11];
    scanf("%s",s);

    int i,j;

    long long ans=0;
    long long tmp;
    for(i=0;i<( 1 << ( strlen(s) - 1 ) );i++){
        tmp = s[0] - '0';
        for(j=0;j<( strlen(s) - 1 );j++){
            if( i & ( 1 << j ) ){
                ans += tmp;
                tmp = 0;
            }
            tmp = tmp*10 + (s[j+1] - '0');
        }
        ans += tmp;
    }

    printf("%lld",ans);

    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000
#define LLINF 1e18

void solve_abc_a() {
	ll n, m;
	//ll x, y;
	ll a, b, d;
	ll c;
	//char c;
	ll h, w;
	ll k;
	string s, t;
	ll l_ans = 0;
	string s_ans = "NG";
	ll l, r;

	cin >> n;

	l_ans = pow(2, (ll)log2(n));

	cout << l_ans << "\n";

	return;
}


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

	solve_abc_a();

	return 0;
}


Measured memory_bytes: 3984
#include<bits/stdc++.h>
#define N 500005
using namespace std;
int n,a[N],ans;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	sort(a+1,a+n+1);reverse(a+1,a+n+1);
	for(int i=1;i<=n;i++) if(i+1>a[i+1]){
		for(int j=i+1;a[j]==i;j++) ans^=1;
		ans|=(a[i]-i)&1;
        if (ans) puts("First");
        else puts("Second");
		return 0;
    }
	return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int main(){
  int a,b,c,d,e,f;
  scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
  int ans1=0,ans2=0;double rate=0.0;
  for(int i=0;i*100*a<=f;++i){
    for(int j=0;j*100*b+i*100*a<=f;++j){
      if(i+j==0)continue;
      int sum=j*100*b+i*100*a;
      int lim=min(sum/100*e,f-sum);
      for(int k=0;k*c<=lim;++k){
	int l=(lim-k*c)/d;
	int sugar=l*d+k*c;
	if(double(sugar)/sum>rate){
	  rate=double(sugar)/sum;
	  ans1=sum+sugar;ans2=sugar;
	}
      }
    }
  }
  if(rate==0)printf("%d %d\n",100*a,0);
  else printf("%d %d\n",ans1,ans2);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,m,ans,kakuninn;
  ans=0;
  cin>>n>>m;
  vector<int> hantei(m);
  vector<vector<int>> vec(m,vector<int>(n+1));
  for(int i=0; i<m; i++){
    cin>>vec.at(i).at(0);
    for(int j=1; j<=vec.at(i).at(0); j++){
      cin>>vec.at(i).at(j);
    }
  }
  for(int i=0; i<m; i++){
    cin>>hantei.at(i);
  }
  for (int bit = 0; bit < (1<<n); ++bit){
    for(int i=0; i<m; i++){
      kakuninn=0;
      for(int j=1; j<=vec.at(i).at(0); j++){
        if(bit & (1<<vec.at(i).at(j)-1) ){
          kakuninn++;
          
        }
      }
      kakuninn=kakuninn%2;
      
      if(kakuninn!=hantei.at(i) ){
        
        break;
      }
      if(i==m-1){
        ans++;
        
        
      }
    }
  }
  cout<<ans;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int A = 0;
    int H = 0;
    int sum = 0;
    scanf("%d %d",&H,&A);
    while(H > 0){
        sum += 1;
        H = H-A;
    }
    printf("%d",sum);
    return 0;
}

Measured memory_bytes: 128
/**Bismillahir Rahmanir Rahim  *///{
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using ull = unsigned long long; using ld = long double;
const ll llinf = (1ll<<61)-1;
const double eps = 1e-6, ldeps = 1e-9;
#define im(a, b) if (a>=b) a -= b; else if (a<0) a += b;
struct Dbg {
static constexpr auto &os = cout;   // replace by cerr in interactive.
template<class C> static auto dud(C *x)->decltype(os << *x, 0);
template<class C> static char dud(...);
template<class C> typename enable_if<sizeof dud<C>(0)!=1, Dbg&>::type operator<<(const C &x) { os << x; return *this; }
template<class C> typename enable_if<sizeof dud<C>(0)==1, Dbg&>::type operator<<(const C &x) {
    *this << "\n[";
    for (auto &elem : x) *this << elem << ", ";
    return *this << "]";
}
template<class B, class C> Dbg &operator <<(const pair<B, C> &x) {
    return *this << "{" << x.first << ", " << x.second << "}";
}
Dbg &operator<<(ostream&(*x)(std::ostream&)) { os << x; return *this; }
} dbg;
void err(istringstream *iss) { delete iss; }
template<class C, class... Args> void err(istringstream *iss, const C &val, const Args &... args) {
    string name; *iss >> name; if (name.back()==',') name.pop_back();
    dbg << name << " = " << val << "; ", err(iss, args ...);
}
#define bug(args...) dbg << __LINE__ << ": ", err(new istringstream(string(#args)), args), dbg << endl
#define sl(a) int(strlen(a))
#define sz(a) int(a.size())
int n, m, K, T, Q, cn;//}
const int inf = 1000000007, mxn = 100005;

int a[mxn], dp[mxn], mx;

int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.precision(10);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    for (int i = n; i >= 1; i--) {
        dp[i] = (a[i+1]<=a[i] ? dp[i+1]+1 : 1);
        mx = max(mx, dp[i]);
    }
    cout << mx-1 << '\n';
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
using namespace std;
#define rep(i,n), for(int i=0;i<n;i++)





int main(void){
    // 自分の得意な言語で
    // Let's チャレンジ！！
    char c;
    int ans =0;
    for(int i=0;i<4;i++){
        cin>>c;
        if(c=='+'){
            ans++;
        }else{
            ans--;
        }
    }
    cout << ans << endl;
    


    return 0;
}


//3 人は同時に、他の 2 人の持っている整数の和を求める。
//その後、自分の持っている整数を求めた整数で置き換える。

Measured memory_bytes: 256
from bisect import bisect_right
# 入力
A, B, Q = map(int, input().split())
s = [int(input()) for _ in range(A)]
t = [int(input()) for _ in range(B)]
x = [int(input()) for _ in range(Q)]

# 計算の便宜のため番兵を導入
INF = 10 ** 18
S = [-INF] + s + [INF]
T = [-INF] + t + [INF]


# 指定した変位に対する問に二分探索を用いて回答
def f(y):
    i = bisect_right(S, y)
    j = bisect_right(T, y)
    return min(
        abs(b - a) + min(abs(a - y), abs(b - y))
        for a in (S[i - 1], S[i])
        for b in (T[j - 1], T[j])
    )


# 各問に対して、fにより解を得る
ans = '\n'.join(map(str, map(f, x)))

# 出力
print(ans)


Measured memory_bytes: 25476
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
        
        while(true){
        	int H=sc.nextInt();
        	int W=sc.nextInt();
            if(H==0&&W==0)
                break;
        
        	for(int i=0;i<H;i++){
        		for(int j=0;j<W;j++){
                    if(i%2==1&&j%2==0||i%2==0&&j%2==1)
                    	System.out.print(".");
                    else
                        System.out.print("#");
            	}
           	 System.out.println();
            }
            System.out.println();
        }
	}
}



Measured memory_bytes: 34864
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 
    int n, h,nw, katanas;
    cin>>n>>h;
    int w[n], t[n], st=0, nt=0, lw=0;
    for(int i=0;i<n;i++){
        cin>>w[i]>>t[i];
        if(w[i]>lw)
            lw=w[i];
    }
    sort(t,t+n);
    for(int i=n-1; i>=0; i--){
        if(t[i]>=lw&&st<h){
            st+=t[i];
            nt++;
        }else
        break;
    }
    if(st>=h){
        cout<<nt;
    }
    else{
     nw=(h-st)/lw;

     katanas=nw+nt;
        if(nw*lw+st>=h)
        cout<<katanas;
        else cout<<katanas+1;
    }
	return 0;
}

Measured memory_bytes: 1024
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    let s: String = read();
    let s = s.chars().collect::<Vec<_>>();
    if (s[0] != s[s.len() - 1]) ^ (s.len() % 2 == 0) {
        println!("First");
    } else {
        println!("Second");
    }
}


Measured memory_bytes: 4352
## C - Build Stairs
N = int(input())
H = list( map(int, input().split()) )
if N == 1:
    print('Yes')
else:
    for n in range(N-1):
        if H[n+1] - H[n] < 0:
            print('No')
            break
        else:
            if H[n] < H[n+1]:
                H[n+1] -= 1
    else:
      print('Yes')

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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<ll> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}


bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
//typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;


typedef pair<string, string> P;

map<P, ll> check(int n, string &s) {
    map<P, ll> ans;
    rep(i, 1 << n) {
        string a, b;
        rep(j, n) {
            if ((i >> j) & 1) a.push_back(s[j]);
            else b.push_back(s[j]);
        }
        ans[P(a, b)]++;
    }
    return ans;
}

int main() {
    int n;
    string s;
    cin >> n >> s;

    string a = s.substr(0, n);
    string b = s.substr(n);

    map<P, ll> m1 = check(n, a);
    reverse(b.begin(), b.end());
    map<P, ll> m2 = check(n, b);

    ll ans = 0;
    for (auto &e : m1) {
        ll now = e.second * m2[e.first];
        ans += now;
    }
    cout << ans << endl;


}


Measured memory_bytes: 89664
a,b,k = map(int,input().split())

if (b - a + 1) >= 2*k:
    for i in range(a,a+k):
        print(i)
    for j in range(b-k+1,b+1):
        print(j)
    
else:
    for i in range(a,b+1):
        print(i)

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

signed main() {
  int n, d, x; cin >> n >> d >> x;
  int cnt = 0;

  for(int i = 0; i < n; i++) {
    int a; cin >> a;
    int loop = 0;
    while(true) {
      if(loop*a + 1 > d) break;
      loop++;
      cnt++;
    }
  }
  cout << cnt + x << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())

def divisor(n):
    cd = []
    i = 1
    while i*i <= n:
        if n%i==0:
            cd.append(i)
            if i != n//i:
                cd.append(n//i)
        i+=1
    return cd

cd = divisor(N)
ans = len(str(cd[-1]))
print(ans)




Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define ll long long
#define ld long double
#define vpll vector<pair<ll,ll> >
#define vpii vector<pair<int,int> >
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mem(a,b) memset(a , b , sizeof a );
#define M 1000000007
#define bs(a,b,x) binary_search(a,b,x)
template<typename T>
T fact(T n)
{
    // to find factorial
    return (n==1 || n==0) ? 1: n * fact(n - 1);
}
bool sortbysec(const pair<int,int> &a, const pair<int,int> &b)
{
    return (a.second < b.second);
}

void dfs(vector<int> adj[],int s,bool vis[])
{
 vis[s]=true;
 for(int i=0;i<adj[s].size();i++)
 {
  if(vis[adj[s][i]]==false)
  {
   dfs(adj,adj[s][i],vis);
  }
 }
}

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n,m;
    cin>>n>>m;
    vector<int> adj[n+1];
    for(int i=0;i<m;i++)
    {
     int s,f;
     cin>>s>>f;
     adj[s].push_back(f);
     adj[f].push_back(s);
    }
    
    bool vis[n+1];
    for(int i=1;i<n+1;i++) vis[i]=false;
    
    int c=0;
    for(int i=1;i<n+1;i++)
    {
        if(vis[i]==false) 
        {
            dfs(adj,i,vis);
            c++;
        }
    }
    
    cout<<c-1<<endl;
    
    return 0;
}

Measured memory_bytes: 10088
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(max(a * c, a * d),max(b * c, b * d)) << endl;
}

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

int main()
{
	int n,d[100];
	cin>>n;
	for(int i=0;i<n;i++) cin>>d[i];
	
	int v=n;
	for(int i=0;i<n-1;i++){
		for(int j=i+1;j<n;j++){
			if(d[i]==d[j]){
				v--;
				break;
			}
		}
	}
	
	cout<<v<<endl;
	
	return 0;
}


Measured memory_bytes: 256
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
#define chmax(x,y) (x = max(x, y))
//  cout.precision(15); cout << fixed;

template<class T1, class T2>
T1 intpow(const T1& a, const T2 n) {
  if (n == 0) return 1;
  auto t = intpow(a, n / 2);
  t = t * t;
  if (n & 1) t = t * a;
  return t;
}

int main() {
  int n, k; cin >> n >> k;
  cout << k * intpow(k-1, n-1) << endl;
  return 0;
}


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

int main(){
	int N;
	cin>>N;
	vector<int> arr;
	int tmp;
	for(int i=0;i<N;++i){
		cin>>tmp;
		arr.push_back(tmp);
	}
	sort(arr.begin(),arr.end());
	int min,max;
	min=arr[0];
	max=arr[arr.size()-1];
	long ans=1000000;
	for(int i=min;i<=max;++i){
		int tmpans=0;
		for(int j=0;j<N;++j){
			tmpans+=(arr[j]-i)*(arr[j]-i);
		}
		if(ans>tmpans)ans=tmpans;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>

void judge(int pm, int pe, int pj){
	char class;
	if(pm==100 || pe==100 || pj==100)class='A';
	else if(pm + pe >= 180)class='A';
	else if(pm + pe + pj >= 240)class='A';
	else if(pm + pe + pj >= 210)class='B';
	else if(pm + pe + pj >= 150 && (pm >= 80 || pe >= 80))class='B';
	else class='C';
	printf("%c\n",class);
}
int main(void){
	int n,pm,pe,pj;
	
	while(1){
		scanf("%d", &n);
		if(n==0)break;
		while(n--){
			scanf("%d%d%d", &pm, &pe, &pj);
			judge(pm, pe, pj);
		}
	}
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#ifdef _IS_LOCAL //
#define dout cout
#define debug() if(true)
#else
#define dout if(false) cout
#define debug() if(false)
#endif//
#define next asdnext
#define prev asdprev
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define vrep(i, v) for(auto &i : v)
#define all(x) (x).begin(),(x).end()
#define vout(v) for(auto &i:v){cout<<i<<" ";}cout<<"\n"; //配列出力
#define vin(v) for(auto &i:v)cin>>i; //配列入力
#define vec(v,n) vector<int> v(n,0);
typedef long long ll;
typedef unsigned long long ull;

void Main() {
	int N,A,B;
	cin>>N>>A>>B;
	cout<<min((N*A), B)<<"\n";

}

int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << std::fixed << std::setprecision(15);
	Main();
	return 0;
}


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

int main() {

	string s;
	cin >> s;
	int ini = 0;
	int fim = s.size()-1;

	while(ini<s.size()) {
		if(s[ini]=='A')	break;
		ini++;
	}
	while(fim >=0) {
		if(s[fim]=='Z')	break;
		fim--;
	}
	cout << fim-ini+1 << endl;
	
}

Measured memory_bytes: 640
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;
import java.util.Set;


public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();


		Set<Integer> adj[] = new HashSet[n+1];
		for(int i = 1; i<adj.length; i++) {
			adj[i] = new HashSet<Integer>();
		}


		for(int i = 0; i < m; i++) {
			int a = scan.nextInt();
			int b = scan.nextInt();

			adj[a].add(b);
			adj[b].add(a);
		}

		int[] dist = new int[n+1];
		dist[0] = 0;
		int[] ans = new int[n+1];

		Set<Integer> endcheck = new HashSet<>();
		endcheck.add(1);
		Set<Integer> start = new HashSet<>();
		start.add(1);

		do {
			Set<Integer> tmpst = new HashSet<>();

			Iterator<Integer> stit = start.iterator();
			while(stit.hasNext()) {
				int v1 = stit.next();

				int tdist = dist[v1] + 1;

				Iterator<Integer> adjit = adj[v1].iterator();
				while(adjit.hasNext()) {
					int v2 = adjit.next();
					if(!endcheck.contains(v2)) {
						tmpst.add(v2);

						if(dist[v2] < 1 || dist[v2] > tdist) {
							dist[v2] = tdist;
							ans[v2] = v1;
						}
					}

				}
			}

			start = tmpst;
			endcheck.addAll(tmpst);

		}while(endcheck.size() < n);

		System.out.println("Yes");
		for(int i = 2; i < n+1; i++) {
			System.out.println(ans[i]);
		}


	}

}


Measured memory_bytes: 103596
from collections import Counter
n, m = list(map(int, input().split()))

s = []
for i in range(n):
  s += list(map(int, input().split()))[1:]

ss = Counter(s)

ans = []
for k, v in ss.items():
  if v == n:
    ans.append(k)
    
print(len(ans))

Measured memory_bytes: 3316
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
using ll=long long;

template<typename T>
void print_vec(vector<T>& v)
{
  for(const auto& e: v) {
    cout << e << " ";
  }
  cout << endl;
}

template<typename T>
vector<T> cumsum(vector<T> v)
{
  vector<T> a(v.size() + 1, 0);
  for (int i = 0; i < v.size(); i++) {
    a[i + 1] = a[i] + v[i];
  }
  return a;
}


int main(int argc, char const* argv[])
{
  ll n, m, a;
  cin >> n >> m;

  vector<ll> as;
  for (int i = 0; i < n; i++) {
    cin >> a;
    as.push_back(a);
  }
  sort(ALL(as));

  // print_vec(as);

  vector<ll> num_greater_or_equal_power(2e5 + 1, 0);
  {
    int idx = 0;
    for (int i = 0; i < as.size(); i++) {
      while (idx <= as[i]) {
        num_greater_or_equal_power[idx] = as.size() - i;
        idx++;
      }
    }
  }

  // print_vec(num_greater_or_equal_power);

  // leftにはm通り以上の組み合わせをとれる最大の幸福度が入る
  // rightにはm通りよりも少ない組み合わせをとる最小の幸福度が入る
  ll left = 0, right = 2e5 + 1, mid, num_a, idx;
  while (right - left > 1) {
    num_a = 0;
    mid = left + (right - left) / 2;
    for (int i = 0; i < as.size(); i++) {
      idx = max((int)(mid - as[i]), 0);
      num_a += num_greater_or_equal_power[idx];
    }
    // 分かりづらいが、num_aが従う関数は単調減少
    if (num_a > m) left = mid;
    else right = mid;
  }

  // asの累積和を計算
  vector<ll> cum_sum_as = cumsum(as);

  ll ans = 0, sum_num_a = 0, num_greater_or_equal_power_idx;
  for (int i = 0; i < as.size(); i++) {
    num_greater_or_equal_power_idx = max((int)(right - as[i]), 0);
    num_a = num_greater_or_equal_power[num_greater_or_equal_power_idx];
    sum_num_a += num_a;
    ans += as[i] * num_a + *(cum_sum_as.end() - 1) - cum_sum_as[cum_sum_as.size() - 1 - num_a];
  }
  ans += left * (m - sum_num_a);

  cout << ans << endl;

  return 0;
}


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

int main()
{
	string s, t;
	cin >> s >> t;

	int a, b;
	cin >> a >> b;

	string u;
	cin >> u;

	if (s == u) {
		--a;
	}
	else if (t == u) {
		--b;
	}

	cout << a << " " << b << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define srt(i) sort(i.begin(), i.end())
#define rvt(i) sort(i.begin(), i.end(), greater<int>())

int main()
{
    int l,r,d;
    cin >> l >> r >> d;

    int ans = 0;
    ans = r/d;
    if(l!=1) ans-= (l-1)/d;

    cout << ans << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main() {
  int h, w;
  char s[50][50];
  string result;
  bool checkkey;
  cin >> h >> w;
  checkkey = true;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> s[i][j];
      if(s[i][j] == '#') checkkey = false;
    }
  }

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (s[i][j] == '#') {
        if (s[i - 1][j] == '.' && s[i + 1][j] == '.' && s[i][j - 1] == '.' && s[i][j + 1] == '.') {
          result = "No";
          break;
        } else {
          result = "Yes";
        }
        if(result == "No") break;
      }
      if(result == "No") break;
    }
    if(result == "No") break;
  }
  if(checkkey == true) {
    cout << "Yes" << endl;
  } else {
    cout << result << endl;
  }
}

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

int main(){
    int H ,W;
    while(1){
        cin>>H>>W;
        if(H==0 && W==0) break;
        for (int i =0; i<H; i++){
            for(int j =0; j<W; j++){
                if( i==0 || i==H-1 || j==0 || j==W-1){
                    cout<<"#";
                }else{
                    cout<<".";
                }
            }
            cout<<"\n";
        
        }
        cout <<endl;
    }
    return 0;
}


Measured memory_bytes: 3064