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


int main(){
  int n, i, j, ch=0;
  //cin >> n;
  //vector<int> A(n);
  //for(i=0; i<n; i++) cin >> A[i];
  //int a, b, c;
  string s;
  //cin >> a >> b;
  cin >> s;
  if(s.at(0) == s.at(1) && s.at(1) == s.at(2)) cout << "No" << endl;
  else cout << "Yes" << endl;
  
  
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/



int main() {
	int N;
	cin >> N;
	vector<string>W(N);
	rep(i, N) {
		cin >> W[i];
	}
	vector<string>w(N);
	rep(i, N) {
		w[i] = W[i];
	}
	int cnt = 0;
	sort(w);
	for (int i = 1; i < N; i++) {
		if (w[i - 1] == w[i]) {
			cout << "No" << endl;
			return 0;
		}
	}
	for (int i = 1; i < N; i++) {
		if (W[i - 1][W[i - 1].size() - 1] != W[i][0]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<vector>
using namespace std;
vector<int>v[110];
int ind[110];
int sum[110];
int main(){
	int a,b;
	while(scanf("%d%d",&a,&b),a){
		int f=0;
		for(int i=0;i<a;i++){
			int c;scanf("%d",&c);
			v[i].clear();
			v[i]=vector<int>(c);
			f+=c;
			for(int j=0;j<c;j++){
				int p;scanf("%d",&p);
				v[i][j]=p;
			}
		}
		for(int i=0;i<a;i++)ind[i]=0;
		for(int i=0;i<a;i++)sum[i]=0;
		bool ok=true;
		while(f--){
			bool OK=false;
			for(int i=0;i<a;i++){
				if(ind[i]==v[i].size())continue;
				sum[i]+=v[i][ind[i]];
				int R=0;int L=999999999;
				for(int j=0;j<a;j++){R=max(R,sum[j]);L=min(L,sum[j]);}
				if(L+b>=R){
					ind[i]++;
					OK=true;break;
				}else{
					sum[i]-=v[i][ind[i]];
				}
			}
			if(!OK){ok=false;break;}
		}
		if(ok)printf("Yes\n");
		else printf("No\n");
	}
}

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

void compress(vector<int> &a) {
	vector<int> sa; int i;
	for (i = 0; i < a.size(); i++) sa.push_back(a[i]);
	sort(sa.begin(), sa.end());
	sa.erase(unique(sa.begin(), sa.end()), sa.end());
	for (i = 0; i < a.size(); i++) a[i] = lower_bound(sa.begin(), sa.end(), a[i]) - sa.begin();
}

int n;
vector<int> a;
int cnt[100000];

int main() {
	int i;
	
	cin >> n;
	a.resize(n);
	for (i = 0; i < n; i++) cin >> a[i];
	compress(a);
	
	int nozeroCnt = 0;
	vector<int> ans;
	for (i = 0; i < n; i++) {
		if (cnt[a[i]] == -1) nozeroCnt--; if (cnt[a[i]] == 0) nozeroCnt++;
		cnt[a[i]]++;
		if (cnt[a[n - 1 - i]] == 1) nozeroCnt--; if (cnt[a[n - 1 - i]] == 0) nozeroCnt++;
		cnt[a[n - 1 - i]]--;
		if (nozeroCnt == 0) {
			ans.push_back(i + 1);
		}
	}
	
	for (i = 0; i < ans.size(); i++) {
		cout << ans[i];
		if (i + 1 < ans.size()) cout << " ";
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 4292
import copy
import sys

def partition(A, p, r):
    key = A[r][1]
    i = p
    for j in range(p, r):
        # 把小的放在左边
        if A[j][1] <= key:
            A[i], A[j] = A[j], A[i]
            i += 1
    # 最后交换key值
    A[r], A[i] = A[i], A[r]
    return i

def quick_sort(A, p, r):
    if p < r:
        q = partition(A, p, r)
        quick_sort(A, p, q - 1)
        quick_sort(A, q + 1, r)

def merge(A, left, mid, right):
    L = A[left: mid] + [(0, sys.maxsize)]
    R = A[mid: right] + [(0, sys.maxsize)]
    i = j = 0
    k = left
    while k < right:
        if L[i][1] <= R[j][1]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1
        k += 1

def merge_sort(A, left, right):
    if right - left > 1:
        mid = (left + right) // 2
        merge_sort(A, left, mid)
        merge_sort(A, mid, right)
        merge(A, left, mid, right)


if __name__ == '__main__':
    n = int(input())
    numlist = []
    for _ in range(n):
        datas = input().split(' ')
        numlist.append((datas[0], int(datas[1])))
    list2 = copy.deepcopy(numlist)
    quick_sort(numlist, 0, n - 1)
    merge_sort(list2, 0, n)
    if list2 == numlist:
        print('Stable')
    else:
        print('Not stable')
    for c, num in numlist:
        print('%s %d' % (c, num))


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

int main() {
  int A1, A2, A3;
  cin >> A1 >> A2 >> A3;

  if (A1+A2+A3 < 22) {
    cout << "win" << endl;
  }
  else {
    cout << "bust" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
// #include <boost/multiprecision/cpp_int.hpp> 

#define gc getchar//_unlocked
#define pc putchar//_unlocked
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define pp pair<int,int>
#define ppl pair<ll,ll>
#define bigint boost::multiprecision::cpp_int
#define finp ios_base::sync_with_stdio(0);cin.tie(0);
#define bc __builtin_popcountll
#define afor(i,a,b) for(int i=a;i<=b;++i)
#define bfor(i,a,b) for(int i=a;i>=b;--i)
#define vi vector<int>
#define vpp vector<pp>
#define vll vector<ll>
#define fr first
#define se second

using namespace std;
using namespace __gnu_pbds;

char putnb[20];
void putn(ll n) {if(!n)pc('0');if(n<0)pc('-'),n=0-n;int pi=0;while(n)putnb[pi++]=(n%10)+'0',n/=10;while(pi)pc(putnb[--pi]);}
void sci(int *x) {register char c = gc();*x = 0;for(; (c<48)||(c>57);c = gc());for(; (c>47)&&(c<58);c = gc())*x = (int)((((*x)<<1) + ((*x)<<3)) + c - 48);}
void scll(ll *x)  {register char c = gc();*x = 0;for(; (c<48)||(c>57);c = gc());for(; (c>47)&&(c<58);c = gc())*x =  (ll)((((*x)<<1) + ((*x)<<3)) + c - 48);}
ll fp(ll a,ll b,ll c) {if(b==0)return 1%c; if(b==1)return a%c; ll ret=fp(a,b/2,c); ret=(ret*ret)%c; if(b&1)ret=(ret*a)%c; return ret;}

const ll mod=1e9 +7;
const ll mod2=1999999973;
const ll inf=1e18;
const int infs=1e9 + 1000;
const int N=100000;
const long double PI = acos(-1);

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



int main()
{
  finp;
  ll a,b,c;
  cin>>a>>b>>c;
  ll tored = min(a,c);
  ll ans = 0;
  ans+= tored;
  a-=tored;
  c-=tored;

  tored = min(c,b);
  ans+= 2*tored;
  c-=tored;
  b-=tored;

  ans+=b;
  ans+= min(c,1LL);
  cout<<ans;
 return 0;

}

Measured memory_bytes: 256
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)]
        rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
#sys.setrecursionlimit(10**5)
input=lambda: sys.stdin.readline().rstrip()

def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

show_flg=False
show_flg=True

ans=0

a,b,k=LI()
#for i in range(n):

if k<=a:
    a=a-k
elif a<k<=a+b:
    b-=k-a
    a=0
else:
    a,b=0,0
print(a,b)




Measured memory_bytes: 39276
import sys
sys.setrecursionlimit(4100000)
def pow(i,n):
  ret = 1
  if n == 0: return ret
  elif n & 1: return i*pow(i,n//2)**2
  else: return pow(i,n//2)**2
mod = 10**9 + 7
def fac(n):
  ans = 1
  for i in range(1,n+1):
    ans *= i
    ans %= mod
  return ans
n = int(input())
print(fac(n))

Measured memory_bytes: 3064
//---------- begin union_find ----------
#[allow(dead_code)]
mod union_find {
    pub struct UF {
        p: Vec<i32>,
    }
    impl UF {
        pub fn new(n: usize) -> UF {
            UF {p: vec![-1; n] }
        }
        pub fn init(&mut self) {
            for p in self.p.iter_mut() {
                *p = -1;
            }
        }
        pub fn root(&self, mut x: usize) -> usize {
            while self.p[x] >= 0 {
                x = self.p[x] as usize;
            }
            x
        }
        pub fn same(&self, x: usize, y: usize) -> bool {
            self.root(x) == self.root(y)
        }
        pub fn unite(&mut self, x: usize, y: usize) -> Option<(usize, usize)> {
            let mut x = self.root(x);
            let mut y = self.root(y);
            if x == y {
                return None;
            }
            if self.p[x] > self.p[y] {
                std::mem::swap(&mut x, &mut y);
            }
            self.p[x] += self.p[y];
            self.p[y] = x as i32;
            Some((x, y))
        }
        pub fn parent(&self, x: usize) -> Option<usize> {
            let p = self.p[x];
            if p >= 0 {
                Some(p as usize)
            } else {
                None
            }
        }
        pub fn get_size(&self, x: usize) -> usize {
            let r = self.root(x);
            (-self.p[r]) as usize
        }
    }
}
//---------- end union_find ----------

use proconio::*;
use proconio::marker::*;

fn run() {
    input! {
        n: usize,
        p: [(Usize1, Usize1); n],
    }
    let w = 100_000;
    let mut dp = vec![(0usize, 1usize); 2 * w];
    for p in dp.iter_mut().take(w) {
        *p = (1, 0);
    }
    let mut u = union_find::UF::new(2 * w);
    for (x, y) in p {
        if let Some((a, b)) = u.unite(x, y + w) {
            dp[a].0 += dp[b].0;
            dp[a].1 += dp[b].1;
            dp[b] = (0, 0);
        }
    }
    let ans = dp.into_iter().map(|p| p.0 * p.1).sum::<usize>() - n;
    println!("{}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 8616
#include<iostream>
#include <string>    
using namespace std;
 
int main(){
  string s;
  string ans;
  cin >> s;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == '0'){
      ans.push_back('0');
    }else if(s[i] == '1'){
      ans.push_back('1');
    }else if(s[i] == 'B'){
      if(ans.size() > 0) ans.erase(ans.size() - 1);
    }
  }
 cout << ans << endl
; return 0;
}

Measured memory_bytes: 256
n=int(input())
s=[]
for i in range(n):
    a=input()
    s.append(a)
ac=0
wa=0
tle=0
re=0
for i in range(n):
    if s[i]=='AC':
        ac+=1
    elif s[i]=='WA':
        wa+=1  
    elif s[i]=='TLE':
        tle+=1
    else:
        re+=1

print('AC x '+str(ac))
print('WA x '+str(wa))
print('TLE x '+str(tle))
print('RE x '+str(re))

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int n, m;
  cin >> n >> m;
  using T = tuple<int, int, int>;
  vector<T> v;
  rep(i, m) {
    int p, y;
    cin >> p >> y;
    v.emplace_back(p, y, i);
  }
  sort(all(v));
  int id = 0;
  int prev = 0;
  vector<pair<int, int>> ans(m);
  rep(i, m) {
    int p, y, idx;
    tie(p, y, idx) = v[i];
    if (p != prev) {
      prev = p;
      id = 0;
    }
    id += 1;
    ans[idx] = make_pair(p, id);
  }
  rep(i, m) {
    printf("%06d%06d\n", ans[i].first, ans[i].second);
  }
}

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

const int N=1e5+10;

int n,m;
int A[N*3];
int B[N*3];
int f[N*3],g[N*3];
int C[1<<17];
pair<int,int>a[N*3],b[N*3];
const int mk=(1<<16)-1;

void paixu()
{
	for(int i=1;i<=n*3;i++) C[A[i]&mk]++;
	for(int i=0;i<=mk;i++) C[i]+=C[i-1];
	for(int i=n*3;i;i--) b[C[A[i]&mk]--]=make_pair(A[i],i);
	memset(C,0,sizeof C);
	for(int i=1;i<=n*3;i++) C[(b[i].first>>15)&mk]++;
	for(int i=0;i<=mk;i++) C[i]+=C[i-1];
	for(int i=n*3;i;i--) a[C[(b[i].first>>15)&mk]--]=b[i];
	int cnt=0;
	a[0]=make_pair(0,0);
	for(int i=1;i<=n*3;i++)
		if(a[i].first!=a[i-1].first) A[a[i].second]=++cnt,B[cnt]=a[i].first;
		else A[a[i].second]=cnt;
	m=cnt;
}
			

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n*3;i++) scanf("%d",&A[i]);
	paixu();
	long long Ans=-1e15;
	long long res=0;
	int s1=m,t1;
	for(int i=1;i<=n;i++) f[A[i]]++,s1=min(s1,A[i]),res+=B[A[i]];
	t1=f[s1];
	for(int i=n+1;i<=n*3;i++) g[A[i]]++;
	long long now=n;
	int s2,t2;
	//for(int i=1;i<=n*3;i++) cout<<A[i]<<' ';
	//cout<<endl;
	for(int i=1;i<=m;i++)
	{
		if(now-g[i]<=0)
		{
			s2=i;
			t2=now;
			res-=(long long)now*B[i];
			break;
		}
		now-=g[i],res-=(long long)g[i]*B[i];
	}		
	Ans=res;
	//cout<<res<<' '<<s1<<' '<<t1<<' '<<s2<<' '<<t2<<endl;
	for(int i=n+1;i<=2*n;i++)
	{
		f[A[i]]++;
		if(A[i]>s1)
		{
			t1--;
			res-=B[s1];
			res+=B[A[i]];
			if(!t1)
			{
				s1++;
				while(!f[s1]) s1++;
				t1=f[s1];
			}
		}
		if(A[i]<=s2)
		{
			res+=B[A[i]];
			t2++;
			if(t2>g[s2])
			{
				s2++;
				while(!g[s2]) s2++;
				t2=1;
			}
			res-=B[s2];
		}
		else g[A[i]]--;
		Ans=max(Ans,res);
	}
	cout<<Ans<<endl;
}
	
	

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

template <typename T>
T Gcd(T a, T b) {
  if (b == 0) {
    return a;
  }
  return Gcd(b, a % b);
}

int main() {
  in(ll, a, b);
  ll g = Gcd(a, b);
  int ans = 1;
  for (ll i = 2; i * i <= g; ++i) {
    if (g % i == 0) {
      ++ans;
      while (g % i == 0) {
        g /= i;
      }
    }
  }
  if (g > 1) ++ans;
  out(ans);
}


Measured memory_bytes: 256
/*!enjoy karo yaar!*/

//CF,CC,AtC,SPOJ: hp1999
//HE: hemant269
//HR: hemant2132

#include<bits/stdc++.h>
using namespace std;

#define     int             long long int
#define     fast()          ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     all(x)          (x).begin(),(x).end()
#define     rz(x)           resize(x)
#define     mem(a,b)        memset(a,b,sizeof(a))
#define     sz(x)           ((int)(x.size()))
#define     pb              push_back
#define     pf              push_front
#define     pob             pop_back
#define     pof             pop_front
#define     ins             insert
#define     pii             pair<int,int>
#define     F               first
#define     S               second
#define     makep           make_pair
#define     maket           make_tuple
#define     remax(a,b)      a=max(a,b)
#define     remin(a,b)      a=min(a,b)
#define     bitcount(x)     __builtin_popcountll(x)
#define     iceil(n, x)     (((n)+(x)-1)/(x))
#define     gcd(a,b)        (__gcd((a),(b)))
#define     lcm(a,b)        (((a)*(b))/gcd((a),(b)))
#define     dbug(x)         cout<<#x<<": "<<(x)<<"\n"
#define     flush           fflush(stdout)
#define     show(x)         for(auto c:x)cout<<c<<" ";cout<<"\n";
#define     nshow(x,n)      for(int zz=0;zz<n;++zz)cout<<x[zz]<<" ";cout<<"\n";
#define     show2(x)        for(auto c:x)cout<<c.F<<" "<<c.S<<"\n";

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

const ld pi=acos(-1);
const ll inf=1e18,M=1e9+7;
const int N=1;

void solve()
{
    int a,b,c;
    cin>>a>>b>>c;

    swap(a,b);
    swap(a,c);

    cout<<a<<" "<<b<<" "<<c;
}

int32_t main()
{
    fast();

    int t=1;
    //cin>>t;
    for(int z=1;z<=t;++z)
    {
        solve();
        //cout<<"\n";
    }

    return 0;
}



Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string;

void main()
{
    auto a = readln.chomp;
    auto b = readln.chomp;

    writeln(
        a.length > b.length ? "GREATER" :
        a.length < b.length ? "LESS" :
        a > b ? "GREATER" :
        a < b ? "LESS" :
        "EQUAL"
    );
}

Measured memory_bytes: 256
<?php
/**
 * ABC133
 * A - T or T
 */

// $s = trim(fgets(STDIN));
// fscanf(STDIN, "%d %d", $a, $b);
// $n = array_map('intval', explode(' ', trim(fgets(STDIN))));

fscanf(STDIN, "%d %d %d", $N, $A, $B);

echo min($N * $A, $B), PHP_EOL;


Measured memory_bytes: 4604
import java.io.InputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.*;

public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    int n = sc.nextInt();
    String s = sc.next();

    String res = s;

    int stack = 0;
    for (int i = 0; i < n; i++) {
      if (s.charAt(i) == '(') stack++;
      else {
        stack--;
      }
      while (stack < 0) {
        // short of left
        res = "(" + res;
        stack++;
      }
    }
    while (0 < stack) {
      // short of right
      res = res + ")";
      stack--;
    }
    os.println(res);
  }

  private static class Scanner {

    private final InputStream is;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    Scanner(InputStream is) {
      this.is = is;
    }

    private boolean hasNextByte() {
      if (ptr < buflen) {
        return true;
      } else {
        ptr = 0;
        try {
          buflen = is.read(buffer);
        } catch (IOException e) {
          e.printStackTrace();
        }
        if (buflen <= 0) {
          return false;
        }
      }
      return true;
    }

    private int readByte() {
      if (hasNextByte()) {
        return buffer[ptr++];
      } else {
        return -1;
      }
    }

    private static boolean isPrintableChar(int c) {
      return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
      while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
        ptr++;
      }
      return hasNextByte();
    }

    public String next() {
      if (!hasNext()) {
        throw new NoSuchElementException();
      }
      StringBuilder sb = new StringBuilder();
      int b = readByte();
      while (isPrintableChar(b)) {
        sb.appendCodePoint(b);
        b = readByte();
      }
      return sb.toString();
    }

    public long nextLong() {
      if (!hasNext()) {
        throw new NoSuchElementException();
      }
      long n = 0;
      boolean minus = false;
      int b = readByte();
      if (b == '-') {
        minus = true;
        b = readByte();
      }
      if (b < '0' || '9' < b) {
        throw new NumberFormatException();
      }
      while (true) {
        if ('0' <= b && b <= '9') {
          n *= 10;
          n += b - '0';
        } else if (b == -1 || !isPrintableChar(b)) {
          return minus ? -n : n;
        } else {
          throw new NumberFormatException();
        }
        b = readByte();
      }
    }

    public int nextInt() {
      long nl = nextLong();
      if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
        throw new NumberFormatException();
      }
      return (int) nl;
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }
  }
}


Measured memory_bytes: 21332
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	n, y := getInt(), getInt()

	ans := [3]int{-1, -1, -1}
	for i := 0; i <= n; i++ {
		for j := 0; j <= n-i; j++ {
			k := (n - i - j)
			yen10000, yen5000, yen1000 := i*10000, j*5000, k*1000
			cand := yen10000 + yen5000 + yen1000

			if y == cand {
				ans = [3]int{i, j, k}
			}
		}
	}

	fmt.Println(ans[0], ans[1], ans[2])
}

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
}

