akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
//#include <unistd.h>
//#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll INF = 1LL << 60;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
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 gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}

ll fac[510000], finv[510000], inv[510000];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < 510000; 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;
    }
}

// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/
/*
    cout << fixed << setprecision(15);
*/

int main(){
    ll N;
    cin >> N;
    vector<ll> num(N);
    ll wa = 0;
    rep(i,N){
        cin >> num[i];
        wa = wa^num[i];
    }
    rep(i,N){
        cout << (wa ^ num[i]) << " ";
    }
    cout << "\n";
}

Measured memory_bytes: 4820
import java.util.Scanner;

public class Main {

    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        int a[][] = new int[3][3];

        for(int i=0; i<3; i++) {
            for(int j=0; j<3; j++) {
                a[i][j] = sc.nextInt();
            }
        }

        boolean b = true;
        b &= a[0][0] - a[1][0] == a[0][1] - a[1][1];
        b &=  a[0][2] - a[1][2] == a[0][1] - a[1][1];
        b &= a[2][0] - a[1][0] == a[2][1] - a[1][1];
        b &=  a[2][2] - a[1][2] == a[2][1] - a[1][1];
        b &= a[0][0] - a[0][1] == a[1][0] - a[1][1];
        b &= a[2][0] - a[2][1] == a[1][0] - a[1][1];
        b &= a[0][2] - a[0][1] == a[1][2] - a[1][1];
        b &= a[2][2] - a[2][1] == a[1][2] - a[1][1];
        System.out.println(b ? "Yes" : "No");
    }


}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define sz(c) (int)(c).size()
#define ALL(c) (c).begin(), (c).end()

const int mod = 924844033;

void add (int &a, int b)
{
    a += b;
    if (a >= mod)
        a -= mod;
}

void sub (int &a, int b)
{
    a -= b;
    if (a < 0)
        a += mod;
}

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

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

    vi fact(n + 1, 1);
    for (int i = 1; i <= n; i++)
        fact[i] = mult(fact[i - 1], i);

    const int ml = (n / (2 * k) + 2);
    int ways[ml + 1][ml + 1][2][2];
    memset(ways, 0, sizeof ways);
    ways[0][0][0][0] = 1;
    ways[0][0][1][1] = 1;

    for (int l = 0; l < ml; l++)
    for (int cnt = 0; cnt <= l; cnt++)
    for (int lf = 0; lf < 2; lf++)
    for (int t = 0; t < 2; t++)
    if (ways[l][cnt][lf][t])
    {
        add(ways[l + 1][cnt][1][t], ways[l][cnt][lf][t]);
        if (lf == 1)
            add(ways[l + 1][cnt + 1][1][t], ways[l][cnt][lf][t]);
        add(ways[l + 1][cnt + 1][0][t], ways[l][cnt][lf][t]);
    }

    const int paths = min(2 * k, n);
    int dp_place[paths + 1][n + 1];
    memset(dp_place, 0, sizeof dp_place);
    dp_place[0][0] = 1;

    for (int i = 0; i < paths; i++)
    for (int j = 0; j <= n; j++)
    if (dp_place[i][j])
    {
        int len = n / (2 * k);
        if (i < n % (2 * k))
            len++;

        for (int c = 0; c <= len; c++)
        if (c + j <= n)
        {
            int t = (i >= k ? 1 : 0);
            int tw = ways[len][c][1][t];
            if (i + (len - 1) * (2 * k) + k < n)
                add(tw, ways[len][c][0][t]);
            add(dp_place[i + 1][c + j], mult(dp_place[i][j], tw));
        }
    }

    assert(dp_place[paths][0] == 1);
    int ans = 0;
    for (int i = 0; i <= n; i++)
    {
        int cur = mult(dp_place[paths][i], fact[n - i]);
        if (i % 2 == 0)
            add(ans, cur);
        else
            sub(ans, cur);
    }

    cout << ans << endl;
}

int main()
{
    #ifndef ONLINE_JUDGE
   // freopen("input.txt", "rt", stdin);
   // freopen("output.txt", "w", stdout);
    #endif

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

    int n;
    while (cin >> n)
        solve(n);
}


Measured memory_bytes: 16000
// Main maut ko takiya, aur kafan ko chadaar banakar audhta hoon!

#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define pb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define len(a) int(a.size())

#ifdef ONLINE_JUDGE
    #define endl "\n"
#endif

//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

#define int ll
#define vll vector< int >
#define pll pair< int, int >
#define vvll vector< vll >
#define vpll vector< pll >

#define minpqll priority_queue<int,vector<int>,greater<int> >

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("O2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)

    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1)
    {
        cerr << name << " : " << arg1 << endl;
    }

    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args)
    {
        const char* comma = strchr(names + 1, ',');
        cerr.write(names, comma - names) << " : " << arg1 << "  ";
        __f(comma + 1, args...);
    }

