akhauriyash/Code-Regression huggingface dataset:
// Author @MAC_19

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>

#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define double long double
#define pb push_back
#define pf push_front
#define mkp make_pair
#define ft first
#define sd second
#define sz(x) (ll)x.size()
#define fbo find_by_order
#define ook order_of_key
#define sp " "
#define nl "\n"
#define loop int t; cin>>t; while(t--)

#define vi vector<ll>
#define vpii vector<pii>
#define pii pair<ll,ll>
#define piii pair<ll,pii>
#define mi map<ll,ll>

#define VARGS_(_10, _9, _8, _7, _6, _5, _4, _3, _2, _1, N, ...) N  
#define VARGS(...) VARGS_(__VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
#define CONCAT_(a, b) a##b
#define CONCAT(a, b) CONCAT_(a, b)
#define f_4(x,a,b,B) for(int x=a;(B ? x<=b : x<b); ++x) 
#define f_3(x,a,b) f_4(x,a,b,0)
#define f(...) CONCAT(f_, VARGS(__VA_ARGS__))(__VA_ARGS__)
#define rf_4(x,a,b,B) for(int x=a;(B ? x>=b : x>b); --x) 
#define rf_3(x,a,b) rf_4(x,a,b,0)
#define rf(...) CONCAT(rf_, VARGS(__VA_ARGS__))(__VA_ARGS__)
#define elif else if
#define beg(a) a.begin()
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()  
#define allf(i) for(auto it=i.begin(); it!=i.end(); it++)
#define inf LLONG_MAX

using namespace std;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> PBDS;

const ll LIM=2e5+7;
const ll MAX=1e9+7;
const ll MOD=998244353;

template<typename T> istream& operator >> (istream& i, vector<T>& a){ for(auto &x : a) i>>x; return i; }
template<typename T> ostream& operator << (ostream& o, vector<T>& a){ for(auto &x : a) o<<x<<sp; return o; }

void deb(){ cerr<<nl; }
template <typename T1, typename ... T2>
void deb(T1 p, T2... lp) { cerr<<p<<sp; deb(lp...); }
#define deb(...) cerr<<"["<<#__VA_ARGS__<<"] : "; deb(__VA_ARGS__)

/*ll fact[1000005];
void _fact(ll M)
{
	ll x=1;
	fact[0]=1;
	f(i,1,200005)
	{
		x=(x*i)%M;
		fact[i]=x;
	}
}

ll pow(int x, int y, ll p=MAX) 
{ 
	ll ans = 1; 
	x = x % p;    
	while (y > 0) 
	{ 
		if (y & 1) 
			ans = (ans*x) % p;
		y = y>>1; 
		x = (x*x) % p;   
	} 
	return ans; 
}*/

signed main() 
{
	fast
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif
	
	int n;
	cin >> n;
	int a[n], b[n], c[n];
	for(int i = 0; i< n; i++)
		cin >> a[i] >> b[i] >> c[i];
	int dp[n][3];
	dp[0][0] = a[0];
	dp[0][1] = b[0];
	dp[0][2] = c[0];
	for(int i = 1; i < n; i++){
		dp[i][0] = a[i] +  max(dp[i - 1][1], dp[i - 1][2]);
		dp[i][1] = b[i] + max(dp[i - 1][0], dp[i - 1][2]);
		dp[i][2] = c[i] + max(dp[i - 1][0], dp[i - 1][1]);
	}
	cout<<max(dp[n - 1][0] , max(dp[n - 1][1], dp[n - 1][2]));
	
	
    
}

Measured memory_bytes: 5996
#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 gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    string N; cin >> N;
    bool f = false;
    REP(i, 3) if(N[i] == '7') f = true;
    Ans(f, "Yes", "No");

    return 0;
}


Measured memory_bytes: 3656
d = int(input())
c_l = list(map(int,input().split()))
s_l = [list(map(int,input().split())) for i in range(d)]


def calc_score(contest_num, last_l):
  contest_val = s_l[day][contest_num]
  point = contest_val

  temp_last_l = last_l[:]
  temp_last_l[contest_num] = day

  for i in range(26):
    point -= c_l[i] * (day - temp_last_l[i])

  return point


last_l = [-1 for i in range(26)]
ans = []

point = 0
for day in range(d):
  each_point = 0
  each_contest_num = 0

  for temp_contest_num in range(26):
    temp_point = calc_score(temp_contest_num, last_l)

    if temp_point > each_point:
      each_point = temp_point
      each_contest_num = temp_contest_num

  last_l[each_contest_num] = day
  ans.append(each_contest_num + 1)

#  print(last_l)

for i in ans:
  print(i)

Measured memory_bytes: 9524
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;

const ll INF=(1LL<<50);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif

template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


void solve(long long N, long long M, std::vector<long long> a){
  ll cnt=-1;
  REP(N){
    ll tmp=1;
    while(a[i]%(1<<tmp)==0)++tmp;
    --tmp;
    if(cnt!=-1&&cnt!=tmp){
      cout<<0<<endl;
      return;
    }
    cnt=tmp;
  }
  ll g=1;
  REP(N){
    g=g*a[i]/(1<<cnt)/gcd(g,a[i]/(1<<cnt));
  }
  cout<<(M+g*(1<<(cnt-1)))/(g*(1<<cnt))<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> a(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&a[i]);
    }
    solve(N, M, std::move(a));
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;

