akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>

int map[3000][3000];
int kyori[3000];
int douro[100000][3];

int main(void) {
	int smalls[3000];
	int visited[3000];
	int tyousataisyounum;
	int matinum;
	int douronum;
	int smallnum;
	int dourolen;
	int i;
	int from,to;
	int smallpos;
	int mincost,mincostto;
	int maxkyori;
	int nowkyori;
	int maekyori;
	scanf("%d %d %d",&matinum,&douronum,&smallnum);
	for(i=0;i<douronum;i++) {
		scanf("%d %d %d",&from,&to,&dourolen);
		douro[i][0]=from-1;
		douro[i][1]=to-1;
		douro[i][2]=dourolen;
		map[from-1][to-1]=dourolen;
		map[to-1][from-1]=dourolen;
	}
	for(i=0;i<smallnum;i++)scanf("%d",&smalls[i]);
	for(i=0;i<matinum;i++)kyori[i]=0x7fffffff;
	memset(visited,0,sizeof(visited));
	for(i=0;i<smallnum;i++) {
		smallpos=smalls[i]-1;
		kyori[smallpos]=0;
		//visited[smallpos]=1;
	}
	tyousataisyounum=smallnum;
	while(1) {
		mincost=0x7fffffff;
		mincostto=-1;
		for(i=0;i<matinum;i++) {
			if(!visited[i]) {
				if(kyori[i]<mincost) {
					mincost=kyori[i];
					mincostto=i;
				}
			}
		}
		if(mincostto>=0) {
			visited[mincostto]=1;
			for(i=0;i<matinum;i++) {
				if(map[i][mincostto]>0) {
					if(kyori[i]>kyori[mincostto]+map[i][mincostto]) {
						kyori[i]=kyori[mincostto]+map[i][mincostto];
					}
				}
			}
		} else break;
	}
	maxkyori=0;
	for(i=0;i<douronum;i++) {
		nowkyori=kyori[douro[i][0]];
		if(nowkyori<kyori[douro[i][1]]) {
			maekyori=nowkyori;
			nowkyori=kyori[douro[i][1]];
		} else maekyori=kyori[douro[i][1]];
		if(maekyori+douro[i][2]>nowkyori) {
			nowkyori=((douro[i][2]+nowkyori-maekyori)*5+5)/10;
			nowkyori+=maekyori;
		}
		if(maxkyori<nowkyori)maxkyori=nowkyori;
	}
	printf("%d\n",maxkyori);
	return 0;
}

Measured memory_bytes: 35000
#include<bits/stdc++.h>
#define hell                         1000000007 
#define M                            1000000007
#define Maxi                      10000000000000000
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                           long long
 
#define vll                          vector<ll>
#define vi                           vector<long long>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
//#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define lbnd                         lower_bound
#define ubnd                         upper_bound
#define bs                           binary_search
#define F                            first  
#define S                            second
#define rep(i,a,b)                   for(i=a;i<b;i++)
#define parr(a,n)                    for(i=0;i<n;i++) cout<<a[i]<<" ";cout<<endl;
#define pcont(a)                     for(auto i:a) cout<<i<<" ";cout<<endl;
#define ret(x)                       return cout<<x,0;
#define dbg(x)                       cout << #x << " is " << x << endl;
#define endl                           '\n'
 
 
// Debug //
 
#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
using namespace std;


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

Measured memory_bytes: 3680
#pragma GCC optimize("Ofast", "unroll-loops", "no-stack-protector")
#include <bits/stdc++.h>
#define pb push_back
#define MP make_pair
#define F first
#define S second
#define mem(x, y) memset((x), (y), sizeof(x))
#define loli ios::sync_with_stdio(0), cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename Ta, typename Tb>istream &operator>>(istream &in, pair<Ta, Tb> &p){ return in >> p.F >> p.S; }
template<typename Ta, typename Tb>ostream &operator<<(ostream &out, pair<Ta, Tb> &p){ return out << p.F << " " << p.S; }
template<typename T>void arr_print(T a, T b){ T i = a; for(cout << *i++; i != b; i++) cout << " " << *i; cout << "\n"; }
template<typename T>ostream &print(T a){ return cout << a << "\n"; }
template<typename T, typename... Args>ostream &print(T a, Args ...args){ cout << a << " "; return print(args...); }

//--------------------Main Code--------------------

int main() {loli
	ll n, a[200000], ans = 0;
	cin >> n;
	for(int i = 0; i < n; i++)
		cin >> a[i];
	sort(a, a + n, greater<ll>());
	for(int i = 1; i < n; i++)
		ans += a[i / 2];
	cout << ans << "\n";
}

Measured memory_bytes: 5220
#include <stdio.h>

