akhauriyash/Code-Regression huggingface dataset:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

from collections import deque

a = deque(sorted(a, reverse=True))
ans = 0
first = a.popleft()
second = a.popleft()
ans += first
max_comfort = second
while True:
    if len(a) == 0:
        break
    ans += max_comfort
    a.pop()
    if len(a) == 0:
        break
    ans += max_comfort
    max_comfort = a.popleft()
print(ans)


Measured memory_bytes: 94828
#include<cstdio>
#include<iostream>
#include<algorithm>

#define MAX_N 200000

using namespace std;

int R[MAX_N + 5];

int main()
{
    int n, i, minVal, maxVal;
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%d", &R[i]);
    }

    minVal = R[0];
    maxVal = R[1] - R[0];
    for (i = 1; i < n; i++) {
        maxVal = max(maxVal, R[i] - minVal);
        minVal = min(minVal, R[i]);
    }
    printf("%d\n", maxVal);

    return 0;
}

Measured memory_bytes: 3972
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

N = int(input())
aa = [int(input()) for i in range(N)]

ans = aa[0]//2
aa[0] %= 2
for i in range(1,N):
    if aa[i-1] > 0 and aa[i] > 0:
        aa[i-1] -= 1
        aa[i] -= 1
        ans += 1
    ans += aa[i]//2
    aa[i] %= 2
    
print(ans)


Measured memory_bytes: 8484
#include<bits/stdc++.h>
#define _USE_MATH_DEFINES
using namespace std;
    
#define ll long long int
#define pb push_back
#define rep(i , j , n) for(ll i = j ; i < n ; i++)
#define pre(i , j , n) for(ll i = j ; i >= n ; i--)
#define all(x) x.begin(), x.end()
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vll;
typedef vector<char>	vc;
typedef vector<bool>	vb;
typedef pair<ll,ll> 	pll;
#define br "\n"
#define ff first
#define ss second
#define MAXIM 1000003

ll mod = 1e9 + 7;
vll fact(MAXIM),inv_fact(MAXIM);

ll bin_exp(ll a, ll b){
    a = a % mod;
    ll ans = 1;
    while(b > 0){
        if(b & 1 == 1) ans = (a * ans) % mod;
        a = (a * a) % mod;
        b = b >> 1; 
    }
    return ans;
}

ll mod_inv(ll n){
    ll a = bin_exp(n,mod - 2);
    return a;
}

void calc(){
    fact[0] = 1;
    inv_fact[0] = 1;
    rep(i,1,MAXIM){
        fact[i] = (fact[i - 1]*i)%mod;
        inv_fact[i] = (inv_fact[i - 1] * mod_inv(i)) % mod;
    }

}

ll nCr(ll n, ll r){
    ll ans = (fact[n] * ((inv_fact[n - r]*inv_fact[r]) % mod)) % mod;
    return ans;
}



void solve(){
    ll n;
    cin >> n;
    if(n == 1){ 
        cout << 0;
        return;
    }
    ll ans=(bin_exp(10,n) - bin_exp(8,n) + mod) % mod;
    // cout << ans << " ";
    ll temp=0;
    rep(i,1,n + 1){
        (temp += (nCr(n,i) * bin_exp(8,n - i))) %= mod;
        // cout << temp << " ";
    }
    (temp *= 2) %= mod;
    // cout << temp << " ";
    cout << (ans - temp + mod) % mod;
}
	

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif 

	ll t = 1;
    calc();
	// cin >> t;
	rep(i,0,t){
		solve();
	}
 
}	

Measured memory_bytes: 18644
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc  = new Scanner(System.in);
		//入力した文字列をcharにして格納
		char[] a = sc.next().toCharArray();
		int n = a.length;
		
		//回答を入れる箱
		String ans = "";
		
		//ケース分け
		for(int i = 0 ; i < n ; i++){
			switch(a[i]){
				case '0' :
					ans = ans + "0";
					break;
				case '1' :
					ans = ans + "1";
					break;
				case 'B' :
					if(ans.length() != 0){
						ans = ans.substring(0,ans.length()-1);
						break;
					} else {
					break;
					}
			}
		}
			
		//結果の出力
		System.out.println(ans);
	}

}

Measured memory_bytes: 9300
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <regex>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End


/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

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

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template


signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    Cinii(N,K);
    vector<int> p(N);
    rep(i,N) cin >> p[i];
    sort(All(p));
    int ans = 0;
    rep(i,K) ans+=p[i];
    cout << ans << nn;
    return 0;
}

Measured memory_bytes: 3144
#include <cstdio>

int main() {
  int N;
  scanf("%d", &N);

  char s[8];

  puts("0");
  fflush(stdout);

  scanf("%s", s);
  if (*s == 'V') return 0;  

  int lb=0, ub=N;
  while (ub-lb > 1) {
    int mid=(lb+ub)>>1;
    printf("%d\n", mid);
    fflush(stdout);

    char t[8];
    scanf("%s", t);
    if (*t == 'V') return 0;
    ((mid&1)^(*s==*t)? lb:ub) = mid;
  }
}


