akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
    auto val = table(args...);
    return vector<decltype(val)>(n, move(val));
}
const ll INF = 1e17;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 200005;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    PRINT(n*(n-1)/2+m*(m-1)/2);
}


Measured memory_bytes: 256
N, M = map(int,input().split())
A = [input() for i in range(N)]
B = [input() for i in range(M)]
flg = 0
for dx in range(N-M+1):
    for dy in range(N-M+1):
#        for i in range(M):
#            print(A[dy+i][dx:dx+M],B[i])
        if all(A[dy+i][dx:dx+M]==B[i] for i in range(M)):
            flg =1
if flg == 1: print("Yes")
else: print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <fstream>
#include <string>
#include <math.h>
#include <set>
#include <string>
#include <bitset>
#include <fstream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
//typedef pair<ll, P> T;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define revrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define f first
#define s second
#define pb push_back

ll mod = 1000000007;
const ll INF = 100000000000010000;
//const ull B = 998244353;
//ll kai[3010];

//void pres(double A, ll x = 20) { printf("%.20f\n", x); }

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

void chmin(double& x, double y) {
	x = min(x, y);
}

void chmax(double& x, double y) {
	x = max(x, y);
}

ll pow_long(ll x, ll y) {
	ll res = 1;
	while (y > 0) {
		if (y % 2 == 1) res *= x;
		x *= x;
		y /= 2;
	}
	return res;
}

void test() {
	cout << "888888888888888888888888" << endl;
}

ll gcd(ll x, ll y) {
	if (y == 0) return x;
	return gcd(y, x % y);
}

ll pow_mod(ll x, ll k) {
	x %= mod;
	ll res = 1;
	while (k > 0) {
		if (k % 2) {
			res *= x; res %= mod;
		}
		x *= x; x %= mod;
		k /= 2;
	}
	return res;
}

ll div_mod(ll x) {
	return pow_mod(x, mod - 2);
}

//コンビネーション
const int MAXcomb = 1000010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAXcomb; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod%i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
ll comb(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * finv[k] % mod * finv[n - k] % mod;
}

ll N, K;
ll num[100010];
ll ct;
ll dp[101][100010];
ll tmp[100010];
ll ans;

void solve() {
	cin >> N >> K;
	for (ll i = 1; i * i <= N; i++) num[i] = 1, ct = i;
	for (ll i = 1; i * i <= N; i++) {
		ll lb = ct, ub = N + 1;
		while(lb + 1 < ub) {
			ll mid = (lb + ub) / 2;
			if (i * mid > N) ub = mid;
			else lb = mid;
		}
		num[ct * 2 + 1 - i] = ub;
		lb = ct, ub = N + 1;
		while(lb + 1 < ub) {
			ll mid = (lb + ub) / 2;
			if ((i + 1) * mid > N) ub = mid;
			else lb = mid;
		}
		//cout << ub << ' ' << num[ct * 2 + 1 - i] << endl;
		num[ct * 2 + 1 - i] -= ub;
	}
	//rep(i, ct * 2) cout << num[i + 1] << endl;
	rep(i, ct * 2 + 1) dp[0][i] = num[i];
	rep(i, K - 1) {
		rep(j, ct * 2 + 1) tmp[j] = 0;
		rep(j, ct * 2 + 1) {
			if (j == 0) continue;
			tmp[j] = tmp[j - 1] + dp[i][j], tmp[j] %= mod;
			ll add = tmp[j] * num[ct * 2 + 1 - j] % mod;
			dp[i + 1][ct * 2 + 1 - j] += add;
			dp[i + 1][ct * 2 + 1 - j] %= mod;
		}
	}
	rep(i, ct * 2 + 1) ans += dp[K - 1][i], ans %= mod;
	cout << ans << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll T = 1;
	//cin >> T;
	rep(i, T) solve();
}


Measured memory_bytes: 81664
#include<bits/stdc++.h>
using namespace std;
unordered_map<int,vector<int>> friends,block;
void dfs(int i,unordered_map<int,int> &blocked,vector<int> &visited,vector<int> &component)
{
    visited[i]=1;
    component.push_back(i);
    for(auto it:block[i])
    {
        blocked[it]++;
    }
    for(auto it:friends[i])
    {
        if(!visited[it])
        dfs(it,blocked,visited,component);
    }
}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n,m,k;
  cin>>n>>m>>k;
  for(int i=0;i<m;i++)
  {
      int x,y;
      cin>>x>>y;
      friends[x].push_back(y);
      friends[y].push_back(x);
  }
  for(int i=0;i<k;i++)
  {
      int x,y;
      cin>>x>>y;
      block[x].push_back(y);
      block[y].push_back(x);
  }
  vector<int> visited(n+1,0);
  vector<int> ans(n+1);
    unordered_map<int,int> blocked;
    vector<int> component;
  for(int i=1;i<=n;i++)
  {
      if(visited[i])
        continue;
        component.clear();
        blocked.clear();
      dfs(i,blocked,visited,component);
      for(auto it:component)
      {
        ans[it]=(component.size()-friends[it].size()-blocked[it]-1);
      }
  }
  for(int i=1;i<=n;i++)
  cout<<ans[i]<<" ";
  return 0;
}

