akhauriyash/Code-Regression huggingface dataset:
import numpy as np
N = int(input())
A = input().split()
A = np.array(A).astype(type(N))
S = np.sum(A)

SS = np.array([A[i] for i in range(1,A.shape[0],2)])

X = np.zeros((N))
X[0] = S -2*sum(SS)
for i in range(0,N-1):
    X[i + 1] = 2*A[i] - X[i]  

for i in X:
    print("{} ".format(int(i)),end="")


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

using namespace std; 
#define REP(i, n) for (int i = 0; i < (n); i++)

typedef long long ll;
// ll mod_pow(ll x, ll n, ll mod){//x^n % mod
//     if (n == 0)
//         return 1;
//     ll res = mod_pow(x * x % mod, n / 2, mod);
//     if (n & 1)
//         res = res * x % mod;
//     return res;
// }
ll gcd(ll a,ll b)
{
	if (a%b==0)
	{
		return(b);
    }
	else
	{
		return(gcd(b,a%b));
    }
}

bool IsPrime(ll num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (ll i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}


int main(int argc, char const *argv[])
{
    cin.tie(0);
   	ios::sync_with_stdio(false);
    ll A, B; cin >> A >> B;
    ll gcd_ab = gcd(A,B);
    ll n = gcd_ab;
    ll res = 1;
    
    if(gcd_ab%2 == 0) res++;
    while(gcd_ab%2 == 0) gcd_ab/=2;
    n = gcd_ab;
    if (IsPrime(n)) {
        cout << res+1 << endl;
        return 0;
    }
    for (ll i = 3; i <= n; i=i+2) {
        if(gcd_ab%i==0) {
            res++;
            while(gcd_ab%i == 0) {
                gcd_ab /=i;
            }
            if(IsPrime(gcd_ab)) {
                res++;
                break;
            }
        }    
        if(gcd_ab == 1) break;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
n=int(input())
alist=[int(i) for i in input().split()]

zeros=0
answer=1
triple=[0,0,0]

for i in range(n):
    now=alist[i]
    if now==triple[0]:
        if now==triple[1]:
            if now==triple[2]:
                answer*=3
            else:
                answer*=2
        triple[0]+=1
    else:
        if now==triple[1]:
            if now==triple[2]:
                answer*=2
            triple[1]+=1
        else:
            if now==triple[2]:
                triple[2]+=1
            else:
                answer=0
    answer%=(1000000007)

print(answer)

Measured memory_bytes: 53060
#include <bits/stdc++.h>
using namespace std;
#define makefast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

const int N = 2e3 + 7;

vector <int> ad[N];
int n, ones;
bool is[N];
int sd[N];
int sz[N];
int dp[N][2];
int rt;

void get(int v, int p = 0) {
	if (is[v])
		sz[v]++;
	for (auto u: ad[v]) {
		if (u != p) {
			get(u, v);
			sz[v] += sz[u];
			int a = dp[u][0] + sz[u];
			int b = dp[u][1] + sz[u];
			int l = dp[v][0];
			int r = dp[v][1];
			if (b < l)
				dp[v][0] = l - b;
			else
			if (r < a)
				dp[v][0] = a - r;
			else {
				if (a % 2 == l % 2)
					dp[v][0] = 0;
				else
					dp[v][0] = 1;
			}
			dp[v][1] = dp[v][1] + b;
//			cout << "tmp : " << v << " " << u << " > " << dp[v][0] << " " << dp[v][1] << endl;
		}
	}
//	cout << rt << " : " << v << " > " << dp[v][0] << " " << dp[v][1] << endl;
}
int main() {
	makefast;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		char c;
		cin >> c;
		if (c == '1')
			is[i] = 1, ones++;
	}
	for (int i = 1; i < n; i++) {
		int v, u;
		cin >> v >> u;
		ad[v].push_back(u);
		ad[u].push_back(v);
	}	
	int res = 1e9;
	for (int i = 1; i <= n; i++) {
		rt = i;
		memset(dp, 0, sizeof dp);
		memset(sd, 0, sizeof sd);
		memset(sz, 0, sizeof sz);
		get(i);
		if (dp[i][0] == 0)
			res = min(res, dp[i][1] / 2);
	}
	if (res == 1e9)
		cout << -1;
	else
		cout << res;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(nullptr); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int M, K;
    cin >> M >> K;
    if (K != 0) {
        int x = 0;
        rep(i, 0, 1 << M) {
            x ^= i;
        }
        if (x == 0 && K < (1 << M)) {
            vector<int> ans(1 << (M + 1));
            int idx = 0;
            rep(i, 0, 1 << M) {
                if (i == K) continue;
                ans[idx] = ans[sz(ans) - 2 - idx] = i;
                idx++;
            }
            ans[idx] = K;
            ans.back() = K;
            cout << ans << endl;
        } else {
            cout << -1 << endl;
        }
    } else {
        vector<int> ans(1 << (M + 1));
        rep(i, 0, 1 << M) {
            ans[i] = ans[sz(ans) - 1 - i] = i;
        }
        cout << ans << endl;
    }
    return (0^_^0);
}



Measured memory_bytes: 3840
s = input()
t = input()
x = ''
if len(s) == len(t):
  for i in range(len(s)):
    x += s[i]
    x += t[i]
elif len(s) > len(t):
  for i in range(len(t)):
    x += s[i]
    x += t[i]
  x += s[-1]
else:
  for i in range(len(s)):
    x += s[i]
    x += t[i]
  x += t[-1]
print(x)


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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

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;
}


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  // ll N, K; cin >> N >> K;
  // ll x, y, z; cin >> x >> y >> z;
  ll a, b, c, d;
  string s; cin >> s;
  a = s[0] - '0';
  b = s[1] - '0';
  c = s[2] - '0';
  d = s[3] - '0';
  
  rep(i, 1<<3) {
    ll k = a;
    s = to_string(a);
    if(i & 1)  {
      s += '+';
      k += b;
    } else {
      s += '-';
      k -= b;
    }
    s += to_string(b);
    if(i>>1 & 1)  {
      s += '+';
      k += c;
    } else {
      s += '-';
      k -= c;
    }
    s += to_string(c);
    if(i>>2 & 1)  {
      s += '+';
      k += d;
    } else {
      s += '-';
      k -= d;
    }
    s += to_string(d);
    if(k == 7) {
      cout << s << "=7" << endl;
      return;
    }
    
  }
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


Measured memory_bytes: 3768
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    words=[]
    n = int(input())
    words=[input().rstrip() for _ in range(n)]

    if len(set(words))!=n:
        print("No")
        exit()

    endstring=""
    for word in words:
        if len(endstring)==0:
            endstring=word[-1]
        else:
            if endstring==word[0]:
                endstring=word[-1]
            else:
                print("No")
                exit()
    print("Yes")


if __name__=="__main__":
    main()

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

int main() {
    ios_base::sync_with_stdio(0); cin.tie(NULL);
    int N, K;
    cin >> N >> K;
    for (int i = 0; i < N; ++i) {
        char c;
        cin >> c;
        if (i == K - 1)
            c = tolower(c);
        cout << c;
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main()
{
    ll n, k;
    string str;
    cin >> n >> k >> str;
	vector<int> ary;
	int now = 1; //今見ている数
	int cnt = 0; //nowがいくつ並んでいるか
	for (int i = 0; i < n; i++)
	{
		if (str[i] == (char)('0' + now)) cnt++;
		else {
			ary.push_back(cnt);
			now = 1 - now; //0と1を切り替える時の計算 now ^= 1;
			cnt = 1; //新しいのをカウントし始める
		}
	}
	if (cnt != 0) ary.push_back(cnt);
 
	//1-0-1-0-1-0-1って感じの配列が欲しい
	//1-0-1-0みたいに0で終わってたら、適当に１つ足す
	if (ary.size() % 2 == 0) ary.push_back(0);
	vector<int> sum(ary.size() + 1);
	for (int i = 0; i < ary.size(); i++)
	{
		sum[i + 1] = sum[i] + ary[i];
	}
  	int Add = 2 * k + 1;
 	int ans = 0;
	//1-0-1...の1から始めるので、偶数番目だけ見る
	for (int i = 0; i < ary.size(); i += 2)
	{
		//次のleft, rightを計算する [left, right)
		int left = i;
		int right = min(i + Add, (int)ary.size());
		int tmp = sum[right] - sum[left];
 
		ans = max(tmp, ans);
	}
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1272
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
//#define i_7 (long long)(1e9+7)
#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}
using namespace std;
//using namespace boost::multiprecision;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}


int main(){
  
  int n;
  cin>>n;
  int m = 3*n;
  string s;
  cin>>s;
  long long cnt[8] = {};//r,g,bのビットを考える
  long long ans = 1;
  REP(i,m){
    if(s[i] == 'R'){//b100
      if(cnt[3] > 0){
        ans *= mod(cnt[3]);
        ans = mod(ans);
        cnt[3]--;
      }else if(cnt[1] > 0){
        ans *= mod(cnt[1]);
        ans = mod(ans);
        cnt[1]--;
        cnt[5]++;
      }else if(cnt[2] > 0){
        ans *= mod(cnt[2]);
        ans = mod(ans);
        cnt[2]--;
        cnt[6]++;
      }else{
        cnt[4]++;
      }
    }else if(s[i] == 'G'){//b010
      if(cnt[5] > 0){
        ans *= mod(cnt[5]);
        ans = mod(ans);
        cnt[5]--;
      }else if(cnt[1] > 0){
        ans *= mod(cnt[1]);
        ans = mod(ans);
        cnt[1]--;
        cnt[3]++;
      }else if(cnt[4] > 0){
        ans *= mod(cnt[4]);
        ans = mod(ans);
        cnt[4]--;
        cnt[6]++;
      }else{
        cnt[2]++;
      }
    }else{//b001
      if(cnt[6] > 0){
        ans *= mod(cnt[6]);
        ans = mod(ans);
        cnt[6]--;
      }else if(cnt[2] > 0){
        ans *= mod(cnt[2]);
        ans = mod(ans);
        cnt[2]--;
        cnt[3]++;
      }else if(cnt[4] > 0){
        ans *= mod(cnt[4]);
        ans = mod(ans);
        cnt[4]--;
        cnt[5]++;
      }else{
        cnt[1]++;
      }
    }
  }
  for(long long i = 1; i<=n; i++){
    ans *= mod(i);
    ans = mod(ans);
  }
  cout<<ans<<endl;
  
  return 0; 
}

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

int main() {
  int N ,K;
  cin >> N >> K;
  vector <int> a(N);
  for (int i=0 ; i<N ; i++){
    cin >> a.at(i);
  }
  sort ( a.begin() , a.end());
  reverse (a.begin() , a.end());
  int sum=0 ;
  for ( int i=0 ; i<K ;i++){
    sum += a.at(i);
  }
  cout << sum << endl;
}

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

using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i != N; ++i) {
    cin >> A[i];
    if (i >= K)
      cout << (A[i-K] < A[i] ? "Yes" : "No") << endl;
  }
}


Measured memory_bytes: 4032
import qualified Data.ByteString.Lazy.Char8 as B
import Data.List
import Data.Maybe
import Debug.Trace

traceQ :: (Show a) => String -> a -> a
-- traceQ label a = trace (label ++ ": " ++ show a) a
traceQ _ a = a

bsReadInts :: B.ByteString -> [Int]
bsReadInts = map (fst . fromJust . B.readInt) . B.words

solve :: Int -> Int -> [[Int]] -> Int
solve valN valH rests =
  case [(i, sum) | (i, sum) <- sc, sum >= valH] of
    (ans, _) : _ -> ans
    [] -> (length effBs) + (((valH - lastsum) + (amax - 1)) `div` amax)
  where
    bs = reverse $ sort $ map (\[a, b] -> b) rests
    as = map (\[a, b] -> a) rests
    amax = maximum (traceQ "as" as)
    effBs = takeWhile (> amax) (traceQ "bs" bs)
    sc = scanl' op (0, 0) effBs
      where op (i, sum) h = (i + 1, sum + h)
    lastsum = snd $ last sc

main :: IO ()
main = do
  conts <- B.getContents
  let fstLine : restLines = B.lines conts
      [valN, valH] = bsReadInts fstLine
      rests = map bsReadInts restLines
      x = solve valN valH rests
  putStrLn $ show x
  


Measured memory_bytes: 56700
#include <stdio.h>
#include <stdlib.h>

void swap(int A[], int x, int y){
    int buff = A[x];
    A[x] = A[y];
    A[y] = buff;
}

int Divide(int A[], int low, int high){
    int i = low-1;
    for(int j=low; j<high; j++){
        if(A[j] <= A[high]){
            i++;
            swap(A,j,i);
        }
    }
    swap(A,i+1,high);

    return i+1;
}

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

    int pivot = Divide(A,0,n-1);

    
    for(int i=0; i<n-1; i++){
        if(i == pivot)
            printf("[%d] ",A[i]);
        else
            printf("%d ",A[i]);
    }
    
    if(n-1 == pivot)
        printf("[%d]",A[n-1]);
    else
        printf("%d",A[n-1]);
    printf("\n");

    return 0;
}


Measured memory_bytes: 2104
/* 
	Author: ankrypt
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define all(x) x.begin(), x.end() 
#define ub upper_bound
#define lb lower_bound
#define MAX_INT 15
#define PI 3.141592653589793
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fi(a, b, c, d) for(int a = b; a < c; a += d)
#define fl(a, b, c, d) for(ll a = b; a < c; a += d)
#define fei(a, b, c, d) for(int a = b; a <= c; a += d)
#define fel(a, b, c, d) for(ll a = b; a <= c; a += d)
#define quit exit(0)
#define mem(x, a) memset(x, a, sizeof x)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pcl pair<char, ll>
#define psl pair<string, ll>


ll N, M, A, B, C;
ll arr[MAX_INT], arr1[MAX_INT], data[MAX_INT];
vector<ll> V;
unordered_map<ll, ll> mp;
set<ll> s;
string S = "";
ll cases;

int main() {
	go;
	cin >> N;
    cin >> S;
    if(S.size() <= N) {
    	cout << S << "\n";
    }
    else {
    	fi(i, 0, N, 1) {
    		cout << S[i] << "";
    	}
    	cout << "...\n";
    }
    
	return 0;
}
/*
	Powered by Buggy Plugin
*/




Measured memory_bytes: 3556
#include<stdio.h>
#include<string.h>

typedef struct{
  int top,front,right,left,back,bottom;
}dice;

void diceroll(dice* d, char c);

int main(void){
  dice d1,d2;
  int i,j;
  scanf("%d %d %d %d %d %d", &d1.top, &d1.front, &d1.right, &d1.left, &d1.back,&d1.bottom);
  scanf("%d %d %d %d %d %d", &d2.top, &d2.front, &d2.right, &d2.left, &d2.back,&d2.bottom),diceroll(&d2,'b');
  
  
    if(d2.top==d1.front) diceroll(&d2,'S');
    else  if(d2.bottom==d1.front) diceroll(&d2,'N');
    else if(d2.right==d1.front) diceroll(&d2,'W'),diceroll(&d2,'S');
    else if(d2.left==d1.front) diceroll(&d2,'E'),diceroll(&d2,'S');
    else if(d2.back==d1.front) diceroll(&d2,'S'),diceroll(&d2,'S');

   for(i=0;i<4;i++){
        if(d1.top==d2.top&&
        d1.bottom==d2.bottom&&
        d1.right==d2.right&&
        d1.left==d2.left&&
        d1.back==d2.back){
            printf("Yes\n");
            return 0;
        }
        diceroll(&d2,'E');
    }
 
    printf("No\n");
     
    return 0;
  }



void diceroll(dice* d, char c){
  int temp;

  switch(c){
  case 'E':
  temp=d->top;
  d->top=d->left;
  d->left=d->bottom;
  d->bottom=d->right;
  d->right=temp;
  break;
  case 'N':
  temp=d->top;
  d->top=d->front;
  d->front=d->bottom;
  d->bottom=d->back;
  d->back=temp;
  break;
  case 'S':
  temp=d->top;
  d->top=d->back;
  d->back=d->bottom;
  d->bottom=d->front;
  d->front=temp;
  break;
  case 'W':
  temp=d->top;
  d->top=d->right;
  d->right=d->bottom;
  d->bottom=d->left;
  d->left=temp;
  break;
  case 'R':
  temp=d->front;
  d->front=d->left;
  d->left=d->back;
  d->back=d->right;
  d->right=temp;
  break;
  case 'L':
  temp=d->front;
  d->front=d->right;
  d->right=d->back;
  d->back=d->left;
  d->left=temp;
  break;
 case 's':
   temp=d->right;
  d->right=d->left;
  d->left=temp;
  break;
 case 'b':
   temp=d->front;
  d->front=d->back;
  d->front=temp;
  break;
case 'B':
   temp=d->top;
  d->top=d->bottom;
  d->bottom=temp;
  break;
  default:
    break;
  }


}

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(int)(a); i!=(int)(b); i++)
#define RFOR(i, a, b) for(int i=(int)(a); i!=(int)(b); i--)
#define REP(i, n) FOR(i, 0, n)
using namespace std;
using ll = long long;