#else
#define trace(...)
#endif // ifndef ONLINE_JUDGE

const double pi = 3.141592653589793238462643383279502884197169399375105820974944;
const double e = 2.71828182845904523536028747135266249775724709369995;
const int mod = 1e9 + 7;
const int inf = 2e18;
const int ninf = -2e18;
const int N5 = 1e5 + 10;
const int N6 = 1e6 + 10;

int power(int x, int y, int mod = inf)
{
    int ans = 1;
    x %= mod;
    while(y)
    {
        if(y&1)
            ans = (x * ans) % mod;

        x = (x * x) % mod;
        y >>= 1;
    }
    return ans;
}

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

    time_t t1, t2;
    t1 = clock();

    int n;
    cin>>n;

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

    bitset<5000000> s;

    s.set(0);

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

    int x = accumulate(a, a+n, 1LL);


    for(int i = x/2; ; i++)
    {
        if(s[i])
            return cout<<i, 0;
    }




    t2 = clock();
    #ifndef ONLINE_JUDGE
        cerr << endl << "time taken: " << t2 - t1 << endl;
    #endif // ONLINE_JUDGE

    return 0;
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define all(x) begin(x), end(x)
#define loop(i,n) for(int i=0; i<n; i++)
#define rep(i,a,b,c) for(int i=a; i<b; i+=c)
#define brep(i,a,b,c) for(int i=a; i>b; i-=c)
#define tc(t) int t; cin>>t; while(t--)
#define sz(v) int((v).size())
#define pb push_back


using namespace std;

void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {std::cout << x;}
void __print(unsigned x) {std::cout << x;}
void __print(unsigned long x) {std::cout << x;}
void __print(unsigned long long x) {std::cout << x;}
void __print(float x) {std::cout << x;}
void __print(double x) {std::cout << x;}
void __print(long double x) {std::cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i : x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
template <typename T> inline void inp(T &any) {cin >> any;} template <typename T, typename... U>inline void inp(T &a, U &...b) {cin >> a; inp(b...);}
#define rin(args...) ll args; inp(args);
#ifndef ONLINE_JUDGE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#define matdeb(mat,row,col) cout << #mat << "::" << endl; printmat(mat,row,col); printpartition;
#define debugv(v,n) cout << #v << ":" << endl; printv(v,0,n-1); printpartition;
#else
#define debug(x...)
#define matdeb(mat,row,col)
#define debugv(v,n)
#endif

const int maxm = 1000000000 + 7;

const ll MOD = 1e9 + 7;
const int INF = 55;
ll dp [INF] [INF * INF];

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}


//----------->CODE BEGINS --------------->


int main()
{

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

    IOS;

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

    int ans = 0;

    for(int i=1; i<=n; i++)
    {
      int c=0, t=i;

      for(int j=0; j<5; j++)
      {
         c += t%10;
         t /= 10;
      }
      

        if(a<=c && c<=b)
        {
          ans += i;
        }


    }

   cout<<ans<<endl;

}


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

using namespace std;

#define ll long long

int main() {
	string s;
	cin >> s;
	int A = (s[0] - '0') * 10 + (s[1] - '0');
	int B = (s[2] - '0') * 10 + (s[3] - '0');

	//cout << A << B << endl;

	bool YYMM = (1 <= B && B <= 12);
	bool MMYY = (1 <= A && A <= 12);

	if (YYMM) {
		if (MMYY) cout << "AMBIGUOUS" << endl;
		else cout << "YYMM" << endl;
	}
	else {
		if (MMYY) cout << "MMYY" << endl;
		else cout << "NA" << endl;
	}
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void){
    int A,B,C,D,E,x,y,cou=0,v[3];
    char S[3],s[3],X,Y;
    scanf("%d %d %d",&A,&B,&C);
    if((C>=A)&&(C<=B)){
        printf("Yes");
    }else{
        printf("No");
    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int lli;

int main(){
	int n,m;
	cin >> n >> m;
	int b[15], p[15], a[15];
	for(int i=0; i<n; i++){
		cin >> b[i];
	}
	for(int i=0; i<m; i++){
		cin >> p[i];
	}
	
	int aidx=0;
	for(int i=0; i<m; i++){
		for(int j=0; j<p[i]; j++){
			a[aidx] = i%2;
			aidx++;
		}
	}
	
	int ans = 1e9;
	for(int i=0; i<2; i++){
		vector<vector<int> > st(2);
		for(int j=0; j<n; j++){
			if(a[j]==i){
				st[0].push_back(j);
			}
			if(b[j]==1){
				st[1].push_back(j);
			}
		}
		if(st[0].size() != st[1].size()){
			continue;
		}
		
		int count = 0;
		for(int j=0; j<(int)st[0].size(); j++){
			count += abs(st[0][j]-st[1][j]);
		}
		ans = min(count, ans);
	}
	
	cout << ans << endl;
	return 0;
}

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

#define ll long long
#define INF 99999999
#define INF_LL 1LL << 60
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)(n); i >= 0; i--)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define RREP(i, a, n) for(int i = (int)(n); i >= a; i--)
#define all(x) (x).begin(),(x).end()

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

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