Measured memory_bytes: 24484
n = int(input())
a = 0
t = 0
for i in range(1, n+1):
    a = n / i
    if(n % i == 0):
        t = i
    if(a <= i):
        break

b = max(int(n / t), t)
ans = 0
while(b >= 1):
    ans += 1
    b /= 10
print(ans)



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

int main()
{
	int n;
	bool flag = true;
	cin >> n;
	int a[n];
	for(int i = 0; i < n; i++) cin >> a[i];
	for(int i = 0; i < n; i++)
	{
		if(a[i] % 2 == 0)
			if(a[i] % 3 != 0 && a[i] % 5 != 0)
			{
				flag = false;
				break;
			}
	}
	if(flag) cout << "APPROVED";
	else cout << "DENIED";
	return 0;
}



Measured memory_bytes: 256
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,lint> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
bool sumi[100100];
lint num[100100];
vector<pint> gr[100100];
lint ma,mi;int ng=0;
void dfs(int v,lint d){
	if(sumi[v]){
		if(num[v]!=d) ng=1;
		return;
	}
	sumi[v]=true;num[v]=d;
	rep(i,gr[v].size()){
		pint p=gr[v][i];
		dfs(p.fi,d+p.se);
	}
}
int main()
{
	int n,m,l,r,d;
	cin>>n>>m;
	rep(i,m){
		cin>>l>>r>>d;
		l--;r--;gr[l].pb(mp(r,d));gr[r].pb(mp(l,-d));
	}
	memset(sumi,false,sizeof(sumi));
	rep(i,n){
		if(sumi[i]) continue;
		ma=mi=0;
		dfs(i,0);
		if(ng>0 || ma>mi+1000000000){
			cout<<"No"<<endl;return 0;
		}
	}
	cout<<"Yes"<<endl;
}


Measured memory_bytes: 16640
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,ll> PPI;
typedef pair<ll,P> PIP;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vp;
#define PQ(T) priority_queue<T,vector<T>,greater<T>>
#define PQ2(T) priority_queue<T>
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define REP(i,a,b) for(ll (i)=a;(i)<(ll)(b);++(i))
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) ((x)=min((x),(y)))
#define chmax(x,y) ((x)=max((x),(y)))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
#define DEBUG(x) cerr<<"line ("<<__LINE__<<")  "<<#x<<": "<<x<<endl;
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	int n;
	cin>>n;
	vector<int> a(n), b(n);
	rep(i, n) cin>>a[i];
	rep(i, n) cin>>b[i];
	rep(i, n-1) a[i+1]+=a[i];
	for(int i = n-2; i >= 0; i--) b[i]+=b[i+1];
	int res = 0;
	rep(i, n) chmax(res, a[i]+b[i]);
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 256
while True:
  n = int(input())
  if n == 0:
    break
  else:
    l = list(map(int, input().split()))
    s = 0
    sq = 0
    for i in range(n):
      s += l[i]
    m = s/n
    for i in range(n):
      sq += (l[i]-m)**2
    alpha = (sq/n)**0.5
    print(alpha)


Measured memory_bytes: 5664
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
using namespace std;
const int maxn=3005;
const pair<int,int> INF={0,0};
int maxx[maxn][maxn];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    string s,t;
    cin>>s>>t;
    s="_"+s; t="_"+t;
    for(int i=1;i<(int)s.length();i++)
        for(int j=1;j<(int)t.length();j++)
            maxx[i][j]=max(maxx[i-1][j-1]+(s[i]==t[j]),max(maxx[i-1][j],maxx[i][j-1]));
    string ans="";
    pair<int,int> cur=make_pair((int)s.length()-1,(int)t.length()-1);
    while(cur!=INF)
    {
        int &i=cur.first,&j=cur.second;
        if(i&&j&&s[i]==t[j]&&maxx[i][j]==maxx[i-1][j-1]+1)
        {
            ans+=s[i];
            i--; j--;
        }
        else if(i&&maxx[i][j]==maxx[i-1][j]) i--;
        else j--;
    }
    reverse(ans.begin(),ans.end());
    cout<<ans<<'\n';
    return 0;
}


Measured memory_bytes: 38824
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

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;
}

const int INF = 1e9;
const long long LINF = 1e18;

