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

#define mp make_pair
#define pb push_back

using namespace std;

char s[2222];
int a[2222], b[2222], c[2222];
int nxtl[2222], nxtr[2222];
int an;
int n;

int main(){
//	freopen("input.inp", "r", stdin);
//	freopen("output.out", "w", stdout);
	scanf("%s",&s);
	n = strlen(s);
	for(int i = 0; i < n; ++i) a[i + 1] = s[i] - '0';
	scanf("%s",&s);
	for(int i = 0; i < n; ++i) b[i + 1] = s[i] - '0';
	int s = 0;
	for(int i = 1; i <= n; ++i) s += b[i];
	if (s == 0){
		for(int i = 1; i <= n; ++i) s += a[i];
		if (s){
			printf("-1");
			return 0;
		}
		printf("0");
		return 0;
	}
	for(int i = 1; i <= n; ++i){
		if (b[i] == 1) nxtl[i] = i;
		else nxtl[i] = nxtl[i - 1];
	}
	for(int i = 1; i <= n; ++i) if (!nxtl[i]) nxtl[i] = nxtl[n];
	for(int i = n; i > 0; --i){
		if (b[i] == 1) nxtr[i] = i;
		else nxtr[i] = nxtr[i + 1];
	}
	for(int i = 1; i <= n; ++i) if (!nxtr[i]) nxtr[i] = nxtr[1];
	an = 1e9;
	for(int s = 0; s < n; ++s){
		for(int i = 1; i <= n; ++i){
			int d = i - s;
			if (d <= 0) d += n;
			c[i] = b[d];
		}
		int tmp = 0;
		for(int i = 1; i <= n; ++i) if (c[i] != a[i]) ++tmp;
		vector<pair<int, int> > p;
		for(int i = 1; i <= n; ++i) if (c[i] != a[i]){
			int d;
			if (nxtl[i] <= i) d = i - nxtl[i];
			else d = n - nxtl[i] + i;
			int dd;
			if (nxtr[i] >= i) dd = nxtr[i] - i;
			else dd = n - i + nxtr[i];
			p.pb(mp(d, dd));
		}
		sort(p.begin(), p.end());
		int q = 0;
		if (p.empty()) an = min(an, min(s, n - s));
		else{
			for(int i = p.size() - 1; i >= -1; --i){
				if (i != p.size() - 1) q = max(q, p[i + 1].second);
				if (i == p.size() - 1 || i == -1 || p[i].first != p[i + 1].first){
					int t = tmp + q;
					if (i > -1) t += p[i].first;
					int qq = i > -1 ? p[i].first : 0;
					int g = abs(qq - s);
					g = min(g, n - abs(qq - s));
					g += q;
					int ps;
					if (q == 0) ps = 1;
					else ps = n - q + 1;
					int g2 = abs(ps - s - 1);
					g2 = min(g2, n - abs(ps - s - 1));
					if (i > -1) g2 += p[i].first;
					an = min(an, t + min(g, g2)) ;
				}
			}			
		}
	}
	printf("%d",an);
	return 0;
}

Measured memory_bytes: 384
N = int(input())
B = list(map(int, input().split()))
V = []

while B:
    # print(f'{B=}')
    for idx in range(len(B) - 1, -1, -1):
        if B[idx] == idx + 1:
            v = B.pop(idx)
            V.append(v)
            break
    else:
        print(-1)
        exit()

for v in V[::-1]:
    print(v)


Measured memory_bytes: 9116
#include <iostream>
#include <math.h>
#include <string>

using namespace std;

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

	int max = 0, min = 1001;
	for(int i = 0; i < N; ++i){
		int input;
		cin >> input;
		if(max < input) max = input;
		if(min > input) min = input;
	}

	cout << max - min << endl;
}


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

using ll = long long;

constexpr ll inf = 1e18;

struct edge {
    int to;
    ll c1, c2;
};

using edges = vector<edge>;
using graph = vector<edges>;

int main() {
    int n, p;
    cin >> n >> p;
    graph g(n);
    for(int i = 0; i < p; ++i) {
        int s, e;
        ll t1, t2;
        cin >> s >> e >> t1 >> t2;
        g[s - 1].push_back(edge{e - 1, t1, t2});
    }

    vector<int> topo(n, -1);
    int idx = 0;
    function<void(int)> calc_topo = [&] (int v) {
        if(topo[v] != -1) return;
        for(auto& e : g[v]) {
            calc_topo(e.to);
        }
        topo[v] = idx++;
    };
    calc_topo(0);

    vector<vector<ll>> dist(n, vector<ll>(n, inf));
    dist[0][0] = 0;
    using state = tuple<ll, int, int>;
    priority_queue<state, vector<state>, greater<state>> que;
    que.emplace(0, 0, 0);
    while(!que.empty()) {
        ll cur_c;
        int fst_v, sec_v;
        tie(cur_c, fst_v, sec_v) = que.top();
        que.pop();
        if(fst_v == sec_v) {
            for(auto& e : g[fst_v]) {
                ll nxt_c = cur_c + e.c1 + e.c2;
                if(dist[e.to][e.to] > nxt_c) {
                    dist[e.to][e.to] = nxt_c;
                    que.emplace(nxt_c, e.to, e.to);
                }
            }

            for(auto& e1 : g[fst_v]) {
                for(auto& e2 : g[sec_v]) {
                    if(e1.to == e2.to) continue;
                    ll nxt_c = cur_c + e1.c1 + e2.c1;
                    if(dist[e1.to][e2.to] > nxt_c) {
                        dist[e1.to][e2.to] = nxt_c;
                        que.emplace(nxt_c, e1.to, e2.to);
                    }
                }
            }
        } else {
            if(topo[fst_v] > topo[sec_v]) {
                for(auto& e : g[fst_v]) {
                    ll nxt_c = cur_c + e.c1;
                    if(dist[e.to][sec_v] > nxt_c) {
                        dist[e.to][sec_v] = nxt_c;
                        que.emplace(nxt_c, e.to, sec_v);
                    }
                }
            } else {
                for(auto& e : g[sec_v]) {
                    ll nxt_c = cur_c + e.c1;
                    if(dist[fst_v][e.to] > nxt_c) {
                        dist[fst_v][e.to] = nxt_c;
                        que.emplace(nxt_c, fst_v, e.to);
                    }
                }
            }
        }
    }

    cout << dist[n - 1][n - 1] << endl;
}



