akhauriyash/Code-Regression huggingface dataset:
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/icl/interval_map.hpp>

#define REPI(i, S, N) for(int i=int(S); i<int(N); i++)
#define REP(i, N) REPI(i, 0, N)
#define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::integer;

using ll = long long;
namespace bst = boost;
namespace icl = boost::icl;
template<typename T> class in {
    T value;
public:
    in() { cin >> value; }
    operator const T&() const { return value; }
    operator T&() { return value; }
    in& operator=(T source) { value = source; return *this; }
};
template<> class in<string> : public string {
public:
    in() { cin >> *this; }
};
template<class T> class inseq : public T {
public:
    template<typename... Arg> inseq(Arg... arg) : T(forward<Arg>(arg)...) { for (auto&& i : *this) cin >> i; }
};
template<class T> using invec = inseq<vector<T>>;

auto solve() {
  in<ll> N, M;
  vector<int> parent(N+1, -1), rank(N+1);
  auto trace = [&](int A, int B) {
    int tA = A, tB = B;
    while (parent[tA] != -1)
      tA = parent[tA];
    while (parent[tB] != -1)
      tB = parent[tB];

    return make_tuple(tA, tB);
  };
  auto unite = [&](int A, int B) {
    int tA = A, tB = B;
    tie(tA, tB) = trace(tA, tB);

    // 更新
    if (A != tA)
      parent[A] = tA;
    if (tB != B)
      parent[B] = tB;

    if (tA != tB){
      if (rank[tA] > rank[tB]){
        parent[tB] = tA;
      }
      else
      {
        parent[tA] = tB;
        if (rank[tA] == rank[tB])
          rank[tB]++;
      }
    }
  };

  REP(i, M) {
    ll A, B;
    cin>>A>>B;
    unite(A, B);
  }
  
  vector<ll> pars(N+1, 0);
  
  for (int i = 1; i <= N; i++) {
    int tA = i, tB = 0;
    tie(tA, tB) = trace(tA, tB);
    pars[tA]++;
  }


  return *bst::max_element(pars);
}

template<typename T> void plot(const T& func) { cout << setprecision(9) << func() << endl; }
template<> void plot<void()>(void(&func)()) { func(); }

int main() {
  plot(solve);

  return 0;
}



Measured memory_bytes: 6364
// Half and Half

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <ios>
#include <iomanip>
#include <string>
#include <numeric>

using namespace std;