Measured memory_bytes: 760
#include <bits/stdc++.h>
using namespace std;
#define ff        first
#define ss        second
#define ll        long long
#define int       long long
#define inf       ((ll)1e18)
#define mod       1000000007
#define double    long double
#define ull       unsigned long long
#define vi        vector<ll>
#define ppi       pair<int,int>
#define pii       pair<pair<int,int>,int>
#define pb        push_back
#define pi        2*acos(0.0)
#define rev       greater<int>()
#define pr(a,x,y) for(int i=x;i<y;i++){cout<<a[i]<<" ";}
#define ps(s)     for(auto i:s){cout<<i<<" ";}
#define sp(x,y)   fixed<<setprecision(y)<<x
#define w(x)      ll x; cin>>x; while(x--)
#define all(v)    v.begin(), v.end()
#define rall(v)   v.rbegin(), v.rend()
#define test      cout<<"This is test"<<endl;
#define str       string
#define endl      '\n'
#define e         cout<<'\n';
void kehsihba(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	/*#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif*/
}
void solve(){
	ll n,m;
	cin>>n>>m;
	str s(n,'$');
	for(int i=0;i<m;i++){
		ll a,b;cin>>a>>b;
		if(s[a-1]=='$'){s[a-1]=(b+'0');}
		else if((b+'0')!=s[a-1]){cout<<-1;return;}
	}
	for(int i=0;i<n;i++){
		if(i==0 and s[i]=='$' and n!=1){s[i]='1';}
		else if(s[i]=='$'){s[i]='0';}
	}
	if(n==1){
		cout<<s;return;
	}
	cout<<((s[0]=='0')?to_string(-1):s);
}
int32_t main(){
	kehsihba();
	//init();
	ll t=1;
	//cin>>t;
	for(int k=1;k<=t;k++){
		//cout<<"Case "<<k<<": ";
		solve();
		//e;
	}
}


Measured memory_bytes: 3664
#include <iostream>
#include <string>
#include <stack>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <stdlib.h>
#include <tuple>
#include <iomanip>
#include <iterator>
#include <stdio.h>
#include <fstream>
#include <time.h>
using namespace std;
const double PI = 3.14159265358979323846;
const long long int MOD = 1000000000 + 7;

struct UnionFind {
    vector<int> parent;

    UnionFind(int N) : parent(N) {
        for (int i = 0; i < N; i++) {
            parent[i] = -1;
        }
    }

    int root(int i) {
        if (parent[i] < 0) {
            return i;
        }
        return (parent[i] = root(parent[i]));
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx != ry) {
            parent[ry] += parent[rx];
            parent[rx] = ry;
        }
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }

    int treeSize(int x) {
        

        return -parent[root(x)];
    }
};

long long int modpow(long long int base, long long int pow, long long int mod) {
    if (pow == 1) {
        return base;
    }
    else if (pow == 0) {
        return 1;
    }

    if (pow % 2 == 0) {
        auto temp = modpow(base, pow / 2, mod);
        return (temp * temp) % mod;
    }
    else {
        return base * modpow(base, pow - 1, mod) % mod;
    }
}

long long int moddiv(long long int X, long long int Y, long long int mod) {
    auto fermatDiv = modpow(Y, mod - 2, mod);

    return (X * fermatDiv) % mod;
}



int main() {
    string s;
    cin >> s;

    auto c_str = s.c_str();
    string output = "";;

    int length = s.length();

    for (int i = 0; i < length; i++) {
        if (c_str[i] == '?') {
            output += "D";
        }
        else {
            output += c_str[i];
        }
    }

    cout << output << endl;
    return 0;
}

Measured memory_bytes: 3856
import sys
from collections import Counter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n=int(input())
d,x=mp()
for i in range(n):
    a=int(input())
    x+=(d-1)//a+1
print(x)

Measured memory_bytes: 3316
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

template <class T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
	for (const auto& e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}
template <class T>
ostream& operator<<(ostream& os, const set<T>& st) {
	for (const auto& e : st) os << e << " ";
	return os;
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const map<T1, T2>& mp) {
	for (const auto& e : mp) os << e << " ";
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T&& h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head&& h, Tail&&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif
int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N;
	cin >> N;

	vector<vector<pair<Int, Int>>> xy(N);
	vector<Int> A(N);
	Int x, y;
	for (Int i = 0; i < N; i++) {
		cin >> A[i];
		for (Int j = 0; j < A[i]; j++) {
			cin >> x >> y;
			x--;
			y;
			xy[i].push_back(make_pair(x, y));
		}
	}

	DMP(xy);

	Int ans = 0;
	Int cnt;
	Int flag;
	vector<Int> temp(N);
	for (Int i = 0; i < (1LL<<N); i++) {//誰が正直者かを全探索
		cnt = 0;
		for (Int j = 0; j < N; j++) {//1なら正直者
			if (i&(1LL<<j)) {
				temp[j] = 1;
				cnt++;
			}
			else {
				temp[j] = 0;
			}
		}

		flag = 0;//嘘つきがいると1
		for (Int m = 0; m < N; m++) {
			if (i & (1LL << m) ){//正直者の場合
				for (Int n = 0; n < A[m]; n++) {
					x = xy[m][n].first;
					y = xy[m][n].second;
					if (temp[x]==1&&y==0) {
						flag = 1;
						break;
					}
					if (temp[x] == 0 && y == 1) {
						flag = 1;
						break;
					}
				}
				if (flag)break;
			}
			else {//嘘つきの場合
			/*	for (Int n = 0; n < A[m]; n++) {
					x = xy[m][n].first;
					y = xy[m][n].second;
					if (temp[x] == 1 && y == 1) {
						flag = 1;
						break;
					}
					if (temp[x] == 0 && y == 0) {
						flag = 1;
						break;
					}
				}
				if (flag)break;*/
				continue;
			}
		}

		if (flag) {
			continue;
		}
		else {
			ans = max(ans, cnt);
		}
	}
	cout << ans << "\n";

}