using namespace std;
using Graph = vector<vector<int>>;
Graph G;

int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}

int n;
vll a;

ll solve(bool isp)
{
	ll sum = 0ll;
	ll ret = 0ll;

	for (int i = 0; i < n; i++)
	{
		sum += a[i];
		if (isp and sum <= 0)
		{
			ret += -sum + 1;
			sum = 1ll;
		}
		if (not isp and sum >= 0)
		{
			ret += sum + 1;
			sum = -1ll;
		}
		isp ^= 1;
	}
	return ret;
}


int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n;
	a = vll(n);
	for (auto& e : a)
	{
		cin >> e;
	}
	ll res = min(solve(0), solve(1));
	
	
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define answer cout << ans << endl;
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
using Graph=vv<int>;

v<int> node;
v<int> ans;
// 深さ優先探索
vector<bool> seen;
void dfs(const Graph &G, int v,int prev_v) {
  seen[v] = true; // v を訪問済にする
  ans[v]=node[v]+ans[prev_v];
  // v から行ける各頂点 next_v について
  for (auto next_v : G[v]) {
    if (seen[next_v]) continue; // next_v が探索済だったらスルー
    dfs(G, next_v, v); // 再帰的に探索
  }
}

signed _main(){
  int N,Q; cin >> N >> Q;
  Graph G(N);
  node.assign(N,0);
  ans.assign(N,0);
  rep(i,N-1){
    int a,b; cin >> a >> b;
    a--;b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  rep(i,Q){
    int p,x; cin >> p >> x;
    p--;
    node[p]+=x;
  }

  // 頂点 0 をスタートとした探索
  seen.assign(N, false); // 全頂点を「未訪問」に初期化
  dfs(G, 0, 0);
  rep(i,N-1){
    cout << ans[i] << " ";
  }
  cout << ans[N-1] << endl;
  return 0;
}


Measured memory_bytes: 25856
n = int(input())
a_ls = list(map(int, input().split()))

num_minus = 0
Min = float('inf')
Sum = 0
for i in range(n):
    if a_ls[i] < 0:
        num_minus += 1
    Min = min(abs(a_ls[i]),Min)
    Sum += abs(a_ls[i])
if num_minus % 2 == 0:
    ans = Sum 
else:
    ans = Sum - 2 * Min
print(ans)

Measured memory_bytes: 15020
from collections import defaultdict

while True:
    n = int(input())
    if not n:
        break
    stars = defaultdict(int)
    for s in map(int, input().split()):
        stars[s] += 1
    half_n = n // 2
    for i, s in stars.items():
        if s > half_n:
            print(i)
            break
    else:
        print('NO COLOR')

Measured memory_bytes: 94324
package main

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

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func main() {
	defer flush()

	H := readInt()
	W := readInt()
	Ch := readInt() - 1
	Cw := readInt() - 1
	Dh := readInt() - 1
	Dw := readInt() - 1
	S := make([]string, H)
	for i := 0; i < H; i++ {
		S[i] = readString()
	}

	t := make([][]int, H)
	for i := 0; i < H; i++ {
		t[i] = make([]int, W)
		for j := 0; j < W; j++ {
			if S[i][j] == '#' {
				t[i][j] = -1
			} else {
				t[i][j] = math.MaxInt64
			}
		}
	}

	t[Ch][Cw] = 0
	q := make([][2]int, 0, 1024)
	q = append(q, [2]int{Ch, Cw})

	for len(q) != 0 {
		warpq := make([][2]int, 0, 1024)
		for len(q) != 0 {
			h, w := q[0][0], q[0][1]
			warpq = append(warpq, [2]int{h, w})
			q = q[1:]
			if h-1 >= 0 && t[h-1][w] > t[h][w] {
				q = append(q, [2]int{h - 1, w})
				t[h-1][w] = t[h][w]
			}
			if h+1 < H && t[h+1][w] > t[h][w] {
				q = append(q, [2]int{h + 1, w})
				t[h+1][w] = t[h][w]
			}
			if w-1 >= 0 && t[h][w-1] > t[h][w] {
				q = append(q, [2]int{h, w - 1})
				t[h][w-1] = t[h][w]
			}
			if w+1 < W && t[h][w+1] > t[h][w] {
				q = append(q, [2]int{h, w + 1})
				t[h][w+1] = t[h][w]
			}
		}

		if t[Dh][Dw] != math.MaxInt64 {
			break
		}

		for i := 0; i < len(warpq); i++ {
			h, w := warpq[i][0], warpq[i][1]
			for i := max(0, h-2); i <= min(H-1, h+2); i++ {
				for j := max(0, w-2); j <= min(W-1, w+2); j++ {
					if t[i][j] <= t[h][w]+1 {
						continue
					}
					t[i][j] = t[h][w] + 1
					q = append(q, [2]int{i, j})
				}
			}
		}
	}

	if t[Dh][Dw] == math.MaxInt64 {
		println(-1)
	} else {
		println(t[Dh][Dw])
	}
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}

var stdoutWriter = bufio.NewWriter(os.Stdout)

func flush() {
	stdoutWriter.Flush()
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdoutWriter, args...)
}