int main() {
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    // aピザ: a円、abピザ: c円
    // aピザをx枚、bピザをy枚用意する必要がある

    // xとyの最小値 =: minまでは
    // aピザとbピザをmin枚買う or abピザを2 * min枚買う　の最小値    ----(1)
    // aピザが残りx - min枚( > 0)とすると、
    // aピザをx - min枚買う or abピザを2 * (x - min)枚買う　の最小値 ----(2)
    // (1) + (2) が求めるべき答え

    int res = 0;
    int min_mai = min(x, y);
    x -= min_mai;
    y -= min_mai;

    res += min(a*min_mai + b*min_mai, c*2*min_mai);

    if (x > 0) {
        res += min(a*x, c*2*x);
    }
    if (y > 0) {
        res += min(b*y, c*2*y);
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int i=0;i<n;i++)
const long long MOD = 1000000007;
const long long INF = MOD*MOD;
typedef pair<int,int> P;
typedef long long ll;
ll n,m,k, ans;
string s;

main(){
  int n,a,b,c,d;cin >> n >> a >> b >> c >> d;
  cin >> s;
  string frag = "No";
  bool tmp1 = true;
  for(int i = a;i<d-1;i++){
    if(s[i] == '#' && s[i+1] == '#') tmp1 = false;
  }

  if(c < d){
    if(tmp1) frag = "Yes";
  }else{
    bool tmp2 = false;
    for(int i = b-2;i<d-1;i++){
      if(s[i] == '.' &&  s[i+1] == '.' && s[i+2] == '.'){
        tmp2 = true;
      }
    }
    if(tmp1 && tmp2) frag = "Yes";
  }
  cout << frag << endl;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
    public static void main(String [] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        long [] a = new long[n];
        for (int i = 0; i < n; ++i) {
            a[i] = scanner.nextLong();
        }
        long sum = 0L;
        long mod = 1000000007L;
        long base = 1L;
        for (int b = 0; b < 60; ++b, base *= 2) {
            int [] ones = new int[n];
            int [] zeros = new int[n];
            if (((a[n - 1] >> b) & 1) == 1) {
                ones[n - 1] = 1;
            } else {
                zeros[n - 1] = 1;
            }
            for (int i = n - 2; i >= 0; --i) {
                if (((a[i] >> b) & 1) == 1) {
                    ones[i] = ones[i + 1] + 1;
                    zeros[i] = zeros[i + 1];
                } else {
                    zeros[i] = zeros[i + 1] + 1;
                    ones[i] = ones[i + 1];
                }
            }
            long currentSum = 0L;
            for (int i = 0; i <= n - 2; ++i) {
                if (((a[i] >> b) & 1) == 1) {
                    currentSum = (currentSum + zeros[i + 1]) % mod;
                } else {
                    currentSum = (currentSum + ones[i + 1]) % mod;
                }
            }
            sum = (sum + (currentSum * (base % mod)) % mod) % mod;
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 160756
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin,(x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;

int gcd(int a, int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

void solve() {
		int64 n; cin >> n;
		vector<int64> a(n + 1);
		vector<int64> b(n);
		rep(i, n + 1) {
			cin >> a[i];
		}
		rep(i, n) {
			cin >> b[i];
		}
		int64 ans = 0;
		rep(i, n) {
			//n番目の勇者でi番目のモンスターを倒しきれるだけ倒す
			int64 t = a[i] < b[i] ? a[i] : b[i];
			//倒したモンスターの数だけ力を消費する
			ans += t;
			b[i] -= t;
			//i + 1番目のモンスターについて、残った力で倒しきれるだけ倒す、全部倒せる場合は全部
			t = a[i + 1] < b[i] ? a[i + 1] : b[i];
			//倒した数だけモンスターの数を減少させる
			a[i + 1] -= t;
			ans += t;
		}
		cout << ans << endl;
    return;
}

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



Measured memory_bytes: 1792
import Control.Monad

main = do
    decks <- replicateM 3 getLine
    putStrLn $ game 'a' decks

type Turn = Char
type Deck = String
type Player = String

proceed :: Turn -> [Deck] -> (Turn, [Deck])
proceed 'a' [a, b, c] = (head a, [drop 1 a, b, c])
proceed 'b' [a, b, c] = (head b, [a, drop 1 b, c])
proceed 'c' [a, b, c] = (head c, [a, b, drop 1 c])

game :: Turn -> [Deck] -> Player
game 'a' ["", _, _] = "A"
game 'b' [_, "", _] = "B"
game 'c' [_, _, ""] = "C"
game turn decks = game $% proceed turn decks

($%) :: (a -> b -> c) -> (a, b) -> c
f $% t = f (fst t) (snd t)

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl




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





int n;

ll dp[maxn];

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


    dp[n]=n;
    dp[n-1]=1ll*n*n%mod;


    ll s=0;
    for (int i=n-2; i>0; i--) {
	s += dp[i+3]; s%=mod;
	dp[i]=dp[i+1];//1,rest
	dp[i]%=mod;
	dp[i]+=1ll*(n-1)*(n-1)%mod;//c,d,d.... where c>1 and d>1
	dp[i]%=mod;

	ll j=n-(n-i-1);//i+j+1>n
	dp[i]+=(s+j);//c,1,1..1,dp[i+j+1], or we overshoot in j cases
	dp[i]%=mod;
    }
  

    ll ans = dp[1];
    ans %= mod;
    ans += mod;
    ans %= mod;

    out(ans);
  

    return 0;
}


Measured memory_bytes: 8064
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);
    int n,a[15],o[105],no[105],ans=1;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]%2==0){
            no[i]=2;
        }
        else{
            no[i]=1;
        }
        if(i!=0)
            no[i]*=no[i-1];
        ans*=3;
    }
    ans-=no[n-1];
    cout<<ans<<endl;
    return(0);
}

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

constexpr long long MOD = 1e9 + 7;
constexpr int MAX_N = 200000 + 1;
long long fact[MAX_N];
void init_fact() {
    fact[0] = 1;
    for(auto i = 1; i < MAX_N; ++i)
        fact[i] = fact[i-1] * i % MOD;
}

long long pow_mod(long long x, long long y, long long mod) {
    auto ret=1ll;
    while (y) {
            if (y % 2)
                ret = ret * x % mod;
            x =  x * x % mod;
            y /= 2;
        }
    return ret;
}

long long nCr(int n, int r) {
    return fact[n] * pow_mod(fact[n-r], MOD - 2, MOD) % MOD * pow_mod(fact[r], MOD - 2, MOD) % MOD;
}

void solve()
{
    init_fact();
    int N, A, B, C;
    cin >> N >> A >> B >> C;

    long long ans = 0;
    long long dab = pow_mod(A + B, MOD - 2, MOD);
    for(auto i = N; i < 2 * N; ++i)
    {
        ans += nCr(i - 1, N - 1)
            * (pow_mod(A, N, MOD) * pow_mod(B, i - N, MOD) % MOD + pow_mod(A, i - N, MOD) * pow_mod(B, N, MOD) % MOD) % MOD
            * i % MOD 
            * 100 % MOD
            * pow_mod(dab, i, MOD) % MOD
            * pow_mod(100 - C, MOD - 2, MOD) % MOD;
        ans %= MOD;
    }

    cout << ans << endl;
}

