akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define popcount __builtin_popcount
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

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;
}

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;

void solve()
{
	ll n,k;
	cin>>n>>k;
	vector<ll>p(n),c(n);
	rep(i,n)cin>>p[i],p[i]--;
	rep(i,n)cin>>c[i];
	ll ans=-INF;
	rep(i,n){
		vector<bool>used(n);
		ll s=i;
		ll nx=s;
		ll cnt=k;
		ll loop=1;
		ll res=0;
		while(cnt>0){
			nx=p[nx];
			if(used[nx]){
				loop=k-cnt;
				break;
			}
			res+=c[nx];
			chmax(ans,res);
			--cnt;
			used[nx]=true;
		}
		if(cnt>0){
			if(cnt/loop-1>=0&&res>0){
				res+=(cnt/loop-1)*res;
				cnt%=loop;
				cnt+=loop;
			}
			chmax(ans,res);
			loop*=2;
			loop+=5;
			while(cnt>0&&loop>0){
				res+=c[nx];
				chmax(ans,res);
				nx=p[nx];
				--cnt;
				--loop;
			}
		}
	}
	cout<<ans;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


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

#define     fast()              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define     ll                  long long int
#define     test()              ll t; cin>>t; while(t--) 
#define     lp0(i,begin,end)    for(ll i=begin;i<end;i++)
#define     lp1(i,begin,end)    for(ll i=begin;i<=end;i++)
#define     rlp(i,begin,end)    for(ll i=end;i>=begin;i--)
#define     prec(n)             fixed<<setprecision(n)
#define     initial(a,i)        memset(a,i,sizeof(a))
#define     pb                  push_back
#define     PI                  3.1415926535897932384626433832795
#define     MOD                 1000000007
#define     F                   first
#define     S                   second
#define     all(a)              (a).begin(),(a).end()
#define     BPC(x)              __builtin_popcountll(x)
#define     gcd(a,b)            __gcd(a,b)

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

ll power(ll x,ll n)
{
    ll result = 1;
    while (n)
    {
        if (n & 1)
            result = result * x;
        n = n / 2;
        x = x * x;
    }
    return result;
}


// Solution Function
void solution(ll compte)
{
    // cout<<compte<<"\n";
    string s;
	cin>>s;
	ll res=0,ans=0;
	lp0(i,0,s.size())
	{
		if(s[i]=='R')res++;
		else ans=max(ans,res),res=0;
	}
	if(res>0) ans=max(ans,res);
	cout<<ans<<'\n';
}
// Driver Function
int main()
{
    ll compte = 1;
    //test()
    //{
        solution(compte);
        compte++;
    //}
    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,n) for(Int i=0;i<n;++i)
using namespace std;

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

    int N;
    string S;
    cin >> N >> S;
    vector<int> needToFlips(N+1);
    
    int needToFlip = 0;
    for (int i = 0; i < N; ++i) {
        if (S[i] == '.')
            ++needToFlip;
    }
    needToFlips[0] = needToFlip;

    for (int i = 0; i < N; ++i) {
        if (S[i] == '.')
            --needToFlip;
        if (S[i] == '#')
            ++needToFlip;

        needToFlips[i+1] = needToFlip;
    }

    cout << *min_element(needToFlips.begin(), needToFlips.end()) << "\n";
}

Measured memory_bytes: 1300
#include<stdio.h>
#include<cstdlib>

#define MAX 44

int fibonacci(int n){
  int i, F[MAX];
  F[0] = 1;
  F[1] = 1;
  for(i = 2; i < n+1; i++){
    F[i] = F[i-1] + F[i-2];
  }
  return F[i-1];
}

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

  printf("%d\n", fibonacci(n));
}



Measured memory_bytes: 2692
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define llong long long
#define INF (__INT32_MAX__ / 2)
#define EPS 10e-8
#define MAX_N 100000

using namespace std;
typedef pair<llong, llong> ipair;
llong modulo(llong left, llong right) { return (left % right + right) % right; }

int N;
vector<int> losers[MAX_N];

int solve(int player) {
    vector<int> children;
    for(int i = 0; i < losers[player].size(); ++i)
        children.push_back(solve(losers[player][i]));
    
    sort(children.begin(), children.end());

    int depth = 0;
    for(int i = 1; i <= children.size(); ++i) {
        depth = max(depth, i + children[children.size() - i]);
    }

    return depth;
}

int main(int argc, char **argv) {
    cin >> N;
    for(int i = 1; i < N; ++i) {
        int a;
        cin >> a;
        losers[a - 1].push_back(i);
    }
    
    cout << solve(0) << endl;
}

Measured memory_bytes: 13568
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus >= 201703L
#        pragma GCC target("avx2")
#    else
#        pragma GCC target("avx")
#    endif

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

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

    Int H, W;
    cin >> H >> W;
    vector<string> field(H);
    for (int i = 0; i < H; i++) {
        cin >> field[i];
    }

    bool ans = true;

    for (int h = 0; h < H; h++) {
        for (int w = 0; w < W; w++) {
            if (field[h][w] == '.') {
                continue;
            }

            bool isOK = false;
            for (int l = 0; l < 4; l++) {
                int nh, nw;
                nh = h + dy[l];
                nw = w + dx[l];

                if (nh < 0 || nw < 0 || H <= nh || W <= nw) {
                    continue;
                }

                if (field[nh][nw] == '#') {
                    isOK = true;
                }
            }
            if (!isOK) {
                ans = false;
            }
        }
    }

    if (ans) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import math
n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

def p1(x, y, n):
    D = []
    for i in range(n):
        D.append(abs(x[i] - y[i]))
    return sum(D)

