akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            const int dishNum = 5;
            var timeList = new List<int>();
            int lastDishIndex = 0;
            int minFracTime = 9;
            for (int i = 0; i < dishNum; i++)
            {
                var time = int.Parse(Console.ReadLine());
                var fracTime = time % 10;
                timeList.Add(time);
                if (fracTime != 0 && fracTime < minFracTime)
                {
                    minFracTime = fracTime;
                    lastDishIndex = i;
                }
            }

            int ans = 0;
            for (int i = 0; i < dishNum; i++)
            {
                if (i == lastDishIndex)
                {
                    ans += timeList[i];
                }
                else
                {
                    ans += ((timeList[i] + 9) / 10) * 10;
                }
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13140
fun main(args: Array<String>) {
    val (n, k) = readLine()!!.split(' ').map { it.toInt() }
    val p = readLine()!!.split(' ').map { it.toInt() }.sorted()

    var ans = 0
    repeat(k) {
        ans += p[it]
    }
    println(ans)
}


Measured memory_bytes: 41048
#include<stdio.h>
int main(void)
{
    double a,b,c,d,e,f,x,y;
    while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){
		
        y=(c*d-f*a)/(b*d-a*e);
		x=(c-b*y)/a;
		
		printf("%0.3lf %0.3lf\n",x,y);
	}
	return 0;
}

Measured memory_bytes: 2620
N, M = map(int, input().split())
L = [[] for i in range(N)]
def dfs(bef, hr, g, vst):
	vst.add(hr)
	if hr == g:
		return 1
	cnt = 0
	for nxt in L[hr]:
		if nxt == bef or nxt in vst:
			continue
		cnt += dfs(hr, nxt, g, vst)
	return cnt
ab = [list(map(lambda x: int(x) - 1, input().split())) for i in range(M)]
for a, b in ab:
	L[a].append(b)
	L[b].append(a)

print(sum(dfs(b, a, b, set()) == 0 for a, b in ab))


Measured memory_bytes: 3064
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<fstream>       //ファイルストリーム（標準入力変更用）
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

//名前
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef map<string, int> msi;
typedef map<string, ll> msll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pllll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;

//定数
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;

//マクロ
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,s,e) for(int i=s;i<e;i++)
#define repse(i,s,e) for(int i=s;i<=e;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define in(x1) cin >> x1
#define in2(x1, x2) cin >> x1 >> x2
#define in3(x1, x2, x3) cin >> x1 >> x2 >> x3
#define inN(x, N) rep(i, N) in(x[i])
#define outl(x) cout << x << endl
#define out2l(x, y) cout << x << " " << y << endl 

//よく使う関数
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

    //標準入力をファイルに変更
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());
    int N;
    in(N);

    vll A(N);
    inN(A, N);

    ll ans = 0;
    ll maxA = A[0];

    reps(i, 1, N)
    {
        if (maxA > A[i]) ans += maxA - A[i];

        chmax(maxA, A[i]);
    }

    outl(ans);

    return 0;
}

