akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
using ld = long double;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> h(n);
    cin >> h;
    vector<int> ans(n);
    for(int i = n - 2; i >= 0; i--) {
        ans[i] = h[i + 1] <= h[i] ? ans[i + 1] + 1 : 0;
    }
    cout << *max_element(ans.begin(), ans.end()) << endl;
    return 0;
}


Measured memory_bytes: 1024
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)

bit = 0
sum = 0
right = 0
n.times do |left|
  while right < n
    break if bit + a[right] != bit ^ a[right]
    bit ^= a[right]
    right += 1
  end
  sum += right - left
  bit ^= a[left]
end
printf("%d\n",sum)

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

int main(){
    int n;
    cin >> n;
    int gemas[n];
    int custo[n];

    int total =0;

    for(int i =0; i < n;i ++){
        cin >> gemas[i];
    }
    for(int i =0; i < n;i ++){
        cin >> custo[i];
    }
    for(int i =0;i < n;i++){
        if(custo[i]  <= gemas[i]){
            total =total+ gemas[i] -custo[i];
        }
    }
    cout << total <<endl;

}

Measured memory_bytes: 256
def circum(A, B, C):
    # 三角形ABCの外心
    Ax, Ay = A
    Bx, By = B
    Cx, Cy = C
    a = (Bx-Cx)**2+(By-Cy)**2
    b = (Cx-Ax)**2+(Cy-Ay)**2
    c = (Ax-Bx)**2+(Ay-By)**2
    s = a*(b+c-a)
    t = b*(c+a-b)
    u = c*(a+b-c)
    Ux = (s*Ax+t*Bx+u*Cx)/(s+t+u)
    Uy = (s*Ay+t*By+u*Cy)/(s+t+u)
    return Ux, Uy


def dist2(a, b):
    # 2点a,bの距離の2乗
    ax, ay = a
    bx, by = b
    return (ax-bx)**2+(ay-by)**2


n = int(input())
P = [tuple(map(int, input().split())) for i in range(n)]
eps = 10**(-7)
if n == 2:
    r = dist2(P[0], P[1])**0.5 / 2
    print(r)
    exit()
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            a, b, c = P[i], P[j], P[k]
            ax, ay = a
            bx, by = b
            cx, cy = c
            if dist2(a, b) + dist2(b, c) <= dist2(c, a):
                p = (cx+ax)/2, (cy+ay)/2
                r2 = dist2(a, p)
            elif dist2(b, c) + dist2(c, a) <= dist2(a, b):
                p = (ax+bx)/2, (ay+by)/2
                r2 = dist2(b, p)
            elif dist2(c, a) + dist2(a, b) <= dist2(b, c):
                p = (bx+cx)/2, (by+cy)/2
                r2 = dist2(c, p)
            else:
                p = circum(a, b, c)
                r2 = dist2(a, p)
            if all([dist2(p, q) <= r2 + eps for q in P]):
                print(r2**0.5)
                exit()


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