def p2(x, y, n):
    D = []
    for i in range(n):
        D.append(abs(x[i] - y[i]))
        D[i] *= D[i]
    Sum = sum(D)
    return math.sqrt(Sum)

def p3(x, y, n):
    D = []
    for i in range(n):
        D.append(abs(x[i] - y[i]))
        D[i] = D[i] * D[i] * D[i]
    Sum = sum(D)
    return math.pow(Sum, 1 / 3)

def pX(x, y, n):
    D = []
    for i in range(n):
        D.append(abs(x[i] - y[i]))
    return max(D)

print('{:6f}'.format(p1(x, y, n)))
print('{:6f}'.format(p2(x, y, n)))
print('{:6f}'.format(p3(x, y, n)))
print('{:6f}'.format(pX(x, y, n)))



Measured memory_bytes: 5712
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <utility>

using namespace std;

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

int main () {
    string S;
    cin >> S;
    string res = (S=="ABC") ? "ARC" : "ABC";
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3016
n, w = map(int, input().split())

w_list = [0] * n
v_list = [0] * n
for i in range(n):
    w_list[i], v_list[i] = map(int, input().split())
v_max = sum(v_list)
dp = [10 ** 9 + 1] * (v_max + 1)

for i, v in enumerate(v_list):
    for j in range(v_max, 0, - 1):
        x = dp[j] + w_list[i]
        if x <= w and x < dp[j + v]:
            dp[j + v] = x
    dp[v] = min(dp[v], w_list[i])

for v in range(v_max, -1, -1):
    if dp[v] <= w:
        print(v)
        quit()

Measured memory_bytes: 68776
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int[] num = new int[n];
    for(int i = 0; i < m; i++) {
      int a = sc.nextInt() - 1;
      int b = sc.nextInt() - 1;
      if(a == 0) num[b]++;
      if(b == (n - 1)) num[a]++;
    }
    String ans = "IMPOSSIBLE";
    for(int i = 0; i < n; i++) {
      if(num[i] > 1) ans = "POSSIBLE";
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 93992
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
#define REP(i, x, y) for(ll i = x; i < y; i++)
#define PER(i, x, y) for(ll i = x; i > y; i--)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-11;

int main() {
    string S;
    cin >> S;
    ll len = S.size();
    ll ans = 0;
    ll num = 0;
    PER(i, len - 1, -1) {
        if (S[i] == 'B') {
            ans += (len - 1 - i - num);
            num++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 640
using namespace std;
#include <bits/stdc++.h>
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
void solve()
{
char c;
cin>>c;
if(c>=97)
cout<<"a"<<endl;
else
cout<<"A"<<endl;
}
int main()
{

FASTIO
 long long int t;
 t=1;
 while(t--)
  solve();
  return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define PI 3.141592653589793
#define MOD 1000000007
typedef long long ll;
typedef long double ld;

#define rep(i, n) for (int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()

int main() {
    string s;
    cin >> s;
    ll n=s.size();
    vector<ll>num(n,0);
    for(ll i=0;i<n-1;i++){
        if(s[i]=='R'&&s[i+1]=='L'){
            for(ll j=i;j>=0&&s[j]=='R';j--){
                num[i+((i-j)%2)]++;
            }
            for(ll j=i+1;j<n&&s[j]=='L';j++){
                num[i+((j-i)%2)]++;
            }
        }
    }
    for(ll i=0;i<n;i++){
        cout << num[i] << " ";
    }
}

Measured memory_bytes: 4216
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
   
struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};
   
typedef struct node * NodePointer;
   
NodePointer nil;
   
NodePointer listSearch(int key){
  NodePointer a;
     
  a = nil->next;
     
  while(a!= nil && a->key != key)
    {
      a = a->next;
    }
  return a;
     
}
   
void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}
   
void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}
   
void deleteNode(NodePointer t){
  if ( t == nil ) return;
  t->prev->next = t->next;
  t->next->prev = t->prev;
   
}
   
void deleteFirst(){
  deleteNode(nil->next);
}
   
void deleteLast(){
  deleteNode(nil->prev);
}
   
void delete(int key){
  NodePointer a;
   
  if((a = listSearch(key))!=NULL)
    {     
      deleteNode(a);
    } 
}
   
   
void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;
   
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
     
}
   
int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
    if ( com[6] == 'F' ) deleteFirst();
    else if ( com[6] == 'L' ) deleteLast();
      } else {
    delete(key); nd++; 
      }
      size--;
    }
  }
   
  printList();
  return 0;
}

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


int main(int argc, char const *argv[])
{
    int r, d, x;
    scanf("%d", &r);
    scanf("%d", &d);
    scanf("%d", &x);

    for(int i=2001; i < 2011; i++){
        x = r * x - d;
        printf("%d\n", x);
    }
    
    return 0;
} 



Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <cstdio>
#include <numeric>
#include <queue>

using namespace std;

unsigned long long N, M;
vector<unsigned long long> a;

int H, W;
int maze[20][20];

#define INF 10000000

bool bound(int y, int x)
{
    return !(x < 0 || x >= W || y < 0 || y >= H);
}