Measured memory_bytes: 4708
#include <bits/stdc++.h>
using namespace std;
#define MAXN 100010
#define INF 1e9
#define FOR(i,s,e) for(int i=s; i<=e; i++)
int cost[MAXN], memo[MAXN];
int n, k;
class fastio {
public:
    fastio() {
        ios_base::sync_with_stdio(false);
        cout.tie(nullptr);
        cin.tie(nullptr);
    }
} __fastio;
int f(int i) {
    if(i > n) return INF;
    if(i == n) return 0;
    if(memo[i] != -1) return memo[i];
    else {
        int ans = INF;
        FOR(j,1,k) {
            ans = min(ans, f(i+j) + abs(cost[i] - cost[i+j]));
        }
        return memo[i] = ans;
    }
}
void solve() {
    cin >> n >> k;
    FOR(i,1,n) {
        cin >> cost[i];
    }
    memset(memo, -1, sizeof(memo));
    cout << f(1) << endl;
}
int main() {
  __fastio;
  solve();
  return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long int
#define ld long double
using namespace std;
const int N = 1e6 + 5;
const int MOD = 1e9 + 7;

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

Measured memory_bytes: 3664
x,k,d = map(int,input().split())

count = abs(x)//d

if x<0:
    before_border = x+d*count
    after_border = x+d*(count+1)
else:
    before_border = x-d*count
    after_border = x-d*(count+1)
    
if count >= k:
    if x<0:
        print(abs(x+d*k))
    else:
        print(abs(x-d*k))
else:
    if (count-k)%2 == 0:
        print(abs(before_border))
    else:
        print(abs(after_border))

Measured memory_bytes: 61900
using System;
using System.Linq;
class Program
{
    static void Main()
    {
        int[] input = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray(); 
        //int a=int.Parse(Console.ReadLine());
        //string a = Console.ReadLine();
        
        Console.WriteLine(input[1]*input[0]%2==1?"Yes":"No");
        Console.ReadLine();
    }
}


Measured memory_bytes: 13268
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <math.h>
#include <string>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>

using namespace std;

#define pb push_back
#define mk make_pair
#define fr first
#define sc second

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int maxn = 200020;

int n, r;
int a[maxn];
int p[maxn];
int c[maxn];

void solve(){
	scanf("%d", &n);
	for(int i = 1; i <= n; i ++){
		scanf("%d", a + i);
		p[a[i]] = i;
	}
	for(int i = 1; i <= n; i ++){
		if(p[i-1] < p[i]){
			c[i] = c[i-1] + 1;
		} else{
			c[i] = 1;
		}
		r = max(r, c[i]);
	}
	printf("%d", n - r);
}

int main(){
	int t = 1;
	while(t --){
		solve();
	}
}

Measured memory_bytes: 2560
N = int(input())
X = list(map(int, input().split()))

X.sort(reverse=True)
ans = 0
cnt = 0
j = 0
for i in range(N):
    if i == 0:
        continue
    elif i == 1:
        ans += X[j]
        j += 1
    else:
        ans += X[j]
        cnt += 1
        if cnt == 2:
            j += 1
            cnt = 0

print(ans)


Measured memory_bytes: 105444
input()
get_data = input().split(' ')  # String
count = dict()
for v in get_data:
  if v not in count.keys():
    count[v] = 1
  else:
    count[v] += 1

count_result = count.items()
dup = dict()
for v in count_result:
  key = v[0]
  dup[key] = v[1]
  key_to_int = int(key)
  if str(key_to_int+1) in count.keys():
    dup[key] += count[str(key_to_int+1)]
  if str(key_to_int-1) in count.keys():
    dup[key] += count[str(key_to_int-1)]
  
  
print(int(sorted(dup.items(), key=lambda v: v[1], reverse=True)[0][1]))

Measured memory_bytes: 22764
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef std::int_fast64_t i64;
typedef std::uint_fast64_t u64;

namespace tools {
  template <typename T>
  void read(std::vector<T>& vector, const typename std::vector<T>::size_type size) {
    vector.reserve(size);
    std::copy_n(std::istream_iterator<T>(std::cin), size, std::back_inserter(vector));
  }

  template <typename T, std::size_t N>
  void read(std::array<T, N>& array) {
    std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
  }
}

#endif

// main.cpp

int main() {
  i64 A, B;
  std::cin >> A >> B;
  std::cout << std::max({A + B, A - B, A * B}) << std::endl;
  return 0;
}

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

using namespace std;

int main(){
  long long N;
  cin >> N;
  
  string name = "";
  while(N){
    --N;
    name += 'a' + ((N) % 26);
    N /= 26;
  }
  
  reverse(name.begin(), name.end());
  
  cout << name << endl;
  
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

vector <int> menu(5);

int main(){
    for(int i = 0; i < 5; i++){
        cin >> menu.at(i);
    }
    vector <int> tmp;
    int ans = 0;
    for(int i = 0; i < 5; i++){
        if(menu.at(i) % 10 == 0){
            ans += menu.at(i);
        }else{
            tmp.push_back(menu.at(i));
        }
    }
    // 1の桁で降順でソート
    sort(tmp.rbegin(), tmp.rend(), [](int x, int y){ return (x % 10) < (y % 10); });
    for(int i = 0; i < tmp.size(); i++){
        if(i + 1 == tmp.size()){
            ans += tmp.at(i);
            break;
        }
        ans += tmp.at(i) + (10 - tmp.at(i) % 10);
    }
    cout << ans << endl;
}


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

using namespace std;
typedef long long ll;
typedef pair< int , int > P;

P f_l_num( int x ){
	int l = x % 10;
	int f;
	
	while( x ){
	f =  x;
	x /=10; 
	}
	return P( f , l );
}

int main(){
	long long n;
	long long ans = 0;
	
	cin>>n;
	
	map < P , int > frq;
	
	for( int i = 1 ; i <= n ; i++ ){
		frq[ f_l_num( i ) ]++;
	}
	
	for( int i = 1 ; i <= n ; i++ ){
		P p = f_l_num( i );
		P q(p.second , p.first);
		ans += frq[ q ];
	}
	cout<<ans;
}



Measured memory_bytes: 256
#include<iostream>
#include <numeric>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <bits/stdc++.h> 
using namespace std;
 
#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++) 
\
 
int main()
{
  int n;
  cin>>n;
  if(n%2!=0)
    cout<<(n/2)+1;
  else
    cout<<(n/2);
  
  return 0;
  
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

ll dp[100][100][3000];

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

    int n, a; cin>>n>>a;
    vector<int> x(n);
    for(int i=0; i<n; i++) cin>>x[i];

    dp[0][0][0] = 1;
    for(int i=0; i<n; i++){
        for(int j=0; j<=i; j++){
            for(int k=0; k<=2500; k++){
                if(k + x[i] <= 2500){
                    dp[i+1][j+1][k+x[i]] += dp[i][j][k];
                }

                dp[i+1][j][k] += dp[i][j][k];
            }
        }
    }

    ll ans = 0;
    for(int i=1; ; i++){
        if(2500 < a * i) break;
        ans += dp[n][i][a*i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 114944
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;

int main(){
    long long int a,b,n;
    cin>>a>>b>>n;
    if(n<a){
        cout<<a-n<<" "<<b<<endl;
    }
    else if(a+b>=n){
        cout<<0<<" "<<b-n+a<<endl;
    }
    else{
    	cout<<0<<" "<<0<<endl;
    }
   return 0;
}

Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
var abo=[0,0,0,0];
Arr.forEach(function(v){
var arr=v.split(",");
if(arr[1]=="A")abo[0]++;
if(arr[1]=="B")abo[1]++;
if(arr[1]=="AB")abo[2]++;
if(arr[1]=="O")abo[3]++;
});
console.log(abo[0]);
console.log(abo[1]);
console.log(abo[2]);
console.log(abo[3]);

Measured memory_bytes: 7644
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

struct Graph {
    struct Vertex { int n, f, a; };
    struct Edge { int i, n, s; };
    Graph(int n, int m) : v(n, { -1, -1, -1 }), e(m), n(n), m(0), z(0), z1(0) {}
    void add_edge(int i, int j, int s) {
        e[m] = { j, v[i].n, s };
        v[i].n = m;
        m++;
    }
    void dfs(int i, int p, int f, int a) {
        v[i].f = f;
        v[i].a = a;
        z0[f - 1] = min(z0[f - 1], a);

        int f1 = f ^ 3;
        for (int j = v[i].n; j >= 0; j = e[j].n) {
            Edge& o = e[j];
            if (o.i == p) continue;
            int a1 = o.s - a;
            if (v[o.i].f < 0) {
                dfs(o.i, i, f1, a1);
            } else {
                if (v[o.i].f != f1) z = 1;
                if (v[o.i].a != a1) z1 = abs(v[o.i].a - a1);
            }
        }
    }
    void clear() {
        z0[0] = z0[1] = 1 << 30;
        z = z1 = 0;
        for (int i = 0; i < n; i++) {
            v[i].f = -1;
            v[i].a = -1;
        }
    }
    int ok() {
        if (z1) return 0;
        int t0 = 1 - z0[0];//t0増やさないといけない
        int t1 = z0[1] - 1;//t1まで増やせる
        //if (t1 < 0) cout << z0[0] << ' ' << z0[1] << endl;
        if (t1 < 0) return 0;
        return max(t1 - t0 + 1, 0);
    }
    vector<Vertex> v;
    vector<Edge> e;
    int n, m, z, z1, z0[2];
};

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

    int n, m;
    cin >> n >> m;

    Graph g(n, m * 2);
    for (int i = 0; i < m; i++) {
        int u, v, s;
        cin >> u >> v >> s;
        u--; v--;

        g.add_edge(u, v, s);
        g.add_edge(v, u, s);
    }

    g.clear();
    g.dfs(0, -1, 1, 1);
    if (g.z) {
        if (g.z1) {
            int c = g.z1 / 2;
            g.clear();
            g.dfs(0, -1, 1, 1 + c);
        }
        if (g.z1 || g.z0[0] <= 0 || g.z0[1] <= 0) {
            cout << 0 << endl;
        } else {
            cout << 1 << endl;
        }
        return 0;
    }

    cout << g.ok() << endl;

    return 0;
}

Measured memory_bytes: 6272
// clang-format

#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;

using lli = long long int;

bool dp[200005] = {};
void solve(long long X) {
  dp[0] = true;
  rep(i, X+1){
    rep(j, 6)
    dp[i+100+j] |= dp[i];
  }
  cout << dp[X] << endl;
}

int main() {
  int a;
  long long X;
  scanf("%lld", &X);
  solve(X);
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>

using namespace std;

int main()
{
    int n;cin>>n;
    string s;
    int ac=0,wa=0,tle=0,re=0;

    while(n--)
    {
        cin>>s;
        if(s=="AC") ac++;
        else if(s=="WA") wa++;
        else if(s=="TLE") tle++;
        else if(s=="RE") re++;
    }

    cout<<"AC x "<<ac<<endl;
    cout<<"WA x "<<wa<<endl;
    cout<<"TLE x "<<tle<<endl;
    cout<<"RE x "<<re<<endl;

}

Measured memory_bytes: 3628
using System;

class Plogram
{
    static void Main()
    {

        var str = Console.ReadLine();
        int num = 0;
        int diff = int.MaxValue;

        for(int i = 0; i < str.Length-2; i++)
        {
            num = int.Parse(str.Substring(i, 3));
            if(diff > Math.Abs(num-753))
            {
                diff = Math.Abs(num - 753);
            }
        }
        Console.WriteLine(diff);
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;


// 入力
int N;
long long a[100010][3]; // a[i], b[i], c[i] をそれぞれまとめて a[i][0], a[i][1], a[i][2] にしてしまう

// DP テーブル
long long dp[100010][3];

int main() {
    int N; cin >> N;
    for (int i = 0; i < N; ++i) for (int j = 0; j < 3; ++j) cin >> a[i][j];

    // 初期化は既に 0 に初期化される
    // 初期条件も既に 0 で OK

    // ループ
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < 3; ++j) {
            for (int k = 0; k < 3; ++k) {
                if (j == k){
                  continue;
                }
                dp[i+1][k]=max(dp[i + 1][k], dp[i][j] + a[i][k]);
            }
        }
    }

    // 答え
    long long res = 0;
    for (int i = 0; i < 3; ++i) res=max(res, dp[N][i]);
    cout << res << endl;
}


Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <functional>
#include <queue>

using namespace std;

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

int X,Y,Z,K;

struct Data {
	int v, a, b, c;
	Data(int v, int a, int b, int c) : v(v), a(a), b(b), c(c) {}
	bool operator<(const Data &data) const {
		return v < data.v;
	}
	bool operator>(const Data &data) const {
		return v > data.v;
	}
};

map<int, bool> used;

int encode(int a, int b, int c)
{
	return a + b*1000ll + c*1000ll*1000ll;
}

signed main()
{
	cin >> X >> Y >> Z >> K;

	vector<int> A(X), B(Y), C(Z);
	rep(i, X) cin >> A[i];
	rep(i, Y) cin >> B[i];
	rep(i, Z) cin >> C[i];

	sort(begin(A), end(A), greater<int>());
	sort(begin(B), end(B), greater<int>());
	sort(begin(C), end(C), greater<int>());

	rep(i, 10000) {
		A.push_back(-1e18);
		B.push_back(-1e18);
		C.push_back(-1e18);
	}

	priority_queue<Data> pq;
	pq.push(Data(A[0]+B[0]+C[0],0,0,0));

	rep(_, K) {
		Data d(0,0,0,0);
		int v,a,b,c;

		do {
			d = pq.top();
			v = d.v, a = d.a, b = d.b, c = d.c;
			pq.pop();
		} while (used[encode(a,b,c)]);

		used[encode(a,b,c)] = true;

		cout << v << endl;

		pq.push(Data(A[a+1]+B[b]+C[c], a+1,b,c));
		pq.push(Data(A[a]+B[b+1]+C[c], a,b+1,c));
		pq.push(Data(A[a]+B[b]+C[c+1], a,b,c+1));
	}
}


Measured memory_bytes: 1400
N,T = map(int,input().split())
Ts = list(map(int, input().split()))

ans = 0

for i in range(N-1):
    t = Ts[i]
    tt = Ts[i + 1]

    if tt <= t + T:
        ans += tt - t
    else:
        ans += T

ans = ans + T

print(ans)


Measured memory_bytes: 25200
def run():
    judge = [0, 0, 0, 0]
    while True:
        a, b, c = sorted((int(x) for x in input().split()))
        if a + b <= c or min([a, b, c]) <= 0:
            print(' '.join(map(str, judge)))
            break
        else:
            S = a ** 2 + b ** 2 - c ** 2
            judge[0] += 1
            if S == 0:
                judge[1] += 1
            elif S > 0:
                judge[2] += 1
            else:
                judge[3] += 1





if __name__ == '__main__':
    run()


Measured memory_bytes: 5608
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}
}

use input::*;

fn main() {
    let (h, w): (usize, usize);
    input!(h, w);
    let mut v = vec![];
    for _ in 0..h {
        let buf = str2vec(&input_line_str());
        v.push(buf);
    }

    let mut ans = true;

    for i in 0..h {
        for j in 0..w {
            if v[i][j] == '.' {
                continue;
            }
            let mut flag = [false; 4];
            if i > 0 && v[i - 1][j] == '#' {
                flag[0] = true;
            }
            if j > 0 && v[i][j - 1] == '#' {
                flag[1] = true;
            }
            if i + 1 < h && v[i + 1][j] == '#' {
                flag[2] = true
            }
            if j + 1 < w && v[i][j + 1] == '#' {
                flag[3] = true
            }

            if !(flag[0] || flag[1] || flag[2] || flag[3]) {
                ans = false
            }
        }
    }
    p(if ans { "Yes" } else { "No" });
}

Measured memory_bytes: 4352
#include <iostream>
#include <cmath>
#include <algorithm>
#include <utility>

using namespace std;

int a[105];
int N;

int main(void) {

	cin >> N;

	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}

	double sum = 0.0;

	for (int i = 0; i < N; i++) {
		sum += a[i];
	}

	double ave = sum / double(N);

	int ans = 0;
	double x = 1000000.0;
	for (int i = 0; i < N; i++) {
		if (fabs(ave - 1.0*a[i]) < x) { ans = i; x = fabs(ave - 1.0*a[i]); }
	}

	cout << ans << endl;

	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef vector<pair<ll,ll> > vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
const int INF=1e9+7;

int main(){
  ll a,b,c,d,e,f;
  cin>>a>>b>>c>>d>>e>>f;
  set<int> water,sugar;
  for (int A = 0; A <= f; A += 100*a) {
    for (int B = 0; A + B <= f; B += 100*b) {
      if(A+B!=0) water.insert(A+B);
    }
  }
  for (int C = 0; C <= f; C += c) {
    for (int D = 0; C + D <= f; D += d) {
      sugar.insert(C + D);
    }
  }
  ll answ,anss;float noudo=0;
  auto itw=water.begin();
  while(itw!=water.end()){
    auto its=sugar.begin();
    while(its!=sugar.end()){
      float con=(float)(*its)/(*itw);
      if(*its+*itw<=f&&noudo<=con&&con<=(float)(e/100.0)){
        answ=*itw;anss=*its;
        noudo=con;
      }
      its++;
    }
    itw++;
  }
  cout<<answ+anss<<" "<<anss<<endl;
}



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

int main(){

  int n,m;
  cin>>n>>m;
  int a[100][100];
  for(int i=0;i<n;i++)
    for(int j=0;j<m;j++) cin>>a[i][j];
  
  int b[100];
  for(int i=0;i<m;i++) cin>>b[i];

  int c[100] = {};
  for(int i=0;i<n;i++)
    for(int j=0;j<m;j++) c[i] += a[i][j] * b[j];
  
  for(int i=0;i<n;i++) cout<<c[i]<<endl;
  
  return 0;
}


Measured memory_bytes: 3160
#include<stdio.h>
int main(){
	int low[5];
	int a,b,c;
	for(a=0;a<5;a++){
		scanf("%d",&low[a]);
	}
	for(a=0;a<5;a++){
		for(b=0;b<4;b++){
			if(low[b]<low[b+1]){
				c=low[b];
				low[b]=low[b+1];
				low[b+1]=c;
			}
		}
	}
	printf("%d %d %d %d %d\n",low[0],low[1],low[2],low[3],low[4]);
	return 0;
}

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


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



    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		solve(s);
		s.close();
	}

	public static long sum = 0;

	public static void solve(Scanner s) {
		String str = s.next();

		String str1 = str.substring(0, 1);
		String str2 = str.substring(1);

		add(str1, str2);

		System.out.println(sum);
	}

	public static void add(String str1, String str2) {

		if (str2.length() == 0) {
			calc(str1);
			return;
		}

		add(str1 + str2.substring(0, 1), str2.substring(1));
		add(str1 + "," + str2.substring(0, 1), str2.substring(1));
	}

	public static void calc(String str) {
		String[] array = str.split(",");
		for (String e : array) {
			sum += Long.parseLong(e);
		}
	}
}

Measured memory_bytes: 10576
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a==1&&b==1){
		cout<<"Draw"<<endl;
	}
	else if(a==1){
		cout<<"Alice"<<endl;
	}
	else if(b==1){
		cout<<"Bob"<<endl;
	}
	else if(a>b){
		cout<<"Alice"<<endl;
	}
	else if(a<b){
		cout<<"Bob"<<endl;
	}
	else if(a==b){
		cout<<"Draw"<<endl;
	}
}


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

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

  vector<int> d(N,0);
  for (int i=0; i<N; i++) cin >> d.at(i);
  sort(d.begin(), d.end());
  reverse(d.begin(), d.end());

  int dan=1;
  if(N==0)cout << dan <<endl;

  for (int i=1; i<N; i++){
    if(d.at(i)<d.at(i-1))dan++;

  }

  cout << dan << endl;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		int r = 0, c = 0;
		int[] a = new int[2];
		Scanner sc = new Scanner(System.in);
		for(int i = 0; i < 2; ++i){ // ?????????????´???°????±????(????¬????)
			a[i] = sc.nextInt();
			}
		r = a[0]; c = a[1];
		int[][] mat = new int[r+1][c+1];
		if(r >= 1 || c >= 1 || r >= 100 || c >= 100){
		for(int k = 0; k < r+1; ++k){ //???????????????
			for(int l = 0; l < c+1; ++l){
				mat[r][c] = 0;
			}
		}
		for(int k = 0; k < r; ++k){ //?????????????????\???
			for(int l = 0; l < c; ++l){
				mat[k][l] = sc.nextInt();
				mat[k][c] += mat[k][l]; //??????????????????????????????????¶???????
				mat[r][l] += mat[k][l]; //???????????????????????????????¶???????
				mat[r][c] += mat[k][l]; //???????????????????¶???????
			}
		}
		for(int k = 0; k < r+1; ++k){ //?????????????????\???
			for(int l = 0; l < c+1; ++l){
				System.out.print(mat[k][l]);
				if(l != c){  //?????¬?????????????????§?????¨???????????????
					System.out.print(" ");
				}
			}
			System.out.println("");
		}
		sc.close();
	}
	}
}

