akhauriyash/Code-Regression huggingface dataset:
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>

#define int long long
#define REP(i,a,n) for(int i=a;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define REV(i,a,n) for(int i=n;i>=a;--i)
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define show(n) cerr<<#n<<" = "<<n<<endl
#define showp(n) cerr<<n.fs<<", "<<n.sc<<endl
#define shows(n) for(auto z:n){cerr<<z<<", ";}cerr<<endl
#define showsp(n) for(auto z:n){cerr<<z.fs<<" "<<z.sc<<", "}cerr<<endl

#define yes puts("Yes")
#define no puts("No")
#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

inline void io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}
inline int  in(){int n;scanf("%lld",&n);return n;}
inline void out(int n){printf("%lld\n",n);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;

int n;
int ds;

int digitsum(int n){
    int sum=0;
    while(n>0){
        sum+=n%10;
        n/=10;
    }
    return sum;
}

signed main(){
    io();

    cin>>n;
    ds = digitsum(n);
    if(n%ds== 0){
        yes;
    }else{
        no;
    }

    return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define print(x) cout << (x) << endl;
#define sz(x) int(x.size())
 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}
 
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

ll dp[110][100100];
int main(void){
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    ll n,w;
    cin >> n >> w;
    vector<ll> W(n),v(n);
    rep(i,n){
      cin >> W[i] >> v[i];
    }
    rep(i,n){
      rep(j,w+1){
        chmax(dp[i+1][j], dp[i][j]);
        if(W[i] > j) continue;
        chmax(dp[i+1][j], dp[i][j-W[i]] + v[i]);
      }
    }
    print(dp[n][w]);
}

Measured memory_bytes: 79360
#include <bits/stdc++.h>
using namespace std;
int main() {
    int a, b, k;
    cin >> k >> a >> b;
    int x = b / k - (a - 1) / k;
    if (x == 0)
        cout << "NG" << endl;
    else
        cout << "OK" << endl;
    return 0;
}


Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    private int N,K;
    private int[] A;
    
    private void Scan()
    {
        var l=Console.ReadLine().Split(' ');
        N=int.Parse(l[0]);
        K=int.Parse(l[1]);
        A=Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    }
    
    private bool Check(int n)
    {
        var dp=new bool[K+1];
        dp[0]=true;
        for(int i=0;i<N;i++)
        {
            if(i==n)continue;
            for(int j=K;j>=0;j--)
            {
                if((dp[j])&&(j+A[i]<=K))
                {
                    dp[j+A[i]]=true;
                }
            }
        }
        for(int i=Math.Max(K-A[n],0);i<K;i++)
        {
            if(dp[i])return true;
        }
        return false;
    }
    
    private int Calc()
    {
        int ok=N;
        int ng=-1;
        while(ok-ng>1)
        {
            int mid=(ok+ng)/2;
            if(Check(mid))
            {
                ok=mid;
            }
            else
            {
                ng=mid;
            }
        }
        return ng+1;
    }
    
    public void Solve()
    {
        Scan();
        Array.Sort(A);
        Console.WriteLine(Calc());
    }
    
    static void Main()
    {
        new Program().Solve();
    }
}

Measured memory_bytes: 13780
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

/*
func readLine(r *bufio.Reader) []byte {
	buf := make([]byte, 0, 1024)
	for {
		l, p, e := r.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return buf
}
	r := bufio.NewReaderSize(os.Stdin, 4096)
*/

func main() {
	sc.Split(bufio.ScanWords)

	A, B, C := getInt(), getInt(), getInt()

	ans := "No"
	if A == B && A != C {
		ans = "Yes"
	}
	if A == C && A != B {
		ans = "Yes"
	}
	if B == C && A != B {
		ans = "Yes"
	}
	out(ans)
}


Measured memory_bytes: 640
DXYS = [[0, 1], [0, -1], [-1, 0], [1, 0], [1, 1], [-1, -1], [-1, 1], [1, -1]]

def initial_position(tiles)
  tiles.size.times do |j|
    tiles[0].size.times do |i|
      return [j, i] if tiles[j][i] == 1
    end
  end
  return []

end

def dfs(tiles, j, i)
  return if j<0 || tiles.size <= j
  return if i<0 || tiles[0].size <= i
  return if tiles[j][i] != 1

  tiles[j][i] = 2

  DXYS.map do |dx,dy|
    dfs(tiles, j+dy, i+dx)
  end
end

loop do
  width, height = gets.split.map(&:to_i)
  break if width == 0 && height == 0

  #?????????
  tiles = []
  height.times {tiles << gets.split.map(&:to_i)}
  island_count = 0

  while (position=initial_position(tiles)) != []
    island_count += 1
    dfs(tiles, position[0], position[1])
  end

  p island_count
end

Measured memory_bytes: 13936
#include <stdio.h>
#include <string.h>