func getInt() int {
	i, err := strconv.Atoi(getString())
	if err != nil {
		panic(err)
	}
	return i
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


Measured memory_bytes: 640
/*s1190073  Rina Sato
File name: prog_2c.c
This is a program which confirm stability of Bubble Sort and Selection Sort. 
*/

#include<stdio.h>
int main(void){
  int N,i,j,n,mini=0,S=0,J=0,stability=0;
  int figure1[36],figure2[36],order1[36],order2[36];
  char symbol1[36],symbol2[36],K;
  scanf("%d",&N);
  for(i = 0 ; i < N ; i++){
    scanf(" %c%d",&symbol1[i],&figure1[i]);
  }
  for(n = 0 ; n < N ; n++){ /*order of cars*/
    order1[n] = n;
  }
  for(i = 0 ; i < N ; i++){ /*_2 is for Selection Sort,_1 is for Bubble Sort.*/  
    figure2[i] = figure1[i];
    order2[i] = order1[i];
    symbol2[i] = symbol1[i];
  }
  /*BubbleSort*/
  for(i = 0 ; i < N ; i++){ 
    for(j = N-1 ; j > i ; j--){
      if(figure1[j] < figure1[j-1]){ /*exchange _[j] for _[j-1]*/
	S = figure1[j]; 
	K = symbol1[j];
	J = order1[j];

	figure1[j] = figure1[j-1];
	symbol1[j] = symbol1[j-1];
	order1[j] = order1[j-1];

	figure1[j-1] = S;
	symbol1[j-1] = K;
	order1[j-1] = J;
      }
    }
  }
  for(i = 0 ; i < N ; i++){
    printf("%c%d",symbol1[i],figure1[i]);
    if(i < N-1){ /*make space between figures*/
      printf(" ");
      if(figure1[i] == figure1[i+1]){
	if(order1[i] > order1[i+1]){ /*If order is strange, stability is 1.*/
	  stability = 1;
	}
      } 
    }
    else printf("\n");
  }
  if(stability == 1){
    printf("Not stable\n");
  } else {
    printf("Stable\n");
  }
  stability = 0;
  
  /*SelectionSort*/
  for(i = 0 ; i < N ; i++){
    mini = i;
    for(j = i+1 ; j < N ; j++){
      if(figure2[j] < figure2[mini]){ /*find the smallest figure from figure2[i+1] to 
                                                                              figure[N-1]*/
	mini = j;
      }
    }
    S = figure2[i]; /*exchange _[i] for _[mini]*/
    K = symbol2[i];
    J = order2[i];

    figure2[i] = figure2[mini];
    symbol2[i] = symbol2[mini];
    order2[i] = order2[mini];

    figure2[mini] = S;
    symbol2[mini] = K;
    order2[mini] = J;
  }
  for(i = 0 ; i < N ; i++){
    printf("%c%d",symbol2[i],figure2[i]);
    if(i < N-1){
      printf(" ");
      if(figure2[i] == figure2[i+1]){
	if(order2[i] > order2[i+1]){
	  stability = 1;
	}
      } 
    }
    else printf("\n");
  }
  if(stability == 1){
    printf("Not stable\n");
  } else {
    printf("Stable\n");
  }
  return 0;
}

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

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long 

// fact(n)
int fact(int n){
	if(n == 1)	return 1;
	else return (n * fact(n - 1));
}

// combination(n,r)
int combination(int n, int r){

	if(r == 0 || r == n)	return 1;
	else if(r == 1)	return n;
	return (combination(n - 1, r - 1) + combination(n - 1, r));
}

// gcd(a,b)
int gcd(int a,int b){
	int ret;
	ret = (b == 0) ? a : gcd(b, a % b);
	return ret;
}

// lcm(a.b)
int lcm(int a,int b){
	return (a * b) / gcd(a,b);
}

// qsort(array, size, sizeof(int),comp);
int comp(const int *a,const int *b){
	return (*a - *b);
}

// append(array,*size,addNum)
void append(int *array,int *size,int num){
	realloc(array, sizeof(int) * (*size + 1));
	array[(*size)] = num;
	++(*size);
}

// pop(array,*size) & nongetpop(array,*size)
int pop(int *array,int *size){
	int temp = array[(*size - 1)];
	realloc(array,sizeof(int) * (*size - 1));
	--(*size);
	return temp;
}

void nongetpop(int *array,int *size){
	realloc(array,sizeof(int) * (*size - 1));
	--(*size);
}

int main(int argc, char const *argv[]){
	int r,g;
	scanf("%d%d",&r,&g);
	printf("%d\n",2 * g - r);
}


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

int main() {
  int n;
  cin >> n;
  
  vector<int> a(n);
  
  for (int i = 0; i < n; i = i + 1) {
    cin >> a.at(i);
  }
  
  int button = 1;
  int count = 0;
  
  while (button != 2) {
    //cout << button << ' ';
    button = a.at(button - 1);
    //cout << button << endl;
    count = count + 1;
    if (count > n) {
      break;
    }
  }
  if (count > n) {
    cout << -1 << endl;
  } else {
    cout << count << endl;
  }
  
}

Measured memory_bytes: 640
N = int(input())
*A, = map(int, input().split())
colors = [False]*8
changeable = 0
for a in A:
    q, _ = divmod(a, 400)
    if q < 8:
        colors[q] = True
    else:
        changeable += 1
c = sum(colors)
print(c if c > 0 else 1, c + changeable)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
//#define int long long
#define F first
#define S second
#define endl "\n"
using namespace std;

const int nax = 3e3+5;
//const int inf = 1e18+7;
const int mod = 1e9+7;
using LF = long double;
// cout << fixed << setprecision(6)
int n,m;
LF a[nax], b[nax];
vector<int>adj[nax];

/*
 * 	   ************************ If you gave me a chance *******************************
 * 	   ************************ I'll take it            *******************************
 * 	   ************************	It's a shot in the dark *******************************
 * 	   ************************	But I will make it:D    *******************************
 */
LF dp[nax][nax];
signed main()
{
    fast;
    cin >> n;
    for (int i = 1; i <= n;i++){
        cin >> a[i];
    }
    dp[0][0] = 1;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 0; j <= i;j++){
            // dp[i][j] = dp[i-1][j-1]*(1 - a[i]);
            if(j)
                dp[i][j] += dp[i - 1][j - 1] * a[i];
            dp[i][j] += dp[i - 1][j] * (1 - a[i]);
        }
    }

    LF ans = 0;

    for (int i = 0; i <= n;i++){
        if(i>n-i){
            ans += (dp[n][i]);
        }
    }
        cout << fixed << setprecision(12) << ans << endl;
    return 0;
}


