akhauriyash/Code-Regression huggingface dataset:
//Utkarsh.25dec
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
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>
// ordered_set s ; s.order_of_key(val)  no. of elements strictly less than val
// s.find_by_order(i)  itertor to ith element (0 indexed)
typedef vector<vector<ll>> matrix;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=500023;
bool vis[N];
vector <int> adj[N];
void solve()
{
    ll n,k;
    cin>>n>>k;
    vl v;
    rep(i,n)
    {
        ll c;
        cin>>c;
        v.pb(c);
    }
    for(int i=k;i<n;i++)
    {
        if(v[i]>v[i-k])
            cout<<"Yes\n";
        else
            cout<<"No\n";
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    //cin>>T;
    int t=0;
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 17048
package main

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

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	// Code for C - Tsundoku
	var N, M, K int
	fmt.Scan(&N, &M, &K)

	sc.Split(bufio.ScanWords)
	var temp int

	A := make([]int, N+1)
	sumA := make([]int, N+1)
	temp = 0
	for i := 1; i <= N; i++ {
		A[i] = nextInt()
		temp += A[i]
		sumA[i] = temp
	}

	B := make([]int, M+1)
	sumB := make([]int, M+1)
	temp = 0
	for i := 1; i <= M; i++ {
		B[i] = nextInt()
		temp += B[i]
		sumB[i] = temp
	}

	var J int = M
	var max int = 0
	for i := 0; i <= N; i++ {
		if sumA[i] > K {
			break
		}
		for j := J; 0 <= j; j-- {
			if sumA[i]+sumB[j] <= K {
				if J > j {
					J = j
				}

				if max < i+j {
					max = i + j
				}
				break
			} else {
				continue
			}
		}
	}

	fmt.Println(max)
}


Measured memory_bytes: 9544
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<iomanip>
using namespace std;

int main(){
    long long int n,ans=1;
    cin>>n;
    vector<long long int>t(1000000);
    vector<long long int>a(1000000);
    vector<long long int>b(1000000);
    for(long long int i=0;i<n;i++){
        cin>>t[i];
        a[t[i]]++;
    }
    if(a[0]>=2){
        ans=0;
    }
    for(long long int i=1;i<n;i++){
        if(a[i]>2||a[i]==1){
            ans=0;
        }
        else if(a[i]==2){
            ans=(ans*2)%1000000007;
        }
        else{

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


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

int calc(int num){
    int res = 0;
    while(num > 9){
        res += num % 10;
        num /= 10;
    }
    res += num % 10;
    return res;
}

int main(){

    int n, a, b, x;
    int count = 0;
    long res = 0;

    cin >> n >> a >> b;

    for(int i = 1; i <= n; i++){
        int temp = calc(i);
        if(a <= temp && temp <= b){
            res += i;
        }
    }

    cout << res << endl;

}



Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
using namespace std;
int MOD = 1e9 + 7;

int X;
int main() {
	cin >> X;
	int n = 1;
	for (; n < X; n++) {
		if (n * (n + 1) / 2 >= X)break;
	}
	cout << n << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
using ll = long long;
const ll mod = 1000000007;
const ll INF = 100000000000000000LL;
signed main(){
    ll s;
    cin >> s;
    ll v = 1000000000, a, b;
    a = (v - s % v) % v;
    b = (s + a) / v;
    cout << "0 0 1000000000 1 " << a << ' ' << b << endl;
}

Measured memory_bytes: 256
#[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")
    };
}

fn main() {
    input! {
        a: usize,
        b: usize,
        c: usize,
        d: usize,
        e: usize,
        k: usize,
    }
    if e - a > k {
        println!(":(")
    } else {
        println!("Yay!");
    }
}


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

int main() {
  int k, n, c;
  cin >> n >> k;
  vector<vector<int>> a(k, vector<int>(n, 0));
  
  for (int i = 0; i < k; i++) {
    cin >> c;
    for (int j = 0; j < c; j++) {
      int t;
      cin >> t;
      a.at(i).at(t-1) = 1;
    }
  }
  
  int count = 0;
  for (int j = 0; j < n; j++) {
    int sum = 0;
    for (int i = 0; i < k; i++) {
      sum += a.at(i).at(j);
    }
    if (sum == 0) count++;
  }
  cout << count << endl;
  
}


Measured memory_bytes: 3660
#include<iostream>
using namespace std;
int main (){
  int a,b,c,temp;
  cin >> a >> b >> c;
  if (a > b){
    temp = a;
    a = b;
    b = temp;
  }
  if (b > c){
    temp = b;
    b = c;
    c = temp;
  }
  if (a > b){
    temp = a;
    a = b;
    b = temp;
  }
  if (a == 5 && b == 5 && c == 7) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(" ").map(String::toInt)
    val ax = readLine()!!.split(" ").map(String::toInt)
    Math.ceil((n - 1) / (k - 1).toDouble()).let(Double::toInt).let(::println)
}

Measured memory_bytes: 47984
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
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; }
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

ll N, K;

bool check(ll mid, int K, vector<int> A) {
    ll sum = 0;
    for(int i = 0; i < N; i++) {
        sum += (A[i]-1)/mid;
    }
    if(sum > K) return false;
    else return true;
}

int main() {


    cin >> N >> K;
    vector<int> A(N);
    REP(i, N) {
        cin >> A[i];
    }

    ll ok = 1;
    ll ng = 1e9+2;

    while (ng>ok) {

        ll mid = (ok + ng) / 2;

        if(check(mid, K, A)) {
            cerr << "!" << mid << endl;
            ng = mid;
        } else {
            cerr << "?" << mid << endl;
            ok = mid+1;
        }
    }

    cout << ng << endl;
    
    return 0;
}

Measured memory_bytes: 4760
import sys
import math

N = int(input())
X = []
Y = []
for i in range(N):
    x, y = map(int, sys.stdin.readline().split())
    X.append(x)
    Y.append(y)
    
sum = 0

for i in range(N - 1):
    for j in range(i, N):
        sum += math.sqrt((X[i] - X[j]) ** 2 + (Y[i] - Y[j]) ** 2)

ans = sum / (N / 2)

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
int H,W;
cin>>H>>W;
char str[H][W];
for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
        cin>>str[i][j];
    }
}
for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
        cout<<str[i][j];
    }
    cout<<endl;
    for(int j=0;j<W;j++){
        cout<<str[i][j];
    }
    cout<<endl;
}
return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define clr(x,i) memset(x,i,sizeof(x))
using namespace std;
const int N=200005;
const ll mod=1e9+7;
inline int read()
{
    int x=0,f=1; char ch=getchar();
    while(ch<'0'||ch>'9') {if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9') {x=x*10+ch-'0',ch=getchar();}
    return x*f;
}

int main()
{
	double n=read()/3.0;
	printf("%.9lf\n",n*n*n);
}

Measured memory_bytes: 256
# from functools import lru_cache

# @lru_cache
# def grundy(s):
#     if len(s) == 2:
#         return 0
#     gs = set()
#     for i in range(1, len(s) - 1):
#         if s[i - 1] == s[i + 1]:
#             continue
#         gs.add(grundy(s[:i] + s[i + 1:]))
#     for i in range(100):
#         if i not in gs:
#             return not (i == 0)

def win_first(s):
    return ((s[0] == s[-1]) + len(s)) % 2

# def test():
#     for i in range(1000000):
#         s = str(i)
#         for c1, c2 in zip(s[:-1], s[1:]):
#             if c1 == c2:
#                 break
#         else:
#             assert win_first(s) == grundy(s)

def main():
    print("First" if win_first(input()) else "Second")

main()

Measured memory_bytes: 62428
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using iii = pair<ii, int>;
#define vt vector
#define pq priority_queue
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define __lcm(a, b) a * b / __gcd(a, b)
// #define multicase
const int MOD = 1e9 + 7;
const int INF = 2e9;
const int N = 1e5 + 5;

int n, k, q;
int a[N];

void solve() {
    int T = 1;
  #ifdef multicase
    cin >> T;
  #endif
    for(int tc = 1; tc <= T; tc++) {
        cin >> n >> k >> q;
        for(int i = 1; i <= n; i++) {
            a[i] = k;
        }
        for(int i = 1, x; i <= q; i++) {
            cin >> x;
            a[x]++;
        }
        for(int i = 1; i <= n; i++) {
            cout << (a[i] - q <= 0 ? "No\n" : "Yes\n");
        }
    }
}

int main() {

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

    solve();
    
}

Measured memory_bytes: 4084
#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, n) for(ll i = 0; i < (n); ++i)
#define ARRAY_LENGTH(array) sizeof(array)/sizeof(*array)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const int INF = 1000100100;

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

    REP(i, S.length()) {
        if((i == A && S[i] != '-') || (i != A && S[i] == '-')) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}

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

ll dp[410][410]={};



int main(){
  int n;
  cin >> n;
  ll a[n];
  rep(i,n)cin >>a[i];

  for(int i=1;i<n;i++){
    for(int j=0;j<n-i;j++){
      ll tmp=1000000000000000;
      ll sum=0;
      for(int k=j;k<j+i;k++){
        tmp=min(tmp,dp[j][k]+dp[k+1][j+i]);
        sum+=a[k];
      }
      sum+=a[j+i];//a[j]~a[j+i]まで足す
      dp[j][j+i]=tmp+sum;
    }
  } 
  cout << dp[0][n-1] << endl;
}

Measured memory_bytes: 4876
#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
typedef long long ll;
const ll INF = 2147483647;
const ll MOD = 1e9 + 7;
const double EPS = 1e-10;
const double pi = acos(-1);//3.1415926535897932384626433832795028...
const ll SIZE = 2000005;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
ll fac[SIZE], finv[SIZE], inv[SIZE];
vector<ll>dij;
struct edge { ll to, cost; };
vector<vector<edge> >G;
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; }

