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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main(void){
	ll k;
	cin >> k;

	const ll n = 50;
	vector<ll> a(n,n-1);

	rep(i,n)  a[i] += k/n;

	k%=n;

	rep(i,k){
		rep(j,n){
			if(i==j) 
				a[j]+=n;
			else
				a[j]--;
		}
	}

	cout << n << endl;
	rep(i,n) cout << (i?" ":"") << a[i];
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a[] = new int[3];
		for (int i = 0; i < 3; ++i) {
			a[i] = scan.nextInt();
		}
		Arrays.sort(a);
		System.out.printf("%d %d %d\n", a[0], a[1], a[2]);
	}

}


Measured memory_bytes: 26216
#include <iostream>

using namespace std;

int main() {

    ios::sync_with_stdio(false);

    string T;
    cin >> T;

    int P = T.size()-1;

    while(P >= 0) {

        //cout << P << '\n';

        if(P >= 4) {
            if(T[P] == 'm' && T[P-1] == 'a' && T[P-2] == 'e' && T[P-3] == 'r' && T[P-4] == 'd') {
                P -= 5;
                continue;
            }
        }

        if(P >= 6) {
            if(T[P] == 'r' && T[P-1] == 'e' && T[P-2] == 'm' && T[P-3] == 'a' && T[P-4] == 'e' && T[P-5] == 'r' && T[P-6] == 'd') {
                P -= 7;
                continue;
            }
        }

        if(P >= 4) {
            if(T[P] == 'e' && T[P-1] == 's' && T[P-2] == 'a' && T[P-3] == 'r' && T[P-4] == 'e') {
                P -= 5;
                continue;
            }
        }

        if(P >= 5) {
            if(T[P] == 'r' && T[P-1] == 'e' && T[P-2] == 's' && T[P-3] == 'a' && T[P-4] == 'r' && T[P-5] == 'e') {
                P -= 6;
                continue;
            }
        }

        cout << "NO";
        return 0;

    }

    cout << "YES";

    return 0;
}


Measured memory_bytes: 512
package main

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

type Edge struct {
	node int
	cost int
}

var edge [][]Edge
var ans []int

func dfs(node int, cost int) {
	for _, v := range edge[node] {
		if ans[v.node] != 0 {
			continue
		}
		if (cost+v.cost)%2 == 0 {
			ans[v.node] = 1
		} else {
			ans[v.node] = 2
		}
		dfs(v.node, cost+v.cost)
	}
}