int main(void){
    char t[200] , tn[200] ;
    int m , h , i , j , k ;
    
    while(1){
        scanf("%s" , t) ;
        scanf("%d" , &m) ;
        if(strcmp(t , "-") == 0){
            break;
        }
        
        for(i = 0 ; i < m ; i++){
            scanf("%d" , &h) ;
            for(j = h ; t[j] != '\0' ; j++){
                tn[j - h] = t[j] ; 
            }
            for(k = 0 ; k < h ; k++){
                tn[j - h + k] = t[k] ;
            }
            for(j = 0 ; t[j] != '\0' ; j++){
                t[j] = tn[j] ;
            }
        }
        printf("%s\n" , t);
    }
    return 0 ;
}


Measured memory_bytes: 2052
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
#define mod 1000000007

const int sz=2e3+5;
ll inf=1e15;

ll n,dp[sz];

ll f(ll sm){
    // cout<<c<<" "<<sm<<endl;
    if(sm>n) return 0;
    if(sm==n) return 1;
    ll &res=dp[sm];
    if(res!=-1){
        return res;
    }
    res=0;
    for(int i=n-sm;i>=3;i--){
        res=(res+f(sm+i))%mod;
    }

    return res;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    // cin>>t;
    while(t--)
    {
        cin>>n;
        memset(dp,-1,sizeof(dp));
        cout<<f(0);
        // for(int c=1;c<)
    }

    return 0;
}