ll mod_pow(ll a, ll b) {
	ll res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

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 V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T & t, const V & v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T & t, const V & v) {
	for (auto& e : t) fill_v(e, v);
}

template<typename T>
void outp(vector<T>v) {
	for (int i = 0; i < v.size(); ++i) {
		cout << v[i];
		if (i != v.size() - 1) { cout << " "; }
	}
}

double add(double a, double b) {
	if (abs(a + b) < EPS * (abs(a) + abs(b))) { return 0; }
	return a + b;
}

double len(int a, int b, int c, int d) {
	return (double)sqrt((a - c) * (a - c) + (b - d) * (b - d));
}

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

long long lcm(long long a, long long b) {
	long long  g = gcd(a, b);
	return a / g * b;
}

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

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

	cout << endl;
}

Measured memory_bytes: 256
eval'H,W,A,B='+`tr ' ' ,`
M,c,z,X=10**9+7,1,0,W+H-B-2
(H-1).times{c=c*(X-_1)*(-~_1).pow(M-2,M)%M}
(H-A).times{|i|z+=c
c=c*(B+i)*(H+~i)*((X-i)*-~i).pow(M-2,M)%M}
p z%M

Measured memory_bytes: 14336
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int p[100001];
bool a[100002],b[100002];
#define MAX_N 100002
struct UnionFind{
    int data[MAX_N]; 
    void init(int n){memset(data,-1,sizeof(data));}
    int find(int x){return data[x]<0?x:data[x]=find(data[x]);}
    void unite(int x, int y){
        x=find(x);y=find(y);       
        if(x!=y){
            if(data[y]<data[x]) swap(x,y);
            data[x]+=data[y];data[y]=x;
        }
        return;
    } 
    bool same(int x, int y){return (find(x) == find(y));}
    int size(int x){return -data[x];}
};
int main(){
    int n,m;
    cin>>n>>m;
    rep(i,n){
        cin>>p[i];
    }
    UnionFind uf;
    uf.init(n+1);
    int xi,yi;
    rep(i,m){
        cin>>xi>>yi;
        uf.unite(xi,yi);
    }
    int cnt=0;
    FOR(i,1,n+1){
        if(uf.same(p[i-1],i)) ++cnt;
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 1024
package main

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

var sc *bufio.Scanner

func init() {
	// 100MB
	bufsize := 100 * 1024 * 1024
	sc = bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, bufio.MaxScanTokenSize), bufsize)
	sc.Split(bufio.ScanWords)
}
func readInt() int              { return readIntArray(1)[0] }
func readInt2() (int, int)      { a := readIntArray(2); return a[0], a[1] }
func readInt3() (int, int, int) { a := readIntArray(3); return a[0], a[1], a[2] }
func readIntArray(n int) []int {
	s := readStringArray(n)
	a := make([]int, n)
	for i := range a {
		a[i], _ = strconv.Atoi(s[i])
	}
	return a
}
func readString() string            { return readStringArray(1)[0] }
func readString2() (string, string) { a := readStringArray(2); return a[0], a[1] }
func readStringArray(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		a[i] = sc.Text()
	}
	return a
}
func max(ns ...int) int {
	max := ns[0]
	for _, n := range ns {
		if n > max {
			max = n
		}
	}
	return max
}
func min(ns ...int) int {
	min := ns[0]
	for _, n := range ns {
		if n < min {
			min = n
		}
	}
	return min
}
func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	N := readInt()
	X := readIntArray(N)
	min := math.MaxInt64
	for p := 0; p <= 100; p++ {
		var cost int
		for _, x := range X {
			cost += (x - p) * (x - p)
		}
		if cost < min {
			min = cost
		}
	}
	fmt.Println(min)
}