int main(){
	char c;
	while(cin >> noskipws >> c && c != '\n'){
		if(c >= 'A' && c <= 'Z'){
			cout << (char)(c - 'A' + 'a');
		}
		else if(c >= 'a' && c <= 'z'){
			cout << (char)(c - 'a' + 'A');
		}
		else
			cout << c;
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 3124
string = list(input())

n = len(string)

def isEven(N):
    return True if N % 2 == 0 else False

if isEven(n):
    n_half = int(n/2)
else:
    n_half = int(n/2) + 1

left_str = []
right_str = []

for i in range(0,n_half):
    #input()
    left_str.append(string[i])
    right_str.append(string[n-1-i])

# count not matched
notMatch = 0
for i in range(0,len(left_str)):
    if left_str[i] != right_str[i]:
        notMatch += 1
    else:
        continue

print(notMatch)

Measured memory_bytes: 3064
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class D
{
	public static void Main()
	{
		long mod = 1000000007;
		int n = GetInt();
		int m = GetInt();
		long[] x = new long[n];
		for(int i = 0; i < n; i++)
			x[i] = GetLong();
		long[] y = new long[m];
		for(int i = 0; i < m; i++)
			y[i] = GetLong();

		long xsum = 0;
		for(int k = 1; k <= n; k++)
			xsum = (xsum + (((2 * k - n - 1) * x[k-1]) % mod)) % mod;

		long ysum = 0;
		for(int k = 1; k <= m; k++)
			ysum = (ysum + (((2 * k - m - 1) * y[k-1]) % mod)) % mod;

		Console.WriteLine((xsum * ysum) % mod);		
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}

Measured memory_bytes: 34008
#include<iostream>
#include<string>
using namespace std;
int main() {
	int t,u;
	int i;
	string s;
	while (getline(cin, s)) {
		t = 0;
		u = s.size();
		while (t==0) {
			for (i = 0; i < u; i++) {
				if (s[i] == 'z') {
					s[i] = 'a';
				}
				else if('a'<=s[i]&&s[i]<'z') {
					s[i] += 1;
				}
			}
			while (s.find("the") != string::npos || s.find("this") != string::npos || s.find("that") != string::npos) {
				t = 1;
				break;
			}
		}
		cout << s << endl;
	}
	return 0;
}

Measured memory_bytes: 3148
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

const ll INF = 1e18;

int main(){
	int n;
	cin >> n;
	vector<pair<int, int>> vp(n);
	rep(i, n){
		int a;
		cin >> a;
		vp.at(i) = make_pair(a, i);
	}
	sort(vp.begin(), vp.end(), greater<pair<int, int>>());
	vector<vector<ll>> dp(n+1, vector<ll>(n+1, -INF));
	dp.at(0).at(0) = 0;
	rep(i, n){
		auto now = vp.at(i);
		rep(j, i+1){
			int x = i-j, y = j;
			auto &ndp = dp.at(y).at(x);
			auto &rdp = dp.at(y).at(x+1);
			auto &ddp = dp.at(y+1).at(x);
			rdp = max(rdp, ndp + (ll)now.first * (now.second - x));
			ddp = max(ddp, ndp + (ll)now.first * ((n-y-1) - now.second));
		}
	}
	ll ans = 0;
	rep(i, n+1){
		ans = max(ans, dp.at(i).at(n-i));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 34672
def main():

    n, x, y = map(int,input().split())

    cnt = 0

    ans=[0]*n

    for i in range(1,n+1):
        for j in range(i+1,n+1):
            d = min(j-i,abs(x-i)+abs(y-j)+1)
            ans[d] += 1

    for i in range(1,n):
        print(ans[i])
   
if __name__ == "__main__":
    main()

Measured memory_bytes: 9316
#include<bits/stdc++.h>
#define ll long long 
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define endl "\n"
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define PI 3.1415926535897932384626433832795
#define F first
#define S second
#define V vector<ll>
#define ALL(sss) sss.begin(),sss.end()
#define arall(rr,n) rr+0,rr+n 
#define mod 1000000007
#define M 100
#define MAXN 1000000000

 
int dp[262145][2];
int ans=INT_MAX;
ll n;
using namespace std;


void fileio(){
    #ifndef ONLINE_JUDGE
    freopen("input.in", "r", stdin);
    freopen("output.out", "w", stdout);
    #endif
}




int main(){


     fileio();
    
   
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);  

    ll T=1,q;
    //cin>>T;
    while(T--){

        ll n,k;cin>>n>>k;
        ll a[n];
        for (int i = 0; i < n; ++i)
        {
            /* code */cin>>a[i];
        }

        vector<ll> dp(n+1,INT_MAX);

        dp[0]=0;dp[1]=abs(a[1]-a[0]);
        for (ll i = 2; i <= n; ++i)
        {
            for(ll j=1;j<=min(k,i);j++){//cout<<i<<" "<<j<<endl;
                dp[i]=min(dp[i-j]+abs(a[i-j]-a[i]),dp[i]);
            }//cout<<endl;
        }

        cout<<dp[n-1];

        // cout<<"Case #"<<q<<": "<<ans<<endl;
    }
    
//prllf("%.9f\n", x);//precision: 9 decimal places.

/*
    GP SUM:(
    (bk)-a)/k-1;//k is ratio and b is final term, a is initial term;

    Comparing two decimal numbers

    if (abs(a-b) < 1e-9) {
        // a and b are equal
    }
*/
    return 0;
}


Measured memory_bytes: 4780
#include <bits/stdc++.h>
#define REP(i,n) for(int64_t i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REV(c) reverse((c).begin(),(c).end())
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define COUTDOUBLE(d,i) cout << setprecision((i)) << (d) << endl;
#define VIN(v) for(int64_t i=0;i<(v).size();i++){cin >> (v).at(i);}
#define MREP(i,m) for(auto i=(m).begin(); i != (m).end(); ++i) // auto key = i->first;auto value = i->second;

using namespace std;
typedef int64_t I;
typedef pair<I,I> P;
typedef vector<I> V;

I MOD = pow(10,9)+7;
I MAX = LONG_MAX;
I MIN = LONG_MIN;

// 最大公約数
I gcd(I a, I b) {
  return b != 0 ? gcd(b, a % b) : a;
}

// 最小公倍数
I lcm(I a, I b) {
  return a * b / gcd(a, b);
}

int ctoi(char c){
  return c - '0';
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  I n,k;
  cin >> n >> k;
  V v(n);
  VIN(v);
  I t=0;
  REP(i,n){
    if (v.at(i) >= k){
      t++;
    }
  }
  cout << t << endl;
  return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int(v.size())
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep2(i, n, m) for (ll i = n; i <= (m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  string s, t; cin >> s >> t;
  int ans = MOD;

  rep(i, si(s) - si(t) + 1) {
    int score = 0;
    rep(j, si(t)) if (t[j] != s[i+j]) ++score;

    chmin(ans, score);
  }

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

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

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

int main() {
    int n, v;
    cin >> n;
    vector<int> a;

    rep(i, n){
        cin >> v;
        a.push_back(v);
    }

    sort(a.begin(), a.end());

    cout << a[n-1] - a[0] << endl;

}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    ll n;
    cin >> n;

    int d = int(sqrt(n));
    print(d * d);
}

Measured memory_bytes: 3648
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            b[i] = a[i];
        }
        Arrays.sort(b);
        int s = b[n / 2 - 1];
        int M = b[n / 2];
        for (int i = 0; i < n; i++) {
            if (a[i] <= s) {
                System.out.println(M);
            } else {
                System.out.println(s);
            }
        }
    }
}

Measured memory_bytes: 93748
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <string>
#include <cctype>
#include <cstdio>
#include <math.h>
using f32 = float;
using f64 = double;
using f80 = __float80;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using vi = vector<int>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vs = vector<string>;
using vl = vector<LL>;
using vvl = vector<vl>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
#define REP(i, n) for (LL i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (LL i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define all(x) (x).begin(), (x).end()
#define fst first
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define sw swap
#define UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define LOW(x) transform(x.begin(), x.end(), x.begin(), ::tolower);
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
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;
}
LL n, a, b, c;
int main()
{
    cin >> a>>b;
        cout << max(a*b,max(a+b,a-b)) << endl;
}

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

int main() {
  int N; cin >> N;
  int a, b, c, d;
  d = N % 10;
  N = ( N - d ) / 10;
  c = N % 10;
  N = ( N - c ) / 10;
  b = N % 10;
  a = N / 10;
  
  if( ( a == b & b == c ) or ( b == c & c == d ) )
     cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	//数値の入力
		String s = sc.next();
      	int count =0;
      	int lowerCase =0;
      	for (int i = 0; i < s.length(); i++) {
			if (Character.isLowerCase(s.charAt(i))) {
              lowerCase++;
            }
          }
      	for (int i = 2; i < s.length() - 1; i++){
          if(s.charAt(i) == 'C'){
            	count++;
      	}
        }
          if((s.charAt(0) == 'A') && (lowerCase == s.length()-2) && count==1){
          	System.out.println("AC");
          }else{
            System.out.println("WA");
          }
    }
}

Measured memory_bytes: 35620
#include<cstdio>
using namespace std;

int n, m;
bool used[7400000];

int main() {
  while (1) {
    scanf("%d%d", &m, &n);
    if (n == 0) break;
    int ans = m, counter = n;
    for (int i = 0; i < 7400000; i++) used[i] = false;
    while (1) {
      if (used[ans]) { ans++; continue; }
      for (int i = ans; i < 7400000; i += ans) used[i] = true;
      counter--;
      if (counter < 0) break;
      ans++;
    }
    printf("%d\n", ans);
  }
}



Measured memory_bytes: 9904
#include<iostream>
#include<vector>
#include<algorithm>
#include<tuple>
using namespace std;
int n; vector<tuple<int, int, int>>vec;
vector<int>res;
void Write(int a, int b) {
	int L = -1;
	int R = vec.size();
	for (int i = L; i < R; i++) {
		if (b == 0)continue;
		int SL = 0; if (i >= 0)SL = get<1>(vec[i]) + 1;
		int SR = 1999999999; if (i < R - 1)SR = get<0>(vec[i + 1]) - 1;
		int SZ = SR - SL + 1;
		if (SZ >= 1) {
			if (b < SZ) { vec.push_back(make_tuple(SL, SL + b - 1, a)); b = 0; }
			else { vec.push_back(make_tuple(SL, SR, a)); b -= SZ; }
		}
	}
	sort(vec.begin(), vec.end());
	return;
}
void Delete(int a) {
	vector<tuple<int, int, int>>vec2;
	for (int i = 0; i < vec.size(); i++) {
		if (get<2>(vec[i]) != a)vec2.push_back(vec[i]);
	}
	vec = vec2;
	return;
}
int Read(int a) {
	for (int i = 0; i < vec.size(); i++) {
		if (get<0>(vec[i]) <= a && a <= get<1>(vec[i])) {
			return get<2>(vec[i]);
		}
	}
	return -1;
}
int main() {
	while (true) {
		cin >> n; vec.clear(); res.clear(); if (n == 0)break;
		for (int i = 0; i < n; i++) {
			char p; cin >> p;
			if (p == 'W') { int l, s; cin >> l >> s; Write(l, s); }
			if (p == 'D') { int l; cin >> l; Delete(l); }
			if (p == 'R') { int l; cin >> l; res.push_back(Read(l)); }
		}
		for (int i = 0; i < res.size(); i++)cout << res[i] << endl;
		cout << endl;
	}
	return 0;
}

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

using namespace std;

#define int long long
#define double long double
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#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 CCIN(...)                                                              \
    char __VA_ARGS__;                                                          \
    CIN(__VA_ARGS__)
#define DCIN(...)                                                              \
    double __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Printv(v)                                                              \
    {                                                                          \
        REP(x, v.size()) { cout << v[x] << (x == v.size() - 1 ? "\n" : " "); } \
    }
template <typename T = string> inline void eputs(T s) {
    cout << s << "\n";
    exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;

typedef long long ll;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<ll, ll> PL;

const int INF = 1e9;
const int MOD = 1e9 + 7;
const double PI = atan(1.0) * 4.0;
// const int MOD = 998244353;
const ll LINF = 1e18;
const ll dx[] = {1, 0, -1, 0};
const ll dy[] = {0, 1, 0, -1};

void cinfast() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

ll v[100], w[100];
ll dp[101][101000];

signed main() {
    LCIN(N, W);
    REP(i, N) cin >> w[i] >> v[i];
    ll vsum = accumulate(v, v + N, 0);
    Fill(dp, LINF);
    dp[0][0] = 0;
    REP(i, N) REP(j, vsum + 1) {
        if(j - v[i] < 0)
            dp[i + 1][j] = dp[i][j];
        else
            dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i]);
    }
    REPR(j, vsum) if(dp[N][j] <= W) eputs(j);
}


