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

//#pragma GCC optimize("Ofast,unroll-loops")
//#pragma GCC target("avx,avx2,fma")

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cerr << #a << " = " << a << endl;

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

namespace IntModulo
{
	const int mod = 1e9 + 7;

	inline int add(int x, int y, int m = mod)
	{
		if (x + y < m)
			return x + y;
		return x + y - m;
	}

	inline int sub(int x, int y, int m = mod)
	{
		if (x >= y)
			return x - y;
		return x - y + m;
	}

	inline int mult(int x, int y, int m = mod)
	{
		return x * (LL) y % m;
	}

	inline int power(int x, int y, int m = mod)
	{
		int r = 1;
		while(y)
		{
			if (y & 1)
				r = mult(r, x, m);
			x = mult(x, x, m);
			y >>= 1;
		}
		
		return r;
	}
	
	inline int inverse(int x, int m = mod)
	{
		return power(x, m - 2, m);
	}
	
	inline void ADD(int& x, int y, int m = mod)
	{
		x += y;
		if (x >= m) x -= m;
	}
	
	inline void SUB(int& x, int y, int m = mod)
	{
		x -= y;
		if (x < 0) x += m;
	}
	
	inline void MULT(int& x, int y, int m = mod)
	{
		x = (x * (LL) y) % m;
	}
};

namespace Combinatorics
{
	using namespace IntModulo;
	
	const int N = 1 << 20;
	int fact[N];
	int inv[N];
	int invFact[N];
	bool inited = false;
	
	inline int C(int n, int k) // binomial C(n, k)
	{
		return n < k ? 0 : mult(fact[n], mult(invFact[k], invFact[n - k]));
	}
	
	inline int H(int n, int k) // number of solution x1 + .. + xn = k
	{
		return C(n + k - 1, k);
	}
	
	void init()
	{
		debug(Combinatorics::N);
		inited = true;
		inv[1] = 1;
		FOR(i, 2, N)
			inv[i] = mult(mod - mod / i, inv[mod % i]);
		
		invFact[0] = fact[0] = 1;
		FOR(i, 1, N)
		{
			fact[i] = mult(i, fact[i - 1]);
			invFact[i] = mult(invFact[i - 1], inv[i]);
		}
	}	
};

using namespace Combinatorics;

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	Combinatorics::init();
	
	int n, m, k;
	cin >> n >> m >> k;
	n--;
	int ans = 0;
	int last = -1;
	
	FOR(t, 0, m + k + 1)		
	{
		int curr = (t ? mult(2 * t, last) : 1);
		if (t)
		{
			FOR(it, 0, 2)
			{
				SUB(curr, mult(mult(m + 1, fact[t - 1]), C(t, m + 1)));
				swap(m, k);
			}
		}
		
		ADD(ans, mult(invFact[t], mult(curr, mult(C(n + t, t), power(3, m + k - t)))));
		last = curr;
	}
	
	cout << ans << endl;
	
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}



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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

const int MAX = 100'000 + 5;
bool prime[MAX];
void init() {
  rep(i, MAX) prime[i] = true;
  prime[0] = prime[1] = false;
  for (int i = 2; i*i <= MAX; i++) {
    if (!prime[i]) continue;
    for (int j = i*i; j < MAX; j+=i) {
      prime[j] = false;
    }
  }
}

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

  init();
  vi vec(MAX);
  for (int x = 1; x < MAX; x+=2) {
    if (prime[x] && prime[(x+1)/2]) vec[x]++;
  }
  srep(i, 1, MAX) vec[i] += vec[i-1];
  int q; std::cin >> q;
  rep(i, q) {
    int l, r; std::cin >> l >> r;
    int ans = vec[r];
    if (l > 0) ans -= vec[l-1];
    std::cout << ans << "\n";
  }
}


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