Measured memory_bytes: 640
#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN];
int head,tail,n;

void enqueue(P x){
  Q[tail]=x;
  tail=(tail+1)%LEN;
}

P dequeue(){
  P x=Q[head];
  head=(head+1)%LEN;
  return x;
}

int min(int a,int b){ return  a<b ? a:b; }

int main(){
  int elaps=0,c;
  int i,q;
  P u;
  scanf("%d %d",&n,&q);

  for(i=1;i<=n;i++){
    scanf("%s",Q[i].name);
    scanf("%d",&Q[i].t);
  }
  head=1; tail=n+1;

  while( head != tail ){
    u=dequeue();
    c=min(q,u.t);
    u.t-=c;
    elaps+=c;
    if(u.t>0)enqueue(u);
    else{
      printf("%s %d\n",u.name,elaps);
    }
  }

  return 0;
}


Measured memory_bytes: 11864
#include <iostream>
#include <vector>
#include <set>
using namespace std;

struct UF{
    int par[100000];
    int rank[100000];
    int g[100000];

    void init(int n){
        for(int i=0;i<n;i++){
            par[i]=i;
            rank[i]=0;
            g[i]=1;
        }
    }

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

    void unite(int x, int y){
        x=find(x);
        y=find(y);
        if(x!=y){
            if(rank[x]<rank[y]){
                par[x]=y;
                g[y]+=g[x];
                g[x]=0;
            }else{
                par[y]=x;
                if(rank[x]==rank[y])rank[x]++;
                g[x]+=g[y];
                g[y]=0;
            }
        }
    }

    bool same(int x, int y){
        return find(x)==find(y);
    }
};
int n, m, a[100000], b[100000];
    long long d[100000];