Measured memory_bytes: 80000
// cities to vapori-
// corner cases // int vs ll // cin vs scanf // clear structures // statement // doublesz
#include <bits/stdc++.h>
#define pb push_back
#define fst first
#define snd second
#define sz(x) int(x.size())
#define fill(x,v) memset(x,v,sizeof(x))
#define REP(i,a,b) for(int i = int(a); i < int(b); ++i)
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;

int main(){

	fastio;
	int a,b,c;
	cin >> a >> b >> c;
	int ans = min({a+b,b+c,a+c});
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3500
#include <stdio.h>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include<math.h>
#include<bitset>
#include<iomanip>
#include<queue>
using namespace std;

int main() {
	int N, L,ans=0; cin >> N >> L;
	for (int i = 0; i < N; i++)ans += L + i;
	if (L > 0)ans -= L;
	else if (L <= 0 && L + N > 0) {
		cout << ans << endl; return 0;
	}

	else ans -= L + N-1;
	cout << ans << endl;
}




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

int n;
string s;
const int MOD = 1e9 + 7;
int dp[3010][3010];

int zbr(int x, int y) {
    if (x+y < MOD) return x+y;
    return x+y-MOD;
}

int raz(int x, int y) {
    if (x >= y) return x-y;
    return x-y+MOD;
}

int main () {

    cin >> n >> s;
    dp[1][1] = 1;
    for (int i = 2; i <= n; i ++) {
        for (int j = 1; j <= i; j ++) {
            if (s[i-2] == '>') dp[i][j] = dp[i-1][j-1];
            else dp[i][j] = raz(dp[i-1][i-1], dp[i-1][j-1]);
        }

        for (int j = 2; j <= i; j ++) {
            dp[i][j] = zbr(dp[i][j], dp[i][j-1]);
        }
    }

    cout << dp[n][n];

    return 0;
}

Measured memory_bytes: 34304
//DPL_1A
#include <iostream>
#include <algorithm>
using namespace std;
 
//static const int MAX=20;
static const int NMAX=50000;
static const int INF=(1<<29);

int main(){
 int n,m;
 int C[21];
 int T[NMAX+1];
 cin>>n>>m;
 for(int i=1;i<=m;i++) cin>>C[i];
 for(int i=0;i<=NMAX;i++) T[i]=INF;
 T[0]=0;
 for(int i=1;i<=m;i++){
  for(int j=0;j+C[i]<=n;j++){
   T[j+C[i]]=min(T[j+C[i]],T[j]+1);
  }
 }
 cout<<T[n]<<endl;
return 0;
}

Measured memory_bytes: 1356
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

sosuu = [None] * 200005

for i in range(2, len(sosuu)):
    if sosuu[i] is None:
        # log(i, "is prime.")
        sosuu[i] = True
        for j in range(i*2, len(sosuu), i):
            sosuu[j] = False

x = int(input())

while sosuu[x] != True:
    # log(x)
    x += 1

print(x)

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

using namespace std;

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

    int n;
    cin >> n;
    vector<int> d(n);
    for(int i = 0; i < n; i++) {
        cin >> d[i];
    }
    long long result = 0;
    for(int i = 0; i < n; i++) {
        for(int j = i+1; j < n; j++) {
            result+=d[i]*d[j];
        }
    }
    cout << result << endl;
}