Measured memory_bytes: 3668
#include <stdio.h>
int main(void){
  int a1,a2,a3;
  scanf("%d %d %d",&a1,&a2,&a3);
  if(a1+a2+a3 >= 22){
    printf("bust");
  }
  else{
    printf("win");
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
#define INF 1e9
#define All(x) (x).begin(), (x).end()

using namespace std;
typedef long long ll;

int main() {
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  if(a>=k){
    cout << k << endl;
    return 0;
  }else if(a+b>=k){
    cout << a << endl;
    return 0;
  }else{
    cout << (a - (k - a - b)) << endl;
    return 0;
  }

    return 0;
}


Measured memory_bytes: 3640
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<tuple>
#include<cctype>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
int main(){
	int n, m;
	cin >> n >> m;
	vector<pair<ll, int>>d(n);
	rep(i, n) {
		int a, b;
		cin >> a >> b;
		d[i] = make_pair(a, b);
	}
	sort(d.begin(), d.end());
	ll ans = 0;
	rep(i, n) {
		int now = min(m, d[i].second);
		m -= now;
		ans += d[i].first * now;
		if (m <= 0) {
			cout << ans << endl;
			return 0;
		}
	}
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>

int main(void);
char* func(int n, int m, int a[]);

char* func(int n, int m, int a[]){
     int ii1, count, sum=0;
     double line;
  	 char *s;
     count = 0;
     for(ii1=0; ii1<n; ii1++) sum+=a[ii1];
     line = (double)sum/(4.0*(double)m);
     for(ii1=0; ii1<n; ii1++){
        if((double)a[ii1] >= line) count++;
     }

     if(count >= m) s="Yes";
  	 else s="No";
  
     return s;
}

int main(void){
    int n, m, ii1;
    scanf("%d %d", &n, &m);
    int a[n];
    char *s;
    for(ii1=0; ii1<n; ii1++){
        scanf("%d", &a[ii1]);
    }
    s = func(n, m, a);

    printf("%s\n", s);

    return 0;
}

Measured memory_bytes: 128
N, X, M = map(int, input().split())

result = 0
loop_list = []
checked = set()
a = X
for i in range(N):
    result += a
    loop_list.append(a)
    checked.add(a)

    a = (a**2) % M
    if a == 0:
        break
    if a in checked:
        idx = loop_list.index(a)
        loop_list = loop_list[idx:]
        lp = (N - 1 - i) // len(loop_list)
        rem = (N - 1 - i) % len(loop_list)
        result += lp * sum(loop_list)
        result += sum(loop_list[:rem])
        break

print(result)



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

string grid[1009];
ll dp[1009][1009];
ll h, w;

ll call(ll i, ll j)
{
    if(i >= h || j >= w || grid[i][j] == '#')
        return 0;
    if(dp[i][j] != -1)
        return dp[i][j];
    if(i == h-1 && j == w-1)
        return 1;

    dp[i][j] = (call(i+1, j) + call(i, j+1)) % mod;

    return dp[i][j];
}

int main()
{
    ll i, j;
    cin >> h >> w;
    for(i = 0; i < h; i++)
        cin >> grid[i];

    memset(dp, -1, sizeof dp);
    cout << call(0, 0);
}


Measured memory_bytes: 9344
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int x = sc.nextInt();
        if(a+b >= x && a <= x) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}


Measured memory_bytes: 21844
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


class City:
    def __init__(self, id, p, y):
        self._id = id
        self._p = p
        self._y = y
        self._x = 0


def main():
    # sys.stdin = open("sample.txt")
    N, M = Scanner.map_int()
    cities = []
    for i in range(M):
        p, x = Scanner.map_int()
        cities.append(City(i, p, x))
    cities.sort(key=lambda c: c._y)
    M = defaultdict(int)
    for c in cities:
        M[c._p] += 1
        c._x = M[c._p]
    cities.sort(key=lambda c: c._id)
    for c in cities:
        print('{:0>6}{:0>6}'.format(c._p, c._x))


if __name__ == "__main__":
    main()


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

using namespace std;

struct Edge {
    int u;
    int v;
    long long c;
    Edge() {}
    Edge(int u, int v, long long c): u(u), v(v), c(c) {}
};

struct PqEle {
    int u;
    int num;
    long long content;
    PqEle() {}
    PqEle(int u, int num, long long content): u(u), num(num), content(content) {}
    bool operator <(const PqEle& o) const {
        return make_pair(num, content) > make_pair(o.num, o.content);
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    auto t0 = clock();
    int n, m;
    long long l;
    cin >> n >> m >> l;
    vector<vector<Edge>> adj_list(n);
    for (int i = 0; i < m; ++i) {
        int a, b;
        long long c;
        cin >> a >> b >> c;
        --a;
        --b;
        if (c <= l) {
            adj_list[a].push_back(Edge(a, b, c));
            adj_list[b].push_back(Edge(b, a, c));
        }
    }
    int q;
    cin >> q;
    vector<pair<int, int>> queries(q);
    for (int i = 0; i < q; ++i) {
        cin >> queries[i].first >> queries[i].second;
        --queries[i].first;
        --queries[i].second;
    }
    auto dijkstra = [&](int start_id) {
        priority_queue<PqEle> pq;
        pq.push(PqEle(start_id, 0, 0LL));
        vector<bool> visited(n, false);
        vector<int> dist(n, -1);
        while (!pq.empty()) {
            auto p = pq.top();
            int node_id = p.u;
            pq.pop();
            if (visited[node_id]) {
                continue;
            }
            dist[node_id] = p.num;
            visited[node_id] = true;
            for (auto& edge : adj_list[node_id]) {
                if (!visited[edge.v]) {
                    if (edge.c + p.content > l) {
                        pq.push(PqEle(edge.v, p.num + 1, edge.c));
                    } else {
                        pq.push(PqEle(edge.v, p.num, edge.c + p.content));
                    }
                }
            }
        }
        return dist;
    };
    vector<vector<int>> dists(n);
    for (int i = 0; i < n; ++i) {
        dists[i] = dijkstra(i);
    }
    for (auto q : queries) {
        cout << dists[q.first][q.second] << "\n";
    }
    cerr << "time used = " << (clock() - t0) << endl;
    return 0;
}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

int main() {
    int N;
    cin >> N;
    int t, x, y;
    t = x = y = 0;
    rep(i, N) {
        int nt, nx, ny;
        cin >> nt >> nx >> ny;
        int diff = abs(nx + ny - x - y);
        int diff_t = nt - t;
        if (diff > diff_t || diff % 2 != diff_t % 2) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll,null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_set_pair tree<pair<ll,ll>,null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> 

typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef pair<ll,ll> pi; 
#define FOR(i,vv,n) for(ll i=vv;i<n;i++)
#define FORR(i,n,vv) for(ll i=n-1;i>=vv;i--)
#define ve vector 
#define maxe(v) *max_element(v.begin(),v.end())
#define mine(v) *min_element(v.begin(),v.end())
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define eb emplace_back
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mp make_pair
#define M 1000000007ll
#define PRECISE cout.precision(18);
#define F first
#define S second




int main(){
 

    FAST
	PRECISE


ll n;
cin>>n;
ve <ll> v(n,0);
ve <ll> a(2*100000+1,0);
FOR(i,0,n){
	cin>>v[i];
	a[v[i]]++;
}
ll sum=0;
FOR(i,1,2*100000+1){
	sum+=(a[i]*(a[i]-1))/2;
}
FOR(i,0,n){
	ll ans=0;
	ll x=v[i];
	ans=sum-(a[x]*(a[x]-1))/2+((a[x]-2)*(a[x]-1))/2;
	cout<<ans<<"\n";
}

return 0;
}



Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
  int n,k;
  cin>>n>>k;
  vin d(k);
  rep(i,0,k)cin>>d[i];
  //////
  int ans=0;
  rep(i,n,100000){
    bool ok=true;
    string t;
    t=to_string(i);
    int g=t.size();
    rep(j,0,g){
      rep(h,0,k){
        if(t[j]==d[h]+'0') ok=false;        
      }   
    }
    
    if(ok){
     ans=i;
      break;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3708
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;
    if(n/100 == n%10)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<algorithm>
using namespace std;

#define LEFT '('
#define RIGHT ')'

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

	string S;
	cin >> S;

	int cnt = 0;
	vector<int> table(N, 0);
	for(int i=0; i<N; i++)
	{
		if(S[i] == LEFT)
			cnt++;
		else
			cnt--;

		table[i] = cnt;
	}

	int cntLeft = max(0, -*min_element(table.begin(), table.end()));
	int cntRight = table.back() + cntLeft;
	cout << string(cntLeft, LEFT) << S << string(cntRight, RIGHT) << endl;

	return 0;
}


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

#define ll long long 
#define pll pair<ll,ll> 

int main(){

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	ll n,d;
	cin>>n>>d;
	ll ans=0;
	for(ll i=0;i<n;i++){
		ll x, y;
		cin>>x>>y;
		if(x*x+y*y<=d*d)
			ans++;
	}
	cout<<ans<<endl;
}


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

int main( void )
{
    int a,b;
    cin >> a >> b;
    
    bool noAns = true;
    for ( int i = b * 10; i <= 10000; i++ )
        if ( i * 2 / 25 == a && i / 10 == b )
        {
            cout << i << endl;
            noAns = false;
            break;
        }
        
        if ( noAns )
            cout << -1 << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#define MAX 251

int parent(int i){
  return i/2;
}

int left(int i){
  return 2*i;
}

int right(int i){
  return 2*i+1;
}

int main(){
  int i,n,heap[MAX];
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&heap[i]);
  }

  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,heap[i]);
    if(i>1)
    printf("parent key = %d, ",heap[parent(i)]);
    int l=left(i);
    int r=right(i);
    if(l<=n)
    printf("left key = %d, ",heap[l]);
    if(r<=n)
    printf("right key = %d, ",heap[r]);
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<string>
#include<map>
#include<queue>
#include<vector>
#include<cstring>
#include<string.h>
#include<cstdio>
#include<stdio.h>
#include<algorithm>
using namespace std;    
int vis[100009];  
typedef pair<int, int> P;  
int main()  
{  
    int k;  
    scanf("%d", &k);  
    deque<P> q;  
    memset(vis, 0, sizeof(vis));  
    q.push_back(make_pair(1, 1));  
    while(!q.empty())  
    {  
        P x = q.front(); q.pop_front();  
        if(vis[x.first]) continue;  
        vis[x.first] = 1;  
        if(x.first == 0)  
        {  
            printf("%d\n", x.second);  
            break;  
        }  
        q.push_front(make_pair(x.first*10 % k, x.second));  
        q.push_back(make_pair((x.first+1) % k, x.second+1));  
   
    }  
    return 0;  
}  

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = (n) - 1; i >= 0; i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define all(ar) ar.begin(), ar.end()
#define rall(ar) ar.rbegin(), ar.rend()
#define sz(x) ((long long)x.size())
#define pb push_back
#define pob pop_back()
#define pf push_front
#define pof pop_front()
#define mp make_pair
#define ff first
#define ss second
#define MOD 1000000007
 
auto clk=clock();
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ll INF = 1e18L+5;
const int d4i[4]={-1, 0, 1, 0}, d4j[4]={0, 1, 0, -1};
const int d8i[8]={-1, -1, 0, 1, 1, 1, 0, -1}, d8j[8]={0, 1, 1, 1, 0, -1, -1, -1};
 
typedef pair<ll, ll> ii;
typedef pair<ll, ii> iii;
typedef vector<ii> vii;
typedef vector<ll> vi;
typedef vector<int> vint;
typedef vector<string> vs;
typedef vector<vi> vvi;

const int N_MAX = 2005;
ll dp[N_MAX][N_MAX];

ll combi(ll n, ll r){
    if(r==0||r==n)
        return 1;
    if(dp[n][r]!=-1)
        return dp[n][r];
    ll a = combi(n-1,r-1);
    ll b = combi(n-1,r);
    dp[n][r] = (a+b)%MOD;
    return dp[n][r];
}

ll modexp(ll base,ll power){
    if(base==0)
        return 0ll;
    if(power==0)
        return 1ll;
    ll res=1;
    while(power){
        if(power&1)
            res = (res*base)%MOD;
        base = (base*base)%MOD;
        power /= 2;
    }
    return res;    
}
 
void solve(){
    ll n;
    cin>>n;
    ll dp[n+1];
    dp[0] = 0;
    dp[1] = 0;
    dp[2] = 0;
    fr(i,3,n)
    	dp[i] = 1;
    fr(i,4,n){
    	for(ll j=3; j<=i-3; j++){
    		dp[i] = (dp[i]+dp[j])%MOD;
    	}
    }
    cout<<dp[n];
}
    
 
int main () 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout<<setprecision(11);
    memset(dp,-1,sizeof(dp));
    ll t = 1;
    // cin>>t;
    while(t--)
        solve();
 
    // cout<<endl<<endl<<"Time elapsed: "<<((double)(clock()-clk)/CLOCKS_PER_SEC)*1000<<"ms"<<endl;
    return 0;
}

Measured memory_bytes: 35048
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
//using Graph = vector<vector<int>>;
//#define pi 3.1415926535

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

  int same = 0, ans = 0;
  for(int i = 0; i < n; i++){
    cin >> a >> b;
    if(a == b){
      same++;
    }
    else{
      same = 0;
    }

    if(same >= 3){
      ans = 1;
    }
  }

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

  return 0; 
}

Measured memory_bytes: 3632
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
ans = []
class P:
    def __init__(self,x,y):
        self.x = x
        self.y = y
    
    def __str__(self):
        return str(self.x) + " " + str(self.y)
    __repr__ = __str__
    

    def __add__(self,p):
        return P(self.x+p.x, self.y+p.y)
    
    __radd__ = __add__
        
    def __sub__(self, p):
        return P(self.x-p.x, self.y-p.y)

    def __mul__(self,other):
        return P(self.x*other, self.y*other)

    def __truediv__(self, other):
        return P(self.x/other, self.y/other)

    # def __rsub__(self, other):
    #     if isinstance(other, ModInt):
    #         return ModInt(other.x - self.x)
    #     else:
    #         return ModInt(other - self.x)


def koch(n,left,right):
    if n==0:
        return 
    w = ((right-left)/3)
    s = left + w
    t = left + w*2
    center = (s+t)/2 #sとtの中点
    vec1 = (t-s)*sqrt(3)/2 #sからtへのベクトルの√3/2倍
    vec2 = P(-vec1.y, vec1.x) 
    u = center + vec2

    #print(left)
    koch(n-1,left, s)
    print(s)
    koch(n-1, s, u)
    print(u)
    koch(n-1,u,t)
    print(t)
    koch(n-1,t,right)
    #print(right)
    


    # print(*left)
    # koch(n-1,left,s)
    # print(*s)
def main():
    n = int(input())
    left = P(0,0)
    right = P(100,0)
    print(left)
    koch(n,P(0,0),P(100,0))
    print(right)
    #print(ans)
if __name__ == '__main__':
    main()


Measured memory_bytes: 6452
from collections import defaultdict
def inpl(): return [int(i) for i in input().split()]

path = defaultdict(lambda: [])
N = int(input())
for _ in range(N-1):
    a, b, c = inpl()
    path[a].append((b,c))
    path[b].append((a,c))

ctr = 1
Q, K = inpl()
now = [K]
dist = [0 for _ in range(N+1)]
while True:
    for na in now.copy():
        na = now.pop()
        for nb, nc in path[na]:
            dist[nb] = dist[na] + nc
            path[nb].remove((na,nc))
            now.append(nb)
            ctr += 1
    if ctr >=  N:
        break
for i in range(Q):
    x, y = inpl()
    print(dist[x]+dist[y])

Measured memory_bytes: 49056
#include <cstdio>
#include <algorithm>
using namespace std;
int N, V[1 << 18], W[1 << 18];
int dptable[1024][100001];
int dp(int i, int j) {
	if (i < 1024) return dptable[i][j];
	if (j < W[i]) return dp(i / 2, j);
	return max(dp(i / 2, j - W[i]) + V[i], dp(i / 2, j));
}
int main() {
	int Q, v, L;
	scanf("%d", &N);
	for (int i = 1; i <= N; ++i) scanf("%d %d", &V[i], &W[i]);
	fill_n(dptable[0], 100001, 0);
	for (int i = 1; i < 1024; ++i) {
		for (int j = 0; j <= 100000; ++j) {
			if (j < W[i]) dptable[i][j] = dptable[i >> 1][j];
			else dptable[i][j] = max(dptable[i >> 1][j], dptable[i >> 1][j - W[i]] + V[i]);
		}
	}
	scanf("%d", &Q);
	for (int i = 0; i < Q; ++i) {
		scanf("%d %d", &v, &L);
		printf("%d\n", dp(v, L));
	}
	return 0;
}

Measured memory_bytes: 403836
import java.math.*;
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) throws IOException{
		FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
		int t = 1;
		while (t-->0) {
		    long n = sc.nextLong();
		    char[] s = sc.nextLine().toCharArray();
		    long r = 0, g = 0, b = 0;
		    for(char c : s){
		        if(c=='R') r++;
		        else if(c=='G') g++;
		        else b++;
		    }
		    long ans = r*g*b;
		    int len = s.length;
		    for(int i=0;i<len;i++){
		        for(int j=1;2*j+i<len;j++){
		            if(s[i]!=s[i+j] && s[i]!=s[i+2*j] && s[i+j]!=s[i+2*j]) ans--;
		        }
		    }
		    out.println(ans);
		}
		out.close();
	}
	static int gcd(int a, int b){
	    if(b==0) return a;
	    return gcd(b,a%b);
	}
	static class Pair implements Comparable<Pair>{
		int a, b;
		public Pair(int c, int d){
			a = c;
			b = d;
		}
		public int compareTo(Pair p){
		    return a-p.a;
		}
	}
	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;
		FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}
		FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}
		String nextLine() {
			try {
				return br.readLine();
			} catch (IOException e) {
				return null;
			}
		}
		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		long nextLong() {
			return Long.parseLong(next());
		}
		double nextDouble() {
			return Double.parseDouble(next());
		}
	}
}

