akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <map>
#include <cassert>
#include <complex>
using namespace std;
using VI = vector<int>;

bool water[3030];
int salt[3030];

int make_max_salt(int limit) {
    if (limit < 0 || limit >= 3030) return -1;
    for (int i = limit;; i--) {
        if (salt[i]) return i;
    }
}

int main() {
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    
    for (int i = 0; a * i < 3030; i++) {
        water[i * a] = true;
    }
    for (int i = 0; c * i < 3030; i++) {
        salt[i * c] = true;
    }
    
    for (int i = 3030 - 1; i >= 0; i--) {
        if (water[i]) {
            for (int j = 1; i + j * b < 3030; j++) {
                water[i + j * b] = true;
            }
        }
        if (salt[i]) {
            for (int j = 1; i + j * d < 3030; j++) {
                salt[i + j * d] = true;
            }
        }
    }

    double max_den = -1;
    int total, slt;
    for (int i = 0; i < 3030; i++) {
        if (water[i]) {
            int limit = i * e;
            int s = make_max_salt(min(limit, f - 100 * i));
            if (s == -1) continue;
            if (s + 100 * i <= f && double(s) / (s + 100 * i) > max_den) {
                max_den = double(s) / (s + 100 * i);
                total = s + 100 * i;
                slt = s;
            }
        }
    }
    
//    if (max_den == -1) {
//        cout << 100 * a << " " << 0 << endl;
//        return 0;
//    }
    
    cout << total << " " << slt << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
ll N, K, X, Y;
int main()
{
    cin >> N >> K >> X >> Y;
    if(N>K)
        cout << K*X + Y*(N-K) << endl;
    else
        cout << N*X << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>
#include <string.h>
int main(void) {
    int n;
    char w[100][11];

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

    for (int i = 1; i < n; i++) {
        char *s1 = w[i - 1];
        char *s2 = w[i];
        if (s1[strlen(s1) - 1] != s2[0]) {
            printf("No\n");
            return 0;
        }
        for (int j = 0; j < i; j++) {
            if (strcmp(w[j], w[i]) == 0) {
                printf("No\n");
                return 0;
            }
        }
    }

    printf("Yes\n");
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <utility>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1e9 + 7
#define INF 1e9
#define PIE 3.14159265358979323

template <class T>
inline bool chmin(T &a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T>
inline bool chmax(T &a, T b) {if (a < b) {a = b; return true;} return false;}
template <class T>
T GCD(T a, T b) {if (b == 0) return a; else return GCD(b, a % b);}
template <class T>
inline T LCM(T a, T b) { return (a * b) / GCD(a, b);}

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    int k;
    cin >> k;
    if (k<=a){
        cout << k << endl;
        return 0;
    }
    else if (k<=a+b){
        cout << a << endl;
        return 0;
    }
    else if (k<=a+b+c){
        cout << a - (k - a - b) << endl;
        return 0;
    }
    else
        cout << a - c << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int bep[2019];//0 1 2
int main(){
	int l,r;cin>>l>>r;
	for(int i=l;i<=r;++i){
		if(bep[i%2019]>=2)break;
		bep[i%2019]++;
	}
	int ans=2019*2019;
	for(int i=0;i<2019;++i){
		if(bep[i]==0)continue;
		
		for(int j=0;j<2019;++j){
			if(bep[j]==0)continue;
			if(j==i && bep[j]==1)continue;
			ans=min(i*j%2019,ans);
		}
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
import           Control.Monad
import           Control.Monad.ST
import           Data.List
import           Data.Array.IO
import           Data.Vector.Unboxed            ( Vector
                                                , (!)
                                                , fromList
                                                )

type Memo = IOUArray Index Int
type Index = (Int, Int, Int)

main :: IO ()
main = do
  [n, a] <- map read . words <$> getLine
  xs     <- map read . words <$> getLine

  let nx  = n * maximum (a : xs)
  let vxs = fromList xs

  memo <- newArray ((0, 0, 0), (n, n, nx)) 0 :: IO Memo

  forM_ [ (j, k, s) | s <- [0 .. nx], k <- [0 .. n], j <- [0 .. n] ]
    $ \(j, k, s) -> case (j, k, s) of
        (j, 0, 0)                              -> writeArray memo (j, 0, 0) 1
        (j, k, s) | j > 0, s < (vxs ! (j - 1)) -> do
          a <- readArray memo (j - 1, k, s)
          writeArray memo (j, k, s) a
        (j, k, s) | j > 0, k > 0, s >= vxs ! (j - 1) -> do
          a <- readArray memo (j - 1, k, s)
          b <- readArray memo (j - 1, k - 1, s - vxs ! (j - 1))
          writeArray memo (j, k, s) (a + b)
        _ -> return ()

  print . sum =<< mapM (\k -> readArray memo (n, k, k * a)) [1 .. n]


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

int main() {
  string str;
  cin >> str;
  int len = str.length();
  int mid = (len + 1)/2;
  string lstr = str.substr(mid);
  string fstr = str.substr(0,mid-1);
  
  if(fstr == lstr){
    cout << "Yes" << endl;
  }
 else{   
  cout << "No" << endl;
 }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <cstdlib>
using namespace std;

int main() {
	const int MAX=100000;
	int n, q, time=0;
	cin >> n >> q;
	pair<string, int> S[MAX], A[MAX];
	queue<int> Q_num;
	queue<string> Q_str;
	
	for(int i=0; i<n; i++){
		cin >> S[i].first >> S[i].second;
		Q_str.push(S[i].first);
		Q_num.push(S[i].second);
	}
	
	while(!Q_str.empty()){
		int a = Q_num.front();
		string s = Q_str.front();
		Q_num.pop();
		Q_str.pop();
		if(a <= q){
			time = time + a;
			cout << s << " " << time << endl;
		}
		else{
			time = time + q;
			Q_num.push(a-q);
			Q_str.push(s);
		}
	}
	
}

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

using namespace std;
#define  ll long long
#define ld long double
#define f first
#define s second

ll a[2000005] , pos[200005];

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

    ll n,k,st=0;
    cin >> n >> k;

    for(int i=1; i<=n; i++)
    {
        cin >> a[i];
        if (a[i] == 1) st=i;
    }

    ll ans=0;
    for(int i=1; i<n; i+=(k-1))
    {
        ans++;
    }

    cout << ans;
//

    return 0;
}

Measured memory_bytes: 2816
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
using ll = long long;
using namespace std;


void solve(){

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

    ll a;
    ll b,n;
    cin >> a >> b>>n;
    // ll k=n/(b-1);
    // ll q=n;
    // ll a1= (a*q)/b;
    // ll a2 = q/b;
    // ll a3 = a*a2;
    // ll ans1= a1-a3;
    ll q,a1,a2,a3,ans1;

    if (n<b-1){
        q=n;
        a1=(a*q)/b;
        a2=q/b;
        a3 = a*a2;
        ans1 = a1-a3;

    }
    else{
        q=b-1;
        a1= (a*q)/b;
        a2 = q/b;
        a3 = a*a2;
        ans1= a1-a3;

    }
    cout << ans1;
    // if (k==0){
    //     cout << ans1;
    // }
    // else{
    //     for (ll i=1;i<=k;i++){
    //         q=b*i-1;
    //         a1= a*q/b;
    //         a2 = q/b;
    //         a3 = a*a2;

    //         ll ans= a1-a3;

    //         ans1 = max(ans1,ans);


    //     }
    //     cout << ans1;
    



    return 0;
}

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

#define x first
#define y second
#define y1 Y1
#define y2 Y2
#define mp make_pair
#define pb push_back
#define DEBUG(x) cout << #x << " = " << x << endl;

using namespace std;

typedef long long LL;
typedef pair <int, int> pii;

template <typename T> inline int Chkmax (T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline int Chkmin (T &a, T b) { return a > b ? a = b, 1 : 0; }
template <typename T> inline T read ()
{
	T sum = 0, fl = 1; char ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') fl = -1;
	for (; isdigit(ch); ch = getchar()) sum = (sum << 3) + (sum << 1) + ch - '0';
	return sum * fl;
}

inline void proc_status ()
{
	ifstream t ("/proc/self/status");
	cerr << string (istreambuf_iterator <char> (t), istreambuf_iterator <char> ()) << endl;
}

const int Maxn = 2e5 + 100;

int N, A[Maxn];
map <int, int> S;

inline int Check (int now)
{
	if (now == 1)
	{
		for (int i = 2; i <= N; ++i)
			if (A[i] <= A[i - 1]) return 0;
		return 1;
	}
	S.clear ();
	for (int i = 2; i <= N; ++i)
	{
		if (A[i] > A[i - 1]) continue;
		while (!S.empty() && (S.rbegin() -> x) > A[i]) S.erase (--S.end());
		for (int j = A[i]; j >= 1; --j)
		{
			++S[j];
			if (S[j] < now) break;
			else S.erase (j);
			if (j == 1) return 0;
		}
	}
	return 1;
}

inline void Solve ()
{
	int l = 1, r = N, ans = 1;
	while (l <= r)
	{
		int mid = ((l + r) >> 1);
		if (Check (mid)) ans = mid, r = mid - 1;
		else l = mid + 1;
	}
	cout << ans << endl;
}

inline void Input ()
{
	N = read<int>();
	for (int i = 1; i <= N; ++i) A[i] = read<int>();
}

int main()
{

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

	Input ();
	Solve ();

	return 0;
}


Measured memory_bytes: 1024
s = input()
t = input()
sl = []
tl = []
for c in s:
    sl.append(c)
for c in t:
    tl.append(c)
sl.sort()
tl.sort(reverse=True)
s = "".join(sl)
t = "".join(tl)
print("Yes" if s < t else "No")


Measured memory_bytes: 3060
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

S=get_nsp
one=S.count("1")
zero=S.count("0")
puts one>zero ? zero*2 : one*2

Measured memory_bytes: 8188
import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsm = lambda: map(str, sys.stdin.readline().split())

n = ni()
s = []
ca = 0
cb = 0
ans = 0
both = 0
for i in range(n):
    t = ns()
    if t[0] == 'B' and t[-1] != 'A':
        cb += 1
    elif t[-1] == 'A' and t[0] != 'B':
        ca += 1
    elif t[0] == 'B' and t[-1] == 'A':
        both += 1
    for j in range(1, len(t)):
        if t[j - 1] == 'A' and t[j] == 'B':
            ans += 1
if both > 0:
    ans += both - 1
    if ca > 0 and cb > 0:
        ans += 2
        ans += min(ca - 1, cb - 1)
    elif abs(ca - cb) > 0:
        ans += 1
        ans += min(ca, cb)
    print(ans)
else:
    ans += min(ca, cb)
    print(ans)


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

vector<pair<int , int> > v[100005];
long long dp[100005];
void dfs(int n , int p , long long  dis)
{
    dp[n] = dis;

    for(int i = 0 ; i<v[n].size() ; i++)
    {

        if(v[n][i].first==p)
            continue;
            dfs(v[n][i].first , n , dis+1ll*v[n][i].second);
    }
}
int main()
{
    int n;

    cin >> n;

    for(int i = 1 ; i<n ; i++)
    {
        int x , y , z;

        cin >> x >> y >> z;

        v[x].push_back(make_pair(y , z));
        v[y].push_back(make_pair(x , z));
    }

    int q , k;

    cin >> q >> k;

    dfs(k , 0 , 0ll);

    for(int i = 1 ; i<=q ; i++)
    {
        int l , r;

        cin >> l >> r;

        cout << dp[r]+dp[l] << "\n";
    }
    return 0;
}


Measured memory_bytes: 14336
#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

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

    int ans = 0;
    
    for(int i = 1; i <= n; i++)
    {   
        int cnt = 0;
        int j = i;
         while(j>0){
            j /= 10;
            cnt++;
         }
         if((cnt%2) != 0) ans++;
    }

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

Measured memory_bytes: 256
import java.util.*;

class Main {

    public static void main(String[] args) {

	Scanner sc = new Scanner(System.in);

	while(sc.hasNext()) {

	    String[] line = sc.nextLine().split(" ");

	    int n = Integer.parseInt(line[0]);
	    int r = Integer.parseInt(line[1]);

	    if(n == 0 && r == 0) break;

	    int deck[] = new int[n];

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

		deck[i] = n - i;

	    }

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

		String[] l = sc.nextLine().split(" ");
		int q = Integer.parseInt(l[0]);
		int c = Integer.parseInt(l[1]);

		int top[] = new int[c];

		for(int j = 0; j < c; j++) {

		    top[j] = deck[q-1+j];

		}

		// for(int j = 0; j < top.length; j++) {

		//     System.out.print(top[j]);

		// }
		// System.out.println();

		int bottom[] = new int[q];

		for(int j = 0; j < q-1; j++) {

		    bottom[j] = deck[j];

		}

		// for(int j = 0; j < q-1; j++) {

		//     System.out.print(bottom[j]);

		// }
		// System.out.println();

		for(int j = 0; j < c; j++) {

		    deck[j] = top[j];

		}

		for(int j = 0; j < q-1; j++) {
		    
		    deck[c+j] = bottom[j];

		}

		// for(int j = 0; j < deck.length; j++) {

		//     System.out.print(deck[j]);
				
		// }
		// System.out.println();

	    }

	    System.out.println(deck[0]);


	}

    }

}

Measured memory_bytes: 39036
#include <iostream>
#include <string>

int main() {
	std::string s, p, ring, name;
	std::cin >> s;
	std::cin >> p;
	int num = 0;
	int count = 0;
	int judge = 0;

	for (int a = 0; p[a]; a++) {
		count++;
	}
	
	for (int i = 0; i < 2; i++) {
		for (int j = 0; s[j]; j++) {
			ring += s[j];
			num++;
		}
	}

	for (int k = 0; k < num - count; k++) {
		for (int l = k; l < k + count; l++) {
			name += ring[l];
		}
		if (p == name) {
			judge++;
		}
		name.erase();
	}
	if (judge == 0) {
		std::cout << "No" << std::endl;
	}
	else {
		std::cout << "Yes" << std::endl;
	}
}

Measured memory_bytes: 3228
from itertools import accumulate
input()
a=[int(i) for i in input().split()]
b=list(accumulate(a))
lp=0
rp=2
ans=float("INF")
for i in range(1,len(a)-2):
    while True:
        p=b[lp]
        q=b[i]-b[lp]
        r=b[rp]-b[i]
        s=b[len(a)-1]-b[rp]
        if abs(p-q)>abs(b[lp+1]-(b[i]-b[lp+1])) and lp+1!=i:
            lp+=1
        elif abs(r-s)>abs(b[rp+1]-b[i]-(b[len(a)-1]-b[rp+1])) and rp!=len(a)-1:
            rp+=1
        else:
            break
    ans=min(ans,abs(max(p,q,r,s)-min(p,q,r,s)))
print(ans)

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

#define ll long long
#define mod 1000000007
#define what_is(x) cerr << #x << " is " << x << endl
#define N 200005
#define extra 20001

#define newLine	printf("\n");

#define sll(X) scanf("%lld", &X);
#define pll(X) printf("%lld", X);
#define printAll(X, n)	for(int i=0;i<n;i++)	printf("%lld ", X[i]); newLine;
#define scanAll(X, n)	for(int i=0;i<n;i++)	scanf("%lld", &X[i]);

ll n, a[N], b[N], c[N];

int main() {
	sll(n);
	scanAll(c, n);
	ll prev = 1;
	for(int i=0;i<n;i++) {
		a[i] = prev;
		b[n-1-i] = prev;
		prev += extra;
	}
	for(int i=1;i<n;i++) {
		ll ind = c[i] - 1;
		a[ind] ++;
		for(int j=i+1;j<n;j++) {
			a[c[j]-1] ++;
		}
	}
	printAll(a, n);
	printAll(b, n);
	return 0;
}

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

for(i=1;i<=c;i++){
if(c%i==0 && a<=i && i<=b) co++; 
}
printf("%d\n",co);
return 0;
}


Measured memory_bytes: 2140
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

ll A[57];

int main() {
    char A[107],B[107];cin >> A >> B;
    if(strlen(A)>strlen(B)){
        cout <<  "GREATER" << endl;
        return 0;
    }
    if(strlen(A)<strlen(B)){
        cout <<  "LESS" << endl;
        return 0;
    }
    rep(i,strlen(A)){
        if(A[i]>B[i]){
            cout <<  "GREATER" << endl;
            return 0;
        }
        if(B[i]>A[i]){
            cout <<  "LESS" << endl;
         return 0;
        }
    }
    cout << "EQUAL" << endl;
}

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

using namespace std;
using pii = pair<int, int>;

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<pii> ranges;
	vector<int> comp;
	for(int i = 0; i < n; ++i){
		int x, l;
		cin >> x >> l;
		ranges.emplace_back(x - l, x + l);
		comp.push_back(x - l);
		comp.push_back(x + l);
	}
	sort(comp.begin(), comp.end());
	comp.erase(unique(comp.begin(), comp.end()), comp.end());
	const int m = comp.size();
	for(auto& r : ranges){
		r.first  = lower_bound(comp.begin(), comp.end(), r.first)  - comp.begin();
		r.second = lower_bound(comp.begin(), comp.end(), r.second) - comp.begin();
	}
	sort(ranges.begin(), ranges.end());
	vector<int> dp(m);
	for(int i = 0, h = 0; i < n; ++i){
		const auto& r = ranges[i];
		while(h < r.first){
			dp[h + 1] = max(dp[h + 1], dp[h]);
			++h;
		}
		dp[r.second] = max(dp[r.second], dp[r.first] + 1);
	}
	cout << *max_element(dp.begin(), dp.end()) << endl;
	return 0;
}



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

int main()
{
    int a,b,c,N=101;
    cin >> a >> b >> c;

    int color[N] = {};
    color[a]++;
    color[b]++;
    color[c]++;

    int sum=0;
    for(int i=1; i<N; i++){
        if(color[i] > 0){
            sum++;
        }
    }

    cout << sum;
}




Measured memory_bytes: 256
N=int(input())
L=list(map(int,input().split()))

n=0
for i in range(N):
    for j in range(N-1,i,-1):
        v=L[j]
        u=L[j-1]
        
        if v < u:
            L[j]=u
            L[j-1]=v
            n+=1
            
print(' '.join(map(str,L)))
print(n)


Measured memory_bytes: 5596
#include <iostream>
#include <iomanip>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
const int nrep = 30;
const double EPS = 1e-10;
const double INF = 1e12;
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define X real()
#define Y imag()

typedef complex<double> P;
typedef vector<P> VP;
struct L : VP{
    L(const P& a, const P& b){ resize(2); at(0)=a; at(1)=b; }
    L(){ resize(2); }
};
struct C{
    P p;
    double r;
    C(const P& p, const double& r) : p(p), r(r) {}
    C(){}
};

double dot(P a, P b){
    return (conj(a)*b).X;
}
double cross(P a, P b){
    return (conj(a)*b).Y;
}

P projection(const L& l, const P& p) {
    double t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);
    return l[0] + t*(l[0]-l[1]);
}
double distanceLP(const L &l, const P &p) {
    return abs(p - projection(l, p));
}

int main(){
	while(1){
		vector<int> input(6);
		bool allzero = true;
		for(int i=0; i<6; i++){
			cin >> input[i];
			if(input[i]!=0) allzero = false;
		}
		if(allzero) break;
		
		VP v(3);
		for(int i=0; i<3; i++){
			v[i] = P(input[2*i], input[2*i+1]);
		}
		
		VP bisection(3);
		for(int i=0; i<3; i++){
			double a = abs(v[(i+1)%3] -v[i]), b = abs(v[(i+2)%3] -v[i]);
			bisection[i] = v[(i+1)%3] + (v[(i+2)%3]-v[(i+1)%3])* a/(a+b);
		}
		
		C c[3];
		P b = v[0], e = bisection[0];
		for(int i=0; i<nrep; i++){
			P mid = 0.5*(b+e);
			c[0] = C(mid, distanceLP(L(v[0], v[1]), mid));
			if(distanceLP(L(v[1], v[2]), mid) < c[0].r +EPS){
				e = mid;
				continue;
			}
			for(int j=1; j<=2; j++){
				P b = v[j], e = bisection[j];
				for(int k=0; k<nrep; k++){
					P mid = 0.5*(b+e);
					c[j] = C(mid, distanceLP(L(v[1], v[2]), mid));
					if(distanceLP(L(v[(j+1)%3], v[(j+2)%3]), mid) < c[j].r +EPS){
						e = mid;
						continue;
					}
					if(abs(c[0].p -c[j].p) < c[0].r+c[j].r){
						e = mid;
					}else{
						b = mid;
					}
				}
			}
			if(abs(c[1].p -c[2].p) < c[1].r+c[2].r){
				b = mid;
			}else{
				e = mid;
			}
		}
		
		cout << fixed;
		cout << setprecision(10);
		cout << c[0].r << " " << c[1].r << " " << c[2].r << endl;
	}
	return 0;
}

Measured memory_bytes: 3232
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000



int main(){
	
	int N;
	cin>>N;
	
	vector<int> A(N);
	
	for(int i=0;i<N;i++)cin>>A[i];
	
	map<int,int> mp;
	int ans = 1;
	mp[0]=3;

	for(int i=0;i<N;i++){
		ans = mod(ans * mp[A[i]]);
		mp[A[i]]--;
		mp[A[i]+1]++;
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 5376
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();
        if(a<b)
        	if(b<c)
        		System.out.println("Yes");
        	else
        		System.out.println("No");
        else
        	System.out.println("No");
    }
}

Measured memory_bytes: 26384
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

public class Program
{
    #region Standard I/O
    readonly TextReader input;
    readonly TextWriter output;

    X[] ReadLine<X>(Func<string, X> func)
    {
        return input.ReadLine().Split(' ').Select(func).ToArray();
    }

    void WriteLineOne(object obj)
    {
        output.WriteLine("{0}", obj);
    }

    void WriteLineMany(params object[] objects)
    {
        output.WriteLine(string.Join(" ", objects.Select(obj => obj.ToString())));
    }
    #endregion

    int n;
    long[] xs;

    void Read()
    {
        n = ReadLine(int.Parse)[0];
        xs = ReadLine(long.Parse);
    }

    IEnumerable<long> Solve()
    {
        for (var i = n - 1; i >= 0; i -= 2)
        {
            yield return xs[i];
        }

        for (var i = n % 2; i < n; i += 2)
        {
            yield return xs[i];
        }
    }

    public void Run()
    {
        Read();
        output.WriteLine(string.Join(" ", Solve()));
    }

    public Program(TextReader input, TextWriter output)
    {
        this.input = input;
        this.output = output;
    }

    public static void Main(string[] args)
    {
        new Program(Console.In, Console.Out).Run();
    }
}


Measured memory_bytes: 46520
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD=1000000007;
#define REP(i,n) for(ll i=0; i<(n); i++)
#define REP2(i,x,n) for(ll i=x; i<(n); i++)
const long long INF = numeric_limits<long long>::max();
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main()
{
    ll N, K;
    cin >> N >> K;

    map<ll, ll > balls;
    for ( ll i = 0; i < N; ++ i ){
        ll n;
        cin >> n;
        balls[n]++;
    }
    vector<pair<ll,ll>> sortedBalls;
    copy(balls.begin(), balls.end(),back_inserter<vector<pair<ll,ll>>>(sortedBalls));

    sort(sortedBalls.begin(), sortedBalls.end(), [](const auto &a, const auto&b ){return a.second < b.second; });

#ifdef SOURCE_TEST
    
    for ( auto& v : sortedBalls ){
        cout << v.first << ":" << v.second << endl;
    }
#endif

    ll diff = sortedBalls.size() - K;
    ll count = 0;
    for ( ll i = 0; i < diff; ++ i ){
        count += sortedBalls[i].second;
    }
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 19712
import java.util.Scanner;

/**
 * Main
 */
public class Main {

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

        int N = sc.nextInt();
        long total = 0;

        for(int i = 1; i<=N; i++){
            if(i % 3 != 0 && i % 5 != 0){
                total += i;
            }
        }
        System.out.println(total);
    }
}

Measured memory_bytes: 27184
#include<bits/stdc++.h>
using namespace std;
int n;
struct cell{
    int x,id;
} x[100010];
bool comp(cell a,cell b){
    return a.x<b.x;
}
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x[i].x;
        x[i].id=i+1;
    }
    sort(x,x+n,comp);
    for(int i=0;i<n;i++)cout<<x[i].id<<" ";
    cout<<endl;
    return 0;
}

