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

#define MAX 1e+18
vector<long long>v;

int main()
{
    int n,k,Mark[102]={0},ans=0;
    cin>>n>>k;
    for(int i=1;i<=k;i++)
    {
        int x,y;
        cin>>x;
        for(int j=1;j<=x;j++)
        {
            cin>>y;
            Mark[y]=i;
        }
    }
    for(int i=1;i<=n;i++)
    {
        if(Mark[i]==0) ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3640
/**
 * File    : E.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-5-26 21:42:14
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <random> // random_device rd; mt19937 mt(rd());
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

class BIT
{ // index starts at 1.
public:
  int N;
  ll *data;

  BIT(int n) : N(n)
  {
    data = new ll[N + 1];
    for (auto i = 1; i <= N; ++i)
    {
      data[i] = 0;
    }
  }

  ~BIT()
  {
    delete[] data;
  }

  ll sum(int i)
  { // [1, i]
    ll s = 0;
    while (i > 0)
    {
      s += data[i];
      i -= i & -i;
    }
    return s;
  }

  ll sum(int a, int b)
  { // [a, b)
    return sum(b - 1) - sum(a - 1);
  }

  void add(int i, ll x)
  {
    while (i <= N)
    {
      data[i] += x;
      i += i & -i;
    }
  }

  void add(int i)
  {
    add(i, 1);
  }
};

typedef pair<int, int> P;

int N;
int K;
int Q;
int A[2010];
vector<P> V;
bool visited[2010];

int main()
{
  cin >> N >> K >> Q;
  for (auto i = 0; i < N; i++)
  {
    cin >> A[i];
    V.push_back(P(A[i], i));
  }
  sort(V.begin(), V.end());
  reverse(V.begin(), V.end());
  int ans = 1000000007;
  fill(visited, visited + 2010, false);
  for (auto i = 0; i < N; i++)
  {
    int Y = V[i].first;
    cerr << "Y = " << Y << endl;
    int k = V[i].second;
    visited[k] = true;
    int left[2010];
    int right[2010];
    int t = -1;
    for (auto j = 0; j < N; j++)
    {
      if (!visited[j])
      {
        t = j;
      }
      left[j] = t;
    }
    t = N;
    for (auto j = N; j >= 0; j--)
    {
      if (!visited[j])
      {
        t = j;
      }
      right[j] = t;
    }
    /*
    for (auto j = 0; j < N; j++)
    {
      cerr << j << " : " << left[j] << " " << right[j] << endl;
    }
    */
    BIT bit(N + 1);
    int cnt[2010];
    for (auto j = 0; j <= i; j++)
    {
      k = V[j].second;
      bit.add(k + 1);
      cnt[k] = bit.sum(left[k] + 2, right[k] + 1);
      // cerr << "cnt[" << k << "] = " << cnt[k] << endl;
    }
    int sel = 0;
    for (auto j = i; j >= 0; j--)
    {
      k = V[j].second;
      if (cnt[k] >= K)
      {
        sel++;
        if (sel == Q)
        {
          int X = V[j].first;
          ans = min(ans, X - Y);
          break;
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
import collections

n = int(input())
a = list(map(int, input().split()))

c = collections.Counter(a)

out = "No"
flag = False
keys = list(c.keys())

if len(keys) == 3 and n %3 == 0:
    if keys[0]^keys[1]==keys[2] and c[keys[0]] == n//3 and c[keys[1]] == n//3 and c[keys[2]] == n//3:
        flag = True
        
elif len(keys) == 2 and n %3 == 0:
    if c[0] == n//3 and (c[keys[0]] == n//3*2 or c[keys[1]] == n//3*2):
        flag = True
        
elif len(keys) == 1:
    if c[0] == n:
        flag = True
        
if flag:
    out = "Yes"
    
print(out)


Measured memory_bytes: 14468
// C - Attention
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	int N; string S; cin>>N>>S;
	vi W(N+2), E(N+2);
	rp(i, 0, N){
		W[i+1] = W[i] + (S[i]=='W');
		E[N-i] = E[N-i+1] + (S[N-1-i]=='E');
	}
	int mini = INT_MAX;
	rp(leader, 1, N+1)
		mini = min(mini, W[leader-1] + E[leader+1]);
	cout<< mini <<endl;
}

Measured memory_bytes: 3076
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
string S,T;
int main(){
	cin>>S>>T;
	cout<<(S==T.substr(0,S.size())?"Yes":"No")<<endl;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    int n; cin >> n;
    vint a(n); rep(i,n) cin >> a[i];
    map<int,int> map;
    rep(i,n) map[i+a[i]]++;
    int res=0;
    rep(i,n){
        res+=map[i-a[i]];
    }
    cout<<res<<endl;

}

Measured memory_bytes: 27448
#include<bits/stdc++.h>
     
    using namespace std;
     
    vector<vector<int>> adj;
    int dist1[100005],dist2[100005];

    void dfs(int x, int par, int dist[]){

        dist[x] = dist[par] + 1;
        for(auto i: adj[x]){
            if(i!=par){
                dfs(i, x, dist);
            }
        }
    }

    
    void solve(){
        int n;
        cin >> n;

        adj.resize(n+1);

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

       for(int i = 1;i<n;i++){
        int x,y;
        cin >> x >> y;

        adj[x].push_back(y);
        adj[y].push_back(x);
       }

       dist1[0] = -1; 
       dist2[0] = -1; 

       dfs(a, 0, dist1);
       dfs(b, 0, dist2);

       int ans  = 0;
       for(int i = 1;i<=n;i++){
        if(dist1[i] < dist2[i]){
            ans = max(ans, dist2[i]-1);
        }
       }

       cout << ans << endl;

    } 

    signed main() 
    {   
        int t = 1;

        for(int i = 1;i<=t;i++){
            solve();
        }
        return 0;
    } 

     


Measured memory_bytes: 10368
import sys
input = sys.stdin.buffer.readline

import heapq
INF = 10**18
def dijkstra_heap(s, edge, n):
    d = [INF] * n
    used = [True] * n #True: not used
    d[s] = 0
    used[s] = False
    edgelist = []
    for e in edge[s]:
        heapq.heappush(edgelist,e)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        d[v] = minedge[0]
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v],e[1]))
    return d

def main():
    n, m, s, t = map(int, input().split())
    s -= 1
    t -= 1
    edge1 = [[] for _ in range(n)]
    edge2 = [[] for _ in range(n)]
    for i in range(m):
        u, v, a, b = map(int, input().split())
        u, v = u-1, v-1
        edge1[u].append((a, v))
        edge1[v].append((a, u))
        edge2[u].append((b, v))
        edge2[v].append((b, u))

    d1 = dijkstra_heap(s, edge1, n)
    d2 = dijkstra_heap(t, edge2, n)
    #print(d1)
    #print(d2)
    C = [0]*n
    for i in range(n):
        C[i] = (d1[i]+d2[i], i)
    heapq.heapify(C)
    cur = -1
    for i in range(n):
        if cur < i:
            while C:
                x, t = heapq.heappop(C)
                if t >= i:
                    cur = t
                    break
        #print(cur)
        print(10**15-x)

if __name__ == '__main__':
    main()

Measured memory_bytes: 90200
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define sz(x) int(x.size())

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 double PI=3.14159265358979323846;

int mod = 1e9+7;
int INF = 1e9+7;
// const long long INF = 1LL<<60;


int main(){
  int h1, m1, h2, m2, K;
  cin >> h1 >> m1 >> h2 >> m2 >> K;
  int f = h1 * 60 + m1;
  int s = h2 * 60 + m2;
  int diff = s - f;

  int ans = diff - K;
  ans = max(ans, 0);

  cout << ans << endl;

  
  return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <iomanip>
//#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

//#include <cv.h>
//#include <highgui.h>
#include <stdlib.h>
#include <string>

const int MAX_N = 100050;
int N, K;
int omote[MAX_N];

int main(int argc, char **argv) {
    std::cin >> N >> K;
    
    int num = 0;
    int coeff = 1;
    for (int i = N; 1 <= i; i--) {
        while (i * coeff < K) {
            coeff = coeff * 2;
            num++;
        }
        omote[i] = num;
    }

    double ret = 0.0;
    for (int i = 1; i <= N; i++) {
        ret = ret + pow(0.5, omote[i]);
    }

    std::cout << std::setprecision(15) << ret / N << std::endl;


    return 0;
}


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

#define int long long
pair<int,int> b[55][55];

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

  int a[n+1];

  for(int i= 0;i<n;i++){
    cin >> a[i];

    for(int j = 1;j<=a[i];j++){
      cin >> b[i][j].first >> b[i][j].second ;
      b[i][j].first--;
    }
  }
    int ans = 0;
  for(int i = 0; i<(1<<n) ;i++){
    bool flag = true;
    for(int j = 0;j<n;j++){
      if(i&(1<<j)){
        for(int k = 1;k<=a[j] ; k++){
          if(b[j][k].second != (bool)(i&(1<<b[j][k].first)))flag = false;
        }
    }
    }
          if(flag) ans = max(ans, (int)__builtin_popcount(i));
  
    }

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





Measured memory_bytes: 256
#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;

const int MOD = 1000000007;

ll gcd(ll a, ll b) {
    return b ? gcd(b, a % b) : a;
}

int main() {
    int N;
    cin >> N;
    vector<ll> a(N);
    rep(i, N) cin >> a[i];

    ll ans = a[0];
    rep(i, N) ans = gcd(ans, a[i]);
    cout << ans << endl;
}

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

factors = [0] * (N + 1)

for i in range(2, N + 1):
	if factors[i] == 0:
		for j in range(i, N + 1, i):
			factors[j] = i

total = 1

for i in range(2, N + 1):
	table = {}
	j = i
	while j > 1:
		f = factors[j]
		if f in table:
			table[f] += 1
		else:
			table[f] = 1
		
		j //= f
	count = 1
	for c in table.values():
		count *= (c + 1)
	total += i * count

print(total)


Measured memory_bytes: 146684
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * (B / gcd(A, B));
}

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


int main(){
    ll n; cin >> n;
    vector<ll> t(n);
    rep(i, n) cin >> t[i];
    ll ans = 1;
    rep(i, n){
        ans = lcm(ans, t[i]);
        //cout << ans << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<string>
#include <iomanip>
#include<deque>
#include<queue>
#include<stack>
#include<set>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e8;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

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

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int a, b;
	cin >> a >> b;

	cout << max(0, a - 2 * b) << endl;

	return 0;
}

Measured memory_bytes: 256
a, b, C =map(float,input().split())
import math
sinC = math.sin(math.radians(C))
S = a*b*sinC*0.5
c = (a**2 + b**2 -2*a*b*math.cos(math.radians(C)))**0.5
L = a+b+c
h = S*2/a
print(S)
print(L)
print(h)


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

int main(){
    string s;
    cin >> s;
    cout << s[0] << s[1] << s[2] << endl;
    return 0;
}

Measured memory_bytes: 3600
<?php
    list($s, $t) = explode(" ", trim(fgets(STDIN)));
    list($a, $b) = explode(" ", trim(fgets(STDIN)));
    $u = trim(fgets(STDIN));
    if($s == $u){
        $a--;
    }else{
        $b--;
    }
    echo $a." ".$b;
?>

Measured memory_bytes: 4856
package main

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

var sc *bufio.Scanner

func nextString() string {
	sc.Scan()
	i := sc.Text()
	return i
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

type Stack struct {
	s   [200]int
	top int
}

func (a *Stack) push(x int) {
	a.top++
	a.s[a.top] = x
}

func (a *Stack) pop() (int, bool) {
	if a.isEmpty() {
		return -1, false
	}
	a.top--
	return a.s[a.top+1], true
}

func (a *Stack) isEmpty() bool {
	return a.top == 0
}

func main() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Scan()
	s := sc.Text()
	a := strings.Split(s, " ")
	stack := new(Stack)
	var v1, v2 int
	var flag1, flag2 bool
	for _, v := range a {
		if v == "+" {
			v1, flag1 = stack.pop()
			v2, flag2 = stack.pop()
			if flag1 && flag2 {
				stack.push(v1 + v2)
			} else {
				fmt.Println("error")
				break
			}
		} else if v == "-" {
			v1, flag1 = stack.pop()
			v2, flag2 = stack.pop()
			if flag1 && flag2 {
				stack.push(v2 - v1)
			} else {
				fmt.Println("error")
				break
			}
		} else if v == "*" {
			v1, flag1 = stack.pop()
			v2, flag2 = stack.pop()
			if flag1 && flag2 {
				stack.push(v1 * v2)
			} else {
				fmt.Println("error")
				break
			}
		} else if v == "/" {
			v1, flag1 = stack.pop()
			v2, flag2 = stack.pop()
			if flag1 && flag2 {
				stack.push(v2 / v1)
			} else {
				fmt.Println("error")
				break
			}
		} else {
			num, _ := strconv.Atoi(v)
			stack.push(num)
		}
	}
	fmt.Println(stack.s[1])
}



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

int main()
{
int a[10],k;
for(int i=0;i<10;i++){
	cin>>a[i];
}

for(int j=0;j<9;j++){
	for(int i=j+1;i<10;i++){
		if(a[j]<a[i]){
		k=a[j];
		a[j]=a[i];
		a[i]=k;}
	}
	
}

for(int i=0;i<3;i++){
	cout<<a[i]<<endl;
}




return 0;
}

Measured memory_bytes: 1160
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		int n = int.Parse(Console.ReadLine());
		string s = Console.ReadLine();
		bool[] true1 = new bool[10];
    bool[] true2 = new bool[100];
    bool[] true3 = new bool[1000];
    int answer = 0;

    for(int i = n-1; i >= 0; i--)
    {
      for(int j = 0; j <= 99; j++)
      {
        if(true2[j])
        {
          true3[(int)(s[i]-'0')*100+j] = true;
        }
      }

      for(int j = 0; j <= 9; j++)
      {
        if(true1[j])
        {
          true2[(int)(s[i]-'0')*10+j] = true;
        }
      }

      true1[(int)(s[i]-'0')] = true;
    }

    for(int i = 0; i <= 999; i++)
    {
      if(true3[i]) answer++;
    }

		Console.WriteLine(answer);
	}
}