func main() {
	sc := NewScanner()
	N := sc.NextInt()
	ans = make([]int, N+1)
	edge = make([][]Edge, N+1)
	for i := 0; i < N; i++ {
		edge[i+1] = make([]Edge, 0)
	}

	for i := 0; i < N-1; i++ {
		A, B, C := sc.NextInt(), sc.NextInt(), sc.NextInt()
		edge[A] = append(edge[A], Edge{B, C})
		edge[B] = append(edge[B], Edge{A, C})
	}

	dfs(1, 0)

	for i := 1; i <= N; i++ {
		fmt.Println(ans[i] - 1)
	}
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 25216
from sys import stdin
from math import gcd
def main():
    #入力
    readline=stdin.readline
    K=int(readline())
    res=0
    for a in range(1,K+1):
        for b in range(1,K+1):
            for c in range(1,K+1):
                res+=gcd(c,gcd(a,b))

    print(res)
if __name__=="__main__":
    main()

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

int main() {
    long long k, a, b; cin >> k >> a >> b;
    k++;
    if(a + 2 > b || a + 2 > k) cout << k << endl;
    else  {
        long long res = 0;
        k -= a+2;
        res = b;
        res += k/2 * (b - a);
        res += k % 2;
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define PB push_back
#define F first
#define S second
#define MP m ake_pair
#define LB lower_bound
#define UB upper_bound

using namespace std;
typedef long long ll;
typedef pair<int , int> pii;
typedef long double DB;

const int N = 2010;

int n , k , q , cmp[N] , ans(1000*1000*1000LL);
pii a[N];

bool mark[N];

	vector <pii> vc[N] , tmp;
set <pii> s;

void add(pii b){

	mark[b.S] = 1;
	int t(0);
	
	if(mark[b.S+1]){
	    int c = cmp[b.S+1];
	   	cmp[b.S] = c;
		vc[c].PB(b);
		sort(vc[c].begin() , vc[c].end());
		t = c;
		if(b.S && mark[b.S-1]){
		    tmp.clear();
			int pt1(0) , pt2(0) , c2 = cmp[b.S-1];
			while(pt1 < vc[c].size() || pt2 < vc[c2].size()){
			   	  if(pt2 == vc[c2].size() || (pt1 != vc[c].size() && vc[c][pt1] <= vc[c2][pt2]))
					  tmp.PB(vc[c][pt1]) , pt1++;
				  else
					 tmp.PB(vc[c2][pt2]) , pt2++;
			}
			
			vc[c] = tmp;
			vc[c2].clear();

			for(auto u : vc[c])
				cmp[u.S] = c;
			
		}
	}
	else if(b.S && mark[b.S-1]){
	    int c = cmp[b.S-1];
		cmp[b.S] = c;
		vc[c].PB(b);
		t = c;
		sort(vc[c].begin() , vc[c].end());		
	}
	else{
	    vc[b.S].PB(b);
		cmp[b.S] = b.S;
		if(k == 1)
			s.insert(b);
		
		return;
	}

	for(auto u : vc[t])
	   s.erase(u);

	for(int i = 0 ; i < (int) vc[t].size() - k + 1 ; i++)
	   s.insert(vc[t][i]);

	return;
}

int main(){

	ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
	
	cin >> n >> k >> q;

	for(int i = 0 ; i < n ; i++){
	   	cin >> a[i].F;
		a[i].S = i;
	}
	
	sort(a , a+n , greater <pii> ());
	
	for(int i = 0 ; i < n ; i++){
		add(a[i]);
		int pt(0);
		for(auto it = s.begin() ; it != s.end() && pt < q ; it++){
		   	if(pt+1 == q)
			   ans = min(ans , it->F - s.begin()->F);
			
			pt++;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin>>n;
  vector<vector<int>> d(n, vector<int>(2));
  vector<int>k(n);
  for(int i=0;i<n;i++){
    cin>>d.at(i).at(0)>>d.at(i).at(1);
    if(d.at(i).at(0)==d.at(i).at(1)){
      k.at(i)=1;
    }
    else{
      k.at(i)=0;
    }
  }
  int p;
  p=0;
  for(int i=0;i<n-2;i++){
    if(k.at(i)+k.at(i+1)+k.at(i+2)==3){
      p=1;
      break;
    }
  
  }
  if(p==1){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 3596
a = list(map(int, input().split()))
ans = 10 ** 30
for i in range(3):
    tmp = (a[i] // 2) * a[i - 1] * a[i - 2]
    total = a[i] * a[i - 1] * a[i - 2]
    ans = min(ans, total - (2 * tmp))

print(ans)

Measured memory_bytes: 3060
// Template Headers {{{
#include <bits/stdc++.h>
using namespace std;

using pii = pair<int, int>; using vpii = vector<pii>;
using vi = vector<int>; using vvi = vector<vi>;
using ll = long long;
using pll = pair<ll, ll>; using vpll = vector<pll>;
using vll = vector<long long>; using vvll = vector<vll>;
template <class T> using min_queue = priority_queue<T, vector<T>, greater<T>>;
template <class T> istream &operator>>(istream &, vector<T> &);
template <class T> ostream &operator<<(ostream &, const vector<T> &);
template <class T, class U> istream &operator>>(istream &, pair<T, U> &);
template <class T, class U> ostream &operator<<(ostream &, const pair<T, U> &);
template <class T> struct Inf { static constexpr T inf() { return std::numeric_limits<T>::has_infinity ? std::numeric_limits<T>::infinity() : std::numeric_limits<T>::max(); } };
template <> struct Inf<int> { static constexpr int inf() { return 0x3f3f3f3f; } };
template <> struct Inf<long long> { static constexpr long long inf() { return 0x3f3f3f3f3f3f3f3fLL; } };
constexpr int INF = Inf<int>::inf(); constexpr ll BINF = Inf<ll>::inf();
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// }}}
// Preprocessing & "Global" variables {{{
struct Solver {
	Solver() {}
	int solve();
};
// }}}


int Solver::solve() {
	int n; cin >> n;
	int lstt = 0, lstx = 0, lsty = 0;
	bool okay = true;
	for (int i = 0; i < n; i++) {
		int t, x, y; cin >> t >> x >> y;
		int dt = t - lstt;
		int dx = abs(x - lstx);
		int dy = abs(y - lsty);
		int dxdy = dx + dy;
		if ((dt & 1) != (dxdy & 1)) okay = false;
		if (dt < dxdy) okay = false;
		lstx = x, lsty = y, lstt = t;
	}
	cout << (okay ? "Yes" : "No") << endl;
	return 0;
}

// Template Main {{{
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	Solver solver;
	#ifdef JUDGE_MULTI_CASE
		int t; cin >> t; for (int i = 1; i <= t; i++)
	#endif
	solver.solve();
	// cout << "Case #" << i << ": ", solver.solve();
	return 0;
}

template <class T> istream &operator>>(istream &is, vector<T> &v) {
	for (auto it=v.begin();it!=v.end();++it) is >> *it;
	return is;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
	for (auto it=v.begin();it!=v.end();) os << *it, os << " \n"[++it==v.end()];
	return os;
}

template <class T, class U> istream &operator>>(istream &is, pair<T, U> &p) {
	return is >> p.first >> p.second;
}

template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p) {
	return os << p.first << ' ' << p.second;
}
// }}}

// vim: fdm=marker


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

int main(){
    int N,M; cin >> N >> M;
    vector<int> dp(1<<N,1e9);
    dp[0]=0;
    for(int i=0;i<M;i++){
        int a,b; cin >> a >> b;
        int mask=0;
        for(int j=0;j<b;j++){
            int c; cin >> c; c--;
            mask+=(1<<c);
        }
        for(int k=0;k<(1<<N);k++){
            dp[k|mask]=min(dp[k|mask],dp[k]+a);
        }
    }
    if(dp[(1<<N)-1]==1e9){
        cout << -1 << endl;
        return 0;
    }
    cout << dp[(1<<N)-1] << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<map>
using namespace std;
const int maxn=2e5+10;
int F1[maxn],F2[maxn];
int findset1(int x)
{
    if(F1[x]==-1) return x;
    return F1[x]=findset1(F1[x]);
}
int findset2(int x)
{
    if(F2[x]==-1) return x;
    return F2[x]=findset2(F2[x]);
}
int main()
{
    memset(F1,-1,sizeof(F1));
    memset(F2,-1,sizeof(F2));
    int n,k,l;
    scanf("%d%d%d",&n,&k,&l);
    for(int i=1;i<=k;i++)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        int fx=findset1(x);
        int fy=findset1(y);
        if(fx!=fy)
            F1[fx]=fy;
    }
    for(int i=1;i<=l;i++)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        int fx=findset2(x);
        int fy=findset2(y);
        if(fx!=fy)
            F2[fx]=fy;
    }
    map<pair<int ,int >,int >mp;
    for(int i=1;i<=n;i++)
    {
        mp[make_pair(findset1(i),findset2(i))]++;
    }
    for(int i=1;i<=n;i++)
    {
        cout<<mp[make_pair(findset1(i),findset2(i))]<<" ";
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 13696
#include <iostream>
#include <vector>
#include <utility>
#include <numeric>
#include <functional>
#include <stdio.h>
#include <math.h>
#include <string>
#include <algorithm>
#include <deque>
#include <queue>
#include <map>
#include <chrono>

using namespace std;
using ll = long long;

int main() {
	int N;
	cin >> N;
	vector<int> vx;
	vector<int> vy;
	vector<int> vh;
	for (int i = 0; i != N; ++i) {
		int x, y, h;
		cin >> x >> y >> h;
		vx.push_back(x);
		vy.push_back(y);
		vh.push_back(h);
	}
	for (int i = 0; i != 101; ++i) {
		for (int j = 0; j != 101; ++j) {
			int k = 0;
			while(vh[k] == 0) {
				++k;
			}
			int H = int(abs(vx[k]-i)) + int(abs(vy[k]-j)) + vh[k];
			bool b = true;
			k = 0;
			while(k < vh.size()) {
				if (vh[k] != max(H - int(abs(vx[k]-i)) - int(abs(vy[k]-j)), 0)) {
					b = false;
					break;
				}
				++k;
			}
			if (b) {
				cout << i << " " << j << " " << H << endl;
				return 0;
			}
		}
	}
}


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

while True:
   q = int(input())
   if q == -1: break
   
   x = q / 2
   while abs(x ** 3 - q) >= 0.00001 * q:
      x = x - (x ** 3 - q) / (3 * x ** 2)
   print(x)



Measured memory_bytes: 5664
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define REPD(i,a,b) for (int i=(a);i<=(b);i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef set<int> si;
typedef vector<si> vsi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pi;
typedef queue<int> qi;
typedef queue<pi> qpi;
typedef pair<ll, ll> pll;
typedef queue<pll> qpll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const int mod = 1000000007;
const int INF = 1001001001;
// 小数点　<< fixed << setprecision(0) <<
// sort降順　sort(ALL(),greater<int>());
// 円周率　M_PI
// 文字判定　isupper islower
// 文字変換　
// 順列　do {} while(next_permutation(ALL(X)));
// 最大値　LLONG_MAX
// a内でx以上　auto iter = lower_bound(ALL(a), x);
// a内でxより大きい　auto iter = upper_bound(ALL(a), x);
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};
typedef struct edge se;
typedef vector<edge> ve;
unsigned Euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return Euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

vpll PrimeFactorization(ll n) {
  vpll res;
  for (ll i=2; i*i<=n; i++) {
    if(n%i!=0) continue;
    ll ex=0;
    while(n%i==0) {
      ex++;
      n/=i;
    }
    res.push_back(pll(i,ex));
  }
  if(n!=1) res.push_back(pll(n,1));
  return res;
}

int main() {
  int n,a,b;
  cin >> n >> a >> b;
  int ans=0;
  REP1(i,n) {
    int c=i,t=c%10;
    while(c!=0) {
      c/=10;
      t+=c%10;
    }
    if(a<=t&&t<=b) {
      ans+=i;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3580
import java.util.Scanner;
 
class Main{
 
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int n = b -a ;
		int sum = 0;
		int ans = 0;
		for(int i=0;i < n;i++){
			sum += i;
		}
		ans = sum -a;
		System.out.println(ans);
	}
 
 
 
 
 
 
 
 
 
}
 

Measured memory_bytes: 21972
#include <iostream>
#include <math.h>
using namespace std;
int main(){
	int n;
	while(cin>>n){
		bool prime[1000000];
		for(int i=2;i<=999999;i++){
			prime[i]=true;
		}
		for(int j=2;j<=999999;j++){
			if(prime[j]){
				for(int k=j*2;k<=999999;k+=j){
					prime[k]=false;
				}
			}
		}
		int a,b;
		for(int l=2;l<n;l++){
			if(prime[l]==true) a=l;
		}
		for(int m=n+1;m<=999999;m++){
			if(prime[m]==true){
				b=m;
				break;
			}
		}
		cout<<a<<" "<<b<<endl;
	}
	return 0;
	
}

Measured memory_bytes: 2136
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;

int main() {
	long long int n=700,m,a,b,c,d,e;
	long double z,w;
	string str,str2,str3;
	char ch;
	long long int x[130]={};
	cout << fixed << setprecision(10);
	cin>>a;
	cout<<a/3;
} 


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

int ten(int hoge) {
	return (int)std::pow(10, hoge);
}

int main()
{
	int N;
	std::cin >> N;
	vector <int>A(9);
	int Ans = 0;
	for (int i = 0; i < 9;i++) {
		A[i] = ((N / ten(8 - i)) % 10);
		Ans = Ans + A[i];
	}
	if (N % Ans == 0)std::cout << "Yes";
	else std::cout << "No";
	return 0;
}

Measured memory_bytes: 384
import Data.Fixed
main = getContents >>= mapM_ (putStrLn . fout . debt_hell . fin) . lines
fin = read
fout = show . round
debt_hell n = foldr (\e acc -> round1000 (acc*e)) 100000 (replicate n 1.05)
 where round1000 x = if mod' x 1000 == 0 then x else x + (1000 - mod' x 1000)

Measured memory_bytes: 3964
import sys
sys.setrecursionlimit(10**7)
N = int(input())
N -= 1

S = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n"]


def dfs(s, depth, maxS):

    if depth == N:
        print(s)
        return

    for i in range(maxS+1):
        if i == maxS:
            dfs(s + S[i], depth+1, maxS+1)
        else:
            dfs(s + S[i], depth+1, maxS)


dfs("a", 0, 1)


Measured memory_bytes: 4340
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <set>
#include <numeric>
#include <bitset>
#include <map>
#include <limits.h>
using namespace std;
typedef unsigned long ul;
typedef pair<ul, ul> P;
const int INF = 1e9;




int main(){
    int N;
    long long K;
    cin >> N >> K;
    long long ans[100000+1] = {};
    for(int i = 0; i < N;i++){
        int a,b;
        cin >> a >> b;
        ans[a] += b;
    }
    for(int i = 1; i <= 100000;i++){
        if(ans[i]>= K){
            cout << i << endl;
            break;
        }
     K -=ans[i];
    }
return 0;

}

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

int main(){
	int n;
	
	bool l[4][13];
	for(int i = 0; i < 4; i++){
		for(int j = 0; j < 13; j++){
			l[i][j] = false;
		}
	}

	cin >> n;

	for(int i = 0; i < n; i++){
		char mark;
		int number;
		cin >> mark >> number;
		switch(mark){
			case 'S': l[0][number-1] = true; break;
			case 'H': l[1][number-1] = true; break;
			case 'C': l[2][number-1] = true; break;
			case 'D': l[3][number-1] = true; break;
		}
	}

	//0:S
	for(int j = 0; j < 13; j++){
		if(l[0][j] == false){
			cout << "S " << j+1 << endl;
		}
	}

	//1:H
	for(int j = 0; j < 13; j++){
		if(l[1][j] == false){
			cout << "H " << j+1 << endl;
		}
	}

	//2:C
	for(int j = 0; j < 13; j++){
		if(l[2][j] == false){
			cout << "C " << j+1 << endl;
		}
	}

	//3:D
	for(int j = 0; j < 13; j++){
		if(l[3][j] == false){
			cout << "D " << j+1 << endl;
		}
	}

	return(0);
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <queue>
#include <stack>
#include <set>
#include <cmath>

typedef long long ll;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<x<<endl
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SUM(vec) accumulate(all(vec),0)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<#a<<':'<<a<<endl

const ll INF = 1e9+7;

template<typename T>inline T digit(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);}
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;}
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;}


int binary_search(vector<int> a,int key){
  int high = a.size()-1;
  int low = 0;

  while(high > low){
    int mid = (high + low) / 2;
    if(key < a[mid]){
      high = mid - 1;
    }else if(key > a[mid]){
      low = mid + 1;
    }else{
      return mid;
    }
  }
  return -1;
}

int main() {
  cin.tie(0); ios::sync_with_stdio(0);
  int n,m;cin>>n>>m;
  vector<string> s(n);rep(i,n)cin>>s[i];
  vector<vector<bool> > ok(n,vector<bool>(m)); rep(i,n)rep(j,m)ok[i][j] = s[i][j] == '.';
  rep(i,n){
    rep(j,m-1){
      if(s[i][j] == s[i][j+1] && s[i][j] == '#'){
        ok[i][j] = true;
        ok[i][j+1] = true;
      }
    }
  }
  rep(i,m){
    rep(j,n-1){
      if(s[j][i] == s[j+1][i] && s[j][i] == '#'){
        ok[j][i] = true;
        ok[j+1][i] = true;
      }
    }
  }
  bool ans = true;
  rep(i,n)rep(j,m) ans &= ok[i][j];
  if(ans)print("Yes");
  else print("No");

  return 0;
} 


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#define NUM 4
using namespace std;
 
int main(void){
    int N, M;
    scanf("%d", &N);
    scanf("%d", &M);

    int num[NUM];

    for(int i = 1; i < NUM; i++){
        num[i] = -1;
    }

    for(int i = 0; i < M; i++){
        int s, c;
        scanf("%d %d", &s, &c);

        if(num[s] == -1 || num[s] == c){
            num[s] = c;
        } else{
            printf("-1\n");
            return 0;
        }
    }

    if(num[1] == -1){
        if(N == 1){
            printf("0\n");
            return 0;
        }else{
            num[1] = 1;
        }
    }

    if(num[1] == 0 && N != 1){
        printf("-1\n");
        return 0;
    }

    for(int i = 2; i <= N; i++){
        if(num[i] == -1){
            num[i] = 0;
        }
    }

    for(int i = 1; i <= N; i++){
        printf("%d", num[i]);
    }
    printf("\n");

    return 0;
}


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

int main(){
  int a, b, m;
  cin >> a;
  cin >> b;
  m = (a + b) % 2;
  if (m == 0){
    m = (a + b) / 2;
    }
  else{
    m = (a + b) / 2 + 1;
    }

  cout << m << endl;
}


Measured memory_bytes: 256
D,G = map(int,input().split())
pc = [list(map(int,input().split())) for i in range(D)]
ans = float('inf')
for bit in range(1<<D):
    _sum = 0
    _ans = 0
    rest = [i for i in range(D)]
    for i in range(D):
        if bit & (1<<i):
            _sum += pc[i][0]*(i+1)*100 + pc[i][1]
            _ans += pc[i][0]
            rest.remove(i)
    if _sum < G and len(rest) != 0:
        i = max(rest)
        for j in range(pc[i][0]-1):
            _sum += (i+1)*100
            _ans += 1
            if _sum >= G:
                break
    if _sum >= G:
        ans = min(ans,_ans)
print(ans)

Measured memory_bytes: 74152
#include<stdio.h>

int main(void) {
	int p, q, r;

	scanf("%d%d%d", &p, &q, &r);

	if (p < q) {
		if (q < r) {
			printf("%d", p + q);
		}
		else {
			printf("%d", p + r);
		}
	}
	else {
		if (p < r) {
			printf("%d", p + q);
		}
		else {
			printf("%d", r + q);
		}
	}

	return 0;
}

Measured memory_bytes: 128
import qualified Data.ByteString.Char8 as BS
import Data.Maybe
import Control.Monad

main :: IO ()
main = do
  n <- readLn
  a <- replicateM n (fst . fromJust . BS.readInt <$> BS.getLine)
  print $ (head a - 1) + solve 1 (tail a)

solve :: Int -> [Int] -> Int
solve _ [] = 0
solve m (n:ns)
  | n == m+1           = solve n ns
  | n `mod` (m+1) == 0 = n `div` (m+1) - 1 + solve m ns
  | otherwise          = n `div` (m+1) + solve m ns


Measured memory_bytes: 22012
#include"bits/stdc++.h"
using namespace std;

void Main() {
  int n, d;
  cin >> n >> d;
  vector<vector<int>> x(n);

  for (int i = 0; i < n; i++) {
    x[i].resize(d);
    for (int j = 0; j < d; j++) {
      cin >> x[i][j];
    }
  }

  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      long long dist = 0;
      for (int k = 0; k < d; k++) {
        dist += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
      }
      for (int k = 1; k * k <= dist; k++) {
        if (k * k == dist) {
          ans++;
          break;
        }
      }
    }
  }
  cout << ans << endl;
}

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


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


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

  int cnt = 0;
 
  for(int i=a;i <= b;i++){
  if(c % i == 0) cnt++;
  }

 cout<<cnt<<endl;

 
 return 0;
}


Measured memory_bytes: 3116
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
#define N 85
int lim=85*160;
bool f[N][N][N*N*4+5];
int u[N][N],v[N][N];
int a[N][N];
signed main()
{
#ifdef __LOCAL__
	freopen("in.txt","r",stdin);
#endif
	int n=read(),m=read();
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++) u[i][j]=read();
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++) v[i][j]=read();
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			a[i][j]=u[i][j]-v[i][j];
		}
	}