Measured memory_bytes: 27224
#include<stdio.h>
 int main(void)
{
 int a,b;
 scanf("%d %d",&a,&b);
 if(a<b){
 	printf("a < b\n");
 }
 if(a>b){
 	printf("a > b\n");
 		}
 if(a==b)
 {
 printf("a == b\n");
 }
 return 0;
}

Measured memory_bytes: 580
#include <iostream>

using namespace std;

int main()
{
    char c ;
    cin >> c;
    if( c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' ){
        cout << "vowel" << endl;
    }
    else {
        cout << "consonant" <<endl;
    }


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define re register
template <typename T> inline void read(T &x)
{
	x=0;int f=1;char c=getchar();
	for(;c>'9'||c<'0';c=getchar()) if(c=='-') f=-1;
	for(;c>='0'&&c<='9';c=getchar()) x=(x<<1)+(x<<3)+(c^48);
	x*=f;
}
template <typename T> inline void print(T x)
{
	if(x<0) putchar('-'),x=-x;
	if(x>9) print(x/10);
	putchar(x%10+48);
}
long long a[100005],sum=0;
int main()
{
	int n;
	read(n);
	for(re int i=1;i<=n;++i)
	{
		read(a[i]);
		sum+=a[i];
	}
	long long all=1LL*n*(n+1)/2;
	if(sum%all!=0)
	{
		printf("NO");
		return 0;
	}
	long long k=sum/all;
	long long cnt=k;
	for(re int i=2;i<=n;++i)
	{
		if(a[i]-a[i-1]==k) continue;
		long long t=k-(a[i]-a[i-1]);
		if(t%n!=0||t<0)
		{
			printf("NO");
			return 0;
		}
		cnt-=t/n;
		if(cnt<0)
		{
			printf("NO");
			return 0;
		}
	}
	printf("YES");
	return 0;
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:16777216")
#pragma warning( disable : 6031)
#include <climits>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>
#include <limits>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-9)
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef vector< pii > vpii;
typedef tuple<int, int, int> tiii;
const long long inf = 1e12;

int main()
{
#ifdef LOCAL_MACHINE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cout << setprecision(18) << fixed;
	int r;
	cin >> r;
	cout << r * r * 3;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#define ll long long int
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
int INF = 2e6;
ll MOD = 1e9 + 7;

int main() {
    int n; cin >> n;
    vector<ll> a(n),b(n),c(n);
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> b[i];
    rep(i,n) cin >> c[i];
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());

    ll ans = 0,ind_a,ind_c;
    for(int i = 0; i < n; i++){
        ll p = b[i];
        auto itr_c = upper_bound(c.begin(),c.end(),p);
        auto itr_a = lower_bound(a.begin(),a.end(),p);
        ind_a = distance(a.begin(),itr_a);
        ind_c = distance(c.end(),itr_c);
        ans += abs(ind_a) * abs(ind_c);
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 2560
def d_double_dots():
    from collections import deque
    N, M = [int(i) for i in input().split()]
    Edges = [[int(i) - 1 for i in input().split()] for j in range(M)]  # 0-indexed

    graph = [[] for _ in range(N)]
    for a, b in Edges:
        graph[a].append(b)
        graph[b].append(a)

    ans = [-1] * N
    is_visit = [False] * N
    queue = deque([0])
    while queue:
        v = queue.pop()
        for u in graph[v]:
            if not is_visit[u]:
                is_visit[u] = True
                ans[u] = v
                queue.appendleft(u)
    ans = ['Yes'] + list(map(lambda x: x + 1, ans[1:]))
    return '\n'.join(map(str, ans))

print(d_double_dots())

Measured memory_bytes: 65700
#include <iostream>
#include <set>

using namespace std;
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)

typedef long long ll;

long long GCD(long long a, long long b) {
    if (b == 0) return a;
    return GCD(b, a % b);
}

int main() {
    int N, K;
    cin >> N >> K;
    set<char> hateNumbers;
    repp(i, 0, K) {
        char d;
        cin >> d;
        hateNumbers.insert(d);
    }

    repp(i, N, 100000) {
        string res = to_string(i);
        bool ok = true;
        for (auto c : res) ok &= hateNumbers.find(c) == hateNumbers.end();

        if (ok) {
            cout << res << endl;
            return 0;
        }
    }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;

#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////


int main(){fastio;
    ll n;string s;
    cin>>n>>s;
    ll a[26];memset(a,0,sizeof(a));
    rep(i,0,n-1){
        a[s[i]-'a']++;
    }
    ll ans=1;
    rep(i,0,25){
        ans=mod(ans*(a[i]+1));
    }
    cout<<mod(ans-1)<<endl;
    
    return 0;
}








Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
template <class T> void cumulative_sum( T array, size_t N );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;

int main( void ){
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	if (B < C || D < A){
		cout << "0\n";
		return 0;
	}
	cout << min(B, D) - max(A, C) << endl;
}

int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
template <class T> void cumulative_sum( T array, size_t N ) {
	rep( i, 1, N + 1 ){
		array[ i ] += array[ i - 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;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}


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

#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FILL0(x) memset(x,0,sizeof(x))

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const double PI=3.14159265358979323846; 

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

    int N;
    cin >> N;
    cout << 2*PI*N <<endl;

 

 

    return 0;
}
 

//cout << setprecision(13);
//next_permutation();
//__gcd();
//reverse();
//set ,tuple ,pair;
//bitset
//vector.find



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

int main() {
    int a, b;
    cin >> a >> b;
    string str = "";
    if(a < b) {
        for(int i = 0; i < b; i++) {
            str += to_string(a);
        }
    } else {
        for(int i = 0; i < a; i++) {
            str += to_string(b);
        }
    }
    cout << str << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <iomanip>


#define REP(i,n) for(int i=0;i<n;++i)
#define RREP(i,n) for(int i=n-1;i>=0;--i)
#define FOR(i,m,n) for(int i=m;i<n;++i)
#define RFOR(i,m,n) for(int i=m-1;i>=n;--i)
#define ALL(v) v.begin(),v.end()
#define INF 1000000001
#define MOD 1000000007


using namespace std;


int main() {
	double x1, x2, y1, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	cout << fixed<<setprecision(8)<<sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)) << endl;;


	return 0;
}

Measured memory_bytes: 3264
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
#include<map>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1001001001;

ll pow_mod(ll p, ll n, ll m) {
	if (n == 0) return 1;
	else if (n == 1) return p % m;
	else if (n % 2 == 1) return p * pow_mod(p, n - 1, m) % m;
	else {
		ll tmp = pow_mod(p, n / 2, m);
		return (tmp * tmp) % m;
	}
}

ll gcd(ll x, ll y) {
	if (y == 0) {
		return x;
	}
	return gcd(y, x % y);
}

ll com_mod(ll n, ll k, ll m) {
	if (k == 0) return 1;
	else {
		ll x = 1;
		ll y = 1;
		for (ll i = 0; i < k; i++) {
			x = (x * (n - i)) % m;
			y = (y * (i + 1)) % m;
		}
		ll res = (x * pow_mod(y, m - 2, m)) % m;
		return res;
	}
}

int main() {
	string s; cin >> s;
	sort(s.begin(), s.end());
	if (s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3596
def main():
    s = input()
    ans = [0]
    count = 0
    for char in s:
        if char in ["A", "C", "G", "T"]:
            count += 1
        else:
            ans.append(count)
            count = 0
    ans.append(count)
    print(max(ans))

if __name__ == '__main__':
   main()

Measured memory_bytes: 3060
#include <stdio.h>
#define M 1000000

int main(){
  char s[M+1];
  int n, m, i, count, a[M];

  while(1){
    a[0] = 0;
    count = 0;
    scanf("%d",&n);
    if(n == 0) break;
    scanf("%d",&m);
    scanf("%s",s);
    for(i = 2 ; i < m ; i++){
      if(s[i] == 'I'){
	if(s[i-1] == 'O' && s[i-2] == 'I') a[i] = a[i-2] + 1;
	else a[i] = 0;
      }
      else a[i] = 0;
    }
    for(i = 0 ; i < m ; i++){
      if(a[i] >= n)
	count++;
    }
    printf("%d\n",count);
  }

  return 0;

}

Measured memory_bytes: 5488
#include<stdio.h>
void search(int c[50][50],int y,int x,int h,int w) {
	c[y][x] = 0;
	if (y + 1 < h) {
		if(c[y+1][x])search(c, y + 1, x, h, w);
		if (x + 1 < w&&c[y+1][x + 1]) search(c, y+1, x + 1, h, w);
		if (x - 1 >= 0 && c[y+1][x - 1]) search(c, y+1, x - 1, h, w);
	}
	if (y - 1 >= 0) {
		if (c[y - 1][x])search(c, y - 1, x, h, w);
		if (x + 1 < w&&c[y - 1][x + 1]) search(c, y-1, x + 1, h, w);
		if (x - 1 >= 0 && c[y - 1][x - 1]) search(c, y-1, x - 1, h, w);
	}
	if (x + 1 < w&&c[y][x+1]) search(c, y, x+1, h, w);
	if (x - 1 >= 0&&c[y][x-1]) search(c, y, x-1, h, w);
}
int main() {
	while (1) {
		int w,h,c[50][50],n=0;
		scanf("%d %d",&w,&h);
		if (!w && !h) {
			break;
		}
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				scanf("%d",&c[i][j]);
			}
		}
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				if (c[i][j]) {
					search(c,i,j,h,w);
					n++;
				}
			}
		}
		printf("%d\n",n);
	}
	return 0;
}


Measured memory_bytes: 2044
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>

using namespace std;
typedef long long ll;
ll const MOD = 1e9 + 7;

int one[101], zero[101];
ll power(ll a, ll b) {
    a%=MOD;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % MOD;
        a = a * a %MOD;
        b >>= 1;
    }
    return res;
}
int main(){
    int n;
    cin >> n;

    for (int i=0;i<n;i++){
        ll x;
        cin >> x;
        int j = 0;
        while (j < 100){
            int bit = x & 1; 
            if (bit & 1) one[j]++; else zero[j]++;
            j++;
            x >>= 1;
        }
    }
    
    ll s = 0LL, ans = 0;
    for (int i=0;i<101;i++){
    ll s = (one[i]%MOD*zero[i]%MOD)%MOD;
            s = (s%MOD*power(2,i)%MOD)%MOD;
            ans = (ans%MOD+s%MOD)%MOD;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int k;
  string s;
  cin>>k>>s;
  if(s.size()<=k){
    cout<<s<<endl;
  }
  else{
    rep(i,0,k){
      cout<<s[i];
    }
    cout<<"..."<<endl;
  }
}

Measured memory_bytes: 3628
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def main():
    N, X, *xn = map(int, open(0).read().split())
    ans = None
    for x in xn:
        div = abs(X - x)
        if ans is None:
            ans = div
        elif abs(X - x) % ans:
            ans = gcd(ans, abs(X - x))
    print(ans)
    return


main()


Measured memory_bytes: 14052
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    my_putchar_unlocked('-');
  }
  while(s--){
    my_putchar_unlocked(f[s]+'0');
  }
}
int N;
int A[200000];
int res[200000];
int main(){
  int i;
  int tot = 0;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=(0);Lj4PdHRW<(N);Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
    }
  }
  for(i=(0);i<(N);i++){
    tot ^= A[i];
  }
  for(i=(0);i<(N);i++){
    res[i] = A[i] ^ tot;
  }
  {
    int xr20shxY;
    if(N==0){
      wt_L('\n');
    }
    else{
      for(xr20shxY=(0);xr20shxY<(N-1);xr20shxY++){
        wt_L(res[xr20shxY]);
        wt_L(' ');
      }
      wt_L(res[xr20shxY]);
      wt_L('\n');
    }
  }
  return 0;
}
// cLay varsion 20200509-1

