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

int main(){
	int n , k , t , u , v , l;
	cin >> n >> k >> t >> u >> v >> l;
	int* d = new int [n+1];
	for(int i=0;i<n;++i){
		cin >> d[i];
	}
	d[n]=l;
	int pos=0,m=0,stock=0;
	double ans=0;
	while(pos<l){
		if(pos<d[m]){ //?¬?????????????????????§????????????????????¨???
			if(stock>0){  //??????????????????????????????????????°?§?????????¢???t*v;
				--stock;
				int tmp = min( l , pos+t*v); 
				ans+=(tmp-pos+0.) /v; //???????????????  =  ????????????+t 
				pos=tmp;
			} else { //?????????????????????????????????????????°?¬?????????????????????§ u m/s  ??§?????????;
				ans+=(d[m]-pos+0.)/u;  
				pos = d[m];
			}
		} else {  //?¬?????????????????????§?????????????????????????¶???????????????¨??????m++
			if(stock==0){  
				if(d[m]==pos){  
					int tmp = min( l , pos+t*v);
					ans+=(tmp-pos+0.)/v;
					pos=tmp;
					++m;  
				} else {
					++stock;
					++m;
				}
			} else if(stock==k){  
				int tmp = min( l , d[m]+t*v);
				ans+=(tmp-pos+0.)/v;
				pos = tmp;
				++m;
			} else { 
				++stock;
				++m;
			}
		}
	}
	cout << fixed << setprecision(9) << ans <<endl;
	delete [] d;
	return 0;
}

Measured memory_bytes: 1272
#include<bits/stdc++.h>
char s[3][5]={"hon","pon","bon"};
using namespace std;
int main()
{
	int n;
	cin>>n;
	n=n%10;
	if (n==2||n==4||n==5||n==7||n==9)   cout<<s[0];
	else if (n==3)   cout<<s[2];
	else   cout<<s[1];
	return  0;
} 