int main() {
  int n, m;
  cin >> n >> m;
  
  int max_L = 0;
  int min_R = n;
  for (int i = 0; i < m; ++i) {
    int L, R; cin >> L >> R;
    max_L = max(max_L, L);
    min_R = min(min_R, R);
  }
  
  if (min_R - max_L + 1 > 0) cout << min_R - max_L + 1 << endl;
  else cout << 0 << endl;
  
  return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

MOD = 10 ** 9 + 7

def gcd(x, y):
  while y: x, y = y, x % y
  return x

def lcm(x, y):
  return x * y // gcd(x, y)

tmp = A[0]
for i in range(1, N):
  tmp = lcm(A[i], tmp)
tmp %= MOD

answer = 0
for a in A:
  answer += tmp * pow(a, MOD - 2, MOD)
  
print(answer % MOD)


Measured memory_bytes: 4084
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    string s;
    cin >> s;
    int len = s.size();
    rep(i, len){
        cout << "x";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
int dp[1 << 12] = {};
const int INF = 1001001001;

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> a(M), b(M), c(M, 0);
    for(int i=0; i<M; ++i) {
        cin >> a[i] >> b[i];
        for(int j=0; j<b[i]; ++j) {
            int tmp; cin >> tmp;
            c[i] |= (1 << (tmp - 1));
        }
    }

    dp[0] = 0;
    for(int S=1; S < (1 << N); ++S) dp[S] = INF;

    for(int S=0; S < (1 << N); ++S) {
        for(int j=0; j<M; ++j) {
            if((S | c[j]) != S) {
                dp[(S | c[j])] = min(dp[(S | c[j])], dp[S] + a[j]);
            }
        }
    }

    if(dp[(1 << N) - 1] == INF) cout << -1 << endl;
    else cout << dp[(1 << N) - 1] << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

//选择排序法（0起点）
int selectSort(int A[],int N)
{
    int i,j,minj,temp,sw=0;
    for(i=0;i<N-1;i++)
    {
        minj=i;
        for(j=i+1;j<N;j++)
        {
            if(A[j]<A[minj])
                minj=j;
        }
        if(minj!=i)
        {
            sw++;
            temp=A[i];
            A[i]=A[minj];
            A[minj]=temp;
        }
    }
    return sw;
}

int main()
{

    int A[100],N,i,sw;
    scanf("%d",&N);
    for(i=0;i<N;i++)
        scanf("%d",&A[i]);

    sw = selectSort(A,N);

    for(i=0;i<N;i++)
    {
        if(i) printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
    printf("%d\n",sw);
    return 0;
}



Measured memory_bytes: 2108
L = input()
ans = 0
n = len(L)
def power_func(a,n,p):
  bi=str(format(n,"b"))
  res=1
  for i in range(len(bi)):
    res=(res*res) %p
    if bi[i]=="1":
      res=(res*a) %p
  return res

count = 0
for i in range(len(L)):
    if i == 0:
        ans += (power_func(3,n-1,1000000007) + 2)
        ans %= 1000000007
        count += 1
    else:
        if L[i] == "1":
            ans += (power_func(3,n-1,1000000007)+1)*(power_func(2,count,1000000007))
            ans %= 1000000007
            count += 1
    n -= 1
print(ans%1000000007)


Measured memory_bytes: 42988
import java.util.*;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long num = sc.nextLong();
		List<Long> integerList = getStrings(sc, num);
		HashMap<Long, CalResult> map = new HashMap<Long, CalResult>();

		long countSize = integerList.stream().distinct().count();
		long size = integerList.size();
		if (countSize == 1) {
			for (long i = 0; i < size; i++) {
				System.out.println((size - 1) * (size - 2) / 2);
			}
			return;
		} else if (countSize == size) {
			for (int i = 0; i < size; i++) {
				System.out.println(0);
			}
			return;
		}

		for (int i = 0; i < size; i++) {
			long a = integerList.get(i);
			if (!map.containsKey(a)) {
				CalResult c = new CalResult();
				c.setCount(1);
				map.put(a, c);
			} else {
				CalResult c = map.get(a);
				long b = c.getCount();
				c.setCount(b+1);
				map.put(a, c);
			}
		}

		long sumall = 0;
		for (Map.Entry<Long, CalResult> entry : map.entrySet()) {
			CalResult c = entry.getValue();
			long count = c.getCount();

			if (count>1) {
				sumall+=(count)*(count-1)/2;
				c.setWithCount((count)*(count-1)/2);
			} else {
				c.setWithCount(0);
			}
			if (count>2) {
				c.setWithoutCount((count-1)*(count-2)/2);
			} else {
				c.setWithoutCount(0);
			}
		}

		for (long i = 0; i < size; i++) {
			long sum =0;
			sum+=map.get(integerList.get((int) i)).getWithoutCount();
			sum+=sumall-map.get(integerList.get((int) i)).getWithCount();
			System.out.println(sum);
		}

	}

	static class CalResult {
		long count;
		long withCount;
		long withoutCount;

		public CalResult() {}

		public long getCount() {
			return count;
		}

		public void setCount(long count) {
			this.count = count;
		}

		public long getWithCount() {
			return withCount;
		}

		public void setWithCount(long withCount) {
			this.withCount = withCount;
		}

		public long getWithoutCount() {
			return withoutCount;
		}

		public void setWithoutCount(long withoutCount) {
			this.withoutCount = withoutCount;
		}
	}

	private static List<Long> getStrings(Scanner sc, long num) {
		List<Long> integerList = new ArrayList<>();
		while(num>0) {
			Long i = sc.nextLong();
			integerList.add(i);
			num--;
		}
		return integerList;
	}

}


Measured memory_bytes: 107536
import math

X = int(input())

R = X
LL = int(math.sqrt(X)) + 1

found = False
while not found:
    bflag = False
    for i in range(2, LL + 1):
        if R % i == 0 and R != i:
            R += 1
            bflag = True
            break
    found = not bflag

print('{}'.format(R))


Measured memory_bytes: 3060
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
using namespace std;
const int N=1e5+10,M=524288;
const int MAX=2e9;
const long long Mod=1e9+7;
long long n,sum,ans,x[N],p[N],l,r;
int main(){
    //freopen("problem.in","r",stdin);
    //freopen("problem.out","w",stdout);
    scanf("%lld%lld",&n,&sum);
    for(int i=1;i<=n;i++) scanf("%lld%lld",&x[i],&p[i]);
    l=1;
    r=n;
    while(l<=r){
        if(x[l]>=sum){
            ans+=x[r]-sum;
            break;
        }
        if(x[r]<=sum){
            ans+=sum-x[l];
            break;
        }
        ans+=x[r]-x[l];
        if(p[l]>=p[r]) while(p[l]>=p[r]&&l<r) p[l]+=p[r--];
        else while(p[l]<p[r]&&l<r) p[r]+=p[l++];
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cmath>
#include<algorithm>

using namespace std;
typedef long long ll;

int N, Z, W;
ll in[2000];
ll ans;

int main() {
	cin >> N >> Z >> W;
	ans = 0;
	for (int i = 0; i < N; i++) {
		cin >> in[i];
	}
	if(N == 1)ans = max(ans, abs(W - in[0]));
	else {
		ans = max(ans, abs(in[N - 2] - in[N - 1]));
		ans = max(ans, abs(in[N - 1] - W));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
 
public class Main{
    public static void main(String[] args){
        Main m = new Main();
        m.input();
    }
 
    public void input(){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        sc.close();
        if(a > c){
            
        }else if(a < c){
            
        }
        if(Math.abs(a - c) <= d){
            System.out.println("Yes");
        }else if((Math.abs(a - b) <= d) && (Math.abs(c - b) <= d)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
    
}

Measured memory_bytes: 21716
import java.util.Scanner;

class Main {
    static class Tree {
        private final Tree lhs;
        private final Tree rhs;

        public Tree(Tree lhs, Tree rhs) {
            this.lhs = lhs;
            this.rhs = rhs;
        }

        private static char[] expr;
        private static int ptr;
        private static Tree constructRec() {
            if (expr[ptr] == '(') {
                ptr++;
                Tree lhs = constructRec();
                assert expr[ptr] == ',';
                ptr++;
                Tree rhs = constructRec();
                assert expr[ptr] == ')';
                ptr++;
                return new Tree(lhs, rhs);
            } else {
                return null;
            }
        }

        public static Tree construct(char[] expr) {
            Tree.expr = expr;
            Tree.ptr = 0;
            return constructRec();
        }

        public static Tree intersectionOf(Tree t1, Tree t2) {
            if (t1 == null || t2 == null) {
                return null;
            } else {
                return new Tree(intersectionOf(t1.lhs, t2.lhs), 
                                intersectionOf(t1.rhs, t2.rhs));
            }
        }

        public static Tree unionOf(Tree t1, Tree t2) {
            if (t1 == null && t2 == null) {
                return null;
            } else if (t1 == null) {
                return new Tree(unionOf(t1, t2.lhs), unionOf(t1, t2.rhs));
            } else if (t2 == null) {
                return new Tree(unionOf(t1.lhs, t2), unionOf(t1.rhs, t2));
            } else {
                return new Tree(unionOf(t1.lhs, t2.lhs), unionOf(t1.rhs, t2.rhs));
            }
        }

        private static void showRec(Tree t) {
            System.out.print('(');
            if (t.lhs != null) {
                showRec(t.lhs);
            }
            System.out.print(',');
            if (t.rhs != null) {
                showRec(t.rhs);
            }
            System.out.print(')');
        }

        public static void show(Tree t) {
            showRec(t);
            System.out.println();
        }
    }

    private static void solve() {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            char operation = scanner.next().charAt(0);
            Tree t1 = Tree.construct(scanner.next().toCharArray());
            Tree t2 = Tree.construct(scanner.next().toCharArray());
            Tree t3;
            if (operation == 'i') {
                t3 = Tree.intersectionOf(t1, t2);
            } else {
                t3 = Tree.unionOf(t1, t2);
            }
            Tree.show(t3);
        }
    }

    public static void main(String... args) {
        solve();
    }
}

Measured memory_bytes: 12000
#include<iostream>
#include<cmath>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<string.h>
#include<queue>
#include<stack>
#include<climits>
#include<cmath>
using namespace std;

int dx[8]={-1,-1,-1,0,1,1,1,0};
int dy[8]={1,0,-1,-1,-1,0,1,1};
int m,n;
bool v[51][51];
int ma[51][51];

void go(int x,int y){
    v[y][x]=1;
    for(int i=0;i<8;i++){
        int nx=x+dx[i];
        int ny=y+dy[i];
        if(nx>=0&&nx<m&&ny>=0&&ny<n&&!v[ny][nx]&&ma[ny][nx]==1){
            go(nx,ny);
        }
    }
}

int main(){
    while(cin>>m>>n,m){
        int ans=0;
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                v[i][j]=0;
                cin>>ma[i][j];
            }
        }
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                if(v[i][j]==0&&ma[i][j]==1){
                    ans++;
                    go(j,i);
                }
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 1240
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

using namespace std;
using P = pair<long, long>;

typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvinv(xs) sort(xs.begin(), xs.end(), std::greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)
#define index_of(as, x) \
  distance(as.begin(), lower_bound(as.begin(), as.end(), x))

#define rep(i,n) for(auto i=0; i<(n); i++)

const int mod = 1000000007;

int xCnt[100005];
char xChar[100005];

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

  long n;
  cin >> n;

  vector<long> a(n);
  fillLong(a, n);

  sortv(a);
  vector<long> b(n+1);
  b[0] = 0;

  rep(i, n) {
    b[i+1] = b[i] + a[i];
  }

  int res = n;
  for(int i = n-1; i >= 1; i--) {
    if (b[i+1] > b[i] * 3) {
      res = n-i;
      break;
    } 
  }

  cout << res << endl;
}


Measured memory_bytes: 1792
#include <stdio.h>
#pragma warning( disable:4996 )

int n, A[2000];

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

int main(void)
{
	int q, M, i;

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


Measured memory_bytes: 2596
#include <stdio.h>
int main(void){
    int x, y;
    double c, t;
    scanf("%d%d", &x, &y);
    c = (4 * x - y) / 2.0;
    t = (y - 2 * x) / 2.0;
    if(c>=0 && t >=0 && c-(int)c==0 && t-(int)t==0){
        printf("Yes");
    }else{
        printf("No");
    }
    return 0;
}

Measured memory_bytes: 1728
// AOJ 1367: Rearranging a Sequence
// 2017.10.9 bal4u@uu

#include <stdio.h>
#include <stdlib.h>

typedef struct { int id, a; } T;
T tbl[200002];

int cmp(T *a, T *b) { return b->id - a->id; }

char buf[100], *p;
int getInt(void)
{
	int n = 0;
//	if (*p == ' ') p++;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ - '0');
	return n;
}

int main()
{
	int n, m, i, j;
	register T *tp;

	fgets(p = buf, 50, stdin); n = getInt(), p++, m = getInt(); 
//	scanf("%d%d", &n, &m);
	for (tp = tbl+1, j = n, i = 1; i <= n; i++, tp++) tp->id = j--, tp->a = i;
	while (m-- > 0) {
		fgets(p = buf, 50, stdin); j = getInt();
//		scanf("%d", &j);
		tbl[j].id = i++;
	}
	qsort(tbl+1, n, sizeof(T), cmp);
	for (tp = tbl+1, i = 1; i <= n; i++, tp++) printf("%d\n", tp->a);
	return 0;
}

Measured memory_bytes: 4408
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int main(){
    int x;
    cin >> x;
    vector<bool> flag(1001,false);
    if(x == 1){
        cout <<1 << endl;
        return 0;
    }
    reps(i,2,101){
        int tmp = i;
        while(tmp <= 1000){
            tmp *= i;
            if(tmp <= 1000){
                flag[tmp] = true;
            }
        }
    }

    for(int i = x; i >= 0; i--){
        if(flag[i]){
            cout << i << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 3624
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main()
{
	int N,M;
	map<int,int>P;
	cin>>N;
	for(int i=0;i<N;i++)
	{
		int t;
		cin>>t;
		P[t]++;
	}
	cin>>M;
	for(int i=0;i<M;i++)
	{
		int t;
		cin>>t;
		if(P[t]>0)
		{
			P[t]--;
		}
		else
		{
			cout<<"NO"<<endl;
			return 0;
		}
	}
	cout<<"YES"<<endl;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
long long i;
char x;
map<char,long long> m;
int main()
{
    for(i=1;i<=3;i++){
     cin>>x;
     m[x]++;
    }
    if(m['a']==1 && m['b']==1 && m['c']==1)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


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

int ary[100];
int n;

void output(){
	cout << ary[0];
	for(int i=1; i<n; i++){
		cout << " " << ary[i];
	}
	cout << "\n";
}

int main(){
	cin >> n;
	
	for(int i=0; i<n; i++) cin >> ary[i];
	
	for(int i=0; i<n; i++){
		int t = ary[i];
		int j;
		for(j=i-1; j>=0 && ary[j]>t; j--){
			ary[j+1] = ary[j];
		}
		ary[j+1] = t;
		output();
	}
	return 0;
}


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

int main(){
  long long a,b;
  cin >> a >> b;
  if(a*b<=0){
    cout << "Zero" << endl;
  }else if(a>0){
    cout << "Positive" << endl;
  }else if((b-a+1)%2==0){
    cout << "Positive" << endl;
  }else{
    cout << "Negative" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  ll x;
  cin >> x;
  cout << x/11*2+(x%11+6-1)/6 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

int main(){
  ll N, A, B;
  cin >> N >> A >> B;

  cout << std::min(N*A, B) << endl;
  
  return 0;
}


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

using namespace std;

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

	long sCnt = 0;
	long res = 0;
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == 'S') {
			sCnt++;
		}
		else {
			if (sCnt > 0) {
				sCnt--;
			}
			else {
				res++;
			}
		}
	}
	cout << res+sCnt << endl;

	return 0;
}

Measured memory_bytes: 640
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n,m,p=map(int,input().split())
g=[[] for _ in range(n)]
g2=[[] for _ in range(n)]
g3=[[] for _ in range(n)]
for _ in range(m):
    a,b,l=map(int,input().split())
    g[a-1].append([b-1,p-l])
    g2[a-1].append(b-1)
    g3[b-1].append(a-1)

f1=[False for _ in range(n)]
def dfs1(s):
    global f1
    global g2
    f1[s] = True
    for sg in g2[s]:
        if not f1[sg]:
            dfs1(sg)
f2=[False for _ in range(n)]
def dfs2(s):
    global f2
    global g3
    f2[s] = True
    for sg in g3[s]:
        if not f2[sg]:
            dfs2(sg)

dfs1(0)
dfs2(n-1)
f3 = []
for i in range(n):
    f3.append(f1[i] and f2[i])

def bellman_ford(g,n):
    INF = 10**10
    res = [INF for _ in range(n)]
    res[0] = 0
    for _ in range(n-1):
        for i in range(n):
            if res[i] != INF:
                for sa,sb in g[i]:
                    res[sa] = min(res[sa],res[i]+sb)
    ret = res[-1]
    for i in range(n):
        if res[i] != INF:
            for sa,sb in g[i]:
                if res[sa]>res[i]+sb:
                    if f3[sa]:
                        return False
    return ret

res = bellman_ford(g,n)
if type(res) == bool:
    print(-1)
elif res > 0:
    print(0)
else:
    print(res * -1)

Measured memory_bytes: 61532
#include <iostream>
#include <string>

using namespace std;

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

  string S;
  cin>>S;
  int W=0,E=0;

  int max=-1,part_sum=0;
  
  for(int j=1;j<N;j++){
    if(S[j]=='E'){
      part_sum++;
    }
  }
  max=part_sum;

  for(int i=1;i<N;i++){
    if(S[i-1]=='W'){
      part_sum++;
    }
    if(S[i]=='E'){
      part_sum--;
    }
    if(part_sum<=max){
      max=part_sum;
    }
  }

  cout<<max<<endl;

  return 0;
}


Measured memory_bytes: 900
#include<stdio.h>
#include<stdlib.h>
#define MAX 20

int row[MAX],col[MAX],U[MAX],V[MAX];
char ans[8][8];

void Solve(int y){
	int x,i,j;
	if(y==8){
		for(i=0;i<8;i++){
			for(j=0;j<8;j++){
				printf("%c",ans[i][j]);
			}
			printf("\n");
		}

		exit(0);
	}

	if(row[y]==1){
		Solve(y+1);
	}
	for(x=0;x<8;x++){
		if(col[x]==0 && U[y+x]==0 && V[y+(7-x)]==0){
			ans[y][x]='Q';
			col[x]=U[y+x]=V[y+(7-x)]=1;
			Solve(y+1);
			ans[y][x]='.';
			col[x]=U[y+x]=V[y+(7-x)]=0;
		}
	}
}

int main(){
	int i,n,y,x;	scanf("%d",&n);
	for(y=0;y<8;y++){
		for(x=0;x<8;x++)ans[y][x]='.';
	}
	for(i=0;i<n;i++){
		scanf("%d%d",&y,&x);
		ans[y][x]='Q';
		row[y]=col[x]=1;
		U[y+x]=V[y+(7-x)]=1;
	}
	Solve(0);

	return 0;
}



Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    ll H, N;
    cin >> H >> N;
    vector<ll> v(N);
    map < ll, ll> mp;
    rep(i, N) cin >> v[i];

    for (ll i = 0; i < N; i++){
        H -= v[i];
    }
    if(H <= 0){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


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

int main() {

  int N,ret,maxval,mval,mval2;
  cin>> N ;
  vector<int> A(N);
  vector<int>B(N);
  mval=0;
  mval2=0;
  for(int i=0;i<N;i++){
    cin>>A.at(i);
    B.at(i)=A.at(i);
  }

  sort(A.begin(), A.end() ,greater<int>());
  mval=A.at(0);
  mval2=A.at(1);

  for (int i=0;i<N;i++){
    maxval=mval;
    if(mval==B.at(i)){

      maxval=mval2;
  }
    cout<<maxval<<endl;
  }

}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
#define int long long

#ifdef LOCALL
#include "e:/Codes/lib/prettyprint.hpp"
#else
#define debug(...) 
#endif

template <typename T>
struct segtree {

  vector<T> seg, lazy;
  segtree(int n = 1e5) {
    n += 5;
    seg.resize(4*n, INT_MAX);
    lazy.resize(4*n, INT_MAX);
  }

  T join(T x, T y) {
    return min(x, y);
  }

  void lazy_update(int x, int s, int e) {
    if (lazy[x] == INT_MAX)	return ;
    seg[x] = min(seg[x], lazy[x]);

    if (s != e)
      lazy[2*x] = min(lazy[2*x], lazy[x]), lazy[2*x+1] = min(lazy[2*x+1], lazy[x]);
    lazy[x] = INT_MAX;
  }

  void build(int x, int s, int e, int val) {
    if (s == e) {
      seg[x] = val;
      return; 
    }

    int mid = (s + e) >> 1;
    build(2 * x, s, mid, val);
    build(2 * x + 1, mid + 1, e, val);

    seg[x] = join(seg[2*x], seg[2*x+1]);
  }

  void update(int x, int s, int e, int l, int r, T val) {
    lazy_update(x, s, e);
    if (s > r || e < l)	return ;

    if (s >= l && e <= r) {
      lazy[x] = min(lazy[x], val);
      lazy_update(x, s, e);
      return;
    }

    int mid = (s + e) >> 1;
    update(2 * x, s, mid, l, r, val);
    update(2 * x + 1, mid + 1, e, l, r, val);

    seg[x] = join(seg[2 * x], seg[2 * x + 1]);
  }

  T query(int x, int s, int e, int l, int r) {
    lazy_update(x, s, e);
    if (e < l || s > r)	return INT_MAX;
    if (s >= l && e <= r){
      return seg[x];
    }

    int mid = (s + e) >> 1;
    return join(query(2 * x, s, mid, l, r), query(2 * x + 1, mid + 1, e, l, r));
  }
};

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

  int n, q;
  cin >> n >> q;
  
  int ans = (n-2)*(n-2);
  segtree<int> v(n), h(n);
  v.build(1, 1, n, n);
  h.build(1, 1, n, n);

  while (q--) {
    int a, b;
    cin >> a >> b;

    if (a == 1) {
      int cur = h.query(1, 1, n, b, b);
      ans -= cur - 2;
      v.update(1, 1, n, 1, cur, b);
    } else {
      int cur = v.query(1, 1, n, b, b);
      ans -= cur - 2;
      h.update(1, 1, n, 1, cur, b);
    }
    debug(ans);
  }

  cout << ans << '\n';
}



Measured memory_bytes: 28188
#include<iostream>
using namespace std;
int a(int b, int c){return b+c;}
int s(int b, int c){return b-c;}
int m(int b, int c){return b*c;}
int d(int b, int c){return b/c;}

int main(){
    int n1, n2;
    char op;
    while(cin >> n1 >> op >> n2 && op != '?'){
        if      (op=='+') cout << a(n1,n2) << endl;
        else if (op=='-') cout << s(n1,n2) << endl;
        else if (op=='*') cout << m(n1,n2) << endl;
        else if (op=='/') cout << d(n1,n2) << endl;
    }
    return 0;
}


Measured memory_bytes: 3088
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int n = sc.nextInt();
			if(n==0) break;
			
			int cnt = 0;
			for(int a=0;a<182;a++){
				if(a*a>n) break;
				for(int b=a;b<182;b++){
					if(a*a+b*b>n) break;
					for(int c=b;c<182;c++){
						if(a*a+b*b+c*c>n) break;
						for(int d=c;d<182;d++){
							if(a*a+b*b+c*c+d*d==n) cnt++;
							else if(a*a+b*b+c*c+d*d>n) break;
						}
					}
				}
			}
			System.out.println(cnt);
		}	
	}	
}

Measured memory_bytes: 20008
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;

	public static void Main(string[] args)
	{
		var s = Console.ReadLine();
		long wa = 0;
		for(int bit = 0; bit < (1 << s.Length-1); bit++)
		{
			long r = 0;
			long keta = (long)(s[s.Length-1] - '0');
			int ten = 10;
			for(int i = 0; i < s.Length-1; i++)
			{
				if(((bit >> i) & 1) == 1)
				{
					r += keta;
					ten = 1;
					keta=0;
					keta += (long)(s[s.Length-1-(i+1)] - '0') * ten;
					ten = 10;
					
				}
				else
				{
					keta += (long)(s[s.Length-1-(i+1)] - '0') * ten;
					ten *= 10;
				}
			}
			r += keta;
			wa += r;
		}
		Console.WriteLine(wa);

	}
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define f(i,j,k) for(int i=j;i<k;i++)
using namespace std;
int main(){
    long long n,m=0;
    string s;
    cin>>n;
    map<string,long long> ss;
    f(i,0,n){
        cin>>s;
        ss[s]++;
    }
    
    for(auto x: ss){
        m=max(m,x.second);
    }
    for(auto x:ss){
        if(x.second==m){
            cout<<x.first<<endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 19212
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef vector<ll> Vl;
template<typename T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;



ll l;

int main() {

	cin >> l;

	l = l * l * l;

	cout << fixed << setprecision(10) << (long double)(l) / 27 << endl;

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include<iostream>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<set>
#include<string>
#include <sstream>
#include<bitset>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
const int INF = 0x7fffffff;
using lll = long long;
using ull = unsigned long long;
using namespace std;


int main(){
  lll ii,jj,kk;
  vector<int> ret;

  string s;

  cin >> s;

  if(s == "AAA" || s == "BBB"){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
  }

  return 0;
}


Measured memory_bytes: 3612
#include<iostream>
#include<string>
#include<utility>
#include<vector>
#include<stack>
#include<algorithm>
#include<cmath>
#include<stdio.h>


using namespace std;

int main(){

	int A,B,C;


	cin >>A>>B>>C;


	int D=A+B;

	if(D >C) cout <<B+C<<endl;

	else if(D==C) cout <<B+C<<endl;
	else cout <<2*D-A+1<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

signed main() {
	int n, m;
	cin >> n >> m;
	cout << n * (n - 1) / 2 + m * (m - 1) / 2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    int n;
    cin >> n;
    vint ans(n, 0);
    vint a(n);
    rep(i, n) cin >> a[i];
    rrep(i, n) {
        int sum = 0;
        for (int j = i; j < n; j += i+1) {
            sum += ans[j];
        }
        if (sum % 2 != a[i]) ans[i] = 1;
    }
    
    cout << accumulate(all(ans), 0) << endl;
    rep(i, n) if (ans[i] == 1) cout << i+1 << endl;
    return 0;
}

Measured memory_bytes: 2432
#include<iostream>
#include<algorithm>
using namespace std;
int n,m;
int q;
int _array[100];
int _left[100];
int _right[100];
int sub[100];
int value[100];
int ans=0;
void comb(int index,int num);
int main(){
  cin>>n>>m>>q;
  for(int i=0;i<q;i++){
    cin>>_left[i]>>_right[i]>>sub[i]>>value[i];
    _left[i]--;_right[i]--;
  }
  
  comb(0,1);
  cout<<ans<<endl;
  return(0);
}

void comb(int index,int num){
  if(index==n){
    int sum=0;
    for(int i=0;i<q;i++){
      int l=_left[i],r=_right[i];
      if(_array[r]-_array[l]==sub[i]){
	sum+=value[i];
      }
    }
    ans=max(ans,sum);
    return;
  }
  
  for(int i=num;i<=m;i++){
    _array[index]=i;
    comb(index+1,i);
  }
  return;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
#define mod 1000000007
const int INF=100100100;

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;} 
ll lcm(ll x,ll y) {return x/gcd(x,y)*y;}

int main(){
    ll h,n;
    cin >> h >> n;
    vector<ll> a(n);
    vector<ll> b(n);
    rep(i,n) cin >> a[i] >> b[i];
    
    vector<ll> dp(h+1,INF);
    dp[0]=0;
    
    for(ll i=0;i<n;i++){
        for(ll j=0;j<h;j++){
            ll nj=min(j+a[i],h);
            dp[nj]=min(dp[nj],dp[j]+b[i]);
        }
    }
    
    cout << dp[h] << endl;

    return 0;
}











Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


int main(){
    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    if (a == 0) cout << 1 << endl;
    else if (b == 0) cout << 2 << endl;
    else if (c == 0) cout << 3 << endl;
    else if (d == 0) cout << 4 << endl;
    else if (e == 0) cout << 5 << endl;
    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vp;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin() , v.end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll INF=99999999999999;
const ll MOD=1000000007;
 
int main() {
  ll n;
  cin >> n;
  vl a;
  inputv(a,n);
  ll ans=0;
  bool b = true;
  while(b){
   rep(i,n){
     if(a[i]%2 != 0){
       b = false;
     } else {
       a[i] /= 2;
     }
   }
    if(b){
      ans++;
    }
    
  }
  cout << ans;
 return 0;
}



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

int main(){
    int a, b, x, y;
    cin >> a >> b;
    for(int i = 1; i <= 999; i++){
        x += i;
        y = x + i + 1;
        if(abs(a - x) == abs(b - y)){
            cout << abs(a - x) << endl;
        }
    }
    return 0;
}


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

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef long double ld;

const ll mod = (ll)1e9 + 7;
const ll mxN = 200200;



void solve(){

	string a,b;
	cin>>a>>b;
	if(a.length()>b.length())
		cout<<"GREATER\n";
	else if(a.length()<b.length())
		cout<<"LESS\n";
	else if(a>b)
		cout<<"GREATER\n";
	else if(b>a)
		cout<<"LESS\n";
	else 
		cout<<"EQUAL\n";

}


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

	//ll t;cin>>t;while(t--)
	solve();

}


Measured memory_bytes: 256
s = input()
n = len(s)
def iseven(str, n):
    for i in range(0, n//2):
        if str[i] != str[i+n//2]:
            return False
    else:
        return True


for i in range(2, n, 2):
    if iseven(s, n-i):
        print(n-i)
        break


Measured memory_bytes: 2940
mon_n,hen_n,c=map(int,input().split(" "))
b=list(map(int,input().split(" ")))
a=[]
for i in range(mon_n):
    a.append(list(map(int, input().split(" "))))
cnt=0
for i in range(mon_n):
    if sum([a[i][ii]*b[ii] for ii in range(hen_n)])+c>0:
        cnt+=1
print(cnt)

Measured memory_bytes: 3064
N = int(input())
A = list(map(int, input().split()))
K = 0
t = 0
place = 0
for i in range(N):
    if abs(A[i]) > K:
        K = abs(A[i])
        place = i
        if A[i] >= 0:
            t = 0
        else:
            t = 1
print(2*N-2)
if t == 0:
    print(place+1, 2)
    print(place+1, 2)
    for i in range(2, N):
        print(i, i+1)
        print(i, i+1)
else:
    print(place+1, N-1)
    print(place+1, N-1)
    for i in range(N-2, 0, -1):
        print(i+1, i)
        print(i+1, i)

Measured memory_bytes: 62532
# -*- coding: utf-8 -*-
# 標準入力を取得
N = int(input())
S = []
for n in range(N):
    S_n = input()
    S.append(S_n)

# 求解処理
for v in ["AC", "WA", "TLE", "RE"]:
    # 結果出力
    print(f"{v} x {S.count(v)}")


Measured memory_bytes: 15984
import datetime
def get_h_m_s(td):
    m, s = divmod(td.seconds, 60)
    h, m = divmod(m, 60)
    return h, m, s
    
num = int(input())
td = datetime.timedelta(seconds = num)
h, m, s = get_h_m_s(td)
print(str(h) + ':' + str(m) + ':' + str(s))


Measured memory_bytes: 6048
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

# ソートして上位A個を使うと最大
# 場合の数は，vの最大値がA個以上あるかで場合分け

N,A,B = LI()
v = LI()

def linear_nCk(n,k):
    a = [1]*(k+1)
    for i in range(1,k+1):
        a[i] = a[i-1]*(n-k+i)//i
    return a[-1]

v.sort(reverse=True)

d = defaultdict(int)
use = defaultdict(int)

for i in range(N):
    d[v[i]] += 1
    if i < A:
        use[v[i]] += 1

if v[0] == v[A-1]:
    num = d[v[0]]
    ans = 0
    for i in range(A,min(B+1,num+1)):
        ans += linear_nCk(num,i)
    print(v[0])
    print(ans)
else:
    max_val = 0
    ans = 1
    for k,v in use.items():
        ans *= linear_nCk(d[k],v)
        max_val += k*v
    print(max_val/A)
    print(ans)

Measured memory_bytes: 38512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
typedef long long ll;
ll mod=1e9+7;
void add(ll &x,ll y){
	x+=y;
	x%=mod;
}
ll ex[401][401];	//ex[i][j] : i^j
ll esum[401][401];	//esum[d][i] : 1^d+2^d+..i^d
ll dp[401][401];
int N,C,A[400],B[400];
int main(){
	cin>>N>>C;
	rep(i,N) cin>>A[i];
	rep(i,N) cin>>B[i];
	rep1(i,400){
		ex[i][0]=1;
		rep(j,400) ex[i][j+1]=ex[i][j]*i%mod;
	}
	rep(d,401){
		rep1(j,400) esum[d][j]=(esum[d][j-1]+ex[j][d])%mod;
	}
	dp[0][0]=1;
	rep(i,N) rep(j,C+1){
		for(int k=0;j+k<=C;k++){
			add(dp[i+1][j+k],dp[i][j]*(esum[k][B[i]]-esum[k][A[i]-1]));
		}
	}
	cout<<(dp[N][C]+mod)%mod<<endl;
}

Measured memory_bytes: 3968
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define mod 1000000007ll
#define mod1 998244353ll
#define endl '\n'
#define inf ((ll)1e18+1)
#include<chrono>
using namespace chrono;
mt19937_64 rng(high_resolution_clock::now().time_since_epoch().count());
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define debr(x,y) {cout<<"-->  "<<#x<<" to "<<#y<<" :  "; auto itr=x; while(itr!=y) cout<<(*itr++)<<' '; cout<<endl; }
#define deba(x) {cout<<"-->  "<<#x<<" :  "; for(auto ele:(x)) cout<<ele<<"  "; cout<<endl; }
#define deb(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s);istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout<<endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a <<"  ,  ";
    err(++it, args...);
}


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
    cin>>n;
    int fac[n+1]={0};
    ll ans=0;
    for(int x=1;x<=n;x++){
        for(int y=x;y<=n;y+=x){
            fac[y]++;
        }
        ans+=fac[x];
    }
    ans-=fac[n];
    cout<<ans<<endl;

}


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

int main(){
    int n;
    cin >> n;
    int c[n];
    int i, j, min_j, tmp, cnt_swap=0;
    
    for(i=0; i<n; i++) cin >> c[i];
    
    for(i=0; i<n; i++){
        if (n==1) break; 
        min_j = i;
        for(j=i+1; j<n; j++){
            if (c[min_j] > c[j]) min_j = j;
        }
        if (i != min_j){
            tmp = c[i];
            c[i] = c[min_j];
            c[min_j] = tmp; 
            cnt_swap++;
        }
    }
    
    for(i=0; i<n; i++) cout << c[i] << " \n"[i==n-1];
    cout << cnt_swap << endl;
    
}


Measured memory_bytes: 3096
D=int(input())                                          #コンテの日数
c=list(map(int,input().split()))                        #26タイプ(AAC~AZC)のコンテストの満足度低下度
s=[list(map(int,input().split())) for _ in range(D)]    #s[d][i]...d(1<=d<=D)日目にi(1<=i<=26)番目のコンテストを行った時の満足度上昇
#types=[int(input()) for _ in range(D)]                  #コンテタイプ(1~26)
#満足度低下はΣ(1<=i<=26)ci*(d-last(d,i))                  #なおlast(d,i)=d日目以前に最後にタイプiのコンテストをやった日にち(ない場合0)
#よって満足度はs[d][i]-Σ(1<=i<=26)ci*(d-last(d,i))
#i日目のスコアはmax(10^6+s[d][i]-Σ(1<=i<=26)ci*(d-last(d,i)),0)
#last=[0]*26                                             #typeごとに、最後に使われた日にちを記録するよ
typ=0
ans=0
#greedyに最大とりまーす
for i in range(D):
    ma=0
    ind=0
    for j in range(26):
        if ma<=s[i][j]:
            ma=s[i][j]
            ind=j
    print(ind+1)


Measured memory_bytes: 68628