akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<cmath>
#include <vector>

using namespace std;

//二点間の距離を計算して返す
double calcDis(vector<int> p1, vector<int> p2, int dim) {
	double dis = 0;

//	cout << "p： ";
	for (int i = 0; i < dim; i++) {
		dis += (p1[i] - p2[i]) * (p1[i] - p2[i]);
//		cout << p2[i] << ", ";
	}
//	cout << endl;
//	cout << "dis^2：" << dis << endl;
	dis = sqrt(dis);

	return dis;
}

int main()
{
	int n, d;
	vector<vector<int>> ps(10);		//10点まで

	cin >> n >> d;
	
	//点ごとに繰り返す
	for (int pi = 0; pi < n; pi++) {
		vector<int> p(10);			//10次元まで
		
		//次元ごとに繰り返す
		for (int di = 0; di < d; di++) {
			//点を作成
			cin >> p[di];
		}
		//点を保存
		ps[pi] = p;
	}
	
	//二点間の距離を確認する
	int cnt = 0;
	double dis = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i+1; j < n; j++) {
			dis = calcDis(ps[i], ps[j], d);
//			cout << "距離：" << dis << endl;
			//整数か確認する
			if (dis == floor(dis)) {
				cnt++;
			}
		}
	}
	cout << cnt << endl;
}


Measured memory_bytes: 256
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N, M, V, P := sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt()
	A := sc.nextIntSlice(N)
	sort.Sort(sort.Reverse(sort.IntSlice(A)))
	S := make([]int, N+1)
	S[0] = 0
	for i, a := range A {
		S[i+1] = S[i] + a
	}
	ans := 0
	//fmt.Println(A)
	//fmt.Println(S)
	for i := 0; i < N; i++ {
		if search(A, A[i]) <= P-1 {
			ans++
			continue
		}
		changed := A[i] + M
		bigCount := search(A, changed)
		k := N - i
		if !(bigCount <= P-1) {
			continue
		}
		diff := (i-P+1)*changed - (S[i] - S[P-1])
		//fmt.Println(i-1, P-1)
		//fmt.Println("i: %d, n: %d, changed: %d, diff: %d, S: %d", i, A[i-1], changed, diff, S[i-1]-S[P-1])
		if (P-1)*M+diff+k*M >= V*M {
			ans++
		}
	}

	fmt.Fprintln(wtr, ans)
	wtr.Flush()
}

// Aのなかでnより大きい要素数
func search(A []int, n int) int {
	ng := -1
	ok := len(A)
	for abs(ok-ng) > 1 {
		mid := (ok + ng) / 2
		if A[mid] <= n {
			ok = mid
		} else {
			ng = mid
		}
	}
	return ok
}


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


#define int ll
#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;++i)
using ll  = long long;
using vi  = vector<int>;
constexpr ll mod = 1e9+7;

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

  vi dp(13);
  dp[0] = 1;
  for(auto c : s){
    vi next(13);
    if(isdigit(c)){
      int x = c - '0';
      rep(i,13) next[(i*10+x)%13] += dp[i];
      rep(i,13) next[i] %= mod;
    }else{
      rep(x,10){
	rep(i,13) next[(i*10+x)%13] += dp[i];
	rep(i,13) next[i] %= mod;
      }
    }
    dp = next;
  }
  cout << dp[5] << endl;
}

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

using namespace std;