// --- original code ---
// int N, A[2d5], res[2d5];
// {
//   int tot = 0;
//   rd(N,A(N));
//   rep(i,N) tot ^= A[i];
//   rep(i,N) res[i] = A[i] ^ tot;
//   wt(res(N));
// }


Measured memory_bytes: 7192
#include <stdio.h>
#include <string.h>
#include <algorithm>
#define rep(i,st,ed) for (int i=st;i<=ed;++i)
#define drp(i,st,ed) for (int i=st;i>=ed;--i)
#define lowbit(x) (x&-x)
#define fi first
#define se second

typedef std:: pair <int,int> pair;
const int MOD=1000000007;
const int N=500005;

struct data {int x,v,id;} r[N];

int s[N<<1],f[N],n;

pair p[N];

int read() {
	int x=0,v=1; char ch=getchar();
	for (;ch<'0'||ch>'9';v=(ch=='-')?(-1):(v),ch=getchar());
	for (;ch<='9'&&ch>='0';x=x*10+ch-'0',ch=getchar());
	return x*v;
}

void upd(int &x,int v) {
	x+=v; (x>=MOD)?(x-=MOD):0;
}

void add(int x,int v) {
	for (;x<=n;x+=lowbit(x)) upd(s[x],v);
}

int get(int x) {
	int res=0;
	for (;x;x-=lowbit(x)) upd(res,s[x]);
	return res;
}

