akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X, i) ((X>>i)&1)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define r_all(a) (a).rbegin() (a).rend()

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vii;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = (1<<30);
const ll INFL = (1L<<62);

int main() {
  int n, k; cin >> n >> k;
  string s; cin >> s;
  int ans = 1;
  int l = 0, r = 0, cnt = 0;
  while (r < n) {
    if (s[r] == '0') {
      while (s[r] == '0') r++;
      cnt++;
    }
    while (s[r] == '1') r++;

    if (cnt <= k) {
      // cout << l << ", " << r << endl;
      ans = max(ans, r - l);
    }
    if (cnt == k) {
      while (s[l] == '1') l++;
      while (s[l] == '0') l++;
      cnt--;
    }
  }
  if (cnt == k) {
    // cout << l << ", " << r << endl;
    ans = max(ans, r - l);
  }

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


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int iinf = 1 << 28;
const long long llinf = 1ll << 60;
const double PI = 3.14159265;

ll exp(ll a, ll b) {
    if (b == 0LL) return 1LL;
    if (b == 1LL) return a;
    ll ans = exp(a, b>>1);
    ans = (ans * ans) % MOD;
    if (b&1LL) ans = (ans * a) % MOD;
    return ans;
}

void work() {
    ll n, a, b; cin>>n>>a>>b;
    ll ans = (exp(2LL, n) - 1LL) % MOD;
    
    // a
    ll d1 = max(a, n-a), d2 = min(a, n - a);
    ll fact_n = 1LL;
    for (ll i = n; i > d1; --i) fact_n = (fact_n * i) % MOD;

    ll invff = 1LL;
    for (ll i = d2; i > 1; --i) invff = (invff * i) % MOD;
    ll na = (fact_n * exp(invff, MOD-2LL)) % MOD;
    ans = (ans - na + MOD) % MOD;

    // b
    d1 = max(b, n-b), d2 = min(b, n - b);
    fact_n = 1LL;
    for (ll i = n; i > d1; --i) fact_n = (fact_n * i) % MOD;

    invff = 1LL;
    for (ll i = d2; i > 1; --i) invff = (invff * i) % MOD;
    ll nb = (fact_n * exp(invff, MOD-2LL)) % MOD;
    ans = (ans - nb + MOD) % MOD;

    cout << ans << endl;
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    work();

    return 0;
}


Measured memory_bytes: 256
def solve(XL, N):
    XL.sort(key=lambda x:x[1])
    count = N
    for i in range(1, N):
        if XL[i][0] < XL[i-1][1]:
            XL[i][1] = XL[i-1][1]
            count -= 1
    return count
N = int(input())
XL = []
for i in range(N):
    x, l = map(int, input().split(' '))
    XL.append([x-l, x+l])
print(solve(XL, N))   

Measured memory_bytes: 25428
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define ll long long
#define ull unsigned long long
#define dd double
#define oo 1001007000
#define ff float
#define ooo 1000000100000000000
#define iii pair<ll,ll>
#define vii vector<ll>
#define viii vector<iii>
#define sss pair<str,str>
#define str string
#define sii set<ll>
#define siii set<iii>
#define st size_t
#define r0 return 0
#define pb push_back
#define sz size
using namespace std;

const char E='\n';
const int N=1005;
const int NN=1000001;
const ll md=998244353;



int main(){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
    ll x;
    cin >> x;
    ll ans=(x/500)*1000;
    x%=500;
    ans+=(x/5)*5;
    cout << ans << E;
    r0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#include <bits/stdc++.h>
using namespace std;
const int maxn=1000005;
vector<int>G[maxn];
int in[maxn]={0};
int u1[maxn]={0};
int v1[maxn]={0};
map<pair<int,int>,int>mm;
int ans=0;
void dfs(int u,int color){
    int col=0;
    for(auto v:G[u]){
        col++;
        if(col==color)
            col++;
        mm[make_pair(u,v)]=col;
        dfs(v,col);
    }
    ans=max(ans,col);
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int u,v;
    for(int i=0;i<n-1;i++){
        cin >> u1[i] >> v1[i];
        G[u1[i]].push_back(v1[i]);
        in[u1[i]]++;
        in[v1[i]]++;
    }
    //int ans=*max_element(in+1,in+n+1);
    dfs(1,0);
    cout << ans << endl;
    for(int i=0;i<n-1;i++){
        cout << mm[make_pair(u1[i],v1[i])] <<endl;
    }
    return 0;
}


Measured memory_bytes: 43520
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
//#define int long long
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

signed main() {
  ll k,a,b;cin>>k>>a>>b;
  if(b-a <= 2){
    cout << 1 + k << endl;
    return 0;
  }
  ll bis = 1, mon = 0;
  rep(i,k){
    if(mon){
      mon--;bis += b;
    }else if(i != k-1 && bis >= a){
      bis -= a;mon++;
    }else{
      bis++;
    }
  }
  cout << bis << endl;
}


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

class Program
{
    static void Main(string[] args)
    {
        new Program().Calc();
    }

    Scanner cin;

    public Program() { }

    void Calc()
    {
        cin = new Scanner();

        int n = cin.nextInt();
        int t = cin.nextInt();

        int minCost = int.MaxValue;

        for (int i = 0; i < n; ++i)
        {
            int c_ = cin.nextInt();
            int t_ = cin.nextInt();

            if (t_ <= t)
            {
                if (minCost > c_) { minCost = c_; }
            }
        }

        if (minCost == int.MaxValue)
        {
            Console.WriteLine("TLE");
        }
        else
        {
            Console.WriteLine(minCost);
        }
    }
}

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 13140
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;


public class Test
{	
    public static void Main()
	{
        string str = Console.ReadLine();
        string T = Console.ReadLine();

        bool isFind = false;
        char[] c1 = str.ToCharArray();
        char[] c2 = T.ToCharArray(); 

         List<string> list = new List<string>();
        string s;
        for(int i = 0 ; i < c1.Length - c2.Length +1 ; i++)
        {
            isFind = true;
            s = "";
            c1 = str.ToCharArray();
            for(int j = 0 ; j < c2.Length ; j++)
            {
                //Console.Write("c1 = " + c1[i+j] + "  c2 =" + c2[j] + "  j="+j );
                if(c1[i + j] == c2[j] || c1[i+j] == '?'){
                    //Console.Write("   ok ");
                }   else{
                    isFind = false;
                } 
                //Console.WriteLine();
            }
        
            if(isFind)
            {
                for(int k = 0 ; k < c2.Length ; k++){
                    c1[i+k] = c2[k];
                }
                for(int x = 0 ; x < c1.Length ; x++)
                {
                    if(c1[x] == '?') s += "a";
                    else s += c1[x].ToString();
                }
                list.Add(s);
                //Console.WriteLine(list[list.Count()-1]);
            }
        }       
        list.Sort();
        if(list.Count() > 0)
        {
            Console.WriteLine(list[0]);
        }
        else Console.WriteLine("UNRESTORABLE");
    }
}

Measured memory_bytes: 11488
N = int(input())
A = list(map(int, input().split()))
d = {}
for a in A:
  d[a] = d.get(a, 0) + 1
d2 = sorted(d.items(), reverse = True)
s = 0
t = 0
f = 0
for p in d2:
  if s == 0:
    if p[1] >= 4:
      print(p[0] * p[0])
      f = 1
      break
    elif p[1] >= 2:
      s = p[0]
  else:
    if p[1] >= 2:
      print(s * p[0])
      f = 1
      break
if f == 0:
  print(0)

Measured memory_bytes: 103172
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

int main() {
    ll N, W; cin >> N >> W;
    vector<ll> val(N);
    vector<ll> weight(N);
    for (int i = 0; i < N; ++i) {
        cin >> weight[i]; cin >> val[i];
    }

    ll dp[N + 1][W + 1];
    for (int w = 0; w < W + 1; ++w) {
        dp[0][w] = 0;
    }

    for (int i = 0; i < N; ++i) {
        for (int w = 0; w <= W; ++w) {
            if (w >= weight[i]) dp[i + 1][w] = max(dp[i][w], dp[i][w - weight[i]] + val[i]);
            else dp[i + 1][w] = dp[i][w];
        }
    }
    cout << dp[N][W] << endl;
}

Measured memory_bytes: 79104
import java.util.Scanner;

public class Main {
    static final int NIL = -1;
    static final int MAX = 26;
    static TNode[] nodes = new TNode[MAX];
    static int[] depth = new int[MAX];
    static int[] height = new int[MAX];

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        for(int i = 0; i < n; i++) {
            nodes[i] = new TNode(NIL, NIL, NIL);
        }
        for(int i = 0; i < n; i++) {
            int id = input.nextInt();
            int left = input.nextInt();
            int right = input.nextInt();

            nodes[id].left = left;
            nodes[id].right = right;

            if( left != NIL) {
                nodes[left].parent = id;
            }
            if(right != NIL) {
                nodes[right].parent = id;
            }
        }
        int root = 0;
        for(int i = 0; i < n; i++) {
            if (nodes[i].parent == NIL) root = i;
        }

        getHeight(root);
        getDepth(root, 0);

        for(int i = 0; i < n; i++) {
            print(i);
        }
    }

    public static int getSibling(int id) {
        int sibling = NIL;
        if (nodes[id].parent != NIL) {
            if(nodes[nodes[id].parent].left != id && nodes[nodes[id].parent].left != NIL) {
                sibling = nodes[nodes[id].parent].left;
            }
            if(nodes[nodes[id].parent].right != id && nodes[nodes[id].parent].right != NIL) {
                sibling = nodes[nodes[id].parent].right;
            }
        }
        return sibling;
    }

    public static int getHeight(int id) {
        int h1 = 0, h2 = 0;
        if(nodes[id].left != NIL) {
            h1 = getHeight(nodes[id].left) + 1;
        }
        if(nodes[id].right != NIL) {
            h2 = getHeight(nodes[id].right) + 1;
        }
        return height[id] = h1 > h2? h1: h2;
    }
    public static void getDepth(int id, int d) {
        if(id == NIL) return;
        depth[id] = d;
        getDepth(nodes[id].left, d + 1);
        getDepth(nodes[id].right, d + 1);
    }

    public static void print(int id) {
        System.out.print("node " + id + ": ");
        System.out.print("parent = " + nodes[id].parent + ", ");
        System.out.print("sibling = " + getSibling(id) + ", ");
        int degree = 0;
        if (nodes[id].left != NIL) {
            degree++;
        }
        if (nodes[id].right != NIL) {
            degree++;
        }
        System.out.print("degree = " + degree + ", ");
        System.out.print("depth = " + depth[id] + ", ");
        System.out.print("height = " + height[id] + ", ");

        if(nodes[id].parent == NIL) {
            System.out.println("root");
        } else if (nodes[id].left == NIL && nodes[id].right == NIL) {
            System.out.println("leaf");
        } else {
            System.out.println("internal node");
        }
    }
}

class TNode {
    public int parent, left, right;

    public TNode(int parent, int left, int right) {
        this.parent = parent;
        this.left = left;
        this.right = right;
    }
}


Measured memory_bytes: 26356
#include<bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
vector<pair<int,int>>v;
int vis[110][110];
int main()
{
    int n;
    scanf("%d",&n);
    memset(vis,0,sizeof vis);
    int nn=(n/2)*2;
    int l=1,r=nn;
    while(l<r)
    {
        vis[l][r]=vis[r][l]=1;
        l++,r--;
    }
    for(int i=1;i<=nn;i++)
    {
        for(int j=1;j<=nn;j++)
        {
            if(!vis[i][j]&&i!=j)
                v.push_back(make_pair(i,j)),vis[i][j]=vis[j][i]=1;
        }
    }
    if(n%2==1)
    for(int i=1;i<=nn;i++)
        v.push_back(make_pair(i,n));

    printf("%d\n",v.size());
    for(int i=0;i<v.size();i++)
        printf("%d %d\n",v[i].first,v[i].second);
    return 0;
}


Measured memory_bytes: 384
N = gets.to_i
A = gets.strip.split.map(&:to_i)
a = 0
b = 0
i = 0
B = []
while a == 0

    b = 0

    B = Marshal.load(Marshal.dump(A))
    c = B.select{|x| x > 0}.min 

    for i in 0..N-1

        if b == 0 && A[i] == c

            A[i] += 0
            b += 1

        else 

            A[i] = A[i] % c

        end

    end

    if A.select{|x| x > 0}.size == 1

        a += 1

    end

end 

puts A.select{|x| x > 0}[0]

Measured memory_bytes: 14476
import sys
input = sys.stdin.readline
H, W = map(int, input().split())
S = [tuple(input()[:-1]) for _ in [0]*H]

ex = []
ey = []

for x in range(W):
    for s in S:
        if s[x] == '#':
            break
    else:
        ex.append(x)

for y in range(H):
    if '#' in S[y]:
        continue
    ey.append(y)

for y, s in enumerate(S):
    if y in ey:
        continue
    for x, t in enumerate(s):
        if x in ex:
            continue
        print(t, end="")
    print()


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

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;

const int INF=1e9;
const int MOD=1e9+7;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

vs parse(const map<string,vs>& rules,const string& symb)
{
	vs res;
	for(string s:rules.at(symb)){
		if(res.size()>200)
			throw "no solution";
		if(s[0]=='[')
			res.push_back(s);
		else{
			vs tmp=parse(rules,s);
			res.insert(end(res),all(tmp));
		}
	}
	return res;
}

bool over50(int x)
{
	int a=x&255,b=x>>8&255,c=x>>16&255,d=x>>24&255;
	return a>50 || b>50 || c>50 || d>50;
}

int main()
{
	for(int na,nt,ng,nc;cin>>na>>nt>>ng>>nc && na|nt|ng|nc;){
		int m; cin>>m; cin.ignore();
		map<string,vs> rules;
		string symb0;
		rep(i,m){
			string line; getline(cin,line);
			istringstream iss(line);
			string from; iss>>from; from.erase(from.size()-1);
			vs to;
			for(string s;iss>>s;) to.push_back(s);
			rules[from]=to;
			if(i==0) symb0=from;
		}
		
		vs symbs;
		try{
			symbs=parse(rules,symb0);
		}
		catch(...){
			cout<<0<<endl;
			continue;
		}
		
		vector<unordered_map<int,int>> dp(2); dp[0][0]=1;
		for(auto symb:symbs){
			dp[1].clear();
			repi(i,1,symb.size()-1){
				int pos=string("ATGC").find(symb[i])*8;
				for(auto p:dp[0]){
					ull key,val; tie(key,val)=p;
					if(over50(key+=1<<pos)) continue;
					(dp[1][key]+=val)%=MOD;
				}
			}
			swap(dp[0],dp[1]);
		}
		
		ull key=na+(nt<<8)+(ng<<16)+(nc<<24);
		cout<<dp[0][key]<<endl;
	}
}

Measured memory_bytes: 8716
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	int H, W;
	cin >> H >> W;
	int N;
	cin >> N;
	vector<int> a(N);
	for (auto i = 0; i < N; ++i)
	{
		cin >> a[i];
	}

	vector<vector<int>> c(H, vector<int>(W));
	auto index = 0;
	for (auto y = 0; y < H; ++y)
	{
		for (auto x = 0; x < W; ++x)
		{
			auto temp = x;
			if (y % 2 > 0)
			{
				temp = W - x - 1;
			}
			c[y][temp] = index + 1;
			--a[index];
			if (a[index] <= 0)
			{
				++index;
			}
		}
	}

	for (auto y = 0; y < H; ++y)
	{
		for (auto x = 0; x < W; ++x)
		{
			cout << c[y][x];
			if (x < W - 1)
			{
				cout << " ";
			}
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 384
import sys
import math
from collections import deque
import bisect

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def main():
    N, M, K = NMI()
    A = NLI()
    B = NLI()
    A_cum = [0]*(N+1)
    B_cum = [0]*(M+1)
    for i, a in enumerate(A):
        A_cum[i+1] = A_cum[i] + a
    for i, b in enumerate(B):
        B_cum[i+1] = B_cum[i] + b

    ans = 0
    for i, sa in enumerate(A_cum):
        if K - sa < 0:
            continue
        idx = bisect.bisect_right(B_cum, K-sa)
        ans = max(ans, i+idx)

    print(ans-1)





if __name__ == "__main__":
    main()

Measured memory_bytes: 47892
#include<iostream>

using namespace std;

int main() {
	int left, right;
	cin >> left >> right;
	if (right - left + 1 >= 2019) {
		cout << 0;
	}
	else {
		long long min = 2019;
		for (long long i = left; i <= right; ++i) {
			for (long long j = i + 1; j <= right; ++j) {
				long long current = (i * j) % 2019;
				if (min > current) {
					min = current;
				}
			}
			
		}
		cout << min;
	}
	system("pause");
}

Measured memory_bytes: 504
#include <iostream>
#include <algorithm>

using namespace std;

double solve(int T, int D, int TA, int TB, int DA, int DB)
{
    double res = 999999999999999.99;
    
    for(int i = 0; i <= D; i += DA)
    {
        for(int j = 0; i + j <= D; j += DB)
        {
            int Acal = TA * i;
            int Bcal = TB * j;
            
            double Temperature = (1.0 * (Acal + Bcal)) / (i + j);
            
            res = min(res, abs(Temperature - T));
        }
    }
    
    return res;
}

int a, b, c, d, e, f;

int main()
{
    cin >> a >> b >> c >> d >> e >>f;
    
    printf("%.999999f\n", solve(a, b, c, d, e, f));
    
    return 0;
}

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

using namespace std;

int main()

{
    int n,x,t,d;
    cin>>n>>x>>t;
    if(n%x==0){
        d=(n/x);
    }
    else{
        d=(n/x);
        d=d+1;
    }
    cout<<d*t;
    return 0;
}



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

using namespace std;

#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

ll modpow(ll a, ll b){

    ll ans=1;
    while(b){
        if(b&1){
            ans=(ans*a)%mod;
        }
        a=(a*a)%mod;
        b=b/2;
    }
    return ans;
}

int inp[200010];

int main(){

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

    int n;
    cin>>n;

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

    int cnt = 0;
    int curr = 1;

    for(int i = 0; i < n; i++) {
        if(inp[i] == curr) {
            curr++;
        } else {
            cnt++;
        }
    }

    if(cnt == n) cout<<-1<<endl;
    else cout<<cnt<<endl;


}


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

int main() {
  ll n, m;
  cin >> n >> m;
  string s(n, 'a');
  ll ans = 0;
  rep(i, m) {
    int tmp;
    char tmp2;
    cin >> tmp >> tmp2;
    if (s.at(tmp - 1) == 'a') {
      s.at(tmp - 1) = tmp2;
    } else if (s.at(tmp - 1) == tmp2) {
    } else {
      ans = -1;
    }
  }
  rep(i, n) {
    if (i == 0 && s.at(i) == 'a') {
      s.at(i) = '1';
    }
    if (s.at(i) == 'a') {
      s.at(i) = '0';
    }
  }
  if (ans == -1) {
    cout << ans;
  } else if (s.size() != 1 && s.at(0) == '0') {
    cout << -1;
  } else if (m == 0 && n == 1) {
    cout << 0;
  } else if (m == 0) {
    cout << 1;
    rep(i, n - 1) { cout << 0; }
  } else {
    rep(i, n) { cout << s.at(i); }
  }
  cout << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#define INFINITY 1000000000
void merge(int*,int,int,int);
void mergesort(int*,int,int);

int count=0;

int main(){

  int i;
  int n;
  int left,right;
  
  scanf("%d",&n);
  int N[n];
  for(i=0;i<n;i++){
    scanf("%d",&N[i]);
  }
  left=0;
  right=n;
  mergesort(N,left,right);
  for(i=0;i<n;i++){
    if(i==n-1) printf("%d\n",N[i]);
    else printf("%d ",N[i]);
  }
  printf("%d\n",count);
  return 0;
}
void merge(int *N,int left,int mid,int right){

  int i,j,k;
  int r,l;
  l=mid-left;
  r=right-mid;
  int L[l],R[r];
  for(i=0;i<l;i++){
    L[i]=N[left+i];
  }
  for(i=0;i<r;i++){
    R[i]=N[mid+i];
  }
  L[l]=INFINITY;
  R[r]=INFINITY;
  
  i=0;
  j=0;
  for(k=left;k<right;k++){
    count++;
    if(L[i]<R[j]){
      N[k]=L[i];
      i++;
    }
    else{
      N[k]=R[j];
      j++;
    }
  }
}
void mergesort(int *N,int left,int right){

  int mid,i;
  if(left+1<right){
    mid=(left+right)/2;
    mergesort(N,left,mid);
    mergesort(N,mid,right);
    merge(N,left,mid,right);
  }
}



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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

inline void fastio () {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
}

#define whats(x) cerr << #x << " = " << (x) << "\n"; 

using LL = long long;
using LD = long double;

const LL INF = LLONG_MAX;
const LL MOD = 998244353;
const LL N = 2e5+1;

int main() {
	fastio();

	string s;
	cin >> s;

	string t = s.substr(0, 3);

	cout << t << "\n";


}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define ld long double
#define ll long long
#define loop(i,x,y) for(ll i=x;i<y;i++)
#define pb push_back
#define S second
#define F first


int * merge_sort(int * arr, int n){

	if(n == 1){
		int* arr0 = new int[1];
		arr0[0] = arr[0];
		return arr0;
	}
	int mid = n/2;

	int * arr1 =merge_sort(arr, mid);
	int * arr2 =merge_sort(arr + mid, (n-mid));

	int s1 = mid, s2 = n - mid;

	int * arr3 = new int[n];

	int i = 0, j = 0, k = 0;

	while(i < s1 && j < s2){

		if(arr1[i] < arr2[j])
			arr3[k++] = arr1[i++];
		else if(arr1[i] > arr2[j])
			arr3[k++] = arr2[j];
		else{
			arr3[k++] = arr1[i++];
			j++;
		}
	
	}

	while(i < s1)
		arr3[k++] = arr1[i++];

	while(j < s2)
		arr3[k++] = arr2[j++];

	return arr3;
  

}

void solve(){

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

	if( (a+w) < b)
		cout << b - (a+w) << endl;
	else if( b+w < a)
		cout << a - (b+w) << endl;
	else
		cout << 0 << endl;

}
 
 
int main(){
	    
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
 
	solve();
	 
	return 0;
 
}




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

class Triangle {

public:
	double Cross_Product_AB_AP, Cross_Product_BC_BP, Cross_Product_CA_CP;
	double Vec_ABx, Vec_BCx, Vec_CAx, Vec_APx, Vec_BPx, Vec_CPx;
	double Vec_ABy, Vec_BCy, Vec_CAy, Vec_APy, Vec_BPy, Vec_CPy;


	Triangle(double x1, double y1, double x2, double y2, double x3, double y3, double xp, double yp);

	bool IsInTriangle();
};


Triangle::Triangle(double x1, double y1, double x2, double y2, double x3, double y3, double xp, double yp){



	//??????????±???????
	//A(x1,y1),B(x2,y2),C(x3,y3),P(xp,yp)??¨????????????
	
	Vec_ABx = x2 - x1;
	Vec_BCx = x3 - x2;
	Vec_CAx = x1 - x3;
	Vec_APx = xp - x1;
	Vec_BPx = xp - x2;
	Vec_CPx = xp - x3;

	Vec_ABy = y2 - y1;
	Vec_BCy = y3 - y2;
	Vec_CAy = y1 - y3;
	Vec_APy = yp - y1;
	Vec_BPy = yp - y2;
	Vec_CPy = yp - y3;



	//AB??AP
	Cross_Product_AB_AP = Vec_ABx*Vec_APy - Vec_ABy*Vec_APx;
	//BC??BP
	Cross_Product_BC_BP = Vec_BCx*Vec_BPy - Vec_BCy*Vec_BPx;
	//CA??CP
	Cross_Product_CA_CP = Vec_CAx*Vec_CPy - Vec_CAy*Vec_CPx;

};


//????§???¢????????¨????????????????????????????????????
bool Triangle::IsInTriangle(){

	if ((Cross_Product_AB_AP >= 0 && Cross_Product_BC_BP >= 0 && Cross_Product_CA_CP >= 0) ||
		(Cross_Product_AB_AP <= 0 && Cross_Product_BC_BP <= 0 && Cross_Product_CA_CP <= 0)){

		return true;
	
	}
	else { return false;}

};


int main(){

	double x1, y1, x2, y2, x3, y3, xp, yp;

	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
	
		//????§???¢???????????§????????????
		Triangle Triangle(x1, y1, x2, y2, x3, y3, xp, yp);
		if (Triangle.IsInTriangle() == true){
			cout << "YES"<<endl;
		}
		else if (Triangle.IsInTriangle() == false) {
			cout << "NO" << endl;
		}
	}


	return 0;
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn = 1e5 + 50;
ll p[64];
int st[64];
int tot = 0;
void ins(ll x) {
	for (int i = 0; i < tot; ++i) {
		if ((x >> st[i]) & 1) {
			if (p[i]) x ^= p[i];
			else {
				p[i] = x;
				break;
			}
		}
	}
}
int n;
ll a[maxn];
int main()
{
	ios::sync_with_stdio(false);
	cin >> n;
	ll sum = 0;
	for (int i = 0; i < n; ++i) cin >> a[i], sum ^= a[i];
	for (int i = 60; i >= 0; --i) if (!((sum >> i) & 1)) st[tot++] = i;
	for (int i = 0; i < n; ++i) ins(a[i]);
	ll res = 0;
	for (int i = 0; i < tot; ++i)
		if (!((res >> st[i]) & 1)) res ^= p[i];
	cout << res + (sum ^ res) << endl;
}


Measured memory_bytes: 1152
import java.util.*;

public class Main {
    private static long INF = Long.MIN_VALUE;

    public void main(Scanner sc) {
        int n = sc.nextInt();
        int m = sc.nextInt();
        Node nodes[] = new Node[n];
        for (int i = 0; i < n; i++) {
            nodes[i] = new Node();
        }
        for (int i = 0; i < m; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            int c = sc.nextInt();
            nodes[a - 1].childs.add(new Edge(b - 1, c));
        }

        boolean isLoop = false;
        nodes[0].maxCost = 0;
        for (int i = 0; i < n; i++) {
            for (int v = 0; v < n; v++) {
                if (nodes[v].maxCost == INF) {
                    continue;
                }
                for (Edge e : nodes[v].childs) {
                    if (nodes[e.to].maxCost < nodes[v].maxCost + e.cost) {
                        nodes[e.to].maxCost = nodes[v].maxCost + e.cost;
                        if (e.to == n - 1 && i == n - 1) {
                            isLoop = true;
                        }
                    }
                }
            }
        }

        System.out.println(!isLoop ? nodes[n - 1].maxCost : "inf");
    }

    private class Edge {
        int to;
        long cost;

        public Edge(int to, long cost) {
            this.to = to;
            this.cost = cost;
        }
    }

    private class Node {
        long maxCost = INF;
        List<Edge> childs = new ArrayList<>();
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        new Main().main(sc);
        sc.close();
    }
}


Measured memory_bytes: 46116
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#define LL long long
#define rint register int
#define MAXN 500005
#define MAXM 3000005
#define INF 0x3f3f3f3f
using namespace std;

int n, m, cnt, head[MAXN], vis[MAXN], vis1[MAXN];
LL ans1, ans2, t1, t2, l, r, root, f[MAXN][2];

struct Edge {int next, to; LL dis;} edge[MAXM*2];

void addedge(int from, int to, LL dis)
{
	edge[++cnt].next=head[from];
	edge[cnt].to=to;
	edge[cnt].dis=dis;
	head[from]=cnt;
}

void dfs(int x, int op, LL val)
{
	if(op==1) l=max(l, 1-val);
	else r=min(r, val-1);
	f[x][0]=op; f[x][1]=val; vis[x]=1;
	for(int i=head[x]; i; i=edge[i].next)
	{
		int to=edge[i].to;
		if(!vis[to]) dfs(to, -op, edge[i].dis-val);
		else
		{
			LL tx=f[x][0]+f[to][0];
			LL ty=f[x][1]+f[to][1];
			if(tx==0 && ty!=edge[i].dis) {printf("0\n"); exit(0);}
			if(tx!=0)
			{
				LL temp=edge[i].dis-ty;
				if(temp%2) {printf("0\n"); exit(0);}
				if(root==-INF) root=temp/tx;
				if(root!=temp/tx) {printf("0\n"); exit(0);}
			}
		}
	}
}
	
void cal(int x, LL val1, LL val2)
{
	//t1+=p[x]-val1; t2+=p[x]-val2;
	vis1[x]=1;
	for(int i=head[x]; i; i=edge[i].next)
	{
		int to=edge[i].to;
		if(!vis1[to]) cal(to, edge[i].dis-val1, edge[i].dis-val2);
	}
}

int main()
{
	scanf("%d%d", &n, &m);
	for(int i=1; i<=m; i++)
	{
		int x, y, z;
		scanf("%d%d%d", &x, &y, &z);
		addedge(x, y, z);
		addedge(y, x, z);
	}
	for(int i=1; i<=n; i++)
		if(!vis[i])
		{
			l=0, r=1e18, root=-INF;
			dfs(i, 1, 0);
			if(l>r) {printf("0\n"); return 0;}
			if(root==-INF)
			{
				//cal(i, l, r);
				//ans1+=min(t1, t2); ans2+=max(t1, t2);
				printf("%lld\n", r-l+1);
			}
			else
			{
				if(root>=l && root<=r)
				{
					//cal(i, l, r);
					//ans1+=min(t1, t2); ans2+=max(t1, t2);
					printf("1\n");
				}
				else printf("0\n");
			}
		}
	//printf("%lld %lld\n", ans1, ans2);
}

/*
5 4
8 7 5 9 8
1 2 10
1 3 10
2 4 3
2 5 4
*/


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

int main() {
  long long N;
  cin >> N;
  long long previous;
  long long UD = 0;
  long long count = 0;
  for (long long i = 0; i < N; i++){
    long long a;
    cin >> a;
    if (i != 0){
      if (UD == 0){
        if (a > previous) UD = 1;
        if (a < previous) UD = -1;
      }
      if (UD == 1){
        if (a < previous){
          count++;
          UD = 2;
        }
      }
      if (UD == -1){
        if (a > previous){
          count++;
          UD = 2;
        }
      }
      if (UD == 2){
        UD = 0;
      }
    }
    previous = a;
  }
  if (UD != 2) count++;
  cout << count << endl;
}

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }

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

    int x, t; cin >> x >> t;
    cout << max(0, x - t) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <utility>
#include <vector>

#include <atcoder/twosat>

int main() {
  int n, d;
  scanf("%d %d", &n, &d);

  std::vector<std::pair<int, int>> xy(n);
  for (auto& [x, y]: xy) scanf("%d %d", &x, &y);

  atcoder::two_sat ts(2*n);
  for (int i = 0; i < n; ++i) {
    ts.add_clause(2*i, true, 2*i+1, true);
    ts.add_clause(2*i, false, 2*i+1, false);
    auto [xi, yi] = xy[i];
    for (int j = 0; j < n; ++j) {
      if (i == j) continue;
      auto [xj, yj] = xy[j];
      if (std::abs(xi-xj) < d) ts.add_clause(2*i, false, 2*j, false);
      if (std::abs(xi-yj) < d) ts.add_clause(2*i, false, 2*j+1, false);
      if (std::abs(yi-xj) < d) ts.add_clause(2*i+1, false, 2*j, false);
      if (std::abs(yi-yj) < d) ts.add_clause(2*i+1, false, 2*j+1, false);
    }
  }

  if (!ts.satisfiable())
    return puts("No"), 0;

  puts("Yes");
  auto ans = ts.answer();
  for (int i = 0; i < n; ++i)
    printf("%d\n", ans[2*i]? xy[i].first: xy[i].second);
}


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

typedef vector <long> vl;
typedef vector <vl> vvl;

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

int main() {
  
    int N,W;
    cin >> N >> W;
    vl weights(W+1);
    long maxValue = 0;
    for(int i = 0; i < N;i++){
        int iw;
        long v;
        cin >> iw >> v;
        for(int w = W - iw; w >= 0;--w){
            weights[w + iw] = max(weights[w + iw],weights[w] + v);
            maxValue = max(maxValue , weights[w+iw]);
        }
    }
   
  
    cout << maxValue <<  endl;
    return 0;
}




Measured memory_bytes: 3636
import java.util.*;
import java.io.*;
 
public class Main{
  public static void main(String[]args)throws IOException{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    PrintWriter out = new PrintWriter(System.out);
    String[] S = br.readLine().split(" ");
    int N = Integer.parseInt(S[0]);
    int M = Integer.parseInt(S[1]);
    
    int[][] val = new int[M][3];
    for(int i = 0; i < M; i++){
      String[] T = br.readLine().split(" ");
      val[i][0] = Integer.parseInt(T[0]);
      val[i][1] = Integer.parseInt(T[1]);
      val[i][2] = i;
    }
    Arrays.sort(val, (a, b) -> Integer.compare(a[1], b[1]));
    
    String[] ans = new String[M];
    int[] count = new int[N+1];
    for(int i = 0; i < M; i++){
      int a = val[i][0];
      count[a]++;
      ans[val[i][2]] = String.format("%06d%06d", a, count[a]);
    }
    
    for(String s : ans){
     out.println(s); 
    }
    out.flush();
  }
}


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

ll gcd(ll a, ll b) { for (; b; a %= b, swap(a, b)); return a; }

int r, c, k;
ll board[3001][3001];

ll dp[3001][3001][4];
ll solve(int x, int y, int h)
{
	ll& ret = dp[x][y][h];
	if (ret != -1) return ret;

	ret = 0;
	if (x + 1 <= r)
	{
		ll res = 0;
		if (h < 3) res = max(res, solve(x + 1, y, 0) + board[x][y]);
		res = max(res, solve(x + 1, y, 0));

		ret = max(ret, res);
	}

	if (y + 1 <= c)
	{
		ll res = 0;
		if (h < 3) res = max(res, solve(x, y + 1, h + 1) + board[x][y]);
		res = max(res, solve(x, y + 1, h));

		ret = max(ret, res);
	}

	if (h < 3) ret = max(ret, board[x][y]);
	return ret;
}

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

	cin >> r >> c >> k;
	for (int i = 0; i < k; i++)
	{
		ll x, y, v; cin >> x >> y >> v;
		board[x][y] = v;
	}

	memset(dp, -1, sizeof dp);

	ll ans = solve(1, 1, 0);

	cout << ans;
}

Measured memory_bytes: 355700
#include <cstdio>
#include <algorithm>
using std::max;
int main(void)
{
    int dp[2][3],a[3],i,N;
    i=0; 
    dp[0][0]=0;
    dp[0][1]=0;
    dp[0][2]=0;

    scanf("%d",&N);
    while(N--)
    {
        scanf("%d%d%d",a,a+1,a+2);
        dp[1-i][0]=a[0]+max(dp[i][1],dp[i][2]);
        dp[1-i][1]=a[1]+max(dp[i][0],dp[i][2]);
        dp[1-i][2]=a[2]+max(dp[i][1],dp[i][0]);
        //printf("%d\t%d\t%d\n",dp[1-i][0],dp[1-i][1],dp[1-i][2]);
        i=1-i;
    }
    printf("%d\n",max(max(dp[i][0],dp[i][1]),dp[i][2]));
    return 0;
}


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

using namespace std;
bool vis[200005];
vector<int> rad[200005];
int n;
int xcnt,ycnt;
void dfs(int now)
{
    vis[now] = true;
    if(now>100000) ++xcnt;
    else ++ycnt;
    for(int i=0;i<rad[now].size();++i)
    {
        if(vis[rad[now][i]]) continue;
        dfs(rad[now][i]);
    }
}

int main()
{
    scanf("%d",&n);
    int u,v;
    for(int i=0;i<n;++i)
    {
        scanf("%d%d",&u,&v);
        u+=100000;
        rad[u].push_back(v);
        rad[v].push_back(u);
    }
    long long ecnt = 0;
    for(int i=1;i<=100000;++i)
    {
        if(vis[i]) continue;
        xcnt = 0;ycnt = 0;
        dfs(i);
        ecnt += 1LL * xcnt * ycnt;
    }
    printf("%lld\n",ecnt-n);
    return 0;
}


Measured memory_bytes: 11264
#include <bits/stdc++.h>
#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() {
  string s; cin >> s;

  if (s.size() >= 6 && s.at(2) == s.at(3) && s.at(4) == s.at(5)){
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i = 0;i < (n); ++i)
#define all(v) v.begin(),v.end()
#define sort_1(v) sort(v.begin(),v.end())
#define sort_2(v) sort(v.begin(),v.end(),greater<ll>())
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
    ll a,b,n;
    cin >> a >> b >> n;
    ll x = n;
    if(n >= b-1) x = b-1;
    ll ans = a*x/b - a*(x/b);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3600
N = gets.to_i
S = gets.strip.chars.map{|c| c == 'o' ? 1 : -1}

def go(l)
  (0 ... N).inject(l){|l, i| l << (l[-1] * S[i]) * l[-2]}
end

res = ([-1, 1]).repeated_permutation(2).map{|l| go(l)}.find{|r| r[0, 2] == r[N, 2]}
puts res ? res[1, N].map{|n| n == 1 ? 'S' : 'W'}.join : '-1'

Measured memory_bytes: 16504
#include<cstdio>
using namespace std;
int main(){
	double matrix[4],ans[2];
	while(scanf("%lf %lf %lf %lf %lf %lf",&matrix[0],&matrix[1],&ans[0],&matrix[2],&matrix[3],&ans[1]) != EOF){
		double t = matrix[0]*matrix[3]-matrix[1]*matrix[2];
		printf("%.3lf %.3lf\n",matrix[3]*ans[0]/t-matrix[1]*ans[1]/t,-matrix[2]*ans[0]/t+matrix[0]*ans[1]/t);
	}
	return 0;
}

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))