int main()
{
    cin.sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    solve();
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class Program
{
    static void Main()
    {
        var N = int.Parse(ReadLine());
        var A = ReadLine().Split().Select(int.Parse).ToArray();
        var segtree = new SegmentTree<int>(A, 0, GCD);
        var ans = 0;
        for (int i = 0; i < N; i++)
        {
            ans = Max(ans, GCD(segtree.Query(0, i), segtree.Query(i + 1, N)));
        }
        WriteLine(ans);
    }

    static int GCD(int a, int b)
    {
        while (b != 0)
        {
            var c = a;
            a = b;
            b = c % b;
        }
        return a;
    }
}

public class SegmentTree<T>//Tがstring以外の参照型だとEの扱いが･･･単位元に対する書き換えは起こらない保証ある･･･？
{
    T[] buffer;
    int N;
    T IE;
    Func<T, T, T> Op;//デリゲート遅そう　

    public SegmentTree(int cap, T E, Func<T, T, T> op)//モノイドが直接渡せれば　C#9.0ではいるか
    {
        var c = 1;
        while (c < cap) c <<= 1;
        N = c;
        buffer = new T[N * 2 - 1];
        //Array.Fill(buffer, E);// NETCOREAPP Only
        for (int i = 0; i < buffer.Length; i++) buffer[i] = E;
        Op = op;
        IE = E;
    }

    public SegmentTree(T[] init, T E, Func<T, T, T> op)
    {
        var c = 1;
        while (c < init.Length) c <<= 1;
        N = c;
        buffer = new T[N * 2 - 1];
        Array.Copy(init, 0, buffer, N - 1, init.Length);
        //Array.Fill(buffer, E, init.Length + N - 1, buffer.Length - init.Length - N + 1);// NETCOREAPP Only
        for (int i = init.Length + N - 1; i < buffer.Length; i++) buffer[i] = E;
        for (int i = N - 2; i >= 0; i--)
        {
            buffer[i] = op(buffer[i * 2 + 1], buffer[i * 2 + 2]);
        }
        Op = op;
        IE = E;
    }

    public void Update(int index, T value)//[0, N)アクセス可
    {
        index += N - 1;
        buffer[index] = value;
        while (index > 0)
        {
            index = (index - 1) / 2;
            buffer[index] = Op(buffer[index * 2 + 1], buffer[index * 2 + 2]);
        }
    }

    public T this[int index]
    {
        set//setの式形式はC#7.0以降
        {
            Update(index, value);
        }
        get
        {
            return buffer[index + N - 1];
        }
    }

    public T Query(int l, int r)
    {
        var lv = IE;
        var rv = IE;
        l += N - 1;
        r += N - 1;
        while (l < r)
        {
            if ((l & 1) == 0)
            {
                lv = Op(lv, buffer[l]);
            }
            if ((r & 1) == 0)
            {
                rv = Op(buffer[r - 1], rv);
            }
            l /= 2;
            r = (r - 1) / 2;
        }
        return Op(lv, rv);
    }
}


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


int main() {
    int N, K;
    cin >> N >> K;
    vector<int> p(N);
    rep(i, N){
        int num;
        cin >> num;
        p.at(i) = num + 1;
    }

    int maxvalue = accumulate(p.begin(), p.begin()+K, 0);
    int current_value = maxvalue;

    for(int i = 1; i <= N - K; i++){
        current_value = current_value - p.at(i-1) + p.at(i+K-1);
        if(maxvalue < current_value){
            maxvalue = current_value;
        }
    }

    double ex = maxvalue;
    ex /= 2;
    printf("%.10f\n", ex);

    return 0;
}

Measured memory_bytes: 1024
use std::io;
use itertools::Itertools;

fn main() {
    let n = read_one::<usize>();
    let pn = read::<usize>();
    let qn = read::<usize>();
    let a = (1..=n).permutations(n).position(|v| v == pn).unwrap();
    let b = (1..=n).permutations(n).position(|v| v == qn).unwrap();
    println!("{}", (a as isize - b as isize).abs());
}

#[allow(unused)]
fn read<T>() -> Vec<T>
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}


#[allow(unused)]
fn read_one<T>() -> T
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

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

int main(void){
    
   int a,b,k,min_num;
   cin >> a >> b >> k;
   min_num = min(a,b);
   vector<int> vec{};
   
   for(int i=1;i<=min_num;i++){
       if(a%i == 0 && b%i == 0) vec.push_back(i);
       
   }
   sort(vec.begin(),vec.end(),greater<int>());
   
   cout << vec[k-1] << endl;
}

Measured memory_bytes: 3624
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    #from math import gcd

    #inf = 10**17
    #mod = 10**9 + 7

    a,b,c = map(int, input().split())
    res = 0
    while True:
        if a%2 == 0 and b%2 == 0 and c%2 == 0:
            a,b,c = (b+c)//2, (a+c)//2, (a+b)//2
            res += 1
        else:
            print(res)
            break
        if a == b == c:
            print(-1)
            break

if __name__ == '__main__':
    main()



Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;

 
lint fac[MAX], finv[MAX], inv[MAX];

void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }

    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
    
    
  int main(){
      lint n,q;
      string s;
      cin>>s;
        if(s=="AAA"||s=="BBB")cout<<"No";
     else cout<<"Yes";
  }
     
  