//	cout<<N*N*4<<endl;
//	cout<<f[1][1][1]<<endl;
	f[1][1][a[1][1]+lim]=1;
	f[1][1][-a[1][1]+lim]=1;
//	cout<<lim<<endl;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			for(int k=0;k<=lim*2;k++)
			{
				if(f[i-1][j][k]==1) f[i][j][k+a[i][j]]=1,f[i][j][k-a[i][j]]=1;
				if(f[i][j-1][k]==1) f[i][j][k+a[i][j]]=1,f[i][j][k-a[i][j]]=1;
			}
		}
	}
//	for(int i=1;i<=n;i++)
//	{
//		for(int j=1;j<=m;j++)
//		{
//			printf("\n%d %d : ",i,j);
//			for(int k=0;k<=lim*2;k++)
//			{
//				if(f[i][j][k]) printf("%d ",k-lim);
//			}
//		}
//	}
	int ans=lim*4;
	for(int i=0;i<=lim*2;i++)
	{
		if(f[n][m][i]==1)
		{
			int to=abs(i-lim);
//			cout<<to<<endl;
			if(to<ans) ans=to;
		}
	}
	cout<<ans<<endl;
#ifdef __LOCAL__
	printf("Time Used : %d\n",clock());
#endif
	return 0;
}



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

