akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//#include <tr1/unordered_map>
//#include"Bignum/bignum.h"
//#define big bignum
#define lowbit(x) (x & -x)
#define debug(x) (cout << "#x = " << (x) << endl)
#define Set(x, i) memset (x, i, sizeof(x))
#define R register
#define For(i, j, k) for(R int i = (j), ED = (k); i <= ED; ++i)
#define Rep(i, j, k) for(R int i = (j), ED = (k); i >= ED; --i)
#define Cross(i, j, k) for(R int i = (j); i; i = (k))
using namespace std;
typedef long long ll;
const ll N = 300011;
const ll INF = 5e16;

namespace IO {

	inline char gc() {
		static char buf[100000], *p1 = buf, *p2 = buf;
		return (p1 == p2) && (p2 = (p1 = buf) +
			fread (buf, 1, 100000, stdin), p1 == p2)? EOF: *p1++;
	}

	#define dd ch = getchar()
	inline ll read() {
		R ll x = 0; R int f = 0; R char dd;
		for (; !isdigit (ch); dd) f ^= (ch == '-');
		for (; isdigit (ch); dd)  x = x * 10 + (ch ^ 48);
		return f? -x: x;
	}
	#undef dd

	inline void write( ll x ) {
		if (x < 0) putchar ('-'), x = -x;
		if (x > 9) write (x / 10); putchar (x % 10 | 48);
	}

	inline void wrn ( ll x ) { write (x); putchar (' '); }

	inline void wln ( ll x ) { write (x); putchar ('\n'); }

	inline void wlnn ( ll x, ll y ) { wrn (x), wln (y); }

}

using IO::wln;
using IO::wlnn;
using IO::read;

namespace Cesare {
	
	ll n, m, cc = 0, Deg[N], W[N], V[N], fa[N];
	
	inline ll Find ( ll x ) {
		return x == fa[x]? x: fa[x] = Find(fa[x]); 
	}
	
	inline void Merge ( ll x, ll y ) {
		fa[Find(x)] = Find(y);
	}
	
	vector <ll> Ve[N], E[N];
	
	inline void Add ( ll u, ll v ) { Ve[u].push_back(v); }
	
	inline void dfs ( ll u, ll fa ) {
		For ( i, 1, Ve[u].size() ) if (Ve[u][i - 1] != fa) {
			ll v = Ve[u][i - 1]; dfs (v, u);
			if (Deg[v] & 1) E[v].push_back(u), ++Deg[v];
			else if (!(Deg[v] & 1)) E[u].push_back(v), ++Deg[u];
		}
	}
	
	int main() {
		n = read(), m = read();
		For ( i, 1, n ) fa[i] = i;
		if (m & 1) return puts ("-1"), 0;
		for (R int i = 1, u, v; i <= m; ++i) {
			u = read(), v = read();
			ll x = Find(u), y = Find(v);
			if (x == y) E[v].push_back(u), ++Deg[v];
			else Merge(u, v), Add(u, v), Add (v, u);
		}
		dfs (1, 0);
		For ( u, 1, n ) For ( i, 1, E[u].size() ) 
			wlnn (u, E[u][i - 1]);
		return 0;
	} 
}

int main()
{
	return Cesare::main();
}

/*

*/






Measured memory_bytes: 28288
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
using namespace  std;
typedef pair<long long , long long> P;
typedef long long ll;
typedef long long lint;
#define REP(i, n) for(long long (i)=0; (i)<(n); ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
typedef tuple<lint, lint, lint, lint> T;
void solve(){
    lint N, Q; cin>>N>>Q;
    vector<tuple<ll, ll, ll> > A(N);
    REP(i, N){
        lint s, t, x; cin>>s>>t>>x;
        A[i] = make_tuple(x, s, t);
    }
    sort(ALL(A));
    set<P> S;
    REP(i, Q){
        lint q; cin >> q;
        S.insert(P(q, i));
    }
    vector<lint> res(Q);
    REP(i, N){
        lint s, t, x;
        tie(x, s, t) = A[i];
        auto itr = S.lower_bound(P(s-x, 0));
        while(itr!=S.end()){
            if(itr->first >= t-x) break;
            res[itr->second] = x;
            itr = S.erase(itr);
        }
    }
    for(auto item: S){
        res[item.second] = -1;
    }
    REP(i, Q){
        cout << res[i] << "\n";
    }
    cout << flush;
}
signed main(){
    solve();
    return 0;
}


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

static const int maxs=100;
static const long long infty=(1LL<<32);

int n;
long long d[maxs][maxs];

void floyd(){
  for(int k=0;k<n;k++){
    for(int i=0;i<n;i++){
      if(d[i][k]==infty)continue;
      for(int j=0;j<n;j++){
	if(d[k][j]==infty)continue;
	d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
      }
    }
  }
}

int main(){
  int e,u,v,c;
  cin>>n>>e;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      d[i][j]=((i==j)?0:infty);
    }
  }
  for(int i=0;i<e;i++){
    cin>>u>>v>>c;
    d[u][v]=c;
  }
  floyd();
  bool negative=false;
  for(int i=0;i<n;i++)if(d[i][i]<0)negative=true;
  if(negative){
    cout<<"NEGATIVE CYCLE"<<endl;
  }else {
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	if(j)cout<<" ";
	if(d[i][j]==infty)cout<<"INF";
	else cout <<d[i][j];
      }
      cout<<endl;
    }
  }
  return 0;
}

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

