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

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int[] A = new int[N];
            for (int i = 0; i < N; i++) {
                A[i] = in.nextInt();
            }

            int min = Math.min(A[0], A[1]);

            int[] X = new int[N];
            int l = 0;
            int r = min + 1;
            for (; l < r;) {
                int xper2 = (l + r) / 2;

                for (int i = 0; i < N; i++) {
                    int j = (i + 1) % N;
                    if (j == 1) {
                        X[j] = xper2;
                        continue;
                    }
                    X[j] = A[i] - X[i];
                }

                if (X[0] + X[1] == A[0]) {
                    break;
                } else if (X[0] + X[1] < A[0]) {
                    l = xper2;
                } else {
                    r = xper2;
                }

            }

            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < N; i++) {
                if (i > 0) {
                    sb.append(" ");
                }
                sb.append(2 * X[i]);
            }
            System.out.println(sb.toString());
        }
    }
}


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

using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    cin >> p.at(i);
  }
  sort(p.begin(), p.end());
  int sum = 0;
  for (int i = 0; i < k; i++) sum += p.at(i);
  cout << sum;
  return 0;
}


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

using namespace std;

/* g++ -g -fsanitize=address -lasan -std=c++11 -Dfoo_ */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#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 FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long
LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

const int maxn = 1e5+5;
struct Edge { int u,v,c; } E[maxn*2];
set<int> colr[maxn]; VI G[maxn];

void dfs(const int u, const int p)
{
    int c = 1;
    FOR_ALL(e,G[u]) {
        const int v = E[*e].v;
        if (v != p) {
            while (in_(c,colr[u]))
                c++;
            colr[u].insert(c);
            colr[v].insert(c);
            E[*e].c = c;
            dfs(v,u);
        }
    }
}

int main()
{
#ifdef foo_
    freopen("foo", "rt", stdin);
#endif
    ios::sync_with_stdio(false);
    int n;
    while (cin >> n) {
        FOR(i,0,n+1)
            colr[i].clear(), G[i].clear();
        int j = 0;
        FOR(_,0,n-1) {
            int u,v; cin >> u >> v;
            E[j].u = u; E[j].v = v; E[j].c = 0;
            G[u].push_back(j); j++;
            E[j].u = v; E[j].v = u; E[j].c = 0;
            G[v].push_back(j); j++;
        }
        dfs(1,1);
        VI ans; 
        FOR(i,0,j) if (E[i].c) 
            ans.push_back(E[i].c);
        set<int> S(ALL(ans));
        cout << S.size() << endl;
        FOR_ALL(a,ans)
            cout << *a << endl;
    }
    return 0;
}


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

int main() {
  int x;
  cin >> x;
  if (x == 3 || x == 5 || x == 7) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <bitset>
#include <limits>
#include <unordered_map>
#include <deque>
#include <queue>
#include <algorithm>


const int INF = 1001001001;
int main() {
    std::cin.tie(0); std::ios::sync_with_stdio(false);

    int n, m;
    std::cin >> n >> m;
    std::unordered_map<int, std::vector<int>> graph;

    for (int i = 0; i < m; ++i) {
        int a, b;
        std::cin >> a >> b;
        a--;
        b--;
        if (graph.count(a)){
            graph[a].push_back(b);
        }else{
            graph[a] = std::vector<int>{b};
        }
    }

    std::vector<int> smallest_cycle(n+1, INF);
    for(int loc=0;loc<n;loc++){

        // findSmallestCycle
        // BFS
        std::queue <int> que;
        std::vector<int> dist(n, INF);
        std::unordered_map<int, int> inv_graph;

        dist[loc] = 0;
        que.push(loc);
        while (que.size()>0){
            // Get que
            int curr_loc = que.front();  que.pop();
            for(int next_loc: graph[curr_loc]){
                if(dist[next_loc]!=INF) continue;
                dist[next_loc] = dist[curr_loc] + 1;
                que.push(next_loc);
                inv_graph[next_loc] = curr_loc;
            }
        }

        std::pair<int, int> min_node(INF, -1);

        for(int i=0;i<n;i++){
            if(i==loc) continue;
            for(int next_node: graph[i]){
                if(next_node==loc){
                    min_node = min(min_node, std::make_pair(dist[i], i));
                }
            }
        }

        std::vector<int> min_cycle{};
        if(min_node.second != -1){
            int prev = min_node.second;
            while(true){
                min_cycle.push_back(prev);
                prev = inv_graph[prev];
                if(prev==loc){
                    min_cycle.push_back(prev);
                    break;
                }
            }
        }

        if(min_cycle.size()==0) continue;

        if(smallest_cycle.size()>min_cycle.size())
            smallest_cycle = min_cycle;
    }
    if (smallest_cycle.size() == n+1){
        std::cout << "-1" << std::endl;
        return 0;
    }
    std::cout << smallest_cycle.size() << std::endl;
    for(auto &it:smallest_cycle){
        std::cout << it+1 << std::endl;
    }
//    for (int i=0;i<n;i++){
//        std::cout << a[i] << std::endl;
//    }

    return 0;
}

Measured memory_bytes: 384
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
//cin.sync_with_stdio(false);
//streambuf
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
using pll = pair<ll, ll>;
typedef pair<double, double> pdd;
using vi = vector<int>;
using vpii = vector<pii>;
template<class T, class T2> using umap = unordered_map<T, T2>;
template<class T> using uset = unordered_set<T>;
#define ALL(a) a.begin(),a.end()
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a) for(int i=1;i<=a;i++)
vector<pair<ll, pll>> buf;
pll m;
void dfs(int f,int pos,int cnt,ll s) {
	if (buf.size() == pos) {
		m = max(m, pll(cnt,s));
		return;
	}
	if (buf.size() - pos + cnt <= m.first)return;
	if (!(f&buf[pos].second.first))dfs(f | 1<<pos, pos + 1, cnt + 1, s | 1ll << pos);
	dfs(f, pos + 1, cnt, s);
}
int main() {
	int n;
	cin >> n;
	vi in(n);
	for (auto &a : in)cin >> a;
	sort(ALL(in));
	ll fa = 1ll << 60;
	do{
		buf.clear();
		rep(i, n) {
			int a = in[i];
			m = pii();
			dfs(0, 0, 0, 0);
			ll f = m.second;
			ll s = 0;
			int k = 0;
			int mf = 0;
			for (int i = 0; 1ll << i <= f; i++)if (f & 1ll << i) if (buf[i].first > 1)mf |= 1ll << (buf.size() + k++); else mf |= 1ll << i;
			if (a > m.first)mf |= 1 << buf.size() + k;
			int l = 0;
			for (int i = 0; f >= 1ll << i&&a; i++) {
				if (f & 1ll << i) {
					if (buf[i].first == 1) {
						buf[i].second.first |= mf;
					}
					else {
						buf.push_back(make_pair(1, pii(buf[i].second.first | mf, buf[i].second.second)));
						buf[i].first--;
						for (auto&a : buf)if (a.second.first & 1ll << i)a.second.first |= 1ll << buf.size()-1;
						buf[i].second.first |= 1 << i;
					}
					a--;
				}
			}
			if (a) {
				buf.push_back(make_pair(a, pll(mf, buf.size())));
			}
		}
		ll ans = 0;
		for (auto &a : buf)ans += a.first;
		fa = min(fa, ans);
	} while (next_permutation(ALL(in)));
	cout << fa << endl;
}

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