Measured memory_bytes: 3624
#include <stdio.h>
int main()
{
    int a,b;
    int c,d;
    int sum;
    int max;
    scanf("%d%d%d%d",&a, &b, &c, &d);
    if(a>=c)
    {
        if(b>=d)
            sum = d-a;
        else
            sum = b-a;
    }
    else
    {
        if(b>=d)
            sum = d-c;
        else
            sum = b-c;
    }
    if(sum>=0)
        max = sum;
    else
        max = 0;
    printf("%d\n",max);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#include <cstring>
#include <iterator>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define FI first
#define SE second
#define MA(i,j) make_pair(i,j)
#define PA pair<int,int>
#define PB push_back
#define PQ priority_queue<int>
#define PGQ priority_queue<int,vector<int>,greater<int> >
#define VE vector<int>
#define VP vector<PA>
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int MOD=1e9+7;
const int INF=1e9+7;
const double PI=3.141592653589793238462643383279;
//
int main(){
  int X;
  int A,B;
  cin>>X>>A>>B;
  X-=A;
  X%=B;
  cout<<X<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vector<ll> > vvl;
typedef vector<vector<P> > vvp;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=998244353;
const int INF=1e9;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

vvl G;


void dfs(int v,vector<bool> &seen,int  &res){
  bool end=true;
  rep(i,seen.size())if(!seen[i] &&i!=v)end=false;
  if(end){
    res++;
    return;
  }
  seen[v]=true;
  for(auto nv:G[v]){
    if(seen[nv])continue;
    dfs(nv,seen,res);
  }
  seen[v]=false;
}
         
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  int n,m;
  cin >> n >> m;
  G.resize(n); 
  rep(i,m){
    int a,b;
    cin >> a >> b;
    a--;
    b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  vector<bool>seen(n,false);
  int res=0;
  dfs(0,seen,res);
  cout << res << endl;
  return 0;     
}


Measured memory_bytes: 3620
#include <iostream>
#include <vector>
using namespace std;
int n,m;
bool visited[200010];
void dfs(int v,int depth, vector<vector<int>>& g){
    if(depth == 4) return;
    visited[v] = true;
    for(int nv:g[v]){
        if(visited[nv]) continue;
        dfs(nv,depth+1,g);
    }
    return;
}

int main(){
    cin >> n >> m;
    for(int i = 0;i < n; i++) visited[i] = false;
    vector<vector<int>> g(n);
    for(int i = 0; i < m; ++i){
        int a,b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
    }
    dfs(0,1,g);
    if(visited[n-1]) puts("POSSIBLE");
    else puts("IMPOSSIBLE");
    return 0;
}

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

int main()
{
    long long n,x,t;
    cin>>n>>x>>t;
    if(n<=x)
    {
        cout<<t;
        return 0;
    }
    else
    {
        int ans=0;
        while(n>x)
        {
            ans+=t;
            n-=x;
        }
        if(n!=0) ans+=t;
        cout<<ans;
    }

    return 0;
}


Measured memory_bytes: 3596
#include<iostream>
using namespace std;
int mod(int a){
    if(a<0)
        return -1*a;
    else return a;
}
int main(){
    int n,k;
    scanf("%d %d",&n,&k);
    int hight[n+1],i,j;
    for(i=1; i<=n; i++)
        scanf("%d",&hight[i]);
    int dp[n+1];
    dp[1]=0;
    int min,temp;
    for(i=2; i<=n; i++){
        min=mod(hight[i]-hight[i-1])+dp[i-1];
        for(j=i-2; j>=1; j--){
            if(j==i-k-1)
              break;
            temp=mod(hight[i]-hight[j])+dp[j];
            if(temp<min)
                min=temp;
        }
        dp[i]=min;
    }
    printf("%d",dp[n]);
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  string s;
  cin>>s;

  rep(i,1<<3){
    bitset<3> b(i);
    int ans = 0;
    ans+= s[0]-'0';
    rep(k,3){
      if(b[k] == 1)ans+=s[k+1]-'0';
      else ans-=s[k+1]-'0';
    }
    if(ans==7){
      string t = "";
      t+=s[0];
      rep(k,3){
        t+=(b[k]==0)?"-":"+";
        t+=s[k+1];
      }
        t+="=7";
        print(t);
        return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int n, m, map[21][21], x, y;
	while (cin >> n, n){
		for (int i = 0; i < 21; i++){
			for (int j = 0; j < 21; j++){
				map[i][j] = 0;
			}
		}
		for (int i = 0; i < n; i++){
			int a, b;
			cin >> a >> b;
			map[a][b] = 1;
		}
		cin >> m;
		x = y = 10;
		for (int i = 0; i < m; i++){
			char a;
			int b;
			cin >> a >> b;
			switch (a){
			case 'N':
				for (int j = 0; j < b; j++){
					y++;
					if (map[x][y]){
						map[x][y] = 0;
						n--;
					}
				}
				break;
			case 'E':
				for (int j = 0; j < b; j++){
					x++;
					if (map[x][y]){
						map[x][y] = 0;
						n--;
					}
				}
				break;
			case 'S':
				for (int j = 0; j < b; j++){
					y--;
					if (map[x][y]){
						map[x][y] = 0;
						n--;
					}
				}
				break;
			case 'W':
				for (int j = 0; j < b; j++){
					x--;
					if (map[x][y]){
						map[x][y] = 0;
						n--;
					}
				}
				break;
			}
		}
		if (n){
			cout << "No" << endl;
		} else{
			cout << "Yes" << endl;
		}
	}
	return 0;
}

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


int main(){
  int n;
  cin >> n;
  double a[n];
  double ans = 0;
  for(int i=0; i<n; i++){
    cin >> a[i];
    ans += 1/a[i];
  }
  cout << fixed << setprecision(10);
  cout << 1/ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#define int long long
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

const int DEPTH = 18;
struct SegTree {
	int d[1 << (DEPTH + 1)];
	SegTree() {
		int i;
		rep(i, (1 << (DEPTH + 1))) d[i] = 0;
	}
	void update(int pos, int x) {
		pos += (1 << DEPTH) - 1;
		d[pos] = x;
		while (pos > 0) {
			pos = (pos - 1) / 2;
			d[pos] = max(d[pos * 2 + 1], d[pos * 2 + 2]);
		}
	}
	//[l, r)
	int getMax(int l, int r, int a = 0, int b = (1 << DEPTH), int id = 0) {
		if (a >= r || b <= l) return 0;
		if (l <= a && b <= r) return d[id];
		int u = getMax(l, r, a, a + (b - a) / 2, id * 2 + 1);
		int v = getMax(l, r, a + (b - a) / 2, b, id * 2 + 2);
		return max(u, v);
	}
};

int n;
int h[200000];
int a[200000];
SegTree dp;

signed main() {
	int i;
	
	cin >> n;
	rep(i, n) cin >> h[i];
	rep(i, n) cin >> a[i];
	
	rep(i, n) {
		dp.update(h[i], dp.getMax(0, h[i]) + a[i]);
	}
	cout << dp.getMax(0, n + 1) << endl;
	return 0;
}

Measured memory_bytes: 7424
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include <cstddef>
#include<queue>
using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> A(N), B(N);
    for(int i = 0; i < N; i++)
    {
        cin >> A.at(i);
        B.at(A.at(i) - 1) = i + 1;
    }
    for(int i = 0; i < N; i++)
    {
        cout << B.at(i) << ' ';
    }
    return 0;
}


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

#define pb push_back
#define ppp pop_back
#define pii pair<int,int>
#define fi first
#define se second

const int N = 105;
const int K = 1e5 + 5;
const int p = 1e9 + 7;

int a[N];
int dp[N][K];

void add(int &a, int b) {
	a += b;
	if (a < 0) a += p;
	else if (a >= p) a -= p;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif
    int n, k;
	cin >> n >> k;
	for (int i=1; i<=n; i++) cin >> a[i];
	dp[0][0] = 1;
	for (int i=1; i<K; i++) dp[0][i] = 0;
	for (int i=1; i<=n; i++) {
		dp[i][0] = 1;
		for (int j=1; j<K; j++) {
			add(dp[i][j], dp[i][j-1]);
			add(dp[i][j], dp[i-1][j]);
			if (j - a[i] - 1 >= 0) add(dp[i][j], - dp[i-1][j - a[i] - 1]);
		}
	}
	cout << dp[n][k] << "\n";
	return 0;
}


Measured memory_bytes: 41216
//***Little by little one travels far***
 
#include<bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
 
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef long double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

ll a[100001];
int main()
{
   ll n,k,q;
   cin>>n>>k>>q;

    forn(i,q){
        ll val;
        cin>>val;
        a[val]++;
    }
    for1(i,n){
        a[i]+=(k-q);
        if(a[i]>0) cout<<"Yes\n";
        else cout<<"No"<<endl;
    }
}

Measured memory_bytes: 1408
N = int(input())
D = []
i = 0
ans_flag = False
while i < N:
    D1, D2 = map(int, input().split())
    if D1 == D2:
        D.append(1)
        if len(D) == 3:
            ans_flag = True
    else:
        D = []
    i += 1

if ans_flag:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9172
from collections import Counter
import sys

sys.setrecursionlimit(10 ** 6)

mod = 1000000007
inf = int(1e18)

dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]


def inverse(a):
    return pow(a, mod - 2, mod)


def main():
    n = int(input())
    if n >= 30:
        print("Yes")
    else:
        print("No")


main()


Measured memory_bytes: 9392
module Main where

import Debug.Trace
import Data.List
import qualified Data.Sequence as S
import qualified Data.ByteString.Char8 as B
import Data.Int
import Data.Char
import Data.Array
import Data.Maybe
import qualified Data.Map as M
import Data.Ord
import Data.Functor
import Control.Applicative
import Control.Monad
import Text.Printf

data Tree = Nil | Node Int Tree Tree deriving (Eq, Show)

solve :: Int -> [[Int]] -> ([Int], [Int], [Int])
solve n lst = (preorder, inorder, postorder) where
    preorder = iter root where
        iter Nil = []
        iter (Node id left right) = id:iter left ++ iter right    

    inorder = iter root where
        iter Nil = []
        iter (Node id left right) = iter left ++ id:iter right

    postorder = iter root where
        iter Nil = []
        iter (Node id left right) = iter left ++ iter right ++ [id]    

    root = iter rootId where
        iter (-1) = Nil
        iter x = Node x (iter l) (iter r) where
            (l, r) = treeTbl!x  

    (treeTbl, rootId) = iter 0 [] lst where
        iter s ac [] = ((listArray (0, n-1) (replicate n (-1, -1))) // ac, div (n*(n-1)) 2 - s)
        iter s ac ([x,(-1),(-1)]:ns) = iter s ac ns 
        iter s ac ([x,l,(-1)]:ns) = iter (s+l) ((x, (l, -1)):ac) ns 
        iter s ac ([x,(-1),r]:ns) = iter (s+r) ((x, (-1, r)):ac) ns 
        iter s ac ([x,l,r]:ns) = iter (s+l+r) ((x, (l, r)):ac) ns

readIntLn:: IO Int
readIntLn = (fst . fromJust . B.readInt) <$> B.getLine

readIntList:: IO [Int]
readIntList = map (fst . fromJust . B.readInt) . B.words <$> B.getLine

print' [] = putStrLn ""
print' (x:xs) = do
    putStr $ ' ':(show x)
    print' xs

main :: IO() 
main = do
    n <- readIntLn
    l <- replicateM n readIntList
    let (pro, ino, poo) = solve n l
    putStrLn "Preorder"
    print' pro
    putStrLn "Inorder"
    print' ino
    putStrLn "Postorder"
    print' poo



Measured memory_bytes: 3648
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    n, d = geta(int)

    cnt = 0
    for _ in range(n):
        x, y = geta(int)

        if x * x + y * y <= d * d:
            cnt += 1

    print(cnt)


if __name__ == "__main__":
    main()

Measured memory_bytes: 74052
N, M = gets.chomp.split(' ').map(&:to_i)

left = 1
right = N
M.times do
  l, r = gets.chomp.split(' ').map(&:to_i)
  left = [ left, l ].max
  right = [ right, r ].min
end

puts right >= left ? right - left + 1 : 0


Measured memory_bytes: 1788
n = int(input())
h = list(map(int, input().split()))
inf = 10**10
dp = [inf]*(n)
dp[0]=0
for i in range(n-1):
    for j in range(1, 3):
        if i+j > n-1:
            break
        dp[i+j] = min(dp[i+j], dp[i]+abs(h[i+j]-h[i]))
        
print(dp[n-1])

Measured memory_bytes: 52208
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
## dp ##
def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in range(d1)]
## math ##
def to_bin(x: int) -> str: return format(x, 'b') # rev => int(res, 2)
def to_oct(x: int) -> str: return format(x, 'o') # rev => int(res, 8)
def to_hex(x: int) -> str: return format(x, 'x') # rev => int(res, 16)
MOD=10**9+7
def divc(x,y) -> int: return -(-x//y)
def divf(x,y) -> int: return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def enumerate_divs(n):
    """Return a tuple list of divisor of n"""
    return [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers n or less"""
    is_prime = [True]*(MAX_NUM+1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(MAX_NUM**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i*2, MAX_NUM+1, i): is_prime[j] = False
    return [i for i in range(MAX_NUM+1) if is_prime[i]]
def prime_factor(n):
    """Return a list of prime factorization numbers of n"""
    res = []
    for i in range(2,int(n**0.5)+1):
        while n%i==0: res.append(i); n //= i
    if n != 1: res.append(n)
    return res
## libs ##
from itertools import accumulate as acc, combinations as combi, product, combinations_with_replacement as combi_dup
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left
#======================================================#

def main():
    k, t = MII()
    aa = MII()
    aa.sort(reverse=True)
    ans = max(aa[0]-1-(k-aa[0]), 0)
    print(ans)



if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

#define MAX 2000000
#define INFTY (1<<30)

int H,A[MAX+1];

void maxHeapify(int i){
	int l,r,largest;
	l=2*i;
	r=2*i+1;
	
	if(l<=H&&A[l]>A[i]) largest = l;
	else largest = i;
	if(r<=H&&A[r]>A[largest]) largest=r;
	
	if(largest!=i){
		swap(A[i],A[largest]);
		maxHeapify(largest);
	}
}

int extract(){
	int maxv;
	if(H<1)return -INFTY;
	maxv = A[1];
	A[1]=A[H];
	H--;
	maxHeapify(1);
	return maxv;
}

void increaseKey(int i,int key){
	if(key<A[i]) return;
	A[i]=key;
	while(i>1 && A[i/2] < A[i]){
		swap(A[i],A[i/2]);
		i=i/2;
	}
}

void insert(int key){
	H++;
	A[H] = -INFTY;
	increaseKey(H,key);
}

int main(){
	int key;
	char com[10];
	while(1){
		scanf("%s",com);
		if(com[0]=='e' && com[1]=='n') break;
		if(com[0]=='i'){
			scanf("%d",&key);
			insert(key);
		}else{
			printf("%d\n",extract());
		}
	}
	return 0;
}

Measured memory_bytes: 7020
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

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

class TaskA {
 public:
  void solve(std::istream &in, std::ostream &out) {
    string S;
    in >> S;
    out << S.substr(0, S.size()-8);
  }
};


int main() {
  TaskA solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


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

using namespace std;

#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR((i),0,(n))

typedef long long ll;

const int INF=1e9;
const int N=1000001;


int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
pair<int,int> dfs1(vector<vector<int>>&field,int nx,int ny,int color,int lookcolor){
    field[ny][nx]=color;
    int xsum=2*nx+1;
    int num=1;
    for(int way=0;way<4;++way){
        int nexty=ny+dy[way];
        int nextx=nx+dx[way];
        if(nexty==field.size()){
            int a=0;
            a++;
        }
        if(nexty<=field.size()-1&&nexty>=0){
            if(field[nexty][nextx]==lookcolor){
            auto p=dfs1(field,nextx,nexty,color,lookcolor);
            xsum+=p.first;
            num+=p.second;
            } 
        }
              
    }
    
    return make_pair(xsum,num);
}   
double eps=1e-7;
pair<int,int> checkdfs(const int now,vector<map<int,vector<int>>>&edges,map<int,pair<int,int>>blockmp){
    int xsum=blockmp[now].first;
    int num=blockmp[now].second;

    for(auto e:edges[now]){
        int tocolor=e.first;
        auto xs=e.second;

        auto p=checkdfs(tocolor,edges,blockmp);
        sort(xs.begin(),xs.end());
        double minx=xs[0]*2;
        double maxx=xs.back()*2+2;
        double center=double(p.first)/p.second;
        if(minx+eps<center&&center<maxx-eps){

            xsum+=p.first;
            num+=p.second;
        }else{
            throw(false);
        }
    }
    return make_pair(xsum,num);
}

int main()
{
    while(true){
      int W,H;
      cin>>W>>H;
      if(!W) break;
      vector<vector<int>>field(H+2,vector<int>(W+2,0));
      for(int i=0;i<H;++i){
          string st;cin>>st;
          for(int j=0;j<W;++j){
            char ch(st[j]);
            if(ch=='.')field[i+1][j+1]=0;
            else field[i+1][j+1]=ch-'0';
          }
      }
      for(int x=1;x<=W;++x){
          field[H+1][x]=10;
      }
      int nowcolor=11;
      map<int,pair<int,int>>blockmp;
      for(int y=H+1;y>=0;--y){
          for(int x=0;x<W+2;++x){
            if(field[y][x]<=10&&field[y][x]>=1){
                auto p= dfs1(field,x,y,nowcolor,field[y][x]);
                blockmp[nowcolor]=p;
                nowcolor++;
            }
          }
      }
      
    vector<map<int,vector<int>>>edges(nowcolor+10,map<int,vector<int>>());
    for(int y=0;y<H+1;++y){
        for(int x=0;x<W+2;++x){
            if(field[y][x]){
                if(field[y+1][x]){
                    if(field[y][x]!=field[y+1][x]){

                        int fromcolor=field[y+1][x];
                        int tocolor=field[y][x];
                        edges[fromcolor][tocolor].push_back(x);
                    }
                }
            }
        }
    }
    bool ok=true;
    try{
        checkdfs(11,edges,blockmp);
    }catch(...){
        ok=false;
    }
    if(!ok)cout<<"UN";
    cout<<"STABLE"<<endl;

  }
  return 0;
}

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

ll dp[100005];
ll h[100005];

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(20);

  int n;
  cin >> n;
  rep(i, n) { cin >> h[i]; }
 
  dp[0] = 0; 
  dp[1] = abs(h[1] - h[0]);
  for (int i = 2; i < n; ++i) {
    dp[i] = min(abs(h[i] - h[i-1]) + dp[i-1],
                abs(h[i] - h[i-2]) + dp[i-2]); 
  }
  cout << dp[n-1] << endl;
  return 0;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//typedef vector<vector<ll>> Graph;

const ll mod = 1e9 + 7;
//const ll mod = 998244353;

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define spa << " " <<
#define fi first
#define se second

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 (a>b) { a=b; return 1; } return 0; }

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

template<typename T> void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cerr<<v[i][0];for(ll j=1;j<w;j++)cerr spa v[i][j];cerr<<endl;}};
template<typename T> void debug(vector<T>&v,ll n){if(n!=0)cerr<<v[0];
for(ll i=1;i<n;i++)cerr spa v[i];
cerr<<endl;};

string num2bit(ll num, ll len){
    string bit = "";
    REP(i, len){
    bit += char('0'+(num>>i & 1));
    }
    return bit;
}

ll dp[303][303][303];
string S;
ll K;

ll rec(ll l, ll r, ll k){
    if(dp[l][r][k]>=0) return dp[l][r][k];
    if(l+1 == r) return 1;
    if(l >= r) return 0;
    ll res = 0;
    if(S[l] != S[r-1]){
        chmax(res, rec(l, r-1, k));
        chmax(res, rec(l+1, r, k));
        if(k>0) chmax(res, rec(l+1, r-1, k-1)+2);
    }else{
        chmax(res, rec(l+1, r-1, k)+2);
    }
    dp[l][r][k] = res;
    return res;
}

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

    cin >> S >> K;
    ll N = S.size();
    
    REP(i, 303)REP(j, 303)REP(k, 303) dp[i][j][k] = -1;

    ll res = 0;
    REP(i, K+1){
        chmax(res, rec(0, N, i));
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 217600
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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 DigitSum(int N)
{
    int sum = 0;
    while (N > 0)
    {
        sum += N % 10;
        N /= 10;
    }
    return sum;
}

void _main()
{
    int N;
    cin >> N;
    int ans = 1 << 30;
    for (int A = 1; A < N; ++A)
    {
        const int B = N - A;
        chmin(ans, DigitSum(A) + DigitSum(B));
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int selectionSort(int A[],int N){
	int i,j,t,sw=0,minj;
	for(i=0;i<N;i++){
		minj=i;
		for(j=i;j<N;j++){
			if(A[minj]>A[j]) minj = j;
		}
		if(minj != i){
			t = A[i];A[i]=A[minj];A[minj]=t;
			sw++;
		}
	}
	return sw;
}

int main(){
	int A[100],N,i,sw;
	
	scanf("%d",&N);
	for(i=0;i<N;i++) scanf("%d",&A[i]);
	
	sw = selectionSort(A,N);
	
	for(i=0;i<N;i++){
		if(i) printf(" ");
		printf("%d",A[i]);
	}
	printf("\n%d\n",sw);
	
	return 0;
}

Measured memory_bytes: 1032
import itertools

N, K = map(int, input().split())

td = {}

for i in range(N):
    a, b = map(int, input().split())
    td.setdefault(a, [])
    td[a].append(b)

top = []
rest = []

for k in td.keys():
    td[k].sort()
    top.append(td[k][-1])
    rest += td[k][:-1]

top.sort()
rest.sort()

cumtop = list(itertools.accumulate(reversed(top)))
cumrest = list(itertools.accumulate(reversed(rest)))

ret = 0

for i in range(min(len(top), K)):
    tmp = (i+1)*(i+1)
    tmp += cumtop[i]
    if i == K-1:
        pass
    else:
        if (K-i-2) < 0 or (K-i-2) > len(cumrest)-1:
            continue
        tmp += cumrest[(K-i-2)]
    ret = max(tmp, ret)

print(ret)



Measured memory_bytes: 32612
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#define pb push_back
#define rep(i,a,b) for(i=a;i<=b;i++)
#define lid node<<1
#define rid node<<1|1
#define lch lid,l,mid
#define rch rid,mid+1,r
using namespace std;
const int N=500010;
const int INF=1e9;
int seg[N<<2];
int p[N],mp[N];int in[N];
vector<int> vec[N];
int n,K;
priority_queue<int> q;

void update(int node){
	seg[node]=min(seg[lid],seg[rid]);
}

void build(int node,int l,int r){
	if(l==r){seg[node]=INF;return;}
	int mid=l+r>>1;
	build(lch);build(rch);
	update(node);
}

void modify(int node,int l,int r,int x,int w){
	if(l>x||r<x)	return;
	if(l==r){seg[node]=w;return;}
	int mid=l+r>>1;
	modify(lch,x,w);modify(rch,x,w);
	update(node);
}

int query(int node,int l,int r,int fl,int fr){
	if(fl<=l&&r<=fr)	return seg[node];
	int mid=l+r>>1;
	if(mid>=fr)	return query(lch,fl,fr);
	else if(mid+1<=fl)	return query(rch,fl,fr);
	else return min(query(lch,fl,fr),query(rch,fl,fr));
}

int main(){
//	freopen("a.in","r",stdin);
//	freopen("a.out","w",stdout);
	int i,j,now,x,y;
	scanf("%d%d",&n,&K);
	rep(i,1,n)	scanf("%d",&p[i]);
	rep(i,1,n)	mp[p[i]]=i;
	//rep(i,1,n)	printf("%d ",mp[i]);printf("\n");
	build(1,1,n);
	for(i=n;i;i--){
		//printf("%d\n",mp[i]);
		x=query(1,1,n,max(1,mp[i]-K+1),mp[i]);
		if(x!=INF)	{x=mp[x];vec[x].pb(mp[i]);in[mp[i]]++;}//printf("%d->%d\n",mp[i],x);}
		x=query(1,1,n,mp[i],min(n,mp[i]+K-1));
		if(x!=INF)	{x=mp[x];vec[x].pb(mp[i]);in[mp[i]]++;}//printf("%d->%d\n",mp[i],x);}
		modify(1,1,n,mp[i],i);
	}
	rep(i,1,n)	if(!in[i])	q.push(i);
	now=n;
	while(!q.empty()){
		x=q.top();q.pop();
		mp[now]=x;now--;
		rep(i,0,(int)vec[x].size()-1){
			y=vec[x][i];
			in[y]--;
			if(!in[y])	q.push(y);
		}
	}
	rep(i,1,n)	p[mp[i]]=i;
	rep(i,1,n)	printf("%d\n",p[i]);
}
	
			
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	

Measured memory_bytes: 42240
A, B = map(int, input().split())
res = []
def make(t, cnt):
    res = []
    for i in range(25):
        res.append([t]*100)
        tmp = [t]*100
        for j in range(50):
            if cnt == 0:
                break
            tmp[2*j] = t^1
            cnt -= 1
        res.append(tmp)
    return res
mp = ".#".__getitem__
ans = make(0, B-1) + make(1, A-1)
print(100, 100)
for l in ans:
    print(*map(mp, l), sep='')

Measured memory_bytes: 41840
#include<iostream>
#include<cmath>
#define N 200000+5
using namespace std;
int n,v,l[N],b,e;
int main()
{
    cin>>n;
    b = ceil((double)(n+1)/2);
    e = (n%2==0)?(-1):(1);
    for(int i=1;i<=n;i++)
        cin>>v,l[b]=v,b+=i*e,e*=-1;
    for(int i=1;i<=n;i++)
    	cout<<l[i]<<" ";
    cout<<endl;
    return 0;
}

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

int main()
{
  int n;
  char a[105];

  scanf("%d",&n);
  scanf(" %s",a);

  int l = 0,r = 0;

  for (int i = 0;i < n;i++)
  {
    if (a[i] == ')')
    {
      if (l > 0) l--;
      else r++;
    }
    else l++;
  }

  for (int i = 0;i < r;i++) printf("(");

  printf("%s",a);

  for (int i = 0;i < l;i++) printf(")");

  printf("\n");

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

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

	vector<int> a(N);
	for (int i = 0; i < N; ++i)
	{
		cin >> a[i];
	}
	sort(a.begin(), a.end(), greater<int>());

	int alice = 0, bob = 0;
	for (int i = 0; i < N; ++i)
	{
		if (i % 2 == 0)
		{
			alice += a[i];
		}
		else
		{
			bob += a[i];
		}
	}

	cout << (alice - bob) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	long long int a,b,c,k;
	cin>>a>>b>>c>>k;
	if(k<=a)
	cout<<k;
	else if(k<=a+b)
	cout<<a;
	else
	cout<<2*a-k+b;
	return 0;
}


Measured memory_bytes: 3652
#define rep(i,n) for (int i = 0; i < n; i++)
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> p;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int inf = 1 << 30;


int main() {
	string s;
	cin >> s;
	int n = s.size();
	vector<vector<int>> dp(2 * n + 1);
	rep(i, 2 * n + 1) {
		dp[i].resize(2 * n + 1);
		rep(j, 2 * n + 1) {
			dp[i][j] = 0;
		}
	}
	dp[0][0] = 1;
	int sumr = 0, sumb = 0;
	rep(i, 2 * n) {
		if (i < n) {
			sumr += s[i] - '0';
			sumb += '2' - s[i];
		}
		rep(j, sumr+1) {
			if (i + 1 < j || sumb < i + 1 - j) continue;
			dp[i + 1][j] += dp[i][j];
			if (j != 0) dp[i + 1][j] += dp[i][j - 1];
			dp[i + 1][j] %= MOD;
		}
	}
	cout << dp[2 * n][sumr] << endl;
	return 0;
}

Measured memory_bytes: 64896
import math

def main():
    A, B, H, M = map(int, input().split())
    h_theta = 2*math.pi * H / 12 + (2*math.pi / 12) * M /60
    m_theta  = 2*math.pi * M / 60
    theta_diff = h_theta - m_theta
    diff = (A**2+B**2-2*A*B*math.cos(theta_diff))**0.5
    print(diff)

    
if __name__ == '__main__':
    main()

Measured memory_bytes: 9512
import heapq

n,k,*td=map(int,open(0).read().split())
td = [[t,d] for t,d in zip(td[::2],td[1::2])]
td = sorted(td,key = lambda x:x[1],reverse=True)

score = [0] * k
taste_sum = 0
extra_taste = []
eat_num = 0
eat_kind = set()

for t,d in td:
    if t in eat_kind:
        if eat_num == k:
            continue
        else:
            heapq.heappush(extra_taste, d)
            taste_sum += d
            eat_num += 1
    else:
        eat_kind.add(t)
        taste_sum += d
        eat_num += 1
        if eat_num > k:
            eat_num -= 1
            taste_sum -= heapq.heappop(extra_taste)
    
    if eat_num == k:
        score[len(eat_kind)-1] = len(eat_kind)**2 + taste_sum
            
    if len(eat_kind) == k:
        break
print(max(score))

Measured memory_bytes: 25956
#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;

int main(){
	double x,h;
	
	while(1){
		scanf("%lf %lf",&x,&h);
		if(x+h==0) break;
		else printf("%lf\n",(x*x)+2*x*sqrt((h*h)+((x/2)*(x/2))));
	}
	return 0;
}

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

const ll maxs = 1e5+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 1e15;

#define IOS ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define I insert
#define endl '\n'

void pre(){

}

void solve(){ 
   ll n;
   cin >> n;
   map<ll,ll> MAP;
   for(ll i=0;i<n-1;i++){
       ll val;
       cin >> val;
       MAP[val]++;
   }
   for(ll i=1;i<n+1;i++){
       cout << MAP[i] << endl;
   }
}

int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("input00.txt","r",stdin);
    // #endif
    IOS;
    pre();
    ll T = 1;   
    //cin>>T;
    while(T--){  
        solve();
    }
    return 0;
}

Measured memory_bytes: 16052
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <cmath>
const long double PI = acos(-1);
using namespace std;
int main (){
    int n; cin >> n;
    vector<int>a(n);
    for(int i=0; i<n; i++) cin >> a[i];
    for(int i=n-1; i>0; i--) cout << a[i] << " ";
    cout << a[0] << endl;
    return 0;
}


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

const int INF = 1e9 + 7;

int main() {
  int n, m; cin >> n >> m;
  vector<vec> g(n, vec(0));

  rep(i,m) {
    int a, b; cin >> a >> b; a--; b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  vec a(n, -1); // みちしるべ

  // bfs
  queue<int> que;
  que.push(0);

  while(que.size()) {
    int c = que.front(); que.pop();

    for (int i : g[c]) {
      if (a[i] == -1) {
        a[i] = c;
        que.push(i);
      }
    }
  }

  // bfsおわり

  rep(i,n) {
    if (a[i] == -1) {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;
  for (int i = 1; i < n; i++) {
    cout << a[i]+1 << endl;
  }

}


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

using namespace std;

#define pb			push_back
#define all(v)			((v).begin()), ((v).end())
#define SZ(v)			((int)((v).size()))
#define clr(v, d)		memset(v, d, sizeof(v))
#define has(c,i) 		((c).find(i) != end(c))
#define hastr(s, c)		((s).find(c) != string::npos)

template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v)
    is >> x;
  return is;
}

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int n, m, x;
    ll s = 0;
    cin >> n >> m;
    for(int i = 0; i < m; ++i) {
    	cin >> x;
    	s += x;
    }
    if(s <= n)
    	cout << n - s;
    else
    	cout << -1;


    return 0;
}


Measured memory_bytes: 3616
#coding:utf-8


def  surface(tmp)
	str = String.new
	a = tmp[0]
	b = tmp[1]
	c = tmp[2]
	d = tmp[3]

	if (c==a+8 && d==b+8 && b==a+1 && d==c+1) then str = "A"
	elsif (b==a+8 && c==b+8 && d==c+8 &&a==d-24) then str = "B"
	elsif (b==a+1 && c==b+1 && d==c+1 && a==d-3) then str ="C"	
	elsif (b==a+7 && c==b+1 && d==b+8 && a==d-15) then str = "D"
	elsif (b==a+1 && c==b+8 && d==c+1 && a==d-10) then str = "E"
	elsif (b==a+8 && c==b+1 && d==c+8 && a==d-17) then str = "F"
	elsif (b==a+1 && c==b+6 && d==c+1 && a==d-8) then str = "G"
	end

	return str
end

while !STDIN.eof? do
	pos = Array.new
	tmp = Array.new

	#getting a surface
	0.upto(7) {|i|
		str = gets.chomp.split('').map(&:to_i)
		#行から'1'を探す. 
		pos = str.each_with_index.select{|x| x[0]==1}.map{|x| x[1]}
		if pos.empty? then next end
		
		tmp << pos.map{|x| x+(i*8)}
		
	}
	gets
	
	tmp.flatten!
	puts surface(tmp)
	
	

end

Measured memory_bytes: 6132
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
//#include<algorithm>
//#include<cmath>
//#include<string>
//#include<cctype>
//#include <vector>
using namespace std;
int main() {
	int s,a = 0;
	while (~scanf("%*[^0-9]%d", &s)) a += s;
	cout << a << endl;
	return 0;
}

Measured memory_bytes: 3096
n = int(input())
h = list(map(int, input().split()))

dp = []
for dpi in range(n):
    dp.append(0)

for i in range(n):
    if i == 1:
        dp[i] = abs(h[i] - h[i-1])
    elif i > 1:
        dp[i] = min(dp[i-2] + abs(h[i] - h[i-2]), dp[i-1] + abs(h[i] - h[i-1]))

print(dp[n-1])

Measured memory_bytes: 13928
import numpy as np
s = list(input())
x, y = map(int, input().split())

X = [0]
Y = [0]

X_append = X.append
Y_append = Y.append

flag = True
tmp = 0
for i in s:
    if i == 'F':
        tmp += 1
    else:
        if flag:
            X_append(tmp)
        else:
            Y_append(tmp)
        tmp = 0
        flag = not flag

if flag:
    X_append(tmp)
else:
    Y_append(tmp)

x -= X[1]
X[1] = 0

x = abs(x)
total_X = sum(X)

lst_X = np.zeros(total_X + 1, dtype = np.int32)
lst_X[0] = 1
for i in X:
    if i == 0:
        continue
    lst_X[i:] = np.maximum(lst_X[i:], lst_X[:-i])

if x > total_X or (total_X - x) % 2 == 1 or lst_X[(total_X - x) // 2] == 0:
    print ('No')
    exit()

y = abs(y)
total_Y = sum(Y)

lst_Y = np.zeros(total_Y + 1)
lst_Y[0] = 1
for i in Y:
    if i == 0:
        continue
    lst_Y[i:] = np.maximum(lst_Y[i:], lst_Y[:-i])

if  y <= total_Y and (total_Y - y) % 2 == 0 and int(lst_Y[(total_Y - y) // 2]) == 1:
    print ('Yes')
else:
    print ('No')

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

using namespace std;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) RFOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1 << 30;

template<typename T>
void printv(vector<T> const& s) {
  REP(i, SZ(s)) {
    cout << s[i] << " ";
  }
  cout << endl;
}

int main () {
  cin.tie(0);
  cout << setprecision(10);

  int h, w; cin >> h >> w;
  int n; cin >> n;
  vi a(n);
  REP(i, n) {
    cin >> a[i];
  }
  vi col;
  REP(i, n) {
    REP(j, a[i]) {
      col.pb(i+1);
    }
  }
  vvi c(h);
  REP(i, h) {
    c[i].resize(w);
  }

  REP(i, h*w) {
    if(i / w % 2 == 0) c[i/w][i%w] = col[i];
    else c[i/w][w-1-i%w] = col[i];
  }

  REP(i, h) {
    REP(j, w) {
      cout << c[i][j] << " ";
    }
    cout << endl;
  }
  
}


Measured memory_bytes: 384
#include<iostream>
#include<vector>
using namespace std;
using Edge=pair<int,int>;
using Graph=vector<vector<Edge>>;

int n;
Graph G;
vector<int> ans;

void dfs(int v, int p, int c){
    ans[v]=c;
    for(auto e : G[v]){
        if(e.first==p) continue;
        if(e.second%2==1) dfs(e.first,v,1-c);
        else dfs(e.first,v,c);
    }
}

int main(){
    cin>>n;
    G.resize(n);
    for(int i=0;i<n-1;++i){
        int u,v,w;
        cin>>u>>v>>w;
        --u; --v;
        G[u].push_back(Edge(v,w));
        G[v].push_back(Edge(u,w));
    }

    ans.assign(n,-1);
    dfs(0,-1,0);

    for(int i=0;i<n;++i) cout<<ans[i]<<endl;
}

Measured memory_bytes: 10676
#include<iostream>

using namespace std;

int main(){
	int r=0, c=0, i, j, S = 0;
	int A[100][100];
	int B[100] = {};
	int C[100] = {};
	cin >> r >> c;
	for (i = 0; i < r; i++) {
		for (j = 0; j < c; j++) {
			cin >> A[i][j];
			B[i] += A[i][j];
			cout << A[i][j] << ' ';
		}
		cout << B[i] << endl;
	}
	for (j = 0; j < c; j++) {
		for (i = 0; i < r; i++) {
			C[j] += A[i][j];
		}
		S += C[j];
		cout << C[j] << ' ';
	}
	cout << S << endl;

	return 0;
}



Measured memory_bytes: 3100
import sys

lines = [line for line in sys.stdin]
gs =['S','H','C','D']
js = list(map(str,range(1,14)))
all=[g + " " +j for g in gs for j in js]

for g in lines[1:]:
    g=g.strip()
    all.remove(g)

for g in all:
    print(g)

Measured memory_bytes: 7496
import java.io.*;

class Main{
    public static void main(String args[]) throws IOException{

	int byo=0;
	int h=0;
	int m=0;
	int s=0;

	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	String str = br.readLine();

	byo=Integer.parseInt(str);
	h=byo/3600;
	byo=byo-(h*3600);
	m=byo/60;
	byo=byo-(m*60);
	s=byo;
	System.out.println(h+":"+m+":"+s);
    }
}

Measured memory_bytes: 16920
#include<bits/stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("Ofast")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;

typedef pair<int,int>pi;
typedef vector<int>vi;

const int MAXN=100005;
const int MOD=1000000007;

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define DEC(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define mp make_pair
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define db(x) cerr<<#x<<" = "<<x<<"\n"
#define LOW(v,x) (lower_bound(all(v),(x))-(v).begin())
#define UP(v,x) (upper_bound(all(v),(x))-(v).begin())

int N,K,P[MAXN];
main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin>>N>>K;
	FOR(i,1,N)cin>>P[i];
	int ans=0;
	sort(P+1,P+1+N);
	FOR(i,1,K) ans+=P[i];
	cout<<ans;
}


Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
#define all(x) (x).begin(), (x).end()

int main(){
    int N;
    cin >> N;
    int x[N];
    for(int i = 0; i < N; i++){
        cin >> x[i];
    }
    sort(x, x + N);
    cout << (x[N - 1] - x[0] + 1) / 2 << endl;
}





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

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

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

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



signed main(){

    int N; cin >> N;
    Out((N + 1) / 2);

    return 0;
}


Measured memory_bytes: 256