Measured memory_bytes: 256
N, Q = map(int, input().split())
S = input()
l = []
r = []
for q in range(Q):
    a,b = map(int, input().split())
    l.append(a)
    r.append(b)

s = [0, 0]
for j in range(1, N):
    if S[j-1]=='A' and S[j]=='C':
        s.append(s[-1]+1)
    else:
        s.append(s[-1])

for q in range(Q):
    print(s[r[q]] - s[l[q]])

Measured memory_bytes: 19400
#include <iostream>
#include <string>
#include <vector>
#include <stdlib.h>
#include <cstdint>
using namespace std;

#define N 4

char s[N];

int main()
{
	int ans = 0;

	cin >> s;

	for( int i = 0; i < N; i++ ) {
		if( s[i] == '+' ) {
			ans++;
		}
		else {
			ans--;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);

    String a = sc.next();
    String b = sc.next();
    String c = sc.next();

    System.out.println(a.substring(0,1) + b.substring(0,1) + c.substring(0,1));
  }
}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  ll n; cin >> n;
  ll a[n]; REP(i,n) cin >> a[i];
  sort(a,a+n,greater<ll>());

  ll x=0;
  REP(i,n-1) {
    if (a[i] == a[i+1]) {
      if (x > 0) { cout << x * a[i] << endl; return 0; }
      x = a[i];
      i++;
    }
  }
  cout << 0 << endl;
}

Measured memory_bytes: 1024
/*
How to lambda
  ex) sort(ALL(cont),[](dat a,dat b){return a.l<b.l;});
lower_bound/upper_bound of 2
  1 2 2 2 3 3 
    ^lb   ^ub */
#include <stdio.h>
#define BR "\n"
#define REP(i,n) for(int (i)=0;(i)<(n);++(i))
#define ALL(cont) begin(cont),end(cont)
#define AS_MOD(a,b) ((((a) % (b) ) + (b)) % (b))
#define FEACH(it,cont) for(auto (it) = begin(cont); it!=end(cont);++it)
#define FEACHR(it,cont) for(auto (it) = rbegin(cont); it!=rend(cont);++it)
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define prl(P) printf("%lld", P)
#define prd(P) printf("%.10Lf", P)
#define pr(P) printf(P)
#define assign_if_greater(V, T) V=max(V,T)
typedef long long ll;
typedef long double ld;
int A,B,Q;
ll As[100000];
ll Bs[100000];
ll INF=(ll)1000*1000*1000*1000;
ll min(ll a, ll b) {
  return a>b? b:a;
}
ll abs(ll a) {
  return a>0?a:-a;
}
ll* lower_bound(ll* a, ll* b, ll v){
  while(b>a+1) {
    ll* m=a+(b-a)/2;
    if(*m >= v) {
      b=m;
    } else {
      a=m;
    }
  }
  return b;
}
ll fastGet() {
  ll ret=0;
  char c=getchar_unlocked();
  // skipping
  while(c<'0' || c > '9') c=getchar_unlocked();
  do {
    ret *= 10;
    ret += (c-'0');
    c = getchar_unlocked();
  } while(c>='0' && c<='9');
  return ret;
}
void fastPut(ll v) {
  char s[256];
  int p=0;
  do {
    s[p++]=(v%10)+'0';
    v/=10;
  } while(v>0);
  while(p--)
    putchar_unlocked(s[p]);
}
int main() {
  A=fastGet();
  B=fastGet();
  Q=fastGet();
  REP(i,A)
    As[i]=fastGet();
  REP(i,B)
    Bs[i]=fastGet();
  REP(i,Q) {
    ll x=fastGet();
    ll* ita=lower_bound(As, As+A, x);
    ll* itb=lower_bound(Bs, Bs+B, x);
    ll ans=INF;
    ll alis[2],blis[2];
    alis[0]=ita!=As+A?*ita:INF;
    blis[0]=itb!=Bs+B?*itb:INF;
    alis[1]=ita!=As?ita[-1]:-INF;
    blis[1]=itb!=Bs?itb[-1]:-INF;
    REP(j,2)
      REP(k,2){
        ll a=alis[j],b=blis[k];
        ans = min(ans,abs(a-x)+abs(b-a));
        ans = min(ans,abs(b-x)+abs(b-a));
      }
    fastPut(ans);
    putchar_unlocked('\n');
  }
  return 0;
}


Measured memory_bytes: 2816
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//#include <ext/pb_ds/detail/standard_policies.hpp>
#include<set>
#include<map>
#include <unordered_map>
#include <unordered_set>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
#include<math.h>
#include <strings.h>
#include <fstream>


