akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
#define INF (1LL << 30)
using namespace std;
typedef long long ll;

ll N, A[100000];

int main(void) {
  cin >> N;
  REP(i, 0, N) cin >> A[i];

  ll d = 0, ans = 1, cnt = 0;
  REP(i, 1, N) {
    if(A[i - 1] == A[i]) continue;
    if(A[i - 1] < A[i]) {
      if(d == 1) cnt++;
      else cnt = 2, d = 1;
    }
    if(A[i - 1] > A[i]) {
      if(d == -1) cnt++;
      else cnt = 2, d = -1;
    }
    ans = max(ans, cnt);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3876
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <cmath>
#include <tuple>
using namespace std;

struct UnionFind {
    vector<int> parent;

    UnionFind(int n) : parent(n) {
        for (int i = 0; i < n; i++) parent[i] = i;
    }

    int root(int x) {
        if (parent[x] == x) return x;
        else return parent[x] = root(parent[x]);
    }

    void unite(int x, int y) {
        int rootX = root(x);
        int rootY = root(y);
        if (rootX == rootY) return;
        parent[rootX] = rootY;
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }
};

int main() {
    int n, m;
    cin >> n >> m;

    int p[n];
    for (int i = 0; i < n; i++) { 
        cin >> p[i];
        --p[i];
    }

    UnionFind tree(n);
    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;

        --x, --y;
        tree.unite(x, y);
    }

    int res = 0;
    for (int i = 0; i < n; i++) {
        if (tree.same(i, p[i])) ++res;
    }

    cout << res << endl;
}


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

#define ff first
#define ss second
#define pb push_back
#define ll long long
#define ull unsigned long long
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define mst(ss,b) memset(ss,b,sizeof(ss));
#define dbg(x) cout << #x << "= " << x << endl;
typedef pair <int, int> pii;
const int inf = 0x3f3f3f3f;
const ll INF = (1LL<<62)-1;
const ll mod = 1e9+7;
const int N = 1e5+5;

int n;
int cnt[N];
int a[N];

ll pow_mod(ll x, ll n){
    ll ret=1;
    while(n){
        if(n&1)ret=ret*x%mod;
        x=x*x%mod;
        n>>=1;
    }
    return ret;
}

int  main(){
    scanf("%d", &n);
    int num;
    for(int i=1; i<=n+1; i++){
        scanf("%d", &a[i]);
        cnt[a[i]]++;
        if(cnt[a[i]] == 2)num = n+1-i;
    }
    for(int i=1; i<=n; i++){
        if(cnt[a[i]] == 2){
            num += i-1;
            break;
        }
    }
    ll fi = n+1, se = 1;
    printf("%lld\n", (fi-se+mod)%mod);
    for(int i=2; i<=n+1; i++){
        fi = (fi*(n+2-i)%mod)*pow_mod(i, mod-2)%mod;
        se = (se*(num+2-i)%mod)*pow_mod(i-1, mod-2)%mod;
        printf("%lld\n", (fi-se+mod)%mod);
    }
    return 0;
}


//    lower_bound()
//    __builtin_popcount()
//    ios::sync_with_stdio(false);
//    freopen("in.txt","r",stdin);
//    freopen("out.txt","w",stdout);
//    const double eps=1e-12;
//    #pragma comment(linker,"/STACK:102400000,102400000")



Measured memory_bytes: 2048
// ABC_149_C

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

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

	int ans = 0;
	bool flag = true;

	const int lim = 2 * n;
	for(int i = n; i < lim; ++i) {
		for(int j = 2; j * j <= i; ++j) {
				if(i % j != 0) continue;
				else {
				flag = false;
				break;
				}
		} 

		if(flag) {
			ans = i;
			break;
		}	
		else flag = true;
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 256
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
using ll = long long;
using P = pair<ll,ll>;

int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
string s;
cin >> s;
string no_x_s;
rep(i,(ll)(s.size())) {
    if (s[i] != 'x')
        no_x_s = no_x_s + s[i];
}
string tmp = no_x_s;
reverse(tmp.begin(),tmp.end());
if(no_x_s != tmp){
    cout << -1 << endl;
    return 0;
}
deque<char> dq;
rep(i,s.size()) {
    dq.push_back(s[i]);
}
ll ans = 0;
while(!dq.empty()){
    if(dq.front() == 'x' && dq.back() != 'x'){
        dq.push_back('x');
        ans++;
    }
    else if(dq.front() != 'x' && dq.back() == 'x'){
        dq.push_front('x');
        ans++;
    }else{
        if(dq.size() >= 2) {
            dq.pop_front();
            dq.pop_back();
        }else{
            break;
        }
    }
}
cout << ans << endl;
}

Measured memory_bytes: 4140
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}

