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

typedef long long ll;
#define ar array
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define all(x) (x).begin(), (x).end()
#define en '\n'
#define FILL(x, v) memset(x, v, sizeof(x))
#define pb push_back
#define fast                     \
	ios::sync_with_stdio(false); \
	cin.tie(NULL);               \
	cout.tie(NULL);
#define F_OR(i, a, b, s) for (int i = (a); ((s) > 0 ? i < (b) : i > (b)); i += (s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define FOR(...)       \
	F_ORC(__VA_ARGS__) \
	(__VA_ARGS__)

#define E_ACH2(x, a) for (auto &x : a)
#define E_ACH3(x, y, a) for (auto &[x, y] : a)
#define E_ACH4(x, y, z, a) for (auto &[x, y, z] : a)
#define E_ACHC(...) GET5(__VA_ARGS__, E_ACH4, E_ACH3, E_ACH2)
#define EACH(...)       \
	E_ACHC(__VA_ARGS__) \
	(__VA_ARGS__)

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

int main()
{
	fast;
	int n, ans = 0;
	ll d;
	cin >> n >> d;
	FOR(n)
	{
		ll p, q;
		cin >> q >> p;
		if (p * p + q * q <= d * d)
			ans++;
	}
	cout << ans;
}

Measured memory_bytes: 3644
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define REP(i, b, n) for (Int i = b; i < Int(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
using Int = long long;
Int inf = 1000000000000000001LL;
using vi = vector<Int>;
using vvi = vector<vi>;
using pii = pair<Int,Int>;
using mapis = unordered_map<Int,string>;
using mapii = unordered_map<Int,Int>;

Int GCD(Int a, Int b){
    if(b==0) return a;
    if(a < b) return GCD(b, a);
    unsigned r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

Int LCM(Int a, Int b){
    return a*b/GCD(a,b);
}


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

    map<char,int> mp;
    rep(i,S.size()){
        mp[S[i]]++;
    }

    int size = mp.size();
    bool tmp = false;
    rep(i,S.size()){
        if (mp[S[i]] == 2) {
            tmp = true;
        }else{
            tmp = false;
        }
    }

    string ans = "No";
    if(size==2 && tmp){
        ans = "Yes";
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int n,a[111111],spre[111111],snxt[111111],bpre[111111],bnxt[111111],l,q,pos,j;
int numpre[111111],numnxt[111111],cnt,x,y;
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	scanf("%d%d",&l,&q);
	for (int i=1;i<=n;i++)
	{
		snxt[i]=lower_bound(a+1,a+n+1,a[i]+l+1)-a-1;
		spre[i]=lower_bound(a+1,a+n+1,a[i]-l)-a;
	}
	for (int i=1;i<=n;i++)
	{
		pos=i;
		for (j=0;j<300;j++)
		{
			if (pos==1) break;
			pos=spre[pos];
		}
		bpre[i]=pos;
		numpre[i]=j;
		pos=i;
		for (j=0;j<300;j++)
		{
			if (pos==n) break;
			pos=snxt[pos];
		}
		numnxt[i]=j;
		bnxt[i]=pos;
	}
	while(q--)
	{
		scanf("%d%d",&x,&y);
		pos=x;cnt=0;
		if (x<y)
		{
			while(bnxt[pos]<y)
			{
				cnt+=numnxt[pos];
				pos=bnxt[pos];
			}
			while(pos<y)
			{
				pos=snxt[pos];
				cnt++;
			}
		}
		else
		{
			while(bpre[pos]>y)
			{
				cnt+=numpre[pos];
				pos=bpre[pos];
			}
			while(pos>y)
			{
				pos=spre[pos];
				cnt++;
			}
		}
		printf("%d\n",cnt);
	}
	return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

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

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

    bool same(int x, int y) { return find(x) == find(y);}
    int size(int x) { return -d[find(x)];}
};

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

    unionfind friends(n);
    vector<int> deg(n,0);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        friends.unite(a, b);
        deg[a]++; deg[b]++;
    }

    vector<vector<int>> block(n);
    rep(i, k) {
        int c, d;
        cin >> c >> d;
        --c; --d;
        block[c].emplace_back(d);
        block[d].emplace_back(c);
    }

    rep(i, n) {
        int ans = friends.size(i) - deg[i] - 1;
        rep(j, block[i].size()) { 
            if (friends.same(i, block[i][j])) ans--;
        }
        printf("%d%c", ans, i==n-1?'\n':' ');
    }
}

Measured memory_bytes: 6784
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const int MOD = 1000000007;

int main() {
  ll n, sum = 0;
  cin >> n;
  for (ll i = 1; i <= n; i++) {
    if (i % 3 == 0 || i % 5 == 0) continue;
    sum += i;
  }
  cout << sum << endl;
}


Measured memory_bytes: 3628
#include<stdio.h>
int main(Void)
{
    int a,b;
    scanf("%d %d",&a,&b);
    if(a<b){
        printf("a < b\n");
    }
    if(a>b){
        printf("a > b\n");
    }
    if(a==b){
        printf("a == b\n");
    }
}


Measured memory_bytes: 2040
import sys 
input = sys.stdin.readline
from heapq import *
def main():
  n, m = map(int, input().split())
  a = list( map(int, input().split()) )
  card = []
  for _ in range(m):
    card.append(list(map(int, input().split())))

  heapify(a)
  card.sort(key=lambda x:x[1], reverse=True)

  for i in range(m):
    for _ in range(card[i][0]):
      if a[0]<card[i][1]:
        heappushpop(a, card[i][1])
      else:
        break
  print(sum(a))

if __name__ == '__main__':
  main()


Measured memory_bytes: 89880
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <regex>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;

vector<string> dfs(string s, ll depth, vector<char> symbol)
{
    vector<string> ret;
    if (depth == 0)
    {
        ret.push_back(s);
        return ret;
    }

    for (ll i = 0; i < symbol.size(); i++)
    {
        auto vec = dfs(s + symbol[i], depth - 1, symbol);
        for (auto &&e : vec)
        {
            ret.push_back(e);
        }
    }
    return ret;
}

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

enum Tenki
{
    Sunny,
    Cloudy,
    Rainy
};

int main()
{
    ll X, t;
    cin >> X >> t;
    cout << max(X - t, 0LL) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <utility>
#include <deque>
#include <stack>
#include <bitset>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
#define rep(i,n) for (int i=0;i<n;++i)
#define REP(i,n) for (int i=1;i<=n;++i)
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define read(x) scanf("%d",&x)
const int INF=1e9;
int n,m,L;
vector<pii> G[305];
pii dis[305][305];
bool vis[305];
int main(){
	ios::sync_with_stdio(false);
	cin>>n>>m>>L;
	REP(i,m){
		int a,b,c;cin>>a>>b>>c;
		if (c<=L) G[a].pb(mp(b,c)),G[b].pb(mp(a,c));
	}
	REP(i,n) REP(j,n) dis[i][j]=mp(INF,INF);
	REP(s,n){
		dis[s][s]=mp(0,0);
		memset(vis,0,sizeof(vis));
		while(1){
			int u=0;pii best=mp(INF,INF);
			REP(i,n) if (!vis[i]&&dis[s][i]<best){
				u=i;best=dis[s][i];
			}
			if (u==0) break;
			vis[u]=1;
			for (int i=0;i<G[u].size();++i){
				int v=G[u][i].F,c=G[u][i].S;
				pii ndis;
				if (best.S+c>L) ndis=mp(best.F+1,c);
				else ndis=mp(best.F,best.S+c);
				if (!vis[v]&&dis[s][v]>ndis) dis[s][v]=ndis;
			}
		}
	}
	int Q;cin>>Q;
	while(Q--){
		int s,t;cin>>s>>t;
		if (dis[s][t]<mp(INF,INF)) cout<<dis[s][t].F<<endl;
		else cout<<-1<<endl;
	}
	return 0;
}

Measured memory_bytes: 2432
package main

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

func main() {
	var n int
	fmt.Scan(&n)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	
	a := make([]int64, n, n)
	s := int64(0)
	for i := 0; i < n; i++ {
		sc.Scan()
		tmp, _ := strconv.Atoi(sc.Text())
		a[i] = int64(tmp)
		s += int64(tmp)
	}

	b := make([]int64, n, n)
	b[0] = s
	for i := 1; i <= n - 2; i += 2 {
		b[0] -= a[i] * 2
	}
	fmt.Print(b[0])
	for i := 1; i < n; i++ {
		b[i] = 2 * a[i - 1] - b[i - 1]
		fmt.Print(" ")
		fmt.Print(b[i])
	}
	fmt.Print("\n")
}

Measured memory_bytes: 6528
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> sum(n);

    int a;
    for(int i=1;i<n;i++){
        cin >> a;
        sum.at(a-1)++;
    }
    for(int i=0;i<n;i++) cout << sum.at(i) << endl;

    return 0;
}

Measured memory_bytes: 4052
#include <iostream>
#include <vector>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int N;
vector <int> M;

int main(){
    int second = 0, forth = 0;
    cin >> N;
    REP(i,N){
        int m;
        cin >> m;
        if(m % 4 == 0){
            forth++;
        }
        else if(m % 2 == 0){
            second++;
        }
    }
    if(forth + second / 2 > N / 2 - 1){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 888
def main():
    from bisect import bisect_left,bisect
    n = int(input())
    s = list(input())
    q = int(input())
    al=[[] for i in range(26)]
    for i in range(n):
        al[ord(s[i])-97].append(i)
    ans = []
    for i in range(q):
        a , b , x = input().split()
        if a == "1":
            al[ord(s[int(b)-1])-97].pop(bisect_left(al[ord(s[int(b)-1])-97],int(b)-1))
            al[ord(x)-97].insert(bisect_left(al[ord(x)-97],int(b)-1),int(b)-1)
            s[int(b)-1] = x
        elif a == "2":
            b = int(b)-1
            x = int(x)-1
            cou = 0
            for j in range(26):
                l = bisect_left(al[j],b)
                r = bisect(al[j],x)
                if l != r:
                    cou += 1
            ans.append(cou)
    for i in ans:
        print(i)

if __name__ == '__main__':
    main()

Measured memory_bytes: 35140
package main

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

func main() {
	readInt()
	s := readBytes()

	ans := 0
	c := byte('_')
	for i := range s {
		if s[i] != c {
			ans++
		}
		c = s[i]
	}

	fmt.Println(ans)
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

// -----------------------------------------------------------------

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

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

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 896
#define _CRT_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <limits>
#include <numeric>
#include <valarray>
#include <fstream>

using namespace std;
typedef unsigned int uint;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;
#define REP(i, a, n) for(LL i = (a), i##_max = (n); i < i##_max; ++i)
#define REM(i, a, n) for(LL i = (LL)(n) - 1, i##min = (a); i >= i##min; --i)
#define ALL(arr) (arr).begin(), (arr).end()
#define FLOAT fixed << setprecision(16)
#define SPEEDUP {cin.tie(NULL); ios::sync_with_stdio(false);}
const int INF = 0x3FFFFFFF;
const LL INFLL = 0x3FFFFFFF3FFFFFFF;
const double INFD = 1.0e+308;
const double EPS = 1.0e-9;

void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
template <class T, class U>
istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; }
template <class T, class U>
ostream& operator<<(ostream& ost, const pair<T, U>& right) { return ost << right.first << ' ' << right.second; }
template <class T, class TCompatible, size_t N>
void Fill(T(&dest)[N], const TCompatible& val) { fill(dest, dest + N, val); }
template <class T, class TCompatible, size_t M, size_t N>
void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); }
template<class T>
T Compare(T left, T right) { return left > right ? 1 : (left < right ? -1 : 0); }
istream& Ignore(istream& ist) { string s; ist >> s; return ist; }
bool Inside(int i, int j, int h, int w) { return i >= 0 && i < h && j >= 0 && j < w; }
template <class T>
T Next() { T buf; cin >> buf; return buf; }

#ifdef ONLY_MY_ENVIR
#include "IntMod.h"
#include "BinaryMatrix.h"
#include "BIT.h"
#include "Factorization.h"
#include "FlowSolver.h"
#include "Graph.h"
#include "LazySegmentTree.h"
#include "Math.h"
#include "Matrix.h"
#include "MinMax.h"
#include "Position.h"
#include "Range.h"
#include "Rational.h"
#include "SegmentTree.h"
#include "SegmentTree2D.h"
#include "SuffixArray.h"
#include "Tree.h"
#include "UnionFind.h"
#endif

#ifdef __GNUC__
typedef __int128 LLL;
istream& operator>> (istream& ist, __int128& val) { LL tmp;  ist >> tmp; val = tmp; return ist; }
ostream& operator<< (ostream& ost, __int128 val) { LL tmp = val; ost << tmp; return ost; }
#endif

#if 1234567891
#include <array>
#include <random>
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;
// template <class T>
// auto Is(const T& value) { return [value](const auto& comparand) -> bool { return comparand == value; }; }
#endif
int main() {
	int a, p;
	cin >> a >> p;

	cout << ((a * 3) + p) / 2 << endl;
}

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

int main() {
    int n;
    scanf("%d", &n);
    vector<vector<int>> G(n);
    vector<pair<int, int>> vp;
    for (int i = 1; i < n; ++i) {
        int a, b;
        scanf("%d %d", &a, &b);
        a--, b--;
        G[a].emplace_back(b);
        G[b].emplace_back(a);
        vp.emplace_back(a, b);
    }

    int k = 0;
    map<pair<int, int>, int> I;
    vector<int> cs(n, 0);
    vector<int> used(n, 0);
    queue<int> que;
    used[0] = 1;
    que.emplace(0);

    while (!que.empty()) {
        int v = que.front();
        que.pop();
        if (k < G[v].size()) k = G[v].size();
        int cur = 1;
        for (int u : G[v]) {
            if (used[u]) continue;
            if (cur == cs[v]) cur++;
            cs[u] = I[make_pair(u, v)] = I[make_pair(v, u)] = cur++;
            used[u] = 1;
            que.emplace(u);
        }
    }
    cout << k << endl;
    for (auto p : vp) {
        cout << I[p] << endl;
    }
    return 0;
}

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

int selectionSort(std::vector<int> &data, int dataLength);
int main(void)
{
    int dataLength = 0;         // データ数
    // データ数を入力
    std::cin >> dataLength;

    std::vector<int> data(dataLength);   // ソートデータ

    for (int i = 0; i < dataLength; i++) {
        std::cin >> data[i];
    }

    int swapCnt = selectionSort(data, dataLength);

    std::cout << data[0];
    for (int k = 1; k < dataLength; k++) {
        std::cout << " " << data[k];
    }
    std::cout << "\n";
    std::cout << swapCnt << "\n";

    return 0;
}

int selectionSort(std::vector<int> &data, int dataLength)
{
    int swapCnt = 0;
    
    for (int i = 0; i < dataLength - 1; i++) {
        int minj = i;
        for (int j = i + 1; j < dataLength; j++) {
            if (data[j] < data[minj]) {
                minj = j;
            }
        }

        if(minj != i){
            int temp = data[i];
            data[i] = data[minj];
            data[minj] = temp;
            swapCnt++;
        }
    }

    return swapCnt;
}


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

int main(){
    int n, judge;
    cin >> n;
    string c1[n], c2[n], c3[n], c[n];
    for(int i = 0; i < n; i++){
        cin >> c1[i];
        c2[i] = c1[i];
        c3[i] = c1[i];
    }

    
/* バブルソート */
    for(int i = 0; i < n; i++){
        for(int j = n-1; j > i; j--){
            if(c1[j][1] < c1[j-1][1]){
                swap(c1[j], c1[j-1]);
            }
        }
    }

    for(int i = 0; i < n; i++){
        if(i == n-1)cout << c1[i] << endl;
        else cout << c1[i] << " ";
    }
    
    cout << "Stable" << endl;

/* 選択ソート */
    for(int i = 0; i < n; i++){
        int minj = i;
        for(int j = i; j < n; j++){
            if(c2[j][1] < c2[minj][1]){
                minj = j;
            }
        }
        swap(c2[i], c2[minj]);
    }

    judge = 1;

    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            for(int a = 0; a < n; a++){
                for(int b = a+1; b < n; b++){
                    if(c3[i][1] == c3[j][1] && c3[i] == c2[b] && c3[j] == c2[a]){
                        judge = 0;
                    }
                }
            }
        }
    }

    for(int i = 0; i < n; i++){
        if(i == n-1)cout << c2[i] << endl;
        else cout << c2[i] << " ";
    }

    if(judge == 0){
        cout << "Not stable" << endl;
    }else if(judge == 1){
        cout << "Stable" << endl;
    }
    
    return 0;
}


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

