akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE

int N;
vector<vector<int> > G;
int dfs(int pos, int pre){
  int x = 0;
  for(int to:G[pos]){
    if(to == pre) continue;
    x ^= dfs(to, pos) + 1;
  }
  return x;
}


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);
  cin>>N;
  G.resize(N);
  for(int i=0;i<N-1;i++){
    int x, y;
    cin>>x>>y; x--, y--;
    G[x].push_back(y);
    G[y].push_back(x);
  }

  int ans = dfs(0, -1);

  if(ans == 0) cout<<"Bob"<<endl;
  else cout<<"Alice"<<endl;
  
  return 0;
}


Measured memory_bytes: 10368
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    vector<int> v(3);
    rep(i, 3) cin >> v[i];
    sort(v.rbegin(), v.rend());

    int ans = v[0] * 10 + v[1] + v[2];

    cout << ans << endl;
}


Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <numeric>
#include <vector>
#include <queue>
#include <map>
typedef unsigned long long ull;
typedef long long ll;
#define MAX 200005
using namespace std;

int main() {
  int a,b;
  cin >> a >> b;
  if(a%2!=0 && b%2!=0) {
    cout << "Yes" << endl;
  }else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import deque

def bfs(s):
    dist = [-1]*N
    q = deque([s])
    dist[s] = 0
    
    while q:
        v = q.popleft()
        
        for nv in adj_list[v]:
            if dist[nv]==-1:
                dist[nv] = dist[v]+1
                q.append(nv)
    
    return dist

N, u, v = map(int, input().split())
adj_list = [[] for _ in range(N)]
degree = [0]*N

for _ in range(N-1):
    Ai, Bi = map(int, input().split())
    adj_list[Ai-1].append(Bi-1)
    adj_list[Bi-1].append(Ai-1)
    degree[Ai-1] += 1
    degree[Bi-1] += 1
    
d1 = bfs(u-1)
d2 = bfs(v-1)
ans = 0

for i in range(N):
    if degree[i]==1 and d1[i]<d2[i]:
        ans = max(ans, d2[i]-1)
        
    #if d1[i]==d2[i] and d1[i]+d2[i]==d1[v-1]:
        #ans = max(ans, d1[i])
    
print(ans)

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

int main() {
  int a,b;
  cin >> a >> b;
  int ans=0;
  while ( a<=b ) {
    string s=to_string(a);
    if ( s[0]==s[4] && s[1]==s[3] ) ans++;
    a++;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using boost::multiprecision::cpp_int;
using namespace std;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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

typedef long long ll;
typedef pair<ll, ll> p;

ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  else return gcd(b, a % b);
  // return (b == 0) ? a : gcd(b, a % b);
}

vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  return (ret);
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  auto start = clock();
  ll n;
  cin >> n;
  vector<ll> v(n);
  rep(i, n) cin >> v[i];

  vector<ll> ana(1000010);
  bool is_pairwise = true;

  bool yaba = n == 1000000;
  for (ll i = 0; i < n; ++i) {
    if(v[i] == 1) continue;
    auto end = clock();
    const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;
    if(time >= 1800.0 && yaba){
      yaba = true;
      break;
    }
    auto yakusu = divisor(v[i]);
    for(auto a : yakusu){
      if(a == 1) continue;
      if(ana[a] == 1) {
        is_pairwise = false;
        break;
      }
      ana[a] = 1;
    }
  }
  if(is_pairwise){
    cout << "pairwise coprime" << endl;
    exit(0);
  }

  ll res = v[0];

  for (ll i = 0; i < n; ++i) {
    res = gcd(res, v[i]);
  }
  if(res == 1){
    cout << "setwise coprime" << endl;
    exit(0);
  }
  cout << "not coprime" << endl;
}


Measured memory_bytes: 19220
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <array>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int main()
{
    ll H, W;
    string Si;
    cin >> H >> W;
    int S[H][W];
    for(int i=0;i<H;i++){
        cin >> Si;
        for(int j=0;j<W;j++){
            S[i][j] = Si[j]=='#'? 1:0;
        }
    }
    int cmap[H][W];
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cmap[i][j]=-1;
        }
    }
    int imax=0;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(cmap[i][j]!=-1) continue;
            cmap[i][j] = ++imax;
            queue<array<int,2>> q;
            q.push(array<int,2>{i,j});
            while(!q.empty()){
                auto ij = q.front(); q.pop();
                auto x = ij[0];
                auto y = ij[1];
                if(y-1>=0 && cmap[x  ][y-1]==-1 && S[x][y] + S[x  ][y-1] == 1){ q.push(array<int,2>{x  ,y-1});cmap[x  ][y-1] = imax;}
                if(y+1< W && cmap[x  ][y+1]==-1 && S[x][y] + S[x  ][y+1] == 1){ q.push(array<int,2>{x  ,y+1});cmap[x  ][y+1] = imax;}
                if(x-1>=0 && cmap[x-1][y  ]==-1 && S[x][y] + S[x-1][y  ] == 1){ q.push(array<int,2>{x-1,y  });cmap[x-1][y  ] = imax;}
                if(x+1< H && cmap[x+1][y  ]==-1 && S[x][y] + S[x+1][y  ] == 1){ q.push(array<int,2>{x+1,y  });cmap[x+1][y  ] = imax;}
            }
        }
    }
    map<int, array<ll,2>> group;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(group.count(cmap[i][j])==0) group[cmap[i][j]] = array<ll,2>{0,0};
            if(S[i][j]) group[cmap[i][j]][0]++;
            else        group[cmap[i][j]][1]++;
        }
    }
    ll count = 0;
    for(auto m : group){
        count += m.second[0] * m.second[1];
    }



    cout<<count<<endl;

    return 0;
}


