akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

typedef struct
{
	unsigned int a;
	unsigned int b;
} abc086b_t;

int concatenate (const abc086b_t * given_data)
{
	if      ( (* given_data).b <  10 ) return   10 * (* given_data).a + (* given_data).b;
	else if ( (* given_data).b < 100 ) return  100 * (* given_data).a + (* given_data).b;
	else                               return 1000 * (* given_data).a + (* given_data).b;
}

bool IsSquare (const abc086b_t * given_data)
{
	const unsigned int concatenated = concatenate( given_data );

	unsigned int iter        = 1;
	unsigned int iter_square = iter * iter;

	while (iter_square <= concatenated)
	{
		if (iter_square == concatenated)
		{ return true; }
		else
		{
			++iter;
			iter_square = iter * iter;
		}
	}

	return false;
}

void ABC086B (const abc086b_t * given_data)
{
	if   ( IsSquare(given_data) ) printf( "Yes\n" );
	else                          printf(  "No\n" );
}

int main (void)
{
	// variables for `main`
	abc086b_t given_data;
	int       retval_scanf;

	// STEP.01
	// read out the given data
	retval_scanf = scanf("%d %d", &given_data.a, &given_data.b);

	// STEP.02
	// calculate & output the answer
	ABC086B(& given_data);

	// STEP.END
	return EXIT_SUCCESS;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
using ll = long long;

template <typename T>
void print_vec(const vector<T>& v, bool is_reverse=false, ll num=0){
  if(num == 0) num = (ll)v.size();
  cout << endl; cout << "i=  ";for(ll i=0; i<num; i++) cout << i << "   ";cout << endl;  
  cout << "    ";
  if(is_reverse) for(ll i=num-1; i>=0; i--){ cout<<v[i]; if(i!=0) cout<<"   ";}
  else for(ll i=0; i<num; i++){ cout<<v[i]; if(i!=num-1) cout<<"   ";}
  cout << endl;
}

// template <typename T>
// void print_pairvec(const vector<T> &v, ll num=0){
//   if(num == 0) num = (ll)v.size();
//   cout << endl; for(ll i=0; i<num; i++){ cout << v[i].first << " " << v[i].second << endl;}
// }
template <typename T>
void print_pairvec(const T &_pair, ll num=0){
  cout << endl; for(pair<ll, int> x: _pair){ cout << x.first << " " << x.second << endl;}
}

template <typename T>
void print_vec2(const vector<vector<T>>& v){
  cout << endl; cout << "       ";
  for(ll i=0; i<v[0].size(); i++) cout << i << "   "; 
  cout << endl;
	for(ll i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(ll j=0; j<v[i].size(); j++){
			if(v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << "   ";
      else cout << "\x1B[31m" << v[i][j] << "   ";//https://stackoverrun.com/ja/q/12618775
		}
		cout << "\x1B[0m" << endl;
	}
}

int main(){
  int N, M;
  cin >> N >> M;
  vector<bool> ans(M, true);
  for(int i=0; i<N; i++){ 
    int k;
    cin >> k;
    vector<bool> is_like(k, false);
    for(int j=0; j<k; j++){
      int a;
      cin >> a;
      a--;
      is_like[a] = true;
    }
    for(int j=0; j<M; j++) if(is_like[j]==false) ans[j]=false;
  }

  int cnt = 0;
  for(int i=0; i<M; i++) if(ans[i]==true) cnt++;
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3628
import sys
input = sys.stdin.readline

# from collections import deque

def linput(_t=int):
    return list(map(_t, input().split()))

def gcd(n,m):
    while m: n,m = m, n%m
    return n

def lcm(n,m): return n*m//gcd(n,m)

def main():
    X = int(input())
    # res = 0
    # for s in S.split("-"):
    #     res = max(res, len(s))

    # print(301**5 - 300**5)

    for A in reversed(range(-310,310)):
        for B in reversed(range(-310,310)):
            if A**5 - B**5 == X:
                print(A, B)
                return
    


    # print(res)

    # print(("No","Yes")[res%2])


main()


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


void solve(std::string S){
    if(S=="ABC")
        cout << "ARC"<<endl;
    if(S=="ARC")
        cout << "ABC" << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cassert>
using namespace std;
#define MOD 998244353

class Comb{
    vector<long long> fact_num, fact_den;
    long long bipow(long long n, int m) {
        if (m == 0) return 1;
        if (m % 2 == 0) {
            n = (n * n) % MOD;
            return bipow(n, m / 2) % MOD;
        } else
            return (n * bipow(n, m - 1)) % MOD;
    }
public:
    Comb(int N){
        fact_num.resize(N+1, 0);
        fact_den.resize(N+1, 0);
        vector<long long> fact_denpow(N+1, 0);

        fact_num[0] = 1;
        for(int i=1; i<=N; i++) fact_num[i] = (fact_num[i-1] * i) % MOD;

        for(int i=0; i<=N; i++) fact_denpow[i] = bipow(i, MOD-2);
        fact_den[0] = 1;
        for(int i=1; i<=N; i++) fact_den[i] = (fact_den[i-1] * fact_denpow[i]) % MOD;
    }
    long long calc(int m, int n){
        assert(m >= n);
        return ((fact_num[m] * fact_den[n]) % MOD * fact_den[m-n]) % MOD;
    }
};

Comb comb(5555);
long long pow2[5555];

long long solve(long long K, long long N, int i){
    long long ans = 0;
    long long a = 0, b = 0;
    for(int j=1; j<=K; j++){
        int k = i - j;
        if(k <= 0 || K < k) b++;
        else if(j < k) a++;
    }
    
    for(int k=0; k<=min(N, a); k++){
        long long M = N - k;
        if(k+b-1 < 0) continue;
        long long tmp = comb.calc(M+k+b-1, k+b-1);
        tmp *= comb.calc(a, k);
        tmp %= MOD;
        tmp *= pow2[k];
        tmp %= MOD;
        ans += tmp;
        ans %= MOD;
    }
    return ans;
}

int main(){
    long long K, N;
    cin >> K >> N;

    pow2[0] = 1;
    for(int i=0; i<5000; i++)
        pow2[i+1] = (2*pow2[i])%MOD;

    for(int i=2; i<=2*K; i++){
        long long ans = solve(K, N, i);
        if(i % 2 == 0)
            ans += solve(K, N-1, i);
        ans %= MOD;
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 512
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuffer sb = new StringBuffer("");
        String[] s1 = br.readLine().trim().split(" ");
        int n = Integer.parseInt(s1[0]);
        int d = Integer.parseInt(s1[1]);
        int ans=0;
        for(int i=0;i<n;i++){
            String[] s = br.readLine().trim().split(" ");
            int x = Integer.parseInt(s[0]);
            int y = Integer.parseInt(s[1]);
            double dis = find(x,y);
            if(dis<=d+.0) ++ans;
        }
        System.out.println(ans);
    }
    static double find(int x, int y) {
        double dis = Math.sqrt((x*1L*x) + (y*1L*y));
        return dis;
    }
}

Measured memory_bytes: 54588
#include <stdio.h>
#include <math.h>
#include <string.h>

int main(void)
{
        long int n,i,d,l;
        char s[11];

        scanf("%s",s);
        l=strlen(s);
        n=0;d=0;
        for(i=0;i<l;i++){
                d+=s[i]-'0';
                n+=(s[i]-'0')*pow(10,l-i-1);
        }

        if(n%d==0)printf("Yes\n");
        else printf("No\n");
        return 0;
}


Measured memory_bytes: 2460
//          ★★ ASHWINI SHARMA ★★ 
#include <bits/stdc++.h>
using namespace std;
 
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (int i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (long long i = (n) - 1; i >= 0; i--)
#define foreach(it,ar) for ( typeof(ar.begin()) it = ar.begin(); it != ar.end(); it++ )
#define ull unsigned long long int
#define ll long long int
#define ui unsigned int
#define pb push_back
 
#define PI 3.1415926535897932385
#define INF 1e9
#define EPS 1e-7
#define MAXN 1000000005
#define MOD 1000000007 
                              //          ★★ ASHWINI SHARMA ★★      
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
ll exp(ll x, ll y, ll p)
{
    ll res = 1;   
    x = x % p;  
    while (y > 0)
    {
        if (y & 1)    
            res = (res*x) % p;
        y = y>>1;     
        x = (x*x) % p; 
    }
    return res;
}



int main() {
   
    fastio;
    int n;
    cin >> n;
    ll a[n];
    rep(i, n)
    cin >> a[i];
    ll pre[n] = {0};
    pre[n-1] = a[n-1];
    for(int i=n-2;i>=0;i--)
        pre[i] = (a[i] % MOD + pre[i+1] % MOD) % MOD;
    ll sum = 0;
    rep(i, n-1)
    {
        sum += (a[i] * pre[i+1]) % MOD;
        sum %= MOD;
    }
    cout << sum;



    return 0; 
}

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

using namespace std;

#define rep(i, a, b) for (int i = (a); i <= (b); i++)
typedef long long ll;
const int N = 2e5 + 100;

int n, a[N], b[N]; ll ans;
struct nod {
  int d, id;
  inline bool operator < (const nod &rhs) const {
    return d < rhs.d;
  }
} ;
priority_queue <nod> Q;

inline int ID(int x) {
  if (x > n) return x - n;
  if (x < 1) return x + n;
  return x;
}

int main() {
  scanf("%d", &n); rep(i, 1, n) scanf("%d", &a[i]);
  rep(i, 1, n) { scanf("%d", &b[i]); Q.push((nod) {b[i], i}); }
  while (!Q.empty()) {
    int p = Q.top().id, lr = b[ID(p + 1)] + b[ID(p - 1)];
    int c = (b[p] - a[p]) / lr; Q.pop();
    if (a[p] == b[p]) continue ; if (c <= 0) { puts("-1"); return 0; }
    b[p] -= lr * c; Q.push((nod) {b[p], p}); ans += c;
  }
  printf("%lld\n", ans);
  return 0;
}

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

int main() {
    int r, c, table[100][100];
    cin >> r >> c;
    for (int i = 0; i < r; i++) {
        for (int j = 0; j < c; j++) {
            cin >> table[i][j];
        }
    }
    int rsum[100], csum[100], tsum = 0;
    for (int i = 0; i < 100; i++) {
        rsum[i] = 0;
        csum[i] = 0;
    }
    for (int i = 0; i < r; i++) {
        for (int j = 0; j < c; j++) {
            rsum[i] += table[i][j];
            csum[j] += table[i][j];
            tsum += table[i][j];
        }
    }
    for (int i = 0; i < r; i++) {
        for (int j = 0; j < c; j++) {
            cout << table[i][j] << " ";
        }
        cout << rsum[i] << endl;
    }
    for (int i = 0; i < c; i++) {
        cout << csum[i] << " ";
    }
    cout << tsum << endl;
    return 0;
}


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

const int N = 200010;
typedef long long ll;

int a[N];

int main(){
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; ++ i){
        scanf("%d", &a[i]);
    }
    if (a[0]){
        printf("-1\n");
        return 0;
    }
    for (int i = 0; i < n - 1; ++ i){
        if (a[i] < a[i + 1] - 1){
            printf("-1\n");
            return 0;
        }
    }
    ll ans = 0;
    for (int i = n - 1; i >= 0; -- i){
        if (i < n - 1 && a[i] == a[i + 1] - 1) continue;
        ans += a[i];
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 1024
import Data.List(minimum)

opA :: (Int -> Int)
opA i = 2 * i

opB :: (Int -> Int -> Int)
opB i k = 2 * (abs $ subtract i k)  

likeFor :: (Int -> Int) -> (Int -> Int) -> [Int] -> [Int] -> [Int] 
likeFor opa opb [] acc = acc
likeFor opa opb src acc = likeFor opa opb (tail src) acc'
  where
    h = head src
    acc' = (minimum [opa h, opb h] + (head acc)) : acc

main = do
  ins <- fmap (fmap (read :: String -> Int) . words) . lines <$> getContents
  let ns = last ins
  let k = head $ head $ tail ins
  let result = likeFor opA (opB k) ns [0]
  putStrLn $ show $ head result

Measured memory_bytes: 892
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  vi A(n);
  for(auto &a:A)cin>>a;
  set<ll>se;
  ll ans=0;
  se.insert(llINF);
  se.insert(-llINF);
  for(int i=0;i<n;i++){
    auto lb = se.lower_bound(A[i]);
    --lb;
    if(*lb == -llINF)ans++;
    se.insert(A[i]);
  }
  cout<<ans<<endl;
  return 0;
}


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
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; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    vector<int> a(3);
    rep(i, 3) cin >> a[i];
    sort(all(a));
    int K;
    cin >> K;
    int sum = a.back();
    rep(i, K) {
        sum *= 2;
    }
    cout << a[0] + a[1] + sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("unroll-loops")
using namespace std;
using u16 = uint16_t;

u16 n;
uint ans;
u16 a[2000];
int main(){
  scanf("%hu", &n);
  for(uint i = 0; i < n; i++) scanf("%hu", &a[i]);
  sort(a, a + n);
  for(uint i = 0; i < n; i++) for(uint j = i + 1; j < n; j++) for(uint k = j + 1; k < n; k++) if(a[i] + a[j] > a[k]) ans++;
  printf("%u", ans);
}


Measured memory_bytes: 384
#include<stdio.h>
#define MAX 101

int count = 0;

/*
void bubble_sort(int n,int *A){
  int i,j,tmp;
  for(i=0;i<n-1;i++){
    for(j=n-1;j>i;j--){
      if(A[j]<A[j-1]){
        tmp = A[j];
        A[j] = A[j-1];
        A[j-1] = tmp;
        count++;
      }
    }
  }
}*/

int main(){
  int n,i,j,tmp;
  int A[MAX];
  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&A[i]);
  
  for(i=0;i<n-1;i++){
    for(j=n-1;j>i;j--){
      if(A[j]<A[j-1]){
        tmp = A[j];
        A[j] = A[j-1];
        A[j-1] = tmp;
        count++;
      }
    }
  }
//  bubble_sort(n,a);
  for(i=0;i<n-1;i++)
    printf("%d ",A[i]);
  printf("%d\n",A[i]);
  printf("%d\n",count);
  return 0;
}



Measured memory_bytes: 2048
#include <iostream>
#include <sstream>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <iomanip>
#include <numeric>
#include <climits>
#include <algorithm>
#include <cstdint>
using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;

    cout << ((b-a)*(b-a+1)/2) - b;
}

Measured memory_bytes: 3644
#include <stdio.h>

int main(void){

int i,j;
int tmp;
int x[3000], y[3000];

for(i=0;i<3000;i++){

scanf("%d %d", &x[i], &y[i]);
if(x[i] ==0 && y[i] == 0) break;

if(x[i] > y[i]){
tmp = x[i];
x[i] = y[i];
y[i] = tmp;
}
}

for(j=0;j<i;j++){
printf("%d %d\n", x[j], y[j]);
}

return 0;
}

Measured memory_bytes: 624
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Aeroui
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            int[] arr = new int[N];

            int sum = 0;
            for (int i = 0; i < N; i++) {
                arr[i] = in.nextInt();
                sum += arr[i];
            }

            int ans = 0;
            if (sum % 10 != 0) {
                out.println(sum);
                return;
            }

            for (int i = 0; i < N; i++) {
                int tmp = sum - arr[i];
                if (tmp % 10 == 0) continue;
                ans = Math.max(ans, tmp);
            }

            out.println(ans);
        }

    }
}