Measured memory_bytes: 33472
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const ll INFLL = 1001001001001001001;  // > 10^18
const int MOD = (int)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

int main () {

    ll x; cin >>x;

    ll ans = x/11;
    ans *= 2;
    x %= 11;

    ans += x/6;
    x %= 6;

    if (x > 0) {
        ans++;
    } 

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




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define si(n) scanf("%d",&n);
#define PI acos(-1.0)
#define sl(n) scanf("%lld",&n);
#define sf(n) scanf("%lf",&n);
#define ss(n) scanf("%s",n);
#define for0(i,n) for(ll i=0;i<n;i++)
#define for1(i,n) for(ll i=1;i<=n;i++)
#define forc(i,j,n) for(ll i=j;i<n;i++)
#define pb push_back
#define sor(n) sort(n.begin(),n.end())
#define sorcmp(n) sort(n.begin(),n.end(),cmp)
#define rev(n) reverse(n.begin(),n.end())
#define pi(x)  printf("%d",x);
#define pl(x)  printf("%lld",x);
#define pf(x)  printf("%.10lf",x);
#define ps(x)  printf("%s",x);
#define en() printf("\n");
#define random_shuffle(r...)random_shuffle(r,[](int _){return rand()%_;})
#define SQR(a) (a)*(a)
#define sp(x) fixed<<setprecision(x)
#define mod 1000000007
#define endl '\n'
#define pii pair<int,int>
#define pll pair<ll,ll>
#define bug cout<<"Here"<<endl
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
template <typename T> T POW(T B,T P){ if(P==0) return 1; if(P&1) return B*POW(B,P-1);  else return SQR(POW(B,P/2));}
ll powmod(ll a, ll b){ll ans = 1;while(b){if(b&1) ans = ans*a%mod;a = a*a%mod;b >>= 1;}return ans;}

int main(){




   ll a,b;
   cin>>a>>b;
   cout<<a*b<<endl;


return 0;
}


Measured memory_bytes: 3596
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
typedef long long int ll;
#define FOR(i,a,n) for(int i=(ll)a;i<(ll)n;++i)
#define TFOR(i,n)FOR(i,0,n)
#define ALL(x) x.begin(),x.end();
const int INF = 1LL << 30;
const ll LLINF = 1LL << 60;
int main() {
	int n, q;
	std::cin >> n >> q;
	int max = 0;
	std::bitset<600000> bit;
	TFOR(i, n) {
		int nn;
		std::cin >> nn;
		bit[nn-1] = 1;
		if (max < nn)max = nn;
	}
	TFOR(i, q) {
		int nn;
		std::cin >> nn;
		bool fl = 0;
		for (int j = nn-1; j>=0; --j) {
			for (int k =max/nn*nn+j; k > 0; k -= nn) {
				if (bit[k - 1] == 1) { std::cout << j << std::endl; fl = 1; }
				if (fl == 1)break;
			}
			if (fl == 1) { fl = 0; break; }
		}
	}
	return 0;
}

Measured memory_bytes: 3144
n,x,m = map(int,input().split())

l = []
ans = 0
for i in range(n):
    if x in l:
      
        d = l.index(x)
        ans += sum(l[:d])
        le = len(l)-d
        
        count = sum(l[d:])
        #print(count)
        n -= d
        #print(n)
        ans += count*(n//le)
        n %= le
        #print(n,ans)
        for k in range(d,d+n):
            ans += l[k]

        print(ans)
        exit()
        break
    l.append(x)
    x = (x**2)%m

print(sum(l))


Measured memory_bytes: 68964
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); i++)

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);


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


