akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;


public class Main {
	Scanner in = new Scanner(System.in);
	
	int n, m, p, a, b;
	double[] t;
	double[][] edge;
	double[][] minCost;
	
	int INF = 100000000;
	
	class State implements Comparable<State> {
		int chicket, node;
		
		State(int c, int n) {
			chicket = c;
			node = n;
		}
	
		public int compareTo(State s) {
			double c1 = minCost[chicket][node], c2 = minCost[s.chicket][s.node];
			if (c1 > c2) return 1;
			else if (c1 < c2) return -1;
			else return 0;
		}
	}
	
	void dijkstra(int start) {
		minCost = new double[(1<<n)][m];
		for (int i = 0; i < (1<<n); i++) 
			Arrays.fill(minCost[i], INF);
		minCost[(1<<n)-1][start] = 0;
		
		PriorityQueue<State> pq = new PriorityQueue<State>();
		pq.add(new State((1<<n) - 1, start));
		
		while (!pq.isEmpty()) {
			State s = pq.poll();
			for (int i = 0; i < m; i++) {
				if (edge[i][s.node] == INF) continue;
				for (int j = 0; j < n; j++) {
					if (((s.chicket >> j) & 1) == 1) {
						int x = ((1 << n) - 1) ^ (1 << j);
						int newChicket = s.chicket & x;
						if (minCost[newChicket][i] > minCost[s.chicket][s.node] + (double)edge[i][s.node] / t[j]) {
							minCost[newChicket][i] = minCost[s.chicket][s.node] + (double)edge[i][s.node] / t[j];
							pq.add(new State(newChicket, i));
						}
					}
				}
			}
		}
		
	}
	
	void run() {
		while (true) {
			n = in.nextInt(); m = in.nextInt(); p = in.nextInt(); a = in.nextInt() - 1; b = in.nextInt() - 1;
			if (n == 0) break;
			
			t = new double[n];
			for (int i = 0; i < n; i++)
				t[i] = in.nextInt();
			
			edge = new double[m][m];
			for (int i = 0; i < m; i++)
				Arrays.fill(edge[i], INF);
			for (int i = 0; i < p; i++) {
				int x = in.nextInt() - 1, y = in.nextInt() - 1, z = in.nextInt();
				edge[x][y] = edge[y][x] = z;
			}
			
			dijkstra(a);
			
			double res = INF;
			for (int i = 0; i < (1<<n); i++) {
				res = Math.min(res, minCost[i][b]);
			}
			System.out.println(res == INF ? "Impossible" : res);
		}
	}
	
	public static void main(String args[]) {
		new Main().run();
	}
}

Measured memory_bytes: 36560
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main(){
  int n,q;
  cin>>n>>q;
  
  priority_queue<int> A[1001];
  
  int com,t,x;
  for(int i=0;i<q;i++){
    scanf("%d",&com);
    
    if(com==0){
        scanf("%d%d",&t,&x);
        A[t].push(x);
    }
    else if(com==1){
        scanf("%d",&t);
        if(!A[t].empty()) printf("%d\n",A[t].top());
    }
    else{        
        scanf("%d",&t);
        if(!A[t].empty()) A[t].pop();
    }
  }
  
  return 0;
}


Measured memory_bytes: 4276
import java.util.*;
public class Main {
    public static void main(String[] args){
      // 入力
      Scanner sc = new Scanner(System.in);
      long N = sc.nextLong();
      
      // 命名
      StringBuilder sb = new StringBuilder();
      while(N > 26){
        int amari = (int)(N % 26);
        if(amari == 0){
          amari = 26;
          N -= 26;
        }
        String s = getChar(amari);
        sb.insert(0, s);
        N = N / 26;
      }
      String last = getChar((int)N);
      sb.insert(0, last);
      
      // 出力
      System.out.println(sb.toString());
    }
    
    // 番号の文字をString型で返す関数
    public static String getChar(int num){
      String charList = " abcdefghijklmnopqrstuvwxyz";
      char c = charList.charAt(num);
      
      return String.valueOf(c);
    }

}

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

