akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author HossamDoma
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public ArrayList<Integer>[] g = new ArrayList[200010];
        public int[] dist1 = new int[200010];
        public int[] distN = new int[200010];
        public int[] mark = new int[200010];
        int f = 1;
        int snuke = 1;

        void dfs(int node, int parent, int[] dArray) {

            for (int x : g[node]) {
                if (x != parent) {
                    dArray[x] = dArray[node] + 1;
                    dfs(x, node, dArray);
                }
            }
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {


            int n = in.nextInt();

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

                int x = in.nextInt();
                int y = in.nextInt();

                if (g[x] == null)
                    g[x] = new ArrayList<>();

                if (g[y] == null)
                    g[y] = new ArrayList<>();

                g[x].add(y);
                g[y].add(x);
            }

            dist1[1] = distN[n] = 0;

            dfs(1, 0, dist1);
            dfs(n, 100001, distN);

            Arrays.fill(mark, 0xff);

            mark[1] = 0;
            mark[0] = 0;

            mark[n] = 1;
            mark[100001] = 1;

//        play(1, 0);

            for (int i = 1; i <= n; ++i) {
                if (dist1[i] <= distN[i])
                    f++;
                else
                    snuke++;
            }
            if (f > snuke)
                out.println("Fennec");
            else
                out.println("Snuke");

        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 73224
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ld long double
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))//memset only use to initialize 0 or -1 no other number.
#define pii pair<int,int>
#define pll pair<ll,ll>
#define INF 1e9
#define INFL 1e18
#define mod 1000000007
//#define mod 998244353
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> os;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> os_pair;

ll power(ll x,ll n){ll res =1;while(n>0){if(n%2==1){res=res*x;}x=x*x;n=n/2;}return res;}
ll powm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

//cout<< fixed << setprecision(10)

int main(){

    fast;
    int T;
    T=1;
    //cin>>T;
    while(T--){
    	ll n,k;
    	cin>>n>>k;
    	ll x=n%k;
    	ll y=k-x;
    	cout<<min(x,y);
    	
    	

    }

}

Measured memory_bytes: 3576
package main

import "fmt"

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

	d := 2
	ans := 0
	for d*d <= n {
		if n%d != 0 {
			d++
			continue
		}

		z := d
		for n%z == 0 {
			n /= z
			z *= d
			ans++
		}
		for n%d == 0 {
			n /= d
		}
		d++
	}
	if n != 1 {
		ans++
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1760
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
#import math
#import time
#import random  # randome is not available at Codeforces
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
#eps=10**(-10)
#ts=time.time()
#sys.setrecursionlimit(10**6)
input=lambda: sys.stdin.readline().rstrip()

show_flg=False
show_flg=True

def wf(d):
    n=len(d)
    for k in range(n):#       // 経由する頂点
        for i in range(n):#    // 始点
            for j in range(n):#  // 終点
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])
    return d


n,m,l=MI()
d=[[inf]*n for _ in range(n)]
for i in range(m):
    a,b,c=LI_()
    d[a][b]=c+1
    d[b][a]=c+1

d=wf(d)
g=[[inf]*n for i in range(n)]

for i in range(n):
    for j in range(i+1,n):
        if d[i][j]<=l:
            g[i][j]=1
            g[j][i]=1
g=wf(g)

q=I()
for _ in range(q):
    s,t=LI_()
    if g[s][t]==inf:
        ans=-1
    else:
        ans=g[s][t]-1
    print(ans)
    

Measured memory_bytes: 126684
#include "bits/stdc++.h"
#define MOD 1000000007
#define INF 11234567890
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

LL Q, H, S, D, N;
LL ans;