int main() {

  int n;
  cin>>n;
  unordered_map<long long , long long > umap;
  
  for(int i=0;i<n;i++){
    long long x;
    cin>>x;
    umap[x]++;
  }
  
  if(umap.size() == n){
    cout<<"YES\n";
  }
  else{
    cout<<"NO\n";
  }  


  
  return 0;
}


Measured memory_bytes: 11396
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
int main(){
  int a[100],n;
  cin  >> n;
  for (int i = 0; i < n; i++){
    cin >> a[i];
    if (a[i] % 2 == 0){
      if (a[i] % 3 != 0 && a[i] % 5 != 0){
        cout << "DENIED\n";
        return 0;
      }
    }
  }
  cout << "APPROVED\n";
  return 0;   
}

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

int main() {
  int N, ans = 0, j = 0, p;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  while(ans < N) {
    ans++; 
    if (A.at(j) == 2) {
      cout << ans << endl;
      ans = N;
    }
    else if (j == A.at(j) - 1) {
      cout << -1 << endl;
      ans = N;
    }
    else {
      p = A.at(j) - 1;
      A.at(j) = j + 1;
      j = p;
    }
  }    
}


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

int main() {
	
	int input;
	cin >> input;
	vector<int> numList(input, 5);
	for (int i = 0; i < input; i++) {
		cin >> numList[i];
	}

	int count = 0;
	for (int i = 1; i < input -1; i++) {
		if ((numList[i-1] < numList[i]&& numList[i + 1] > numList[i])|| (numList[i + 1] < numList[i] && numList[i - 1] > numList[i])) {
			count++;
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <cstdlib>
#include <queue>
#include <vector>
#include <set>
#include <stdio.h>
#include <cstdio>
#include <cmath>
#include <complex>
using namespace std;
typedef complex<double> xy_t;
xy_t P[30];
int N;
double x,y;
int aa=1;
int main() {
cin >> N;
double s =0.0;
for(int i = 0;i < N;i++) {
    cin >> x >> y;
    P[i] = xy_t(x,y);
}
for ( int i = 0; i < N;i++ ){
    xy_t a = P[(i+1)%N] - P[i], b = P[(i+2)%N]-P[(i+1)%N];
    if((a.real()*b.imag()-a.imag()*b.real())<0){
    	aa=0; break;
    }
}
printf("%d\n", aa);
}

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

string divString[4] = {"dream", "dreamer", "erase", "eraser"};

int main() {
  string S;
  cin >> S;
  // すべての文字列を「左右反転」する
  reverse(S.begin(), S.end());
  for (int i = 0; i < 4; ++i) {
    reverse(divString[i].begin(), divString[i].end());
    }
    // 端から切っていく
    string ans = "YES";
    for (int i = 0; i < S.size();) {
        bool can = false; // 4個の文字列のどれかで分割できるか
        for (int j = 0; j < 4; ++j) {
            string d = divString[j];
          // dで分割できるか
          if (S.substr(i, d.size()) == d) {
            can = true;
            i += d.size(); // 分割できたらiを進める
          }
        }
        if (!can) {
          ans = "NO";
          break;
        }
    }
    cout << ans << "\n";
}
  


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <bitset>
#define MOD1 1e9 + 7
#define MOD2 1e9 + 9
#define inf  (int)2e9
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))



using namespace std;


typedef long long ll;

int main() {

int n,m;
SCD(n);
SCD(m);
int ans = (n * (n - 1)) / 2 + (m * (m - 1)) / 2;
printf("%d\n", ans);

return 0;


}

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

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;


fn main() {
    input!{n:chars};

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

}

Measured memory_bytes: 4352
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
da = 0
db = 0
for i in range(n):
    if a[i] > b[i]:
        db += a[i]-b[i]
    else:
        da += (b[i]-a[i])//2
if db > da:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 4596
#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() {
  string s;
  cin>>s;
  int n=s.size();

  vector<int>a(n+1);
  for(int i=0;i<n;i++){
    if(s[i]=='<'){a[i+1]=a[i]+1;}
  }

  for(int i=n;i>=1;i--){
    if(s[i-1]=='>'){a[i-1]=max(a[i-1],a[i]+1);}
  }

  int64_t sum=0;
  for(int i=0;i<n+1;i++){
    sum+=a[i];
  }
  cout<<sum<<endl;
  return 0;  
}