Measured memory_bytes: 41860
N,K,Q = list(map(int,input().split()))

count = [0]*N
for i in range(Q):
    Ai = int(input())
    count[Ai-1] += 1

for i in range(N):
    if K-Q+count[i] > 0:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 4804
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
 
using namespace std;
 
#define PB push_back
#define MP make_pairA
#define REP(i,n) for(int i=0;i<(n);i++)
int main()
{
    int a;
    cin>>a;
    if(a<1200)cout<<"ABC"<<endl;
    else if(a<2800)cout<<"ARC"<<endl;
    else cout<<"AGC"<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int a,s,d[10000],f[10000],g[10000],h[10000],i,j,z;
	scanf("%d",&a);
	scanf("%d",&s);
	while(a!=0&&s!=0){
	z=0;
	for(i=1;i<=s;i++){
		g[i]=0;
		h[i]=0;
	}
	for(i=1;i<=s;i++){
		scanf("%d %d",&d[i],&f[i]);
		if(d[i]==1){
			g[f[i]]=1;
			h[i]=f[i];
		}
//		printf("h==%d\n",h[i]);
	}
	for(i=1;i<=s;i++){
		for(j=1;j<=s;j++){
			if(i!=j){
				if(h[i]==d[j]){
					if(g[f[j]]!=1){
						g[f[j]]=2;
					}
				}
				if(h[i]==f[j]){
					if(g[d[j]]!=1){
						g[d[j]]=2;
					}
				}
			}
		}
	}
	for(i=1;i<=s;i++){
		if(g[i]==1||g[i]==2){
			z++;
		}
	}
	printf("%d\n",z);
	scanf("%d",&a);
	scanf("%d",&s);
	}
	return 0;
}

