akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define DEBUG(x)           cout << '>' << #x << ':' << x << endl;
#define forn(i,n)          for(int i=0;i<(int)n;++i)
#define for1(i,n)          for(int i=1;i<=(int)n;++i)
#define forr(i,n)          for(int i=(int)n-1;i>=0;--i)
#define forre(i,a,b)       for(int i=(int)b;i>=(int)a;--i)
#define fore(i,a,b)        for(int i=(int)a;i<=(int)b;++i)
#define input(arr,n)       for(int i=0;i<n;i++)cin>>arr[i]
#define output(arr,n)      for(int i=0;i<n;i++)cout<<arr[i]<<" "
#define for_each(arr)      for(auto& it:arr)cout<<it<<" "
#define ff                 first
#define ss                 second
#define PI                 acos(-1.0)
#define all(a)             a.begin(),a.end()
#define rall(a)            a.rbegin(),a.rend()
#define Unique(a)          sort(all(a)),a.erase(unique(all(a)),a.end())
#define pb(x)              push_back(x)
#define eb(x)              emplace_back(x) 
#define ppb(x)             pop_back(x)
#define pf(x)              push_front(x)
#define ppf(x)             pop_front(x)
#define in(x,y)            insert({x,y})
#define Sort(a)            sort(a.begin(),a.end())
#define mem(arr,a)         memset(arr,a,sizeof arr)
#define ins(a)             insert(a)
#define max2(a,b)          max(a,b)
#define max3(a,b,c)        max(a,max(b,c))
#define max4(a,b,c,d)      max(a,max3(b,c,d))
#define min2(a,b)          min(a,b)
#define min3(a,b,c)        min(a,min(b,c))
#define min4(a,b,c,d)      min(a,min3(b,c,d))
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<char> vc;
typedef vector<double> vd;
/*inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void Set(int & n, int b) { n |= two(b); }
inline void Reset(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }*/
/*int fx1[]={+1,-1,+0,+0};
int fy1[]={+0,+0,+1,-1};
int fx2={+0,+0,+1,-1,-1,+1,-1,+1};
int fy2={-1,+1,+0,+0,+1,+1,-1,-1};
*/

ll a,b,c,n,ans,cn1,cn2,cn3,t;
string s,s1,s2;


int main()
{
    FIO;
    //#ifndef ONLINE_JUDGE
  //  freopen("input.txt","r",stdin);
  //  freopen("output.txt","w",stdout);
  //  #endif
    cin>>a;
    set<ll>st;
    for(int i=0;i<a;i++){
    	cin>>b;
    	st.insert(b);
    }
    if(st.size()==a)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

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


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

using namespace std;

string s;

void solve() {
    for (int i = 0; i < s.size(); i++) {
        if (i % 2 == 0) {
            printf("%c", s[i]);
        }
    }
    printf("\n");
}

int main() {
    cin >> s;
    solve();
    return 0;
}

Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define debug(a) cout<<#a<<":"<<a<<endl;
#define fr freopen("in.txt","r",stdin);
const int INF=0x3f3f3f3f;
const int N=1e6+7;
const int mod=1e9+7;
int maxn,minn;
int T,n,m,x;
struct aa{
	int w;
	int a[100];
}arr[N];

int a[100];

void dfs(int num,int sum){
	if(num==n+1){
		for(int i=1;i<=m;i++){
			if(a[i]<x){
				return ;
			}
		}
		minn=min(minn,sum);
		return ;
	}
	for(int i=1;i<=m;i++){
		a[i]=a[i]+arr[num].a[i];
	} 
	dfs(num+1,sum+arr[num].w);
	for(int i=1;i<=m;i++){
		a[i]=a[i]-arr[num].a[i];
	} 
	dfs(num+1,sum);
}

int main(){
	int w;
	cin>>n>>m>>x;
	for(int i=1;i<=n;i++){
		cin>>w;
		arr[i].w=w;
		for(int j=1;j<=m;j++){
			scanf("%d",&arr[i].a[j]);
		}
	}
	minn=INF;
	dfs(1,0);
	if(minn==INF){
		minn=-1;
	}
	cout<<minn<<endl;
	

	return 0;
}





Measured memory_bytes: 3768
#include <bits/stdc++.h>
#define N 256101
#define Q 3414680
#define tuple Tuple
using namespace std;

typedef long long ll;
const ll INF = 0x7f7f7f7f7f7f7f7fll;

struct tuple{
	int w, id, pos;
	tuple (int w0 = 0, int id0 = 0, int pos0 = 0): w(w0), id(id0), pos(pos0) {}
};

int n, A, B, i, inf, sup;
int x[N], fst[N];
ll f[2][2][N], *F[2], *G[2], ans;

tuple que[Q];

template <typename T>
inline void up(T &x, const T y){x < y ? x = y : 0;}
template <typename T>
inline void down(T &x, const T y){x > y ? x = y : 0;}
inline bool cmp(const tuple &A, const tuple &B){return A.id < B.id || A.id == B.id && f[A.w & 1][A.id][A.pos] < f[B.w & 1][B.id][B.pos];}

void bfs(){
	int h, t = 1, W = -1, i, j, k; ll f0, f1;
	tuple z, z0, z1;
	que[0] = tuple(0, 0, B);
	for(h = 0; h < t; h++){
		if(que[h].w > W){
			W = que[h].w;
			fst[W] = h;
			swap(F[0], G[0]); swap(F[1], G[1]);
			if(W >= 1)
				for(i = fst[W - 1]; i < h; i++)
					f[que[i].w & 1][que[i].id][que[i].pos] = INF;
			sort(que + h, que + t, cmp);
			for(j = h, i = h + 1; i < t; i++){
				z0 = que[j]; z1 = que[i];
				if(z0.id == z1.id)
					if(f[z0.w & 1][z0.id][z0.pos] + abs(z0.pos - z1.pos) <= f[z1.w & 1][z1.id][z1.pos]){
						f[z1.w & 1][z1.id][z1.pos] = INF;
						continue;
					}
				que[++j] = que[i];
			}
			t = ++j;
		}
		z = que[h];
		if(W == n){down(ans, F[z.id][z.pos]); continue;}
		if(z.id){ // right
			z0 = tuple(W + 1, 0, x[W]); // left
			f0 = F[1][z.pos] + abs(z.pos - x[z0.w]);
			z1 = tuple(W + 1, 1, z.pos); // right
			f1 = F[1][z.pos] + abs(x[W] - x[z1.w]);
		}else{ // left
			z0 = tuple(W + 1, 0, z.pos); // left
			f0 = F[0][z.pos] + abs(x[W] - x[z0.w]);
			z1 = tuple(W + 1, 1, x[W]); // right
			f1 = F[0][z.pos] + abs(z.pos - x[z1.w]);
		}
		if(x[z0.w] <= z0.pos && f0 < G[0][z0.pos]){
			if(G[0][z0.pos] >= INF)
				que[t++] = z0;
			G[0][z0.pos] = f0;
		}
		if(z1.pos <= x[z1.w] && f1 < G[1][z1.pos]){
			if(G[1][z1.pos] >= INF)
				que[t++] = z1;
			G[1][z1.pos] = f1;
		}
	}
}

int main(){
	scanf("%d%d%d%d", &inf, &n, &A, &B);
	if(A > B) swap(A, B);
	for(sup = i = 1; i <= n; i++){
		scanf("%d", x + i);
		down(inf, x[i]); up(sup, x[i]);
	}
	memset(f, 127, sizeof f);
	G[0] = f[0][0]; G[1] = f[0][1];
	F[0] = f[1][0]; F[1] = f[1][1];
	x[0] = A; G[0][B] = 0;
	ans = LLONG_MAX;
	bfs();
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 50048
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define int long long
#define double long double
const int INF = 1e18, MOD = 1e9 + 7;
const int MAX = 1111111;

int fac[MAX], finv[MAX], inv[MAX];
 
void init() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
int comb(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

signed main() {
    int x, y;
    cin>>x>>y;
    if ((x + y) % 3 != 0) {
        cout<<0<<endl;
        return 0;
    }
    int a, b;
    a = (2 * x - y) / 3;
    b = (2 * y - x) / 3;
    init();
    cout<<comb(a + b, a)<<endl;
}

Measured memory_bytes: 26240
using System;
using System.Linq;
using System.Collections.Generic;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var s = Console.ReadLine().ToCharArray();

            if (n % 2 != 0)
            {
                Console.WriteLine("No");
            }
            else
            {
                var left = new string(s.Where((x, i) => i < n / 2).ToArray());
                var right = new string(s.Where((x, i) =>i >=n/2).ToArray());

                if(left == right) Console.WriteLine("Yes");
                else Console.WriteLine("No");
            }
        }
    }
}


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