int main(){

  int n,i,ans;
  scanf("%d",&n);
  ans=n;
  char s[n+10];
  scanf("%s",s);

  for(i=0;s[i+1]!='\0';i++){
    if(s[i]==s[i+1])  ans--;
  }
  

  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc167/tasks/abc167_d

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline ll len(V<T> arr) {
  return arr.size();
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}

const ll INF = 1e18;

void solve();

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

void solve() {
  ll N, K;
  cin >> N >> K;

  VL as(N);
  rep(i, N) cin >> as[i];
  rep(i, N) as[i]--;

  ll loop_i = -1;
  ll loop_length = -1;

  {
    VL visited_step(N, -1);
    ll cur = 0;

    rep(step, N + 1) {
      if (visited_step[cur] == -1) {
        visited_step[cur] = step;
        cur = as[cur];
        continue;
      }

      loop_i = cur;
      loop_length = step - visited_step[cur];
      break;
    }
  }

  ll cur = 0;
  ll rest = K;

  while (rest > 0) {
    if (cur != loop_i) {
      cur = as[cur];
      --rest;
      continue;
    }

    rest %= loop_length;
    if (rest == 0) break;

    cur = as[cur];
    --rest;

    continue;
  }

  cout << cur + 1 << "\n";
}


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

using namespace std;

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

    int n, m;
    cin >> n >> m;
    int h[n], ans = 0;
    vector<int> adj[n];

    for (int i = 0; i < n; i++)
        cin >> h[i];

    while (m--) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }

    for (int i = 0; i < n; i++) {
        bool ok = true;
        for (int x : adj[i])
            if (h[x] >= h[i])
                ok = false;
        ans += ok;
    }
    cout << ans << '\n';

    return 0;
}

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

/*
#define mygc(c) (c)=getchar_unlocked()
#define mypc(c) putchar_unlocked(c)
void reader(int *x){int k,m=0;*x=0;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){*x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||k>'9')break;*x=(*x)*10+k-'0';}if(m)(*x)=-(*x);}
template <class T, class S> void reader(T *x, S *y){reader(x);reader(y);}
void writer(int x, char c){int s=0,m=0;char f[10];if(x<0)m=1,x=-x;while(x)f[s++]=x%10,x/=10;if(!s)f[s++]=0;if(m)mypc('-');while(s--)mypc(f[s]+'0');mypc(c);}
template<class T> void writerLn(T x){writer(x,'\n');}
*/

#define incID(i, l, r) for(int i = (l); i < (r); i++)
#define inc(i, n) incID(i, 0, n)
template<typename T> bool setmin(T &a, T b) { if(a <= b) { return false; } else { a = b; return true; } }
template<typename T> bool setmax(T &a, T b) { if(b <= a) { return false; } else { a = b; return true; } }


// ---- ----

int n, k;
vector<int> vec[100000];
bool has[100000];
int mi[100000];
int ma[100000];

void prod(int x, int y) {
	if(has[y]) {
		bool flag = true;
		if(has[x] && (mi[x] - mi[y]) % 2 == 0) { flag = false; }
		setmax(mi[x], mi[y] - 1);
		setmin(ma[x], ma[y] + 1);
		has[x] = true;
		if(mi[x] > ma[x]) { flag = false; }
		if(! flag) {
			cout << "No\n";
			exit(0);
		}
	}
}

bool dfs(int node, int pre) {
	if(pre != -1) { prod(node, pre); }
	for(auto && e : vec[node]) {
		if(e != pre) {
			dfs(e, node);
			prod(node, e);
		}
	}
}

int main() {
	// cin.tie(0);
	// ios::sync_with_stdio(false);
	
	cin >> n;
	inc(i, n - 1) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		vec[a].push_back(b);
		vec[b].push_back(a);
	}
	fill(mi, mi + n, -1000000);
	fill(ma, ma + n,  2000000);
	cin >> k;
	inc(j, k) {
		int v, p;
		cin >> v >> p;
		v--;
		mi[v] = p;
		ma[v] = p;
		has[v] = true;
	}
	
	dfs(0, -1);
	dfs(0, -1);
	
	cout << "Yes\n";
	inc(i, n) { cout << mi[i] << "\n"; }
	
	return 0;
}


Measured memory_bytes: 11904
class InputLine
  def self.to_s
    gets.chomp
  end

  def self.to_i
    InputLine.to_s.to_i
  end
  
  def self.to_f
    InputLine.to_s.to_f
  end

  def self.to_sa
    InputLine.to_s.split(' ')
  end

  def self.to_ia
    InputLine.to_sa.map(&:to_i)
  end
  
  def self.to_fa
    InputLine.to_sa.map(&:to_f)
  end
end

def main(argv)
  n = InputLine.to_i
  m = ((n / 1000) + (n % 1000 == 0 ? 0 : 1)) * 1000
  puts (m - n).to_s
end

if self.to_s == 'main' then
  main(ARGV)
end

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

#define REP(i, a) for(int64 i = 0; i < (a);i++)
#define FOR(i, a, b) for(int64 i = (a); i < (b); i++)
#define INF (int64)1e9
#define INF_LL (int64)1e18
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int32_t;
using int64 = int64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

template<typename A, typename B> inline void chmin(A &a, B b) { if (a > b) a = b;}
template<typename A, typename B> inline void chmax(A &a, B b) { if (a > b) a = b;}

template<typename CommutativeMonoid>
class FenwickTree{
public:
  using value_structure = CommutativeMonoid;
  using value_type = typename CommutativeMonoid::value_type;
  using size_type = ::std::size_t;

private:
  ::std::vector<value_type> tree;
  size_type N;

  static value_type calc(const value_type& a, const value_type& b){
    return value_structure::operation(a, b);
  }

public:
  FenwickTree(){}
  FenwickTree(const size_type& N):N(N+10), tree(N+11, value_structure::identity()){}
  FenwickTree(const FenwickTree& bit):tree(bit.tree), N(bit.N){}

  void update(size_type k, const value_type& diff){ // update k in [1, N]
    for(;k <= N;k += k & -k){
      tree[k] = calc(tree[k], diff);
    }
  }