Measured memory_bytes: 21052
package main

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

const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
)

func main() {
	A := getInt()
	B := getInt()
	K := getInt()

	if A <= K {
		K -= A
		A = 0
	} else {
		A -= K
		K = 0
	}

	if B <= K {
		B = 0
	} else {
		B -= K
	}

	fmt.Println(A, B)
}

type Graph struct {
	n     int
	edges [][]int
}

func NewGraph(n int) *Graph {
	g := &Graph{
		n:     n,
		edges: make([][]int, n),
	}
	return g
}

func (g *Graph) AddEdge(u, v int) {
	g.edges[v] = append(g.edges[v], u)
	g.edges[u] = append(g.edges[u], v)
}

func dfs(c int, edges [][]int, visited map[int]struct{}) {
	visited[c] = struct{}{}

	for _, v := range edges[c] {
		_, flag := visited[v]
		if flag {
			continue
		}
		dfs(v, edges, visited)
	}
}

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func powMod(n, p int) int {
	if p == 0 {
		return 1
	} else if p%2 == 0 {
		t := powMod(n, p/2)
		return calcMod(t * t)
	} else {
		return n * powMod(n, p-1)
	}
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func printIntArray(array []int) {
	strArray := fmt.Sprint(array)
	fmt.Println(strArray[1 : len(strArray)-1])
}

func calcMod(x int) int {
	return x % mod
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}


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

vector<int> dx = {1,1,1,0,0,-1,-1,-1};
vector<int> dy = {1,0,-1,1,-1,1,0,-1};

int main() {
  int x, y;
  cin >> x >> y;
  vector<string> dt(x);
  for (auto &e : dt) cin >> e;
  
  for (int i = 0; i < x; i++) {
    for (int j = 0; j < y; j++) {
      if (dt[i][j] == '#') {
        cout << '#';
        continue;
      }
      int mine = 0;
      for (int k = 0; k < 8; k++) {
        int X = i + dx[k];
        int Y = j + dy[k];
        if (X < 0 || X >= x || Y < 0 || Y >= y) continue;
        if (dt[X][Y] == '#') mine += 1;
      }
      cout << mine;
    }
    cout << endl; 
  }
}

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

using std::max;

int n,k;

inline int bin_chop(int l,int r,int a){
	int mid,div=a/l;
	while(l<=r){
		mid=l+r>>1;
		if(a-k>=mid*div) l=mid+1;
		else r=mid-1;
	}
	return r;
}

inline int solve(int n){
	int ret=0;
	for(int l=1,r;l<=n;l=r+1){
		r=n/(n/l);
		if(r>k) ret+=bin_chop(max(l,k),r,n)-l+1;
	}
	return ret;
}

int main(){
	scanf("%d%d",&n,&k);
	if(k==0) printf("%lld",(long long)n*n);
	else{
		long long ans=0;
		for(int i=k+1,cnt,r;i<=n;++i){
			cnt=n/i,r=n%i;
			ans+=(long long)cnt*(i-1-k+1);
			if(r>=k) ans+=r-k+1;
		}
		printf("%lld",ans);
	}
/*	for(int i=1;i<=n;++i)
		ans+=solve(i);
	for(int i=k;i<n;++i)
		ans+=n-(i+1)+1;
*/
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
#include<bits/stdc++.h> 
int main()
{
	char A[10000],B[10000];
    cin>>A>>B;
	int x=strlen(A);
	int y=strlen(B);
	if(x!=y){
		if(x>y)
		    cout<<"GREATER\n";
		else
		    cout<<"LESS\n";}
	else{
		for(int i=0;i<x;i++){
			if(A[i]!=B[i]){
				if(A[i]>B[i])
				  cout<<"GREATER\n";
				else
		           cout<<"LESS\n";
		           break;}
			if(i+1==x)
			   cout<<"EQUAL\n";
			   continue;
		}}
		return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx")
#include <iostream>

constexpr int buffer_size = 1 << 18;
static int input_pos = buffer_size;
static int output_pos = 0;
char Input[buffer_size];
char Output[buffer_size];

#define READ fread_unlocked
#define WRITE fwrite_unlocked

inline char get_char(void){
    if(input_pos == buffer_size){ READ(Input, 1, buffer_size, stdin); input_pos = 0; }
    return Input[input_pos++];
}

inline int getint(void){
    int res = 0, c; while((c = get_char() - '0') >= 0) res = 10 * res + c;
    return res;
}
inline char get_c(void){
    const char c = get_char(); get_char();
    return c;
}

inline void put_char(const char c){
    if(output_pos == buffer_size){ WRITE(Output, 1, buffer_size, stdout); output_pos = 0; }
    Output[output_pos++] = c;
}
inline void println(int x){
    if(x){
        static char bbb[20];
        char t = 0; do{ bbb[t++] = x % 10; } while(x /= 10);
        while(t--){ put_char(bbb[t] ^ 48); }
    }
    else put_char('0');
    put_char('\n');
}


constexpr int mod = 998244353;

int height = 0;
int length;
int sum_arr[1 << 20];
int value[1 << 20];
char belong[1 << 20];

void build(int n){
    height = 31 - __builtin_clz(n); if((length = (1 << height)) < n){ length *= 2; ++height; }

    for(int i = n - 1, v = 1; i >= 0; --i){ sum_arr[i + length] = v; v = 10LL * v % mod; }
    for(int i = length - 1; i > 0; --i){
        sum_arr[i] = sum_arr[2 * i] + sum_arr[2 * i + 1];
        if(sum_arr[i] >= mod) sum_arr[i] -= mod;
    }
}

inline void propagate(const int x){
    for(int shift = height; shift ; --shift){
        const int idx = x >> shift;
        if(belong[idx]){
            belong[2 * idx] = belong[idx];
            belong[2 * idx + 1] = belong[idx];
            value[idx] = static_cast<long long int>(sum_arr[idx]) * belong[idx] % mod;
            belong[idx] = 0;
        }
    }
    if(belong[x]){ value[x] = static_cast<long long int>(sum_arr[x]) * belong[x] % mod; belong[x] = 0; }
}

inline void calculateData(int x){
    while(x >>= 1){
        const int c1 = 2 * x, c2 = c1 + 1;
        const int a = belong[c1] ? static_cast<long long int>(sum_arr[c1]) * belong[c1] % mod : value[c1];
        const int b = belong[c2] ? static_cast<long long int>(sum_arr[c2]) * belong[c2] % mod : value[c2];
        value[x] = a + b; if(value[x] >= mod) value[x] -= mod;
    }
}

inline void update(int l, int r, char c){
    propagate(l += length); propagate(r += length - 1);
    for(int li = l, ri = r + 1; li < ri; li >>= 1, ri >>= 1){
        if(li & 1) belong[li++] = c;
        if(ri & 1) belong[--ri] = c;
    }
    calculateData(l); calculateData(r);
}

inline int sum_all(void){
    return value[1];
}


int main(void){
    int n = getint(), q = getint();
    build(n);
    update(0, n, 1);

    while(q--){
        const int l = getint() - 1;
        const int r = getint();
        const char c = get_c() ^ '0';
        update(l, r, c);
        println(sum_all());
    }
    WRITE(Output, 1, output_pos, stdout);
    return 0;
}


Measured memory_bytes: 7924
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int inf=100100100;
int main() {
  int h,n;
  cin >> h >> n;
  vector<int> a(n),b(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i) >> b.at(i);
  }
  
  vector<int> dp(h+1,inf);
  dp.at(0) = 0;
  
  for(int i=0;i<n;i++){
    for(int j=0;j<=h;j++){
      int tmp = min(h,j+a.at(i));
      dp.at(tmp) = min(dp.at(tmp),dp.at(j)+b.at(i));
    }
  }
  
  cout << dp.at(h) << endl;
  
  return(0);
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int n;
vector<vector<int>> G;
vector<int> ans;
vector<int> c;
int id=0;

void dfs(int v,int p=-1){
    ans[v]=c[id];
    id++;
    for(auto nv : G[v]){
        if(nv==p) continue;
        dfs(nv,v);
    }
}

int main(){
    cin>>n;
    G.resize(n);
    ans.resize(n);

    rep(i,n-1){
        int a,b;
        cin>>a>>b;
        a--,b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    c.resize(n);
    int sum=0;
    rep(i,n){
        cin>>c[i];
        sum+=c[i];
    }
    sort(all(c));
    reverse(all(c));
    sum-=c[0];
    cout<<sum<<endl;

    dfs(0);
    rep(i,n) cout<<ans[i]<<" ";
    cout<<endl;
}

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

using namespace std;

#define roop(a,b) for(int a=0;a<b;++a)

int main(){
	int n;
	vector<int> d;
	cin >> n;
	d.resize(n);
	roop(i,n){
		cin >> d[i];
	}
	sort(d.begin(),d.end());
	cout << d[n/2] - d[n/2-1] << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
bool cmp(int a,int b) {
	return a>b;
}
int a[100001];
int b[100001];
int main() {
	int num,health;
	scanf("%d%d",&num,&health);
	for(int i=0; i<num; i++)
		scanf("%d%d",&a[i],&b[i]);
	sort(a,a+num,cmp);
	sort(b,b+num,cmp);
	int jb=-1;
	for(int v=0; v<num; v++) {
		if(a[0]>b[v])break;
		else jb=v;
	}
	int re=0,cur=0;
	while(jb>=cur) {
		health-=b[cur];
		cur++;
		re++;
		if(health<=0) {
			printf("%d\n",re);
			return 0;
		}
	}
	int ex=health%a[0]==0? 0:1;
	int ans=health/a[0]+ex;
	printf("%d\n",re+ans);
	return 0;
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string.h>
#include<cmath>
#include<map>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(ll i=a;i<b;i++)
int main() {
	ll A, B, C, X, Y;
	ll m = 1e13;
	scanf("%lld%lld%lld%lld%lld", &A, &B, &C, &X, &Y);
	rep(i, 0, 1000000){
		m = min(i * 2 * C + max((ll)0, X - i) * A + max((ll)0, Y - i) * B, m);
	}
	printf("%lld", m);
	return 0;
}

Measured memory_bytes: 128
n = int(input())
ct_ac = 0
ct_wa = 0
ct_tle = 0
ct_re = 0
for i in range(n):
    s = input()
    if s == 'AC':
        ct_ac += 1
    if s == 'WA':
        ct_wa += 1
    if s == 'TLE':
        ct_tle += 1
    if s == 'RE':
        ct_re += 1

print('AC x ' + str(ct_ac))
print('WA x ' + str(ct_wa))
print('TLE x ' + str(ct_tle))
print('RE x ' + str(ct_re))

Measured memory_bytes: 9236
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep(i,n) FOR(i,0,n-1)
#define int long long
#define MOD 998244353
#define MAXN  100005
#define P pair<int,int>


signed main(){
	
	int n;cin>>n;
	string s,t;cin>>s>>t;
	
	int ans = 0;
	FOR(i,1,n)
	{
		bool ok =true;
		rep(j,i)
		{
			if(s[n-i+j] != t[j]) ok =false;
		}
		
		if(ok) ans = i;
	}
	cout << 2*n-ans << endl;
}

//cout << ans << endl;

Measured memory_bytes: 256
N = int(input())
a = [int(i) for i in input().split()]

half = ((N * (N + 1) // 2) + 1) // 2

class BinaryIndexedTree() :
    def __init__(self, N) :
        self.N = N
        self.tree = [0] * (N + 1)
        
    def sum(self, i) :
        s = 0
        while i > 0 :
            s += self.tree[i]
            i -= i & -i
        return s
        
    def add(self, i, x) :
        while i <= self.N :
            self.tree[i] += x
            i += i & -i

def check(x) :
    b = [0] + [1 if a[i] >= x else -1 for i in range(N)]
    for i in range(1, N + 1) :
        b[i] += b[i-1]
    BIT = BinaryIndexedTree(2*N+2)
    
    ret = 0
    for i in range(N+1) :
        ret += BIT.sum(N+1+b[i])
        BIT.add(N+1+b[i], 1)
    
    return ret >= half
    
aa = sorted(a)
ok = 0
ng = N
while ng - ok > 1 :
    mid = (ok + ng) // 2
    if check(aa[mid]) :
        ok = mid
    else :
        ng = mid

print(aa[ok])
    

Measured memory_bytes: 114728
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }



void solve() {
    string s;
    cin >> s;
    REP(i,0,s.size()) cout << "x";
    cout << endl;
}

signed main() {
    solve();
    
    return 0;
}

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

kk = sum(p[:K])
res = kk

for i in range(N-K):
    kk += p[K+i] - p[i]
    res = max(res, kk)

res = res/2 + K/2
print(res)


Measured memory_bytes: 25060
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem A

if __name__ == '__main__':
    x, y = map(int, input().split())

    groupA = [1, 3, 5, 7, 8, 10, 12]
    groupB = [4, 6, 9, 11]
    groupC = [2]

    condition1 = (x in groupA) and (y in groupA)
    condition2 = (x in groupB) and (y in groupB)
    condition3 = (x in groupC) and (y in groupC)

    if condition1 or condition2 or condition3:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<map>
#include<set>
#include<complex>
#define INF 2147483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  int n;cin>>n;
  vector<ll >x(n),x2(n);
  for(int i=0;i<n;i++){cin>>x[i];x2[i]=x[i];}
  sort(x.begin(),x.end()); 
  for(int i=0;i<n;i++){
    if(x2[i]<x[n/2-1])
      cout<<x[n/2]<<endl;
    else if(x2[i]==x[n/2-1])
      cout<<x[n/2]<<endl;
    else
      cout<<x[n/2-1]<<endl;
  }
  return 0;
}


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

#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define all(x) (x).begin(),(x).end()
#define S(x) (int)(x).size()
#define L(x) (int)(x).length()

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int , null_type , less<int> , rb_tree_tag , tree_order_statistics_node_update> ordered_set;

const int mod = 1e9+7;
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;

void solve()
{
	string s;
	cin>>s;
	cout<<s.substr(0,3);
}

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


Measured memory_bytes: 3640
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<map>
#include<math.h>
#include<string>
#include <cctype>
#include <cstdlib>
#include<bitset>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl;
#define INF 1ll<<60;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

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

int main(){
    int a, b, c;cin >> a >> b >> c;
    int k; cin >> k;

    int cnt=0;
    while(c<=b||b<=a){
        if(c<=b){
        c *= 2;
        k--;
        }
        if(b<=a){
            b *=2;
            k--;
        }
        if(cnt>7) break;
        cnt++;
    }

    if(k>=0){out("Yes");}
    else if (k<0)
    {
        out("No");
    }
}

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

namespace ConsoleApplication1
{
    class Program
    {
        static readonly int MAX = 81;

        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            int n = int.Parse(Console.ReadLine());

            for (int i = 0; i < n; i++)
            {
                string input1 = Console.ReadLine();
                int len = input1.Length;

                string input2 = Console.ReadLine();
                len = Math.Max(len, input2.Length);

                if (len > 80)
                {
                    sb.AppendLine("overflow");
                    continue;
                }

                int[] a = MakeArray(input1);
                int[] b = MakeArray(input2);
                int[] sum = new int[MAX];

                for (int j = 0; j < len; j++)
                {
                    int temp = a[j] + b[j] + sum[j];

                    if (temp >= 10)
                    {
                        sum[j + 1] = 1;
                        sum[j] = temp % 10;
                    }
                    else sum[j] = temp;
                }

                if (sum[MAX - 1] > 0)
                {
                    sb.AppendLine("overflow");
                    continue;
                }

                if (sum[len] > 0) sb.Append(sum[len]);

                for (int j = len - 1; j >= 0; j--) sb.Append(sum[j]);

                sb.Append("\n");
            }
            Console.Write(sb);
        }

        static int[] MakeArray(string s)
        {
            int[] ret = new int[MAX];
            int count = 0;

            for (int j = s.Length - 1; j >= 0; j--)
            {
                ret[count] = int.Parse(s[j].ToString());
                count++;
            }
            return ret;
        }
    }
}

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

int main() {
	string S,T;
  	cin>>S>>T;
  
  	int l=S.size();
  	string t =T.erase(l);
  
  	if(S==t){
    	cout<<"Yes"<<endl;
    }
  	
  	else{
    	cout<<"No"<<endl;
    }
      
    
  	

}

Measured memory_bytes: 3584
#pragma GCC optimize("O3")
#pragma GCC target("avx")
#pragma GCC optimize("unroll-loops")
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define DB double
#define ST string
#define BS bitset
#define VE vector
#define VL vector<LL>
#define VP vector<pair<LL,LL>>
#define VVL vector<vector<LL>>
#define PQ priority_queue
#define PQS priority_queue<LL,vector<LL>,greater<LL>>
#define PB push_back
#define POB pop_back
#define PF push_front
#define POF pop_front
#define EB emplace_back
#define MP make_pair
#define TS to_string
#define TU to_ullong
#define FOR(i,a,n) for(i=a;i<n;i++)
#define rep(i,n) FOR(i,0,n)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define UB(a,n) *upper_bound(ALL(a),n)
#define LB(a,n) *lower_bound(ALL(a),n)
#define INF 1145141919810364364
#define PI 3.14159265358979
#define MOD 1000000007
//#define MOD 998244353
#define ERR 0.00000001
//#define ERR 0.00000000000001
#define NUM 200010
#define FAST cin.tie(0);ios::sync_with_stdio(false)

void Yn(LL a){if(a)printf("Yes\n");else printf("No\n");}
void YN(LL a){if(a)printf("YES\n");else printf("NO\n");}
LL pwmn(LL a,LL n){LL ans=1;while(ans<a)ans*=n;return ans;}
LL GCD(LL a,LL b){LL c=1,tmp=max(a,b);b=min(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
LL LCM(LL a,LL b){return a*b/GCD(a,b);}
int lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;}
int lcmpr(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return -1;if(*(LL*)a<*(LL*)b)return 1;return 0;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int ccmpr(const void* a,const void* b){return *(char*)b-*(char*)a;}
int scmp(const void* a,const void* b){return strcmp((char*)a,(char*)b);}
int scmpr(const void* a,const void* b){return strcmp((char*)b,(char*)a);}
LL mod(LL a,LL m){if(a<0)return a%m+m;else return a%m;}
LL DIV(LL a,LL d){LL m=MOD,x=1,y=0,k;while(m){k=d/m;d-=k*m;swap(m,d);x-=k*y;swap(x,y);}return mod(a*mod(x,MOD),MOD);}
LL POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return ans;}
LL fact[NUM],finv[NUM],inv[NUM];
void comi(){LL i;fact[0]=fact[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fact[i]=fact[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}}
LL com(LL n,LL k){if(n<k||n<0||k<0)return 0;return fact[n]*(finv[k]*finv[n-k]%MOD)%MOD;}
bool cmps(pair<LL,LL> a,pair<LL,LL> b){if(a.second!=b.second)return a.second<b.second;return a.first<b.first;}

int main(){
  FAST;
  LL i,ans=0,N,M,a=0;
  cin>>N>>M;
  LL A[N];
  rep(i,N)cin>>A[i];
  rep(i,N)a+=A[i];
  rep(i,N){
    if(A[i]*4*M>=a)ans++;
  }
  Yn(ans>=M);
}


Measured memory_bytes: 256
from fractions import gcd
N,K=[int(i) for i in input().split()]
A=[int(i) for i in input().split()]
ans=A[0]
for i in range(1,N):
        ans=gcd(ans,A[i])
if K%ans==0 and K<=max(A):
        print("POSSIBLE")
else:
        print("IMPOSSIBLE")


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

using namespace std;

int main(void){
	int a = 0;
	char c;
	int i;
	for(i = 0;i < 4;++i){
		scanf("%c", &c);
		if(c == '+'){
			++a;
		}else{
			--a;
		}
	}

	printf("%d\n", a);

	return 0;
}

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

using namespace std;

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



int main(){

  int a,b,c,x,y,mz=0;
  long long l = 1e10,tl;
  
  cin >> a >> b >> c >> x >> y;
  rep(z,max(x,y)+1){
    tl = a*max(x-z,0)+b*max(y-z,0)+2*c*z;
    if(tl<l)l=tl;
  }
  cout << l << endl;
  return 0;
}


Measured memory_bytes: 256
/* Author : Aaryan Srivastava ^__^ */ 
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define pb push_back
#define popb pop_back
#define mt make_tuple 
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second 
#define ull unsigned long long  
#define pii pair<int, int>
#define piii pair<int,pii>
#define beg begin
#define rep(i,n) for(int (i) = 0 ; i < (n) ; i++)
#define repA(i,x,y) for(int i = (x) ; i <= (y) ; i++)
#define repD(i,x,y) for(int i = (x) ; i >= (y) ; i--)
#define all(c) (c).begin(),(c).end()
#define fill(a,val) memset(a,val,sizeof(a))
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define int ll
using ll = long long;
const int N = 3*1e5 +5 ;
const int mod = 1e9 + 7 ;
const int inf = 1e18 ;
const int SZ = 101 ;
const double eps = 1e-9 ;
using namespace __gnu_pbds;
using namespace std;
using ordered_set =  tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ;

#ifdef AaryanS
#define mycout cout
#define mycerr cerr 
#endif

#ifndef AaryanS
#define mycout if(false) cout
#define mycerr if(false) cerr
#endif


int bagvalue[105][N/3]; 
int n,W ;
vector<pair<int,int>> items;
int dp(int w, int cur){
	if(cur == n)
		return 0; 
	int& ans = bagvalue[cur][w];
	if(ans) return ans;
	ans = max(ans, dp(w,cur+1));
	if(items[cur].ff + w <= W) 
		ans = max(ans, items[cur].ss + dp(w + items[cur].ff, cur+1));
	return ans ;
}

void solve()
{
	cin >> n >> W; 
	items.resize(n);
	for(auto &it : items) cin >> it.ff >> it.ss ;
	sort(all(items));
	cout << dp(0,0);
}   

     
int32_t main(int32_t argc, char *argv[])
{
    double t1 = clock() ;
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    int TC = 1, t = 0;
    //cin >> TC ;
    while(t++ < TC)
    {
        //cout << "Case #" << t << ": " ;
        solve();
        //cout << endl ;
    }
    mycerr << "Time : " << 1000 *(clock() - t1)/CLOCKS_PER_SEC << " ms\n" ;
    return 0;
}

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

int main () {
  string a , b ;
  cin >> a >> b ;
  
  int sa = a.length() ;
  int sb = b.length() ;
  
  if( sa < sb ) cout << "LESS" << endl ;
  else if (sa > sb ) cout << "GREATER" << endl ;
  else if ( a > b ) cout << "GREATER" << endl ;
  else if ( a < b ) cout << "LESS" << endl ;
  else cout << "EQUAL" << endl ;
}

Measured memory_bytes: 256
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]

n,m=map(int,input().split())
abc=[list(map(int,input().split())) for i in range(m)]

def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

# n,w = map(int,input().split()) #n:頂点数　w:辺の数
dic=defaultdict(int)
d = [[float("inf") for i in range(n)] for i in range(n)] 
#d[u][v] : 辺uvのコスト(存在しないときはinf)
for i in range(m):
    x,y,z = abc[i]
    x,y=x-1,y-1
    d[x][y] = z
    d[y][x] = z
for i in range(n):
    d[i][i] = 0 #自身のところに行くコストは０
tmp=warshall_floyd(d)

for i in range(m):
    a,b,c=abc[i]
    if tmp[a-1][b-1]==c:
        dic[(a,b)]+=1

print(m-len(dic))

Measured memory_bytes: 70888
#include <bits/stdc++.h>
#define endl '\n'
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define x first
#define y second
#define pb push_back
#define ll long long
#define int ll
#define ld long double
#define ii pair<int, int>
#define iii pair<int, ii>
#define vi vector<int>
#define vii vector<ii>
#define pq priority_queue
using namespace std;
const int ms = 2e5+100;
const int mod = 1e9+7;
const int inf = 1e9;
const int sigma = 30;
int n, m, k, t = 1;

int dp[ms];
bool valid[ms];

int w[ms];
int v[ms];

void solve(){
  cin>>n>>m;
  for(int i=0; i<n; i++){
    cin>>w[i]>>v[i];
  }
  valid[0] = 1;
  dp[0] = 0;
  for(int i = 0; i<n; i++){
    for(int j = m; j>=0 && j-w[i]>=0; j--){
      int pos = j-w[i];
      if(valid[pos]){
        valid[j] = 1;
        dp[j] = max(dp[j], dp[pos] + v[i]);
      }
    }
  }
  int ans = 0;
  for(int i = m; i>=0; i--){
    ans = max(ans, dp[i]);
  }
  cout<<ans<<endl;
  
}

int32_t main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  while(t--){
    solve();
  }
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;

int dp[200005];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	string s;
	cin >> s;
	int n = s.size();
	if(n==1){
		cout << "1\n";
		return 0;
	}else if(n==2){
		cout << (s[0]==s[1] ? "1\n" : "2\n");
		return 0;
	}
	dp[0] = 1;
	dp[1] = (s[0]==s[1] ? 1 : 2);
	dp[2] = (s[0]!=s[1] && s[1]!=s[2] ? 3 : 2);
	FOR(i,3,n){
		if(s[i-1]==s[i]) dp[i] = max(dp[i], dp[i-3] + 2);
		else dp[i] = max(dp[i], dp[i-1]+1);
	}

	cout << dp[n-1] << '\n';
	return 0;
}



Measured memory_bytes: 1300
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;

int main(){
    ll N,K;
    string S;
    cin >> N >> K >> S;
    K--;
    S[K] = S[K] + 0x20;
    cout << S <<  "\n";
    return 0;
} 


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    double x;
    cin>>x;
    //cout<<x<<endl;
    cout<<setprecision(10)<<2*x*3.141592653<<endl;
    
    
    
    return 0;   
}




 
 


Measured memory_bytes: 3808
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll countGreater(ll arr[], ll n, ll k) 
{ 
    ll l = 0; 
    ll r = n - 1; 
  
 
    ll leftGreater = n; 
  
 
    while (l <= r) { 
        ll m = l + (r - l) / 2; 
  
        if (arr[m] > k) { 
            leftGreater = m; 
            r = m - 1; 
        } 
  
 
        else
            l = m + 1; 
    } 
  
   
    return (n - leftGreater); 
}
ll p=pow(10,9)+7;
ll phi(ll n) {
    ll result = n;
    for (ll i = 2; i * i <= n; i++) {
        if(n % i == 0) {
            while(n % i == 0)
                n /= i;
            result -= result / i;
        }
    }
    if(n > 1)
        result -= result / n;
    return result;
}
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      
    x = x % p;  
   while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p; 
    } 
    return res; 
} 
 
ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
}

ll ans(ll A[],ll left,ll right,ll x)
{
    if(A[left]==x)return 1;

    else if(A[right==x])return 1;

   ll m=left+(right-left)/2;
   while(left<=right)
   {
    if(A[m]>x)right=m-1;
    else if(A[m]<x)left=m+1;
    else return 1;
   }
   return 0;
} 
 
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
ll a=0,b=0,i;
  string s;
  cin>>s;
  for(i=0;i<3;i++)
  {
    if(s[i]=='A')a++;
    else b++;
  }

  if(a==3||b==3)cout<<"No"<<"\n";
  else cout<<"Yes"<<"\n";


    return 0;
    
}


 

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
  int n;
  cin >> n;
  int a[n];
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  for(int i=n-1;i>0;i--){
    cout << a[i] << " ";
  }
  cout << a[0] << endl;
  return 0;

}