#define f first
#define s second
#define pb push_back
#define lp(i,a,n) for(int (i)=(a);(i)<=(int)(n);(i)++)
#define lpd(i,n,a) for(int (i)=(n);(i)>=(a);--(i))
#define mp make_pair
#define clr(a, b) memset(a,b,sizeof a)
#define all(v) v.begin(),v.end()
#define mod 1000000007
#define eps 1e-8
#define infi 2000000007
#define infll 1e18
#define MX 1000000
#define X real()
#define Y imag()
#define polar(r,t) ((r)* exp(point(0,(t))))
#define length(a) hypot( (a).X , (a).Y )
#define angle(a) atan2( (a).Y , (a).X )
#define vec(a,b) ( (b) - (a) )
#define dot(a,b) (conj(a)*(b)).X
#define cross(a,b) (conj(a)*(b)).Y
#define lengthsqr(a) dot(a,a)
#define reflect(V,M) (conj((V)/(M)) * (M))
//#define rotate(a, theta) (a) * (polar(1.0, (theta) ))
#define normalize(a)   ((a)/length(a))
#define ccw(a,b,c) cross(vec(a,b) , vec(a,c)) > eps
#define cosRule(a,b,c) (acos(((a)*(a)+(b)*(b)-(c)*(c))/(2*(a)*(b))))
#define cosDot(a,b) (acos(dot(a,b)/length(a)/length(b)))
#define EQ(a,b) (fabs((a) - (b)) <= eps) /* equal to */
#define NE(a,b) (fabs((a) - (b)) > eps)  /* not equal to */
#define LT(a,b) ((a) < (b) - eps)        /* less than */
#define GT(a,b) ((a) > (b) + eps)        /* greater than */
#define LE(a,b) ((a) <= (b) + eps)       /* less than or equal to */
#define GE(a,b) ((a) >= (b) - eps)       /* greater than or equal to */
#define mod1 100050001
#define mod2 100030001
#define base1 37
#define base2 31
#define PI acos(-1)
#define sz(a) (int) (a).size()

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef set<int> si;
typedef map<int, int> mii;
typedef map<ll, ll> mll;
typedef complex<long double> point;
typedef pair<point, point> line;
typedef pair<double , point> Circle;
typedef long double ld;

//const int N = 7002;



int main(int argc, const char * argv[]) {
    int a,b;
    scanf("%d%d",&a,&b);
    
    if(a > 8 || b > 8) printf(":(\n");
    else printf("Yay!\n");
    
    
    return 0;
}

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

 */





Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define POWER9 1000000000
#define MOD POWER9+7
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483647
#define INT_MAX 2147483647
#define LL_MIN (LL)-9223372036854775807
#define LL_MAX (LL)9223372036854775807
#define PI 3.14159265359
//Union-Find木
struct UnionFind{
private:
	vector<int> parent;
public:
	UnionFind(int N) : parent(N){ //初期化する O(N)
		for(int i=0; i<N; i++) parent[i] = i;
	}
	int root(int a){ //親を返す O(log N)
		if(parent[a] == a) return a;
		return parent[a] = root(parent[a]);
	}
	void unite(int a, int b){ //木を併合する O(log N)
		int rootA = root(a);
		int rootB = root(b);
		if(rootA != rootB) parent[rootA] = rootB;
	}
	bool same(int a, int b){ //属する木が同じかを返す O(log N)
		return root(a) == root(b);
	}
};

int A[100000],B[100000];
LL ans[100000];
int c[100000];
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << setprecision(9);

	LL N,M;
	cin >> N >> M;
	
	for(int i=0; i<M; i++){
		cin >> A[i] >> B[i];
		A[i]--;
		B[i]--;
	}
	UnionFind uf(N);
	for(int i=0; i<N; i++) c[i] = 1;
	ans[M-1] = N * (N-1) / 2;
	for(int i=M-1; i>=1; i--){
		if(uf.root(A[i]) == uf.root(B[i])){
			ans[i-1] = ans[i];
			continue;
		}
		ans[i-1]  = ans[i] - c[uf.root(A[i])] * c[uf.root(B[i])];
		int tmp = c[uf.root(A[i])] + c[uf.root(B[i])];
		uf.unite(A[i],B[i]);
		c[uf.root(A[i])] = tmp;
	}
	for(int i=0; i<M; i++) cout << ans[i] << endl;

	return 0;
}


Measured memory_bytes: 3712
fn getline() -> String {
    let mut __ret = String::new();
    std::io::stdin().read_line(&mut __ret).ok();
    return __ret;
}

fn main() {
    let n: usize = getline().trim().parse().unwrap();

    let s = getline();
    let vec: Vec<_> = s.trim().split(' ').collect();

    let mut head_vec: Vec<_> = Vec::new();
    let mut tail_vec: Vec<_> = Vec::new();

    for i in 0..n {
        let a = vec[i];

        if i % 2 == 0 {
            tail_vec.push(a);
        } else {
            head_vec.push(a);
        }
    }

    if n % 2 == 0 {
        tail_vec.reverse();
        tail_vec.append(&mut head_vec);
        tail_vec.reverse();
        println!("{}", tail_vec.connect(" "));
    } else {
        head_vec.reverse();
        head_vec.append(&mut tail_vec);
        head_vec.reverse();
        println!("{}", head_vec.connect(" "));
    }
}


Measured memory_bytes: 20056
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> yakusu;
    for (ll i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            yakusu.push_back(i);
            if (i * i != n)
            {
                yakusu.push_back(n / i);
            }
        }
    }
    sort(yakusu.begin(), yakusu.end());
    ll ans = 0;
    ll sz = yakusu.size();
    for (ll i = 0; i < sz; i++)
    {
        if (yakusu[i] <= (ll)sqrt(n) + 1)
        {
            continue;
        }
        else
        {
            ans += yakusu[i] - 1;
        }
    }
    cout << ans << endl;
}

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

#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