typedef long long ll;
typedef pair<ll,ll> pll;
#define dbg          cout<<"Freak"<<endl;
#define dbgg(i)      cout<<i<<endl;
#define N            1e9+7
#define pb           push_back
#define pf           push_front
#define pi           acos(-1)
#define all(x)       x.begin(),x.end()
ll t;
vector<ll>v,r,g,c;


int main()
{
    ll a,b,c,d,e,f,i,j;
    cin>>a>>b>>c>>d>>e;
    for(i=0;i<c;i++)
    {
        cin>>f;
        r.pb(f);
    }
    sort(all(r));
    reverse(all(r));
    for(i=0;i<a;i++)
    {
        v.pb(r[i]);
    }
    for(i=0;i<d;i++)
    {
        cin>>f;
        g.pb(f);
    }
    sort(all(g));
    reverse(all(g));
    for(i=0;i<b;i++)
    {
        v.pb(g[i]);
    }
    for(i=0;i<e;i++)
    {
        cin>>f;
        v.pb(f);
    }
    sort(all(v));
    reverse(all(v));
    f=0;
    for(i=0;i<a+b;i++)
    {
        f+=v[i];
    }
    cout<<f<<endl;


}



Measured memory_bytes: 7408
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int W = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		if(a + W < b){
			System.out.println(b - (a + W));
		}else if(a > b + W){
			System.out.println(a- (b + W));
		}else{
			System.out.println(0);
		}
	}
}