Measured memory_bytes: 21844
#include<stdio.h>
int main()
{
	int tanka,ryo,souryo=0,suryo=0,k=0,heikin,heikinkari;
	while(scanf("%d,%d",&tanka,&ryo)!=EOF)
	{
		souryo+=(tanka*ryo);
		suryo+=ryo;
		k++;
	}
	
	heikinkari=(suryo*10 /k);
	heikin=suryo/k;
	if(heikinkari%10>4)
	{
		heikin++;
	}
	
	printf("%d\n%d\n",souryo,heikin);
	return 0;
}
 

Measured memory_bytes: 1020
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define rep(i,n) REP(i,0,n)
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;


int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  rep(i, N) cin >> A[i];
  ll sum = accumulate(A.begin(), A.end(), 0LL);
  ll cnt = 0;
  rep(k, sum) {
    bool flag = true;
    rep(i, N) {
      ll tmp = floor(1.0 * A[i] / N);
      if(tmp > 0) flag = false;
      rep(j, N) {
        if(i == j) A[j] -= tmp * N;
        else A[j] += tmp;
      }
      cnt += tmp;
    }
    if(flag) break;
  }
  cout << cnt << endl;
  return 0;
}



Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var a, b, k int
	fmt.Scan(&a, &b, &k)

	min := a
	if b < a {
		min = b
	}

	count := 0
	for i := min; i >= 1; i-- {
		if a%i == 0 && b%i == 0 {
			count++
			if count == k {
				fmt.Println(i)
				break
			}
		}
	}
}


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