int main(){
    int D;
    std::cin >> D;
    std::vector< int > C(26);
    for(int i=0; i<26; i++){
        std::cin >> C[i];
    }
    std::vector< std::vector< int > > S(D, std::vector< int >(26));
    for(int i=0; i<D; i++){
        for(int j=0; j<26; j++){
            std::cin >> S[i][j];
        }
    }
    std::vector< int > T(D);
    for(int i=0; i<D; i++){
        std::cin >> T[i];
    }
    
    long long ans = 0;
    std::vector< int > last(26, 0);
    std::vector< int > V(D);
    for(int i=0; i<D; i++){
        ans += S[i][T[i] - 1];
        last[T[i] - 1] = i + 1;
        for(int j=0; j<26; j++){
            ans -= (i + 1 - last[j]) * C[j];
        }
        V[i] = ans;
    }
    
    for(int i=0; i<D; i++){
        std::cout << V[i] << std::endl;
    }
    
    return 0;
}



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

//template
#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 ALL(v) (v).begin(),(v).end()
typedef long long int ll; typedef pair<ll, ll> P;
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 (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T>void Fill(A(&array)[N], const T &val) { fill((T*)array, (T*)(array + N), val); }
const int inf = INT_MAX / 2; const ll INF = LLONG_MAX / 2;
//template end



int main(){
	int a; cin >> a;
	string s; cin >> s;
	if (a >= 3200)cout << s << endl;
	else cout << "red" << endl;
	return 0;
}


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

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<string>vst;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
#define all(ct) ct.begin() , ct.end()
#define endl "\n"
#define fr(i,a) for(auto i:a)
#define f(i,a,b) for(int i=a;i<b;++i)
#define fd(i,a,b) for(int i=a;i>=b;--i)
#define pb push_back
#define in(d,v) d.find(v)!=d.end()
#define mp make_pair
#define size(a) int(a.size())

const ll mod = 1e9 + 7;
const ll inf = ll(4e18);
const double PI = acos(-1);

ll modexp(ll x, ll n, int md) {
    if (n == 0)return 1;
    if (n % 2 == 0)return modexp((x * x) % md, n / 2, md);
    return (x * modexp((x * x) % md, n / 2, md)) % md;
}
int n;
pair<ll,pii>a[15];
ll ans[16];
int ax[16]={0},ay[16]={0},countx=0,county=0;
void road(int i){
    if(i==n){
        int count=countx+county;
        ll curr=0;
        f(i,0,n){
            ll curr1=inf;
            f(j,0,countx+1){
                curr1=min(curr1,a[i].first*abs(ax[j]-a[i].second.first));
            }
            ll curr2=inf;
            f(j,0,county+1){
                curr2=min(curr2,a[i].first*abs(ay[j]-a[i].second.second));
            }
            curr+=min(curr1,curr2);
            if(curr>ans[count])return;
        }
        ans[count]=curr;
        return;
    }
    road(i+1);
    ++countx;ax[countx]=a[i].second.first;
    road(i+1);
    --countx;
    ++county;ay[county]=a[i].second.second;
    road(i+1);
    --county;
}
int main() {
    fastio;
    // clock_t tm = clock();
    cin>>n;
    f(i,0,n){
        cin>>a[i].second.first>>a[i].second.second>>a[i].first;
    }
    sort(a,a+n,greater<pair<ll,pii>>());
    f(i,0,n+1)ans[i]=inf;
    road(0);
    f(i,0,n+1)cout<<ans[i]<<endl;
    //cout<<((clock()-tm)*1.0)/CLOCKS_PER_SEC<<endl;
}

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

int dp[5005][5005];

int main() {
  int n,ans=0;
  string s;
  cin >> n >> s;
  for(int i = n-1; i >= 0; i--){
    for(int j = n-1; j >= 0; j--){
      if(s[i]!=s[j]) dp[i][j] = 0;
      else dp[i][j] = dp[i+1][j+1]+1;
    }
  }
  rep(i,n)rep(j,n) {
    if(i >= j) continue;
    int now = min(dp[i][j], j-i);
    ans = max(ans, now);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 98048
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int d = in.nextInt();
            int x = in.nextInt();
            int[] a = in.nextIntArray(n);

            int sum = 0;
            for (int i = 0; i < n; i++) {
                sum += 1 + (d - 1) / a[i];
            }

            out.println(sum + x);
        }

    }

    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
            st = new StringTokenizer("");
        }

        public String nextString() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return st.nextToken();
        }

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

        public int[] nextIntArray(int n) {
            int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        }

    }
}



Measured memory_bytes: 23508
#include<iostream>

using namespace std;

int main(){
  int A,B,C,X; cin >> A >> B >> C >> X;
  
  int cnt = 0;
  
  for(int i = 0; i <= A; i++){
    for(int j = 0; j <= B; j++){
      for(int k = 0; k <= C; k++){
        if( 500*i + 100*j + 50*k == X){ cnt++;}}}}
  
  cout << cnt << endl; return 0;}


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

using namespace std;

int main() {
	int n;
	scanf("%d", &n);
	if (n % 10 == 3) puts("bon");
	else if ((n % 10 == 0) || (n % 10 == 1) || (n % 10 == 6) || (n % 10 == 8)) puts("pon");
	else puts("hon");
}

