akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long
#define rep(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
int main()
{
  string s,t;
  int a,m,k;
  cin >> s >> t;
  a=s.length();
  k=0;
  rep(i,a){
    m=0;
    rep(j,a){if(s[j]==t[(j+i)%a])m++;
             if(m==a)k=1;
            }
  }
  if(k==1)printf("Yes");
  else printf("No");
}

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

typedef long long int lli;
#define int lli
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<lli> vli;
typedef vector<pii> vii;

const int MOD   = 1e9 + 7;
const double PI = acos(-1.0);
const int xd[4] = {1, -1, 1, -1}, yd[4] = {-1, 1, 1, -1};
const int INF   = 1e18;

#define fastio            ios_base::sync_with_stdio(false);cin.tie(0)
#define sz(a) int((a).size())
#define rsz resize
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define f first
#define s second
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define endl "\n"
#define spc " "
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template <typename T> T lcm(T a, T b){return (a*b)/gcd(a,b); }


void solve(){

    int n;
    cin >> n;

    priority_queue<int> h[4];

    vii query;
    rep(i, n){
        int u, v;
        cin >> u >> v;
        query.pb({u, v});
    }

    int ans = -INF;

    rep(i, 4){
        int fin = xd[i] * query[0].f + yd[i] * query[0].s;
        h[i].push(fin);
    }


    repA(p, 1, n - 1){
        pii curr = query[p];
        int tans = -INF;
        rep(dir, 4){
            int fin = xd[dir] * curr.f + yd[dir] * curr.s;
            tans = max(tans, abs(h[dir].top() - fin));
            h[dir].push(fin);
        }
        ans = max(ans, tans);
    }

    cout << ans << endl;






}

signed main(){
    fastio;

    solve();

    return 0;
}


Measured memory_bytes: 17160
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int n, d, x;
    cin >> n >> d >> x;
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        for (int j = 1; j <= d; j += a)
        {
            x++;
        }
    }
    cout << x << endl;
}

Measured memory_bytes: 256
a  =  int(input())

b = list(map(int,input().split()))

b.sort()

c = 1
d = 0
dd = 0

p = b[0]

for i in range(1,a):
	if p == b[i]:
		c += 1
	elif p != b[i]:
		p = b[i]
		c = 1
	if c == 2:
		d = dd
		dd = p
	elif c == 4:
		d = p
		dd = p

print(d*dd)

Measured memory_bytes: 14252
#include<bits/stdc++.h>
#define IL inline
#define _ 600005
#define ll long long
using namespace std ;

map<ll , char>M ;
ll n,m,lcm ; char S[_] , T[_] ;
ll GCD(ll a , ll b) {return b ? GCD(b , a % b) : a ; }

IL bool Check(ll N) {
	M.clear() ;
	ll dv = N / n ; 
	for(ll j = 0; j < n; j ++) M[j * dv + 1] = S[j+1] ;
	dv = N / m ;
	for(ll j = 0; j < m; j ++) {
		if(M.find(j * dv + 1) != M.end()){
			if(M[j*dv + 1] != T[j+1]) return false ;
		}
	}
	return true ; 
}

int main() {
	cin >> n >> m ; 
	scanf("%s" , S + 1) ; scanf("%s" , T + 1) ; 
	lcm = n * m / GCD(n , m) ;
	if(!Check(lcm)) return puts("-1") , 0 ;
	else printf("%lld\n" , 1ll * lcm) ; 
	return 0  ;
}

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

using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
  int N;
  cin >> N;
  int a[N];
  for (int i = 0; i < N; i++) cin >> a[i];

  double ans = 0;
  for (int i = 0; i < N; i++) ans += 1.0 / a[i];

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


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#define ll long long int
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int main() {
    string s; cin >> s;
    int n = s.length();
    vector<ll> a;
//cout << n << endl;
    int i = 0, cnt = 1;
    while(i < n - 1){
        if(s[i] == s[i+1]){
            cnt++;
        }else{
            a.pb(cnt);
            cnt = 1;
        }
        i++;
    }
    if(cnt != 1) a.pb(cnt);
    if(s[n-1] != s[n-2]) a.pb(1);

    ll ans = 0;
    int N = a.size();
    if(s[0] == '<'){
        for(int i = 0; i < N-1; i+=2){
            ll MA = max(a[i],a[i+1]);
            ll MI = min(a[i],a[i+1]);
            ans += (1+MA) * MA / 2;
            ans += MI * (MI-1) / 2;
        }
        if(N%2==1) ans += (a[N-1]+1) * a[N-1] / 2;
    }else{
        ans += a[0] * (a[0] + 1) / 2;
        for(int i = 1; i < N -1; i+=2){
            ll MA = max(a[i],a[i+1]);
            ll MI = min(a[i],a[i+1]);
            ans += (1+MA) * MA / 2;
            ans += MI * (MI-1) / 2;
        }
        if(N%2==0) ans += (a[N-1]+1) * a[N-1] / 2;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3316
#include<iostream>
#include<stdio.h>
#include<cmath>
using namespace std;
int main(){
    int n,x[100]={},y[100]={};
    double max=0.0,a,b=0.0,c=0.0,d=0.0,e,f,g;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x[i];
    }
    for(int i=0;i<n;i++){
        cin>>y[i];
    }
    for(int i=0;i<n;i++){
        a=abs(x[i]-y[i]);
        b+=a;
        c+=a*a;
        d+=a*a*a;
        if(a>max) max=a;
    }
    e=sqrt(c);
    f=cbrt(d);
    g=max;
    printf("%f\n %f\n %f\n %f\n",b,e,f,g);
    return 0;
}



Measured memory_bytes: 3340
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define all(x) (x).begin(), (x).end()
ll inf = LLONG_MAX;
long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

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

  vll a(n);
  for (ll i = 0; i < n; i++) cin >> a[i];

  ll x = 0, y = 0, z = 0;
  for (ll i = 0; i < n; i++) {
    if (a[i] % 4 == 0) x++;
    else if (a[i] % 2 == 0) y++;
    else z++;
  }

  if (z <= x) Yes();
  else if (z == x + 1 && y == 0) Yes();
  else No();
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include <vector>
#include <cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;

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

const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
ll combi(ll n,ll m) {
  ll ans=1;
  rFOR(i,n,n-m){
    ans*=i;
  }
  FOR(i,1,m+1){
    ans/=i;
  }
  return ans;
}
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll n; ci(n);
  vll A(n);
  vll B(n);
  
  FOR(i,0,n){
    ci(A[i])
      B[i]=A[i];
  }
  SORT(A);
  FOR(i,0,n){
    if(B[i]<A[n/2]) co(A[n/2])
      else co(A[n/2-1])
      }
}

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