int calc(int sy, int sx)
{
    int m[20][20], score[20][20];
    for(int y = 0;y < H;y++)
    {
        for(int x = 0;x < W;x++)
        {
            score[y][x] = INF;
            m[y][x] = maze[y][x];
        }
    }
    int maxd = 0;
    queue<pair<int, int> > q;
    q.push(make_pair(sy, sx));
    score[sy][sx] = 0;

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

    while(!q.empty())
    {
        pair<int, int> c = q.front();
        q.pop();
        int cy = c.first;
        int cx = c.second;
        int d = score[cy][cx];
        for(int i = 0;i < 4;i++)
        {
            int ny = cy + dy[i];
            int nx = cx + dx[i];
            if(bound(ny, nx) && m[ny][nx] == 0 && score[ny][nx] == INF)
            {
                score[ny][nx] = d+1;
                q.push(make_pair(ny, nx));
            }
        }
    }
    for(int y = 0;y < H;y++)
    {
        for(int x = 0;x < W;x++)
        {
            if(m[y][x] == 0)
            {
                maxd = max(maxd, score[y][x]);
            }
        }
    }
    return maxd;
}

int main()
{
    cin >> H >> W;
    for(int y = 0;y < H;y++)
    {
        string s;
        cin >> s;
        for(int x = 0;x < W;x++)
        {
            maze[y][x] = s[x] == '.' ? 0 : 1;
        }
    }
    
    int ans = 0;
    for(int y = 0;y < H;y++)
    {
        for(int x = 0;x < W;x++)
        {
            if(maze[y][x] == 0)
            {
                ans = max(ans, calc(y, x));
            }
        }
    }
    cout << ans << endl;
    
    return 0;
}


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

int main()
{
    int numa, numb;
    cin >> numa >> numb;
    for(int i=0;i<numa*2-2;i++){
        cout << numb-numa+1+i << " ";
    }
    cout << numb + numa - 1 << endl;
    return 0;
}

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

vector<int>x[2502], y[2502];
int d[2502][2502];
int p;

int main() {
	int w, h;
	while (scanf("%d%d", &w, &h), w) {
		rep(i, 2502) {
			x[i].clear(); y[i].clear();
		}
		p = 1;//s->0,g->p
		int gx, gy;
		rep(i, h) {
			rep(j, w) {
				string s; cin >> s;
				if (s == ".");
				else if (s == "S")
					x[0].push_back(i), y[0].push_back(j);
				else if (s == "G")gx = i, gy = j;
				else {
					int d = stoi(s); p = max(p, d + 1);
					x[d].push_back(i); y[d].push_back(j);
				}
			}
		}
		x[p].push_back(gx); y[p].push_back(gy);
		memset(d, 0x3f, sizeof(d));
		d[0][0] = 0;
		for (int i = 1; i <= p; i++) {
			rep(j, x[i].size()) {
				rep(k, x[i - 1].size()) {
					d[i][j] = min(d[i][j], d[i - 1][k] + abs(x[i - 1][k] - x[i][j]) + abs(y[i - 1][k] - y[i][j]));
				}
			}
		}
		printf("%d\n", d[p][0]);
	}
}

Measured memory_bytes: 28004
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

s = input()
n = len(s)
c = Counter(s)
cnt = 0
for key,value in c.items():
    if value >= 2:
        cnt += value*(value-1)//2
print(n*(n-1)//2 - cnt + 1)


Measured memory_bytes: 65772
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int main(void)
{
	int i,k,j,data[7],wk,flg,da[100][7],l,f,n,ii,jj;
	scanf("%d",&n);
	for(i=0;i<n;i++)	{
		for(j=1;j<=6;j++)	scanf("%d",&da[i][j]);
	}
	flg=0;
	for(ii=0;ii<n-1;ii++)	{
		for(jj=ii+1;jj<n;jj++)	{
			for(i=1;i<=6;i++)	data[i]=da[ii][i];
			for(i=0;i<4;i++)	{
				wk=data[1];
				data[1]=data[2];
				data[2]=data[6];
				data[6]=data[5];
				data[5]=wk;
				for(j=0;j<4;j++)	{
					wk=data[1];
					data[1]=data[4];
					data[4]=data[6];
					data[6]=data[3];
					data[3]=wk;
					for(k=0;k<4;k++)	{
						wk=data[2];
						data[2]=data[3];
						data[3]=data[5];
						data[5]=data[4];
						data[4]=wk;
						f=1;
						for(l=1;l<=6;l++)	{
							if(data[l]!=da[jj][l])	{
								f=0;	break;
							}
						}
						if(f==1)	{
							flg=1;
							j=4;	k=4;	i=4;
						}
					}
				}
			}
		}
	}
	if(flg==1)	printf("No\n");
	else printf("Yes\n");
	return 0;
}


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

6 7
1 2
2 3
5 3
2 6
5 1
3 4
4 6

*/
int recursiveLongestPath(map<int, vector<int>>& ma, int s){
    if(ma[s].size() == 0)
        return 0;
    int mxm = 0;
    for(auto x:ma[s]){
        int cur = 1 + recursiveLongestPath(ma, x);
        mxm = max(mxm, cur);
    }
    return mxm;
}
int memoLongestPath(map<int, vector<int>>& ma, int s, vector<int>& dp){
    if(dp[s] != -1)
        return dp[s];

    if(ma[s].size() == 0){
        dp[s] = 0;
        return dp[s];
    }
    int mxm = 0;
    for(auto x:ma[s]){
        int cur = 1 + memoLongestPath(ma, x, dp);
        mxm = max(mxm, cur);
    }

    return dp[s] = mxm;

}

int main(){
    map<int, vector<int>> ma;
    int n,m;
    cin>>n>>m;
    int x,y;
    for(int i=0; i<m; i++){
        cin>>x>>y;
        ma[x].push_back(y);
    }
    // int mxm = 0;
    // for(int i=1; i<=n; i++){
    //     mxm = max(mxm, recursiveLongestPath(ma, i));
    // }
    // cout<<"The length of the Longest Path(Recursive Implementation) is "<<mxm<<endl;
    vector<int> dp(n+1, -1);
    int mxm = 0;
    for(int i=1; i<=n; i++){
        mxm = max(mxm, memoLongestPath(ma, i, dp));
    }
    // cout<<"The length of the Longest Path(Memoization Implementation) is "<<mxm<<endl;
    cout<<mxm<<endl;
    return 0;
}


Measured memory_bytes: 18500
import itertools
import numpy as np
import copy

N, M, X = map(int, input().split())
CA = [list(map(int, input().split())) for _ in range(N)]
CA = np.array(CA)

ans = 10 ** 7
for i in itertools.product([0, 1], repeat=N):
    tCA = copy.copy(CA)
    for j in range(N):
        if i[j] == 0:
            tCA[j] = np.zeros(CA.shape[1])
    s = np.sum(tCA, axis=0)
    l = sum(k >= X for k in s[1:])
    if s[0] < ans and l == M:
        ans = s[0]

if ans == 10 ** 7:
    print(-1)
else:
    print(ans)


Measured memory_bytes: 27216
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <cassert>
#include <unordered_map>
#include <iomanip>

#define _(x) { cout << #x << " = " << x << " "; }

const double E = 1e-8;
const double PI = acos(-1);

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int r;
    cout << setprecision(20) << fixed;
    cin >> r;
    cout << 2 * PI * r << '\n';
    return 0;
}