int main()
{
	in >> Q >> H >> S >> D >> N;

	H = std::min(H, Q * 2);
	S = std::min(S, H * 2);
	D = std::min(D, S * 2);
	ans += N / 2*D;
	N -= N / 2 * 2;
	ans += N / 1 * S;

	out << ans << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;



int main(void) {
    
    int n,x;
    cin>>n>>x;
    vi v(n);
    rep(i,n)cin>>v[i];
    ll ans=0;
    if(v[0]>x){
        ans+=v[0]-x;
        v[0]=x;
    }
    for(int i=1;i<n;i++){
        if(v[i]-(x-v[i-1])>=0){
            ans+=v[i]-(x-v[i-1]);
            v[i]-=v[i]-(x-v[i-1]);
        }
    }
    // rep(i,n)cout<<v[i]<<" ";
    // cout<<endl;
    fin(ans);

}


Measured memory_bytes: 640
#include <stdio.h>

int main()
{
  int n, m, k[30], a[30][30];
  int i, j, b[30] = {0}, count = 0;

  scanf("%d%d", &n, &m);

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

  for (i = 0; i < n; i++) {
    for (j = 0; j < k[i]; j++) {
      b[a[i][j] - 1]++;
    }
  }

  for (i = 0; i < m; i++) {
    if (b[i] == n) {
      count++;
    }
  }

  printf("%d\n", count);

  return 0;
}


Measured memory_bytes: 128
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<int, int>;
using PL = pair<lint, lint>;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr lint B1 = 1532834020;
constexpr lint M1 = 2147482409;
constexpr lint B2 = 1388622299;
constexpr lint M2 = 2147478017;
constexpr int INF = 2147483647;
void yes(bool expr) {cout << (expr ? "Yes" : "No") << "\n";}
template<class T>void chmax(T &a, const T &b) { if (a<b) a=b; }
template<class T>void chmin(T &a, const T &b) { if (b<a) a=b; }
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int N, M;
  cin >> N >> M;
  vector<string> S(N);
  REP(i, N) cin >> S[i];
  lint komasum = 0;
  lint komacnt = 0;
  REP(i, N) REP(j, M) {
    if(S[i][j] == 'o') {
      komasum += N-1-i+M-1-j;
      komacnt++;
    }
  }
  mcf_graph<int, int> g(N*M+2);
  REP(i, N) REP(j, M) {
    if(S[i][j] == 'o') g.add_edge(N*M, i*M+j, 1, 0);
    g.add_edge(i*M+j, N*M+1, 1, N-1-i+M-1-j);
  }
  REP(i, N) REP(j, M) {
    if(S[i][j] == '#') continue;
    if(i != N-1 && S[i+1][j] != '#') g.add_edge(i*M+j, (i+1)*M+j, 100, 0);
    if(j != M-1 && S[i][j+1] != '#') g.add_edge(i*M+j, i*M+j+1, 100, 0);
  }
  cout << komasum - (g.flow(N*M, N*M+1)).second << endl;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  int L; cin >> L;
  ll A[L]; rep(i,L) cin >> A[i];
  ll dp[L+1][5] = {}; rep(i,L+1) fill_n(dp[i],5,LLINF);
  rep(i,L+1) {
    rep(j,5) {
      if (i==0) dp[i][j] = 0;
      else {
        rep(k,j+1) dp[i][j] = min(dp[i][j], dp[i-1][k]);
        if (j==0||j==4) dp[i][j] += A[i-1];
        else if (j==1||j==3) dp[i][j] += A[i-1] ? A[i-1]%2 : 2;
        else if (j==2) dp[i][j] += !(A[i-1]%2);
      }
    }
  }
  // rep(i,L+1) debug(dp[i],dp[i]+5);
  ll result = LLINF; rep(i,5) result = min(result,dp[L][i]);
  cout << result << endl;
  return 0;
}

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

using std::cin;
using std::cout;
using std::endl;

const int8_t SHEEP = 'S';
const int8_t WOLF = 'W';
int8_t animals[100005];

int main()
{
    std::ios::sync_with_stdio(false);
    int64_t N;
    cin >> N;
    std::string s;
    cin >> s;
    for (int64_t k = 0; k < 4; ++k)
    {    
        if (k == 0)
            animals[0] = animals[1] = SHEEP;
        else if (k == 1)
            animals[0] = SHEEP, animals[1] = WOLF;
        else if (k == 2)
            animals[0] = WOLF, animals[1] = SHEEP;
        else
            animals[0] = animals[1] = WOLF;
        for (int64_t i = 1; i < N - 1; ++i)
        {
            if (s[i] == 'o' && animals[i] == SHEEP || s[i] == 'x' && animals[i] == WOLF)
                animals[i+1] = animals[i-1];
            else
                animals[i+1] = (animals[i-1] == WOLF) ? SHEEP : WOLF;
        }
        if (s[N-1] == 'o' && animals[N-1] == SHEEP || s[N-1] == 'x' && animals[N-1] == WOLF)
        {
            if (animals[N-2] == animals[0])
            {
                if (s[0] == 'o' && animals[0] == SHEEP && animals[N-1] == animals[1] || s[0] == 'x' && animals[0] == WOLF && animals[N-1] == animals[1])
                {
                    std::copy(std::begin(animals), std::begin(animals) + N, std::ostream_iterator<int8_t>(cout, ""));
                    cout << endl;
                    return 0;
                }
                else if (s[0] == 'x' && animals[0] == SHEEP && animals[N-1] != animals[1] || s[0] == 'o' && animals[0] == WOLF && animals[N-1] != animals[1])
                {
                    std::copy(std::begin(animals), std::begin(animals) + N, std::ostream_iterator<int8_t>(cout, ""));
                    cout << endl;
                    return 0;
                }
            }
        }
        else if (s[N-1] == 'o' && animals[N-1] == WOLF || s[N-1] == 'x' && animals[N-1] == SHEEP)
        {
            if (animals[N-2] != animals[0])
            {
                if (s[0] == 'o' && animals[0] == SHEEP && animals[N-1] == animals[1] || s[0] == 'x' && animals[0] == WOLF && animals[N-1] == animals[1])
                {
                    std::copy(std::begin(animals), std::begin(animals) + N, std::ostream_iterator<int8_t>(cout, ""));
                    cout << endl;
                    return 0;
                }
                else if (s[0] == 'x' && animals[0] == SHEEP && animals[N-1] != animals[1] || s[0] == 'o' && animals[0] == WOLF && animals[N-1] != animals[1])
                {
                    std::copy(std::begin(animals), std::begin(animals) + N, std::ostream_iterator<int8_t>(cout, ""));
                    cout << endl;
                    return 0;
                }
            }
        }
    }
    cout << -1 << endl;
}


