akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

vector<int> g[2020];
bool used[2020];
int lim;

void dfs(int now,int d){
  if(d>lim) return;
  used[now]=true;
  for(int i=0;i<g[now].size();i++){
    int u=g[now][i];
    if(used[u]) continue;
    dfs(u,d+1);
  }
  return;
}

int main(){
  int n,k;
  cin>>n>>k;
  vector<pair<int,int>> edge;
  for(int i=0;i<n-1;i++){
    int a,b;
    cin>>a>>b;
    g[a].push_back(b);
    g[b].push_back(a);
    edge.push_back(make_pair(a,b));
  }

  int ans=n;
  lim=k/2;
  if(k%2==0){
    for(int i=1;i<=n;i++){
      for(int j=0;j<=n;j++) used[j]=false;
      dfs(i,0);

      int cnt=0;
      for(int j=1;j<=n;j++){
        if(!used[j]) cnt++;
      }
      ans=min(ans,cnt);
    }
  }else{
    for(int i=0;i<n-1;i++){
      bool used1[n+1];
      for(int j=0;j<=n;j++){
        used[j]=false;
        used1[j]=false;
      }
      dfs(edge[i].first,0);
      for(int j=1;j<=n;j++){
        used1[j]=used[j];
        used[j]=false;
      }
      dfs(edge[i].second,0);

      int cnt=0;
      for(int j=1;j<=n;j++){
        if(!used[j]&&!used1[j]) cnt++;
      }
      ans=min(ans,cnt);
    }
  }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 384
/*
 * main.c
 *
 *  Created on: 2019/04/20
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>


unsigned long long int ope(unsigned long long int* a)
{
    if(((*a)%2) == 1) {
        *a -= 1;
    }
    *a = *a/2;
    return (*a);
}

int main()
{
    unsigned long long int A,B;
    int K = 0;
    int i = 0;
    scanf("%llu %llu %d", &A, &B, &K);
    for(i = 0; i < K; i++) {
        if((i%2) == 0) {
            // takahashi
            B += ope(&A);
        } else {
            // aoki
            A += ope(&B);
        }
    }
    printf("%llu %llu\n", A, B);
    return 0;
}


Measured memory_bytes: 128
//*--  ILSH  --*//
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
#define pb push_back 
#define pop pop_back
#define mp make_pair
#define vii vector < int >
#define vll vector < ll > 
#define pii pair < int , int >
#define pll pair < ll , ll >
#define vpi vector < pii >
#define vpl vector < pll >
#define fi first
#define sz size 
#define se second 
#define len length
const int N=2e5+5;
const ll inf=1e18+1e17;
void solve(){
	int n;
	cin>>n;
	int arr[n];
	int count=0;
	for ( int i=0;i<n;i++)
		cin>>arr[i];
	for ( int i=0;i<n-2;i++){
		vii v;
		for ( int j=i;j<i+3;j++)
			v.pb( arr[j]);
		sort( v.begin(),v.end());
		if ( v[1]==arr[i+1])
			count++;
	}
	cout<<count<<'\n';

}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
   // cin>>t;
    while ( t-- ){
    	solve();
    }
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security.Cryptography.X509Certificates;

namespace hello_world
{class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			string[] input = new string[n];
			for(int i = 0; i < n; i++)
			{
				input[i] = Console.ReadLine();
			}
			Console.WriteLine(input.Distinct().Count());
		}


	}

}

	

Measured memory_bytes: 48372
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll a, b, c, d, e, n;
  in(n);
  e = 999999999999;
  rep2(i, 1, 100000){
    a = i;
    if(n % a != 0)
      continue;
    b = n / a;
    c = d = 0;
    while(a > 0){
      a = a / 10;
      c++;
    }
    while(b > 0){
      b = b / 10;
      d++;
    }
    c = max(c, d);
    e = min(e, c);
  }
  out(e);
  memi;
}

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

using i64=int64_t;

#define rep(i,x,y) for(i64 i=i64(x),i##_max_for_repmacro=i64(y); i<i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif
 
const int inf=1.01e9;
const i64 inf64=4.01e18;
const double eps=1e-9;
 
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    int A,B,C,D;
    string s;
    cin >> s;

    A=s[0]-'0';
    B=s[1]-'0';
    C=s[2]-'0';
    D=s[3]-'0';

    if(A-B-C-D==7){
        cout << A << "-" << B << "-" << C << "-" << D << "=7" << endl;
        return;
    }
    if(A-B-C+D==7){
        cout << A << "-" << B << "-" << C << "+" << D << "=7" << endl;
        return;
    }
    if(A-B+C-D==7){
        cout << A << "-" << B << "+" << C << "-" << D << "=7" << endl;
        return;
    }
    if(A-B+C+D==7){
        cout << A << "-" << B << "+" << C << "+" << D << "=7" << endl;
        return;
    }
    if(A+B-C-D==7){
        cout << A << "+" << B << "-" << C << "-" << D << "=7" << endl;
        return;
    }
    if(A+B-C+D==7){
        cout << A << "+" << B << "-" << C << "+" << D << "=7" << endl;
        return;
    }
    if(A+B+C-D==7){
        cout << A << "+" << B << "+" << C << "-" << D << "=7" << endl;
        return;
    }
    if(A+B+C+D==7){
        cout << A << "+" << B << "+" << C << "+" << D << "=7" << endl;
        return;
    }
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 256
import collections
import sys
sys.setrecursionlimit(2000000)
# import math
# import itertools
# import statistics
# import numpy as np
n = int(input())
#a = list(map(int, input().split()))
a = []
for i in range(n):
    a.append(int(input()))