const long mod = 1000000007;
vector<long> fact, inv;

long power(long n, long k) {
  if (k == 0) return 1;
  long half = power(n, k / 2);
  if (k % 2 == 0) {
    return half * half % mod;
  } else {
    return half * half % mod * n % mod;
  }
}

long invert(long n) {
  return power(n, mod - 2);
}

void init() {
  fact.push_back(1);
  for (int i = 1; i < 110000; i++) {
    fact.push_back(i * fact.at(i - 1) % mod);
  }
  for (int i = 0; i < 110000; i++) {
    inv.push_back(invert(fact.at(i)));
  }
}

long combination(int n, int r) {
  return fact.at(n) * inv.at(r) % mod * inv.at(n - r) % mod;
}

int main() {
  init();
  int n, m;
  cin >> n >> m;
  map<int, int> p;
  for (int i = 2; i * i <= m; i++) {
    while (m % i == 0) {
      p[i]++;
      m /= i;
    }
  }
  if (m > 1) p[m]++;
  long ans = 1;
  for (auto x : p) {
    ans *= combination(n + x.second - 1, x.second);
    ans %= mod;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3188
A, B, C, D = map(int, input().split(' '))

i = 1

while (A > 0 and C >0):
    if i% 2 ==1:
        C = C - B
    else:
        A = A- D
    i += 1

if C <= 0:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9192
#include<bits/stdc++.h>
#include<unordered_map>
#include<string>
#include<math.h>
#define ll long long
using namespace std;
const ll INF = 1LL << 60;
const int inf = 1 << 30;
const ll N= 1e10;
inline void fastio()
{ 
     ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}
int cnt[10000001];
int main()
{
    int n;
    cin >> n;
    ll ans=0;
    for (ll i = 1; i <= n;i++)
    {
        for (ll j = i; j <= n;j+=i)
        {
            ans += j;
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
using namespace std;
int main() {
		ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    vector<pair<ll,ll>> v(n+1);
    for(int i=1;i<=n;i++){
			cin>>v[i].first;
			v[i].second = i;
		}
		sort(v.begin(),v.end());
    ll dp[n+2][n+1],k=1;
    memset(dp,0,sizeof(dp));
    for(int i=1;i<=n;i++){
				for(int j=1;j+i-1<=n;j++){
						ll L = j;
						ll R = j+i-1;
						dp[L][R] = max(v[k].first*abs(v[k].second-L)+dp[L+1][R] ,  v[k].first*abs(v[k].second-R)+dp[L][R-1]);
				}
				k++;
		}
		cout<<dp[1][n]<<"\n";
}
 



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

#define rep(i, a, n)  for(ll i=a; i<n; i++)
#define per(i, a, n)  for(ll i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define LONGMAX 1e18
#define intMAX 1000000000
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod = 1e9+7;


ll n, a,b;
int main(){
	cin >> n >> a >> b;
	ll ans = 0;
	if ((b-a)%2==0)ans = abs(b-a)/2;
	else {
		ll left = a - 1;
		ll right = n - b;
		// cout << left << " " << right << endl;
		if(left > right){
			ans +=  n-b+1;
			ans += abs(n-(a+n-b+1))/2;
		}else{
			ans += a;
			ans += abs(b-a)/2;
		}
	}
	cout << ans << endl;
}

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

int gcd(int a, int b) {
  if(a==0) return b;
  return gcd(b%a,a);
}


int main() {
  int a, b;
  
  while(cin>>a>>b) {
    cout << gcd(a,b) << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int sum=0;
    int a,b;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b;
        sum+=abs(a-b)+1;
    }
    cout<<sum;
    return 0;
}


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

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

  int cnt4=0, cntN4=0, cnt2=0;
  for (int i=0; i<n; i++) {
    long long tmp;
    cin >> tmp;
    if (tmp%4==0) {
      cnt4++;
    } else {
      if (tmp%2==0) {
        cnt2++;
      } else {
        cntN4++;
      }
    }
  }

  if (cnt2 != 0) cntN4++;

  if ((cnt4 - cntN4) < -1) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int T = sc.nextInt();
		long t[] = new long[N];
		for (int i=0;i<N;i++) {
			t[i] = sc.nextLong();
		}
		long sum =0;
		for(int i=1;i<N;i++) {
			if (t[i]-t[i-1]<T) {
				sum +=t[i]-t[i-1];
			} else {
				sum +=T;
			}
		}
		sum +=T;
		System.out.println(sum);
	}
}


Measured memory_bytes: 87348
/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	int N, M;
	std::vector<std::pair<int, int>> ab, cd;
	std::cin >> N >> M;
	ab.resize(N);
	cd.resize(M);
	for (auto& x : ab) {
		std::cin >> x.first >> x.second;
	}
	for (auto& x : cd) {
		std::cin >> x.first >> x.second;
	}

	auto distfn = [&](int a, int b)->int { return abs(ab[a].first - cd[b].first) + abs(ab[a].second - cd[b].second); };

	for (int i = 0; i < N; ++i) {
		int idx = 0;
		int distance = distfn(i, 0);
		for (int j = 1; j < M; ++j) {
			int dtmp = distfn(i, j);
			if (dtmp < distance) {
				idx = j;
				distance = dtmp;
			}
		}
		std::cout << (idx+1) << "\n";
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=205,INF=1<<30;
bool ok=true;
int siz[MAX];
map<pair<char,int>,int> MA;
string S;

bool check(int &i){
    if('a'<=S[i]&&S[i]<='z') return 1;
    if('A'<=S[i]&&S[i]<='Z') return 1;
    return 0;
}

int expr(int &i);
int num(int &i);

int expr(int &i){
    if(check(i)){
        char c=S[i];
        i++;
        i++;
        int x=expr(i);
        i++;
        if(siz[int(c-'A')]<=x) ok=false;
        if(MA.count(mp(c,x))==0) ok=false;
        return MA[mp(c,x)];
    }else{
        return num(i);
    }
}

int num(int &i){
    int a=0;
    while(i<si(S)&&'0'<=S[i]&&S[i]<='9'){
        a*=10;
        a+=int(S[i]-'0');
        i++;
    }
    return a;
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        memset(siz,-1,sizeof(siz));
        MA.clear();
        ok=true;
        
        for(int t=1;;t++){
            cin>>S;
            if(S=="."){
                if(t==1) return 0;
                cout<<0<<endl;
                break;
            }
            
            int flag=-1;
            for(int i=0;i<si(S);i++){
                if(S[i]=='=') flag=i;
            }
            
            if(flag==-1){
                string num;
                for(int i=2;i<si(S)-1;i++){
                    num+=(S[i]);
                }
                siz[int(S[0]-'A')]=stoi(num);
                
                continue;
            }
            
            int s;
            s=flag+1;
            int x=expr(s);
            
            while(si(S)>=flag) S.pop_back();
            
            s=2;
            int y=expr(s);
            
            if(siz[int(S[0]-'A')]<=y) ok=false;
            MA[mp(S[0],y)]=x;
            
            if(!ok){
                cout<<t<<endl;
                while(1){
                    cin>>S;
                    if(S==".") break;
                }
                break;
            }
        }
    }
}




Measured memory_bytes: 3196
S = input()
A = int(S[:2])
B = int(S[2:])
if 1 <= A <= 12 and 1 <= B <= 12:
    print('AMBIGUOUS')
elif 1 <= A <= 12:
    print('MMYY')
elif 1 <= B <= 12:
    print('YYMM')
else:
    print('NA')

Measured memory_bytes: 3060
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
using namespace std;

#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)

#define FOR(i,a,b) for(ll i = (a);i<(b);i++)
#define REP(i,a) FOR(i,0,(a))
#define MP make_pair

int main() {
  int w, a, b, ans;
  cin >> w >> a >> b;
  if (a > b) {
    int	tmp = a;
    a =	b;
    b =	tmp;
  }

  if (b <= a + w) {
    ans = 0;
  } else {
    ans = b - (a + w);
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
/*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???
using std::sort;
int main() {
	int num;
	int sides[3];

	cin >> num;
	for (size_t i = 0; i < num; i++)
	{
		int a = 0;
		int b = 0;
		int c = 0;

		cin >> sides[0] >> sides[1] >> sides[2];
		sort(sides, sides+3);
		for (size_t j = 0; j < 3; j++)
		{
			// ?????§??????
			a = std::pow(sides[0], 2);
			b = std::pow(sides[1], 2);
			c = std::pow(sides[2],2);	
		}
		if ((a + b) == c) {
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3000
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#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--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
struct edge { int to, cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
const double EPS = 1e-10;
const int MOD = 1e9+7;
const double PI = acos(-1.0);

const int mx4[] = {0,1,0,-1};
const int my4[] = {1,0,-1,0};
const int mx8[] = {0,1,1,1,0,-1,-1,-1};
const int my8[] = {1,1,0,-1,-1,-1,0,1};

int main()
{
	int n,d;
	cin >> n >> d;
	int x[n][d];
	rep(i,n) rep(j,d) cin >> x[i][j];

	int ans = 0;
	for(int i = 0; i < n; i++){
		for(int j = i+1; j < n; j++){
			double sum = 0;
			for(int k = 0; k < d; k++){
				sum += (x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
			}
			if((int)sqrt(sum)*(int)sqrt(sum) == sum) ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
typedef long double ld;
const ld eps = 1e-9;

vector<ld> quadraticEquation(ld a, ld b, ld c){
    ld d = b*b - 4*a*c;
    if(abs(a) < eps) return { -c/b };
    if(abs(d) < eps) return { (-b + sqrt(d)) / (2*a) };
    if(0 < d){
        int sign = (b >= 0) ? 1 : -1;
        ld x1 = (-b - sign * sqrt(d))/(2.0 * a), x2 = c / (a * x1);
        return { x1, x2 };
    }
    return {};
}

ld simpson(ld x0, ld x1, function<ld(ld)> f){
    const int n = 1e4;
    const ld dx = (x1 - x0) / n;
    ld a = f(x0) + f(x0 + dx * n);
    int i;
    for(i=1; i<n; i+=2){
        a += 4.0 * f(x0 + dx * i);
    }
    for(i=2; i<n; i+=2){
        a += 2.0 * f(x0 + dx * i);
    }
    return a*dx/3.0;
}

ld W,H,N;
ld a[55], p[55], q[55];

ld f(int i, ld x){
    return a[i]*(x-p[i])*(x-p[i]) + q[i];
}

bool inside(ld x, ld y){
    if (x < -eps || W < x-eps) return false;
    if (y < -eps || H < y-eps) return false;
    return true;
}

ld solve(){
    vector<ld> es = { 0, W };
    rep(i,N){
        auto xs = quadraticEquation(a[i], -a[i]*2*p[i], q[i] + a[i]*p[i]*p[i]); // on x axis
        for(ld x : xs) if(inside(x,f(i,x))) es.push_back(x);
        rep(j,i){
            ld aa = a[i] - a[j];
            ld bb = -a[i]*2*p[i] - (-a[j]*2*p[j]);
            ld cc = (q[i] + a[i]*p[i]*p[i]) - (q[j] + a[j]*p[j]*p[j]);
            auto cs = quadraticEquation(aa, bb, cc);
            for(ld x : cs) {
                if(inside(x,f(i,x))){
                    es.push_back(x);
                }
            }
        }
    }
    sort(es.begin(), es.end());
    ld ans = 0;
    rep(i,es.size()-1){
        ld x1 = es[i], x2 = es[i+1];
        ld m = (x1+x2) / 2;
        int idx = -1;
        ld maxy = -1e9;
        rep(j,N){
            if(maxy < f(j,m)){
                maxy = f(j,m);
                idx = j;
            }
        }
        if(maxy > -eps){
            ans += simpson(x1, x2, [&](ld x){
                    ld dy = a[idx] * 2 * (x - p[idx]);
                    return sqrt(1 + dy*dy);
                });
        }
    }
    return ans;
}

int main(){
    while(cin >> W >> H >> N){
        rep(i,N) cin >> a[i] >> p[i] >> q[i];
        printf("%.10lf\n", (double)solve());
    }
}

Measured memory_bytes: 3380
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;
#define N 10000+10
int per[N];
struct Point
{
	double x,y;
}p[N];
struct Edge
{
	int s,e;
	double w;
}a[N*N];
double ma(Point a,Point b)
{
	return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
bool cmp(Edge a,Edge b)
{
	return a.w>b.w;
}
int Find(int x)
{
	while(x!=per[x])
		x=per[x];
	return x;
}
int Judge(int x,int y)
{
	int fx=Find(x);
	int fy=Find(y);
	if(fx!=fy)
	{
		per[fx]=fy;
		return 1;
	}
	return 0;
}
int main()
{
	int i,n,m,x,y;
	while(~scanf("%d%d",&n,&m))
	{
		for(i=1;i<=n;i++)
		{
			per[i]=i;
			scanf("%lf%lf",&p[i].x,&p[i].y);
		}
		double sum=0;
		for(i=0;i<m;i++)
		{
			scanf("%d%d",&x,&y);
			a[i].s=x;a[i].e=y;
			a[i].w=ma(p[x],p[y]);
			sum+=a[i].w;
		}
		sort(a,a+m,cmp);
		double tmp=0;
		for(i=0;i<m;i++)
		{
			if(Judge(a[i].s,a[i].e))
				tmp+=a[i].w;
		}
		printf("%.3lf\n",sum-tmp);
	}
	return 0;
}

Measured memory_bytes: 1748
N = int(input())
A = list(map(int, input().split()))

A.sort()
A.reverse()
ans = 0
ans += A[0]

if len(A) % 2 == 0:
  tmp = 0
  for i in range(1, int((N-2)/2)+1):
    tmp += A[i] * 2
else:
  tmp = 0
  for i in range(1, int((N-1)/2)+1):
    tmp += A[i] * 2
  tmp -= A[int((N-1)/2)]

ans += tmp
print(ans)


Measured memory_bytes: 31520
import heapq

NM = input().split(' ')
N = int(NM[0])
M = int(NM[1])
AN = input().split(' ')
An = [ int(i)*(-1) for i in AN ] 
heapq.heapify(An)

for _ in range(M):
    max_num = heapq.heappop(An) * (-1)
    cooponed_num = max_num//2
    heapq.heappush(An,cooponed_num*(-1))
print(sum(An) * (-1))

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

using namespace std;

const int maxn = 100000 + 10;

int n , sg[maxn] , fa , ans;
vector < int > Edge[maxn];

int DFS( int u , int fa = 0 ){
	for(auto v : Edge[u]){
		if( v == fa )
			continue;
		sg[u] ^= (DFS( v , u ) + 1);
	}
	return sg[u];
}

int main( int argc , char * argv[] ){
	scanf( "%d" , & n );
	for(int i = 2 ; i <= n ; ++ i){
		int u , v;
		scanf( "%d%d" , & u , & v );
		Edge[u].emplace_back( v );
		Edge[v].emplace_back( u );
	}
	if( DFS( 1 ) )
		puts( "Alice" );
	else
		puts( "Bob" );
	return 0;
}



Measured memory_bytes: 10752
import java.util.*;

class Main {
    public static void main(String args[]) {
        Scanner inp = new Scanner(System.in);
        do_(inp);
        inp.close();
    }
    public static void do_(Scanner inp) {
        int a = inp.nextInt();
        int b = inp.nextInt();
        int c = inp.nextInt();
        System.out.println(Math.min(a * b, c));
    }
}


Measured memory_bytes: 21712
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x)                                         \
  cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
       << " " << __FILE__ << endl;

// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

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

int main() {
  int n;
  cin >> n;
  priority_queue<double, vector<double>, greater<double>> v;
  rep(i, n) {
    double x;
    cin >> x;
    v.push(x);
  }

  rep(i, n - 1) {
    double v1 = v.top();
    v.pop();
    double v2 = v.top();
    v.pop();
    double p = (v1 + v2) / (double)2.0;
    v.push(p);
  }

  double ans = v.top();

  printf("%.5f\n", ans);

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;

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

const LL  INF=1<<31;
const LL MOD=1000000007;



int main(){
     string s;
     cin>>s;
     int st=-1,fi=-1;
     for(int i=0;i<s.size();++i){
          if(st==-1&&s[i]=='A')st=i;
          if(st!=-1&&s[i]=='Z')fi=i;
     }
     cout<<fi-st+1<<endl;
}

Measured memory_bytes: 640
#include<cmath>
#include<cstdio>
#include<vector>
#include<algorithm>

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

using namespace std;

const double EPS=1e-5;
const double INF=1e77;

struct point{
	double x,y;
	point():x(0),y(0){}
	point(double x,double y):x(x),y(y){}
	point operator-(const point &a)const{ return point(x-a.x,y-a.y); }
};

bool operator< (const point &a,const point &b){ return a.x+EPS<b.x || abs(a.x-b.x)<EPS && a.y+EPS<b.y; }
bool operator!=(const point &a,const point &b){ return abs(a.x-b.x)>EPS || abs(a.y-b.y)>EPS; }

double cross(const point &a,const point &b){ return a.x*b.y-a.y*b.x; }

struct line{
	point a,b;
	line(const point &a,const point &b):a(a),b(b){}
};

typedef vector<point> polygon;

enum{CCW=1,CW=-1,ON=0};
int ccw(const point &a,const point &b,const point &c){
	double rdir=cross(b-a,c-a);
	if(rdir> EPS) return CCW;
	if(rdir<-EPS) return CW;
	return ON;
}

polygon convex_hull(vector<point> &P){
	int n=P.size();
	polygon CH;
	if(n<=1){
		CH.insert(CH.end(),P.begin(),P.end());
		return CH;
	}
	sort(P.begin(),P.end());

	rep(_,2){
		int m=0;
		vector<point> half(n);
		rep(i,n){
			half[m++]=P[i];
			while(m>=3 && ccw(half[m-3],half[m-2],half[m-1])!=CCW){
				half[m-2]=half[m-1];
				m--;
			}
		}
		CH.insert(CH.end(),half.begin(),half.begin()+m-1);
		reverse(P.begin(),P.end());
	}

	return CH;
}

double dist(const point &a,const point &b){
	return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}

double dist(const line &L,const point &p){
	return abs(cross(L.b-L.a,p-L.a))/dist(L.a,L.b);
}

double area(const point &a,const point &b,const point &c){
	return abs(cross(b-a,c-a))/2;
}

int main(){
	int n; scanf("%d",&n);
	vector<point> P(n);
	rep(i,n) scanf("%lf%lf",&P[i].x,&P[i].y);

	polygon CH=convex_hull(P);

	if(CH.size()==3){
		double A=INF;
		rep(i,n) if(P[i]!=CH[0] && P[i]!=CH[1] && P[i]!=CH[2]) { // テ・ツ?クテ・ツ個?、ツサツ・テ・ツ、ツ姪」ツ?ョテァツつケ
			A=min(A,dist(CH[0],CH[1])*dist(line(CH[0],CH[1]),P[i])/2);
			A=min(A,dist(CH[1],CH[2])*dist(line(CH[1],CH[2]),P[i])/2);
			A=min(A,dist(CH[2],CH[0])*dist(line(CH[2],CH[0]),P[i])/2);
		}
		printf("%.1f\n",area(CH[0],CH[1],CH[2])-A);
	}
	else{ // CH.size()>=4
		n=CH.size();
		CH.resize(2*n);
		rep(i,n) CH[n+i]=CH[i];

		double ans=0;
		rep(i,n) for(int j=i+1;j<n;j++) {
			if((j-i)%n==1 || (j-i)%n==n-1) continue;

			int lo=i,hi=j;
			while(lo<hi){
				int mi1=(lo+hi)/2,mi2=mi1+1;
				if(area(CH[i],CH[j],CH[mi1])<area(CH[i],CH[j],CH[mi2])) lo=mi1+1; else hi=mi2-1;
			}
			int k=lo;


			lo=j,hi=n+i;
			while(lo<hi){
				int mi1=(lo+hi)/2,mi2=mi1+1;
				if(area(CH[j],CH[n+i],CH[mi1])<area(CH[j],CH[n+i],CH[mi2])) lo=mi1+1; else hi=mi2-1;
			}
			int l=lo;

			ans=max(ans,area(CH[i],CH[j],CH[k])+area(CH[j],CH[n+i],CH[l]));
		}
		printf("%.1f\n",ans);
	}

	return 0;
}

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		StringBuilder S = new StringBuilder(s);
		if(s.length() == 2) {
			System.out.println(s);
		}else if(s.length() == 3) {
			S.reverse();
			System.out.println(S);
		}
	}
}

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

int main()
{
  ll a,b,c, ans;
  cin >> a >> b >> c;
  if (b == 0) {
    cout << 0 << endl;
    return 0;
  }
  ll d = b + c;
  ans = a / d * b;
  if(a % d) {
    ans += min(b, a % d);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3660
d = int(input())
C = list(map(int, input().split()))
S = []
for i in range(d):
    S.append(list(map(int, input().split())))
'''
T = [0]
for i in range(d):
    T.append(int(input()))
'''
#print(S)
#print(T)

#最終開催日
Last = [0 for i in range(26)]

#各Scores
Scores = [[0 for i in range(26)] for j in range(d+1)]

for day in range(1, d+1):
    for num in range(26):
        Scores[day][num] = Scores[day-1][num] - C[num] * (day - Last[num])
    minus_total = sum(Scores[day])

    max_score = -float("inf")
    for contest in range(26):
        plus = S[day-1][contest]
        score = minus_total - Scores[day-1][contest] + plus
        if max_score < score:
            ap_contest = contest
            max_score = score

    Last[ap_contest] = day
    Scores[day][ap_contest] = plus
    #print(Scores[day])
    print(ap_contest + 1)
    #print(score)

Measured memory_bytes: 69428
import java.io.*;

class Main {
  public static void main(String[] args)throws IOException{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringBuilder sb = new StringBuilder();
    while(true){
      String data[] = br.readLine().split(" ");
      int a = Integer.parseInt(data[0]);
      int b = Integer.parseInt(data[1]);
      if(a == 0 && b == 0)
    	  break;

      for(int i = 0; i < a; i++){
          for(int j = 0; j < b; j++){
              if((i + j) % 2 == 0)
                sb.append("#");
              else
                sb.append(".");
          }
          sb.append("\n");
      }
      sb.append("\n");
    }
    System.out.print(sb);
  }
}

Measured memory_bytes: 25620
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define SF scanf
#define PF printf
#define MAXN 100010
using namespace std;
typedef long long ll;
int n;
ll a,b,c,d;
ll gcd(ll x,ll y){
	if(y==0)
		return x;
	return gcd(y,x%y);
}
int main(){
	SF("%d",&n);
	while(n--){
		SF("%lld%lld%lld%lld",&a,&b,&c,&d);
		if(a<b){
			PF("No\n");
			continue;
		}
		if(b>d){
			PF("No\n");
			continue;
		}
		if(c+1>=b){
			PF("Yes\n");
			continue;
		}
		ll g=gcd(b,d);
		if((a-c-1ll)/g-(a-b)/g>0)
			PF("No\n");
		else
			PF("Yes\n");
	}
} 

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int N, K;
    cin >> N >> K;
    vector<int> h(N);
    rep(0, i, N)
    {
        cin >> h[i];
    }
    sort(all(h));
    int ans = h[N - 1] - h[0];
    rep(0, i, N - K + 1)
    {
        int s = h[i + K - 1] - h[i];
        ans = min(ans, s);
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
/* ALDS1_6_C: Quick Sort */

#include <iostream>

struct Card {
    char suit;
    int number;
    int order;
};

int partition(Card cards[], int p, int r) {
    int pivot_num = cards[r].number;
    int i = p - 1;
    for (int j = p; j < r; j++) {
        if (cards[j].number <= pivot_num) {
            i++;
            std::swap(cards[i], cards[j]);
        }
    }
    std::swap(cards[i + 1], cards[r]);
    return i + 1;
}

void quick_sort(Card cards[], int p, int r) {
    if (r <= p) return;
    int q = partition(cards, p, r);
    quick_sort(cards, p, q - 1);
    quick_sort(cards, q + 1, r);
}

bool is_stable(int n_cards, Card cards[]) {
    for (int i = 0; i < n_cards; i++) {
        Card c1 = cards[i];
        Card c2 = cards[i + 1];
        if (c1.number == c2.number && c2.order < c1.order)
            return false;
    }
    return true;
}

int main() {
    std::ios::sync_with_stdio(false);

    int n_cards;
    std::cin >> n_cards;

    int number;
    char suit;
    Card cards[n_cards + 1];
    for (int i = 0; i < n_cards; i++) {
        std::cin >> cards[i].suit >> cards[i].number;
        cards[i].order = i;
    }
    Card guard = { '-', 0, 0 };
    cards[n_cards] = guard;

    quick_sort(cards, 0, n_cards - 1);
    bool stable = is_stable(n_cards, cards);

    std::cout << (stable ? "Stable" : "Not stable") << "\n";
    for (int i = 0; i < n_cards; i++) {
        std::cout << cards[i].suit << " " << cards[i].number << "\n";
    }
    return 0;
}

Measured memory_bytes: 2380
N,H=map(int,input().split())
B=[]
A=0
for _ in range(N):
    a,b=map(int,input().split())
    A=max(A,a)
    B.append(b)
B.sort(reverse=True)
ans=(H-1)//A+1
for i in range(N):
    H-=B[i]
    if H<=0:
        ans=min(ans,i+1)
        break
    ans=min(ans,(H-1)//A+1+i+1)
print(ans)

Measured memory_bytes: 13044
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
#define rp(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define chmin(x,y) x=min(x,(y))

int main(){
	int D,G; cin>>D>>G;
	G /= 100;
	vvi PC(D, vi(3));
	rp(i,0,D){
		cin>>PC[i][0]>>PC[i][1];
		PC[i][1] /= 100;
		PC[i][2] = (i+1)*PC[i][0] + PC[i][1];
	}

	// cout<<D<<" "<<G<<"\n";
	// rp(i,0,D)
	// 	cout<<PC[i][0]<<" "<<PC[i][1]<<" "<<PC[i][2]<<"\n";
	// cout<<"(1<<D)-1: "<<(1<<D)-1<<"\n";

	int ans = INT_MAX;
	int n = 1<<D;
	rp(bit, 1, n){
		int tot = 0;
		int cnt = 0;
		// cout<<bitset<10>(bit)<<"\n";
		rp(j, 0, D){
			if(bit & (1<<j)){
				cnt += PC[j][0]; // count
				tot += PC[j][2]; // total
			}
		}

		if(tot >= G) chmin(ans, cnt);

		rp(j, 0, D){
			if(bit & (1<<j)){
				int now_cnt = cnt - PC[j][0];
				int now_tot = tot - PC[j][2];
				// cout<<" j+1 "<<j+1;
				// cout<<" now_cnt "<<now_cnt;
				// cout<<" now_tot "<<now_tot;
				// cout<<"\n";
				rp(k, 1, PC[j][0]){ // [1,p-1]
					// cout<<" calc tot "<<now_tot + (j+1)*k;
					// cout<<" calc cnt "<<now_cnt + k;
					// cout<<"\n";
					if(now_tot + (j+1)*k >= G){
						chmin(ans, now_cnt + k);
					}
				}
			}
		}

	}

	// if(ans == INT_MAX){
	// 	puts("NG");
	// }
	// else{
		cout<< ans <<endl;
	// }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
     
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define mp  make_pair
#define all(v) (v).begin(), (v).end()
#define hell 1000000007  
#define hell2 998244353 

int solve(){
    int n;
    cin>>n;
    int x=0,a[n];
    rep(i,0,n){cin>>a[i]; x=(x^a[i]);}
    rep(i,0,n) cout<<(x^a[i])<<" ";
    return 0;
}   
     
signed main(){
    IOS;
    int t=1;
  //  cin>>t;
    while(t--){
        solve();
        cout<<"\n";
    }
//    return 0;
} 

Measured memory_bytes: 5088