signed main(){
	int n, m;
	cin >> n >> m;
	int ans[100] = {};

	for(int i = 0;i < m;i++){
		int a, b;
		cin >> a >> b;
		ans[a]++;
		ans[b]++;
	}

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

	return 0;
}


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

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

    int n, k;
    cin >> n >> k;

    int res = 1;
    rep(i, n) res = min(2*res, res+k);

    cout << res << endl;
}

Measured memory_bytes: 256
num = int(input())
B_list = [int(item) for item in input().split()]

Ai_cand =[B_list[0]]

for k in range(1, num-1):
    Ai_cand.append(min(B_list[k], B_list[k-1]))

Ai_cand.append(B_list[-1])
    
print(sum(Ai_cand))

Measured memory_bytes: 3060
#include <stdio.h>
 int main(void){
  char s[11]={0};
  int i=0,j=0,k=0,l;
  int count=0,len=0,max[11]={0};
  int max2;

  scanf("%s",s);
  while(s[len])
   len++;

do{
  while(s[j]=='A'||s[j]=='C'||s[j]=='G'||s[j]=='T'){
   count++; j++;

}
 max[k]=count;
 
 k++; count=0;
j++;

}while(j<11);
max2=max[0];


for(l=1;l<10;l++)
if(max2<max[l])
max2=max[l];
printf("%d",max2);
   return 0;
 }


Measured memory_bytes: 128
#include <stdio.h>
int A[2000];
int n;
int solve(int, int);

int main(){
  int i,x,q;
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&x);
  
    if (solve(0, x)==1) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}

int solve(int l, int m){
  int sum;
  if(m==0) return 1;
  if(l>=n) return 0;

  sum=solve(l+1, m) || solve(l+1, m-A[l]);
  return sum;
}

Measured memory_bytes: 580
#!/usr/bin/env python
# coding: utf-8

N = int(input())
h = list(map(int, input().split()))
#N = 4
#h = [10, 20, 30, 40]
#
#DP = [0, abs(h[0]-h[1])]
#for i in range(N-2):
#    DP += [min(DP[-2] + abs(h[i]-h[i+2]), DP[-1] + abs(h[i+1]-h[i+2]))]
#
#print(DP[-1])

dp = {}
NOT_FOUND = pow(10, 4) + 1
def sget(i):
    if i in dp:
        return dp[i]
    return NOT_FOUND

def chmin(a, b):
    return b if a > b else a

dp = {0: 0, 1: abs(h[0] - h[1])}
for i in range(2, N):
    dp[i] = chmin(sget(i-2) + abs(h[i] - h[i-2]),
                  sget(i-1) + abs(h[i] - h[i-1]))
print(dp[N-1])

#def main(N, hs):
#    dp[0] = 0
#    #for i in range(1, N):
#    #    dp[i] = chmin(sget(i), sget(i - 1) + abs(hs[i] - hs[i - 1]))
#    #    if i > 1:
#    #        dp[i] = chmin(sget(i), sget(i - 2) + abs(hs[i] - hs[i - 2]))
#    #def rec(i):
#    #    if sget(i) < NOT_FOUND:
#    #        return sget(i)
#    #    if i == 0:
#    #        return 0
#    #    res = NOT_FOUND
#    #    res = chmin(res, rec(i-1) + abs(hs[i] - hs[i-1]))
#    #    if (i > 1):
#    #        res = chmin(res, rec(i-2) + abs(hs[i] - hs[i-2]))
#    #    dp[i] = res
#    #    return dp[i]
#    #return rec(N-1)
#    return dp[N-1]


Measured memory_bytes: 23216
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

#define FOR(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define REP(i, n) FOR((i), 0, (n))

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}

int main() {
    int a, b;
    cin >> a >> b;
    if(a >= 10 || b >= 10)
        cout << -1 << endl;
    else
        cout << a * b << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
//namespace mp=boost::multiprecision;
//#define mulint mp::cpp_int
//#define mulfloat mp::cpp_dec_float_100
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
constexpr int MOD=1000000007;
//constexpr int MOD=998244353;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcountll(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;
//struct edge{lint to,num;};
//vector<int> bucket[MAX_N/1000];

int main(void){
    int N;
    cin >> N;
    int D[N][2];
    rep(i,N) cin >> D[i][0] >> D[i][1];
    bool ans=false;
    rep(i,N-2) if(D[i][0]==D[i][1] && D[i+1][0]==D[i+1][1] && D[i+2][0]==D[i+2][1]) ans=true;
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3640
n = int(input())
li = list(map(int,input().split()))

def cs(lix):
  if len(lix) == 1:
    return lix[0]
  elif len(lix) == 0:
    return 0
  m = min(lix)
  div = lix.count(m)+1
  lili = [0]*div
  cut = 0
  for i in range(div-1):
    lili[i] = lix[cut:lix[cut:].index(m)+cut]
    cut = lix[cut:].index(m)+cut+1
  if lix[-1] == m:
    lili[div-1] = []
  else:
    lili[div-1] = lix[cut:]
  for i in range(lili.count([])):
    lili.remove([])
  return sum(list(map(cs,lili))) - (len(lili)-1)*m
print(cs(li))

Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define SORT(v) sort((v).begin(), (v).end())
#define REV(v) sort((v).begin(), (v).end(), greater<int>())
#define INF 1000000007
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a * b / gcd(a, b);};
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

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

  int n, m;
  cin >> n >> m;
  int a[1000], b[1000];
  rep(i, n) cin >> a[i];
  rep(i, m) cin >> b[i];
  P poi[n];
  rep(i, n) poi[i].second = i + 1;
  rep(i, m) {
    int h = b[i];
    rep(j, n) {
      if(a[j] <= h) {
        poi[j].first++;
        break;
      }
    }
  }
  //rep(i, n) cout << poi[i].first << endl;
  sort(poi, poi + n);
  cout << poi[n - 1].second << endl;
  return 0;
}