int main(){
    int X, A;
    cin >> X >> A;
    
    if(X < A)
        cout << 0 << "\n";
    else 
        cout << 10 << "\n";
    return 0;
} 


Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace Project
{
	
	class MainClass
	{
		public static LinkedList<int> list = new LinkedList<int>();
		public static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			for (int i = 0; i < n; i++)
			{
				string[] s = Console.ReadLine().Split(' ');
				command(s);
			}
			int m = list.Count;
			for (int i = 0; i < m; i++)
			{
				Console.Write(list.First.Value);
				list.RemoveFirst();
				Console.Write(i != m - 1 ? " " : "\n");
			}
		}

		public static void command(string[] s)
		{
			int x;
			switch (s[0])
			{
				case "insert":
					x = int.Parse(s[1]);
					list.AddFirst(x);
					break;
				case "delete":
					x = int.Parse(s[1]);
					list.Remove(x);
					break;
				case "deleteFirst":
					list.RemoveFirst();
					break;
				case "deleteLast":
					list.RemoveLast();
					break;
			}
		}
	}
}

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

int main()
{
	int N, M;
	cin >> N >> M;
	set<int> a;
	for (auto i = 0; i < M; ++i)
	{
		int temp;
		cin >> temp;
		a.insert(temp);
	}

	auto mod = 1000000007ull;
	vector<unsigned long long> dp(N + 1);
	dp[N] = 1;
	for (auto i = N - 1; i >= 0; --i)
	{
		if (a.find(i) != a.end())
		{
			continue;
		}

		if (i < N - 1)
		{
			if (a.find(i + 2) == a.end())
			{
				dp[i] = (dp[i] + dp[i + 2]) % mod;
			}
		}
		if (a.find(i) == a.end())
		{
			dp[i] = (dp[i] + dp[i + 1]) % mod;
		}
	}

	cout << dp[0] << endl;

	return 0;
}

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

int a, b;
string s, t;

int main() {
  cin >> a >> b;
  for(int i = 0; i < a; ++i) s += '0' + b;
  for(int i = 0; i < b; ++i) t += '0' + a;
  cout << min(t, s) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}
const ll MOD = 1e9 + 7;

void mainsolve(){

	vector<vector<ll>> a(3,vector<ll>(3));
	rep(i,3) rep(j,3) cin >> a[i][j];

	ll n;
	cin >> n;
	set<ll> b;
	rep(i,n){
		ll tmp;
		cin >> tmp;
		b.insert(tmp);
	} 

	rep(i,3){
		if(b.find(a[i][0]) != b.end() && b.find(a[i][1]) != b.end() && b.find(a[i][2]) != b.end()){
			cout << "Yes" << endl;
			return;
		}
	}

	rep(i,3){
		if(b.find(a[0][i]) != b.end() && b.find(a[1][i]) != b.end() && b.find(a[2][i]) != b.end()){
			cout << "Yes" << endl;
			return;
		}
	}

		if(b.find(a[0][0]) != b.end() && b.find(a[1][1]) != b.end() && b.find(a[2][2]) != b.end()){
			cout << "Yes" << endl;
			return;
		}	

		if(b.find(a[0][2]) != b.end() && b.find(a[1][1]) != b.end() && b.find(a[2][0]) != b.end()){
			cout << "Yes" << endl;
			return;
		}	

	cout << "No" << endl;
	return;
}