ans = collections.Counter(a)

count = 0
for i in ans.values():
    if i % 2 != 0:
        count += 1

print(count)


Measured memory_bytes: 16612
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1e9+7,maxlen=200000;

int n,m,x,y,ans=0;
int a[maxlen+5],b[maxlen+5],jc[maxlen+5];

int quick_power(int a,int b)
{
	int res=1;
	for (;b;b=b>>1,a=(a*a)%mod)
	{
		if (b&1)  res=(res*a)%mod;
	}
	return res;
}

int ny(int k)
{
	return quick_power(k,mod-2)%mod;
}

int C(int n,int k)
{
	if (k==0||n==k)  return 1;
	if (2*k>n)  k=n-k;
	
	return ((jc[n]*ny(jc[k]))%mod*ny(jc[n-k]))%mod;
}

inline void init()
{
	jc[0]=1;
	for (int i=1;i<=maxlen;i++)  jc[i]=(jc[i-1]*i)%mod;
}

signed main()
{
	cin>>n>>m>>x>>y;
	init();
	
	for (int i=y+1;i<=m;i++)  a[i]=C((n-x-1)+(i-1),(i-1));
	for (int i=y+1;i<=m;i++)  b[i]=C((m-i)+(x-1),(m-i));
	
	for (int i=y+1;i<=m;i++)  ans=(ans+a[i]*b[i])%mod;
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 4352
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define iout(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define REP(x,l,u) for(ll x = l;x<u;x++)
#define RREP(x,l,u) for(ll x = l;x>=u;x--)
#define complete_unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define mst(x,a) memset(x,a,sizeof(x))
#define all(a) a.begin(),a.end()
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-(x)))
#define lson (ind<<1)
#define rson (ind<<1|1)
#define se second
#define fi first
#define sz(x) ((int)x.size())
#define EX0 exit(0);

typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
using namespace std;
typedef vector<ll> VLL;
typedef vector<int> VI;
const int block_size = 320;
typedef complex<ll> point;
const ll mod = 1e9 + 7;
const ll inf = 1e9 + 7;
const ld eps = 1e-9;
const db PI = atan(1) * 4;

template<typename T, typename S>inline bool upmin(T&a, const S&b) { return a > b ? a = b, 1 : 0; }
template<typename T, typename S>inline bool upmax(T&a, const S&b) { return a < b ? a = b, 1 : 0; }

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a%b); }
namespace SOLVE {
	vector<VI> e;
	VI incount;
	void main() {
		int n, m, a, b;
		cin >> n >> m;
		e.resize(n + 5);
		incount.resize(n + 5);

		REP(i, 0, m) {
			cin >> a >> b;
			e[a].push_back(b);
			incount[b]++;
		}

		queue<int> q;
		REP(i, 1, n + 1) {
			if (incount[i] == 0) {
				q.push(i);
			}
		}

		VI maxdistance(n + 5);
		int thisv;
		int ans = 0;
		while (sz(q)) {
			int thisv = q.front();
			for (int v : e[thisv]) {
				maxdistance[v] = max(maxdistance[v], maxdistance[thisv] + 1);
				ans = max(maxdistance[v], ans);
				incount[v]--;
				if (incount[v] == 0) {
					q.push(v);
				}
			}
			q.pop();
		}
		cout << ans;
	}
}


signed main() {

	int t;
	//    in(t);
	t = 1;
	while (t--) {
		SOLVE::main();

	}

	return 0;
}


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

#define mp make_pair
#define pb push_back

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> l4;


bool valid[10];
inline bool solve(int n)
{
  while (n)
    {
      if (!valid[n%10])
	return false;
      n /= 10;
    }
  return true;
}
int main()
{
  int n, k;
  scanf("%d %d", &n, &k);
  memset(valid, 1, sizeof(valid));
  for (int i = 0; i < k; ++i)
    {
      int x;
      scanf("%d", &x);
      valid[x] = false;
    }
  while (!solve(n))
    ++n;
  printf("%d\n", n);
}


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

int main(){

	int n; cin >> n;
	
	int prea;
	int cnt = 0,ans = 0;
	
	for(int i=0;i<n;i++)
	{
		int a;cin>>a;
		if(i == 0) 
		{
			prea = a;
			continue;
		}
		
		if(a == prea) 
		{
			cnt++;
		}
		else
		{
			prea = a;
			ans += (cnt+1)/2;
			cnt = 0;
		}
		
		
	}
	
	ans += (cnt+1)/2;
	
	cout << ans << endl;
	return 0;
}


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

int isprime(int x){

  if(x == 2) return 1;
  else if( (x < 2) || (x % 2 == 0) ) return 0;

  int i = 3;

  while(i <= std::sqrt( (double)x )){
    if( (x % i) == 0) return 0;
    i = i + 2;
  }

  return 1;
}


int main(){

  int count = 0;
  int n, x;

  std::cin >> n;

  for(int i = 0; i < n; i++){
    std::cin >> x;
    count += isprime(x);
  }

  std::cout << count << std::endl;

  return 0;
}

Measured memory_bytes: 3072
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] b = new int[N-1];
        int sum = 0;
        for(int i = 0; i < N-1; i++) {
            b[i] = sc.nextInt();
        }
        sum += b[0];
        for(int i = 1; i < N-1; i++) {
            sum += min(b[i-1], b[i]);
        }
        
        sum += b[N-2];

        System.out.println(sum);

    }
    
    public static int min(int x, int y) {
        if(x < y) {
            return x;
        }else {
            return y;
        }
    }
}