Measured memory_bytes: 3732
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;

struct int_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);
    }
};

struct pair_hash {
    size_t operator()(pair<int, int> x) const {
        return int_hash{}(x.first) ^ (int_hash{}(x.second) << 16);
    }
};

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e7;
const int MX = 100001; //check the limits, dummy

bool checkVert(const vector<vector<int>> &v) {
    for(int i = 0; i < 3; i++)
        if(v[i][0] && v[i][0] == v[i][1] && v[i][1] == v[i][2])
            return true;
    return false;
}

bool checkHoriz(const vector<vector<int>> &v) {
    for(int j = 0; j < 3; j++)
        if(v[0][j] && v[0][j] == v[1][j] && v[1][j] == v[2][j])
            return true;
    return false;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    unordered_map<int, pair<int, int>> mp;
    for(int i = 0; i < 3; i++)
        for(int j = 0; j < 3; j++) {
            int in; cin >> in;
            mp[in] = {i, j};
        }

    vector<vector<int>> v(3, vector<int>(3, 0));
    int n; cin >> n;
    for(int i = 0; i < n; i++) {
        int in; cin >> in;
        if(mp.count(in))
            v[mp[in].first][mp[in].second] = 1;
    }

    if(checkHoriz(v) || checkVert(v) 
        || v[0][0] && v[0][0] == v[1][1] && v[1][1] == v[2][2] 
        || v[0][2] && v[0][2] == v[1][1] && v[1][1] == v[2][0])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define fastIO cout << fixed << setprecision(12), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
using namespace std;

const int N = 2e5 + 9;
ll adj[N], cycle, vis[N], req, ans;
ll k;

void dfs(ll node) {
	vis[node] = 1;
	if(!vis[adj[node]]) {
		++cycle;
		if(cycle == k) {
			ans = adj[node];
		}
		dfs(adj[node]);
	} else
		req = adj[node];
}

int main() {
	fastIO;
#ifdef LOCAL
	freopen("input.in", "rt", stdin);
#endif
	ll n, a;
	cin >> n >> k;
	for (int i = 1; i <= n; ++i) {
		cin >> a;
		adj[i] = a;
	}
	req = 1;
	dfs(1);
	if(k <= cycle) {
		cout << ans << '\n';
		return 0;
	}
	k -= cycle + 1;
	memset(vis, 0, sizeof vis);
	cycle = 0;
	dfs(req);
	++cycle;
	k %= cycle;
	ans = req;
	memset(vis, 0, sizeof vis);
	cycle = 0;
	dfs(req);
	cout<< ans;
	return 0;
}


Measured memory_bytes: 6716
# -*- coding: utf-8 -*-
# IMPORT ###############################################################################################################
import sys                                                      # システム
sys.setrecursionlimit(10**6)                                    # 再帰処理の上限変更
from collections import deque, Counter                          # キュー・個数カウント
from itertools   import accumulate, permutations, combinations  # 累積和・順列・組み合わせ
from operator    import itemgetter                              # ソート補助
from bisect      import bisect_left, bisect_right, bisect       # 二分探索
from heapq       import heappop, heappush                       # プライオリティキュー
from fractions   import gcd                                     # 最大公約数
from math        import ceil, floor, sqrt, cos, sin, tan, pi    # 数学処理
from copy        import deepcopy                                # オブジェクトコピー
import numpy         as np                                      # 数値計算

# MAIN #################################################################################################################
def main():
    # Init #############################################################################################################
    im = InputManager()
    # Input ############################################################################################################
    s = im.inputSingle(dtype=str)
    # Logic ############################################################################################################
    aa = int(s[0:2])
    bb = int(s[2:4])
    canYYMM = False
    canMMYY = False
    if (bb >= 1 and bb <= 12):
        canYYMM = True
    if (aa >= 1 and aa <= 12):
        canMMYY = True
    # Output ###########################################################################################################
    if (canYYMM and canMMYY):
        print("AMBIGUOUS")
    elif (canYYMM):
        print("YYMM")
    elif (canMMYY):
        print("MMYY")
    else:
        print("NA")
    # Return ###########################################################################################################
    return

# INPUT MANAGER ########################################################################################################
class InputManager(object):
    def __init__(self):
        pass

    @staticmethod
    def inputSingle(dtype=int):
        return dtype(input())
    
    @staticmethod
    def inputMultiple(dtype=int, aslist=False):
        if aslist:
            return list(map(dtype, input().split()))
        else:
            return map(dtype, input().split())

    @staticmethod
    def input2D(h, dtype=int):
        return [list(map(dtype, input().split())) for i in range(h)]

# CALL MAIN ############################################################################################################
main()

Measured memory_bytes: 22412
n = int(raw_input())
S = raw_input().split(" ")
q = int(raw_input())
T = raw_input().split(" ")

cnt = 0

for i in range(q):
    key = T[i]
    for j in range(n-1):
        if S[j] == key:
            cnt += 1
            break

print cnt

Measured memory_bytes: 6924
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <queue>
#include <list>
#include <limits>
#include <string>
#include <vector>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
const int MOD = 998244353;

struct cell{
  int no;
  ll year;
};
bool operator<(const cell& left, const cell& right){
  return left.year < right.year;
}
bool operator>(const cell& left, const cell& right){
  return left.year > right.year;
}

int gcd(int a, int b){
  if(b == 0) return a;
  return gcd(b, a%b);
}

int main()
{
  int N;
  int year = 111;
  cin >> N;
  while(year < N){
    year += 111;
  }
  cout << year;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mxn= 5e5+5;
#define mod 1000000007
#define endl '\n'
void rishabh(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
int main(){
    set<char> s;
    s.insert('A');    s.insert('G');    s.insert('C');    s.insert('T');
    string str;
    cin>>str;
    int temp=0;
    int ans=0;
    for(int i=0;i<str.size();i++){
        if(s.count(str[i])){
            temp++;
            ans=max(ans,temp);
        }
        else temp=0;
    }
    cout<<ans;
}



Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int[] list = new int[10];
		for(int i = 0; i < 10; ++i)
			list[i] = Integer.parseInt(sc.nextLine());
		QuickSort(list, 0, 10);
		for(int i = 9; i > 6; --i)
			System.out.println(list[i]);
	}
	
	public static void QuickSort(int[] array, int first, int n)
	{
		if(n<=1)
			return;		
		int Pivot = array[first + n/2 - 1];
		int Left = first;
		int Right = first + n - 1;
		while(Left <= Right)
		{
			while(array[Left] < Pivot)
				Left++;
			
			while(array[Right] > Pivot)
				Right--;
			if(Left <= Right)
			{
				int tmp = array[Left];
				array[Left] = array[Right];
				array[Right] = tmp;
				Left++;
		    	Right--;
			}
		}
		QuickSort(array, first, Right - first + 1);
		QuickSort(array, Left, first +  n  - Left );
	}

} 

Measured memory_bytes: 17300
#include<stdio.h>
int main()
        {
            int count=0,i,j;
            char S[3],b;
            for(i=0;i<3;i++){
                scanf("%c",&S[i]);
            }
                for(j=0;j<3;j++){
                    b=S[j];
                    if(b=='R'){
                        count++;
                    }
                }
                if(count>=2 && S[1]!='S'){
                printf("%d",count);
            }
            else if(count==0){
                printf("0");
            }
            else{
                printf("1");
            }
        }


Measured memory_bytes: 1672
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{   
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;cin>>s;
    if(s=="ABC")
    {
        cout<<"ARC\n";
    }
    else
    {
        cout<<"ABC\n";
    }
    return 0;
}

Measured memory_bytes: 3608
import java.util.Scanner;
import java.util.ArrayList;
import java.util.HashSet;

class Main{
      public static void main(String args[]){
	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	int m = sc.nextInt();
	long[] height = new long[n];
	HashSet<Integer> mt = new HashSet<Integer>();
	for(int i=0;i<n;i++){
	    height[i] = sc.nextLong();
	    mt.add(i);
	}
	for(int i=0;i<m;i++){
	    int a = sc.nextInt()-1;
	    int b = sc.nextInt()-1;
	    if(!(height[a]==height[b])){
		if(height[a]>height[b]){
		    mt.remove(b);
		}else{
		    mt.remove(a);
		}
	    }else{
		mt.remove(a);
		mt.remove(b);
	    }
	}
	System.out.println(mt.size());
      }
}


Measured memory_bytes: 71436
gets.to_i.times do
  gx, gy = gets.split.map(&:to_i)
  vine = Array.new(gx+2) {Array.new(gy+2) {Array.new(gx+2) {Array.new(gy+2, false)}}}
  p = gets.to_i
  p.times do
    x1, y1, x2, y2 = gets.split.map(&:to_i)
    vine[x1+1][y1+1][x2+1][y2+1] = vine[x2+1][y2+1][x1+1][y1+1] = true
  end
  dp = Array.new(gx+2) {Array.new(gy+2, 0)}
  dp[1][1] = 1
  for i in 0..gx do
    for j in 0..gy do
      dp[i+1][j+1] += dp[i][j+1] if !vine[i][j+1][i+1][j+1]
      dp[i+1][j+1] += dp[i+1][j] if !vine[i+1][j][i+1][j+1]
    end
  end
  puts dp[gx+1][gy+1] != 0 ? dp[gx+1][gy+1] : "Miserable Hokusai!"
end

Measured memory_bytes: 6872
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <complex>

using namespace std;

//#pragma GCC optimize("Ofast")
//#pragma GCC optimization("unroll-loops, no-stack-protector")
//#pragma GCC target("avx,avx2,fma")


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


	int n;
	cin >> n;
	cout << 1 - n << "\n";


	return 0;
}