Measured memory_bytes: 21972
//#include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <limits.h>
#include <string>
#include <deque>
#include <cmath>
#include <bitset>
#include <complex>
#include <time.h>
#include <stdio.h>

typedef long long ll;
typedef std::pair<int, int> Pii;
typedef std::pair<long long, long long> Pll;
typedef std::pair<double, double> Pdd;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define mapa make_pair
#define all(a) a.begin(), a.end()
#define MM << " " <<

template<typename T>
using MaxHeap = std::priority_queue<T>;
template<typename T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<typename T>
inline bool chmax(T &a, T b){
	if(a<b){
		a = b;
		return true;
	}
	return false;
}
template<typename T>
inline bool chmin(T &a, T b){
	if(a>b){
		a = b;
		return true;
	}
	return false;
}
template<typename T>
std::vector<T> vec(int len, T elem) {return std::vector<T>(len, elem);}
template<typename T>
void vdeb(std::vector<T> &da) {
	for (int i = 0;i < da.size();i++) {
		if (i == da.size() - 1) std::cout << da[i] <<std:: endl;
		else std::cout << da[i] << ' ';
	}
}
template<typename T>
void vvdeb(std::vector<T> &da) {
	for (int i = 0;i < da.size();i++) vdeb(da[i]);
}

using namespace std;

