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

#define int long long
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
constexpr int MOD = 1e9 + 7;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vec>;

template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) {
    return stream << p.first << " " << p.second;
}
template <typename T>
void print(const vector<vector<T>> matrix) {
    repall (vec, matrix)
        print(vec);
}
template <typename T>
void print(const vector<T> vec) {
    unsigned int len = vec.size();
    rep (i, len - 1)
        cout << vec[i] << ' ';
    cout << vec[len - 1] << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}
template <typename T>
T sum_(vector<T> vec, T init = 0) {
    return std::accumulate(all(vec), T(init));
}

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

template <typename T>
void init(vector<T>& v) {
    rep (i, v.size())
        cin >> v[i];
}

template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) {
    assert(v.size() == w.size());
    rep (i, v.size())
        cin >> v[i] >> w[i];
}

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<vec> g(n + 1);
    int u, v;
    rep (i, m) {
        cin >> u >> v;
        g[u].pb(v);
    }
    int s, t;
    cin >> s >> t;

    vec d(n + 1, INF);
    d[s] = 0;
    pqr<P> q;
    q.push({0, s});

    while (not q.empty()) {
        P p = q.top();
        q.pop();
        repall (e1, g[p.second]) {
            repall (e2, g[e1]) {
                repall (e3, g[e2]) {
                    int alt = d[p.second] + 1;
                    if (d[e3] > alt) {
                        if (e3 == t) {
                            print(alt);
                            return 0;
                        }
                        d[e3] = alt;
                        q.push({alt, e3});
                    }
                }
            }
        }
    }
    print(-1);

    return 0;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V  = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T, class H> void rsz(V<T> &v, H h) { v.resize(h); }
template<class T, class H, class... R> void rsz(V<T> &v, H h, R... r) { v.resize(h); for (auto&& i : v) rsz(i, r...); }
using C = complex<double>;

int main() {
  cin.tie(NULL); ios::sync_with_stdio(false);
  int x, y; cin >> x >> y; C p1(x, y);
  cin >> x >> y; C p2(x, y);
  int q; cin >> q;
  for (int i = 0; i < q; i++) {
    cin >> x >> y; C p(x, y);
    double t = arg((p - p1) / (p2 - p1));
    C res = p1 + (p - p1) * polar(1.0, -2 * t);
    cout << fixed << setprecision(10) << real(res) << ' ' << imag(res) << '\n';
  }
}


Measured memory_bytes: 3808
import numpy as np
 
n, d = map(int, input().split())
 
p = np.zeros((n,d))
 
for i in range(n):
  p[i] = np.array(list(map(int, input().split())))
cnt = 0
d = 0
for i in range(n):
  for j in range(i+1,n):
    d = np.sqrt(np.sum((p[i] - p[j]) ** 2))
    if d % 1 == 0:
      cnt += 1
print(cnt)


Measured memory_bytes: 12396
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<cctype>
#include<string.h>
#include <stdlib.h>

#define PI 3.1415926
int max(int n, int m);

int main() {
	int D, N, T[400], A[400], B[400], C[400], X[20][400] = { 0 };
	int F[10][400] = { 0 };
	int f[10][400];
	int ans = 0;
	scanf("%d %d", &D, &N);
	for (int i = 1; i <= D; i++) {
		scanf("%d", &T[i]);
	}
	for (int i = 1; i <= N; i++) {
		scanf("%d %d %d", &A[i], &B[i], &C[i]);
	}
	for (int i = 1; i <= D+100; i++) {
		X[1][i] = 100;
	}
	for (int i = 1; i <= D; i++) {
		for (int j = 1; j <= N; j++) {
			if (A[j] <= T[i] && B[j] >= T[i] && C[j] > X[0][i]) {
				X[0][i] = C[j];
			}
			if (A[j] <= T[i] && B[j] >= T[i] && C[j] < X[1][i]) {
				X[1][i] = C[j];
			}
		}
		//printf("%d %d %d\n", i, X[0][i], X[1][i]);
	}
	f[0][1] = 0;
	f[1][1] = 1;
	for (int i = 2; i <= D; i++) {
		if (F[0][i-1]+abs(X[0][i] - X[0][i - 1]) > F[1][i-1]+abs(X[0][i] - X[1][i - 1])) {
			F[0][i] = F[0][i - 1] + abs(X[0][i] - X[0][i - 1]);
		}
		else {
			F[0][i] = F[1][i - 1] + abs(X[0][i] - X[1][i - 1]);
		}
		if (F[0][i-1]+abs(X[1][i] - X[0][i - 1]) >F[1][i-1]+ abs(X[1][i] - X[1][i - 1])) {
			F[1][i] = F[0][i - 1] + abs(X[1][i] - X[0][i - 1]);
		}
		else {
			F[1][i] = F[1][i - 1] + abs(X[1][i] - X[1][i - 1]);
		}
		//printf("%d %d\n", F[0][i], F[1][i]);
	}

	printf("%d\n",max(F[0][D],F[1][D]));
	return 0;
}

int max(int n, int m) {
	if (n >= m) {
		return n;
	}
	else {
		return m;
	}
}

Measured memory_bytes: 2696
using System;
using System.Linq;

namespace Hitachi2020A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string res = "Yes";
            if (s.Length%2 == 1)
            {
                Console.WriteLine("No");
                return;
            }
            for (int i = 0; i < s.Length; i++)
            {
                if (s.Substring(i,2) == "hi")
                {
                    i++;
                    continue;
                }
                else
                {
                    res = "No";
                    break;
                }
            }
            Console.WriteLine(res);
        }
    }
}


Measured memory_bytes: 11092
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iterator>
#define INF 2147483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;