Measured memory_bytes: 720
#include<iostream>

using namespace std;

int main() {
	int N;
	cin >> N;
	int A[20], B[20], C[20];
	for (int i = 0; i < N; i++)cin >> A[i];
	for (int i = 0; i < N; i++)cin >> B[i];
	for (int i = 0; i < N - 1; i++)cin >> C[i];
	int ans = B[A[0] - 1];
	int bef = A[0];
	for (int i = 1; i < N; i++) {
		if (A[i] == bef + 1) {
			ans += C[A[i] - 2];
		}
		ans += B[A[i] - 1];
		bef = A[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
using ll = long long;
#define MAX_N 1000001
#define MAX_M 100010
const long long mod = 1e9 + 7;
#define vec vector<int>
#define vecll vector<ll>
#define vecllvec vector<vector<ll>>
#define vecb vector<bool>
#define vecBvec vector<vector<bool>>
#define vecst vector<string>
#define veche vector<char>
#define vecd vector<double>
#define vecvec vector<vector<int>>
#define vecDvec vector<vector<double>>
#define vecHvec vector<vector<char>>
#define all(x) (x).begin(),(x).end()
#define ent cout<<endl
#define printvec(vec) for(int aqw=0;aqw<vec.size();aqw++){cout<<vec[aqw]<<" ";}ent;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define REP(i,m,n) for(int i=m;i<(int)n;++i)
#define INF 1e+9
#define P pair<int, int>;
#define MAX_V 1000
#define PI 3.141592653589793
// cout << setprecision(15) << std::fixed;

int main()
{
	int n, l;
	cin >> n >> l;
	vecst S(n);
	for (int i = 0;i < n;i++) {
		cin >> S[i];
	}
	sort(all(S));
	for (int i = 0;i < n;i++) {
		cout << S[i];
	}
	ent;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<sstream>
#include<utility>
#include<map>
#include<ctime>
#include<cstdio>
#include<cassert>
#include<functional>
#include<unordered_map>
#include<deque>
#include<cmath>





using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;
typedef pair<double, double> pdd;

#define show(x) cerr << x
#define debug(x) show(#x << ": " << (x) << endl)

const long double PI = 3.14159265358979323846;
const long double eps = 1e-5;
const ll INF = numeric_limits<int>::max();
const ll LINF = numeric_limits<ll>::max();
const ll mod = 1000 * 1000 * 1000 + 7;


void solve() {
    int n, m;
    cin >> n >> m;
    vector<vector<int> > gr(n, vector<int>(n, INF/4));
    vector<vector<int> > d(n, vector<int>(n, INF/4));
    for (int i = 0; i < m; ++i) {
        int a, b, c;
        cin >> a >> b >> c;
        --a, --b;
        gr[a][b] = gr[b][a] = c;
        d[a][b] = d[b][a] = c;
    }
    for (int k = 0; k < n; ++k) {
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
        }
    }
    }
    int res = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < i; ++j) {
            if ((gr[i][j] != INF/4) && (gr[i][j] > d[i][j]))
                ++res;
        }
    }
    cout << res << endl;


}


//#define LOCAL

int main() {
    ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    solve();



#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif	
    return 0;
}


Measured memory_bytes: 384
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int a = scn.nextInt();
		int b = scn.nextInt();
      	int ans = a*b;
      	int ans2 = 0;
      	for(int i=0; i<b; i++){
          ans2 += a;
        }
      	System.out.println(ans2);
	}
}

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

int main(){
	int k;
	while(cin>>k&&k){
		int s=0;
		for(int i=0;i<k*(k-1)/2;i++){
			int c;
			cin>>c;
			s+=c;
		}
		cout<<s/(k-1)<<endl;
	}
    return 0;
}

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

int main() {
	int N, D, X[13] = {}, ANS = 24;
	vector<int> V;
	bool L = true, R = true, Y[24] = {};
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> D;
		X[D]++;
	}
	if (X[0] != 0) {
		cout << 0;
		return 0;
	}
	for (int i = 1; i < 12; i++) {
		if (X[i] > 2) {
			cout << 0;
			return 0;
		}
		if (X[i] == 2) {
			Y[i] = true, Y[24 - i] = true;
			L = true, R = true;
		}
		if (X[i] == 1) {
			if (L) {
				Y[i] = true;
				L = false, R = true;
			}
			else {
				Y[24 - i] = true;
				L = true, R = false;
			}
		}
	}
	if (X[12] > 1) {
		cout << 0;
		return 0;
	}
	if (X[12] == 1) Y[12] = true;
	V.push_back(0);
	for (int i = 0; i < 24; i++) {
		if (Y[i]) V.push_back(i);
	}
	V.push_back(V[0] + 24);
	for (int i = 0; i < V.size() - 1; i++) {
		ANS = min(ANS, V[i + 1] - V[i]);
	}
	cout << ANS;
}

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