int ask(int l,int r) {
	int tmp=get(r)-get(l-1)+MOD;
	(tmp>=MOD)?(tmp-=MOD):0;
	return tmp;
}

bool cmp1(data a,data b) {
	return (a.x!=b.x)?(a.x<b.x):(a.v>b.v);
}

bool cmp2(data a,data b) {
	return a.v<b.v;
}

bool cmp3(pair a,pair b) {
	return (a.se!=b.se)?(a.se<b.se):(a.fi<b.fi);
}

int main(void) {
	//freopen("river.in","r",stdin);
	//freopen("river.out","w",stdout);
	n=read();
	rep(i,1,n) r[i].x=read(),r[i].v=read();
	std:: sort(r+1,r+n+1,cmp2);
	rep(i,1,n) r[i].id=i;
	std:: sort(r+1,r+n+1,cmp1);
	int mn=n+1,mx=0;
	rep(i,1,n) {
		mx=std:: max(mx,r[i].id);
		p[r[i].id].se=mx;
	}
	drp(i,n,1) {
		mn=std:: min(mn,r[i].id);
		p[r[i].id].fi=mn;
	}
	std:: sort(p+1,p+n+1,cmp3);
	rep(i,1,n) {
		if (p[i].fi==1) upd(f[i],1);
		int tmp=ask(std:: max(1,p[i].fi-1),p[i].se);
		upd(f[i],tmp);
		add(p[i].se,f[i]);
	}
	printf("%d\n", ask(n,n));
	return 0;
}

Measured memory_bytes: 12416
import java.io.PrintWriter
val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val nums = listOfInt()

    val ab = nums[0] * nums[1]
    val cd = nums[2] * nums[3]

    if (ab > cd) {
        println(ab)
    } else {
        println(cd)
    }
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { it.toInt() }