Measured memory_bytes: 10112
n = int(input())
a = list(map(int, input().split()))
a.sort()
dp = [0]*(1000000+1)
cnt = 0
for i in range(len(a)):
  if dp[a[i]]==1:
    continue
  j = 2
  while(a[i]*j<=a[-1]):
    dp[a[i]*j] = 1
    j += 1
  if i!=len(a)-1 and a[i+1]==a[i]:
    dp[a[i]] = 1
    continue
  cnt += 1
  dp[a[i]] = 1
print(cnt)

Measured memory_bytes: 33108
def max(a, b); a < b ? b : a; end
def min(a, b); a < b ? a : b; end
def divceil(a, b); (a + b - 1) / b; end

class Problem
  attr_accessor *(?a..?z).to_a.map(&:to_sym)

  def initialize
    @n,@k = gets.to_s.split.map{ |v| v.to_i }
    @a = gets.to_s.split.map{ |v| v.to_i }
  end

  def solve
    lo = 0
    hi = 10**10
    (lo..hi).bsearch do |x|
      query(x)
    end
  end

  def query(x)
    cutnum(x) <= k
  end

  def cutnum(x)
    a.map{ x == 0 ? _1 + 1 : divceil(_1, x) - 1 }.sum
  end

  def show(ans)
    puts ans == 0 ? 1 : ans
  end
end

Problem.new.instance_eval do
  show(solve)
end



Measured memory_bytes: 79452
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System;
using static System.Math;
using static System.Console;

class E { static void Main() => new J(); }
class J
{
	int F() => int.Parse(ReadLine());
	int[] G() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
	public J()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var s = new[] { ReadLine(), ReadLine() };
		for (var i = 0; i >= 0; i++)
			foreach (var a in s)
			{
				if (i < a.Length) Write(a[i]);
				else
				{
					Console.WriteLine();
					return;
				}
			}
	}
}

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

int main() {
	int h, s, t, a;
	h = 0;
	s = 0;
	t = 0;
	for (int i = 1; i <= 10; i++) {
		cin >> a;
		if (h < a) {
			swap(a,h);
		}
		if (s < a) {

			swap(s,a);

		}
		if (t < a) {

			swap(t,a);

		}
	}
	cout << h << endl;
	cout << s << endl;
	cout << t << endl;
	return 0;
}

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

def f(n):
    if n < 2:
        return 1
    return n * f(n - 2)

def zeros(n):
    count = 0
    cur = n
    while(cur != 0 and cur % 10 == 0):
        cur = cur // 10
        count += 1
    return count