Measured memory_bytes: 256
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)

# Debug output


def chkprint(*args):
    names = {id(v): k for k, v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg), '???')+' = '+repr(arg) for arg in args))

# Binary converter


def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]

# --------------------------------------------


dp = None


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


def main():
    N = int(input())
    A = li_input()

    A.sort(reverse=True)
    ans_c = -1

    n = A[0]

    half = n / 2
    diff = 10 ** 100

    A.remove(n)

    for a in A:
        if abs(a - half) < diff:
            r = a
            diff = abs(a - half)

    print(n, r)


main()


Measured memory_bytes: 15704
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1000000007;
const double PI = acos(-1);

int main()
{
	int h, w;
	cin >> h >> w;
	vector<vector<string>> s(h, vector<string>(w));
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) cin >> s[i][j];
	}

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (s[i][j] == "snuke") {
				cout << char(j + 'A') + to_string(i + 1) << endl;
				return 0;
			}
		}
	}
}


Measured memory_bytes: 3684
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T &a){int t = 0;for(auto itr :a){if(t++)cout << " "; cout << itr;} cout <<endl; }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    //    std::ios_base::sync_with_stdio(false);
    //    cin.tie(NULL);
    int n; cin >> n;
    vector<vector<pii>>edge(n);
    rep(i,n-1){
        int a,b,c;
        cin >> a >> b >> c;
        --a,--b;
        edge[a].push_back(pii(b,c));
        edge[b].push_back(pii(a,c));
    }
    vector<int>d(n,INF);
    int Q,K;
    cin >> Q >> K;
    priority_queue<pii,vector<pii>,greater<>>que;
    d[--K] = 0;
    que.push(pii(d[K],K));
    while(!que.empty()){
        auto top = que.top();
        que.pop();
        if(top.first > d[top.second])continue;
        rep(j,edge[top.second].size()){
            auto t = edge[top.second][j];
            int nv = t.first;
            int cost = t.second;
            if(d[nv] > top.first + cost){
                d[nv] = top.first + cost;
                que.push(pii(d[nv],nv));
            }
        }
    }
    rep(_,Q){
        int x,y; cin >> x >> y;
        --x,--y;
        cout << d[x] + d[y] << endl;
    }
}