Measured memory_bytes: 3168
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
main(){
int x;
cin >> x;
int flag =0;
for (int i = -120;i<120;i++){
	for(int j =-120;j<120;j++){
      double p = pow(i,5)-pow(j,5);
      if(p == x && flag ==0){
      cout<<i<<' '<<j<<endl;
      flag = 1;
      break;
      }
    }
}
}

Measured memory_bytes: 4028
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 998244353LL;

ll mod_pow(ll x, ll n) {
    ll res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % MOD; //ビット演算(最下位ビットが1のとき)
        x = (x * x) % MOD;
        n >>= 1; //右シフト(n = n >> 1)
    }
    return res;
}

const long long MAXN = 300010;
long long fact[MAXN], inv[MAXN];

void init_fact() {
    fact[0] = 1;
    for(long long i=1; i<MAXN; i++) {
        fact[i] = (fact[i-1] * i) % MOD;
    }

    inv[MAXN - 1] = mod_pow(fact[MAXN - 1], MOD-2);
    for(long long i=MAXN - 2; i>=0; i--) {
        inv[i] = (inv[i+1] * (i+1)) % MOD;
    }
}

long long comb(long long n, long long r) {
    if(r < 0 || n < r) return 0;
    return fact[n] * inv[n-r] % MOD * inv[r] % MOD;
}