int main()
{
    string str = "==========";

    cin >> str;

    if (str[0] == 'Y' &&
        str[1] == 'A' &&
        str[2] == 'K' &&
        str[3] == 'I') {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
    int n,a=0,b=0,o=0,ab=0;
    char g;
    string x;
    while(cin>>n>>g>>x){
        if(x=="A"){
            a++;
        }else if(x=="B"){
            b++;
        }else if(x=="O"){
            o++;
        }else if(x=="AB"){
            ab++;
        }
    }
    cout<<a<<endl<<b<<endl<<ab<<endl<<o<<endl;
    return 0;
}

Measured memory_bytes: 2992
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    if(a<b)
    {
        cout<<"0";
    }
    else
    {
        b=b*2;
        if(b<a)
        {
            cout<<a-b;
        }
        else
        {
            cout<<"0";
        }
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main() {
  int n, m;
  int ans = 0;
  cin >> n >> m;
  vector<int> data(m);
  for(int i = 0; i < n; i++) {
    int c;
    cin >> c;
    for(int j = 0; j < c; j++) {
      int d;
      cin >> d;
      data[d-1]++;
    }
  }
  for(int i = 0; i < data.size(); i++) {
    if(data[i] == n) ans += 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>  
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod=1e9+7;
const ll longINF=3e18;
const double eps=1e-8;
const double dinf=190.0;
const double pi=acos(-1);
const int INF=2e9+1;

int n;
        
int main() 
{        
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        //freopen("input.txt","r",stdin);
        //freopen("output.txt","w",stdout);
        cin>>n;
        cout<<"ABC"<<n;
        return 0;
}

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

using namespace std;

#define MOD 1000000007

int main() {
	int n; cin >> n;
	vector<vector<int> > a(n, vector<int>(n));
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < n; ++j)
			cin >> a[i][j];
	vector<vector<long long> > dp(n + 1, vector<long long>(1 << n));
	dp[0][0] = 1;
	for (int i = 0; i < n; ++i)
		for (int flag = 0; flag < (1 << n); ++flag)
			if (i == __builtin_popcount(flag))
				for (int j = 0; j < n; ++j)
					if (!(flag & (1 << j)))
						if (a[i][j]) (dp[i + 1][flag | (1 << j)] += dp[i][flag]) %= MOD;
	cout << dp[n][(1 << n) - 1] << endl;

	return 0;
}

Measured memory_bytes: 377216
h,w = map(int, input().split())
ans = 1000000000
if max(h,w) >= 3:
  if h >= w :
    ans = w*min(1,(h%3))
  else:
    ans = h*min(1,(w%3))
if h%3 == 0:
  ans = 0
if w%3 == 0:
  ans = 0
for i in range(1,h):
  ans_ = max(i*w,(h-i)*(w+(w%2))//2) - min(i*w,(h-i)*(w-(w%2))//2)
  ans = min(ans,ans_)
for i in range(1,w):
  ans_ = max(i*h,(w-i)*(h+(h%2))//2) - min(i*h,(w-i)*(h-(h%2))//2)
  ans = min(ans,ans_)
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define irep(i,a,b) for(typeof(i) i = (a); i < (b); ++i)
#define itrep(it,c) for(auto it = (c).begin(); it != (c).end(); ++it)

class Node;

vector<Node> nodes;
ll nn; // チェック済み（戻り済み）ノードの数
map<int, ll> excl; // (color, local counter): colorにとって、既に除外されたノード数
map<int, ll> cumm; // (color, paths with no color): 色が途切れたら、count個数を見てこの領域のpath数を入れる。

class Node {
private:
	int color_;
	set<Node*> links_;
public:
	void setColor(int c) { color_ = c; }
	void setLink(int n) { links_.insert(&nodes[n]); }
	void calc(Node* prev) { // 戻り値はカウント済み全ノード数
		ll mynn = nn;
		ll myexcl = excl[color_];
		itrep(it, links_) {
			if (*it == prev) continue;
			(*it)->calc(this); // 戻ってきたら、自分のcolor_については一旦切る。
			ll inner = nn - mynn - (excl[color_] - myexcl);
			cumm[color_] += inner * (inner + 1) / 2;
			excl[color_] += inner;
//			cout << "INN  color = " << color_ +1 << ", cumm = " << cumm[color_] << ", excl = " << excl[color_] << ", nn = " << nn << endl;
		}
		nn++;
		excl[color_]++;
//		cout << "PREV color = " << color_ + 1 << ", cumm = " << cumm[color_] << ", excl = " << excl[color_] << ", nn = " << nn << endl;
		return;
	}
};


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

	ll N;
	cin >> N;
	nodes.assign(N,Node());

	int id = 0;
	itrep(it, nodes) {
		int c;
		cin >> c;
		it->setColor(c-1);
		id++;
	}

	rep(i, N - 1) {
		int a, b;
		cin >> a >> b;
		nodes[a - 1].setLink(b - 1);
		nodes[b - 1].setLink(a - 1);
	}

	// loop
	nn = 0;
	nodes.at(0).calc(nullptr);

	rep(i, N) {
		// 最後の加算がされていない
		ll inner = nn - excl[i];
		cumm[i] += inner * (inner + 1) / 2;
		excl[i] = nn;
//		cout << "color = " << i+1 << ", cumm = " << cumm[i] << ", excl = " << excl[i] << endl;
		cout << N * (N + 1) / 2 - cumm[i] << endl;
	}
}


Measured memory_bytes: 79784
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,i;
	cin>>n;
	int a[n];
	int c=0;
	map < int,int > x;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		if(1<=a[i]&&a[i]<=399)
		{
			x[1]=1;
		}
	else if(400<=a[i]&&a[i]<=799)
		{
			x[2]=1;
		}
	else if(800<=a[i]&&a[i]<=1199)
		{
			x[3]=1;
		}
		else if(1200<=a[i]&&a[i]<=1599)
		{
			x[4]=1;
		}
		else if(1600<=a[i]&&a[i]<=1999)
		{
			x[5]=1;
		}
	else if(2000<=a[i]&&a[i]<=2399)
		{
			x[6]=1;
		}
	else if(2400<=a[i]&&a[i]<=2799)
		{
			x[7]=1;
		}
	else if(2800<=a[i]&&a[i]<=3199)
		{
			x[8]=1;
		}
		else
		{
			c=c+1;
		}
	}
	
	if(c==0)
	cout<<x.size()<<" "<<x.size()<<endl;
	else if(x.size()==0)
	cout<<x.size()+1<<" "<<x.size()+c<<endl;
	else
	cout<<x.size()<<" "<<x.size()+c<<endl;
}

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



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)



int main(void){
	
	int A, B, T; cin >> A >> B >> T;

	int p = T / A;
	int ans = p * B;
	cout << ans << endl;


	return 0;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		scan.close();
		System.out.println(n*(n-1)/2+m*(m-1)/2);
	}
}

Measured memory_bytes: 35688
var
	N,K,i,u,v:Longint;
begin
	read(N,K);
	if (N-1)*(N-2)<K*2 then begin
		writeln(-1);
		exit;
	end;
	K:=(N-1)*(N-2)div 2-K;
	writeln(K+N-1);
	for i:=2 to N do begin
		write('1 ');
		writeln(i);
	end;
	for u:=2 to N do begin
		for v:=u+1 to N do begin
			if K=0 then exit;
			writeln(u);
			writeln(v);
			dec(K);
		end;
	end;
end.