int main(){
  int n;
  cin >> n;
  int x[n];
  int y[n];
  int h[n];
  for(int i = 0; i < n; i++){
    cin >> x[i] >> y[i] >> h[i];
  }

  for(int cx = 0; cx <= 100; cx++){
    for(int cy = 0; cy <= 100; cy++){
      int prevH;
      bool flag = true;
      bool firstPrevH = false;
      for(int i = 0; i < n; i++){
        if(firstPrevH == false && h[i] != 0){
          prevH = h[i] + abs(x[i] - cx) + abs(y[i] - cy);
          firstPrevH = true;
        }else{
          if(h[i] == 0 || prevH == h[i] + abs(x[i] - cx) + abs(y[i] - cy)) continue;
          else flag = false;
        }

      }
      if(flag){
        if(firstPrevH){
          bool flag2 = true;
          for(int i = 0; i < n; i++){
            if(h[i] == max(0, prevH - abs(x[i] - cx) - abs(y[i] - cy))) continue;
            else flag2 = false;
          }
          if(flag2) cout << cx << ' ' << cy << ' ' << prevH << endl;

        }
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
n = int(input())
t = []
x = []
y = []
for i in range(n):
	ttemp,xtemp,ytemp = map(int,input().split())
	t.append(ttemp)
	x.append(xtemp)
	y.append(ytemp)
check = True
nowx = 0
nowy = 0
for i in range(n):
	disx = x[i] - nowx
	disy = y[i] - nowy
	total = disx + disy
	if i == 0:
		if t[i] >= total and (t[i]%2 == total%2):
			nowx = x[i]
			nowy = y[i]
		else:
			check = False
			break
	else:
		if (t[i]-t[i-1]) >= total and ((t[i]-t[i-1])%2 == total%2):
			nowx = x[i]
			nowy = y[i]
		else:
			check = False
			break
if check:
	print('Yes')
else:
	print('No')

Measured memory_bytes: 11836
#include <iostream>
#include <vector>
#include <algorithm>
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());
    double m;
    if (a[n-1] % 2 == 0) {
        m = a[n-1] / 2.0;
    } else {
        m = (a[n-1] + 1) / 2.0;
    }
    int ans = a[0];
    for (int i = 0; i < n; i++) {
        if (max((double)ans - m, m - (double)ans) > max((double)a[i] - m, m - (double)a[i])) ans = a[i];
    }
    cout << a[n-1] << ' ' << ans << endl;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <math.h>

int main(){
	long N,A[100000],result=1,flag=1;
	scanf("%ld",&N);
	for(int i=0;i<N;i++){
		scanf("%ld",&A[i]);
		if(A[i]==0){
		printf("0");
		return 0;
		}
		if(1>(long)1e18/result/A[i]){
			flag=0;
		}
		else result=result*A[i];
	}
	if(flag==0)puts("-1");
	else printf("%ld\n",result);
  	return 0;
}

Measured memory_bytes: 2448
#include <stdio.h>

int main(void){
    int r, c;
    int j, q, k;
    int table[100][100];
    int csum, rsum[100] = {};
    int xsum = 0;
    
    scanf("%d %d", &r, &c);
    for(j = 0; j < r; j++){
        for(q = 0; q < c; q++){
            scanf(" %d", &table[j][q]);
        }
    }
    for(j = 0; j < r; j++){
        csum = 0;
        for(q = 0; q < c + 1; q++){
            if(1 <= q && q < c)
                printf(" ");
            if(q == c){
                for(k = 0; k < c; k++){
                    csum += table[j][k];
                }
                printf(" %d\n", csum);
                xsum += csum;
                //printf("%d\n", xsum);
            }else
                printf("%d", table[j][q]);
                rsum[q] += table[j][q];
        }
    }
    for(j = 0; j < c + 1; j++){
        if(1 <= j && j < c)
            printf(" ");
        if(j == c)
            printf(" %d\n", xsum);
        else
            printf("%d", rsum[j]);
    }
    return 0;
}



Measured memory_bytes: 2060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,1,-1,1,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}
ll modpow(long long a, long long n, long long mod2) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod2;
        a = a * a % mod2;
        n >>= 1;
    }
    return res;
}