Measured memory_bytes: 5868
#include<bits/stdc++.h>
using namespace std;  
#pragma GCC optimize("Ofast") 
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n; i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
#define PI  3.14159265358979323846
#define MOD 1000000007
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
const int N = 2e6+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int A[N];
int dp[N];
inline int mul(int x, int y, int mod) {
  if (x >= mod) x %= mod;
  if (y >= mod) y %= mod;
  return (x*y) % mod;
}
int solve( int n, int k) 
{ 
    sort(A, A + n); 
    int product = 1; 
   if (A[n - 1] == 0 && (k & 1)) 
        return 0; 
    if (A[n - 1] <= 0 && (k & 1)) { 
        for (int i = n - 1; i >= n - k; i--) 
            product = mul(product, A[i],MOD); 
        return product; 
    } 
   int i = 0; 
    int j = n - 1; 
     if (k & 1) { 
        product = mul(product, A[j] , MOD); 
        j--; 
        k--; 
    } 
   k >>= 1; 
    for (int itr = 0; itr < k; itr++) { 
        int left_product = A[i] * A[i + 1]; 
        int right_product = A[j] * A[j - 1]; 
     if (left_product > right_product) { 
            product = mul(product, left_product,MOD); 
            i += 2; 
        } 
        else { 
            product = mul(product, right_product,MOD); 
            j -= 2; 
        } 
    } 
    return product; 
} 
signed main(){
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
  IOS;
  int T=1;
  // cin >> T;
  while(T--){
    int n ,k;
    cin >> n >> k;
    fn{
      cin >>A[i];
    }
    int ans = solve(n,k);
    if(ans<0)ans+=MOD;
    cout<<ans;
  
  
  }
  return 0;
}