Measured memory_bytes: 1536
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var s = cin.next();
            var i = s.Length - 2;
            Console.WriteLine("" + s[0] + i + s[s.Count()-1]);
            
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


Measured memory_bytes: 11220
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 100100100100;
const long long MOD = 1000000007;
typedef pair<long long,long long> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}

int main() {
    long long N,M;cin >> N >> M;
    if(N == 1){
        cout << M << endl;
        return 0;
    }
    long long ans = 1;
    for(long long i = 2;i<=(long long)sqrt(M)+114;i++){
        if(M % i == 0 && i <= M/N){
            ans = max({ans,i});
            if(M/i <= M/N){
                ans = max(ans,M/i);            
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include "queue"
#include <deque>
#include <stack>
#include <numeric>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <complex>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <climits>
#include <cassert>
#include <iostream>
using namespace std;
#define MOD 1000000007
#define MODSET(d) if ((d) >= MOD) d %= MOD;
#define MODNEGATIVESET(d) if ((d) < 0) d = (d % MOD + MOD) % MOD;
#define pii pair<long long ,long long >
#define ll  long long int
#define loop(i,n) for(ll i=0;i<n;i++)
#define loop2(i,n) for(ll i = 1;i<=n;i+=1)
#define pb push_back
#define mp make_pair
#define EPS 1e-7
using namespace std;
// JAI SHREE KRISHNA
//Winning is my right
//I.W.T.D.I.F.M.F


const int MAXN = (ll)2e5+100;
vector<ll>roads[MAXN];
vector<ll>trains[MAXN];
ll fortrains[MAXN];
ll forroads[MAXN];
ll vis[MAXN] = {false};
void DFSFORROADS(ll node,ll colour)
{
    vis[node] = true;
    forroads[node] = colour;
    loop(i,roads[node].size())
    {
        ll to = roads[node][i];
        if(vis[to]==false)
        {
            
            DFSFORROADS(to,colour);
            
        }
    }
}

void DFSFORTRAINS(ll node,ll colour)
{
    vis[node] = true;
    fortrains[node] = colour;
    loop(i,trains[node].size())
    {
        ll to = trains[node][i];
        if(vis[to]==false)
        {
            DFSFORTRAINS(to, colour);
        }
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
   
    ll n,k,l;
    cin>>n>>k>>l;
    
    loop(j,k)
    {
        ll a,b;
        cin>>a>>b;
        roads[a].push_back(b);
        roads[b].push_back(a);
    }
    loop(j,l)
    {
        ll a,b;
        cin>>a>>b;
        trains[a].push_back(b);
        trains[b].push_back(a);
    }
    ll counter = 1 ;
    loop2(i, n)
    {
        if(vis[i]==false)
        {
            DFSFORROADS(i,counter);
            counter+=1;
        }
    }
    
    
    memset(vis, 0, sizeof(vis));
    counter = 1;
    loop2(i, n)
    {
        if(vis[i]==false)
        {
            DFSFORTRAINS(i, counter);
            counter+=1;
        }
    }
    
    map<pii, ll>m1;
    
    loop2(i, n)
    {
        m1[{forroads[i],fortrains[i]}]+=1;
    }
    loop2(i,n)
    {
        cout<<m1[{forroads[i],fortrains[i]}]<<" ";
    }
    return 0;
    
    
}

Measured memory_bytes: 32000
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define c(P)        cout<<P<<"\n"
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define F           first
#define S           second
#define mem(a,val)  memset(a,val,sizeof(a))
#define fr(i,x,n)   for(ll i=x;i<n;i++)
#define frr(i,x,n)  for(ll i=n-1;i>=x;i--)


const ll N   =  500005;
const ll mod = 1e9 + 7;

using namespace std;


void solve(){

  ll x=0,y=0,c=0,ans=0;
  ll n,m,k;
  cin>>n;
  std::vector<ll> v,p,q;
  for (ll i = 1; i <= n; ++i)
  {
    v.pb(i);
  }
  for (int i = 0; i < n; ++i)
  {
    cin>>x;  p.pb(x);
  }
  for (int i = 0; i < n; ++i)
  {
    cin>>x;  q.pb(x);
  }
  x= 0;
  bool val = 1;
  while(val)
  {
    c++;
    if(v==p)
    {
        x = c;
    }
    if(v==q)
    {
        y = c;
    }
    val = next_permutation(v.begin(), v.end());
  }
  c(abs(x-y));
}

signed main(){
     
  ios_base::sync_with_stdio(false);   
  cin.tie(NULL);
  ll T=1;
  //cin>>T;
  while(T--){
  solve();
  }
  return 0;
}


Measured memory_bytes: 256
n, t = map(int, input().split())
a = list(map(int, input().split()))
m = [a[i] for i in range(n)]
for i in range(n - 2, -1, -1):
  m[i] = max(m[i], m[i + 1])
d = 0
ans = 0
for i in range(n):
  if d < m[i] - a[i]:
    d = m[i] - a[i]
    ans = 1
  elif d == m[i] - a[i]:
    ans += 1
print(ans)


Measured memory_bytes: 15020
#include <iostream>
#include <vector>
#include <queue>
#define INF (1 << 28)

using namespace std;

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

struct data_t {
	int row;
	int col;
	int dir;
	int cost;

	bool operator<(const data_t& right) const {
		return (cost > right.cost);
	}
};

int main(void) {
	while (cin >> w >> h, w) {
		vector< vector<int> > s(h+2,vector<int>(w+2));
		for (int i = 0; i < h+2; ++i) {
			for (int j = 0; j < w+2; ++j) {
				if (i == 0 || i == h+1 || j == 0 || j == w+1) {
					s[i][j] = -1;
				}
				else {
					cin >> s[i][j];
				}
			}
		}

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

		int cost[h+2][w+2][4];
		for (int i = 0; i < h+2; ++i) {
			for (int j = 0; j < w+2; ++j) {
				for (int k = 0; k < 4; ++k) {
					cost[i][j][k] = INF;
				}
			}
		}

		priority_queue<data_t> pq;
		pq.push((data_t){1,1,0,0});
		cost[1][1][0] = 0;
		while (!pq.empty()) {
			data_t sn = pq.top();
			pq.pop();
			if (sn.row == h && sn.col == w) {
				cout << sn.cost << endl;
				break;
			}
			else {
				for (int op = 0; op < 4; ++op) {
					int d = (sn.dir + op) % 4;
					if (sn.row+dy[d] > 0 && sn.row+dy[d] <= h && sn.col+dx[d] > 0 && sn.col+dx[d] <= w) {
						if (s[sn.row][sn.col] == op) {
							if (sn.cost < cost[sn.row+dy[d]][sn.col+dx[d]][d]) {
								cost[sn.row+dy[d]][sn.col+dx[d]][d] = sn.cost;
								pq.push((data_t){sn.row+dy[d],sn.col+dx[d],d,sn.cost});
							}
						}
						else {
							if (sn.cost+c[op] < cost[sn.row+dy[d]][sn.col+dx[d]][d]) {
								cost[sn.row+dy[d]][sn.col+dx[d]][d] = sn.cost + c[op];
								pq.push((data_t){sn.row+dy[d],sn.col+dx[d],d,sn.cost+c[op]});
							}
						}
					}
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3124
n = int(raw_input())
a1 = map(int,raw_input().split(" "))
a2 = map(int,raw_input().split(" "))

ans = 0

a1sum = []
a2sum = []

now = 0
for a in range(n):
  now = now + a1[a]
  a1sum.append(now)

now = 0
for a in range(n):
  now = now + a2[n - a - 1]
  a2sum.append(now)
a2sum = a2sum[::-1]

ans = -1
for a in range(n):
  buf = a1sum[a] + a2sum[a]
  if ans < buf:
    ans = buf
print ans


Measured memory_bytes: 2568
n = int(input())
print("{}:".format(n), end="")
q = 2
while n>1 and q*q <= n:
	if n % q == 0:
		print(" {}".format(q), end="")
		n //= q
	else:
		q += 1
if n>1:
	print(" {}".format(n), end="")
print("")


Measured memory_bytes: 5592
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
)

func scanInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func scanInt64() int64 {
	sc.Scan()
	i, _ := strconv.ParseInt(sc.Text(), 10, 64)
	return i
}

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func scanInts64(n int) []int64 {
	res := make([]int64, n)
	for i := range res {
		res[i] = scanInt64()
	}
	return res
}

func scanText() string {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Scan()
	return sc.Text()
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)

	n, k := scanInt(), scanInt()
	p := scanInts(n)

	sort.Sort(sort.IntSlice(p))
	sum := 0
	for _, i := range p[0:k] {
		sum += i
	}
	fmt.Println(sum)
}


Measured memory_bytes: 1780
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define ff first
#define ss second
#define nl '\n'
/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */

using vi = vector<int>;
#define allOf(x) (x).begin(), (x).end()

template <typename P, typename Q>
ostream&operator<<(ostream&os, const pair<P, Q>&p)
{return os << '(' << p.first << ", " << p.second << ')';}
template <typename K, typename V>
ostream&operator<<(ostream&os, const map<K, V>&v)
{os << '['; for(const auto&it:v) (os << it) << ", "; return os << ']';}
template <typename T> ostream&operator<<(ostream&os, const set<T>&v)
{os << '['; for(const auto&it:v) (os << it) << ", "; return os << ']';}
template <typename T> ostream&operator<<(ostream&os, const vector<T>&v)
{os << '['; for(const auto&it:v) os << it << ", "; return os << ']';}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */



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

  int n, m; cin >> n >> m;
  char c[1+n];
  for(int i=1; i<=n; i++) cin >> c[i];

  vector< vi > g(1+n);
  for(int u,v,i=1; i<=m; i++) {
    cin >> u >> v;
    g[u].emplace_back(v);
    if( v != u )
      g[v].emplace_back(u);
  }

  int ac[1+n], bc[1+n], mark[1+n];
  fill(ac, ac+n+1, 0);
  fill(bc, bc+n+1, 0);
  fill(mark, mark+n+1, 0);
  int Q[n], lx=0, rx=0;
  for(int i=1; i<=n; i++) {
    for(auto&nb:g[i]) {
      if( c[nb] == 'A' ) ac[i]++;
      if( c[nb] == 'B' ) bc[i]++;
    }
    if( ac[i] > 0 and bc[i] > 0 ) continue;
    mark[i] = 1;
    Q[rx++] = i;
    // cerr << i << ": " << ac[i] << ' ' << bc[i] << endl;
  }

  while( lx < rx ) {
    int u = Q[lx++];
    char C = c[u];
    for(auto&nb:g[u]) {
      if( C == 'A' ) ac[nb]--;
      else bc[nb]--;
      if( ac[nb] > 0 and bc[nb] > 0 ) continue;
      if( mark[nb] ) continue;
      mark[nb] = 1;
      Q[rx++] = nb;
    }
  }

  cout << (rx < n ? "Yes" : "No") << nl;

  return 0;
}

/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */


Measured memory_bytes: 13184
#include <iostream>
#include <cmath>

int main()
{
    int n;
    std::cin >> n;
    int c = 0;
    for (int i = 1; i <= n; i++) {
        if (((int)(std::log10(i)+1)) % 2) {
            c++;
        }
    }

    std::cout << c << std::endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define long long long
#define ull unsigned long long
#define up(i,a,b) for (int i=a; i<=b; i++)
#define upadj(i,adj) if (adj.size()>0) up(i,0,adj.size()-1)
#define down(i,a,b) for (int i=a; i>=b; i--)
#define endl '\n'
#define pb push_back
#define X first
#define Y second
#define II pair<int, int>
#define III pair<int, pair<int, int> >
#define V vector
#define debug(X) cerr<< #X << "=" <<X << endl
#define debug2(X,Y)  cerr<< #X << "=" <<X << ", " << #Y << "=" <<Y << endl
#define show(X,a,b) {cerr << #X << " = "; up(__,a,b) cerr << X[__] << ' '; cerr << endl;}
#define gc getchar
#define pc putchar
using namespace std;

inline void read(int &x)
{
    register int c = gc();
    x = 0;
    int neg = 0;
    for (;((c<48 || c>57) && c != '-') ;c = gc());
    if(c=='-') {neg=1;c=gc();}
    for(;c>47 && c<58;c = gc()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}
inline void writeln(int x){

         char buffor[21];
         register int i=0;
         int neg=0; if (x<0) {neg=1; x= -x;}
         do{
               buffor[i++]=(x%10)+'0';
               x/=10;
            } while(x);
           i--;
           if (neg) pc('-');
           while(i>=0) pc(buffor[i--]);
           pc('\n');
       }
int n,m;
int a[102];
void input()
{
    cin>>n>>m;
    up(i,1,m) cin>>a[i];
}

void solve()
{
    if (m==1)
    {
        cout<<a[1]<<endl;
        if (a[1]==1) cout<<1<<endl; else cout<<2<<endl;
        if (a[1]==1) cout<<1<<endl;
        else cout<<a[1]-1<<" "<<1<<endl;
        return;
    }
    int cntodd= 0;
    up(i,1,m)
     if (a[i]%2==1) cntodd++;
    if (cntodd>=3)
    {
        cout<<"Impossible"; return;
    }
    int odd1= -1,odd2= -1;
    up(i,1,m)
     if (a[i]%2==1)
     {
         if (odd1==-1)
         {
             odd1= a[i]; swap(a[i],a[1]);
         }
         else if (odd2== -1)
         {
             odd2= a[i]; swap(a[i],a[m]);
         }
     }
     up(i,1,m) cout<<a[i]<<" ";
     cout<<endl;
     if (a[1]==1) cout<<m-1<<endl;
     else cout<<m<<endl;
     if (a[1]>1) cout<<a[1]-1<<" ";
     up(i,2,m-1) cout<<a[i]<<" ";
     cout<<a[m]+1;
}

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

    #ifdef I_Love_Pork
    #define TASK "tmp"
    freopen(TASK".inp","r",stdin);
    freopen(TASK".out","w",stdout);
    #endif

    input();
    solve();

    return 0;
}


Measured memory_bytes: 256
N,M = map(int, input().split())
a_list = [int(input()) for _ in range(M)]

tmp =  [1]*(N+1)
for a in a_list:
    tmp[a] = 0
for i in range(2,N+1):
    if tmp[i]:
        tmp[i] = tmp[i-1]+tmp[i-2]
    if tmp[i]> 1000000007:
        tmp[i] = tmp[i] % 1000000007
print(tmp[-1] % 1000000007)

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

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#include <map>
#define all(x) (x).begin(),(x).end()

void solve(){

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

    return 0;
}


Measured memory_bytes: 504
#pragma region ヘッダー
#define _CRT_SECURE_NO_WARNINGS

#ifdef _____MY_DEBUG_____
#define VS_ENDPAUSE()	(system("pause"))
#define DEBUG_OUT(...)  (printf(__VA_ARGS__))
#else
#define VS_ENDPAUSE()
#define DEBUG_OUT(...)
#endif

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;
typedef signed char int8;
typedef signed short int16;
typedef signed int int32;
typedef signed long long int64;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long long uint64;
#define int int64

#ifndef INT8_MIN
#define INT8_MIN	(-127)
#endif
#ifndef INT8_MAX
#define INT8_MAX	( 128)
#endif
#ifndef UINT8_MAX
#define UINT8_MAX	( 255)
#endif
#ifndef INT16_MIN
#define INT16_MIN	(-32768)
#endif
#ifndef INT16_MAX
#define INT16_MAX	( 32767)
#endif
#ifndef UINT16_MAX
#define UINT16_MAX	( 65535)
#endif
#ifndef INT32_MIN
#define INT32_MIN	(-2147483648)	// -2 * 10^9
#endif
#ifndef INT32_MAX
#define INT32_MAX	( 2147483647)	//  2 * 10^9
#endif
#ifndef UINT32_MAX
#define UINT32_MAX	( 4294967295)	//  4 * 10^9
#endif
#ifndef INT64_MIN
#define INT64_MIN	(-9223372036854775808)	// -9 * 10^18
#endif
#ifndef INT64_MAX
#define INT64_MAX	( 9223372036854775807)	//  9 * 10^18
#endif
#ifndef UINT64_MAX
#define UINT64_MAX	( 18446744073709551615)	// 18 * 10^18
#endif

void func(void);
#pragma endregion

int32 main(void)
{
    func();
    VS_ENDPAUSE();
    return 0;
}

void func(void)
{
//DEBUG_OUT("----\n");
    int32 N;
    cin >> N;
    printf("ABC%03d\n", N);

    return;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
	int n; cin>>n;
	int a[n]; rep(i,n) cin>>a[i];
	sort(a,a+n);
	long x,y=0; bool flag=false;
	for(int i=n-2;i>=0;i--){
		if(a[i]==a[i+1]){
			if(!flag){
				x=a[i]; a[i]=a[i+1]=0; flag=true;
			}else{
				y=a[i]; break;
			}
		}
	}
	cout<<x*y<<endl;
	return 0;
}


Measured memory_bytes: 640
#include<stdio.h>

static const int N = 1000;

void trace(int A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

int main(){
  int n,i,j,a;
  int A[N+1];
  scanf("%d", &n);

  for ( i = 1; i <= n; i++ ) scanf("%d", &A[i]);
  
  for(i=1; i<=n; i++){
    j=i-1;
    a=A[i];
    while(j>=0 && A[j]>a){
      A[j+1]=A[j];
      j--;
      A[j+1]=a;
    }
    trace(A, n);
  }
  return 0;
}

Measured memory_bytes: 604
// In the name of God

#include <bits/stdc++.h>

using namespace std;

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

	map<string, int> mp;

	int n;
	cin >> n;
	while(n--) {
		string s;
		cin >> s;
		mp[s]++;
	}

	cout << "AC x " << mp["AC"] << "\n";
	cout << "WA x " << mp["WA"] << "\n";
	cout << "TLE x " << mp["TLE"] << "\n";
	cout << "RE x " << mp["RE"] << "\n";

	return 0;
}


Measured memory_bytes: 3628
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read::<usize>();
    let mut f = vec![vec![0; 10]; n];
    let mut p = vec![vec![0; 11]; n];

    for i in 0..n {
        for j in 0..10 {
            f[i][j] = read::<i64>();
        }
    }
    for i in 0..n {
        for j in 0..11 {
            p[i][j] = read::<i64>();
        }
    }

    let mut ans = -1_000_000_000;
    for o in 1..2i32.pow(10) {
        let mut c = vec![0; n];
        for i in 0..10 {
            if 1 << i & o != 0 {
                for j in 0..n {
                    if f[j][i] == 1 {
                        c[j] += 1;
                    }
                }
            }
        }
        let mut t_sum = 0;
        for i in 0..n {
            t_sum += p[i][c[i]];
        }

        if t_sum > ans {
            ans = t_sum;
        }
    }
    println!("{}", ans)
}

Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <string>
#include <utility>
#include <map>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)(n);i++)
#define Rep(i,n) for(int i=0;i<=(int)(n-1);i++)
typedef long long ll;
typedef map<int,int> mint;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};
int inf=1e9+1000;
ll infi=1e18+100;

ll N,T;
ll t[200005];
int main() {
	cin>>N>>T;
	Rep(i,N) cin>>t[i];
	ll ans = 0;
	rep(i,N-1){
		if(t[i]-t[i-1]>T){
			ans+=T;
		}
		else ans+=(t[i]-t[i-1]);
	}
	ans+=T;
	cout<<ans<<endl;



	return 0;
}

Measured memory_bytes: 1792