Measured memory_bytes: 1180
#include <iostream>

using namespace std;

int main() {
  int N;
  cin >> N;
  int b = N % 1000;
  int ans = 0;
  if (b == 0) {
    cout << ans << endl;
  } else {
    ans = 1000 - b;
    cout << ans << endl;
  }
}

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

int main(void){
  const char *S[10];
  const char *T[10];
  int len;
  
  scanf("%s",&S);
  scanf("%s",&T);
  len = strlen(S);
  
  if(strncmp(S,T,len)==0){
    printf("Yes");
  }
  else{
    printf("No");
  }
  
  return 0;
}

Measured memory_bytes: 1748
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <locale>
#include <iomanip>
#include <math.h>

#define nl '\n'

using namespace std;

int a, b, c;

int main(){

    cin >> a >> b >> c;

    if((a+b+c) >= 22){
        cout << "bust";
    } else{
        cout << "win";
    }



}

//g++ -std=c++14 comp.cpp -o b; ./b.exe

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ff first
#define ss second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define boost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define check(x) cout << #x << " : " << (x) << endl
#define all(v) v.begin(),v.end() 
#define endl '\n'  
#define show(a) for(auto i:a) cout<<i<<" ";cout<<endl
typedef long long ll; 
typedef unsigned long long ull; 
typedef long double ld;
typedef pair< int , int > mypair;
typedef priority_queue <int> max_heap;
typedef priority_queue <int, vector<int>, greater<int> > min_heap;
const ll mod=1000000007;
const ll inf=1e9;
const ll N=5e5+10;
vector<int> v[N];
vector<int> topo;
int ans[N];
bool visited[N];
void dfs(int node)
{
    visited[node]=1;
    for(auto i:v[node]) if(visited[i]==0) dfs(i);
    topo.pb(node);    
}
int main()
{
    boost;
    string s;
    cin>>s;
    int n=s.size();
    for(int i=0;i<n;i++)
    {
        if(s[i]=='<') v[i].pb(i+1);
        else v[i+1].pb(i);
    }
    for(int i=0;i<=n;i++)
    {
        if(visited[i]==0) dfs(i);
    }
    reverse(all(topo));
    ll tot=0;
    for(auto i:topo)
    {
        for(auto j:v[i])
        {
            ans[j]=max(ans[j],ans[i]+1);
        }
        tot+=ans[i];
    }
    cout<<tot;
    

    return 0;
}

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