Measured memory_bytes: 23252
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <chrono>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

using namespace std;

int N;

void dfs(vector<int> &visited, vector<pair<int, int>> *g, int curr) {
    for (auto e : g[curr]) {
        if (visited[e.first] == -1) {
            visited[e.first] = e.second ^ visited[curr];
            dfs(visited, g, e.first);
        }
    }
}

int main() {
    cin >> N;
    vector<pair<int, int>> g[N + 1];
    int u, v, w;
    for (int i = 0; i < N - 1; i++) {
        cin >> u >> v >> w;
        g[u].push_back({v, w % 2});
        g[v].push_back({u, w % 2});
    }

    vector<int> visited(N + 1, -1);
    visited[1] = 1;
    dfs(visited, g, 1);

    for (int i = 1; i <= N; i++) {
        cout << to_string(visited[i]) << endl;
    }
    return 0;
}


Measured memory_bytes: 8192
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <list>
#define INF 10000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef long double ld;
using namespace std;
queue<int> vertex;
int n;
int ans = 0;
int graph[10][10] = { };
void dfs(int p, int check[]){
	int t = 1;
	REP(i, n){
		if(check[i] == 0) t = 0;
	}
	if(t == 1) ans++;
	REP(i, n){
		if(graph[p][i] == 1 && check[i] == 0){
			check[i] = 1;
			dfs(i, check);
			check[i] = 0;
		}
	}
	return;
}
int main(){
	int m;
	cin >> n >> m;
	int check[n] = { };
	REP(i, m){
		int a, b;
		cin >> a >> b;
		graph[a-1][b-1] = 1;
		graph[b-1][a-1] = 1;
	}
	check[0] = 1;
	dfs(0, check);
	cout << ans << endl;
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = 99999999;
const ll linf = 999999999999999999;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


int main(){
	ll n,k;
	cin >> n >> k;

    ll ans = k;
	
    rep(i,1,n)ans *= k-1;
    P(ans);
	return  0;
}

Measured memory_bytes: 256
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
ans=0
for i in range(n):
    a=list(map(int,input().split()))
    d=0
    for j in range(m):
       d+=a[j]*b[j]
    if(d+c>0):
        ans+=1
print(ans)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();

            long sum = 0;
            long[] A = new long[N];
            for (int i = 0; i < N; i++) {
                A[i] = sc.nextLong();
                sum += A[i];
            }

            long left = 0;
            long right = 0;
            long mid = 0;
            for (int i = 0; i < N; i++) {
                left += A[i];
                if (left >= sum / 2) {
                    right = sum - left;
                    left -= A[i];
                    mid = A[i];
                    break;
                }
            }

            long ans = Math.min(left, right) + mid - Math.max(left, right);

            System.out.println(ans);
        }
    }

}


Measured memory_bytes: 83608
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
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;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

#define BLACK 0
#define WHITE 1

V<vvll> edges;
vll d, bw;
ll bmin = HIGHINF, wmin = HIGHINF, tmp;
bool change = false;

bool dfs(ll i) {
  if (bw[i] == BLACK) chmin(bmin, d[i]);
  else chmin(wmin, d[i]);
  for (auto toe: edges[i]) {
    ll s = toe[0], to = toe[1];
    if (bw[to] == -1) {
      bw[to] = (bw[i] + 1) % 2;
      d[to] = s - d[i];
      if (!dfs(to)) return false;
    }
    if (bw[i] != bw[to]) {
      // 辺の色が違う時は和が一定なのでsにならないといけない
      if (d[i] + d[to] != s) return false;
    } else {
      ll val = (bw[i]==BLACK?1:-1) * (s-d[i]-d[to]);
      if (!change) {
        tmp = val; change=true;
      }
      if (val % 2 == 1 || tmp != val) {  // どれだけ変えるかがマッチしないなら
        return false;
      }
    }
  }
  return true;
}