Measured memory_bytes: 3800
fun main(args: Array<String>) {
    val (x1, y1, x2, y2) = readLine()!!.split(' ').map { it.toDouble() }
    val s = T1B.Segment(T1B.Point(x1, y1), T1B.Point(x2, y2))
    val q = readLine()!!.toInt()
    repeat(q) {
        val (x, y) = readLine()!!.split(' ').map { it.toDouble() }
        val p = T1B.Point(x, y)
        println(p.reflect(s))
    }
}

private class T1B {

    data class Point(val x: Double, val y: Double) {

        fun dot(p: Point): Double {
            return x * p.x + y * p.y
        }

        fun norm(): Double {
            return x * x + y * y
        }

        fun project(s: Segment): Point {
            val base = s.p2 - s.p1
            val r = (this - s.p1).dot(base) / base.norm()
            return s.p1 + base * r
        }

        fun reflect(s: Segment): Point {
            return this + (project(s) - this) * 2.0
        }

        operator fun plus(p: Point): Point {
            return Point(x + p.x, y + p.y)
        }

        operator fun minus(p: Point): Point {
            return Point(x - p.x, y - p.y)
        }

        operator fun times(r: Double): Point {
            return Point(x * r, y * r)
        }

        override fun toString(): String {
            return "$x $y"
        }

    }

    data class Segment(val p1: Point, val p2: Point)

}



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

int main(){
  for (int i = 0; i < 10000; i++) {
    int x;
    cin >> x;
    if (x == 0) {
      break;
    }
    cout << "Case " << i+1 << ": " << x << endl;
  }
}


Measured memory_bytes: 3088
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <complex>

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

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

	int n, m;
	cin >> n >> m;
	vector<int> a(m);
	vector<int> b(m);
	vector<int> c(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i] >> b[i];
		for (int j = 0; j < b[i]; j++) {
			int cc;
			cin >> cc;
			c[i] += (1 << (cc - 1));
		}
	}
	vector<int> dp(1 << n, INT_MAX);
	dp[0] = 0;
	for (int i = 0; i < dp.size(); i++) {
		if (dp[i] == INT_MAX) continue;
		for (int j = 0; j < m; j++) {
			dp[i | c[j]] = min(dp[i | c[j]], dp[i] + a[j]);
		}
	}
	if (dp.back() == INT_MAX) cout << -1;
	else cout << dp.back();

	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.List;
import java.util.StringTokenizer;

public class Main {
	
	static class Reconstruction {
		
		static int n;
		static List<Integer> preorder, inorder, postorder;
		static int pos;
		
		public void reconstruction (InputReader ir) {
			
			n = ir.nextInt();
			
			preorder = new ArrayList<>();
			inorder = new ArrayList<>();
			postorder = new ArrayList<>();
			
			for (int i = 0; i < n; i++) {
				preorder.add(ir.nextInt());
			}
			for (int i = 0; i < n; i++) {
				inorder.add(ir.nextInt());
			}
			
			pos = 0;
			Postorder (0, n);
			
			StringBuilder sb = new StringBuilder ();
			sb.append(postorder.get(0));
			
			for (int i = 1; i < n; i++) sb.append(" ").append(postorder.get(i));
			
			System.out.println(sb);
			
		}
		
		static void Postorder (int i, int n) {
			
			if (i >= n) return;
			
			int root = preorder.get(pos++);
			int m = inorder.indexOf(root);
			
			Postorder (i, m);
			Postorder (m + 1, n);
			
			postorder.add(root);
			
		}
	}
	
	static class InputReader {
		BufferedReader br;
		StringTokenizer st;
		
		public String nextString() {
			
			 while (!st.hasMoreTokens()) {
	                try {
	                    st = new StringTokenizer(br.readLine(), " ");
	                } catch (IOException e) {
	                    throw new InputMismatchException();
	                }
	            }
			return st.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(nextString());
		}
					
		public InputReader (InputStream inputStream) {
			br = new BufferedReader (new InputStreamReader (inputStream));
			st = new StringTokenizer ("");
		}
		
	}
	