#ifdef DEBUG
#define debug(x) cout << #x << ": " << x << endl
#else
#define debug(x)
#endif

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPS(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()

#define pb push_back
#define mp make_pair
#define mt make_tuple

using namespace std;

using ll = long long;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;

const ll INF = 1e18;
const ll MOD = 1e9+7;

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


signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int A, B, C, D; cin >> A >> B >> C >> D;
    int turn = 0;
    while(true)
    {
        if(turn % 2 == 0)
        {
            C -= B;
        }
        else
        {
            A -= D;
        }
        turn++;
        if(A <= 0)
        {
            cout << "No" << endl;
            return 0;
        }
        if(C <= 0)
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3648
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <iostream>
#include <cassert>
#include <cmath>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>

using namespace std;

#define INF 1e+9
#define mp make_pair
#define pb push_back
#define fi first
#define fs first
#define se second
#define i64 long long
#define li long long
#define lint long long
#define pii pair<int, int>
#define vi vector<int>

#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define fore(i, b, e) for (int i = (int)b; i <= (int)e; i++)

int main() {
#ifdef LOCAL
    freopen("inp", "r", stdin);
    //freopen("outp", "w", stdout);
#else
    // freopen(TASKNAME ".in", "r", stdin);
    // freopen(TASKNAME ".out", "w", stdout);
#endif
    int d, n;
    scanf("%d%d", &d, &n);
    int i = 1;
    while(true) {
        int cnt = 0;
        int j = i;
        while(j % 100 == 0) {
            j /= 100;
            cnt++;
        }
        if (cnt == d) {
            n--;
            if (n == 0) {
                printf("%d", i);
                exit(0);
            }
        }
        i++;
    }
}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;
using Graph = vector<vector<int>>;

static long long INF = (1LL<<62);

LL N, K;
vector<LL> P, C;

LL h(int i, int r){
	LL ret = INF * (-1);
	LL u = 0;
	LL pos = P[i];
	for(int j=0; j<r; j++){
		u += C[pos];
		if(ret < u){
			ret = u;
		}
		pos = P[pos];
	}
	return ret;
}

LL f(int i){
	if(K <= N+1){
		return h(i, K);
	}

	LL wa = INF * (-1);
	LL wb = wa, wc = wa, wd = wa;

	LL pos = P[i];
	LL ipos = pos;
	LL count = 0, loop = 0, u = 0;
	while(true){
		u += C[pos];
		if(wa < u){
			wa = u;
		}
		count++;
		pos = P[pos];
		if(pos == ipos){
			loop = 1;
			break;
		}
	}

	if(loop == 1){
		// K = q*count + r;
		LL q = K / count;
		LL r = K % count;
		LL s = h(i, r);
		wb = q*u + s;
		wc = h(i, count);
		wd = (q-1)*u + wc;
	}
	LL ret = 0;
	ret = max(wa, max(wb, max(wc, wd)));
	return ret;
}

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

	cin >> N >> K;

	for(int i=0; i<N; i++){
		LL p;
		cin >> p;
		P.push_back(p-1);
	}
	for(int i=0; i<N; i++){
		LL c;
		cin >> c;
		C.push_back(c);
	}

	LL max_point = INF * (-1);
	for(int i=0; i<N; i++){
		LL w= f(i);
		if(max_point < w){
			max_point = w;
		}
	}
	printf("%lld\n", max_point);
	return 0;
}


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

int main(){
  int A, P; cin >> A >> P;
  cout << (A*3 + P)/2;
  return 0;
}

Measured memory_bytes: 256
s = list(input())


def check(L):
    if len(L)%2 != 0:
        return False
    
    n = int(len(L)/2)
    if L[:n] == L[n:]:
        #print(L[:n],L[n:])
        return True



#print(check(s))

for i in range(1,len(s)):
    m = len(s) - i
    if check(s[0:m]):
        print(m)
        exit()

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
int main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
    #endif        
    long long n;
    cin>>n;
    bool s=1;
    for(int i=-118;i<=120&&s;i++){
        for(int j=-118;j<=120&&s;j++){
            if(pow(i,5)-pow(j,5)==n){
                cout<<i<<" "<<j;
                s=0;
            }
        }
    }
  
}