Measured memory_bytes: 3600
/********************************************//**
 ****** Handle: techno_phyle    *****************
 ***********************************************/

#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
typedef long long ll;
#define mod 1000000007
#define N 100010
#define M 200010
#define db(a) cout << a << endl
#define db2(a,b) cout << a << " " << b << endl
#define dbp(a) cout << a.first << " " << a.second << endl
#define adb(a) for(auto it:a) cout << it << " "; cout << endl
#define adbp(a) for(auto it:a) cout << it.first << " " << it.second << endl
#define pb push_back
#define mp make_pair
#define endline "\n"
#define in(x) scanf("%d",&x);
const ll INF = 1e18L + 5;
const int inf = 1e9 + 5;
typedef pair<double, long> key;
struct comp {
	bool operator()(pair<int, int> p1, pair<int, int> p2) {
		if (p1.first < p2.first) return false;
		if (p2.first < p1.first) return true;
		return p1.second < p2.second;
	};
};
//greater<pair<int,int> , greater<int>>
ll a[M];
map<pair<ll , ll> , ll > mpp;
map <ll , ll > mpp_y , mpp_x;
vector<ll> ind_x , ind_y;

ll solve(ll max_x , ll max_y) {
	ll ans = max_x + max_y - 1;
	//cout << ans << endl;
	//for (auto it : ind_x) cout << it << " "; cout << endl;
	//for (auto it : ind_y) cout << it << " "; cout << endl;
	for (int i = 0; i < ind_x.size(); i++) {
		for (int j = 0; j < ind_y.size(); j++) {
			//cout << mpp[ {i, j}] << endl;
			if (mpp[ {ind_x[i] , ind_y[j]}] == 0) {
				ans ++;
				return ans;
			}
		}
	}
	return ans;
}
int main() {
	fastIO;
	int test = 1;
	//cin >> test;
	while (test--) {
		ll h , w , m;
		cin >> h >> w >> m;

		for (int i = 0; i < m; i++) {
			ll x , y;
			cin >> x >> y;
			mpp[ {x , y}]++;
			mpp_x[x]++;
			mpp_y[y]++;
		}
		ll max_x = 0 , max_y = 0 ;
		for (auto it : mpp_x) {
			if (it.second > max_x) {
				max_x = it.second;
			}
		}
		for (auto it : mpp_y) {
			if (it.second > max_y) {
				max_y = it.second;
			}
		}
		for (auto it : mpp_x) {
			if (max_x == it.second) {
				ind_x.pb(it.first);
			}
		}
		for (auto it : mpp_y) {
			if (max_y == it.second) {
				ind_y.pb(it.first);
			}
		}
		//for (auto it : mpp) cout << it.first.first << " " << it.first.second << " " << it.second << endl;
		ll ans = solve(max_x , max_y);
		cout << ans << endl;
	}




	return 0;

}