  value_type query(size_type k) const { // sum of [1, k]
    value_type res = value_structure::identity();
    for(;k > 0;k -= k & -k){
      res = calc(res, tree[k]);
    }
    return res;
  }

  void updatez(size_type k, value_type v){ // 0-indexed
    update(k+1, v);
  }

  value_type queryz(size_type k) const { // [0, k)
    return query(k);
  }

  size_type search(const std::function<bool(value_type)>& f) const { // Find k :[0, k) -> True, [0, k-1) -> False
    if(f(value_structure::identity()))
      return 0;
    if(!f(query(N)))
      return N+1;
    value_type x = value_structure::identity();
    size_type k = 1, idx = 0;
    while(k <= N) k <<= 1;
    k >>= 1;
    for(;k > 0;k >>= 1){
      if((idx|k) <= N && !f(tree[idx|k]+x))
        x = calc(x, tree[idx |= x]);
    }
    return idx+1;
  }

  size_type size() const {return N;}
};

class v_monoid {
public:
  using value_type = int64;
  static const value_type identity() { return 0; }
  static const value_type operation(const value_type& a, const value_type& b) {
    return a + b;
  }
};

int main(void) {
  int64 N, K;
  cin >> N >> K;
  vector<int64> a(N), za(N);
  REP(i, N) {
    cin >> a[i]; a[i] -= K;
    if (i) a[i] += a[i-1];
    za[i] = a[i];
  }
  sort(all(za)); za.erase(unique(all(za)), za.end());
  REP(i, N) a[i] = lower_bound(all(za), a[i]) - za.begin();
  FenwickTree<v_monoid> bit(N);
  int64 res = 0;
  REP(i, N) {
    res += bit.queryz(a[i]+1);
    if (za[a[i]] >= 0) res++;
    bit.updatez(a[i], 1);
  }
  cout << res << endl;
}




Measured memory_bytes: 5184
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7;

signed main()
{
	IO_OP;
	
	int n;
	cin >> n;
	map<pi, int> mp;
	ll ans = 0;
	for(int i = 0; i < n; i++) {
		long double x;
		cin >> x;
		ll y = x * 1e9 + 0.5;
		int a = 0, b = 0;
		while(y % 2 == 0) a++, y /= 2;
		while(y % 5 == 0) b++, y /= 5;
		for(auto p:mp) {
			if(p.F.F+a >= 18 && p.F.S+b >= 18) ans += p.S;
		}
		mp[{a, b}]++;
	}
	cout << ans << endl;
	
}





Measured memory_bytes: 3792
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <list>
#include <cmath>
#include <stack>
#include <deque>
#include <iomanip>

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

const ll INF = 1LL<<60;
const ll MOD = 1000000007;

//cout << fixed << setprecision(10);

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

    vector<ll> H(N);
    ll ans = 0;
    for(int i=0;i<N;i++){
        cin  >> H[i];
        if(H[i]>=K) ans++;
    }

    cout << ans << endl;



    return 0;
}

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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 62;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  ll a, b, c; cin >> a >> b >> c;
  ll ans = INF64;
  if(a%2==1) chmin(ans, b*c);
  else chmin(ans, 0ll);

  if(b%2==1) chmin(ans, a*c);
  else chmin(ans, 0ll);

  if(c%2==1) chmin(ans, a*b);
  else chmin(ans, 0ll);

  cout << ans << endl;
}

Measured memory_bytes: 3620
package main

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

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

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

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

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

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func maxFloat64(a, b float64) float64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

func str2Int(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

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

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

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	if x == 2 {
		return true
	}
	if x%2 == 0 {
		return false
	}

	b := true
	rootx := int(math.Sqrt(float64(x)))
	i := 3
	for i <= rootx {
		if x%i == 0 {
			b = false
			break
		}
		i += 2
	}
	return b
}

func PrimeFactors(n int) (pfs []int) {
	// Get the number of 2s that divide n
	for n%2 == 0 {
		pfs = append(pfs, 2)
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			pfs = append(pfs, i)
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs = append(pfs, n)
	}

	return
}

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

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

var H, W int

func main() {
	sc.Split(bufio.ScanWords)

	H, W = nextInt(), nextInt()
	S := make([]string, H)
	for i := 0; i < H; i++ {
		S[i] = nextStr()
	}

	//fmt.Println(S)
	buf := bufio.NewWriter(os.Stdout)
	hash := ""
	for j := 0; j < W+2; j++ {
		hash += "#"
	}
	for i := 0; i < H+2; i++ {
		if i%(H+1) == 0 {
			buf.Write([]byte(fmt.Sprintf("%s\n", hash)))
		} else {
			buf.Write([]byte(fmt.Sprintf("#")))
			buf.Write([]byte(fmt.Sprintf("%s", string(S[i-1]))))
			buf.Write([]byte(fmt.Sprintf("#\n")))
		}
	}
	buf.Flush()
}


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

#define rp(i,n) for(int i=0;i<n;i++)
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define llrp(i,n) for(long long i=0;i<n;i++)
#define llrep(i,m,n) for(long long i=m;i<=n;i++)
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define pb push_back
#define elif else if
#define vcin(a); rp(i,a.size()){cin>>a[i];}
#define vcout(a); rp(i,a.size()){cout<<a[i]<<endl;}
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef string S;
typedef pair<int,int> P;

