akhauriyash/Code-Regression huggingface dataset:
n=int(input())
ans=[]
memo=1
if n==0:
  print(0)
else:
  while n!=0:
    if abs(n)%2==1:
      ans.append("1")
      n-=memo
    else:
      ans.append("0")
    n//=2
    memo*=-1
  print("".join(ans[::-1]))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n; cin>>n;
  vector<int> a(n);
  for(int i=0; i<n; i++){
    cin>>a[i];
  }
  int count = -1;
  bool is_odd=true;
  while(is_odd){
    for(int i=0; i<n; i++){
      if( a[i] % 2 == 0){
        a[i] /= 2;
      }
      else {
        is_odd = false;
        break;
      }
    }
    count++;
  }
  cout << count<<endl;
  return 0;
}

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

using namespace std;

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

    for(int i=1; i<s.size(); i++) {
        if(s[i-1] == s[i]) {
            cout << i << ' ' << i+1 << endl;
            return 0;
        }
    }

    for(int i=2; i<s.size(); i++) {
        if(s[i-2] == s[i]) {
            cout << i-1 << ' ' << i+1 << endl;
            return 0;
        }
    }

    cout << "-1 -1" << endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (2e9)
#define INFL (2e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
using vint=vector<int>;
using vll=vector<ll>;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
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; }

int main()
{
    string s; cin >> s;
    int n = s.size();
    ll ans = 0;

    vint w, b;
    rep(i, n){
        if(s[i]=='B') b.push_back(i);
        else w.push_back(i);
    }

    rep(i, w.size()){
        ans += w[i] - i;
    }
    pr(ans);
    return 0;}

Measured memory_bytes: 4400
#pragma GCC optimize("Ofast")
#pragma GCC target ("avx")
#include <bits/stdc++.h>
constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
using namespace std;
using ll = long long int;
using ull =  unsigned long long int;


int main() {
	int N, K;
	cin >> N >> K;
	if (K > (N - 1) * (N - 2) / 2) {
		cout << -1 << endl;
		return 0;
	}
	vector<pair<int, int>> ans;

	for (int i = 2; i <= N; i++) {
		ans.push_back({ 1, i });
	}
	for (int i = 2, k = 0; i < N; i++)for (int j = i + 1; j <= N && k < (N - 1) * (N - 2) / 2 - K; j++, k++){
		ans.push_back({ i,j });
	}

	cout << ans.size() << endl;
	for (int i = 0; i < ans.size(); i++) {
		cout << ans[i].first << " " << ans[i].second << endl;
	}
}


Measured memory_bytes: 384
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

c = 0
for i in range(n):
    if (a[i]+a[i+1] - b[i]) > 0:
        if a[i] <= b[i]:
            c += b[i]
            a[i+1] = a[i]+a[i+1] - b[i]
        else:
            c += b[i]

    else:
        c += (a[i]+a[i+1])
        a[i+1] = 0
print(c)


Measured memory_bytes: 18624
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M  1000000007
#define rep(i,a,n) for(int i=a;i<n;i++)
#define N 300005
#define vi vector<int>
#define all(v) v.begin(),v.end()

signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   double r;
   cin>>r;
   cout<<2*pi*r<<endl;
}


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

int main(){
    int H, W;
    cin >> H >> W;

    vector<string> g(H);
    for(int i = 0; i < H; i++) cin >> g[i];
    
    for(int i = 0; i < H; i++){
        bool flag1 = false;

        for(int j = 0; j < W; j++){
            if (g[i][j] == '#') flag1 = true;
        }
        if(flag1){
            for(int k = 0; k < W; k++){
                bool flag2 = false;
                for(int l = 0; l < H; l++){
                    if(g[l][k] == '#') flag2 = true;
                }
                if(flag2) cout << g[i][k];
            }
            cout << endl;
        }
    }
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
cnt = 0
flag = True
while flag == True:
    for i in range(N):
        if A[i] % 2 != 0:
            flag = False
            break
        else:
            A[i] = A[i] // 2
    if flag == False:
        break
    else:
        cnt += 1
print(cnt)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = Integer.parseInt(scan.next());
        int b = Integer.parseInt(scan.next());
        int c = Integer.parseInt(scan.next());
        int d = Integer.parseInt(scan.next());
        scan.close();

        int ao = (a + d - 1) / d;
        int taka = (b + c - 1) / b;

        if (taka <= ao) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
}


Measured memory_bytes: 35632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string s; 
int main()
{
    std::ios::sync_with_stdio(false);
    cin >> s;
    if(s == "RRR") cout << 3 << endl;
    else if(s == "RRS" or s == "SRR") cout << 2 << endl;
    else if(s == "SSS") cout << 0 << endl;
    else cout << 1 << endl;
	return 0;
}


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

class Solve {
private:
	using vb = std::vector<bool>;
	using vc = std::vector<char>;

	using i4 = std::array<int, 4>;

	int W, H;
	int dir4[4][2]{{0, 1}, {0, -1}, {1, 0}, {-1, 0}}, digit[4];
	std::vector<vc> Room[2];