Measured memory_bytes: 13140
a,b,c,d = map(int,input())

if a==2:
  e=1
else:
    e=0
    
if b==2:
  f=1
else:
    f=0
  
if c==2:
  g=1
else:
    g=0
    
if d==2:
  h=1
else:
    h=0
  
print(e+f+g+h)
  

Measured memory_bytes: 2940
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<climits>
#include<map>
#define ll long long
using namespace std;
int main() {
	ll x, y, z;
	cin >> x >> y >> z;
	cout << (x - z) / (y + z) << endl;
}

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

int isLoadble(int w[], int n, int k, int p){
  int tmp=0,numTrack=1;
  for (int i=0; i<n; i++){
    if (w[i]>p) return 0;
    if (tmp+w[i]>p){
      tmp=0; numTrack++;
      if (numTrack>k) return 0;
    }
    tmp += w[i];
//    cout << "   " << tmp << " " << numTrack << endl;
  }
  return numTrack<=k;
}

int main(void){
  int w[100000];
  int n,k;
  long long pOK, pNG;
  
  cin >> n >> k;
  pOK=0;
  for (int i=0; i<n; i++){
    cin >> w[i];
    pOK += w[i];
  }
  pNG = 0;
  while (pOK-pNG>=2){
    int pMid = (pOK+pNG)/2;
//    cout << pNG << " to " << pOK<< "->" << pMid << endl;
    if (isLoadble(w,n,k,pMid)){
      pOK = pMid;
//      cout << " OK" << endl;
    } else {
      pNG = pMid;
//      cout << " NG" << endl;
    }
  }
  cout << pOK << endl;
  return 0;
}