fun println(value : Any) {
    pw.println(value)
}

Measured memory_bytes: 35948
N=int(input())
AList = list(map(int, input().split()))
BList = list(map(int, input().split()))
CList = list(map(int, input().split()))

mae=0
MAN=0
i=0
while i<N:
    MAN+=BList[(AList[i])-1]
    if (mae+1)==AList[i] and i!=0:
        MAN+=CList[mae-1]
    
    
    mae=AList[i]
    
    
    i+=1

print(MAN)




Measured memory_bytes: 3064
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

//----------------------- Print Function ----------------------//

inline void print() {
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest) {
    cout << first << ' ';
    print(rest...);
}

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

//------------------------- Libraries -------------------------//

//--------------------------- Solve ---------------------------//

void solve() {
    int X; cin >> X;
    int x = 0, i = 0;
    while (x < X) {
        i++;
        x += i;
    }
    cout << i << '\n';
}

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

    solve();

    return 0;
}

Measured memory_bytes: 3632
import java.util.*;
import java.math.*;
import java.awt.geom.*;
import java.io.*;
     
     
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for(int i = 0; i < n; i++) {
			Line a = new Line(sc.nextDouble(),sc.nextDouble(),sc.nextDouble(),sc.nextDouble());
			Line b = new Line(sc.nextDouble(),sc.nextDouble(),sc.nextDouble(),sc.nextDouble());
			double ret = cross(a,b);
			boolean ok = false;
			if(Math.abs(ret) < 1.0e-12) ok = true;
			System.out.println((ok)?"YES":"NO");
		}
	}
	
	static double cross(Line a, Line b) {
		return (a.p2x - a.p1x) * (b.p2y - b.p1y) - (a.p2y - a.p1y) * (b.p2x - b.p1x);
	}

	static class Line {
		double p1x;
		double p1y;
		double p2x;
		double p2y;
		Line(double a, double b, double c, double d) {
			p1x = a;
			p1y = b;
			p2x = c;
			p2y = d;
		}
	}
}

Measured memory_bytes: 30392
import Control.Applicative

m = 10^9 + 7
modm n = mod n m

mul' x y = modm $ modm x * modm y

power' x 0 = 1
power' x 1 = modm x
power' x n
  | (n `mod` 2) == 0 = let i = power' x (n `div` 2) in mul' i i
  | otherwise = mul' x $ power' x (n - 1)

div' x y = mul' x $ power' y (m - 2)

product' xs = foldl mul' 1 xs

factorial' n = product' [1..n]

npr' n r = product' [n - i | i <- [0..(r - 1)]]

ncr' n r = modm $ (npr' n r) `div'` (factorial' r)

main = do
  [n, k] <- (map read). words <$> getLine :: IO [Int]
  mapM_ (putStrLn.show) $ (flip map) [1..k] $ \x -> mul' (ncr' (n - k + 1) x) (ncr' (k - 1) (x - 1))


Measured memory_bytes: 1404
#168 - F
import sys
import numpy as np


def main():
    N, M = map(int, sys.stdin.buffer.readline().split())
    LineData = np.int64(sys.stdin.buffer.read().split())

    INF = 10**9 + 1

    LineData = LineData.reshape(-1, 3)
    A, B, C = LineData[:N].T
    D, E, F = LineData[N:].T
    X = np.unique(np.concatenate([D, [-INF, INF]]))
    Y = np.unique(np.concatenate([C, [-INF, INF]]))
    A = np.searchsorted(X, A)
    B = np.searchsorted(X, B, 'right') - 1
    C = np.searchsorted(Y, C)
    D = np.searchsorted(X, D)
    E = np.searchsorted(Y, E)
    F = np.searchsorted(Y, F, 'right') - 1

    area = cal_area(A, B, C, D, E, F, X, Y)

    if area == 0:
        print("INF")
    else:
        print(area)


def cal_area(A, B, C, D, E, F, X, Y):
    x = np.searchsorted(X, 0, 'right') - 1
    y = np.searchsorted(Y, 0, 'right') - 1

    DX = X[1:] - X[:-1]
    DY = Y[1:] - Y[:-1]

    A = A.tolist()
    B = B.tolist()
    C = C.tolist()
    D = D.tolist()
    E = E.tolist()
    F = F.tolist()
    X = X.tolist()
    Y = Y.tolist()
    DX = DX.tolist()
    DY = DY.tolist()

    LenX = len(X)
    LenY = len(Y)

    visit = [[False] * LenY for _ in range(LenX)]
    visit[x][y] = True
    area = 0
    queue = [(x, y)]

    LineX = [[False] * LenY for _ in range(LenX)]
    LineY = [[False] * LenY for _ in range(LenX)]

    for x1, x2, y in zip(A, B, C):
        for x in range(x1, x2):
            LineY[x][y] = True

    for x, y1, y2 in zip(D, E, F):
        for y in range(y1, y2):
            LineX[x][y] = True

    LenX -= 1
    LenY -= 1

    q_pop = queue.pop
    q_append = queue.append
    
    while queue:
        x, y = q_pop()
        
        if x == 0 or x == LenX or y == 0 or y == LenY:
            area = 0
            break
        
        area += DX[x] * DY[y]
        
        x1 = x - 1
        if not LineX[x][y] and not visit[x1][y]:
            visit[x1][y] = True
            q_append((x1, y))
        y1 = y - 1
        if not LineY[x][y] and not visit[x][y1]:
            visit[x][y1] = True
            q_append((x, y1))
        x1 = x + 1
        if not LineX[x1][y] and not visit[x1][y]:
            visit[x1][y] = True
            q_append((x1, y))
        y1 = y + 1
        if not LineY[x][y1] and not visit[x][y1]:
            visit[x][y1] = True
            q_append((x, y1))

    return area


if __name__ == '__main__':
	main()

sys.exit()


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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)

