akhauriyash/Code-Regression huggingface dataset:
/*input
6
30 10 60 10 60 50

*/
/*

  ####   #    #    ##    #####    ####           #    #
 #       #    #   #  #   #    #  #    #          #    #
  ####   ######  #    #  #    #  #    #          #    #
      #  #    #  ######  #    #  #    #          # ## #
 #    #  #    #  #    #  #    #  #    #          ##  ##
  ####   #    #  #    #  #####    ####  #######  #    #

*/
#include<bits/stdc++.h>
#define lld          long long int
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<lld,lld>
#define msi         map<string,lld>
#define mis         map<lld, string>
#define mpi         map<pair<lld ,lld >,lld >
#define pii         pair<lld,lld>
#define vi          vector<lld>
#define vpi 		vector<pii>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (lld)x.size()
#define hell        1000000007
#define rep(i,m,n)	for(lld i=m;i<n;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
#define pr(x) 		cout<< x << " ";
#define pre(x)		cout<< x << endl ;
using namespace std;
#define N  100005
lld dp[N];
lld ht[N];
lld n;
void init()
{
	rep(i,0,N)
	{
		dp[i]=-1;
		ht[i]=0;
	}
}
lld func(lld x)
{
	if(x>=n)
	{
		return hell;
	}
	if(x==n-1)
	{
		return 0;
	}
	if(dp[x]!=-1)
	{
		return dp[x];
	}
	lld ans=func(x+1)+abs(ht[x+1]-ht[x]);
	ans=min(func(x+2)+abs(ht[x+2]-ht[x]),ans);
	dp[x]=ans;
	return dp[x];
}
inline void solve()
{
	cin >> n;
	init();
	rep(i,0,n)
	{
		cin >> ht[i];
	}
	cout << func(0) << endl;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tests=1;
	//cin>>tests;
	while(tests--)
	{
		solve();
	}
}

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

using namespace std;

//int→string
//string→int
//------------------------------------------
inline int toInt(string s) {
    int v;
    istringstream sin(s);
    sin >> v;
    return v;
}

template<class T>
inline string toString(T x) {
    ostringstream sout;
    sout << x;
    return sout.str();
}

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<bool> VB;
typedef vector<VI> VVI;
typedef vector<VB> VVB;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

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

//repetition
//------------------------------------------
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n)  FOR(i,0,n)
#define REPR(i, n) for(int i = n;i >= 0;i--)

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

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

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



int main() {

    int N;
    cin>>N;
    int M;
    cin>>M;

    VVB mapB;
    mapB.resize(N);
    REP(i, N){
        mapB[i].resize(N);
    }
    REP(i, N){
        REP(j,N){
            mapB[i][j] = false;
        }
    }
    REP(i, M){
        int a;
        int b;
        cin>>a>>b;
        mapB[a-1][b-1] = true;
        mapB[b-1][a-1] = true;
    }

    int p[10];
    REP(i,10){
        p[i] = i;
    }
    int count = 0;

    do{
        bool good = true;
        for(int i=0;i<N-1;i++){
            if(i==0){
                if(p[i]!=0){
                    good = false;
                }
            }
            if(mapB[p[i]][p[i+1]]){
                continue;
            }else{
                good = false;
            }
        }
        if(good){
            count++;
        }
    }while(next_permutation(p,p+N));

    cout<<count;

    return 0;
}






































