	public static void main (String[] args) {
		InputStream inputStream = System.in;
		InputReader in = new InputReader (inputStream);
		Reconstruction obj = new Reconstruction();
		obj.reconstruction(in);
	}
	
	
}



Measured memory_bytes: 24468
#include <iostream>

using namespace std;

int main(){

  int w,h,x,y,r;

  cin >>w >> h >> x >> y >> r;

  if( x-r<0 || x+r>w || y+r>h || y-r<0)
    cout << "No"<<endl;
  else
    cout <<"Yes"<<endl;

  return 0;

}

Measured memory_bytes: 3100
#include<iostream>
using namespace std;
int main(){
	int i=0,c=0;
	string str;
    cin>>str;
	for(i;i<str.length()/2;i++){
	if(str[i]!=str[str.length()-1-i]){
		c++;
	  }
	}
    cout<<c;
	return 0;
}

Measured memory_bytes: 256
# 056_a
a, b = input().split()
if (a == 'H' or a == 'D') and (b == 'H' or b == 'D'):
    if a == 'H':
        if b=='H':
            print('H')
        else:
            print('D')
    if a == 'D':
        if b=='H':
            print('D')
        else:
            print('H')


Measured memory_bytes: 8876
#include<bits/stdc++.h> 
using namespace std;
int main()
{
	int a,b,c;
  	cin>>a>>b>>c;
    if((10*b+c)%4==0)
    {
    	cout<<"YES";
	}
    else
    {
    	cout<<"NO";
	}
    return 0;
}


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

struct{
	float x,y;
}typedef Vertex;

void koch(int n,Vertex p1,Vertex p2){
	if(n == 0)
		return;
	Vertex s;
	Vertex u;
	Vertex t;
	s.x = (2.0 * p1.x + p2.x) / 3.0;
	s.y = (2.0 * p1.y + p2.y) / 3.0;
	t.x = (p1.x + 2.0 * p2.x) / 3.0;
	t.y = (p1.y + 2.0 * p2.y) / 3.0;
	float rad = 60 * M_PI / 180.0;
	u.x = (t.x - s.x) * cos(rad) - (t.y - s.y) * sin(rad) + s.x;
	u.y = (t.x - s.x) * sin(rad) + (t.y - s.y) * cos(rad) + s.y;
	koch(n - 1,p1,s);
	cout << s.x << " " << s.y << endl;
	koch(n - 1,s,u);
	cout << u.x << " " << u.y << endl;
	koch(n - 1,u,t);
	cout << t.x << " " << t.y << endl;
	koch(n - 1,t,p2);
}

int main(){
	int n;
	cin >> n;
	Vertex a,b;
	a.x = 0;
	a.y = 0;
	b.x = 100;
	b.y = 0;
	cout << a.x << " " << a.y << endl;
	koch(n,a,b);
	cout << b.x << " " << b.y << endl;
	return 0;
}


Measured memory_bytes: 3272
n = int(input())
h = list(map(int,input().split()))
tmp = [0 for i in range(n)]
ans = 0
right = 0
left = n-1

while tmp != h:
    for i in range(n):
        if tmp[i] != h[i]:
            right = i
            left = i
            break
    for i in range(i+1,n):
        if tmp[i] == h[i]:
            left = i-1
            break
        elif i == n-1 and tmp[n-1] != h[n-1]:
            left = n-1
            break
    for i in range(right,left+1):
        tmp[i] += 1
    ans += 1
#    print(right,left,ans)
#    print(tmp)

print(ans)


Measured memory_bytes: 9156
#include<bits/stdc++.h>
using namespace std;
template<typename T>
inline void read(T &x)
{
	x=0;
	int f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=getchar();
	x*=f;
	return;
}
template<typename T>
void write(T x)
{
	if(x<0) putchar('-'),x=-x;
	if(x>=10) write(x/10);
	putchar(x%10+'0');
	return;
}
int n,m;
bool book[100010];
int num[100010]; 
int ans1,ans2;
int main()
{
	ios::sync_with_stdio(false);
	memset(book,0,sizeof(book)); 
	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		int id;
		string s;
		cin>>id>>s;
		if(!book[id])
		{
			if(s=="AC") ans1++,book[id]=1,ans2+=num[id];
			else num[id]++;
		}
	}
	cout<<ans1<<" "<<ans2<<endl;
	return 0;
}


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

#define mp make_pair
#define pb push_back
#define x first
#define y second
#define DEBUG(x) cout << #x << " = " << x << endl;

using namespace std;

typedef long long LL;
typedef unsigned long long ull;
typedef pair<int, int> pii;

const int inf = INT_MAX;
const LL INF = LLONG_MAX;

template <typename T> inline T read ()
{
	T sum = 0, fl = 1; char ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') fl = -1;
	for (; isdigit(ch); ch = getchar()) sum = (sum << 3) + (sum << 1) + ch - '0';
	return sum * fl;
}

const int maxn = 3000 + 5;

int N;
int A[maxn];

int c;
int he[maxn], ne[maxn << 1], to[maxn << 1];

inline void add_edge (int x, int y) 
{ 
	ne[++c] = he[x]; he[x] = c; to[c] = y; 
	ne[++c] = he[y]; he[y] = c; to[c] = x; 
}

bool chk (int p, int f) 
{
	int cnt = 0, win = 0;
	for (int i = he[p]; i; i = ne[i])
		if (A[to[i]] < A[p]) win |= chk (to[i], p) ^ 1, ++cnt;

	return cnt == 0 ? 0 : win;
}

inline void solve ()
{
	for (int i = 1; i <= N; ++i) 
		if (chk (i, 0)) printf ("%d ", i);
}