bool isOK(int index, int key,vi a) {
    if (a[index] >= key) return true;
    else return false;
}

int binary_search(int key,vi a) {
    int left = -1;
    int right = (int)a.size();
    while (right - left > 1) {
        int mid = left + (right - left) / 2;
        
        if (isOK(mid, key,a)) right = mid;
        else left = mid;
    }
    return right;
}

int modpow(int a,int b,int p){
    if(b==0){
        return 1;
    }elif(b%2==0){
        return modpow((a*a)%p,b/2,p);
    }else{
        return (a*modpow(a,b-1,p))%p;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vll a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(a);
    if((a[0]*a[1]*a[2])%2){
        cout << a[0]*a[1] << endl;
    }else{
        cout << 0 << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
H, W, D = map(int, input().split())

#盤面を取得
lst = [0] * (H * W + 1)
for i in range(1, H + 1):
    tmp = list(map(int, input().split()))
    for j in range(1, W + 1):
        lst[tmp[j - 1]] = [i, j]
#前処理

#xからyに移動するのにかかるコストを返す関数
def cost(x, y): 
    return abs(lst[x][0] - lst[y][0]) + abs(lst[x][1] - lst[y][1])

check_lst = [False] * (H * W + 1)
cost_lst = [0] * (H * W + 1)
for i in range(1, H * W + 1):
    if check_lst[i]:
        continue
    check_lst[i]  = True
    tmp = i
    while tmp + D <= H * W:
        cost_lst[tmp + D] = cost_lst[tmp] + cost(tmp, tmp + D)
        check_lst[tmp + D] = True
        tmp += D

#出力
Q = int(input())
for _ in range(Q):
    L, R = map(int, input().split())
    print (cost_lst[R] - cost_lst[L])


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

int hw[450][450];
int m[210], d[210];

int main() {
	int n;

	while (1) {
		cin >> n;
		if (!n) break;

		for (int i = 0; i <= 420; i++) {
			for (int j = 0; j <= 420; j++) {
				hw[i][j] = -1;
			}
		}

		hw[201][201] = 0;
		for (int i = 1; i < n; i++) {
			cin >> m[i] >> d[i];

			for (int j = 1; j <= 410; j++) {
				for (int k = 1; k <= 410; k++) {
					if (hw[j][k] == m[i]) {
						if (d[i] == 0) {
							hw[j][k - 1] = i;
						}
						if (d[i] == 1) {
							hw[j + 1][k] = i;
						}
						if (d[i] == 2) {
							hw[j][k + 1] = i;
						}
						if (d[i] == 3) {
							hw[j - 1][k] = i;
						}
					}
				}
			}
		}

		/*for (int i = 195; i <= 205; i++) {
			for (int j = 195; j <= 205; j++) {
				cout << hw[i][j];
			}
			cout << endl;
		}


		break;

		for (int i = 1; i <= 400; i++) {
			cout << hw[i][0] << endl;
		}*/


		int ansminw = 1000;
		for (int j = 1; j <= 410; j++) {
			for (int k = 1; k <= 410; k++) {
				if (hw[j][k] >=0) {
					ansminw = min(ansminw, k);
					break;
				}
			}
		}

		int ansmaxw = 0;
		for (int j = 1; j <= 410; j++) {
			for (int k = 410; k > 0; k--) {
				if (hw[j][k] >=0) {
					ansmaxw = max(ansmaxw, k);
					break;
				}
			}
		}

		int ansminh = 1000;
		for (int j = 1; j <= 410; j++) {
			for (int k = 1; k <= 410; k++) {
				if (hw[k][j] >=0) {
					ansminh = min(ansminh, k);
					break;
				}
			}
		}

		int ansmaxh = 0;
		for (int j = 1; j <= 410; j++) {
			for (int k = 410; k > 0; k--) {
				if (hw[k][j] >=0) {
					ansmaxh = max(ansmaxh, k);
					break;
				}
			}
		}

		/*cout << ansminw << endl;
		cout << ansmaxw << endl;
		cout << ansminh << endl;
		cout << ansmaxh << endl;*/
		cout << (ansmaxw - ansminw) + 1 << " " << (ansmaxh - ansminh) + 1 << endl;
	}
}


Measured memory_bytes: 3820
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma warning(disable:4996)
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
#include <map>
#include <iomanip> 
#include <ctime>
#include <numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

const double PI = 3.14159265358979323846;
const int MAX = 1e7;
const int MOD = 1e9+7;

int main(int argc, char *args[]) {
	string s;
	cin >> s;
	int n = s.size();
	int cnt = 0;
	for (int i = 0; i < n / 2; i++) {
		if (s[i] != s[n - 1 - i])cnt++;
	}
	cout << cnt << endl;

}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

const int MOD = (int)1e9 + 7;
void sadd(int &a, int b){
    a += b;
    if(a >= MOD)a -= MOD;
    else if(a < 0)a += MOD;
}

int dp[70][3];

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

    cin >> N;
    vi d;
    while(N)d.push_back(N % 2), N /= 2;
    reverse(all(d));
    int D = sz(d);

    dp[0][0] = 1;

    rep(i, D)rep(j, 3) {
        rep(x, 3) {
            int nj = j << 1;
            nj += d[i] - x;
            smin(nj, 2);
            if(nj < 0)continue;
            sadd(dp[i + 1][nj], dp[i][j]);
        }
    }

    int ans = 0;
    rep(i, 3)sadd(ans, dp[D][i]);
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <iostream>

#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

#include <cassert>
#include <cmath>
#include <algorithm>
#include <cstdint>
#include <ctime>

#include <fstream>

#include <cassert>

/*
ADD_CUSTOM_COMMAND(TARGET trainings
        POST_BUILD
        COMMAND trainings
        WORKING_DIRECTORY /Users/Roman/ClionProjects/trainings)
 */

using namespace std;

#define M_PI 3.14159265358979323846264338327950288
using LL = long long;
const int INF = 1e9;

const long double kek = 1.0;
const float eps = 1e-9;
#define DB(x) cerr << #x << " " << x << endl;


//long double D = 100.0;

inline long double event_time(long double dist, long double sz1, long double sz2) {
    return ( dist  / (sz2 - sz1)  );
}

set < pair < long double, int > > ev;
vector < long double > idx_to_time;

void gen (int n) {
    srand(1791279);
    freopen("input.txt", "w", stdout);
    //cout  << n << endl;
    long long sumkek = 0;
    for (int i = 0; i < n; ++i) {
        int a = rand()  % 99 + 1;
        sumkek += a;
        cout << a << " " << rand() % 10000 << endl;
    }
    //cout << endl;
    //cout << sumkek << endl;
    exit(0);
}

int main()
{
    //gen(1001);
    //freopen("input.txt", "r", stdin);
    //cin.tie(nullptr);
    //ios_base::sync_with_stdio(false);
    cerr.setf(ios_base::fixed);
    string s;
    cin >> s;
    int n = s.length();
    vector < int > used(n, 0);
    for (int i = 0; i + 6 <= n; ++i) {
        if (s.substr(i, 6) == "eraser") {
            for (int j = i; j < i + 6; ++j) {
                used[j] = 1;
            }
        }
    }
    for (int i = 0; i + 5 <= n; ++i) {
        if (s.substr(i, 5) == "erase") {
            bool ok = true;
            for (int j = i; j < i + 5; ++j) {
                if(used[j]) {
                    ok = false;
                }
            }
            if (ok) {
                for (int j = i; j < i + 5; ++j) {
                    used[j] = 1;
                }
            }
        }
    }
    for (int i = 0; i + 7 <= n; ++i) {
        if (s.substr(i, 7) == "dreamer") {
            bool ok = true;
            for (int j = i; j < i + 7; ++j) {
                if(used[j]) {
                    ok = false;
                }
            }
            if (ok) {
                for (int j = i; j < i + 7; ++j) {
                    used[j] = 1;
                }
            }
        }
    }
    for (int i = 0; i + 5 <= n; ++i) {
        if (s.substr(i, 5) == "dream") {
            bool ok = true;
            for (int j = i; j < i + 5; ++j) {
                if(used[j]) {
                    ok = false;
                }
            }
            if (ok) {
                for (int j = i; j < i + 5; ++j) {
                    used[j] = 1;
                }
            }
        }
    }

    bool ok = true;
    for (auto p: used) {
        ok = ok && (p == 1);
    }
    if (ok)
    {
        cout << "YES";
    } else {
        cout << "NO";
    }
    return 0;
}






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

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
typedef pair<int, int> P;
typedef long long ll;
typedef unsigned long long ull;

int main(){
  int N, K;
  cin >> N >> K;

  vector<int> A(N);
  rep(i,N) cin >> A.at(i);

  rep(i,N-K){
    if(A.at(K+i)>A.at(i)) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}


Measured memory_bytes: 4052
#include <bits/stdc++.h>
using namespace std;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define INF 100000000
typedef long long ll;

int main(){
    ll N,i;
    cin>>N>>i;
    cout<<N-(i-1);
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int cmp(const void *a,const void *b){
    if(*(int*)a>*(int*)b){return -1;}
    else if(*(int*)a<*(int*)b){return 1;}
    else {return 0;}
}
int min(int a,int b){

    if(a>=b){return b;}
    return a;
}

int main(void){
int n;
int l[205];
int sum=0;
scanf("%d",&n);
for(int i=0;i<2*n;i++){
    scanf("%d",&l[i]);
}
qsort(l,2*n,sizeof(int),cmp);

for(int i=0;i<2*n-1;i=i+2){
    sum=sum+min(l[i],l[i+1]);
}
printf("%d\n",sum);
}

Measured memory_bytes: 128
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String o = in.next();
            String e = in.next();
            int idx = 0;
            if (o.length() >= e.length()) {
                idx = o.length() * 2;
            } else {
                idx = e.length() * 2 + 1;
            }
            char oarr[] = new char[idx];
            char earr[] = new char[idx];
            oarr = o.toCharArray();
            earr = e.toCharArray();

            char ans[] = new char[idx];

            int j = 0;
            for (int i = 0; i < o.length(); i++) {
                ans[j] = oarr[i];
                j += 2;
            }
            j = 1;
            for (int i = 0; i < e.length(); i++) {
                ans[j] = earr[i];
                j += 2;
            }

            out.println(String.valueOf(ans).trim());
        }

    }
}



Measured memory_bytes: 21844
/* Author - thiolhub */

#include <bits/stdc++.h>

using namespace std;

#define ll              long long int
#define ld              long double
#define db              double
#define pi              3.1415926535897932384626
#define PI              acos(-1.0)
#define endl            "\n"
#define mod             1000000007
#define mk              make_pair
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(t)            ll t; cin>>t; while(t--)
#define sc(a)	        scanf("%lld",&a);
#define pr(a)	        printf("%lld\n",a)
#define rep(i,a,n)		for(ll i=a;i<n;i++)
#define m(a)		    memset(a,0,sizeof(a))
#define FastIO          ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define min3(a,b,c)     min(a,min(b,c))



int main(){ FastIO;

	int n;cin>>n;
	if(n%1000==0) cout<<0;
	else cout<<1000-(n%1000);	

}

Measured memory_bytes: 3628
import java.util.*;
import java.io.*;

public class Main {

	void solve() {
		int r = in.nextInt(), c = in.nextInt();
		char[][] a = new char[r][c];
		for (int i = 0; i < r; i++) {
			a[i] = in.nextToken().toCharArray();
		}
		
		int ans = Math.max(r, c);
		int[][] eq = new int[r - 1][];
		int[][] notEq = new int[r - 1][];
		for (int i = 0; i < r - 1; i++) {
			eq[i] = getEq(a[i], a[i + 1], true);
			notEq[i] = getEq(a[i], a[i + 1], false);
		}
		int[] lcp = new int[r - 1];
		int[] left = new int[r - 1], right = new int[r - 1], stack = new int[r];
		
		for (int pos = 0; pos < c; pos++) {
			for (int i = 0; i < r - 1; i++) {
				lcp[i] = Math.max(eq[i][pos], notEq[i][pos]) - pos;
			}
			int head;
			head = 1;
			stack[0] = -1;
			for (int i = 0; i < r - 1; i++) {
				while (head > 1 && lcp[i] <= lcp[stack[head - 1]]) {
					head--;
				}
				left[i] = stack[head - 1] + 1;
				stack[head++] = i;
			}
			head = 1;
			stack[0] = r - 1;
			for (int i = r - 2; i >= 0; i--) {
				while (head > 1 && lcp[i] <= lcp[stack[head - 1]]) {
					head--;
				}
				right[i] = stack[head - 1] - 1;
				stack[head++] = i;
			}
			
			for (int i = 0; i < r - 1; i++) {
				int dist = right[i] - left[i] + 1;
				ans = Math.max(ans, lcp[i] * (dist + 1));
			}
		}
		
		out.println(ans);
	}
	
	int[] getEq(char[] a, char[] b, boolean flag) {
		int[] result = new int[a.length];
		for (int i = 0; i < a.length; ) {
			if ((a[i] == b[i]) != flag) {
				result[i] = i;
				i++;
				continue;
			}
			int j = i;
			while (j < a.length && ((a[j] == b[j]) == flag)) {
				j++;
			}
			for (int t = i; t < j; t++) {
				result[t] = j;
			}
			
			i = j;
		}
		return result;
	}

	FastScanner in;
	PrintWriter out;

	void run() {
		in = new FastScanner();
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		public String nextToken() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextToken());
		}

		public long nextLong() {
			return Long.parseLong(nextToken());
		}

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

	public static void main(String[] args) {
		new Main().run();
	}
}


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

int main(){
 
  int H, W;
  cin >> H >> W;
  char s = '#';
  
  for(int i = 0; i < W + 2; i++){
    cout << s;
  }
  cout << endl;
    
  for(int i = 0; i < H; i++){
    string str_i;
    cin >> str_i;
    cout << s + str_i + s << endl;
  }
  
  for(int i = 0; i < W + 2; i++){
    cout << s;
  }
  
}

Measured memory_bytes: 256
def II(): return int(input())
def MI(): return map(int,input().split())
def LMI(): return list(map(int,input().split()))
def LIIN(n): return list(int(input()) for _ in range(n))
def LMIN(n): return [list(map(int, input().split())) for _ in range(n)]
def IS(): return input()
def LS(): return list(input())
def MS(): return map(str,input().split())
def LMS(): return list(map(str,input().split()))
def LMS(): return list(map(str,input().split()))
def LISN(n): return list(input() for _ in range(n))
def LMSN(n): return [input().split() for _ in range(n)]
MOD = 10**9+7
INF = 10**18

def main():
    n,a,b = MI()
    s = LS()
    for i in range(n):
        if s[i] == 'c':
            print('No')
            continue
        if s[i] == 'a':
            if a > 0:
                a-=1
                print('Yes')
            elif b > 0:
                b-=1
                print('Yes')
            else:
                print('No')
            continue
        if s[i] == 'b':
            if a+b > 0 and b > 0:
                b-=1
                print('Yes')
            else:
                print('No')
            continue

if __name__ == '__main__':
    main()


Measured memory_bytes: 54520
// AUTHOR : Kishan Srivastav
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define in freopen("input.txt", "r", stdin)
#define out freopen("output.txt", "w", stdout)
#define ios ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}

int main() {
	ios
#ifndef ONLINE_JUDGE
	in;
	out;
#endif
	int d,t,s;
	cin>>d>>t>>s;

	double a = (double)d/s;
	if( (a) <= t ) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
}

Measured memory_bytes: 3576
from collections import defaultdict
import sys

sys.setrecursionlimit(10 ** 6)


def rec(node):
    if memo[node]:
        return memo[node]

    res = 0
    for next_node in edge[node]:
        res = max(res, rec(next_node) + 1)

    memo[node] = res
    return res


n, m = map(int, input().split())
memo = [0] * (n + 1)
edge = defaultdict(list)

for i in range(m):
    x, y = map(int, input().split())
    edge[x].append(y)

ans = 0
for i in range(1, n + 1):
    ans = max(ans, rec(i))

print(ans)


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

int main() {
	int a, b;
	int vertex[128];
	int flag;
	int i;

	while(scanf("%d %d", &a, &b) != EOF) {
		memset(vertex, 0, sizeof(vertex));
		flag = 1;

		vertex[0] = vertex[1] = 1;

		vertex[a - 1]++;
		vertex[b - 1]++;

		while(a | b) {
			scanf("%d %d", &a, &b);
			vertex[a - 1]++;
			vertex[b - 1]++;
		}

		for(i = 0; i < 128; i++) {
			if(vertex[i] % 2) {
				flag = 0;
				break;
			}
		}

		if(flag)
			puts("OK");
		else
			puts("NG");
	}

	return 0;
}

Measured memory_bytes: 584
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
 int i,tate,yoko;
while(cin>>tate>>yoko){
		if(tate==0&&yoko==0){
			break;
		}
	for(int j=0;j<tate;j++){
		for(i=0;i<yoko;i++){
			cout<<"#";
		}cout<<endl;
	}cout<<endl;
}	
return 0;
}