int main(){
	
	//ll TC;cin>>TC;rep(I,TC){cout<<"case:"<<I+1<<"---"<<endl; // comment out!
		mainsolve();
	//} // comment out!
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.precision(15);
  cout << fixed;
  double n,k;
  cin >> n >> k;
  ll ret = 0;
  for(ll i = 1; i <= n; ++i){
    ll j = 0;
    while((i<<j) < k) ++j;
    ret += 1<<(30-j);
  }
  cout << (1.0*ret)/n/(1<<30);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (1E9+7)
#define PI 3.1415926535897932384

std::ostream &operator<<(std::ostream &out, const vector<int> &tgt)
{
	string s;
	for (int i = 0; i<tgt.size(); i++) {
		s += (to_string(tgt[i]) + ((i != tgt.size() - 1) ? " " : ""));
	}
	out << s;
	return out;
}

int cas(int a, int b, int c, int d,int e) {
	return a * 10000 + b * 1000 + c * 100 + d * 10 + e;
}

int main() {
	ios::sync_with_stdio(false);
	int n, m, in;
	while (scanf("%d %d",&n,&m)==2) {
		stack<int> s;
		rep(i, m) {
			scanf("%d",&in);
			s.push(in);
		}
		vector<bool> b(n,true);
		while (!s.empty()) {
			if (b[s.top() - 1]) {
				printf("%d\n",s.top());
				b[s.top() - 1] = false;
			}
			s.pop();
		}
		rep(i, n) {
			if (b[i])printf("%d\n",i+1);
		}
	}
}


Measured memory_bytes: 3512
N, Q = gets.split(/ /).collect{|n| n.to_i}
S = ['-'] + gets.strip.split(//)

SPELL = []
Q.times{
	SPELL << gets.strip.split(/ /)
}

def check(pos)
	SPELL.each{|t, d|
		if S[pos] == t
			if d == "L"
				pos -= 1
				if pos == 0
					return false
				end
			else
				pos += 1
				if pos == N + 1
					return false
				end
			end
		end
	}
	return true
end

#p (1..N).collect{|pos| check(pos)}

head = (1..N).bsearch{|pos|
	check(pos)
}

if head
	tail = N - (0...N).bsearch{|pos|
		check(N - pos)
	}
	puts "#{tail - head + 1}"
else
	puts "0"
end



Measured memory_bytes: 98836
#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>

using namespace std;

typedef long long ll;

mt19937 rnd(228);

int main()
{
#ifdef ONPC
    freopen("a.in", "r", stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector <int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a.rbegin(), a.rend());
    auto ok = [&](int x, int y)
    {
        return x < n && y < a[x];
    };
    int x = 0, y = 0;
    while (ok(x + 1, y + 1))
    {
        x++, y++;
    }
    int la = 0, lb = 0;
    {
        int len = 1;
        int dx = x, dy = y;
        while (ok(dx, dy))
        {
            dx++;
            len ^= 1;
        }
        la = len;
    }
    {
        int len = 1;
        int dx = x, dy = y;
        while (ok(dx, dy))
        {
            dy++;
            len ^= 1;
        }
        lb = len;
    }
    if (la || lb)
    {
        cout << "First\n";
    }
    else
    {
        cout << "Second\n";
    }
}


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

int main(){
    const int n=1000;
    int A[n],i,j,v,size,count;
    cin>>size;
    for(i=0;i<size;++i){
        cin >> A[i];
    }
    for(count=0;count<size;++count){
        if(count!=size-1) cout<<A[count]<<" ";
        else cout<<A[count];
    }
    cout << endl;
    for(i=1;i<size;++i){
        v=A[i];
        j=i-1;
        while(j>=0 && A[j]>v){
            A[j+1]=A[j];
            --j;
            A[j+1]=v;
        }
        for(count=0;count<size;++count){
            if(count!=size-1) cout<<A[count]<<" ";
            else cout<<A[count];
        }
        cout<<endl;
    }

    return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  int a, b, c, d;
  a = N / 1000;
  b = (N - a*1000) / 100;
  c = (N - a*1000 - b*100) / 10;
  d = (N - a*1000 - b*100 - c*10);
  
  if (a+b+c+d==7)
    cout << a << "+" << b << "+" << c << "+" << d << "=7" << endl; 

  else if (a+b+c-d==7)
    cout << a << "+" << b << "+" << c << "-" << d << "=7" << endl; 

  else if (a+b-c-d==7)
    cout << a << "+" << b << "-" << c << "-" << d << "=7" << endl; 

  else if (a+b-c+d==7)
    cout << a << "+" << b << "-" << c << "+" << d << "=7" << endl; 

  else if (a-b+c+d==7)
    cout << a << "-" << b << "+" << c << "+" << d << "=7" << endl; 

  else if (a-b+c-d==7)
    cout << a << "-" << b << "+" << c << "-" << d << "=7" << endl; 

  else if (a-b-c+d==7)
    cout << a << "-" << b << "-" << c << "+" << d << "=7" << endl; 

  else if (a-b-c-d==7)
    cout << a << "-" << b << "-" << c << "-" << d << "=7" << endl; 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(v) v.begin(),v.end()
#define eb emplace_back
using namespace std;
using ll=long long;
int INF=(1<<30);
void chmin(int& a,int b){a=min(a,b);}
void chmax(int& a,int b){a=max(a,b);}
int n,res;
vector<int> li[100000],ld[100000];//li[i]:長さiのLISのラストmin,ld:LDSのラストMAX
vector<vector<int>> G;
vector<int> a,id,sz;
void calc(int i,int p){
	int to=-1,ma=0;
	sz[i]=1;
	for(auto &e:G[i]){
		if(e==p)continue;
		calc(e,i);
		sz[i]+=sz[e];
		if(ma<sz[e]){
			ma=sz[e];
			to=id[e];
		}
	}
	if(to==-1){
		id[i]=i;
		li[i].eb(a[i]);
		ld[i].eb(a[i]);
		return;
	}
	id[i]=to;
	if(li[to].back()<a[i]){
		li[to].eb(a[i]);
	}else{
		auto f=[&](int x){return x<a[i];};
		(*partition_point(all(li[to]),f))=a[i];
	}
	if(ld[to].back()>a[i]){
		ld[to].eb(a[i]);
	}else{
		auto f=[&](int x){return x>a[i];};
		(*partition_point(all(ld[to]),f))=a[i];
	}
	for(auto &e:G[i]){
		if(e==p)continue;
		int u=id[e];
		if(u==to){
			continue;
		}
		for(int j=0;j<ld[u].size();j++){
			auto f=[&](int x){return x<ld[u][j];};
			int x=partition_point(all(li[to]),f)-li[to].begin();
			//chmax(res,x+j+1);
		}
		for(int j=0;j<li[u].size();j++){
			auto f=[&](int x){return x>li[u][j];};
			int x=partition_point(all(ld[to]),f)-ld[to].begin();
			//chmax(res,x+j+1);
		}
		for(int j=0;j<ld[u].size();j++){
			if(j<ld[to].size()){
				chmax(ld[to][j],ld[u][j]);
			}else{
				ld[to].eb(ld[u][j]);
			}
		}
		for(int j=0;j<li[u].size();j++){
			if(j<li[to].size()){
				chmin(li[to][j],li[u][j]);
			}else{
				li[to].eb(li[u][j]);
			}
		}
	}
	chmax(res,li[to].size());
//	chmax(res,ld[to].size());
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n;
	res=1;
	a.resize(n);
	G.resize(n);
	id.resize(n);
	sz.resize(n);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	reverse(all(a));
	/*
	for(int i=0;i<n-1;i++){
		int u,v;cin>>u>>v;--u;--v;
		G[u].eb(v);
		G[v].eb(u);
	}*/
	for(int i=0;i<n-1;i++){
		G[i].eb(i+1);
	}
	calc(0,-1);
	cout<<res<<'\n';
}




Measured memory_bytes: 28700
import numpy as np

s = list(map(int, input().split()))
N,K = s[0],s[1]
ans = 0
n = 10**9 + 7

"""
if K==2:
    min = (0+K-1)*K/2
    max = (N-K+1+N)*K/2
elif K==3:
    min = (0+K-1)*K/2
    max = (N-K+1+N)*K/2
else:
    min = (0+K-1)*K/2
    max = (N-K+1+N)*K/2
"""

def num(x, N):
    y = -x**2 + (N+1)*x +1
    return y

#a = np.array(range(K,N+2))
#b = num(a,N)
ans = num(K,N)
for i in range(1,N-K+2):
    if ans >= n:
        ans = ans % n
    ans += num(K+i,N)

print(ans)


Measured memory_bytes: 27136
#include <stdio.h>
int main(void){
  int N;
  scanf("%d", &N);
  int i, x, y, z, c[10001] = {0};
  for(x=1; x<=100; x++){
    for(y=1; y<=100; y++){
      for(z=1; z<=100; z++){
        int f = x*x+y*y+z*z+x*y+y*z+z*x;
        if(f < 10001){
          c[f]++;
        }
      }
    }
  }

  for(i=1;i<=N;i++){
    printf("%d\n", c[i]);
  }
  return 0;
}

Measured memory_bytes: 2084
#include<bits/stdc++.h>
using namespace std;
 
 
void doit()
{
int a,b;
cin >> a>>b;
if(a==b)
	cout<<"Yes";
	else	cout<< "No";
}

int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	
	int t=1;
	//cin >>t;
	
	while(t--)
		doit();
	
	return 0;
}

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

int main() {
	double a,b,x;
	cin>>a>>b>>x;
	double v=a*a*b;
	double ans=0;
	if(x>=v/2){
		ans=atan2(2.0*(v-x),a*a*a)*360.0/(2.0*M_PI);
	}
	else{
		ans=atan2(b*b*a,2.0*x)*360.0/(2.0*M_PI);
	}
	
	printf("%.9f",ans);
	// your code goes here
	return 0;
}

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

using namespace std;

double dp[3000][3000];

int main()
{
  int n;
  cin>>n;
  double H_prob[n+1];
  for(int i =1 ; i<=n ; i++)
    cin>>H_prob[i];

  dp[1][0] = 1 - H_prob[1];
  dp[1][1] = H_prob[1];
  for(int i = 2 ; i<=n ; i++)
  {
    dp[i][0] = dp[i-1][0] * (1 - H_prob[i]);
    for(int j = 1 ; j<i ; j++)
    {
      dp[i][j] = (dp[i-1][j] * (1 - H_prob[i])) + (dp[i-1][j-1] * H_prob[i]);
    }
    dp[i][i] = dp[i-1][i-1] * H_prob[i];
  }

  double ans = 0;

  for(int i = (n/2 + 1); i<=n ; i++)
  {
    ans = ans + dp[n][i];
  }

  cout<<fixed<<setprecision(10)<<ans;
  
  return 0;
}

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

int n,m;
int main(){
    std::cin >> n>>m;
    std::vector<int> ans(n);
    for (int i = 0; i < n; i++) {
        /* code */
        ans.at(n-1)=0;
    }
    for (int i = 0; i < m*2; i++) {
        int a;
        std::cin >> a;
        ans.at(a-1)+=1;
    }
    for (int i = 0; i < n; i++) {
        std::cout << ans.at(i) << std::endl;
    }
    
}

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

c = [[int(i) for i in input().split()] for _ in range(3)]

res = True

diff = []
for row in range(3):
    diff.append([c[row][0]-c[row][1], c[row][1]-c[row][2], c[row][2]-c[row][0]])

for i in range(3):
    if not(diff[0][i] == diff[1][i] and diff[1][i] == diff[2][i]):
        res = False

diff = []
for col in range(3):
    diff.append([c[0][col]-c[1][col], c[1][col]-c[2][col], c[2][col]-c[0][col]])

for i in range(3):
    if not(diff[0][i] == diff[1][i] and diff[1][i] == diff[2][i]):
        res = False

if res == True:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
#include <stdio.h>

int main(void) {
  int i, n, a[10000000], maxv = -999999999, minv = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }

  minv = a[0];
  for (i = 1; i < n; i++) {
    if (maxv < (a[i] - minv)) {
      maxv = a[i] - minv;
    }
    if (minv > a[i]) {
      minv = a[i];
    }
  }

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



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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;


#define F first
#define S second

#define ERR 1e-9

#if !ONLINE_JUDGE && !EVAL
    #define dbg_var(x) cerr << #x << ": " << x << "\n";
    #define dbg_iter(x, y) cerr  << #x << ": " << print_iterable(x, y) << "\n";
#else
    #define dbg_var(x)
    #define dbg_iter(x, y)
#endif // ONLINE_JUDGE

template <typename T1, typename T2>
string print_iterable( T1 begin_iter, T2 end_iter){
    bool first = true;
    stringstream res;
    res << "[ ";
    for(; begin_iter != end_iter; ++begin_iter){
        if(!first) res << ", ";
        first = false;
        res << *begin_iter;
    }
    res << " ]";
    return res.str();
}

void aggMax(int & res, int x){ if(x > res)res = x; }
void aggMin(int & res, int x){ if(x < res)res = x; }

int II(){ int i; cin >> i; return i; }
void OI(int i){ cout << i; }

// constraints
#define MAXN 1000000

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);

    char c; cin >> c;

    if(c == 'A') cout << 'T';
    else if(c == 'C') cout << 'G';
    else if(c == 'G') cout << 'C';
    else cout << 'A';

    return 0;
}