Measured memory_bytes: 3488
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

typedef long long ll;
typedef long double ld;

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

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

  // Brute force method
  // int cnt = 0;
  // for (int i = 0; i < n + m; ++i) {
  //   for (int j = 0; j < n + m; ++j) {
  //     if (i == j) continue;
  //     if ((i < n && j < n) || (i >= n && j >= n)) {
  //       ++cnt;
  //     }
  //   }
  // }
  // cout << cnt / 2;

  // Combinatorics method
  cout << n * (n - 1) / 2 + m * (m - 1) / 2;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=1e6+5;
map<pii,bool> M,calc;
int main() {
	std::vector<pii> V;
	std::vector<int> tot(10);
    ll n,m,k;cin>>n>>m>>k;
    for(int j=1;j<=k;j++) {
    	int y,x;cin>>y>>x;
    	M[{y,x}]=true;
    	V.emplace_back(y,x);
    }
    static int dy[]={1,1,1,0,-1,-1,-1,0,0};
    static int dx[]={-1,0,1,1,1,0,-1,-1,0};
    ll sum=(n-2)*(m-2);
    auto cal= [&](int y,int x) {
    	if(calc[{y,x}]) return;
    	if(y<=1||y>=n||x<=1||x>=m) return;
    	int cnt=0;
    	for(int i=0;i<9;i++) {
    		int ny=y+dy[i];
    		int nx=x+dx[i];
    		if(M[{ny,nx}]) cnt++;
    	}
    	calc[{y,x}]=1;
    	tot[cnt]++;
    };
    for(auto poi:V) {
    	for(int i=0;i<9;i++) {
    		int ny=poi.first+dy[i];
    		int nx=poi.second+dx[i];
    		cal(ny,nx);
    	}
    }
    for(int i=1;i<=9;i++) sum-=tot[i];
    cout<<sum<<endl;
    for(int i=1;i<=9;i++) cout<<tot[i]<<endl;
    return 0;
}