#define debug(vec) for(auto v : vec) cout << v << " "; cout << endl;

#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cout << v << " "; cout << endl; } 

using namespace std;

typedef long long ll;

const long long int INF = 1 << 29; //<10^10
//const ll MOD = 998244353;
const ll MOD = 1000000007;

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

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

	rep(i,max(a,b))	std::cout << min(a,b);
}


Measured memory_bytes: 256
/*
　　こんにちは。あたしはｶｳｶﾞｰﾙ。
　　RedcoderになるためAtCoderを巡る旅をしてます。

　　　 　＿_
　　　 ヽ|＿_|ノ　　　　ﾓｫ
　　　　||‘‐‘||ﾚ　　_)_, ―‐ 、
　　　　/(Ｙ (ヽ＿ /・ ヽ　　   ￣ヽ
　　　　∠ ＿ ゝ　 ｀^ヽ ﾉ.::::_(ノヽ
　　　　 _/ヽ　 　　  /ヽ￣￣￣/ヽ
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl

#define rep(i, n) REP(i, 0, n)                  // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++) // x, x + 1, ..., n-1
#define FOREACH(x, a) for(auto &(x) : (a))

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define COUT(x) cout << (x) << endl

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;
}

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

    int N;
    cin >> N;
    COUT(pow(N, 3));
}


Measured memory_bytes: 4124
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m, x, y;
    cin >> n >> m >> x >> y;
    rep(i, n)
    {
        int temp;
        cin >> temp;
        chmax(x, temp);
    }
    rep(j,m){
        int temp;
        cin>>temp;
        chmin(y,temp);
    }
    if(x<y)cout<<"No War"<<"\n";
    else cout<<"War"<<"\n";
}


Measured memory_bytes: 3580
from itertools import accumulate
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
aa = list(accumulate(a))
aa = aa[::-1]
a.sort()
div = 10**9+7
ans=0

ls = [0]*60
for i in range(60):
    for j in a:
        if j&(1<<i):
            ls[i]+=1
        else:
            ls[i]-=1
    
for i in range(n-1):
    ans+=aa[i+1]
    for j in range(60):
        if a[i]&(1<<j):
            ls[j]-=1
            ans-=ls[j] * 2**j
        else:
            ls[j]+=1
    
    ans %= div

print(ans)


Measured memory_bytes: 128004
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] counts = new int[9];
		for (int i = 0; i < n; i++) {
			int rate = sc.nextInt();
			int pos = Math.min(8, rate / 400);
			counts[pos]++;
		}

		int min = 0;
		for (int i = 0; i < counts.length - 1; i++) {
			if (counts[i] > 0) {
				min++;
			}
		}

		int max = min + counts[counts.length-1];
		if (n > 0 && min == 0) {
			min = 1;
		}
		System.out.println(min + " " + max);
	}
}

Measured memory_bytes: 20948
#include<iostream>
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue> 
using namespace std;
int t[100000],n,a[100000],b[100000],c[10000];
int main() 
{cin>>n;
 for (int i=1;i<=n;i++)
 cin>>t[i]>>a[i]>>b[i];
 
 for (int i=1;i<=n;i++){
 c[i]=t[i]-t[i-1]-abs(a[i]-a[i-1])-abs(b[i]-b[i-1]);
 if (c[i]%2 or c[i]<0){
 cout<<"No";
 system("pause");
 return 0;}}
 cout<<"Yes";
 system("pause");
 return 0;
}        

Measured memory_bytes: 1656
/**************************************************
 * Atcoder problems
 * Contest No :081
 * Problem No :B
 * File Name  :program.cs
 * Create date:2020/06/07
 *
 * Copyright 2020 Shunichi Sato,All Rights Reserved.
**************************************************/
//memo terinal command
//compile:mcs program.cs
//excute :mono program.exe
using System;
class Program
{
	static void Main(string[] args)
	{
        // 個数の入力
        int count = int.Parse(Console.ReadLine());
        String[] nums = Console.ReadLine().Split(' ');
        int num_max_length = 999;
        int[] num = new int[num_max_length];
        int output = 0;
        for (int i = 0; i<count;i++)
        {
            num[i] = int.Parse(nums[i]);
        }
        // 判定
        while (true)
        {
            bool exist_odd = false;
            for (int i = 0;i < count;i++)
            {
                if(num[i] % 2 != 0)
                {
                    exist_odd = true;
                }
            }
            if(exist_odd)
            {
                break;
            }

            for (int i = 0 ;i < count ; i++)
            {
                num[i] = num[i] / 2;
            }
            output++;
        }
		//出力
		Console.WriteLine(output);
	}
}


Measured memory_bytes: 13268
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}

/*************** テストスペース ***************/

//let input = readIntSplit(by: " ")
//let (N, M, X) = (input[0], input[1], input[2])
//let A = readIntSplit(by: " ")