inline void input ()
{
	N = read<int>();
	for (int i = 1; i <= N; ++i) A[i] = read<int>();
	for (int i = 1; i < N; ++i) add_edge (read<int>(), read<int>());
}

int main ()
{

	input ();
    solve ();

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define M 1000000007
typedef long long ll;
int main() { 
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll t,a[1000000],n,i;
    string s;
    map <string,int> mp;
    mp["SAT"]=1;
    mp["FRI"]=2;
    mp["THU"]=3;
    mp["WED"]=4;
    mp["TUE"]=5;
    mp["MON"]=6;
    mp["SUN"]=7;
    cin>>s;
    cout<<mp[s];
    return 0;
}

Measured memory_bytes: 256
import sys

def main():
    def input():
      return sys.stdin.readline().rstrip()
    
    N = int(input())
    t = [0] * (N+1)
    x = [0] * (N+1)
    y = [0] * (N+1)
    for i in range(1, N+1):
        t[i], x[i], y[i] = map(int, input().split())
    
    flag = True
    for i in range(N):
        dt = t[i+1] - t[i]
        dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
        if dt % 2 != dist % 2 or dt < dist:
            flag = False
            break
            
    print('Yes' if flag else 'No')
    
    

if __name__ == '__main__':
    main()

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

int main() {
  	int N;
  	cin >> N;
  
  	vector<int> H(N);
  	for ( int i = 0 ; i < N ; i++ ){
      cin >> H.at(i);
    }
  
  	int count = 0;
  	for ( int i = N-1 ; i > 0 ; i-- ){
      	for ( int j = i-1 ; j >= 0 ; j-- ){
    		if( H.at(i) - H.at(j) < 0 ){
          		count++;
              	break;}
        }
    }  
  	cout << N - count << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<string.h>
using namespace std;
int main()
{
	string a,b;
	cin>>a>>b;
	int len1=a.size();
	int len2=b.size();
	if(len1>len2)
	{
		for(int i=0;i<len2;i++)
		{
			cout<<a[i]<<b[i];
		}
		for(int i=len2;i<len1;i++)
		{
			cout<<a[i];
		}
		cout<<endl;
	}
	else
	{
		for(int i=0;i<len1;i++)
		{
			cout<<a[i]<<b[i];
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int n, m, a;
    cin >> n >> m;
    for(int i = 0; i < m; i++)
    {
        cin >> a;
        n = n - a;
    }
    if(n >= 0)
        cout << n;
    else cout << -1;
    return 0;
}

Measured memory_bytes: 3596
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	long X;
	Map<Integer, Long> map;
	int A, B;

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	long pow(int val) {
		long v = (long) val;
		return v * v * v * v * v;
	}

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		X = Long.parseLong(tokens[0]);
		map = new HashMap<>();
		for (int i = -200; i <= 200; ++i) {
			long val = pow(i);
			map.put(i, val);
		}
	}

	void calc() {
		List<Integer> keys = new ArrayList<>();
		keys.addAll(map.keySet());
		for (int i = 0; i < keys.size(); ++i) {
			long aPow = map.get(keys.get(i));
			for (int j = 0; j < keys.size(); ++j) {
				long bPow = map.get(keys.get(j));
				if (aPow - bPow == X) {
					A = keys.get(i);
					B = keys.get(j);
					return;
				}
			}
		}
	}

	void showResult() {
		System.out.println(A + " " + B);
	}
}

Measured memory_bytes: 36840
# https://atcoder.jp/contests/abc117/tasks/abc117_c

n, m = map(int, input().split())
nums = [int(i) for i in input().split()]

if n >= m:
    print(0)
else:
    nums.sort()
    dist = []
    total = 0
    for i in range(m - 1):
        d = nums[i + 1] - nums[i]
        dist.append(d)
        total += d
    dist.sort(reverse=True)

    for i in range(n - 1):
        total -= dist[i]
    print(total)

Measured memory_bytes: 57384
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const double PI=3.14159265358979323846;
const int64_t waru = 1000000007;
using in = int64_t;

in cnt5(in n,in c5){
  in wa = n/c5;
  return wa/2ll;
}
 
int main(){
in n;
  cin>>n;
  if(n%2ll==1ll){
     cout<<0<<endl;
    return 0;
  }
  
in c5=5ll; 
  in ans=0ll;
  while(n>=c5){
    ans += cnt5(n,c5);
    if(c5>200000000000000000ll) break;
    c5 *= 5ll;
  }
  
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

//Lattice Practices
public class Main{

	String[] s;
	String[] rev;
	char[][] m;
	boolean[] u;
	Set<String> set;
	int c = 0;

	char[][] rotate(char[][] t){
		char[][] r = new char[5][5];
		for(int i=0;i<5;i++)for(int j=0;j<5;j++)r[i][j] = t[4-j][i];
		return r;
	}

	char[][] mirror(char[][] t){
		char[][] r = new char[5][5];
		for(int i=0;i<5;i++)for(int j=0;j<5;j++)r[i][j] = t[4-i][j];
		return r;
	}

	String get(char[][] t){
		StringBuilder sb = new StringBuilder();
		for(int i=0;i<5;i++)for(int j=0;j<5;j++)sb.append(t[i][j]);
		return sb.toString();
	}

	boolean match(String a, String b){
		for(int i=0;i<5;i++)if(a.charAt(i)==b.charAt(i))return false;
		return true;
	}

	int x = 0;

	void f(int k){
		if(k==5){
			String[] v = new String[5];
			for(int j=0;j<5;j++){
				char[] t = new char[5];
				for(int i=0;i<5;i++)t[i]=m[i][j];
				v[j] = new String(t);
			}
			boolean[] w = new boolean[10];
			char[][] f = new char[5][5];
			for(int i=0;i<5;i++){
				boolean match = false;
				for(int j=0;j<10;j++){
					if(u[j]||w[j])continue;
					if(match(v[i], s[j])){
						w[j] = true;
						match = true;
						f[i] = s[j].toCharArray();
						break;
					}
					else if(match(v[i], rev[j])){
						w[j] = true;
						match = true;
						f[i] = rev[j].toCharArray();
						break;
					}
				}
				if(!match)return;
			}
			String ans = get(m);
			if(!set.contains(ans)){
				c++;
				set.add(ans);
				set.add(get(mirror(m)));
				set.add(get(rotate(rotate(m))));
				set.add(get(mirror(rotate(rotate(m)))));
				set.add(get(f));
				set.add(get(mirror(f)));
				set.add(get(rotate(rotate(f))));
				set.add(get(mirror(rotate(rotate(f)))));
			}
			return;
		}
		for(int i=0;i<10;i++){
			if(!u[i]){
				u[i] = true;
				m[k] = s[i].toCharArray();
				f(k+1);
				if(!s[i].equals(rev[i])){
					m[k] = rev[i].toCharArray();
					f(k+1);
				}
				u[i] = false;
			}
		}
	}

	void run(){
		Scanner sc = new Scanner(System.in);
		while(true){
			s = sc.nextLine().split(" ");
			if(s.length==1)break;
			rev = new String[10];
			for(int i=0;i<10;i++){
				StringBuilder sb = new StringBuilder(s[i]);
				rev[i] = sb.reverse().toString();
			}
			u = new boolean[10];
			m = new char[5][5];
			c = 0;
			set = new HashSet<String>();
			f(0);
			System.out.println(c);
		}
	}

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

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll mod= 1e9 + 7;




int N, M;  //N頂点M辺
vector<int> visited;
vector<vector<int>> G;
ll ans=0,kk=0;

void dfs(int now){
    visited[now] = 1;
    kk++;
    for(int next : G[now]){
        if(!visited[next]){dfs(next);}
    }
}


int main() {
    cin >> N >> M;
    G = vector<vector<int>>(N); // サイズを確保する
    visited = vector<int>(N, 0); // 全頂点を「未訪問」に初期化
    for(int i=0; i<M; i++){
        int a, b;
        cin >> a >> b;
        // 頂点番号を 0-indexed とする
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    rep(i,N){
    kk=0;
    dfs(i);
    chmax(ans,kk);
    }
    cout << ans <<endl;

}

Measured memory_bytes: 21136
#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.at(i);
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  int sum1=0;
  int sum2=0;
  for (int i=0;i<N;i++){
    if (i%2==0){
      sum1+=a.at(i);
    }
    else{
      sum2+=a.at(i);
    }
  }
  cout<<sum1-sum2<<endl;
}


Measured memory_bytes: 256
import           Control.Monad (replicateM)
import           Data.List     (foldl')

main :: IO ()
main = do
  s <- getLine
  q <- readLn
  qs <- replicateM q getQuery
  putStrLn $ solve s qs

data Query = Reverse | Cons Char | Snoc Char

getQuery :: IO Query
getQuery = do
  (t:xs) <- words <$> getLine
  return $ case t of
    "1" -> Reverse
    "2" -> let [f, c] = xs in case f of
      "1" -> Cons $ head c
      "2" -> Snoc $ head c

solve :: String -> [Query] -> String
solve s qs = toList $ foldl' g (fromList s) qs
  where g xs Reverse  = rev xs
        g xs (Cons c) = cons c xs
        g xs (Snoc c) = snoc xs c

data DoubleList a = DoubleList [a] [a]

fromList :: [a] -> DoubleList a
fromList xs = DoubleList xs []

toList :: DoubleList a -> [a]
toList (DoubleList xs ys)  = xs ++ reverse ys

rev :: DoubleList a -> DoubleList a
rev (DoubleList xs ys) = DoubleList ys xs

cons :: a -> DoubleList a -> DoubleList a
cons x (DoubleList xs ys) = DoubleList (x:xs) ys

snoc :: DoubleList a -> a -> DoubleList a
snoc (DoubleList xs ys) x = DoubleList xs (x:ys)


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

const ll MAX = 510000;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	ll N,K;
	cin>>N>>K;

    COMinit();

    for(ll i=1;i<=K;i++){
        ll ans = 1;
        ll blue_n,red_n;
        if(i==1){
            blue_n = 1;
        }else{
            blue_n = COM(K-i+(i-1),i-1);
        }
        red_n = COM(N-K+i-(i-1),i);
        ans = blue_n*red_n%MOD;
        if(ans<0) ans +=MOD;
        // cout<<blue_n<<" "<<red_n<<"\n";
        cout<<ans<<"\n";
    }
	
	
	return 0;
}

Measured memory_bytes: 12288
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine();

            var wCount = 0;
            var eCount = 0;
            var wArray = new int[N];
            var eArray = new int[N];

            for (var i = 0; i < N; i++)
            {
                if (S[i] == 'W')
                {
                    wCount++;
                    wArray[i] = wCount;
                    eArray[i] = eCount;
                }
                else
                {
                    eCount++;
                    eArray[i] = eCount;
                    wArray[i] = wCount;
                }
            }

            var left = 0;
            var right = 0;
            var min = int.MaxValue;

            for (var i = 0; i < N; i++)
            {
                if (i == 0)
                    left = 0;
                else
                    left = wArray[i - 1];
                right = eCount - eArray[i];
                min = Math.Min(left + right, min);
            }

            Console.WriteLine(min);
        }
    }
}

Measured memory_bytes: 14432
// Vicfred
// https://atcoder.jp/contests/abc168/tasks/abc168_b
// implementation
import std.conv;
import std.stdio;
import std.string;

void main() {
    int K = readln.chomp.to!int;
    string S = readln.strip;

    if(S.length > K) {
        S[0..K].write;
        "...".writeln;
    } else {
        S.writeln;
    }
}


Measured memory_bytes: 2684
import numpy as np
N,D = map(int,input().split())
XD = [list(map(int,input().split()))  for i in range(N)]
dis = 0
count = 0
for i in range(N):
    for j in range(N-i):
        if j == 0:
            continue
        for k in range(D):
            dis += (abs(XD[i][k]-XD[j+i][k]))**2
        if int(np.sqrt(dis)) == np.sqrt(dis):
            count += 1
        dis = 0

print(count)


Measured memory_bytes: 12428
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)