string S;
int sums,sumt;

int main()
{
	cin>>S;
	for(int i=0;i<S.size();i++)
	{
		if(S[i] == 'S') sums++;
		if((sums)&&(S[i]=='T'))
		{
			sums--;
			sumt+=2;
		}
	}
	cout<<S.size()-sumt<<"\n";
}

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

int main(){
    int N;
    cin >> N;
    vector<int> ans(N+1);
    for(int i=1; i<=100; i++) for(int j=1; j<=100; j++) for(int k=1; k<=100; k++){
        int v = i*i + j*j + k*k + i*j + j*k + k*i;
        if(v <= N) ans[v]++;
    }
    for(int i=1; i<=N; i++) cout << ans[i] << endl;
    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
const int maxn=105;
int n,a[maxn],cnt[2],match[maxn<<1];
bool used[maxn<<1];
vector<int> G[maxn<<1],diff;
set<int> vis;
bool dfs(int v) {
    used[v]=1;
    for (int i=0;i<(int)G[v].size();++i) {
        int u=G[v][i],w=match[u];
        if (w==-1||(!used[w]&&dfs(w))) {
            match[v]=u;
            match[u]=v;
            return true;
        }
    }
    return false;
}
inline int bipartite_matching() {
    int ret=0;
    memset(match,-1,sizeof match);
    for (int i=0;i<(int)diff.size();++i)
        if (match[i]==-1) {
            memset(used,0,sizeof used);
            ret+=dfs(i);
        }
    return ret;
}
bool check(int x) {
    if (x<=2)
        return false;
    for (int i=2;i*i<=x;++i)
        if (x%i==0)
            return false;
    return true;
}
int main()
{
    scanf("%d",&n);
    for (int i=1;i<=n;++i) {
        scanf("%d",&a[i]);
        vis.insert(a[i]);
    }
    for (int i=1;i<=n;++i) {
        if (vis.find(a[i]-1)==vis.end()) {
            diff.push_back(a[i]);
            ++cnt[a[i]%2];
        }
        if (vis.find(a[i]+1)==vis.end()) {
            diff.push_back(a[i]+1);
            ++cnt[(a[i]+1)%2];
        }
    }
    for (int i=0;i<(int)diff.size();++i)
        for (int j=i+1;j<(int)diff.size();++j)
            if (check(abs(diff[i]-diff[j]))) {
                G[i].push_back(j);
                G[j].push_back(i);
            }
    int k=bipartite_matching();
    printf("%d\n",k+2*((cnt[0]-k)/2+(cnt[1]-k)/2)+(cnt[0]-k)%2*3);
    return 0;
}


Measured memory_bytes: 384
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	map<string, int> f;
	f["SUN"] = 0;
	f["MON"] = 1;
	f["TUE"] = 2;
	f["WED"] = 3;
	f["THU"] = 4;
	f["FRI"] = 5;
	f["SAT"] = 6;

	string s; cin >> s;
	cout << 7 - f[s];
	return 0;
}

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

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'

using namespace std;

typedef long long   ll;
typedef long double ld;

typedef pair<ll, ll>    pll;
typedef pair<ll, int>   pli;
typedef pair<int, int>  pii;

typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll>  vll;

const int Inf = (int) 1e9;
const ll  InfL = (ll)  1e18;

const int MaxN = (int) 1e5 + 5;

int a[MaxN], n;
pii ans;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

#ifdef LOCAL
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif

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

    sort(a, a + n);
    ans.ff = a[n-1];

    if (n == 2) {
        cout << a[1] << " " << a[0] << endl;
        return 0;
    }

    int pos = lower_bound(a, a + n, (double)a[n - 1]/2.0) - a;
    if ( fabs( (double)a[n - 1]/2.0 - a[pos - 1]) <= fabs( a[pos] - (double)a[n-1]/2.0) ) {
        ans.ss = a[pos - 1];
    }
    else {
        ans.ss = a[pos];
    }
/*
    sort(a, a + n);

    for (int i = 0; i < n; i++) {
        int pos = lower_bound(a, a + n, (a[i]+1)/2) - a;
        cout << "Pos " << pos << endl;
    }
*/
    cout << ans.ff << " " << ans.ss << endl;
	return 0;
}


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

using namespace std ;
typedef long long ll;
typedef string str;
typedef pair<int, int> pii;
typedef vector<int> vint;
typedef vector<double> vdou ;
typedef vector<ll> vll;
typedef vector<vint> vvint;
typedef vector<str> vstr;
typedef pair<ll,ll> pll ;
typedef vector<pii> vpii ;
typedef vector<pll> vpll ;

