akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vll = vector<ll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	for (auto &u : v) os << u << el;
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}

int main() {
	ll N, K; cin >> N >> K;
	vll A(N); cin >> A;

	sort(begin(A), end(A));
	
	ll ng = -LLINF, ok = LLINF;
	while (llabs(ng - ok) > 1) {
		ll X = (ng + ok) / 2;
		ll cnt = 0;
		//cout << X << endl;
		for (int i = 0; i < N - 1; i++) {
			if (A[i] < 0) {
				ll aa = -A[i];
				ll xx = llabs(X);
				ll num;

				if (X < 0) num = (xx + aa - 1) / aa;
				else if (X == 0) num = 0;
				else num = xx / aa;

				if (X != 0) num *= -(X / xx);
				cnt += N - (lower_bound(begin(A) + i + 1, end(A), num) - begin(A));
			} else if (A[i] > 0) {
				if (X > 0) {
					ll num = X / A[i];
					cnt += (--upper_bound(begin(A) + i + 1, end(A), num) - begin(A)) - i;
				}
			} else {
				if (X >= 0) {
					cnt += N - i - 1;
				}
			}
		}
		if (cnt >= K) ok = X;
		else ng = X;
		//cout << cnt << endl;
	}
	cout << ok << endl;
	return (0);
}


Measured memory_bytes: 1792
/* be name Khoda */
#include <bits/stdc++.h>
using namespace std;

const int N = 200 * 1001, inf = 1e9;
int n;
long long a[N], res;
long double d[N];
map<pair<int, int>, int> cnt;

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> d[i];
		a[i] = llround(d[i] * inf); 
		int two = 0, five = 0;
		while (a[i] % 2 == 0) {
			two++;
			a[i] /= 2;
		}
		while (a[i] % 5 == 0) {
			five++;
			a[i] /= 5;
		}
		cnt[{two, five}]++;
	}
	for (auto p1: cnt) 
		for (auto p2: cnt) {
			if (p1.first.first + p2.first.first >= 18 && p1.first.second + p2.first.second >= 18) {
				if (p1 < p2)
					res += 1LL * p1.second * p2.second;
				else if (p1 == p2)
					res += 1LL * p1.second * (p1.second - 1) / 2;
			}
		}
	cout << res << "\n";
}


Measured memory_bytes: 8440
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef vector<lint> vlint;

#define inf 1e+9
#define endl "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define rep_rev(i, n) for (int i = n-1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()

#define pb push_back
#define eb emplace_back
#define Size(c) (int)(c).size()

#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))

template <class T> using pq = priority_queue<T>;
template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>;

template <class T, class S> inline bool chmax(T &a, S b) {
    if(a < b) {a = b;return 1;} return 0;
}
template <class T, class S> inline bool chmin(T &a, S b) {
    if(a > b) {a = b;return 1;} return 0;
}
template <class T>
void line(vector<T> &x){for (auto&& xi : x) cin >> xi;}

inline void IN(void){ return;}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){ cin >> first; IN(rest...); return;}

#define INT(...) int __VA_ARGS__; IN (__VA_ARGS__)
#define LINT(...) lint __VA_ARGS__; IN (__VA_ARGS__)
#define STR(...) string __VA_ARGS__; IN(__VA_ARGS__)

template <class T> void UNIQUE(vector<T> &x) {
    sort(all(x)); x.erase(unique(all(x)), x.end());
}
template <class T> void print_vec(T first, T end){
    for (auto i = first; i < end - 1; i++) cout << *i << " ";
    cout << *(end-1) << endl;
}

template<class... T>
void debug_print(T... args){
    vector<lint> tmp = initializer_list<lint>{args...};
    print_vec(all(tmp));
}
template<class T>
void print(T a){ cout << a << endl;}

vector<string> Yes = {"No", "Yes"};
vector<string> YES = {"NO", "YES"};

int ord(char x){ return (int)(x - 'a');}
char chr(lint x){ return (char)(x + (lint)('a'));}
lint mod = 1e9+7;
// lint mod = 

lint sum(vlint a){lint ret = 0; for(auto&& v:a) ret += v; return ret;}
lint vmini(vlint a, lint &index){
    lint ret = LLONG_MAX;
    rep(i, Size(a)){ if (chmin(ret, a[i])) index = i;}
    return ret;
}
lint vmaxi(vlint a, lint &index){
    lint ret = -LLONG_MAX;
    rep(i, Size(a)){ if (chmax(ret, a[i])) index = i;}
    return ret;
}

lint vmin(vlint a){
    lint ret = LLONG_MAX; for (auto && v : a) chmin(ret, v); return ret;
}
lint vmax(vlint a){
    lint ret = -LLONG_MAX; for (auto && v : a) chmax(ret, v); return ret;
}


vlint base_3(int k){
    vlint ret;
    while (k > 0){
        ret.pb(k % 3);
        k /= 3;
    }
    reverse(all(ret));
    return ret;
}