/*************** メインプログラム ***************/

let N = readInt()!
var S = readLine()!.toArray()
let K = readInt()!
let c = S[K-1]
for i in 0..<N {
    if S[i] != c {
        S[i] = "*"
    }
}
print(S.joinWithSeparator(""))


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

typedef long long ll;
const int N = 3100;

ll f[N][N];
int n, a[N];

int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) scanf("%d", &a[i]);
	for(int i = 1; i <= n; ++i) if(n & 1) f[i][i] = a[i]; else f[i][i] = -a[i];
	for(int len = 2; len <= n; ++len) {
		for(int l = 1; l <= n; ++l) {
			int r = l + len - 1;
			if((n - len) & 1) f[l][r] = min(f[l + 1][r] - a[l], f[l][r - 1] - a[r]);
			else f[l][r] = max(f[l + 1][r] + a[l], f[l][r - 1] + a[r]);
		}
	}
	printf("%lld\n", f[1][n]);
}

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

#ifdef _DEBUG
inline void dump() { cerr << endl; }
template<typename Head> void dump(Head&& head) { cerr << head; dump(); }
template<typename Head, typename... Tail> void dump(Head&& head, Tail&&... tail) { cerr << head << ", "; dump(forward<Tail>(tail)...); }
#define debug(...) do {cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; dump(__VA_ARGS__); } while (false)
#else
#define dump(...)
#define debug(...)
#endif

template<typename T>
struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

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

const ll inf = 1LL<<60;

int main()
{
  ll r,c,k; cin>>r>>c>>k;
  vector<vector<vector<ll>>> dp(r+2, vector<vector<ll>>(c+2, vector<ll>(5)));
  vector<vector<ll>> a(r+2, vector<ll>(c+2));
  rep(i, k) {
    ll x,y,t; cin>>x>>y>>t;
    a[x][y] = t;
  }

  for (int i=1; i<=r; i++) for (int j=1; j<=c; j++) {
    rep(l, 4) {
      dp[i][j][l+1] = max(dp[i][j-1][l+1], max(dp[i][j-1][l], dp[i-1][j][3]) + a[i][j]);
    }
  }
  cout << dp[r][c][3] << endl;

  return 0;
}


Measured memory_bytes: 707564
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 2e9
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;

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

  set<string> ss;
  string s;
  REP(i, n)
  {
    cin >> s;
    ss.insert(s);
  }

  cout << ss.size() << endl;

  return 0;
}

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

typedef long long ll;
using namespace std;

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

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

	if(d[n-1] < 10 || d[0] < 10){cout << "no" << endl; return 0; } 

	for (int i = 0;i < n;i++){
		if(d[i] < 10){
			int t = 10;
			for (int j = i-1;j >= 0;j--){
				t += 10;
				if(d[j] >= t) break;
				if(j == 0){ cout << "no" << endl; return 0;}
			}
			t = 10;
			for (int j = i+1;j < n;j++){
				t += 10;
				if(d[j] >= t) break;
				if(j == n-1){ cout << "no" << endl; return 0;}
			}
		}
	}

	cout << "yes" << endl;

	return 0;

}




Measured memory_bytes: 4368
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define c(n) cin>>n
#define co(n) cout<<n<<endl
using namespace std;
typedef long long ll;
typedef vector<long> vl;
typedef vector<string> vs;

int main(){
  int a,b,c=0,d=0,e,n,m,x,y;
  string s,t,u;
  cin>>s;
  rep(i,0,s.size()){
    cout<<'x';
  }
  cout << endl;
 
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using System.Numerics;

namespace ABC174
{
    class Program
    {
        static void Main(string[] args)
        {
            //var NK = Console.ReadLine().Split().Select(long.Parse).ToArray();
            //var p = Console.ReadLine().Split().Select(long.Parse).OrderBy(x => x).ToArray();
            // var CA = Enumerable.Repeat(0, (int)N).Select(_ => Console.ReadLine().Split().Select(long.Parse).ToArray()).ToArray();
            var K = long.Parse(Console.ReadLine());
            var x = 7L;
            for (long i = 0; i <= K; i++)
            {
                if (x % K == 0) { Console.WriteLine(i + 1); return; }
                x = (10 * x + 7) % K;
            }
            Console.WriteLine(-1);
        }
    }
}


Measured memory_bytes: 27468
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 101000;
int g[N],pri[N],tot;
ll f[1010][1010],p1[1010],p2[1010];
void init(){
	for(int i=2;i<=10000;i++){
		if(!g[i]){pri[++tot]=i;g[i]=i;}
		for(int j=1;pri[j]*i<=10000;j++){
			g[pri[j]*i]=pri[j];
			if(pri[j]==g[i]) break; 
		}
	}
	int k1=0,k2=0;
	for(int i=1;i<=1004;i++)
		if(i&1) p1[++k1]=pri[i];
		else p2[++k2]=pri[i];
	ll p[1010],now=0;
	memcpy(p,p1,sizeof(p1));
	for(int i=1;i<=k1;i+=2)
		p1[i]=p[k1-now],p1[i+1]=p[++now];
	memcpy(p,p2,sizeof(p));now=0;
	for(int i=1;i<=k2;i+=2)
		p2[i]=p[k2-now],p2[i+1]=p[++now];
}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){
	if(a==0) return b;
	if(b==0) return a;
	return a/gcd(a,b)*b;
}
int main(){
	int n;
	cin>>n;
	if(n==2){
		puts("4 7\n23 10\n");
		return 0;
	}
	init();
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			if(i+j&1){
				int k=i+j>>1;
				f[i][j]=p1[k];
				k=i+(n-j+1)>>1;
				f[i][j]*=p2[k];
			}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			if(~(i+j)&1){
				f[i][j]=lcm(f[i][j-1],lcm(f[i][j+1],lcm(f[i-1][j],f[i+1][j])))+1;
		 	}
	/*set<ll> S;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++){
			if(j<n&&max(f[i][j],f[i][j+1])%min(f[i][j],f[i][j+1])!=1) cerr<<"!!\n";
			if(i<n&&max(f[i][j],f[i+1][j])%min(f[i][j],f[i+1][j])!=1) cerr<<"!!\n";
			if(S.count(f[i][j])) cerr<<i<<' '<<j<<'\n';
			else S.insert(f[i][j]);
		}*/
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			cout<<f[i][j]<<" \n"[j==n];
	return 0;
}


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