Measured memory_bytes: 1152
#include <bitset>
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>
#include <bitset>

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main()
{
    int N, A;
    cin >> N;
    cin >> A;

    cout << N * N - A << endl;

    return 0;
}


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

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define MOD 1000000007

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

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a[i];
	map<int, int> mp;
	rep(i,n) {
		if(a[i]/400 < 8) {
			mp[a[i]/400]++;
		}
		else mp[8]++;
	}
	int ansmin=0,ansmax=0;
	rep(i,9) {
		if(i < 8) {
			if(mp[i] != 0) {
				ansmin++;
				ansmax++;
			}
		}
		else {
			if(ansmin == 0 && mp[8] != 0) ansmin = 1;
			ansmax += mp[8];
		}
	}
	cout << ansmin << " " << ansmax << endl;

  return 0;
}


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

int main(){
	int n;
	scanf("%d", &n);
	vector<tuple<int, int, string, long, string> > a;
	int v, w;
	long time;
	string t, name;
	for(int i = 0; i < n; i++) {
		cin >> v >> w >> t >> time >> name;
		a.push_back(make_tuple(v, w, t, time, name));
	}
	sort(a.begin(), a.end());
	for(int i = 0; i < n; i++)
		cout << get<0>(a[i]) << " " << get<1>(a[i]) << " " << get<2>(a[i]) << " " << get<3>(a[i]) << " " << get<4>(a[i]) << '\n';
}