Measured memory_bytes: 256
//kruskal tree
#include <cstdio>
#include <algorithm>
using namespace std;
#define M 100000
int parent[M],a[M],b[M];
pair<int,int>node[M];
int root(int a){return parent[a]==a?a:parent[a]=root(parent[a]);}
int unite(int a,int b){
	int x=root(a),y=root(b);
	if(x==y)return 0;
	parent[x]=y;
	return 1;
}
int main(){
	int i,s,n,m;
	for(;scanf("%d%d",&n,&m)>1;printf("%d\n",s)){
		for(i=0;i<m;i++)scanf("%d%d%d",a+i,b+i,&node[i].first),node[i].second=i;
		sort(node,node+m);
		for(i=0;i<n;i++)parent[i]=i;
		for(s=i=0;i<m;i++)if(unite(a[node[i].second],b[node[i].second]))s+=node[i].first;
	}
}

Measured memory_bytes: 2628
#include <stdio.h>
#include <string.h>
#define a 0
#define b 1
#define c 2
#define d 3
#define e 4
#define f 5
#define g 6
#define h 7
#define i 8

int main(void) {
	int status[9][9];
	int n, I, J;
	char s[1000];
	char ch;
	int flag = 0;
	status[a][0] = 2;
	status[a][1] = b;
	status[a][2] = d;
	status[b][0] = 3;
	status[b][1] = a;
	status[b][2] = c;
	status[b][3] = e;
	status[c][0] = 2;
	status[c][1] = b;
	status[c][2] = f;
	status[d][0] = 3;
	status[d][1] = a;
	status[d][2] = e;
	status[d][3] = g;
	status[e][0] = 4;
	status[e][1] = b;
	status[e][2] = d;
	status[e][3] = f;
	status[e][4] = h;
	status[f][0] = 3;
	status[f][1] = c;
	status[f][2] = e;
	status[f][3] = i;
	status[g][0] = 2;
	status[g][1] = d;
	status[g][2] = h;
	status[h][0] = 3;
	status[h][1] = g;
	status[h][2] = e;
	status[h][3] = i;
	status[i][0] = 2;
	status[i][1] = f;
	status[i][2] = h;

	n = 1000;
	while (n--) {
		flag = 1;
		scanf("%s", s);
		ch = s[0];
		
		for (I = 1; strlen(s) >=2 &&I < strlen(s); I++) {
			for (J = 1; J <= status[ch - 'A'][0]; J++) {
				if (status[ch - 'A'][J] == s[I]-'A') break;
			}
			if (J == status[ch - 'A'][0] + 1) {
				flag = 0; break;
			}
			if (I != strlen(s) - 1)ch = s[I];
		}
		if (flag == 1) printf("%s\n", s);
	}



	return 0;
}

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

using namespace std;

int r,d,x;

int main()
{
    scanf("%d%d%d",&r,&d,&x);
    for(int i = 1;i <= 10;i++)
    {
        x = r * x - d;
        printf("%d\n",x);
    }
    return 0;
}


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

using ll = long long;
using Pii = std::pair<int, int>;
using Pll = std::pair<ll, ll>;

const ll INF = (ll)1e11;

using namespace std;

int main() {
    ios::sync_with_stdio(false);

    int A, B;
    cin >> A >> B;
    
    cout << (A >= 13 ? B : A >= 6 ? B/2 : 0) << endl;

    return 0;
}


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