Measured memory_bytes: 216568
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const int INF = 1 << 28;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int main() {
    int n;
    cin >> n;
    vi a(n);
    map<int, int> ma;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        ma[a[i]]++;
    }

    double dp[n + 2][n + 2][n + 2]; // 3, 2, 1 sushies left on each dish
    for (int i = 0; i <= n + 1; ++i) {
        for (int j = 0; j <= n + 1; ++j) {
            for (int k = 0; k <= n + 1; ++k) {
                if (i == 0 && j == 0 && k == 0)
                    continue;
                double exp = double(n) / double(i + j + k);
                dp[i][j][k] = exp;
                if (i != 0)
                    dp[i][j][k] += double(i) / double(i + j + k) * dp[i - 1][j + 1][k];
                if (j != 0)
                    dp[i][j][k] += double(j) / double(i + j + k) * dp[i][j - 1][k + 1];
                if (k != 0)
                    dp[i][j][k] += double(k) / double(i + j + k) * dp[i][j][k - 1];
            }
        }
    }
    cout << fixed << setprecision(9) << dp[ma[3]][ma[2]][ma[1]] << "\n";

    return 0;
}

Measured memory_bytes: 215424
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>

using namespace std;

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

using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int k , x;
    cin >> k >> x;
    if (500 * k >= x) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    int[] num = new int[100002];
    String[] S = sc.nextLine().split(" ");
    for(int i = 0; i < N; i++){
      int n = Integer.parseInt(S[i]);
      num[n]++;
      num[n+1]++;
      num[n+2]++;
    }
    
    int ans = 0;
    for(int i = 0; i < 100002; i++){
      ans = num[i] > ans ? num[i] : ans;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 48300
#include <iostream>
#include <algorithm>
#include <climits>
#define ll long long

using namespace std;

const int NMAX = 100005;
ll h[NMAX], d[NMAX];
ll poz, n, k;

int main()
{
    int i;
    cin >> n >> k >> h[1]; h[0] = INT_MAX;
    for(i = 2; i <= n; i++) {
        cin >> h[i];
        d[i] = INT_MAX;
        int ok = 0;
        for(int j = 1; j <= k && i >= j; j++) {
            int x = abs(h[i] - h[i - j]);
            d[i] = min(d[i], d[i - j] + x);
        }
    }
    cout << d[n];
    return 0;
}


Measured memory_bytes: 5180
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s1 ,s2 , s3 , s ;
    cin>>s1>>s2>>s3;
    vector<char>v;
    v.push_back(s1[0]-32);
    v.push_back(s2[0]-32);
    v.push_back(s3[0]-32);
    cout<<v[0]<<v[1]<<v[2]<<endl;
}

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