int main(void){
    
    
    UF u;
    
    cin>>n>>m;
    
    u.init(n);
    for(int i=0;i<m;i++){
        cin>>a[i]>>b[i];
        a[i]--;
        b[i]--;
    }
    d[m-1]=(long long)n*(n-1)/2;
    for(int i=m-1;i>0;i--){
        d[i-1]=d[i];
        if(!u.same(a[i], b[i])){
            d[i-1]=d[i]-u.g[u.find(a[i])]*u.g[u.find(b[i])];
        }
        u.unite(a[i], b[i]);
    }
    for(int i=0;i<m;i++){
        cout<<d[i]<<endl;
    }
}


Measured memory_bytes: 4096
n, m=map(int, input().split())
favl=[list(map(int, input().split())) for _ in range(n)]
favset=[set(favl[i][1:favl[i][0]+1]) for i in range(n)]
allfav=favset[0]
for i in range(1, n):
  allfav=allfav & favset[i]
print(len(allfav))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n)cin >> a[i];
  vector<int> b(n);
  rep(i,n)cin >> b[i];
  vector<int> c(n-1);
  rep(i,n-1)cin >> c[i];
  rep(i,n) a[i]--;

  int ans = 0;
  rep(i,n){
    ans += b[a[i]];
  }
  rep(i,n-1){
    if(a[i]+1 == a[i+1])ans += c[a[i]];
  }
  cout << ans <<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	while (1) {
		int a, b, kq;
		char x;
		scanf("%d %c %d", &a, &x, &b);
		switch (x){
		case '?' :
			return 0;
		case '-' :
			kq = a - b;
			break;
		case '+' :
			kq = a + b;
			break;
		case '*' :
			kq = a * b;
			break;
		case '/' :
			kq = a / b;
			break;
		}
		printf("%d\n", kq);
	}
}

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

using ll = long long;
const ll MOD = 1e9 + 7;

int main() {
    int H, W, si, sj, ans = -1;
    cin >> H >> W;
    vector<string> S(H);
    rep(i, H) {
        cin >> S[i];
    }
    rep(a, H) rep(b, W) {
        if (S[a][b] == '#') continue;
        vector<vector<int>> d(H, vector<int>(W, -1));
        queue<vector<int>> q;
        q.push({a, b, 0});
        d[a][b] = 0;
        while (!q.empty()) {
            auto p = q.front();
            q.pop();
            int di[4] = {1, 0, -1, 0}, dj[4] = {0, 1, 0, -1};
            rep(i, 4) {
                int i0 = p[0] + di[i], j0 = p[1] + dj[i];
                if (i0 < 0 || i0 >= H || j0 < 0 || j0 >= W) continue;
                if (d[i0][j0] > -1 || S[i0][j0] == '#') continue;
                d[i0][j0] = p[2] + 1;
                q.push({i0, j0, p[2] + 1});
            }
        }
        rep(i, H) {
            rep(j, W) {
                //cout << d[i][j] << " ";
                ans = max(ans, d[i][j]);
            }
        }
        //cout << endl;
    }
    cout << ans << endl;
}

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

using System.Collections;

class Program
{
    static void Main()
    {
        int[] nmc = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

        int N = nmc[0];
        int M = nmc[1];
        int C = nmc[2];

        var bList = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToList();

        var sourceList = 
            Enumerable.Range(0, N)
            .Select(n => Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray())
            .ToList();

        var ans = sourceList.Count(source => source.Zip(bList, (a, b) => new { a, b }).Sum(itm => itm.a * itm.b) + C > 0);

        Console.WriteLine(ans);

    }
}


Measured memory_bytes: 13652
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <bitset>
#include <iomanip>
 
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main(int argc, const char * argv[]) {
    int K, N; cin >> K >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    sort(A.begin(), A.end());

    int m = 0;
    for (int i = 0; i < N - 1; i++) {
        m = max(m, abs(A[i] - A[i+1]));
    }
    m = max(m, abs(K - A[N-1] + A[0]));
    cout << K - m << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long n,s=0,m;
  cin>>n;
  m=n;
  while(m)
  {
    s=s+m%10;
    m=m/10;
  }
  if(n%s==0)
    cout<<"Yes";
  else
    cout<<"No";
  return 0;
}

Measured memory_bytes: 3576
# include <iostream>
# include <string>
using namespace std;
int main()
{
	int p,n;
	p=0;
	string s; 
	cin>>s;
	n=s.size();
	for(int i=0; i<s.size(); i++)
	{
		if(s[i]!=s[n-1-i])
		{
			p=1;
		}
		if(i<(s.size()-1)/2)
		{
		if(s[i]!=s[(s.size()-1)/2-1-i])
		{
			p=1;
		}
	}
	if(i>=(s.size()+3)/2-1)
	{
	if(s[i]!=s[n-1-i])
	{
	p=1;	
	}
}
	}
	if(p==1)
	{
		cout<<"No";
	}
	else
	{
		cout<<"Yes";
	}
}

Measured memory_bytes: 3568
n,m = map(int, raw_input().split())

def g(u,parent):
    if parent[u]!= u:
        parent[u] = g(parent[u], parent)
    return parent[u]