Measured memory_bytes: 4068
package main

import (
	"fmt"
)

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

	if (b - a + 1) < k {
		k = b - a + 1
	}

	for i := 0; i < k; i++ {
		fmt.Printf("%d\n", (a + i))
	}

	if (b - k + 1) <= (a + k - 1) {
		k = k - ((a + k - 1) - (b - k + 1) + 1)
	}

	for i := 0; i < k; i++ {
		fmt.Printf("%d\n", (b - k + i + 1))
	}
}


Measured memory_bytes: 512
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (1 << 30) - 1
#define LLINF (1LL << 61) - 1
// #define int ll
using namespace std;
const int MOD = 1000000007;
const int MAX = 510000;
const double pi=3.141592653589793;

ll sumofdigits(ll n){
    ll sum =0;
    while(n>0){
        sum += n%10;
        n /=10;
    }
    return sum;
}

double snuke(ll n){
    return (double)n/(double)sumofdigits(n);
}



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n,a=1;
    vll ans;
    cin>>n;
    rep(i,15){
        rep2(j,1,150){
            ans.pb(a*(j+1)-1);
        }
        a*=10;
    }
    sort(all(ans));
    ans.erase(unique(all(ans)),ans.end());
    ll s=ans.size();
    rep(i,s){
        rep2(j,i+1,s){
            if(snuke(ans[i])>snuke(ans[j])){
                ans.erase(ans.begin() + i--);
                break;
            }
        }
    }
    rep(i,n){
        cout<<ans[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;
#define rep(i, n) for (int i = 0; i <(int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
int main(){
   int n;cin>>n;
   int a[n];
   int count=0;
   rep(i,n){
       cin>>a[i];
       if(a[i]%2!=0)count++;
   }
   if(count%2!=0)cout<<"NO"<<endl;
   else cout<<"YES"<<endl;
}

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

typedef struct tp{
  char suit;
  int value;
}TP;

void BubbleSort(TP *,int);
void SelectionSort(TP *,int);
void output(TP *,int);
int hantei(TP *,TP *,int);
  
int main()
{
  int N,i;
  TP C1[36],C2[36];

  scanf("%d",&N);
  if(N<1 || N>36) exit(1);
  for(i=0;i<N;i++){
    scanf(" %c%d",&C1[i].suit,&C1[i].value);
    C2[i] = C1[i];
  }
  
  BubbleSort(&C1[0],N);
  SelectionSort(C2,N);
 
  output(C1,N);
  printf("Stable\n"); /*バブルソートは絶対に安定*/
  output(C2,N);
  if(hantei(C1,C2,N) == 0) printf("Not stable\n");
  else printf("Stable\n");
  
  return 0;
}

void BubbleSort(TP C[],int N)
{
  int i,j,flag=1;
  TP tmp;
  
  /*
  for(i=0;i<N;i++){
    for(j=N-1;j>i;j--){
      if(C[j].value < C[j-1].value){
	tmp = C[j];
	C[j] = C[j-i];
	C[j-1] = tmp;
      }
    }
  }
  */

  while(flag)
    {
      flag=0;
      for(i=N-1;i>0;i--)
	{
	  if(C[i].value < C[i-1].value)
	    {
	      tmp = C[i];
	      C[i] = C[i-1];
	      C[i-1] = tmp;
	      flag=1;
	    }
	}
    }
}

void SelectionSort(TP C[],int N)
{
  int i,j,minj;
  TP tmp;

  for(i=0;i<N;i++){
    minj = i;
    for(j=i;j<N;j++){
      if(C[j].value < C[minj].value)
	minj = j;
    }
    tmp = C[i];
    C[i] = C[minj];
    C[minj] = tmp;
  }
}

void output(TP C[],int N)
{
  int i;
  
  for(i=0;i<N;i++){
    if(i) printf(" ");
    printf("%c%d",C[i].suit,C[i].value);
  }
  printf("\n");
}

int hantei(TP C1[],TP C2[],int N)
{

  int i;
  
  for(i=1;i<N;i++){
      if(C1[i].suit != C2[i].suit) return 0;
  }
  return 1;
				  
}



Measured memory_bytes: 2104
n=int(input())
xlis = list(map(int,input().split()))
def tai(p,x):
  return pow(x-p,2)
ans=999999999999
for i in range(0,100):
  sum=0
  for j in xlis:
    sum+=tai(i,j)
  if ans>sum:
    ans=sum
    
print(ans)

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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

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

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

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

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  explicit FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int N;
  int64 K;
  cin >> N >> K;
  vector< int64 > A(N), F(N);
  cin >> A >> F;
  sort(A.rbegin(), A.rend());
  sort(F.begin(), F.end());
  auto check = [&](int64 limit) {
    int64 add = 0;
    for(int i = 0; i < N; i++) {
      int64 diff = max(0LL, A[i] * F[i] - limit);
      add += (diff + F[i] - 1) / F[i];
      if(add > K)return false;
    }
    return true;
  };

  int64 ok = infll, ng = -1;
  while(ok - ng > 1) {
    int64 mid = (ok + ng) / 2;
    if(check(mid)) ok = mid;
    else ng = mid;
  }
  cout << ok << endl;
}





Measured memory_bytes: 3456
#include <bits/stdc++.h>
#define mp make_pair
#define F first
#define S second
#define ll long long
using namespace std;
const int LIM = 1e6+3;
pair<int,int> arr[LIM+3];
int Ans[LIM+3];
int main(){
  string s;cin >> s;
  int n = s.size();
  int odd = 0,even = 0;
  for(int i = 0;i<n-1;i++)
  {
    swap(odd,even);
    if(s[i] == 'R')even++;
    if(s[i] == 'R' && s[i+1] == 'L')
      Ans[i]+= even, Ans[i+1]+=odd, even = 0, odd = 0;
  }
  odd = 0;even = 0;
  for(int i = n-1;i>0;i--)
  {
    swap(odd,even);
    if(s[i] == 'L')even++;
    if(s[i] == 'L' && s[i-1] == 'R')
      Ans[i]+= even, Ans[i-1]+=odd, even = 0, odd = 0;
  }
  for(int i = 0;i<n;i++)
    printf("%d ", Ans[i]);
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll x;
    cin >> x;
    PR(!(bool)x);

    return 0;
}

/*



*/

Measured memory_bytes: 3524
#include <algorithm>
#include <stdio.h>
#include <vector>
using namespace std;
#define PB push_back

constexpr int kN = int(1E5 + 10);

long long int a[kN];

int main() {
	int n;
	vector<long long int> v;
	long long int ans = 0;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
	sort(a + 1, a + n + 1);
	for (int i = 2; i <= n; i++) if (a[i] == a[i - 1]) {
		v.PB(a[i]);
		i++;
	}
	reverse(v.begin(), v.end());
	if (v.size() >= 2) printf("%lld\n", v[0] * v[1]);
	else printf("0\n");
}


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

int main() {
  int n,a=0,w=0,t=0,r=0;
  string s;
  cin >> n;
  for (int i=0;i<n;i++) {
    cin >> s;
    if (s=="AC") {
      a++;
    }
    if (s=="WA") {
      w++;
    }
    if (s=="TLE") {
      t++;
    }
    if (s=="RE") {
      r++;
    }
  }
  cout << "AC" << " x " << a << endl <<"WA" << " x " << w << endl << "TLE" << " x " << t << endl << "RE" << " x " << r;
}

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

using namespace std;

int a[100005];
char t[5];
pair <int, int> s[100005];

char getChar(int x) {
	return 'A' + x;
}

int main() {
	int n;
	scanf("%d%d%d%d", &n, &a[0], &a[1], &a[2]);
	
	for (int i = 0; i < n; i++) {
		scanf("%s", t);
		
		int x, y;
		
		if (t[0] == 'A') x = 0;
		else x = 1;
		
		if (t[1] == 'B') y = 1;
		else y = 2;
		
		s[i] = make_pair(x, y);
	}
	
	bool gg = 0;
	vector <char> sol;
	
	for (int i = 0; i < n; i++) {
		int x = s[i].first;
		int y = s[i].second;
		
		if (!a[x] && !a[y]) {
			gg = 1;
			break;
		}
		else if (!a[x]) {
			sol.push_back(getChar(x));
			a[x]++;
			a[y]--;
		}
		else if (!a[y]) {
			sol.push_back(getChar(y));
			a[y]++;
			a[x]--;
		}
		else {
			if (i == n - 1) sol.push_back(getChar(x));
			else {
				int nx = s[i + 1].first;
				int ny = s[i + 1].second;
				
				if (x == nx || x == ny) {
					sol.push_back(getChar(x));
					a[x]++;
					a[y]--;
				}
				else {
					sol.push_back(getChar(y));
					a[y]++;
					a[x]--;
				}
			}
		}
	}
	
	if (gg) return 0 * printf("No\n");
	
	printf("Yes\n");
	for (int i = 0; i < sol.size(); i++) printf("%c\n", sol[i]);
	printf("\n");
}


Measured memory_bytes: 4680
using System;

namespace Abc138
{
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            // 整数の入力
            int a = int.Parse(Console.ReadLine());
                       
            // スペース区切りの整数の入力
            string s = Console.ReadLine();

            if(a < 3200)
            {
                Console.WriteLine("red");

            }
            else
            {
                Console.WriteLine(s);
            }
        }
    }
}


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