int main() {
  int a, b;
  cin >> a >> b;
  int c = a + b;
  if (c % 2 == 1) {
    cout << "IMPOSSIBLE" << endl;
  }
  else {
    cout << c / 2 << endl;
  }
}

Measured memory_bytes: 256
S = [i for i in input()]
T = [j for j in input()] 

x = sorted(S)
y = sorted(T)
i = 0

if x == y:
  while i <= len(S):
    O = S.copy()
    S.pop()
    S.insert(0,O[-1])
    i += 1
    if S == T:
      print("Yes")
      break
  else:
    print("No")
else:
  print("No")


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

using namespace std;

int main()
{
    string S,T,U;
    int A,B;
    cin >> S >> T >> A >> B >> U;
    if(S == U){
        cout<<A-1<<" "<<B<<endl;
    }else if(T == U){
        cout<<A<<" "<<B-1<<endl;
    }

    return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define MAX 114514
vector<int> G[MAX];
map<int,int> M[MAX];
int h[MAX];
int n,k,ans;
int dfs2(int v,int p){
  int res=0;
  for(int u:G[v]) res=max(res,dfs2(u,v));
  if(p&&res>=k-1){
    ans++;
    return 0;
  }
  return h[v]=res+1;
}
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  cin>>n>>k;
  int a[n];
  for(int i=0;i<n;i++) cin>>a[i];
  for(int i=1;i<n;i++){
    a[i]--;
    G[a[i]].push_back(i);
  }
  ans=(a[0]!=1);
  dfs2(0,0);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 17664
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

pub fn bsearch<F>(ok: i64, ng: i64, pred: F) -> Option<i64>
where
    F: Fn(i64) -> bool,
{
    let orig_ok = ok;
    let mut ok = ok;
    let mut ng = ng;
    while (ok - ng).abs() > 1 {
        let mid = (ok + ng) / 2;
        if pred(mid) {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    if ok == orig_ok {
        None
    } else {
        Some(ok)
    }
}

fn main() {
    input! {
        n: usize, k: usize, c: usize,
        s: Chars
    };

    let mut forward_days = Vec::new();
    let mut last_ng_day = -1;
    for i in 0..n {
        if s[i] == 'x' {
            continue;
        }
        if i as isize <= last_ng_day {
            continue;
        }
        forward_days.push(i);
        last_ng_day = (i + c) as isize;
    }
    let mut backward_days = Vec::new();
    let mut last_ng_day = n as isize;
    for i in (0..n).rev() {
        if s[i] == 'x' {
            continue;
        }
        if i as isize >= last_ng_day {
            continue;
        }
        backward_days.push(i);
        last_ng_day = i as isize - c as isize;
    }

    for i in 0..n {
        let li = bsearch(-1, forward_days.len() as i64, |x| {
            let x = x as usize;
            i > forward_days[x]
        });
        let lc = if let Some(li) = li { li + 1 } else { 0 };
        let ri = bsearch(-1, backward_days.len() as i64, |x| {
            let x = x as usize;
            i < backward_days[x]
        });
        let rc = if let Some(ri) = ri { ri + 1 } else { 0 };
        let c = lc + rc
            - match (li, ri) {
                (Some(li), Some(ri)) => {
                    let l = forward_days[li as usize];
                    let r = backward_days[ri as usize];
                    if r - l > c {
                        0
                    } else {
                        -1
                    }
                }
                _ => 0,
            };
        if c < k as i64 {
            println!("{}", i + 1);
        }
    }
}


Measured memory_bytes: 6196
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<math.h>
#include<string>
#include<stack>

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

using namespace std;

string str;

void solve() {
	stack<char> sta;
	rep(i,str.size()) {
		if(str[i]=='('||str[i]=='[') sta.push(str[i]);
		if(str[i]==')') {
			if(sta.empty()) {
				cout<<"no"<<endl;
				return;
			}
			if(sta.top()!='(') {
				cout<<"no"<<endl;
				//cout<<i<<endl;
				return;
			}
			else {
				sta.pop();
			}
		}
		if(str[i]==']') {
			if(sta.empty()) {
				cout<<"no"<<endl;
				return;
			}
			if(sta.top()!='[') {
				cout<<"no"<<endl;
				//cout<<i<<endl;
				return;
			}
			else {
				sta.pop();
			}
		}
	}
	if(sta.empty()) {
		cout<<"yes"<<endl;
	}
	else
	{
		cout<<"no"<<endl;
	}

}

int main() {
	while(getline(cin,str)) {
		if(str==".") return 0;
		solve();
	}

	return 0;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/arc087_a.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N;
  cin >> N;

  vector<ll> c(N);
  rep(i, N) { cin >> c[i]; }

  ll ans = 0;
  map<ll, ll> m;
  rep(i, N) {
    if (m[c[i]] >= c[i]) {
      ans++;
    } else {
      m[c[i]]++;
    }
  }
  for (auto p : m) {
    if (p.first > p.second) {
      ans += p.second;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 10024
# ABC076c
import sys
import re
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

ss = input()[:-1].replace('?', '.')
t = input()[:-1]

ans = []
for i in range(len(ss) - len(t) + 1):
    m = re.match(ss[i:i+len(t)], t)
    if (m != None):
        ans.append(ss[:i] + t + ss[i + len(t):])
if (len(ans) == 0):
    print('UNRESTORABLE')
    exit()
for i in range(len(ans)):
    ans[i] = ans[i].replace('.', 'a')
ans.sort()
print(ans[0])

Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
using ll = long long;
#define pi 3.1415926
 
 
int main(){
    int a, b;
    cin >> a >> b;
    if((a + b)%2 == 0)
        cout << (a + b) / 2;
    else
        cout << "IMPOSSIBLE";
    

}

Measured memory_bytes: 256
from bisect import bisect_right as br
N = int(input())
A = [int(a) for a in input().split()]
B = [int(a) for a in input().split()]
s, t = 0, 0
for i in range(N):
    s ^= A[i]
    t ^= B[i]
ans = (s ^ t) * (N % 2)
for k in range(1, 29):
    m = (1<<k) - 1
    AA = sorted([a & m for a in A])
    BB = sorted([a & m for a in B])[::-1]
    m += 1
    i, j = 0, 0
    while i < N and AA[i] + BB[j] < m:
        i += 1
    s = 0
    while i < N:
        while j < N and AA[i] + BB[j] >= m:
            j += 1
        s += j
        i += 1
    ans ^= (s % 2) << k
print(ans)

Measured memory_bytes: 142896
n=int(input());score=[list(map(lambda x:int(x)-1,input().split())) for _ in range(int(n*(n-1)/2))];points= [0]*n
for a,b,c,d in score: 
    if c>d:points[a]+=3 
    elif c<d:points[b]+=3 
    else:points[a]+=1;points[b]+=1
rank=sorted(points,reverse=True)
for p in points:print(rank.index(p)+1)

Measured memory_bytes: 7500
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long k = sc.nextLong();
        Set<Long> s = new HashSet<>();

        long min = n;
        while (!s.contains(n)) {
            if (n % k == 0) {
                min = 0;
                break;
            }

            s.add(n);
            if (n > k) n = n % k;
            else n = Math.abs(n-k);
            min = Math.min(min, n);
        }

        System.out.println(min);
    }
}

Measured memory_bytes: 22736
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
// #define int ll
using namespace std;
const int INF (1 << 30);
const ll LLINF (1LL << 55LL);
const int MOD = 1000000007;
const int MAX = 510000;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll h,w,a,b;
    cin>>h>>w>>a>>b;
    rep(i,h){
        if(i<h-b){
            rep(j,w){
                if(j<a) cout<<1;
                else cout<<0;
            }
        }
        else{
            rep(j,w){
                if(j<a) cout<<0;
                else cout<<1;
            }
        }
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int N, K;
  cin >> N >> K;
  double ans = 0.000000000000;
  for(int i=1; i<=min(N, K-1); i++){
    int v = i;
    int times = 0;
    int denom = 1;
    while(v < K){
      v *= 2;
      times++;
      denom *= 2;
    }
    ans += (double) (double)1.0/(double)denom;
//    cout << ans << endl;
  }
  if(N >= K) ans += (double)(N-K+1);
  ans /= (double)N;
  printf("%.10f\n", ans);
}

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

signed main(){
	int N; cin>>N;
	set<string> se;
	for(int i=0;i<N;i++){
		string S; cin>>S;
		se.insert(S);
	}
	cout<<se.size()<<endl;
}

Measured memory_bytes: 19256
#include <bits/stdc++.h>
#define ll long long
#define INF 9999999999999LL
#define MAXN 2005
using namespace std;
ll n,sum,a;
bitset <MAXN*MAXN> bs;
int main(){
    bs[0]=1;

    cin>>n;
    for (int i=0; i<n; i++){
        cin>>a;
        sum+=a;
        bs|=bs<<a;    
    }

    for (int i=(sum+1)/2; i<=sum; i++)
    if (bs[i]) { cout<<i<<endl; return 0; }
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
int n,a[55],mx,p;

void prt(int x,int y){
	printf("%d %d\n%d %d\n",x,y,x,y);
}
int main(){
	cin>>n; for (int i=1;i<=n;++i) cin>>a[i], mx=max(mx,abs(a[i]));
	for (p=1;abs(a[p])!=mx;++p);
	printf("%d\n",n*2);
	if (a[p]>0){
		prt(p,1);
		for (int i=1;i<n;++i) prt(i,i+1);
	}else{
		prt(p,n);
		for (int i=n-1;i>0;--i) prt(i+1,i);
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
int n;
char s[10];
int main()
{
	scanf("%s",s+1); n=strlen(s+1);
	for (int i=1;i<=n;i++) if (s[i]=='7') {printf("Yes\n"); return 0;}
	printf("No\n");
return 0;
}

Measured memory_bytes: 3684
#include <iostream>

int main (void)
{
	// variables for main process
	register unsigned int maxloc_1st;
	register unsigned int maxval_1st;
	register unsigned int maxval_2nd;
	register unsigned int val_sequence;
	static   unsigned int len_sequence;

	// STEP.01
	// read out the given data
	// (the length of the given sequence)
	std::cin >> len_sequence;

	// STEP.02
	// initialize the variable to calculate the answer of this task
	maxval_1st = 0U;
	maxval_2nd = 0U;

	// STEP.03
	// read out the given data
	// (the values of the given sequence)
	// calculate the answer of this task
	for (register unsigned int itr = 0; itr < len_sequence; itr++)
	{
		// read out the given data
		std::cin >> val_sequence;

		// calculate the answer of this task
		if (maxval_1st < val_sequence)
		{
			maxval_2nd = maxval_1st;
			maxval_1st = val_sequence;
			maxloc_1st = itr;
		}
		else if (maxval_2nd < val_sequence)
		{ maxval_2nd = val_sequence; }
		else
		{ continue; }
	}

	// STEP.04
	// output the answer of this task
	for (register unsigned int itr = 0; itr < len_sequence; itr++)
	{
		if (itr == maxloc_1st) { std::cout << maxval_2nd << std::endl; }
		else                   { std::cout << maxval_1st << std::endl; }
	}

	// STEP.END
	return EXIT_SUCCESS;
}

Measured memory_bytes: 1664
#include<iostream>
using namespace std;
int main(){
  int a[3],max=0,maxind=0,sum=0;
  cin >> a[0] >> a[1] >> a[2];
  for (int i=0;i<3;i++){
    if (max < a[i]){
      max = a[i];
      maxind = i;
    }
    sum += a[i];
  }
  if (a[maxind] == sum-a[maxind]){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<cstdint>
#include<bits/stdc++.h>
#include<queue>
#include<set>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for(int i = n-1; i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define INF bit(60)
#define pb push_back
#define mod 1000000007

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

using namespace std;
using uif=uint_fast64_t;
using ll=long long int;

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mod;a=1ll*a*a%mod;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


#define FACSIZE 2002

ll invfac[FACSIZE];
ll fac[FACSIZE];

ll mod_pow(ll ,ll );
ll mod_add(ll ,ll );
ll mod_mul(ll ,ll );
ll mod_div(ll ,ll );
void make_fact(ll );
void make_invfact(ll );



int main(void){

  ll n;
  cin>>n;

  double ans;

  vector<ll> v(n);
  priority_queue<double,vector<double>,greater<double>> que;

  rep(i,n){
    cin>>v[i];
    que.push(v[i]);
  } 

  while(que.size()>1){

    double a,b,x;
    a=que.top();
    que.pop();
    b=que.top();
    que.pop();

    x=(a+b)/2;

    que.push(x);

  }

  cout << que.top() << endl;


  return 0;

}

ll mod_pow(ll x,ll r){
  if(r==0) return 1;
  else if(r==1) return x%mod;
  else if(r%2==0){
    ll t=mod_pow(x,r/2)%mod;
    return t*t %mod;
  } 
  else{
    ll t=mod_pow(x,r/2)%mod;
    ll k= t*t %mod;
    return k*x%mod;
  } 
}
ll mod_add(ll a,ll b){
  return (a+b)%mod;
}

ll mod_mul(ll a,ll b){
  return (a*b)%mod;
}

ll mod_div(ll a,ll b){
  return mod_mul(a,mod_pow(b,mod-2));
}

void make_fact(ll n){
  fac[0]=1;
  rep(i,n){
    fac[i+1]=mod_mul(fac[i],i+1);
  }  
}

void make_invfact(ll n){
  invfac[n]= mod_pow( fac[n] ,mod-2);
  for(int i=n-1;i>=0;i--){
    invfac[i]=mod_mul(invfac[i+1],i+1);
  }

}

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

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    int n,m;
    bool ans = false;
    cin >> n >> m;
    vector<string> a(n);
    vector<string> b(m);

    for (int i=0; i<n; i++) cin >> a[i];
    for (int i=0; i<m; i++) cin >> b[i];

    for (int i=0; i<n-m+1; i++) {
        for(int j=0; j<n-m+1; j++) {

            bool f = true;
            for (int k=0; k<m; k++) {
                for (int l=0; l<m; l++) {
                    if (a[i+k][j+l] != b[k][l]) f = false;
                }
            }

            if (f) ans = true;
        }
    }

    cout << (ans? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <iostream>

struct Vector {
        static const int VECSIZE = 500000 + 10;
        int A[VECSIZE];
        int top = -1;

        void pushBack(int x) {
                A[++top] = x;
        }

        void dump() {
                if (!empty()) {
                        for (int iter = 0; iter <= top; ++iter) {
                                if (iter) std::cout << " ";
                                std::cout << A[iter];
                        }
                }
                std::cout << std::endl;
        }

        void clear() {
                top = -1;
        }

        bool empty() {
                return top == -1;
        }
};

Vector arrays[1000 + 1];

int main()
{
        int n, q;
        std::cin >> n >> q;
        while (q--) {
                int op;
                std::cin >> op;
                if (op == 0) {
                        // pushBack
                        int t, x;
                        std::cin >> t >> x;
                        arrays[t].pushBack(x);
                } else if (op == 1) {
                        // dump
                        int i;
                        std::cin >> i;
                        arrays[i].dump();
                } else {
                        // clear
                        int i;
                        std::cin >> i;
                        arrays[i].clear();
                }
        }

        return 0;
}


Measured memory_bytes: 9044
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define all(A) A.begin(),A.end()
typedef long long ll;

const ll MOD = (ll)pow(10,9)+7;

int main(){
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n){
    cin >> a[i];
  }
  ll T1 = 0;
  rep(i,n){
    for(int j=i+1;j<n;j++){
      if(a[i]>a[j]) T1 ++;
    }
  }
  ll T2 = 0;
  rep(i,n){
    rep(j,n){
      if(a[i]>a[j]) T2 ++;
    }
  }
  ll ans = 0;
  ans += T1*k;
  ans %= MOD;
  if(k%2 == 0) ans += (T2*k/2)%MOD*(k-1);
  if(k%2 == 1) ans += (T2*(k-1)/2)%MOD*k;
  ans %= MOD;
  cout << ans << endl;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int a , b , c , d;

 cin >> a >> b >> c >> d;
 if ((a + b) > (c + d)){
  cout << "Left" << endl;
 }

 else if ((a + b) == (c + d)){
  cout << "Balanced" << endl;
 }
  
 else if ((a + b) < (c + d)){
  cout << "Right" << endl;
 } 
}

Measured memory_bytes: 256
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
		int N = nextInt();
		myout(3 * N * N);
	}
	//Method addition frame start




	//Method addition frame end
}


Measured memory_bytes: 32916
import java.io.*;
import java.util.Map;
import java.util.HashMap;
public class Main{

	public static void main(String[] args) {
		// TODO Auto-generated method stub
    int i,j,n=0;
    BufferedReader sca=new BufferedReader(new InputStreamReader(System.in));;
    String yomi,sp[]=new String[2];//0:order 1:name
    try{
    n=Integer.parseInt(sca.readLine());
    }catch(Exception e){
	System.out.println(e);
    }
    HashMap<String,String> dicmap=new HashMap<String,String>(n);
    for(i=0;i<n;i++){
	try{
	sp=(sca.readLine()).split("[\\s]+");
	}catch(Exception e){
	    System.out.println(e);
	}
    	if(sp[0].equals("insert")){
	    dicmap.put(sp[1],sp[1]);
    	}
    	if(sp[0].equals("find")){
    		if(dicmap.containsKey(sp[1])){
    			System.out.println("yes");
    		}else{
    			System.out.println("no");
    		}
    	}
    }
	}

}



Measured memory_bytes: 370424
#include <cstdio>

typedef long long ll;

int main(){

	ll a,b,c,d;	scanf("%lld %lld %lld %lld",&a,&b,&c,&d);

	ll aa=a*c,bb=a*d,cc=b*c,dd=b*d;

	ll max=aa;

	if(max<bb) max=bb;

	if(max<cc) max=cc;

	if(max<dd) max=dd;

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

	return 0;

}

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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> d(N);
  for (int i = 0; i < N; i++) {
    cin >> d[i];
  }

  sort(d.begin(), d.end());

  cout << d[N / 2] - d[(N / 2) - 1] << endl;
}


Measured memory_bytes: 768
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

int a[100000];
int b[100000];
int x,y;

int main() {
  int n;
  scanf("%d",&n);
  int au=-INF,al=INF,bu=-INF,bl=INF;
  REP(i,n) {
    scanf("%d%d",&x,&y);
    a[i]=x+y;
    b[i]=x-y;
    au = max(au,a[i]);
    al = min(al,a[i]);
    bu = max(bu,b[i]);
    bl = min(bl,b[i]);
  }
  // auとalを分け、buとblを分けたい
  // au,bu と al,bl に分ける
  int tmp = 0;
  REP(i,n) {
    tmp = max(tmp, min(
                max(au-a[i], bu-b[i]), // au,bu
                max(a[i]-al, b[i]-bl))); // al,bl
  }
  int ans = tmp;
  // au,bl と al,bu に分ける
  tmp = 0;
  REP(i,n) {
    tmp = max(tmp, min(
                max(au-a[i], b[i]-bl), // au,bl
                max(a[i]-al, bu-b[i]))); // al,bu
  }
  ans = min(ans, tmp);
  printf("%d\n", ans);
}

Measured memory_bytes: 1968