parent = range(n+1)
for _ in range(m):
    u,v = map(int, raw_input().split())
    pu,pv = g(u,parent), g(v,parent)
    if pu!= pv:
        parent[pu] = pv

ans = 0
for u in range(1, n+1):
    if g(u,parent) == u:
        ans+=1
print ans -1

Measured memory_bytes: 95424
//code by lynmisakura.wish to be accepted!
/****************************/
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<bitset>
#include <climits>
#include<set>
#include<bitset>
using namespace std;
/***************************/
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int, int> pi;
typedef vector<pair<int, int>> vpi;

const long long INF = 1LL << 55;

#define itn int
#define endl '\n'
#define pb push_back
#define mp make_pair
#define ss second
#define ff first
#define dup(x,y) ((x) + (y) - 1)/(y)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)
#define all(x) (x).begin(),(x).end()
#define Rep(n) for(int i = 0;i < n;i++)
#define rep(i,n) for(int i = 0;i < n;i++)
#define rrep(i,n) for(int i = n - 1;i >= 0;i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

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

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

int main(void){
   int n;cin >> n;
   if(n %2 == 0)cout << 0.5 << endl;
   else{
      cout << fixed;
      cout << setprecision(20) << (double)(n+1)/(double)(2*n) << endl;
   }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  int H, W;
  cin >> H >> W;
  vector<string> canvass = {string(W + 2, '.')};
  rep(i, H)
  {
    string s;
    cin >> s;
    s = "." + s + ".";
    canvass.push_back(s);
  }
  canvass.push_back(string(W + 2, '.'));
  bool is_ok = true;
  rep(h, H) rep(w, W)
  {
    if (canvass[h + 1][w + 1] == '.')
      continue;

    if (canvass[h + 2][w + 1] == '.' && canvass[h][w + 1] == '.' && canvass[h + 1][w] == '.' && canvass[h + 1][w + 2] == '.')
      is_ok = false;
  }

  printYesNo(is_ok);
  return 0;
}

Measured memory_bytes: 256
#DPまとめコンテストA問題より
infinity=10**6
N = int(input())
h = list(map(int,input().split()))

dp=[infinity]*N

dp[0]=0

for i in range(N-1):
    if i==0:
        dp[i+1] = dp[i]+abs(h[i+1]-h[i])
    else:
        dp[i+1] = min(dp[i]+abs(h[i+1]-h[i]),dp[i-1]+abs(h[i+1]-h[i-1]))

print(dp[-1])

Measured memory_bytes: 52208
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<iomanip>


using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<vector<ll>> vv;


#define MOD 1000000007
#define INF 1001001001
#define MIN -1001001001
#define rep(i,k,N) for(int i=k;i<N;i++)
#define MP make_pair
#define MT make_tuple //tie,make_tuple は別物
#define PB push_back
#define PF push_front
#define all(x) (x).begin(),(x).end()


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


int main(){
    ll N;
    cin>>N;
    v A(N);
    map<ll,ll> m;
    ll sum = 0;
    rep(i,0,N){
        cin>>A[i];
        m[A[i]]++;
        sum += A[i];
    }
    ll Q;
    cin>>Q;
    v B(Q),C(Q);
    rep(i,0,Q){
        cin>>B[i]>>C[i];
        m[C[i]] += m[B[i]];
        sum += m[B[i]] * (C[i]-B[i]);
        m[B[i]] = 0;
        cout<<sum<<endl;
    }

    return 0;
}

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

using namespace std;

int n;
string s, t;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n >> s >> t;
	for (int i=0; i<n; i++) {
		cout << s[i] << t[i];
	}
	cout << endl;
}

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

long long H, W;

int main(){
  cin >> H >> W;
  if(H == 1 || W == 1) cout << 1 << endl;
  else if(H & 1 && W & 1) cout << (H*W)/2 + 1 << endl;
  else cout << (H*W)/2 << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n, a[200010], answer[200010];
vector<int> E[200010], vec{0};
void dfs(int u, int p) {
	int idx = -1, old = -1;
	if (a[u] > vec.back()) {
		vec.push_back(a[u]);
	} else {
		idx = lower_bound(vec.begin(), vec.end(), a[u]) - vec.begin();
		old = vec[idx];
		vec[idx] = a[u];
	}
	/*
	cout << u << " " << idx << '\n';
	for (int x : vec) {
		cout << x << " ";
	}
	cout << '\n';
	*/
	answer[u] = vec.size();
	for (int v : E[u]) {
		if (v != p) {
			dfs(v, u);
		}
	}
	if (idx == -1) {
		vec.pop_back();
	} else {
		vec[idx] = old;
	}
}
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> a[i];
	}
	for (int i = 1; i <= n - 1; ++i) {
		int u, v;
		cin >> u >> v;
		E[u].push_back(v);
		E[v].push_back(u);
	}
	dfs(1, 1);
	for (int i = 1; i <= n; ++i) {
		cout << answer[i] - 1 << '\n';
	}
}

Measured memory_bytes: 27412
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] lines = line.split("");

		int max = 0;
		int count = 0;
		for(int i = 0; i < lines.length; i++) {
			if(lines[i].equals("A") || lines[i].equals("T") || lines[i].equals("C") || lines[i].equals("G")) {
				count++;
				if(i == lines.length - 1 && max < count) {
					max = count;
				}
			}else {
				if(max < count) {
					max = count;
				}
				count = 0;
			}
		}

		System.out.println(max);
	}

}