int main() {
  ll n, m; cin >> n >> m;
  edges.resize(n);
  REP(i, m) {
    ll u, v, s; cin >> u >> v >> s;
    vll sv(2); sv[0] = s; sv[1] = v-1;
    edges.at(u-1).push_back(sv);
    sv[1] = u-1;
    edges.at(v-1).push_back(sv);
  }
  bw.resize(n); REP(i, n) bw[i] = -1; bw[0] = 0;  // BLACK: 0, WHITE: 1
  d.resize(n); REP(i, n) d[i] = 0;
  if (!dfs(0)) {
    cout << 0 << endl;
  } else {
    if (change) {
      if (tmp/2+bmin<=0 || wmin+tmp/2<=0) cout << 0 << endl;
      else cout << 1 << endl;
    } else {
      cout << max(0LL, wmin+bmin-1) << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 25984
import java.util.*;
public class Main {
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long L [] = new long[N+1];
        long DP[] = new long[N+1];
        long DP2[] = new long[N+1];
        int list[] = new int[N+1];
        Arrays.fill(L,0);
        Arrays.fill(DP,0);
        Arrays.fill(DP2,0);
        long sum = 0;
        for(int i=1;i<=N;i++){
            int num = sc.nextInt();
            L[num]++;
            list[i]=num;
        }
        for(int i=1;i<=N;i++) {
            if(L[i]!=0){
                DP[i] = (L[i]*(L[i]-1))/2;
                DP2[i] = ((L[i]-1)*(L[i]-2))/2;
                sum+=DP[i];
            }
        }
        for(int i=1;i<=N;i++){
           long opt = sum-DP[list[i]]+DP2[list[i]];
            System.out.println(opt);
        }
    }
}

Measured memory_bytes: 106844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	string s;
	cin>>s;
	for(ll i=0;i<s.size();i++){
		cout << "x";
	}
	// your code goes here
	return 0;
}

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

template <typename T>
using vector2d = vector<vector<T>>;

// cost, a, b
using Edge = tuple<int, int, int>;
const int INF = 1e8;

namespace UnionFind {
template <typename T>
void init(vector<T> &u) {
    for (int i = 0; i < u.size(); i++) {
        u[i].parent = i;
        u[i].group.insert(i);
    }
}
template <typename T>
int root(vector<T> &u, int x) {
    if (x < 0 || u.size() <= x) {
        return -1;
    } else if (u[x].parent == x) {
        return x;
    } else {
        return u[x].parent = root(u, u[x].parent);
    }
}
template <typename T>
bool connect(vector<T> &u, int a, int b) {
    a = root(u, a), b = root(u, b);
    if (a == b || a < 0 || b < 0) return false;
    {
        u[a].group.insert(u[b].group.begin(), u[b].group.end());
        u[b].group.clear();
    }
    u[b].parent = a;
    return true;
}
// O(u.size())
template <typename T>
void count(vector<T> &u, map<int, int> &ret) {
    for (int i = 0; i < u.size(); i++) {
        int tmp = u[i].parent;
        if (!ret.count(tmp)) {
            ret[tmp] = 0;
        }
        ret[tmp]++;
    }
}
};  using namespace UnionFind;

struct Node {
    int parent;
    set<int> group;
};

int main() {
    #ifdef DEBUG
    std::ifstream in("/home/share/inputf.in");
    std::cin.rdbuf(in.rdbuf());
    #endif
    int N, M;
    cin >> N >> M;
    int ans = 0;
    vector<Edge> edge;
    vector<Node> tree(N);
    init(tree);
    vector2d<int> D(N, vector<int>(N, INF));
    for(int i = 0; i < N; i++) {
        D[i][i] = 0;
    }
    for(int i = 0; i < M; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        a--, b--;
        if(a == b) {
            ans++;
            continue;
        }
        edge.emplace_back(c, a, b);
    }
    sort(edge.begin(), edge.end());
    for(int i = 0; i < edge.size(); i++) {
        int c, a, b;
        tie(c, a, b) = edge[i];
        bool place_flag = false;
        if(root(tree, a) != root(tree, b)) {
            connect(tree, a, b);
            place_flag = true;
        }
        set<int> &s = tree[root(tree, a)].group;
        for(auto j = s.begin(); j != s.end(); j++) {
            for (auto k = s.begin(); k != s.end(); k++) {
                int C = min(D[*j][a] + c + D[b][*k],
                             D[*k][a] + c + D[b][*j]);
                if (D[*j][*k] >= C) {
                    D[*j][*k] = C;
                    place_flag = true;
                }
            }
        }
        if(!place_flag) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
import java.util.*;
public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n];
        for (int i = 1; i <= n; i++) {

            int x = in.nextInt() - 1;
            a[x] = i;

        }

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

            System.out.print(a[i] + " ");

        }
        System.out.println(a[n - 1]);

    }

}


Measured memory_bytes: 62512
using System;
using System.Collections.Generic;
class Program{
  static void Main(string[] args){
    string[] tmp=Console.ReadLine().Split(' ');
    int n=int.Parse(tmp[0]);
    int m=int.Parse(tmp[1]);
    string[] tmpx=Console.ReadLine().Split(' ');
    int[] x=new int[m];
    for(int i=0;i<m;i++){x[i]=int.Parse(tmpx[i]);}
    Array.Sort(x);
    int[] d=new int[m-1];
    for(int i=0;i<m-1;i++){d[i]=x[i+1]-x[i];}
    Array.Sort(d);
    int p=0;
    if(m>n){for(int i=0;i<m-n;i++){p+=d[i];}}
    Console.WriteLine(p);
  }
}

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