int main(){
  int n;cin>>n;
  ll ans=0;
  vector<int> A(n),B(n),C(n);
  vector<int> AA(n),CC(n);
  for(int i=0;i<n;i++){
    AA[i]=i;
    CC[i]=n-i-1;
  }
  for(int i=0;i<n;i++)
    cin>>A[i];
  for(int i=0;i<n;i++)
    cin>>B[i];
  for(int i=0;i<n;i++)
    cin>>C[i];
  sort(A.begin(),A.end());
  sort(C.begin(),C.end());
  for(int i=0;i<n;i++){
    ll C_BE=n-(upper_bound(C.begin(),C.end(),B[i])-C.begin());
    ll A_BE=lower_bound(A.begin(),A.end(),B[i])-A.begin();
    ans+=C_BE*A_BE;
    //cout<<C_BE<<" "<<A_BE<<endl;
    //cout<<upper_bound(C.begin(),C.end(),B[i])-C.begin()<<endl;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 2176
N, M = map(int, input().split())

a_list = []
b_list = []
edge = [[0 for _ in range(N)] for _ in range(N)]

for _ in range(M):
    a, b = map(int, input().split())
    a_list.append(a - 1)
    b_list.append(b - 1)
    edge[a - 1][b - 1] = 1
    edge[b - 1][a - 1] = 1

ans = 0
flags = [False] * N

def dfs(v):
    flags[v] = True
    for v2 in [i for i, x in enumerate(edge[v]) if x == 1]:
        if flags[v2]:
            continue
        dfs(v2)

for i in range(M):
    edge[a_list[i]][b_list[i]] = 0
    edge[b_list[i]][a_list[i]] = 0

    flags = [False] * N

    dfs(0)
    ans += 1 if not all(flags) else 0

    edge[a_list[i]][b_list[i]] = 1
    edge[b_list[i]][a_list[i]] = 1

print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() 
{	
	int n; cin>>n;
	map<string,int>mp;
	for(int i=0;i<n;i++)
	{
		string a; cin>>a;
		mp[a]++;
	}
	cout<<"AC "<<"x"<<" "<<mp["AC"]<<endl;
		cout<<"WA "<<"x"<<" "<<mp["WA"]<<endl;
			cout<<"TLE "<<"x"<<" "<<mp["TLE"]<<endl;
				cout<<"RE "<<"x"<<" "<<mp["RE"]<<endl;
	
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;

int main() {
    int n;
    cin >> n;
    double ans = 0;
    rep(i,n) {
        double x;
        string u;
        cin >> x >> u;
        if (u == "JPY") ans += x;
        else ans += x*380000;
    }
    printf("%.10f\n", ans);
    return 0;
}

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

inline double add(double a, double b){
    return abs(a+b)<(1e-10)*(abs(a)+abs(b)) ? 0.0 : a+b;
}

struct vec{
    long double x,y;
    vec operator-(vec b){
        return (vec){add(x,-b.x),add(y,-b.y)};
    }
    vec operator+(vec b){
        return (vec){add(x,b.x),add(y,b.y)};
    }
    vec operator*(long double d){
        return (vec){x*d,y*d};
    }
    bool operator==(vec b){
        return x==b.x&&y==b.y;
    }
    bool operator!=(vec b){
        return x!=b.x||y!=b.y;
    }
    bool operator<(const vec&r) const{
    return this->x==r.x?this->y<r.y:this->x<r.x;
    }
    long double dot(vec v){
        return add(x*v.x,y*v.y);
    }
    long double cross(vec v){
        return add(x*v.y,-y*v.x);
    }
    long double norm(){
        return sqrt(x*x+y*y);
    }
};

int main(){
    int N; cin>>N;
    vec V[N];
    for(auto& v:V) cin>>v.x>>v.y;
    if(N%2){
        cout << "NA" << endl;
        return 0;
    }
    vec M[N/2];
    for(int i=0;i<N/2;i++){
        M[i]=(V[i]+V[N/2+i])*0.5;
    }
    for(int i=1;i<N/2;i++){
        if((M[0]-M[i]).norm()>1e-4){
            cout << "NA" << endl;
            return 0;
        }
    }
    cout.precision(5);
    cout << fixed;
    cout << M[0].x << " " << M[0].y << endl;
    return 0;
}

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

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

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

using namespace std;


int N, M, Q;
int a[52]={0}, b[52]={0}, c[52]={0}, d[52]={0};

vector<int> v; //数列の表現

void dfs(vector<int> &A, long long &tokuten){
	if(A.size() == N){
		long long lsum = 0;
		for(int i=1; i<=Q; i++){
			if(A[b[i]-1] - A[a[i]-1] == c[i]){
				lsum += d[i];
			}
		}
		if(lsum > tokuten){ tokuten = lsum; }
		return;
	}

	for(int i=1; i<=M; i++){
		if(A.size() > 0 && A[A.size()-1] > i) continue;
		A.push_back(i);
		dfs(A, tokuten);
		A.pop_back();
	}
}

int main(int argc, char* argv[]){
	cin >> N >> M >> Q;

	for(int i=1; i<=Q; i++){
		cin >> a[i] >> b[i] >> c[i] >> d[i] ;
	}

	long long ans = 0;
	v.clear();
	dfs(v, ans);
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 3780
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main()
{	
	int a,b,c;
	cin>>a>>b>>c;
	int t=(a+b-1)/a;
	if(a*t>=b&&a*t<=c)cout<<"OK"<<endl;
	else cout<<"NG"<<endl;
	return 0;
}

Measured memory_bytes: 3636
import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)

def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))
import math

n = getN()
nums = getList()

ans = 0
for num in nums:
    ans += 1/ num
    # print(ans)

print(1/ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main () {
    int n, d, x, a[100], dem = 0, res = 0, demsum = 0, k = 1;
    cin >> n >> d >> x;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    for (int i = 1; i <= n; i++)    {
        while (res <= d)    {
            res = k*a[i] + 1;
            dem++;
            k++;
        }
        demsum += dem;
        dem = 0;
        res = 0;
        k = 1;
    }
    cout << demsum + x << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define maxm 100005
#define maxn 10005
using namespace std;
typedef long long ll;
struct edge{
	int from,to;
	double cst;
	bool operator <(const edge e)const
	{
		return cst > e.cst;
	}
}el[maxm];
int par[maxn],hei[maxn],E,n,m,x[maxn],y[maxn];
double tot,ans;
inline void ini(int x){
	for(int i=1;i<=x;i++){
		par[i] = i;
		hei[i] = 1;
	}
}
int fin(int x){
	if(par[x] == x) return x;
	return par[x] = fin(par[x]);
}
inline void uni(int x,int y){
	x = fin(x);y = fin(y);
	if(x==y) return;
	if(hei[x] < hei[y]) par[x] = y;
	else{
		par[y] = x;
		if(hei[x] == hei[y]) hei[x]++;
	}
}
inline bool same(int x,int y){
	return fin(x) == fin(y);
}
inline void kruskal(){
	ini(n);
	sort(el+1,el+E+1);
	for(int i=1;i<=E;i++){
		if(!same(el[i].from,el[i].to)){
			uni(el[i].from,el[i].to);
			ans += el[i].cst;
		}
	}
	printf("%.5lf\n",tot - ans);
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&x[i],&y[i]);
	}
	for(int i=1;i<=m;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		el[++E].from = u;
		el[E].to = v;
		el[E].cst = sqrt((x[u]-x[v])*(x[u]-x[v])+(y[u]-y[v])*(y[u]-y[v]));
		tot += el[E].cst;
	}
	kruskal();
	return 0;
}



Measured memory_bytes: 3828
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>
using namespace std;
int c[3][3];
int t = 0;
int main() {
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < 3; j++){
            cin >> c[i][j];
        }
    }
    vector<int>a(3);
    vector<int>b(3);
    for(int i = 0; i <= 100; i++){
        a[0] = i;
        b[0] = c[0][0] - a[0];
        b[1] = c[0][1] - a[0];
        b[2] = c[0][2] - a[0];
        a[1] = c[1][0] - b[0];
        a[2] = c[2][0] - b[0];
        for(int i = 0; i < 3; i++){
            for(int j = 0; j < 3; j++){
                if(c[i][j] == a[i] + b[j]){
                    t++;
                }
            }
        }
        if(t == 9) {
            cout << "Yes" << endl;
            return 0; 
        }
    }   
    cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 100000;
