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

#define rep(i, s, t) for(int i = (s); i < (t); ++i)
using namespace std;

typedef long long ll;

//slightly modified template from
//https://atcoder.jp/contests/abc157/submissions/10551937
////
const double eps = 1e-12;

struct Point {
	double x;
	double y;
  Point(double x = 0, double y = 0) : x(x), y(y) {};
	double dist(const Point& p) {
		double dx = x - p.x, dy = y - p.y;
		return sqrt(dx * dx + dy * dy);
	}
};

struct Circle {
	Point p;
	double c;
	double r;

  bool contains(const Point &P)
  {
    return p.dist(P) <= r + eps;
  }

	vector<Point> intersections(const Circle& c) {
		vector<Point> pp;
		double dist = p.dist(c.p);
		if (dist <= r + c.r && r <= dist + c.r && r + dist >= c.r) {
			double dx = c.p.x - p.x, dy = c.p.y - p.y;
			double a = (dx * dx + dy * dy + r * r - c.r * c.r) / 2, dd = dx * dx + dy * dy;
			pp.push_back(Point(
				(a * dx + dy * sqrt(dd * r * r - a * a)) / dd + p.x,
				(a * dy - dx * sqrt(dd * r * r - a * a)) / dd + p.y
			));
			pp.push_back(Point(
				(a * dx - dy * sqrt(dd * r * r - a * a)) / dd + p.x,
				(a * dy + dx * sqrt(dd * r * r - a * a)) / dd + p.y
			));
		}
		return pp;
	}
};
////

int n, k;

vector<Circle> cs;
vector<int> c;

bool C(double T)
{
  rep(i, 0, n) cs[i].r = T/double(c[i]); //given c[i]!=0
  //point is intersection of itself
  vector<Point> all_candicates;
  rep(i, 0, n) all_candicates.push_back(cs[i].p);
  rep(i, 0, n)rep(j, i+1, n)
  {
    auto cur = cs[i].intersections(cs[j]);
    if(cur.size() == 0) continue;
    //if(i==j) assert(cur.size());
    all_candicates.insert(all_candicates.end(), cur.begin(), cur.end());
  }
  //rep(i, 0, all_candicates.size()) cout << all_candicates[i].x << " " << all_candicates[i].y << " \n"[i==all_candicates.size()-1];
  for(auto x : all_candicates)
  {
    int cnt = 0;
    rep(i, 0, n) cnt += int(cs[i].contains(x));
    if(cnt >= k) return true;
  }
  return false;
};

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(0);
  cin >> n >> k;
  cs.resize(n);
  c.resize(n);
  rep(i, 0, n) cin >> cs[i].p.x >> cs[i].p.y >> c[i];

  //Circle a(0, 0, 1), b(0, 1 ,1);
  //cout << (a.intersections(b)[0].x) << " " << (a.intersections(b)[0].y);

  /*std::function<bool(double)> C = [](double T)
  {
    rep(i, 0, n) cs[i].r = T/double(c[i]); //given c[i]!=0
    //point is intersection of itself
    vector<Point> all_candicates;
    rep(i, 0, n)rep(j, 0, n)
    {
      auto cur = cs[i].intersections(cs[j]);
      all_candicates.insert(all_candicates.end(), cur.begin(), cur.end());
    }
    for(auto x : all_candicates)
    {
      bool inall = 1;
      rep(i, 0, n) inall &= c[i].includes(x);
      if(inall) return true;
    }
    return false;
  };*/

  double L = 0, R = 1e9; //
  double M;
  //const double ans_eps = 1e-10;
  //while(R-L > ans_eps)
  rep(t, 0, 100)
  {
    M = (L+R)/2.0;
    //cout << "M "<<M<<endl;
    if(C(M)) R = M;
    else L = M;
  }
  cout << fixed << setprecision(20) << L << endl;

  return 0;
}

//need to learn how to set eps and precusion


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(void){
   int N,p[20000] ;
   cin >> N ;
   for(int i=0;i<N;i++){
        cin >> p[i] ;
   }
    
    long int a[20000],b[20000] ;
    for(int i;i<N;i++){
         a[i] = (i+1)*20000 ;
         b[N-i-1] = (i+1)*20000 ; 
    }
    
    for(int i=0;i<N;i++){
         a[p[i]-1] += i ;
    }
    
    for(int i=0;i<N;i++){
         cout << a[i] << ' ' ;
    }
    cout << '\n' ;
    for(int i=0;i<N;i++){
         cout << b[i] << ' ';
    }
}


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

void A()
{
  // 入力
  string S, T;
  cin >> S >> T;
  
  // 先頭からSの長さだけTの部分文字列がSと一致すればOK
  if( S == T.substr(0, (int)S.length()) )
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

int main()
{
  A();
  
  return 0;
}

Measured memory_bytes: 3604
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	const maxWord = (1 << 30)
	buf := []byte{}
	sc.Buffer(buf, maxWord)
	sc.Split(bufio.ScanWords)
}