int n;

void bfs(vector<vector<int>> &to, vector<int> &da, int st){
	vector<bool> ju(n,true);
	queue<int> q;
	q.push(st);
	da[st] = 0;
	ju[st] = false;
	while(!q.empty()){
		int now = q.front();q.pop();
		rip(i, to[now].size(),0){
			if(ju[to[now][i]]){
				da[to[now][i]] = da[now]+1;
				ju[to[now][i]] = false;
				q.push(to[now][i]);
			}
		}
	}
	return;
}

int main(){
	cin >> n;
	vector<vector<int>> to(n,vector<int>(0));
	rip(i,n-1,0){
		int x,y;cin >> x >> y;
		x--;y--;
		to[x].push_back(y);
		to[y].push_back(x);
	}
	vector<int> a(n),b(n);
	bfs(to,a,0);bfs(to,b,n-1);
	//vdeb(a);vdeb(b);
	int fe=0,su=0;
	rip(i,n,0){
		if(a[i] <= b[i]) fe++; else su++;
	}
	printf((fe<=su)?"Snuke\n":"Fennec\n");
}

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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int

int main(){
  int N,M;
  cin>>N>>M;
  map<int,int> m;
    rep(i,N)
    {
        int q;
        cin>>q;
        rep(j,q)
        {
            int t;
            cin>>t;
            m[t]++;
        }
    }
    int count=0;
    for(int i=1;i<M+1;i++)
    {
        if(m[i]==N)
        count++;
    }
    cout<<count<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

void solve(){
    int n;
    cin >> n;
    Vi a(n);
    rp(i,n) cin >> a.at(i);
    ll ans=0;
    Sort(a);
    ans+=a[0];
    rp(i,n-2){
        ans += a.at(i/2+1);
    }
    print(ans);
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

Measured memory_bytes: 4780
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define test ll t; cin>>t; while(t--)
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
int solve()
{
	int n;
	cin>>n;
	string ans;
	while(n>0){
		n--;
		ans+=char('a'+n%26);
		n/=26;
	}
	reverse(ans.begin(),ans.end());
	cout<<ans<<endl;
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}






Measured memory_bytes: 3648
using namespace std;
#include <iostream>
#include <string>
#include <set>
#include <functional>
#include <vector>
#include <algorithm>

int main()
{
	int n,s;
	while(cin>>n>>s&&(n||s)){
		if(!n){cout<<"0"<<endl;continue;}
		int comb=(1<<n)-1,ans=0;
		while(comb<1<<10){
			int sum=0;
			for(int i=0;i<10;i++){
				sum+=i*((comb>>i)&1);
			}
			//cout<<"sum:"<<sum<<endl;
			if(sum==s)ans++;
			int x=comb&-comb,y=comb+x;
			comb=((comb&~y)/x>>1)|y;
		}
		cout<<ans<<endl;
	}
    return 0;
}

Measured memory_bytes: 1160
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define INF 2e9
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,flag=0,count=0,count2=0;
  string s;
  cin>>s;
  rep(i,4){
    if(i!=0){
      if(s[i]!=s[i-1]){
	flag++;
      }
      else if(flag==0){
	count++;
      }
      else{
	count2++;
      }
    }
  }
  if(count>1 || count2>1){
    cout<<"Yes"<<'\n';
  }
  else{
    cout<<"No"<<'\n';
  }
  
  return(0);
}


Measured memory_bytes: 256
if __name__ == "__main__":
    n, m = map(int, input().split())
    edge = list()
    for i in range(m):
        edge.append(list(map(int, input().split())))

    ans = 0

    def dfs(v):
        visted[v] = True
        for i in range(n):
            if graph[v][i] is False:
                continue
            if visted[i] is True:
                continue
            dfs(i)

    for i in range(m):
        visted = [False] * n
        graph = [[False] * n for _ in range(n)]

        for j in range(m):
            if i != j:
                graph[edge[j][0]-1][edge[j][1]-1] = True
                graph[edge[j][1]-1][edge[j][0]-1] = True
        dfs(0)
        if visted != [True] * n:
            ans += 1

    print(str(ans))


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;
typedef long double ld;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

class UnionFind {
    public:
        vector<int> rank, p, size;

        UnionFind() {}
        UnionFind(int s) {
            rank.resize(s, 0);
            p.resize(s, 0);
            size.resize(s, 0);
            rep (i, s) init(i);
        }

        void init(int x) {
            p[x] = x;
            rank[x] = 0;
            size[x] = 1;
        }

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

        void unite(int x, int y) {
            if (isSame(x, y)) return;
            link(root(x), root(y));
        }

        void link(int x, int y) {
            if (rank[x] > rank[y]) {
                p[y] = x;
                size[x] += size[y];
            } else {
                p[x] = y;
                size[y] += size[x];
                if (rank[x] == rank[y]) {
                    rank[y]++;
                }
            }
        }

        int root(int x) {
            if (x != p[x]) {
                p[x] = root(p[x]);
            }
            return p[x];
        }

        int getSize(int x) {
            return size[root(x)];
        }
};

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int n, m, k;
    cin >> n >> m >> k;
    UnionFind uf = UnionFind(n);
    vector<int> f(n);
    vector<int> b[n];
    // vector<vectror<int> > g(n, vector<int>(n));
    rep (i, m) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        f[a]++, f[b]++;
        // g[a][b] = g[b][a] = 1;
        uf.unite(a, b);
    }
    rep (i, k) {
        int c, d;
        cin >> c >> d;
        c--, d--;
        b[c].push_back(d);
        b[d].push_back(c);
        // g[c][d] = g[d][c] = 2;
    }
    rep (i, n) {
        int cnt = 0;
        rep (j, b[i].size()) {
            if (uf.isSame(b[i][j], i)) cnt++;
        }
        cout << (uf.getSize(i) - f[i] - 1) - cnt;
        if (i < n - 1) cout << " ";
        else cout << endl;
    }
    
    return 0;
}