Measured memory_bytes: 128
from sys import stdin
from itertools import repeat
def f(a):
    n = len(a)
    l = [0] * (n + 1)
    st = [(0, 0, 0, 1)]
    pu = st.append
    po = st.pop
    for i in xrange(1, n):
        ad = 0
        r = i
        u = 0
        k = 1
        while st and (a[r] << u) > a[st[-1][0]]:
            y = a[r] << u
            x, r, u, q = po()
            c = (((y - 1) / a[x]).bit_length() + 1) / 2 * 2
            ad += c * q
            k += q
            u += c
        pu((i, r, u, k))
        l[i+1] = l[i] + ad
    return l
 
def main():
    n = int(stdin.readline())
    a = map(int, stdin.readline().split(), repeat(10, n))
    l = f(a)
    r = f(a[::-1])[::-1]
    ans = 10 ** 12
    for i in xrange(n + 1):
        if ans > l[i] + i + r[i]:
            ans = l[i] + i + r[i]
    print ans
main()


Measured memory_bytes: 42824
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <limits>
#include <numeric>

using namespace std;
typedef long long int ll;
typedef long double ld;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }                   // 最大公約数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); };                      // 最小公倍数
ll getDigit(ll num) { return log10(num) + 1; }                         // 桁数
ll digitSum(ll n) { return (n < 10) ? n : digitSum(n / 10) + n % 10; } // 各桁の和
#define MOD 1e9 + 7
#define pb push_back
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repn(i, n) for (ll i = 1; i <= n; i++)
#define repi(i, a, b) for (ll i = ll(a); i < ll(b); ++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265359

template <typename T>
void printVector(string name, vector<T> vec)
{
    cout << name << ": ";
    rep(i, vec.size())
    {
        cout << vec[i] << " ";
    }
    cout << endl;
}

void Main()
{
    int a;
    int b;
    cin >> a >> b;
    cout << (a * b) << endl;
    return;
}

signed main(void)
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

int main() {


    int n;

    cin >> n;

    vector<int> v(n);

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

    sort(v.begin(), v.end());
    int maxV = v[n - 1];

    vector<bool> used(maxV + 1, false);
    int count = 0;

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

        if(used[v[i]])
            continue;

        for(int j = 1; j * v[i] <= maxV; j++) {
            used[v[i] * j] = true;
        }

        if(i + 1 < n && v[i] == v[i + 1])
            continue;

        count++;

    }

    cout << count << endl;

    return 0;


}

Measured memory_bytes: 3996
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;
using vi = vector<int>;

#define in(v) v; cin >> v;
void ins() {}
template<class T,class... Rest>void ins(T& v,Rest&... rest){cin>>v;ins(rest...);}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rrep(i,n) for(long long i=(n);i>=0;--i)
#define all(f,c,...) (([&](decltype((c)) cccc) { return (f)(begin(cccc), end(cccc), ## __VA_ARGS__); })(c))