using namespace std;

bool solve() {
  int n;
  string s;
  cin >> n >> s;
  if (n % 2 != 0) return false;
  return s.substr(0, n / 2) == s.substr(n / 2, n / 2);
}

int main() {
  bool ans = solve();
  cout << (ans ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using namespace std;
using ll = long long;
const ll MOD = (ll)1e9+7;
//const ll MOD = 998244353;
//const ll MOD = 924844033;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

#ifdef DEBUG
#define OUTPUT(x) (output(x), outendl())
#else
#define OUTPUT(x) (void)0
#endif

ll modpow(ll x, ll b){
	ll res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

ll modinv(ll x){
	return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
	if(was_output)cout << " ";
	cout << a;
	was_output = true;
}
void outendl(){
	was_output = false;
	cout << endl;
}

//below here

template<class t>
class Vector2{
	public:
		t x;
		t y;
		Vector2():x(0), y(0){}
		Vector2(t a, t b):x(a), y(b){}
		Vector2(const Vector2 &o):x(o.x), y(o.y){}

		Vector2& operator+=(Vector2 o){x+=o.x;y+=o.y;return *this;}
		Vector2& operator-=(Vector2 o){x-=o.x;y-=o.y;return *this; }
		Vector2& operator*=(t o){x*=o;y*=o;return *this;}
		Vector2& operator/=(t o){x/=o;y/=o;return *this;}

		Vector2 operator+(Vector2 o){return Vector2(*this)+=o;}
		Vector2 operator-(Vector2 o){return Vector2(*this)-=o;}
		Vector2 operator*(t o){return Vector2(*this)*=o;}
		Vector2 operator/(t o){return Vector2(*this)/=o;}

		double abs(){
			return sqrt(x*x+y*y);
		}

		Vector2 normal(){
			return (*this) / abs();
		}
};

template<class t>
double abs(Vector2<t> x){
	return x.abs();
}

template<class t>
double dot(Vector2<t> x, Vector2<t> y){
	return x.x * y.x + x.y * y.y;
}

template<class t>
double cross(Vector2<t> x, Vector2<t> y){
	return x.x * y.y - x.y * y.x;
}

template<class t>
void output(Vector2<t> x){
	printf("%lf %lf\n", x.x, x.y);
}

using vector2 = Vector2<ll>;

vector2 input_vector2(){
	double x,y;
	cin >> x >> y;
	return vector2(x,y);
}

int main(){
	vector2 p0;
	vector2 p1;
	p0 = input_vector2();
	p1 = input_vector2();
	p1 -= p0;
	int q;
	cin >> q;
	rep(i,q){
		vector2 p2;
		p2 = input_vector2();
		p2 -= p0;
		if(cross(p1,p2)>0){
			cout << "COUNTER_CLOCKWISE" << endl;
		}else if(cross(p1,p2)<0){
			cout << "CLOCKWISE" << endl;
		}else if(dot(p1,p2)<0){
			cout << "ONLINE_BACK" << endl;
		}else if(abs(p2)>abs(p1)){
			cout << "ONLINE_FRONT" << endl;
		}else{
			cout << "ON_SEGMENT" << endl;
		}
	}
}



Measured memory_bytes: 3228
input_lines = readlines.map(&:chomp)
N, M, C = input_lines.shift.split(' ').map(&:to_i)
BB = input_lines.shift.split(' ').map(&:to_i)

result = input_lines[0, N].count do |line|
  aa = line.split(' ')[0, M].map(&:to_i)

  sigma = aa.map.with_index do |a, i|
    a * BB[i]
  end
  sigma << C

  sigma.inject(:+) > 0
end

puts result

Measured memory_bytes: 1916
#include <cstdio>

int main(){
	int n;
	int a[6] = {500,100,50,10,5,1};
	while(scanf("%d",&n), n!= 0){
		int t = 0;
		n = 1000 - n;
		for(int i = 0; i < 6; i++){
			t += n / a[i];
			n %= a[i];
		}
		printf("%d\n",t);
	}
	return 0;
}
		

Measured memory_bytes: 2596
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <climits>
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int ans = 0;
    for(int i=0; i<N; i++){
        int l, r;
        cin >> l >> r;
        ans += r-l+1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
N,K = map(int,input().split())
mod = pow(10,9)+7

F = [1]
for i in range(N):F.append((F[i]*(i+1))%mod)
Y = [1]
for i in range(N):Y.append(pow(F[i+1],mod-2,mod))
def c(n,r):
    global F,Y
    if n<r:return 0
    return (F[n]*Y[n-r]*Y[r])%mod
for k in range(1,K+1):
    ans = c(N-K+1,k)*c(K-1,k-1)
    print(ans%mod)

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

priority_queue<pair<int, int>> q;
int t[101010];
int main()
{
  int n, l;
  cin >> n >> l;
  for (int i = 0; i < n; i++){
    int x;
    cin >> x;
    q.emplace(x, i + 1);
  }

  int maxt = 0;
  while (!q.empty()){
    auto v = q.top(); q.pop();
    t[v.second] = max(t[v.second - 1], t[v.second + 1]) + l - v.first;
    maxt = max(maxt, t[v.second]);
  }

  cout << maxt << endl;
}

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

using namespace std;

int main()
{
    string s;
    cin>>s;
    bool ans = false;
    ans = (s[2] == s[3]) & (s[4] == s[5]);
    if(ans)     cout<<"Yes"<<endl;
    else    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<array>
#include<vector>
#include<functional>
#include<unordered_map>
#include<map>
#include<numeric>
#include<limits>
#include<utility>
#include<queue>
#include<random>
 
using namespace std;
 
int main(){
 
  string s;
  int len;
  
  cin >> s;
  
  len = s.size();
  
  cout << s[0] << len - 2 << s[len - 1] << endl;
  
  return 0;}

Measured memory_bytes: 256
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

const mod = 1000000007

func mpow(a, b int) int {
	if b == 0 {
		return 1
	} else if b%2 == 0 {
		tmp := mpow(a, b/2)
		return tmp * tmp % mod
	}
	return mpow(a, b-1) * a % mod
}

// 逆元を使った割り算（MOD）
// mod. m での a の逆元 a^{-1} を計算する
func modinv(a, m int) int {
	b := m
	u := 1
	v := 0
	for b != 0 {
		t := a / b
		a -= t * b
		a, b = b, a
		u -= t * v
		u, v = v, u
	}
	u %= m
	if u < 0 {
		u += m
	}
	return u
}

func nCr(n, r int) int {
	if n == r {
		return 1
	}
	if n < r || r < 0 {
		return 0
	}
	f0 := 1
	f1 := 1
	for i := 0; i < r; i++ {
		f0 *= (n - i)
		f0 %= mod
		f1 *= (r - i)
		f1 %= mod
	}

	f1 = modinv(f1, mod)

	ret := f0 * f1
	ret %= mod

	return (ret)
}

func main() {
	sc.Split(bufio.ScanWords)
	N, a, b := getInt(), getInt(), getInt()

	ans := mpow(2, N)

	ans -= nCr(N, a)
	if ans < 0 {
		ans += mod
	}
	ans -= nCr(N, b)
	if ans < 0 {
		ans += mod
	}

	out(ans - 1)
}


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

int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  set<int> x;
  x.insert(a);
  x.insert(b);
  x.insert(c);
  x.insert(d);

  set<int> y={1,9,7,4};

  if(x==y)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <math.h>
typedef long long ll;
using namespace std;

int main()
{
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (abs(c - a) <= d) cout << "Yes";
	else if (abs(c - b) <= d && abs(b - a) <= d) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
#include <tuple>
#include <random>

using namespace std;
typedef long long int ll;

#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 rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()

#define inf 10000000000

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

    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(a * b, c * d) << endl;
}


Measured memory_bytes: 256
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), cout, ", ") << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, ostream &os = cout, string sep = " ")
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), os, ", ") << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, N);
    IN(ll, M);
    YES(N == M);
}

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