int main(){
 int A,B,count=1,C;
 cin >>A>>B;
 C=A;
 while(A<B){
   A+=(C-1);
   count++;
 }
 if(B==1)count=0;
 cout <<count;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, s, n) for(int i = s; i < n; i++)

int main() {
    int d, g;
    cin >> d >> g;
    vector<int> p(d);
    vector<ll> c(d);
    rep(i, 0, d) {
        cin >> p[i] >> c[i];
    }
    int ans = 1e9;
    rep(bit, 0, (1<<d)) {
        int tmp = 0;
        int point = 0;
        int m = 0;
        for(int j = 0; j < d; j++) {
            if(bit & (1<<j)) {
                tmp += p[j];
                point += 100*(j+1)*p[j]+c[j];
            }
            else m = j;
        }
        if(point < g) {
            if(100*(m+1)*(p[m]-1)<g-point) continue;
            tmp += min(p[m], (g-point+100*(m+1)-1)/(100*(m+1)));
        }
        ans = min(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
alphabet = "abcdefghijklmnopqrstuvwxyz"
#print(len(alphabet))
#a = len(alphabet)
#print(a)
x = ''
while True:
    try:
        x += input().lower()
    except EOFError:
        break

for i in range(len(alphabet)):
    print("{0} : {1}".format(alphabet[i], int(x.count(alphabet[i]))))

Measured memory_bytes: 7424