void solve(){
  int k, s;
  cin >> k >> s;
  int ans = 0;
  FOR(i,0,k+1){
    FOR(j,0,k+1){
      if(s-i-j<=k && s-i-j>=0) ++ans;
    }
  }
  cout << ans << endl;
}

int main(void){
  solve();
  return 0;
}

Measured memory_bytes: 256
from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math
import random
J=int(1e9)+7

###############################################################################\n=17
X=[False]*(10**6+1)
P=[]
for i in range(2,len(X)):
    if X[i] is False:
        for j in range(2*i,len(X),i):
            X[j]=True
for i in range(2,len(X)):
    if X[i] is False:
        P.append(i)


n=int(input())
A=INPUT()
ans=0
V=[0]*(10**6+1)
for i in range(n):
    ans=math.gcd(ans,A[i])
    V[A[i]]+=1
if ans==1:
    bool=True
    for i in range(2,10**6+1):
        if V[i]>=2:
            bool=False
            break
    if bool:
        for ele in P:
            c=0
            for i in range(ele,10**6+1,ele):
                if V[i]>0 and i%ele==0:
                    c+=1
            if c>1:
                bool=False
                break
        if bool:
            print("pairwise coprime")
        else:
            print("setwise coprime")
    else:
        print("setwise coprime")