Measured memory_bytes: 67800
#include<bits/stdc++.h>
using namespace std;
using p=pair<int,int>;
#define int long long
#define rep(i,N) for(int i=0;i<N;i++)

signed main(){
  int N;
  cin>>N;
  string S,T;
  cin>>S>>T;
  rep(i,N)cout<<S[i]<<T[i];
}

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

struct stuff{
	int w, v;
	friend decltype(auto)
		operator>>(std::istream&is, stuff&s) {
		return is >> s.w >> s.v;
	}

	stuff() = default;
};

using ull = unsigned long long;

int main() {
	
	unsigned n, w;
	std::cin >> n >> w;
	std::vector<stuff> v{ n };
	for (auto&e : v)
		std::cin >> e;

	std::vector<std::vector<ull>> tab;
	tab.resize(n+1);
	for (auto&e : tab)
		e.resize(w+1, {});


	for (unsigned i{1}; i <= n; ++i) {

		for (unsigned wi{}; wi <= w; ++wi) {

			if (wi >= v[i-1].w )
				tab[i][wi]
				= std::max(
					tab[i - 1][wi]
					, tab[i - 1][wi - v[i-1].w] + v[i-1].v
				);
			else
				tab[i][wi] = std::max(tab[i - 1][wi], tab[i][wi]);
		}
		/*
		std::cout << "i:" << i << " ";
		for (const auto&e : tab[i])
			std::cout << " " << e;
		std::cout << "\n";
		*/
	}

	std::cout << tab[n][w] << "\n";

	return 0;
}

Measured memory_bytes: 79488
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 12 22:54:45 2020