int main() {
    int n,ans = 0,tmp = 0;
    cin >> n;
    vector<int> h(n);
    for (int i = 0; i < n; ++i) {
        cin >> h[i];
    }
    for (int i = 0; i < n-1; ++i) {
        if(h[i] >= h[i+1]){
            tmp++;
            ans = max(ans,tmp);
        }
        else{
            tmp = 0;
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main( )
{
    long long int r, d, x;

    cin >> r >> d >> x;

    for (int i = 1; i <= 10; i++)
    {
        x = r * x - d;
        cout << x << "\n";
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;
ll p = 1000000007ll;

int main(void)
{
  string s;
  cin >> s;
  int n = s.size() + 1;
  vector<ll> la(n,0),ra(n,0);
  REP(i,n-1)
    if(s[i]=='<') la[i+1] = la[i]+1;
    else la[i+1] = 0;
  REP(i,n-1)
    if(s[n-2-i]=='>') ra[n-2-i] = ra[n-1-i]+1;
    else ra[n-2-i] = 0;
  ll answer = 0;
  REP(i,n) answer += max(la[i],ra[i]);
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 8708
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)
#define Yes(condition) if(condition) cout << "Yes" << '\n'; else{ cout << "No" << '\n'; }
#define YES(condition) if(condition) cout << "YES" << '\n'; else{ cout << "NO" << '\n'; }
#define yes(condition) if(condition) cout << "yes" << '\n'; else{ cout << "no" << '\n'; }




int main() {
    ll n, t;
    cin >> n >> t;
    ll ans = INF;
    REP(i, n){
        ll a, b;
        cin >> a >> b;
        if(b <= t){
            ans = min(ans, a);
        }
    }
    if(ans != INF){
        cout << ans << endl;
    }
    else{
        cout << "TLE" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string s;
    cin >> s;
    rep(bit, 1<<3) {
        string ans;
        int sm = 0;
        ans += s[0];
        sm += s[0] - '0';
        rep(i, 3) {
            if (bit>>i&1) {
                ans += '+';
                ans += s[i+1];
                sm += s[i+1] - '0';
            } else {
                ans += '-';
                ans += s[i+1];
                sm -= s[i+1] - '0';
            }
        }
        if (sm == 7) {
            ans += "=7";
            cout << ans << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#-*- coding: utf-8 -*-
"""
oj dl https://atcoder.jp/contests/abc116/tasks/abc116_b -d test-b
oj test -d test-c -c "python abc116c.py"
oj test -d test-b -c "python abc116b.py" test-b/sample-3.in
"""

from collections import defaultdict
import sys
import math
import time
import itertools

#累積和
def deco(func):
    def wrapper(*args, **kwargs):
        s = time.time()
        #print('--start--')
        ret = func(*args, **kwargs)
        logging.debug('--end in %f --' % (time.time() - s) )
        return ret
    return wrapper


@deco
def sol(S):
    zeroFirst= 0
    oneFirst = 0
    for i, s in enumerate(S):
        expected = '0' if i % 2 else '1'
        # 0 -> 0, 1 -> 1, 2 -> 0, 3-> 1
        logging.debug("expected {} and s {} zeroFirst {}, oneFirst {}".format(
            expected, s, zeroFirst, oneFirst
        ))
        if s == expected:
            oneFirst+=1
        else:
            zeroFirst+=1

    logging.debug("zeroFirst {}, oneFirst {}".format(zeroFirst, oneFirst))
    return min(oneFirst, zeroFirst)






import logging

do_submit = False
do_submit = True

if do_submit:
    logging.basicConfig(level=logging.ERROR, format="%(message)s")
else:
    logging.basicConfig(level=logging.DEBUG, format="%(message)s")
def input_parse(input_str):
    lines = [x.strip() for x in input_str.split("\n") if x.strip()]
    parsed_lines = [list(line.split()) for line in lines]
    (S) = parsed_lines[0][0]
    return (S)



if not do_submit:
    (S) = input_parse("""
    10010010
    """)
    print (sol(S))

    (S) = input_parse("""
    000
    """)
    print (sol(S))

else:
    str = ""
    str = input().strip()
    (S) = input_parse(str)
    print (sol(S))







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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

#define X first
#define Y second

//#include <boost/unordered_map.hpp>
//using namespace boost;

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

namespace io{
	const int L = (1 << 18) + 1;
	
	char buf[L], *S , *T, c;
	 
	char getchar() {
		if(S == T) {
			T = (S = buf) + fread(buf, 1, L, stdin);
			return (S == T ? EOF : *S++);
		}
		return *S++;
	}
	
	int inp() {
		int x = 0, f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}
	
	ll inp_ll() {
		ll x = 0; int f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}
	
	char B[25], *outs=B+20, *outr=B+20;
	template<class T>
	inline void print(register T a,register char x=0){
		if(x) *--outs = x, x = 0;
		
		if(!a)*--outs = '0';
		else 
			while(a)
				*--outs = (a % 10) + 48, a /= 10;
		
		if(x)
			*--outs = x;
		
		fwrite(outs, outr - outs , 1, stdout);
		outs = outr;
	}
};

using io :: print;
using io :: inp;
using io :: inp_ll;

const int MAXN = 110;

int n;
vector<int> v[MAXN];
pair<ull, ull> ans(MAXN, 0);

int u[MAXN], cnt[MAXN], most[MAXN];

void check(int r, int s)
{
	for (int i = 1; i <= n; ++ i)
	{
		u[i] = 0;
		cnt[i] = 0;
		most[i] = 0;
	}
	queue<int> q;
	int c = 1;
	if (s != -1)
	{
		q.push(r);
		q.push(s);
		u[r] = u[s] = 1;
	}
	else
	{
		q.push(r);
		u[r] = 1;
	}
	while (!q.empty())
	{
		int x = q.front();
		q.pop();
		for (auto y : v[x])
			if (!u[y])
			{
				u[y] = u[x]+1;
				cnt[x] ++;
				c = max(c, u[y]);
				q.push(y);
			}
	}
	for (int i = 1; i <= n; ++ i)
		most[u[i]] = max(most[u[i]], cnt[i]);
	ull tmp = (s == -1) ? 1 : 2;
	for (int i = 1; i < c; ++ i)
		tmp *= most[i];
	ans = min(ans, pair<ull, ull>(c, tmp));
}

int main()
{
	
	n = inp();
	for (int i = 1; i < n; ++ i)
	{
		int x = inp();
		int y = inp();
		v[x].push_back(y);
		v[y].push_back(x);
	}
	for (int r = 1; r <= n; ++ r)
	{
		check(r, -1);
		for (auto s : v[r])
			check(r, s);
	}
	cout << ans.X << " " << ans.Y << endl;
	
	return 0;
}


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

int main(){
    int arr[101];
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
    }
    sort(arr, arr + n);
    int sum = 0;
    int k = 1;
    for (int i = n - 1; i >= 0; i--) {
        sum += arr[i] * k;
        k *= -1;
    }
    cout << sum << endl;
    
}


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

bool solve() {
    string S;
    cin >> S;
    int i = 0;
    while ( i < S.size() && S[i] != 'C' ) i++;
    i++;
    while ( i < S.size() && S[i] != 'F' ) i++;
    return i < S.size();
}

int main() {
    string ans = solve() ? "Yes" : "No";
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
//Marks

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using p = pair<ll,ll>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    int n,k;cin>>n>>k;
    vecrep(n,a,int);
    rep(i,k,n){
        if(a[i]>a[i-k])cout<<"Yes"<<nnn;
        else cout<<"No"<<nnn;
    }
    return 0;
}

Measured memory_bytes: 4840
# Node
class Node
  attr_accessor :id, :parent, :left, :right

  def initialize(id, parent = nil, left = nil, right = nil)
    @id, @parent, @left, @right = id, parent, left, right
  end
end

# BinaryTree
class BinaryTree
  attr_accessor :nodes

  def initialize(data)
    @nodes = data.each_with_object({}) do |(key, value), hash|
      hash[key] = Node.new(key, value[:parent], value[:left], value[:right])
    end
  end

  def depth(id)
    node = @nodes[id]
    unless node.parent.nil?
      return depth(node.parent) + 1
    else
      return 0
    end
  end

  def root?(id)
    node = @nodes[id]
    node.parent.nil?
  end

  def leaf?(id)
    children(id).empty?
  end

  def sibling(id)
    parent = @nodes[id].parent
    unless parent.nil?
      s = children(parent).select { |child| id != child }
      return s.any? ? s.shift : -1
    end
    -1
  end

  def degree(id)
    children(id).length
  end

  def height(id)
    c = children(id)
    unless c.empty?
      heights = []
      c.each do |child|
        heights << height(child) + 1
      end
      return heights.max
    else
      return 0
    end
  end

  private

  def children(id)
    node = @nodes[id]
    [node.left, node.right].select { |i| i != -1 }
  end
end

data = {}
parent = {}

n = gets.chop.to_i

n.times do
  id, left, right = gets.chop.split.map(&:to_i)
  data[id] = { :left => left, :right => right }
  parent[left] = parent[right] = id
end

data.each do |key, value|
  value[:parent] = parent[key]
end

data = Hash[data.sort]

t = BinaryTree.new(data)

t.nodes.each do |id, node|
  out = []
  out << "node #{id}: parent = " + (!node.parent.nil? ? node.parent : -1).to_s
  out << "sibling = " + t.sibling(id).to_s
  out << "degree = " + t.degree(id).to_s
  out << "depth = " + t.depth(id).to_s
  out << "height = " + t.height(id).to_s
  out << (t.root?(id) ? "root" : t.leaf?(id) ? "leaf" : "internal node").to_s
  puts out.join(', ')
end

Measured memory_bytes: 6148
/*ॐ नमो भगवते वासुदेवाय नमः*/
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define allrev(x) (x).rbegin(), (x).rend()
#define pb push_back
#define pf push_front
#define fori(i, a, n) for(int i = a; i < n; ++i)
#define MAX(x) (*max_element(all(x)))
#define MIN(x) (*min_element(all(x)))
#define sortarr(a, n) sort(a, a + n)
#define sortvec(V) sort(all(V))

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

typedef unordered_map<int, int, custom_hash> u_map;
typedef unordered_set<int, int, custom_hash> u_set;
typedef vector<int> V;
typedef pair<int , int> pairi;
typedef set<int> seti;
typedef priority_queue<int> p_queue;
typedef deque<int> deqi;

const int MOD = 1e9+7;
const int INF = 1e9+8;
const double pi = 3.14159265359;

int binpow(int a, int b, int m) {
    a %= m;
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

void solve()
{
    int N, R;
    cin >> N >> R;
    if(N >= 10) cout << R << endl;
    else{
        cout << R + 100 * (10 - N) << endl;
    }
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    solve();
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n ";
}

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

int main() {
    int N; cin >> N;
    vector<int> L(N);
    for(int i = 0; i < N; ++i) cin >> L[i];
    
    sort(L.begin(), L.end());
    
    int res = 0;
    for(int i = 0; i < N-1; ++i) {
        for(int j = i+1; j < N; ++j) {
            int it = lower_bound(L.begin(), L.end(), L[i] + L[j]) - L.begin();
            res += it - 1 - j;
        }
    }
    cout << res << endl;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for (int i = a; i < b; i++)
#define each(i, mp) for(auto& i:mp)

int main() {
  int x, y, z;
  cin >> x >> y >> z;
  // string s;
  // cin >> s;
  int tmp;
  tmp = x;
  x = y;
  y = tmp;
  tmp = z;
  z = x;
  x = tmp;
  // ll ans = 0;
  cout << x << " "<< y << " "<< z << endl;
  return 0;
}


Measured memory_bytes: 256
from heapq import heappush, heappop

N = int(input())
A = [int(input()) for i in range(N)]
hq = []
for i in range(N):
    heappush(hq, -A[i])
max1 = -heappop(hq)
max2 = -heappop(hq)
ans = [0] * N
for i in range(N):
    if A[i] == max1:
        ans[i] = max2
    else:
        ans[i] = max1
print(*ans, sep="\n")


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

using i32 = int_fast32_t;
using i64 = int_fast64_t;

struct unionfind {
    vector<i32> p, s;
    i32 g;

    unionfind(i32 n): p(n), s(n, 1), g(n) {
        iota(begin(p), end(p), 0);
    }

    i32 find(i32 n) {
        return p[n] == n ? n : p[n] = find(p[n]);
    }

    void unite(i32 n, i32 m) {
        n = find(n), m = find(m);
        if (n == m) return;
        if (s[n] < s[m]) swap(n, m);
        s[n] += s[m];
        p[m] = n, g--;
    }

    i32 size(i32 n) {
        return s[find(n)];
    }

    bool same(i32 n, i32 m) {
        return find(n) == find(m);
    }
};

int main() {
    i32 n, m;
    cin >> n >> m;
    unionfind t(n);
    i32 ans = 0;
    for (i32 i = 0; i < m; i++) {
        i32 x, y, z;
        cin >> x >> y >> z;
        t.unite(x, y);
    }

    cout << t.g << endl;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
char ax[100000+100];
int dp[100000+100][3];
int main(){
    scanf("%s",ax+1);
    int len = strlen(ax+1);
    int ans = 0;
    int j = ax[1]-'0';
    dp[1][j] = 0,dp[1][1-j] = 1;
    for(int i = 2;i<=len;i++){
        int j = ax[i]-'0';
        dp[i][j] = min(dp[i-1][1-j],dp[i-1][j]+i-1);
        dp[i][1-j] = min(dp[i-1][j]+1,dp[i-1][1-j]+i);
    }
    ans = min(dp[len][0],dp[len][1]);
    printf("%d\n",ans);
    return 0;
}


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

#define int long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double pi = 3.1415926535897932384626433832795028L;
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int A, B;
signed main() {
    cin >> A >> B;
    rep(i, 11000) {
        if (i * 8 / 100 == A && i * 10 / 100 == B) { fin(i); }
    }
    cout << -1 << endl;
}

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

int main(){
	string str;
	cin>>str;
	int i,j=-1,k=-1;
	for(i=0;i<str.size();i++){
		if(str[i]=='C'&&j==-1) j=i;
		if(str[i]=='F') k=i;
	}
	if(k!=-1&&j!=-1&&j<k) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<utility>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<cstring>
#define ma 100001
#define mod 1000000007
#define ll long long int
using namespace std;
int main(){
	ll n=0,m=0;
	cin >> n >> m;
	string str[n];
	for(int i=0;i<n;i++){
		cin >> str[i];
	}
	char s[n+1][m+1];
	for(int i=0;i<=n;i++){
		s[i][0]='#';
	}
	for(int i=0;i<=m;i++){
		s[0][i]='#';
	}
	for(int i=1;i<n+1;i++){
		for(int j=1;j<m+1;j++){
			s[i][j]=str[i-1][j-1];
		}
	}
	int k[n+1][m+1];
	memset(k,0,sizeof(k));
	k[1][1]=1;
	for(int i=0;i<=n;i++){
		for(int j=0;j<=m;j++){
			if(s[i][j]=='#'){
				k[i][j]=-1;
			}
			else if(s[i-1][j]!='#' && s[i][j-1]!='#'){
				k[i][j]=(k[i-1][j]+k[i][j-1])%mod;
			}
			else if(s[i-1][j]!='#' && s[i][j-1]=='#'){
				k[i][j]=k[i-1][j];
			}
			else if(s[i-1][j]=='#' && s[i][j-1]!='#'){
				k[i][j]=k[i][j-1];
			}
		}
	}
	cout << k[n][m];
	return 0;
}

Measured memory_bytes: 6144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define INF 1e9

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

    int N;
    cin >> N;

    int hyaku = N / 100;
    int jyu = (N / 10) % 10;
    int ichi = N % 10;
    int ans;

    if (hyaku > jyu) {
        ans = hyaku;
    } else if (hyaku < jyu) {
        ans = hyaku + 1;
    } else {
        if (jyu >= ichi) ans = hyaku;
        else ans = hyaku + 1;
    }

    ans = ans*100 + ans*10 + ans;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long x, yokin;
  int i;
  cin>>x;
  yokin = 100;
  for(i=0;yokin<x;i++){
    yokin = yokin * 1.01;
  }
  
  cout<< i<< "\n";
return 0;
}

Measured memory_bytes: 3624
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <climits> // FOO_MAX, FOO_MIN
#include <cmath> 
#include <cstdlib> // abs(int)
#include <numeric>
#include <iomanip>
#include <map>

using namespace std;

#define roundup(n,d) ( ((n) + ((d)-1)) / (d) )
#define assign_max(into, compared) (into = max((into), (compared)))
#define assign_min(into, compared) (into = min((into), (compared)))
#define rep(i,n) for(long long i = 0;i < n;++i)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(nullptr);
#define fix(n) fixed << setprecision(n)
#define ALL(v) v.begin(),v.end()

#define PI 3.14159265358979323846;

using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;


int main(void){
    FAST_IO
    ll h,w;
    cin >> h >> w;
    vector<vector<char>> c (h+2, vector<char>(w+2));

    rep(i,h){
        rep(j,w) cin >> c[i+1][j+1];
    }


    for(ll i = 1;i < h+1;i++){
        for(ll j = 1;j < w+1;j++){
            if(c[i][j] == '#'){
                if(c[i+1][j] == '.' &&
                    c[i-1][j] == '.' &&
                    c[i][j-1] == '.' &&
                    c[i][j+1] == '.'){
                    
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }

    cout << "Yes" << endl;
    return 0;
}

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef pair<int,int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define EXIST(m,v) (m).find((v)) != (m).end()
#define LB(a,x) lower_bound((a).begin(), (a).end(), x) - (a).begin()
#define UB(a,x) upper_bound((a).begin(), (a).end(), x) - (a).begin()

#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)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

#define en 


constexpr double EPS = 1e-9;
constexpr double PI  = 3.1415926535897932;
constexpr int INF = 2147483647;
constexpr long long LINF = 1LL<<60;
constexpr long long MOD = 1000000007;

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

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}

void Main() {
    long long N;
    cin >> N;
    int ans = 0;
    FOR(i, 1, N) {
        const auto &pf = prime_factorize(N-i);
        long long res = 1;
        for (auto p : pf) res *= p.second + 1;
        ans += res;
    }
    cout << ans << endl;
}

int main(void){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);cout<<fixed<<setprecision(15);
    int t=1; //cin>>t;
    REP(_,t) Main();
    return 0;
}



Measured memory_bytes: 3652
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    LL r,d,x;
    cin>>r>>d>>x;
    REP(i,10){
        x = r * x - d;
        PUTS(x);
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n,i,j,k,f;
  vector<int> a(10001);
  cin>>n;
  for(i=1;i<=100;i++){
    for(j=1;j<=100;j++){
      for(k=1;k<=100;k++){
        f=i*i+j*j+k*k+i*j+j*k+k*i;
        if(f<=10000) a.at(f)++;
      }
    }
  }
  for(i=1;i<=n;i++) cout<<a.at(i)<<endl;
}

Measured memory_bytes: 3656
import math

inp = str(input())
inp = inp.split()

a,b,h,m = inp[0],inp[1],inp[2],inp[3]
a = int(a)
b = int(b)
h = int(h)
m = int(m)

minangle = m/60*2*math.pi
hourangle = h/12*2*math.pi + m/60*2*math.pi/12
angle = abs(minangle - hourangle)

if angle > math.pi:
    angle = 2*math.pi - angle

c2 = a**2 + b**2 -2*a*b*math.cos(angle)
c = math.sqrt(c2)

print(c)

Measured memory_bytes: 9468
import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.complex;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

const real eps = 1e-10;

const long p = 1_000_000_000 + 7;

void main(){
    auto n = readLong();
    auto a = readLongs();
    auto count = new long[](200000);
    foreach(ai; a) {
        count[ai]++;
    }
    long ans = 0;
    foreach(i; iota(1, 150000)) {
        ans = max(ans, count[i-1] + count[i] + count[i+1]);
    }
    writeln(ans);
}



Measured memory_bytes: 6960
import sys
sys.setrecursionlimit(4100000)

_input = [i for i in open(0).read().split('\n') if i]
n, k = [int(i) for i in _input[0].split()]
edge = tuple([tuple([int(p) for p in i.split()]) for i in _input[1:n]])

factorial = [0] * (k + 1)
inverse = [0] * (k + 1)
MOD = 1000000007

# Ref: http://keita-matsushita.hatenablog.com/entry/2016/12/05/175024
def mod_pow1(n, k, mod):
    a = 1
    while k:
        if (k & 1) == 1:
            a = (a * n) % mod
        n = (n * n) % mod
        k >>= 1
    return a

# Ref: https://www.smartbowwow.com/2018/10/mod1097.html
def mod_pow2(n, k, mod):
    if k == 0:
        return 1
    if k % 2 == 0:
        a = mod_pow2(n, k // 2, mod)
        return (a * a) % mod
    else:
        return (n * mod_pow2(n, k - 1, mod)) % mod

#mod_pow = mod_pow1
# It's better to use built-in function for speed.
mod_pow = pow

def mod_factorial_inverse(k, mod):
    factorial[0] = 1
    inverse[0] = 1

    # Ref: http://keita-matsushita.hatenablog.com/entry/2016/12/05/184011
    for i in range(1, k + 1):
        factorial[i] = ((i * factorial[i - 1]) % mod) # factrial[i]
        inverse[i] = mod_pow(factorial[i], mod - 2, mod) # inverse[i]
 
total = 1

if not edge:
    print(k)
else:
    all_edge = tuple([[] for _ in range(n + 1)])
    for e in edge:
        all_edge[e[0]].append(e[1])
        all_edge[e[1]].append(e[0])
    all_edge = [set(v) for v in all_edge]

    if [v for v in all_edge if len(v) >= k]:
        print(0)
    else:
        mod_factorial_inverse(k, MOD)

        root = edge[0]
        total = (factorial[k] * inverse[k - len(all_edge[root[0]]) - 1]) % MOD

        def dfs(current, from_):
            global total
            child = all_edge[current]
            if len(child) - 1 > 0:
                total = (total * factorial[k - 2] * inverse[k - 2 - (len(child) - 1)]) % MOD
            for c in child:
                if c != from_:
                    dfs(c, current)
        for c in all_edge[root[0]]:
            dfs(c, root[0])
        print(total)


Measured memory_bytes: 112244
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>

using namespace std;
typedef long long ll;
const int LEN = 100000;

struct fastio{
  int it,len;
  char s[LEN + 5];
  fastio(){
    it = len = 0;
  }
  char get(){
    if(it < len) return s[it++];
    it = 0, len = fread(s,1,LEN,stdin);
    return len ? s[it++] : EOF;
  }
  bool notend(){
    char c;
    for(c = get();c == ' ' || c == '\n';c = get());
    if(it) it--;
    return c != EOF;
  }
  void put(char c){
    if(it == LEN) fwrite(s,1,LEN,stdout), it = 0;
    s[it++] = c;
  }
  void flush(){
    fwrite(s,1,it,stdout);
  }
}buff,bufo;
inline int getint(){
  char c; int res = 0, sig = 1;
  for(c = buff.get();c < '0' || c > '9';c = buff.get()) if(c == '-') sig = -1;
  for(;c >= '0' && c <= '9';c = buff.get()) res = res * 10 + (c - '0');
  return sig * res;
}
inline ll getll(){
  char c; ll res = 0, sig = 1;
  for(c = buff.get();c < '0' || c > '9';c = buff.get()) if(c == '-') sig = -1;
  for(;c >= '0' && c <= '9';c = buff.get()) res = res * 10 + (c - '0');
  return sig * res;
}
inline void putint(int x,char suf){
  if(!x) bufo.put('0');
  else{
    if(x < 0) bufo.put('-'), x = -x;
    int k = 0; char s[15];
    while(x){
      s[++k] = x % 10 + '0';
      x /= 10;
    }
    for(;k;k--) bufo.put(s[k]);
  }
  bufo.put(suf);
}
inline void putll(ll x,char suf){
  if(!x) bufo.put('0');
  else{
    if(x < 0) bufo.put('-'), x = -x;
    int k = 0; char s[25];
    while(x){
      s[++k] = x % 10 + '0';
      x /= 10;
    }
    for(;k;k--) bufo.put(s[k]);
  }
  bufo.put(suf);
}
inline char get_char(){
  char c;
  for(c = buff.get();c == ' ' || c == '\n';c = buff.get());
  return c;
}
#define maxn 100005
#define maxV 200005
int n,h,w,par[maxV];
bool loop[maxV];
void ini(int x){
  for(int i = 1;i <= x;i++) par[i] = i;
}
int fin(int u){
  if(par[u] == u) return u;
  return par[u] = fin(par[u]);
}
bool uni(int u,int v){
  u = fin(u), v = fin(v);
  if(u == v){
    if(!loop[u]){
      loop[u] = true;
      return true;
    }
    return false;
  }
  if(!loop[u] && !loop[v]){
    par[u] = v;
    return true;
  }
  if(!loop[u] || !loop[v]){
    par[u] = v;
    loop[v] = true;
    return true;
  }
  return false;
}
struct edge{
  int u,v,w;
  bool operator < (const edge &e){
    return w > e.w;
  }
}el[maxn];
int main(){
  n = getint(), h = getint(), w = getint();
  ini(h + w);
  for(int i = 1;i <= n;i++){
    el[i].u = getint(), el[i].v = h + getint(), el[i].w = getint();
  }
  sort(el + 1,el + n + 1);
  ll ans = 0;
  for(int i = 1;i <= n;i++){
    ans += uni(el[i].u,el[i].v) * el[i].w;
  }
  putll(ans,'\n');
  bufo.flush();
  return 0;
}


Measured memory_bytes: 2688
#include<iostream>
#include<cstring>
#include<vector>
#include<math.h>
#include<algorithm>
using namespace std;
//int dp[1001][1001][1001];

//long long int DP(int n, int m, int l);
//int dp2[1001][1001][1001];

//long long int DP2(int n, int m, int l);
//long long int MOD = 1000000007;
int main() {

	//F
	/*memset(dp, -1, sizeof(dp));
	int n, m, l;
	cin >> n >> m >> l;
	cout << DP(n, m, l) << endl;
	return 0;*/

	//D
	vector<pair <long long int, long long int>> pairs;
	long long int h, w;
	int a, b;
	cin >> h >> w;
	long long int counter[10];
	counter[0] = (h - 2) * (w - 2);
	int i, j, k;
	for (i = 1; i < 10; i++)counter[i] = 0;
	int n;
	cin >> n;
	//int a, b;
	//cout << "a";
	for (i = 0; i < n; i++) {
		cin >> a >> b;
		for (j = max(a - 2, 1); j <= min(a, (int)(h-2)); j++) {
			for (k = max(b - 2, 1); k <= min(b, (int)(w - 2)); k++) {
				pairs.push_back(pair<long long int, long long int>(j, k));
			}
				
		}
	}
	//cout << "i";
	sort(pairs.begin(), pairs.end());
	if (pairs.size() == 0) {
		for (i = 0; i < 10; i++) {
			cout << counter[i] << endl;
		}
		return 0;

	}
	//cout << "u";
	//cout << pairs[0].first << ' ' << pairs[0].second << endl;
	pair<long long int, long long int>pp = pairs[0];
	//cout << "e";
	int c = 1;
	for (i = 1; i < pairs.size(); i++) {
		if (pairs[i] == pp) {
			c++;
		}
		else {
			counter[c]++;
			c = 1;
			pp = pairs[i];
		}
	}
	
	counter[c]++;
	for (i = 1; i < 10; i++) {
		counter[0] = counter[0] - counter[i];
	}
	for (i = 0; i < 10; i++) {
		cout << counter[i] << endl;
	}
	return 0;

	//C
	/*
	long long int sum = 0;
	string s;
	cin >> s;
	int i;
	int bin[10] = { 1,2,4,8,16,32,64,128,256,512 };
	int j;
	long long int k;
	for (i = 0; i < bin[s.size() - 1]; i++) {
		k = (s[0] - '0');
		for (j = 0; j < s.size() - 1; j++) {
			if ((i ^ bin[j]) == (i + bin[j])) {
				sum = sum + k;
				//cout << k << endl;
				k = (s[j + 1] - '0');
			}
			else {
				k = k * 10;
				k = k + (s[j + 1] - '0');
			}
		}
		sum = sum + k;
		//cout << k << endl;
	}
	cout << sum << endl;
	return 0;
	*/
}
/*long long int DP(int n, int m, int l) {

	if (dp[n][m][l] >= 0)return dp[n][m][l];
	int i;
	long long int d;
	if (n == 0) {
		d = 1;
		for (i = 0; i < m + l; i++) {
			d = (d * 3) % MOD;
		}
		dp[n][m][l] = d;
		return d;
	}
	else {
		d = DP(n - 1, m, l) + DP2(m, n - 1, l);
		d = d % MOD;
		d = d + DP2(l, n - 1, m);
		d = d % MOD;
		dp[n][m][l] = d;
		return d;
	}
}
long long int DP2(int n, int m, int l) {

	if (dp2[n][m][l] >= 0)return dp2[n][m][l];
	int i;
	long long int d;
	if (n == 0) {
		dp2[n][m][l] = 0;
		return 0;
	}
	else {
		d = DP(m, n-1, l) + DP2(n-1, m, l);
		d = d % MOD;
		d = d + DP2(l, m, n-1);
		d = d % MOD;
		dp2[n][m][l] = d;
		return d;
	}
}*/

Measured memory_bytes: 19696
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <climits>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <map>
#include <tuple>
#include <iostream>
#include <deque>
#include <array>
#include <set>
#include <functional>


int main() {
	int n; std::cin >> n;
	std::vector<int> weights(n);
	for (auto& w : weights) std::cin >> w;
	for (auto i = 1; i < weights.size(); ++i) {
		weights[i] += weights[i - 1];
	}
	auto sum = weights.back();
	auto min = INT_MAX;
	for (const auto w : weights) {
		if (std::abs(sum - w - w) < min) {
			min = std::abs(sum - w - w);
		}
	}
	std::cout << min << std::endl;
};

Measured memory_bytes: 256
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int a = sc.nextInt();
  int b = sc.nextInt();
  int c = sc.nextInt();
  if(a+b == c||b+c == a||c+a == b)
    System.out.println("Yes");
  else System.out.println("No");
}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define god dimasi5eks
#pragma GCC optimize("O3")
#define fi first
#define se second
#define pb push_back
#define pf push_front

// #define fisier 1

using namespace std;

typedef long long ll;

const int mod = 1000000007;
const double dancila = 3.14159265359; // PI 
const double eps = 1e-9;

int n, m, ss;
struct orz
{
	int nxt, timp, slv;
};
vector<orz> v[52];
ll dp[52][2502];
int dt[52], val[52];
int main()
{

    #ifdef fisier
        ifstream f("input.in");
        ofstream g("output.out");
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	
	cin >> n >> m >> ss;
	ss = min(ss, 2500);
	for(int i = 1; i <= m; ++i)
	{
		int a, b, slv, timp;
		cin >> a >> b >> slv >> timp;
		v[a].pb({b, timp, slv});
		v[b].pb({a, timp, slv});
	}
	for(int i = 1; i <= n; ++i)
		cin >> val[i] >> dt[i];
	for(int i = 1; i <= n; ++i)
		for(int j = 0; j <= 2500; ++j)
			dp[i][j] = (1LL<<60);
	dp[1][ss] = 0;
	set<pair<ll, pair<int, int> > >s;
	s.insert({0, {1, ss}});
	while(!s.empty())
	{
		pair<ll, pair<int, int> > x = *s.begin();
		s.erase(x);
		if(x.fi + dt[x.se.fi] < dp[x.se.fi][min(2500, x.se.se + val[x.se.fi])])
		{
			s.erase({x.fi + dt[x.se.fi], {x.se.fi, min(2500, x.se.se + val[x.se.fi])}});
			dp[x.se.fi][min(2500, x.se.se + val[x.se.fi])] = x.fi + dt[x.se.fi];
			s.insert({x.fi + dt[x.se.fi], {x.se.fi, min(2500, x.se.se + val[x.se.fi])}});
		}
		for(int i = 0; i < v[x.se.fi].size(); ++i)
		{
			int vec = v[x.se.fi][i].nxt;
			int costslv = v[x.se.fi][i].slv;
			int costtmp = v[x.se.fi][i].timp;
			if(x.se.se >= costslv)
			{
				int nsl = x.se.se - costslv;
				if(x.fi + costtmp < dp[vec][nsl])
				{
					s.erase({dp[vec][nsl], {vec, nsl}});
					dp[vec][nsl] = x.fi + costtmp;
					s.insert({dp[vec][nsl], {vec, nsl}});
				}
			}
		}
	}
	for(int x = 2; x <= n; ++x)
	{
		ll ans = (1LL<<60);
		for(int i = 0; i <= 2500; ++i)
			ans = min(ans, dp[x][i]);
		cout << ans << '\n';
	}
    return 0;
}


Measured memory_bytes: 8132
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc =new Scanner(System.in);
		int a,b;
		a=sc.nextInt();
		b=sc.nextInt();
		if(a==b)
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		}
	}

}


Measured memory_bytes: 23764