Measured memory_bytes: 256
from collections import deque
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

W = deque([])
ans = 0
def janken(i):
    W.append(1)
    if T[i] == "r":
        return P
    elif T[i] == "s":
        return R
    else:
        return S
    

for i in range(N):
    if i < K:
        ans += janken(i)
    else:
        if T[i] == T[i - K] and W[i - K] == 1:
            W.append(0)
        else:
           ans += janken(i)
print(ans)


Measured memory_bytes: 4212
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b,c;cin >> a >> b >> c;
	if(a == b && b == c) cout << 1 << endl;
	else if(a == b || b == c || c == a) cout << 2 << endl;
	else cout << 3 << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;
using myui = uint64_t;

bool is_acgt(const char c) {
    switch(c) {
        case 'A':
        case 'C':
        case 'G':
        case 'T':
            return true;
        default: return false;
    }
}

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

    {
        myui n, q;
        string s;
        vector<myui> idx;
        cin >> n >> q >> s;

        for(myui i = 0; i < n - 1; i++) {
            if (s[i] == 'A') {
                if (s[i + 1] == 'C') {
                    idx.push_back(i);
                    i++;
                }
            }
        }

        while(q--) {
            myui l, r;
            cin >> l >> r;

            auto head = lower_bound(idx.cbegin(), idx.cend(), l - 1);
            auto tail = lower_bound(idx.cbegin(), idx.cend(), r - 1);
            cout << tail - head << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 1480
#include <iostream>
#include <algorithm> 
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;

int facto(int n) {
    int r = 1;
    for (int i = 1; i < n + 1; i++) {
        r *= i;
    }
    return r;
}

int main() {
    std::cout<<std::fixed<<std::setprecision(10);
    int N; cin >> N;
    vector<vector<int>> places(N, vector<int>(2));
    for (int i = 0; i < N; i++) {
        cin >> places[i][0];
        cin >> places[i][1];
    }
    vector<int> v(N);
    for (int i = 0; i < N; i++) v[i] = i;
    double ans = 0;
    do {
        for (int i = 0; i < N - 1; i++) {
            ans += sqrt((places[v[i]][0] - places[v[i+1]][0]) * (places[v[i]][0] - places[v[i+1]][0]) + (places[v[i]][1] - places[v[i+1]][1]) * (places[v[i]][1] - places[v[i+1]][1]));
        } 
    } while( next_permutation(v.begin(), v.end()) );
    ans /= (facto(N));
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
    cin >> s;
    int slen = s.length();
    for(int i = 0; i < slen; ++i) {
        if((i+1) % 2 == 1) {
            cout << s.at(i);
        }
    }
}

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

int main()
{
	int N, T; cin >> N >> T;

	vector<int>ts(N);
	for (int i = 0; i < N; i++) {
		cin >> ts[i];
	}

	long long ans = T;
	for (int i = 0; i < N-1; i++) {
		ans += min(T,ts[i+1]-ts[i]);
	}
	cout << ans << endl;

    return 0;
}



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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define VIN(v) for(auto&elem_: (v) )cin>>elem_
#define VOUT(v, sep) for(_loop_int idx=0; idx<(_loop_int)v.size(); idx++) {cout<<v[idx]; if(idx<(_loop_int)v.size()-1) cout<<sep;} cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(debugidx,v.size())cout<<" "<<v[debugidx];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(debugidx,n)cout<<" "<<v[debugidx];cout<<endl

const ll MOD = 1000000007ll;
const int IINF = numeric_limits<int>::max()/2-1;
const ll LINF = numeric_limits<ll>::max()/2-1;

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



int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n;
    cin>>n;
    vl a(n);
    vl dp(n+2,-1);
    REP(i,n){
        cin>>a[i];
    }

    dp[0] = -LINF;
    dp[n+1] = LINF;

    REP(i,n){
        *(lower_bound(ALL(dp),a[i])-1) = a[i];
        //DEBUG_VEC(dp);
    }

    int ans=0;
    FOR(i,1,n+1){
        if(dp[i]!=-1) ans++;
    }

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

Measured memory_bytes: 4780
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
//#define mod 1000000007
#define maxN 100005


int main()
{

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	{
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	}
#endif
	string s, t;
	cin >> s;
	cin >> t;
	ll n = s.size(), m = t.size(), cnt, lol = 100000, p;
	for (ll i = 0; i < (n - m + 1); i++) {
		cnt = 0;
		p = 0;
		for (ll j = i; j < (i + m); j++) {
			if (s[j] != t[p]) {
				cnt++;
			}
			p++;
		}
		lol = min(lol, cnt);
	}
	cout << lol << endl;

	return 0;

}

Measured memory_bytes: 3664
n = int(input())
a = list(map(int, input().split()))
absa = list(map(abs, a))

count = 0
for i in range(n):
  if a[i] < 0:
    count += 1
    
if count % 2 == 0:
  print(sum(absa))
else:
  absa.sort()
  temp = absa.pop(0)
  print(sum(absa)-temp)

Measured memory_bytes: 14412
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
int main()
{
   
   
        
   ll n,x,i;
   cin>>x>>n;
   ll ans=200;
   ll vis[101]={};
   memset(vis,0,sizeof(vis));
   for(i=0;i<n;i++)
   {
      ll x1;
      cin>>x1;
     vis[x1]=1;
   }
   vector< ll >v;
   for(i=-200;i<0;i++)
    v.pb(i);
   for(i=0;i<=100;i++)
   {
       if(vis[i]==0)
        v.pb(i);
   }
   for(i=101;i<=201;i++)
    v.pb(i);
   ll minn=300;
   for(i=0;i<v.size();i++)
   {
       if(abs(v[i]-x)<minn)
           {
               ans=v[i];
               minn=abs(v[i]-x);
           }
   }
     cout<<ans;
	return 0;
}

Measured memory_bytes: 3640
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq

s = input()
l = len(s)
k = ni()
def aind(w):
    if w=="a":
        ret = 0
    else:
        ret = 26 - (ord(w) - ord("a"))
    return ret
ans = []
for i in range(l-1):
    if aind(s[i]) <=k:
        ans.append("a")
        k-=aind(s[i])
    else:
        ans.append(s[i])

idx =(ord(s[-1]) - ord("a") +k%26)%26 +ord("a")
ans.append( chr(idx) )
print("".join(ans))


Measured memory_bytes: 10304
#include<bits/stdc++.h>
using namespace std;
#pragma gcc optimize("O3")
#pragma gcc optimize("unroll-loops")
#ifdef EVAH
    #define _WIN32_WINNT 0x0500
    #include<windows.h>
#endif
#define openFile(n) ShellExecute(nullptr,"open",n,nullptr,nullptr,SW_SHOWNORMAL);
#define closeP(n) system((string("taskkill /im ")+n+" /f").c_str());
#define closeConsole PostMessage(GetConsoleWindow(), WM_CLOSE, 0, 0);
#define opf "output.txt"
#define ipf "input.txt"
#define mem(n,x) memset(n,x,sizeof(n));
#define sf scanf
#define pf printf
#define ff first
#define ss second
#define pb push_back
#define PII pair<int,int>
#define For(x,n) for(int i=x; i<n; i++)
#define stv v+2*(mid-tl+1)
#define LL long long int
#define PI acos(-1.0)
#define N 500001

int blockSize;

struct query {
    int l,r,idx;
    bool operator<(query other) const {
        if(l/blockSize != other.l/blockSize) return l<other.l;
        return (l/blockSize&1) ? (r<other.r) : (r>other.r);
    }
};

vector<int> clr(N),appeared(N);
int tempAns = 0;

void rmv(int idx) {
    appeared[clr[idx]]--;
    if(!appeared[clr[idx]]) tempAns--;
}
void add(int idx) {
    if(!appeared[clr[idx]]) tempAns++;
    appeared[clr[idx]]++;
}
int get_ans() {
    return tempAns;
}

vector<int> mosAlgo(vector<query> queries) {
    vector<int> ans(queries.size());
    sort(queries.begin(),queries.end());
    int curL = 0;
    int curR = -1;
    for(query q : queries) {
        while(curL > q.l) {
            curL--;
            add(curL);
        }
        while(curR < q.r) {
            curR++;
            add(curR);
        }
        while(curL < q.l) {
            rmv(curL);
            curL++;
        }
        while(curR > q.r) {
            rmv(curR);
            curR--;
        }
        ans[q.idx] = get_ans();
    }
    return ans;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    #ifdef EVAH
        //freopen(ipf,"r",stdin);
        //openFile(ipf);
        //closeConsole;
        //freopen(opf,"w",stdout);
    #endif

    int n,q,l,r;
    cin >> n >> q;
    blockSize = sqrt(n);
    vector<query> queries(q);
    For(0,n) {
        cin >> clr[i];
    }
    For(0,q) {
        queries[i].idx = i;
        cin >> queries[i].l >> queries[i].r;
        queries[i].l--;
        queries[i].r--;
    }
    vector<int> ans = mosAlgo(queries);
    For(0,ans.size()) {
        cout << ans[i] << "\n";
    }

    #ifdef EVAH
        //openFile(opf);
        //Sleep(3000);
        //closeP("notepad.exe");
        //closeConsole;
    #endif
}


Measured memory_bytes: 20756
#include <bits/stdc++.h>
#include <fstream>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>


typedef long long ll;
typedef long double ld;
using namespace std;
using namespace __gnu_pbds;


#define endl "\n"
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
const int N=1e5+5, mxN=(1<<20)+5;
int mod=1e9+7;
int arr[N];
int main()
{
    FIO
   int l, r;
   cin>>l>>r;
   ll ans=1e18;
   for(int i=0;i<2019&&l<=r;i++)
   {

       for(int j=l+1,co=0;j<=r&&co<2019;j++,co++)
       {

           ll a=((l%2019)*(j%2019))%2019;
           ans=min(ans,a);

       }
   l++;
   }
   cout<<ans;


     return 0;

}


Measured memory_bytes: 256
// RGB Boxes

#include <iostream>
#include <vector>


using namespace std;

int main()
{
    int R,G,B,N;
    cin >> R >> G >> B >> N;
    int ans = 0;
    for (int x = 0; x <= N; x++) {
        for (int y = 0; y <= N; y++) {
            int tmp = N - (x*R + y*G);
            if (tmp >= 0 && tmp % B == 0) {
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#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;
	cin>>n;
	rep(j,n){
		// if(k==l) continue;
		vint ans;
		int a,b;
		// cout<<a<<" -> "<<b<<endl;
		cin>>a>>b;
		// cout<<q.front()<<endl;
		queue<int> q;
		rep(i,10) q.push(i);
		rep(i,5) q.push(5-i);

		rep(i,30){
			int t=q.front();
			q.push(t);
			q.pop();
			if(t==a){
				ans.clear();
				ans.PB(t);
			}
			else if(t==b&&ans.size()&&ans[0]==a){
				ans.PB(t);
				break;
			}
			else{
				ans.PB(t);
			}
		}
		rep(i,ans.size()){
			if(i) cout<<" ";
			cout<<ans[i];
		}
		cout<<endl;
	}
}

Measured memory_bytes: 1216
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();

		if (x == 2 || y == 2){
			System.out.println("No");
		}
		else if(x == 4 || x == 6 || x == 9 || x == 11){
			if (y == 4 || y == 6 || y == 9 || y == 11){
				System.out.println("Yes");
			}
			else{
				System.out.println("No");
			}
		}
		else{			
			if (y == 4 || y == 6 || y == 9 || y == 11){
				System.out.println("No");
			}
			else{
				System.out.println("Yes");
			}
		}


	}
}

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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int n; cin>>n;
	map<int,int> f;
	rep(i,n){ int a; cin>>a; ++f[a]; }

	int ans=0;
	for(auto x:f) ans+=x.second%2;
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <numeric>
#include <iomanip>
#include <set>
#include <string.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REP3(i,st,en) for(ll (i)=(st);(i)<(en);(i)++)

using P = pair<ll, ll>;
const int MOD = 1e9+7;
const ll INF = 1e+14;
const double PI = 3.14159265349;



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

  ll N;
  cin >> N;
  vector<P> A(N);
  REP(i,N) {
    ll ai;
    cin >> ai;
    A[i] = P(ai,i+1);
  }
  sort(A.begin(), A.end(), [](auto const& la, auto const& ra){
    return la.first < ra.first;
  });

  REP(i,N){
    cout << A[i].second;
    if (i<N-1){
      cout << " ";
    }
  }
  cout << "\n";
  return 0;
}


Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
// #define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountl
#define m_p make_pair
#define inf 1000000000000000000ll
#define MAXN 1000001
#define eps 0.0000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T>//usage rand<long long>()
T rand() {
    return uniform_int_distribution<T>()(rng);
}

// string to integer stuuu()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

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

#define S second
#define F first
#define int long long  
///////

signed main()
{
	fastio;
	#ifdef ANIKET_GOYAL
		freopen("inputf.in","r",stdin);
		freopen("outputf.in","w",stdout);
	#endif
	int n,k;
	cin>>n>>k;
	--k;
	string s;
	cin>>s;
	for(int i=0;i<n;++i)
	{
		if(i==k)
		{
			cout<<((char)(s[i]+32));
		}
		else
			cout<<s[i];
	}
}


Measured memory_bytes: 256
#include<stdio.h>
int main() {
	int a = 0, b = 0;
	scanf("%d%d", &a, &b);


	if (a == b) {
		printf("a == b\n");
	}else if (a < b) {
		printf("a < b\n");
	} else {
		printf("a > b\n");
    }

	return 0;
}

Measured memory_bytes: 580
import java.util.Scanner;

class Solver {
    void solve(Scanner sc) {
        int N = sc.nextInt();

        long sum = 0;
        int first = sc.nextInt();
        boolean positive = first >= 0;
        int min = positive ? first : -first;
        for (int i = 1; i < N; i++) {
            int next = sc.nextInt();
            int abs;
            if (next < 0){
                abs = -next;
                positive ^= true;
            } else {
                abs = next;
            }

            if (min > abs){
                sum += min;
                min = abs;
            } else {
                sum += abs;
            }
        }
        if (positive){
            sum += min;
        } else {
            sum -= min;
        }

        System.out.println(sum);
    }
}

class Main {
    public static void main(String... args) {
        Scanner in = new Scanner(System.in);

        new Solver().solve(in);

        in.close();
    }
}

Measured memory_bytes: 48800
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define all(c) begin(c), end(c)
const int INF =
    sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = 1e9 + 7;
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    int ans = 1;
    rep(i, 0, N) { ans = min(ans * 2, ans + K); }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define INT(str) stoi((str), 0)
#define INTB(str) stoi((str), 0, 2) // 2進数の文字列を int に
 
int main() {
  int A[3][3];
  REP(i, 3) {
    REP(j, 3) {
      cin >> A[i][j];
    }
  }
  
  int N;
  cin >> N;
  
  REP(k, N) {
    int b;
    cin >> b;
    REP(i, 3) {
      REP(j, 3) {
        if (A[i][j] == b)
          A[i][j] = -1;
      }
    }
  }
  
  REP(i, 3) {
    if (A[i][0] == -1 && A[i][0] == A[i][1] && A[i][0] == A[i][2]) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  
  REP(j, 3) {
    if (A[0][j] == -1 && A[0][j] == A[1][j] && A[0][j] == A[2][j]) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  
  if (A[0][0] == -1 && A[0][0] == A[1][1] && A[0][0] == A[2][2]) {
    cout << "Yes" << endl;
    return 0;
  }
  
  if (A[0][2] == -1 && A[0][2] == A[1][1] && A[0][2] == A[2][0]) {
    cout << "Yes" << endl;
    return 0;
  }
  
  cout << "No" << endl;
}

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

int main() {
  int N=0;
  cin >> N;
  int ans=N;
  vector<int> v_a(N);
  for(int i=0;i<v_a.size();i++) cin >> v_a.at(i);
  sort(v_a.begin(),v_a.end());
  for(int i=1;i<N;i++){
    if(v_a.at(i)==v_a.at(i-1)) ans -= 1;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
a = input()
ar = []
for i in range(len(a)):
    ar.append(a[i])
n = len(ar)
ret = 0
for i in range(2**(n-1)):
    p = "+"
    m = "-"
    tmp = ""
    flag = -1
    ret = int(ar[0])
    for j in range(n):
        if flag == 0:
            ret += int(ar[j])
        if flag == 1:
            ret -= int(ar[j])
        if (1 & (i >> j)) == 1:
            tmp += ar[j]
            tmp += p
            flag = 0
        else:
            tmp += ar[j]
            tmp += m
            flag = 1
    tmp = tmp[:-1]
    if ret == 7:
        break
print(tmp + "=7")

Measured memory_bytes: 3064
package main

import(
    "fmt"
    "sort"
    "strings"
)



func main() {
    var n int
    fmt.Scan(&n)
    a := make([]int, n)
    for i:=0; i<n; i++{
        fmt.Scan(&a[i])
    }
    sort.Sort(sort.Reverse(sort.IntSlice(a)))
    sum1 := 0
    sum2 := 0
    for i:=0; i<n; i++{
        if i%2 == 0{
            sum1+=a[i]
        } else {
            sum2+=a[i]
        }
    }
    fmt.Println(sum1-sum2)
}





// Pairsort
type Pair struct {
    first,second int64
}

type By func(p1, p2 *Pair) bool

func (by By) Sort(pairs []Pair) {
    ps := &pairSorter{
            pairs : pairs,
            by: by,
    }
    sort.Sort(ps)
}

type pairSorter struct {
    pairs []Pair
    by func(p1, p2 *Pair) bool
}

func (s *pairSorter) Len() int {
    return len(s.pairs)
}

func (s *pairSorter) Swap(i, j int) {
    s.pairs[i], s.pairs[j] = s.pairs[j], s.pairs[i]
}

func (s *pairSorter) Less(i, j int) bool {
    return s.by(&s.pairs[i], &s.pairs[j])
}

func first (p1, p2 *Pair) bool {
        return p1.first < p2.first
}

func second (p1, p2 *Pair) bool {
        return p1.second < p2.second
}
// end



func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func scanTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}

func SortString(s string) string{
    t := strings.Split(s, "")
    sort.Strings(t)
    return strings.Join(t, "")
}


Measured memory_bytes: 640
n = int(raw_input())
aa = map(int, raw_input().split())


# start plus
ans1 = 0
sum1 = aa[0]

# start minus
ans2 = 0
sum2 = aa[0]

if sum1 <= 0:
  ans1 += abs(1 - sum1)
  sum1 = 1

if sum2 >= 0:
  ans2 += abs(-1 - sum2)
  sum2 = -1

for i in range(1,n):
  ai = aa[i]
  sum1 += ai
  sum2 += ai

  if i%2 == 0:
    if sum1 <= 0:
      ans1 += abs(1 - sum1)
      sum1 = 1
    if sum2 >= 0:
      ans2 += abs(-1 - sum2)
      sum2 = -1

  else:
    if sum1 >= 0:
      ans1 += abs(-1 - sum1)
      sum1 = -1
    if sum2 <= 0:
      ans2 += abs(1 - sum2)
      sum2 = 1

print min(ans1, ans2)

Measured memory_bytes: 11288
#include <iostream>
#include <vector>
using namespace std;
const int N=702;
int n,m,mp[N][N];
int c[N],b,w;
vector<int> g[N];
void dfs(int u) {
    //printf("c[%d]=%d\n", u,c[u]);
    if (c[u]==1) b++;
    if (c[u]==2) w++;
    for(int i=0;i<g[u].size();i++) {
        int v=g[u][i]; if(u==v) continue;
        //printf("%d->%d\n", u,v);
        if(c[v]==0) {
            c[v]=3-c[u], dfs(v);
        } else
        if(c[v] && c[u]+c[v]!=3) {
            printf("-1\n"); exit(0);
        }
    }
}
int dp[N][N];
int main() {
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++) {
        int x,y; scanf("%d%d",&x,&y);
        mp[x][y]=mp[y][x]=1;
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++) if(mp[i][j]==0) g[i].push_back(j);
    }
    vector< pair<int,int> > it;
    for(int i=1;i<=n;i++) if(c[i]==0) {
        b=w=0; c[i]=1;
        dfs(i);
        it.push_back(make_pair(b,w));
    }
    dp[0][0]=1;
    for(int i=0;i<it.size();i++) {
        for(int j=0;j<N;j++) {
            if(dp[i][j]) dp[i+1][j+it[i].first]=1, dp[i+1][j+it[i].second]=1;
        }
    }
    int ans=1e9;
    for(int i=0;i<=n;i++) {
        if(dp[it.size()][i]) {
            //printf("ok %d\n", i);
            ans=min(ans, i*(i-1)/2+(n-i)*(n-i-1)/2);
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 4096