int main() {
    string S, T;
    cin >> S >> T;

    int ans = 0;
    for (int i = 0; i < 3; i++) {
        if (S[i] == T[i]) {
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
def solve(people)
  $answers.each do |person, ans|
    if people[person]
      # 正直者だったら、答えが間違いなら即アウト
      ans.each do |to, is|
        if people[to] != is
          return false
        end
      end
    else
      # 真偽不明ならスルー
      # 嘘つきだったら、答えが正しいなら即アウト
      # ans.each do |to, is|
      #   if people[to] == is
      #     return false
      #   end
      # end
    end
  end
  true
end

def create_people(num_of_truthy)
  truthy = num_of_truthy
  falsy = N - truthy

  peoples = []
  (0..(N-1)).to_a.combination(falsy).each do |fal|
    people = Array.new(N) { true }
    fal.each do |f|
      people[f] = false
    end
    peoples.push people
  end

  peoples
end

N = gets.chomp.to_i

$answers = {}
N.times do |n|
  ans = {}
  gets.chomp.to_i.times do
    a = gets.chomp.split.map(&:to_i)
    ans[a.first-1] = a.last == 1
  end
  $answers[n] = ans
end

N.downto(0) do |num_of_truthy|
  peoples = create_people(num_of_truthy)

  peoples.each do |people|
    if solve(people)
      puts num_of_truthy
      exit
    end
  end
end


Measured memory_bytes: 8700
n = int(input())
dict = {}
for i in range(n):
  a = input()
  if (not (a in dict.keys())):
    dict[a] = 1
  else:
    dict[a] += 1
b = max(dict.values())
list = []
for i in dict.keys():
  if dict[i] == b:
    list.append(i)
list.sort()
for i in list:
  print(i)

Measured memory_bytes: 32096
n,s,sj=int(input()),input(),''.join
l=sum([1 if c==')' else 0 for c in s])
r=n-l
t=s[:]
while True:
    for i in range(len(t)-1):
        if t[i:i+2]=='()':
            t,l,r=t[:i]+t[i+2:],l-1,r-1
            break
    else:break
print(sj(['(']*l)+s+sj([')']*r))

Measured memory_bytes: 3064
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	fmt.Print(string(Scanner()[0]))
	fmt.Print(string(Scanner()[1]))
	fmt.Println(string(Scanner()[2]))
}


Measured memory_bytes: 1772
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
a, b, c = MAP()
print(a+b+c-max(a,b,c))

Measured memory_bytes: 5144
n = int(input())
alist = [int(a) for a in input().split()]


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


prev = None
for a in alist:
    if prev is None:
        prev = a
        continue
    prev =lcm(prev, a)

print(prev)


Measured memory_bytes: 62832
N, M = map(int, input().split())
*S, = map(int, input().split())
*T, = map(int, input().split())

data = [0]*(M+2)
def get(k):
    s = 0
    while k:
        s += data[k]
        k -= k & -k
    return s % MOD
def add(k, x):
    while k <= M:
        data[k] = (data[k] + x) % MOD
        k += k & -k

MOD = 10**9 + 7
s = 0
rM = range(M-1, -1, -1)
for i in range(N):
    si = S[i]
    for j in rM:
        if si == T[j]:
            v = get(j+1) + 1
            add(j+2, v); s += v
print((s + 1) % MOD)

Measured memory_bytes: 43484
from collections import Counter,defaultdict,deque
import sys,bisect,math,itertools,string,queue
from heapq import heappop, heappush
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
res = 100
for i in range(1,3*10**6+1):
    if (n/i).is_integer():
        tmp = max(len(str(i)), len(str(n//i)))
        res = min(res, tmp)
print(res)

Measured memory_bytes: 41832
#include <iostream>
#include <string>
#include <vector>

using ll = long long;

int main()
{
  ll A, B, C;
  std::cin >> A >> B >> C;

  std::swap(A, B);
  std::swap(A, C);
  std::cout << A << " " << B << " " << C << std::endl;

  return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
n = int(input())
h = [int(i) for i in readline().split()]

ans = 0
tmp = 0
i = 0
while i < n-1:
  if h[i] >= h[i+1]:
    tmp += 1
  else:
    ans = max(ans, tmp)
    tmp = 0
  i += 1
ans = max(ans, tmp)
print(ans)

Measured memory_bytes: 14252
import java.io.IOException;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	
	public static final int MAX = 24 * 60 * 60;
	
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);

		while (sc.hasNext()) {
			final int n = sc.nextInt();
			
			if(n == 0){
				break;
			}
			
			int[] imos = new int[MAX];
			
			for(int i = 0; i < n; i++){
				String[] start_str = sc.next().split(":");
				final int start = (Integer.parseInt(start_str[0]) * 60 + Integer.parseInt(start_str[1])) * 60 + Integer.parseInt(start_str[2]);
				
				String[] end_str = sc.next().split(":");
				final int end = (Integer.parseInt(end_str[0]) * 60 + Integer.parseInt(end_str[1])) * 60 + Integer.parseInt(end_str[2]);
				
				imos[start]++;
				if(end < MAX){
					imos[end]--;
				}
			}
			
			int max = 0;
			for(int i = 1; i < MAX; i++){
				imos[i] += imos[i-1];
				max = Math.max(max, imos[i]);
			}
			
			System.out.println(max);
		}
	}

}

Measured memory_bytes: 99976
#include <stdio.h>

using namespace std;

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

int main() {
    // 偶数回裏返すと表
    // 奇数回裏返すと裏
    // 周りにあるマスの数 + 1回裏返される

    long N, M;
    scanf("%ld %ld", &N, &M);

    // 1, 1 ならば 1
    // 2, 1 ならば 0
    // 2, 2 ならば 0
    // 3, 1 ならば 1
    // N, 1 ならば N - 2
    // 3, 2 ならば 0
    // 3, 3 ならば 1
    // 4, 4 ならば 4
    // 5, 4 ならば 6
    // N, M は 2 以上のとき
    // N, M ならば (N - 2) * (M - 2)

    if (N <= 2 && M <= 2) {
        if (N == 1 && M == 1) {
            printf("1\n");
            return 0;
        }
        if (N == 2 || M == 2) {
            printf("0\n");
            return 0;
        }

        printf("0\n");
        return 0;
    }

    if (N == 1 || M == 1) {
        printf("%ld\n", N == 1 ? M - 2 : N - 2);
        return 0;
    }

    printf("%ld\n", (N - 2) * (M - 2));
    return 0;
}


Measured memory_bytes: 128
#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() {
	string A, B;
	cin >> A >> B;
	int As = A.size();
	int Bs = B.size();
	if (As > Bs) {
		cout << "GREATER" << endl;
	}
	else if (As < Bs) {
		cout << "LESS" << endl;
	}
	else if (A == B) {
		cout << "EQUAL" << endl;
	}
	else {
		vector<string>S(2);
		S[0] = A;
		S[1] = B;
		sort(S);
		if (S[0] == A) {
			cout << "LESS" << endl;
		}
		else {
			cout << "GREATER" << endl;
		}
	}
}

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

#define REP(i,num) for(ll i=0;i<(num);++i)
#define FOR(i,c,num) for(ll (i)=(c);(i)<(num);++(i))
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=ll>
T in(){T x; cin >> x; return (x);}
template<typename T=ll,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return x;}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

template<typename T>
bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>
bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

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

	auto N=in();

	out(N+N*N+N*N*N);
	return 0;
}


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