typedef long long LL;

int main(){
  int n;
  cin >> n;
  vector<LL> a(n);
  for(int i=0;i<n;i++) cin >> a[i];
  vector<int> b(n,0);
  b[0]=0;
  int now=1;
  for(int i=1;i<n;i++){
    if(a[i]>a[b[now-1]]){
      b[now]=i;
      now++;
    }
  }
  // for(int i=0;i<now;i++) cout << b[i] << endl;
  priority_queue<LL> q;
  vector<LL> ans(n,0);
  LL total=0,num=0,prenum=0;
  if(now==1){
    for(int i=0;i<n;i++){
      ans[0]+=a[i];
    }
    for(int i=0;i<n;i++) cout << ans[i] << endl;
  }else{
    for(int i=b[now-1];i<n;i++){
      q.push(a[i]);
    }
    for(int i=now-1;i>0;i--){
      // cout << i << "---------" << endl;
      total=0;
      while(!q.empty()&&q.top()>a[b[i-1]]){
        // cout << q.top() << " ";
        total+=q.top()-a[b[i-1]];
        num++;
        q.pop();
      }
      // cout << endl;
      // cout << endl;
      total+=prenum*(a[b[i]]-a[b[i-1]]);
      // cout << prenum << endl;
      prenum=num;
      ans[b[i]]=total;
      // if(i>1){
        for(int j=b[i-1];j<b[i];j++){
          q.push(a[j]);
        }
      // }
    }
    for(int i=0;i<n;i++){
      if(a[b[0]]<a[i]) ans[0]+=a[b[0]];
      else ans[0]+=a[i];
    }
    for(int i=0;i<n;i++) cout << ans[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 3320
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    string a,b; cin>>a>>b;
    string ans;
    if(a.size()!=b.size()){
        if(a.size()>b.size()) ans="GREATER";
        else ans="LESS";
    }
    else{
        if(a>b) ans="GREATER";
        else if(a<b) ans="LESS";
        else ans="EQUAL";
    }
    cout<<ans<<endl;
}


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

int main(){
    int n;
    cin >> n;
    int count = n/4 + 1;
    for(int i = 0; i < count; i++)
    {
        for(int j = 0; j < count; j++)
        {
            if ((4*i + 7*j) == n) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}

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

int main(){
	int n, l;
	cin >> n >> l;
	
	int a[n]={};
	int sum=0;
	for(int i=0; i<n; i++){
		a[i] = l+i+1-1;
		sum += a[i];
	}
	
	//all+ then flag=n, all- then flag=0, mixed then flag=1~n-1
	int flag=0;
	for(int i=0; i<n; i++){
		if(a[i]>=0) flag++;
	}
	
	int ans=0;
	if(flag==n){  //all+
		sort(a, a+n);
		for(int i=1; i<n; i++) ans+=a[i];
		cout << ans << endl;
	}else if(flag==0){  //all- 
		sort(a, a+n, greater<int>());
		for(int i=1; i<n; i++) ans+=a[i];
		cout << ans << endl;
	}else{  //mixed
		for(int i=0; i<n; i++) ans+=a[i];
		cout << ans << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
long long n;
long long ans=0;
long long a[101];
long long cl(long long x)
{
	for(long long  i=2;x!=1;i++)
	{
		while(x%i==0)
		{
			x/=i;
			a[i]++;
		}
	}
}
int main()
{
	cin>>n;
	memset(a,0,sizeof(a));
	for(long long i=2;i<=n;i++)
	{
		cl(i);
	}
	int x24=0,x2=0,x4=0,x14=0,x74=0;
	for(int i=2;i<=n;i++)
	{
		if(a[i]>=24)x24++;
		if(a[i]>=2)x2++;
		if(a[i]>=4)x4++;
		if(a[i]>=14)x14++;
		if(a[i]>=74)x74++;
	}
	long long ans=0;
	ans+=x74+(x2-2)*x4*(x4-1)/2+x14*(x4-1)+x24*(x2-1);
	cout<<ans;
	return 0;
}

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

typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define PB push_back
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((ll)(x).size())
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define pvd(v) cout << setprecision(16) << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, start_index, num)  (a).begin()+(start_index),(a).begin()+(num)

int main() {
	vector<int> 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 };
	int k;
	cin >> k;
	pv(a[k - 1]);
	return 0;
}

Measured memory_bytes: 3584
N,K = [int(i) for i in input().split()]
D = sorted([int(i) for i in input().split()],reverse=True)

def is_ok(x):
  while x!=0:
    if x%10 in D:
      return False

    x //=10

  return True

while True:
  if is_ok(N):
    print(N)
    break
  N+=1

Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define pie 3.141592653589
using namespace std;

int main()
{
  long long N,ans=1000000000000;scanf("%lld",&N);
  long long i=0;
  while((i+1)*(i+1)<=N)
  {
    i++;
    if(N%i!=0)continue;
    long long j=N/i;
    ans=min(i+j-2,ans);
  }
  printf("%lld",ans);
}

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

using namespace std;

#define int long long
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = (long long)1e9 + 7; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N, ans = 1;
	string s1, s2;
	
	cin>>N;
	cin>>s1>>s2;
	
	for(int i = 0; i < N; i++){
		if(s1[i] == s2[i]){
			if(i){
				if(s1[i-1] == s2[i-1]){
					ans *= 2;
				} else {
					ans *= 1;
				}
			} else {
				ans *= 3;
			}
		} else{
			if(i){
				if(s1[i-1] == s2[i-1]){
					ans *= 2;
				} else {
					ans *= 3;
				}
			} else {
				ans *= 6;
			}
			i++;
		}
		ans %= MOD;
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s, t;
  cin >> s;
  for(auto i : s){
    if(!t.empty() && t.back() != i) t.pop_back();
    else t.push_back(i);
  }
  cout << s.size() - t.size() << endl;
  return 0;
}


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

#define for_(i,a,b) for(int i = (a);i < (b);i++)
#define rfor_(i,a,b) for(int i = (b)-1;i >= (a);i--)
#define rep(i,n) for_(i,0,(n))
#define rrep(i,n) rfor_(i,0,(n))

int a, b;

int main(){
	cin.tie(0);

    cin>>a>>b;
    
    cout<<(a/b)<<' '<<(a%b)<<' ';
    cout << fixed;
    cout << setprecision(5) << ((double)a/(double)b) <<endl;
    
	return 0;
}



Measured memory_bytes: 3292
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	string  n;
	cin >> n;
	int count = 0,soeji;
	if (n[0] == 'A') {
		
		for (int i = 2; i < n.size()-1; i++) {
			if (n[i] == 'C') {
				soeji = i;
				count++;
				
			}
		}
		for (int i = 1; i < n.size(); i++) {
			if (i != soeji && (n[i]<'a'||n[i]>'z')) {
				cout << "WA" << endl;
				exit(0);
			}
		}
	}
	if (count == 1) {
		cout << "AC" << endl;
	}
	else {
		cout << "WA" << endl;
	}

}


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

class BIT {
public:
    static const int MAX_N = 100000;
    // [1, n]
    int bit[MAX_N+1], n;

    BIT(int n) {
        this->n = n;
        for (int i = 0; i <= n; i++) bit[i] = 0;
    }

    int sum(int i) {
        int s = 0;
        while (i > 0) {
            s += bit[i];
            i -= i & -i;
        }
        return s;
    }

    int getSum(int s, int t) {
        return sum(t) - sum(s-1);
    }

    void add(int i, int x) {
        while (i <= n) {
            bit[i] += x;
            i += i & -i;
        }
    }
};

int main(void) {
    int n, q; cin >> n >> q;
    BIT bit(n);

    for (int i = 0; i < q; i++) {
        int com, x, y; cin >> com >> x >> y;
        if (com == 0) {
            bit.add(x, y);
        } else {                // com == 1
            cout << bit.getSum(x, y) << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 3484
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(dead_code)]
use proconio::input;
use proconio::marker::*;
use std::cmp::{min, max};
use std::collections::{HashSet, HashMap, BinaryHeap, VecDeque};

static MOD: i64 = 1e9 as i64 + 7;

fn main() {
    input! {
        n: usize,
    }
    let mut ans = 0;
    for i in 1..1000000{
        for j in 1..1000000{
            if i * j >= n{
                break;
            }
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2140