int main()
{
    int N;
    int ans = 0;
    int A[300];
    cin >> N;
    for (int i = 0; i < N; i++)
        cin >> A[i];
    sort(A, A + N);
    reverse(A, A + N);
    for (int i = 0; i < N; i++)
    {
        if (i % 2 == 0)
            ans += A[i];
        else
            ans -= A[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define ll long long
const ll MOD=1000000007;
const long double PI=3.14159265358979323846264;
const ll MAX=0;

int main() {
  long double a,b;
  cin>>a>>b;
  long double H,M;
  cin>>H>>M;
  long double si;
  si=abs(30*H-11*M/2);
  //if(si>180){
  //  si-=180;
  //}//
  
  si=si/180*PI;
  long double ans=a*a+b*b-2*a*b*cos(si);
  cout<<fixed << setprecision(20)<<sqrt(ans)<<endl;
 // cout<<cos(si);
}


Measured memory_bytes: 4160
#include<stdio.h>

int main(){

  int num,i,j,k,v;
  int A[1000];


  scanf("%d",&num);

  for(i=0;i<num;i++){
    scanf("%d",&A[i]);
  }

    for(i=0;i<num-1;i++){
      printf("%d ",A[i]);
    }
    printf("%d\n",A[i]);

  for(i = 1 ; i <= num-1 ; i++){
    v=A[i];
    j=i-1;

    while(j>=0 && A[j]>v){

      A[j+1]=A[j];
      j--;
    }
      A[j+1]=v;
    

    for(k=0;k<num-1;k++){
      printf("%d ",A[k]);
    }
    printf("%d\n",A[k]);
    
  }
  return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;

int main() {
    int N;
    cin >> N;
    if (N % 10 == 3) {
        cout << "bon" << endl;
    } else if (N % 10 == 0 || N % 10 == 1 || N % 10 == 6 || N % 10 == 8) {
        cout << "pon" << endl;
    } else {
        cout << "hon" << endl;
    }
}


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

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

int gcd3(int a,int b,int c){
	int ab_gcd = gcd(a,b);
	int abc_gcd = gcd(ab_gcd,c);
	return abc_gcd;
}

int main(){
	int K = 0;
	cin >> K;
	int ans = 0;
	for(int a=1;a <= K;++a){
		for(int b=1;b <= K;++b){
			for(int c=1;c <= K;++c){
				ans += gcd3(a,b,c);
			}
		}
	}

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


Measured memory_bytes: 3152
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rrep(i,n) for(int i=(int)n-1;i>=0;--i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T& a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U& u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U& u,const V... v){for(auto& e:u)fill_v<T>(e,v...);}

ll f(vector<P>& p) {
    int n = p.size();
    rep(i, n) chmin(p[i].first, n);
    auto s = make_vec<int>(n+1, 0);
    rep(i, n) s[p[i].first].push_back(p[i].second);
    priority_queue<int> pq;
    ll res = 0;
    for (int i = n; i >= 1; --i) {
        for (int x : s[i]) pq.push(x);
        if (!pq.empty()) {
            res += pq.top();
            pq.pop();
        }
    }
    return res;
}

void solve() {
    int n;
    cin >> n;
    vector<P> pl, pr;
    ll ans = 0;
    rep(i, n) {
        int k, l, r;
        cin >> k >> l >> r;
        int m = min(l, r);
        ans += m;
        l -= m; r -= m;
        if (l > 0) pl.emplace_back(k, l);
        else pr.emplace_back(n-k, r);
    }
    ans += f(pl);
    ans += f(pr);
    cout << ans << endl;
}

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

    int t;
    cin >> t;
    while (t--) solve();
}


Measured memory_bytes: 9652
#include <cstdio>

unsigned long long int L[87];

void setLucasNumber(int N){
	L[0] = 2;
	L[1] = 1;
	for(int i = 2;i <= N;i++)
		L[i] = L[i-1] + L[i-2];
}

int main(void){
	int N;
	scanf("%d", &N);
	setLucasNumber(N);
	printf("%llu\n", L[N]);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define inf 1145141919364364
#define double long double
using namespace std;
typedef pair<ll, ll>P;
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
ll n, k, ans = 0;
ll a[114514];
signed main() {
	cin >> n >> k;
	rep(i, n)cin >> a[i];
	rep(i, n) {
		if (a[i] >= k)ans++;
	}
	cout << ans << endl;
	ggr
}



Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define showall(obj) for(auto x:obj)cout<<x<<endl;
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
typedef vector<int> vint;
typedef vector<ll> vll;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int n; cin>>n;
	priority_queue<double, vector<double>, greater<double>> Q;
	rep(i,n){
		double t; cin>>t;
		Q.push(t);
	}
	while(Q.size()!=1){
		double e;
		e = Q.top();
		Q.pop();
		e = (e+Q.top())/2;
		Q.pop();
		Q.push(e);
	}
	cout<<Q.top()<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int a[1000005];

int main(void){
	scanf("%d",&n);
	memset(a,-1,sizeof(a));
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	sort(a,a+n);
	reverse(a,a+n);
	int now=0;
	while(now+1<a[now+1] && now<n){
		now++;
	}
	ll c1=a[now]-now;
	ll c2=0;
	int nv=now;
	while(nv<a[now]){
		c2++;
		now++;
	}
	c1--;
	c2--;
	printf("%s\n",(c1%2LL==0 && c2%2LL==0)?"Second":"First");
	return 0;
}


Measured memory_bytes: 4224
import math

a, b, t = map(int, input().strip().split())

t = math.radians(t)
h = b * math.sin(t)
l = a + b + math.sqrt(a*a + b*b - 2*a*b*math.cos(t))
s = a * h / 2
print(s)
print(l)
print(h)

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

int main(){
  int i,j,k,n,x,c=0;
  while (1){
    cin>>n>>x;
    if (n==0&&x==0)break;
    for (i=1;i<n-1;i++){
      for (j=i+1;j<n;j++){
        if (i+2*j<x&&x<=i+j+n)c++;
      }
    }
    cout<<c<<endl;
    c=0;
  }
}



Measured memory_bytes: 3096
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
using namespace std;
#define ll long long
#define re register
#define file(a) freopen(a".in",,"r",stdin);freopen(a".out","w",stdout)
#define int ll
inline int gi(){
	int f=1,sum=0;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){sum=sum*10+ch-'0';ch=getchar();}
	return f*sum;
}
const int N=100;
int dp[N][N*N][N],x[N],n,A;
signed main(){
	n=gi();A=gi();int sum=0;
	for(int i=1;i<=n;i++)x[i]=gi(),sum+=x[i];
	dp[0][0][0]=1;
	for(int i=1;i<=n;i++){
		for(int j=0;j<=sum;j++)
			for(int k=0;k<=i;k++)
				dp[i][j][k]+=dp[i-1][j][k];
		for(int j=x[i];j<=sum;j++)
			for(int k=1;k<=i;k++)
				dp[i][j][k]+=dp[i-1][j-x[i]][k-1];
	}int ans=0;
	for(int i=1;i*A<=sum;i++)
		ans+=dp[n][i*A][i];
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 200960
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

int main() {
    ll n;
    cin >> n;
    
    vl a(n), b(n), c(n);
    rep(i, n) {
        cin >> a[i];
    }
    sort(all(a));
    rep(i, n) {
        cin >> b[i];
    }
    sort(all(b));
    rep(i, n) {
        cin >> c[i];
    }
    sort(all(c));
    
    ll ans = 0;
    rep(i, n) {
        ll x = lower_bound(all(a), b[i]) - a.begin();
        ll y = c.end() - upper_bound(all(c), b[i]);
        ans += x*y;
    }

    out(ans);
    re0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
#define int long long


void solve(string S){
    int res = S.size();
    for(int i = 0; i < S.size() - 1; ++i) {
        if (S[i] != S[i + 1]) {
            res = min(res, max(i + 1, (int)S.size() - (i + 1)));
        }
    }
    cout << res << endl;
}

signed main(){
    string S;
    cin >> S;
    solve(S);
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
#define pb push_back
#define eb emplace_back
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll MOD = 1e9 + 7;
constexpr int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
template <class T>
void chmin(T &a, T b) { a = min(a, b); }
template <class T>
void chmax(T &a, T b) { a = max(a, b); }
void ok() { cerr << "ok" << endl; }
using D = double;
using Point = complex<D>;
const D eps = 1e-40;
inline int sgn(const D &a) { return (a < -eps) ? -1 : (a > eps) ? 1 : 0; }
inline D cross(const Point &a, const Point &b) {
    return a.real() * b.imag() - a.imag() * b.real();
}
inline D dot(const Point &a, const Point &b) {
    return a.real() * b.real() + a.imag() * b.imag();
}
istream &operator>>(istream &is, Point &p) {
    D a, b;
    is >> a >> b;
    p = Point(a, b);
    return is;
}
ostream &operator<<(ostream &os, Point &p) {
    os << p.real() << " " << p.imag();
    return os;
}
inline int ccw(const Point &a, Point b, Point c) {
    D d = cross(b - a, c - a);
    if (sgn(d) > 0) {
        return +1; //anti-clockwise
    } else if (sgn(d) < 0) {
        return -1; //clockwise
    } else {
        if (sgn(dot(b - a, c - a)) < 0) {
            return -2;
        } else if (sgn(dot(a - b, c - b)) < 0) {
            return +2;
        }
    }
    return 0;
}
struct ConvexHull : vector<Point> {
    vector<Point> pt;
    ConvexHull(const vector<Point> &pt) : pt(pt) {}
    void build() {
        auto cmp = [](const Point &a, const Point &b) {
            return a.imag() == b.imag() ? a.real() < b.real() : a.imag() < b.imag();
        };
        sort(pt.begin(), pt.end(), cmp);
        int k = 0;
        resize(pt.size() * 2);
        for (int i = 0; i < pt.size(); i++) {
            while (k > 1 && ccw((*this)[k - 2], (*this)[k - 1], pt[i]) <= 0) {
                k--;
            }
            (*this)[k++] = pt[i];
        }
        int lim = k;
        for (int i = (int)pt.size() - 2; i >= 0; i--) {
            while (k > lim && ccw((*this)[k - 2], (*this)[k - 1], pt[i]) <= 0) {
                k--;
            }
            (*this)[k++] = pt[i];
        }
        resize(k - 1);
    }
};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    int n;
    cin >> n;
    vector<Point> pt(n);
    for (int i = 0; i < n; i++) {
        cin >> pt[i];
    }
    ConvexHull ch(pt);
    ch.build();
    cout << ch.size() << '\n';
    for (int i = 0; i < ch.size(); i++) {
        cout << ch[i] << '\n';
    }
}


Measured memory_bytes: 9160
//============================================================================
// Name        : e.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
int main() {
	int x,y,a,b,c;cin>>x>>y>>a>>b>>c;
	vector<ll> p(a),q(b),r(c);
	for(int i=0;i<a;i++){
		cin>>p[i];
	}
	for(int i=0;i<b;i++){
		cin>>q[i];
	}
	for(int i=0;i<c;i++){
		cin>>r[i];
	}
	vector<ll> ab;
	sort(p.begin(),p.end());
	reverse(p.begin(),p.end());
	sort(q.begin(),q.end());
	reverse(q.begin(),q.end());
	for(int i=0;i<x;i++){
		ab.push_back(p[i]);
	}
	for(int i=0;i<y;i++){
		ab.push_back(q[i]);
	}
	sort(ab.begin(),ab.end());
	sort(r.begin(),r.end());
	reverse(r.begin(),r.end());
	for(int i=0;i<c;i++){
		if(ab[i]<r[i]){
			ab[i]=r[i];
		}
		if(i==ab.size()-1)break;
	}
	ll ans=0;
	for(int i=0;i<ab.size();i++){
		ans+=ab[i];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4724
A, B = input().split(" ")
A, B = int(A), int(B)

# from math import gcd
def gcd(a, b):
	if a < b:
	    a, b = b, a
	while a % b != 0:
	    a, b = b, a % b
	return(b)

print(int(A * B / gcd(A, B)))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl "\n"
const int MAX= 100005 ;
const long long mod = 1.0e9+7;
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    #endif
    int t;
    t=1;
    while(t--)
    {
        int n,m,i,x,y,z;
        char c;
        cin>>c;
        if(c>='A' && c<='Z')
            cout<<'A'<<endl;
        else 
            cout<<'a'<<endl;
    }
    return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007
#define pb push_back
#define vl vector<ll>
#define pll pair<ll,ll>
#define mp make_pair
using namespace std; 
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int main()
{
	ll n,m;
	cin>>n>>m;
	ll a[n],b[n];
	memset(a,0,sizeof(a));
	memset(b,0,sizeof(b));
	for (ll i = 0; i < m; ++i)
	{
		ll t;
		string s;
		cin>>t>>s;
		if(a[t-1]==0)
		{
			if(s=="AC")
				a[t-1]++;
			else
				b[t-1]++;			
		}
		else
		{
			continue;	
		}
	}
	ll a1=0,a2=0;
	for (int i = 0; i <n; ++i)
	{
		a1+=a[i];
		if(a[i])
			a2+=b[i];
	}
	cout<<a1<<" "<<a2<<endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<cstdint>
#include<bits/stdc++.h>
#include<queue>
#include<set>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for(int i = n-1; i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define INF bit(60)
#define pb push_back
#define mod 1000000007

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

using namespace std;
using uif=uint_fast64_t;
using ll=long long int;

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mod;a=1ll*a*a%mod;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


#define FACSIZE 2002

ll invfac[FACSIZE];
ll fac[FACSIZE];

ll mod_pow(ll x,ll r){
  if(r==0) return 1;
  else if(r==1) return x%mod;
  else if(r%2==0){
    ll t=mod_pow(x,r/2)%mod;
    return t*t %mod;
  } 
  else{
    ll t=mod_pow(x,r/2)%mod;
    ll k= t*t %mod;
    return k*x%mod;
  } 
}
ll mod_add(ll a,ll b){
  return (a+b)%mod;
}

ll mod_mul(ll a,ll b){
  return (a*b)%mod;
}

ll div(ll a,ll b){
  return mod_mul(a,mod_pow(b,mod-2));
}

void make_fact(ll n){
  fac[0]=1;
  rep(i,n){
    fac[i+1]=mod_mul(fac[i],i+1);
  }  
}

void make_invfact(ll n){
  invfac[n]= mod_pow( fac[n] ,mod-2);
  for(int i=n-1;i>=0;i--){
    invfac[i]=mod_mul(invfac[i+1],i+1);
  }

}

ll mod_combi(ll n, ll m){
    ll tmp = mod_mul(fac[n],invfac[n-m]);
    return mod_mul(tmp,invfac[m]);
}

int main(void){

  ll n;
  cin>>n;

  vector<ll> a(n);

  ll sum=0;

  ll sum_o=0;
  ll sum_e=0;

  vector<ll> sum_o_v;
  vector<ll> sum_e_v;

  rep(i,n){
    cin>>a[i];
    sum+=a[i];
    if(i%2==1){
      sum_e+=a[i];
      //sum_e_v.pb(sum_e);
    }
    else{
      //sum_o++;
      sum_o+=a[i];
      //sum_o_v.pb(sum_o);
    }
    sum_e_v.pb(sum_e);
    sum_o_v.pb(sum_o);
    
  }
  /*
  for(auto x:sum_e_v) cout << x << endl;
  cout << endl;
  for(auto x:sum_o_v) cout << x << endl;

  cout << endl;
  cout << sum << endl;
  */

  rep(i,n){
    ll tmp=sum;
    //cout << (sum_e_v[n-1] - sum_e_v[i]  ) << endl;
    //cout << sum_o_v[i-1] << endl;
    //cout << endl;
    if(i%2==0){
      if(i==0){
        tmp= tmp -2*(sum_e_v[n-1] - sum_e_v[i]  );
      }
      else{
        tmp= tmp -2*(sum_e_v[n-1] - sum_e_v[i]  ) - 2*(sum_o_v[i-1]);
      }
      
    }
    else{
      tmp= tmp - 2*(sum_o_v[n-1] - sum_o_v[i]  ) - 2*(sum_e_v[i-1]);
    }

    cout << tmp << " ";
    //cout << endl;
  }
  cout << endl;

  return 0;

}


Measured memory_bytes: 3820
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int MOD=1000000007;

int main(){
    ll x,y,a,b,c,ans;
    ans=0;
    int i;
    cin>>x>>y>>a>>b>>c;
    ll sum=x+y;
    priority_queue<ll> p,q,r;
    rep(i,a){
        ll p_;
        cin>>p_;
        p.push(p_);
    }
    rep(i,b){
        ll q_;
        cin>>q_;
        q.push(q_);
    }
    rep(i,c){
        ll r_;
        cin>>r_;
        r.push(r_);
    }
    ll max_;
    while(sum){
        if(!r.empty()){
            if(x>0 && y>0){
                max_=max(p.top(),max(q.top(),r.top()));
                ans+=max_;
                if(max_==p.top()){
                    p.pop();
                    x--; sum--;
                }else if(max_==q.top()){
                    q.pop();
                    y--; sum--;
                }else{
                    r.pop();
                    sum--;
                }
            }else if(x==0 && y>0){
                max_=max(q.top(),r.top());
                ans+=max_;
                if(max_==q.top()){
                    q.pop();
                    y--; sum--;
                }else{
                    r.pop();
                    sum--;
                }
            }else if(x>0 && y==0){
                max_=max(p.top(),r.top());
                ans+=max_;
                if(max_==p.top()){
                    p.pop();
                    x--; sum--;
                }else{
                    r.pop();
                    sum--;
                }
            }
        }else{
            if(x>0 && y>0){
                max_=max(p.top(),q.top());
                ans+=max_;
                if(max_==p.top()){
                    p.pop();
                    x--; sum--;
                }else{
                    q.pop();
                    y--; sum--;
                }
            }else if(x==0 && y>0){
                ans+=q.top(); q.pop();
                y--; sum--;
            }else if(x>0 && y==0){
                ans+=p.top(); q.pop();
                x--; sum--; 
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3316
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <cstring>
#include <climits>
using namespace std;
#define ll long long
#define FOR(i,n) for(int i=0;i<n;i++)
#define sz(x) (int)(x.size())
#define all(x) (x).begin(),(x).end()
template<typename tp> void read(tp &x) {cin >> x;}
template<typename tp, typename... Args> void read(tp& x, Args&... args) {read(x);read(args...);}
const int mxN = (int)1e5,INF = (int)1e9,MOD = (int)1e9+7;



void solve()
{
		int n;
		read(n);
		int ans = 0;
		for(int A=1;A<n;A++)
		{
			int l = 1,r = n/A+2;
			while(l+1 < r)
			{
				int m = l+(r-l)/2;
				if(A*m<n)l = m;
				else r = m;
			}
			ans+=l;	
		}
		cout << ans << '\n';
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int test = 1;
	//read(test);
	while(test--)
		solve();
	return 0;
}


Measured memory_bytes: 3604
import java.util.Scanner;
public class Main
{
	public static void main(String arg[])
	{
		Scanner in = new Scanner(System.in);
		int count =0;
		String tmp = "0";
		while(in.hasNext())
		{
			char ch[]=in.nextLine().toCharArray();
			for(int i=0; i<ch.length; i++)
			{
				while(i<ch.length&&(Character.isDigit(ch[i])))
				{
					tmp+=ch[i];
					i++;
				}
				count+=Integer.valueOf(tmp);
				tmp="0";
			}
		}
		System.out.println(count);
	}
}

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

int main(){
    int N;
    cin >> N;
    vector<int> A(N-1);
    vector<int> ans(N,0);
    for(int i = 0;i < N-1;i++){
        cin >> A.at(i);
        ans.at(A.at(i) - 1)++;
    }

    for(int i = 0;i < N;i++){
        cout << ans.at(i) << endl;
    }
}

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

#define REP(i ,n) for(int i=0 ;i < n; i++)
#define REPB(i ,n) for(int i=n; i >= 0; i--)
#define FOR(i ,m ,n) for(int i=m; i < n; i++)
#define FORB(i, m, n) for(int i=m; i>= m; i--)
#define ll long long
#define pb push_back
#define popb pop_back
using namespace std;

int main(){
  int n,rt;
  vector<int> r;
  cin >> n;
  REP(c, n){
      cin >> rt;
      r.pb(rt);
    }
    int maxi = -2000000000;
    int mini = r[0];
    FOR(i,1, n){
        maxi = max(maxi, r[i] -mini);
        mini = min(mini, r[i]);
      }
      cout << maxi << endl;
}



Measured memory_bytes: 3888
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
constexpr double eps=1e-12;
const double pi=acos(-1);
//int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
int n;
double l,t[3010],x,y;
struct point{double x,y;};
point p[3010];
signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    cin>>n>>l;
    rep(i,n)cin>>t[i];
    rep(i,n){
        rep(j,n){
            if(i<j){
                double rad;
                rad=pi*(t[i]+t[j])/l;
                x+=(n+i-j-1)*cos(rad);
                y+=(n+i-j-1)*sin(rad);
                rad+=pi;
                if(rad>=2*pi)rad-=2*pi;
                x+=(j-i-1)*cos(rad);
                y+=(j-i-1)*sin(rad);
            }
        }
    }
    x/=n*(n-1)*(n-2)/6;
    y/=n*(n-1)*(n-2)/6;
    printf("%.12lf %.12lf\n",x,y);
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define MAXN 3001
ll a[MAXN];
ll dp[MAXN][MAXN];   // i から j　まで
int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    for (int i = 1; i <= n; i++) {
        if (n % 2) {
            dp[i][i] = a[i];
        }
        else {
            dp[i][i] = -1 * a[i];
        }
    }
    for (int i = 2; i <= n; i++) {
        // 幅がどれくらいか
        for (int j = 1; j <= n - i + 1; j++) {
            // j　から j + i - 1まで
            if (i % 2 == n % 2) {
                //　先行ターン
                dp[j][j + i - 1] = max(dp[j + 1][j + i - 1] + a[j], dp[j][j + i - 2] + a[j + i - 1]);
            }
            else {
                dp[j][j + i - 1] = min(dp[j + 1][j + i - 1] - a[j], dp[j][j + i - 2] - a[j + i - 1]);
            }
        }
    }
    cout << dp[1][n] << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  int N; scanf("%d", &N);
  ll A, B; scanf("%lld %lld", &A, &B);
  vector<ll> X(N + 5);
  for (int i = 1; i <= N; ++i) {
    scanf("%lld", &X[i]);
  }
  ll ans = 0;
  for (int i = 1; i + 1 <= N; ++i) {
    ll val = (X[i + 1] - X[i]) * A;
    ans += min(val, B);
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 1024
# Problem C - Multiplication 3

import math

# input
A, B = input().split()
A = int(A)

# initialization
b_1 = int(B[0])
b_2 = int(B[2])
b_3 = int(B[3])
tmp_1 = A * b_1 * 100
tmp_2 = A * b_2 * 10
tmp_3 = A * b_3
ans = math.floor((tmp_1 + tmp_2 + tmp_3) // 100)

# output
print(ans)


Measured memory_bytes: 9200
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String add="hi";
        String can="";
        String s=sc.next();
        for(int i=0;i<5;i++){
            can+=add;
            if(can.equals(s)){
                System.out.println("Yes");
                        return;
            }
        }
        System.out.println("No");
        
 
    }



}


Measured memory_bytes: 23764
import java.util.*;

public class Main {
	public static void main(String[] args) {
		int i;
		Scanner sc = new Scanner(System.in);
		int r = Integer.parseInt(sc.next());
		int d = Integer.parseInt(sc.next());
		int x = Integer.parseInt(sc.next());
		sc.close();
		sc = null;
		int ans = x;
		for(i = 1; i <= 10; i++) {
			ans = r*ans - d;
			System.out.println(ans);
		}
	}
}

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

using namespace std;

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) { return '"' + s + '"'; }

string to_string(const char* s) { return to_string((string)s); }

string to_string(bool b) { return (b ? "true" : "false"); }

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(vector<A> v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " +
         to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " +
         to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) void(0)
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<vector<int>> c(10, vector<int>(10));
  for (int i = 1; i <= n; i++) {
    string si = to_string(i);
    int len = (int)si.size();
    c[si[0] - '0'][si[len - 1] - '0']++;
  }
  debug(c);
  int ans = 0;
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      ans += c[i][j] * c[j][i];
    }
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3716
#include<stdio.h>
#include<string.h>
#define max(a,b) ((a)>(b) ? (a):(b))
int dp[1001][1001];
int lcs(char *s,char *t){
    int i,j,ls,lt;

    ls=strlen(s);
    lt=strlen(t);
    for(i=0;i<ls;i++){
	for(j=0;j<lt;j++){
	    if(s[i]==t[j]) dp[i+1][j+1]=dp[i][j]+1;
	    else dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1]);
	}
    }
    return dp[ls][lt];
}
int main(){
    char s[1001],t[1001];
    int k;

    scanf("%d", &k);
    while(k--){
	scanf("%s%s", s, t);
	printf("%d\n",lcs(s,t));
    }

    return 0;
}



Measured memory_bytes: 6616
#include <iostream>
#include <cstring>
#include <string>

using namespace std;

const int SIZE = 501;
char memo[SIZE][SIZE];

bool rec ( string& str, int begin ,int end )
{
	if ( begin > end ) {
		return true;
	}
	if ( begin == end ) {
		return false;
	}
	if ( str[begin] != 'm' || str[end] != 'w' ) {
		return false;
	}
	if ( memo[begin][end] != -1 ) {
		return ( bool )memo[begin][end];
	}
	bool result = false;
	for ( int i = begin + 1; i < end; ++i ) {
		if ( str[i] == 'e' ) {
			result |= rec( str, begin + 1, i - 1 ) && rec( str, i + 1, end - 1 );
		}
	}
	memo[begin][end] = ( char )result;
	return result;
}

int main()
{
	string str;
	while ( cin >> str  ) {
		memset( memo, -1, SIZE * SIZE );
		cout << ( rec( str, 0, str.size() - 1 ) ? "Cat" : "Rabbit" ) << endl;
	}
	return 0;
}

Measured memory_bytes: 1440
#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>
using namespace std;
using ll = long long;
using ld = long double;
#define endl "\n"
//#define int long long
#define ALL(x) begin(x),end(x)
#define resort(v) sort((v).rbegin(), (v).rend())
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
//const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279;
int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int fact(int i) {
    if (i == 0) return 1;
    return ((fact(i - 1)) * i) % MOD;
}
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int keta(int n) {
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
int ketasum(int n) {
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
ll modpow(ll a, ll n, ll mod) {
    ll hi = 1;
    while (n > 0) {
        if (n & 1) hi = hi * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return hi;
}
char toSmall(char c) { // 大文字を小文字へ
    return (c + 0x20);
}
char toLarge(char c) { // 小文字を大文字へ
    return (c - 0x20);
}
float myPower(int a, int n) { // aのn乗の計算
    float x = 1;
    while (n > 0) { // 全てのbitが捨てられるまで
        if (n & 1) { // 一番右のbitが１のとき
            x *= a;
        }
        a *= a;
        n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
    }
    return x;
}

bool is_prime(const unsigned n) {
    switch (n) {
    case 0: // fall-through
    case 1: return false;
    case 2: // fall-through
    case 3: return true;
    } // n > 3 が保証された
    if (n % 2 == 0 || n % 3 == 0) return false;
    // n は 2 と 3 のいずれの倍数でもないことが保証された
    // これより n は (6の倍数)-1 か (6の倍数)+1 である
    // 6の倍数前後の数を使って試し割りをする
    for (unsigned i = 5; i * i <= n; i += 6) {
        if (n % i == 0) return false; // (6の倍数)-1
        if (n % (i + 2) == 0) return false; // (6の倍数)+1
    }
    return true;
}

/*signed*/int main(void) {
    int n,x,t;
  cin>>n>>x>>t;
  cout<<((n-1)/x+1)*t<<endl;
    return 0;
}


Measured memory_bytes: 3592
#include"bits/stdc++.h"

using namespace std;
#define REP(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) REP((i),0,(n))
using ll = long long;
using pll = pair<ll, ll>;
using tp3 = tuple<ll, ll, ll>;
constexpr int INF = 1 << 28;
constexpr ll INFL = 1ll << 60;
constexpr int dh[4] = { 0,1,0,-1 };
constexpr int dw[4] = { -1,0,1,0 };
bool isin(const int H, const int W, const int h, const int w) {
    return 0 <= h && h < H && 0 <= w && w < W;
}
// ============ template finished ============

int main()
{
    string s = "ACL";
    int K;
    cin >> K;
    rep(i, K)cout << s;
    cout << endl;
    return 0;
}


Measured memory_bytes: 3628
for _ in[0]*int(input()):
 a,b,c,d,e,f=map(float,input().split())
 x=((a*a+b*b)*(d-f)+(c*c+d*d)*(f-b)+(e*e+f*f)*(b-d))/2/(a*(d-f)+c*(f-b)+e*(b-d))
 y=((a*a+b*b)*(c-e)+(c*c+d*d)*(e-a)+(e*e+f*f)*(a-c))/2/(b*(c-e)+d*(e-a)+f*(a-c))
 print('%.3f %.3f %.3f'%(x,y,((x-a)**2+(y-b)**2)**.5))


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

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;

typedef long long ll;
const ll lim = 1e18;
int main() {
	
	int n;
	cin >> n;
	ll ans = 1;
	vector< ll > a(n);
	for (auto& e:a) {
		cin >> e;
		if (e == 0) return cout << 0 << '\n', 0;
	}
	
	for (int i=0; i<n; i++) {
		ll x = a[i];
		// if (x == 0) return cout << 0 << '\n', 0;
		if (x > (lim / ans)) return cout << -1 << '\n', 0;
		ans *= x;
	}
	cout << ans << '\n';
	
	
	return 0;
}


Measured memory_bytes: 4052
n = gets.to_i
h = {}
max = 0
for i in 0..(n-1)
  s = gets.chomp
  if h[s.to_sym]
    h[s.to_sym] += 1
    max = h[s.to_sym] if h[s.to_sym] > max
  else
    h[s.to_sym] = 1
    max = 1 if max == 0
  end
end
a = h.find_all {|k, v| v == max}
puts a.to_h.keys.sort


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

int main () {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> s(H,vector<char>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> s.at(i).at(j);
    }
  }
  vector<int> dx(4), dy(4);
  dx = {1, -1, 0, 0};
  dy = {0, 0, 1, -1};
  bool ans = true;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (s.at(i).at(j) == '.') continue;
      else {
        int count = 0;
        for (int k= 0; k < 4; k++) {
          int nx = i+dx.at(k);
          int ny = j+dy.at(k);
          
          if (nx < 0 || nx >= H || ny < 0 || ny >= W) continue;
          else if (s.at(nx).at(ny) == '#') count++;
        }
        if (count == 0) {
          ans = false;
          break;
        }
      }
    }
    if (ans == false) break;
  }
  if (ans) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    string res;

    while (1) {
        c -= b;
        if (c <= 0) {
            res = "Yes";
            break;
        }
        a -= d;
        if (a <= 0) {
            res = "No";
            break;
        }
    }

    cout << res << endl;

    return 0;
}


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

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

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main(int argc, char const *argv[]) {
    int n, k; std::cin >> n >> k;
    std::vector<int> sunuke(n);
    REP(i,k) {
        int temp_d; std::cin >> temp_d;
        REP(j,temp_d) {
            int temp_a; std::cin >> temp_a;
            sunuke[temp_a-1]++;
        }
    }
    int ans = 0;
    REP(i,n) {
        if (sunuke[i] == 0) {
            ans++;
        }
    }
    std::cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3628
import scala.annotation.tailrec
import scala.collection.mutable

object Main extends App {

  import scala.io.StdIn._
  import scala.math._
  val n = readLine.trim.toInt
  val answers = readLine.trim.toList.map{_ == 'o'}
  println(
    count(answers)
  )
  @tailrec
  def count(answers: List[Boolean], result: Int = 0): Int = {
    answers match {
      case Nil ⇒ result
      case false::false::t ⇒ result + 1
      case _::t ⇒ count(t, result + 1)
    }
  }
  implicit class Extension[T](val value :T){
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
    def let[R](func: T ⇒ R): R = func(value)
  }
}


Measured memory_bytes: 52140
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ld = long double;

int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  string S,T;
  cin >> S >> T;
  int Sn=sz(S);
  int Tn=sz(T);

  vector<vector<int>> dp(Sn+1,vector<int>(Tn+1,0));
  for(int i=0;i<Sn;i++){
    for(int j=0;j<Tn;j++){
      if(S.at(i)==T.at(j))  dp.at(i+1).at(j+1)=max({dp.at(i+1).at(j),dp.at(i).at(j+1),dp.at(i).at(j)+1});
      else  dp.at(i+1).at(j+1)=max(dp.at(i+1).at(j),dp.at(i).at(j+1));
    }
  }
  string ans="";
  int i=Sn;
  int j=Tn;
  while(i>0 && j>0){
    if(dp.at(i).at(j)==dp.at(i).at(j-1)) j--;
    else if(dp.at(i).at(j)==dp.at(i-1).at(j)) i--;
    else if(dp.at(i).at(j)==dp.at(i-1).at(j-1)+1){
      ans+=S.at(i-1);
      i--;
      j--;
    }
  }
  reverse(all(ans));
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 35584
// D - I hate Factorization
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
	ll X; cin>>X;
	for(ll a=-200; a<=200; ++a){
		for(ll b=-200; b<=200; ++b){
			if(a*a*a*a*a - b*b*b*b*b == X){
				cout<<a<<" "<<b<<endl;
				return 0;
			}
		}
	}
}


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

int main() {
    int N;
    scanf("%d", &N);

    int a[N];
    int b[N];
    for (int i = 0; i < N; i++) scanf("%d", &a[i]);
    for (int i = 0; i < N; i++) scanf("%d", &b[i]);

    bool ans[29] = {};
    for (int i = 29; i >= 0; i--) {
        int x = 1 << (i + 1);
        for (int j = 0; j < N; j++) {
            a[j] %= x;
            b[j] %= x;
        }
        sort(b, b + N);

        for (int j = 0; j < N; j++) {
            int* pos1 = lower_bound(b, b + N, x / 2 - a[j]);
            int* pos2 = lower_bound(b, b + N, x / 2 * 2 - a[j]);
            int* pos3 = lower_bound(b, b + N, x / 2 * 3 - a[j]);
            int* pos4 = lower_bound(b, b + N, x / 2 * 4 - a[j]);
            int idx1 = distance(pos1, pos2);
            int idx2 = distance(pos3, pos4);
            ans[i] ^= (idx1 + idx2) % 2;
        }
    }

    int sum = 0;
    for (int i = 0; i < 29; i++) {
        sum += ans[i] << i;
    }
    printf("%d\n", sum);
    
    return 0;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define foreach(i,n) for(auto &&i:n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define GSORT(x) sort(all(x), greater<int>())
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) LL x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define truecheck assert
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef long long int64;
template<class T,class U>bool chmax(T &a, const U &b) { if (a<b) { a=b; return true; } return false; }
template<class T,class U>bool chmin(T &a, const U &b) { if (b<a) { a=b; return true; } return false; }
const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;

int main() {
    fastcin();
    cout << fixed << setprecision(10);
    cii(a);
    cii(b);
    int ans = (a - b * 2 > 0)
            ?a - b * 2
            :0;
    co(ans);
    return 0;
}

Measured memory_bytes: 256
dp = [[0 for j in range(1001)] for i in range(10)]
dp[0][0] = 1
for j in range(1, 1001):
  dp[0][j] = 0
for k in range(0, 101):
  for i in range(9, 0, -1):
    for j in range(k, 1001):
      dp[i][j] += dp[i - 1][j - k]

while True:
  n, s = map(int, input().split())
  if n + s == 0:
    break
  print(dp[n][s])


Measured memory_bytes: 5716
s = input()
t = input()
st_dict = {}
flag = True
for i in range(len(s)):
    if s[i] not in st_dict:
        if t[i] in st_dict.values():
            flag = False
            break
        else:
            st_dict[s[i]] = t[i]
            
    else:
        if st_dict[s[i]] != t[i]:
            flag = False
if flag:
    print('Yes')
    
else:
    print('No')

Measured memory_bytes: 3632
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
        mut p: [isize; n]
    }

    p.sort();
    let r = &p[0..m];
    println!("{:?}", r.iter().sum::<isize>());
}


Measured memory_bytes: 2180