Measured memory_bytes: 256
import java.io.*;
import java.util.*;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		char[] n = sc.next().toCharArray();

		if ((n[0] == n[1] && n[1] == n[2]) || (n[1] == n[2] && n[2] == n[3])) {
			pr.println("Yes");
		} else {
			pr.println("No");
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 22484
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define re register
#define pb push_back
#define fi first
#define se second
#define mp make_pair
const int N=2e6+10;
const int mod1=998244353;
const int mod2=19260811;
void read(int &a)
{
    a=0;int d=1;char ch;
    while(ch=getchar(),ch>'9'||ch<'0')
        if(ch=='-')
            d=-1;
    a=ch^48;
    while(ch=getchar(),ch>='0'&&ch<='9')
        a=(a<<3)+(a<<1)+(ch^48);
    a*=d;
}
int main()
{
    int n,m;
    read(n),read(m);
    printf("%d\n",n*(n-1)/2+m*(m-1)/2);
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <set>
#include <iostream>
#include <stack>
#include <vector>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <random>
#include <chrono>
using namespace std;


const int mod = 1e9 + 7;
const int maxn = 1e6 + 5;

vector<int> G[maxn];
int n;

int fac[maxn], inv[maxn];
int size[maxn];
int dp[maxn], dp1[maxn];

int qpow(int a, int n){
    int ret = 1;
    while(n > 0){
        if(n & 1){
            ret = 1LL * ret * a % mod;
        }
        a = 1LL * a * a % mod;
        n >>= 1;
    }
    return ret;
}

void pre_comb(){
    fac[0] = 1;
    for(int i = 1;i < maxn;i++){
        fac[i] = 1LL * fac[i - 1] * i % mod;
    }
    inv[maxn - 1] = qpow(fac[maxn - 1], mod - 2);
    for(int i = maxn - 2;i >= 0;i--){
        inv[i] = 1LL * inv[i + 1] * (i + 1) % mod;
    }
}

int comb(int n, int m){
    if(m > n or m < 0) return 0;
    return 1LL * fac[n] * inv[m] % mod * inv[n - m] % mod;
}

void dfs(int u, int fa){
    size[u] = 1;
    int sum = 0;
    dp[u] = 1;
    dp1[u] = 1;
    for(auto v : G[u]){
        if(v == fa){
            continue;
        }
        dfs(v, u);
        sum += size[v];
        dp[u] = 1LL * dp[u] * dp[v] % mod;
        dp[u] = 1LL * dp[u] * comb(sum, size[v]) % mod; 
    }
    //dp1[u] = 1LL * dp[u] * comb(n - 1, sum) % mod;
    size[u] += sum;
}

void dfs2(int u, int fa){
    int val = inv[n - size[u]];
    int pre = val, suf = 1;
    //cout << u << " " << dp1[u] << endl;
    for(auto v : G[u]){
        if(v == fa)
            continue;
        dp1[v] = 1LL * dp1[v] * fac[n - size[v] - 1] % mod;
        dp1[v] = 1LL * dp1[v] * dp1[u] % mod;
        dp1[v] = 1LL * dp1[v] * pre % mod;
        pre = 1LL * pre * inv[size[v]] % mod;
        pre = 1LL * pre * dp[v] % mod;
        //cout << "###" << v << " " << dp1[v] << endl;
    }
    for(int i = G[u].size() - 1;i >= 0;i--){
        int v = G[u][i];
        if(v == fa)
            continue;
        dp1[v] = 1LL * dp1[v] * suf % mod;
        suf = 1LL * suf * inv[size[v]] % mod;
        suf = 1LL * suf * dp[v] % mod;
    }
    for(auto v : G[u]){
        if(v != fa)
            dfs2(v, u);
    }
}

int main(){
    pre_comb();
    cin >> n;
    for(int i = 1;i < n;i++){
        int u, v;
        scanf("%d%d", &u, &v);
        G[u].push_back(v);
        G[v].push_back(u);
    }
    dfs(1, 1);
    dfs2(1, 1);
    for(int i = 1;i <= n;i++){
        dp[i] = 1LL * dp[i] * comb(n - 1, (size[i] - 1)) % mod;
        dp[i] = 1LL * dp[i] * dp1[i] % mod;
        printf("%d\n", dp[i]);
    }
    return 0;
}


Measured memory_bytes: 46068
#include <bits/stdc++.h>
using namespace std;int main(){cin.tie(0);ios::sync_with_stdio(false);long long i,a,N,s,A=LLONG_MAX,l=0,r=0,S[100002]={0};cin>>N>>s;for(i=1;i<=N;i++){cin>>a;S[i]+=S[i- 1]+a;}for(;;){if(S[r]-S[l]>=s){A=min(A,r-l);l++;}else(r++);if(r>N){if(A==LLONG_MAX)A=0;cout<<A<<endl;return 0;}}}

Measured memory_bytes: 3924
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define REP(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
 
 
 
int main()
{
	int N, input;
	vector<int> A;
	scanf("%d", &N);
 
	rep(i, N) {
		scanf("%d", &input);
		A.push_back(input);
	}
 
	sort(A.begin(), A.end());
 
	bool isDistinct = true;
	REP(i, 1, N) {
		if (A[i] == A[i - 1]) {
			isDistinct = false;
			break;
		}
	}
 
	printf("%s\n", isDistinct ? "YES" : "NO");
	return 0;	
}

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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

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

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }


void func(long long N, long long K, std::vector<long long> A){

}

int main(){
    int n;
    ll k;
    cin >> n >> k;
    vi a(n);
    rep(i, n) {
        cin >> a[i];
        a[i]--;
    }
    vi cnt(n);
    int p = 0, roop = -1, ans = -1;
    rep1(i, n) {
        if (k == 0) {
            ans = p + 1;
            break;
        }
        if (cnt[p] != 0) {
            roop = i - cnt[p];
            k %= roop;
            int q = p;
            rep(j, k) {
                q = a[q];
            }
            ans = q + 1;
            break;
        }
        cnt[p] = i;
        p = a[p];
        --k;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4844
#include <cstdio>
#include <algorithm>

using namespace std;
typedef long long lli;

const lli inf=1e18;

int n;
lli arr[200001];

lli get(lli a,lli b,lli c,lli d) {
	lli mx=max({a,b,c,d}),mn=min({a,b,c,d});
	return mx-mn;
}
lli check(int l,int r,lli f,lli s) {
	lli sum=arr[r]-f;
	int idx=upper_bound(arr+1,arr+n+1,f+sum/2)-arr;
	
	return min(get(f,s,arr[idx]-arr[l-1],arr[r]-arr[idx]),
				get(f,s,arr[idx-1]-arr[l-1],arr[r]-arr[idx-1]));
}
int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%lld",arr+i);
	for(int i=1;i<=n;i++) arr[i]+=arr[i-1];

	lli ans=inf;
	for(int i=1;i<=n-3;i++) {
		lli lo=i+3,up=n;
		while(up-lo>5) {
			lli m1=(lo*2+up)/3, m2=(lo+up*2)/3;
			lli v1=check(i+1,m1-1,arr[i],arr[n]-arr[m1-1]);
			lli v2=check(i+1,m2-1,arr[i],arr[n]-arr[m2-1]);
			if(v1<v2)up=m2;
			else lo=m1;
		}
		for(int j=lo;j<=up;j++) {
			ans=min(ans,check(i+1,j-1,arr[i],arr[n]-arr[j-1]));
		}
	}
	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 1664
from math import sqrt
q = int(input())
l, r = [], []
for i in range(q):
    a, b = map(int, input().split())
    l.append(a)
    r.append(b)


like = [0] * 100001
prime = set()


def isprime(n):
    global prime
    if (n in prime):
        return True
    else:
        f = False
        for i in range(2, int(sqrt(n)) + 1):
            f |= (n % i == 0)

        if not f:
            prime.add(n)
        return not f


def is2017like(n):
    if n % 2 == 0:
        return False
    return isprime(n) & isprime((n + 1) // 2)


for i in range(1, 100001):
    like[i] = like[i-1] + int(is2017like(i))


for i in range(q):
    print(like[r[i]]-like[max(1, l[i]-1)])


Measured memory_bytes: 66008
n = int(input())
a = list(map(int, input().split()))
ans = 1000
kabu = 0

future = []

for i in range(n-1):
  if a[i] < a[i+1]:
    future.append("u")
  elif a[i] == a[i+1]:
    future.append("e")
  else:
    future.append("d")

try:
  last_u = future[::-1].index("u")
except ValueError:
  print(1000)
else:
  last_u = n - last_u - 1
  for i in range(last_u):
    if future[i] == "u":
      if kabu != 0:
        ans += kabu * a[i]
        kabu = 0
      kabu = ans // a[i]
      ans -= kabu * a[i]
    if future[i] == "d":
      if kabu != 0:
        ans += kabu * a[i]
        kabu = 0
  if kabu != 0:
    ans += kabu * a[last_u]
  print(ans)

Measured memory_bytes: 9244
//============================================================================
// Name        : AOJ.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;

int main() {
	char s[201],p[101];
	cin>>s>>p;
	char t[101]={};
	strcpy(t,s);
	strcat(s,t);
	if(strstr(s,p)==NULL)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 3096
# coding: utf-8

n, t = map(int, input().split())
times = list(map(int, input().split()))

ans = 0
end_time = 0
for i in range(n):
    if end_time <= times[i]:
        ans += t
        end_time = times[i] + t
    else:
        ans += max(0, times[i] + t - end_time)
        end_time = max(times[i] + t, end_time)

print(ans)

Measured memory_bytes: 26836
package main
import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
  // "math"
)

// 行単位で読み込む場合
var sc = bufio.NewScanner(os.Stdin)

func main() {
  sc.Scan()
  A, _ := strconv.Atoi((strings.Split(sc.Text(), " "))[0])
  B, _ := strconv.Atoi((strings.Split(sc.Text(), " "))[1])
  K, _ := strconv.Atoi((strings.Split(sc.Text(), " "))[2])

  for i := A; i <= B; i++ {
    if i < A + K || i > B - K {
      fmt.Println(i)
    }
  }

}

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

using namespace std;
int main()
{
    string s;cin>>s;
    while(true)
    {
        s.pop_back();
        if(s.size()%2==0) if(s.substr(0, s.size()/2)==s.substr(s.size()/2, s.size()/2))
        {
            printf("%d\n",s.size());
            return 0;
        }
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,ans;
    char ch;
    while(1)
    {
        cin>>a >> ch >> b;
        if(ch == '?')
            break;
        if(ch == '+')
            ans = a+b;
        else if(ch == '-')
            ans = a-b;
        else if(ch == '*')
            ans = a*b;
        else if(ch == '/')
            ans = a/b;

     cout<<ans<<endl;

    }
 return 0;
}



Measured memory_bytes: 3064
N = int(input())
A = list(map(int, input().split()))

d = {}
for a in A:
  d[a] = d.get(a, 0) + 1
sum = sum([v*(v-1)/2 for v in d.values()]) 

for i in range(N):
  print(int(sum-d[A[i]]+1))

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

int main() {
  int n, c = 0;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == a[i+1]){ 
      a[i+1] = 0;
      c++;
    }
  }
  cout << c;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        long n=Long.parseLong(sc.next());
        sc.close();
        for(long a=(long) Math.sqrt(n);a>=1;a--){
            if(n%a==0){
                long b=n/a;
                String b_str=Long.toString(b);
                System.out.println(b_str.length());
                System.exit(0);
            }
        }
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
//for(int i = 0; i<n; i++)
 
 
int main()
{
    int n,k;cin>>n>>k;
    vector<int> x(n);
    int sum = 0;
    for(int i = 0; i<n; i++){
        cin>>x[i];
        x[i] = min(x[i], k - x[i]);
        sum += x[i]*2;
    }
    cout << sum << endl;
    
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<map>
#include<cstring>
#include <stack>
#include <numeric>
#include<climits>
#include<set>
#include<unordered_set>
#include<iomanip>
#include<queue>
#include<unordered_map>
#define vi vector<float>
#define vl vector<long long>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define loop(i,n) for(float i=0; i<n; i++)
#define pb push_back
#define mp make_pair
#define ll long long
#define pii pair<float,float>
#define umap unordered_map<ll,float>
using namespace std;

#define xx first
#define yy second


int main() 
{ 
	ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    
    ll n;
    cin >> n;

  	ll ans = (n/500)*1000;
  	n -= (n/500)*500;
  	ans += (n/5)*5;

  	cout << ans << endl;










  	return 0;
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep0(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define mREP(i,a,b) for (int i = a; i > (b); --i)
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;
typedef long long ll;
using namespace std;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int main(){
  int w,a,b;
  cin>>w>>a>>b;
  if(a+w < b)cout<<max(b-(a+w),0)<<endl;
  else cout<<max(a-(b+w),0)<<endl;
  return 0;
} 

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

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

int main() {
  ll x, y, ans = 0;
  cin >> x >> y;

  cout << (2 * x <= y && y <= 4 * x && y % 2 == 0 ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3592
k=int(input())
count=0
def rec(l,keta,countive,s):
    global count
    global k
    #count
    if keta==1:
        if countive:
            count+=1
            if count==k:
                while s[0]=="0":
                    s=s[1:]
                print(s)
                return True #end flag
    #create next
    else:
        if l==0:
            if countive==False:#all l
                if rec(0,keta-1,False,s+str(0)):return True
                for i in range(1,10):
                    if rec(i,keta-1,True,s+str(i)):return True
            else:
                if rec(l,keta-1,True,s+str(l)):return True
                if rec(l+1,keta-1,True,s+str(l+1)):return True
        elif l==9:
            if rec(l-1,keta-1,True,s+str(l-1)):return True
            if rec(l,keta-1,True,s+str(l)):return True
        else:
            if rec(l-1,keta-1,True,s+str(l-1)):return True
            if rec(l,keta-1,True,s+str(l)):return True
            if rec(l+1,keta-1,True,s+str(l+1)):return True
rec(0,11,False,"0")

Measured memory_bytes: 3064
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
//namespace mp=boost::multiprecision;
//#define mulint mp::cpp_int
//#define mulfloat mp::cpp_dec_float_100
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
//constexpr int MOD=1000000007;
constexpr int MOD=998244353;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;

int main(void){
    int N;
    cin >> N;
    lint ans=0;
    rep(i,N) ans+=(i+1)*(N-i);
    rep(i,N-1){
        lint a,b;
        cin >> a >> b;
        if(a>b) swap(a,b);
        ans-=a*(N-b+1);
    }
    cout << ans << endl;
}

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

using namespace std;

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  while (1) {
    c -= b;
    if (c <= 0) {
      cout << "Yes" << endl;
      break;
    }
    a -= d;
    if (a <= 0) {
      cout << "No" << endl;
      break;
    }
  }

  return 0;
}
/* vim:set fdm=marker: */


Measured memory_bytes: 3636
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)
#define pf push_front
#define ins insert

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
unsigned XorShift(void){static unsigned x = 123456789;static unsigned y = 362436069;static unsigned z = 521288629;static unsigned w = 88675123;unsigned t;t = x ^ (x << 11);x = y; y = z; z = w;return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

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;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}

int n,m,h,w;

main(){
	cin>>n>>m>>h>>w;
	dump(n*m-h*m-w*n+h*w);
}

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

using namespace std;

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

	int n; cin >> n;
  	int arr[n], ans = 0;
	for (int i = 0; i < n; ++i) {
    	cin >> arr[i];
    }
  	for (int i = 1; i < n - 1; ++i) {
    	if (arr[i] > arr[i - 1] && arr[i] < arr[i + 1]) {
    		++ans;
    	}
    	if (arr[i] < arr[i - 1] && arr[i] > arr[i + 1]) {
    		++ans;
    	}
    }
  	cout << ans << endl;
}

Measured memory_bytes: 256
import sys, os.path
import math
from collections import Counter
if(os.path.exists('input.txt')):
    sys.stdin = open("input.txt","r")
    sys.stdout = open("output.txt","w")



MAX = 1000001

factor = [0]*(MAX + 1)

def generatePrimeFactors():
    factor[1] = 1
    for i in range(2,MAX):
        factor[i] = i
    for i in range(4,MAX,2):
        factor[i] = 2
    i = 3
    while(i * i < MAX):
        if (factor[i] == i):
            j = i * i
            while(j < MAX):
                if (factor[j] == j):
                    factor[j] = i
                j += i
        i+=1


def calculateNoOFactors(n):
    if (n == 1):
        return 1
    ans = 1
    dup = factor[n]
    c = 1
    j = int(n / factor[n])
    while (j > 1):
        if (factor[j] == dup):
            c += 1
        else:
            dup = factor[j]
            ans = ans * (c + 1)
            c = 1
        j = int(j / factor[j])
    ans = ans * (c + 1)

    return ans
generatePrimeFactors()

n = int(input())
temp = n
c = 1
count = 0
while(temp-c > 0):
    w = temp-c
    count += calculateNoOFactors(w)
    c += 1
print(count)


Measured memory_bytes: 48700
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>

using namespace std;
typedef long long int ll;

int main()
{
	ll n;
	scanf("%lld",&n);
	int ret=0,mx=0;
	ll t=1;
	while(t<=n)
	{
		t*=10LL;
		mx+=9;
	}
	t/=10LL;
	mx-=9;
	mx+=n/t-1;
	vector <int> vec;
	while(t>=1)
	{
		ret+=n/t;
		n%=t;
		t/=10LL;
	}
	printf("%d\n",max(ret,mx));
	return 0;
}


Measured memory_bytes: 128
// Algorithm.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <algorithm>

using namespace std;


void Trace(int a[], int b) {
	for (int i = 0; i < b; i++) {
		if (i != 0) cout << ' ' << flush;
		cout << a[i] << flush;
	}
	cout << endl;
}


void Insertation_Sort(int a[], int b) {
	for (int i = 1; i < b; i++) {
		int v, j;
		v = a[i];
		j = i - 1;
		while (j >= 0 && a[j] > v) {
			a[j + 1] = a[j];
			j--;
		}
		a[j + 1] = v;
		Trace(a, b);
	}
}//挿入ソート





int main()
{
	int a[1004] = {};
	int b; cin >> b;
	for (int i = 0; i < b; i++)cin >> a[i];



	int count = 0;
	bool flag = true;
	int c;
	while (flag) {
		flag = false;
		for (int i = b - 1; i > 0; i--) {
			if (a[i] < a[i - 1]) {
				c = a[i];
				a[i] = a[i - 1];
				a[i - 1] = c;
				flag = true;
				count++;
			}
		}
	}
	Trace(a, b);
	cout << count << endl;
}

/* 
bubbleSort(A, N) // N 個の要素を含む 0-オリジンの配列 A
2   flag = 1 // 逆の隣接要素が存在する
3   while flag
4     flag = 0
5     for j が N-1 から 1 まで
6       if A[j] < A[j-1]
7         A[j] と A[j-1] を交換
8         flag = 1
*/


Measured memory_bytes: 3124
#!/usr/bin/env python3
import sys
import bisect

sys.setrecursionlimit(10 ** 8)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
L = list(map(int, readline().split()))
L.sort()


def solve():
    ans = 0
    for i in range(N):
        b = L[i]
        for j in range(i):
            a = L[j]
            k = bisect.bisect_left(L, a + b, i + 1) - 1
            if k == i:
                continue
            ans += k - i
    return ans


if __name__ == "__main__":
    print(solve())


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

ll n,a,b;
vector<ll> h;

bool ok(ll k){
    ll c = a-b;
    auto hh = h;
    rep(i,n) hh[i] -= k*b;

    ll cnt = 0;
    rep(i,n){
        if(hh[i] < 0) continue;
        ll t = (hh[i]+c-1)/c;
        cnt += t;
    }
    return cnt <= k;
}


int main(){
    cin >> n >> a >> b;
    h.resize(n);
    rep(i,n) cin >> h[i];
    sort(all(h));
    reverse(all(h));

    ll l=0,r=h[0]/b+1;


    while(r-l>1){
        ll mid = (l+r)/2;

        if(ok(mid)) r = mid;
        else l = mid;
    }
    cout << r << endl;
}

Measured memory_bytes: 1792
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18+20;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	string str;
	cin >> str;
	cout << str.substr(0,4) << " " << str.substr(4,8) << endl;
	//for(int i=0;i<12;++i){cout << str[i];if( i==3)cout << " ";}cout << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n); for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b); 
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e10+10;

/*----------------------------------------------*/

signed main(){
  int n;
  cin>>n;
  vi a(n);
  rep(i,n) cin>>a[i];
  bool flag=true;
  int ans=0;
  while(flag){
    flag=false;
    for(int j=n-1;j>0;j--){
      if(a[j-1]>a[j]){
        int v=a[j-1];
        a[j-1]=a[j];
        a[j]=v;
        flag=1;ans++;
      }
    }
  }
  rep(i,n-1)cout<<a[i]<<" ";
  cout<<a[n-1]<<endl;
  cout<<ans<<endl;

  return 0;
}


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

// @@ !! LIM()

int main(/* int argc, char *argv[] */) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N, K; cin >> N >> K;
  vector<ll> X(N), Y(N);
  for (ll i = 0; i < N; i++) {
    ll x, y; cin >> x >> y;
    X.at(i) = x;
    Y.at(i) = y;
  }
  vector vx(X);
  vector vy(Y);
  sort(vx.begin(), vx.end());
  sort(vy.begin(), vy.end());
  map<ll, ll> mx, my;
  for (ll i = 0; i < N; i++) {
    mx[vx[i]] = i;
    my[vy[i]] = i;
  }
  vector plane(N, vector(N, false));
  vector acc(N+1, vector(N+1, 0LL));
  for (ll i = 0; i < N; i++) {
    ll ix = mx[X[i]];
    ll iy = my[Y[i]];
    plane[ix][iy] = true;
  }
  for (ll x = 0; x < N; x++) {
    for (ll y = 0; y < N; y++) {
      acc[x+1][y+1]
	= acc[x][y+1] + acc[x+1][y] - acc[x][y] + (plane[x][y] ? 1 : 0);
    }
  }
  ll ans = LLONG_MAX;
  for (ll x = 0; x < N; x++) {
    for (ll y = 0; y < N; y++) {
      for (ll xx = 1; xx <= N; xx++) {
	for (ll yy = 1; yy <= N; yy++) {
	  ll z = acc[xx][yy] - acc[x][yy] - acc[xx][y] + acc[x][y];
	  if (z >= K) {
	    ans = min(ans, (vx[xx-1] - vx[x]) * (vy[yy-1] - vy[y]));
	  }
	}
      }
    }
  }
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
int main() {
    int Q; cin >> Q;
    vector<int> A(301);
    while (Q--) {
        int m, x; cin >> m >> x; A[m] = x;
    }
    vector<map<int, Int>> M(301);
    for (int i = 1; i <= 300; i++) {
        auto &m = M[i];
        int t = i;
        for (int j = 2; j <= t; j++) {
            int cnt = 0;
            while (t % j == 0) t /= j, cnt++;
            if (cnt) m[j] = cnt;
        }
    }
    vector<int> P = {2, 3, 5, 7, 11, 13, 17};
    vector<int> X = {8, 5, 3, 2,  2,  2,  2};
    map<int, int> num;
    Int result = 0;
    auto recur = [&](auto& recur, int i) -> void {
        if (i == P.size()) {
            Int ans = 0;
            map<int, Int> m;
            for (int t = 2; t <= 300; t++) {
                bool add = true;
                for (auto &p : M[t]) {
                    if (p.first <= 17 && num[p.first] < p.second) {
                        add = false;
                        break;
                    }
                    if (p.first >= 18) {
                        add = false;
                        m[p.first] += A[t];
                        break;
                    }
                }
                if (add) ans += A[t];
            }
            for (auto &p : m) ans += max(0LL, p.second);
            result = max(ans, result);
        } else {
            for (int k = 0; k <= X[i]; k++) {
                num[P[i]] = k;
                recur(recur, i + 1);
            }
        }
    };
    recur(recur, 0);
    cout << result << '\n';
    return 0;
}


Measured memory_bytes: 3720
<?php
$n = (int)(fgets(STDIN));
$s = (fgets(STDIN));

if($n % 2 === 1) {
    echo "No";
} else {
    $arr = str_split($s, $n / 2);
    if($arr[0] === $arr[1]) {
        echo "Yes";
    } else {
        echo "No";
    }
}


Measured memory_bytes: 4728
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define debug(x) cerr<<#x<<": "<<x<<endl;
#define MOD 1000000007ULL;
#define rep(i,n) for(int i=0;i<n;i++)


int main() {
	ll x;
  	cin>>x;
  	
  
  	cout<<1-x<<endl;
}

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

const int N = 1e5+5;
int best[N], h[N];

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

    int n, m;
    cin>>n>>m;

    for (int i=1; i<=n; i++)    cin>>h[i];

    for (int i=0; i<m; i++) {
        int x, y;
        cin>>x>>y;
        best[x] = max(best[x], h[y]);
        best[y] = max(best[y], h[x]);
    }

    int ans = 0;
    for (int i=1; i<=n; i++)
        if (h[i]>best[i])
            ans ++;
    cout<<ans<<endl;
}


Measured memory_bytes: 4388
#include<iostream>
#include<string>

using namespace std;

int main() {
	string s;

	cin >> s;

	if (s[2] == s[3] && s[4] == s[5]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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; }

const int mod=1e9+7;
const int INF=1001001001;

int main() {
  int K;
  cin>>K;
  cout<<(K/2)*(K-K/2)<<endl;
  return 0;  
}

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

#define DEBUG
#ifdef DEBUG
#define debug_printf printf
#else
#define debug_printf 1 ? 0 : printf
#endif

using namespace std;
typedef long long int ll;
typedef vector<ll> Vl;
typedef vector<Vl> VVl;
typedef vector<int> Vi;
typedef pair<int, int> Pi;

#define BASE  (1000000000 + 7)
#define MAX_N (1000000000)
#define MAX_M (100000)
#define K     (3)

int N, M;
int X[MAX_M + 1];
ll A[K] = {1, 3, 1};
ll P1[K][K] = {
  {2, 1, 0},
  {3, 1, 2},
  {1, 0, 1}},
P[31][K][K] ,
Q[K][K] = {{1, 1, 0},
  {0, 1, 2},
  {0, 0, 1}},
R[K][K];

void mat_print(ll a[K][K]) {
#ifdef DEBUG
  for (int i = 0; i < K; i++) {
    for (int j = 0; j < K; j++) {
      debug_printf("%lld ", a[i][j]);
    }
    debug_printf("\n");
  }
#endif
}

void mat_copy(ll a[K][K], ll b[K][K]) {
  for (int i = 0; i < K; i++)
    for (int j = 0; j < K; j++) a[i][j] = b[i][j];
}

void mat_prod(ll a[K][K], ll b[K][K], ll c[K][K]) {
  for (int i = 0; i < K; i++) {
    for (int j = 0; j < K; j++) {
      a[i][j] = 0;
      for (int k = 0; k < K; k++) a[i][j] = (a[i][j] + b[i][k] * c[k][j]) % BASE;
    }
  }
}

void build_pow_P() {
  for (int i = 0; i < K; i++) {
    for (int j = 0; j < K; j++) {
      P[0][i][j] = (i == j)? 1: 0;
      P[1][i][j] = P1[i][j];
    }
  }

  for (int i = 2; i < 31; i++) mat_prod(P[i], P[i - 1], P[i - 1]);
}

void pow_P(ll a[K][K], ll n) {
  for (int i = 0; i < K; i++)
    for (int j = 0; j < K; j++) a[i][j] = P[0][i][j];

  for (int i = 1; i < 31; i++) {
    if (n == 0) break;
    if ((n & 1) != 0) {
      ll b[K][K];
      mat_prod(b, a, P[i]);
      mat_copy(a, b);
    }
    n >>= 1;
  }
}

void solve() {
  pow_P(R, X[0] - 1);
  for (int i = 1; i <= M; i++) {
    ll s[K][K], t[K][K];
    pow_P(s, X[i] - X[i - 1] - 1);
    mat_prod(t, R, Q);
    mat_prod(R, t, s);
  }

  ll ans = 0;
  for (int i = 0; i < 3; i++) ans = (ans + R[0][i] * A[i]) % BASE;

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

int main() {
  build_pow_P();

  cin >> N >> M;
  for (int i = 0; i < M; i++) cin >> X[i];
  X[M] = N;

  solve();

  return 0;
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    ll ans = 0;
    for(int i = 0; i < n; ++i){
        for(int j = i+1; j < n; ++j){
            ans += a[i] * a[j];
        }
    }
    cout << ans << endl;
	return 0;
}

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

int main() {
    long long N, M;
    cin >> N >> M;
    vector <long long> H(N);
    for (long long i=0; i<N; i++) cin >> H.at(i);
    vector <long long> GOOD(N);
    for (long long i=0; i<N; i++) GOOD.at(i)=1;
    long long A, B;
    for (long long i=0; i<M; i++) {
        cin >> A >> B;
        if (H.at(A-1)>H.at(B-1)) GOOD.at(B-1)=0;
        else if (H.at(A-1)<H.at(B-1)) GOOD.at(A-1)=0;
        else {
           GOOD.at(B-1)=0;
           GOOD.at(A-1)=0; 
        }
    }
    long long ans=0;
    for (long long i=0; i<N; i++) {
        if (GOOD.at(i)==1) ans++;
    }
    cout << ans;
}

Measured memory_bytes: 4844
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include<unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#define lli long long int
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 57;
const int M = 1e6 + 500;
const lli ths = 1LL << 40;

lli dp[N];

void solve()
{
    lli n, k, q;
    cin>>n>>k>>q;
    lli cnt[n + 1];
    memset(cnt, 0, sizeof cnt);
    lli x;
    for(int i = 0; i < q; i ++)
    {
        cin>>x;
        cnt[x] ++;
    }
    lli ans = 0;
    for(int i = 1; i <= n; i++)
    {
        x = q - cnt[i];
        if(k - x > 0)
            cout<<"Yes\n";
        else
            cout<<"No\n";
    }
    return ;
}
/*
7
6 7 4 1 2 11 6
5
1 2 10 4 5
*/

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

    lli t;
    t = 1;
//    cin>>t;
    while(t --)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 1408
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

a = inpl()
a.sort()
if (a[0] != a[1] and a[1] == a[2]) or (a[0] == a[1] and a[1] != a[2]):
    print('Yes')
else:
    print('No')
    


Measured memory_bytes: 65260
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	_ "sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

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

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	N, C := sc.nextInt(), sc.nextInt()
	var D [31][31]int
	for i := 1; i <= C; i++ {
		for j := 1; j <= C; j++ {
			D[i][j] = sc.nextInt()
		}
	}
	var T [3][31]int
	for i := 1; i <= N; i++ {
		for j := 1; j <= N; j++ {
			T[(i+j)%3][sc.nextInt()]++
		}
	}
	ans := INF
	for i := 1; i <= C; i++ {
		for j := 1; j <= C; j++ {
			for k := 1; k <= C; k++ {
				if i == j || i == k || j == k {
					continue
				}
				sum := 0
				for l := 1; l <= C; l++ {
					sum += D[l][i] * T[0][l]
				}
				for l := 1; l <= C; l++ {
					sum += D[l][j] * T[1][l]
				}
				for l := 1; l <= C; l++ {
					sum += D[l][k] * T[2][l]
				}
				if sum < ans {
					ans = sum
				}
			}
		}
	}

	fmt.Fprintln(wtr, ans)
}


Measured memory_bytes: 1152
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define EB emplace_back
#define GREATER(T) T, VT<T> greater<T>
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

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

    const auto ab = string(b, '0' + a);
    const auto ba = string(a, '0' + b);
    cout << (ab < ba ? ab : ba) << endl;
}


Measured memory_bytes: 256
import java.util.*;

class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		long x = (long) Math.sqrt((double)N);
		for(;x > 1;x--){
			if(N % x == 0) break;
		}

		System.out.println(x - 1 + N/x - 1);
	}
}






Measured memory_bytes: 23636
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
    ll l, r, minn=2018;
    cin >> l >> r;
    if ((l-1)/2019 != r/2019)
    {
        cout << 0;
        return 0;
    }
    else
        for (ll i=l; i<r; i++)
            for (ll j=i+1; j<r+1; j++)
                minn = min(minn, (i*j)%2019);
    cout << minn;
    return 0;
}

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

using namespace std;
typedef long long ll;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define endl '\n'
#define MOD 1000000007
#define mm(arr) memset(arr, 0, sizeof(arr))

int s;
const int N = 2e3 + 5;
int dp[N];
int calc(int sum){
    if(sum == s){
        return 1;
    }
    if(dp[sum] != -1){
        return dp[sum];
    }
    int res = 0;
    if(s - sum < 3)return 0;
    for(int i = 3; i <= s - sum; i++){
        res += calc(sum + i);
        res %= MOD;
    }
    return dp[sum] = res%MOD;
}
int main(){
    FAST
    cin >> s;
    memset(dp, -1, sizeof(dp));
    cout << calc(0) << endl;
    return 0;
}


Measured memory_bytes: 3636