Measured memory_bytes: 11120
#include <bits/stdc++.h>                                           
 
#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
using namespace std;
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;
typedef unsigned long long ull;         
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb;  
typedef long long ll;  
typedef double db;                             
 
 
const int dx[] = {1,	 -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const int inf = 1e9, maxn = 4e5 + 148, mod = 1e9 + 7, N = 1e4 + 211;
const db eps = 1e-12, pi = 3.14159265359;
const ll INF = 1e18;

int a, b;
main () {			
	cin >> a >> b;
	cout << a * b / __gcd(a, b) << endl;

}

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

import pdb
import sys
sys.setrecursionlimit(10**7)
F = sys.stdin

H = int(F.readline().rstrip())


def power(a,b):
    if b == 0:
        return 1
    elif b == 1:
        return a
    elif b%2 == 0:
        return power(a,b//2)**2
    else:
        return power(a,b//2)**2*a

ans = 0
i = 0
while power(2, i) <= H:
    ans += power(2, i)
    i += 1



print(ans)


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

#define MX 705
bool mat[MX][MX];
vector<int> g[MX];
int c1, c2, col[MX];
bool flag[MX], tmp[MX];

bool dfs(int u) {
	col[u] == 1 ? c1++ : c2++;
	for(auto v : g[u]) {
		if(!col[v]) {
			col[v] = 3 - col[u];
			if(!dfs(v)) return false;
		}
		else if(col[v] == col[u]) return false;
	}
	return true;
}

int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	while(m--) {
		int u, v; scanf("%d%d", &u, &v);
		mat[u][v] = mat[v][u] = true;
	}
	for(int i = 1; i <= n; i++)
		for(int j = 1; j <= n; j++)
			if(i != j && !mat[i][j]) g[i].push_back(j);
	int cnt = 0;
	flag[0] = true;
	for(int i = 1; i <= n; i++) {
		if(col[i]) continue;
		col[i] = 1; c1 = c2 = 0;
		if(!dfs(i)) {
			puts("-1");
			return 0;
		}
		memcpy(tmp, flag, sizeof tmp);
		memset(flag, 0, sizeof flag);
		for(int j = 0; j <= n; j++)
			if(tmp[j]) {
				flag[j + c1] = flag[j + c2] = true;
			}
	}
	int res = INT_MAX;
	for(int i = 0; i <= n; i++) if(flag[i]) res = min(res, i * (i - 1) / 2 + (n - i) * (n - i - 1) / 2);
	printf("%d\n", res);
	return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
#define MAX_N 200000

int n, m, tmp, T[MAX_N];
multiset<int> bagD;

int main(void){
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
      scanf("%d", &tmp);
      bagD.insert(tmp);
    }
    scanf("%d", &m);
    for (int i = 0; i < m; ++i) {
      scanf("%d", &T[i]);
    }
    for (int i = 0; i < m; ++i) {
      auto itr = bagD.find(T[i]);
      if (itr != bagD.end()) bagD.erase(itr);
      else {printf("NO\n"); return 0;}
    }
    printf("YES\n");
    return 0;
}


Measured memory_bytes: 10368
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
const bool WHITE = false;
const bool BLACK = true;

vector<int> dx = {1, -1, 0, 0}, dy = {0, 0, 1, -1};

int main()
{
  int H, W;
  cin >> H >> W;
  vector<vector<bool>> field(H, vector<bool>(W, WHITE));
  queue<pair<int, int>> que;
  rep(y, H)
  {
    rep(x, W)
    {
      char c;
      cin >> c;
      if (c == '#')
      {
        field.at(y).at(x) = BLACK;
        que.push(make_pair(y, x));
      }
    }
  }
  int ans = 0;
  while (!que.empty())
  {
    for (int i = que.size() - 1; i >= 0; i--)
    {
      int y, x;
      tie(y, x) = que.front();
      que.pop();
      rep(direction, 4)
      {
        int ny = y + dy.at(direction), nx = x + dx.at(direction);
        if (0 <= ny && ny < H && 0 <= nx && nx < W && field.at(ny).at(nx) == WHITE)
        {
          field.at(ny).at(nx) = BLACK;
          que.push(make_pair(ny, nx));
        }
      }
    }
    ans++;
  }
  cout << --ans << endl;
}

Measured memory_bytes: 8592
#include <bits/stdc++.h>
using namespace std;
#define rep for(int i = 0;i<n;i++)
 
int main(void){
  long long n;cin >> n;
  long long a = n/11;
  long long b = n - a*11;
  //cout << b << endl;
  long long sum = 2*a;
  if(b < 7 and b > 0){
    sum += 1;
  }else if(b>= 7){
    sum += 2;
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
#define rep(i,x,y) for(int i=x;i<=y;i++)
#define rvp(i,x,y) for(int i=y;i>=x;i--)
#define sc scanf
#define pr printf
#define ios ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const int N = 1e5+10;
ll a[N],b[N];
int main()
{
	int n;
	ios;
	while(cin>>n)
	{
		rep(i,1,n+1) cin>>a[i];
		rep(i,1,n) cin>>b[i];
		ll ans=0;
		rep(i,1,n) 
		if(b[i]>=a[i])
		{
			ans+=a[i];
			b[i]-=a[i];
			ans+=min(b[i],a[i+1]);
			a[i+1]-=min(b[i],a[i+1]);
		}
		else ans+=b[i];
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1792
// atcoder/abc140/B/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  while (cin >> n) {
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n - 1);
    cin >> a >> b >> c;
    lli sum = 0;
    for (int i = 0; i < a.size(); ++i) {
      sum += b.at(a.at(i) - 1);
      // cout << b.at(a.at(i) - 1) << endl;
      if (i + 1 < a.size() && a.at(i) + 1 == a.at(i + 1)) {
        sum += c.at(a.at(i) - 1);
      }
    }
    cout << sum << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define INF 999999999
#define rep(i,n) for(int i=0;i<n;i++)
const ll MOD = 1000000007;
ll cnt =0,ans=0;
const int MAX = 510000;

int main(){
    int n;     cin >> n;
    ll l[n];
    for(int i=0;i<n;i++){
         cin >> l[i];
    }

    for(int i=0;i<n;i++){
         for(int j=i;j<n;j++){
              for(int k=j;k<n;k++){
                  if(l[i] == l[j] || l[i] == l[k] || l[j] == l[k])continue; 
                  ll maxl,midl,minl;
                  ll all = l[i] + l[j] + l[k];
                  maxl = max(l[i],max(l[j],l[k]));
                  minl = min(l[i],min(l[j],l[k]));
                  midl = all - maxl - minl;
                  if( maxl < minl+midl ){
                       ans++;
                      // cout << i+1 <<" "<< j+1 <<" "<< k+1 << endl;
                  }

              }
         }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3612
//#include <boost/multiprecision/cpp_dec_float.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
using namespace std;
//namespace mp = boost::multiprecision;
//using llll = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
//using Real = mp::number<mp::cpp_dec_float<1024>>;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  ll n;
  cin>>n;
  vector<ll>v(n,0);
  for(ll i=0;i<n;i++){
    cin>>v[i];
  }
  ll ans=0;
  for(ll i=1;i<n-1;i++){
    if(v[i]<v[i-1]&&v[i]>v[i+1])ans++;
    if(v[i]>v[i-1]&&v[i]<v[i+1])ans++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  ll n;
  cin >> n;
  if(n % 2 == 1 || n < 10){
    cout << 0 << endl;
    return 0;
  }
  ll n5 = 10;
  ll ans = 0;
  while(1){
    ans += n/n5;
    n5 *= 5;
    if(n5 > n) break;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
p1 = [i for i in range(n)]
s1 = [1 for _ in range(n)]

def root(i):
  if p1[i] == i:
    return i
  else:
    p1[i] = root(p1[i])
    return p1[i]

def unite(i, j):
  pi = root(i)
  pj = root(j)
  if pi == pj:
    return
  else:
    if s1[pi] < s1[pj]:
      p1[pi] = pj
    elif s1[pj] < s1[pi]:
      p1[pj] = pi
    else:
      if pi < pj:
        p1[pj] = pi
        s1[pi] += 1
      else:
        p1[pi] = pj
        s1[pj] += 1

for _ in range(m):
  x, y, z = map(int, input().split())
  unite(x-1, y-1)

for i in range(n):
  root(i)

print(len(set(p1)))


Measured memory_bytes: 77088
#include <cstdio>
#include <map>
using namespace std;

int main()
{
  int n, tmp;
  map<int, int> m;
  scanf("%d", &n);

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

  int count = 0;
  for (auto const &kv : m)
  {
    if (kv.first == kv.second)
      continue;
    else if (kv.second < kv.first)
      count += kv.second;
    else
      count += kv.second - kv.first;
  }

  printf("%d\n", count);

  return 0;
}


Measured memory_bytes: 4736
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] a = new long[n];
		boolean allZero = true;
		Map<Long, Integer> counter = new HashMap<>();
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextLong();
			if (a[i] != 0) allZero = false;
			counter.put(a[i], counter.getOrDefault(a[i], 0) + 1);
		}

		if (allZero) {
			System.out.println("Yes");
			return;
		}

		if (counter.size() <= 1 || counter.size() > 3 || n % 3 != 0) {
			System.out.println("No");
			return;
		}

		if (counter.size() == 2) {
			if (counter.containsKey(0L) && counter.get(0L) == n / 3) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
			return;
		}

		long[] x = new long[3];
		int index = 0;
		for (Long i : counter.keySet()) {
			x[index++] = i;
		}

		if (((x[0] ^ x[1]) ^ x[2]) != 0) {
			System.out.println("No");
			return;
		}
		for (Integer i : counter.values()) {
			if (i != n / 3) {
				System.out.println("No");
				return;
			}
		}

		System.out.println("Yes");
	}
}


Measured memory_bytes: 63068
package main

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

func main() {
	log.SetFlags(log.Lshortfile)
	nextReader = NewScanner()
	line1 := nextInt()
	N := line1[0] // 人数
	//_ = line1[1] // 食べ物の種類

	var array [][]int
	for i := 0; i < N; i++ {
		line := nextInt()
		array = append(array, line)
	}

	kindMap := make(map[int]int, 31)
	for i := 0; i < len(array); i++ {
		for j := 1; j < len(array[i]); j++ {
			kindMap[array[i][j]]++
		}
	}

	var result int
	for _, v := range kindMap {
		if v == N {
			result++
		}
	}

	fmt.Printf("%d\n", result)

	//fmt.Printf("N: %+v\n", N)
	//fmt.Printf("kindMap: %+v\n", kindMap)
	//fmt.Printf("result: %+v\n", result)
	//fmt.Printf("%+v\n", array)

}

// ------ Mathライブラリ ---------------------------------//
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}

func maxIdx(a ...int) int {
	r := a[0]
	index := 0
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
			index = i
		}
	}
	return index
}

func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}

func minIdx(a ...int) int {
	r := a[0]
	index := 0
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
			index = i
		}
	}
	return index
}