Measured memory_bytes: 85724
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

int main() {
    fastio();

    int n;
    set<char> s;
    cin >> n;

    forn(i, n) {
        char c;
        cin >> c;
        s.insert(c);
    }
    cout << (s.size() == 3 ? "Three" : "Four") << endl;

    return 0;
}

Measured memory_bytes: 256
n=int(input())
s=[]
for i in range(n):
    s.append(int(input()))
    
s.sort()

check=[]
total=sum(s)
for i in s:
    if i%10!=0:
        check.append(i)
if total%10!=0:
    print(total)
elif check==[]:
    print(0)
else:
    print(total-check[0])

Measured memory_bytes: 3064
void main() {
  import std.stdio, std.string, std.conv, std.algorithm;
  import std.range : iota;

  int h, w;
  rd(h, w);
  const int n = 10;
  auto c = new int[][](n, n);
  iota(0, n).each!((i) => (c[i] = readln.split.to!(int[])));
  foreach (_; 0 .. n)
    foreach (i; 0 .. n)
      foreach (j; 0 .. n)
        c[i][j] = min(c[i][j], c[i][_] + c[_][j]);

  int cost = 0;
  foreach (_; 0 .. h) {
    auto a = readln.split.to!(int[]);
    cost += reduce!((res, val) => res + (val < 0 ? 0 : c[val][1]))(0, a);
  }
  writeln(cost);
}