///******************************** C o n t a i n e r ********************************///

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

///*********************************** C o n s t ***********************************///

const int       N=1e6+123;
const double    PI = acos(-1);
const ll        MOD=1000000007;                 ///1e9+7
ll dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};       ///first 4 for adjacent
ll dy[] = {0, +1, 0, -1, +1, -1, +1, -1};
ll dx8[]= {+1, +1, -1, -1, +2, +2, -2, -2};    ///knights move
ll dy8[]= {+2, -2, +2, -2, +1, -1, +1, -1};

///********************************** M a r c o ***********************************///

#define pb push_back
#define MP make_pair
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define sp <<' '
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

ll powmod(ll a,ll b){ a%=MOD;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=MOD;--b;}a*=a;a%=MOD;b/=2;}return pr;}
ll modinverse(ll a){return powmod(a,MOD-2);}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0 or n%(i+2)==0)return false;}return true;}
void seive(bool a[]){ll mx=sqrt(N),ii,jj;for(ii=3;ii<=mx;ii+=2)if(!a[ii])for(jj=ii*ii;jj<N;jj+=2*ii)a[jj]=true;}
void numofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<N;jj+=ii){if(jj==ii*ii) a[jj]++; else a[jj]+=2;}}}
void sumofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<N;jj+=ii){if(jj==ii*ii) a[jj]+=ii; else a[jj]+=ii+jj/ii;}}}

///**************************************************** C o d e ****************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///



void _case()
{
    ll n,m,i,x,ans=0;
    cin>>n>>m;
    map<ll,ll> ac,wa;
    string a;
    while(m--){
        cin>>x>>a;
        ///cout<<x sp<<a el;
        if(ac[x]) continue;
        if(a=="AC") ac[x]++;
        else wa[x]++;
    }
    x=0;
    for(auto i:ac) if(i.S) x++;
    for(auto i:wa){
        if(ac[i.F]) ans+=i.S;
    }
    cout<<x sp<<ans el;
}

main()
{
    fastio();
    _case();

}


///Thank you.


///Brainless_Loco Terminates Here!


Measured memory_bytes: 11452
#include<bits/stdc++.h>
#include<string>
using namespace std;
int main()
{
   string s;
   int t,c=0;
   cin>>t;
   cin>>s;
   if(t%2!=0)
   {
       cout<<"No"<<endl;
   }
   else
   {
       for(int i=0;i<t/2;i++)
       {
           if(s[i]==s[i+t/2])
            c++;
       }
       if(c==t/2)
       {
           cout<<"Yes";
       }
       else
       {
           cout<<"No";
       }
   }

    return 0;

}










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

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

const int N = 3e5 + 5;

int a[N], m[N];
ordered_set<pair<int, int>> os;

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
    os.insert({a[i], m[a[i]]++});
  }
  for (int i = 0; i < n; i++) {
    int x = os.order_of_key({a[i], 0});
    int b = n - x;
    if (b > 1) {
      pair<int, int> c = *os.find_by_order(n - 1);
      cout << c.first <<'\n';
    } else {
      pair<int, int> c = *os.find_by_order(n - 2);
      cout << c.first <<'\n';
    }
  }
  return 0;
}


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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;cin>>n;
  vector<int> a(n),b(n);
  rep(i,n)cin>>a[i]>>b[i];
  ll x=1,y=1;
  for(int i=1;i<n;i++){
      x=(x*a[i-1]+a[i]-1)/a[i];
      y=(y*b[i-1]+b[i]-1)/b[i];
      x=y=max(x,y);
  }
  cout<<x*a[n-1]+y*b[n-1]<<endl;
  return 0;
  }


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