last = 0
maxcnt = 0
cnt = 0

for i in range(n):
    if h[i] > last:
        cnt = 0
    if cnt > maxcnt:
        maxcnt = cnt
    last = h[i]
    cnt += 1
print(maxcnt)



Measured memory_bytes: 14252
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(void)
{
    int N, M, i, j, ans=0, count, judge=1;
    string s[102], t[102];

    cin >> N;
    
    for(i=1; i<=N; i++){
        cin >> s[i];
    }

    cin >> M;

    for(i=1; i<=M; i++){
        cin >> t[i];
    }

    sort(s+1, s+N+1);
    
    sort(t+1, t+M+1);

    for(i=1; i<=N; i++){
        count = 1;

        if(i<=N-1){
            while(i<=N-1 && s[i]==s[i+1]){
                i++;

                count++;
            }
        }

        for(j=1; j<=M; j++){
            if(s[i] == t[j]){
                count--;
            }
        }

        if(ans < count){
            ans = count;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
int n,p,q;
scanf("%d",&p);
scanf("%d",&n);
if(p>=6 && p<=12)
{
	n=n/2;
	printf("%d",n);
}
else if(p>12)
printf("%d",n);
else if(p<6)
printf("0");

}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000;

int main(){
	int n,a[110],sum=0,ans=0;
	double d,min=INF;
	cin>>n;
	REP(i,n){
		cin>>a[i];
		sum+=a[i];
	}
	d=(double)sum/(double)n;
	REP(i,n){
		if(abs(d-(double)a[i])<min){
			min=abs(d-(double)a[i]);
			ans=i;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr int mod = 1e9+7;

int main() {
  int h, w, d;
  cin >> h >> w >> d;
  vector<vector<int>> a(h, vector<int>(w));
  rep(i,h) rep(j,w) cin >> a[i][j];
  vector<int> x(h * w + 1), y(h * w + 1);
  rep(i,h) rep(j,w) {
    x[a[i][j]] = i, y[a[i][j]] = j;
  }
  vector<int> cum(h * w + 1, 0);
  for (int i = 0; i <= h * w; i++) {
    if (i - d > 0) {
      cum[i] = cum[i - d] + abs(x[i] - x[i - d]) + abs(y[i] - y[i - d]);
    }
  }

  int q;
  cin >> q;
  while (q--) {
    int l, r;
    cin >> l >> r;
    cout << cum[r] - cum[l] << "\n";
  }
  return 0; 
}


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


int main() {
  ll N,A,B;
  cin >> N >> A >> B;
  ll ans = 0;
  ans += (N/(A+B)) * A;
  if (N%(A+B) <= A) ans += N%(A+B);
  else if (N%(A+B) > A) ans += A;
  cout << ans << endl;
}

Measured memory_bytes: 256
X,Y = map(int,input().split(" "))
flag=1
for a in range(0,101):
    for b in range(0,101):
        if a + b == X and 2*a + 4*b == Y:
            print("Yes")
            flag = 0
            break
    if flag==0:
        break
if flag:
    print("No")

Measured memory_bytes: 9176
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.Arrays;
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
 */

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);
        Task                 solver               = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
    	public void solve(int testNumber, InputReader in, PrintWriter out) {
    		int M = in.nextInt();
    		int ans = 24 - M + 24;
    		out.println(ans);
    	}
    }

    static class InputReader {
        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 int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 24788
#include <iostream>
#include <sstream>
#include <algorithm>
#include <functional>
#include <iterator>
#include <numeric>
#include <cstdint>
#include <cmath>
#include <bitset>
#include <string>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>

#define N_TIMES(i, n)     for ( uint64_t i = 0;     i <  n; ++i )
#define N_TIMES_REV(i, n) for (  int64_t i = n - 1; i >= 0; --i )
#define SQRTI(n) static_cast<uint64_t>(::floor(::sqrt(static_cast<double>(n))))

#ifdef __DEBUG__
template<typename T, typename U>
std::ostream& operator<<(std::ostream &os, const std::pair<T, U> &pair)
{
  os << pair.first << ": " << pair.second;
  return os;
}

template<class ForwardIterator>
std::ostream& _iterator_to_display(
  std::ostream &os, 
  ForwardIterator begin, ForwardIterator end, 
  const std::string &delim = ", "
)
{
  auto itr = begin;
  while (itr != end) {
    os << *itr;
    ++itr;
    if (itr != end) os << delim;
  }
  return os;
}

template<typename T>
std::ostream& operator<<(std::ostream &os, const std::list<T> &list)
{
  _iterator_to_display(os, list.begin(), list.end());
  return os;
}

template<typename T>
std::ostream& operator<<(std::ostream &os, const std::vector<T> &vector)
{
  _iterator_to_display(os, vector.begin(), vector.end());
  return os;
}

template<typename T, class C=std::less<T>>
std::ostream& operator<<(std::ostream &os, const std::set<T> &set)
{
  _iterator_to_display(os, set.begin(), set.end());
  return os;
}

template<typename T, typename U, class C=std::less<T>>
std::ostream& operator<<(std::ostream &os, const std::map<T, U> &map)
{
  _iterator_to_display(os, map.begin(), map.end());
  return os;
}
#endif /* __DEBUG__ */

bool judge(const std::string &S)
{
  if (S[0] != 'A' || !std::islower(S[1])) return false;
  
  unsigned C = 0;
  for (unsigned i = 2; i < S.size() - 1; ++i) {
    if (S[i] == 'C') ++C;
    else if (!std::islower(S[i])) return false;
  }
  
  if (C != 1) return false;
  
  return std::islower(S[S.size() - 1]);
}

int main(int argc, char **argv)
{
  std::string S;
  std::cin >> S;
  
  std::cout << (judge(S) ? "AC" : "WA") << std::endl;
  
  return 0;
}

Measured memory_bytes: 256
n, k = gets.split.map { |e| e.to_i }
a    = gets.split.map { |e| e.to_i }.sort.reverse

ans = (0.0 .. a[0]).bsearch do |t|
  
  i   = 0
  cnt = 0
  while (i < n && a[i] > t) && cnt <= k
    cnt += (a[i] / t).ceil - 1
    i += 1
  end
  
  cnt <= k
end.ceil

puts ans

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

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

  bool flag = false;

  rep2(i, 9) rep2(j, 9) if (n == i * j) flag = true;

  if (flag) cout << "Yes" << endl;
  else cout << "No" << endl; 

  return 0;
}


Measured memory_bytes: 3636
#include<stdio.h>
typedef struct{
  int p;
  int left;
  int right;
} Tree;
Tree tree[10000];

#define NIL -1
int geth(int);
int main()
{
  int i,id,j,n,k,dep=0,num,l,r,deg=0,h=0;
 
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    tree[i].p=NIL;
  }
 
  for(i=0;i<n;i++){
    scanf("%d%d%d",&id,&l,&r);
    tree[id].left=l;
    tree[id].right=r;
    if(l!=NIL && r!=NIL){
      tree[l].p=id;
      tree[r].p=id;
    }
    else if(l!=NIL && r==NIL){
      tree[l].p=id;
    }
    else if(l==NIL && r!=NIL){
      tree[r].p=id;
    }
  }
   
  for(i=0;i<n;i++){
    printf("node %d: parent = %d, ",i,tree[i].p);
    if(tree[i].p==NIL){
      printf("sibling = -1, ");
    }
    else if(tree[tree[i].p].left==i){
      printf("sibling = %d, ",tree[tree[i].p].right);
    }
    else{
      printf("sibling = %d, ",tree[tree[i].p].left);
    }
    printf("degree = ");
    if(tree[i].left!=NIL && tree[i].right!=NIL){
      printf("2, ");
    }
    else if(tree[i].left==NIL && tree[i].right==NIL){
      printf("0, ");
    }
    else printf("1, ");
 
    num=i;
    while(tree[num].p!=NIL){
      dep++;
      num=tree[num].p;
    }
    printf("depth = %d, ",dep);
    dep = 0;
 
    printf("height = ");
    h = geth(i);
    printf("%d,",h);
    
    if(tree[i].p==NIL){
      printf(" root\n");
    }
    else if(tree[i].left==NIL && tree[i].right==NIL){
      printf(" leaf\n");
    }
    else {
      printf(" internal node\n");
      }
  }
  return 0;
}

int geth(int i)
{
  int k=0,l=0;
  if(tree[i].left==NIL && tree[i].right==NIL)return 0;

  if(tree[i].left!=NIL){
  k=geth(tree[i].left)+1;
  }
  if(tree[i].right!=NIL){
  l=geth(tree[i].right)+1;
  }
  if(k>l){
    
    return k;
  }
  else{
    return l;
  }
}



Measured memory_bytes: 2048
#include <iostream>

using namespace std;

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

    int num_of_socket = 1;
    int num_of_tap = 0;
    while (num_of_socket < b) {
        --num_of_socket;
        num_of_socket += a;
        ++num_of_tap;
    }
    cout << num_of_tap << '\n';
}


Measured memory_bytes: 256
N = int(input())
A = [int(x) for x in input().split()]

reg = A[0]
flg=True
if 0 in A:
    print(0)
    flg=False
    reg=0
for i in range(1, N):
    reg *= A[i]
    if reg>10**18:
        print(-1)
        flg=False
        break
if flg:
    print(reg)

Measured memory_bytes: 21660
s=input()
S=len(s)

li_0=[]
for i in s:
    li_0.append(int(i))

li=[0,1]*10**5
li_1=[]
li_2=[]

cnt1=0
cnt2=0

for i in range(S):
    li_1.append(li[i])
    li_2.append(li[i+1])

for i in range(S):
    if li_0[i]==li_1[i]:
        cnt1+=1
    if li_0[i]==li_2[i]:
        cnt2+=1

if cnt1>=cnt2:
    print(S-cnt1)
else:
    print(S-cnt2)
    

Measured memory_bytes: 13240
def solve():
    X,K,D = map(int,input().split())
    close_zero = None

    if X >= 0:
        close_zero = X // D
        if close_zero > K:
            print(abs(X + (-K) * D))
            return
    else:
        close_zero = - X // D
        if close_zero > K:
            print(abs(X + K * D))
            return
    
    rest_k = K - close_zero
    if rest_k % 2 == 0:
        if X >= 0:
            print(abs(X-close_zero*D))
        else:
            print(abs(X+close_zero*D))
    else:
        if X >= 0:
            print(abs(X-(1+close_zero)*D))
        else:
            print(abs(X+(1+close_zero)*D))


if __name__ == '__main__':
    solve()

Measured memory_bytes: 61828
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

int main(void){
	          int i;

	          cin.tie(0);  ios_base::sync_with_stdio(false);
	          
	          string s,t;
	          cin >> s >> t;
	          cout << t+s << endl;





	          return 0;
}



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

int main(void){

    int a1, a2, a3;

    cin >> a1 >> a2 >> a3;

    if(a1+a2+a3>=22){
        cout << "bust" << endl;
    } else{
        cout << "win" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 200000
int max(int a,int b){return a>b ? a: b;}
int min(int a,int b){return a<b ? a: b;}
int main(void){
    int R[MAX],i,n;
    scanf("%d",&n);
    for(i=0;i<n;i++)scanf("%d",&R[i]);
    int maxv=-2000000000;
    int minv=R[0];
    for(int i=1;i<n;i++){
        maxv=max(maxv,R[i]-minv);
        minv=min(minv,R[i]);
    }
    printf("%d\n",maxv);
   return 0;
    
}



Measured memory_bytes: 2552
#include<bits/stdc++.h>
using namespace std;
 
 
typedef complex<double> P;
const double EPS = 1e-10;
 
struct Circle{
  double r;
  P c;
};
 
namespace std {
  bool operator < (const P&a, const P&b) {
    return fabs( real(a) - real(b) ) < EPS ? imag(a) < imag(b) : real(a) < real(b);
  }
}
 
vector<P> getIntersectCC(Circle C1,Circle C2){
  vector<P> res;
  double r1 = C1.r, r2 = C2.r, d;
  P p1 = C1.c, p2 = C2.c;
  d = abs( p1 - p2 );
   
  if( d < EPS && abs( r1 - r2 ) < EPS ) return res;
  if( r1 + r2 < d - EPS || d + EPS < abs( r1 - r2 ) ) return res;
  double a = ( r1 * r1 - r2 * r2 + d * d ) / (2 * d);
  double h = sqrt(max(r1 * r1 - a * a, 0.0) );
  P tmp1 = p1 + a / d * (p2 - p1);
  P tmp2 = h / d * (p2 - p1);
 
  if( abs( tmp2 ) < EPS ) res.push_back( tmp1 );
  else {
    res.push_back( P(real(tmp1) - imag(tmp2), imag(tmp1) + real(tmp2)) );
    res.push_back( P(real(tmp1) + imag(tmp2), imag(tmp1) - real(tmp2)) );    
  }
  return res;
}
 
bool inCircle(Circle C,P p){//in point
  if( abs(C.c - p) < C.r + EPS ) return true;
  return false;
}
 
int N;
Circle X[11];
 
int main(){
  while( cin >> N && N ){
    for(int i=0;i<N;i++)
      cin >> X[i].c.real() >> X[i].c.imag() >> X[i].r;
     
    double st = 0.0, ed = 10000.0;
    while(  ed - st  > EPS ){
      double h = (ed + st)/2.0;
      vector<Circle> nc;
      bool f = true;
      for(int i=0;i<N;i++){
        nc.push_back( X[i] );
        nc[i].r = X[i].r * X[i].r - h * h;
        if( nc[i].r < EPS ) {
          f = false;
          break;
        }
        nc[i].r = sqrt(nc[i].r);
      }
      if( !f ) {
        ed = h;
        continue;
      }
      vector<P> pos;
      for(int i=0;i<N;i++){
        pos.push_back( nc[i].c );
        for(int j=i+1;j<N;j++){
          vector<P> ret = getIntersectCC(nc[i],nc[j]);
          for(int k=0;k<(int)ret.size();k++) pos.push_back( ret[k] );
        }
      }
      f = false;
      // cout << "h : " <<h << endl;
      for(int i=0;i<(int)pos.size();i++){
        // cout <<pos[i] << endl;
        bool kf = true;
        for(int j=0;j<N;j++){
          if( !inCircle( nc[j], pos[i] ) ) kf = false;
        }
        if( kf ){
          f = true;
          //cout << "ok"<< endl;
          break;
        }
      }
      if( f ) st = h;
      else ed = h;
    }
    printf("%.10lf\n",st);
  }
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<long long,long long>
 
int main() {
	int a,b;
	cin>>a>>b;
	if(a==1){
		if(b==2)
		cout<<3;
		else
		cout<<2;
	}
	if(a==2){
		if(b==1)
		cout<<3;
		else
		cout<<1;
	}
	if(a==3){
		if(b==1)
		cout<<2;
		else
		cout<<1;
	}
	return 0;
}

Measured memory_bytes: 256
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
# MOD = 10 ** 9 + 7
# MOD = 998244353

MOD = 1000003

Q = int(sys.stdin.buffer.readline())
XDN = [list(map(int, sys.stdin.buffer.readline().split())) for _ in range(Q)]


def get_factorials(max, mod=None):
    """
    階乗 0!, 1!, 2!, ..., max!
    :param int max:
    :param int mod:
    """
    ret = [1]
    n = 1
    if mod:
        for i in range(1, max + 1):
            n *= i
            n %= mod
            ret.append(n)
    else:
        for i in range(1, max + 1):
            n *= i
            ret.append(n)
    return ret


def mod_invs(max, mod):
    """
    逆元 0, 1/1, 1/2, 1/3, ..., 1/max
    :param int max:
    :param int mod:
    """
    invs = [1] * (max + 1)
    invs[0] = 0
    for x in range(2, max + 1):
        invs[x] = (-(mod // x) * invs[mod % x]) % mod
    return invs


def factorial_invs(max, mod):
    """
    階乗 0!, 1!, 2!, ..., max! の逆元
    :param int max:
    :param int mod:
    """
    ret = [1]
    r = 1
    for inv in mod_invs(max, mod)[1:]:
        r = r * inv % mod
        ret.append(r)
    return ret


factorials = get_factorials(MOD, MOD)
invs = mod_invs(MOD, MOD)
finvs = factorial_invs(MOD, MOD)


def solve(args):
    x, d, n = args
    if d == 0:
        return pow(x, n, MOD)
    num = x * invs[d] % MOD + n - 1
    if num >= MOD:
        return 0
    return pow(d, n, MOD) * factorials[num] % MOD * finvs[(x * invs[d] - 1) % MOD] % MOD


print(*map(solve, XDN), sep='\n')


Measured memory_bytes: 134120
#include<iostream>
#include <algorithm>
#include <string>
using namespace std;
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(int)(n); i++)
typedef long long ll;
const int INF = numeric_limits<int>::max();
const int MOD = (1e9 + 7);


int main(){
  int N, D;
  string S[N];
  cin >> N >> D;
  rep(i, N){
    cin >> S[i];
  }
  sort(S, S+N);
  rep(i, N){
    cout << S[i];
  }
  cout << endl;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll          long long int
#define lld          long double
#define pb          push_back
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define vec         vector<ll>
#define all(a)     (a).begin(),(a).end()
#define F           first
#define S           second
#define mod         1000000007
#define rep(i,a,b)	for(ll  i=a;i<b;i++)
#define repi(i,a,b)	for(ll  i=a;i<=b;i++)
#define per(i,a,b)  for(ll i=a;i>=b;i--)
#define mp          make_pair
#define mit         map<ll,ll>::iterator
#define sit         set<ll>::iterator
#define pit         pair<ll,ll>::iterator
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;
ll xo(ll x, ll y) 
{ 
   return (x | y) & (~x | ~y); 
}  
ll bin_Expo(ll x,ll n)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return bin_Expo(x*x,n/2);
    else                             //n is odd
        return x*bin_Expo(x*x,(n-1)/2);
}
ll mod_Expo(ll x,ll n,ll M)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return mod_Expo((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*mod_Expo((x*x)%M,(n-1)/2,M))%M;
 
}
ll NcR(int n, int r) 
{ 
    ll p = 1, k = 1; 
    if (n - r < r) 
        r = n - r; 
  
    if (r != 0) { 
        while (r) { 
            p *= n; 
            k *= r; 
            ll m=__gcd(p, k); 
            p /= m; 
            k /= m; 
            n--; 
            r--; 
        } 
    } 
    else
        p = 1; 
    return p;
}
bool prime_check(ll x)
{
    bool prime = (x >= 2);
    for (ll i = 2; i * i <= x; i++) 
    {
        if (x % i == 0) 
        {
            prime = false;
            break;
        }
    }
    return prime;
}
ll logg(ll base,ll x)
{
    return (ll)(log(x)/log(base));
}
ll po(ll n)
{
	ll k=0;
	while(n%2==0)
	{
		k++;
		n=n/2;
	}
	return k;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
    while(TESTS--)
    {
    	ll i,j,l,m,k,n;
    	cin>>n;
    	ll a[n][3],dp[n][3];
    	rep(i,0,n)
    	{
    		cin>>a[i][0]>>a[i][1]>>a[i][2];
    		dp[i][0]=-1; dp[i][1]=-1; dp[i][2]=-1;
		}
		dp[0][0]=a[0][0]; dp[0][1]=a[0][1]; dp[0][2]=a[0][2];	
		rep(i,1,n)
		{
			dp[i][0]=a[i][0]+max(dp[i-1][1],dp[i-1][2]);
			dp[i][1]=a[i][1]+max(dp[i-1][0],dp[i-1][2]);
			dp[i][2]=a[i][2]+max(dp[i-1][1],dp[i-1][0]);
		}
		cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
		
		
    }
	return 0;
}

Measured memory_bytes: 4992
N = int(input())

xys = []
from collections import defaultdict
for i in range(N):
    x, y = map(int, input().split())
    xys.append((x, y))
pqs = []
for xy1 in xys:
    x1, y1 = xy1

    for xy2 in xys:
        x2, y2 = xy2

        dx = x1 - x2
        dy = y1 - y2

        if dx != 0 or dy != 0:
            pqs.append((dx, dy))

ans = N
for pq in pqs:
    p, q = pq
    count = 0
    for xy1 in xys:
        x1, y1 = xy1

        for xy2 in xys:
            x2, y2 = xy2

            dx = x1 - x2
            dy = y1 - y2
            if dx == p and dy == q:
                count += 1

    ans = min(ans, N - count)

print(ans)

Measured memory_bytes: 3572
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
l=[a,b,c,d,e]
s=[]
t=[]
x=0
for i in range(5):
    s.append(l[i]%10)
for i in range(5):
    if s[i]==0:
        t.append(l[i])
    else:
        t.append((l[i]//10+1)*10)
        
for i in range(1,10):
    if s.count(i)>0:
        x=10-i
        break
print(sum(t)-x)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;using ll=int_fast64_t;using ld=long double;constexpr ll INF=1LL<<60,MOD=1e9+7;//998244353;
void solve();int main(){cin.tie(nullptr);ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);solve();return 0;}
#define SELECTOR(_1,_2,_3,_4,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep2,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(int i=0;i<(int)n;++i)
#define _rep1(i,k,n) for(int i=k;i<(int)n;++i)
#define _rep2(i,k,n,d) for(int i=k;d>0?i<(int)n:i>(int)n;i+=d)
#ifdef __LOCAL
#include "ostreams.h"
#endif
template<class T> inline bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
template<class T> vector<T> make_vector(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_vector(size_t a,Ts... ts){return vector<decltype(make_vector(ts...))>(a,make_vector(ts...));}
void print(){cerr<<endl;} template<class T,class... Ts> void print(const T& a,const Ts&... ts){cerr<<a<<' ';print(ts...);}

template<class T>
class SegmentTree{
private:
    ll n = 1;
    function<T(T, T)> dot;
    T unit;
    vector<T> tree;
public:
    constexpr SegmentTree(const vector<T> &A, function<T(T, T)> dot, T unit) : dot(dot), unit(unit) {
        while(n < (ll)A.size()) n <<= 1;
        tree.resize(2 * n, unit);
        copy(A.begin(), A.end(), tree.begin() + n);
        rep(i, n - 1, 0, -1) tree[i] = dot(tree[i << 1], tree[i << 1 | 1]);
    }
    constexpr void update(ll i, T v){
        i += n;
        tree[i] = v;
        while(i >>= 1) tree[i] = dot(tree[i << 1], tree[i << 1 | 1]);
    }
    constexpr void add(ll i, T v){update(i, tree[i + n] + v);}
    constexpr T sum(ll l, ll r) const {
        l += n; r += n;
        T l_val = unit, r_val = unit;
        while(l < r){
            if(l & 1) l_val = dot(l_val, tree[l++]);
            if(r & 1) r_val = dot(tree[--r], r_val);
            l >>= 1; r >>= 1;
        }
        return dot(l_val, r_val);
    }
};

void solve(){
    ll n, q; cin >> n >> q;
    vector<ll> C(n);
    rep(i, n){
        cin >> C[i];
        C[i] --;
    }
    vector<tuple<ll, ll, ll>> queries(q);
    rep(i, q){
        ll l, r; cin >> l >> r;
        queries[i] = make_tuple(l - 1, r, i);
    }
    sort(queries.rbegin(), queries.rend());

    vector<ll> A(n), next(n, -1), used(n, -1);
    rep(i, n - 1, -1, -1){
        ll c = C[i];
        A[i] = 1;
        if(used[c] != -1){
            next[i] = used[c];
            A[used[c]] = 0;
        }
        used[c] = i;
    }
    SegmentTree<ll> tree(A, [](ll a, ll b){return a + b;}, (ll)0);

    vector<ll> ans(q);
    rep(l, n){
        while((!queries.empty()) && get<0>(queries.back()) == l){
            auto [l, r, i] = queries.back();
            queries.pop_back();
            ans[i] = tree.sum(l, r);
        }
        if(next[l] != -1){
            tree.add(next[l], 1);
        }
    }
    for(auto a : ans) cout << a << endl;
}

Measured memory_bytes: 43300
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>

using namespace std;

int main(){

    //int ans=0;

    int a[32]={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 n;
    cin>>n;
   
    cout<<a[n-1]<<endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int l = sc.nextInt();
		UnionFindTree road = new UnionFindTree(n);
		for (int i = 0; i < k; i++) {
			road.union(sc.nextInt() - 1, sc.nextInt() - 1);
		}
		UnionFindTree train = new UnionFindTree(n);
		for (int i = 0; i < l; i++) {
			train.union(sc.nextInt() - 1, sc.nextInt() - 1);
		}
		HashMap<Pair, Integer> map = new HashMap<>();
		for (int i = 0; i < n; i++) {
			Pair p = new Pair(road.find(i), train.find(i));
			if (map.containsKey(p)) {
				map.put(p, map.get(p) + 1);
			} else {
				map.put(p, 1);
			}
		}
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
			if (i != 0) {
				sb.append(" ");
			}
			Pair p = new Pair(road.find(i), train.find(i));
			sb.append(map.get(p));
		}
		System.out.println(sb);
	}
	
	static class Pair {
		int x;
		int y;
		public Pair(int x, int y) {
			this.x = x;
			this.y = y;
		}
		
		public int hashCode() {
			return x + y;
		}
		
		public boolean equals(Object o) {
			Pair p = (Pair) o;
			return p.x == x && p.y == y;
		}
	}
	
	static class UnionFindTree {
		int[] parent;
		
		public UnionFindTree(int size) {
			parent = new int[size];
			for (int i = 0; i < size; i++) {
				parent[i] = i;
			}
		}
		
		public int find(int x) {
			if (parent[x] == x) {
				return x;
			} else {
				int v = find(parent[x]);
				parent[x] = v;
				return v;
			}
		}
		
		public boolean same(int x, int y) {
			return find(x) == find(y);
		}
		
		public void union(int x, int y) {
			int rootX = find(x);
			int rootY = find(y);
			parent[rootX] = rootY;
		}
	}
}


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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

ll n;

int main(void) {
  // Here your code !
  scanf("%lld", &n);

  ll ans = (n - 1 + 1) * (n - 1) / 2LL;

  printf("%lld\n", ans);

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+5;
inline int read(){
	char c=getchar();int t=0,f=1;
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){t=(t<<3)+(t<<1)+(c^48);c=getchar();}
	return t*f;
}
int n;
struct node{
	int a,b;
}a[maxn];
bool cmp(node a,node b){
	if(a.b==b.b)return a.a>b.a;
	return a.b<b.b;
}
int main(){
	n=read();
	for(int i=1;i<=n;i++){
		a[i].a=read(),a[i].b=read();
	}
	sort(a+1,a+1+n,cmp);
	long long tmp=0;
	for(int i=1;i<=n;i++){
		tmp=tmp+a[i].a;
		if(tmp>a[i].b){puts("No");return 0;}
	}
	puts("Yes");
	return 0;
}


Measured memory_bytes: 1792