akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	bool fail=false;
	cin>>s;
	while(s.size()>3&&(!fail)){
		string t;
		if(s[0]=='A'&&s[1]=='B'&&s[2]=='C'){
			rep(i,s.size()){
				if(s[i]=='A'){
					if(i<s.size()-2&&s.substr(i,3)=="ABC"){
						s[i+1]='*';
						s[i+2]='*';
					}
					else fail=true;
				}
			}
		}
		else if(s[s.size()-3]=='A'&&s[s.size()-2]=='B'&&s[s.size()-1]=='C'){
			rep(i,s.size()){
				if(s[i]=='C'){
					if(i>1&&i<s.size()&&s.substr(i-2,3)=="ABC"){
						s[i-1]='*';
						s[i-2]='*';
					}
					else fail=true;
				}
			}
		}
		else{
			rep(i,s.size()){
				if(s[i]=='B'){
					if(i>0&&i<s.size()-1&&s.substr(i-1,3)=="ABC"){
						s[i-1]='*';
						s[i+1]='*';
					}
					else fail=true;
				}
			}
		}
		rep(i,s.size())if(s[i]!='*')t.push_back(s[i]);
		fail|=s.size()==t.size();
		swap(s,t);
	}
	Yn(!fail&&s=="ABC");
}



Measured memory_bytes: 3264
n,m,l=map(int,input().split())
cost=[[10**9+1]*n for i in range(n)]
length=[[10**9]*n for i in range(n)]
for i in range(m):
    a,b,c=map(int,input().split())
    a-=1
    b-=1
    cost[a][b]=c
    cost[b][a]=c
q=int(input())
st=[map(int,input().split())for i in range(q)]

for k in range(n):
    for i in range(n):
        for j in range(n):
            cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j])
for i in range(n):
    length[i][i]=0
for i in range(n):
    for j in range(n):
        if cost[i][j]<=l:
            length[i][j]=0
for k in range(n):
    for i in range(n):
        for j in range(n):
            length[i][j]=min(length[i][j],length[i][k]+length[k][j]+1)
for s,t in st:
    ch=min(length[s-1][t-1],length[t-1][s-1])
    print(-1 if ch>10**8 else ch)

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