def est(n):
    ev = n // 10
    divider = 50
    while(n // divider != 0):
        ev += n // divider
        divider *= 5
    return ev

if N % 2 == 1:
    print(0)
else:
    print(est(N))


Measured memory_bytes: 3060
from collections import Counter
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
C = Counter(A)

kv = sorted(list(C.items()))
_, nums = zip(*kv)

nums = list(nums)

l = 0
r = len(nums) - 1
adjust = 0
while l <= r:
    if l == r:
        adjust = 1 if nums[r] % 2 == 0 else 0
        nums[r] = 1
        break

    if nums[l] == 1:
        l += 1
        continue
    if nums[r] == 1:
        r -= 1
        continue

    eat = min(nums[l], nums[r]) - 1
    nums[l] -= eat
    nums[r] -= eat

ans = len(nums) - nums.count(0) - adjust
print(ans)


Measured memory_bytes: 29844
#include <stdio.h>
#include <stdbool.h>
 
int main(void)
{
    int x, y, z, sum;
    while (scanf ("%d%d%d", &x, &y, &z) != EOF){        
        sum = 10000 * x + 100 * y + z;
        if (sum < 18680908){
            printf("pre-meiji\n");
        }else if(sum < 19120730){
            printf("meiji %d %d %d\n", x - 1867, y, z);
        }else if(sum < 19261225){
            printf("taisho %d %d %d\n", x - 1911, y, z);
        }else if(sum < 19890108){
            printf("showa %d %d %d\n", x - 1925, y, z);
        }else{
            printf("heisei %d %d %d\n", x - 1988, y, z);
        }
    }
    return 0;
}

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

#define PI 3.14159265358979323846264338327950288419

using namespace std;

const int INF = 9999;

int h, w;
char grid[105][105];
int dp[105][105];

int main(){
	scanf("%d %d", &h, &w);
	for(int i = 1; i <= h; i++){
		scanf(" %s", grid[i] + 1);
	}
	for(int i = 0; i <= h; i++){
		for(int j = 0; j <= w; j++){
			if(i == 0 || j == 0){
				dp[i][j] = INF;
			}else if(i == 1 && j == 1){
				dp[i][j] = (grid[i][j] == '#');
			}else{
				if(grid[i][j] == '#'){
					int option1 = dp[i - 1][j] + (grid[i - 1][j] == '.');
					int option2 = dp[i][j - 1] + (grid[i][j - 1] == '.');
					dp[i][j] = min(option1, option2);
				}else{
					dp[i][j] = min(dp[i - 1][j], dp[i][j - 1]);
				}
			}
		//	printf("%d %d: %d\n", i, j, dp[i][j]);
		}
	}
	printf("%d\n", dp[h][w]);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>

int main(){
int n;
 std::cin >> n;
 int a[n];
 int avg=0;
 for(int i=0;i<n;i++){
       std::cin >> a[i];
       avg+=a[i];
 }
 int avg1=avg;
 avg=(avg)/n;
 avg1=(avg1+n-1)/n;
 //std::cout << avg << " " << avg1 << "\n";
 int t=0,t1=0;
 for(int i=0;i<n;i++){
     t+=(a[i]-avg)*(a[i]-avg);
     t1+=(a[i]-avg1)*(a[i]-avg1);
 }
 std::cout << std::min (t,t1) << std::endl;
 return 0;
}


Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,ans;
int main()
{
    ans=1e16;
    scanf("%lld",&n);
    for(ll i=1;i*i<=n;i++)
    {
        if(n%i==0)
        {
            ll now=n/i+i-2;
            ans=min(ans,now);
            //printf("%lld %lld\n",ans,now);
        }
    }
    if(ans==1e8)
    printf("%lld\n",n-1);
    else
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)

using namespace std;

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

    string s;
    cin >> s;
    ll n = s.size();

    Rep (i, n) {
        if (i+1 < n && s[i] == s[i+1]) {
            cout << i+1 << " " << i+2 << endl;
            return 0;
        } else if (i+2 < n && s[i] == s[i+2]) {
            cout << i+1 << " " << i+3 << endl;
            return 0;
        }
    }

    cout << "-1 -1" << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
// typedef long  l;
typedef pair<int,int> P;
const ll INF=100000000000000001;
const double PI=3.141592653589;


int main(){
  int m1,m2,d1,d2; cin>>m1>>d1>>m2>>d2;
  if(m1==m2)
  cout<<0<<endl;
  else{
    cout<<1<<endl;
  }

  return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [int(s) for s in input().split()]
S = [[0] * 20 for _ in range(N + 1)]
for i in range(1, N + 1):
    for j in range(20):
        S[i][j] = S[i-1][j] + (1 if A[i-1] & (1 << j) else 0)

ans = 0
i = 0
for j in range(N):
    while not all(S[j + 1][v] - S[i][v] < 2 for v in range(20)):
        i += 1
    ans += j + 1 - i
print(ans)


Measured memory_bytes: 124364
#include<iostream>
#include<string>
using namespace std;
int main(){
  string s;
  while(cin >>s){
    int field[30][30]={0};
    for(int i=0; i<8; i++){
      if(i!=0) cin >>s;
      for(int j=0; j<8; j++) if(s[j] == '1') field[10+j][10+i] = 1;
    }
    for(int i=0; i<30; i++){
      for(int j=0; j<30; j++){
	if(field[j][i] == 1){
	  if(field[j+1][i] == 1 && field[j][i+1] == 1 && field[j+1][i+1] == 1) cout <<"A"<<endl;
	  if(field[j][i+1] == 1 && field[j][i+2] == 1 && field[j][i+3] == 1) cout <<"B"<<endl;
	  if(field[j+1][i] == 1 && field[j+2][i] == 1 && field[j+3][i] == 1) cout <<"C"<<endl;
	  if(field[j][i+1] == 1 && field[j-1][i+1] == 1 && field[j-1][i+2] == 1) cout <<"D"<<endl;
	  if(field[j+1][i] == 1 && field[j+1][i+1] == 1 && field[j+2][i+1] == 1) cout <<"E"<<endl;
	  if(field[j][i+1] == 1 && field[j+1][i+1] == 1 && field[j+1][i+2] == 1) cout <<"F"<<endl;
	  if(field[j+1][i] == 1 && field[j][i+1] == 1 && field[j-1][i+1] == 1) cout <<"G"<<endl;
	  break;
	}
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1176
{-# LANGUAGE FlexibleInstances    #-}
{-# LANGUAGE TypeSynonymInstances #-}

import           Control.Applicative
import           Control.DeepSeq
import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                  as A
import qualified Data.Array.IArray           as IA
import qualified Data.Array.IO               as AI
import qualified Data.Array.MArray           as MA
import qualified Data.Array.ST               as STA
import qualified Data.Array.Unboxed          as AU
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import qualified Data.Graph                  as G
import           Data.Int
import qualified Data.IntMap                 as IM
import qualified Data.IntSet                 as IS
import           Data.List
import qualified Data.Map.Strict             as M
import           Data.Maybe
import           Data.Ord
import qualified Data.Sequence               as SQ
import qualified Data.Set                    as S
import           Data.Time
import qualified Data.Tree                   as T
import qualified Data.Vector                 as V
import qualified Data.Vector.Mutable         as VM
import qualified Data.Vector.Unboxed         as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

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

readInts :: Int -> IO [[Int]]
readInts n = replicateM n readInt

readInteger :: IO [Integer]
readInteger = map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine

readIntegers :: Int -> IO [[Integer]]
readIntegers n = replicateM n readInteger

readString :: IO [String]
readString = map BS.unpack . BS.words <$> BS.getLine

readStrings :: Int -> IO [[String]]
readStrings n = replicateM n <$> readString

toPair :: [a] -> (a, a)
toPair [x, y] = (x, y)

count :: Eq a => a -> [a] -> Int
count a as = length $ filter (== a) as

put :: Show a => a -> IO ()
put = putStr . show

putLn :: Show a => a -> IO ()
putLn = print

putList :: Show a => [a] -> IO ()
putList [n] = put n
putList (n:ns) = do
  put n
  putStr " "
  putList ns

putStrList :: [String] -> IO ()
putStrList [n] = putStr n
putStrList (n:ns) = do
  putStr n
  putStr " "
  putStrList ns

main = do
  [n, a, b] <- readInt
  put $ min (a * n) b


Measured memory_bytes: 380
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define Mod 1000000007
#define ll long long
#define dd double
#define pb push_back
#define ff first
#define ss second
#define Mp make_pair
#define INF 999999999999999999
#define NN (ll)(1e5+5)
int mod(string s,int a) 
{ 
    int ans=0; 
    for (int i=0;i<s.length();i++) 
         ans=(ans*10+(int)s[i]-'0')%a; 
    return ans; 
}
ll min(ll x,ll y){if(x<y) return x;return y;}
ll max(ll x,ll y){if(x>y) return x;return y;}
ll power(ll x,unsigned ll y) 
{ 
    if (y==0) 
        return 1; 
    else if (y%2==0) 
        return power(x,y/2)*power(x,y/2); 
    else
        return x*power(x,y/2)*power(x,y/2); 
}
ll hcf(ll a,ll b) 
{ 
    if(b==0) 
        return a; 
    return hcf(b,a%b);  
}
ll n,m;
vector <ll> g[NN],vis(NN),deg(NN);
void bfs()
{
    queue <ll> q;
    q.push(1);
    deg[1]=0;
    vis[1]++;
    while(!q.empty())
    {
        ll node=q.front();
        q.pop();
        for(auto u:g[node])
        {
            if(!vis[u])
            {
                deg[u]=deg[node]+1;
                vis[u]++;
                q.push(u);
            }
        }
    }
}
int main()
{
   fio;
   /*#ifndef ONLINE_JUDGE 
    	freopen("input.txt", "r", stdin); 
    	freopen("output.txt", "w", stdout); 
    	freopen("error.txt", "w", stderr); 
   #endif*/
   ll TT=1;
   //cin>>TT;
   while(TT--)
   {    
       ll i,x,y;
       cin>>n>>m;
       vector <ll> ans;
       for(i=1;i<=m;i++)
       {
           cin>>x>>y;
           g[x].pb(y);
           g[y].pb(x);
       }
       bfs();
       for(i=2;i<=n;i++)
       {
           ll f=0;
           for(x=0;x<g[i].size();x++)
           {
               if(deg[g[i][x]]==deg[i]-1)
                {
                    f=1;
                    ans.pb(g[i][x]);
                    break;
                }
           }
           if(!f)
           {
               cout<<"No\n";
               return 0;
           }
       }
       cout<<"Yes\n";
       for(auto u:ans)
        cout<<u<<"\n";
   }
}

Measured memory_bytes: 14604
A,B,C,D,E,F=list(map(int,input().split()))

answ=1
anss=0

for b in range(F//(100*B)+1):
    for a in range((F-100*B*b)//(100*A)+1):
        w=100*A*a+100*B*b
        if w==0:
            continue
        smax=min(F-w,w*E//100)
        s=0
        for d in range(smax//D+1):
            c=(smax-d*D)//C
            tmps=c*C+d*D

            s=max(s,tmps)

        if anss*(s+w)<=s*(anss+answ):
            answ=w
            anss=s

print('{} {}'.format(answ+anss,anss))

Measured memory_bytes: 39408
local h,w=io.read("n","n","l")
local s={}
for i=1,h do
    s[i]={io.read():byte(1,w)}
end

local u,d,l,r={},{},{},{}
for j=1,w do
    for i=1,h do
        u[i]=u[i] or {}
        if s[i][j]==35 then
            u[i][j]=0
        else
            if i==1 then
                u[i][j]=1
            else
                u[i][j]=u[i-1][j]+1
            end
        end
    end
end
for j=1,w do
    for i=h,1,-1 do
        d[i]=d[i] or {}
        if s[i][j]==35 then
            d[i][j]=0
        else
            if i==h then
                d[i][j]=1
            else
                d[i][j]=d[i+1][j]+1
            end
        end
    end
end
for i=1,h do
    l[i]={}
    for j=1,w do
        if s[i][j]==35 then
            l[i][j]=0
        else
            if j==1 then
                l[i][j]=1
            else
                l[i][j]=l[i][j-1]+1
            end
        end
    end
end
for i=1,h do
    r[i]={}
    for j=w,1,-1 do
        if s[i][j]==35 then
            r[i][j]=0
        else
            if j==w then
                r[i][j]=1
            else
                r[i][j]=r[i][j+1]+1
            end
        end
    end
end

local max=0
for i=1,h do
    for j=1,w do
        max=math.max(max,u[i][j]+d[i][j]+l[i][j]+r[i][j]-3)
    end
end
print(max)

Measured memory_bytes: 164948
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::cmp::max;
fn main() {
    input!{
        a: u64,
        b: u64,
    }
    println!("{}", if max(a, b) <= 8 { "Yay!" } else { ":(" });
}


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

int main(void)
{
  int a, b;
  cin >> a >> b;
  a = a % 500;
  if (a - b <= 0)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}

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

int main() {
  int n, k, x;
  cin >> n >> k;
  x = 1;
  for(int i = 0; i < n; i++){
    if(x * 2 < x + k){
      x *= 2;
    }else{
      x += k;
    }
  }
  cout << x << endl;
}

Measured memory_bytes: 256
N,M,X,Y = map(int,input().split())
xx = map(int,input().split())
yy = map(int,input().split())

ret = 'No War'
if X < Y:
    limit_x = sorted(xx)[-1]
    limit_y = sorted(yy)[0]
    if  limit_x >= limit_y or limit_x >= Y or limit_y<= X: 
        ret='War'
else:
    limit_x = sorted(xx)[0]
    limit_y = sorted(yy)[-1]
    if limit_x <= limit_y or limit_x <= Y or limit_y >= X:
        ret='War'

print(ret)  

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


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

  N = N%10;

  if(N == 0 || N == 1 || N == 6 || N == 8){
    cout << "pon" << "\n";
  }else if(N == 3){
    cout << "bon" << "\n";
  }else{
    cout << "hon" << "\n";
  }


  return 0;
}


Measured memory_bytes: 3656
import sys
import numpy as np

# inputを高速化する。
input = sys.stdin.readline

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

dp = np.zeros(N, dtype=int)
h = np.array(h)

for i in range(1, N):
  start = max(0, i-K)
  dp[i] = min(dp[start:i] + np.abs(h[start:i]-h[i]))
print(dp[N-1])

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

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> l(n);
    string ans = "No";
    for (int i = 0; i < n; ++i) {
        cin >> l[i];
    }
    sort(l.begin(), l.end(), greater<int>());
    int sum = 0;
    for (int i = 1; i < n; ++i) {
        sum += l[i];
    }

    if (l[0] < sum) ans = "Yes";
    cout << ans << endl;

    return 0;
}
    

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::iter::*;
#[allow(unused_imports)]
use std::*;

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
#[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

fn main() {
    println!("{}", solve(&stdin!()));
}
fn solve(src: &str) -> String {
    input! {
        source = src,
        s:String,
        t:String,
    }
    ld(&s, &t).to_string()
}

fn ld(s: &str, t: &str) -> usize {
    if s.is_empty() {
        return 0;
    }
    if t.is_empty() {
        return 0;
    }
    let sc = s.as_bytes()[0];
    let tc = t.as_bytes()[0];
    let i = if sc == tc { 0 } else { 1 };
    i + ld(&s[1..], &t[1..])
}
test! {
    include_str!("b_1.txt") => "4",
    include_str!("b_2.txt") => "5",
    include_str!("b_3.txt") => "0",
}


Measured memory_bytes: 18528
#include <cstdio>
#include <queue>
#include <map>
#include <vector>
#include <cmath>
#include <cassert>
#include <string>
#include <algorithm>

using namespace std;

struct P {
    int bits;
    int time;
    int zero;
    P(int bits, int time, int zero): bits(bits), time(time), zero(zero) {}
};

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

int get_bit(int num, int x) {
    if (x == MAX_BIT-1) {
        int k = pow(LEN, x);
        return num / k;
    } else if (0 <= x && x < MAX_BIT-1) {
        int k1 = pow(LEN, x+1);
        int k2 = pow(LEN, x);
        return (num % k1) / k2;
    } else {
        assert(0);
    }
}

void swap_bits(int& num, int x, int y) {
    int bit_x = get_bit(num, x);
    int bit_y = get_bit(num, y);
    num -= bit_x * (int) pow(LEN, x);
    num -= bit_y * (int) pow(LEN, y);
    num += bit_x * (int) pow(LEN, y);
    num += bit_y * (int) pow(LEN, x);
}

string bits2str(int num) {
    string result;
    int div = pow(LEN, MAX_BIT-1);
    while (div) {
        int quo = num / div;
        int rem = num % div;
        num = rem;
        div /= LEN;
        result.push_back(quo+'0');
    }
    return result;
}

int main() {
    int origin = 0;
    for (int i = 0; i < LEN; i++) {
        origin = LEN*origin + i;
    }

    queue<P> q;
    map<int, int> reach_time;

    q.push(P(origin, 0, 0));
    reach_time.insert(make_pair(origin, 0));
    while (!q.empty()) {
        P& p = q.front();
        int magic = p.bits;
#if DEBUG
        string s_magic = bits2str(magic);
#endif
        int time = p.time;
        int zero = p.zero;
        q.pop();
        for (int i = 0; i < 4; i++) {
            int x = zero/4 + dx[i];
            int y = zero%4 + dy[i];
            if (x >= 0 && x < 2 && y >= 0 && y < 4) {
                int new_magic = magic;
                swap_bits(new_magic, MAX_BIT-1-zero, MAX_BIT-1-(4*x+y));
#if DEBUG
                string s_new_magic = bits2str(new_magic);
#endif
                if (reach_time.find(new_magic) == reach_time.end()) {
                    reach_time.insert(make_pair(new_magic, time+1));
                    q.push(P(new_magic, time+1, 4*x+y));
                }
            }
        }
    }

    while (1) {
        int ret;
        int puzzle = 0;
        for (int i = 0; i < LEN; i++) {
            int tmp;
            ret = scanf("%d", &tmp);
            if (ret < 0) break;
            puzzle = LEN*puzzle + tmp;
        }
        if (ret < 0) break;
        printf("%d\n", reach_time[puzzle]);
    }
    return 0;
}

Measured memory_bytes: 1800
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <sstream>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <vector <int>> vii;
typedef vector <long long> vll;
typedef vector <string> vs;
typedef vector <char> vc;
typedef set <int> si;
typedef set <string> ss;
typedef queue <int> qi;
typedef queue <long long> qll;
typedef queue <string> qs;
typedef queue <char> qc;
typedef struct board board;
typedef pair <int, int> pi;
typedef pair <long long, long long> pll;
typedef pair <int, pair<int, int>> pii;

#define eb emplace_back
#define ppb pop_back
#define clr(a) a.clear()
#define F first
#define S second
#define mkp make_pair

#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

#define left(x) x * 2
#define right(x) x * 2 + 1

#define meme(a, b, c) fill(a + 1, a + 1 + b, c)

#define max(a, b) (a > b ? a : b)
#define min(a, b) (a > b ? b : a)
#define abs(a) (a > 0? a : -(a))

#define move(s) s += "#"

#define eprintf(...) fprintf(stderr, __VA_ARGS__);

template <typename T>
void printArr(const T * arr, int s, int fn) {
    for (int i = s; i <= fn; ++ i) cout << arr[i] << " ";
    cout << '\n';
}

template <typename T>
long long minArr(const T * arr, int s, int fn) {
    ll res = 1e16 + 1;
    for (int i = s; i <= fn; ++ i) {
        res = min(res, arr[i]);
    }
    return res;
}

template <typename T>
void printVec(const T * arr) {
    for (int i = 0; i < sz(arr); ++ i) cout << arr[i] << " ";
    cout << '\n';
}

template <class T>
bool uax(T&a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <class T>
bool uin (T&a, const T& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

void to_pray() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cerr << "Ready\n";
}

const int N = 1e5 + 10;
const int NN = 1e3 + 10;
const int NNN = 2e3 + 9;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll LLINF = 1e12 + 7;
const int EPS = 1e-9 - 8;
const int vN = 2e4 + 10;
const int sz = (1 << 22) - 1;
const double PI = acos(-1);

int main () {
    to_pray();

    int a, b;
    cin >> a >> b;

    for (int i = (b - a + 1); i <= (a + b - 1); ++ i)
        cout << i << " ";

    //eprintf("%.18lf seconds\n", (double)clock() / CLOCKS_PER_SEC);

    cout << '\n';
    
    return 0;
}

Measured memory_bytes: 256
int p[10000],n=2,i,j;
int main(){
  *p=2;
  for(;i<10000;)
    for(;;){
    a:  n++;
      for(j=0;p[j]*p[j]<=n;j++)
	if(n%p[j]==0) goto a;
      p[++i]=n;
      break;
    }
  for(i=1;i<10000;)
    p[i]+=p[i++-1];
  for(;;){
    scanf("%d",&n);
    if(!n) break;
    printf("%d\n",p[n-1]);
  }
  return 0;
}

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

using namespace std;

int dp[2020][2020];

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

    long long ans=0,
    temp = 0;
    for(int i=0;i<n;i++) {
        cin>>dp[i][0];
        ans += dp[i][0];
    }


    for(int i=1;i<n;i++) {
        temp = 0;
        for(int j=0;j<n;j++) {
            dp[j][i] = min(dp[j][i-1], dp[(j-i+n)%n][0]);
            temp  += dp[j][i];
        } ans = min(ans, temp + 1LL*a*i);
    }

    cout<<ans;
}


Measured memory_bytes: 16128
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        
        if (x < 600) {
            System.out.println("8");
        } else if (x < 800) {
            System.out.println("7");
        } else if (x < 1000) {
            System.out.println("6");
        } else if (x < 1200) {
            System.out.println("5");
        } else if (x < 1400) {
            System.out.println("4");
        } else if (x < 1600) {
            System.out.println("3");
        } else if (x < 1800) {
            System.out.println("2");
        } else{
            System.out.println("1");
        }
        
    }
}


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

using namespace std;

int x,y,a,b,ans;

int main(){
	scanf("%d%d",&x,&y);
	scanf("%d%d",&a,&b);
	ans = abs(x-a)*abs(y-b);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const ll INF = 1LL<<60;
const int ny[4] = {-1,1,0,0}, nx[4] = {0,0,-1,1};
int sy,sx,gy,gx;

int main(){
  int h,w; cin >> h >> w;
  vector<string> g(h);
  vector<vector<int>> ans(h,vector<int>(w,0));
  for(int i = 0; i < h; i++) cin >> g[i];

  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(g[i][j] != '.'){
        ans[i][j] = -1;
        continue;
      }
      int cnt = 0;
      for(int x = -1; x <= 1; x++){
        for(int y = -1; y <= 1; y++){
          if(0 > x+i || x+i >= h || 0 > y+j || y+j >= w) continue;
          if(g[x+i][y+j] == '#') cnt++;
        }
      }
      ans[i][j] = cnt;
    }
  }
  rep(i,h){
    rep(j,w){
      if(ans[i][j] == -1){
        cout << '#';
      }else{
        cout << ans[i][j];
      }
    }
    cout << endl;
  }
  return 0;
}


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

int main() {
    int x;
    cin >> x;
    vector<int> dp(x + 1, 0);
    dp[0] = 1;
    for (int i = 0; i <= x; i++) {
        if (i + 100 <= x) dp[i + 100] += dp[i];
        if (i + 101 <= x) dp[i + 101] += dp[i];
        if (i + 102 <= x) dp[i + 102] += dp[i];
        if (i + 103 <= x) dp[i + 103] += dp[i];
        if (i + 104 <= x) dp[i + 104] += dp[i];
        if (i + 105 <= x) dp[i + 105] += dp[i];
    }
    cout << (bool)dp[x] << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) v.erase(unique(ALL(v)), v.end())
#define bit(i) (1LL<<i)
#define sz(v) ((LLI)(v).size())

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(...) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){is >> p.first >> p.second; return is;}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

class UnionFind{
  vector<int> _parent, _depth, _size;
  int _count;
public:
  UnionFind(int n): _parent(n), _depth(n,1), _size(n,1), _count(n){REP(i, n) _parent[i] = i;}
  int root(int i){
    if(_parent[i] == i) return i;
    else return _parent[i] = root(_parent[i]);
  }
  bool same(int i, int j){return root(i) == root(j);}
  int merge(int i, int j){
    int ri = root(i), rj = root(j);
    if(ri == rj) return ri;
    else{
      --_count;
      if(_depth[ri] < _depth[rj]){
	_parent[ri] = rj; _size[rj] += _size[ri];
	return rj;
      }else{
	_parent[rj] = ri; _size[ri] += _size[rj];
	if(_depth[ri] == _depth[rj]) ++_depth[ri];
	return ri;
      }
    }
  }
  int size(int i){return _size[root(i)];}
  int count(){return _count;}
};

namespace std {
  template <>
  class hash<std::pair<int, int>> {
  public:
    size_t operator()(const std::pair<int, int>& x) const{
      return hash<int>()(x.first) ^ hash<int>()(x.second);
    }
  };
}

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

  int N;
  while(cin >> N){

    vector<int> x(N), y(N);

    REP(i,N){
      cin >> x[i] >> y[i];
    }

    map<pair<int,int>, int> m;
    REP(i,N){
      REP(j,N){
	if(i==j) continue;
	m[{x[i]-x[j], y[i]-y[j]}] += 1;
      }
    }


    int k = 0;
    for(auto &kv : m) chmax(k, kv.snd);

    int ans = N - k;

    cout << ans << endl;
  }
  
  return 0;
}


Measured memory_bytes: 384
MOD = 10**9+7 # MODは問題に合わせて変更する
ONE = '1'.freeze
def inv(x)
    res = 1 # 逆元をどんどんかけるやつ
    beki = x # 逆元を計算したい値のMOD化でのべき乗
    (MOD - 2).to_s(2).reverse.chars do |digest|
        res = (beki * res) % MOD if digest == ONE
        beki = (beki * beki) % MOD
    end
    res
end

str = gets.split
N,K = str[0].to_i, str[1].to_i

k = K >= N ? N-1 : K
answer = 1
a = 1
i = 1
while i <= k
    a *= (N-i)*(N+1-i)
    a %= MOD
    a *= inv(i)**2
    a %= MOD
    answer += a
    answer %= MOD
    i += 1
end

puts answer

Measured memory_bytes: 3836
#include<bits/stdc++.h>
using namespace std;
int maxx = 1000000007;
int main()
{
  int n,t;
  cin>>n>>t;
  vector<int> tim(n),cost(n);
  int mincost = maxx;
  for(int i=0;i<n;i++)
  {
    cin>>cost[i];
    cin>>tim[i];
    if((tim[i] <= t))
      mincost = min(mincost,cost[i]);
  }
  if(mincost == maxx)
    cout<<"TLE";
  else
    cout<<mincost;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using p = pair<int, ll>;
 
bool judge(const vector<int> &target)
{
  for(auto e : target)
  {
    if(e > 1)
    {
      return false;
    }
  }
  return true;
}
 
int main()
{
  int n, m;
  ll mod = 1000000007;
  cin >> n >> m;
  vector<int> a(n * m + 1, 0);
  vector<int> b(n * m + 1, 0);
  for(int i = 0; i < n; i++)
  {
    int temp;
    cin >> temp;
    a[temp]++;
  }
  for(int j = 0; j < m; j++)
  {
    int temp;
    cin >> temp;
    b[temp]++;
  }
  bool cana = judge(a);
  bool canb = judge(b);
  if(!cana && !canb)
  {
    cout << 0 << endl;
    return 0;
  }
  vector<int> asum = a;
  vector<int> bsum = b;
  for(int i = 1; i <= n * m; i++)
  {
    asum[i] += asum[i - 1];
    bsum[i] += bsum[i - 1];
  }
  ll result = 1;
  for(ll i = n * m; i > 0; i--)
  {
    if(a[i] == 1 && b[i] == 1)
    {
      result = result;
    }else if(a[i] == 1){
      result = (result * (bsum[n * m] - bsum[i])) % mod;
    }else if(b[i] == 1){
      result = (result * (asum[n * m] - asum[i])) % mod;
    }else{
      ll temp = (asum[n * m] - asum[i]) * (bsum[n * m] - bsum[i]);
      temp -= n * m - i;
      result = (result * temp) % mod;
    }
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 15872
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
#include <random>
#include <utility>
#include <map>
#include <vector>
#include <queue>
#include <bitset>
#include <sstream>
#define REP(i,x) for(int i=0; i<(x); i++)
typedef long long ll;

using namespace std;

int count(int x){
    int ct = 0;
    while(true){
        if(x%2==1){
            return ct;
        }else{
            x = x/2;
            ct++;
        }
    }
}

int main(int argc, const char * argv[]) {
    int n;
    cin >> n;
    int a[n];
    int out = 0;
    REP(i,n){
        cin>> a[i];
        out += count(a[i]);
    }

    cout << out << endl;
    
    return 0;
}


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

using namespace std;

struct Info{ int color, num;};
vector<Info> V;

void add(int col, bool odd){

  if(V.empty()){
    V.push_back((Info){col,1});
    return;
  }

  if(odd){
    //odd
    if(V.back().color == col) V.back().num++;
    else V.push_back((Info){col,1});
  }else{
    //even
    if(V.back().color == col) V.back().num++;
    else{
      int tmp = 1;
      while(!V.empty() && V.back().color != col){
	tmp += V.back().num;
	V.pop_back();
      }
      V.push_back((Info){col,tmp});
    }
  }
}

int main(){
  int n;
  while(scanf("%d",&n) && n){
    V.clear();
    for(int i = 0; i < n; i++){
      int in;
      scanf("%d",&in);
      add(in, !(i%2));
    }

    int ans = 0;
    for(int i = 0; i < (int)V.size(); i++)
      if(V[i].color == 0) ans += V[i].num;
    
    printf("%d\n",ans);
  }
  return 0;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  rep(i, n) a[i]--;
  vector<int> s(n + 1);
  rep(i, n) s[i + 1] = (s[i] + a[i]) % k;
  map<int, int> mp;
  ll ans = 0;

  rep(i, n + 1) {
    ans += mp[s[i]];
    mp[s[i]]++;
    if (i - k + 1 >= 0) mp[s[i - k + 1]]--;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 11136
/*
ID: alec3
LANG: C++14
PROG:
*/


#include <bits/stdc++.h>

#define check(x) cout<<(#x)<<": "<<x<<" ";
#define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ss second
#define ff first
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define ld long double
#define all(c) (c).begin(), (c).end()
#define FOR(i, a, b) for (int i = a; i < b; i++)

typedef long long ll;
typedef unsigned long long ull;

int pct(int x) { return __builtin_popcount(x); }



using namespace std;


int main()
{
    io;
    int n, x, t;
    cin >> n >> x >> t;

    int c = 0;
    int ans = 0;
    while (c < n){
        c += x;
        ans += t;
    }
    cout << ans << endl;



    return 0;

}


Measured memory_bytes: 3648
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

import sys
K=input()
K=int(K)
S=0
a=1
b=1
c=1
for i in range(K):
    for j in range(K):
        if gcd(a,b)==1:
            S+=K
        else:
            S+=sum([gcd(a,b,c) for c in range(1,K+1)])
        c=1
        b=b+1
    b=1
    c=1
    a=a+1

print(S)

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x, y;
    cin >> x >> y;
    string s = "No";
    for(int i=0; i<=x; i++)
    {
        if(i*2 + (x-i)*4 == y) s = "Yes";
    }
    cout << s << endl;

    return 0;
}


Measured memory_bytes: 3668