Measured memory_bytes: 16980
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <limits.h>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;

int main() {
    
    int N, M;
    
    cin >> N;
    cin >> M;
    
    int ans[50] = {0};
    
    for ( int i = 0; i < M; i++ ) {
        int a,b;
        cin >> a;
        cin >> b;
        
        ans[a-1]++;
        ans[b-1]++;
    }
    
    for ( int i = 0; i < N; i++ ) {
        cout << ans[i] << endl;
    }
    
    
    
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
#define ll long long
using namespace std;
const ll MOD=998244353;
int n,m;
ll f[8005],fact[8005],inv[8005];
ll A[20005],B[20005];
int limit,l,r[20005];
ll quick_pow(ll x,ll a)
{
	ll ans=1;
	while(a)
	{
		if(a&1)ans=ans*x%MOD;
		x=x*x%MOD;
		a>>=1;
	}
	return ans;
}
void NTT(ll*A,int type)
{
	for(int i=0;i<limit;i++)
	  if(i<r[i])swap(A[i],A[r[i]]);
	for(int mid=1;mid<limit;mid<<=1)
	{
		ll Wn=quick_pow(3,(MOD-1)/(mid<<1));
		for(int j=0,R=mid<<1;j<limit;j+=R)
		{
			ll w=1;
			for(int k=0;k<mid;k++,w=w*Wn%MOD)
			{
				ll x=A[j+k],y=A[j+mid+k]*w;
				A[j+k]=(x+y)%MOD;
				A[j+mid+k]=(x-y)%MOD;
			}
		}
	}
	if(type==-1)
	{
		ll inv=quick_pow(limit,MOD-2);
		for(int i=0;i<limit;i++)A[i]=A[i]*inv%MOD;
		for(int i=1;i<(limit>>1);i++)swap(A[i],A[limit-i]);
	}
}
int main()
{
	scanf("%d%d",&n,&m);
	fact[0]=1;
	for(int i=1;i<=n+2;i++)fact[i]=fact[i-1]*i%MOD;
	inv[n+2]=quick_pow(fact[n+2],MOD-2);
	for(int i=n+2;i>=1;i--)inv[i-1]=inv[i]*i%MOD;
	f[0]=1;
	limit=1,l=0;
	while(limit<16384)limit<<=1,l++;
	for(int i=0;i<limit;i++)
	  r[i]=(r[i>>1]>>1)|((i&1)<<(l-1));
	for(int i=3;i<=n+2;i++)B[i]=inv[i];
	NTT(B,1);
	for(int t=1;t<=m;t++)
	{
		for(int i=0;i<n;i++)A[i]=f[i];
		for(int i=n;i<limit;i++)A[i]=0;
		NTT(A,1);
		for(int i=0;i<limit;i++)A[i]=A[i]*B[i]%MOD;
		NTT(A,-1);
		for(int i=0;i<=n;i++)f[i]=(f[i]*(i*(i+1)/2+1)+A[i+2]*(i+1)*(i+2))%MOD;
	}
	ll ans=0;
	for(int i=0;i<=n;i++)
	  ans=(ans+f[i]*fact[n]%MOD*inv[n-i])%MOD;
	if(ans<0)ans+=MOD;
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define INF (1e9)
#define EPS (1e-7)
using namespace std;
typedef complex<double> P;

double dot(P a,P b){
  return real(conj(a)*b);
}

double cross(P a,P b){
  return imag(conj(a)*b);
}

double getdistance_sp(P a,P b,P p){
  if(!(dot(p-a,b-a)>=0&&dot(p-b,a-b)>=0))
    return min(abs(p-a),abs(p-b));
  return abs(cross(p-a,b-a)/abs(b-a));
}

double getdistance_pp(P a,P b){
  return sqrt((b.real()-a.real())*(b.real()-a.real())+(b.imag()-a.imag())*(b.imag()-a.imag()));
}

int main(){
  double d,x,y,z,w;
  P p,v;
  while(1){
    cin>>d;
    if(!d)break;
    cin>>x>>y>>z>>w;
    p=P(x,y);
    v=P(z,w);
    double dis=getdistance_pp(p,P(0,0));
    if(abs(cross(v-p,-p))>EPS)cout<<"impossible"<<endl;
    else if(getdistance_sp(p,p+P(v.real()*INF,v.imag()*INF),P(0,0))<EPS&&dis<=d+EPS)printf("%.8f\n",dis);
    else if(2-dis<=d+EPS)printf("%.8f\n",2-dis);
    else cout<<"impossible"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1296
# coding: utf-8
# Your code here!

H, W = map(int, input().split())
in_li = [list(input()) for i in range(H)]

for i in range(H + 2):
    for j in range(W + 2):
        if i == 0 or i == H + 1:
            print("#", end="")
        elif j == 0 or j == W + 1:
            print("#", end="")
        else:
            print(in_li[i - 1][j - 1], end="")
    print("")

Measured memory_bytes: 4596
#include <bits/stdc++.h>
using namespace std;
#define llong long long
#define LINF  100000000000000000
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
vector<pair<int, llong>> graph[100001];
llong cost[100001];

void dfs(int x){
    for(int i=0; i<graph[x].size(); i++){
        if(cost[graph[x][i].first] == LINF){
            cost[graph[x][i].first] = cost[x] + graph[x][i].second; 
            dfs(graph[x][i].first);
        }
    }
}
int main(){
    int n;cin >> n;
    for(int i=0; i<n-1; i++){
        int a,b;llong c;
        cin >> a >> b >> c;
        graph[a].push_back(make_pair(b,c));
        graph[b].push_back(make_pair(a,c));
    }
    int q, k;cin >> q >> k;
    for(int i=1; i<=n; i++){
        cost[i] = LINF;
    }
    cost[k] = 0;
    dfs(k);
    for(int i=0; i<q; i++){
        int x,y ; cin >> x >> y;
        cout << cost[x] + cost[y] << endl;
    }
    


}

Measured memory_bytes: 14336
#include <bits/stdc++.h>
#define ll long long
#define ld lond double
#define pll pair < long long , long long>
#define p_b push_back
#define all(x) x.begin(),x.end();
#define fi first
#define se second
#define string str
using namespace std;

int main()
{
    map < int , int > m;
    int a,b,c;
    cin >> a >> b >> c;
    m[a]++;
    m[b]++;
    m[c]++;
    if(m.size()==2)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;
 
// template from zscoder
 
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
    ll n,y;
  cin >> n >> y;
  for(int i = 0; i <= n; i++)
  {
    for(int j = 0; j <= n; j++)
    {
      int k = n-i-j;
      if(k>-1&&((i*10000+j*5000+k*1000)==y))
      {
        cout << i << " " << j << " " << k << endl;
        return 0;
      }
    }
  }
  cout << -1 << " " << -1 << " " << -1 << endl;
  return 0;
}

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

#define forsn(i,s,n) for(tint i=(s);i<(tint)(n); i++)
#define forn(i,n) forsn(i,0,n)
#define dforn(i,n) for(tint i = tint(n)-1; i >= 0; i--)
#define debug(x) cout << #x << " = "  << x << endl

using namespace std;

typedef long long tint;
typedef long double ldouble;

random_device rd;
mt19937 gen(rd());

uniform_int_distribution<tint> dis(1, 10000);

void imprimirVector (vector<tint> v)
{
	if (!v.empty())
	{ 
		tint p = tint(v.size());
		cout << "[";
		forn(i,p-1)
			cout << v[i] << ",";
		cout << v[p-1] << "]" << endl;
	}
	else
		cout << "[]" << endl;
}

int main()
{
	#ifdef ACMTUYO
		assert(freopen("entrada.in", "r", stdin));
	#endif
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	ldouble L;
	while (cin >> L)
	{
		cout << fixed << showpoint << setprecision(16) << (L/3.0)*(L/3.0)*(L/3.0) << "\n";
	}
	
	
	return 0;
}






Measured memory_bytes: 256