ll A, B, C, D;

int gcd(int a, int b) {
    int large = max(a, b);
    int small = min(a, b);
    if (small == 0) return large;
    else return gcd(small, large % small);
}

int main() {
    cin >> A >> B >> C >> D;

    ll C_cnt = 0;
    if (A % C == 0) {
        C_cnt = (B / C) - (A / C) + 1;
    }
    else {
        C_cnt = (B / C) - (A / C);
    }

    ll D_cnt = 0;
    if (A % D == 0) {
        D_cnt = (B / D) - (A / D) + 1;
    }
    else {
        D_cnt = (B / D) - (A / D);
    }


    ll gcd_cd = gcd(C, D);
    ll LCM = C*D / gcd_cd;
    ll CD_cnt = 0;
    if (A % (LCM) == 0) {
        CD_cnt = (B / (LCM)) - (A / (LCM)) + 1;
    }
    else {
        CD_cnt = (B / (LCM)) - (A / (LCM));
    }

    cout << B - A + 1 - C_cnt - D_cnt + CD_cnt << endl; 

    return 0;
}


Measured memory_bytes: 256
use std::io::stdin;

fn main() {
    let mut h = String::new();
    let _ = stdin().read_line(&mut h).unwrap();
    let num_of = h.trim().split(' ').collect::<Vec<_>>()[0].parse::<u32>().unwrap();
    let mut strs = (0..num_of)
        .map(|_| -> String{
            let mut s = String::new();
            let _ = stdin().read_line(&mut s).unwrap();
            s.trim().to_string()
        }).collect::<Vec<_>>();
    strs.sort();
    println!("{}", strs.concat());
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int> X(N);
	int ans = 100000000;
	int sum = 0;
	for (int i = 0; i < N; i++) {
		cin >> X[i];
	}
	for (int i = 0; i < 101; i++) {
		sum = 0;
		for (int j = 0; j < N; j++) {
			sum += pow((i - X[j]), 2);
		}
		ans = min(ans, sum);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

import static java.lang.Integer.parseInt;

/**
 * Membership Management
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		while ((line = br.readLine()) != null && !line.isEmpty()) {

			int n = parseInt(line);
			if (n == 0) break;

			Map<String, Set<String>> groups = new HashMap<>();
			String first = "";

			for (int i = 0; i < n; i++) {
				words = br.readLine().replaceAll("\\.", "").split("[:,]");
				groups.put(words[0], new HashSet<>());
				for (int j = 1; j < words.length; j++) {
					groups.get(words[0]).add(words[j]);
				}
				if (i == 0) first = words[0];
			}

			//solve
			boolean changed;
			do {
				changed = false;
				for (String group : groups.keySet()) {
					if (!group.equals(first) && groups.get(first).contains(group)) {
						groups.get(first).remove(group);
						for (String member : groups.get(group)) {
							groups.get(first).add(member);
						}
						changed = true;
					}
				}
			} while (changed);

			System.out.println(groups.get(first).size());
		}
	}
}

Measured memory_bytes: 42056
n, m, x, y = gets.chomp.split(" ").map(&:to_i)
x_cities = gets.chomp.split(" ").map(&:to_i)
y_cities = gets.chomp.split(" ").map(&:to_i)
x_max = x_cities.max
y_min = y_cities.min
ans = "War"
(x_max + 1..y_min).each do |i|
  if (x + 1..y).include?(i)
    ans = "No War"
    break
  end
end
puts ans

Measured memory_bytes: 1788
N, M = map(int, input().split())
Xm = list(map(int, input().split()))

ans = 0
if N < M:
    Xm = sorted(Xm)
    Ym = [0] * (M-1)

    for i in range(1, M):
        Ym[i-1] = abs(Xm[i] - Xm[i-1])

    Ym = sorted(Ym, reverse=True)
    for i in range(N-1):
        Ym[i] = 0

    ans = sum(Ym)

print(ans)


Measured memory_bytes: 13968
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll=long long;
using ld=long double;
//#define int long long
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279;
int fact(int i) {
    if (i == 0) return 1;
    return ((fact(i - 1)) * i) % MOD;
}
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int keta(int n) {
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
int ketasum(int n) {
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
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;
}
char toSmall(char c) { // 大文字を小文字へ
    return (c + 0x20);
}
char toLarge(char c) { // 小文字を大文字へ
    return (c - 0x20);
}
float myPower(int a, int n) { // aのn乗の計算
    float x = 1;
    while (n > 0) { // 全てのbitが捨てられるまで
        if (n & 1) { // 一番右のbitが１のとき
            x *= a;
        }
        a *= a;
        n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
    }
    return x;
}
bool is_prime(const unsigned n) {
    switch (n) {
    case 0: // fall-through
    case 1: return false;
    case 2: // fall-through
    case 3: return true;
    } // n > 3 が保証された

    if (n % 2 == 0 || n % 3 == 0) return false;
    // n は 2 と 3 のいずれの倍数でもないことが保証された
    // これより n は (6の倍数)-1 か (6の倍数)+1 である
    // 6の倍数前後の数を使って試し割りをする
    for (unsigned i = 5; i * i <= n; i += 6) {
        if (n % i == 0) return false; // (6の倍数)-1
        if (n % (i + 2) == 0) return false; // (6の倍数)+1
    }
    return true;
}

int main(void){
    int n, x = 0, ans = 0;
    string s;
    cin >> n >> s;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'I') x++;
        else x--;
        ans = max(ans, x);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3596
def merge( tS, left, mid, right )
	n1 = mid - left;
	n2 = right - mid;
	tL = [];
	tR = [];
	for i in ( 0 ... n1 )
		tL.push( tS[ left+i ] )
	end
	for i in ( 0 ... n2 )
		tR.push( tS[ mid+i ] )
	end
	
	tL.push( 1000000001 )
	tR.push( 1000000001 )
	i = j = 0
	for k in ( left ... right )
		$cnt += 1
		if tL[i] <= tR[j]
			tS[k] = tL[i]
			i += 1
		else
			tS[k] = tR[j]
			j += 1
		end
	end
end

def mergeSort( tS, left, right )
	if left+1 < right
		mid = ( left+right )/2
		mergeSort( tS, left, mid )
		mergeSort( tS, mid, right )
		merge( tS, left, mid, right )
	end
end

n = gets.to_i
arrS = gets.split( " " ).map { |val| val.to_i }
$cnt = 0
mergeSort( arrS, 0, n )
puts( arrS.join( " " ) )
puts( $cnt )

Measured memory_bytes: 205468
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass : Scanner
{
    static void Main()
    {
        var N = RInt();
        var a = RInts();
        Array.Sort(a);
        Array.Reverse(a);
        int alice = 0;
        int bob = 0;
        for (int i = 0; i < N; i++)
        {
            if (i % 2 == 0) alice += a[i];
            else bob += a[i];
        }
        WriteLine(Abs(alice-bob));
    }
}



class Scanner
{
    public static string RString() => Console.ReadLine();
    public static int RInt() => ReadTuple<int>();
    public static long RLong() => ReadTuple<long>();
    public static double RDouble() => ReadTuple<double>();

    public static string[] RStrings() => Console.ReadLine().Split();
    public static int[] RInts() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
    public static long[] RLongs() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
    public static double[] RDoubles() => Array.ConvertAll(Console.ReadLine().Split(), double.Parse);
    public static int[] RInts(Func<string, int> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static long[] RLongs(Func<string, long> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static double[] RDoubles(Func<string, double> func) => Console.ReadLine().Split().Select(func).ToArray();
    //public static string[] RStrings(Func<string, string> func) => Console.ReadLine().Split().Select(func).ToArray();

    public static T1 ReadTuple<T1>()
    {
        var r = RString();
        var r1 = (T1)Convert.ChangeType(r, typeof(T1));
        return r1;
    }
    public static (T1, T2) ReadTuple<T1, T2>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        return (r1, r2);
    }
    public static (T1, T2, T3) ReadTuple<T1, T2, T3>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[2], typeof(T3));
        return (r1, r2, r3);
    }
    public static (T1, T2, T3, T4) ReadTuple<T1, T2, T3, T4>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[2], typeof(T3));
        var r4 = (T4)Convert.ChangeType(r[3], typeof(T4));
        return (r1, r2, r3, r4);
    }
}


Measured memory_bytes: 27432
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#define INF INT_MAX
using namespace std;
int dx[5]={1,0,-1,0,0},dy[5]={0,1,0,-1,0};
long long gcd(long long a,long long b){if(a%b==0){return b;}else return gcd(b,a%b);}
long long lcm(long long a,long long b){if(a==0){return b;} return a/gcd(a,b)*b;}
#define MOD 1000000007
#define sym cout<<"---------"<<endl;
#define ll long long
#define PL pair<long long, long long>
#define mk make_pair
#define en endl
#define WHITE 1
#define BLACK 2
#define GRAY 1
#define RE return 0
#define int ll
#define P pair<int,int>

set<P> keep;
#define MAX 100005

// 上からfirst,  左からsecond
P blacks[MAX];

map<P,bool> there;
map<P,bool> searched;
int ans[10];

int solve(int H,int W){
  int ret=0;
  for(int i=H; i<H+3; i++){
    for(int j=W; j<W+3; j++){
      if(there[mk(i,j)]) ret++;
    }
  }
  return ret;
}

signed main(){
  int h,w,n;
  cin>>h>>w>>n;
  
  for(int i=0; i<n; i++){
    cin>>blacks[i].first>>blacks[i].second;
    there[blacks[i]]=true;
  }
  
  for(int i=0; i<n; i++){
    for(int j=0; j<3; j++){
      for(int k=0; k<3; k++){
        int H=blacks[i].first-j,W=blacks[i].second-k;
        if(H<=0||H>h||W<=0||W>w||H+2>h||W+2>w) continue;
        if(searched[mk(H,W)]) continue;
        searched[mk(H,W)]=true;
        int s=solve(H, W);
        ans[s]++;
      }
    }
  }
  
  int sum=accumulate(ans, ans+10, 0);
  ans[0]=(h-2)*(w-2)-sum;
  for(int i=0; i<=9; i++){
    cout<<ans[i]<<en;
  }
}



Measured memory_bytes: 214272
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef pair<double,double> PD;
typedef pair<int,P> ed;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int N;
  cin >> N;
  vp a(N);
  rep(i,N) {
    int x;
    cin >> x;
    a[i] = P(x,i);
  }
  sort(rng(a));
  reverse(rng(a));
  vv(ll) dp(N+1,vl(N+1,-INF));
  dp[0][0] = 0;
  rep(i,N) {
    ll act = a[i].first;
    int idx = a[i].second;
    rep(l,i+1) {
      int r=i-l;
      chmax(dp[i+1][l+1],dp[i][l]+act*abs(idx-l));
      chmax(dp[i+1][l],dp[i][l]+act*abs((N-r-1)-idx));
    }
  }
  ll ans = -INF;
  rep(i,N+1) {
    chmax(ans,dp[N][i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 34640
#include<bits/stdc++.h>
using namespace std;
int main(){
   long long int n;
   cin>>n;
  long long  int sum=0;
   for(long long int i=1;i<=n;i++){
       if(n==1){
           cout<<"1";
           return 0;
       }
       else if(n==2){
           cout<<"3";
           return 0;
       }
       else if(i%3!=0 and i%5!=0){
           sum+=i;
       }
   }
   cout<<sum;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>   
using namespace std;
using namespace __gnu_pbds;
typedef long long ll; 
#define int long long
typedef unsigned long long lu;
typedef vector<ll> v;
typedef vector<vector<ll> > vv;
typedef vector<string>  vs;
typedef vector<pair<ll,ll>> vpr;
typedef vector<bool>vb;
typedef vector<double>vd;
typedef long double ld;
#define f(i,n) for(ll i = 0; i < n; i++)
#define ff(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define endl "\n"
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define amax(x,y) if(y>x) x=y;
#define amin(x,y) if(y<x)x=y;
#define bg(x) x.begin()
#define sz(x) (ll)x.size()
#define in(x,n) for(ll i=0;i<n;i++)cin>>x[i]
#define out(x,n) for(ll i=0;i<n;i++)cout<<x[i]<<" " 
#define mxt(a) *(max_element(a.begin(),a.end()))
#define mnt(a) *(min_element(a.begin(),a.end())
#define tc ll t;cin>>t;while(t--)
typedef pair<ll,ll> pi;
#define yes cout<<"YES\n";
#define no cout<<"NO\n";
#define yesno(f) if(f) yes else no
const v dx = {1, -1, 0, 0};
const v dy = {0, 0, 1, -1};
const ld PI = 2 * acos(0.0);
ll cel(ll x1,ll y1){if((x1%y1)==0)return x1/y1;else return x1/y1+1;}
ll power(ll a,ll b,ll m)
{
    if(b==0)
        return 1;
    ll d=power(a,b/2,m);
    d=(d*d)%m;
    if(b&1)
        d=(d*a)%m;
    return d;
}
const ll mod=1e9+7;
int MOD(int a)
{
    if(a<0)
        a+=mod;
    if(a>=mod)
        a%=mod;
    return a;
}
// set_name.find_by_order(k) It returns to an iterator to the kth element (counting from zero) in the set in O(logn) time
// set_name.order_of_key(k) It returns to the number of items that are strictly smaller than our item k in O(logn) time.
/*string operations :
str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
str.substr (x) : returns a substring str[x],... end of string
str.find(qtr) : returns the first occurenece of qtr in str */
int32_t main()
{
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    int n;cin>>n;
    v x(n),y(n);
    f(i,n)
    {
        cin>>x[i]>>y[i];
    }
    int fans=0;
    for(int i=-1;i<=1;i+=2)
    {
        for(int j=-1;j<=1;j+=2)
        {
            v arr;
            for(int k=0;k<n;k++)
            {
                arr.pb(x[k]*i+y[k]*j);
            }
            int ans=*max_element(all(arr))-*min_element(all(arr));
            fans=max(ans,fans);
        }
    }
    cout<<fans<<endl;
    return 0;
}

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

int main(){
    int h,w;
    cin >> h >> w;
    int index_h[h]={};
    int index_w[w]={};
    //配列入力&横が全て.のindexを取得
    char a[h][w]={};
    for(int i=0;i<h;i++){
        int count = 0;
        for(int j=0;j<w;j++){
            cin >> a[i][j];
            if(a[i][j]=='.')count++;
        }
        if(count==w){
            index_h[i]++;
        }
    }
    //縦が全て.のindexを取得
    for(int j=0;j<w;j++){
        int count = 0;
        for(int i=0;i<h;i++){
            if(a[i][j]=='.')count++;
        }
        if(count==h){
            index_w[j]++;
        }
    }
    //出力
    for(int i=0;i<h;i++){
        bool flag = false;
        for(int j=0;j<w;j++){
            if(index_h[i]==0 && index_w[j]==0){
                cout << a[i][j];
                flag = true;
            }
        }
        if(flag) cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
//C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#define rp(i,a,b) for(int (i)=(int)(a);i<(int)(b);++i)

using namespace std;

typedef long long ll;
typedef pair<int,int> P;



int d[10][10];
int V=10;
int INF=10000;
//d[i][i]==0;no path==INF;
void warshall_floyd(){
    for(int k=0;k<V;k++)
        for(int i=0;i<V;i++)
            for(int j=0;j<V;j++) d[i][j]= min(d[i][j],d[i][k] + d[k][j]);
}


int main(){
    while(1){
        int n;
        cin>>n;
        if(n==0) break;
        rp(i,0,10){
            rp(j,0,10) {
                d[i][j]=INF;
                if(i==j) d[i][j]=0;
            }
        }
        rp(i,0,n) {
            int x,y,z;
            cin>>x>>y>>z;
            d[x][y]=z;
            d[y][x]=z;
        }
        warshall_floyd();
        int sum=0,ans=-1,pos=-1;
        rp(i,0,10){
            sum=0;
            rp(j,0,10){
                //cout<<d[i][j]<<" ";
                if(i==j) continue;
                if(d[i][j]!=INF) sum+=d[i][j];
            }
            //cout<<sum<<endl;
            if(ans==-1) {ans=sum;pos=i;}
            else if(sum!=0 and sum<ans){ans=sum;pos=i;}
        }
        cout<<pos<<" "<<ans<<endl;


    }
    return 0;
};

Measured memory_bytes: 3048
import math

def combinations(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n, k = map(int, input().split())
for i in range(k):
    if n-k+1 < i+1:
        print(0)
        continue
    if i == 0 or i == k-1:
        print(combinations((n - k + 1), i+1) % (10 ** 9 + 7))
    else:
        print(combinations((n - k + 1), i+1) * combinations(k-1, i) % (10 ** 9 + 7))

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

// Common file
#include <ext/pb_ds/assoc_container.hpp>
// Including tree_order_statistics_node_update
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>



#define pb push_back
#define F first
#define S second
#define rep(i,n) for(int i = 0; i < (n); i++)

using ll = long long;
using ld = long double;
using ul = unsigned long long;
using ii = pair<int, int>;
#define Mosta     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ReadFile            freopen("input.in","r",stdin)
#define WriteFile           freopen("output.txt","w",stdout)
const ll mod7 = 1000000007,mod = 1000000000,OO = 0x3f3f3f3f;
const ld EPS = 1e-7;
double Pi=acos(-1);
const ld rad=Pi/180.0;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
            y = y>>1;
            x = (x*x) % p;
    }
    return res;
}
ll nCr (ll n,ll m)
{
    return(m == 0)?1:n*nCr(n-1,m-1)/m;
}

/*****************************************************/

const int N = 1e4 + 5;
int a[N] , n;

int main()
{
    cin >> n;

    memset(a , 0 , sizeof a);

    for(int x = 1; x <= 100; ++x)
        for(int y = 1; y <= 100; ++y)
            for(int z = 1; z <= 100; ++z) {
                ll f = x*x + y*y + z*z + x*y + x*z + y*z;
                if(f <= 10000)
                    a[f]++;
            }

    for(int i = 1; i <= n; ++i)
        cout << a[i] << "\n";

    return 0;
}


Measured memory_bytes: 3612
# -*- config: utg-8 -*-

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

k = i[0]
x = i[1]

num_list = list(range(x-k+1, x+k, 1))
new_list = [e for e in num_list if -1000000 <= e <= 1000000]
lite_new_list = map(str, new_list)

print(' '.join(lite_new_list))

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

using namespace std;

#define ll long long
#define ld long double
#define pll pair <ll , ll>

#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mp make_pair

#define X first
#define Y second

#define LB(x) ((x) & -(x))
#define BIT(a , b) (((a)>>(b)) & 1)

const ll MAXN=1e5+10;

struct segment
{
    ll l , r , sign;
};

segment z[MAXN];
segment ps[MAXN];
segment res[MAXN];

ll a[MAXN];
ll x[MAXN];
ll ans[MAXN];

ll n;

segment merge_segment(segment b , segment c)
{
    segment res;

    if (b.sign==c.sign)
    {
        res.sign=b.sign;
        res.l=min(b.l , c.l);
        res.r=max(b.r , c.r);
    }
    else
    {
        if ((b.r-b.l+1)<(c.r-c.l+1))
        {
            swap(b , c);
        }

        res.sign=b.sign;

        if (b.l==c.l)
        {
            res.l=c.r+1;
        }
        else
        {
            res.l=b.l;
        }

        if (b.r==c.r)
        {
            res.r=c.l-1;
        }
        else
        {
            res.r=b.r;
        }
    }

    return res;
}

void perform(segment b[MAXN] , segment c[MAXN])
{
    ps[0].l=0;
    ps[0].r=0;
    ps[0].sign=1;

    for(ll i=1;i<=n;i++)
    {
        ps[i]=merge_segment(ps[i-1] , c[i]);
    }

    for(ll i=1;i<=n;i++)
    {
        ll l=b[i].l , r=b[i].r , sign=b[i].sign;
        ps[l-1].sign=-ps[l-1].sign;
        b[i]=merge_segment(ps[r] , ps[l-1]);
        ps[l-1].sign=-ps[l-1].sign;

        if (sign==-1)
        {
            b[i].sign=-b[i].sign;
        }
    }
}

void pw(ll k)
{
    if (k==0)
    {
        return;
    }

    pw(k/2);
    perform(res , res);

    if (k&1)
    {
        perform(res , z);
    }
}

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

	cin>>n;

	for(ll i=1;i<=n;i++)
    {
        cin>>x[i];
    }

    ll m , k;
    cin>>m>>k;

    for(ll i=1;i<=m;i++)
    {
        cin>>a[i];
    }

    for(ll i=1;i<=n;i++)
    {
        z[i].l=i;
        z[i].r=i;
        z[i].sign=1;
    }

    for(ll i=m;i>=1;i--)
    {
        z[a[i]-1]=merge_segment(z[a[i]-1] , z[a[i]]);
        z[a[i]+1]=merge_segment(z[a[i]+1] , z[a[i]]);
        z[a[i]].sign=-z[a[i]].sign;
    }

    for(ll i=1;i<=n;i++)
    {
        res[i].l=i;
        res[i].r=i;
        res[i].sign=1;
    }

    pw(k);

    for(ll i=1;i<=n;i++)
    {
        ans[res[i].l]+=res[i].sign*x[i];
        ans[res[i].r+1]-=res[i].sign*x[i];
    }

    for(ll i=1;i<=n;i++)
    {
        ans[i]+=ans[i-1];
        cout<<ans[i]<<endl;
    }
}

/*
5
1 1 1 1 1
3 1
2 3 4
*/


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

using namespace std;

typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<llint, llint> pll;
typedef vector<int> vi;
typedef vector<llint> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define ci cin
#define co cout
#define en endl
#define ln cout<< '\n'
#define rep(i, n) for(int i = 0; i < n; i++)
#define outl(x) cout<< (x) << '\n'
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007

template<typename Tn> Tn gcd(Tn a, Tn b)
{
    return (b ? gcd(b, a % b) : a);
}

template<typename Tn> Tn lcm(Tn a, Tn b)
{
    return a / gcd(a, b) * b;
}

string IntToString(int number)
{
    stringstream ss;
    ss << number;
    return ss.str();
}

int n;
llint memo[101][5][5][5];

llint dfs(int idx, int a, int b, int c)
{
    if(idx == n) return 1;
    if(memo[idx][a][b][c] != -1) return memo[idx][a][b][c];

    llint rec = 0;

    rec += dfs(idx + 1, b, c, 1);
    if(!(b == 1 && c == 3)) rec += dfs(idx + 1, b, c, 2);
    if(!(b == 1 && c == 2) &&
       !(b == 2 && c == 1) &&
       !(a == 1 && c == 2) &&
       !(a == 1 && b == 2)) rec += dfs(idx + 1, b, c, 3);
    rec += dfs(idx + 1, b, c, 4);

    return memo[idx][a][b][c] = rec % MOD;
}

int main()
{
    ci >> n;
    memset(memo, -1, sizeof(memo));
    co << dfs(0, 0, 0, 0) << en;
    return 0;
}


Measured memory_bytes: 384
//  Copyright © 2020 Diego Garcia Rodriguez del Campo. All rights reserved.
#include<bits/stdc++.h>
#define MAX 200005
#define optimiza_io cin.tie(0); ios_base::sync_with_stdio(0);
#define what_is(x) cerr << #x << " is " << x << endl;
#define pii pair < ll , ll >
#define fi first
#define se second
using namespace std;
typedef long long ll;

const ll INF = 1e18;
ll N, D, T;
map<ll, ll> mp;
ll m[3]{2,3,5};
ll p[3];

ll dp(ll x){
    if(x <= 1)
        return x * D;
    if(mp[x])
        return mp[x];
    
    ll ans = INF;
    if(x<=INF/D) ans = D*x;
    for(ll i = 0; i < 3; i ++){
        ll tms = x / m[i];
        ll fst = tms * m[i];
        ll snd = fst + m[i];
        ans = min(ans, dp(fst / m[i]) + p[i] + abs(fst - x) * D);
        if(x % m[i])
            ans = min(ans, dp(snd / m[i]) + p[i] + abs(snd - x) * D);
    } 
    return mp[x] = ans;
}

int main()
{
    optimiza_io
    cin >> T;
    while(T --){
        cin >> N >> p[0] >> p[1] >> p[2] >> D;
        mp.clear();
        cout << dp(N) << "\n";
    }
    return 0;
}

// CHECAR LIMITES 


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

vector <long long> A, B, C;
set <pair <long long, tuple <int, int, int>>> S, US;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int X, Y, Z, K;
	cin >> X >> Y >> Z >> K;
	A.resize(X);
	B.resize(Y);
	C.resize(Z);
	for (int i = 0; i < X; i++){
		cin >> A[i];
	}
	for (int i = 0; i < Y; i++){
		cin >> B[i];
	}
	for (int i = 0; i < Z; i++){
		cin >> C[i];
	}
	sort(A.begin(), A.end());
	sort(B.begin(), B.end());
	sort(C.begin(), C.end());
	reverse(A.begin(), A.end());
	reverse(B.begin(), B.end());
	reverse(C.begin(), C.end());
	S.insert(make_pair(A[0] + B[0] + C[0], make_tuple(0, 0, 0)));
	for (int i = 0; i < K; i++){
		pair <long long, tuple <int, int, int>> P = *(S.rbegin());
		cout << P.first << '\n';
		S.erase(S.find(P));
		US.insert(P);
		int a = get<0>(P.second);
		int b = get<1>(P.second);
		int c = get<2>(P.second);
		if (a + 1 < X){
			pair <long long, tuple <int, int, int>> T = make_pair(A[a + 1] + B[b] + C[c], make_tuple(a + 1, b, c));
			if (!US.count(T))
				S.insert(T);
		}
		if (b + 1 < Y){
			pair <long long, tuple <int, int, int>> T = make_pair(A[a] + B[b + 1] + C[c], make_tuple(a, b + 1, c));
			if (!US.count(T))
				S.insert(T);
		}
		if (c + 1 < Z){
			pair <long long, tuple <int, int, int>> T = make_pair(A[a] + B[b] + C[c + 1], make_tuple(a, b, c + 1));
			if (!US.count(T))
				S.insert(T);
		}
	}
}

Measured memory_bytes: 768
N = int(input())
ab = []
for i in range(N):
    ab.append(tuple(map(int,input().split())))
 
up = sorted(ab,key=lambda a:a[1],reverse=True)
down = sorted(ab,key=lambda a:a[0],reverse=True)
 
if N%2 == 1:
    print(up[N//2][1]-down[N//2][0]+1)
else:
    r = (up[N//2][1]+up[N//2-1][1])
    l = (down[N//2][0]+down[N//2-1][0])
    print(r-l+1)

Measured memory_bytes: 42188
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define base 31
#define MOD 1e9+7
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FORs(i, a, b) for(int i = a; i >= b; i--)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define __FOR(i, a, b, k) for(int i = a; i <= b; i+= k)
#define __REP(i, a, b, k) for(int i = a; i < b; i+= k)
#define pb push_back
#define _io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;

typedef pair <int, int> ii;
typedef vector <ii> vii;
#define fi first
#define se second
#define mp make_pair
#define PROB "text"
#define MAXN 200005
int n,d,v[1000][1000];
void input(){
		cin>>n>>d;
		FOR(i,1,n){
			FOR(j,1,d){
				cin>>v[i][j];
			}
		}
}
int cal(int x, int y){
	return pow(abs(x-y),2);
}
void process(){
	int dit=0;
	FOR(i,1,n){
		FOR(j,i+1,n){
			int sum=0;
			FOR(x,1,d){
				int res=cal(v[i][x],v[j][x]);
				sum+=res;
			}
			int cc=(int)sqrt(sum);
			if(cc*cc==sum){
				dit++;
//cout<<i<<" "<<j<<" "<<sum<<"\n";
			}
		}
	}
	cout<<dit;
}
int main(){
		_io;
		
		input();
		process();
		//cout<<pow(int(sqrt(25)),2);
}



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

int main(int argc, char const *argv[])
{
    string a;
    cin >> a;
    if (a == "ABC")
    {
        cout << "ARC" << endl;
    }
    else
    {
        cout << "ABC" << endl;
    }
    return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<list>
#include<bitset>

#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000

using namespace std;


int main(void) {
	int n;
	int a[20];
	int dp = 0;
	int ki = 0;
	int gu = 0;

	cin >> n;
	FOR(i, 1, n) {
		cin >> a[i];
		if (a[i] % 2 == 0) {
			gu++;
		}
		else {
			ki++;
		}
	}
		cout << pow(3, n) - pow(2, gu) << endl;
	

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>

int main(){
  int n;
  int debt = 100000;
  
  std::cin >> n;
  for(int i=0; i<n; i++){
    debt = round((double)debt * 1.05);
    int under = debt % 1000;
    if(under==0){}
    else{
      debt = debt - under + 1000;
    }
  }
  std::cout << debt << std::endl;
  
  return 0;
}

Measured memory_bytes: 3112
import java.util.Scanner;
import java.util.ArrayList;
import java.util.HashSet;
import java.lang.Integer;
import java.lang.StringBuilder;
import java.lang.Math;

public class Main {

    public static int calc(int max, int target) {
        int cnt = 0;
        for (int i = 0; i <= max; i++) {
            for (int j = 0; j <= max; j++) {
                int sum = i + j;
                int k = target - sum;
                if (k <= max && k >= 0) {
                    //System.out.println(i + "," + j + "," + (target - sum));
                    cnt++;
                }
            }
        }
        return cnt;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int K = in.nextInt();
        int S = in.nextInt();

        int result = calc(K, S);
        System.out.println(result);
    }
}

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

long long cnv_4to10(int src)
{
    static long long xx[4] = { 0, 3, 5, 7 };
    long long ret = 0;
    long long p = 1;
    while (src > 0)
    {
        int index = (src & 3);
        ret += xx[index] * p;
        p *= 10;
        src >>= 2;
    }
    return ret;
}

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

    int num = 0;
    int x = 0x1b;
    for (; ; x++)
    {
        long long z = cnv_4to10(x);
        if (z > n)
        {
            break;
        }
        int flag = 0;
        int xx = x;
        for (; xx > 0; xx >>= 2)
        {
            int xxx = xx & 3;
            if (xxx > 0)
            {
                flag |= (1 << (xxx - 1));
            }
            else
            {
                flag = 0;
                break;
            }
        }
        if (flag == 7)
        {
            num++;
        }
    }

    cout << num << endl;
    return 0;
}

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

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

    char c;
    for(int i = 0; i < n; i++){
        cin >> c;
        if(c == 'Y'){
            cout << "Four" << endl;
            return 0;
        }
    }

    cout << "Three" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
#define rreps(i, n) for(int i=((int)(n)); i>0; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pl(s) cout << (s) << "\n";
#define pls(...) {bool space = false; for(auto i : __VA_ARGS__) (cout << (space?" ":"") << i), space = true; cout << "\n";}
#define plexit(s) {cout << (s) << "\n"; exit(0);}
#define yes(s) cout << ((s)?"Yes":"No") << "\n";
#ifdef __LOCAL
#include <dump.hpp>
#define dump(...) DUMPOUT << "  " << string(#__VA_ARGS__) << ": " << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl << "    ", dump_func(__VA_ARGS__)
#else
#define dump(...)
#endif
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
struct IOInit { IOInit() { cin.tie(nullptr); ios::sync_with_stdio(false); dump("READY"); /*cout << unitbuf;*/} } IO_INIT;
using ll = long long; using ull = unsigned long long; using ld = long double;
template<typename T = int> using V = vector<T>; template<typename T = int> using P = pair<T, T>;
using Vi = V<int>; using Vl = V<ll>; using Vd = V<ld>; using VVi = V<Vi>; using VVl = V<Vl>; using Pi = P<int>; using Pl = P<ll>; using Pd = P<ld>;
constexpr ll MOD = 1000000007; constexpr int INF = (1 << 30) - 1; constexpr ll INFL = 1LL << 60; constexpr ld EPS = 1e-12; constexpr ld PI = 3.141592653589793238462643383279;



signed main(void) {
  int t; cin >> t;
  rep(i,t) {
    ll n, m, a, b; cin >> n >> m >> a >> b;
    pl(floor_sum(n, m, a, b));
  }
  return 0;
}


Measured memory_bytes: 3708
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

Int n, l;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n >> l;
	Int ans = 0;
	for(Int i=0; i<n; ++i) ans += l+i;
	if(l >= 0){
		cout << ans - l << "\n";
	}else if(l+n-1 >= 0){
		cout << ans << "\n";
	}else{
		cout << ans - (l+n-1) << "\n";
	}
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int main()
{
    int a,b,c,d,e,f;
    double l,k;
    while (scanf ("%d %d %d %d %d %d", &a,&b,&c,&d,&e,&f) != EOF){
        l= a*e-d*b;
        k = b*d - a*e;
        double x = (c*e-b*f)/l;
        double y =(c*d - a*f)/k;

        if(x ==0)
            x = abs(x);
        if(y == 0)
            y = abs(y);

        printf("%.3lf %.3lf\n",x,y);
    }
    return 0;
}

Measured memory_bytes: 1064
import math
import sys
N = input()
i = list(map(int, input().split()))
result = 1
if 0 in i:
  print(0)
  sys.exit()
for x in i:
  result *= x
#  if(len(str(result)) >= 19):
  if(result > 10**18):
    print(-1)
    sys.exit()
print(result)


Measured memory_bytes: 22248
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def gcd(x, y):
    """greatest common divisor of x and y"""
    while y:
        x, y = y, x % y
    return x


def main():
    a, b = map(int, input().split())

    print((a * b) // gcd(a, b))


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


Measured memory_bytes: 29292
var
  a, f, h, tmp: array [0..100000] of longint;
  u, v: array [1..200000] of longint;
  n, m, i, x, y, s, rt, re, cnt: longint;
procedure swap(var x, y: longint); inline;
var
  t: longint;
begin
  t := x;
  x := y;
  y := t;
end;
function find(x: longint): longint;
begin
  if x <> f[x] then f[x] := find(f[x]);
  exit(f[x]);
end;
procedure add(x, y: longint); inline;
begin
  inc(cnt);
  u[cnt] := h[x];
  v[cnt] := y;
  h[x] := cnt;
end;
procedure dfs(x, s: longint);
var
  i: longint;
begin
  a[x] := s;
  i := h[x];
  while i > 0 do
  begin
    if v[i] <> f[x] then
    begin
      f[v[i]] := x;
      dfs(v[i], -s);
      inc(a[x], a[v[i]]);
    end;
    i := u[i];
  end;
end;
procedure quicksort(l, r: longint);
var
  i, j, m: longint;
begin
  i := l;
  j := r;
  m := tmp[(l + r) shr 1];
  repeat
    while tmp[i] < m do inc(i);
    while tmp[j] > m do dec(j);
    if i <= j then
    begin
      swap(tmp[i], tmp[j]);
      inc(i);
      dec(j);
    end;
  until i > j;
  if l < j then quicksort(l, j);
  if i < r then quicksort(i, r);
end;
begin
  read(n, m);
  for i := 1 to n do f[i] := i;
  cnt := 0;
  rt := 1;
  re := 1;
  for i := 1 to m do
  begin
    read(x, y);
    if find(x) <> find(y) then
    begin
      f[find(x)] := find(y);
      add(x, y);
      add(y, x);
    end
    else
    begin
      rt := x;
      re := y;
    end;
  end;
  f[rt] := 0;
  dfs(rt, 1);
  if n = m then
  begin
    cnt := 0;
    i := re;
    while i > 0 do
    begin
      inc(cnt);
      tmp[cnt] := a[i];
      i := f[i];
    end;
    if odd(cnt) then
    begin
      if odd(a[rt]) then
      begin
        writeln(-1);
        halt;
      end;
      i := re;
      while i > 0 do
      begin
        dec(a[i], a[rt] div 2);
        i := f[i];
      end;
    end
    else
    begin
      if a[rt] <> 0 then
      begin
        writeln('-1');
        halt;
      end;
      quicksort(1, cnt);
      i := re;
      while i > 0 do
      begin
        dec(a[i], tmp[cnt shr 1]);
        i := f[i];
      end;
    end;
  end
  else
    if a[rt] <> 0 then
    begin
      writeln(-1);
      halt;
    end;
  s := 0;
  for i := 1 to n do inc(s, abs(a[i]));
  writeln(s);
end.


Measured memory_bytes: 6400
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<int> vec(3);
  for(int i=0;i<3;i++){
    cin>>vec.at(i);
  }
  sort(vec.begin(),vec.end());
  int K;
  cin>>K;
  for(int i=0;i<K;i++){
    vec.at(2)*=2;
  }
  int ans = 0;
  for(int i=0;i<3;i++){
    ans+=vec.at(i);
  }
  cout<<ans<<endl;
  return 0;
}
  

Measured memory_bytes: 256