class Graph {
	int N;
	vector<vector<P>> edge;
	vector<vector<int>> dp;

public:
	Graph(int N) : N(N), edge(N), dp(1 << N, vector<int>(N, -1)) {}
	void add(int s, int t, int d) {
		edge[s].emplace_back(t, d);
	}
	int ans(int st = 0, int now = 0) {
		if (dp[st][now] >= 0) {
			return dp[st][now];
		}
		if (st == (1 << N) - 1 && now == 0) {
			return dp[st][now] = 0;
		}
		int res = INF;
		for (auto &p : edge[now]) {
			int to, d;
			tie(to, d) = p;
			if (!(st >> to & 1)) {
				res = min(res, ans(st | (1 << to), to) + d);
			}
		}
		return dp[st][now] = res;
	}
};

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

	int V, E;
	cin >> V >> E;
	Graph graph(V);
	REP(i, E) {
		int s, t, d;
		cin >> s >> t >> d;
		graph.add(s, t, d);
	}
	int res = graph.ans();
	if (res == INF) res = -1;
	cout << res << endl;

	return 0;
}


Measured memory_bytes: 6216
package main

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

var sc = bufio.NewScanner(os.Stdin)
var patterns = []struct {
	pos [6]int
}{
	{[6]int{0, 0, 0, 1, 0, 2}},
	{[6]int{1, 0, 1, 1, 1, 2}},
	{[6]int{2, 0, 2, 1, 2, 2}},
	{[6]int{0, 0, 1, 0, 2, 0}},
	{[6]int{0, 1, 1, 1, 2, 1}},
	{[6]int{0, 2, 1, 2, 2, 2}},
	{[6]int{0, 0, 1, 1, 2, 2}},
	{[6]int{0, 2, 1, 1, 2, 0}},
}