int main() {
	int n;
	cin >> n;
	if (n >= 25) {
		cout << 0 << endl;
		return 0;
	}
	vector<int>d(n);
	for (int i = 0; i < n; i++)cin >> d.at(i);
	sort(d.begin(), d.end());
	if (d.at(0)==0) {
		cout << 0 << endl;
		return 0;
	}
	for (int i = 0; i < n - 2; i++) {
		if (d.at(i) == d.at(i + 2)) {
			cout << 0 << endl;
			return 0;
		}
		if (d.at(i) == 12 && d.at(i + 1) == 12) {
			cout << 0 << endl;
			return 0;
		}
	}
	vector<int>tz(24,0);
	tz.at(0) = 1;
	for (int i = 0; i < n; i++)tz.at(d.at(i))++;
	vector<int>opz;
	for (int i = 1; i <= 11; i++) {
		if (tz.at(i) == 1) {
			opz.push_back(i);
			tz.at(i)--;
		}
		else if (tz.at(i) == 2) {
			tz.at(i)--;
			tz.at(24 - i)++;
		}
	}
	int ans = 0;
	for (int bit = 0; bit < (1 << opz.size()); bit++) {
		vector<int>tzc = tz;
		vector<int> l(0);
		for (int i = 0; i < opz.size(); i++) {
			if (bit & (1 << i))tzc.at(opz.at(i))++;
			else tzc.at(24 - opz.at(i))++;
		}
		int res = 24;
		vector<int>tzd;
		for (int i = 0; i < 24; i++) {
			if (tzc.at(i) != 0)tzd.push_back(i);
		}
		for (int i = 1; i < tzd.size(); i++) {
			res = min(res, tzd.at(i) - tzd.at(i - 1));
		}
		res = min(res, 24 - tzd.at(tzd.size() - 1));
		ans = max(ans, res);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin>>n>>m;

vector<int>ans(m,0);
for(int i = 0; i<n; i++){
    int k; cin>>k;
    for(int j = 0; j<k; j++){
        int a; cin>>a;
        a = a -1;
        ans[a] = ans[a] + 1;
    }
}
int count = 0;
for(int i = 0; i<m; i++){
    if(ans[i]==n){
        
        count++;
    }
}
cout<<count<<endl;
return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
    char c11,c12,c13,c21,c22,c23;
    std::cin >> c11 >> c12 >> c13;
    std::cin >> c21 >> c22 >> c23;
    bool a=false,b=false,c=false;
    a=(c11==c23);
    b=(c12==c22);
    c=(c13==c21);
    if( a&&b&&c ){
        std::cout<<"YES"<<std::endl;
    }else {
        std::cout<<"NO"<<std::endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long int a,b,c,k;
	cin >> a >> b >> c >>k;
	if(a>=k){
		cout << k << endl;
	}
	else if(k>a && k<=b){
		cout << a << endl;
	}
	else{
		cout << a-(k-a-b) << endl;
	}
}

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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = 10e15;
const ll MINF = -10e10;
//const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<P, vector<P>, greater<P>> PQ_ASK;
const int mod = 1000000007;


int main() {

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

    if (a + b >= c) {
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }

}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES // for C++  
#include <cmath> 
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <array>
#include <iterator>
#include <utility>
#include <set>
#include <random>
#include <map>
#include <stack>
#include <queue>
#include <list>
#include <functional>
#define LL long long


using namespace std;

int main() {
	string a, b;
	cin >> a >> b;
	if (a.size() > b.size())
	{
		cout << "GREATER" << endl;
	}
	else if (a.size() < b.size())
	{
		cout << "LESS" << endl;
	}
	else
	{
		if (a > b)
		{
			cout << "GREATER" << endl;
		}
		else if (b > a)
		{
			cout << "LESS" << endl;
		}
		else
		{
			cout << "EQUAL" << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3

import sys
# import math
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product                # product(iter, repeat=n)
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4


def main():
    mod = 1000000007                  # 10^9+7
    inf = float('inf')
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():  return int(input())
    def mi():  return map(int, input().split())
    def mi_0(): return map(lambda x: int(x)-1, input().split())
    def lmi(): return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():  return list(input())
    
    
    n, a, b = mi()
    q = n // (a + b)
    res = n % (a + b)
    print(q * a + min(res, a))

if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
#include <vector>
#include <cmath>
#include <iostream>
#include <algorithm>

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;
typedef double              DOUBLE;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)

using namespace std;

int main() {

	SINT32 N = 0;
	SINT32 SUM = 0;


	cin >> N;


	for (SINT32 i = 0; i < 10; i++) {
		SUM = SUM + ((N/(SINT32)pow(10,i)) % 10);
	}
	if ((N % SUM) == 0) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}

//	sort(DATA.begin(),DATA.end());
//	sort(DATA.begin(),DATA.end(),std::greater<SINT32>());
//	__gcd(ANS,DATA[i]);

//	// DATA.emplace_back(BUF);	//後ろに追加

//  DATA.erase(std::unique(DATA.begin(), DATA.end()), DATA.end());

/*
	SINT32 M = 3;
	vector<pair<SINT32,SINT32>> DATA2(M);
	for (SINT32 i = 0; i < M; i++) {
		cin >> DATA2[i].first;
		cin >> DATA2[i].second;
	}
	sort(DATA2.begin(),DATA2.end());
	cout << DATA2[0].first << endl;
	cout << DATA2[0].second << endl;
*/

//		APOSI = lower_bound(ADATA.begin(),ADATA.end(),QDATA[i]) - ADATA.begin();
//		BPOSI = lower_bound(BDATA.begin(),BDATA.end(),QDATA[i]) - BDATA.begin();

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N;
    cin >> N;
    vector<int> V(N);
    ll ans = 0;
    rep(i,0,N){
        cin >> V[i];
        ans += V[i];
    }
    sort(V.begin(),V.end());
    rep(i,0,N){
        if(ans % 10 == 0 && V[i] % 10 == 0)continue;
        if(ans % 10 == 0)ans -= V[i]; 
        cout << ans << endl;
        return 0;
    }
    cout << 0 << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int MOD = 1e9+7;
 
int main(){
 
	ll n, k;
    cin >> n >> k;
	vector < ll > a(n);
	for(auto & i: a) cin >> i;
	if(k < 100){
		while(k--){
			vector < ll > b(n);
			for(ll i=0;i < n;i++)
            {
				ll c = i-a.at(i);
				c = max < ll > (c, 0);
				ll d = i + a.at(i)+1;
				b.at(c)++;
				if(d < n) b.at(d)--;
                        }
			ll now{};
			for(ll i=0;
                            i < n;
                            i++){
				now += b.at(i);
				a.at(i) = now;
                        }
		}
		for(ll i=0;
                    i < n-1;
                    i++){
			cout << a.at(i) << ' ';
                }
		cout << a.back() << endl;
            }
	else{
		for(ll i=0;
                    i < n;
                    i++){
			cout << n << endl;
                }
	}
 
 
}

Measured memory_bytes: 6384
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    map<ll, ll> mp;
    ll ans = 0;
    ll a;

    for(int i=0;i<n;i++){
        cin >> a;
        ans += mp[-a + i];
        mp[a + i]++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 26276
#include "bits/stdc++.h"
#pragma GCC optimize("Ofast")

// Begin {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T>
inline vector<T> make_v(const T &initvalue, intmax_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, intmax_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}

constexpr int INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;
// }}} End

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    size_t X, Y;
    cin >> X >> Y;

    intmax_t res = 0;
    unordered_map<intmax_t, intmax_t> mp;
    mp[3] = 100000; mp[2] = 200000; mp[1] = 300000;
 
    res += mp[X];
    res += mp[Y];

    if (X == 1 && Y == 1) res += 400000;

    cout << res << "\n";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const ld PI = acos(-1.0);
const ld EPS = 1e-11;

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);

int n;
cin >> n;
cout << n*n*n << endl; 

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int tempw,tempv;
int n,w;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>w;
    vector<long long int> dp(w+1);
    for(int i=1;i<=n;i++){
        cin>>tempw>>tempv;
      	for(int j=w;j>=tempw;j--){
          dp[j]=max(dp[j],dp[j-tempw]+tempv);
        }
    }
    cout<<dp[w]<<endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
//#include<atcoder/all>

using namespace std;
//using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007


int main(){
  
  ll n,x,m;
  cin >> n >> x >> m;
  ll X = x;
  if(n <= 100000){
    ll res = 0;
    rep(i,n){
      res += x;
      x = x*x%m;
    }
    cout << res << "\n";
    return 0;
  }
  ll roop = 0;
  ll sum = 0;
  vector<int> d(m);
  int cnt = 0;
  while(d[x] == 0){
    cnt++;
    d[x] = cnt;
    sum += x;
    x = x*x%m;
    roop++;
  }
  ll res = 0;
  while(X != x){
    res += X;
    sum -= X;
    X = X*X%m;
    n--;
    roop--;
  }
  ll k = n/roop;
  res += k*sum;
  rep(i,n%roop){
    res += x;
    x = x*x%m;
  }
  cout << res << "\n";


  return 0;
}

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

int main(){
    int n;
    cin >> n;
    for(int tsumugi = 0; tsumugi < n; tsumugi++){
        char tmp;
        cin >> tmp;
        if(tmp == 'Y'){
            cout << "Four" << endl;
            return 0;
        }
    }
    cout << "Three" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
int n[8]={},N,x,y;


scanf("%d",&N);
for(int i=0;i<N;i++){
scanf("%d.%d",&x,&y);
if(185<=x)n[6]++;
else if(180<=x)n[5]++;
else if(175<=x)n[4]++;
else if(170<=x)n[3]++;
else if(165<=x)n[2]++;
else if(165>x)n[1]++;
}
for(int i=1;i<=6;i++)
{
printf("%d:",i);
for(int j=0;j<n[i];j++){
printf("*");
}
printf("\n");
}
return 0;
}

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

int main() {
    int k;
    cin >> k;
    if (k % 5 == 0 || k % 2 == 0) {
        cout << -1;
        exit(0);
    }
    long long pow = 10;
    int ind = 1;
    while (7 * (pow - 1) % (9 * k)!= 0) {
        ind++;
        pow *= 10;
        pow %= (9 * k);
    }
    cout << ind << '\n';
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
 
#define clr(i, j)     memset(i, j, sizeof(i))
#define pb            push_back
 
typedef long long     ll;
 
//-*-*-*-*-*-*-*-*-
 
  
 
ll m,k,x,y,z;
ll dp[9999999];
ll a[999999];ll c[99];map<ll,ll>mp;
map<ll,ll>mpp;
ll b[9999999];ll p[9999999];
int main()
{
   ll l=0;ll s=0;ll mn=0;
   ll n,k;    cin>>n;
   ll ans=0;
   ll t=0;
    for(ll j=1;j<=n;j++){
       cin>>z>>x>>y;
     mn=abs(l-x)+abs(y-s);
     
     if(t+mn>z||(t+mn)<z&&(z-(t+mn))%2!=0){
        cout<<"No";return 0;
     }else{t=z;l=x;s=y;}
   }  
     cout<<"Yes";
      
   

  
   }

Measured memory_bytes: 2304
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

class AtCoder
{
    const int MOD = 1000000007;
    public void Slove()
    {
        var n = int.Parse(Console.ReadLine());
        var mons = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var unit = Console.ReadLine().Split().Select(int.Parse).ToArray();
        long ans = 0;
        for(int i = 0; i < n; i++)
        {
            var temp = Math.Min(mons[i], unit[i]);
            mons[i] -= temp;
            unit[i] -= temp;
            ans += temp;
            if(unit[i] > 0)
            {
                temp = Math.Min(mons[i + 1], unit[i]);
                mons[i + 1] -= temp;
                ans += temp;
            }
        }
        Console.WriteLine(ans);
    }
    static void Main()
    {
        var ac = new AtCoder();
        ac.Slove();
    }
}

Measured memory_bytes: 34372
#include <bits/stdc++.h>
using namespace std;
int N;
int R;
int a[500005],s[500005],Tree[500005];
int Lowbit(int x){	return x&-x;}
void Insert(int Now,int x){for (int i=Now;i<=2*N;i+=Lowbit(i)) Tree[i]+=x;}
long long query(int Now){long long ans=0;for (int i=Now;i;i-=Lowbit(i)) ans+=Tree[i];return ans;}
bool Check(int Now){
	for (int i=1;i<=2*N;i++) Tree[i]=0;
	s[0]=0;
	for (int i=1;i<=N;i++)
		if (a[i]>=Now) s[i]=s[i-1]+1;
			else s[i]=s[i-1]-1;
	long long ans=0;
	for (int i=0;i<=N;i++){
		ans+=query(s[i]+N);		
		Insert(s[i]+N,1);
	}
	return (ans>=1ll*N*(N+1)/4);
}
int main(){
	int ll=0;
	scanf("%d",&N);
	for (int i=1;i<=N;i++){
		scanf("%d",&a[i]);
		R=max(R,a[i]);
	}
	while (ll<=R){
		int mid=(ll+R)>>1;
		if (Check(mid)) ll=mid+1;
		else R=mid-1;
	}
	cout<<R;
	return 0;
}

Measured memory_bytes: 3456
#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <algorithm>

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define MOD 1000000007

typedef long long ll;

using namespace std;
int main(){
    ll N, W;
    cin >> N >> W;
    map<ll, vector<ll>> wvMap;
    ll w, v;
    ll w_one;

    for(ll i = 0; i < N; ++i)
    {
    	cin >> w >> v;
    	if (i == 0)
    	{
    		w_one = w;
		    // 重さの種類は高々4種類	
    		for (ll n = w_one; n <= w_one + 3; ++n)
    		{
    			wvMap[n] = {};
    		}
    	}
    	wvMap[w].push_back(v);
    }

    for (ll i = w_one; i <= w_one + 3; ++i)
    {
		sort(wvMap[i].begin(), wvMap[i].end());
    }

    ll ans = 0;
    ll tmpW = w_one;
    ll weightSum[4];
    ll valueSum[4];
    ll allWeightSum = 0;
    ll allValueSum = 0;
    int count = 0;
    REP(i, 4)
    {
    	weightSum[i] = 0;
    	valueSum[i] = 0;
    }

    for (int i = 0; i <= wvMap[tmpW].size(); ++i)
    {
    	for(int n = 1; n <= i; ++n)
    	{
    		valueSum[count] += wvMap[tmpW][wvMap[tmpW].size() - n];
    	}
    	weightSum[count] = tmpW * i;
    	count++;
    	tmpW++;
    	for (int j = 0; j <= wvMap[tmpW].size(); ++j)
	    {
	    	for(int n = 1; n <= j; ++n)
	    	{
	    		valueSum[count] += wvMap[tmpW][wvMap[tmpW].size() - n];
	    	}
	    	weightSum[count] = tmpW * j;
	    	count++;
	    	tmpW++;
	    	for (int k = 0; k <= wvMap[tmpW].size(); ++k)
		    {
		    	for(int n = 1; n <= k; ++n)
		    	{
		    		valueSum[count] += wvMap[tmpW][wvMap[tmpW].size() - n];
		    	}
		    	weightSum[count] = tmpW * k;
		    	count++;
		    	tmpW++;
		    	for (int l = 0; l <= wvMap[tmpW].size(); ++l)
			    {
			    	for(int n = 1; n <= l; ++n)
			    	{
			    		valueSum[count] += wvMap[tmpW][wvMap[tmpW].size() - n];
			    	}
			    	weightSum[count] = tmpW * l;
			    	// 最大値を更新するか判定する
			    	allValueSum = 0;
			    	allWeightSum = 0;
			    	for (int n = 0; n < 4; ++n)
			    	{
			    		allValueSum += valueSum[n];
			    		allWeightSum += weightSum[n];
			    	}
			    	if (allWeightSum <= W) ans = max(ans, allValueSum);

			    	valueSum[count] = 0;
			    	weightSum[count] = 0;
			    }
		    	count--;
			   	tmpW--;
			    valueSum[count] = 0;
		    	weightSum[count] = 0;
		    }
	    	count--;
	    	tmpW--;
		    valueSum[count] = 0;
	    	weightSum[count] = 0;
	    }
    	count--;
    	tmpW--;
	    valueSum[count] = 0;
		weightSum[count] = 0;
	}

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int a[101],b[101][101],n1,n2,n3,i,j;

  scanf("%d",&n1);

  for(i=0;i<101;i++)
    {
      for(j=0;j<101;j++)
	{
	  b[i][j]=0;
	}
    }
  for(i=1;i<=n1;i++)
    {
      scanf("%d%d",&a[i],&n2);
      for(j=1;j<=n2;j++)
	{
	  scanf("%d",&n3);
	  b[a[i]][n3]=1;
	}
    }
  for(i=1;i<=n1;i++)
    {
      for(j=1;j<=n1;j++)
	{
	  if(j!=1)printf(" ");
	  printf("%d",b[i][j]);
	}
      printf("\n");
    }

  return 0;
}
	



Measured memory_bytes: 2112
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.annotation.Target;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.FormatFlagsConversionMismatchException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Random;
import java.util.StringTokenizer;

import javax.naming.spi.DirStateFactory.Result;
import javax.swing.text.AbstractDocument.BranchElement;

import org.w3c.dom.css.Counter;
 
public class Main {

	
	public static void main(String[] args) {
		FastScanner fs=new FastScanner();
		int first = fs.nextInt();
		int temp = fs.nextInt();
		long sum=0;
		for (int i = 1; i < first; i++) {
			int sec = fs.nextInt();
			if(sec<temp) {
				sum=sum+(temp-sec);
			}
			if(sec>temp) {
				temp=sec;
			}
		}
		System.out.println(sum);
	}
	
 
	static final Random random=new Random();
	
	static void ruffleSort(int[] a) {
		int n=a.length;//shuffle, then sort 
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n), temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}
	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}
 
	
}

Measured memory_bytes: 54524
#include <bits/stdc++.h>
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
using namespace std;
typedef long long ll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};

int main()
{
 int a,b;
 cin>>a>>b;
 cout<<(a+b+1)/2<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int x,n;
    cin >> x >> n;
    vector<int>a(n);
    vector<int>num(102);
    for(int i=0;i<=101;i++){
        num[i]=i;
    }
    for(int i=0;i<n;i++){
        cin >> a[i];
        num[a[i]]=100000;   
    }
    reverse(num.begin(),num.end());
    int near=100000;
    int ans=0;
    for(int i=0;i<=101;i++){
        if(abs(x-num[i])<=near){
            ans=num[i];
            near=abs(x-num[i]);
        }
    }
    cout << ans;

    
}

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

int main()
{
    ll K, N, A[1000002], t, tt, ans;
    scanf("%ld %ld", &K, &N);
    rrep(i, N+1){
        scanf("%ld", &A[i]);
    }
    A[0]=0;
    A[N+1]=K;
    t=0;
    rep(i, N+1){
        tt=A[i+1]-A[i];
        if(tt>t){
            t=tt;
        }
    }
    tt=(K-A[N])+A[1];
    if(tt>t) t=tt;

    ans = K-t;
    
    printf("%ld", ans);

    // rep(i,N+2) {
    //     printf("%ld", A[i]);
    // }


    return 0;
}


Measured memory_bytes: 3840
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	points := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&points[i])
	}

	total := 0
	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			total += points[i] * points[j]
		}
	}

	fmt.Println(total)
}


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