int main(void) {
  long long H, N, A;
  cin >> H >> N;
  for (int i = 0; i < N; i++) {
    cin >> A;
    H -= A;
  }
  if (H <= 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


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

using namespace std;
typedef long long ll;

pair<ll, ll> DFS(int x, int y, vector<string> &map, vector<vector<int>> &ok) {
	pair<ll, ll> ans = make_pair(0, 0), p;
	ok[y][x] = false;
	if (y > 0 && ok[y - 1][x] && map[y - 1][x] != map[y][x]) {
		p = DFS(x, y - 1, map, ok);
		ans.first += p.first;
		ans.second += p.second;
	}
	if (x > 0 && ok[y][x - 1] && map[y][x - 1] != map[y][x]) {
		p = DFS(x - 1, y, map, ok);
		ans.first += p.first;
		ans.second += p.second;
	}
	if (y < map.size() - 1 && ok[y + 1][x] && map[y + 1][x] != map[y][x]) {
		p = DFS(x, y + 1, map, ok);
		ans.first += p.first;
		ans.second += p.second;
	}
	if (x < map[0].size() - 1 && ok[y][x + 1] && map[y][x + 1] != map[y][x]) {
		p = DFS(x + 1, y, map, ok);
		ans.first += p.first;
		ans.second += p.second;
	}
	if (map[y][x] == '.')
		ans.first++;
	else
		ans.second++;
	return ans;
}

int main(void) {
	int h, w, num, i, j;
	ll ans = 0;
	cin >> h >> w;
	vector<string> s(h);
	pair<ll, ll> p;
	for (i = 0; i < h; i++)
		cin >> s[i];
	vector<vector<int>> d(h, vector<int>(w, true));
	for (i = 0; i < h; i++) {
		for (j = 0; j < w; j++) {
			if (d[i][j]) {
				p = DFS(j, i, s, d);
				ans += p.first * p.second;
			}
		}
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 21120
#include<iostream>
#include<sstream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

int n, a[20];
double dp[20][150000];

int main(){
	cin >> n;
	rep(i, n) cin >> a[i];
	rep(i, n) rep(j, 150000) dp[i][j] = 1;
	
	rep(i, a[0] * 1.5 + 1) dp[0][i] = abs(i - a[0]) * 1.0 / a[0];
	rep(i, n - 1) rep(j, a[i] * 1.5 + 1) if(dp[i][j] < 1){
		for(int k = 1; k * j <= a[i + 1] * 1.5; k++)
		dp[i + 1][k * j] = min(dp[i + 1][k * j], max(dp[i][j], abs(k * j - a[i + 1]) * 1.0 / a[i + 1]));
	}
	double ans = 1;
	rep(i, 150000) ans = min(ans, dp[n - 1][i]);
	printf("%.9f\n", ans);
	return 0;
}

Measured memory_bytes: 24620
def main():
    N, D = map(int, input().split())
    pts = [list(map(int, input().split())) for i in range(N)]
    cnt = 0
    for pt in pts:
        if D ** 2 >= pt[0] ** 2 + pt[1] ** 2:
            cnt += 1
    return cnt

if __name__ == '__main__':
    print(main())

Measured memory_bytes: 102428
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string s;
  long k;
  cin >> s;
  cin >> k;
  int i;
  int ans;
  char d;
  if(k < s.length()){
    for(i = 0;i<k;i++){
      if(s[i] != '1'){
        d = s[i];
        cout << atoi(&d) << endl;
        return 0;
      }
    }
    cout << 1 << endl;
  }else{
    for(i = 0;i<s.length();i++){
      if(s[i] != '1'){
        d = s[i];
        cout << atoi(&d) << endl;
        return 0;
      }
    }
    cout << 1 << endl;
  }
}

Measured memory_bytes: 256
import itertools

n = int(input())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
li = list(range(1, n+1))
ans = []

for i in itertools.permutations(li):
    ans.append(list(i))

print(abs(ans.index(x)-ans.index(y)))

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

int main(){
    int n,k;
    cin >> n >> k;
    int h[n];
    rep(i,n)cin >> h[i];
    
    int dp[n+1];
    rep(i,n)dp[i+1] = 1e9;
    dp[0] = 0;
    
    for(int i = 0;i < n;i++){
        for(int j = 1;j <= k;j++){
            if(i + j < n)dp[i+j] = min(dp[i+j],dp[i] + abs(h[i+j] - h[i]));
        }
    }
    
    cout << dp[n-1] << endl;
}

Measured memory_bytes: 4380
'''
.append(要素) リストに要素を追加
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前
sort()
sorted(reverse=true)
配列の初期化
配列名=[a]*n+[b]*m
Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
from functools import reduce
from operator import mul
from collections import Counter
import itertools
import fractions
import sys
ac = 0
wa = 0
tle = 0
re = 0
num = int(stdin.readline().rstrip())
for el in range(num):
    st = stdin.readline().rstrip()
    if st == 'AC':
        ac += 1
    if st == 'WA':
        wa += 1
    if st == 'TLE':
        tle += 1
    if st == 'RE':
        re += 1
print('AC x '+str(ac))
print('WA x '+str(wa))
print('TLE x '+str(tle))
print('RE x '+str(re))


Measured memory_bytes: 73436
#include<cmath>
#include<cstdio>
#include<algorithm>
 
#define rep(i,n) for(int i=0;i<(n);i++)
 
using namespace std;
 
const double INF=1e77;
const double EPS=1e-8;
const double PI=acos(-1);
 
template<class T>
struct point{
    T x,y;
    point operator+(const point &a)const{ point t = {x+a.x,y+a.y}; return t; }
    point operator-(const point &a)const{ point t = {x-a.x,y-a.y}; return t; }
};
 
template<class T>
point<T> operator*(T c,const point<T> &a){
	point<T> p = {c*a.x,c*a.y};
    return p;
}
 
point<double> rot(const point<double> &a,double theta){
	point<double> p = {a.x*cos(theta)-a.y*sin(theta),a.x*sin(theta)+a.y*cos(theta)};
	return p;
}
 
template<class T>
struct segment{
    point<T> a,b;
};
 
struct star{
    point<double> c;
    double a,r;
    point<double> p[5];
};
 
template<class T>
T dot(const point<T> &a,const point<T> &b){ return a.x*b.x+a.y*b.y; }
 
template<class T>
T cross(const point<T> &a,const point<T> &b){ return a.x*b.y-a.y*b.x; }
 
enum{CCW=1,CW=-1,ON=0};
int ccw(const point<double> &a,const point<double> &b,const point<double> &c){
    double rdir=cross(b-a,c-a);
    if(rdir> EPS) return CCW;
    if(rdir<-EPS) return CW;
    return ON;
}
 
bool intersect(const segment<double> &S1,const segment<double> &S2){
    if(max(S1.a.x,S1.b.x)+EPS<min(S2.a.x,S2.b.x)
    || max(S1.a.y,S1.b.y)+EPS<min(S2.a.y,S2.b.y)
    || max(S2.a.x,S2.b.x)+EPS<min(S1.a.x,S1.b.x)
    || max(S2.a.y,S2.b.y)+EPS<min(S1.a.y,S1.b.y)) return false;
    return ccw(S1.a,S1.b,S2.a)*ccw(S1.a,S1.b,S2.b)<=0
        && ccw(S2.a,S2.b,S1.a)*ccw(S2.a,S2.b,S1.b)<=0;
}
 
template<class T>
T dist2(const point<T> &a,const point<T> &b){
    return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
 
template<class T>
double dist2(const segment<T> &S,const point<T> &p){
    if(dot(S.b-S.a,p-S.a)<=0) return dist2(p,S.a);
    if(dot(S.a-S.b,p-S.b)<=0) return dist2(p,S.b);
    return (double)cross(S.b-S.a,p-S.a)*cross(S.b-S.a,p-S.a)/dist2(S.a,S.b);
}
 
template<class T>
double dist(const segment<T> &S1,const segment<T> &S2){
    if(intersect(S1,S2)) return 0;
    return sqrt(min(min(dist2(S1,S2.a),dist2(S1,S2.b)),
                    min(dist2(S2,S1.a),dist2(S2,S1.b))));
}
 
int main(){
    for(int n,m,l;scanf("%d%d%d",&n,&m,&l),n||m||l;){
        m--;
        l--;
 
        star S[100];
        rep(i,n){
            scanf("%lf%lf%lf%lf",&S[i].c.x,&S[i].c.y,&S[i].a,&S[i].r);
        }
 
        rep(i,n){
            S[i].p[0].x = 0, S[i].p[0].y = S[i].r;
            S[i].p[0]=rot(S[i].p[0],S[i].a/180*PI);
            for(int j=1;j<5;j++){
                S[i].p[j]=rot(S[i].p[j-1],2*PI/5);
            }
            rep(j,5) S[i].p[j]=S[i].p[j]+S[i].c;
        }
 
        int f1[]={0,2,4,1,3,0};
 
        double d[100][100];
        rep(i,n){
			rep(j,n) {
            d[i][j]=INF;
            rep(a,5) rep(b,5){
				segment<double> s = {S[i].p[f1[a]],S[i].p[f1[a+1]]};
				segment<double> t = {S[j].p[f1[b]],S[j].p[f1[b+1]]};
				d[i][j]=min(d[i][j],dist(s,t));
			}
			}
        }
 
        rep(k,n) rep(i,n) rep(j,n) d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
 
        printf("%.15f\n",d[m][l]);
    }
 
    return 0;
}

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

using namespace std;

int main(int argc, const char *argv[])
{
    string a, b;
    cin >> a >> b;

    int x, y;
    x = stoi(a);
    y = stoi(b);

    string s, t;
    for (int i = 0; i < y; i++)
    {
        s += a;
    }

    for (int i = 0; i < x; i++)
    {
        t += b;
    }

    if (s <= t)
    {
        cout << s << endl;
    }
    else
    {
        cout << t << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <cctype>
#include <stdio.h>
#include <stdlib.h>
#include <map>

#define p(s) puts("s")

using namespace std;
//from は残りのチーズ数
int bfs(int from);
//訪れたら1
typedef pair<int, int> P;
char atlas[1000][1000] = {0};

int h, w, n;
//int start_i , start_j;
int dj[] = {0,1,0,-1 };
int di[] = {-1,0,1,0 };

int main(int argc, char const* argv[])
{
    //行数 一行の長さ 工場の数
    cin >> h >> w >> n;
    //atlas配列初期化&start位置取得
    for (int i = 0; i < h; i++) 
    {
        for (int j = 0; j < w; j++) 
        {
            cin >> atlas[i][j];
        }
    }

    int sum = 0;
    for(int i=0; i<n; i++)
    {
        //cout << "--------------------------------------------------" << endl;
        //cout << "call bfs(" << i << ")" << endl;
        sum += bfs(i);
        //cout << "bfs(" << i << ")  = " << bfs(i) << endl;
    }
    cout << sum << endl;
    return 0;
}



//チーズsからs+1までの最短経路を返す関数
int bfs(int s)
{
    //cout << "enter bfs(" << s << ")"  << endl;

    //スタートを取得
    P start;
    for(int i=0; i<h; i++)
    {
        for(int j=0; j < w; j++)
        {
            // s==0  0=>S
            if (s == 0 && atlas[i][j] == 'S' )          { start = P(i,j);} //cout<< "start = "<<  i << ", " <<j <<endl; }
            else if (s != 0 && atlas[i][j] == '0' + s)  { start = P(i,j);} //cout<< "start = "<<  i << ", " <<j <<endl; }
        }
    }

    //is_visit初期化
    int is_visit[1000][1000] = {0};
    queue<P> q;
    //map初期化
    map<P, int> dis;

    //一つ入れる
    q.push(start);
    dis[start] = 0;

    while( q.size() )
    {
        //一つ取り出す
        P now = q.front(); q.pop();

        //終了判定
        if(atlas[now.first][now.second] == '0'+s+1)  {
            //cout << "end of bfs(" << s << ")" << "now = (" << now.first <<" ,"<<now.second <<")"<< endl; 
            return dis[now];
        }

        //分岐
        for(int i=0; i < 4; i++) {
            P next = P(now.first + di[i], now.second + dj[i]);
            // 訪れてないか　枠の中か 障害物は無いか
            if( -1 < next.first && next.first < h && 
                -1 < next.second && next.second < w && 
                dis.find(next) == dis.end() &&
                atlas[next.first][next.second] != 'X'
                )
            {
                q.push(next);
                dis[next] = dis[now] + 1;
            }
        }
    }
}

Measured memory_bytes: 30104
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n)  { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x)         { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};

int main() {
	ll n, a, b;
	cin >> n >> a >> b;
	vector<ll> town(n);
	REP(i, n)
		cin >> town[i];
	ll ans = 0;
	REP(i, n - 1) {
		ans += min((town[i + 1] - town[i])*a, b);
	}
	cout << ans << endl;
}

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


int main() {
    int X, Y;
    cin >> X >> Y;
    bool t = false;
    for (int i = 0; i <= X; i++) {
        if (i*2 + (X-i)*4 == Y) t = true;
    }
    if (t == true) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

const int MLEN = 100009;

int main() {
    #ifdef DEBUG
    std::ifstream in("/home/share/inputf.in");
    std::cin.rdbuf(in.rdbuf());
    #endif
    int N;
    cin >> N;
    vector<pair<int,int>> x(MLEN), y(MLEN);
    for(int i = 0; i < MLEN; i++) {
        x[i] = y[i] = make_pair(0,i);
    }
    for(int i = 0; i < N; i++) {
        int tmp;
        cin >> tmp;
        if(i % 2) {
            x[tmp].first++;
        } else {
            y[tmp].first++;
        }
    }
    sort(x.rbegin(), x.rend());
    sort(y.rbegin(), y.rend());
    auto X = x[0], Y = y[0];
    if(X.second == Y.second) {
        auto altX = x[1], altY = y[1];
        if(altX.first > altY.first) {
            X = altX;
        } else {
            Y = altY;
        }
    }
    int ans = N - X.first - Y.first;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define FORD(x,y,z) for(int x=y;x>=z;x--)
#define MSET(x,y) memset(x,y,sizeof(x))
#define FOR(x,y) for(__typeof(y.begin()) x=y.begin();x!=y.end();x++)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define H 2005
#define W 2005
void RI(){}
template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d",&head);
    RI(tail...);
}
using namespace std;
typedef long long LL;

char grid[H][W];
int gleft[H][W], gright[H][W], gup[H][W], gdown[H][W];

int main()
{
	memset(gleft, 0, sizeof(gleft) );
	memset(gright, 0, sizeof(gright) );
	memset(gup, 0, sizeof(gup) );
	memset(gdown, 0, sizeof(gdown) );

	int m, n;
	cin >> m >> n;
	for(int i = 0; i < m; i++) cin >> grid[i];
	for(int i = 0; i < m; i++) for(int j = 0; j < n; j++) { //gleft,gup
		if(grid[i][j] != '#' && j-1 >= 0 && grid[i][j-1] != '#')
			gleft[i][j] = gleft[i][j-1] + 1;
		if(grid[i][j] != '#' && i-1 >= 0 && grid[i-1][j] != '#')
			gup[i][j] = gup[i-1][j] + 1;
	}
	for(int i = m-1; i >= 0; i--) for(int j = n-1; j >= 0; j--) { //gright, gdown
		if(grid[i][j] != '#' && j+1 < n && grid[i][j+1] != '#')
			gright[i][j] = gright[i][j+1] + 1;
		if(grid[i][j] != '#' && i+1 < m && grid[i+1][j] != '#')
			gdown[i][j] = gdown[i+1][j] + 1;
	}
	int ans = 0;
	for(int i = 0; i < m; i++) for(int j = 0; j < n; j++) {
		ans = max(ans, gleft[i][j] + gright[i][j] + gup[i][j] + gdown[i][j] + 1 );
	}
	cout << ans << endl;
	return 0;
}



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

int main(){
  int N,M;
  cin >> N >> M;
  vector<pair<int,int>> s(N);
  vector<pair<int,int>> cp(M);
  rep(i,N){
    cin >> s.at(i).first >> s.at(i).second;
  }
  rep(i,M){
    cin >> cp.at(i).first >> cp.at(i).second;
  }
  int num;
  rep(i,N){
    int x1 = s.at(i).first, y1 = s.at(i).second;
    int dis = 1e9+7;
    rep(j,M){
      int x2 = cp.at(j).first, y2 = cp.at(j).second;
      if(dis>abs(x1-x2)+abs(y1-y2)){
        num = j+1;
        dis = abs(x1-x2)+abs(y1-y2);
      }
    }
    cout << num << endl;
  }
}


Measured memory_bytes: 256
n,m = map(int,input().split())
sc = [[i for i in map(int,input().split())] for j in range(m)]
start = 0
goal = 0
if n==1:
  start = 0
  goal = 9
elif n==2:
  start = 10
  goal = 99
elif n==3:
  start = 100
  goal = 999
  
flag = 1
ans = -1
for num in range(start,goal+1):
  flag = 1
  for i in range(m):
    if str(num)[sc[i][0]-1] != str(sc[i][1]):
      flag = 0
  if flag == 1:
    ans = num
    break
    
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
int main() {
  int N, D, ans, sum;
  scanf("%d%d", &N, &D);
  sum = 2 * D + 1;
  ans = 0;
  for(;;){
    N -= sum;
    ans++;
    if(N <= 0){
      break;
    }
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int cnt[100005] = {};
signed main() {
    int A,B,C;
    cin >> A >> B >> C;
    int X = max({A,B,C})*3-(A+B+C);
    if(X%2 == 0) {
        cout << X/2 << endl;
    }
    else {
        cout << X/2+2 << endl;
    }
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = signed long long int;
using P = pair<int, int>;
int main (void) {
    int a;
    cin >> a;
    cout << (a + a * a + a * a * a) << endl;

}


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

typedef long long ll;
#define PB push_back

ll maxrs = 400000000;
set<ll> s;

void btrk(ll x) {
	if (s.find(x) != s.end()) return;
	s.insert(x);
	if (x > maxrs) return;
	if (x == 0) {
		for (int i = 1; i <= 9; ++i) {
			btrk(i);
		}
	} else {
		int lst = x % 10;
		if (lst > 0) btrk(x * 10 + (lst - 1));
		btrk(x * 10 + lst);
		if (lst < 9) btrk(x * 10 + (lst + 1));
	}
}


int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	int k; cin >> k;
	btrk(0);
	while (k) {
		s.erase(s.begin());
		--k;
	}
	cout << *s.begin();
}

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

int main() {
  int a , b ;
  cin >> a >> b;
  
 int i = 0;
  
  if(a - b == 0){
    while(i < a){
      cout << a ;
      i++;
    }
  }
  
  else if(a < b){
    while(i < b){
      cout << a ;
      i++;
    }
  }
  
  else if(b < a){
    while(i < a){
      cout << b ;
      i++;
    }
  }
      cout << endl;
}

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

main () {
    std::string s;
    std::cin >> s;
    for (int i = 0; i < 3; i++) {
        if (s[i] == '1') s[i] = '9';
        else s[i] = '1';
    }
    std::cout << s << std::endl;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
#define SORT(x) sort(x.begin(),x.end(),greater<ll>())
#define ALL(x) x.begin(),x.end()
#define deb(x) cout<<#x<<"="<<x<<endl
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;


void Main(){

  int n,m;

  cin>>n>>m;

  int ans[n]={};

  rep(i,m){
    int a,b;
    cin>>a>>b;
    ++ans[a-1];
    ++ans[b-1];
  }

  rep(i,n){
    cout<< ans[i]<<"\n";
  }

}
//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


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

struct RURM {
	using t1 = int;
	using t2 = int;
	static t1 id1() { return INT_MAX; }
	static t2 id2() { return -1; }
	static t1 op1(const t1& l, const t1& r) { return min(l, r); }
	static t1 op2(const t1& l, const t2& r) { return r != id2() ? r : l; }
	static t2 op3(const t2& l, const t2& r) { return r != id2() ? r : l; }
};

template <typename M>
class node {
	using T1 = typename M::t1;
	using T2 = typename M::t2;
public:
	T1 val;
	T2 lazy;
	node<M> *l, *r;
	node() {}
	void init(T1 val_, T2 lazy_, node<M>* l_ = nullptr, node<M>* r_ = nullptr) {
		val = val_;
		lazy = lazy_;
		l = l_;
		r = r_;
	}
};

template <typename M>
class SaikyoSegmentTree {
	using T1 = typename M::t1;
	using T2 = typename M::t2;
	const ll n;
	vector<node<M>*> root;
	vector<node<M>> pool;
	int it;
	ll size(ll n) {
		ll res = 1;
		while (res < n) res <<= 1;
		return res;
	}
	node<M> *new_node() {
		pool[it].init(M::id1(), M::id2());
		return &pool[it++];
	}
	node<M> *fix(node<M> *t) {
		pool[it] = *t;
		return &pool[it++];
	}
	node<M> *push(node<M> *t, ll lb, ll ub) {
		t = fix(t);
		if (lb + 1 < ub) {
			if (t->l == nullptr) t->l = new_node();
			else t->l = fix(t->l);
			if (t->r == nullptr) t->r = new_node();
			else t->r = fix(t->r);
			t->l->lazy = M::op3(t->l->lazy, t->lazy);
			t->r->lazy = M::op3(t->r->lazy, t->lazy);
		}
		t->val = M::op2(t->val, t->lazy);
		t->lazy = M::id2();
		return t;
	}
	node<M> *suc(ll l, ll r, node<M> *t, ll lb, ll ub, T2 val) {
		if (ub <= l || r <= lb) return t;
		if (t == nullptr) t = new_node();
		if (l <= lb && ub <= r) {
			t->lazy = M::op3(t->lazy, val);
			return t;
		}
		t = push(t, lb, ub);
		t->l = suc(l, r, t->l, lb, (lb + ub) / 2, val);
		t->r = suc(l, r, t->r, (lb + ub) / 2, ub, val);
		t->val = M::op1(t->l == nullptr ? M::id1() : M::op2(t->l->val, t->l->lazy), t->r == nullptr ? M::id1() : M::op2(t->r->val, t->r->lazy));
		return t;
	}
	node<M> *sub(ll l, ll r, node<M> *t, ll lb, ll ub, T1& res) {
		if (t == nullptr || ub <= l || r <= lb) return t;
		if (l <= lb && ub <= r) {
			res = M::op1(res, M::op2(t->val, t->lazy));
			return t;
		}
		t = push(t, lb, ub);
		t->l = sub(l, r, t->l, lb, (lb + ub) / 2, res);
		t->r = sub(l, r, t->r, (lb + ub) / 2, ub, res);
		return t;
	}
public:
	SaikyoSegmentTree(ll n_, int PMAX = 2e7)
		: n(size(n_)), root(1, nullptr), pool(PMAX), it(0) {}
	void update(ll l, ll r, T2 val, int rt = -1) {
		if (rt == -1) rt = root.size() - 1;
		assert(0 <= rt && rt < (int)root.size());
		root.push_back(suc(l, r + 1, root[rt], 0, n, val));
	}
	T1 find(ll l, ll r, int rt = -1) {
		if (rt == -1) rt = root.size() - 1;
		assert(0 <= rt && rt < (int)root.size());
		T1 res = M::id1();
		root.push_back(sub(l, r + 1, root[rt], 0, n, res));
		return res;
	}
	int getversion() {
		return root.size() - 1;
	}
};

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int n, q, com, x, y, val;
	cin >> n >> q;
	SaikyoSegmentTree<RURM> st(n);
	while (q--) {
		cin >> com >> x >> y;
		if (com) {
			printf("%d\n", st.find(x, y));
		}
		else {
			cin >> val;
			st.update(x, y, val);
		}
	}
	return 0;
}

Measured memory_bytes: 220684
H,W=map(int,input().strip().split(" "))

l="#"*(W+2)

a=''
b=[]

for i in range(H):
    a="#"
    a+=input()
    a+="#"
    b.append(a)
print(l)
for i in range(H):
    print(b[i])
print(l)


Measured memory_bytes: 3060
import math   

def main():
    #0.input
    X = int(input())
    
    #exception
    if X<4:
        print(1)
    
    #other.
    else:
        #1. list up numbers lt sqrt
        nums = [i for i in range(2, int(math.sqrt(X)+1))]
        
        #2. list up power nums
        candidates=[]
        for n in nums:
            cand = n
            while cand*n <= X:
                cand *= n
            candidates.append(cand)
        
        #3.output
        print(max(candidates))


if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
template <class T = ll>
T IN(){T x;cin>>x;return (x);}
 
template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
  VECCIN(head);
  VT2(move(tail)...);
}
 
template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
  seco[head]=IN();
  VT3(head,move(tail)...);
}
 
#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc
 
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision; // cpp_int
 
#define P pair<ll,ll>
#define V vector<ll>
#define M map<ll,ll>
#define S set<ll>
 
#define pb(a) push_back(a)
#define mp make_pair

int main(){

  COUT("ABC"+to_string(IN<int>()));

  return 0;
}

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

int main()
{
    char Command[8];
    int Value;

    std::priority_queue<int> S;
    while(1){
        std::scanf("%s", Command);
        if(Command[0] == 'i'){
            std::scanf("%d", &Value);
            S.push(Value);
        }else
        if(Command[1] == 'x'){
            std::printf("%d\n", S.top());
            S.pop();
        }else{
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 6512
#include <iostream>
#include <utility>
#include <vector>
#include <string>
using namespace std;

int main(void){
	string s[8];
	while(cin>>s[0]){
		std::vector<pair<int,int> > v;
		for(int i=1;i<8;i++)cin>>s[i];
		for(int i=0;i<8;i++){
			for(int j=0;j<8;j++){
				if(s[i][j]=='1')v.push_back(make_pair(i,j));
			}
		}
		// second=x,first=y
		if(v[0].first==v[1].first&&v[0].second==v[2].second)cout<<"A"<<endl;
		else if(v[0].second==v[1].second&&v[2].second==v[1].second&&v[2].second==v[3].second)cout<<"B"<<endl;
		else if(v[2].first==v[0].first)cout<<"C"<<endl;
		else if(make_pair(v[0].first+2,v[0].second-1)==v[3])cout<<"D"<<endl;
		else if(make_pair(v[0].first+1,v[0].second+2)==v[3])cout<<"E"<<endl;
		else if(make_pair(v[0].first+2,v[0].second+1)==v[3])cout<<"F"<<endl;
		else cout<<"G"<<endl;
		// cin>>s[0]; // CRLF
	}
}

Measured memory_bytes: 3132