int main() {
    int N; cin >> N;
    vector<int> a(N, 0);
    for (int i = 0; i < N; i++) {
        cin >> a.at(i);
    }
    sort(a.begin(), a.end(), greater<int>());
    int alice = 0, bob = 0;
    for (int i = 0; i < N; i++) {
        if (i%2 == 0) {
            alice += a.at(i);
        } else {
            bob += a.at(i);
        }
    }
    cout << alice - bob << endl;
    return 0;
}

Measured memory_bytes: 256
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  n <- unsafeTextToInt <$> T.getLine :: IO Int
  print . go n $ States 1 0 0 0 0 0 0 0 0 0

data States = States !Int !Int !Int !Int !Int !Int !Int !Int !Int !Int

go :: Int -> States -> Int
go 0 (States s0 a ac ag agg agt at atg g ga) = modSum [s0, a, ac, ag, agg, agt, at, atg, g, ga]
go l (States s0 a ac ag agg agt at atg g ga) = go (pred l) (States s0' a' ac' ag' agg' agt' at' atg' g' ga')
  where
    s0' = modSum [s0 * 2, ac * 2, agg, agt, at * 2, atg, g * 2]
    a' = modSum [s0, a, ac, agt, at, ga]
    ac' = a
    ag' = modSum [a, ga]
    agg' = ag
    agt' = ag
    at' = modSum [a, ga]
    atg' = at
    g' = modSum [s0, agg, agt, atg, g]
    ga' = modSum [ag, agg, atg, g]
    -- o' = modSum [ac, ag, agg, agt, atg, ga, o * 4]
{-# INLINE go #-}

modSum :: [Int] -> Int
modSum = foldl modAdd 0
  where
    modAdd :: Int -> Int -> Int
    modAdd x y = (x + y) `mod` modulus
{-# INLINE modSum #-}

modulus = 10 ^ 9 + 7 :: Int
{-# INLINE modulus #-}

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}


Measured memory_bytes: 508
while True:
    try:
        c1,c2,c3 = map(int, raw_input().split())
        count = 0
        for i in range(10):
            num = i+1
            if num != c1 and num != c2 and num != c3:
                if c1+c2+num <= 20:
                    count += 1
            if count >= 4:
                print 'YES'
                break
        else:
            print 'NO'
        
    except EOFError:
        break

Measured memory_bytes: 4208
(n, m) = [int(i) for i in input().split()]

matrix = []
vector = []
product = [0 for d in range(n)]

for nc in range(n):
    matrix.append([int(i) for i in input().split()])

for mc in range(m):
    vector.append(int(input()))

for nc in range(n):
    for mc in range(m):
        product[nc] += matrix[nc][mc] * vector[mc]

[print(product[nc]) for nc in range(n)]

Measured memory_bytes: 7020
function main()
	N,K=map(x->parse(Int,x),split(readline()))
	S=chomp(readline())
	id=N+1
	ans=Int[]
	while id>1
		nxt=-1
		for j=min(id-1,K):-1:1
			if S[id-j]=='0'
				nxt=id-j
				push!(ans,j)
				break
			end
		end
		if nxt<0
			println(-1)
			exit()
		end
		id=nxt
	end
	println.(reverse(ans))
end
main()

Measured memory_bytes: 168468
import java.util.*;

public class Main{
        public static void main(String[] args) {
                try(Scanner sc = new Scanner(System.in)){
                        if(-sc.nextInt()+sc.nextInt()*2==sc.nextInt()){
                                System.out.println("YES");
                        }else{
                                System.out.println("NO");
                        }
                }
        }
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    Int(n);
    vector<double> data(n);
    rep(i, n) {
        cin >> data[i];
    }

    //sort(all(data)); reverse(all(data));

    vector<vector<double>> dp(n+1, vector<double>(n+1, 0.0));

    dp[0][0] = 1.0;
    rep(i, n) {
        rep(j, i+1) {
            dp[i+1][j] += dp[i][j] * (1.0 - data[i]);
            dp[i+1][j+1] += dp[i][j] * data[i];
        }
    }

    double ans = 0.0;
    for (int i = n/2 + n%2; i <= n; i++) {
        ans += dp[n][i];
    }

    std::cout << Decimal << ans << std::endl;

    return 0;
}


Measured memory_bytes: 70784