// ========== debug ==========
template<class T>ostream& operator<<(ostream& os,const vector<T>& vec){os<<"{";for(size_t i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
ostream& operator<<(ostream& os,const vector<char>&v){for(size_t i=0;i<v.size();++i)os<<v[i];return os;}
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>& rhs){os<<"("<<rhs.first<<", "<<rhs.second<<")";return os;}

#ifdef LOCAL
void debug() {cerr << "\n";}
template<class First> void debug(const First& first) {cerr<<first<<"\n";}
template<class First, class... Rest> void debug(const First& first, const Rest&... rest) {cerr<<first<<",";debug(rest...);}
void debug2() {cerr << "\n";}
template<class First> void debug2(const First& first) {cerr<<first<<" ";}
template<class First, class... Rest> void debug2(const First& first, const Rest&... rest) {cerr<<first<<" ";debug2(rest...);}
#else
#define debug(...) 42
#define debug2(...) 42
#endif
// ===========================

int main() {
  int N;
  ins(N);

  rep(i, 360) {
    if ((i+1) * N % 360 == 0) {
      cout << i+1 << endl;
      return 0;
    }
  }

  return 0;
}


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

int main() {
  int K , X ;
  cin >> K >> X ;
  
  if (500*K >= X ){
    cout << "Yes" << endl ; 
    
    
  }
  else {
    cout << "No" << endl ;
  
  
  }
  
  
  
  
}

Measured memory_bytes: 3560
#include <iostream>
#include <stdio.h>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <deque>
#include <algorithm>
#include <math.h>
#include <random>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define int long long
#define double long double
#define Matrix vector<vector<int> >
#define kektor vector
#define pp pair
#define all(x) x.begin(), x.end()

using namespace std;

typedef long long ll;

int RandInt(int min, int max) {
    if (max < min) {
        swap(min, max);
    }
    random_device rd;
    mt19937 mt(rd());
    uniform_int_distribution<int> dist(min, max);
    return dist(mt);
}

struct Node {
	int l, r, x; 
	Node(int _l, int _r, int _x) : l(_l), r(_r), x(_x) {} 
	Node() : l(-1), r(-1), x(0) {} 
};

const int maxn = 2e5 + 1, mod = 1e9;
bool debug = false;


void solve() {
	int n, a;
	cin >> n >> a;
	while (n >= 500) {
		n -= 500; 		
	}
	if (n <= a) {
		cout << "Yes" ;
		return;	
	}
	cout << "No";
}            

signed main() {
    /*!

    !*/
    cout.precision(10);
    cout << fixed;
    if (!debug) {
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
    }
 //   freopen("TASK.in", "r", stdin);
  //  freopen("TASK.out", "w", stdout);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int rest(int);

int main()
{
	int n;
	scanf("%d", &n);
	int i;
	for (i = 1; i <= n - 1; i++)
	{
		if (i % 3 == 0 || i % 10 == 3|| rest(i) == 1) printf(" %d", i);
	}
	if (i % 3 == 0 || i % 10 == 3 || rest(i) == 1) printf(" %d\n", i);
	else printf("\n");
	
	return 0;
}

int rest(int x)
{
	int j;
	while (x > 0)
	{
		x /= 10;
		if (x % 10 == 3) return 1;
	}
	return 0;

}

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

int main(){
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int x1tox2 = x2 - x1;
    int y1toy2 = y2 - y1;
    int x1tox2_90degree = -y1toy2;
    int y1toy2_90degree = x1tox2;
    cout << x2+x1tox2_90degree << " " << y2+y1toy2_90degree << " " << x1+x1tox2_90degree << " " << y1+y1toy2_90degree << endl;
    return 0;
}

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

int main() {
	// your code goes here
	long long int n,d,x,y;
	cin>>n>>d;
	long long int count = 0;
	while(n--) {
	    cin>>x>>y;
	    if((double)sqrt(x * x + y * y) <= (double)d)
	        count++;
	}
	cout<<count<<endl;
	return 0;
}


Measured memory_bytes: 3676
// Marcin Knapik
// before you read it
// make sure it's a good idea
#include<bits/stdc++.h>
using namespace std;

typedef long long         ll;
typedef unsigned long long      ull;
typedef pair< ll, ll >        pll;
typedef pair< int, int  >       ii;
typedef vector< int  >       vi;
typedef vector< ii >        vii;
typedef vector< vi >        vvi;
typedef vector< vector < ii > >   vvii;
typedef vector< ll >        vll;
typedef vector< pll >       vpll;
typedef long double         ld;

#define boost   ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define szy     first
#define gi      second
#define sz(a)   (int)(a).size()
#define pb      push_back
#define all(c)    (c).begin(), (c).end()
#define rall(c)   (c).rbegin(), (c).rend()


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

template<class T> inline T fast(T a,T b,T mod) {ll res = 1; while(b){if(b&1) res = (res*a)%mod;a = (a*a)%mod;b >>= 1;}return res;}
template<class T> inline T russian(T a, T b, T mod) {ll res = 0; while(b){if(b&1) res = (res + a)%mod; a = (a+a)%mod; b>>=1;}return res;}
template<class T> inline T sub(T a, T b, T mod) {return ((a - b)+mod)%mod;}
template <class T> istream &operator>>(istream &os, vector<T> &container){for (auto &u : container)os >> u;return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> &container){for (auto &u : container)os << u << " ";return os;}
template<typename T> inline T gcd(T a, T b) { while (b)swap(a %= b, b); return a; }

ld e = 2.7182818284590452353602874713526624;
ld PI = acos(-1);
ld eps = 1e-11;

const ll T = 1 << 19;
const ll INF = 1e9 + 7;
const ll BIG_INF = 1e18 + 5;
const long long  N = 44 + 7;
ll n, m, k;
string a, b;

int main(){
	boost;
	cin >> n;
	vi tab(n);
	cin >> tab;
	sort(all(tab));

	if(n&1){
		cout << 0;
		exit(0);
	}

	if(tab[n/2] != tab[n/2-1]){
		cout << tab[n/2] - tab[n/2-1];
		exit(0);
	}
	else{
		cout << 0;
		exit(0);
	}
}		

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

vector<ll> enum_prime(ll N){
	deque<bool> is_prime(N+1,true);
	vector<ll> P;
	for(ll i=2;i<=N;i++){
		if(is_prime[i]){
			for(ll j=i*i;j<=N;j+=i){
				is_prime[j] = false;
			}
			P.emplace_back(i);
		}
	}
	return P;
}

vector<ll> prime_factor(ll n){
	ll sn = sqrt(n)+1;
	auto prime_list = enum_prime(sn);
	vector<ll> res;
	for(int i=0,ei=prime_list.size();i<ei;i++){
		ll v = prime_list[i];
		if(v*v>n) break;
		while(!(n%v)){
			n /= v;
			res.push_back(v);
		}
	}
	if(n>1){
		res.push_back(n);
	}

	return res;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	auto N=in();
	auto P=prime_factor(N);
	sort(ALL(P));

	cout << N << ": ";
	for(int i=0,ei=P.size();i<ei;i++){
		cout << P[i];
		if(i==ei-1) cout << endl;
		else cout << " ";
	}
	
	return 0;
}


Measured memory_bytes: 3212
#include<iostream>
#include<algorithm>
#include<string.h>

using namespace std;

int a[100000];

int main(){
	memset(a,0,sizeof(a));
	int n;
	cin >> n;
	
	for(int i = 0;i < n;i++){
		cin >> a[i];
	}
	
	int all = 0;
	int now = 0;
	for(int i = 0;i < n;i++){
		all += abs(now - a[i]);
		now = a[i];
	}
	all += abs(now);
	
	for(int i = 0;i < n;i++){
		int cost = all;
		if(i == 0){
			if(a[i] < min(a[i+1],0)){
				cost -= abs(a[i] - min(a[i+1],0)) * 2;
			}else if(a[i] > max(a[i+1],0)){
				cost -= abs(a[i] - max(a[i+1],0)) * 2;
			}
		}else if(i == (n-1)){
			if(a[i] < min(a[i-1],0)){
				cost -= abs(a[i] - min(a[i-1],0)) * 2;
			}else if(a[i] > max(a[i-1],0)){
				cost -= abs(a[i] - max(a[i-1],0)) * 2;
			}
		}else{
			if(a[i] < min(a[i-1],a[i+1])){
				cost -= abs(a[i] - min(a[i-1],a[i+1])) * 2;
			}else if(a[i] > max(a[i-1],a[i+1])){
				cost -= abs(a[i] - max(a[i-1],a[i+1])) * 2;
			}
		}
		cout << cost << endl;
	}
	return 0;
}

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

const int INF=1000000000;

struct edge{int to,cost;};
typedef pair<int,int>P;

int V,E,r;
vector<edge>G[100010];
int d[100010];

void dijkstra(int s){
    priority_queue<P,vector<P>,greater<P>>que;
    fill(d,d+V,INF);
    d[s]=0;
    que.push(P(0,s));
    while(!que.empty()){
        P p=que.top(); que.pop();
        int v=p.second;
        if(d[v]<p.first)continue;
        for(int i=0;i<G[v].size();i++){
            edge e=G[v][i];
            if(d[e.to]>d[v]+e.cost){
                d[e.to]=d[v]+e.cost;
                que.push(P(d[e.to],e.to));
            }
        }
    }
}


int main(){
    cin>>V>>E>>r;
    for(int i=0;i<E;i++){
        int a,b,c;
        cin>>a>>b>>c;
        struct edge e;
        e.to=b; e.cost=c;
        G[a].push_back(e);
    }
    dijkstra(r);
    for(int i=0;i<V;i++){
        if(d[i]==INF)cout<<"INF"<<endl;
        else cout<<d[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 13076
# -*- coding:utf-8 -*-
n = int(input())

PosList = []
TempSum = 0
ReturnSum = 0

PosList = list(map(int,input().split()))


for pos in range(1,101):
    TempSum = 0
    for nPos in range(n):
        TempSum += (pos - PosList[nPos])**2
    if pos == 1:
        ReturnSum = TempSum
    elif ReturnSum > TempSum:
        ReturnSum = TempSum
    """
    print("Position = "+str(pos))
    print("TempSum = "+ str(TempSum))
    print("ReturnSum = " + str(ReturnSum))
    print("----------------------------")
    """

print(ReturnSum)

Measured memory_bytes: 8964
#include <iostream>

 

 

 

using namespace std;

 

 

 

int main()
{
    int a, b;
    cin >> a >> b;
    if (a > b)
      cout << "a > b" << endl;
    else if (a < b)
      cout << "a < b" << endl;
    else
      cout << "a == b" << endl;    
}


Measured memory_bytes: 3100
#include<iostream>
using namespace std;
int main(){
    int n;
    cin>>n;
    int temp =n;
    int sum =0;
    while(n>0){
        sum +=n%10;
        n/=10;
    }
    if(temp%sum==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define sortall(obj) sort(ALL(obj));
typedef string str;
typedef long l;
typedef long long ll;
const ll INF=1e18;
const int mod=1e9+7; 
#define ins(a) cin >> a;
#define ind(a,b) cin >> a >> b;
#define rep(i,n) for(int i=0;i<n;i++)
#define print(a) cout << a << endl;

int main()
{
    int n;ll k;ind(n,k)
    vector<pair<int,int> > x(n);
    rep(i,n)ind(x.at(i).first,x.at(i).second)
    sortall(x)
    ll j=k;int cnt=-1;
    for(int i=0;j>0;i++){
        cnt++;
        j-=x.at(cnt).second;
    }
    print(x.at(cnt).first)
    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>

int main(void){
	int A,B,C,D,train,bus,fee;
	scanf("%d",&A);
	scanf("%d",&B);
	scanf("%d",&C);
	scanf("%d",&D);

	train = (A < B) ? A : B;
	bus = (C < D) ? C : D;

	fee = train + bus;
	printf("%d\n",fee);

	return 0;
}

Measured memory_bytes: 128
n=gets.to_i
arr=gets.split(" ").map{|n|n.to_i}
arr_r = []
arr_l = []
ans = []
arr_r[0] = arr[0]
arr_l[n-1-1] = arr[n-1]
for i in 1..n-2
  arr_r[i] = arr[i] + arr_r[i-1]
  arr_l[n-1-i-1] = arr[n-1-i] + arr_l[n-1-i+1-1]
end

for i in 0..n-1-1
 ans[i] = (arr_r[i] - arr_l[i]).abs
end

puts ans.sort[0]

Measured memory_bytes: 3836
<?php
while (true) {
    list($H, $W) = array_map("intval", explode(' ', trim(fgets(STDIN))));
    if ($H == 0 && $W == 0) {
        break;
    }
    
    $line1 = str_repeat('#', $W) . "\n";
    $line2 = '#' . str_repeat('.', $W - 2) . "#\n";
    $rectangle = $line1 . str_repeat($line2, $H - 2) . $line1;

    print($rectangle . "\n");
}
?>


Measured memory_bytes: 9288
#define MAX_VALUE 10000

#include<iostream>

using namespace std;

int main() {
	int n;
	int backet[MAX_VALUE + 1] = { 0 };
	cin >> n;
	int* a = new int[n];
	int work;
	for (int i = 0;i < n;i++) {
		cin >> work;
		backet[work]++;
	}
	int count = 0;
	for (int i = 0;i <= MAX_VALUE;i++) {
		for (int j = 0;j < backet[i];j++) {
			a[count] = i;
			count++;
		}
	}
	for (int i = 0;i < n - 1;i++) {
		cout << a[i] << " ";
	}
	cout << a[n - 1] << endl;
	

}


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


typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;

typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;

#define _  %  MOD
#define __ %= MOD

#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))

#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define fbo find_by_order
#define ook order_of_key

ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;} // modular exponent

int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
    string s;
    cin>>s;
    int n=s.length();
    string s1,s2;
    repA(i,0,(n/2)-1) s1+=s[i];
    repA(i,(n/2)+1,n-1) s2+=s[i];
    string s3=s2;
    reverse(s3.begin(),s3.end());
    string s4=s1;
    reverse(s4.begin(),s4.end());
    if(s1==s3 && s1==s4) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;

}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <memory>
#include <algorithm>
#include <cstring>

using namespace std;


int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (a == 7)
        swap(a, b);
    if (b == 7)
        swap(b, c);
    if (a == b && a == 5 && c == 7)
        cout << "YES";
    else
        cout << "NO";
    return 0;
}


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

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


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

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

bool isNumChar(char c) {
    return c >= '0' && c <= '9';
}

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

    string s;
    cin >> s;

    for (int i = 0; i < a; i++) {
        char c = s[i];
        if (!isNumChar(c)) {
            cout << "No" << endl;
            return 0;
        }
    }

    if (s[a] != '-') {
        cout << "No" << endl;
        return 0;
    }
    for (int i = 0; i < b; i++) {
        char c = s[a + i + 1];
        if (!isNumChar(c)) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
}

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

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

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

int main()
{
    int n,candies;
    cin>>n>>candies;
    vector<int>upto(n);
    for(int i=0;i<n;i++) cin>>upto[i];
    vector<long long int> dp(candies+1);
    dp[0]=1;

       for(int i=0;i<n;i++){
               vector<ll> dp1(candies+1);
         for(int cur_candy=candies;cur_candy>=0;cur_candy--){
                int temp=dp[cur_candy];
                int L=cur_candy+1;
               int R=cur_candy+min(upto[i],candies-cur_candy);
               if(L<=R && L<=candies){
                 add_self(dp1[L],temp);
                  if(R+1<=candies) set_self(dp1[R+1],temp);
               }

            }
           ll prefix_sum=0;
           for(int i=0;i<=candies;i++){
             add_self(prefix_sum,dp1[i]);
             add_self(dp[i],prefix_sum);
           }
         }

    cout<<dp[candies];

}


Measured memory_bytes: 4832
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define endl "\n"
#define f(i, a, b) for(ll i=a; i<b; i++)
#define fb(i, a, b) for(ll i=a; i>=b; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector <int>
#define vl vector <long long>
#define pi pair <int, int>
#define sz(x) (int) x.size()
#define M 100005
#define mod 1000000007
using namespace std;

void solve()
{
	int n, k, d, ans = 0, x;
	cin>>n>>k;
	int cnt[n] = {};
	f(i, 0, k)
	{
		cin>>d;
		f(i, 0, d) cin>>x, cnt[x-1]++;
	}
	f(i, 0, n) if(cnt[i] == 0) ans++;
	cout<<ans;
}

int main()
{
    IOS
    int t = 1;
    //cin>>t;
    f(tno, 1, t+1)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3652
while 1:
    board = []
    n = list(input())
    if n[0] == "0":
        break

    board.append(n)
    for _ in range(2):
        n = list(input())
        board.append(n)

    ans = "NA"
    for i in range(3):
        if board[i][0] == board[i][1] == board[i][2] and board[i][0] != "+":
            ans = board[i][0]
        elif board[0][i] == board[1][i] == board[2][i] and board[0][i] != "+":
            ans = board[0][i]

    if board[0][0] == board[1][1] == board[2][2] and board[0][0] != "+":
        ans = board[0][0]
    elif board[2][0] == board[1][1] == board[0][2] and board[2][0] != "+":
        ans = board[1][1]

    print(ans)



Measured memory_bytes: 5572
import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		// ------------------------------------------------
		int n = Integer.parseInt(sc.next());
		int k = Integer.parseInt(sc.next());
		List<Integer> h = new ArrayList<Integer>();
		for (int i = 0; i < n; i++) {
			h.add(Integer.parseInt(sc.next()));
		}

		int ret = 0;
		for (int i = 0; i < n; i++) {
			if (h.get(i) >= k) {
				ret++;
			}
		}
		out.println(ret);

		// ------------------------------------------------
		sc.close();
		out.flush();
	}
}

Measured memory_bytes: 48092
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 998244353
#define INF 1145141919810364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n, m;
int cnt;

signed main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int a; cin >> a;
		cnt += a;
	}
	if (n < cnt)cout << -1 << endl;
	else cout << n - cnt << endl;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
vector<int> v[100005];
int main() {
    int n,k,i,j,x,y;
    cin>>n>>k;
    for(i=0;i<k;i++) {
       cin>>x>>y;
       v[x].push_back(y);
       v[y].push_back(x);
    }
    vector<int> ans(n+1,-1);
    queue<int> q;
    q.push(1);
    while(!q.empty()) {
        int t=q.front();
        q.pop();
        for(i=0;i<v[t].size();i++) {
            if(ans[v[t][i]]==-1) {
                ans[v[t][i]]=t;
                q.push(v[t][i]);
            }
        }
    }
    bool upd=true;
    for(i=2;i<=n;i++) {
        if(ans[i]==-1) {
            upd=false;
            break;
        }
    }
    if(!upd) cout<<"No\n";
    else {
        cout<<"Yes\n";
        for(i=2;i<=n;i++) cout<<ans[i]<<"\n";
    }
}

Measured memory_bytes: 10172
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

int n;
vector<int> ve[10005];
int a[10005];
int b[10005];
int sum;
queue<int> qu;
int ans[10005];
int cnt;

int main()
{
    scanf("%d", &n);
    for(int i = 0; i < n - 1; i++)
    {
        int u, v;
        scanf("%d%d", &u, &v);
        ve[u].push_back(v);
        ve[v].push_back(u);
    }
    for(int i = 0; i < n; i++) scanf("%d", &a[i]);
    sort(a, a + n);
    for(int i = 0; i < n - 1; i++)
    {
        sum += a[i];
    }
    printf("%d\n", sum);
    for(int i = 1; i <= n; i++) b[i] = ve[i].size();
    for(int i = 1; i <= n; i++) if(b[i] == 1) qu.push(i), ans[i] = a[cnt], cnt++;
    while(!qu.empty())
    {
        int t1 = qu.front();
        qu.pop();
        for(int i = 0; i < ve[t1].size(); i++)
        {
            b[ve[t1][i]]--;
            if(b[ve[t1][i]] > 1 || ans[ve[t1][i]]) continue;
            ans[ve[t1][i]] = a[cnt];
            cnt++;
            qu.push(ve[t1][i]);
        }
    }
    for(int i = 1; i <= n; i++) printf("%d ", ans[i]);
    return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<map>
#include<string>
#include<cstring>
using namespace std;
map <string,int> ke;
main(){
  int n;
  char k[256];
  while(scanf("%d,%s",&n,k)!=EOF){
    string st=k;
    ke[st]++;
  }
  cout << ke["A"] << endl;
  cout << ke["B"] << endl;
  cout << ke["AB"] << endl;
  cout << ke["O"] << endl;
}

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

using namespace std;
using ll = long long;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int a, b, h;
    cin >> a >> b >> h;
    cout << (a + b)*h/2 << '\n';
    return 0;
}

Measured memory_bytes: 3632
import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class Main {

static long[] list=new long[87];

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

   String nyuA=sc.nextLine();
 //  String nyuB=sc.nextLine();
 
//   String[] s=sc.nextLine().split(" ");
 //    String[] t=sc.nextLine().split("");

int N=Integer.parseInt(nyuA);
//int A=Integer.parseInt(s[0]);
//int B=Integer.parseInt(s[1]);

TreeSet<Integer> list=new TreeSet<>();
for(int i=0;i<N;i++){
list.add(Integer.parseInt(sc.nextLine()));
}
ArrayList<Integer> set=new ArrayList<>(list);


System.out.println(set.size());


}

}



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


bool inside(int i, int j, int h, int w) {
	return (i >= 0 && i < h && j >= 0 && j < w);
	}

int main() {

    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);  
	int n,k,s;
	cin>>n>>k>>s;
	if(s < 1e9) {
		for(int i = 0; i < n; i++) {
			if(k-- > 0) 
				cout<<s<<" ";
			else
				cout<<s+1<<" ";
		}
	}
	else {
		for(int i = 0; i < n; i++) {
			if(k-- > 0) 
				cout<<s<<" ";
			else
				cout<<1<<" ";
		}
	}

	return 0;		
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S, W;
  string DE[4] = {"maerd","esare","resare","remaerd"};
  int L, N, K;
  cin >> S;
  L = S.size();
  N = L;
  bool H = true;
  reverse(S.begin(), S.end());
  
  
  while(H){
     W = "";
     if(N == 0){
     break;
     }
     if(N < 5){
     H = false;
     break;
     }
    
     if(S.at(L - N) == 'm' || S.at(L - N) == 'e'){
     K = 0;
     }
     else if(S.at(L - N) == 'r'){
        if(S.at(L - N + 2) == 's'){
        K = 1;
        }
        else if(S.at(L - N + 2) == 'm'){
        K = 2;
        }
     }
        
     for(int i = 0;i < 5 + K;i++){
     W = W + S.at(L - N + i);
     }

     if(W == DE[0] || W == DE[1] || W == DE[2] || W == DE[3]){
     N = N - 5 - K;
     }
     else{
     H = false;
     }
  }
 
  if(H){
  cout << "YES" << endl;
  }
  else{
  cout << "NO" << endl;
  }
}

Measured memory_bytes: 512
def main():
    s = int(input())
    mod = 10**9 + 7

    dp = [0] * (s+1)
    dp[0] = 1
    for i in range(1, s+1):
        for j in range(0, (i-3)+1):
            dp[i] += dp[j]
            dp[i] %= mod
    print(dp[-1])


if __name__ == "__main__":
    main()


Measured memory_bytes: 64552
import Data.Set (fromList)

main :: IO ()
main = do
    l1 <- getLine
    l2 <- getLine
    let n = read l1 :: Int
    let as = (map read . words) l2 :: [Int]
    putStrLn $ solve n as

solve :: Int -> [Int] -> String
solve n as = show . removeDup $ (x, n-x)
    where x = countDup as

removeDup :: (Int, Int) -> Int
removeDup (0, uni) = uni
removeDup (1, uni) = uni - 1
removeDup (x, uni) = removeDup (x-2, uni)

countDup :: [Int] -> Int
countDup as = abs $ length as - length (fromList as)


Measured memory_bytes: 47484
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}
 