func input() string {
	sc.Scan()
	return sc.Text()
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func main() {
	n, _ := strconv.Atoi(input())
	p := make([]int, n)
	for i := 0; i < n; i++ {
		p[i], _ = strconv.Atoi(input())
	}

	ans := 0
	minv := p[0]
	for i := 0; i < n; i++ {
		if p[i] <= minv {
			ans++
		}
		minv = min(minv, p[i])
	}
	fmt.Println(ans)
}


Measured memory_bytes: 3584
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>

using namespace std;

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


bool compare_by_b(pair<long, long> a, pair<long, long> b){
    return a.second < b.second;
}


int main(){
    long long n;
    cin >> n;
    vector<pair<long long, long long>> job(n);
    rep(i, n){
        long long a, b;
        cin >> a >> b;
        job[i].first = a;
        job[i].second = b;
    }
    /* 
    if(n == 1){
        if(job[0].first <= job[0].second)cout << "Yes\n";
        else cout << "No\n";
        return 0;
    }*/
    sort(job.begin(), job.end(), compare_by_b);

    long long time = 0;
    rep(i, n){
        time += job[i].first;
        if(time > job[i].second){
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";

}


Measured memory_bytes: 3328
N = int(input())
A = [0] * N
B = list(map(int, input().split()))

A[0] = B[0]
A[N - 1] = B[N - 2]
for i in range(1, N -1):
    A[i] = min(B[i - 1], B[i])
print(sum(A))

Measured memory_bytes: 38384
s = input()
use = set()
for i in range(4):
    use.add(s[i])
if len(use) != 2:
    print("No")
    exit()
if (s[0] == s[1] and s[1]==s[2]) or (s[0] == s[1] and s[1] == s[3]) or (s[0] == s[2] and s[2] == s[3]) or (s[1]== s[2] and s[2]== s[3]):
    print("No")
    exit()

print("Yes")

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<cmath>
using sll = signed long long;

int main() {
	size_t N{ 0 };
	std::cin >> N;
	
	std::vector<sll> vcs;
	vcs.resize(N);

	for (auto& v : vcs) {
		std::cin >> v;
	}
	
	auto mmit = std::minmax_element(std::begin(vcs), std::end(vcs));

//	size_t i_{ 0 };
	sll sum{ 0 }, before{100*100*100};
	for (sll i{ *mmit.first }; i <= *mmit.second; i++) {

		//std::cout <<"i, sum, bef : "<<i<<","<< sum <<", "<< before << "\n";
		sum = 0;
		for (size_t k{ 0 }; k < vcs.size(); k++) {
			auto dis = vcs[k] - i;
			sum += dis*dis;
			//std::cout <<"sum : "<< sum << "\n";
		}
		if (before > sum) { before = sum; }// i_ = i; }
		
	}
	std::cout << before << "\n";
	return 0;
}


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

#define x first
#define y second
#define pb push_back
#define mp make_pair

typedef long long LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

const int INF = 1000000009;

int main(){
    int n;
    scanf("%d", &n);
    printf("%d\n", (n/500)*1000 + ((n - (n/500)*500)/5)*5);
return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
li = [0]*(K+1)

out = 0
mod = 10**9+7

for i in range(K, 0, -1):
  li[i] = pow(K//i, N, mod) 
  for j in range(i*2, K+1, i):
    li[i] -= li[j]
  out += li[i] * i
print(out%mod)

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

#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define rep(i, x, y) for(decltype(y) i = (x) - ((x) > (y)); i != (y) - ((x) > (y)); i += 1 - 2 * ((x) > (y)))
#define trav(i,a) for(auto& (i) : (a))
#define all(a) (a).begin(),(a).end()
#define sz(a) int((a).size())
#define clr(a,x) memset((a),(x),sizeof(a)) // array (0,-1)
#define dbg(x) cerr << "STDERR => " << __LINE__ << ": " << #x << " = " << (x) << "  :(\n";
#define pb push_back
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline void cpuTime() { cerr << "cpu time : " << double(clock())/CLOCKS_PER_SEC << "\n"; return; }
using ll = long long;
using ull = unsigned long long;
using F = float;
using D = double;
using vi = vector<int>;
using pii = pair<int,int>;
#define MOD 1000000007


void solve(){

    int n, k;
    cin >> n >> k;

    vi a(n+1, 0);
    iota(all(a), 0);

    ull min = 0, max = 0;
    ull ans = 0;
    rep(i,1,n+2){
        min += a[i-1];
        max += a[n+1-i];

        if(i >= k){
            ans += max-min+1;
            ans %= MOD;
        }
    }

    cout << ans << "\n";
    return;
}

/*
 read the question carefully ( what're the exact constraints? )
 look out for SPECIAL CASES (n=1?) and OVERFLOW (ll vs int?) ARRAY OUT OF BOUNDS
 Check datatypes
*/
int main(){

    fast_io;
    int t=1;
    // cin >> t;

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

    cpuTime();
return 0;
}


Measured memory_bytes: 3980
#include<bits/stdc++.h>
using namespace std;
int main(){
  
    long int n,i;
    cin>>n;
    vector<long int>monsters(n+1),heros(n);
    
    long int res=0;
    
    for(i=0;i<=n;i++) cin>>monsters[i];
    for(i=0;i<n;i++) cin>>heros[i];
    
    for(i=0;i<n;i++){
     
        if(monsters[i]>=heros[i])
            res = res+heros[i];
        else{
           res = res+monsters[i];
            if((heros[i]-monsters[i])>monsters[i+1]){
               res = res+monsters[i+1];
               monsters[i+1]=0;
            }
            else{
               res = res+heros[i]-monsters[i];
               monsters[i+1]=monsters[i+1] - heros[i]+monsters[i];
            }
           
        }
        
    }
    
    cout<<res;
    
    return 0;
}

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

int main() {
  int N,X,Y;
  cin >> N;
  vector<int> V(N);
  vector<int> C(N);
  for (int i = 0; i<N; i++){
    cin >> V.at(i);
  }  
   for (int i = 0; i<N ; i++){
    cin >> C.at(i);
  } 
  for (int i = 0; i < N; i++){
    if(V.at(i) > C.at(i)){
      X += V.at(i);
      Y += C.at(i);
    }
  }
  cout << X - Y << endl;
}

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

using namespace std;

int main()
{
	int H, W;
	cin >> H >> W;
	vector<vector<int>> a(H, vector<int>(W));
	for (auto &v : a) {
		for (auto &x : v) {
			cin >> x;
		}
	}
	vector<tuple<int, int, int, int>> ans;
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			if (a[i][j] % 2 != 0) {
				--a[i][j];
				if (j + 1 < W) {
					++a[i][j + 1];
					ans.emplace_back(i + 1, j + 1, i + 1, j + 2);
				}
				else if (i + 1 < H) {
					++a[i + 1][j];
					ans.emplace_back(i + 1, j + 1, i + 2, j + 1);
				}
			}
		}	
	}

	cout << ans.size() << endl;
	for (auto &t : ans) {
		int y1, x1, y2, x2;
		tie(y1, x1, y2, x2) = t;
		cout << y1 << " " << x1 << " " << y2 << " " << x2 << endl;
	}
}


Measured memory_bytes: 5232
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
fn main() {
    let s:String= read::<String>();

    let ans = match &*s {
        "SUN" => 7,
        "MON" => 6,
        "TUE" => 5,
        "WED" => 4,
        "THU" => 3,
        "FRI" => 2,
        "SAT" => 1,
        _ => 10,
    };
    println!("{:?}",ans);


}


Measured memory_bytes: 4352
# -*- coding: utf-8 -*-
a = int(input())  # 500yen
b = int(input())  # 100yen
c = int(input())  # 50yen
x = int(input())
pattern = 0

for i in range(a + 1):
  for j in range(b + 1):
    for k in range(c + 1):
      if ((500 * i) + (100 * j) + (50 * k)) == x:
        pattern += 1

print(pattern)


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

ans = 0
j = 1
k = 0
sum_plus = A[0]
sum_xor = A[0]
while j <= N and k < j:
    if sum_plus == sum_xor:
        ans += j-k
        if j < N:
            sum_plus += A[j]
            sum_xor ^= A[j]
        j += 1
    else:
        sum_plus -= A[k]
        sum_xor ^= A[k]
        k += 1
    
print(ans)

Measured memory_bytes: 24584
#include <iostream>

using namespace std;

const int N = 20000;
int T, d[N], t, m, n;

main(){
  for(int i=0;i<143;i++){
    for(int j=0;j<143;j++){
      t = i * i + j * j;
      if(1 < t && t < N) d[t] = true;
    }
  }
  for(int i=0;i<N;i++){
    if(!d[i]) continue;
    for(int j=i;j<N;j++){
      if(i * j >= N) break;
      d[i*j] = false;
    }
  }
  cin >> T;
  for(int i=0;i<T;i++){
    cin >> m >> n;
    cout << (d[m*m+n*n] ? "P" : "C") << endl;
  }
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n,m;
    scanf("%d%d", &n, &m);
    bool f=false;
    char gn[n][n];
    char gm[m][m];
    for (int i=0; i<n; i++) {
        scanf("%s", &gn[i]);
    }
    for (int i=0; i<m; i++) {
        scanf("%s", &gm[i]);
    }
    for (int i=0; i<=n-m; i++) {
        for (int j=0; j<=n-m; j++) {
            bool mt=true;
            for (int k=0; k<m; k++) {
                for (int l=0; l<m; l++) {
                    if (gn[i+k][j+l]!=gm[k][l]) {
                        mt=false;
                        break;
                    }
                }
                if (!mt) break;
            }
            f |= mt;
        }
    }
    printf("%s\n", f ? "Yes":"No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int,int> pii;
typedef long long ll;
const long long MOD=1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define pb push_back





int main(){

    string s;
    cin>>s;
    cout<<s.at(0)<<s.at(1)<<s.at(2)<<endl;
    






}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>

template<typename W, typename V>
struct dijkstra_result {
	std::vector<W> distance; // 距離
	std::vector<V> prev; // 「前」の頂点
};

/**
 * ダイクストラ法で、ある頂点から到達可能な頂点までの距離と最短経路を求める
 * 
 * @tparam G グラフを表す型。
 *           グラフ g で頂点 u から v への重み w の辺があることを g[u][v] = w で表す。無向グラフなら g[u][v] = g[v][u] にしておく
 *           G は map<V, map<V, W>> や vector<vector<pair<V, W>>> などが可能
 * @tparam V 頂点番号の型。普通は int にすると思う
 * @tparam W 重みの型。 G から求まるので指定しなくてよい
 */
template<typename G, typename V, typename W = typename std::remove_reference<decltype(std::declval<G>()[0][0])>::type>
dijkstra_result<W, V> dijkstra(/*const*/ G& graph, V start, V num)
{
	using PQT = std::pair<W, V>;

	std::vector<W> distance;
	std::vector<V> prev;
	std::deque<bool> done; // 既に確定している頂点かどうか（覚えておかなくても計算できるが無駄がある）
	std::priority_queue<PQT, std::vector<PQT>, std::greater<PQT>> q;

	distance.resize(num);
	prev.resize(num);
	done.resize(num);

	for (V i = 0; i < num; ++i) {
		distance[i] = std::numeric_limits<W>::max();
	}
	distance[start] = 0;
	q.push({0, start});

	while (!q.empty()) {
		const auto& du = q.top();
		const auto dist = du.first;
		const auto u = du.second;
		q.pop();
		if (done[u])
			continue;
		done[u] = true;
		const auto& edges = graph[u];
		for (const auto& vw : edges) {
			const auto v = vw.first;
			const auto w = vw.second;
			if (!done[v]) {
				long updated = dist + w;
				if (distance[v] > updated) {
					distance[v] = updated;
					prev[v] = u;
					q.push({updated, v});
				}
			}
		}
	}

	return {distance, prev};
}

int main()
{
	// ABC126D

	long N;
	std::unordered_map<long, std::unordered_map<long, long> > E; // src -> {dst -> weight}

	std::cin >> N;
	for (int i = 0; i < N-1; ++i) {
		long u, v;
		long w;
		std::cin >> u >> v >> w;
		--u;
		--v;
		E[u][v] = w;
		E[v][u] = w;
	}

	auto dij_res = dijkstra(E, 0L, N);
	auto& D = dij_res.distance;

	for (long i = 0; i < N; ++i) {
		std::cout << (D[i] % 2) << "\n";
	}
}


Measured memory_bytes: 22820
#include <iostream>

using namespace std;

bool is_prime(int n) {
    for(int i=2; i*i<=n; i++) if(n % i == 0) return false;
    return n != 1;
}

void solve(int n) {
    int ans = 0;
    for(int i=n+1; i<=2*n; i++) ans += is_prime(i);
    cout << ans << "\n";
}

int main() {
    int n;
    while(cin>>n && n) solve(n);
    return 0;
}

Measured memory_bytes: 3088
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <array>
#include <random>
#include <complex>
#include <regex>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define fcout cout << fixed << setprecision(10)
#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define mp(a,b) make_pair(a,b)
#define pb push_back
const ll inf = 1e18;
const ll mod = 1e9 + 7;

ll pow (ll x, ll n){
    ll ans = 1;
    while(n>0){
        if(n & 1 == 1){
            ans *= x;
        }
        x = x * x;
        n >>= 1;
    }
    return ans;
}

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

    // y = 10000*a + 5000*b + 1000*c
    // n = a + b + c

    for(a=0; a<=n; a++){
        for(b=0; b<=n-a; b++){
            c = n-a-b;
            int m = 10000*a + 5000*b + 1000*c;
            if(m==y){
                cout << a << " " << b << " " << c << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;

}


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

class unionFindTree{
public:
  int parent;
  int rank;
  int num;

  //コンストラクタ parent=ノード番号・rank=0に初期化
  unionFindTree(){
    rank = 0;
    parent=n;
    num=n;
    n++;
    v.push_back(this);
  }

  //木の根を求める
  static int find(int x){
    if(v[x]->parent==x) return x;
    else return v[x]->parent = find(v[v[x]->parent]->num);
  }

  //集合を併合
  static void unite(int x, int y){
    x = find(x), y = find(y);

    //もし2つのノードの親が同じならば併合する必要がない
    if(x==y) return;

    if(v[x]->rank < v[y]->rank){
      v[x]->parent = y;
    }else{
      v[y]->parent = x;
      if(v[x]->rank == v[y]->rank) v[x]->rank++;
    }

  }

  //xとyが同じ集合に属するか否か
  static bool same(int x, int y){
    return find(x)==find(y);
  }

private:
  static int n;
  static vector<unionFindTree*> v;
};

int unionFindTree::n=0;
vector<unionFindTree*> unionFindTree::v;

int main(){
  int n, q; cin >> n >> q;
  unionFindTree node[n];

  int operate, x, y;
  int ans[q]; int j=0;
  for(int i=0; i<q; i++){
    cin >> operate >> x >> y;
    if(operate==0) unionFindTree::unite(x, y);
    else if(operate==1) {
      if(unionFindTree::same(x, y)) ans[j++]=1;
      else ans[j++]=0;
    }
  }
  for(int i=0; i<j; i++) cout << ans[i] << endl;

  return 0;
}



Measured memory_bytes: 3580
#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;

const int N = 1e5 + 5;
using lint = long long;
lint a[N];

int main(){
    int n;
    lint l;
    scanf("%d%lld",&n,&l);
    for(int i=1;i<=n;i++){
        scanf("%lld\n",a+i);
    }
    
    lint t = 0;
    int idx = 0;
    for(int i=1;i<n;i++){
        lint k = a[i]+a[i+1];
        if(t <= k){
            t = k;
            idx = i;
        }
    }
    if(t>=l){
        puts("Possible");
        for(int i=n-1;i>=idx+1;i--){
            printf("%d\n",i);
        }
        for(int i=1;i<=idx;i++){
            printf("%d\n",i);
        }
    }
    else{
        puts("Impossible");
    }
    return 0;   
}

Measured memory_bytes: 1536
N,D = map(int,input().split())

from math import sqrt
b = []
for i in range(0,N):
  b.append([int(x) for x in input().split()])
#print(b)

def distance(p,q,n):
  d = 0
  for i in range(0,n):
    d += (p[i]-q[i])**2
  return sqrt(d)

cnt = 0
for l in range(0,N-1):
  for k in range(l+1,N):
    if distance(b[l],b[k],D)-int(distance(b[l],b[k],D))==0:
      cnt += 1
print(cnt)


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

int ck(int v1[], int v2[], int n){
    int a=1;;
    for (int i=0; i<n; i++){
        if (v1[i]!=v2[i]){
            a=0;
            break;
        }
    }
    return a;
}
long long a=1,b=1,n,c,d;
string ss,s1,s2;
int main(){
    cin>>a>>n>>ss;
    ss[n-1]=tolower(ss[n-1]);
    cout<<ss<<endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
int main(void){
	char s[10001];
	int l,j,o;
	while(scanf("%s",s)!=EOF){
		l=strlen(s)-2;
		j=o=0;
		for(int i=0;i<l;i++){
			if(s[i+1]=='O' && s[i+2]=='I'){
				if(s[i]=='J')j++;
				if(s[i]=='I')o++;
			}
		}
		printf("%d\n%d\n",j,o);
	}
}

Measured memory_bytes: 980
import java.util.*;

public class Main {

    public static void main(String[] args) {
	    // write your code here
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Integer[] list = new Integer[n];

        for(int i = 0; i < n; i++) {
            list[i] = sc.nextInt();
        }
        Arrays.sort(list, Comparator.reverseOrder());

        int ans = 0;
        for(int i = 0; i < n - 2; i++) {
            int a = list[i];
            for (int i1 = i + 1; i1 < n - 1; i1++) {
                int b = list[i1];
                if (2 * b < a) {
                    break;
                }
                for(int i2 = i1 + 1; i2 < n; i2++) {
                    int c = list[i2];
                    if (a < b + c && b < c + a && c < a + b) {
                        ans++;
                    }
                }
            }
        }

        // 出力
        System.out.println(ans);
    }
}


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

int main(){
	string s;cin>>s;int count=0,count2=0;
	if(s[0]==65&&s[s.size()-1]>=97&&s[1]>=97){
    	for(int i=2;i<s.size()-1;++i){
        	if(s[i]==67)++count;
          	if(s[i]>=65&&s[i]<=90)++count2;
        }if(count==1&&count2==1){cout<<"AC"<<endl;return 0;}
      	else {cout<<"WA"<<endl;return 0;}
    }else cout<<"WA"<<endl;return 0;
}


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

template<typename ty,typename ty2>
struct my_hash_map{
	#define hash_map_MX ((1<<20)-1)
	int head[hash_map_MX+2];
	int nex[hash_map_MX+2];
	ty key[hash_map_MX+2];
	ty2 assoc_val[hash_map_MX+2];
	int tot;
	my_hash_map(){
		tot=0;
		memset(head,-1,sizeof(head));
		memset(nex,-1,sizeof(nex));
	}
	inline ty2* find(ty val){
		int km=(val&hash_map_MX);
		if(head[km]==-1){
			head[km]=tot++;
			key[head[km]]=val;
			return &assoc_val[tot-1];
		}
		for(int i=head[km];;i=nex[i]){
			if(key[i]==val)return &assoc_val[i];
			if(nex[i]==-1){
				nex[i]=tot++;
				key[nex[i]]=val;
				return &assoc_val[tot-1];
			}
		}
		return NULL;
	}
};

my_hash_map<__int128,int> mp;

int n;
 
char buf[MAX];
 
__int128 mod1=1007ll;
__int128 mod2=1000000000000000031LL;
 
inline __int128 mul(__int128 a,__int128 b){
	return (a*b)%mod2;
}
inline __int128 add(__int128 a,__int128 b){
	auto f=a+b;
	if(f>=mod2)f%=mod2;
	return f;
}
inline __int128 sub(__int128 a,__int128 b){
	auto f=a-b;
	if(f<0)f+=mod2;
	f%=mod2;
	return f;
}
__int128 ppow(__int128 a,__int128 b){
	__int128 res=1;
	while(b){
		if(b&1LL)res*=a;
		if(res>=mod2)res%=mod2;
		a*=a;
		a%=mod2;
		b>>=1LL;
	}
	return res;
}
vector<pair<__int128,__int128> > v;
int main() {
	cin>>n;
	scanf("%s",buf);
	auto inv = ppow(mod1,mod2-2);
	__int128 cur=1;
	__int128 hs=0;
	int sz=strlen(buf);
	v.push_back(make_pair(0,1));
	for(int i=0;i<sz;i++){
		if(buf[i]=='<'){
			cur=mul(cur,inv);
		}
		if(buf[i]=='>'){
			cur=mul(cur,mod1);
		}
		if(buf[i]=='+'){
			hs=add(hs,cur);
		}
		if(buf[i]=='-'){
			hs=sub(hs,cur);
		}
		v.push_back(make_pair(hs,cur));
	}
	__int128 acieve=v.back().first;
	//(x-c)/second=acieve
	//x-c=acieve/second
	//x = c+ acieve/second
	long long int way=0;
	for(int i=v.size()-1;i>=0;i--){
		__int128 want=add(v[i].first,mul(acieve,v[i].second));
		way+=(*mp.find(want));
		(*mp.find(v[i].first))++;
		//cerr<<i<<" "<<way<<endl;
	}
	printf("%lld\n",way);
	return 0;
}


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

# define N (int)(2*1e5)

using namespace std;

typedef long long int Int;

class Union_Find
{
    private:
	vector<int> par,rank;

    public:
	Union_Find(int n)
	{
	    for(int i = 0;i <= n;i++)
	    {
		par.push_back(i);
		rank.push_back(0);
	    }
	}

	int find(int x)
	{
	    return par[x] == x ? x : par[x] = find(par[x]);
	}

	bool same(int x,int y)
	{
	    return find(x) == find(y);
	}

	void merge(int x,int y)
	{
	    x = find(x);
	    y = find(y);
	    if(x == y)
		return;

	    if(rank[x] < rank[y])
	    {
		par[x] = y;
	    } else {
		par[y] = x;
		if(rank[x] == rank[y])
		    rank[x]++;
	    }
	}
};

map<pair<int,int>,int> m;

int main(void)
{
    int n,k,l;
    cin>>n>>k>>l;

    Union_Find u_road(n);
    Union_Find u_rail(n);

    for(int i = 0;i < k;i++)
    {
	int p,q;
	cin>>p>>q;
	p--;
	q--;
	u_road.merge(p,q);
    }
    for(int i = 0;i < l;i++)
    {
	int r,s;
	cin>>r>>s;
	r--;
	s--;
	u_rail.merge(r,s);
    }

    for(int i = 0;i < n;i++)
    {
	pair<int,int> temp;
	temp.first = u_road.find(i);
	temp.second = u_rail.find(i);
	
	m[temp]++;
    }

    for(int i = 0;i < n;i++)
    {
	pair<int,int> temp;
	temp.first = u_road.find(i);
	temp.second = u_rail.find(i);

	cout<<m[temp]<<" ";
    }

    return 0;
}


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

typedef long long llong;


llong sum[10000005];

int main()
{
    llong n;
    llong pnt = 0;
    llong maxv;

    cin >> n;

    for (llong i = 1; i <= n; i++) {
        sum[i] = sum[i - 1] + i;
    }


    while (n) {
        maxv = lower_bound(sum, sum + n, n) - sum;
        cout << maxv << endl;

        n = n - maxv;
    }

    return 0;
}


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

int main() {
    string S, T, U;
    cin >> S >> T;
    int A, B;
    cin >> A >> B;
    cin >> U;

    if (S == U) cout << A-1 << " " << B << endl;
    else cout << A << " " << B-1 << endl;
    return 0;
}

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

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  for (int i = 0; i < H; i++)
    cin >> S[i];
  vector<vector<int>> L(H, vector<int>(W, 0)), R(H, vector<int>(W, 0)), U(H, vector<int>(W, 0)), D(H, vector<int>(W, 0));
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      if (S[i][j] == '#')
        L[i][j] = 0;
      else
      {
        if (j == 0)
          L[i][j] = 1;
        else
          L[i][j] = L[i][j - 1] + 1;
      }
    }
  }
  for (int i = 0; i < H; i++)
  {
    for (int j = W - 1; j >= 0; j--)
    {
      if (S[i][j] == '#')
        R[i][j] = 0;
      else
      {
        if (j == W - 1)
          R[i][j] = 1;
        else
          R[i][j] = R[i][j + 1] + 1;
      }
    }
  }
  for (int j = 0; j < W; j++)
  {
    for (int i = 0; i < H; i++)
    {
      if (S[i][j] == '#')
        U[i][j] = 0;
      else
      {
        if (i == 0)
          U[i][j] = 1;
        else
          U[i][j] = U[i - 1][j] + 1;
      }
    }
  }
  for (int j = 0; j < W; j++)
  {
    for (int i = H - 1; i >= 0; i--)
    {
      if (S[i][j] == '#')
        D[i][j] = 0;
      else
      {
        if (i == H - 1)
          D[i][j] = 1;
        else
          D[i][j] = D[i + 1][j] + 1;
      }
    }
  }
  int ans = 0;
  int idxi = -1, idxj = -1;
  for (int i = 0; i < H; i++)
  {
    for (int j = 0; j < W; j++)
    {
      int tmp = L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3;
      if (ans < tmp)
      {
        ans = max(ans, tmp);
        idxi = i, idxj = j;
      }
    }
  }
  cout << ans << endl;
  cerr << idxi << " " << idxj << endl;
  return 0;
}

// 直接求めるのではなくいくつかの補助的な前計算をしておく　前計算として必要なものはL[i][j]: (i, j)に明かりをおいたとき，そこから左方向に照らされるマスの個数 R[i][j], U[i][j], D[i][j]も同様
// i行目j列目に障害物があるときはL[i][j] = 0, そうでないとき，j = 1ならL[i][j] = 1, j > 1ならば，L[i][j] = L[i][j - 1] + 1
// これらを全て計算した後，L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3で求められる．（-3は重複分）


Measured memory_bytes: 67328
n,k = map(int,input().split())
P = list(map(int,input().split()))
sum_a = 0
index = 0

for i in range(k):
    sum_a += P[i]
num = sum_a
for j in range(1,n-k+1):
    num += P[j+k-1]
    #print(num)
    num -= P[j-1]
    #print(num)
    if(sum_a<num):
        index = j
        sum_a = num

total = 0.0
for m in range(index,index+k):
    total += sum(list(range(P[m]+1)))/P[m]
print(total)

Measured memory_bytes: 71792
#include <bits/stdc++.h>
#define LL long long
using namespace std;

int main()
{
   int n;
   while(scanf("%d",&n)!=EOF)
   {
       if(n%2==0)
        cout<<"0.5000000000"<<endl;
       else
       {
           double ans=(double)(n+1)/2/n;
           cout<<ans<<endl;
       }
   }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>

bool is_753(const char* buf)
{
  bool contains3 = false;
  bool contains5 = false;
  bool contains7 = false;
  for (int i = 0; i < (int)strlen(buf); i++) {
    switch (buf[i]) {
      case '7':
        contains7 = true;
        break;
      case '5':
        contains5 = true;
        break;
      case '3':
        contains3 = true;
        break;
      default:
        return false;
    }
  }
  return contains7 && contains5 && contains3;
}

bool next_candidate(char* buf)
{
  for (int i = 0; i < (int)strlen(buf); i++) {
    switch (buf[i]) {
      case '3':
        buf[i] = '5';
        return true;
      case '5':
        buf[i] = '7';
        return true;
      case '7':
        buf[i] = '3';
        continue;
      default:
        std::cerr << "Invalid candidate found" << std::endl;
        exit(1);
    }
  }
  return false;
}

int check_all_candidates(int limit)
{
  char buf[16];
  memset(buf, 0, sizeof(buf));
  int cnt = 0;
  for (int i = 1; i < 10; i++) {
    memset(buf, '3', i);
    do {
      if (is_753(buf) && atoi(buf) <= limit) {
        cnt++;
      }
    } while (next_candidate(buf));
  }
  return cnt;
}

int main()
{
  int n;
  std::cin >> n;
  std::cout << check_all_candidates(n) << std::endl;
  return 0;
}


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

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

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int dif = Math.abs(a - b);
            if (dif % 2 == 1)
                out.println("IMPOSSIBLE");
            else
                out.println(Math.min(a, b) + dif / 2);
        }

    }

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

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

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

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

    }
}

Measured memory_bytes: 21460
// luogu-judger-enable-o2
#include <iostream>
#include <string>
using namespace std;
int main(){
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    string s;
    cin>>s;
    int l=s.length();
    if(s[0]==s[l-1])
        if(l%2==0) cout<<"First"<<endl;
        else cout<<"Second"<<endl;
    else
        if(l%2==0) cout<<"Second"<<endl;
        else cout<<"First"<<endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <set>
#include <map>

using namespace std;

typedef long long ll;

int q;

multiset<ll> a;
ll b;

int main()
{
    cin >> q;

    bool even = false;

    int num;
    ll tmp;
    cin >> num >> tmp >> b;

    a.insert(tmp);

    auto itr = a.begin();

    tmp = 0;

    for (int i = 0; i < q - 1; i++)
    {
        cin >> num;

        if (num == 1)
        {
            ll aa, bb;
            cin >> aa >> bb;
            b += bb;

            if (even)
            {
                if (aa < *itr)
                {
                    a.insert(aa);
                    tmp += abs(aa - *itr);
                }
                else
                {
                    ll tt = *itr;
                    a.insert(aa);
                    ++itr;
                    tmp += abs(aa - tt) - (*itr - tt);
                }
                even = false;
            }
            else
            {
                if (aa < *itr)
                {

                    tmp += abs(*itr - aa);
                    a.insert(aa);
                    --itr;
                }
                else
                {
                    a.insert(aa);
                    tmp += abs(aa - *itr);
                }
                even = true;
            }
        }
        else
        {
            cout << *itr << ' ' << tmp + b << endl;
        }
    }
}


Measured memory_bytes: 9600
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include<cstdio>
#include<bits/stdc++.h>
using namespace std;
using ll =long long;

int main (void) {
  int A,B;
  char s;
  cin>> A>> B;
  for (int i=0;i<A+B+1;i++){
    cin >> s;
    if (i==A){
      if(s=='-'){
        continue;
      }
      else {
        cout << "No";
        return 0;
      }
    }
    if (s=='-'){
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{

  int n;
  int l[105];
  int box = 0;
  int box1 = 0;
  int ans = 0;
  cin >> n;
  
  for( int i=0;i<n;i++ ){
    cin >> l[i];
    if( box < l[i] ){
      box = l[i];
    }
    box1+=l[i];
  }
  
  
  ans = box1-box;

  if( box < ans ){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
  
  return(0);
  
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<map>
#include<set>
#include<queue>
#include<cmath>

using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(a) (a).begin(),(a).end()
#define PI 3.14159265358979323846264338327950L
#define INF 1050000000
#define INFL (long long)(4e18)

using vi = vector<int>;

template<class T>
struct Edge {
	int to;
	T cost;
	Edge() {};
	Edge(int to, T cost) : to(to), cost(cost) {};
};

template<class T>
class Graph {
	int n;
	bool directed;
	vector<vector<Edge<T>>> edges;
public:

	Graph(int n, bool directed) :n(n), directed(directed), edges(vector<vector<Edge<T>>>(n)) {};
	Graph() {};

	void add(int to, T cost) {
		emplace_back(to, cost);
	}

	int size() {
		return n;
	}
};


int main() {

	long double A,B,H, M;

	cin >> A >> B >> H >> M;

	long double argL = (H * 60 + M) * 0.5;
	long double argS = M * 6.0;

	long double theta;

	if (abs(argL - argS) <= 180) {
		theta = abs(argL - argS);
	}
	else {
		theta = (360 - max(argS, argL)) + min(argS, argL);
	}

	long double ans = sqrt(A * A + B * B - 2*A * B * cos(theta*PI/180.0));

	cout << fixed << setprecision(15) << ans << endl;

	return 0;
}

Measured memory_bytes: 4136
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long
#define float long double
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define endl '\n'
#define pii pair<int, int>
#define min3(a,b,c) min(a, min(b, c))
#define max3(a,b,c) max(a, max(b, c))
#define all(x) x.begin(), x.end()
#define fill(a,b) memset(a, b, sizeof(a))
#define sz(x) (int)x.size()
#define sp(x) setprecision(x)
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define bs binary_search

signed main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

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

    int n; cin>>n;
    int arr[n],aux[n];
    for(int i=0;i<n;i++) cin>>arr[i];
    aux[n-1]=arr[n-1];
    for(int i=n-2;i>=0;i--) aux[i]=(arr[i]+aux[i+1])%mod;
    int ans=0;
    for(int i=0;i<n-1;i++) ans=(ans+arr[i]*aux[i+1])%mod;
    cout<<ans<<endl;

}

Measured memory_bytes: 6744
# -*- coding: utf-8 -*-

n = int(input())

b = [int(i) for i in input().split()]
# print(b)
a = []
for i in range(n):
    if i >= 1 and i < len(b) :
        a.append(min(b[i],b[i-1]))
    elif i >= len(b) :
        a.append(b[i-1])
    else :
        a.append(b[i])
    
# print(a)
print(sum(a))

Measured memory_bytes: 3064
import sys
read = sys.stdin.read

N, *A = map(int, read().split())

answer = 0
for i in range(N - 1):
    if A[i] % 2 == 1:
        if A[i + 1] != 0:
            A[i + 1] += 1

answer = sum([i // 2 for i in A])
print(answer)

Measured memory_bytes: 14092
#include <iostream>

using namespace std;

const int N = 100010;
int n, q;
int a[N];

int main()
{
	scanf("%d", &n);

	for (int i = 0; i < n; i++) scanf("%d", &a[i]);
	scanf("%d", &q);
	int k, cnt = 0;
	while (q--)
	{
		scanf("%d", &k);
		int l = 0, r = n - 1;
		while (l < r)
		{
			int mid = l + r >> 1;
			if (a[mid] >= k) r = mid;
			else l = mid + 1;
		}
		if (a[l] == k) cnt++;
		
	}
	printf("%d\n", cnt);
    return 0;
}


Measured memory_bytes: 3560
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
const int N = 100100;
ll q[N],f[N],tag[N],x;
int n,Q,tail;
void solve(ll d,ll v) {
    if(d==0) return ;
    int j=upper_bound(q+1,q+tail+1,d)-q-1;
    if(j==0) tag[1]+=v,tag[d+1ll]-=v;
    else f[j]+=d/q[j]*v,solve(d%q[j],v);
}
int main() {
    scanf("%d%d",&n,&Q);
    q[++tail]=(ll)n;
    for(int i=1;i<=Q;i++) {
        scanf("%lld",&x);
        while(tail&&q[tail]>=x) tail--;
        q[++tail]=x;
    }
    f[tail]=1;
    for(int i=tail;i>1;i--) {
        f[i-1]+=q[i]/q[i-1]*f[i];
        solve(q[i]%q[i-1],f[i]);
    }
    tag[1]+=f[1],tag[q[1]+1ll]-=f[1];
    for(int i=1;i<=n;i++) tag[i]+=tag[i-1],printf("%lld\n",tag[i]);
}

Measured memory_bytes: 4144
#include <bits/stdc++.h>
#define fore(x,a,b) for(int x=a, qwerty=b; x<qwerty; x++)
#define ALL(a) (a).begin(),(a).end()
#define SZ(a) ((int)(a).size())
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define fst first
#define snd second
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;


int main(){	FIN;
	int n;
	cin>>n;
	if(n<=999)cout<<"ABC\n";
	else cout<<"ABD\n";
}

Measured memory_bytes: 256
// --------------
// Tejas Pandey  |
// 25 - 07 - 20  |
// ABC M-Solution|
// --------------

#include <bits/stdc++.h>
using namespace std;
     
#define mod 1000000007
#define vi vector<int>
typedef long long int ll;
     
int main (void){
  //freopen("in.txt","r",stdin);
  //freopen("out.txt","w",stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n,k;
  cin >> n >> k;
  int a[n];
  for(int i = 0;i < n;i++) cin >> a[i];
  for(int i = k;i < n;i++){
	if(a[i] > a[i - k]) cout << "Yes\n";
	else cout << "No\n";
  }  
  return 0;
}


Measured memory_bytes: 4440
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ITP1
{
    class ITP1_3_C
    {
        static void Main(string[] args)
        {
            while (true)
            {
                List<int> dataSet = Console.ReadLine().Split().Select(int.Parse).ToList();
                if ((dataSet[0] == 0) && (dataSet[1] == 0))
                {
                    break;
                }
                else
                {
                    dataSet.Sort();
                    Console.WriteLine($"{dataSet[0]} {dataSet[1]}");
                }
            }
        }
    }
}



Measured memory_bytes: 16428
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int N  = Integer.parseInt(s.nextLine());
        int num = 1000 - N%1000;
        if (num == 1000){
            System.out.println(0);
        } else {
            System.out.println(num);
        }

//        int W  = Integer.parseInt(s.nextLine());
//        int K  = Integer.parseInt(s.nextLine());
        }
}

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

const int N=2e5+50;
char ch[N];
int n,cnt[26],s;
LL ans;
int main() {
	scanf("%s",ch+1); n=strlen(ch+1);
	for(int i=1;i<=n;i++)
		ans+=s-cnt[ch[i]-'a'], ++s, ++cnt[ch[i]-'a'];
	cout<<ans+1<<'\n';
}

Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

using namespace std;

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

	int W, H, x, y;
	cin >> W >> H >> x >> y;

	double area = double(W) * double(H) / 2.0;
	bool check_many = (x + x == W) && (y + y == H);

	cout.setf(ios::fixed);
	cout.precision(9);
	cout << area << " " << check_many;

	return 0;
}


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

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define print_var(x) cerr << #x << " = " << x << endl
#define print_array(arr, len) {cerr << #arr << " = "; for (int i = 0; i < len; i++) cerr << arr[i] << " "; cerr << endl;}
#define print_iterable(it) {cerr << #it << " = "; for (const auto &e : it) cerr << e << " "; cerr << endl;}
#else
#define eprintf(...) (void)0
#define print_var(x) (void)0
#define print_array(arr, len) (void)0
#define print_iterable(it) (void)0
#endif

using ll = long long;

void solve()
{
    string s;
    cin >> s;
    string t = s;
    reverse(t.begin(), t.end());
    puts(s == t ? "Yes" : "No");
}

int main()
{
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    solve();

    eprintf("\n\ntime = %.3lf\n", (double)clock() / CLOCKS_PER_SEC);
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  long long a,b,c,k;
  cin >> a >> b >> c >> k;
  long long ans = 0;

  if(a < k){
    ans = a;
    k -= a+b;
    if(k > 0){
      ans -= k;
    }
  }
  else{
    ans = k;
  }
  
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3676
import std.algorithm;
import std.conv;
import std.numeric;
import std.stdio;
import std.string;

void main()
{
    int n = to!int(readln().chomp());
    if (n % 2 == 0)
    {
        writeln(n);
    }
    else
    {
        writeln(n * 2);
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool comp(int a,int b){
   return a<b;
}
int main(){
    char arr[3];
    char arr2[3];
    cin>>arr;
    cin>>arr2;
    int c=0;
    for(int i=0;i<3;i++){
        if(arr[i]==arr2[i])c++;
    }
    cout<<c;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define mod 1000000007
using namespace std;
int main(){
    int n;  cin>>n;
    vector<int> num(n);
    rep(i,n) cin>>num[i];
    for(int k=0;k<n-1;++k){
            cout<<num[k]<<" ";
        }
        cout<<num[n-1]<<endl;
    for(int i=1;i<n;++i){
        int x=num[i];
        int j=i-1;
        while(j>=0&&num[j]>x){
            num[j+1]=num[j];
            --j;
        }
        num[j+1]=x;
        for(int k=0;k<n-1;++k){
            cout<<num[k]<<" ";
        }
        cout<<num[n-1]<<endl;
    }
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
 
using ll=long long;
 
 
int main(void){
	int n;
	string s;
	cin >> n >> s;
	int left=-1,right=n;
	rep(i,n){
		if(s[i]=='>') right=min(right,i);
		if(s[i]=='<') left=max(left,i);
	}
	// cerr << left << " " << right << endl;
	int ans=left-right+1;
	cout << ans+max(n-1-left,right) << endl;
	return 0;
}	

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define mid (tl+tr)/2
#define mod 1000000007
#define fain(arr) for(int i=0;i<n;i++)cin>>arr[i];
#define all(x) x.begin(),x.end()
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define bugv(n1) if(DEBUG)cout<<#n1<<" is "<<n1<<'\n';
#define buga(A) cout<<#A<<" is :"<<endl ; for(auto x:A)cout<<x<<" "; cout<<endl;
#define FILE freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define endl '\n'
#define ll long long 
#define pii pair<int,int>
#define pll pair<long long ,long long >
#define pi acos(-1)
#define sz(x) ((int)x.size())
#define clr(x) memset(x, 0, sizeof(x))
#define init(x, a) memset(x, a, sizeof(x))
#define DEBUG true
using namespace std;

int DFS(int current,vector<int>*adj,vector<int>& memo)
{
   if(memo[current]!=-1)return memo[current];

   int maxd=-1;

   for(auto x:adj[current]){
      maxd=max(maxd,DFS(x,adj,memo));
   }

   memo[current]=maxd+1;
   return memo[current];
}

int main(){
   // FILE
   SPEED
   int n,m;
   cin>>n>>m;

   vector<int> adj[n+1];

   for(int i=0;i<m;i++){
      int x,y;
      cin>>x>>y;
      adj[x].push_back(y);
   }     

   vector<int> memo(n+1,-1);

   for(int i=1;i<=n;i++)DFS(i,adj,memo);
   int ans=0;
   rep(i,1,n+1){ans=max(ans,memo[i]);}

   cout<<ans<<endl;

}

Measured memory_bytes: 8832
n = int(input())
h = list(map(int, input().split()))
for i in range(n):
    if i == 0 or h[i - 1] < h[i]:
        h[i] -= 1
for i in range(n - 1):
    if h[i] > h[i + 1]:
        print('No')
        break
else:
    print('Yes')


Measured memory_bytes: 20500
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF (1 << 29) * 2
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  char c;
  scanf("%c", &c);
  puts(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o' ? "vowel" : "consonant");
  return 0;
}


Measured memory_bytes: 128
N = int(input())
A = list(map(int, input().split()))
D = 1000000007


ans = 0
B = [0] * (N + 1)

for i in range(N-1, -1, -1):
    B[i] = (B[i+1] + A[i]) % D

for i in range(0, N-1):
    ans += (A[i] * B[i+1]) % D

print(int(ans % D))

Measured memory_bytes: 31520