Measured memory_bytes: 35784
n=int(input())
l=list(map(int,input().split()))
cnt=0
l.sort()
for i in range(0,n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i]:
                if l[k]<l[i]+l[j]:
                    cnt+=1
print(cnt)

Measured memory_bytes: 9192
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.split(" ").map(Number);
var a=arr[0];
var b=arr[1];
if(a===b){
console.log(a);
return;
}
var x=Math.max(a,b);
var y=Math.min(a,b);
var c=x%y;
for(var i=c;i>=1;i--){
if(x%i==0 && y%i==0)break;
}
console.log(i);

Measured memory_bytes: 8604
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    int x[3];
    x[0]=a+b;
    x[1]=a-b;
    x[2]=a*b;
    sort(x,x+3);
    cout<<x[2]<<endl;
}


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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define RREP0(i, n) for (int i = (n)-1; i >= 0; --i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define RREP1(i, n) for (int i = (n); i >= 1; --i)
#define pow10(n) int(1e##n + n)

#include <boost/multiprecision/cpp_int.hpp>
typedef boost::multiprecision::cpp_int LL;
typedef pair<int, int> P;

const int INTINF = int(1e9) + 1;
const LL LLINF = LL(1e18) + 1;
long double eps = 1.0E-14;

void solve()
{
    int N, P;
    cin >> N >> P;
    int e = 0, o = 0;

    REP0 (i, N)
    {
        int a;
        cin >> a;
        if (a % 2)
            o++;
        else
            e++;
    }

    if (o == 0)
    {
        if (P == 1)
        {
            std::cout << 0 << endl;
        }
        else
        {
            std::cout << (1LL << N) << endl;
        }
        return;
    }

    std::cout << (1LL << (N - 1)) << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(20);
    solve();
    return 0;
}


Measured memory_bytes: 384
for e in iter(input,'0 0'):
 N,M=map(int,e.split())
 k,p=1,0
 S=[int(input()) for _ in[0]*N]
 for d in[int(input())for _ in[0]*M]:
  p+=d if N<=p+d else d+S[p+d]
  if N<=p+1:break
  k+=1
 print(k)


Measured memory_bytes: 5636
N = int(input())
As = list(map(int,input().split()))
Bs = list(map(int,input().split()))
Cs = [0] + list(map(int,input().split()))

score = 0
for i in range(N):
  score += Bs[As[i]-1]
  if i >= 1 and As[i]-1==As[i-1]:
    score += Cs[As[i]-1]
print(score)

Measured memory_bytes: 38256
H, W = map(int, input().split())
S = [list(map(int, input().split())) for i in range(H)]
dp = [[0]*(W) for i in range(H)]

for i in range(H):
  for j in range(W):
    if S[i][j] == 0:
      dp[i][j] = min(dp[i-1][j-1], dp[i-1][j], dp[i][j-1])+1
# print(max([max([max(a) for a in dp])**2]))
print(max([max(a) for a in dp])**2)



Measured memory_bytes: 55188
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstring>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
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; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  ll k;
  cin >> n >> k;
  vector<ll> v(1e5+1);
  rep(i, n) {
    int a, b;
    cin >> a >> b;
    v[a] += b;
  }
  ll sum = 0;
  rep (i, 1e5+1) {
    sum += v[i];
    if (sum >= k) {
      cout << i << endl;
      break;
    }
  }
  return 0;
}

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

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

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

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

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

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


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int res = 0;
  int tmp = 0;
  for (int i = 0; i < 3; ++i) {
    if(s[i] == 'R') tmp++;
    else{
      chmax(res, tmp);
      tmp = 0;
    }
  }
  chmax(res, tmp);

  cout << res << endl;
}


Measured memory_bytes: 3640
def main():
    import sys
    def input():
        return sys.stdin.readline()[:-1]
    X=list(map(int,input().split()))
    A=list(map(int,input().split()))
    N=X[0]
    K=X[1]
    j=0
    for i in range(N-K):
        j=i+K+1
        if A[i]<A[j-1]:
            print("Yes")
        else:
            print("No")





if __name__ == '__main__':
    main()

Measured memory_bytes: 31536
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;


int main(void){
  int n,l,r,mid,k,al,ar;
  string s;
  
  cin >> n;
  
  cout << 0 << endl;
  cin >> s;
  if (s=="Vacant") return 0;
  if (s=="Male") al=ar=0;
  else al=ar=1;
  
  l=0;
  r=n;
  while (r-l>1){
    mid=(l+r)/2;
    cout << mid << endl;
    cin >> s;
    if (s=="Vacant") return 0;
    if (s=="Male") k=0;
    else k=1;
    
    if ((al+k+mid-l)%2==1){
      r=mid;
      ar=k;
    }else{
      l=mid;
      al=k;
    }
  }
  
  cout << l << endl;
  cin >> s;
  if (s=="Vacant") return 0;
  
  return 0;
}