#define REP(i, n) for (ll (i) = 0; (i) < (ll)(n); i++) 
#define FOR(i, a, b) for(ll (i) = a; (i) < (ll)b; i++)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define CHI 1000000000000000003
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define NP next_permutation
#define SZ(x)  (ll)x.size()
#define SP(x)  setprecision((ll)x)

const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const double PI = M_PI;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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;} //最小公倍数

void yes(){
  cout <<"YES"<<endl ;
}
void no(){
  cout <<"NO"<<endl ;
}
//-----------------------------------------




















//-----------------------------------------
int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s ;
  cin >> s ;
  int cnta, cntb, cntc ;
  cnta = cntb = cntc = 0 ;
  REP(i,SZ(s)){
    if(s[i]=='a'){
      cnta++ ;
    }
    else if(s[i]=='b'){
      cntb++ ;
    }
    else{
      cntc++ ;
    }
  }
  
  if(max({cnta,cntb,cntc}) - min({cnta,cntb,cntc}) <=1){
    yes() ;
  }
  else{
    no() ;
  }
  
  
  
  
  return 0 ;
}




Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
using namespace std;
typedef long long ll;

int main(){

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

    if( a > 0 ){
        cout << "Positive";
    }
    else if( b >= 0 ){
        cout << "Zero";
    }
    else if((b-a+1)%2 == 0){
        cout << "Positive";
    }
    else{
        cout << "Negative";
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cmath>
#include<string>
#include<numeric>
#include<limits.h>
#include<utility>
#include<cstdlib>
#include<bitset>
#define LP(i,n) for(int i=0;i<n;i++)
#define LPIN(n,a) for(int i=0;i<n;i++)cin >> a[i]
using namespace std;

int main(){
   int a[30] = {};
   char c;
   for(int i=0;i<4;i++){
cin >> c;
a[c-'A']++;
   }
   for(int i=0;i<30;i++){
if(a[i] == 2 || a[i] == 0)continue;
else {
cout << "No" << endl;
return 0;
}
   }
   cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  


int main() {
  int N,M;
  cin >> N >> M;
  vi xs(M),ys(M);
  rep(i,M) {
    cin >> xs[i] >> ys[i];
    xs[i]--;
    ys[i]--;
  }
  vi used(N,0);
  vi num(N,1);
  used[0]++;
  rep(i,M) {
    int f=xs[i];
    int t=ys[i];
    if(!used[f]) {
      num[f]--;
      num[t]++;
      continue;
    }
    num[f]--;
    num[t]++;
    used[t]++;
    if(num[f]==0) {
      used[f]=0;
    }
  }
  int ans = 0;
  rep(i,N) {
    if(used[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}

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

using ll = long long;

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

    vector<int> N(4);
    for (int i = 0; i < 4; i++) cin >> N[i];
    sort(N.begin(), N.end());
    
    cout << (N[0] == 1 && N[1] == 4 && N[2] == 7 && N[3] == 9 ? "YES" : "NO") << endl;
}


Measured memory_bytes: 256
def main():
    raw = []
    for i in range(4):
        raw.append(input())

    n = int(raw[0])
    a = raw[1]
    b = raw[2]
    c = raw[3]

    difference = [0] * n
    for i in range(n):
        n = {a[i], b[i], c[i]}
        difference[i] = len(n) - 1

    print(sum(difference))


if __name__ == "__main__":
    main()


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

using ll=long long; 

void solve(){
	int n;
	cin>>n;
	map<string, bool> used;
	vector<string> sl(n);
	cin>>sl[0];
	used[sl[0]]=1;
	for(int i=1; i<n; i++){
		cin>>sl[i];
	}
	for(int i=1; i<n; i++){
		if(used[sl[i]]||*(sl[i].begin())!=*(sl[i-1].end()-1)){
			cout<<"No"<<endl;
			return;
		}
		used[sl[i]]=1;
	}
	cout<<"Yes"<<endl;
}

signed main(){
	//while(1)
	solve();
}

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


ll gcd(ll a, ll b){
    ll r;
    while(a % b){
        r = a % b;
        a = b;
        b = r;
    }
    return b;
}


int main(){
    ll K;
    cin >> K;
    ll ans = 0;
    for(ll a=1; a<=K; a++){
        for(ll b=1; b<=K; b++){
            for(ll c=1; c<=K; c++){
                ans += gcd(gcd(a, b), c);
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3624
import sys
#input = sys.stdin.buffer.readline

def main():
    S = str(input())
    N = len(S)
    sc = 0
    count = 0
    for r in range(N):
        if S[r] == "T":
            if sc == 0:
                continue
            else:
                sc -= 1
                count += 1
        else:
            sc += 1
            
    print(N-2*count)

if __name__ == "__main__":
    main()


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

using namespace std;
typedef long long ll;
#define sz(x) (ll)((x).size())
#define pb push_back 
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;
const ll INF=1000000000000000;
	
vector<ll> Next[10050];
bool check[10050];
ll d[10050];
vector<ll> c(10050);
ll sub=0;

void bfs(ll x){
    queue<ll> que;
	que.push(x);

	while(!que.empty()){
		ll y=que.front(); que.pop();
		d[y]=c[sub++];
		check[y]=false;

		rep(i,sz(Next[y])){
			if(check[Next[y][i]]==true){
				que.push(Next[y][i]);
			}
		}
	}
}

int main(){
	ll N; cin>>N;
	ll sum=0;
	rep1(i,N) d[i]=0;
    memset(check,true,sizeof(check));
	rep(i,N-1){
		ll A,B; cin>>A>>B;
		Next[A].pb(B);
        Next[B].pb(A);
	}
	rep(i,N){
		cin>>c[i];
		sum+=c[i];
	}
	sort(all(c),greater<ll>());
	sum-=c[0];
	bfs(1ll);

	cout<<sum<<endl;
	rep1(i,N) cout<<d[i]<<" ";
	
}


Measured memory_bytes: 1152
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
#include <sstream>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;

template <class T>
void initvv(vector<vector<T> > &v,int a,int b, const T  &t = T()){
	v.assign(a,vector<T>(b,t));
}

//v.erase(unique(v.begin(),v.end()),v.end());


int main(){
	int n;
	while(cin>>n,n){
		vector<pii> v(n);
		rep(i,n){
			int a,b,c;
			cin>>a>>b>>c;
			v[i].F=b+c;
			v[i].S=a;
		}
		sort(ALL(v));
		cout<<v.back().S<<" "<<v.back().F<<endl;
	}
}

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

#define ll long long
#define ar array

const int mxN=2e5;
int n, a[mxN];
ll c[mxN], ans;

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

	cin >> n;
	for(int i=0; i<n; ++i) {
		cin >> a[i], --a[i];
		++c[a[i]];
	}
	for(int i=0; i<n; ++i)
		ans+=c[i]*(c[i]-1)/2;
	for(int i=0; i<n; ++i) {
		ans-=c[a[i]]*(c[a[i]]-1)/2;
		--c[a[i]]*(c[a[i]]-1)/2;
		ans+=c[a[i]]*(c[a[i]]-1)/2;
		cout << ans << "\n";
		ans-=c[a[i]]*(c[a[i]]-1)/2;
		++c[a[i]]*(c[a[i]]-1)/2;
		ans+=c[a[i]]*(c[a[i]]-1)/2;
	}
}

Measured memory_bytes: 3968
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <queue>

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> p(n);
    for(int i = 0; i < n; i++)
    {
        cin >> p[i];
    }
    vector<vector<int>> graph(n);
    for(int i = 0; i < m; i++)
    {
        int x, y;
        cin >> x >> y;
        graph[x - 1].push_back(y - 1);
        graph[y - 1].push_back(x - 1);
    }
    vector<bool> flag(n, false);
    auto bfs = [&](int start)
    {
        queue<int> q;
        q.push(start);
        map<int, int> possible;
        vector<int> value;
        if(flag[start]) {
            return 0;
        }
        flag[start] = true;
        possible[start] = 1;
        value.push_back(p[start]);
        while(!q.empty())
        {
            int current = q.front();
            q.pop();
            for(int i = 0; i < graph[current].size(); i++)
            {
                int next = graph[current][i];
                if(!flag[next])
                {
                    q.push(next);
                    possible[next] = 1;
                    value.push_back(p[next]);
                    flag[next] = true;
                }
            }
        }
        int count = 0;
        for(int i = 0; i < value.size(); i++)
        {
            if(possible.count(value[i] - 1)) count++;
        }
        return count;
    };
    int count = 0;
    for(int i = 0; i < n; i++)
    {
        count += bfs(i);
    }
    for(int i = 0; i < n; i++)
    {
        if(!flag[i])
        {
            if(p[i] - 1 == i) count++;
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 11256
import java.util.Scanner;
import java.util.ArrayList;
public class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		ArrayList<String> list = new ArrayList<>();
		int n = sc.nextInt();
		for(int i=0;i<=n;i++){
			list.add(sc.nextLine());
		}
		for(int i=1;i<14;i++){
			if(list.contains("S "+i)==false)
				System.out.println("S "+i);
		}
		for(int i=1;i<14;i++){
			if(list.contains("H "+i)==false)
				System.out.println("H "+i);
		}
		for(int i=1;i<14;i++){
			if(list.contains("C "+i)==false)
				System.out.println("C "+i);
		}
		for(int i=1;i<14;i++){
			if(list.contains("D "+i)==false)
				System.out.println("D "+i);
		}
	}
}

Measured memory_bytes: 26140
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MAXN=1e5+5;
ll n,a[MAXN],h[MAXN],ans;
void solve()
{
    for(ll i=1;i<=n;i++)
    {
        if(h[i]<=a[i])
        {
            ans+=h[i];
        }
        else
        {
            ans+=a[i];
            h[i]-=a[i];
            if(h[i]<=a[i+1])
            {
                ans+=h[i];
                a[i+1]-=h[i];
            }
            else
            {
                ans+=a[i+1];
                a[i+1]=0;
                h[i]-=a[i+1];
            }
        }
    }
    printf("%lld\n",ans);
}
int main()
{
    scanf("%lld",&n);
    for(ll i=1;i<=n+1;i++)
    {
        scanf("%lld",&a[i]);
    }
    for(ll i=1;i<=n;i++)
    {
        scanf("%lld",&h[i]);
    }
    solve();
}


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

int main(){
	vector<double> vd;
	double height;
	while(cin >> height) vd.push_back(height);
	sort(vd.begin(), vd.end());
	cout << vd[vd.size() - 1] - vd[0] << endl;
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define MAX 100005
using namespace std;

int main()
{
    set<string> s;
    string temp, str;
    int n;

    cin>>n;

    cin>>str;

    s.insert(str);
    int flag = 0;
    for(int i = 1; i < n; i++){
        cin>>temp;
        int len1 = (int) str.size();
        int len2 = (int) temp.size();
        if(temp[0] != str[len1-1]){
            //cout<<"No"<<endl;
            flag = 1;
        }
        if(s.find(temp) != s.end()){
            //cout<<"No"<<endl;
            flag = 1;
        }
        s.insert(temp);
        str = temp;
    }
    if(!flag)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef istringstream ISS;
typedef ostringstream OSS;
typedef vector<string> VS;
typedef int INT;
typedef vector<INT> VI;
typedef vector<VI> VVI;
typedef pair <INT, INT> II;
typedef vector <II> VII;



const int SIZE = 101;
int N, T, H, L;
int t[SIZE];
int h[SIZE];

bool input() {
    if ( ! ( cin >> N >> T >> H >> L ) ) return false;
    for ( int i = 0; i < N; ++ i ) {
        cin >> t[i] >> h[i];
    }
    return true;
}

int solve() {
    int sum = 0;
    while ( true ) {
        for ( int i = 0; i < N; ++ i ) {
            if ( t[i] > 0 ) {
                T ++;
                if ( T > L ) return i;
                sum += 10;
                t[i] --;
            } else if ( h[i] > 0 ) {
                H ++;
                sum += 100;
                h[i] --;
            } else {
                return i;
            }

            if ( sum >= 90 ) {
                int remains = sum - 90;
                while ( remains > 0 && T > 0 ) {
                    remains -= 10;
                    T --;
                    t[i] ++;
                }
                while ( remains >= 100 && H > 0 ) {
                    remains -= 100;
                    H --;
                    h[i] ++;
                }
                if ( remains > 0 ) return i;
                sum = 0;
            }
        }
    }
}

int main() {
    while ( input() ) {
        cout << solve()+1 << endl;
    }
    return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<int,int>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e18)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))
#define YesNo(a) cout<<((a)?"Yes":"No")<<endl
#define YESNO(a) cout<<((a)?"YES":"NO")<<endl

int main(){
	int N;
	cin >> N;
	ll ans = 0;
	vector<int> A(N),B(N),C(N);
	FOR(i,0,N)cin>>A[i];
	FOR(i,0,N)cin>>B[i];
	FOR(i,0,N)cin>>C[i];
	SORT(A);SORT(B);SORT(C);
	FOR(i,0,N){
		ll a,c;
		a = POSL(A,B[i]);
		c = N-POSU(C,B[i]);
		ans += a*c;
	}
	cout << ans << endl;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main(){
    int x,n;
    cin>>x>>n;
    vector<int> p(n,0);
    for(int i=0;i<n;i++){
        cin>>p[i];
    }
    int min=51;
    int ans=0;
    for(int i=0;i<=101;i++){
        if(min>abs(x-i)){
            bool flag=true;
            for(int j=0;j<n;j++){
                if(p[j]==i)flag=false;
            }
            if(flag){
                min=abs(x-i);
                ans=i;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

int main()
{
  int A, B, K;

  cin >> A >> B >> K;

  int num = 0;

  for (int i = min(A, B); i > 0; i--)
  {
    if (A % i == 0 && B % i == 0)
    {
      num++;

      if (num == K)
      {
        cout << i << endl;
        break;
      }
    }
  }
}


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

int main()
{
    long a;
    cin>>a;
    if (a%2==0)
    {
        printf ("%ld\n",a);
    }
    else
    {
        a=a*2;
        printf ("%ld\n",a);
    }
    return 0;
}


Measured memory_bytes: 256
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial
from bisect import bisect_left #bisect_left(list, value)
#from fractions import gcd
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

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

cnt = 0
for ai in a:
    while ai%2 == 0:
        cnt += 1
        ai //= 2

print(cnt)


Measured memory_bytes: 4532
#include <stdio.h>
long long gcd(long long a, long long b){return (a<b?a:b)==0?(a>b?a:b):gcd((a<b?a:b),(a>b?a:b)%(a<b?a:b));}
int main(void){
    long long n,x;
    scanf("%lld%lld",&n,&x);
    printf("%lld\n",3*(n-gcd(n,x)));
    return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        sc.close();
        int len = 0;
        if (A > (B * 2)) {
            len = A - (B * 2);
        }
        System.out.println(len);
    }
}


Measured memory_bytes: 23764
#define Oo ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#include <bits/stdc++.h>
using namespace std;
#define PI acos(-1.0)
typedef long long ll;
const int MAX=1e6+7;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
int pre[MAX],a[MAX],n;
vector<int>g[MAX];
void init(int n)
{
    for(int i=0;i<=n;i++)
        pre[i]=i;
}
int FIND(int x)
{
    return pre[x]==x?x:pre[x]=FIND(pre[x]);
}
void mix(int a,int b)
{
    int fa=FIND(a),fb=FIND(b);
    if(fa!=fb){
        pre[fa]=fb;
    }
}
int main()
{
      Oo
      int n, m;
      cin>>n>>m;
      init(n);
      for (int i=0; i<m; i++)
      {
            int u,v;cin>>u>>v;
            mix(u, v);
      }
      int ans=0;
      for (int i=1; i<=n; i++)
      {
            int f=FIND(i);
            g[f].push_back(i);
            ans=max(ans, (int)g[f].size());
      }cout <<ans<< endl;
	return 0;
}


Measured memory_bytes: 34656
#include <iostream>
#include <utility>
#include <vector>
using namespace std;

#define fi first
#define se second

struct s {
	int m, a, b;
	s() {}
	s(int m_, int a_, int b_) {
		m = m_; a = a_; b = b_;
	}
};

int main() {
	int n;
	while(cin >> n, n) {
		vector
 v;
		vector<int> t;
		for(int i = 0; i < n; i++) {
			int m, a, b;
			cin >> m >> a >> b;
			v.push_back(s(m, a, b));
			t.push_back(a);
			t.push_back(b);
		}

		bool flg = true;
		for(int i = 0; i < t.size(); i++) {
			int sum = 0;
			for(int j = 0; j < n; j++) {
				if(v[j].a <= t[i] && t[i] < v[j].b)
					sum += v[j].m;
			}
			if(sum > 150)
				flg = false;
		}
		if(flg)
			cout << "OK" << endl;
		else
			cout << "NG" << endl;
	}
}

Measured memory_bytes: 1212
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
using namespace std;
 
typedef int ll;
 
#define int long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define endl '\n'
 
typedef pair<int,int>pii;
typedef pair<int,pair<int,int> > piii;
 
const int mod=1e9+7;
 
int POWER[65];
int power(int a, int b) {int ret=1;while(b) {if(b&1) ret*=a;a*=a;if(ret>=mod) ret%=mod;if(a>=mod) a%=mod;b>>=1;}return ret;}
int inv(int x) {return power(x,mod-2);}
 
void precompute() {
	POWER[0]=1;
	for(int i=1;i<63;i++) POWER[i]=POWER[i-1]<<1LL;
}
 
int gcd(int a, int b) {
   if (b == 0)
   return a;
   return gcd(b, a % b);
}
 
ll main() {
	// freopen("Task.in", "r", stdin);freopen("Task.out", "w", stdout);

	string s;
	cin>>s;

	int cnt=0, ret=0;
	for (int i=0; i<sz(s); i++) {
		if(s[i]=='R')	cnt++;
		else {
			ret=max(ret, cnt);
			cnt=0;
		}
	}
	ret=max(ret, cnt);
	cout<<ret<<endl;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define irp(i,s,e) for(int i=(int)(s);i>(int)(e);--i)
// #define NMAX 1000000000
int N,M;
vvi V;

void solve(){

	// cout<<N<<" "<<M<<"\n";
	// rp(i,0,N){
	// 	cout<<i<<": ";
	// 	for(auto j:V[i]){cout<<j<<" ";}
	// 	puts("");
	// }
	// puts("---");

	vi ans(N, -1);
	queue<int> q;
	q.push(0);
	while(q.size()){
		int p = q.front(); q.pop();
		for(auto c:V[p]){
			if(c == 0) continue;
			if(ans[c] == -1){
				// cout<<"p "<<p;
				// cout<<" -> c "<<c;
				// cout<<"\n";

				ans[c] = p;
				q.push(c);
			}
		}
	}

	// rp(i, 0, N){cout<< ans[i] <<endl;}

	puts("Yes");
	rp(i, 1, N){
		// cout<<i<<" ";///
		cout<< ans[i]+1 <<endl;
	}

}

int main(){
	cin>>N>>M;
	V.resize(N);
	rp(i,0,M){
		int a,b; cin>>a>>b; --a,--b;
		V[a].push_back(b);
		V[b].push_back(a);
	}
	solve();
}


Measured memory_bytes: 10216