@author: Kanaru Sato
"""

n,k,q = list(map(int, input().split()))
dict = {}

for i in range(q):
    ans = input()
    if ans not in dict:
        dict[ans] = 1
    else:
        dict[ans] += 1

points = []

for i in range(1,n+1):
    if k-q>0:
        points.append("Yes")
    elif str(i) in dict and dict[str(i)]+k-q>0:
        points.append("Yes")
    else:
        points.append("No")

for i in range(n):
    print(points[i])

Measured memory_bytes: 11192
#include <bits/stdc++.h> 
using namespace std;
 
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
const ll mod = 1000000007;
const ll INF = 1e18;
const ll MAX = 100001;
//
//
                void solve(){
                    ll n;
                    cin>>n;
                    if(n%2 == 0){
                        cout<<"-1";
                        return ;
                    }
                    ll k = 7;
                    ll cnt = 1;
                    while(true){
                        if(k%n == 0){
                            cout<<cnt;
                            break;
                        }
                        if(cnt > n){
                            cout<<"-1";
                            break;
                        }
                        k = (k%n)*10 +7;
                        // cout<<k<<"\n";
                        ++cnt;
                    }
                }
                int main(){ 
                        hs;
                        ll t;
                        t=1;
                        // cin>>t;
                        for (int i=1; i<=t; i++){
                                //cout<<"Case #"<<i<<": ";
                                solve();
                         }
        return 0; 
}         

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
using namespace std;
int main(void){
  int n;cin>>n;
  vector<int> v(n,0);
  for(int i=0,a,b,c,d;i<n*(n-1)/2;++i){
    cin>>a>>b>>c>>d;
    if(c!=d)v[(c>d)?a-1:b-1]+=3;
    else{++v[a-1];++v[b-1];}
  }
  map<int,int,greater<int> > rank;
  for(int i=0;i<n;++i)++rank[v[i]];
  int r=1;
  for(map<int,int>::iterator it=rank.begin();it!=rank.end();++it){
  	int t=it->second;
  	it->second=r;
  	r+=t;
  }
  for(int i=0;i<n;++i) cout<<rank[v[i]]<<endl;
  return 0;
}

Measured memory_bytes: 1200
#include<iostream>

int main(){
  int a,b,c;
  std::cin>>a>>b>>c;
  for(int i=a;i<a+c&&i<=b;i++){
    std::cout<<i<<std::endl;
  }
  if(a+c-1>=b){
  }else if(a+c-1>=b-c+1){
    for(int i=a+c;i<=b;i++){
      std::cout<<i<<std::endl;
    }
  }else if(b-c+1>a+c-1){
    for(int i=b-c+1;i<=b;i++){
      std::cout<<i<<std::endl;
    }
  }
   return 0;
}



Measured memory_bytes: 3564
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class APlacingMarbles {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            out.print(Integer.bitCount(Integer.parseInt(in.next(), 2)));
        }

    }

    static class InputReader implements AutoCloseable {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public void close() {
        }

    }
}



Measured memory_bytes: 19412
N=int(input())
H = list(map(int, input().split(' ')))
ans = 0
tmp = 0
for i in range(N-1):
    if H[i] >= H[i+1]:
        ans += 1
    else:
        if tmp <= ans:
            # print(H[i])
            tmp = ans
        ans = 0
print(max(ans,tmp))

Measured memory_bytes: 14224
/*author : Yashvardhan
Thursday, April 30, 2020
3:26 PM
*/

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

using ll = long long;

#define int ll
#define pb push_back
#define vi vector<int>
#define pi pair<int,int>
#define vpi vector<pi>
#define ff first
#define ss second
#define mp make_pair
#define endl '\n'
#define all(a) a.begin(), a.end()
#define initialise(a, x) memset(a, x, sizeof(a))
#define rev(Y) reverse(all(Y))

#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS

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

template <typename T> ostream& operator << (ostream& os,const vector<T>& v){for(int i=0;i<v.size();++i) os<<v[i]<<" ";return os;} 
template <typename T> ostream& operator << (ostream& os,const set<T>& v){for(auto it:v) os<<it<<" ";return os;} 
template <typename T, typename S> ostream& operator << (ostream& os, const pair<T,S>& v) {os<<v.ff<<" "<<v.ss;return os;}

const int mod = 1e9 + 7;
const int inf = 2e18;
const int ninf = -2e18;

int takemod(int a){return ((a%mod)+mod)%mod;}

int pow(int a, int b, int m)
{
	int ans = 1;
	a %= m;
	while (b)
	{
		if (b & 1)
			ans = (ans * a) % m;
		b /= 2;
		a = (a * a) % m;
	}
	return ans;
}

int modinv(int a){return takemod( pow( takemod(a), mod-2,mod ) );}


signed main()
{

	ios_base::sync_with_stdio(false);
	cin.tie(0);

	#ifdef __APPLE__
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		freopen("error.txt","w",stderr);
	#endif

	time_t t1, t2;
	t1 = clock();
	
	int n,m;
	cin >> n >> m;

	if(n == m) cout << "Yes" << endl;
	else cout << "No" << endl; 
	

	t2 = clock();
	cerr << endl << t2-t1 << endl;
	
	return 0;
}



Measured memory_bytes: 256
require 'prime'
n = gets.chomp.to_i
upper = Math.sqrt(n).to_i
ret = n.to_s.length
(1..upper).each do |i|
  if n % i == 0 then
    curr = ([i, n / i].max).to_s.length
    ret = [ret, curr].min
  end
end
puts ret

Measured memory_bytes: 2556
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,x,n) for(int i=x;i<n;i++)
#define pb push_back
#define int long long
#define MAX 10000
#define NIL -1
using namespace std;
const int INF=1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

struct node{
  int p,l,r;
};
struct node T[MAX];
int n;

void preParse(int u){
  if(u==NIL) return ;
  printf(" %d", u);
  preParse(T[u].l);
  preParse(T[u].r);
}

void inParse(int u){
  if(u==NIL)return ;
  inParse(T[u].l);
  printf(" %d", u);
  inParse(T[u].r);
}
void postParse(int u){
  if(u==NIL)return ;
  postParse(T[u].l);
  postParse(T[u].r);
  printf(" %d", u);
}

signed main(){
    int v,l,r,root=0;
    cin>>n;
    rep(i,n)T[i].p=NIL;
    rep(i,n){
      cin>>v>>l>>r;
      T[v].l=l;
      T[v].r=r;
      if(l!=NIL)T[l].p=v;
      if(r!=NIL)T[r].p=v;
    }
    rep(i,n)if(T[i].p==NIL)root=i;
    cout<<"Preorder"<<endl;
    preParse(root);
    cout<<endl;
    cout<<"Inorder"<<endl;
    inParse(root);
    cout<<endl;
    cout<<"Postorder"<<endl;
    postParse(root);
    cout<<endl;
  return 0;
}

Measured memory_bytes: 3192
N,M = map(int,input().split())
cint = [0,0]*M

for i in range(M):
    cint[i]=list(map(int,input().split()))

for i in range(1,N+1):
    count=0
    for j in range(M):
        if cint[j][0] == i or  cint[j][1] == i:
            count +=1
    print(count)

Measured memory_bytes: 3064
# A - Buttons

A, B = map(int, input().split())
total = 0

if A>B:
  total += A
  A -= 1
else:
  total += B
  B -= 1
  
  
if A>B:
  total += A
  A -= 1
else:
  total += B
  B -= 1
  
print(total)


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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int h, w;
  char c[50][51];
  cin >> h >> w;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> c[i][j];
    }
  }
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (c[i][j] == '#' && c[i][j + 1] != '#' && c[i][j - 1] != '#' && c[i + 1][j] != '#' && c[i - 1][j] != '#') {
        cout << "No\n";
        return 0;
      }
    }
  }
  cout << "Yes\n";
  return 0;
}


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


#define  SZ(items) (int)items.size()
#define  CLR(a)  memset(a,0,sizeof(a))
#define  SET(a)  memset(a,-1,sizeof(a))
#define  nl "\n";

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



template <class T> inline T biton(T n, T pos)
{
	return n | ((T)1 << pos);
}
template <class T> inline T bitoff(T n, T pos)
{
	return n & ~((T)1 << pos);
}
template <class T> inline T ison(T n, T pos)
{
	return (bool)(n & ((T)1 << pos));
}
template <class T> inline T gcd(T a, T b)
{
	while (b)
	{
		a = a % b;
		swap(a, b);
	}
	return a;
}
template <class T> inline T bigmod(T p, T e, T m)
{
	T ret = 1;
	for (; e > 0; e >>= 1)
	{
		if (e & 1)
			ret = (ret * p) % m;
		p = (p * p) % m;
	}
	return (T)ret;
};



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



void solve()
{
	vector<int> ab = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };

	int k;
	cin >> k;

	cout << ab[k - 1] << endl;
	
}

int main()
{
	ios_base::sync_with_stdio(false);
	cout.setf(ios::fixed);
	cout.precision(10);
	cout.tie(nullptr);
	cin.tie(nullptr);

	int t = 1;


	while (t--)
	{
		solve();
	}

	return 0;
}


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

int n,pos;
vector<int> pre,in,post;

void rec(int l,int r){
  if(l>=r)return;
  int root=pre[pos++];
  //cout<<"root"<<root<<endl;
  int m=distance(in.begin(),find(in.begin(),in.end(),root));
  rec(l,m);
  rec(m+1,r);
  post.push_back(root);
}

void solve(){
  pos=0;
  rec(0,pre.size());
  for(int i=0;i<n;i++){
    if(i)cout<<" ";
    cout<<post[i];
  }
  cout<<endl;
}

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

  for(int i=0;i<n;i++){
    cin>>k;
    pre.push_back(k);
  }

  for(int i=0;i<n;i++){
    cin>>k;
    in.push_back(k);
  }
  solve();
  return 0;
}



Measured memory_bytes: 3164
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int a,b,w;
		String str;
		String[] s;
		str=br.readLine();
		while(str !=null){
			StringBuilder out=new StringBuilder();
			s=str.split(" ");
			a=Integer.parseInt(s[0]);
			b=Integer.parseInt(s[1]);
			w=a+b;
			out.append(w);
			System.out.println(out.length());
			str=br.readLine();
		}
	}
}

Measured memory_bytes: 16992
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
	int x,y;
	cin>>x>>y;
	int tot;
	bool flag = 0;
	for(int i=0;i<=x;i++){
		tot = 0;
		tot += i*2 + (x-i)*4;
		if(tot == y){
			cout<<"Yes"<<endl;
			flag = 1;
			break; 
		}
	}
	if(!flag) cout<<"No"<<endl;
	return 0;
} 

Measured memory_bytes: 3016
import sys

input=sys.stdin.readline

R,C,N=map(int,input().split())

def is_on_edge(x,y):
    return x==0 or x==R or y==0 or y==C

line=[]
for i in range(0,N):
    x1,y1,x2,y2=map(int,input().split())
    if is_on_edge(x1,y1) and is_on_edge(x2,y2):
        line.append([x1,y1,x2,y2])

n=len(line)
query=[]
for i in range(n):
    x1,y1,x2,y2=line[i]
    if y1==0:
        query.append([x1,i])
    elif x1==R:
        query.append([R+y1,i])
    elif y1==C:
        query.append([R+C+(R-x1),i])
    else:
        query.append([2*R+2*C-y1,i])

    if y2==0:
        query.append([x2,i])
    elif x2==R:
        query.append([R+y2,i])
    elif y2==C:
        query.append([R+C+(R-x2),i])
    else:
        query.append([2*R+2*C-y2,i])

query.sort(reverse=True)
que=[]
dic=[0 for i in range(n)]
while query:
    t,num=query.pop()
    if dic[num]==0:
        que.append(num)
        dic[num]=1
    else:
        if que[-1]!=num:
            print("NO")
            exit()
        else:
            dic[num]=2
            que.pop()
print("YES")


Measured memory_bytes: 92636
import Data.List

main = do
  getLine
  li <- getLine
  let as = map read $ words li
  let ans = compute as
  print ans

d :: Integer
d = 1000000007

compute :: [Integer] -> Integer
compute as = foldl1' f bs
  where
    x = foldl1' lcm as
    bs = map (div x) as
    f a b = (a + b) `mod` d


Measured memory_bytes: 6780
import collections

def div_calculation(a, b):
    while b > 0:
        a, b = b, a%b
    return a

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

A, B = map(int, input().split())
div_ab = div_calculation(A, B)
c_dict = collections.Counter(prime_factorize(div_ab))
ans = len(c_dict.keys()) + 1
print(ans)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n)-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(b)-1;i>=(a);--i)
#define ALL(a) a.begin(),a.end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
    if (a < b) { a = b; return true; }
    return false;
}
template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
    if (a > b) { a = b; return true; }
    return false;
}
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp) {
    os << "{";
    int a = 0;
    for (auto &tp : mp) {
        if (a) os << ", ";
        a = 1;
        os << tp;
    }
    return os << "}";
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    os << p.first << ":" << p.second;
    return os;
}

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

    for (;;) {
        int n; cin >> n;
        if (n == 0) break;
        map<string,int> mp;
        REP(i, n) {
            string s, t; cin >> s >> t;
            ++mp[s], --mp[t];
        }

        int ans = 0, cnt = 0;
        for (auto &tp : mp) {
            cnt += tp.second;
            chmax(ans, cnt);
        }
        cout << ans << endl;
    }

    return 0;
}



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


struct unionfind{
    vector<int> d;
    unionfind(int n=0) : d(n, -1){}
    int find(int x) {//根を返す関数
        if(d[x]<0) return x;
        return d[x]=find(d[x]);//d[x]にfind[d[x]]の値を代入してそれを返している．これにより根に全ての子を繋げられる．
    }
    bool unite(int x, int y){
        x=find(x);y=find(y);
        if(x == y) return false;
        if(d[x]>d[y]) swap(x, y);//-なので逆にしている
        d[x]+=d[y];//連結成分サイズを保持している
        d[y]=x;//yの根をxにしている
        return true;
    }
    bool same(int x, int y){return find(x)==find(y);}
    int size(int x){return -d[find(x)];}
};

int deg[100005];
vector<int > to[100005];

int main(void){
    int n, m, k;
    cin>>n>>m>>k;
    unionfind uf(n);
    rep(i, m){
        int a, b;
        cin>>a>>b;
        --a;--b;
        uf.unite(a, b);
        deg[a]++;
        deg[b]++;
    
    }
    rep(i, k){
        int a, b;
        cin>>a>>b;
        --a;--b;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    
    rep(i, n){
        int ans=uf.size(i)-1-deg[i];
        for(auto u : to[i]){
            if(uf.same(i, u)) --ans;
        }
        cout<<ans<<endl;
    }
    return 0;

}

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

int main (void) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    string ans;

    int diff_a_c, diff_a_b, diff_b_c;
    if ((a-c) < 0) {
        diff_a_c = c-a;
    } else {
        diff_a_c = a-c;
    }

    if ((a-b) < 0) {
        diff_a_b = b-a;
    } else {
        diff_a_b = a-b;
    }

    if ((b-c) < 0) {
        diff_b_c = c-b;
    } else {
        diff_b_c = b-c;
    }

    if (diff_a_c <= d) {
        ans = "Yes";
    } else {
        if (diff_a_b <= d and diff_b_c <= d) {
            ans = "Yes";
        } else {
            ans = "No";
        }
    }

    cout << ans << endl;
}

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

int main() {
  int N;
  cin>>N;
  vector<int> L(N);
  for(int i=0; i<N; i++){
    cin >> L.at(i);
  }
  int cnt=0;
  sort(L.begin(),L.end());
  for(int i=0; i<N; i++){
    for(int j=i+1; j<N; j++){
      for(int k=j+1; k<N; k++){
    	if(L.at(i)+L.at(j)>L.at(k)&&L.at(i)!=L.at(j)&&L.at(j)!=L.at(k)){
          cnt++;
        }
      }
  	}
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main() {
    int a, b, k;
    cin >> a >> b >> k;

    int taka = a, aoki = b;
    int turn = 0;
    while(1) {
        if(turn%2 == 0) {
            if(taka%2 == 1) {
                taka--;
            }
            aoki += taka/2;
            taka /= 2;
        }
        else {
            if(aoki%2 == 1) {
                aoki--;
            }
            taka += aoki/2;
            aoki /= 2;
        }
        turn++;
        if(turn == k) {
            break;
        }
    }

    cout << taka << " " << aoki << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pp() pop_back()
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
//#define min min<int>
//#define max max<int>
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
/*template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}*/
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 /*int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }*/
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int a){
	par= vector<int>(a,-1);
  }
  int find(int a){
    if(par[a]<0)
      return a;
    else
      return par[a]=find(par[a]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
int gcm(int a,int b){
    if(b==0)
        return a;
    return gcm(b,a%b);
}
int lcm(int a,int b){
    return a/gcm(a,b)*b;
}
/*struct aa{
	vector<int> gt;
  aa(int n){
	gt= vector<int>(n, 1);
  }
	void c(V<int> d,int b){
	if(d[b]==0){
		gt[d[b]-1]++;
		gt[gt.sz-1]++;
	}
	else{
		gt[d[b]-1]++;
		c(d,d[d[b]]-1);
	}
}
void cok(int a){
	cout<<gt[a-1]<<endl;
	fo(i,a-1)
	cout<<gt[i]<<endl;
}
};
*/
/*struct dfs(){

}*/
signed main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  cout<<c-(d-b)<<' '<<d+(c-a)<<' '<<a-(d-b)<<' '<<b+(c-a)<<endl;
}


Measured memory_bytes: 256