else:
    print("not coprime")


Measured memory_bytes: 208436
package main

import (
	"fmt"
)

func main() {
	var n,k,q int
	fmt.Scan(&n,&k,&q)

	points := make([]int,n)
	for i := 0; i < n; i++ {
		points[i] = k
	}

	for i := 0; i < q; i++ {
		var winner int
		fmt.Scan(&winner)
		points[winner - 1]++
	}

	for _,point := range points {
		point -= q
		if point > 0 {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}
}

Measured memory_bytes: 5888
n,k = gets.chomp.split(" ").map(&:to_i)

d = []
a = []
k.times { |i|
  d[i] = gets.chomp.to_i
  a[i] = gets.chomp.split(" ").map(&:to_i)
}

newN = Array.new

count = 0
for j in 0...k do
  for k in 0...d[j] do
    newN[a[j][k]] = 0
  end
end

for l in 1..n do
  if(newN[l] == nil)
    count += 1
  end
end

puts count

Measured memory_bytes: 14260
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
#define endl "\n"
using namespace std;

constexpr int inf = 2147483647;
constexpr int64_t inf64 = 9223372036854775807;
constexpr int mod = 1e9+7;

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

  vector<vector<int>> info(3, vector<int> (3));
  rep(i,3) rep(j,3) cin >> info[i][j];

  vector<int> a(3);
  vector<int> b(3);
  a[0] = 0;

  bool flag = true;
  rep(i,3) b[i] = info[0][i];
  a[1] = info[1][0] - b[0];
  a[2] = info[2][0] - b[0];

  rep(i,3) {
    rep(j,3) {
      if(info[i][j] != a[i]+b[j]) flag = false;
    }
  }
  YesorNo(flag);
  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

void add(int& x, int y) {
  x = (x + y) % MOD;
}

const int N = 300 + 10;
vector<ii> a[N];
int dp[N][N][N];

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    int L, R, cnt;
    scanf("%d%d%d", &L, &R, &cnt);
    a[R].push_back({L, cnt});
  }
  dp[0][0][0] = 1;
  int ret = 0;
  for (int i = 0; i <= n; ++i) {
    for (int j = i; j <= n; ++j) {
      for (int k = j; k <= n; ++k) {
        bool valid = true;
        for (auto& it : a[k]) {
          int L = it.first, cnt = it.second;
          if ((L <= i && cnt != 3) ||
              (L > i && L <= j && cnt != 2) ||
              (L > j && cnt != 1)) {
            valid = false;
            break;
          }
        }
        if (!valid) dp[i][j][k] = 0;
        if (k == n) {
          add(ret, dp[i][j][k]);
        } else {
          add(dp[j][k][k + 1], dp[i][j][k]);
          add(dp[i][k][k + 1], dp[i][j][k]);
          add(dp[i][j][k + 1], dp[i][j][k]);
        }
      }
    }
  }
  printf("%d\n", ret);
  return 0;
}


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


int main()
{	
	double x1, x2, y1, y2, x, y;
	cin >> x1 >> y1 >> x2 >> y2;	
	x = x2 - x1;
	y = y2 - y1;
	cout << fixed << sqrt(x*x+y*y) << endl;
	return 0;
}


Measured memory_bytes: 3272