Measured memory_bytes: 5112
r, g, b, N = gets.chomp.split.map(&:to_i)
ans=0
ra, rb=N.divmod(r)
for ri in 0..ra do
  ga, gb=(N-ri*r).divmod(g)
  for gi in 0..ga do
    ba, bb=(N-ri*r-gi*g).divmod(b)
    ans += 1 if bb == 0
  end
end
p ans


Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>

using namespace std;

template<typename T> 
void show(T a){
  for(auto i : a){ cout << i << " "; }
  cout << endl;
}

bool comp(char a, char b, char c){
  if(a == b) return true;
  if(a == c) return true;
  if(b == c) return true;
  return false;
}

int main(int argc, char *argv[]){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  
  int n;
  string a, b, c;
  cin >> n >> a >> b >> c; 
  
  int count = 0;
  for(int i = 0; i < n; i++){
    if(a[i] == b[i] && b[i] == c[i]) continue;
    if(comp(a[i], b[i], c[i])) count++;
    else count += 2;
  }
    
  cout << count << endl;
  

}


Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        // 自分の得意な言語で
        // Let's チャレンジ！！
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
		
		// 1行、2つ(複数)数字
		String[] ss0 = br.readLine().trim().split(" ", 0);
		int n = Integer.parseInt(ss0[0]);
		int k = Integer.parseInt(ss0[1]);

		int f = 0;
		
		f = (k) * (int)Math.pow((k-1), (n-1));
		
		

		
		// System.out.print(n + " " + k + " " + f);
		System.out.print(f);

    }
}