Measured memory_bytes: 852
#include<iostream>
#include<string>
using namespace std;
int main()
{
	char c[6];
	int i;
	for(i=0;i<6;i++)
	{
		cin>>c[i];
	}
	if(c[0]==c[5]&&c[1]==c[4]&&c[2]==c[3])
	{
		cout<<"YES"<<endl;
	}
	else
	{
		cout<<"NO"<<endl;
	}
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, n) for (int i = (a); i < (n); i++)
#define repb(i, a, n) for (int i = (n); i >= (a); i--)
#define all(x) x.begin(), x.end()
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define pb push_back
#define mp make_pair
#define fir first
#define sec second

void Main() {
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, 0, N) { cin >> A[i]; }
    vector<int> L(N + 1), R(N + 1);
    L[0] = 0, R[N] = 0;
    rep(i, 0, N) { L[i + 1] = __gcd(A[i], L[i]); }
    repb(i, 0, N - 1) { R[i] = __gcd(A[i], R[i + 1]); }
    int max1 = 0;
    rep(i, 0, N) { max1 = max(max1, __gcd(L[i], R[i + 1])); }
    cout << max1 << endl;
}

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(12) << endl;
    Main();
    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
  int M, N;
  cin >> M >> N;
  for (int i = 0; i < N; i++) {
    int A;
    cin >> A;
    M -= A;
  }
  if (M < 0) {
    cout << -1 << endl;
  } else {
    cout << M << endl;
  }
  return 0;
}

Measured memory_bytes: 3644
class Wall():

    def __init__(self, x, y, r):
        self.x = x
        self.y = y
        self.r = r

    def sign(self, x, y):
        if (x-self.x)*(x-self.x) + (y-self.y)*(y-self.y) - self.r*self.r > 0:
            return 1
        else:
            return -1

def isVisible(x1, y1, x2, y2, wall):

    if wall.sign(x1, y1) == 1 and wall.sign(x2, y2) == 1:

        x0 = wall.x
        y0 = wall.y
        r0 = wall.r

        la = y2-y1
        lb = -(x2-x1)
        lc = -x1*(y2-y1) + y1*(x2-x1)

        ma = x2-x1
        mb = y2-y1
        mc = -(x2-x1)*x0 - (y2-y1)*y0

        if (la*x0+lb*y0+lc)*(la*x0+lb*y0+lc) <= r0*r0*(la*la+lb*lb):
            if (ma*x1+mb*y1+mc)*(ma*x2+mb*y2+mc) < 0:
                return False
            else:
                return True
        else:
            return True
    elif wall.sign(x1, y1) == -1 and wall.sign(x2, y2) == -1:
        return True
    else:
        return False


while True:
    n = int(input())
    if n == 0:
        break

    walls = []
    for l in range(n):
        x,y,r = [int(i) for i in input().split()]
        walls.append(Wall(x,y,r))

    m = int(input())
    for l in range(m):
        tx, ty, sx, sy = [int(i) for i in input().split()]
        ans = "Danger"
        for k in range(len(walls)):
            if isVisible(tx, ty, sx, sy, walls[k]) == False:
                #print("Wall", k+1, ": Safe")
                ans = "Safe"
                break
        print(ans)



Measured memory_bytes: 5620
#include <iostream>
using namespace std;
int main(){
    int k;
    cin >> k;
    if(k%2 == 0 || k%5 == 0){
        cout << -1 << endl;
        return 0;
    }

    int c = 1;
    int x = 7%k;
    while(x>0){
        c++;
        x = (10*x+7)%k;
    }
    cout << c << endl;
}

Measured memory_bytes: 3624
N = gets.strip.split.map(&:to_i)[0]
X = gets.strip.split.map(&:to_i)

sorted_x = X.sort

left = sorted_x.sort[(N-1)/2]
right = sorted_x.sort[N/2]

if(left==right)
  X.each {|element| puts left }
  exit
end

memo={}
X.each do |element|
  puts right if element <= left
  puts left if element >= right

end



Measured memory_bytes: 28388
#include <cstdio>
#include <string>
#include <set>

using namespace std;

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

    set<string> s;
    for (size_t i=0; i<n; ++i) {
        char buf[1<<4];
        scanf("%s", buf);
        string instr(buf);

        scanf("%s", buf);
        string str(buf);

        if (instr == "insert") {
            s.insert(str);
        } else if (instr == "find") {
            printf("%s\n", s.count(str)? "yes":"no");
        }
    }

    return 0;
}

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

using ll = long long;

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

    ll n,m;cin>>n>>m;

    ll ans=0;
    if(n*2<=m)
    {
        ans+=n;
        m-=n*2;
        ans+=m/4;
    }
    else
    {
        ans+=m/2;
    }
    
    cout<<ans<<"\n";

    return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>

int main(void){

    int x;
    scanf("%d",&x);

    if(x>=400 && x<=599){
        printf("8");
    }else if(x>=600 && x<=799){
        printf("7");
    }else if(x>=800 && x<=999){
        printf("6");
    }else if(x>=1000 && x<=1199){
        printf("5");
    }else if(x>=1200 && x<=1399){
        printf("4");
    }else if(x>=1400 && x<=1599){
        printf("3");
    }else if(x>=1600 && x<=1799){
        printf("2");
    }else if(x>=1800 && x<=1999){
        printf("1");
    }

    return 0;
}