	bool is_reachable()
	{
		digit[0] = digit[2] = H + 2;
		digit[1] = digit[3] = W + 2;
		for (int i{}; i < 2; i++) Room[i].resize(H + 2, vc(W + 2));
		std::fill(Room[0][0].begin(), Room[0][0].end(), '#');
		std::fill(Room[1][0].begin(), Room[1][0].end(), '#');
		std::fill(Room[0][H + 1].begin(), Room[0][H + 1].end(), '#');
		std::fill(Room[1][H + 1].begin(), Room[1][H + 1].end(), '#');

		i4 start, goal;
		for (int h_i{1}; h_i <= H; h_i++)
		{
			Room[0][h_i][0] = Room[0][h_i][W + 1] = Room[1][h_i][0] = Room[1][h_i][W + 1] = '#';
			for (int w_i{1}; w_i <= W; w_i++)
			{
				scanf(" %c", &Room[0][h_i][w_i]);
				switch (Room[0][h_i][w_i])
				{
				case 'L':
					start[0] = h_i;
					start[1] = w_i;
					break;
				case '%':
					goal[0] = h_i;
					goal[1] = w_i;
					break;
				}
			}
			for (int w_i{W}; w_i >= 1; w_i--)
			{
				scanf(" %c", &Room[1][h_i][w_i]);
				switch (Room[1][h_i][w_i])
				{
				case 'R':
					start[2] = h_i;
					start[3] = w_i;
					break;
				case '%':
					goal[2] = h_i;
					goal[3] = w_i;
					break;
				}
			}
		}
		vb visited((H + 2) * (W + 2) * (H + 2) * (W + 2));
		std::queue<i4> nexts;
		visited[calcHash(start)] = true;
		nexts.push(start);
		while (!nexts.empty())
		{
			auto now{nexts.front()};
			nexts.pop();
			for (int i{}; i < 4; i++)
			{
				i4 next{calcNext(now, i)};
				int hash{calcHash(next)};
				if (visited[hash]) continue;
				if (next == goal)
					return true;
				if ((next[0] == goal[0] && next[1] == goal[1]) || (next[2] == goal[2] && next[3] == goal[3]))
					continue;
				visited[hash] = true;
				nexts.push(next);
			}
		}
		return false;
	}

	i4 calcNext(i4 now, int dir)
	{
		if (Room[0][now[0] + dir4[dir][0]][now[1] + dir4[dir][1]] != '#')
		{
			now[0] += dir4[dir][0];
			now[1] += dir4[dir][1];
		}
		if (Room[1][now[2] + dir4[dir][0]][now[3] + dir4[dir][1]] != '#')
		{
			now[2] += dir4[dir][0];
			now[3] += dir4[dir][1];
		}
		return now;
	}

	int calcHash(i4 place)
	{
		int ret{};
		for (int i{}; i < 4; i++)
			ret = digit[i] * ret + place[i];
		return ret;
	}

public:
	bool is_last_query{};
	Solve()
	{
		scanf("%d%d", &W, &H);
		if (W == 0 && H == 0)
		{
			is_last_query = true;
			return;
		}
		if (is_reachable()) puts("Yes");
		else puts("No");
	}
};

int main()
{
	while (!Solve().is_last_query);

	return 0;
}


Measured memory_bytes: 4716
//It's time to be who I am, rather than who I am supposed to be.
#include<bits/stdc++.h>
#define int long long
#define sz(x) (int)(x.size())
using namespace std;

const int N = 1e5+10;
const int mod = 998244353;
const int inf = 1e18;
int n, h[N], dp[N];

int solve(int n){
	if(n == 1)
		return 0;
	else if(n == 2)
		return abs(h[2] - h[1]);
	if(n < 1)
		return inf;
	int &ans = dp[n];
	if(ans != inf)
		return ans;
	ans = min(abs(h[n] - h[n-1]) + solve(n-1), abs(h[n] - h[n-2]) + solve(n-2));
	return ans;
}

int32_t main(){
	ios::sync_with_stdio(false);
   cin.tie(NULL); cout.tie(NULL);


    fill(dp, dp + N, inf);
    cin >> n;
    for(int i = 1; i <= n; i++)
    	cin >> h[i];
    dp[1] = 0;

    cout << solve(n) << '\n';

}

Measured memory_bytes: 3328
#!usr/bin/env python3
from collections import defaultdict
import math
def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()
def LIR(n): return [LI() for i in range(n)]
mod = 1000000007

#A
"""
a,b = LS()
c = int(a+b)
for i in range(1,1000):
    if i * i == c:
        print("Yes")
        quit()
print("No")
"""
#B
a,b = LI()
if a*b <= 0:
    print("Zero")
else:
    if b < 0:
        if (a-b) %2 == 1:
            print("Positive")
        else:
            print("Negative")
    else:
        print("Positive")
#C

#D

#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


Measured memory_bytes: 38384
#include <iostream>
#include <string>
using namespace std;
#define LEN 100005

struct pp {
    char name[100];
    int t;
};
int head, tail, n;
struct pp queue[LEN];
void enqueue(struct pp x) {
    queue[tail++] = x;
    tail %= LEN;
}
struct pp dequeue() {
    struct pp x = queue[head++];
    head %= LEN;
    return x;
}