void rd(T...)(ref T x) {
  import std.stdio : readln;
  import std.string : split;
  import std.conv : to;

  auto l = readln.split;
  assert(l.length == x.length);
  foreach (i, ref e; x)
    e = l[i].to!(typeof(e));
}


Measured memory_bytes: 3836
s = input()
t = input()
n = len(t)

for i in reversed(range(len(s)-n+1)): #後ろから一致する部分が無いか見ていく
    x = s[i:i+n]
    y = 0
    for j in range(n):
        if x[j] == "?" or x[j] == t[j]:
            continue
        else:
            y = 1
            break
    if y == 0:
        print(s[:i].replace("?", "a") +t + s[i+n:].replace("?", "a"))
        exit()

print("UNRESTORABLE")


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int h, n; cin >> h >> n;
	rep(i, n){
		int x; cin >> x; h -= x;
	}
	cout << (h > 0 ? "No" : "Yes") << endl;
	
	return 0;
}

Measured memory_bytes: 256
import sys
import math
import fractions
import bisect
import queue
import heapq
from collections import deque
sys.setrecursionlimit(4100000)

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288
INF = 1e18

'''
1行のint
N, K = map(int, input().split())

1行のstring
S, T = input().split()

1行の整数配列
P = list(map(int,input().split()))

改行あり整数
x = []
y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)

N行M列の初期化
dp = [[INF] * M for i in range(N)]

'''