int main()
{
    string s;
    cin >> s;

    ll ans = 0;
    ll BC_count = 0;

    rrep(i, s.size()-1)
    {
        if( s[i] == 'A' && BC_count > 0 )
        {
            ans += BC_count;
        }
        else if( i-1 >= 0 && s[i] == 'C' && s[i-1] == 'B' )
        {
            BC_count++;
            i--;
        }
        else BC_count = 0;
        //if( i-2 > -1 )cout << ans << " " << BC_count << " " << s[i] << s[i-1] << s[i-2] << endl;
        //else cout << ans << " " << BC_count << endl;
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
# frozen_string_literal: true

n = gets.to_i
a = gets.split.map(&:to_i)

l = Hash.new {|h,k| h[k]=[]}
r = Hash.new {|h,k| h[k]=[]}

a.each_with_index do |e, i|
  l[e + i].push i
  r[i - e].push i
end
count = 0
l.each do |k, v|
  count += r[k].size * l[k].size if r[k]
end
puts count


Measured memory_bytes: 71360
import java.util.*;
import java.awt.geom.Point2D.Double;

public class Main {
    private static int MAX = 100000;

    public static void main(String[] args) throws Exception {
            // 入力
            int[]   A = new int[MAX];
            int     n;
            Scanner sc = new Scanner(System.in);
            n = Integer.parseInt(sc.nextLine());
            for (int i = 0; i < n; i++) {
                A[i] = Integer.parseInt(sc.next());
            }
            sc.close();

            // パーティション
            int     q = partition(A, 0, n - 1);

            // 出力
            for (int i = 0; i < n; i++) {
                if (i > 0) System.out.print(" ");
                if (i == q) System.out.print("[");
                System.out.print(A[i]);
                if (i == q) System.out.print("]");
            }
            System.out.println();
    }

    static int partition(int[] A, int p, int r) {
        int         x = A[r];       // 配列の末尾。判定の基準になる
        int         i = p - 1;      // A[r]以下を差す
        int         temp = 0;
        for (int j = p; j < r; j++) {
            if (A[j] <= x) {
                i = i + 1;
                temp = A[i];
                A[i] = A[j];
                A[j] = temp;
            }
        }
        temp = A[i + 1];
        A[i + 1] = A[r];
        A[r] = temp;
        return i + 1;
    }
}



Measured memory_bytes: 72364
isSeven = 0
n = input()
#print(len(n))
if (len(n)!=3):
  print("No")
  quit()
for i in n:
  i = int(i)
  if (i==7):
    isSeven = 1
if (isSeven!=0):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9112
import java.io.InputStream;
import java.util.NoSuchElementException;
public class Main {
	public static void main(String[] args)throws Exception{
		for(int i=0;i<5;i++){
			int x=nextInt();
			if(x==0)
				System.out.println(i+1);
		}
	}
	//FastScanner
	static InputStream in = System.in;
	static  byte[] buffer = new byte[1024];
	static int length = 0, p = 0;
	public static boolean hasNextByte () {
		if (p < length) return true;
		else {
			p = 0;
			try {length = in.read(buffer);}
			catch (Exception e) {e.printStackTrace();}
			if (length == 0) return false;
		}
		return true;
	}
	public static int readByte () {
		if (hasNextByte() == true) return buffer[p++];
		return -1;
	}
	public static boolean isPrintable (int n) {return 33<=n&&n<=126;}
	public static void skip () {
		while (hasNextByte() && !isPrintable(buffer[p])) p++;
	}
	public static boolean hasNext () {skip(); return hasNextByte();}
	public static String next () {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int temp = readByte();
		while (isPrintable(temp)) {
			sb.appendCodePoint(temp);
			temp = readByte();
		}
		return sb.toString();
	}
	public static int nextInt () {return Math.toIntExact(nextLong());}
	public static int[] nextInts (int n) {
		int[] ar = new int[n];
		for (int i=0; i<n; i++) ar[i] = nextInt();
		return ar;
	}
	public static long nextLong () {
		if (!hasNext()) throw new NoSuchElementException();
		boolean minus = false;
		int temp = readByte();
		if (temp == '-') {
			minus = true;
			temp = readByte();
		}
		if (temp<'0' || '9'<temp) throw new NumberFormatException();
		long n = 0;
		while (isPrintable(temp)) {
			if ('0'<=temp && temp<='9') {
				n *= 10;
				n += temp - '0';
			}
			temp = readByte();
		}
		return minus? -n : n;
	}
}


Measured memory_bytes: 32380
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;


int main() {
int N;
cin>>N;
int count=0;
ll A[N];

rep(i,N){
    cin>>A[i];
    if(A[i]<0){
        count++;
        
    }
}
ll ans=0;
if(count%2==0){
rep(i,N){
    ans+=abs(A[i]);
}

}
else{
    
    rep(i,N){
        ans+=abs(A[i]);
        A[i]=abs(A[i]);
    }
    sort(A,A+N);
    ans-=A[0]*2;
}
cout<<ans<<endl;


return 0;
}

Measured memory_bytes: 4432
#define  _CRT_SECURE_NO_WARNINGS
#pragma comment (linker, "/STACK:526000000")

#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144*2LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

unsigned long xor128() {
	static unsigned long x = 123456789, y = 362436069, z = 521288629, w = time(NULL);
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

void init() {
	iostream::sync_with_stdio(false);
	cout << fixed << setprecision(20);
}

#define int ll

struct Point {
	long double x;
	long double y;
	long double z;
};

long double dist(Point a, Point b) {
	return sqrt(pow(a.x - b.x, 2) + pow(a.y - b.y, 2) + pow(a.z - b.z, 2));
}

void solve(){
	int n, query;
	cin >> n >> query;
	vector<tuple<Point, long double, int>>  blocks;
	REP(i, n) {
		long double a, b, c, d;
		int e;
		cin >> a >> b >> c >> d >> e;
		blocks.push_back(make_tuple(Point{ a, b, c }, d, e));
	}
	REP(i, query) {
		Point a, b;
		cin >> a.x >> a.y >> a.z >> b.x >> b.y >> b.z;
		int ans = 0;
		REP(q, n) {
			long double bot = 0;
			long double top = 1;
			REP(j, 100) {
				long double mid1 = (bot + bot + top) / 3.00000L;
				long double mid2 = (bot + top + top) / 3.00000L;
				Point leftMid{ a.x + (b.x - a.x) * mid1,a.y + (b.y - a.y) * mid1,a.z + (b.z - a.z) * mid1 };
				Point rightMid{ a.x + (b.x - a.x) * mid2,a.y + (b.y - a.y) * mid2,a.z + (b.z - a.z) * mid2 };
				if (dist(leftMid, get<0>(blocks[q])) > dist(rightMid, get<0>(blocks[q]))) {
					bot = mid1;
				}
				else {
					top = mid2;
				}
			}
			Point leftMid{ a.x + (b.x - a.x) * bot,a.y + (b.y - a.y) * bot,a.z + (b.z - a.z) * bot };
			if (dist(leftMid, get<0>(blocks[q])) < eps + get<1>(blocks[q])) {
				ans += get<2>(blocks[q]);
			}
		}
		cout << ans << endl;
	}
}

#undef int
int main() {
	init();
	solve();
}


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

int compare(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

#define D_LEN 100000

int main(void) {
    int n;
    int d[D_LEN];

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

    qsort(d, n, sizeof(int), compare);
    printf("%d\n", d[n / 2] - d[n / 2 - 1]);

    return 0;
}


Measured memory_bytes: 892
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-02-16 07:25:37
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) { os << '{'; for (auto it = mp.begin(); it != mp.end(); ++it) { os << '{' << it->first << ':' << it->second << '}'; if (it != --mp.end()) os << ','; } os << '}'; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, const std::set<T>& st) { os << '{'; for (auto it = st.begin(); it != st.end(); ++it) { os << *it; if (it != --st.end()) os << ','; } os << '}'; return os; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...) 1728
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

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

  int r, g; cin >> r >> g;
  cout << 2 * g - r << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<string> svec;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
//#define int long long

void solve() {
    int a, b; cin >> a >> b;
	if(b % a == 0) {
    	cout << a + b << endl; return;
    } else {
    	cout << b - a << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N, K = [int(x) for x in input().strip().split()]
H = sorted([int(input()) for _ in range(N)])
ans = 10 ** 9
for n in range(N - (K - 1)):
    ans = min(ans, H[n+K-1] - H[n])

print(ans)

Measured memory_bytes: 45020
#include <iostream>
#include <string>
#include <cctype>

using namespace std;

int main(){
	const char *KEYWORDS[] = { "the", "this", "that" };
	string s;
	while(getline(cin, s)){
		for(int i = 0; i < 26; ++i){
			for(int j = 0; j < s.size(); ++j){
				if(islower(s[j])){ s[j] = (s[j] - 'a' + 1) % 26 + 'a'; }
			}
			bool accept = false;
			for(int j = 0; j < 3; ++j){
				if(s.find(KEYWORDS[j]) != string::npos){ accept = true; }
			}
			if(accept){ break; }
		}
		cout << s << endl;
	}
	return 0;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int mod2 = 998244353;

vector<int> to[105];

int main() {
  int n, k;
  cin >> n >> k;
  if (k > (n-1)*(n-2)/2) {
    cout << "-1" << endl;
    return 0;
  }
  FOR(i, 1, n) to[0].push_back(i);
  int l = (n-1)*(n-2)/2 - k;
  int m = n-1+l;
  FOR(i, 1, n-1) {
    FOR(j, i+1, n) {
      if (l == 0) break;
      to[i].push_back(j);
      l--;
    }
  }
  cout << m << endl;
  vector<pair<int, int>> edge(m);
  int j = 0;
  rep(i, n) {
    for (int c: to[i]) {
      edge[j].first = i+1;
      edge[j].second = c+1;
      j++;
    }
  }
  rep(i, m) {
    cout << edge[i].first << " " << edge[i].second << endl;
  }
}

Measured memory_bytes: 384
Q=  int(input())
dp = [False]*(100001)
for i in range(2,100001):
    if not dp[i]:
        for j in range(2*i,100001,i):
            dp[j] = True
A = []
for i in range(3,100001):
    if not dp[i] and not dp[(i+1)//2]:
        A.append(i)
from bisect import bisect_left, bisect_right
queries = []
for _ in range(Q):
    l,r = map(int,input().split())
    queries.append([l,r])
for l,r in queries:
    idl = bisect_left(A,l)
    idr = bisect_right(A,r)
    print(idr-idl)

Measured memory_bytes: 92424
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll N=1e6+5,inf=1e18,mod=1e9+7;
#define test ll testcases;cin>>testcases; while(testcases--)
#define lp(var,start,end) for (ll var = start; var <end ; ++var)
#define rlp(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define vld vector<ld>
#define pll pair<ll,ll> 
#define pld pair<ld,ld> 
#define vpll vector<pll>
#define vpld vector<pld>
#define all(X) X.begin(),X.end()
#define sz(x) ((ll)((x).size()))
const ld pi=3.141592653589793238;

bool check_prime(ll n)
{
	ll flag=0,i;
	for(i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			flag=1;
			break;
		}
	}
	if(n==1)
	{
		return false;
	}
	else if(flag==0 || n==2 || n==3)
	{
		return true;
	}
	else
	{
		return false;
	}
}

ll fastexpo(ll a,ll b,ll MOD) 
{
	ll result=1;
	while(b>0)
	{
		if(b%2==1)
		{
			result=(result*a)%MOD;
		}
		a=(a*a)%MOD;
		b=b/2;
	}
	return result;
}

ld pre=0.001;
ld dp[3005][3005];
ld p[3005];

ld fxn(ll r,ll k)
{
	ld s;
	ll i;
	if((dp[r][k]+1.0)>pre)
	{
		return dp[r][k];
	}
	if(r==0 && k==0)
	{
		return 1.0;
	}
	else if(r==0)
	{
		return 0.0;
	}
	else if(k==0)
	{
		s=1.0;
		for(i=1;i<=r;i++)
		{
			s*=(1-p[i]);
		}
		return s;
	}
	else
	{
		dp[r][k]=p[r]*fxn(r-1,k-1)+(1-p[r])*fxn(r-1,k);
		return dp[r][k];
	}
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,i,t,j;
    ld ans;
    cin>>n;
    for(i=1;i<=n;i++)
    {
    	cin>>p[i];
    }
    for(i=0;i<3005;i++)
    {
    	for(j=0;j<3005;j++)
    	{
    		dp[i][j]=-1.0;
    	}
    }
 	for(i=n;i>=0;i--)
 	{
 		for(j=n;j>=0;j--)
 		{
 			t=fxn(i,j);
 		}
 	}
 	ans=0.0;
 	for(i=(n+1)/2;i<=n;i++)
 	{
 		ans+=dp[n][i];
 	}
 	printf("%0.10Lf\n",ans);
	return 0;
}

Measured memory_bytes: 145228
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		String s = sc.nextLine();
		List<Character> duplicateCharList = new ArrayList<Character>();
		Map<Integer, Integer> posMap = new HashMap<Integer, Integer>();

		for (int i = 0; i < n; i++) {
			char ch = s.charAt(i);
			int lastIdx = s.lastIndexOf(ch);
			if (!duplicateCharList.contains(ch) && lastIdx != i) {
				duplicateCharList.add(ch);
				posMap.put(i, lastIdx);
			}
		}

		int maxCount = 0;
		for (int i = 0; i < n; i++) {
			int tmpCount = 0;
			Iterator<Integer> iter = posMap.keySet().iterator();
			while (iter.hasNext()) {
				int key = iter.next();
				if (key <= i && posMap.get(key) > i) {
					tmpCount++;
				}
			}
			if (maxCount < tmpCount) {
				maxCount = tmpCount;
			}
		}
		System.out.println(maxCount);

		sc.close();
	}
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000; //10^9
const ll inff = 1000000000000000000; //10^18

int a[3][3];
int x[3];
int y[3];

int main(){
    rep(i, 3) {
        rep(j, 3) cin >> a[i][j];
    }
    x[0] = 0;
    rep(i, 3) y[i] = a[0][i] - x[0];
    rep(i, 3) x[i] = a[i][0] - y[0];

    bool good = true;
    rep(i, 3) {
        rep(j, 3) {
            if(x[i]+y[j] != a[i][j]) {
                good = false;
            }
        }
    }

    if(good) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3600
#include <stdio.h>
int main(){
  
   int h , w ,a , b;
   while(1){
   scanf("%d%d" , &a , &b);
    if(a == 0 && b == 0){
     break;
    }
      for(h = 0;h < a; h++){
       for(w = 0;w < b; w++){
        printf("#"); 
       }
         printf("\n");   
      }
printf("\n");
   }

    return 0;


 }



Measured memory_bytes: 1916
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; }
vector<int> a;
vector<vector<int>> dp;
int rec(int l, int r) {
  if(dp[l][r] >= 0) return dp[l][r]; // memo
  if(r - l < 2) return dp[l][r] = 0;
  if(abs(a[l] - a[r-1]) <= 1) { // all clear
    if(rec(l+1, r-1) == (r-1) - (l+1)) {
      return dp[l][r] = r - l; 
    }
  }
  int res = 0;
  for (int i = l+1; i < r; ++i) {
    chmax(res, rec(l, i) + rec(i, r));
  }
  return dp[l][r] = res;
}

int main()
{
  vector<int> res;
  while(1) {
    int n; cin >> n;
    if(n == 0) break;
    a.resize(n);
    rep(i,n) cin >> a[i];
    dp.assign(n+1, vector<int>(n+1, -1));
    res.push_back(rec(0, n));
  }
  rep(i,res.size()) cout << res[i] << "\n";
  return 0;
}



Measured memory_bytes: 3292
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define pb push_back
#define debug(x) cerr <<__LINE__<< ": " << #x << " = " << x << endl
#define debug_vec(v) cerr<<__LINE__<<": "<<#v<<" = ";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

template <unsigned int mod>
struct ModInt {
    ll x;
    ModInt() : x(0) {}
    ModInt(ll y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) { if((x += p.x) >= mod) x -= mod; return *this; }
    ModInt &operator-=(const ModInt &p) { if((x += mod - p.x) >= mod) x -= mod; return *this; }
    ModInt &operator*=(const ModInt &p) { x = (int) (1LL * x * p.x % mod); return *this; }
    ModInt &operator/=(const ModInt &p) { *this *= p.inverse(); return *this; }
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt pow(int64_t n) const {
        ModInt ret(1), mul(x);
        while(n > 0) {
            if(n & 1) ret *= mul;
            mul *= mul;
            n >>= 1;
        }
        return ret;
    }
    ModInt inverse() const { return pow(mod - 2); }
    friend ostream &operator<<(ostream &os, const ModInt &p) {
        return os << p.x;
    }
};

const int mod = 1000000007;
using Mint = ModInt<mod>;

void solve() {
    int n, k;
    cin >> n >> k;
    Mint cnt[101010] = {0};
    Mint ans = 0;
    for (int i = k; i > 0; i--) {
        Mint x = Mint(k / i).pow(n);
        for (int j = i; j <= k; j += i) x -= cnt[j];
        cnt[i] = x;
        ans += x * i;
    }
    cout << ans << endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}


Measured memory_bytes: 4456
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
const lint MOD =1000000007;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
typedef map<lint,lint> M;
 
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;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 

  int main(){
     lint n,d;
     cin>>n>>d;
     lint ans=0;
     rep(i,n){
         lint x,y;
         cin>>x>>y;
         if(sqrt(x*x+y*y)<=d)ans++;
     }
     cout<<ans<<endl;
     }

Measured memory_bytes: 3680
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
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; }
//#define int long long

//各点からpow(2, k)　日進んだ時に行ける点を持っておけば、二部探索できる！！！！！
//ダブリング（初期化O(nlogn),各クエリO(logn)）

void solve() {
	int n; cin >> n;
    vector<int> x(n);
    rep(i, n) {
        cin >> x[i];
    }
    int l, q; cin >> l >> q;
    int r[20][100100], b[30][100100];
    //尺取り法
    int j = 0;
    rep(i, n) {
        while(j < n && x[j] - x[i] <= l) j++;
        r[0][i] = j - 1;
    }
    j = n - 1;
    per(i, n) {
        while(j > -1 && x[i] - x[j] <= l) j--;
        b[0][i] = j + 1;
    }
    //　実は前に進もうが、後ろに進もうが、考えた結果は同じでは？　<- ほんと？？
    for(int k = 0; k + 1 < 20; ++k) {
        rep(i, n) {
            r[k + 1][i] = r[k][r[k][i]];
            b[k + 1][i] = b[k][b[k][i]];
        }
    }
    //1日で確実に1つはいどうする！！
    while(q--) {
        int x, y; cin >> x >> y;
        --x; --y;
      if(y < x) swap(x, y);
        int res = 0;
        if(x < y) {
            for(int k = 19; k >= 0; --k) {
                if(r[k][x] < y) {
                    res += (1<<k);
                    x = r[k][x];
                }
            }
        } else {
            for(int k = 19; k >= 0; --k) {
                if(b[k][x] > y) {
                    res += (1<<k);
                    x = b[k][x];
                }
            }
        }
        cout << res + 1 << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}


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

int main(){
	int h, w;
	cin >> h >> w;
		
	string str[h];
	for(int i = 0; i < h; ++i){
		cin >> str[i];
	}

	string s1;
	for(int i = 0; i < w + 2; ++i){
		s1 += '#';
	}

	cout << s1 << endl;
	for(int i = 0; i < h; ++i){
		cout << '#' << str[i] << '#' << endl;
	}
	cout << s1 << endl;
	
	return 0;
}
	

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        Integer d[] = new Integer[k];
        Set<Integer> num = new HashSet<>();

        for( int i=0; i<k; i++ ){
            d[i] = sc.nextInt();
            Integer a[][] = new Integer[k][d[i]];

            for( int j=0; j<d[i]; j++ ){
                 a[i][j] = sc.nextInt();
                 num.add(a[i][j]);
            }
        }

        System.out.println( n-num.size() );

    }
}

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

int main() {
  int N;
  cin >> N;
  map<ll, int> M;
  for (int i = 0; i < N; i++) {
    ll A;
    cin >> A;
    M[A]++;
  }
  vector<ll> A;
  for (auto m : M) {
    if (m.second >= 4) {
      A.push_back(m.first);
      A.push_back(m.first);
    } else if (m.second >= 2) {
      A.push_back(m.first);
    }
  }
  sort(A.begin(), A.end(), greater<ll>());
  if (A.size() < 2) {
    cout << 0 << endl;
  } else {
    cout << A[0] * A[1] << endl;
  }
  return 0;
}

Measured memory_bytes: 6528
#include "bits/stdc++.h"
using namespace std;

/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int saisyo[100001] = {};
int nibanme[100001] = {};
int main() {
	int N;
	cin >> N;
	if (N % 2 == 0) {
		cout << N;
	}
	else {
		cout << N * 2;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

struct Combination {
    vector<int64_t> fact, rfact;
    Combination(int sz) : fact(sz + 1), rfact(sz + 1) {
        fact[0] = 1;
        for(int i = 1; i < fact.size(); i++){
            fact[i] = fact[i - 1] * i % mod;
        }
        rfact[sz] = inv(fact[sz]);
        for(int i = sz - 1; i >= 0; i--){
            rfact[i] = rfact[i + 1] * (i + 1) % mod;
        }
    }
    int64_t inv(int x) const {
        return pow(x, mod - 2);
    }
    int64_t pow(int64_t x, int64_t n) const {
        int64_t ret = 1;
        while(n > 0){
            if(n & 1) (ret *= x) %= mod;
            (x *= x) %= mod;
            n >>= 1;
        }
        return (ret);
    }
    int64_t P(int n, int r) const {
        if(r < 0 || n < r) return (0);
        return (fact[n] * rfact[n - r] % mod);
    }

    int64_t C(int p, int q) const {
        if(q < 0 || p < q) return (0);
        return (fact[p] * rfact[q] % mod * rfact[p - q] % mod);
    }

    int64_t H(int n, int r) const {
        if(n < 0 || r < 0) return (0);
        return (r == 0 ? 1 : C(n + r - 1, r));
    }
};

int dp[1010], nxt[1010];

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    Combination cb(100000);
    dp[0] = cb.fact[n];
    for(int i = a; i <= b; i++){
        for(int j = 0; j <= n; j++) nxt[j] = dp[j];
        for(int j = 0; j < n; j++){
            int tmp = cb.pow(cb.inv(cb.fact[i]), c - 1);
            for(int k = c; k <= min(d, (n - j) / i); k++){
                tmp *= cb.inv(cb.fact[i]);
                tmp %= mod;
                nxt[j + k * i] += dp[j] * tmp % mod * cb.inv(cb.fact[k]) % mod;
                nxt[j + k * i] %= mod;
            }
        }
        swap(dp, nxt);
    }
    cout << dp[n] << endl;
}

Measured memory_bytes: 1792
#include<stdio.h>
int main(){
	int a,b,c;
	scanf("%d %d",&a,&b);
	c = a - b;
	if(c<0){
		printf("a < b\n");
	}else if(c>0){
		printf("a > b\n");
	}else{
		printf("a == b\n");
	}
	return 0;
}

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

int main() {
  int a,b;
  cin>>a>>b;
  if(a==b)puts("Draw");
  else if(b==1)puts("Bob");
  else if(a==1||a>b)puts("Alice");
  else puts("Bob");
  return 0;
}


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

using namespace std;

int main(){

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

  
  vector<int > zunuke(k, 0);
  for (int i = 0; i < n; i++)
  {
    int d;
    cin >> d;
    for (int j = 0; j < d; j++)
    {
      int tmp;
      cin >> tmp;
      zunuke[tmp-1]++;
    }
  }
  
  int ans = 0;
  for (int i = 0; i < k; i++)
  {
    if( zunuke[i] == 0 ){
      ans++;
    }
  }
  
  cout << ans << endl;
  

  return 0;
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
#define fastio ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define display(v) for (auto x : v) cout << x << ", "
#define print(x) cout << (#x) << " = [ ";display(x); cout << "]\n"
#define endl '\n'
#define pb push_back
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
 
// DEBUG TEMPLATE by livw
void __print(int x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifdef INCLUDEWHENOFFLINE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif



int main()
{
    fastio;
    
    int n;
    cin >> n;
    int arr[n];
    for (auto &x : arr) cin >> x;
    int dp[n];
    dp[0] = 0;
    dp[1] = abs(arr[1] - arr[0]);
    for (int i = 2; i < n; i++)
    {
        dp[i] = min(dp[i - 1] + abs(arr[i - 1] - arr[i]), 
                    dp[i - 2] + abs(arr[i - 2] - arr[i]));
    }
    cout << dp[n - 1];
    return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <math.h>
#include <cstdlib>
#include <iostream>
#include <cstdlib>
using namespace std;

int main(){
	long long int m,h;
	cin>>m;
	h=(m/500)*1000;
	m=m-(m/500)*500;
	h=h+(m/5)*5;
	cout<<h;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<utility>//swapでaとbの値を入れ替える
#define rep(i,n) for(int i=0;i<(n);i++)
#define ll long long
#define sort(s) sort(s.begin(),s.end())
#define r(s) reverse(s.begin(),s.end())
using namespace std;
int main(){
	int a;
	cin >> a;
	cout << 180 * (a - 2) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
#define Rep(i,n) for(long long i=1; i<n; i++)
#define ll long long
#include <math.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>


using namespace std;
#define PI acos(-1)

int main(){
    ll K,A,B;
    cin>>K>>A>>B;
    while(A<=B){
        if(A%K==0){cout<<"OK"<<endl;return 0;}
        A++;
    }
    cout<<"NG"<<endl;
}



Measured memory_bytes: 3640
from collections import deque

H, W = list(map(int,input().split()))
s = []
for i in range(H):
    s.append(input())
    
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
sx, sy = 0, 0
gx, gy = W - 1, H - 1

def bfs():
    q = deque([])
    d = [[-1 for _ in range(W)] for _ in range(H)]
    q.append([sx, sy])
    d[sy][sx] = 0
    
    while(q):
        pop = q.popleft()
        x, y = pop[0], pop[1]
        if x == gx and y == gy:
            break
        for i in range(4):
            nx = x + dx[i]
            ny = y + dy[i]
            if 0 <= nx and nx < W and ny >= 0 and ny < H:
                if s[ny][nx] != "#" and d[ny][nx] == -1:
                    q.append([nx, ny])
                    d[ny][nx] = d[y][x] + 1
    return d[gy][gx]
                
ret = bfs()   

count = 0
for i in range(W):
    for j in range(H):
        if s[j][i] == "#":
            count += 1           
        
ans = H * W - (ret - 1) - count - 2
if ret == -1:
  	print(-1)
else:
	print(ans)

Measured memory_bytes: 40688