int a[105];
int dp[105][100005];

//#define MOD 1000000007

int main()
{
    int n, k;
    cin >> n >> k;
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }

    for(int i = 0; i <= k; ++i){
        if(i)
            dp[0][i] = dp[0][i-1];
        if(i <= a[0])
            dp[0][i]++;
    }

    for(int i = 1; i < n; ++i){
        dp[i][0] = 1;
        for(int j = 1; j <= k; ++j){
            dp[i][j] = dp[i][j - 1];
            dp[i][j] += (dp[i - 1][j] - (j - a[i] - 1 >= 0 ? dp[i - 1][j - a[i] - 1] : 0) + 1000000007) % 1000000007;
            dp[i][j] %= 1000000007;
        }
    }

    cout << (dp[n - 1][k] - dp[n - 1][k - 1] + 1000000007) % 1000000007 << "\n";
    return 0;
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};



int main(){

  int n;
  cin >> n;
  vector<int> v(n);
  REP(i,n)cin >> v[i];
  vector<int> s(n),t(n);
  s[0] = v[0];
  REP(i,n-1)s[i+1] = __gcd(s[i],v[i+1]);
  t[n-1] = v[n-1];
  REPD(i,n-1)t[i] = __gcd(t[i+1],v[i]);
  ll res = max(s[n-2],t[1]);
  for(ll i = 1;i < n-1;i++)res = max(res,1ll*__gcd(s[i-1],t[i+1]));
  cout << res << endl;


  

  return 0;
}


Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();

		do {
			C = C-B;
			if(C > 0) {
				A = A-D;
			}
		}while (A > 0 && C > 0);
				
		if(A > C) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		
		sc.close();
	}
}

Measured memory_bytes: 35744
N = int(input())
if(N<=111):
    print("111")
elif(N<=222):
    print("222")
elif(N<=333):
    print("333")
elif(N<=444):
    print("444")
elif(N<=555):
    print("555")
elif(N<=666):
    print("666")
elif(N<=777):
    print("777")
elif(N<=888):
    print("888")
else:
    print("999")

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

using namespace std;


void solve() {
    int n; cin >> n;
    string s,t;
    cin >> s >> t;
    for (int i = 0; i < n; i++) {
        cout << s[i]<<t[i];
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long int ll;


struct Dice{
    int a,b,c,d,e,f;
};

void rotate(Dice &D,char c){
    int tmp;
    if(c=='N'){
        tmp=D.a;D.a=D.b;D.b=D.f;D.f=D.e;D.e=tmp;
    }
    if(c=='S'){
        tmp=D.a;D.a=D.e;D.e=D.f;D.f=D.b;D.b=tmp;
    }
    if(c=='W'){
        tmp=D.a;D.a=D.c;D.c=D.f;D.f=D.d;D.d=tmp;
    }
    if(c=='E'){
        tmp=D.a;D.a=D.d;D.d=D.f;D.f=D.c;D.c=tmp;
    }
}

void spin(Dice &D){
    int tmp;
    tmp=D.b;D.b=D.c;D.c=D.e;D.e=D.d;D.d=tmp;
}

bool same(Dice &D,Dice &E){
    if(D.a==E.a&&D.b==E.b&&D.c==E.c&&D.d==E.d&&D.e==E.e&&D.f==E.f)return true;
    else return false;
}


int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	Dice D;
    cin >> D.a >> D.b >> D.c >> D.d >> D.e >> D.f;
    string s; cin >> s;
    for(char c:s){
    	rotate(D,c);
    }
    cout << D.a << endl;
}


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

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

bool is_prime(ll n){
	if(n==1)return false;
	for(ll i=2;i*i<=n;i++){
		if(n%i==0)return false;
	}
	return true;
}
vector<ll>divisor(ll n){
	vector<ll>res;
	for(ll i=1;i*i<=n;i++){
		if(n%i==0){
			res.push_back(i);
			if(i!=n/i)res.push_back(n/i);
		}
	}
	return res;
}
map<ll,int>prime_factor(ll n){
	map<ll,int>res;
	for(ll i=2;i*i<=n;i++){
		while(n%i==0){
			res[i]++;
			n/=i;
		}
	}
	if(n!=1)res[n]++;
	return res;
}
vector<ll>prime_enum(int n){
	vector<bool>is_prime(n+1,true);
	is_prime[0]=is_prime[1]=false;
	vector<ll>res;
	for(int i=2;i<=n;i++){
		if(!is_prime[i])continue;
		res.push_back(i);
		for(int j=2*i;j<=n;j+=i){
			is_prime[j]=false;
		}
	}
	return res;
}

#include <atcoder/math>
using namespace atcoder;


ll f(ll n){
	auto mp=prime_factor(n);
	mp[2]++;
	assert(mp.size()<=20);
	int N=mp.size();
	vector<ll>v;
	for(auto p:mp){
		ll A=1;
		rep(i,p.second){
			A*=p.first;
		}
		v.push_back(A);
	}
	ll Min=LLONG_MAX;
	rep(i,1<<N){
		ll a=1,b=1;
		rep(j,N){
			if(i>>j&1)a*=v[j];
			else b*=v[j];
		}
		auto res=crt({0,1},{a,b});
		ll d=(res.first+res.second-1)%res.second;
		if(d==0)d+=res.second;
		Min=min(Min,d);
	}
	return Min;
}

int main(){
	ll n;cin>>n;
	cout<<f(n)<<endl;
	//~ ll a=1;
	//~ int cnt=0;
	//~ for(ll i=1;;i++){
		//~ if(is_prime(i)){
			//~ a*=i;
			//~ cnt++;
			//~ if(a>=1e15){
				//~ cout<<a<<' '<<cnt<<endl;
				//~ return 0;
			//~ }
		//~ }
	//~ }
	//~ cout<<"f(2)="<<f(2)<<endl;
	//~ for(int n=1;n<=100;n++){
		//~ for(int k=1;;k++){
			//~ if((k*(k+1)/2)%n==0){
				//~ cout<<n<<' '<<k<<endl;
				//~ assert(k==f(n));
				//~ break;
			//~ }
		//~ }
	//~ }
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)

#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
using ll = long long;
template <class T> using vec = vector<T>;
using vi   = vector<int>;
using vvi  = vector<vi>;
using vvvi = vector<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second


// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase( unique(all(v)), v.end() )
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }

template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval>newval) { minval=newval; return 1; } return 0; }

// Utilities
// Grid world utilities
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
#define inside(H,W,y,x) 0<=(x) && (x)<(W) && 0<=(y) && (y)<(H)

inline int in() {int x; cin >> x; return x;} // read int from cin
inline  ll IN() {ll x; cin >> x; return x;}  // read ll from cin



// Debug
#ifdef LOCAL
  #include "dump.hpp"
  #define debug(x) cerr << #x << ": " << x << '\n'
#else
  #define dump(...)
  #define debug(x)
#endif

// Paste snippets here!!

// 

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  int n=in();
  vector<double> v(n);
  rep(i,n) cin>>v[i];
  priority_queue<double> q;
  rep(i,n) q.push(-v[i]);

  double ans = 0;
  while(q.size()>1){
    double val1 = -q.top(); q.pop();
    double val2 = -q.top(); q.pop();
    q.push(-(val1+val2)/2);
  }
  dump(-q.top());
  cout << setprecision(12) << -q.top() << endl;
  return 0;
}


Measured memory_bytes: 256
#pragma region pre
#include <iostream>
#include <vector>
#include <array>

using namespace std;
using ll = long long;
constexpr double INF{ 1e9 };
constexpr int MOD{ 1000000000 + 7 };
#define rep(i,n) for (int i = 0; i < n; ++i)
constexpr array<int, 4> dy{ -1, 1, 0, 0 };
constexpr array<int, 4> dx{ 0, 0, -1, 1 };

//constexpr int div_ru(int a, int b)
//{
//    return (a - b + 1) / b;
//}
//ll pow_mod(ll b, ll e, ll m)
//{ // https://atcoder.jp/contests/atc002/tasks/atc002_b
//    ll r = 1;
//    for (; e > 0; e >>= 1)
//    {
//        if (e & 1)
//            r = (r * b) % m;
//        b = (b * b) % m;
//    }
//    return r;
//}

#pragma endregion

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

    int n, x;
    cin >> n >> x;
    vector<int> l(n);
    for (int i = 0; i < n; ++i) {
        cin >> l[i];
    }

    int d = 0;
    int cnt = 0;

    if (d <= x) {
        cnt++;
    }

    for (int i = 0; i < n; ++i) {
        d += l[i];
        if (d <= x) {
            cnt++;
        }
    }

    cout << cnt << endl;
}
// vector<vector<int>> mm(h, vector<int>(w, -1));



Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <list>
#include <iomanip>
#include <queue>
#include <cmath>
#include <numeric>
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)

using namespace std;
using ll = long long;
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; }
const long long mod = 1e9 + 7;
ll dx[] = { 1,0 };
ll dy[] = { 0,1 };