N, M = map(int, input().split())
S = input()


now = N
ans = []
while now > 0:
    for step in range(M, 0, -1):
        if now-step <0:
            step = now
        if S[now-step] == "0":
            ans.append(step)
            now -= step
            break
        if step == 1:
            print(-1)
            sys.exit()

ans.reverse()
ret = ""
for a in ans:
    ret+= str(a) + " "

print(ret)




Measured memory_bytes: 6652
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <limits>
#include <cmath>
#include <numeric>
#include <string>

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
#define rep(i, a, b) for(int i = (a); i < (b); ++i )
#define rrep(i, a, b) for(int i = (a); i > (b); --i )
#define REP(i, a, b) for(int i = (a); i <= (b); ++i )
#define RREP(i, a, b) for(int i = (a); i >= (b); --i )
#define llrep(i, a, b) for(ll i = (a); i < (b); ++i )
#define llrrep(i, a, b) for(ll i = (a); i > (b); --i )
#define llREP(i, a, b) for(ll i = (a); i <= (b); ++i )
#define llRREP(i, a, b) for(ll i = (a); i >= (b); --i )
#define ullrep(i, a, b) for(ull i = (a); i < (b); ++i )
#define ullrrep(i, a, b) for(ull i = (a); i > (b); --i )
#define ullREP(i, a, b) for(ull i = (a); i <= (b); ++i )
#define ullRREP(i, a, b) for(ull i = (a); i >= (b); --i )