int main()
{
  int N;
  int A[100020] = {};
  int i,j;
  int number;
  char s[10];
  int  cnt_sum=0;
  int  cnt=0;
  int  cnt_a=0;
  int  cnt_b=0;
  int  cnt_c=0;
  int  ans=0;

//    int k=0;
  scanf("%d", &N);
//  scanf("%lld %lld",  &D, &X);
  A[0]=0;
  A[N+1]=0;
  for(i=1;i<N+2;i++){
    scanf("%d", &A[i]);
//    if(A[i-1]<A[i]) cnt=(long long)abs(A[i]-A[i-1]);
    cnt=abs(A[i]-A[i-1]);
    //    else cnt=abs(A[i-1]-A[i]);
 //   printf("%lld\n",  cnt);
    cnt_sum = cnt_sum + cnt ;
  }
  for(i=1;i<N+1;i++){
//    if(A[i-1]<A[i+1]) cnt_a=(long long)abs(A[i+1]-A[i-1]);
//    else            cnt_a=(long long)abs(A[i-1]-A[i+1]);  
//    if(A[i-1]<A[i]) cnt_b=(long long)abs(A[i]-A[i-1]);
//    else            cnt_b=(long long)abs(A[i-1]-A[i]);
//    if(A[i]<A[i+1]) cnt_c=(long long)abs(A[i+1]-A[i]);
//    
       cnt = cnt_sum + abs(A[i-1]-A[i+1]) - abs(A[i]-A[i-1])- abs(A[i+1]-A[i]);

    printf("%d\n",  cnt);  
  }

return 0;
}