func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// ------ Mathライブラリ ---------------------------------//

// ----- 標準入力用の関数 ----------------------------------//
var nextReader func() []string

func NewScanner() func() []string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	return func() []string {
		r.Scan()
		return strings.Fields(r.Text())
	}
}

func nextString() []string {
	return nextReader()
}

func nextInt() []int {
	var intArray []int
	strArray := nextReader()
	for _, v := range strArray {
		i, _ := strconv.Atoi(v)
		intArray = append(intArray, i)
	}
	return intArray
}

func nextFloat64() []float64 {
	var floatArray []float64
	strArray := nextReader()
	for _, v := range strArray {
		f, _ := strconv.ParseFloat(v, 64)
		floatArray = append(floatArray, f)
	}
	return floatArray
}

// ------ 標準入力用の関数 ---------------------------------//

// ------ あまり使わない -----------------------------------//
func nextInt64() []int64 {
	var int64Array []int64
	strArray := nextReader()
	for _, v := range strArray {
		i, _ := strconv.ParseInt(v, 10, 64)
		int64Array = append(int64Array, i)
	}
	return int64Array
}

// ------ あまり使わない -----------------------------------//


Measured memory_bytes: 640
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		//while(scan.hasNext()){
			int n = scan.nextInt();
			long s = 0;
			for(int i = 0;i < n;i++){
				s += scan.nextInt();
			}
			
			System.out.println(s / n);
		//}
	}
}