double len(double x1, double y1, double x2, double y2){
  return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
}

double Heron(double a, double b, double c){
  double s = (a + b + c) / 2;
  return sqrt(s * (s-a) * (s-b) * (s-c));
}

double solve(double* l){
  sort(l, l+3);
  double s = Heron(l[0], l[1], l[2]);
  double h = 2 * s / l[2];
  double t = (l[0] + l[1] + l[2]) / 2;

  return s / (t + h);  
}

int main(){
  double x[3], y[3];
  REP(i, 3) cin >> x[i] >> y[i];

  double l[3];
  REP(i, 3){
    l[i] = len(x[(i+1)%3], y[(i+1)%3], x[i], y[i]);
  }

  printf("%.10lf\n", solve(l));

  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {

	public void doIt(){
		Scanner sc = new Scanner(System.in);
		String n = sc.nextLine();
		HashMap<Integer, Integer> lastmonth = new HashMap<Integer, Integer>();
		HashMap<Integer, Integer> thismonth = new HashMap<Integer, Integer>();
		while(!n.equals("")){
			String [] data = n.split(",");
			int num = Integer.parseInt(data[0]);
			//すでにあるのならカウント追加
			if(lastmonth.containsKey(num)){
				lastmonth.put(num, (lastmonth.get(num) + 1));
			}
			else{
				lastmonth.put(num, 1);
			}
			n = sc.nextLine();

		}
		while(sc.hasNext()){
			n = sc.nextLine();
			String [] data = n.split(",");
			int num = Integer.parseInt(data[0]);
			//すでにあるのならカウント追加
			if(thismonth.containsKey(num)){
				thismonth.put(num, (thismonth.get(num) + 1));
			}
			else{
				thismonth.put(num, 1);
			}
		}

		//比較
		ArrayList<Integer> ansList = new ArrayList<Integer>();
		for(int key: lastmonth.keySet()){
			if(thismonth.containsKey(key)){
				ansList.add(key);
			}
		}
		Collections.sort(ansList);

		//出力
		for(int anskey: ansList){
			System.out.println(anskey + " " + (lastmonth.get(anskey) + thismonth.get(anskey)));
		}

	}
	public static void main(String[] args) {
		Main obj = new Main();
		obj.doIt();

	}

}

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

int main(){
  
  int n;

  while(cin>>n && n){
    int nmax=0,nmin=100000,s,ans=0;
    for(int i=0;i<n;i++){
      cin>>s;
      ans+=s;
      nmax=max(nmax,s);
      nmin=min(nmin,s);
    }
    cout<<(ans-nmax-nmin)/(n-2)<<endl;
  }

  return 0;
}

Measured memory_bytes: 1160
# include<iostream>
using namespace std;
int main ()
{
	int H,N;
	cin>>H>>N;
	int A[N];
	int sum=0;
	for(int i=0;i<N;i++)
	{
		cin>>A[i];
		sum+=A[i];
	}
	if(sum>=H)
	{
		 cout<<"Yes"<<endl;
	}
	else
	{
		 cout<<"No"<<endl;
	}
	 
	
	
}

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

int main(){
    int a, b;
    cin >> a >> b;
    if(a >= 13) cout << b;
    else if(a >= 6) cout << b/2;
    else cout << 0;

    cout << endl;
    return 0;
}

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

int main(void){
    int N; cin >> N;
    string S; cin >> S;
    
    int ans = 0;
    for(int i = 0; i <= 999; i++){
        string s_i = to_string(i);
        while(s_i.size()!=3){
            s_i = '0' + s_i;
        }
        bool flag1=false, flag2=false, flag3=false;
        for(int j = 0; j < N; j++){
            if(!flag1 && S[j] == s_i[0]){
                flag1 = true;
                continue;
            }
            if(!flag2 && flag1 && S[j] == s_i[1]){
                flag2 = true;
                continue;
            }
            if(!flag3 && flag2 && S[j] == s_i[2]){
                flag3 = true;
                break;
            }
            // cout << flag1 << ' ' << flag2 << ' ' << flag3 << ' ' << s_i << endl; 
        }
        if (flag1 && flag2 && flag3){
            ans++;
        }
    }
    cout << ans << endl;
}


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

int main(void){
  int h, w;

  while(1){
    
    cin >> h >> w;

    if(h == 0 && w == 0){
      break;

    }
    
    for(int i = 0; i < h; i++){
      for(int j = 0; j < w; j++){
	cout << "#";
      }
      cout << endl;
    }

    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 1152
def main():
    from heapq import heappush

    inf = 1 << 30

    N, T = map(int, input().split())
    *A, = map(int, input().split())

    h = [inf]
    ma = -1
    cnt = 0
    for x in A:
        d = x - h[0]
        if ma < d:
            ma = d
            cnt = 1
        elif ma == d:
            cnt += 1
        heappush(h, x)

    print(cnt)


if __name__ == '__main__':
    main()


Measured memory_bytes: 14380
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

int N, a, minv = inf, ans;

int main()
{
    cin >> N >> a;
    vector<int> val;
    for (int i = 0; i < N; i++)
    {
        cin >> a;
        if (a < minv)
            minv = a;
        else
            val.push_back(a - minv);
    }
    sort(val.rbegin(), val.rend());
    for (int i = 0; i < val.size(); i++)
        ans += val[0] == val[i];
    cout << ans << endl;
}

Measured memory_bytes: 892
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<deque>
#include<cstdio>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>
#define PP pair<P,int>

int n;
int a[222222];

int main(){
    cin>>n;
    rep(i,n)cin>>a[i];
    int cnt=0,pos=1;

    rep(i,n){
        if(a[i]==pos){
            pos++;
            cnt++;
        }
    }

    if(cnt==0){
        cout<<-1<<endl;
    }
    else{
        cout<<n-cnt<<endl;
    }
    return 0;
}

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

using namespace std;

#define fcout(d) cout << fixed << setprecision(d)
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rep1(i,n) for(int (i) = 1; (i) <= (n); ++(i))
#define repU(i,bottom,ceiling) for(auto (i) = (bottom); (i) <= (ceiling); ++(i))
#define repD(i,ceiling,bottom) for(auto (i) = (ceiling); (i) >= (bottom); --(i))
#define repV(i,v) for(auto (i) = begin(v); (i) < end(v); ++(i))
#define all(v)  begin(v),end(v)
#define clr(v) fill(all(v),0)
#define l_bnd lower_bound
#define u_bnd upper_bound
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define mkp make_pair
#define mkt make_tuple
#define fir first
#define sec second
#define q_ceil(n,d) ((n - 1)/(d) + 1)
#define parity(a,b) ((a)^(b) & 1LL ^ 1LL)

typedef long long ll;
typedef unsigned long long ull;
typedef double db;

const pair<int,int> DIR[] = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int INF_32 = -1 + (1 << 30);
const ll INF_64 = -1 + (1LL << 62);
const int MOD = (int)1e9 + 7;

ull next_subset(ull subset){
	ull tem = subset + (subset & -subset);
	ull btm = (~tem & subset) / (subset & -subset) >> 1;
	return btm | tem;
}

int N,W;
ll w;
vector<int> g[4];
ll ans = 0;

void solve(){
	
	rep(i,4) sort(all(g[i]),greater<int>());
	ll s0,s1,s2,s3;
	s0 = 0;
	rep(i,g[0].size() + 1){
		s1 = 0;
		rep(j,g[1].size() + 1){
			s2 = 0;
			rep(k,g[2].size() + 1){
				s3 = 0;
				rep(l,g[3].size() + 1){
					if(w * i + (w + 1) * j + (w + 2) * k + (w + 3) * l <= W) ans = max(ans,s1 + s2 + s3 + s0);
					if(l < g[3].size()) s3 += g[3][l];
				}
				if(k < g[2].size()) s2 += g[2][k];
			}
			if(j < g[1].size()) s1 += g[1][j];
		}
		if(i < g[0].size()) s0 += g[0][i];
	}
	cout<<ans<<endl;
	return;
}

void input(){
	
	cin>>N>>W;
	int t,v;
	rep(i,N){
		cin>>t;
		if(!i) w = t;
		t -= w;
		cin>>v;
		g[t].pub(v);
	}
	
	return;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	input();
	solve();
	
	return 0;
}





Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  vi v(31);
  int x;
  while (cin >> x) v[x] = 1;
  loop(i, 1, 31) if (!v[i]) cout << i << endl;
}

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>

using namespace std;

int main(){
    int a, b, c, d, e, f;
    /***
    |a, b| |x| - |c|
    |d, e| |y| - |f|
     ***/
    while (cin >> a >> b >> c >> d >> e >> f) {
	int p, q, r, s;
	double det = (a*e - b*d);
	p = e;
	q = -b;
	r = -d;
	s = a;

	double x, y;
	x = (p*c + q*f) / det;
	y = (r*c + s*f) / det;
	if (x == 0) {x = 0;}
	if (y == 0) {y = 0;}
	
	printf("%.3lf %.3lf\n", x, y);
    }

    return 0;
}

Measured memory_bytes: 1192
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<climits>
#include<stack>
#include<queue>
#include<unordered_map>
#include<map>
#include<set>

#define loopi(x,y) for(int i = x;i<(y);i++)
#define rloopi(x,y) for(int i = x;i>=(y);i--)
#define rloopj(x,y) for(int j = x;j>=(y);j--)
#define loopj(x,y) for(int j = x;j<(y);j++)


#define nl cout<<"\n";
#define ll long long int
using namespace std;
#define mod  1000000007


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

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int x;
	cin >> x;

	ll k = 360;

	while (k % x != 0)
	{
		k += 360;
	}

	cout << k / x;

	return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, n) for (int i = 1; i <= (int)(n); i++)
#define ll long long
#define umap unordered_map
using graph = vector<vector<int>>;
using graph2 = vector<vector<pair<int, int>>>;
#define oorret true //std::out_of_rangeが返された時
#define oor(x) [&](){try{x;} catch(const std::out_of_range& oor){return oorret;} return x;}()
double pi = 3.141592653589793238;
ll mod(ll x, ll y){if(x>=0||x%y==0) return x%y;return y+x%y;} //mod including minus
ll dv0(ll x, ll y){if(x>=0||x%y==0)return x/y;return x/y-1;} //rnd down
ll dv1(ll x, ll y){if(x%y==0) return dv0(x,y);return dv0(x,y)+1;} //rnd up
int D;
void calculate(vector<int> c, vector<vector<int>> s, int contest,int day, vector<int> &t, ll &score){
    ll p=0;
    int a[26];
    rep(i, 26){
        a[i]=0;
    }
    rep(i, D){
        rep(j, 26){
            p-=c[j]*(i+1-a[j]);
        }
        if(i!=day){
            p+=s[i].at(t[i])+c[t[i]]*(i+1-a[t[i]]);
            a[t[i]]=i+1;
        }else{
            p+=s[day].at(contest)+c[contest]*(day+1-a[contest]);
            a[contest]=i+1;
        }
        
    }
    if(score<p){
        score=p;
        t[day]=contest;
    }
}

int main(){
cin>>D;
vector<int> c(26);
rep(i, 26){
    cin>>c[i];
}
vector<vector<int>> s(D);
int r;
rep(i, D){
    rep(j, 26){
        cin>>r;
        s[i].push_back(r);
    }
}
int M[26];
rep(i, 26){
    M[i]=0;
}
vector<vector<int>> m(D);
rep(i, D){
    rep(j, 26){
        m[i].push_back(0);
    }
}
vector<int> a(26);

rep(i, 26){
    a[i]=0;
}
rep(i, D){
}
vector<int> t(D);
ll score=0;
rep(i, D){
    rep(j, 26){
        M[j]=0;
    }
    rep(j, 26){
        score-=c[j]*(i+1-a[j]);
        rep(k, j+1){
            if(s[i].at(j)+c[j]*(i+1-a[j])>M[k]){
                rep(l, j-k){
                    M[j-l]=M[j-l-1];
                    m[i].at(j-l)=m[i].at(j-l-1);
                }
                M[k]=s[i].at(j)+c[j]*(i+1-a[j]);
                m[i].at(k)=j;
                break;
            }
        }
    }
    score+=M[0];
    a[m[i].at(0)]=i+1;
    t[i]=m[i].at(0);
}
rep(j, 13){
    rep(i, j+2){
        rep(k, D){
            calculate(c, s, m[k].at(i),k, t, score);
        }
    }
    rep(i, j+2){
        rep(k, D){
            calculate(c, s, m[k].at(i),k, t, score);
        }
    }
}
rep(i, D){
    cout<<t[i]+1<<endl;
}
}


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

using namespace std;
const int maxn =  1e6 + 10;
#define ll long long
#define ios std::ios::sync_with_stdio(false)
const ll INF(0x3f3f3f3f3f3f3f3fll);
const int inf(0x3f3f3f3f);
/*


ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
ll pow_mod(ll x,ll n,ll mod){ll res=1;while(n){if(n&1)res=res*x%mod;x=x*x%mod;n>>=1;}return res;}//xµÄn´Î·½mod


ll mult(ll a,ll b,ll p){a%=p;b%=p;ll r=0,v=a;while(b){if(b&1){r+=v;if(r>p)r-=p;}v<<=1;if(v>p)v-=p;b>>=1;}return r;}
ll quick_pow(ll a,ll b,ll p){ll r=1,v=a%p;while(b){if(b&1)r=mult(r,v,p);v=mult(v,v,p);b>>=1;}return r;}
bool CH(ll a,ll n,ll x,ll t)
{ll r=quick_pow(a,x,n);ll z=r;for(ll i=1;i<=t;i++){r=mult(r,r,n);if(r==1&&z!=1&&z!=n-1)return true;z=r;}return r!=1;}
bool Miller_Rabin(ll n)
{if(n<2)return false;if(n==2)return true;if(!(n&1))return false;ll x=n-1,t=0;while(!(x&1)){x>>=1;t++;}srand(time(NULL));
ll o=8;for(ll i=0;i<o;i++){ll a=rand()%(n-1)+1;if(CH(a,n,x,t))return false;}return true;}


*/

#define int long long
#define sc(t) scanf("%lld",&t)
#define pr(ans) printf("%lld\n",ans)
ll pow_mod(ll x,ll n,ll mod){ll res=1;while(n){if(n&1)res=res*x%mod;x=x*x%mod;n>>=1;}return res;}//xµÄn´Î·½mod
template<typename T>void read(T &res){bool flag=false;char ch;while(!isdigit(ch=getchar()))(ch=='-')&&(flag=true);
for(res=ch-48;isdigit(ch=getchar());res=(res<<1)+(res<<3)+ch - 48);flag&&(res=-res);}
typedef unsigned long long ULL;

int gcd(int a,int b){return !b?a:gcd(b,a%b);}
int lcm(int a,int b){return a/gcd(a,b)*b;}
#define debug(x) cout << #x << " : " << x << '\n';
#define sb cout << "sb\n" << '\n';
#define fi first
#define se second
#define pb(a) push_back(a)
#define cn cout << '\n'


int a[maxn] , ma[maxn];
signed main()
{
    ios;
    cin.tie(0);///
    int n;
    cin >> n;
    int k;
    cin >> k;
    while(k --){
        int d;
        cin >> d;
        for(int i = 1 ; i <= d ; i ++) cin >> a[i] , ma[a[i]] ++;
    }
    int ans = 0;
    for(int i = 1 ; i <= n ; i ++){
        if(! ma[i]) ans ++;
    }
    cout << ans ;
    cn;
    return 0;
}
/*
1
1025
*/


Measured memory_bytes: 3628
package main

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

type Edge struct {
	node int
	cost int
}

var edge [][]Edge
var ans []int

func dfs(node int, cost int) {
	for _, v := range edge[node] {
		if ans[v.node] != 0 {
			continue
		}
		if (cost+v.cost)%2 == 0 {
			ans[v.node] = 1
		} else {
			ans[v.node] = 2
		}
		dfs(v.node, cost+v.cost)
	}
}

func main() {
	sc := NewScanner()
	N := sc.NextInt()
	ans = make([]int, N+1)
	edge = make([][]Edge, N+1)
	for i := 0; i < N; i++ {
		edge[i+1] = make([]Edge, 0)
	}

	for i := 0; i < N-1; i++ {
		A, B, C := sc.NextInt(), sc.NextInt(), sc.NextInt()
		edge[A] = append(edge[A], Edge{B, C})
		edge[B] = append(edge[B], Edge{A, C})
	}

	dfs(1, 0)

	for i := 1; i <= N; i++ {
		fmt.Println(ans[i] - 1)
	}
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 26156
l, r = map(int, input().split())
ans = float('inf')
for i in range(l, r + 1):
    for j in range(i + 1, r + 1):
        mod = (i * j) % 2019
        ans = min(ans, mod)
        if mod == 0:
            print(0)
            exit()
print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define repr(i, n, m) for (int i = (int)(n) - 1; i >= (int)(m); i--)
using namespace std;
using ll = int64_t;
const int MOD = 1000000007; // 10^9+7
// https://atcoder.jp/contests/abc169/tasks/abc169_c
int main() {
    ll a; cin >> a;
    string s; cin >> s;
    ll b = (s[0] - '0') * 100 + (s[2] - '0') * 10 + (s[3] - '0');
    ll ab = a * b;
    string ans = to_string(ab);
    if (ans.size() < 3) cout << 0 << endl;
    else cout << ans.substr(0, ans.size() - 2) << endl;
}


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

int main()
{
    long long X, K, D;
    cin >> X >> K >> D;

    long long cnt = 0;
    cnt = abs(X)/D;
    long long ans;

    //残り回数
    if(K < cnt){
        ans = abs(X) - abs(D) * K;
    }else{
        K -= abs(X)/D;
        long long rest = abs(X)%D;

        if( K % 2 == 0){
            ans = rest;
        }else{
            long long candidate1 = abs(rest + D) ;
            long long candidate2 = abs(rest - D) ;
            ans = min( abs(candidate1), abs(candidate2) );
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
import java.util.*;
import java.math.*;
class Main {
    //
    static final int MOD = 1_000_000_007; // 10^9+7
    //static final int MAX = 2_147_483_646; // intの最大値
    static final int INF = 1_000_000_000; // 10^9
    static final int MAX = 10_000_000;
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s;
        int n,m;
        int[] ary;
        s = sc.next();
        if(s.equals("AAA")||s.equals("BBB")){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
    }
}



Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vd=vector<double>;
using vvd=vector<vd>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using vs=vector<string>;
#define rep(i,n) range(i,0,n)
#define range(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define LINF    	((ll)1ll<60)
#define INF     	((int)1<<30)
#define EPS     	(1e-9)
#define MOD     	(1000000007)
#define fcout(a)	cout<<setprecision(a)<<fixed
#define fs 			first
#define sc			second
#define PI			3.141592653589793

template<class S,class T>ostream& operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s; a=0;} return os;}

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	int n;cin>>n;
  	rep(_,n){
  	    string q,s;
  	    cin>>q>>s;
  	    reverse(all(q));
  	    int l=s.size();
  	    for(auto Q:q){
  	        switch(Q){
  	            case 'J': s=s.substr(l-1)+s.substr(0,l-1); break;
  	            case 'C': s=s.substr(1)+s.substr(0,1); break;
  	            case 'E': s=s.substr((l+1)/2)+s.substr((l+1)/2-1,l%2)+s.substr(0,l/2); break;
  	            case 'A': reverse(all(s)); break;
  	            case 'P': for(auto&c:s)if(isdigit(c))c=(c=='0'?'9':c-1); break;
  	            case 'M': for(auto&c:s)if(isdigit(c))c=(c=='9'?'0':c+1); break;
  	        }
  	    }
        cout<<s<<endl;
  	}
  	
	return 0;
}



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

#define ll long long int
#define rep(i,n) for(int (i)=0;(i) < (n);(i)++)
#define INF 1000000000000000000

using namespace std;

int main(void){
    int x[5],zero = 0;
    cin >> x[0] >> x[1] >> x[2] >> x[3] >> x[4];
    rep(i,5){
        if(x[i] == 0){
            zero = i + 1;
            break;
        }
    }
    cout << zero << endl;
    return 0;
}

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


int main(){
#ifndef ONLINE_JUDGE
    freopen("ip.txt", "r", stdin);
    freopen("op.txt", "w", stdout);
#endif
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; ++i){
		cin >> a[i];
	}
	int dp[n +1] = {0};
	dp[0] = 0;
	dp[1] = abs(a[1] - a[0]);
	for(int i = 2; i < n; ++i){
		dp[i] = min(abs(a[i -1] - a[i]) + dp[i -1], abs(a[i -2] - a[i]) + dp[i -2]);
	}

	cout << dp[n -1] << endl;
}


Measured memory_bytes: 4024
#include <bits/stdc++.h>
    #define rep(i,n) for(int i = 0; i < (n); i++)
     
    using namespace std;  
    using ll = long long;
    using P = pair<int,int>;
    
    
    ll gcd(ll x, ll y){
    	if(y==0){
    		return x;
    	} else{
    		return gcd(y,x%y);
    	}
    }
    int main() {
   
     ll k;
     cin >> k;
     ll sum = 0;
     
     for(ll a = 1; a <= k; a++){
     	for(ll b = 1; b <= k; b++){
     		for(ll c = 1; c <= k; c++){
     			sum += gcd(gcd(a,b),c);
     		}
        }
     }
     
      cout << sum << '\n';
     
     return 0;
    }

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A;
  cin >> A;
  long long B, N;
  cin >> B >> N;
  if (N >= B - 1){
    cout << A * (B - 1) / B << endl;
  } else {
    cout << A * N / B << endl;
  }
}