Measured memory_bytes: 1536
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();
		int C = sc.nextInt();
		int D = sc.nextInt();
		if(B <= C || A >= D){
			System.out.println(0);
		} else {
			System.out.println((B < D ? B : D)-(A > C ? A : C));
		}
	}
}

Measured memory_bytes: 21712
#pragma GCC optimize("Ofast",3,"inline")
#include<bits/stdc++.h>
using namespace std;
#define fir first
#define sec second
#define m_p make_pair
#define y1 ygftgfgcdtfgxffgx
#define y2 yfdsesgvtyghftfvv
#define x1 xvyr6cf6fgcfgf676
#define x2 xcr6rfc5r66y6r6fr
#define up_bound upper_bound
#define low_bound lower_bound
#define next_per next_permutation
#define pb push_back
#define i_to_s to_string
typedef priority_queue<int> p_queue;
typedef priority_queue<int, vector<int>, greater<int> > min_p_queue;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int mon[20]={31,28,31,30,31,30,31,31,30,31,30,31};
ll gcd(ll x,ll y){return ((y==0)?x:gcd(y,x%y));}
inline int read(){
	int x=0;char ch=getchar();
	while(ch<'0'||ch>'9')ch=getchar();
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x;
}
int l,r;
int d;
int cnt;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	cin>>l>>r>>d;
	while(r>=l){
		if(r%d==0)cnt++;
		r--;
	}
	cout<<cnt;
	return 0;
}



Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
typedef long long lint;
typedef unsigned int uint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
typedef unsigned long long ulint;
#define endl '\n'
#define fst first
#define sed second
#define pb push_back
#define mp make_pair
#define rint register int
#define newline putchar('\n')
#define leave_space putchar(' ')
#define all(x) (x).begin(), (x).end()
#define reveal(x) cerr << #x << " = " << (x) << endl
#define rep(it, f, e) for (rint it = (f); it <= (e); ++it)
#define per(it, f, e) for (rint it = (f); it >= (e); --it)
const int tx[] = {0, 1}, ty[] = {1, 0};
int n, m, mat[205][205];
int dp[205][205][205];
inline int dfs(int x1, int y1, int x2, int y2) {
	if (~dp[x1][y1][x2]) return dp[x1][y1][x2];
	int ret = 0, X1, Y1, X2, Y2;
	rep (i, 0, 1) {
		X1 = x1 + tx[i];
		Y1 = y1 + ty[i];
		rep (j, 0, 1) {
			X2 = x2 + tx[j];
			Y2 = y2 + ty[j];
			if (X1 == X2) continue;
			if (~mat[X1][Y1] && ~mat[X2][Y2])
			ret = max(ret, dfs(X1, Y1, X2, Y2));
		}
	}
	return dp[x1][y1][x2] = ret + mat[x1][y1] + mat[x2][y2];
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL), cout.tie(NULL);
	cin >> n >> m;
	memset(mat, -1, sizeof(mat));
	rep (i, 1, n) {
		rep (j, 1, m) {
			cin >> mat[i][j];
		}
	}
	if (n < 3 || m < 3) {
		int ans = 0;
		rep (i, 1, n) {
			rep (j, 1, m) {
				ans += mat[i][j];
			}
		}
		cout << ans << endl;
		return 0;
	}
	memset(dp, -1, sizeof(dp));
	cout << dfs(1, 2, 2, 1) + mat[1][1] + mat[n][m] << endl;
	return 0;
}

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