int main(){
  int N;
  cin >> N;
  vector<int> X(N);
  for(int i=0; i<N; i++) cin >> X.at(i);
  int ans=1000001;
  for(int i=1; i<=100; i++){
    int temp=0;
    for(int j=0; j<N; j++){
      temp+=(X.at(j)-i)*(X.at(j)-i);
    }
    ans = min(ans, temp);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
class Main{
    static Scanner sc = new Scanner(System.in);
    public static void main(String args[]){
        long n=sc.nextLong(),a=0;
      	int s=(int)Math.sqrt(n);
        for(int i=1;i<=s;i++){
            if(n%i==0) a=i;
        }
        System.out.println(1+(int)Math.log10(n/a));
    }
}

Measured memory_bytes: 35452
A=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k=int(input())
print(A[k-1])

Measured memory_bytes: 3060
N = int(input())
a = list(map(int, input().split()))
c = [False] * 8
o = 0
for i in range(N):
    for j in range(8):
        if a[i] >= 400*j and a[i] < 400*(j+1):
            c[j] = True
    if a[i] >= 3200:
        o += 1
if c.count(True) > 0:
    print(c.count(True), c.count(True)+o)
else:
    print(1, o)


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

int main(){
    int count[128]={};
    char ch;

    while( cin >> ch){
        if (isalpha(ch)){
            int num = ch - 'a';
            if ( isupper(ch)){
                num = num + 32;
            }
            count[num]++;
        }
    }
    cout << "a : " << count[0] << '\n';
    cout << "b : " << count[1] << '\n';
    cout << "c : " << count[2] << '\n';
    cout << "d : " << count[3] << '\n';
    cout << "e : " << count[4] << '\n';
    cout << "f : " << count[5] << '\n';
    cout << "g : " << count[6] << '\n';
    cout << "h : " << count[7] << '\n';
    cout << "i : " << count[8] << '\n';
    cout << "j : " << count[9] << '\n';
    cout << "k : " << count[10] << '\n';
    cout << "l : " << count[11] << '\n';
    cout << "m : " << count[12] << '\n';
    cout << "n : " << count[13] << '\n';
    cout << "o : " << count[14] << '\n';
    cout << "p : " << count[15] << '\n';
    cout << "q : " << count[16] << '\n';
    cout << "r : " << count[17] <<'\n';
    cout << "s : " << count[18] << '\n';
    cout << "t : " << count[19] << '\n';
    cout << "u : " << count[20] << '\n';
    cout << "v : " << count[21] <<'\n';
    cout << "w : " << count[22] <<'\n';
    cout << "x : " << count[23] << '\n';
    cout << "y : " << count[24] << '\n';
    cout << "z : " << count[25] << '\n';
    
    return 0;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
#define ll long long

using namespace std;

int main(){
	int n, w;
	cin >> n >> w;

	int wt[n], val[n];
	ll sum_value = 0;
	for(int i=0;i<n;i++){
		cin >> wt[i] >> val[i];
		sum_value += val[i];
	}

	vector<ll> dp(sum_value+1, 1e18);
	dp[0] = 0;
	for(ll i=0;i<n;i++){
		for(ll j=sum_value-val[i];j>=0;j--){
			dp[j+val[i]] = min(dp[j+val[i]], dp[j]+wt[i]);
		}
	}

	ll res = -1;
	for(ll i=0;i<=sum_value;i++){
		if(dp[i] <= w){
			res = max(res, i);
		}
	}

	cout << res << endl;
	return 0;
}

Measured memory_bytes: 4044
n = int(input())
total = []

for i in range(1, n + 1):
    if i % 15 == 0:
        "FizzBuzz"
    elif i % 3 == 0:
        "Fizz"
    elif i % 5 == 0:
        "Buzz"
    else:
        total.append(i)

print(sum(total))

Measured memory_bytes: 30168
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
using namespace std;
const ll N=500010;

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

    ll a,b;
    cin>>a>>b;
    ll ans=(a*b)/__gcd(a,b);
    cout<<ans;

    return (0);
}


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second

//int dxy[5] = {0, 1, 0, -1, 0};
// assign avl ncm dijkstra geo2 kruskal graph uf lca BIT
// matrix dinic next_combination topcoder lcm

typedef int Weight;
typedef int Flow;
struct Edge {
    int s, d; Weight w; Flow c;
    Edge() {};
    Edge(int s, int d, Weight w = 1) : s(s), d(d), w(w), c(w) {};
};
bool operator<(const Edge &e1, const Edge &e2) { return e1.w < e2.w; }
bool operator>(const Edge &e1, const Edge &e2) { return e2 < e1; }
inline ostream &operator<<(ostream &os, const Edge &e) { return (os << '(' << e.s << ", " << e.d << ", " << e.w << ')'); }

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;

void addArc(Graph &g, int s, int d, int w = 1) {
    g[s].push_back(Edge(s, d, w));
}
void addEdge(Graph &g, int a, int b, int w = 1) {
    addArc(g, a, b, w);
    addArc(g, b, a, w);
}

//単一始点最短経路(負閉路なし)
//Dijkstra O((|E|+|V|)log|V|)
//dist: 始点から各頂点までの最短距離, assignされるので安心して欲しい
//戻り値: 最短経路木の親頂点(根は-1)
vector<int> dijkstra(const Graph &g, int s, Array &dist) {
    int n = g.size();
    assert(s < n);
    enum { WHITE, GRAY, BLACK };
    vector<int> color(n, WHITE); color[s] = GRAY;
    vector<int> prev(n, -1);
    dist.assign(n, INF); dist[s] = 0;
    //始点からの最短距離 子 親
    typedef pair< int, pair < int, int > > State;
    priority_queue<State, vector<State>, greater<State> > pq;
    pq.push(State(0, i_i(s, -1)));
    while (pq.size()) {
        Weight d = pq.top().first; 
        int v = pq.top().second.first, u = pq.top().second.second; 
        pq.pop();
        if (dist[v] < d)continue;
        color[v] = BLACK; prev[v] = u;
        for (int i = 0; i < g[v].size(); i++) {
            Edge e = g[v][i];
            if (color[e.d] == BLACK)continue;
            if (dist[e.d] > dist[v] + e.w) {
                dist[e.d] = dist[v] + e.w;
                pq.push(State(dist[e.d], i_i(e.d, v)));
                color[e.d] = GRAY;
            }
        }
    }
    return prev;
}

signed main()
{
    Int(n);
    Graph g(n);
    Rep(i, n) {
        int3(a, b, c);
        a--; b--;
        addEdge(g, a, b, c);
    }
    int2(q, k);
    k--;
    vi dist;
    dijkstra(g, k, dist);
    while (q--) {
        int2(x, y);
        x--; y--;
        std::cout << dist[x] + dist[y] << std::endl;
    }



    return 0;
}


Measured memory_bytes: 19564
/*	
	:)
*/
#include <bits/stdc++.h> 
using namespace std;
#define fl(i,a,b) for(int i=a;i<b;i++)
#define endl '\n'
#define pb push_back
#define ff first
#define ff first
#define ss second
#define inf 2e18
#define mod 998244353
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define mx 205
#define ll long long
#define pi 3.1415926535897932384626433
void solve()
{
	ll a,b,H,M;
	cin >> a >> b >> H >> M;
	long double h = H * 30 + M * 0.5 ;
	long double m = M * 6;
	long double ang = abs(h - m);
	if(ang >= 180)
	{
		ang = 360 - ang;
	}
	long double ans = a*a + b*b - 2 * a * b * cos((long double )ang * 2 * pi / 360) ;
	cout << fixed << setprecision(12);
	cout << sqrtl(ans) << endl;
}
main()
{
	fast;
	int t =  1;
	while(t--)
	{
		solve();
	}
}

Measured memory_bytes: 4168
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

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

using namespace std;
using namespace __gnu_pbds; 

#define int long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define f first
#define s second
#define sz(x) (int)x.size()
#define endl "\n"
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout<<(x)<<endl
#define watch2(x,y) cout<<(x)<<" "<<(y)<<endl
#define watch3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld; 
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> oset;

const int INF = 9e18;
const int mod = 998244353;
const int N = 1e5 + 5;

void solve(){
    int a;
    ld b;
    cin>>a>>b;
    int ans=floor(a*b);
    cout<<ans;
}

signed main(){
    fastio;
    int t;
    //cin>>t;
    t=1;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3748
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector <long long> vll;
typedef pair <long long, long long> pll;
typedef pair <int, int> pii;
typedef vector <int> vii;
typedef complex <double> Point;

#define csl ios_base::sync_with_stdio(false); cin.tie(NULL)
#define mp make_pair
#define fst first
#define snd second

long long t, n, m, u, v, q, k;
const int N = 2e5 + 500;
const int LN = 21;
const long long mod = 1e9 + 7;
const long long INF = 1LL << 61LL;
long long arr[N];


int gcd(int a, int b) {
  while (a && b) {
    if (a > b) a %= b;
    else b %= a;
  }
  return a + b;
}
bool go() {
  int odd = 0, even = 0;
  for (int i = 1; i <= n; ++i) {
    if (arr[i] & 1) odd++;
    else even++;
  }
  if (even & 1) {
    // the state of even integers goes from odd to even to odd.... until 1 1 1 1 1..1
    return true;
  }
  if (odd >= 2) {
    // we'll end up at the above case with opponent playing
    return false;
  }
 // cout << odd << " " << even << endl;
  int x = 1;
  int g = 0;
  for (int i = 1; i <= n; ++i) {
    if (arr[i] & 1) x = i;
  }
  //cout << arr[x] << endl;
  if (arr[x] <= 1) return false;
  arr[x]--;
  for (int i = 1; i <= n; ++i) {
    g = gcd(g, arr[i]);
  }
  for (int i = 1; i <= n; ++i) arr[i] /= g;
  
  return 1 - go();
}
int main() {
  csl;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> arr[i];
  }
  
  if (go()) {
    cout << "First\n";
  } else cout << "Second\n";
  return 0;
}


















Measured memory_bytes: 1024
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/assoc_container.hpp> 
using namespace std; 
using namespace __gnu_pbds;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
 
template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
#define FOR(i,a,b) for(int i = a; i < b; i++)
#define F0R(i,a) for(int i = 0; i < a; i++)
#define pb push_back
#define all(x) x.begin(), x.end()
#define sz(x) int((x).size())
#define newl '\n'
 
#define FAST ios::sync_with_stdio(0); cin.tie(0);
#define finish(x) return cout << x << "\n", 0;
#define bug(x) cerr << ">>> " << #x << " = " << x << "\n";
#define _ << " " << 
 
const ll MOD = 998244353;
const ll INF = 1e9 + 7;

const int MX = 41;
array<int,3> abc[MX];
int N, a[MX], b[MX], c[MX], ma, mb, DP[MX][401][401],prefa[MX],prefb[MX],ans;

//check int vs ll and precision
//check logic
int main(){ FAST

	ans = 1e5;
	cin >> N >> ma >> mb;
	FOR(i,1,N+1){
		cin >> a[i] >> b[i] >> c[i];
		//abc[i] = {c[i],a[i], b[i]};
	}
	//sort(abc+1,abc+N+1);
	FOR(i,1,N+1){
		//a[i] = abc[i][1], b[i] = abc[i][2], c[i] = abc[i][0];
		prefa[i] = prefa[i-1] + a[i];
		prefb[i] = prefb[i-1] + b[i];
	}

	F0R(i,N+1) F0R(j,401) F0R(k,401) DP[i][j][k] = 1e5;
	//DP[i][j][k] = min cost [1,i] of achieving j : k ratio for a : b, 1e9 if not possible

	DP[0][0][0] = 0;
	FOR(i,1,N+1){
		F0R(j,prefa[i-1]+1) F0R(k,prefb[i-1]+1) DP[i][j][k] = min(DP[i][j][k],DP[i-1][j][k]);
		F0R(j,prefa[i-1]+1){
			F0R(k,prefb[i-1]+1){
				int _j = j + a[i], _k = k + b[i];
				DP[i][_j][_k] = min(DP[i][_j][_k], DP[i-1][j][k] + c[i]);
			}
		}
	}
	//FOR(i,1,N+1) F0R(j,401) F0R(k,401) if (DP[i][j][k] != 1e5) bug(i _ j _ k _ DP[i][j][k]);
	FOR(j,1,prefa[N]+1) FOR(k,1,prefb[N]+1) if (j * mb == k * ma && DP[N][j][k] != 1e5) ans = min(ans, DP[N][j][k]); 	
	cout << (ans == 1e5 ? -1 : ans) << newl;


    return 0;
}


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

typedef ostringstream OSS; typedef istringstream ISS;
typedef long long LL;
typedef pair<int, int> PII;  typedef pair<LL, LL> PLL;
typedef vector<int>    VI;   typedef vector<VI>   VVI;   typedef vector<VVI>   VVVI;
typedef vector<LL>     VLL;  typedef vector<VLL>  VVLL;  typedef vector<VVLL>  VVVLL;
typedef vector<double> VD;   typedef vector<VD>   VVD;   typedef vector<VVD>   VVVD;
typedef vector<string> VS;   typedef vector<VS>   VVS;   typedef vector<VVS>   VVVS;
typedef vector<bool>   VB;   typedef vector<VB>   VVB;   typedef vector<VVB>   VVVB;
typedef vector<PII>    VPII; typedef vector<VPII> VVPII; typedef vector<VVPII> VVVPII;
typedef vector<PLL>    VPLL; typedef vector<VPLL> VVPLL; typedef vector<VVPLL> VVVPLL;

typedef unsigned int  UI;
typedef vector<UI>    VUI;
typedef vector<VUI>   VVUI;

#define fst first
#define snd second
// #define Y first
// #define X second
#define MP make_pair
#define PB push_back
#define EB emplace_back 
#define ALL(x)  (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define RANGEBOX(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define RANGE(x, l, r) ((l) <= (x) && (x) <= (r))
#define rep(i, N)  for (int i = 0; i < (int)(N); i++)
#define rrep(i, N) for (int i = N - 1; i >= 0; i--)
#define REP(i, init, N)  for (int i = (init); i < (int)(N); i++)
#define RREP(i, N, last) for (int i = (init - 1); i >= last; i--)
#define MAXUD(orig, target) orig = max(orig, target)
#define MINUD(orig, target) orig = min(orig, target)
#define DUMP(x) cerr << #x << " = " << (x) << endl

template < typename T > inline T fromString(const string &s) { T res; ISS iss(s); iss >> res; return res; };
template < typename T > inline string toString(const T &a)   { OSS oss; oss << a; return oss.str(); };

template<typename T=int> inline void dump(vector<T> vs, bool ent=false) { rep(i, vs.size()) cout << vs[i] << (i+1==vs.size() ? '\n' : ' '); if (ent) cout << endl; }
template<typename T = int> inline void dump(vector<vector<T>> vs, bool ent=false) { rep(i, vs.size()) dump<T>(vs[i]); if (ent) cout << endl; }

const int    INF  = 0x3f3f3f3f;
const LL     INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;
const int    DX[] = {1,  0, -1, 0};
const int    DY[] = {0, -1,  0, 1};
const double EPS  = 1e-12;
// const double PI   = acos(-1.0);

template<typename T = int> inline T in() { T x; cin >> x; return x; }
template<typename T = int> inline vector<T> in(int n) { vector<T> xs(n); rep(i, n) cin >> xs[i]; return xs; }
template<typename T = int> inline vector<vector<T>> in(int n, int m) { vector<vector<T>> xs(n, vector<T>(m)); rep(i, n) rep(j, m) cin >> xs[i][j]; return xs; }

int main(void) {
    string s = in<string>();
    cout << s.substr(0, 4) << " " << s.substr(4, 8) << endl;

    return 0;
}



Measured memory_bytes: 764
#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    int h, w;
    
    while (1) {
        scanf("%d %d", &h, &w);
        if (h == 0 && w == 0) {
            break;
        }
        for (int y=0; y<h; y++) {
            for (int x=0; x<w; x++) {
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
    
    
    return 0;
}


Measured memory_bytes: 2040
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
var a=Arr[1].split(" ").map(Number);
var b=Arr[3].split(" ").map(Number);
var cnt=0;
var len=a.length;

for(var i=0;i<b.length;i++){
   if(linearSearch(b[i]))cnt++;
}
console.log(cnt);
 
function linearSearch(key){
   var i=0;
   a[len]=key;
   while(a[i]!=key){
      i++;
      if(i>=len)return false;
   }
   return true;
}

Measured memory_bytes: 9868
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <string>
#include <limits>
#include <numeric>
#include <type_traits>
#include <stdlib.h>
#include <typeinfo>
using namespace std;
#define ll long long int
const ll mod = 1e9 + 7;


int main() {
  int n;
  string s;
  cin >> n >> s;
  vector< ll > sum(26);
  for ( int i = 0; i < n; ++i ) {
    char x = s[i];
    if( x == 'a' )++sum[0];
    else if( x == 'b' )++sum[1];
    else if( x == 'c' )++sum[2];
    else if( x == 'd' )++sum[3];
    else if( x == 'e' )++sum[4];
    else if( x == 'f' )++sum[5];
    else if( x == 'g' )++sum[6];
    else if( x == 'h' )++sum[7];
    else if( x == 'i' )++sum[8];
    else if( x == 'j' )++sum[9];
    else if( x == 'k' )++sum[10];
    else if( x == 'l' )++sum[11];
    else if( x == 'm' )++sum[12];
    else if( x == 'n' )++sum[13];
    else if( x == 'o' )++sum[14];
    else if( x == 'p' )++sum[15];
    else if( x == 'q' )++sum[16];
    else if( x == 'r' )++sum[17];
    else if( x == 's' )++sum[18];
    else if( x == 't' )++sum[19];
    else if( x == 'u' )++sum[20];
    else if( x == 'v' )++sum[21];
    else if( x == 'w' )++sum[22];
    else if( x == 'x' )++sum[23];
    else if( x == 'y' )++sum[24];
    else if( x == 'z' )++sum[25];
  }

  ll ans = 1;
  for (int i = 0; i < 26; ++i){
    //cout << "------" << endl;
    //cout << i << endl;
    //cout << sum[i] << endl;
    ans *= sum[i] + 1;
    ans %= mod;
  }

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


Measured memory_bytes: 1144
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const int N = 2e7 + 9, M = 1e7, OO = 0x3f3f3f3f;
#define AC ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin.sync_with_stdio(0);
int main()
{
int n,i,flag=0;
string s;
cin>>s;
n=s.size();
for(i=0;i<n-1;++i){
    if(s[i]==s[i+1]){
        printf("%d %d",i+1,i+2);
        flag=1;
        break;
    }
    else if(s[i]==s[i+2]&&i+2<n){
        printf("%d %d",i+1,i+3);
        flag=1;
        break;
    }
}
if(!flag){
    printf("-1 -1");
}



    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <unordered_set>
#include <vector>

using namespace std;
typedef long long ll;

int main(){
  ll N;
  ll ret = 1;
  vector<ll> D(1000001, 0);
  cin >> N;
  for (ll i=1; i<=N; i++){
    for (ll j=i; j<=N; j += i){
      D[j]++;
    }
  }
  
  
  for (ll i=2; i<=N-1; i++){
    ret += D[i];
  }
  cout << ret << "\n";
  return 0;
}

Measured memory_bytes: 10988
n = int(input())
a = list(map(int, input().split()))
count = 0
exist_odd = False
while count < 100:
  for i in range(n):
    if a[i]%2:
      exist_odd = True
    a[i] /= 2
  if exist_odd:
    break
  count += 1
print(count)

Measured memory_bytes: 3060
//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define S 1000001
#define M 1000000007
#define nl cout<<"\n";
#define er  cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test lli t;  cin>>t; while(t--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define Y cout<<"YES\n";
#define N cout<<"NO\n";
#define print(x)                 cout<<#x<<": "<<x<<endl;
#define print2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define print3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define print4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define print5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl;
#define print6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl;

int main()
{
    fast
    lli n,k;
    cin>>n>>k;
    vector<lli> v(n);
    for(lli i=0;i<n;i++)
    {
        cin>>v[i];
    }
    lli sum=0;
    sort(v.begin(),v.end());
    for(lli i=0;i<k;i++)
    {
    sum=sum+v[i];    
    }
    cout<<sum;
}
//a+b=a?b+2?(a&b)
//a+b==(a&b)+(a|b)
//__builtin_popcount(number)
//cout<<fixed<<setprecision(8)<<output<<"\n";



Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

#define TR ","
#define fi first
#define se second
#define rep(i,N) for(ll i=0;i<(ll)N;++i)
#define repe(i,a,b) for(ll i=a;i<(ll)b;++i)
#define all(v) v.begin(), v.end()
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define INF 100000000

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

ll lcm(ll x, ll y) {
    return x / gcd(x, y) * y;
}

ll waz = 76543217;

ll inv(ll x) {
    if (x == 1) { return 1; }
    if (x == 0) { return 0; }
    else {
        ll a = (waz - inv(waz % x) * (waz / x)) % waz;
        if (a >= 0) { return a; }
        else { return waz + a; }
    }
}

void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

vector<ll> p;

ll phi(ll x) {
    ll a = x;
    ll b = x;
    for (ll k = 0; k != p.size(); ++k) {
        if (a % p[k] == 0) {
            while (a % p[k] == 0) {
                a /= p[k];
            }
            b = b / p[k] * (p[k] - 1);
        }
        if (a == 1) { break; }
    }
    return b;
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

int N, A, B, C;
vector<int> L;

void chmin(int& a, int b) {
    if (a >= b) a = b;
}

int length(int i, int a, int b, int c) {

    if (i == N) {
        if (a == 0 || b == 0 || c == 0) return INF;
        return abs(A - a) + abs(B - b) + abs(C - c);
    }

    int res = INF;
    chmin(res, length(i+1, a, b, c));
    chmin(res, length(i + 1, a + L[i], b, c) + (a ? 10 : 0));
    chmin(res, length(i + 1, a, b + L[i], c) + (b ? 10 : 0));
    chmin(res, length(i + 1, a, b, c + L[i]) + (c ? 10 : 0));

    return res;

}


int main()
{
    IO;

    cin >> N >> A >> B >> C;
    L.resize(N);
    rep(i, N) cin >> L[i];
    cout << length(0, 0, 0, 0) << endl;

}

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

int main(){
  int N,C,K;
  cin >> N >> C >> K;
  vector<int> T(N);
  for(int i=0; i<N;++i){cin >> T[i];}
  sort(T.begin(),T.end());
  int res=0,j;
  for(int i=0;i<N;){
    res++;
    j=i;
    while(i<N && T[i]-T[j]<=K && i-j<C)i++;
  }
  cout << res << endl;
}


Measured memory_bytes: 640