Measured memory_bytes: 31068
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		long s = sc.nextLong();
		long c = sc.nextLong();

		if(s * 2 > c ) {
			System.out.print(c / 2);
		}else{
			System.out.print(s + (c - s * 2) / 4);
		}


		sc.close();
	}

}


Measured memory_bytes: 21844
n=input()

if n=='SUN':
    print(7)
elif n=='MON':
    print(6)
elif n=='TUE':
    print(5)
elif n=='WED':
    print(4)
elif n=='THU':
    print(3)
elif n=='FRI':
    print(2)
else:
    print(1)


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

using namespace std;

using i64 = int64_t;

const i64 MOD = 1e9+7;

const i64 INF = 1e18+7;

struct UnionFind{
    vector<i64> par, siz, l, r;
    int c;
    UnionFind(int n, vector<i64>& siz) : par(n, -1), siz(siz), l(n), r(n), c(0){
        iota(l.begin(), l.end(), 0);
        iota(r.begin(), r.end(), 0);
    }
    int Find(int x){return par[x] < 0 ? x : Find(par[x]);}
    i64 Sum(int x){return par[x] < 0 ? siz[x] : Sum(par[x]);}
    bool Unite(int x, int y){
        if((x = Find(x)) == (y = Find(y)))
            return false;
        ++c;
        if(par[x] > par[y])
            swap(x, y);
        par[x] += par[y];
        siz[x] += siz[y];
        l[x] = min(l[x], l[y]);
        r[x] = min(l[y], r[y]);
        par[y] = x;
        return true;
    }
};