int main(){

    init_fact();
    //cout << comb(5, 2) << endl;
    long long n, A, B, K; cin >> n >> A >> B >> K;
    long long ans = 0;
    for(long long a = 0; K - a*A >= 0; a++){
        if((K - a*A) % B != 0) continue;
        long long b = (K - a*A) / B;
        if(a < 0 || n < a || b < 0 || n < b) continue;
        //cout << a << " " << b << endl;
        
        ans += (comb(n, a) % MOD) * (comb(n, b) % MOD);
        ans %= MOD;
    }

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

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

int main(){
    int H,W;
    cin >> H >> W;
    string frame;
    for (int i = 0; i < W+2; i++){
        frame += "#";
    }
    cout << frame << endl;
    for (int i = 0; i < H; i++){
        string a;
        cin >> a;
        cout << "#"+a+"#" << endl;
    }
    cout << frame << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
int main()
{
    int n;
    cin >> n;
    int sum = 0;

    vector<int> l(n), r(n);
    rep(i, n)
    {
        cin >> l[i] >> r[i];
        sum += (r[i] - l[i]) + 1;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
int k;
ll get(vector < pii > s,int val)
{
    if (val == -1)
    {
        ll ans = 0;
        for (auto it : s)
            ans += it.se;
        return ans;
    }
    int n = s.size();
    if ((k >> val) & 1)
    {
        ll ans = 0;
        for (auto it : s)
            if (!((it.fi >> val) & 1))
                ans += it.se;
        dbg(ans);
        return max(ans,get(s,val - 1));
    }
    else
    {
        ll ans = 0;
        vector < pii > v;
        for (auto it : s)
            if (!((it.fi >> val) & 1))
                v.pb(it);
        return get(v,val - 1);
    }
}
int main(void)
{
    int n;
    cin>>n>>k;
    vector < pii > s(n);
    for (auto & it : s)
        cin>>it.fi>>it.se;
    int lg = 0;
    int mx = k;
    for (auto it : s)
        mx = max(mx,it.fi);
    while (mx >> lg) ++lg;
    --lg;
    sort(all(s));
    cout << get(s,lg) << '\n';
    return 0;
}


Measured memory_bytes: 39540
#include<stdio.h>

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

void insertionSort(int A[],int N){
	int i,j,v;
	for(i=1;i<N;i++){
		j=i-1;
		v=A[i];
		while(j>=0&&A[j]>v){
			A[j+1]=A[j];
			j--;
		}
		A[j+1]=v;
		trace(A,N);
	}
}

int main(){
	int A[100];
	int i,j;
	int N;
	scanf("%d",&N);
	for(i=0;i<N;i++){
		scanf("%d",&A[i]);
	}
	trace(A,N);
	insertionSort(A,N);
	return 0;
} 

Measured memory_bytes: 2720
import java.lang.IllegalArgumentException
import java.math.BigInteger
import java.util.*

fun main(args: Array<String>) {

    var sc = Scanner(System.`in`)
    var n = sc.nextInt()

    var a = IntArray(n)
    for (i in 0 until n) {
        a[i] = sc.nextInt()
    }
    var map = mutableMapOf<Int, Long>()

    (0 until n).forEach {
        var t = a[it]
        map[t] = if (map.containsKey(t)) map[t]!! + 1 else 1
    }

    var ans = BigInteger.ZERO
    for ((i, s) in map) {
        ans = ans.plus(BigInteger.valueOf(s * (s - 1) / 2))
    }

    a.forEach {
        val s = map[it] ?: throw IllegalArgumentException(n.toString())
        println(ans.plus(BigInteger.valueOf((s - 1) * (s - 2) / 2 - s * (s - 1) / 2)))
    }

}



Measured memory_bytes: 117588
import scala.io.StdIn._

object Main extends App {

  val Array(sx,sy,tx,ty) = readLine().split(" ").map(_.toInt)

  def solve() = {
    val w = tx-sx
    val h = ty-sy
    "R" * w +
    "U" * h +
    "L" * w +
    "D" * (h+1) +
    "R" * (w+1) +
    "U" * (h+1) +
    "L" +
    "U" +
    "L" * (w+1) +
    "D" * (h+1) +
    "R"
  }

  println(solve())

}



Measured memory_bytes: 54732
#include <bits/stdc++.h>
typedef long long ll;

ll solve(ll *x, ll A, ll n) { // bit全探索する.200点取れるけど300点は取れない
    ll ans = 0;
    for (ll bit = 1; bit < (1 << n); ++bit) {
        std::vector<int> bit_set;
        for (int i = 0; i < n; ++i) {
            if (bit & (1 << i)) { // i が bit に入るかどうか
                bit_set.push_back(i);
            }
        }
        ll sum = 0;
        for (int i = 0; i < bit_set.size(); ++i) {
            sum += x[bit_set[i]];
        }
        if (sum == A * bit_set.size()) {
            ans++;
        }
    }
    return ans;
}

ll solve_dp(ll *x, ll A, ll n) {
    ll sum = 0;

    for (size_t i = 0; i < n; i++) {
        sum += x[i];
    }
    ll DP[n + 1][n + 1][sum + 1];
    for (size_t j = 0; j < n + 1; j++) {
        for (size_t k = 0; k < n + 1; k++) {
            for (size_t s = 0; s < sum + 1; s++) {
                if (j >= 1 && s < x[j - 1]) {
                    DP[j][k][s] = DP[j - 1][k][s];
                } else if (j >= 1 && s >= x[j - 1] && k >= 1) {
                    DP[j][k][s] =
                        DP[j - 1][k][s] + DP[j - 1][k - 1][s - x[j - 1]];
                } else if (s == 0 && j == 0 && k == 0) {
                    DP[j][k][s] = 1;
                } else {
                    DP[j][k][s] = 0;
                }
            }
        }
    }
    ll ans = 0;
    /*
    for (size_t i = 1; i < n + 1; i++) {
        for (size_t j = 1; j < sum + 1; j++) {
            std::cout << DP[n][i][j] << " ";
        }
        std::cout << '\n';
    }*/
    for (size_t i = 1; i < std::min(sum / A + 1, n + 1); i++) {
        ans += DP[n][i][i * A];
        // std::cout << i << " " << i * A << " " << DP[n][i][i * A] << '\n';
    };

    return ans;
}

int main(int argc, char const *argv[]) {
    ll N, A;
    std::cin >> N >> A;
    ll x[N];
    for (size_t i = 0; i < N; i++) {
        std::cin >> x[i];
    }
    std::cout << solve_dp(x, A, N) << '\n';
    return 0;
}


Measured memory_bytes: 51072
#include <iostream>
using namespace std;
int main()
{
    int n;
    int i;
    int b;
    int a=0;
    cin>>n;
    b=n;
    while(n--){
    	cin>>i;
    	if(i%2==0){
			if(i%3==0||i%5==0)
    			a++;
		}
    	else
    	a++;
	}
	if(a==b)
	cout<<"APPROVED" ;
	else
	cout<<"DENIED";
    return 0;
}

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

using static Input;
using static Util;
class Program
{
    static long[] T;
    static void INPUT()
    {
        var n = NextInt();
        T = new long[n];
        for (int i = 0; i < n; i++)
            T[i] = NextLong();
    }
    static void OUT()
    {
        var tt = 1L;
        foreach(var t in T)
        {
            tt = LCM(tt, t);
        }

        Console.WriteLine(tt);
    }
    static void Main(string[] args)
    {
#if DEBUG  
        TESTINPUT();
#else
        INPUT();
#endif
        OUT();
    }

    static void TESTINPUT()
    {
       // N = 1000003;
    }

}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

class Util
{
    /// <summary>
    /// 最大公約数
    /// </summary>
    /// <param name="a"></param>
    /// <param name="b"></param>
    /// <returns></returns>
    public static long GCD(long a, long b)
    {
        if (b == 0) return a;
        return GCD(b, a % b);
    }

    /// <summary>
    /// 最小公倍数
    /// </summary>
    /// <param name="a"></param>
    /// <param name="b"></param>
    /// <returns></returns>
    public static long LCM(long a, long b)
    {
        var g = GCD(a, b);
        return a / g * b;
    }
}




Measured memory_bytes: 13268
#include <iostream>

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

int main() {
    int a, b, c, x;
    int ans = 0;
    std::cin >> a >> b >> c >> x;

    rep(i, a+1) {
        rep(j, b+1) {
            rep(k, c+1) {
                int y = 500*i + 100*j + 50*k;
                if (x == y) ++ans;
            }
        }
    }
    std::cout << ans << std::endl;

    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<cstdio>
#include<stdio.h>
#include<cmath>
#include<math.h>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<sstream>
#include<iomanip>
#define forn(i,n) for(int (i)=0;i<(n);i++)
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int>pii;
typedef long long ll;
typedef pair<ll,ll> pll;
const int MAXN=100005;
const int INF=2147483647;
const ll LINF=9223372036854775807;
const int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
int n; 
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n;
	cout<<1-n;
	return 0;
}


Measured memory_bytes: 3612
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		int ans=0;
		if(s.equals("SUN")){
			ans=7;
		}else if(s.equals("MON")){
			ans=6;
		}else if(s.equals("TUE")){
			ans=5;
		}else if(s.equals("WED")){
			ans=4;
		}else if(s.equals("THU")){
			ans=3;
		}else if(s.equals("FRI")){
			ans=2;
		}else{
			ans=1;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 23380
#include <bits/stdc++.h>
using namespace std;
#define Rep(i, n) for(int i = 0; i < (int)(n); i++)
#define Repi(i, a, b) for(int i = int(a); i < (int)(b); i++)
#define Repl(i, list) for(int i : list)
#define Sort(v) sort(v.begin(), v.end())
#define ll long long
template<typename _T> void Out(_T x) { cout << x << endl; }
template<typename _T> void PrintVec(vector<_T> vec) { Rep(i, vec.size()) { cout << vec.at(i) << " "; } cout << endl; }

long long gcd (long long a, long long b){
    if (a < b) {
        long long tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    return b ? gcd(b, a % b) : a;
}

long long lcm (long long a, long long b){
    return (a * b) / gcd(a, b);
}

int main()
{
    // input
    long long A, B;
    cin >> A >> B;

    // output
    Out(lcm(A,B));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define rrep(i, n) for (int i = (int)n-1; i >= 0; --i)
using namespace std;
using ll = long long;
template<typename T>
inline bool chmax(T& a, const T& b) {
    if (a < b){
        a = b;
        return true;
    }
    return false;
}
template<typename T>
inline bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T> vector<T> make_vec(size_t n) { return vector<T>(n); }
template<typename T, typename... Args> auto make_vec(size_t n, Args... args) {
    return vector<decltype(make_vec<T>(args...))>(n, make_vec<T>(args...));
}
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value>::type fill_v(U& u, const V... v) { u = U(v...); }
template<typename T, typename U, typename... V>
typename enable_if<!is_same<T, U>::value>::type fill_v(U& u, const V... v) {
    for (auto& e : u) fill_v<T>(e, v...);
}

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

    int n, x, t;
    cin >> n >> x >> t;
    cout << (n + x - 1) / x * t << '\n';
}


Measured memory_bytes: 3648
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
  ll n;
  cin >> n;
  if(n % 2 == 0) {
    cout << n << " " << n << " " << n / 2 << endl;
  } else {
    for(int i = 1; i <= 3500; i++) {
      for(int j = i; j <= 3500; j++) {
        if((4 * i * j - n * i - n * j) == 0) {
          continue;
        }
        if((n * i * j) % (4 * i * j - n * i - n * j) == 0) {
          if((4 * i * j - n * i - n * j) > 0) {
            cout << i << " " << j << " ";
            cout << (n * i * j) / (4 * i * j - n * i - n * j) << endl;
            return 0;
          }
        }
      }
    }
  }
  return 0;
}

Measured memory_bytes: 3636
#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 <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cstdlib>
#define rep(i,n) for(int i = 0;i<(n);i++);
#define all(a) (a).begin(),(a).end()
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 10010010010;
typedef pair<ll, ll> P;
const ll mod = 1000000007;
ll gcd(ll a, ll b) {//a>b
	if (a < b)swap(a, b);
	if (a % b == 0) return b;
	else return gcd(b, a % b);
}
int main() {
	int L;
	scanf("%d", &L);
	printf("%.12f\n", (double)L * L * L / 27);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>

#define rep(i,n) for(int i=0;i<n;i++)
#define dup(x,y) (((x)+(y)-1)/(y)) // dup * y >= x なる最小のdup.
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;



int main() {
	vector<int> A(5);
	rep(i, 5) cin >> A[i];
	int k;
	cin >> k;

	bool yay = true;
	sort(A.begin(), A.end());

	if(A[4]-A[0]>k) yay = false;

	if(!yay) cout << ":(" << endl;
	else cout << "Yay!" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define mp(a,b) make_pair(a,b)
#define vi vector<int>
#define mii map<int,int>
#define mpi map<pair<int,int>,int>
#define vp vector<pair<int,int> >
#define pb(a) push_back(a)
#define fr(i,n) for(i=0;i<n;i++)
#define rep(i,a,n) for(i=a;i<n;i++)
#define F first
#define S second
#define endl "\n"
#define fast std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define dom 998244353
#define pi 3.14159265
#define sl(a) (int)a.length()
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define pii pair<int,int> 
#define mini 2000000000000000000
#define time_taken 1.0 * clock() / CLOCKS_PER_SEC
//mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
void shikhar7s(int cas)
{
    int a;
    cin>>a;
    cout<<a+(a*a)+(a*a*a);
}
signed main()
{
    fast;
    int t=1;
    //cin>>t;
    int cas=1;
    while(cas<=t)
    {
    shikhar7s(cas);
    cas++;
    }
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
using namespace std;
int main(){ 
  int a;
  char op;
  int b;
  int ans = 0; 
  while(cin >> a >> op >> b){
    if(op == '+'){
      ans = a + b;
    }
    else if(op == '-'){
      ans = a - b;
    }
    else if(op == '*'){
      ans = a * b;
    }
    else if(op == '/'){ 
      ans = a / b;
    }
    else if(op == '?'){
      break;
    }   
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1164