using namespace std;


int main()
 {
//code
         ll n,i;
         cin>>n;
         vector<ll> dp(n,0);
         vector<ll> a(n);
         for(i=0;i<n;i++)
         {
         	ll temp;
         	cin>>temp;
         	a[i]=temp;
		 }

         dp[0]=0;dp[1]=a[0]>=a[1]?a[0]-a[1]:a[1]-a[0];
         
         for(i=2;i<n;i++)
         {
         	ll temp2=a[i-2]>=a[i]?a[i-2]-a[i]:a[i]-a[i-2];
		    ll temp1=a[i-1]>=a[i]?a[i-1]-a[i]:a[i]-a[i-1];
            ll min=temp1+dp[i-1]>=temp2+dp[i-2]?temp2+dp[i-2]:temp1+dp[i-1];
            dp[i]=min;
        }
         // for(i=0;i<n;i++)
          //cout<<dp[i]<<endl;
        
       
       cout<<dp[n-1];

}

Measured memory_bytes: 1792
#include <stdio.h>
#define PI 3.14159265358979

int main(void){
    double r;
    double s, l;

    scanf("%lf", &r);
    l = 2*PI*r;
    s = r*r*PI;
    printf("%lf %lf\n", s, l);
    return 0;
}

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

int a,b,k;