int main() {
    int elaps = 0;
    int c;
    int q;
    struct pp u;
    cin >> n >> q;
    for(int i = 1; i <= n; i++) {
        cin >> queue[i].name >> queue[i].t;
    }
    head = 1; tail = n+1;
    while(head != tail) {
        u = dequeue();
        c = min(q, u.t);
        u.t -= c;
        elaps += c;
        if(u.t > 0) {
            enqueue(u);
        } else {
            cout << u.name << " " << elaps << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 13276
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
long long ni(long long ta, vector<long long> & v) {

}
long long rui(long long n, long long k, long long p) {
	if (k == 0) {
		return 1;
	}
	else {
		long long a = rui(n, k / 2, p);
		if (k % 2 == 0) {
			return (a*a) % p;
		}
		return (((a*a) % p)*n) % p;
	}
}
int main(){
	int n;
	cin >> n;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		ans += 1 - (a % 2);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3124
import java.util.Scanner;

public class Main {
	int[][] cell;
	int w, h;

	int remove(int k) {
		int res = 0;
		int cnt = 0;
		for (int i = 0; i < 3; i++) {
			int a = Math.abs(cell[k][i]);
			int b = Math.abs(cell[k][i + 1]);
			int c = Math.abs(cell[k][i + 2]);
			if (a != 0 && a == b && b == c) {
				res = a;
				cell[k][i] = -a;
				cell[k][i + 1] = -b;
				cell[k][i + 2] = -c;
			}
		}
		for (int i = 0; i < w; i++) {
			if (cell[k][i] < 0) {
				cnt++;
				cell[k][i] = 0;
			}
		}
		return Math.max(0, res * cnt);
	}

	void refresh(int k) {
		int id = h - 1;
		for (int i = h - 1; 0 <= i; i--) {
			if (cell[i][k] != 0) {
				cell[id--][k] = cell[i][k];
			}
		}
		for (int i = id; 0 <= i; i--) {
			cell[i][k] = 0;
		}
	}

	void run() {
		Scanner sc = new Scanner(System.in);

		while (true) {
			w = 5;
			h = sc.nextInt();
			if (h == 0) {
				break;
			}
			cell = new int[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					cell[i][j] = sc.nextInt();
				}
			}

			boolean flg = true;
			int score = 0;
			while (flg) {
				flg = false;
				for (int i = 0; i < h; i++) {
					int tmp = remove(i);
					if (0 < tmp) {
						score += tmp;
						flg = true;
					}
				}
				for (int i = 0; i < w; i++) {
					refresh(i);
				}
			}

			System.out.println(score);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	public void mapDebug(int[][] a) {
		System.out.println("--------map display---------");
		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[i].length; j++) {
				System.out.printf("%3d ", a[i][j]);
			}
			System.out.println();
		}
		System.out.println("----------------------------" + '\n');
	}
}

Measured memory_bytes: 50088
k, n = map(int, input().split())
a = list(map(int, input().split()))

li = []
for i in range(n - 1):
    li.append(a[i + 1] - a[i])

if a[0] == 0:
    li.append(k - a[n - 1])
    li.sort()
    li.pop(-1)
else:
    li.append(k - a[n - 1] + a[0])
    li.sort()
    li.pop(-1)
print(sum(li))

Measured memory_bytes: 87856
#include<stdio.h>
int main(void)
{
    int n,a[100000],i,count = 0,j[100000];
    scanf("%d",&n);
    for(i = 0; i < n ; i++)
    {
        scanf("%d",&a[i]);
    }
    for(i = 0 ; i < n ; i++)
    {
        j[a[i] - 1] = i + 1;
    }
    for(i = 0 ; i < n ; i++)
    {
        printf("%d ",j[i]);
    }
    return 0;
}

Measured memory_bytes: 2508
n=int(input())
S=[]
for i in range(n):
    S.append(input())

m=int(input())
T=[]
for j in range(m):
    T.append(input())

res=0
for i in range(n):
    x=S.count(S[i])
    y=T.count(S[i])
    if x-y>res:
        res=x-y
for j in range(m):
    x=S.count(T[j])
    y=T.count(T[j])
    if x-y>res:
        res=x-y

print(res)

Measured memory_bytes: 3064
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
typedef long long int ll;
int main()
{
   ll n;
   cin>>n;
   ll a[n+1],b[n];
   ll i;
   for(i=0;i<n+1;i++)
   {
      cin>>a[i];
   }
   for(i=0;i<n;i++)
   {
       cin>>b[i];
   }
   ll ans=0;
   for(i=0;i<n;i++)
   {
       if(a[i]>b[i])
       {
           ans+=b[i];
       }
       else
       {
           ans+=a[i];
           b[i]=b[i]-a[i];
           if(a[i+1]<b[i])
           {
               ans+=a[i+1];
               a[i+1]=0;
           }
           else
           {
               ans+=b[i];
               a[i+1]-=b[i];
           }

       }
   }
   cout<<ans;
}


Measured memory_bytes: 1792
import std.stdio;
import core.stdc.stdio;
import std.algorithm;
import std.math;
import core.stdc.string;

char[] A;
char[] B;

class Arr{
	int as,bs,cs,ds;
	void Set(int a,int b,int c,int d){
		as = a;
		bs = b;
		cs = c;
		ds = d;
		data = new int[a*b*c*d];
	}
	this(){
		Set(500,10,2,3);
	}
	int[] data;
	ref int opIndex(int a,int b,int c,int d){
		return data[(((a)*bs+b)*cs+c)*ds+d];
	}
	void Clear(){
		data[] = 0;
	}
}

Arr now;
Arr next;

static immutable modBase = 10000;

void Minus(char[] d,int idx){
	if(d[idx] == 0){
		d[idx] = 9;
		d.Minus(idx-1);
	}else{
		d[idx]--;
	}
}

int Count(char[] d,int m,bool minus){
	int len = cast(int)strlen(d.ptr);
	for(int i=0;i<len;i++){
		d[i] -= '0';
	}
	if(minus)
		d[0..len].Minus(len-1);
	now.Clear;
	
	int md=1;
	int res=0;
	foreach_reverse(_,c;d[0..len]){
		next.Clear;
		for(int i=0;i<m;i++){
			for(int j=0;j<10;j++){
				if(_ == len-1){
					if(i==0){
						next[j%m,j,j<=c?0:1,2] = 1;
					}
				}else{
					for(int k=0;k<10;k++){
						if(j==k) continue;
						int t = 0;
						int s = 1;
						if(j > k) swap(s,t);
						if(j<c){
							next[(i+md*j)%m,j,0,t] += now[i,k,0,s] + now[i,k,1,s] + now[i,k,0,2] + now[i,k,1,2];
							next[(i+md*j)%m,j,0,t] %= modBase;
						}else if(j==c){
							next[(i+md*j)%m,j,0,t] += now[i,k,0,s] + now[i,k,0,2];
							next[(i+md*j)%m,j,1,t] += now[i,k,1,s] + now[i,k,1,2];
							next[(i+md*j)%m,j,0,t] %= modBase;
							next[(i+md*j)%m,j,1,t] %= modBase;
						}else{
							next[(i+md*j)%m,j,1,t] += now[i,k,0,s] + now[i,k,1,s] + now[i,k,0,2] + now[i,k,1,2];
							next[(i+md*j)%m,j,1,t] %= modBase;
						}
					}
				}
			}
		}
		swap(now,next);
		for(int i=1;i<10;i++){
			res += now[0,i,0,0] + now[0,i,0,1] + now[0,i,0,2];
			if(_>0)
				res += now[0,i,1,0] + now[0,i,1,1] + now[0,i,1,2];
			res %= modBase;
		}
		md *= 10;
		md %= m;
	}
	
	return res;
}

void main(){
	A = new char[514];
	B = new char[514];
	scanf("%s",A.ptr);
	scanf("%s",B.ptr);

	int m;
	scanf("%d",&m);
	
	now = new Arr;
	next = new Arr;
	
	int ac = A.Count(m,true);
	int bc = B.Count(m,false);
	
	printf("%d\n",(bc+modBase-ac)%modBase);
}

Measured memory_bytes: 2580
#include<iostream>
#include<cstdio>
#include<stack>
#include<algorithm>
#include<string>
#include<map>
using namespace std;
int main(){
    map<char,int>M;
    M['(']=M[')']=1;
    M['[']=M[']']=2;
    string str;
    while(getline(cin,str),str!="."){
        bool flag=true;
        stack<int>S;
        for(int i=0;i<str.length();i++){
            char c=str[i];
            if(c=='('||c=='['){
                S.push(M[c]);
            }
            if(c==')'||c==']'){
                if(S.size()==0){
                    flag=false;
                    break;
               }
                if(S.top()!=M[c]){
                    flag=false;
                    break;
                }
                S.pop();
            }
        }
        if(S.size())flag=false;
        puts(flag?"yes":"no");
    }
    return 0;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1.0)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    bool ans = false;
    rep(i, k+1){
        int na = a, nb = b * pow(2, i), nc = c * pow(2, k-i);
        if(na < nb && nb < nc)ans = true;
    }
    cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 4056
#include<stdio.h>

int main(){
  char b;
  scanf("%c",&b);
  if(b == 'A'){
    printf("T");
  }
  if(b == 'T'){
    printf("A");
  }
  if(b == 'C'){
    printf("G");
  }
  if(b == 'G'){
    printf("C");
  }

  return 0;
}


Measured memory_bytes: 128
using System;

namespace ConsoleApplication1
{
	public class Runes
	{
		static int Main(string[] args)
		{
			string s = Console.ReadLine();
			int i = Convert.ToInt32(s);
			if (i < 1200)
				Console.WriteLine("ABC");
			else
				Console.WriteLine("ARC");
			return 0;
		}
	}
}


Measured memory_bytes: 2776
#include <iostream>                                             
#include <cstdio>                                               
#include <cmath>                                                
#include <cstdlib>                                              
using namespace std;                                            
                                                                
int main(void) {                                                
  int i;                                                        
  double n,x[1001],y[1001],sum,d,p,max=0;                       
  cin >> n;                                                     
  for (i=0; i<n; i++) {                                         
    cin >> x[i];                                                
  }                                                             
  for (i=0; i<n; i++) {                                         
    cin >> y[i];                                                
  }                                                             
  for (p=1; p<4; p++) {                                         
    for (i=0,sum=0; i<n; i++) {                                 
      sum += pow(fabs(x[i]-y[i]),p);                            
      if(max<fabs(x[i]-y[i])) {                                 
        max = fabs(x[i]-y[i]);                                  
      }                                                         
    }                                                           
    d=pow(sum,1.0/p);                                           
    printf("%.6f\n",d);                                         
  }                                                             
  printf("%.6f\n",max);                                         
  return 0;                                                     
}                                                               
                                                                
                                                                
                                                                
                                     

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

int main(){
	int N;
	string S;
	cin >> N >> S;
	int ans=0,t=0;
	for(int i=0;i<N;i++){
		if(S[i]=='I')t++;
		else t--;
		ans=max(ans,t);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
fun main() {
    val N = readLine()!!.toInt()
    val A = readLine()!!.split(" ").map { it.toLong() }

    var s = 0L
    A.forEach { a ->
        s = s.xor(a)
    }

    val B = LongArray(N)
    for(i in 0 until N){
        B[i] = s.xor(A[i])
    }
    println(B.joinToString(separator = " "))
}

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

int main() {
  int N,M;
  cin >> N >> M;
  vector<int>result(N);
  for(int i=0;i<2*M;i++){
    int a;
    cin >> a;
    result.at(a-1)++;
  }
  for(int i=0;i<N;i++){
    cout << result.at(i) << endl;
  }
}


Measured memory_bytes: 256
from collections import deque
s = list(input())
ans = deque(s)
q = int(input())
check = 1
for i in range(q):
    a = list(input().split())
    if a[0] == "1":
        check *= -1
    else:
        if a[1] == "1":
            if check == 1:
                ans.appendleft(a[2])
            else:
                ans.append(a[2])
        else:
            if check == 1:
                ans.append(a[2])
            else:
                ans.appendleft(a[2])
    
ans = list(ans)
if check==1:
    print(*ans,sep="")
else:
    ans = ans[::-1]
    print(*ans,sep="")



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


int main() {
    int a,b,c,x,y;
    cin>>a>>b>>c>>x>>y;
    if(a+b<c*2){
        cout<<x*a+y*b<<endl;
        return 0;
    }
    else{
        int price=c*2*min(x,y);
        if(x>y){
            price+=min(a,c*2)*(x-y);
        }
        else price+=min(b,c*2)*(y-x);
        cout<<price<<endl;
    }
    return 0;
}

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

template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; }
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif

#define fast_cin() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX 1000000
#define ll long long
#define db double
#define str string
#define pb push_back
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define Forrev(i,s,e) for (ll i=(s); i>=(e); i--)
#define all(v) v.begin(),v.end()

#define vll vector<ll>
#define vs vector<string>
#define mapll map<ll,ll>
#define pll pair<ll,ll>
#define initialise(a, x) memset(a, x, sizeof(a))
#define maxheap priority_queue<ll>
#define minheap priority_queue<ll,vector<ll> ,greater<ll>>

#define ff first
#define ss second
#define endl "\n"
#define mp make_pair
const ll mod=1e9 + 7;

ll takemod(ll a) {
    return ((a%mod)+mod)%mod;
}

ll gcd(ll a, ll b) { 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);        
}

ll fast_exp(ll base, ll expo) {
    ll res=1;
    while(expo>0) {
        if(expo&1) res=(res*base)%mod;
        base=(base*base)%mod;
        expo>>=1;}
    return res;
}

ll modinv(ll a) {
    return takemod(fast_exp(takemod(a), mod-2));
}

void solve()
{
	ll n;
	cin>>n;

	ll ans=0;

	For(i,1,n+1)
	{
		if(i%3!=0 and i%5!=0)
			ans+=i;
	}
	cout<<ans<<endl;
}

signed main() 
{
    fast_cin();
    // #ifndef ONLINE_JUDGE
    // freopen("C:/IO/in.txt", "r", stdin);
    // freopen("C:/IO/out.txt", "w", stdout);
    // #endif
    
    int t=1;
    //cin>>t;
    while(t--)
    {
    	solve();
    }
    
    
    return 0;    
}

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

#define NN 100010

int main(void)
{
  int i, k, id, N, K;
  scanf("%d",&N);
  scanf("%d",&K);
  
  char S[NN];
  char tmp;
  scanf("%s",S);
  int s[N];
  for(i=0;i<N;i++){

    if( (i+1)!=K){
       s[i] = S[i] -48 ;
    }else{
       s[i] = S[i] -16;
    }
    tmp = '0' + s[i] ;
    printf("%c" , tmp); 

       //      printf("%s", (char)((in)(X[i])+100) ); 
      //      printf("%s", X[i] ); 
  }
  return (0);
}


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

int main()
{
  ll a, v, b, w, t;
  cin >> a >> v >> b >> w >> t;
  
  if(w >= v)
  {
    cout << "NO" << endl;
    return 0;
  }
  
  ll dist = abs(a-b), s = v - w;
  if(s*t < dist)
  {
    cout << "NO" << endl;
  }
  else
  {
    cout << "YES" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3624
//Decision's template
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cstdlib>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<set>
using namespace std;

#define maxn 100000
#define INF 10000007
#define MOD 1000000007
#define mst(s,k) memset(s,k,sizeof(s))

typedef long long ll;

struct Edge{
    int from,to,dist;
    Edge(int u,int v,int d):from(u),to(v),dist(d){}
};

/*-------------------------------template End--------------------------------*/

int n,A,B,C,a[10],ans = INF;
int tt[10] = {1,2,4,8,16,32,64,128,256,512};
vector<int> anss;

bool cmp(int x,int y){return x>y;}

int cal(int y,int x){
	int res = 0,cnt = 0;
	for(int i = 1;i<=n;i++){
		if((x>>(i-1))&1) res += a[i],cnt++;
	}
	//cout<<res<<" "<<abs(res - y) + (cnt - 1) * 10<<endl;
	return abs(res - y) + (cnt - 1) * 10;
}

int main(){
	cin>>n>>A>>B>>C;
	for(int i = 1;i<=n;i++){
		cin>>a[i];
	}
	int tmp = tt[n] - 1;
	for(int i = 1;i<=tmp;i++){
		for(int j = 1;j<=tmp;j++){
			for(int k = 1;k<=tmp;k++){
				if(i&j || j&k || i&k) continue;
				ans = min(cal(A,i) + cal(B,j) + cal(C,k),ans);
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    q, h, s, d = LI()
    n = II()
    q4 = q * 4
    h2 = h * 2
    l1 = min(q4, h2, s)
    l2 = min(l1 * 2, d)
    print((n >> 1) * l2 + (n & 1) * l1)
    
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 38512
import java.util.*;
public class Main {
	static int n;
	static long[] bit=new long[212345];
	public static void update(int x,long v) {
		while (x<=n) {
			bit[x]=Math.max(bit[x],v);
			x+=x&-x;
		}
	}
	public static long query(int x) {
		long ret=0;
		while (x>0) {
			ret=Math.max(ret,bit[x]);
			x-=x&-x;
		}
		return ret;
	}
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		n=in.nextInt();
		int[] h=new int[n];
		int[] a=new int[n];
		for (int i=0;i<n;++i) h[i]=in.nextInt();
		for (int i=0;i<n;++i) a[i]=in.nextInt();
		long res=0;
		for (int i=0;i<n;++i) {
			long x=a[i]+query(h[i]-1);
			res=Math.max(res,x);
			update(h[i],x);
		}
		System.out.println(res);
	}
}

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

//#define int long long
#define fi first
#define se second
#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 rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1002000007
#define INF LONG_LONG_MAX

int main(){
    int n,m;
    cin>> n>>m;
    if ((n==m) ? cout<<"Yes"<<endl : cout<<"No"<<endl); 
    return 0;
}

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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> void operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) cin >> e; }

typedef long long ll;
int const inf = 1<<29;

int main() {
  int N, A, B; cin >> N >> A >> B;
  if ((abs(A - B) - 1) % 2 == 0) {
    cout << "Borys\n";
  } else {
    cout << "Alice\n";
  }
}


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

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

    for (int i = 0; i < s.length(); i++) {
        int temp = s[i] - 'A';
        temp = (temp + n) % 26;
        s[i] = temp + 'A';
    }

    cout << s << endl;
}

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

// THINK: INT vs LONG LONG?

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

	int n; cin >> n;
	ll ans = 0;
	for (int a = 1; a < n; ++a) {
		if (n % a == 0) {
			ans += (n / a - 1);
		}
		else ans += (n / a);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3688
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val s = readLine()!!

    var max = 0

    for (i in 1..(n - 1)) {
        val s1 = s.substring(0, i).toSet()
        val s2 = s.substring(i, n).toSet()

        val count = s1.count { s2.contains(it) }
        max = if (count > max) count else max
    }

    println(max)
}

Measured memory_bytes: 33780
setting = input().split();
package_count = int(setting[0]);
truck_count = int(setting[1]);
packages = [];
for i in range(package_count):
    packages.append(int(input()));

def allocation():
    max_p = sum(packages);
    left = 0;
    right = max_p;
    while left < right:
        mid = (left + right) // 2;
        load = calculate_load(mid);
        if load >= package_count:
            right = mid;
        else:
            left = mid + 1;
    return right;

def calculate_load(p):
    i = 0;
    j = 0;
    current_truck_p = p;
    while i < package_count and j < truck_count:
        if packages[i] <= current_truck_p:
            current_truck_p -= packages[i];
            i += 1;
        else:
            j += 1;
            current_truck_p = p;
    return i;

print(allocation());


Measured memory_bytes: 9556
import scala.io.StdIn

object Main extends App {

  val n = StdIn.readLine().trim.toInt
  val lst1 = StdIn.readLine().trim.split(' ').map(_.toInt) ++ Array(-1)
  val t = StdIn.readLine().trim.toInt
  val lst2 = StdIn.readLine().trim.split(' ').map(_.toInt)
  
  val result = lst2.foldLeft(0){ (acc, e) =>
    lst1(n) = e
    var i = 0
    while(lst1(i)!=e)i+=1

    if(i == n) acc else acc + 1
  }
  
  println(result)

}



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

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<< #str << " " str<<endl

constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7

bool ismonth(char a, char b) {
	int res = a - '0';
	res *= 10;
	res += b - '0';
	return 1 <= res && res <= 12;
}

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

	bool yymm = false, mmyy = false;

	if (ismonth(s[0], s[1]))mmyy = true;
	if (ismonth(s[2], s[3]))yymm = true;


	if (yymm && mmyy) {
		cout << "AMBIGUOUS" << endl;
	}
	else if (yymm) {
		cout << "YYMM" << endl;
	}
	else if (mmyy) {
		cout << "MMYY" << endl;
	}
	else {
		cout << "NA" << endl;
	}
	return 0;
}


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

public class Main {

     static Scanner scanner;

     public static void main(String[] args) {
         scanner = new Scanner(System.in);

         int N=gi();
         int x=gi();
         int[] a=new int[2*N-1];
         List<Integer> f=new ArrayList<Integer>();

         if (x==1 || x==2*N-1) {
        	 System.out.println("No");
        	 return;
         } else {
        	 for(int i=0; i<2*N-1; i++) {
        		 a[i]=-1;
        	 }
        	 a[N-1]=x;
        	 a[N-2]=1;
        	 a[N]=2*N-1;
        	 f.add(x);
        	 f.add(1);
        	 f.add(2*N-1);
        	 if(N!=3 && x!=2) {
        		 a[N+1]=2;
        		 f.add(2);
        	 }
         }

         int ind=0;
         int v=1;
         while(ind<2*N-1) {
        	 if(a[ind]==-1) {
        		 while(f.contains(v)) {
        			 v++;
        		 }
        		 a[ind]=v;
        		 v++;
        		 ind++;
        	 } else {
        		 ind++;
        	 }
         }

         System.out.println("Yes");
         for(int i=0; i<2*N-1; i++) {
        	 System.out.println(a[i]);
    	 }
         //System.out.println(ans);
     }

     // 文字列として入力を取得
     public static String gs() {
          return scanner.next();
     }

     // intとして入力を取得
     public static int gi() {
          return Integer.parseInt(scanner.next());
     }

     // longとして入力を取得
     public static long gl() {
          return Long.parseLong(scanner.next());
     }

     // doubleとして入力を取得
     public static double gd() {
          return Double.parseDouble(scanner.next());
     }
}

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

using namespace std;

int main() {

	long n,k;

	cin >> n >> k;

	vector<long> h(n + 1);

	for (long i = 1; i <= n; i++) {
		cin >> h[i];
	}

	h[0] = h[1];

	vector<long> dp(n+2);


	for (long i = 0; i <= n + 1; i++) {
		dp[i] = 1000000000;
	}
	dp[1] = 0;
	dp[2] = abs(h[2] - h[1]);
	for (long i = 3; i <= n; i++) {
		for (long j = 0; j < k ; j++) {
			if (i - k + j >= 1) {
				dp[i] = min(dp[i],dp[i - k + j] + abs(h[i] - h[i - k + j]));
			}
		}
	
	}

	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 1792
N=int(input())
L=list(map(int,input().split()))
M=[float("inf")]*(N+10)
M[0]=0
for i in range(1,N+1):
	M[i]=M[i-1]+L[i-1]
ans=float("inf")
for i in range(1,N):
	X=M[i]
	Y=M[N]-M[i]
	ans=min(ans,abs(X-Y))
print(ans)

Measured memory_bytes: 24816
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vii vector<vector<int>>
#define vpi vector<pair<int,int>>
#define w(t) int t;cin>>t;while(t--)
#define pi pair<int,int>
#define mii map<int,int>
#define pb push_back
#define ff first
#define ss second
#define FOR(i,t,n) for(int i=t;i<n;i++)
#define SCI(x)  scanf("%d",&x)
#define SCL(x) scanf("%lld",&x)

int main()
{

	int A,B,C,k;
	cin>>A>>B>>C>>k;
	if(k <= A){
		cout<<k<<endl;
	}
	else if(k <= A+B){
		cout<<A<<endl;
	}

	else if(k <= A+B+C){
		int ans = A;
		ans  = A - (k - A - B);
		cout<<ans<<endl;
	}

}

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

using namespace std;

typedef long long ll;

const int MOD = 1e9 + 7;
const int N = 2e5 + 5;

vector<int> G[N];

int n;

ll fac[N], invf[N];

void init() {
    fac[0] = 1;
    for (int i = 1; i < N; i++)
        fac[i] = fac[i - 1] * i % MOD;
    invf[0] = 1, invf[1] = 1;
    for (int i = 2; i < N; i++)
        invf[i] = (MOD - MOD / i) * invf[MOD % i] % MOD;
    for (int i = 2; i < N; i++)
        invf[i] = invf[i] * invf[i - 1] % MOD;
}

inline ll C(int n, int m) {
    return fac[n] * invf[n - m] % MOD * invf[m] % MOD;
}

ll f[N];

int sz[N];

void dfs(int u, int p = 0) {
    sz[u] = 1; f[u] = 1;
    for (auto v : G[u]) if (v != p) {
        dfs(v, u);
        sz[u] += sz[v];
    }    
    int cnt = 1;
    for (auto v : G[u]) if (v != p) {
        (f[u] *= C(sz[u] - cnt, sz[v]) * f[v] % MOD) %= MOD;
        cnt += sz[v];
    }
}

ll res[N];

ll qpow(ll a, ll b) {
    ll ret = 1;
    for (; b; (a *= a) %= MOD, b >>= 1)
        if (b & 1)
            (ret *= a) %= MOD;
    return ret;
}

inline ll inv(ll x) {
    return qpow(x, MOD - 2);
}

void solve(int u, int p = 0, ll val_p = 1) {
    res[u] = f[u] * val_p % MOD;
    if (u != 1) {
        (res[u] *= C(n - 1, n - sz[u])) %= MOD;
    }
    ll prod = 1, prod2 = 1;
    for (auto v : G[u]) if (v != p) {
        (prod *= fac[sz[v]]) %= MOD;
        (prod2 *= f[v]) %= MOD;
    }
    if (u > 1) {
        (prod *= fac[n - sz[u]]) %= MOD;
        (prod2 *= val_p) %= MOD;
    }
    for (auto v : G[u]) if (v != p) {
        ll cur = prod * inv(fac[sz[v]]) % MOD;
        ll cur2 = prod2 * inv(f[v]) % MOD;
        cur = inv(cur);
        ll val = cur2 * fac[n - sz[v] - 1] % MOD * cur % MOD;
        solve(v, u, val);
    }
}

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin >> n;
    for (int i = 1; i < n; i++) {
        int u, v;
        cin >> u >> v;
        G[u].push_back(v);
        G[v].push_back(u);
    }
    init();
    dfs(1);
    solve(1);
    for (int i = 1; i <= n; i++)
        cout << res[i] << endl;
    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n; cin>>n;
	vector<int> x(n), y(n);
	for(int i = 0; i < n; i++){
		cin>>x[i]>>y[i];
	}
	ld ans = 0.0;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			ld dx = x[i] - x[j];
			ld dy = y[i] - y[j];
			ld tmp = sqrt(dx*dx + dy*dy);
			ans += tmp/n;
		}
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main(){
  string s;
  cin >> s;
  int n=s.size();
  ll ans=0,x=1,k=0;
  vector<ll> cnt;
  char c=s[0];
  for(int i=1;i<n;i++){
    if(s[i]==c) x++;
    else{
      cnt.push_back(x);
      x=1;
      c=s[i];
    }
  }
  cnt.push_back(x);
  cnt.push_back(0);
  if(s[0]=='>'){
    ans+=cnt[0]*(cnt[0]+1)/2; k=1;
  }
  for(int i=k;i<cnt.size()-1;i+=2){
    ll p=max(cnt[i],cnt[i+1]);
    ll q=min(cnt[i],cnt[i+1]);
    ans+=p*(p+1)/2+q*(q-1)/2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3068
#include <bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define ll long long
const ll mod = 1000000007;


int main() {
  ll x,y;
  scanf("%lld%lld", &x,&y);

  if(abs(x-y)<=1)printf("Brown\n");
  else printf("Alice\n");
    return 0;
}


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

using namespace std;

typedef long long LL;

const int N = 100005;

int a[N], pa[N], deg[N];
vector<int> ds[N];

bool dfs(int u) {
    LL s = 0, ma = 0;
    for (auto &v : ds[u]) {
        if (pa[u] == v) continue;
        pa[v] = u;
        if (!dfs(v)) return false;
        s += a[v];
        ma = max(ma, LL(a[v]));
    }
    if (ds[u].size() == 1) return true;
    if (a[u] > s) return false;
    if (ma+ma > s) {
        ma = s-ma;
        if (ma < s - a[u]) return false;
    }
    a[u] -= (s - a[u]);
    if (a[u] < 0) return false;
    if (pa[u] == 0 && a[u] > 0) return false;
    return true;
}

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

    for (int i = 1; i <= n; i++) scanf("%d", a+i);

    if (n == 2) {
        if (a[1] == a[2]) printf("YES");
        else printf("NO");
        return 0;
    }

    for (int i = 1; i < n; i++) {
        int u, v;
        scanf("%d%d", &u, &v);

        ds[u].push_back(v);
        ds[v].push_back(u);

        deg[u]++;
        deg[v]++;
    }

    int r = 0;
    for (int i = 1; i <= n; i++)
    if (deg[i] > 1) {
        r = i; break;
    }

    if (dfs(r)) printf("YES");
    else printf("NO");
}


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

int main() {
    int N, K;
    string S;
    while (cin >> N >> S >> K) {
        char c = S[K-1];
        for (auto &s : S) if (s != c) s = '*';
        cout << S << endl;
    }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, a, b, w);g_dir(graph, b, a, w);}
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
const ll INF = 1145141919;
const ll MOD = 1000000007;
const ll NUM = 101010;

//A以上B以下を数える
class ABCount{
    public:
    vector<ll>v;
    set<pair<ll, ll> >S;
    ll makeFlg;
    ll Inf;
    ABCount(ll inf = 1145141919){
        Inf = inf;
        makeFlg = 0;
    }
    void push(ll a){
        v.push_back(a);
    }
    void make(){
        makeFlg = 1;
        S.clear();
        sort(v.begin(), v.end());
        for(ll i = 0; i < v.size(); i++){
            S.insert(pair<ll, ll>(v[i], i));
        }
        S.insert(pair<ll,ll>(Inf, v.size()));
    }
    ll count(ll a, ll b){
        if(a > b)return 0;
        if(makeFlg == 0)make();
        return (*S.upper_bound(pair<ll,ll>(b, Inf))).second - (*S.lower_bound(pair<ll,ll>(a, 0))).second;
    }
};

ll a[101010], b[101010], c[101010];
ll wa(ll l, ll r){
    if(l > r)return 0;
    return b[r] - b[l - 1];
}
ll jump(ll idx){
    if(idx <= 0)return 0;
    return c[idx];
}
int main(){

    ll N, Q;
    cin >> N >> Q;
    ABCount abc;
    rep1(i, N)cin >> a[i];
    rep1(i, N)abc.push(a[i]);
    rep1(i, N)b[i] = b[i - 1] + a[i];
    c[1] = a[1];
    for(ll i = 2; i <= N; i++)c[i] = c[i - 2] + a[i];
    rep(i, Q){
        ll x;
        cin >> x;
        ll ng = 1, ok = N;
        while(ng + 1 < ok){
            ll mid = (ng + ok) / 2;
            if(a[mid] <= x){
                ng = mid;
                continue;
            }
            ll l = x - (a[mid] - x);
            ll r = x + (a[mid] - x);
            if(abc.count(l, r) < N - mid + 1)ng = mid;
            else ok = mid;
        }
        cout << wa(ok, N) + jump(N - 2 * (N - ok + 1)) << endl;
    }
    
    return 0;
}

Measured memory_bytes: 11124
import java.util.*;


public class Main {
	
	int n, m, k, start, goal, r;
	int[] a, b, cost, time;
	
	final int INF = Integer.MAX_VALUE;
	Edge[] esc, est;
	int[] min;
	
	int shortestPath(Edge[] es) {
		min[start] = 0;
		
		while (true) {
			boolean update = false;
			for (int i = 0; i < n * 2; i++) {
				Edge e = es[i];
				int cost = min[e.from] + e.cost;
				if (min[e.from] != INF && cost < min[e.to]) {
					min[e.to] = cost;
					update = true;
				}
			}
			if (!update) break;
		}
		return min[goal];
	}
	
	int solve() {
		min = new int[m + 1];
		Arrays.fill(min, INF);
		if (r == 0) {
			return shortestPath(esc);
		} else {
			return shortestPath(est);
		}
	}
	
	void run() {
		Scanner sc = new Scanner(System.in);
		String output = "";
		while (sc.hasNext()) {
			n = sc.nextInt();
			m = sc.nextInt();
			if (n == 0 && m == 0) {
				break;
			} else {
				a = new int[n];
				b = new int[n];
				cost = new int[n];
				time = new int[n];
				for (int i = 0; i < n; i++) {
					a[i] = sc.nextInt();
					b[i] = sc.nextInt();
					cost[i] = sc.nextInt();
					time[i] = sc.nextInt();
				}
				esc = new Edge[n * 2];
				est = new Edge[n * 2];
				for (int i = 0; i < n; i++) { 
					esc[i] = new Edge(a[i], b[i], cost[i]);
					est[i] = new Edge(a[i], b[i], time[i]);
				}
				for (int i = n; i < n * 2; i++) { 
					esc[i] = new Edge(b[i - n], a[i - n], cost[i - n]);
					est[i] = new Edge(b[i - n], a[i - n], time[i - n]);
				}
				k = sc.nextInt();
				for (int i = 0; i < k; i++) {
					start = sc.nextInt();
					goal = sc.nextInt();
 					r = sc.nextInt();
					output += solve() + "\n";
				}
			}
		}
		sc.close();
		System.out.print(output);
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
	
	class Edge {
		
		int from, to, cost;
		
		Edge(int from, int to, int cost) {
			this.from = from;
			this.to = to;
			this.cost = cost;
		}
		
	}

}

Measured memory_bytes: 163172