int main() {

    ll N, M;

    cin >> N >> M;

    priority_queue<ll> A;

    ll tmp;

    rep(i, N) {
        cin >> tmp;
        A.push(tmp);
    }

    rep(i, M) {
        if (A.top() == 0) break;
        tmp = A.top() / 2;
        A.pop();
        A.push(tmp);
    }


    ll ans = 0;
    rep(i, N) {
        ans += A.top();
        A.pop();
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 4332
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

const int N = 200005;
const double eps = (double) 1e-9;
const double pi = 2 * acos(0.0);

double x, a, b;

double f(double angle) {
  angle = pi / 2 - angle;
  if (2 * x <= a * a * b) {
    return a * b * (b * tan(angle)) / 2;
  } else {
    return a * b * a - a * a * (a / tan(angle)) / 2;
  }
}

int main() {
  cin >> a >> b >> x;
  double l = 0, r = pi / 2;
  while (fabs(r - l) > eps) {
    double mid = (l + r) / 2.0;
    if (f(mid) - x > eps) {
      l = mid;
    } else {
      r = mid;
    }
  }
  double ans = (l + r) / 2.0;
  cout << fixed << setprecision(12) << ans * 180 / pi << endl;
  return 0;
}


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

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define pb push_back
#define odd(x) ((x)&1)
#define even(x) (!odd(x))
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(auto i=0;i<n;++i)
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define TEST_CASE int tc;cin>>tc;while(tc--)

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

#ifdef LOCAL
#define cerr cout
#else
#endif

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}


template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define JD

/******************************************************************************************************************************/

int main()
{
    FASTIO

    #ifndef JD
        freopen("in.txt","r",stdin);
        freopen("out.txt","w",stdout);
    #endif

    int ans;
    string s;
    cin>>s;
    string t = "RRR";
    if(t==s)
        ans = 3;
    else if((s[0]=='R'&&s[1]=='R')||(s[1]=='R'&&s[2]=='R'))
        ans = 2;
    else if(s[0]=='R'||s[1]=='R'||s[2]=='R')
        ans = 1;
    else ans=0;

    cout<<ans<<"\n";

    return 0;
}


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

int main() {
  int ABCD;
  cin >> ABCD;
  
  int A, B, C, D;
  D = ABCD%10;
  C = ABCD/10 %10;
  B = ABCD/100 %10;
  A = ABCD/1000 %10;
  
  if (A + B + C + D == 7) {
    cout << A << '+' << B << '+' << C << '+' << D << "=7" << endl;
  } else if (A + B + C - D == 7) {
    cout << A << '+' << B << '+' << C << '-' << D << "=7" << endl;
  } else if (A + B - C + D == 7) {
    cout << A << '+' << B << '-' << C << '+' << D << "=7" << endl;
  } else if (A + B - C - D == 7) {
    cout << A << '+' << B << '-' << C << '-' << D << "=7" << endl;
  } else if (A - B + C + D == 7) {
    cout << A << '-' << B << '+' << C << '+' << D << "=7" << endl;
  } else if (A - B + C - D == 7) {
    cout << A << '-' << B << '+' << C << '-' << D << "=7" << endl;
  } else if (A - B - C + D == 7) {
    cout << A << '-' << B << '-' << C << '+' << D << "=7" << endl;
  } else if (A - B - C - D == 7) {
    cout << A << '-' << B << '-' << C << '-' << D << "=7" << endl;
  }
}

Measured memory_bytes: 256
N=int(input())
L=["AC","WA","TLE","RE"]
ANS=[0,0,0,0]

for i in range(N):
    s=input()
    for j in range(4):
        if s==L[j]:
            ANS[j]+=1


print("AC x "+str(ANS[0]))
print("WA x "+str(ANS[1]))
print("TLE x "+str(ANS[2]))
print("RE x "+str(ANS[3]))

Measured memory_bytes: 9152
#include<stdio.h>
int main()
{
  int n,t[100000],k,s;
  while(1){
    scanf("%d",&n);
    if(n==0)break;
    s=0;
    for(k=0;k<(n/4);k++){
      scanf("%d",&t[k]);
      s=s+t[k];
    }
    printf("%d\n",s);
  }
  return 0;
}

Measured memory_bytes: 608
#include <cstdio>

int n;
int a[100005];
long long dp[100005];
const long long MOD= 1000000007;

long long exp(int e){
    if(!dp[e]){
        if(e%2){
            return dp[e]=2*exp(e-1)%MOD;
        }else{
            return dp[e]=exp(e/2)*exp(e/2)%MOD;
        }
    }
    return dp[e];
}

int main(){
    dp[0]=1;
    dp[1]=2;
    scanf("%d", &n);
    for(int i=0;i<n;++i){
        int tmp;
        scanf("%d", &tmp);
        a[tmp]++;
    }
    if(n%2){
        if(!a[0]){
            puts("0");
            return 0;
        }
        for(int j=2;j<=n-1;j+=2){
            if(a[j]!=2){
                puts("0");
                return 0;
            }
        }
        printf("%lld", exp(n/2));
    }else{
        for(int j=1;j<=n-1;j+=2){
            if(a[j]!=2){
                puts("0");
                return 0;
            }
        }
        printf("%lld", exp(n/2));
    }

}


Measured memory_bytes: 640
a_bt, b_bt = map(int, input().split())
result = a_bt > b_bt
sum = a_bt if result else b_bt
a_bt = a_bt - 1 if result else a_bt
b_bt = b_bt - 1 if not result else b_bt
result = a_bt > b_bt
sum += a_bt if result else b_bt

print(sum)


Measured memory_bytes: 2940
#include <set>
#include <iostream>
using namespace std;
/*
int main()
{
    set<int> s[3];
    s[0].insert(1);
    s[0].insert(3);
    s[0].insert(5);
    s[0].insert(7);
    s[0].insert(8);
    s[0].insert(10);
    s[0].insert(12);
    s[1].insert(4);
    s[1].insert(6);
    s[1].insert(9);
    s[1].insert(11);
    s[2].insert(2);
    

    int x, y;
    bool is_found = false;
    cin >> x >> y;
    for(int i = 0; i < 2; i++){
	    if(s[i].find(x) != s[i].end() && s[i].find(y) != s[i].end()){
		    is_found = true;
	    }
    }
    if(is_found){
	    cout << "Yes" << endl;
    }else{
	    cout << "No" << endl;
    }

    return 0;
}
*/
#include <vector>
int main()
{
	int H, W;
	cin >> H >> W;
	vector<vector<char>> array(H + 2, vector<char>(W + 2));

	for(int i = 0; i < H + 2; i++){
		for(int j = 0; j < W + 2; j++){
			if(i == 0 || j == 0 || i == H + 1 || j == W + 1){
				array[i][j] = '#';
			}else{
				char tmp;
				cin >> tmp;
				array[i][j] = tmp;
			}
		}
	}
        for(int i = 0; i < array.size(); i++){
	       for(int j = 0; j < array[i].size(); j++){
	           cout << array[i][j];
               }
               cout << endl;
       }	       
	return 0;
}


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

int n,a[N],cnt;
char s[N];

int main(){
	scanf("%s",s);n=strlen(s);
	for (int i=0;i<n;i++) a[i]=9*(s[n-1-i]-'0');
	for (int i=0;i<n;i++)
	{
		a[i+1]+=a[i]/10;
		a[i]%=10;
	}
	for (int i=0;i<=n;i++) cnt+=a[i];
	//cout<<cnt<<endl;
	for (int t=1;;t++){
		a[0]+=9;cnt+=9;
		for (int i=0;a[i]>=10;i++)
			a[i+1]++,a[i]-=10,cnt-=9;
		if (cnt<=9*t) {printf("%d\n",t);return 0;}
	}
	return 0;
}

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

using namespace std;
 
int main(){
  string a, b;
  int c= 0;
  cin >> a >> b;
  for (int i = 0; i < a.size(); i++){
    if (a[i] != b[i]) c++;
  }
  cout << c << endl;
}

Measured memory_bytes: 3920
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <array>
#include <algorithm>
#include <utility>
#include <numeric>


using namespace std;


template <class ...Args>
void Input(Args &...args)
{
	(cin >> ... >> args);
}

template <class T>
void InputArray(std::size_t size, T &t)
{
	t.resize(size);
	for (auto &e : t) {
		cin >> e;
	}
}

template <class ...Args>
void InputArray(std::size_t size, Args &...args)
{
	(InputArray(size, args), ...);
}

template <class ...Args>
void InputVerticalArray(std::size_t size, Args &...args)
{
	(args.resize(size), ...);
	for (int i = 0; i < size; i++) {
		((cin >> args[i]), ...);
	}
}

template <class ...Args>
void Output(const Args &...args)
{
	((cout << args << ' '), ...) << endl;
}

template <class ...Args>
void OutputVertical(const Args &...args)
{
	((cout << args << endl), ...);
}

template <class T>
void OutputArray(const T &t)
{
	for (const auto &e : t) {
		cout << e << ' ';
	}
	cout << endl;
}

template <class ...Args>
void OutputArray(const Args &...args)
{
	(OutputArray(args), ...);
}

template <class ...Args>
void OutputVerticalArray(const Args &...args)
{
	for (int i = 0; i < min({ args.size()... }); i++) {
		((cout << args[i] << ' '), ...) << endl;
	}
}


#define inp(type, ...) \
	type __VA_ARGS__; \
	Input(__VA_ARGS__)

#define inpa(type, size, ...) \
	type __VA_ARGS__; \
	InputArray((size), __VA_ARGS__)

#define inpva(type, size, ...) \
	type __VA_ARGS__; \
	InputVerticalArray((size), __VA_ARGS__)

#define otp(...) \
	Output(__VA_ARGS__)

#define otpv(...) \
	OutputVertical(__VA_ARGS__)

#define otpa(...) \
	OutputArray(__VA_ARGS__)

#define otpva(...) \
	OutputVerticalArray(__VA_ARGS__)

#define rep(counter, range) \
	for (int (counter) = 0; (counter) < (range); (counter)++)

#define repi(range) \
	rep(i, range)

#define rrep(counter, range) \
	for (int (counter) = (range) - 1; (counter) >= 0; (counter)--)

#define rrepi(range) \
	rrep(i, range)

#define repc(element, container) \
	for (auto &(element) : (container))

#define repe(container) \
	repc(e, container)

#define all(container) \
	(container).begin(), (container).end()

#ifdef __CCR__
#	define dlog(x) clog << #x " = " << x << endl
#else
#	define dlog(x)
#endif



int main()
{
	inpa(vector<int>, 5, a);
	
	int t = 0;
	int u = 10;
	repe(a) {
		t += (e - 1) / 10;
		if (e % 10 > 0) u = min(u, e % 10);
	}
	t += 5;
	t *= 10;
	t += u - 10;
	
	otp(t);
	
	return 0;
}


Measured memory_bytes: 3536
import Data.List
import Control.Monad

main = do
  [n, m] <- map read . words <$> getLine
  lrs <- map (map read . words) <$> replicateM m getLine :: IO [[Int]]
  print $ length $ solve n lrs

solve n lrs =
  let [l, r] = foldl1 (\[l, r] [l', r'] -> [max l l', min r r']) lrs
  in
      [(max l 1)..(min r n)]

Measured memory_bytes: 100732