signed main(){

    int n, k;
    cin >> n >> k;
    vector<i64> a(n);
    for(auto& x : a)
        cin >> x;

    UnionFind u(n, a);

    priority_queue<pair<i64,int>> que;
    for(int i = 0; i < n - 1; ++i)
        que.emplace(a[i] + a[i + 1], i);

    vector<int> ans;

    while(!que.empty()){
        i64 len;
        int pos;
        tie(len, pos) = que.top();
        que.pop();
        if(u.Find(pos) == u.Find(pos + 1))
            continue;
        if(u.Sum(pos) + u.Sum(pos + 1) >= k){
            ans.push_back(pos + 1);
            u.Unite(pos, pos + 1);
            int f = u.Find(pos);
            if(u.l[f])
                que.emplace(u.Sum(u.l[f] - 1) + u.Sum(pos), u.l[f] - 1);
            if(u.r[f] != n - 1)
                que.emplace(u.Sum(u.r[f] + 1) + u.Sum(pos), u.r[f]);
        }
    }
    if(ans.size() == n - 1){
        cout << "Possible" << endl;
        reverse(ans.begin(), ans.end());
        for(auto& x : ans)
            cout << x << endl;
    }else
        cout << "Impossible" << endl;

}


Measured memory_bytes: 8560
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())
#define endl "\n"

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
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};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int a[10], k;

signed main() {
	rep(i,5) cin >> a[i];
	cin >> k;
	sort(a,a+5);
	if (a[4]-a[0]>k) cout << ":(" << endl;
	else cout << "Yay!" << endl;
}

Measured memory_bytes: 256