Measured memory_bytes: 7680
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
	int w,h,n;
	int min_x,max_x,min_y,max_y;
	scanf("%d%d%d",&w,&h,&n);
	min_x = min_y = 0;
	max_x = w;
	max_y = h;
	for(int i=0;i<n;i++){
		int x,y,a;
		scanf("%d%d%d",&x,&y,&a);
		switch(a){
			case 1:
				min_x = max(min_x,x);
				break;
			case 2:
				max_x = min(max_x,x);
				break;
			case 3:
				min_y = max(min_y,y);
				break;
			case 4:
				max_y = min(max_y,y);
				break;
		}
	}
	if(max_x<min_x||max_y<min_y) printf("0\n");
	else printf("%d\n",(max_x-min_x)*(max_y-min_y));
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
public class Hello{
    public static void Main(){
        string[] s = Console.ReadLine().Split(' ');
        int x = int.Parse(s[0]);
        int y = int.Parse(s[1]);
        var a = new List<int>(){1,3,5,7,8,10,12};
        var b = new List<int>(){4,6,9,11};
        if(x == y){
            Console.WriteLine("Yes");
        }else if(a.Contains(x) && a.Contains(y)){
            Console.WriteLine("Yes");
        }else if(b.Contains(x) && b.Contains(y)){
            Console.WriteLine("Yes");
        }else{
            Console.WriteLine("No");
        }
    }
}


Measured memory_bytes: 13140
import sys
sys.setrecursionlimit(10**8)
N=int(input())
P=[int(i) for i in input().split()]
X=[int(i) for i in input().split()]
table=[[] for i in range(N)]
for i in range(N-1):
    table[P[i]-1].append(i+1)
dp=[0]*N #shiro

def tree(pa):
    for i in table[pa]:
        tree(i)
    t=len(table[pa])
    if t==0:
        return
    T=set()
    s=0
    for i in range(t):
        x=table[pa][i]
        s+=X[x]+dp[x]
        if i==0:
            if X[x]<=X[pa]:
                T.add(X[x])
            if dp[x]<=X[pa]:
                T.add(dp[x])
            continue
        S=set()
        for k in T:
            if k+X[x]<=X[pa]:
                S.add(k+X[x])
            if k+dp[x]<=X[pa]:
                S.add(k+dp[x])
        T=S
    if len(T)==0:
        print('IMPOSSIBLE')
        sys.exit()
    dp[pa]=s-max(T)
    return

tree(0)    
print('POSSIBLE')