Measured memory_bytes: 3088
fun main(args: Array<String>) {
    val (persons, points, quizzes) = readLine()!!.split(" ").map { it.toInt() }
    val scores = Array(persons) { points - quizzes }
    for (i in 0 until quizzes) {
        scores[readLine()!!.toInt() - 1]++
    }
    for (i in 0 until persons) {
        if (scores[i] > 0) println("Yes")
        else println("No")
    }
}

Measured memory_bytes: 48268
n,k = map(int,input().split())
s = str(input())
num = 0
nu = 0
lis = []
li = []
if s[0] == "0":
    li.append(0)
for i in range(len(s)):
    if s[i] == "0":
        if nu != 0:
            num = 1
            li.append(nu)
            nu = 0
        else:
            num += 1
    else:
        if num != 0:
            nu = 1
            lis.append(num)
            num = 0
        else:
            nu += 1
lis.append(num)
li.append(nu)
if len(lis) == len(li):
    li.append(0)
cou = 0
nn = max(0,k-len(lis))
for i in range(nn):
    lis.append(0)
    li.append(0)
ans = sum(lis[:k])+sum(li[:k+1])
num = sum(lis[:k])+sum(li[:k+1])
for i in range(len(lis)-k):
    num -= li[i]+lis[i]
    num += li[i+k+1]+lis[i+k]
    ans = max(ans,num)