Measured memory_bytes: 1664
object Main extends App {

  val n = scala.io.StdIn.readInt()
  val readA =  scala.io.StdIn.readLine()
  val aArray = readA.split(" ").map(_.toInt).toVector
  val readB =  scala.io.StdIn.readLine()
  val bArray = readB.split(" ").map(_.toInt).toVector
  val readC =  scala.io.StdIn.readLine()
  val cArray = readC.split(" ").map(_.toInt).toVector

  var result = 0
  var before = -1
  aArray.foreach { a =>
    result = result + bArray(a - 1)
    if (before > 0 && a == (before + 1)) {
      result = result + cArray(before - 1)
    }
    if (a <= cArray.size) {
      before = a
    } else {
      before = -1
    }

  }
  println(result)
}

Measured memory_bytes: 25540
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(ll (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define opf(i) cout<<fixed<<setprecision(10)<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define matC(name,fnum,snum); vector<vector<char>> name((fnum),vector<char>((snum),0));
#define debugP int debug_point; cin>>debug_point;
#define FI first
#define SE second
const ll MOD= 1e9 + 7;

//
void solve(std::vector<long long> A){
    ll ans=0;
    rep(i,3){
        ans+=A[i];
    }
    if(ans>=22)op("bust")
    else op("win")
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::vector<long long> A(3);
    for(int i = 0 ; i < 3 ; i++){
        scanf("%lld",&A[i]);
    }
    solve(std::move(A));
    return 0;
}


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

int main(){
    int H, W;
    cin >> H >> W;
    string S[H+10];
    int tmp[H+10][W+10];
    string ans[H+10];
    for(int j = 0; j <= W + 1; ++j){
        tmp[0][j] = 0;
        tmp[H+1][j] = 0;
    }
    for(int i = 1; i <= H; ++i){
        tmp[i][0] = 0;
        tmp[i][W+1] = 0;
    }
    for(int i = 1; i <= H; ++i){
        cin >> S[i];
        for(int j = 0; j < W; ++j){
            if(S[i].substr(j,1)=="#") tmp[i][j+1] = 1;
            else  tmp[i][j+1] = 0;
        }
    }
    
    for(int i = 1; i <= H; ++i){
        for(int j = 1; j <= W; ++j){
            if(tmp[i][j]==1){
                int count = tmp[i-1][j] + tmp[i][j-1] + tmp[i][j+1] + tmp[i+1][j];
                if(count==0){
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define rep(i, n) for(ll i=0; i<(ll)(n); i++)
#define repd(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=b-1; (ll)(a)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

ll c[1010][1010]; 

int main(){
    ll h, w;    cin >> h >> w;
    ll sx, sy,  gx, gy; cin >> sx >> sy >> gx >> gy;
    sx--, sy--, gx--, gy--;
    vector<vector<char>> g(h, vector<char>(w));
    rep(i, h)   rep(j, w)   cin >> g[i][j];
    rep(i, h)   rep(j, w)   c[i][j] = LINF;
    c[sx][sy] = 0;
    priority_queue<tuple<ll, ll, ll>, vector<tuple<ll, ll, ll>>, greater<tuple<ll, ll, ll>>> que;
    que.emplace(0, sx, sy);
    while(!que.empty()){
        ll cost = get<0>(que.top()), x=get<1>(que.top()), y=get<2>(que.top());
        que.pop();
        rep(i, 4){
            ll nx=x+dx[i], ny=y+dy[i];
            if(nx<0 || h<=nx || ny<0 || w<=ny) continue;
            if(g[nx][ny]=='#') continue;
            if(cost<c[nx][ny]){
                c[nx][ny] = c[x][y];
                que.emplace(c[nx][ny], nx, ny);
            }
        }
        for(int i=-2; i<=2; i++){
            for(int j=-2; j<=2; j++){
                ll nx=x+i, ny=y+j;
                if(nx<0 || h<=nx || ny<0 || w<=ny) continue;
                if(g[nx][ny]=='#') continue;
                if(cost+1<c[nx][ny]){
                    c[nx][ny] = c[x][y]+1;
                    que.emplace(c[nx][ny], nx, ny);
                }
            }
        }
    }
    
    if(c[gx][gy]==LINF) c[gx][gy] = -1;

    
    cout << c[gx][gy] << endl;
        
}


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

typedef long long ll;
typedef std::pair<ll, ll> P;

constexpr ll INF = 1e15;
constexpr ll mod = 1e9+7;

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

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

int main() {
    ll n;
    cin >> n;
    vector<ll> xs(n);
    vector<ll> ys(n);
    rep(i, n) {
        ll x, y;
        cin >> x >> y;
        xs[i] = x + y;
        ys[i] = x - y;
    }
    sort(xs.begin(), xs.end());
    sort(ys.begin(), ys.end());
    ll d1 = xs.back() - xs.front();
    ll d2 = ys.back() - ys.front();
    cout << max(d1, d2) << endl;
    return 0;
}


Measured memory_bytes: 6376