int H, W, D;
int X[90010];
int Y[90010];
int S[90010];
int Q;

int main() {
    cin >> H >> W >> D;
    REP(i, 1, H)
    REP(j, 1, W) {
        int val;
        cin >> val;
        X[val] = j;
        Y[val] = i;
    }
    cin >> Q;
    REP(i, 1, D) {
        S[i] = 0;
    }
    REP(i, D+1, H*W) {
        S[i] = S[i-D] + abs(X[i] - X[i-D]) + abs(Y[i] - Y[i-D]);
    }
    rep(i, 0, Q) {
        int L, R;
        cin >> L >> R;
        cout << S[R] - S[L] << endl;
    }
}

Measured memory_bytes: 2176
#include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>
#include <iterator>
#include <regex>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(x,xs) for(auto &x: xs)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

template <class T, template <class, class> class C, class charT = char>
void vdump(const C<T, allocator<T>> &v, const charT* delimiter = ", ",
           ostream &stream = cout) {
  copy(v.begin(), v.end(), ostream_iterator<T>(stream, delimiter));
  stream << endl;
}

int main() {
  ios::sync_with_stdio(false);
  int n, a, b;
  cin >> n >> a >> b;
  if (n < a + b - 1 || (ll)a * (ll)b < (ll)n) {
    cout << -1 << endl;
    return 0;
  }
  VI vs(a, 1);
  int m = n - a;
  FOR(v, vs) {
    if (m <= 0) {
      break;
    }
    int d = min(m, b - v);
    m -= d;
    v += d;
  }
  int i = 0;
  FOR(v, vs) {
    REP(j,0,v) {
      cout << i + v - j << " ";
    }
    i += v;
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 3072
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int check(ll N, ll x) {
    if(x == 1) return 0;

    while(N % x == 0) N /= x;

    if(N % x == 1) return 1;
    else return 0;
}

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

    ll ans = -1;

    for(ll i = 1; i * i <= N - 1; i++) {
        if((N - 1) % i == 0) {
            if(i * i == (N - 1)) {
                ans++;
            } else {
                ans += 2;
            }
        }
    }

    for(ll i = 1; i * i <= N; i++) {
        if(N % i == 0) {
            if(i * i == N) {
                ans += check(N, i);
            } else {
                ans += check(N, i);
                ans += check(N, N / i);
            }
        }
    }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  ll n,k;
  cin >> n >> k;
  vector<P> p(n);
  rep(i,n){
    cin >> p[i].first >> p[i].second;
  }
  sort(p.begin(),p.end());
  vl y(n);
  ll ans=4*INF+1;
  rep(i,n-k+1){
    FOR(j,i+k-1,n){
      ll x=p[j].first-p[i].first;
      rep(h,n){
        y[h]=INF;
      }
      rep(h,j-i+1){
        y[h]=p[h+i].second;
      }
      sort(y.begin(),y.end());
      ll ymin=INF;
      rep(h,j-i-k+2){
        ymin=min(ymin,y[h+k-1]-y[h]);
      }
      ans=min(ans,x*ymin);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int f(long N,int k){
  double d,p,q;
  long P,Q;
  if(k==0){
    if(N % 4 == 1 || N % 4 == 2){
      return 1;
    }else{
      return 0;
    }
  }else if(k>=1){
    d = (double)k;
    p = pow(2.0,d+1.0);
    q = pow(2.0,d);
    P = (long)p;
    Q = (long)q;
    if(N%P >= Q && (N%P)%2 == 0){
      return 1;
    }else{
      return 0;
    }
  }
}

int check(int a,int b){
  if(a==b){
    return 0;
  }else{
    return 1;
  }
}

int main(){
  long A,B;
  scanf("%ld %ld",&A,&B);
  int a,b;
  double s;
  long answer;
  for(int i=0;i<40;i++){
    if(A == 0){
      b = f(B,i);
      s = (double)i;
      answer += b * pow(2.0,s);
    }else if(A >= 1){
      a = f(A-1,i);
      b = f(B,i);
      s = (double)i;
      answer += check(a,b) * pow(2.0,s);
    }
  }
  printf("%ld\n",answer);
  return 0;
}

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

int main() {
  int n;

  cin >> n;
  int p = 0, w = 0, g = 0, y = 0;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;

    if (s == "P") {
      p += 1;
    } else if (s == "W") {
      w += 1;
    } else if (s == "G") {
      g += 1;
    } else if (s == "Y") {
      y += 1;
    }
  }

  if (p == 0 || w == 0 || g == 0 || y == 0) {
    cout << "Three" << endl;
  } else {
    cout << "Four" << endl;
  }
}


Measured memory_bytes: 256
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<iostream>
using namespace std;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
#define rep(i, n) for (i32 i = 0; i < (i32)(n); i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using P = pair<i64,i64>;

int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
i64 d,t,s;
cin >> d >> t >> s;
cout << (d<= t * s? "Yes": "No") << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
typedef long long i64;
const int N=1e5+7;
i64 D,ans=0;
struct pos{
	i64 x,y;
	int id;
	bool operator<(pos a)const{
		return x!=a.x?x<a.x:y<a.y;
	}
}ps[N];
int n,a,b,id[4][N];
bool ed[N];
std::queue<int>q;
int lr[N][4][2],cnt[N],f[4][N];
void push(int x){if(!ed[x])ed[x]=1,q.push(x),ans+=cnt[x];}
i64 abs(i64 x){return x>0?x:-x;}
i64 max(i64 a,i64 b){return a>b?a:b;}
bool chk1(pos&a,pos&b){
	return a.x<b.x+D||a.x==b.x+D&&a.y<b.y-D;
}
bool chk2(pos&a,pos&b){
	return a.x==b.x+D&&a.y<=b.y+D;
}
int gf(int*f,int x){
	while(x!=f[x])x=f[x]=f[f[x]];
	return x;
}
void cal(int t){
	std::sort(ps+1,ps+n+1);
	for(int i=1;i<=n+1;++i)f[t][i]=i;
	for(int i=1,j=1,k=1;i<=n;++i){
		int w=ps[i].id;
		id[t][i]=w;
		for(;j<=n&&chk1(ps[j],ps[i]);++j);
		if(k<j)k=j;
		for(;k<=n&&chk2(ps[k],ps[i]);++k);
		lr[w][t][0]=j;
		lr[w][t][1]=k;
		cnt[w]+=k-j;
	}
}
void push(int t,int l,int r){
	int*F=f[t];
	for(l=gf(F,l);l<r;l=F[l]=gf(F,l+1))push(id[t][l]);
}
int main(){
	scanf("%d%d%d",&n,&a,&b);
	for(int i=1,x,y;i<=n;++i){
		scanf("%d%d",&x,&y);
		ps[i]=(pos){x+y,x-y,i};
	}
	D=max(abs(ps[a].x-ps[b].x),abs(ps[a].y-ps[b].y));
	cal(0);
	for(int i=1;i<=n;++i){
		for(int a=-1;a<=1;a+=2)
		for(int b=-1;b<=1;b+=2)
		if(std::binary_search(ps+1,ps+n+1,(pos){ps[i].x+D*a,ps[i].y+D*b}))--cnt[ps[i].id];
	}
	for(int i=1;i<=n;++i)ps[i].x*=-1;
	cal(1);
	for(int i=1;i<=n;++i)std::swap(ps[i].x,ps[i].y);
	cal(2);
	for(int i=1;i<=n;++i)ps[i].x*=-1;
	cal(3);
	push(a),push(b);
	while(q.size()){
		int p=q.front();q.pop();
		for(int t=0;t<4;++t){
			push(t,lr[p][t][0],lr[p][t][1]);
		}
	}
	printf("%lld\n",ans/2);
	return 0;
}

Measured memory_bytes: 9728
n, m = map(int, input().split())

if n < 1 or m < 2:
    print(0)
    quit()

if n < m:
    if 2*n == m:
        print(n)
    elif 2*n < m:
        print(n + (m-2*n)//4)
    elif 2*n > m:
        print(m//2)
else:
    print(m//2)


Measured memory_bytes: 3060
import java.util.*;
/**
 * Main
 */
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int L = sc.nextInt();
        int val = (L-1)*N + (N*(N+1))/2 - eatval(N, L);
        System.out.println(val);
        sc.close();
    }

    static int eatval(int N, int L) {
        if(N < -L+1) 
            return L+N-1;
        else if(1 <= -L+1 && -L+1 <= N)
            return 0;
        else
            return L;
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#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 == "Sunny") cout << "Cloudy" << endl;
  if (S == "Cloudy") cout << "Rainy" << endl;
  if (S == "Rainy") cout << "Sunny" << endl;
  return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define contains(v, t) (find(v.begin(), v.end(), t) != v.end())
#define MOD 1000000007
using ll = long long;
using ull = unsigned long long;

int main() {
  int n;
  string s;
  cin>>n>>s;
  int ans = 0;
  for(int i = 1; i < n; i++) {
    string a = s.substr(0, i);
    string b = s.substr(i, n-i);
    set<char> sa, sb;
    rep(j, a.length()) sa.insert(a[j]);
    rep(j, b.length()) sb.insert(b[j]);
    map<char, int> m;
    int c = 0;
    for(auto j : sa) {
      if (sb.find(j) != sb.end()) c++;
    }
    ans = max(ans, c);
  }
  cout << ans;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void)
{

int A,B,C,X;
scanf("%d %d %d %d",&A,&B,&C,&X);
int a,b,c,ans=0;
  for(a=0;a<=A;a++){
  	for(b=0;b<=B;b++){
  		for(c=0;c<=C;c++){
  			if(a*500+b*100+c*50==X){
  				ans++;
  			}
  		}
  	}
  }
  printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
using namespace std;
int main(){
	int n,k,b,s[101],c[101];
	while(true){
	cin>>n>>k;
	if(n==0&&k==0)
		break;
	for(int i=0;i<k;i++){
		cin>>s[i];
		c[i]=0;
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<k;j++){
			cin>>b;
			c[j]+=b;
		}
	}
	bool t=true;
	for(int i=0;i<k;i++){
		if(s[i]<c[i])
			t=false;
	}
	if(t==true)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	}
    return 0;
}

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

int main() {
  int N, K, a;
  a = 1;
  cin >> N >> K;
  for (int  i = 0; i < N; i++){
    int b = a * 2;
    int c = a + K;
    if (b < c) {
      a *= 2;
    }
    else {
      a += K;
    }
  }
  cout << a << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=(b);++i)
#define per(i,a,b) for(int i=a;i>=(b);--i)
#define mem(a,x) memset(a,x,sizeof(a))
#define pb push_back
#define pi pair<int, int>
#define mk make_pair
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
void solve()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    while(a>0&&c>0){
        c-=b;
        if(c<=0) break;
        a-=d;
    }
    if(a>c) puts("Yes");
    else puts("No");
}
int main()
{
	//ios::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	//int _;cin>>_;while(_--)
	solve();
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool IsOneBit(int bits, int i) {
	return (bits & (1ll << i)) > 0;
}
int popcount(int bits) {
	int ans = 0;
	while (bits > 0) {
		if (bits & 1) ans++;
		bits /= 2;
	}
	return ans;
}
int main() {
	int H, W, K;
	cin >> H >> W >> K;
	vector<vector<char>> S(H, vector<char>(W));
	for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) cin >> S[i][j];
	int ans = H + W;
	for (int b = 0; b < (1 << (H - 1)); b++) {
		vector<int> sum(H);
		int num = 0;
		bool IsOut = false;
		for (int j = 0; j < W; j++) {
			int si = 0;
			for (int i = 0; i < H; i++) {
				sum[si] += (S[i][j] == '1');
				if (IsOneBit(b, i)) si++;
			}
			for (int i = 0; i < H; i++) {
				if (sum[i] > K) {
					IsOut = true;
					break;
				}
			}
			if (IsOut) {
				num++;
				sum = vector<int>(H);
				si = 0;
				for (int i = 0; i < H; i++) {
					sum[si] += (S[i][j] == '1');
					if (IsOneBit(b, i)) si++;
				}
				IsOut = false;
				for (int i = 0; i < H; i++) {
					if (sum[i] > K) {
						IsOut = true;
						break;
					}
				}
			}
			if (IsOut) break;
		}
		if (!IsOut) ans = min(num + popcount(b), ans);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3596