int main() { long A; long B; long C; long X; long Y;
cin >> A >> B >> C >> X >> Y;

// long evenmax = max(X, Y);
// if(max(X, Y) % 2 == 1) evenmax += 1;
long ans = 1e12;
long s;
long t;
// s = A * (X - 5);
long u = 0;

for(long i = 0; i <= max(X, Y) * 2; i += 2){
  s = max(A * (X - i / 2), u);
  t = max(B * (Y - i / 2), u);
  ans = min(C * i + s + t, ans);
}
// ans = max(s, u);

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

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int n, q;
string s, t, d;

int fdo(int pos){
	rep(i, q){
		if(s[pos] != t[i]) continue;
		pos += d[i]=='L'? -1: 1;
		if(pos < 0 ) return 2;
		if(pos >=n ) return 3;
	}
	return 1;
}

int fnc(bool lr){
	int hi=n, lw=-1;
	while(hi - lw >1){
		int md = (hi + lw) >>1;
		if(lr) (fdo(md) == 2? lw: hi) = md;
		else   (fdo(md) == 3? hi: lw) = md;
	}
	return hi;
}


int main(){
	cin.tie(0); ios_base::sync_with_stdio(false);
	cin >>n>>q>>s;

	rep(i,q){
		string x,y; cin >>x >>y;
		t+=x; d+=y;
	}
	cout << fnc(false) - fnc(true) <<"\n";
	
}



Measured memory_bytes: 1044
#include <bits/stdc++.h>
#define R cin>>
#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 INF 1e9
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long unsigned int ll;

int main(){
    ll N;
    R N;
    vector<pair<ll, ll>> v;
    for(int i=0; i<N; i++) {
        int a, b;
        cin >> a >> b;
        v.emplace_back(b, a);
    }
    sort(all(v));
    ll t = 0;
    for(int i=0; i<N; i++) {
        t += v[i].second;
        if (t > v[i].first) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 6384
S = input()
s1 = list(S)

if (s1[0] == s1[1] and s1[2] == s1[3] and s1[0] != s1[2]) or (s1[1] == s1[2] and s1[0] == s1[3] and s1[1] != s1[3]) or (s1[0] == s1[2] and s1[1] == s1[3] and s1[0] != s1[1]):
    print("Yes")
else:
    print("No")        


Measured memory_bytes: 3060
'use strict';

const receive = () => require('fs').readFileSync('/dev/stdin', 'utf8').split(/\s/);

const main = input => {
  const [A, B, C, ...rest] = input.map(x => Number(x));
  const ans = Math.max(A, B, C) * 9 + A + B + C;
  console.log(ans);
};

main(receive());


Measured memory_bytes: 7820
def resolve():
    '''
    code here
    '''
    N, K = [int(item) for item in input().split()]
    xs = [int(item) for item in input().split()]
    
    min_lr = 10**9
    min_rl = 10**9

    if N != K:
        for i in range(N-K+1):
            min_lr = min(min_lr, abs(xs[i]) + abs(xs[i+K-1] - xs[i]))
            min_rl = min(min_rl, abs(xs[i+K-1]) + abs(xs[i+K-1] - xs[i]))

        print(min(min_lr, min_rl))
    elif N ==1:
        print(abs(xs[0]))
    else:
        print(min(abs(xs[0]) + abs(xs[N-1] - xs[0]), abs(xs[N-1]) + abs(xs[N-1] - xs[0])))

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 20516
//given n integers and an integer m such that n>m then there exits a pair
//(a-b) such that (a-b)%m==0


#include<bits/stdc++.h>
using namespace std;
typedef  long long int ll;
const ll M=1000000007;
void solve(){
 int n;
 cin>>n;
 int a[n];
 map<int,int>mp;
 for(int i=0;i<n;i++)cin>>a[i],mp[a[i]]++;
 int ans=0;
 for(int i=0;i<n;i++){
    int x=a[i];
    bool ok=true;
    if(mp[x]>1)ok=false;
    for(int j=2;j<=sqrt(x)&&ok;j++){
        if(x%j==0&&(mp[j]||mp[x/j])){
           ok=false;
        }
    }
    if(ok)ans++;
 }
 if(mp[1]==1)ans=1;
 if(mp[1]>1)ans=0;
 cout<<ans;
}

int main(){
 int t=1;
 //cin>>t;
 while(t--){
        solve();
        cout<<endl;
 }
}


Measured memory_bytes: 33128
cmp(int*a,int*b){return*a<*b?-1:1;}
char x[9],buf[1100000];
sz;i;
T[1<<17];
N,C,K,k;
ans,id,pre;
main()
{
	read(0,buf,1100000);
	for(;;)
	{
		k=buf[sz++];
		if(k<'0')break;
		N=N*10+k-'0';
	}
	for(;;)
	{
		k=buf[sz++];
		if(k<'0')break;
		C=C*10+k-'0';
	}
	for(;;)
	{
		k=buf[sz++];
		if(k<'0')break;
		K=K*10+k-'0';
	}
	for(;i<N;++i)
	{
		for(;;)
		{
			k=buf[sz++];
			if(k<'0')break;
			T[i]=T[i]*10+k-'0';
		}
	}
	qsort(T,N,4,cmp);
	for(i=0;i<N;++i)
	{
		if(i-id>=C||pre<T[i])
		{
			ans+=1;
			pre=T[i]+K;
			id=i;
		}
	}
	sz=8;
	do
	{
		x[--sz]=ans%10+'0';
		ans/=10;
	}while(ans);
	write(1,x+sz,8-sz);
}

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

int main(){
	int w,h,x,y;
	char map[15][15];
	int dp[15][15];
	int ans;
	
	while(cin>>w>>h,w!=0){
		for(y=0;y<h;y++){
		for(x=0;x<w;x++){
			cin>>map[x][y];
			dp[x][y]=0;
		}
		}

		for(x=0;x<w;x++) if(map[x][0]!='1') dp[x][0]=1;

		for(y=0;y<h-1;y++){
		for(x=0;x<w;x++){
			if(map[x][y]=='0'){
				if(map[x][y+1]!='1') dp[x][y+1]+=dp[x][y];
				if(0<x && map[x-1][y+1]=='0') dp[x-1][y+1]+=dp[x][y];
				if(x<w-1 && map[x+1][y+1]=='0') dp[x+1][y+1]+=dp[x][y];
			}else if(map[x][y]=='2'){
				if(y<h-2 && map[x][y+2]!='1') dp[x][y+2]+=dp[x][y];
			}
		}
		}
		
		ans=0;for(x=0;x<w;x++){
			if(map[x][h-2]=='2') ans+=dp[x][h-2];
			ans+=dp[x][h-1];
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
h, w = map(int, input().split())
s = [["."] + list(input()) + ["."] for _ in range(h)]
s0 = ["."] * (w + 2)
s.insert(0, s0)
s.append(s0)
v = [[0, 1], [0, -1], [1, 0], [-1, 0]]
ans = 1
for i in range(1, h + 1):
    for j in range(1, w + 1):
        if s[i][j] == "#":
            c = 0
            for k in v:
                if s[i + k[0]][j + k[1]] == "#":
                    c += 1
            if c == 0:
                ans = 0
#print(s)
if ans == 1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <map>
#include <string>
#include <algorithm>

#define REP(i, n) for(int i = 0; i < n ; i++)

using namespace std;

int main() {
    int n = 0;
    int k = 0;
    cin >> n >> k;
    int h[n];
    REP(i, n) cin >> h[i];
    sort(h, h + n);
    int ret = 0;
    for (int i = 0; i < n; i++){
        if (h[i] >= k){
            ret++;
        }
    }
    cout << ret << endl;
}

Measured memory_bytes: 640
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<tuple>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
ll MOD=1e+9+7;
ll fac(ll a){
	if(a==1) return 1;
	else return a*fac(a-1)%MOD;
}
int main(){
	ll N,M;
	scan(N);scan(M);
	if(abs(N-M)>1){
		prin(0);
	}
	else{
		if(N==M){
			prin(2*fac(N)*fac(N)%MOD);
		}
		else{
			prin(fac(N)*fac(M)%MOD);
		}
	}
	return 0;
}


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

int main(){
	int n;
	cin >> n;
	vector<int> d(n);
	for(int i=0; i<n; i++){
		cin >> d[i];
	}
	
	bool ans = true;
	for(int r=0; r<2 && ans; r++){
		int maxdist = 0;
		for(int i=0; i<n; i++){
			if(maxdist < i*10){
				ans = false;
				break;
			}
			maxdist = max(maxdist, i*10 +d[i]);
		}
		reverse(d.begin(), d.end());
	}
	if(ans){
		cout << "yes" << endl;
	}else{
		cout << "no" << endl;
	}
	return 0;
}



Measured memory_bytes: 3896
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	vector<int> abc(3);
	cin >> abc[0] >> abc[1] >> abc[2];
	
	sort(abc.begin(), abc.end(), greater<int>());
	
	int k;
	cin >> k;
	
	for(int i = 0; i < k; ++i) {
		abc[0] *= 2;
	}
	
	cout << abc[0] + abc[1] + abc[2] << endl;

	return 0;
}

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

using namespace std;


int main()
{
  int H, W, K;
  string s[30];
  int power[31];
  power[0] = 1;
  for(int i = 1; i < 31; i++) power[i] = power[i - 1] * 2;

  cin >> H >> W >> K;
  for(int i = 0; i < H; i++) {
    cin >> s[i];
    for(auto &c : s[i]) c -= '0';
  }

  int ret = 0;
  for(int i = 0; i < H; i++) {
    for(int j = 0; j < W; j++) {
      int now = 0;
      vector< string > field(H);
      for(int k = 0; k < H; k++) {
        field[k] = s[k];
      }
      field[i][j] = -1;
      for(int k = i; k > 0; k--) {
        swap(field[k][j], field[k - 1][j]);
      }
      bool update = true;
      for(int k = 0; update; k++) {
        update = false;
        vector< int > ff(H, 0);
        for(int l = 0; l < H; l++) {
          auto &bits = ff[l];

          int rev = -1, cs = 0;
          for(int m = 0; m < W; m++) {
            if(field[l][m] == -1) {
              rev = -1;
              continue;
            }
            if(rev == field[l][m]) {
              cs++;
            } else {
              rev = field[l][m];
              cs = 1;
            }
            if(cs >= K) {
              for(int n = 0; n < K; n++) {
                bits |= 1 << (m - n);
              }
              update = true;
            }
          }
        }
        int cost = 0;
        for(int l = 0; l < H; l++) {
          auto &bits = ff[l];
          for(int m = 0; m < W; m++) {
            if(field[l][m] == -1) continue;
            if((bits >> m) & 1) {
              cost += field[l][m];
              field[l][m] = -1;
              for(int n = l; n > 0; n--) {
                swap(field[n - 1][m], field[n][m]);
              }
            }
          }
        }
        now += power[k] * cost;
      }
      ret = max(ret, now);
    }
  }
  cout << ret << endl;
}


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

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;

#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(),(x).end()
constexpr auto INF = 4000000000;
constexpr auto MOD = 1000000007;


int over(int p, int q) {
	ll ret = 1;
	ll c = p;
	while (q) {
		if(q % 2 == 1) {
			ret *= c;
			ret %= MOD;
			q -= 1;
		}
		q /= 2;
		c *= c;
		c %= MOD;
	}
	return ret;
}

int main() {

	ll x, y;
	cin >> x >> y;
	if ((x + y) % 3 != 0 || 2 * x < y || 2 * y < x) {
		cout << "0" << endl;
		return 0;
	}

	int n = (x + y) / 3;
	int r = y - n;

	ll ans=1;
	rep(i, r) {
		ans *= (ll)n - r + i+1;ans %= MOD;
		ans *= over((i + 1), (MOD - 2));ans %= MOD;
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
const int INF = 1e9;


signed main(){
    int N;
    cin >> N;
    string s;
    cin >> s;
    int Q;
    cin >> Q;
    vector<set<int>> alp(26,set<int> {INF});
    for(int i=0;i<N;i++){
        alp[s[i]-'a'].insert(i);
    ;}


    for(int i=0;i<Q;i++){
        int t;
        cin >> t;
        if(t==1){
            int a;
            cin >> a;a--;
            char c;
            cin >> c;
            if(s[a]!=c)alp[s[a]-'a'].erase(a);
            s[a]=c;
            alp[c-'a'].insert(a);
        }
        else if(t==2){
            int ans=0;
            int l;
            cin >> l;l--;
            int r;
            cin >> r;
            for(int c=0;c<26;c++){
                if(alp[c].empty())continue;
                if(*alp[c].lower_bound(l) < *alp[c].lower_bound(r))ans++;
            ;}
            cout<<ans<<endl;
        }
    }


    
}


Measured memory_bytes: 24196
import java.io.*;

class Main {
    public static void main(String[] args) {
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            int x = 0;
            int y = 0;
            int max = 0;
            boolean end = false;

            while (!end) {
                String temp = br.readLine();
                String[] numbers = temp.split(" ");
                x = Integer.parseInt(numbers[0]);
                y = Integer.parseInt(numbers[1]);

                if ((x < 0 && y > 10000) || (x == 0 && y == 0) || max > 3000) {
                    end = true;
                } else if (x > y || x == y) {
                    System.out.println(y + " " + x);
                } else if (x < y) {
                    System.out.println(x + " " + y);
                }
                max++;
            }

        } catch (Exception e) {
            System.out.println(e);
        }
    }
}

Measured memory_bytes: 27092
#include<cstdio>
int main(){
	int A,B,C,D,X,Y;
	scanf("%d %d %d %d",&A,&B,&C,&D);
	X=A*B;
	Y=C*D;
	if(X >= Y) printf("%d\n",X);
	else printf("%d\n",Y);
	return 0;
}


Measured memory_bytes: 128
n = int(input())
a = list(map(int, input().split()))

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

s1 = [0]*(n + 1)
s2 = [0]*(n + 1)
for i in range(1, n):
    s1[i] = gcd(s1[i-1], a[i-1])
    s2[n-i] = gcd(s2[n-i+1], a[n-i])

ans = 0
for i in range(n):
    ans = max(ans, (gcd(s1[i], s2[i+1])))

print(ans)

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

typedef long long ll;

int main()
{
    ll A, B, C, X, Y;

    cin >> A >> B >> C >> X >> Y;
    ll ans = 100000000000;
    for (ll i = 0; i <= max(X, Y) * 2; i += 2)
    {
        ll en = i * C +
                max((ll)0, (X - i / 2)) * A +
                max((ll)0, (Y - i / 2)) * B;
        // cout << en << endl;
        ans = min(ans, en);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3528
n,a,b,c,d = map(int,input().split())
s = input()
a,b,c,d = a-1,b-1,c-1,d-1
if s[a:c+1].count('##') > 0 or s[b:d+1].count('##') >0:
  print('No')
  exit()
if c > d:
  if s[b-1:d+2].count('...') == 0:
    print('No')
    exit()
print('Yes')

Measured memory_bytes: 40816
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        m: usize,
        x: i64,
        y: i64,
        mut xs: [i64; n],
        mut ys: [i64; m],
    }
    xs.sort();
    ys.sort();
    let ok_range = (xs[n - 1] + 1, ys[0] + 1);
    if ok_range.0 >= ok_range.1 {
        println!("War");
        return;
    }
    let z_range = (x + 1, y + 1);
    let overlap = !(z_range.1 <= ok_range.0 || ok_range.1 <= z_range.0);
    let ans = if overlap { "No War" } else { "War" };
    println!("{}", ans);
}


Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            List<int> list = new List<int>();
            {
                var input = Console.ReadLine();
                list.Add(int.Parse(input.Substring(0, 2)));
                list.Add(int.Parse(input.Substring(2, 2)));
            }

            string answer;
            if (IsMonth(list[0]))
            {
                if (IsMonth(list[1]))
                {
                    answer = "AMBIGUOUS";
                }
                else
                {
                    answer = "MMYY";
                }
            }
            else
            {
                if (IsMonth(list[1]))
                {
                    answer = "YYMM";
                }
                else
                {
                    answer = "NA";
                }
            }

            Console.WriteLine(answer);
        }

        private bool IsMonth(int input)
        {
            bool ret;
            if (1 <= input && input <= 12)
            {
                ret = true;
            }
            else
            {
                ret = false;
            }

            return ret;
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;

int main() {
  ll n,r;
  cin >> n >> r;
  if(n>=10) {
    cout << r << endl;
  }
  else {
    cout << r+100*(10-n) << endl;
  }
}

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

int main() {
  string S,T;
  int A,B,aki=1,a=0;
  cin >> A >> B;
  
  while (aki < B)
  {
    aki=aki-1+A;
    a++;
  }
  
  
  cout << a << endl;
}

Measured memory_bytes: 256
/*Author : Kartik Bansal
 *Date : 02/08/19
 *Time : 17:46 */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
#define tc int t ;cin>>t ;while(t--)
#define pb push_back
#define FOR(i,n) for(int i =0;i<n;i++)
#define Sort(v) sort(v.begin() ,v.end())
int32_t main()
{
  int n ;
  cin>>n ;
  vector<int> v(n+1) ;
  v[0] = 0 ;
  for(int i=1 ;i<=n ;i++)
  {
    cin>>v[i] ;
  }
  vector<int> value(n+1) ;

value[2] = abs(v[2] - v[1]) ;
  // va
  for(int i=3 ;i<=n;i++)
  {
    // value[i] = 10000000 ;
    // for(int j =1 ;j<=i ;j++)
    // {
    //   value[i] = min(value[i-1] + v[j] , value[i-2]+v[j]) ;
    // }
    value[i] = min(value[i-1] + abs(v[i] - v[i-1]) , value[i-2] + abs(v[i] - v[i-2]) ) ;
  }
  cout<<value[n] ;
  return 0 ;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
#define F first
#define S second
#define mod 1000000007
#define pb push_back
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const int NUM = 2e5 + 5;

int main(){
    ios
    int num_tests=1; 
    //cin>>num_tests;
    while(num_tests-->0){
        int n; cin>>n;
        vector<int> a(n+1,0);
        for(int i=1;i<=n;i++) cin>>a[i];
        int cnt=0;
        for(int i=1;i<n;i++) 
            if(a[i]!=i) cnt++;
        if(cnt>2) cout<<"NO";
        else cout<<"YES";
    }   
}


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

int main() {
	int n;
	cin >> n;
	int a[n],b[n];
	for(int i=0;i<n;i++){
		cin >> a[i];
		b[i] = a[i];
	}
	sort(b,b+n);
	
	for(int i=0;i<n;i++){
		if(a[i]==b[n-1]) cout << b[n-2] << endl;
		else cout << b[n-1] << endl;
	}
	
	
	return 0;
}

Measured memory_bytes: 3200
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
typedef long long ll;
const ll mod = 1e9 + 7;
const ll inf = 1e9;

int main() {
    int A, B;
    cin >> A >> B;
    
    int ans = max(A - 2*B, 0);

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main(){
    int X;
    cin >> X;
    if(X >= 30) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3616
#include<stdio.h>

int main()
{
    char grid[150][150];
    int myH[150], myW[150];
    int i, j, ind, h, w;
    scanf("%d %d", &h, &w);
    for(i=0;i<h;i++)
        scanf("%s", grid[i]);
    for(i=0;i<h;i++)
    {   
        ind=0;
        for(j=0;j<w;j++)
        {
            if(grid[i][j]=='#')    
                break;
            else if(j==w-1)
                ind=1;
        }
        if(ind==1)
            myH[i]=1;
    }
    for(j=0;j<w;j++)
    {   
        ind=0;
        for(i=0;i<h;i++)
        {
            if(grid[i][j]=='#')    
                break;
            else if(i==h-1)
                ind=1;
        }
        if(ind==1)
            myW[j]=1;
    }
    for(i=0;i<h;i++)
    {
        if(myH[i]==1) 
            continue;
        for(j=0;j<w;j++)
        {
            if(myW[j]!=1)    
                printf("%c", grid[i][j]);
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}



int main(){
  ll N;
  cin>>N;
  vector<vector<ll>> A(N,vector<ll>(N));
  for(ll i=0;i<N;i++){
    for(ll j=i+1;j<N;j++){
      for(ll k=0;;k++){
        if(((i>>k)&1)!=((j>>k)&1)){
          A[i][j]=k+1;
          break;
        }
      }
    }
  }
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      cout<<A[i][j]<<(j+1==N?"\n":" ");
    }
  }

  return 0;
}


Measured memory_bytes: 2432
#include <iostream>
#include <stdio.h>
#include <math.h>

using namespace std;

int main(){
  int a,b;
  char op;
  
  while(cin >>a>>op>>b,(op!='?')){

    if(op=='+'){
      cout <<a+b<<endl;
    }
    else if(op=='-'){
      cout <<a-b<<endl;
    }
    else if(op=='*'){
      cout <<a*b<<endl;
    }
    else if(op=='/'){
      cout <<a/b<<endl;
    }

  }


  return 0;
  
}



Measured memory_bytes: 3068
a, b, c, d = map(int, list(str(input())))

if a + b + c + d == 7:
  print("{0}+{1}+{2}+{3}=7".format(a,b,c,d))
  exit(0)

if a + b + c - d == 7:
  print("{0}+{1}+{2}-{3}=7".format(a,b,c,d))
  exit(0)

if a + b - c - d == 7:
  print("{0}+{1}-{2}-{3}=7".format(a,b,c,d))
  exit(0)
  
if a - b - c - d == 7:
  print("{0}-{1}-{2}-{3}=7".format(a,b,c,d))
  exit(0)

if a + b - c + d == 7:
  print("{0}+{1}-{2}+{3}=7".format(a,b,c,d))
  exit(0)
  
if a - b + c + d == 7:
  print("{0}-{1}+{2}+{3}=7".format(a,b,c,d))
  exit(0)

if a - b - c + d == 7:
  print("{0}-{1}-{2}+{3}=7".format(a,b,c,d))
  exit(0)

if a - b + c - d == 7:
  print("{0}-{1}+{2}-{3}=7".format(a,b,c,d))
  exit(0)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int N; cin>>N;
  map<int,int> M;
  REP(i,2,N){
    int K=i;
    REP(j,2,K){
      while(K%j==0){
        M[j]++;
        K/=j;
      }
    }
  }
  int sum3=0,sum5=0,sum15=0,sum25=0,sum75=0;
  for(auto p:M){
    int X=p.second;
    if(X>=2)
      sum3++;
    if(X>=4)
      sum5++;
    if(X>=14)
      sum15++;
    if(X>=24)
      sum25++;
    if(X>=74)
      sum75++;
  }
  int ans=0;
  ans+=max(0ll,sum5*(sum5-1)/2*(sum3-2));
  ans+=max(0ll,(sum3-1)*sum25);
  ans+=max(0ll,(sum5-1)*sum15);
  ans+=max(0ll,sum75);
  cout<<ans<<endl;
  }




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5+10;
typedef long long ll;
int a[maxn],rt[maxn];
int lc[maxn*40],rc[maxn*40],tol;
ll sum[maxn*40];
map<int,int>vis;
void init(){
	tol=1;
	vis.clear();
}
void update(int &u, int x, int y, int p, ll v)
{
    sum[tol] = sum[u]+v,lc[tol] = lc[u],rc[tol] = rc[u];
    u = tol++;
    if(x == y) return;
    int m = (x+y)>>1;
    if(p <= m) update(lc[u],x,m,p,v);
    else update(rc[u],m+1,y,p,v);
}
ll query(int u, int x, int y, int ql, int qr)
{
    if(ql <= x && y <= qr) return sum[u];
    int m = (x+y)>>1;
    ll ans = 0;
    if(ql <= m) ans += query(lc[u],x,m,ql,qr);
    if(qr > m) ans += query(rc[u],m+1,y,ql,qr);
    return ans;
}
int main(){
	int n,q;
	init();
	scanf("%d%d",&n,&q);
	for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
	for(int i=1;i<=n;i++){
		rt[i]=rt[i-1];
		if(vis.find(a[i])!=vis.end())
		{
			int tmp=rt[i-1];
			update(tmp,1,n,vis[a[i]],-1);
			rt[i]=tmp;
			update(rt[i],1,n,i,1);
		}
		else 
		{
			rt[i] = rt[i-1];
            update(rt[i],1,n,i,1);
        }
        vis[a[i]]=i;
	}
	while(q--){
		int l,r;
		scanf("%d%d",&l,&r);
		printf("%lld\n",query(rt[r],1,n,l,r));
	}
	return 0;
	
} 

Measured memory_bytes: 319036
#include <algorithm>
#include <climits>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

// author:Swastik Banerjee

using namespace std;

typedef long long ll;
#define MOD 1000000007

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



  ll n;
  cin >> n;

  ll arr[n];

  for (ll i = 0; i < n; i++) {
    cin >> arr[i];
  }

  sort(arr, arr + n);
  int flag = 0;

  for (ll i = 1; i < n; i++) {
    if (arr[i] == arr[i - 1]) flag = 1;
  }

  if (flag == 1)
    cout << "NO";
  else
    cout << "YES";
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
int character_count(string text, char character){ int ans = 0; for(int i = 0; i < text.size(); i++){ ans += (text[i] == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl(long(n))
#define fcout cout << fixed << setprecision(10)
#define highest(x) (63 - __builtin_clzl(x))
 
int main(){
    int A, B, C;
    cin >> A >> B >> C;
    cout << max({A, B, C}) - min({A, B, C}) << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

#intの場合

L, R = map(int,input().split())
dell = set(range(1, L))
answer = set(range(1, L+1))

for x in range(R):
  intA = int(input())
  dell = list(map(int, input().split()))
  
  answer = answer.difference(dell)

print (len(answer))

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


int main(){
    double l;
    cin >> l;
    double ans = 1.00;
    ans *= 1.00 *  (l/3);
    ans *= 1.00 * (l/3);
    double t = (l/3) + (l/3);
    ans *= 1.00 * (l - t);
    cout <<setprecision(10)<< (1.0 * ans) <<"\n";
    return 0;
}

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

int main(){
  ll x;
  cin >> x;
  ll ans = x-1;
  ll n = sqrt(x);
  for(int i = 1; i <= n; i++){
    if (x % i == 0){
      ll j = x / i;
      if(ans > j + i - 2){
        ans = i + j - 2;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include<bits/stdc++.h>
using namespace std;
using ll=int_fast64_t;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

bool dfs(vector<vector<int>>&v,vector<bool>&vis,vector<bool>&col,int i=0,bool c=false){
    if(vis[i]){
        return col[i]!=c;
    }
    vis[i]=true;
    col[i]=c;
    for(auto j:v[i]){
        if(dfs(v,vis,col,j,!c)) return true;
    }
    return false;
}

class BGraphPartition {
public:
    void solve(istream& in, ostream& out) {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        int n;
        in>>n;
        char c;
        vector<vector<int>> d(n,vector<int>(n,1000000));
        vector<vector<int>> v(n);
        fr(i,n){
            d[i][i]=0;
            fr(j,n){
                in>>c;
                if(c-'0'){
                    v[i].emplace_back(j);
                    d[i][j]=1;
                }
            }
        }
        vector<bool> vis(n),col(n);
        if(dfs(v,vis,col)){
            out<<-1<<endl;
            return;
        }
        fr(k,n) fr(i,n) fr(j,n) d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
        int ans=0;
        fr(i,n) fr(j,n) ans=max(ans,d[i][j]);
        out<<ans+1<<endl;
    }
};

int main() {
    BGraphPartition solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<long long> A(n);
    for (int i = 0; i < n; i++) cin >> A[i];
    
    long long max_num = 0;
    bool possible = true;
    long long count = 0;
    for (int i = 0; i < n; i++){
        if (A[i] <= max_num) {
            max_num = A[i] + 1;
            if (i > 0){
                if (A[i] > A[i-1]) count += 1;
                else count += A[i];
            }
            
        }
        else possible = false;
    }

    if (possible == true){
        cout << count << '\n';
    }
    else cout << -1 << '\n';

}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int r; cin>>r;
    if (r<1200){
        cout<<"ABC\n";
    }else if(r<2800){
        cout<<"ARC\n";
    }else{
        cout<<"AGC\n";
    }
    return 0;
}

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

using namespace std;

/*
aX+bY=c
dX+eY=f
*/

void solve(int a, int b, int c, int d, int e, int f) {
	double x = (f - (double)e*c/b) / (d - (double)e*a/b);
	double y = (c - a*x) / b;
	if (x == 0) x = 0.000;
	if (y == 0) y = 0.000;
	printf("%4.3f %4.3f\n", x, y);
}

int main() {
	int a, b, c, d, e, f;
	while (cin >> a >> b >> c >> d >> e >> f) {
		solve(a,b,c,d,e,f);
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<vector>

int main() {
   
   std::string n;
   std::cin >> n;
   for (int i = 0; i < 3; i++) {
      if (n[i] == '1') std::cout << '9';
      else if (n[i] == '9') std::cout << '1';
      else std::cout << n[i];
   }
   std::cout << std::endl;
   return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int y = sc.nextInt();

        if ((y%2 != 0)) {
            System.out.println("No");
            return;
        }

        int diff = y - (x * 2);
        if( diff < 0 ) {
            System.out.println("No");
            return;
        }

        if ((diff / 2) > x) {
            System.out.println("No");
            return;
        }
        System.out.println("Yes");
    }
}

Measured memory_bytes: 35692
/*package whatever //do not write package name here */

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

class Main {
    static double dp[][];
    public static double probability(int i,int tails,int n,double []ar){
        if(i==n)return 1;
        if(dp[i][tails]!=-1)return dp[i][tails];
        double ans=0;
         if(tails<n-tails-1)ans+=probability(i+1, tails+1, n, ar)*(1-ar[i]);
         
         ans+=probability(i+1, tails, n, ar)*ar[i];
         dp[i][tails]=ans;
         return ans;
    }
	public static void main (String[] args)throws IOException{
		//code
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		
		String[]s;
		
            int n=Integer.parseInt(br.readLine());
           
            

  
           double []ar=new double[n];
           s=br.readLine().split("\\s+");
		    for(int i=0;i<n;i++){
                ar[i]=Double.parseDouble(s[i]);  
            }

        
           dp=new double[n][n+1];
           for(int i=0;i<n;i++)Arrays.fill(dp[i], -1);
           System.out.println(probability(0, 0, n, ar));

            
            
         
        
          
		
		    
	
		
	}
}


Measured memory_bytes: 134600
#include<iostream>
#include<vector>
#include<queue>
#include<set>
#include<string>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

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

  cout << str.size() << endl;
  return 0;
}


Measured memory_bytes: 15696
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    char ch = sc.next().toCharArray()[0];
    char a = 'a';
    Set<Character> set = new HashSet<>();
    for(int i=0;i<26;i++){
      set.add((char)(a+i));
    }
    if(set.contains(ch)){
      System.out.println('a');
    }else{
      System.out.println('A');
    }
    
  }
}

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

#define sp ' '
#define endl '\n'
#define st first
#define nd second
#define sz(x) ((long long int)x.size())
#define pb push_back
#define pob pop_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define forn(YY, yy) for(long long int yy = 0; yy < YY; ++yy)
#define prn(XX) cout << XX << '\n'
#define prs(XX) cout << XX << ' '
#define TEST cout << "TEST\n";

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;

const long long int MOD = 1e9 + 7;
const long long int INF = 2e9 + 13;
const long long int mINF = -2e9 - 13;
const double PI = acos(-1.0);
const double EPS = 1e-9;

ll mx(ll x, ll y){ return (x>y?x:y); }
ll mn(ll x, ll y){ return (x<y?x:y); }

void max_self(ll &x, ll y){ x = mx(x, y); }
void min_self(ll &x, ll y){ x = mn(x, y); }
void add(ll &x, ll y){ x%=MOD; x += (y%MOD); x %= MOD; }
void mul(ll &x, ll y){ x%=MOD; x *= (y%MOD); x %= MOD; }

ll us(ll n, ll x, ll m){
    if(x == 0) return 1;
    ll a = us(n, x>>1, m);
    return (((a*a)%m)*(x&1?n:1))%m;
}

int main(int argc, char **argv){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    //freopen(".gir", "r", stdin);
    //freopen(".cik", "w", stdout);

    ll sayi, base;
    cin >> sayi >> base;

    vll usler; usler.pb(1);
    for(ll i = 1; usler[i-1] <= sayi; ++i) usler.pb(usler[i-1]*base);
    
    auto bas = lower_bound(usler.begin(), usler.end(), sayi) - usler.begin();
    if(usler[bas] > sayi) --bas;
    vector<int> newSayi(bas+1, 0);
    newSayi[0] = sayi / usler[bas];
    sayi %= usler[bas];
    ll tempbas = bas-1;

    for(int i = 1; i <= bas and sayi; ++i){
        ll uss = usler[tempbas--];
        newSayi[i] = sayi / uss;
        sayi %= uss;
    }
    
    ll ans = 0;
    for(ll i = 0; i <= bas; ++i){ string s = to_string(newSayi[i]); ans += s.length(); }
    cout << ans << endl;

    return 0;
}

//cikisir



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

long long N, A[200009], S[200009], P[22][200009];

long long ranges(int l, int r) {
	if (r > N) return 0;
	long long sum = S[r] - S[l - 1];
	long long X = 0;
	for (int i = 0; i < 20; i++) {
		long long G = P[i][r] - P[i][l - 1]; G %= 2;
		X += (1 << i)*G;
	}
	if (sum == X) return 1;
	return 0;
}

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> A[i]; S[i] = S[i - 1] + A[i];
		for (int j = 0; j < 20; j++) { if ((A[i] / (1 << j)) % 2 == 1) P[j][i] = 1; }
	}
	for (int i = 0; i < 20; i++) {
		for (int j = 1; j <= N + 1; j++) P[i][j] += P[i][j - 1];
	}
	long long ans = 0;
	for (int i = 1; i <= N; i++) {
		int L = i, R = N + 1, M, maxn = -1;
		for (int j = 0; j < 20; j++) {
			M = (L + R) / 2;
			if (ranges(i, M) == 1) { maxn = max(maxn, M); L = M; }
			else { R = M; }
		}
		ans += (maxn - i + 1);
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
  int n,a,b,minb;
  cin>>n;
  int maxa=-1;
  for(int i=0;i<n;i++){
    cin>>a>>b;
    if(maxa<a||maxa==-1){maxa=a;minb=b;}
  }
  cout<<maxa+minb<<endl;
}


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

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

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test() int t;cin>>t;while(t--)
#define forn(i,f,n) for(int i=f;i<f+n;i++)
#define rforn(i,l,n) for(int i=l;i>l-n;i--)
#define all(v) v.begin(),v.end()
#define prin(V) for(auto v:V) cout<<v<<" ";cout<<endl
#define take(V,f,n) for(int i=f;i<f+n;i++) cin>>V[i]
#define what(x) cerr<<#x<<" = "<<x<<endl
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const int MOD = 1e9+7,MAX = 1e5+5;
/////////////////FastExp///////////////////
ll powN(ll a,ll p)
{
	if(p==0) return 1;
	ll z=powN(a,p/2);
	z=(z*z)%MOD;
	if(p%2) z=(z*a)%MOD;
	return z;
}
/////////////////FastExp///////////////////
//////////////////Sieve////////////////////
vector<bool> is_prime(MAX+1, true);
void Sieve()
{
	is_prime[0] = is_prime[1] = false;
	int i,j;
	for (i = 2; i*i <= MAX; i++) 
	{
    	if (is_prime[i]) 
    	{
        	for (j = i * i; j <= MAX; j += i)
            	is_prime[j] = false;
    	}
	}
}
//////////////////Sieve////////////////////

int main()
{	
	int k;
	cin>>k;
	vi A = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	cout<<A[k-1]<<endl;

}		

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>

using namespace std;
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;


int main() {
    int n, k;
    cin >> n >> k;
    string s;
    string t;
    cin >> s >> t;
    using P = pair<int, int>;
    priority_queue<P, vector<P>, greater<P>> que[2];

    V<int> dp(n+1);
    dp[0] = 0;

    int off[2] = {};
    for (int i = 0; i < n; i++) {
        int sc = (s[i] == 'W') ? 0 : 1;
        int tc = (t[i] == 'W') ? 0 : 1;
        if (i) {
            if (t[i] != t[i-1]) {
                off[tc]++;
            }
        }
        //add i
        que[tc].push(P(1 - off[tc] + dp[i], i));
        que[1-tc].push(P(0 - off[1-tc] + dp[i], i));
        //rem i-k
        for (int f = 0; f < 2; f++) {
            while (que[f].size() && que[f].top().second <= i-k) {
                que[f].pop();
            }
        }
        if (sc == tc) {
            dp[i+1] = dp[i];
            continue;
        }
        dp[i+1] = 1 + que[sc].top().first + off[sc];
    }

    cout << dp[n] << endl;
/*    for (int i = 0; i <= n; i++) {
        cout << dp[i] << ", ";
    }
    cout << endl;*/
    return 0;
}

Measured memory_bytes: 14260
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());//int型
		int b = Integer.parseInt(sc.next());
		int c = Integer.parseInt(sc.next());
		sc.close();
		if ((a < c && c < b) || (b < c && c < a)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}


Measured memory_bytes: 23124