Measured memory_bytes: 3648
#include<iostream>
#include<cmath>
#include<iomanip>

int main(){
    double a,b,c,C;
    double S,L,h;
    double pi=acos(-1);

    std::cin>>a>>b>>C;

    C=C/180*pi;
    S=a*b*sin(C)/2;//面積を計算
    
    c=sqrt((double)a*(double)a+(double)b*(double)b-2*(double)a*(double)b*cos(C));//残りの辺を導出
    L=(double)a+(double)b+c;//周の長さを計算

    h=2*S/(double)a;

    std::cout<<std::fixed;
    std::cout<<std::setprecision(5)<<S<<" "<<std::flush;
    std::cout<<std::setprecision(5)<<L<<" "<<std::flush;
    std::cout<<std::setprecision(5)<<h<<std::endl;
    
    return 0;
}



Measured memory_bytes: 3488
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        x: String,
        y: String,
    }
    println!(
        "{}",
        if x < y {
            "<"
        } else if x > y {
            ">"
        } else {
            "="
        }
    );
}


Measured memory_bytes: 4352
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int l = String.valueOf(N).length();
		double ans = 0;
		if(l/2 == 3) {
			ans += 90909;
		}else if(l/2 == 2) {
			ans += 909;
		}else if(l/2 == 1){
			ans += 9;
		}
		if(l%2 == 1) {
			ans += N - Math.pow(10, l-1) + 1;
		}
		
		System.out.println((int)ans);
	}
}