func main() {
	var bingo [3][3]int
	// scan card
	bingo[0] = scanIntNums()
	bingo[1] = scanIntNums()
	bingo[2] = scanIntNums()

	// scan bingo
	inputlines := scanInt100Lines()

	if checkResult(bingo, inputlines) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

func checkResult(bingo [3][3]int, nums []int) bool {
	for _, pattern := range patterns {
		if contain(bingo[pattern.pos[0]][pattern.pos[1]], nums) &&
			contain(bingo[pattern.pos[2]][pattern.pos[3]], nums) &&
			contain(bingo[pattern.pos[4]][pattern.pos[5]], nums) {
			return true
		}
	}
	return false
}

func contain(num int, array []int) bool {
	for _, v := range array {
		if v == num {
			return true
		}
	}
	return false
}

func scanIntNum() (num int) {
	sc.Scan()

	num, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return num
}

func scanInt100Lines() []int {
	var array []int

	for sc.Scan() {
		num, e := strconv.Atoi(sc.Text())
		if e != nil {
			break
		}
		array = append(array, num)
	}
	return array
}

func scanIntNums() (nums [3]int) {
	sc.Scan()
	numString := strings.Split(sc.Text(), " ")

	var err error

	for i := 0; i < 3; i++ {
		nums[i], err = strconv.Atoi(numString[i])
		if err != nil {
			panic(err)
		}
	}
	return nums
}


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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (int i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()

const int MAX = 1e5+10;
const int MOD = 998244353;

int N;
int D[MAX];
int memo[MAX];

int solve() {
    if (D[0] != 0) return 0;
    REP (i, N) {
        memo[D[i]]++;
    }
    ll ans = 1;
    FOR (i, 1, N) {
        ans = ans * memo[D[i]-1] % MOD;
    }
    return ans;
}

int main() {
    cin >> N;
    REP (i, N) cin >> D[i];
    cout << solve() << endl;
}

Measured memory_bytes: 1024
def isCLKWISE(ph) : return not ((ph[-1][0] - ph[-3][0])*(- ph[-3][1] + ph[-2][1]) - (ph[-2][0] - ph[-3][0])*(- ph[-3][1] + ph[-1][1] ) < 0)
      
def ConvexHullScan(P):
    P = sorted(P)
    phU = [P[0],P[1]]
    for p in P[2:]:
        phU.append(p)
        while(True):
            try :
                if isCLKWISE(phU) : break
                else : del phU[-2]
            except IndexError : break
    phL = [P[-1],P[-2]]
    for p in P[-3::-1]:
        phL.append(p)
        while(True):
            try :
                if isCLKWISE(phL) : break
                else : del phL[-2]
            except IndexError : break
    ph = phU + phL[1:-1]
    return ph
  
P = [[int(x) for x in input().split()] for _ in range(int(input()))]
P = ConvexHullScan(P)
P.reverse()
print(len(P))
idx = min([[x[1][1],x[1][0],x[0]] for x in enumerate(P)])[2]
for p in P[idx:] + P[:idx] : print(p[0],p[1])

Measured memory_bytes: 33276
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 競プロ_Csharp {
    class Program {
        static void Main(string[] args) {

            int[] a = NextInts();
            Array.Sort(a);
            Println(string.Join(" ", a));

        }

        public static void Println (Object o) {
            Console.WriteLine(o);
        }

        public static string NextString() {
            return Console.ReadLine();
        }

        public static int NextInt () {
            return int.Parse(Console.ReadLine());
        }

        public static int[] NextInts () {
            string[] a = Console.ReadLine().Split();
            int[] b = new int[a.Length];
            for (int i = 0; i < a.Length; i++) {
                b[i] = int.Parse(a[i]);
            }
            return b;
        }
    }
}



Measured memory_bytes: 18044
N = int(input())
S = [int(input()) for _ in range(N)]
s = sum(S)
S.sort()
if s % 10 != 0:
    print(s)
else:
    for t in S:
        if t % 10 == 0:
            continue
        else:
            print(s-t)
            break
    else:
        print(0)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int M = 202;
int g[M][M],G[M][M];
int r[10];
bool vis[M];
int ans;
int n,m,R;
void dfs(int s,int cnt,int sum){
    //cout<<s<<' '<<cnt<<' '<<sum<<endl;
    if(cnt==R){
        ans=min(ans,sum);
        return;
    }
    for(int i=1;i<=R;++i){
        if(vis[i] || G[s][i]==INF) continue;
        vis[i]=true;
        dfs(i,cnt+1,sum+G[s][i]);
        vis[i]=false;
    }
}
int main(){

    while(cin>>n>>m>>R){
        for(int i=1;i<=R;++i) cin>>r[i];
        memset(g,0x3f,sizeof(g));
        for(int i=1;i<=n;++i) g[i][i]=0;
        int a,b,c;
        while(m--){
            cin>>a>>b>>c;
            g[a][b]=g[b][a]=min(g[a][b],c);
        }
        for(int k=1;k<=n;++k)
            for(int i=1;i<=n;++i)
                for(int j=1;j<=n;++j)
                    g[i][j]=min(g[i][j],g[i][k]+g[k][j]);
        memset(G,0x3f,sizeof(G));
        for(int i=1;i<=R;++i) G[i][i]=0;
        for(int i=1;i<=R;++i)
            for(int j=i+1;j<=R;++j)
                G[i][j]=G[j][i]=g[r[i]][r[j]];
        ans=INF;

        for(int i=1;i<=R;++i){
            memset(vis,false,sizeof(vis));
            vis[i]=true;//cout<<endl;
            dfs(i,1,0);
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Text;

class Program
{
	static Dictionary<int, int> dp = new Dictionary<int, int>() {{ 0, 1 }, { 1, 1 }};

	static void Main(string[] args)
	{
		string[] inputs = Console.ReadLine().Split();
		System.Console.WriteLine(Fib(int.Parse(inputs[0])));
	}

	static int Fib(int i)
	{
		return dp.ContainsKey(i) ? dp[i] : dp[i] = Fib(i - 1) + Fib(i - 2);
	}
}



Measured memory_bytes: 9652
def main():
    n,y = map(int, input().split())
    aa, ab, ac = -1, -1, -1
    a = y//10000
    b = (y-10000*a)//5000
    c = (y-10000*a-5000*b)//1000
    flag = False
    if n > a+b+c:
        no = n-a-b-c
        for s in range(b+1):
            for t in range(a+1):
                for t1 in range(t+1):
                    for t5 in range(t-t1+1):
                        if s*4 + t1*9 + t5 == no:
                            aa = a-t
                            ab = b-s+t5*2
                            ac = c+s*5+t1*10
                            flag = True
                            break
                    if flag:
                        break
                if flag:
                    break
            if flag:
                break
    elif n == a+b+c:
        aa, ab, ac = a, b, c
    print(aa,ab,ac)


if __name__ == "__main__":
    main()

Measured memory_bytes: 39152
import math
from itertools import groupby

def rlE(S: str):
    grouped = groupby(S)
    res = []
    for k, v in grouped:
        res.append((k, (len(list(v)))))
    return res

S = input()
ans = [0 for _ in range(len(S))]
cnt = 0
rS = rlE(S)
rS.append(["", 0])
temp = rS[0][1] - 1

while(cnt < len(rS) - 1):
    ans[temp] = math.ceil(rS[cnt][1] / 2) + rS[cnt + 1][1] - math.ceil(rS[cnt + 1][1] / 2)
    ans[temp + 1] = math.ceil(rS[cnt + 1][1] / 2) + rS[cnt][1] - math.ceil(rS[cnt][1] / 2)
    temp += (rS[cnt + 1][1] + rS[cnt + 2][1])
    cnt += 2
print(*ans)

Measured memory_bytes: 91308
from itertools import product

S = list(map(int, input()))
S.reverse()
ans = 0

# 区切り方のパターン全列挙
for part in product(range(2), repeat = len(S) - 1):
	cur = 0
	keta = 1
	for j in range(len(S)):
		cur += keta * S[j]
		if j == len(S) - 1: break
		if part[j] == 1:
			ans += cur
			keta = 1
			cur = 0
		else:
			keta *= 10
	if cur != 0:
		ans += cur
			
print(ans)

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

void insertionSort(int A[], int N);
void trace(int A[], int N);

int main(){
    int i, N;
    cin >> N;
    int A[N];
    for(i = 0; i < N; i++){
        cin >> A[i];
    }
    insertionSort(A, N);
    return 0;
}

void trace(int A[], int N){
    int i;
    for(i=0;i < N ;i++){
        if(i > 0) cout << " ";
        cout << A[i];
    }
    cout << endl;
}

void insertionSort(int A[], int N){
    trace(A, N);
    for(int i = 1; i < N; i++){
        int v, j;
        v = A[i];
        j = i - 1;
        while( j >= 0 && A[j] > v){
            A[j+1] = A[j];
            j--;
        }
        A[j+1] = v;
        trace(A, N);
    }
}


Measured memory_bytes: 3088
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>

using namespace std;

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

	for (int tsuru = 0; tsuru <= x; tsuru++) {
		int kame = x - tsuru;
		int tmp = tsuru * 2 + kame * 4;
		if (tmp == y) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}


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

public class Main{
    final static String alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".toLowerCase();//.toCharArray();
    static class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){br = new BufferedReader(new InputStreamReader(System.in));}
        String next(){while (st == null || !st.hasMoreElements()){try{st = new StringTokenizer(br.readLine());}catch (IOException  e){e.printStackTrace();}}return st.nextToken();}
        int nextInt(){return Integer.parseInt(next());}
        long nextLong(){return Long.parseLong(next());}
        double nextDouble(){return Double.parseDouble(next());}
        int[] readArray(int n){int[] a=new int[n];for (int i=0; i<n; i++) a[i]=nextInt();return a;}
        long[] readLongArray(int n){long[] a=new long[n];for (int i=0; i<n; i++) a[i]=nextLong();return a;}
        String nextLine(){String str = "";try{str = br.readLine();}catch (IOException e){e.printStackTrace();}return str;}
    }
    static int getGcd(int n1,int n2){
        while(n1 != n2){
            if(n1 > n2) n1 -= n2;
            else n2 -= n1;
        }
        return n1;
    }
    static boolean isSorted(int[] arr, int n){
        for(int i=1;i<n;i++){
            if(arr[i]<arr[i-1]) return false;
        }
        return true;
    }
    static boolean isPrime(long n){
        if(n==2) return true;
        else if(n%2==0) return false;
        for(int i=3;i<=n/2;i+=2){
            if(n%i==0) return false;
        }
        return true;
    }
    static boolean isPrime(int n){
        if(n==2) return true;
        else if(n%2==0) return false;
        for(int i=3;i<=n/2;i+=2){
            if(n%i==0) return false;
        }
        return true;
    }
    static void printArray(int[] arr){
        for(int x:arr){
            System.out.print(x+" ");
        }
        System.out.println();
    }
    static long Fact(int n){
        //int p=1000000007;
        long result = 1;
        for (int i = 1; i <= n; i++) result = (result*i);
        //for (int i = 1; i <= n; i++) result = (result*i)%p;
        return result;
    }
    static final Random random=new Random();
    static void ruffleSort(int[] a) {
        int n=a.length;//shuffle, then sort
        for (int i=0; i<n; i++) {
            int oi=random.nextInt(n), temp=a[oi];
            a[oi]=a[i]; a[i]=temp;
        }
        Arrays.sort(a);
    }
    public static void main(String[] args) throws NumberFormatException, IOException {
        FastReader s = new FastReader();
        PrintWriter pw = new PrintWriter(System.out,true);
        int n=s.nextInt(),x=s.nextInt(),t=s.nextInt();
        int ans=n/x;
        if(n%x!=0) ans+=1;
        pw.println(ans*t);
    }
}

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

int f(int n) {
  if (n % 2) return 3*n+1;
  else return n/2;
}

int main() {
  int s;
  cin >> s;
  int n = 1;
  set<int> S;
  while (true) {
    S.insert(s);
    n++;
    s = f(s);
    if (S.count(s)) {
      cout << n << endl;
      return 0;
    }
  }
}

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll K;
    cin >> K;
    vector<ll> v(K);
    REP(i, K) {
        cin >> v[i];
    }

    REP(i, pow(2LL, N)) {
        bool e = true;
        REP(j, K) {
            if ((i & (1LL << v[j])) == 0)
                e = false;
        }
        if (!e)
            continue;
        cout << i << ":";
        REP(j, N) {
            if ((i >> j) & 1)
                cout << " " << j;
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3360
#include<stdio.h>
char str[1024],input[2048];

void print(void){
	int i,a,b;
	sscanf(input,"print %d %d",&a,&b);
	
	for(i=a;i<=b;i++){
		printf("%c",str[i]);
	}
	printf("\n");
}

void reverse(void){
	int i,a,b;
	char tmp;
	sscanf(input,"reverse %d %d",&a,&b);
	
	for(i=0;i<(b-a+1)/2;i++){
		tmp=str[a+i];
		str[a+i]=str[b-i];
		str[b-i]=tmp;
	}
}

void replace(void){
	int i,a,b;
	char tmp[1024];
	sscanf(input,"replace %d %d %s",&a,&b,&tmp);
	
	for(i=0;i<b-a+1;i++){
		str[a+i]=tmp[i];
	}
	
	
}

int main(){
	int i,num;
	
	fgets(str,sizeof str,stdin);
	
	fgets(input,sizeof input,stdin);
	sscanf(input,"%d",&num);
	
	for(i=0;i<num;i++){
		fgets(input,sizeof input,stdin);
		switch(input[2]){
			case 'p':
				replace();
			break;
				
			case 'v':
				reverse();
			break;
				
			case 'i':
				print();
			break;
		}
	}
	
	
	return 0;
}

Measured memory_bytes: 588
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Math;
using static System.Array;
using static AtCoderSolve.Tool;

namespace AtCoderSolve
{
    class Solve
    {
        const int mod = 1000000007;
        const int INF = int.MaxValue / 2;
        const long SINF = long.MaxValue / 2;

        static void Main(string[] args)
        {
            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);
            var cin = new Scanner();
            const long max = 1000000000;
            long S = long.Parse(Console.ReadLine());
            long x2, x3;
            long a = S / max;
            long r = S % max;
            if (a >= max)
            {
                x2 = max;
                x3 = 0;
            }
            else
            {
                x2 = a + 1;
                x3 = max - r;
            }

            Console.WriteLine($"0 0 {x2} 1 {x3} {max}");
            



            //Console.Out.Flush();
        }

        //10e9*x2-x3=10e9*a+r
        //10e9*(x2-1)+(10e9-x3)=10e9*a+r

    }

    public class Scanner
    {
        public int[] SplitReader()
        {
            int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return array;
        }
        public long[] SplitReaderL()
        {
            long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return array;
        }
    }

    public static class Tool
    {
        static public void Initialize<T>(ref T[] array, T initialvalue)
        {
            for(var i = 0; i < array.Length; i++)
            {
                array[i] = initialvalue;
            }
        }
    }

    struct Pair<T> : IComparable<Pair<T>> where T : IComparable<T>
    {
        public T variable;
        public int index;

        public Pair(T val, int i)
        {
            variable = val;
            index = i;
        }

        public int CompareTo(Pair<T> otherPair)
        {
            return variable.CompareTo(otherPair.variable);
        }

        public int CompareIndex(Pair<T> otherPair)
        {
            return index.CompareTo(otherPair.index);
        }
    }



}






Measured memory_bytes: 13140
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> query;
typedef vector<vector<ll>> matrix;

int n, q;
string s;
char desire[200005];
char dir[200005];
bool valid[200005];
void solve() {
  // TODO: fix input
  cin >> n >> q >> s;
  for(int i = 0; i < q; i++) {
    cin.ignore();
    cin >> desire[i] >> dir[i];
  }
  {
    // prefix
    int lhs = -1;
    int rhs = n-1;
    while(lhs != rhs) {
      int mid = (lhs+rhs+1)/2;
      int curr = mid;
      for(int i = 0; i < q && curr >= 0 && curr < n; i++) {
        if(desire[i] == s[curr]) {
          if(dir[i] == 'L') curr--;
          else curr++;
        }
      }
      if(curr < 0) lhs = mid;
      else rhs = mid-1;
    }
    for(int i = 0; i <= lhs; i++) {
      valid[i] = true;
    }
  }
  {
    // suffix
    int lhs = 0;
    int rhs = n;
    while(lhs != rhs) {
      int mid = (lhs+rhs)/2;
      int curr = mid;
      for(int i = 0; i < q && curr >= 0 && curr < n; i++) {
        if(desire[i] == s[curr]) {
          if(dir[i] == 'L') curr--;
          else curr++;
        }
      }
      if(curr >= n) rhs = mid;
      else lhs = mid+1;
    }
    for(int i = lhs; i < n; i++) {
      valid[i] = true;
    }
  }
  int ret = 0;
  for(int i = 0; i < n; i++) {
    ret += valid[i];
  }
  cout << n - ret << "\n";
}

void casesolve() {
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
  // casesolve();
}


Measured memory_bytes: 1172
#include<bits/stdc++.h>
using namespace std;
const int N=105;
int n,a[N],nans;double av,aa;
int main(){
    ios::sync_with_stdio(false);cin>>n;
    for(int i=1;i<=n;++i)cin>>a[i],av+=a[i];av/=n;
    aa=0x3f3f3f3f;
    for(int i=1;i<=n;++i)if(aa>fabs(av-a[i]))aa=fabs(av-a[i]),nans=i;
    cout<<nans-1<<endl;return 0;
}

Measured memory_bytes: 256
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseFloat(x::SubString{String}) = parse(Float64, x)
parseFloat(x::Char) = parse(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    s=split(readline())
    println(uppercase(join([s[1][1],s[2][1],s[3][1]])))
end
main()

Measured memory_bytes: 113704
w=input()
count={w[0]:0}

for i in w:
    if i in count:
        count[i]+=1
        
    else:
        count[i]=1

for i in count.values():
    ans=0
    if i%2==0:
        ans+=1
    else:
        ans=0
        break
    
print('Yes' if ans>0 else 'No')

Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int main()
{
	char a[11];
	scanf("%s",a);
	int A,C,i;
	A=C=0;
	for(i=1;i<strlen(a);i++)
	{
		if(a[i]=='C')
			C++,A=i;
		else if(a[i]>='a' && a[i]<='z')
			;
		else
			break;
	}
	if( a[0]=='A' &&A!=strlen(a)-1 && A!=1 && C==1 && i>=strlen(a))
		printf("AC\n");
	else
		printf("WA\n");
    return 0;
}


Measured memory_bytes: 256
n = int(input())
p = [list(str(input())) for _ in range(n)]
m = 0
a = 0
r = 0
c = 0
h = 0
for i in p:
    if i[0] == 'M':
        m += 1
    if i[0] == 'A':
        a += 1
    if i[0] == 'R':
        r += 1
    if i[0] == 'C':
        c += 1
    if i[0] == 'H':
        h += 1
ln = [m, a, r, c, h]
import itertools
ans = 0
for j in itertools.combinations(ln, 3):
    ans += j[0] * j[1] * j[2]
print(ans)

Measured memory_bytes: 84312
n = int(input())
h = list(map(int,input().split()))

ans = 0
c = 0
while max(h) != 0:
    flag = False
    for i in range(n):
        if h[i] != 0:
            h[i] -= 1
            flag = True
            if i == n-1:
                ans += 1
                c += 1
        elif flag:
            flag = False
            ans += 1
print(ans)

Measured memory_bytes: 38896
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    static int[] w = new int[100010];
    static int[] v = new int[100010];
    static int[][] dp = new int[110][100010];
    static int k;

    static int chmin(int a, int b) {
        if (a > b) {
            a = b;
            return a;
        }
        return a;
    }

    static int chmax(int a, int b) {
        if (a < b) {
            a = b;
            return a;
        }
        return a;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] l = sc.next().toCharArray();
        int count = 0;
        for (int i = 0; i < 3; i++) {
            if (l[i] == 'o') {
                count++;
            }
        }
        System.out.println(700 + 100 * count);
    }
}


Measured memory_bytes: 84308
#include <cstdio>

int main()
{
  char s[4];
  scanf("%s", s);
  printf("%d\n", (s[0] == '1' ? 1 : 0) + (s[1] == '1' ? 1 : 0) + (s[2] == '1' ? 1 : 0));
  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <math.h>

#define SIZE 1024

int main(void){
  int n, i;
  double  m, sigma, a;

  for (;;){
    m = 0, sigma = 0;
    double s[SIZE] = {0};
    
    scanf("%d", &n);
    if (n == 0)
      break;
    for (i = 0; i < n; i++) {
      scanf("%lf", &s[i]);
      m += s[i];
    }
    m /= n;

    for (i = 0; i < n; i++)
      sigma += pow(s[i] - m, 2);
    a = sqrt(sigma / n);

    printf("%lf\n", a);
  }
  return 0;
}



Measured memory_bytes: 2772
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>

// ===============================================================

using namespace std;
using ll = long long;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using vs = vector<string>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using vm = vector<short>;
using vmm = vector<vector<short>>;
using pii = pair<int, int>;
using psi = pair<string, int>;
using ld = long double;
using ull = unsigned long long;

// ===============================================================

ll gcd(ll a, ll b)
{
	if (a % b == 0)
	{
		return(b);
	}
	else
	{
		return(gcd(b, a % b));
	}
}
//最大公約数
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
//最小公倍数
ll box(double a) 
{
	ll b = a;
	return b;
}
//切り捨て
ll fff(double a) 
{
	ll b = a + 0.5;
	return b;
}
//四捨五入
ll sum(ll n) { 
	return (1 + n) * n / 2;
}
//1から整数nまでの合計
bool prime(ll a)//素数判定、primeならtrue,違うならfalse
{
	if (a < 2) return false;
	else if (a == 2) return true;
	else if (a % 2 == 0) return false;
	double sqrtNum = sqrt(a);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (a % i == 0)
		{
			return false;
		}
	}

	// 素数である
	return true;
}
//素数判定

// ===============================================================

int main() {
	ll n; cin >> n;
	vl a(n);
	ll cnt = 10000;
	ll count = 0;
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 32; j++) {
			if (a[i] % 2 == 0) {
				a[i] /= 2; 
				count++;
			}
			else {
				if (min(cnt, count) == count) {
					cnt = count;
				}
			}
		}
		count = 0;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 3600
#include <iostream>
#include <iomanip>
using namespace std;
int n;
double p[3000];
double dp[3000][3000];
double ans = 0;
int main () {
	cout << fixed;
	cout << setprecision(10);
	cin >> n;
	for (int i=0; i<n; i++) {
		cin >> p[i];
	}
	dp[0][0] = 1;
	for (int i=1; i<=n; i++) {
		dp[i][0] = dp[i-1][0]*(1.0-p[i-1]);
		for (int j=1; j<=n; j++) {
			dp[i][j] = dp[i-1][j-1]*p[i-1]+dp[i-1][j]*(1.0-p[i-1]);
		}
	}
	for (int i=n/2+1; i<=n; i++) {
		ans += dp[n][i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 74108
N = int(input())

count_list = []
for num in range(1, N + 1):
    if num % 2 != 0:
        count = 0
        for n in range(1, num + 1):
            if num % n == 0:
                count += 1
            else:
                pass
        count_list.append(count)
    else:
        count_list.append(-1)

print(count_list.count(8))

Measured memory_bytes: 3060
import std.algorithm, std.conv, std.range, std.stdio, std.string;
import std.uni;

void main()
{
  auto hi = new int[](26);

  for (;;) {
    auto s = readln;
    if (!s) break;

    foreach (c; s.chomp)
      if (c.isLower) ++hi[c - 'a'];
      else if (c.isUpper) ++hi[c - 'A'];
  }

  foreach (dchar i; 0..26)
    writefln("%c : %d", dchar(i + 'a'), hi[i]);
}

Measured memory_bytes: 2492
sx,sy,tx,ty = map(int,input().split())

U = (ty - sy)*'U'
D = (ty - sy)*'D'
R = (tx - sx)*'R'
L = (tx - sx)*'L'

print(U+R+D+L+'LU'+U+R+'RD'+'RD'+D+L+'LU')

Measured memory_bytes: 3060
-- AtCoder My Practice
-- author: Leonardone @ NEETSDKASU

-- 解説読後
-- http://arc060.contest.atcoder.jp/data/arc/060/editorial.pdf

import qualified Data.Array as A
import qualified Data.Map as M

main = print . solve . map read . words =<< getContents

solve (n:a:xs) = ans where
    x  = maximum (a:xs)
    nx = n * x
    ys = A.listArray (1, n) $ map (+ (-a)) xs
    dp j t m =
        case M.lookup (j, t) m of
        Just c  -> (c, m)
        Nothing ->
            case True of
                _ | j == 0 && t == nx -> (1, m)
                _ | j >= 1 && (ty <  0 || ty >  2 * nx) -> ans where
                    (a1, m1) = dp j1 t m
                    ans = (a1, M.insert (j, t) a m1)
                _ | j >= 1 && (ty >= 0 && ty <= 2 * nx) -> ans where
                    (a1, m1) = dp j1 t m
                    (a2, m2) = dp j1 ty m1
                    ans = (a1 + a2, M.insert (j, t) (a1 + a2) m2)
                _ -> (0, m)
        where
            j1 = j - 1
            ty = t - (ys A.! j)
    ans = fst (dp n nx M.empty) - 1

Measured memory_bytes: 7164
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		char[] t = sc.next().toCharArray();
		sc.close();

		int cnt = 0;
		int[] ss = new int[26];
		int[] tt = new int[26];
		for (int i = 0; i < s.length; i++) {
			int si = s[i] - 'a';
			int sj = ss[si];
			int ti = t[i] - 'a';
			int tj = tt[ti];
			if (sj != tj) {
				System.out.println("No");
				return;
			}
			if (sj == 0) {
				cnt++;
				ss[si] = cnt;
				tt[ti] = cnt;
			}
		}
		System.out.println("Yes");
	}
}


Measured memory_bytes: 27792
N = int(input())
L = list(map(int, input().split()))

count = 0

for i in range(N):
  for j in range(i+1, N):
    for k in range(j+1, N):
      if L[i] != L[j] and L[j] != L[k] and L[k] != L[i]:
        if (L[i] + L[j] > L[k]) and (L[k] + L[j] > L[i]) and (L[i] + L[k] > L[j]):
          count += 1
          
print(count)

Measured memory_bytes: 9028
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
// aよりbの方が小さかったら、aの値をbの値に置き換える。(swapではない！)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
// aよりbの方が大きかったら、aの値をbの値に置き換える。
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
// 素数かどうか判定
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))

const int nmax = 8;
bool graph[nmax][nmax];

int dfs(int v, int n, bool visited[nmax]) {
	bool all_visited = true;
	rep(i, n) {
		if (!visited[i])all_visited = false;
	}
	if (all_visited)return 1;
	int ret = 0;
	rep(i, n) {
		if (!graph[v][i])continue;
		if (visited[i])continue;
		visited[i] = true;
		ret += dfs(i, n, visited);
		visited[i] = false;
	}
	return ret;
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, m; cin >> n >> m;
	rep(i, m) {
		int a, b; cin >> a >> b;
		graph[a - 1][b - 1] = graph[b - 1][a - 1] = true;
	}
	bool visited[nmax]; rep(i, n)visited[i] = false;
	visited[0] = true;
	cout << dfs(0, n, visited) << endl;
	return 0;
}

Measured memory_bytes: 384
import bisect
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
a = []
for i in range(n):
    a.append(ni())
a = a[::-1]
hs = [999999999999] * (n+1)
lis = 0
for v in a:
    pos = bisect.bisect_right(hs, v)
    hs[pos] = v
    lis = max(lis, pos+1)
print(lis)


Measured memory_bytes: 7896
macro_rules! get {
      ($t:ty) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.trim().parse::<$t>().unwrap()
          }
      };
      ($($t:ty),*) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              let mut iter = line.split_whitespace();
              (
                  $(iter.next().unwrap().parse::<$t>().unwrap(),)*
              )
          }
      };
      ($t:ty; $n:expr) => {
          (0..$n).map(|_|
              get!($t)
          ).collect::<Vec<_>>()
      };
      ($($t:ty),*; $n:expr) => {
          (0..$n).map(|_|
              get!($($t),*)
          ).collect::<Vec<_>>()
      };
      ($t:ty ;;) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.split_whitespace()
                  .map(|t| t.parse::<$t>().unwrap())
                  .collect::<Vec<_>>()
          }
      };
      ($t:ty ;; $n:expr) => {
          (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
      };
}

fn main() {
    // 入力
    let (A, B) = get!(i64, i64);
    let v = vec![A + B, A - B, A * B];

    let ans = v.iter().max();

    // 出力
    println!("{}", ans.unwrap());
}

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

int main(){
	int x;
	cin>>x;
	int op=-1;
	if(x>=400&&x<=599) op=8;
	else if(x>=600&&x<=799) op=7;
	else if(x>=800&&x<=999) op=6;
	else if(x>=1000&&x<=1199) op=5;
	else if(x>=1200&&x<=1399) op=4;
	else if(x>=1400&&x<=1599) op=3;
	else if(x>=1600&&x<=1799) op=2;
	else if(x>=1800&&x<=1999) op=1;
	cout<<op<<endl;
}

Measured memory_bytes: 3632