print(ans)

Measured memory_bytes: 5652
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 1e9;

signed main(){
    int H, N; cin >> H >> N;
    vector<int> a(N);
    for(int i = 0; i < N; i++) cin >> a[i];
    int sum = 0;
    for(int i = 0; i < N; i++) sum += a[i];
    if(sum >= H) cout << "Yes" << endl;
    else cout << "No" << endl;
} 

Measured memory_bytes: 1024
N,Y=map(int, input().split())

a=(-1,-1,-1)
for i in range(N+1):
    for j in range(N-i+1):
        k = N - i - j
        if 10000*i+5000*j+1000*k == Y:
            a=(i, j, k)
            break
print('{} {} {}'.format(*a))

Measured memory_bytes: 9044
import heapq as hp

INF = 1000000

def diikstraMethd(G, s):
    # ?????????
    n = len(G)
    d = [INF for _ in range(n)]
    d[s] = 0
    PQ = [(d[s], s)]

    while PQ:
        u = hp.heappop(PQ)[1]
        for v, c in G[u]:
            alt = d[u] + c
            if d[v] > alt:
                d[v] = alt
                hp.heappush(PQ, (alt, v))

    return d


if __name__ == '__main__':
    n = int(input())
    G = [ [] for _ in range(n)]
    for _ in range(n):
        tmp = list(map(int, input().split()))
        u = tmp.pop(0)
        k = tmp.pop(0)
        for i in range(k):
            v = tmp.pop(0)
            c = tmp.pop(0)
            G[u].append((v, c))

    d = diikstraMethd(G, 0)

    for i in range(n):
        print('{0} {1}'.format(i, d[i]))

Measured memory_bytes: 70536