Measured memory_bytes: 8148
from _collections import deque
h,w=map(int,input().split())
cx,cy=map(int,input().split())
dx,dy=map(int,input().split())
s=[[] for _ in range(h+2)]
for i in range(h):
    x=list(input())
    x.insert(0,"#")
    x.append("#")
    s[i+1]=x
s[0]=s[-1]=["#"]*(w+2)


dep=[[10**10]*(w+2) for _ in range(h+2)]
dep[cx][cy]=0
data=deque([[cx,cy]])
data2=deque([])
while len(data)>0:
    while len(data)>0:
        xy=data.popleft()
        x,y=xy[0],xy[1]
        data2.append([x,y])
        if s[x-1][y]=="." and dep[x-1][y]>dep[x][y]:
            dep[x-1][y]=dep[x][y]
            data.append([x-1,y])

        if s[x+1][y] == "." and dep[x+1][y] > dep[x][y]:
            dep[x+1][y] = dep[x][y]
            data.append([x + 1,y])

        if s[x][y-1] == "." and dep[x][y-1] > dep[x][y]:
            dep[x][y-1] = dep[x][y]
            data.append([x,y-1])

        if s[x][y+1] == "." and dep[x][y+1] > dep[x][y]:
            dep[x][y+1] = dep[x][y]
            data.append([x,y+1])


    while len(data2)>0:
        xy=data2.popleft()
        x,y=xy[0],xy[1]
        for i in range(5):
            for j in range(5):
                if 0<=x-2+i<=h+1 and 0<=y-2+j<=w+1 and s[x-2+i][y-2+j]=="." and dep[x-2+i][y-2+j]>dep[x][y]+1:
                    dep[x-2+i][y-2+j]=dep[x][y]+1
                    data.append([x-2+i,y-2+j])

print(dep[dx][dy] if dep[dx][dy]<10**10 else -1)



Measured memory_bytes: 143104
import sys,math,collections,itertools
input = sys.stdin.readline

N=int(input())
xy = []

if N == 1:
    print(1)
    exit()

for _ in range(N):
    xy.append(list(map(int,input().split())))

rxy = []
for i in range(N):
    for j in range(N):
        if i==j:
            continue
        rxy.append((xy[i][0]-xy[j][0],xy[i][1]-xy[j][1]))
cr = collections.Counter(rxy)
print(N-max(cr.values()))



Measured memory_bytes: 9536