string s;
int a,b,ans=0;

int main()
{
	cin>>a>>b;
	cin>>s;
	if(s[a]!='-')
	{
	    puts("No");
	    return 0;
	}
	for(int i=0; i<a+b+1; i++)
	{
		if(s[i]<48 || s[i]>57)  ans++;
		if(ans>=2)
		{
		    puts("No");
		    return 0;
		}
	}
	puts("Yes");
	return 0;
}

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

if n != 0:
    p = list(map(int,input().split()))
else:
    p = []

result = []

i = 0

while len(result) == 0:
    if not (x - i in p):
        result.append(x - i)
    if not (x + i in p):
        result.append(x + i)
    
    i += 1

print(int(min(result)))

Measured memory_bytes: 61924
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define lamsort(v,p) sort(v.begin(),v.end(),[](p a, p b){return a.num < b.num;});
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
const long long LLINF = 1LL<<60;
const int INF = 1e9;
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; }
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

vector<int> alllist[100005];

int ans[100005];

void dfs(int now, int bnum){
    bool flag = false;
    if(alllist[now].size()==0) return;
    rep(i,alllist[now].size()){
        if(i==bnum) flag = true;

        ans[alllist[now][i]] = i;
        if(flag) ans[alllist[now][i]]++;

        dfs(alllist[now][i],ans[alllist[now][i]]);
    }
    return;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n; cin >> n;
    vector<int> ki;
    rep(i,n-1){
        int a,b; cin >> a >> b;
        a--; b--;
        alllist[a].push_back(b);
        ki.push_back(b);
    }
    dfs(0,-1);

    int lastn = 0;

    REP(i,1,n) lastn = max(lastn,ans[i]+1);
    cout << lastn << endl;


    rep(i,n-1)  cout << ans[ki[i]]+1 << endl;


    return 0;
}

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

int main() {
    int n, x[100], y[100];
    cin >> n;
    for (int i = 0; i < n; i++) cin >> x[i];
    for (int i = 0; i < n; i++) cin >> y[i];
    
    double d[4] = {};
    
    for (int p = 1; p <= 3; p++) {
      for (int i = 0; i < n; i++) {
        d[p] += pow(fabs(x[i] - y[i]), p);
      }
      d[p] = pow(d[p], 1.0/p);
    }
    
    for (int i = 0; i < n; i++){
      d[0] = (d[0] < fabs(x[i] - y[i])?fabs(x[i] - y[i]):d[0]);
    }
    
    printf("%lf\n%lf\n%lf\n%lf\n", d[1], d[2], d[3], d[0]);
    
}



Measured memory_bytes: 3348