Measured memory_bytes: 23764
/*																													   
 Templatka c++ Kacper Fis																							   																											   //
*/																													  
#include <functional>																							   
#include <bits/stdc++.h>																							   
																													   
using namespace std; 																								   
																													   
const int INF = 1000000001;																						   
const float PI = 3.14;	
const int mod = 1e9+7;																							   
typedef long long LL;																								   
																													   
typedef vector<int> vi;																								   
typedef list<int> li;																								   
typedef queue<int> qi; 																								   
typedef pair<int,int> ii; 																							   
typedef map<string,int> msi; //np msi['nazwa'] = 'liczba'															   
typedef vector<ii> vii; //vector par<int>, do tworzenia tablicy dla grafów wagowych #dijkstra #Bellman_Ford			   
typedef priority_queue< ii, vector<ii>, greater<ii> > pq; //kolejka priorytetowa vectorów par(top()=min) #dijkstra																													   																				   list<int>::iterator it;																								   
																				   
vector<ii>::iterator iter;																							   
																													   																				   
#define print_list(x) for(it = (x).begin(); it != (x).end(); it++) {cout << *it << " ";}							   
#define print_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++) {cout << *it2 << " ";}						   
#define search_list(x) for(it = (x).begin(); it != (x).end(); it++)													   
#define search_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++);											   
#define pb(x) push_back(x) 																							   
#define pf(x) push_front(x)																							   
#define mp(x, y) make_pair(x, y)                                                                                       
///////////////////////////////////////////////GLOBAL DEFINITIONS//////////////////////////////////////////////////////




///////////////////////////////////////////////FUNCTIONS/////////////////////////////////////////////////////////////




/////////////////////////////////////////////////////MAIN////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])																					 
{ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);                  												       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	set<int, greater<int> > s;
	int a, b, k;
	cin >> a >> b >> k;
	for(int i = 1; i <= 100; i++){
		if(a % i == 0 && b % i == 0){
			s.insert(i);
		}
	} 
	
	int licznik = 0;
	for(auto it : s){
		licznik++;
		//cout << it << endl;
		if(licznik == k){
			cout << it << endl;
			return 0;
		}
	}
	
	
	
	
	
	
	
	
	
						
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
      char str1[50],str2[50],str3[50];
      scanf("%s %s %s",str1,str2,str3);
      printf("%c%c%c\n",str1[0]-32,str2[0]-32,str3[0]-32);
      return 0;
}


Measured memory_bytes: 256