signed main() {
    cin >> a >> b >> k;
    cout << max(0LL, a-k) << " " << max(0LL, b-max(0LL,k-a)) << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define MOD 1000000007
//S.size()
//配列名.Length()
using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<bool> VB;
typedef unsigned long long ll;


int main(void){
	ll L,R; cin >> L >> R;
	R = min(R,L + 2019);
	ll num;
	ll minn = MOD;
	for(ll i = L; i < R; i++){
		for(ll j = i + 1; j <= R; j++){
			num = i * j % 2019;
			if(num < minn)minn = num;
		}
	}
	cout<<minn<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int a, b;
    cin >> a >> b;
    cout << max({2 * a - 1, 2 * b - 1, a + b}) << endl;
    return 0;
}


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

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

    int ans=1e9;
    while(n--){
        int a; cin>>a;
        int count_2 = 0;
        while(a%2 == 0){
            count_2++;
            a /= 2;
        }
        ans = min(ans,count_2);
    }
    cout << ans << endl;

}


Measured memory_bytes: 3636
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
int a,b;
int main()
{
	scanf("%d%d",&a,&b);
	if(a<=0&&b>=0)printf("Zero\n");
	else if(a>0&&b>0)printf("Positive\n");
	else
		if((b-a)%2)printf("Positive\n");
		else printf("Negative\n");
	return 0;
}

Measured memory_bytes: 256
#B
s = list(input())
left = int(s[0])*10+int(s[1])
right = int(s[2])*10+int(s[3])
if 0 < left <= 12:
    if 0 < right <= 12:
        print("AMBIGUOUS")
    else:
        print('MMYY')
elif 0 < right <= 12:
    print('YYMM')
else:
    print('NA')


Measured memory_bytes: 3060