lint dist(lint x, lint y){
    return x*x + y*y;
};
int main(){
    LINT(n, d);
    lint ret = 0;
    lint x, y;
    rep(i, n){
        IN(x, y);
        if (d * d >= dist(x, y)) ret ++;
    }
    print(ret);
}


Measured memory_bytes: 3592
#include <stdio.h>
#include <stdlib.h>
#include <float.h>
#include <math.h>

int main(void){

	double x, y;
	unsigned int X;
	unsigned int K = 0;

	x=1.;
	y=0.;

    scanf("%3d", &X);
	const double theta_x = X * (M_PI / 180.0);
  	double theta = 0;

	while(1){
            theta += theta_x;
		x += cos(theta);
		y += sin(theta);
		K++;
      if(fabs(x)-0. < 1e-7 && fabs(y)-0. < 1e-7){
        break;
    }
      }
  
	printf("%d\n", K+1);

	return 0;
}

Measured memory_bytes: 2472
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <climits>
using namespace std;

struct Edge { int from, to; };
vector<Edge> edges;

int main() {
    int m, n, x, y;
    cin >> m >> n;

    edges.clear();
    int c[21] = {};
    for (int i=0; i<n; ++i) {
        cin >> x >> y;
        edges.push_back((Edge){x, y});
        c[y] ++;
    }

    for (int i=0; i<m; ++i) {
        for (int su=1; su<=m; ++su) {
            if (c[su] != 0) continue;
            cout << su << endl;
            c[su] = INT_MAX;
            for (int j=0; j<n; ++j) {
                if (edges[j].from == su) {
                    c[edges[j].to] --;
                }
            }
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 1212
#include<iostream>
#include<string>
using namespace std;
int main() {

	int N;
	string A, B, C;
	cin >> N;
	cin >> A;
	cin >> B;
	cin >> C;
	int num = 2 * N;

	for (int i = 0; i < N; i++) {
		if (A[i] == B[i]&&A[i]==C[i])num-=2;
		else {
			if (A[i] == B[i])num--;
			if (A[i] == C[i])num--;
			if (B[i] == C[i])num--;
		}
		
	}

	cout << num << endl;

	return 0;
}

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

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(i, a, b) for(int i = (a); i > (b); --i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<int, int> Pair;
typedef pair<ll, ll> PL;
typedef priority_queue<int> PQ;
typedef priority_queue<int, V, greater<int>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;

string S;

int main() {
    cin >> S;
    ll N = S.length();
    ll ans = 0;
    REP(i, 1 << (N - 1)) {
        ll tmp = 0, pre = 0;
        REP(j, N - 1) {
            if(i & 1 << j) {
                string s = S.substr(pre, j - pre + 1);
                tmp += stoll(s);
                pre = j + 1;
            }
        }
        tmp += stoll(S.substr(pre, N - pre));
        ans += tmp;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
package main

import (
  "fmt"
  "sort"
)

func main() {
  var a, b, c int
  fmt.Scan(&a)
  fmt.Scan(&b)
  fmt.Scan(&c)
  data := []int{a, b, c}
  sort.Ints(data)
  fmt.Print(data[2]*10+data[1]+data[0])
}


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

int main(){

	int W, H, x, y, r;

	cin >> W >> H >> x >> y >> r;

	if ((x + r) <= W && (x - r) >= 0 && (y + r) <= H && (y - r) >= 0)
	{
		cout << "Yes"<<endl;
	}
	else{ cout << "No"<<endl; }

	return 0;
}

Measured memory_bytes: 1160
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <chrono>
#include <cstring>
#include <functional>
#include <iostream>
#include <istream>
#include <map>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <iostream>
#include <iomanip>
#include <math.h>
#include <cmath>
#include <array>
#include <complex>
#include <limits>

using namespace std;
#define ll long long
#define reg register int
const int N = 100000;


class Solve{
	public:
		void solution(){
			ll n;
			cin >> n;
            vector<ll> array(n);
            for(int i=0;i<n;i++)cin >> array[i];
            ll stool = 0;
            ll curmax = array[0];
            for(int i=1;i<n;i++){
                if(array[i] > curmax){
                    curmax = array[i];
                }
                else{
                    stool += curmax - array[i];
                }
            }
            cout << stool << endl;
			return;
		}

};

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	Solve s;
	// int testCase;
	// scanf("%d", &testCase);
	// while(testCase--)
		s.solution();
	return 0;
}

Measured memory_bytes: 4780
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        try {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char c = s.charAt(s.length()-1);
        if (c != '1' && c != '3' && c != '7' && c != '9') {
            System.out.println(-1);
            return;
        }
        K = Integer.parseInt(s);
        initialize(c - '0');
        System.out.println(func(0, 0));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    
    static int K;
    static int[] ary;
    static int[] ok = new int[]{7, 77, 777, 7777, 77777, 777777, 7777777};
    
    static void initialize(int num) {
        ary = new int[10];
        for (int i = 0; i < 10; i++) {
            int t = num * i;
            ary[t - t/10*10] = i;
        }
    }
    
    static int func(int num, int count) {
        int t = 7 - (num - num/10*10);
        if (t < 0) t = 10 + t;
        num = num + K * ary[t];
        for (int i = 0; i < ok.length; i++) {
            if (num == ok[i]) {
                return count + i + 1;
            }
        }
        return func(num/10, ++count);
    }
}


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

#define rep(x, y) for (int i = (x); i < (y); i++)

typedef long long ll;

using namespace std;

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

    int n = 0;
    rep(0, 4) {
        switch (s[i]) {
            case '+':
                n++;
                break;
            case '-':
                n--;
                break;
        }

    }

    cout << n << endl;

    return 0;
}

Measured memory_bytes: 256
n,k=map(int,input().split())
x=list(map(int,input().split()))
c=10**9
for i in range(n-k+1):
	h=x[i]
	m=x[i+k-1]
	H=abs(h)
	M=abs(m)
	if h*m<0:
		c=min(c,2*H+M,2*M+H)
	else:
		c=min(c,max(M,H))
print(c)

Measured memory_bytes: 14224
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define lld long double
#define w(x) ll x;cin>>x;while(x--)
#define mod 1000000007
#define speed ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;

int main(){
    speed;
    ll n;   cin>>n;
    ll cnt=0;
    for(ll i=1;i<n;i++){
        for(ll j=1;j<n;j++){
            if(i*j>=n)  break;
            else{
                cnt++;
            }
        }
    }
    cout<<cnt<<'\n';
    return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define ll int
const ll N = 1e3 + 5, M = 1e9 + 7;
ll dp[N][N] = {0, 1};
int main()
{
    ios::sync_with_stdio(0), cin.tie(0);
    ll h, w;
    string s;
    cin >> h >> w;
    for (ll i = 1; i <= h; i++)
    {
        cin >> s;
        for (ll j = 1; j <= w; j++)
            if (s[j - 1] == '.')
                dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]) % M;
    }
    cout << dp[h][w];
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define mp make_pair
#define all(x) x.begin(), x.end()
#define EPS 1e-9
#define X real()
#define Y imag()
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;
using point = pair<double, double>;
using Vector = complex<double>;
#define MOD 1000000007
int main() {
	ios_base :: sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n, b[60] = {0}, p[61];
	p[0] = 1;
	for(int i = 1; i <= 60; ++i)
		p[i] = 2LL * p[i - 1] % MOD;
	cin >> n;
	vector<ll> x(n);
	for(int i = 0; i < n; ++i) {
		cin >> x[i];
		ll y = x[i];
		for(int k = 0; y > 0; ++k) {
			if(y & 1) ++b[k];
			y >>= 1;
		}
	}
	int ans = 0;
	for(int k = 0; k < n - 1; ++k) {
		ll y = x[k];
		int i = 0;
		for(int i = 0; i < 60; ++i) {
			if(y & 1) {
				--b[i];
				ans = (ans + (n - k - 1LL - b[i]) * p[i]) % MOD;
			}
			else
				ans = (ans + 1LL * b[i] * p[i]) % MOD;
			y >>= 1;
		}
	}
	cout << (ans + MOD) % MOD << '\n';
    return 0;
}


Measured memory_bytes: 2560
#include "bits/stdc++.h"
using namespace std;


int main()
{
	string s, t;
	cin >> s >> t;
	int a, b;
	cin >> a >> b;
	string u;
	cin >> u;
	
	if (s == u) {
		a--;
	} else {
		b--;
	}

	cout << a << " " << b << endl;
}


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

using namespace std;

// constexpr double EPS = 0.0000000001;
constexpr double EPS = 1.0e-10;

int main()
{
    double xA, yA, xB, yB, xC, yC, xD, yD;

    while (cin >> xA >> yA >> xB >> yB >> xC >> yC >> xD >> yD) {
        double dot = (yA-yB) * (yC-yD) + (xC-xD) * (xA-xB);
        cout << ((abs(dot) < EPS)? "YES": "NO") << endl;
    }

    return 0;
}

Measured memory_bytes: 1224
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  ll n,w,wei[105]={},val[105]={};
  cin >> n >> w;
  for(int i=1; i<=n; i++) {
    cin >> wei[i] >> val[i];
  }
  ll dp[105][100005]={};
  for(int i=0; i<=n; i++) {
    for(int j=0; j<=100005; j++) {
      dp[i][j]=1e18;
    }
  }
  dp[0][0]=0;
  for(int i=1; i<=n; i++) {
    for(int j=0; j<=100000; j++) {
      if(j-val[i]>=0) {
        dp[i][j]=min(dp[i-1][j],dp[i-1][j-val[i]]+wei[i]);
      }
      else {
        dp[i][j]=dp[i-1][j];
      }
    }
  }
  ll ans=100000;
  while(dp[n][ans]>w) {
    ans--;
  }
  cout << ans << endl;
}

Measured memory_bytes: 82432
#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 ); }
template <class T1, class T2, class Pred = std::less<T2> >
struct sort_pair_second {
    bool operator()(const std::pair<T1,T2>&left, const std::pair<T1,T2>&right) {
        Pred p;
        return p(left.second, right.second);
    }
};

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

    int a, b, h, m;
    cin >> a >> b >> h >> m;

    double theta1 = PI * (m / 30.0);
    double theta2 = PI * (h / 6.0) + (theta1 / 12.0);
    double theta = max(theta1, theta2) - min(theta1, theta2);
    if (theta >= PI) theta = 2 * PI - theta;
    double c = pow(a, 2) + pow(b, 2) - 2 * a * b * cos(theta);
    printf("%.12lf\n", sqrt(c));
}

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

using namespace std;

int main(){
    int n;
    int x;

    cin >> n;

    for(int i = 1; i <= n; i++){
        if(i%3 == 0){
            cout << " " << i;
        }else{
            x = i;
            do{
                if(x%10 == 3){
                    cout << " " << i;
                    break;
                }
                x /= 10;
            }while(x);
        }
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define ll long long int
#define db double
#define pb push_back
#define mpr make_pair
#define andl "\n"
#define f first
#define s second
#define mset(x,y) memset(x,y,sizeof(x))
#define fr(i,n) for(long long int i=0;i<n;i++)
#define trace(it,x) for(auto it = (x).begin(); it != (x).end(); it++)
#define mod 1000000007
#define fastio ios::sync_with_stdio (false); cin.tie (0); cout.tie (0);
#define runtime cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
using namespace std;
 
// convert number to string to_string(x);
// convert string to number stoi();
 
// ll mulmod(ll x,ll y)
// {
//     return ((x%mod)*(y%mod))%mod;
// }
 
// ll binpow(ll x, ll y)
// {
//     ll z = 1;
//     while(y > 0)
//     {
//         if(y % 2 == 1)
//             z = mulmod(z, x);
//         x = mulmod(x, x);
//         y /= 2;
//     }
//     return z;
// }
 
// ll ncr(ll n,ll r)
// {
//     return mulmod(fact[n],binpow(mulmod(fact[n-r],fact[r]),mod-2));
// }
 
// ll pwr(ll n,ll m)
// {
//   if(n==1 || m==0)
//     return 1;
 
//   ll x=pwr(n,m/2);
//   if(m%2==0)
//     return x*x;
//   else
//     return n*x*x;
// }
 
// ll pwr(ll n,ll m,ll b)
// {
//   if(n==1 || m==0)
//     return 1;
 
//   ll x=pwr(n,m/2,b);
//   if(m%2==0)
//     return ((x%b)*(x%b))%b;
//   else
//     return ((n%b)*(((x%b)*(x%b))%b))%b;
// }
 
void solve()
{
  return ;
}
 
int main()
{
  fastio
  
  ll n;
  cin >> n;
  if(n==1)
  	cout << 0;
  else
  {
  	ll a=1,b=1,c=1;

  	for(ll i=1;i<=n;i++)
  	{
  		a*=10;b*=8;c*=9;
  		a%=mod;b%=mod;c%=mod;
  	}
  	// b*=3;
  	c*=2;
  	c%=mod;
  	cout << (a+b-c+mod)%mod;
  }
 
  runtime
}

Measured memory_bytes: 3780
#include<iostream>
#include<algorithm>
#include<cmath>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){ 
    int a[3];
    rep(i,3) cin >> a[i];

    sort(a,a+3);
    if(a[0] != a[1]) cout << a[0] << endl;
    else cout << a[2] << endl;
}   

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい

typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>

const int MOD=1000000007; //10^9+7

int main() {
    int N;
    cin>>N;
    string S;
    cin>>S;
    if(N%2){
        cout<<"No"<<endl;
    }else{
        bool ok=true;
        for(int i=0;i<N/2;i++){
            if(S.at(i)!=S.at(i+N/2)){
                ok=false;break;
            }
        }
        cout<<(ok?"Yes":"No")<<endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <queue>
#include <algorithm>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);

int n,m;

int main(){
	while(1){
		cin>>n;
		if(n==0) break;
		vector<pair<char,char> > cha(n);
		for(int i=0;i<n;i++){
			cin>>cha[i].first>>cha[i].second;
		}
		cin>>m;
		for(int i=0;i<m;i++){
			char s;
			bool used=0;
			cin>>s;
			for(int i=0;i<n;i++){
				if(s==cha[i].first){
					cout<<cha[i].second;
					used=1;
					break;
				}
			}
			if(!used) cout<<s;
		}
		cout<<endl;
	}
}

Measured memory_bytes: 1184
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<functional>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef queue<P> Q;

int main(){
    int a,b;
    cin>>a>>b;
    if(a>=b*2-1){
        cout<<"YES";
    }else{
        cout<<"NO";
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define min(a,b) ((a)<(b)?(a):(b))

int main(){
		long long l,r,ans=200000000,i,j;
		scanf("%lld%lld",&l,&r);
		if(r-l>2019)ans=0;
		else{
				l%=2019;
				r%=2019;
				if(r<l)ans=0;
				else{
						for(i=0;i<=r-l;i++){
								for(j=i+1;j<=r-l;j++){
										ans=min(ans,((l+i)*(l+j))%2019);
								}
						}
				}
		}
		printf("%lld\n",ans);
		return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template <typename T>
void debugV(const vector<T> v) {
#ifdef _DEBUG
  rep(i, v.size()) {
    cout << i << ":" << v[i] << " ";
  }
  cout << endl;
#else
  (void)v;
#endif
}

signed main() {
  ll N, A;
  cin >> N >> A;

  if (N < A) {
    COUT(0);
  } else {
    COUT(10);
  }
  return 0;
}

Measured memory_bytes: 256
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)
#define pf push_front
#define ins insert

//{
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...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
unsigned XorShift(void){static unsigned x = 123456789;static unsigned y = 362436069;static unsigned z = 521288629;static unsigned w = 88675123;unsigned t;t = x ^ (x << 11);x = y; y = z; z = w;return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}

int a,b,c;

main(){
	cin>>a>>b>>c;
	dump(max({a+b,a-b,a*b}));
}

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

int main()
{
  
  const int d_max = 1000;
  const int c_max = 1000;
  const int n_max = 1000;
  const int INF = d_max * c_max * n_max + 1;
  
  int n, m;
  cin >> n >> m;

  int d[n+1], c[m+1];

  for(int i = 0; i < n; i++) cin >> d[i];
  for(int i = 0; i < m; i++) cin >> c[i];

  int dp[n][m];

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

      if(i == 0 && j == 0) dp[i][j] = 0;

      else if(i == 0) dp[i][j] = 0;

      else if(i > j) dp[i][j] = INF;

      else if(dp[i][j - 1] < dp[i-1][j-1] + c[j-1]*d[i-1]) dp[i][j] = dp[i][j-1];

      else dp[i][j] = dp[i-1][j-1] + c[j-1]*d[i-1];

    }
  }

  cout << dp[n][m] << endl;

  return 0;

}



Measured memory_bytes: 6132
<?php
$p=array();
for($i=0;$i<10000;$i++){
  list($a,$o,$b)=explode(' ',trim(fgets(STDIN)));
  if($o=='?')break;
  elseif($o=='+')$p[]=$a+$b;
  elseif($o=='-')$p[]=$a-$b;
  elseif($o=='*')$p[]=$a*$b;
  elseif($o=='/')$p[]=floor($a/$b);
}
print implode(PHP_EOL,$p);
?>

Measured memory_bytes: 15460
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque, defaultdict
#deque(l), pop(), append(x), popleft(), appendleft(x)
#q.rotate(n)で → にn回ローテート
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import reduce,lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printe(*x):print("## ",*x,file=sys.stderr)
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reverse=True)  #二個目の要素で降順並び替え

    N = int(input())
    #N, K = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列
    a=N//1000
    b=N%1000
    if b==0:
        print(0)
    else:
        print((a+1)*1000-N)





if __name__ == "__main__":
    main()

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

using namespace std;

int main(void){
    string s, t, u;
    int n,m;
    cin >> s >> t >> n >> m >> u;
    if(s == u){
        n--;
    }else{
        m--;
    }
    cout << n << " " << m << endl;
    return 0;
}

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

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

Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)

int main(){
	int c=0;
	int K,S;
	cin>>K>>S;
	rep(i,K+1){
		rep(j,K+1){
			int k = S-i-j;
			if(0<=k&&k<=K)c++;
		}
	}
	cout<<c<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

const int maxN = 40;
const ll mod = 1000000007;
const ll base = 27;

const ll mod2 = 666013;
const ll base2 = 29;

int n, i, limit, conf, cnt;
char s[maxN];
string a, b;
map< string , ll> M[maxN];
ll ans;

pair<ll, ll> get_hash(string& act) {
    ll ans = 0;
    ll ans2 = 0;

    for (auto e : act) {
        ans = (ans * base + e - 'a') % mod;
        ans2 = (ans * base2 + e - 'a') % mod2;
    }

    return mp(ans, ans2);
}

int main()
{
    //freopen("test.in","r",stdin);

    scanf("%d\n%s", &n, s);
    limit = 1 << n;

    for (conf = 0; conf < limit; conf++) {
        a.clear();
        b.clear();

        cnt = 0;
        for (i = 0; i < n; i++) {
            if ((conf >> i) & 1)
                a += s[i], cnt++;
            else
                b += s[i];
        }

        reverse(b.begin(), b.end());
        a += b;

        //cerr << a << ' ' << cnt << '\n';

        M[cnt][a]++;
    }

    //cerr << "\n\n";

    for (conf = 0; conf < limit; conf++) {
        a.clear();
        b.clear();

        cnt = 0;
        for (i = 0; i < n; i++) {
            if ((conf >> i) & 1)
                a += s[n + i], cnt++;
            else
                b += s[n + i];
        }

        reverse(b.begin(), b.end());
        b += a;
        
        //cerr << b << ' ' << cnt << '\n';

        ans += M[n - cnt][b];
    }

    printf("%lld", ans);

    return 0;
}


Measured memory_bytes: 70656
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
long long Comb(int a,int b){
 	if(a<b||b<0)return 0;
 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
}
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
long long pw(long long a,long long b){
	if(a<0LL)return 0;
	if(b<0LL)return 0;
	long long ret=1;
	while(b){
		if(b%2)ret=ret*a%mod;
		a=a*a%mod;
		b/=2;
	}
	return ret;
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
// ここから編集しろ
int main(){
	int a,b;scanf("%d%d",&a,&b);
	printf("%d\n",a-b+1);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a, b;
	cin >> a >> b;
	int count = 0;
	for(int i=1; i<=a; i++)
	{
		for(int j=22; j<=b; j++)
		{
			if(j % 10 == 0) j += 2;
			if(j > b) break;
			if((j % 10) * (j / 10) == i)
			{
//				printf("%d %d\n",i, j);
				count ++;
			}
		}
	}
	printf("%d\n",count);
	return 0;
}

Measured memory_bytes: 256
def decode(a,b):
	s=''
	for i in range(max(len(a),len(b))):
		m=a[i] if i<len(a) else ''
		n=b[i] if i<len(b) else ''
		s+=m+n
	return s

o=input()
e=input()
print(decode(o,e))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,t,a,i;
	cin>>n>>t>>a;
	int h[n],m=0;
	double p[n];
	for(i=0;i<n;i++){
		cin>>h[i];
		p[i]=abs(a-(t-h[i]*0.006));
		if(p[i]<p[m]) m=i;
	}
	cout<<m+1;
}

Measured memory_bytes: 256
#include<stdio.h>
long long t,tt;
long long a[100001],s[100001];
int b[100001],flg[100001];
int main(void)
{
	int n,q,i,j,c[1000],x;
	scanf("%d %lld %d",&n,&t,&q);
	for(i=1;i<=n;i++){
		scanf("%lld %d",&a[i],&b[i]);
		flg[i]=0;
	}	
	for(i=1;i<=q;i++)	scanf("%d",&c[i]);
	for(i=1;i<n;i++){
		if(b[i]==1&&b[i+1]==2&&a[i+1]-a[i]<t*2){
			flg[i]=1; flg[i+1]=1;
			s[i]=s[i+1]=(a[i]+a[i+1])/2;
		}
	}
	x=0;
	for(i=n;i>=1;i--){
		if(flg[i]==1){
			tt=s[i];	x=1;
		}
		else{
			if(b[i]==1&&x==1&&a[i]+t>tt){
				s[i]=tt;	flg[i]=2;
			}
		}
	}
	x=0;
	for(i=1;i<=n;i++){
		if(flg[i]==1){
			tt=s[i];	x=1;
		}
		else{
			if(b[i]==2&&x==1&&a[i]-t<tt){
				s[i]=tt;	flg[i]=2;
			}
		}
	}
	for(i=1;i<=n;i++){
		if(flg[i]==0){
			if(b[i]==1) s[i]=a[i]+t;
			else s[i]=a[i]-t;
		}
	}	
	for(i=1;i<=q;i++) printf("%lld\n",s[c[i]]);
}

Measured memory_bytes: 4924
#include<bits/stdc++.h>
using namespace std;
#define int long long
template <class Q>
void clearQueue(Q & q) {
    q = Q();
}
void solve(){
	int n,k;
	cin>>n>>k;
	vector<int>h(n);
	for(int i=0;i<n;i++){
		cin>>h[i];
	}
	int dp[n];
	dp[0]=0;
	dp[1]=abs(h[1]-h[0]);
	for(int i=2;i<n;i++){
		dp[i]=INT_MAX;
		for(int j=1;j<=min(i,k);j++){
			dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
		}
	}
	cout<<dp[n-1];
}
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL); 
	int T=1;
	// cin>>T;
	while(T--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 4740
import numpy as np
from itertools import permutations

N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i], y[i] = map(int, input().split())
x = np.array(x).reshape(N, 1)
y = np.array(y).reshape(N, 1)
dist = ((x - x.T)**2 + (y - y.T)**2)**0.5
_sum = 0
combination = list(permutations([i for i in range(N)]))
for comb in combination:
    for i in range(N-1):
        _sum += dist[comb[i], comb[i+1]]
ret = _sum / len(combination)
print(ret)

Measured memory_bytes: 18788
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    string s;cin>>s;
    map<char, int> mc;
    for(char c : s){
        mc[c]++;
    }
    for(int i=0; i<n-1;i++){
        map<char, int> mt;
        string t;cin>>t;
        for(auto a:t) mt[a]++;
        for(auto a : mc){
            if(a.second==0) continue;
            mc[a.first] = min(a.second, mt[a.first]);
        }
    }
    vector<char> ans;
    for(auto a : mc) {
        rep(i, a.second) ans.push_back(a.first);
    }
    sort(all(ans));
    rep(i, ans.size()) cout<<ans[i];
    cout<<endl;
    return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
long int n,k,a;
  cin>>n>>k;
  while(1)
  { if(n%k==0){cout<<n%k;break;}
    else if(n>k){n=n%k;
                 continue;}
    else if(n<=k){a=k-n;
                 if(a<=n){cout<<a;break;}
                 else{cout<<n;break;}
                }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	long int i, n, m, l, r, lmax=0, rmin=9999999, res=0;
	cin>>n>>m;
	for(i=0; i<m; i++){
		cin>>l>>r;
		if(l>lmax)
			lmax=l;
		if(r<rmin)
			rmin=r;
	}
	res= (rmin-lmax+1);
	if(res>=0)
		cout<<res;
	else
		cout<<0;
	return 0;
}

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

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(){
    int h, n; cin >> h >> n;
    vector<int> a(n); rep(i, n) cin >> a[i]; 
    if(h <= accumulate(a.begin(), a.end(), 0)) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main() {
    string s; cin>>s;
    if (s=="SAT") cout<<"1"<<endl;
        if (s=="SUN") cout<<"7"<<endl;
            if (s=="MON") cout<<"6"<<endl;
                if (s=="TUE") cout<<"5"<<endl;
                    if (s=="WED") cout<<"4"<<endl;
                        if (s=="THU") cout<<"3"<<endl;
                            if (s=="FRI") cout<<"2"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
long count=0;
void Merge(long A[500000],long left,long int mid,long right){
  long n1,n2,i,k,j;
  n1=mid-left;
  n2=right-mid;
  long int L[n1+1],R[n2+1];
  for(i=0;i<n1;i++) L[i]=A[left+i];
  for(i=0;i<n2;i++) R[i]=A[mid+i];
    L[n1]=1000000000;
    R[n2]=1000000000;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      A[k]=L[i];
      i=i+1;
    }else{
      A[k]=R[j];
      j=j+1;
    }
    count++;

  }
}


void MergeSort(long A[500000],long left,long right){
  long mid; 
  if(left+1<right){
    mid=(left+right)/2;
    MergeSort(A,left,mid);
    MergeSort(A,mid,right);
    Merge(A,left,mid,right);
  }else return;
}



int main(){
  long S[500000];
  long i,j,n;
  scanf("%ld",&n);
  for(i=0;i<n;i++) scanf("%ld",&S[i]);
  MergeSort(S,0,n);
  for(i=0;i<n;i++){
    if(i==n-1)  printf("%ld\n",S[i]);
    else  printf("%ld ",S[i]);
  }
  printf("%ld\n",count);  
  return 0;
}

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

#define ll long long
#define pb push_back

using namespace std;

int main()
{
    ll n, t, x = 100, i, j;
    string s;

    cin >> n;

    for(i = 1; ; i++)
    {
        x += (x * 0.01);
        if(x >= n)
            break;
    }

    cout << i << endl;

    return 0;
}



Measured memory_bytes: 3628
n = int(input())
for _ in range(n):
    a,b,c = list(map(int,input().split()))
    if a**2 + b**2 == c**2 or c**2 + b**2 == a**2 or a**2 + c**2 == b**2 :
        print("YES")
    else :
        print("NO")


Measured memory_bytes: 5596
#include <bits/stdc++.h>
#define EPS 1e-8
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
double k;
double s[100001];
long double sum[100001];

class segtree{
public:
	static const int N=1<<18;
	int dp[1<<19];
	segtree(){
		memset(dp,-1,sizeof(dp));
	}
	void update(int k,int v){
		k+=N-1;
		if(dp[k]==-1)dp[k]=v;
		dp[k]=min(v,dp[k]);
		while(k>0){
			k=(k-1)/2;
			dp[k]=min(dp[k*2+1],dp[k*2+2]);
		}
	}

	int query(int a,int b,int k=0,int l=0,int r=N){
		if(b<=l || r<=a)return N;
		if(a<=l && r<=b)return dp[k];
		int mid=(l+r)/2;
		int vl=query(a,b,k*2+1,l,mid);
		int vr=query(a,b,k*2+2,mid,r);
		return min(vl,vr);
	}
};

segtree seg;

int main(void){
	scanf("%d%lf",&n,&k);
	for(int i=0;i<n;i++){
		scanf("%lf",&s[i]);
	}
	if(k<EPS){
		int len=0;
		int res=0;
		for(int i=0;i<n;i++){
			if(s[i]<EPS)len++;
			else len=0;
			if(len>0)res=n;
		}
		printf("%d\n",res);
		return 0;
	}
	for(int i=0;i<n;i++){
		if(s[i]<EPS){
			printf("%d\n",n);
			return 0;
		}
	}
	vector<long double> vec;
	vec.push_back(0.0);
	for(int i=0;i<n;i++){
		sum[i+1]+=sum[i];
		sum[i+1]+=logl(s[i]);
		vec.push_back(sum[i+1]);
	}
	sort(vec.begin(),vec.end());
	vec.erase(unique(vec.begin(),vec.end()),vec.end());
	for(int i=0;i<vec.size();i++){
		seg.update(i,1<<18);
	}
	int ans=0;
	for(int i=0;i<n;i++){
		int v=lower_bound(vec.begin(),vec.end(),sum[i])-vec.begin();
		seg.update(v,i);
		v=lower_bound(vec.begin(),vec.end(),sum[i+1]-logl(k))-vec.begin();
		ans=max(ans,i+1-seg.query(v,vec.size()));
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 9348
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<string>

#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>

#include<algorithm>
#include<string>
#include<math.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)

class Data{
    public:
        int i;
        int p;
        int y;
        int order;

    static bool cmp_by_i(const Data &a, const Data &b)
    {
        return a.i < b.i;
    }

    static bool cmp_by_y(const Data &a, const Data &b)
    {
        return a.y < b.y;
    }
};

void printV(vector<Data> list){
    cout << "[vector]" << endl;
    
    for(int i=0; i < list.size(); i++){
        cout << list[i].i << " ";
        cout << list[i].p << " ";
        cout << list[i].y << " ";
        cout << list[i].order << " ";
        cout << endl;
    }
    cout << endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    // input
    int n, m;
    cin >> n >> m;

    vector<Data> list;

    FOR(i,0,m){
        int p, y;
        cin >> p >> y;

        Data d;
        d.i = i;
        d.p = p;
        d.y = y;

        list.push_back(d);
    }

    // sort by year
    sort(list.begin(), list.end(), Data::cmp_by_y);

    map<int, int> mp;

    FOR(i,0,m){
        mp[list[i].p]++;
        list[i].order = mp[list[i].p];
    }
    
    // sort
    sort(list.begin(), list.end(), Data::cmp_by_i);

    // print
    for(auto data : list){
        std::cout << std::setfill('0') << std::right << std::setw(6) << data.p;
        std::cout << std::setfill('0') << std::right << std::setw(6) << data.order << endl;
    }
    
    return 0;
}

Measured memory_bytes: 7792
import numpy as np
n, m = map(int, input().split())
A = list(map(int, input().split()))
s = sum(A)
A.sort()
index = n
for i in range(n):
    if A[i] >= s / (4 * m):
        index = i
        break

if (n - index) >= m:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 21768
S = STDIN.gets.chomp
s = S + 'O' # ACGT文字列でないものを最後尾に追加

index = 0
length = 0
tmpIndex = 0
tmpLength = 0

s.chars { |c|
  if c == 'A' || c == 'C' || c == 'G' || c == 'T' then
    if tmpLength == 0 then
      tmpLength = 1
    else
      tmpLength += 1
    end
  else
    if tmpLength > 0 then
      if length < tmpLength then
        length = tmpLength
      end
      tmpLength = 0
    end                                                                   
  end
}

puts length

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

int main()
{
int a,b,k,i,j=0;
  cin >> a >> b >> k;
  for(i=100;i>=1;i--)
  {
  if((a%i==0)&&(b%i==0))
  {
    j++;
  }
  if(j==k)
  {cout << i;
  break;
  }
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define pb push_back

bool cmp(const pair<int,int> &a,const pair<int,int> &b) 
{ 
    return (a.second > b.second); 
} 

main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
		
	int n,m;
	cin>>n>>m;
	int arr[n];
	for(int i=0;i<n;i++)
		cin>>arr[i];
	sort(arr,arr+n);
	vector<pair<int,int>> v(m);
	for(int i=0;i<m;i++)
		cin>>v[i].first>>v[i].second;

	sort(v.begin(),v.end(),cmp);

	int c=0;
	for(int i=0;i<m;i++)
	{
		if(c==n)
			break;
		
		int k=min(c+v[i].first-1,n-1);
		int low=c,high=k,f=-1;
		while(high>=low)
		{
			int mid=(low+high)/2;
			if(arr[mid]<=v[i].second)
			{
				f=mid;
				low=mid+1;
			}
			else
				high=mid-1;
		}

		for(int j=c;j<=f;j++)
			arr[j]=v[i].second;

		if(f==k)
			c=k+1;
		else
			break;
	}

	int ans=0;
	for(int i:arr)
		ans+=i;

	cout<<ans;
}

Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String result = null;
		if (S.equals("Sunny")) {
			result = "Cloudy";
		} else if (S.equals("Cloudy")) {
			result = "Rainy ";
		} else {
			result = "Sunny";
		}
		System.out.println(result);
		sc.close();
	}
}

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

#define MOD 1000000007LL

int main(){
	int N;
	cin >> N;
	vector<int> A(N);
	for(auto &i:A)cin >> i;
	
	long long ans=1;
	int RGB[3]={0,0,0};
	
	for(int i=0;i<N;i++){
		int c=0;
		for(int j=0;j<3;j++){
			if(RGB[j]==A[i]){
				if(c==0)RGB[j]++;
				c++;
			}
		}
		ans*=c;
		ans%=MOD;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 768