Measured memory_bytes: 40688
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int main() {

	int n; scanf("%d", &n);
	vector<int> scores(n, 0);
	int perfect = 0;
	for (int i = 0; i < n; ++i) {
		scanf("%d", &scores[i]);
		perfect += scores[i];
	}

	vector<vector<bool>> isPossible(n, vector<bool>(perfect + 1, false));

	isPossible[0][0] = true;
	isPossible[0][scores[0]] = true;

	for (int i = 1; i < n; ++i) {
		for (int score = 0; score <= perfect; ++score) {
			isPossible[i][score] = (isPossible[i-1][score] || (score - scores[i] >= 0 ? isPossible[i-1][score - scores[i]] : false));
		}
	}

	int maxPossible = 0;
	for (int i = 0; i <= perfect; ++i) {
		if (i % 10 != 0 && isPossible[n-1][i]) {
			maxPossible = i;
		}
	}

	printf("%d\n", maxPossible);

	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <utility>
#include <cmath>
#include <queue>

using namespace std;

#define REP(i,n)	for(int i=0, i##_len=(n); i<i##_len; ++i)

#define INF 		2000000007
#define MOD			998244353
#define MAX 		100005

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;


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

	int l = N.length();
	int cnt=0;
	REP(i,l){
		if(N[i]=='o')cnt++;
	}

	if(cnt + (15-l) >= 8)cout << "YES\n";
	else cout << "NO\n";


	return 0;
}



Measured memory_bytes: 256
use proconio::{input, fastout};
use std::collections::HashMap;

#[fastout]
fn main() {
    input! {
        n: usize,
        ax: [i64; n]
    }


    let mut l = HashMap::new();
    let mut r = HashMap::new();

    for (i, &a) in ax.iter().enumerate() {
        (*l.entry(i as i64 + a).or_insert(vec![])).push(i);
        (*r.entry(i as i64 - a).or_insert(vec![])).push(i);
    }

    let mut ans = 0;
    for (key, lvalue) in l.iter() {
        
        if let Some(rvalue) = r.get(key) {
            ans += lvalue.len() * rvalue.len();
        }
    }

    println!("{}", ans);
}

Measured memory_bytes: 33496
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

#define int long long

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

template<typename T>T& max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T& min(T&a,T&b){if(a<b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

signed main()
{ // #define int long long をしてるのでscanfを使うと意味不明な値が入力され死にます
    int N, A,B;cin >> N>>A>>B;

    int cnt = 0;
    rep(i, N) {
        int a;cin>>a;
        if (A<=a&&a<B)cnt++;
    }
    cout<<N-cnt<<endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    a, b, c = rli()
    print(max(0, c-(a-b)))


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <string>
using namespace std;
using ll = long long;

ll MOD = 998244353LL;
ll ADD(ll x, ll y) { return (x+y)%MOD; }

vector<ll> ONES;

vector<ll> DP;
string S;
ll dp(ll i, ll nadd, ll ndel, bool just_deleted, bool deleted) {
  // If S[i]==1, can accept or delete this character. Can delete if we already dropped a 1 somewhere earlier, and either the previous character was a 0 or we just deleted.
  // If S[i]==0, can accept this character or airlift a 1 here. Can airlift if we have 1s left and we didn't delete within this block.
  if(i==S.size()) { return nadd==0 && ndel==0 ? 1LL : 0LL; }
  ll key = i*S.size()*S.size()*2*2 +nadd*S.size()*2*2 + ndel*2*2 + (just_deleted?1:0)*2 + (deleted?1:0);
  if(DP[key]>=0) { return DP[key]; }
  ll ans = 0;
  if(S[i]=='1') {
    ans = ADD(dp(i+1, nadd, ndel,false,deleted), ndel>=1 && just_deleted ? dp(i+1, nadd, ndel-1,true,true) : 0);
  } else {
    ans = ADD(dp(i+1, nadd, ndel,true,false), nadd>=1 && !deleted ? dp(i, nadd-1, ndel+1,true,deleted) : 0);
  }
  /*cerr << "S=";
  for(ll j=0; j<S.size(); j++) {
    if(j==i) { cerr << "["; }
    cerr << S[j];
    if(j==i) { cerr << "]"; }
  }
  cerr << " nadd=" << nadd << " ndel=" << ndel << " ans=" << ans << endl;*/
  DP[key] = ans;
  return ans;
}

int main() {
  ll k;
  cin >> S >> k;
  ll n_one = 0;
  for(ll i=0; i<S.size(); i++) {
    if(S[i]=='1') {
      n_one++;
    }
  }
  k = min(k, n_one);

  ll count = 0;
  for(ll i=0; i<S.size(); i++) {
    if(S[i]=='0') {
      ONES.push_back(count);
      count = 0;
    } else {
      count++;
    }
  }
  ONES.push_back(count);

  DP = vector<ll>(S.size()*S.size()*S.size()*2*2, -1);
  ll ans = 0;
  for(ll nadd=0; nadd<=k; nadd++) {
    ans = ADD(ans, dp(0, nadd, 0,true,false));
  }
  cout << ans << endl;
}


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

using namespace std;

int main() {
    string s;
    cin >> s;
    int n = s.size();

    vector<pair<char,int>> cnt;
    cnt.emplace_back(s[0],0);

    bool ans = false;
    for (int i=0; i<n; i++) {
        if (cnt.back().first == s[i]) cnt.back().second++;
        else cnt.emplace_back(s[i], 1);

        if (cnt.back().second >= 3) ans = true;
    }


    cout << (ans? "Yes" : "No") << endl;
}

Measured memory_bytes: 256