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

int main()
{
    int N,A[1000000];
    cin >> N;
    A[0] = 0;
    for(int i=1; i<=N; i++){
        cin >> A[i];
    }
    A[N+1] = 0;
    int sum = 0;
    for(int i=1; i<=N+1; i++){
        sum += abs(A[i] - A[i-1]);
    }
    for(int i=1; i<=N; i++){
        int ans = sum;
        ans = ans - abs(A[i-1]-A[i]) - abs(A[i]-A[i+1]) + abs(A[i-1]-A[i+1]);
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3584
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
        Scanner sc = new Scanner(System.in);
        int k =sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        boolean flag = false;
        for(int i = a;i<=b ; i++) {
        	if(i%k ==0) {
        		flag=true;
        	}}
        	if(flag == true) {
        		System.out.println("OK");
        	}else {
        	System.out.println("NG");       	
        }

	}
}



Measured memory_bytes: 35680
S = list(input())
K = int(input())

if len(set(S)) == 1:
  print(len(S)*K//2)
  exit()
  
if S[0] != S[-1]:
  cnt = 1
  s = S[0]
  l = []
  for i in range(1,len(S)):
    if S[i] == s:
      cnt += 1
    else:
      l.append(cnt//2)
      cnt = 1
      s = S[i]
  l.append(cnt//2)
  print(sum(l)*K)
else:
  cnt = 1
  s = S[0]
  l = []
  for i in range(1, len(S)):    
    if S[i] == s:
      cnt += 1
    else:
      l.append(cnt)
      cnt = 1
      s = S[i]
  l.append(cnt)
  num = l[0]+l[-1]
  ans = (num//2)*(K-1)
  for i in range(len(l)):
    if i == 0 or i == len(l)-1:
      if l[i] > 1:
        ans += l[i]//2
    else:
      ans += (l[i]//2)*K
  print(ans)

Measured memory_bytes: 3064
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 10????????? cout << setprecision(10) << double;
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;

#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//for gcc (???test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// ??\??????push_back(d)???array[d]???????????????1?????§?????????
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN(){T d;cin>>d;return d;}
// ?????§??¬?´???°???Greatest Common Divisor???
LL gcd(LL a, LL b){ return (b > 0) ? gcd(b, a%b) : a; }
// ????°???¬?????°???Least Common Multiple???
LL lcm(LL a, LL b){ return a / gcd(a, b) * b; }

// ------------------- include, typedef, define END. -------------------

int main(){
	FAST_IO;
	// for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;
	bool dbgF = true;

	//??????????????????????????????.
	int a,b,n;
	while(cin>>a>>b>>n){
		double temp = (double)a/b;
		double seisuubu;
		double shosuubu = modf(temp,&seisuubu);

		// string ?????????
		string str_shoshuubu;
		stringstream ss;
		ss << setprecision(12) << shosuubu;
		ss >> str_shoshuubu;
		//cout<< str_shoshuubu << " , ";

		// ?°???°?¬¬i????????????
		int ans=0;
		FOR(i,0,n){
			if((i+2) >= str_shoshuubu.length())
				ans += 0;
			else
				ans += str_shoshuubu.at(i + 2) - '0';
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1308
/* Aditya0412 */
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
#define pb push_back 
#define ve vector
#define vii vector < int >
#define vll vector < ll > 
#define pii pair < int , int >
#define pll pair < ll , ll >
#define vpl vector < pll >
#define fi first
#define all(a)      (a).begin(),(a).end()
#define si(x)       (int)((x).size())
#define debug(x)    cout<<#x<<" is "<<(x)<<endl;cout.flush();  
#define se second 
#define endl        '\n'
#define f(i,a,b)    for(int i=a;i<b;i++)
#define mem(a,x)          memset(a,x,sizeof(a))

// const ll mod=998244353;
const ll mod = 1000000000+7;
const ll N=1000000+6;
#define M_PI           3.14159265358979323846



// === Debug macro starts here ===

int recur_depth = 0;
#ifdef DEBUG
#define dbg(x) {++recur_depth; auto x_=x; --recur_depth; cerr<<string(recur_depth, '\t')<<"\e[91m"<<__func__<<":"<<__LINE__<<"\t"<<#x<<" = "<<x_<<"\e[39m"<<endl;}
#else
#define dbg(x)
#endif
template<typename Ostream, typename Cont>
typename enable_if<is_same<Ostream,ostream>::value, Ostream&>::type operator<<(Ostream& os,  const Cont& v){
    os<<"[";
    for(auto& x:v){os<<x<<", ";}
    return os<<"]";
}
template<typename Ostream, typename ...Ts>
Ostream& operator<<(Ostream& os,  const pair<Ts...>& p){
    return os<<"{"<<p.first<<", "<<p.second<<"}";
}

// === Debug macro ends here ===


void inp(ll *arr,ll n)
{
  for(int i=0;i<n;i++)
    cin>>arr[i];
}
void inp_mat(ll *arr,ll n,ll m)
{
    for(int i=0;i<n;i++)
      for(int j=0;j<m;j++)
        {
          ll x;cin>>x;
          *((arr+i*m) + j)=x;
        }
}
// syntax for inp_mat inp_mat((ll *)arr,n,m);
// int x2[]={+1,-1,+0,+0};
// int y2[]={+0,+0,+1,-1};
// int x2[]={+0,+0,+1,-1,-1,+1,-1,+1};
// int y2[]={-1,+1,+0,+0,+1,+1,-1,-1};
// int x2[]={-2,-2,-1,-1,+1,+1,+2,+2};
// int y2[]={-1,+1,-2,+2,-2,+2,-1,+1};
ll n,k;
vll v;
bool fun(int x)
{
    int c=0;
    f(i,0,n)
    {
        ll y=(v[i]/x);
        if(v[i]%x==0)
        y--;
        c+=y;
    }
    return (c<=k);
}
int main() 
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //  #ifndef ONLINE_JUDGEc
    //   freopen ("INPUT.txt" , "r" , stdin);
    //   freopen ("OUTPUT.txt", "w" , stdout);
    // #endif 
    cin>>n>>k;
    v.resize(n);
    f(i,0,n)
    cin>>v[i];
    ll l=1,r=1000000000;
    ll ans=-1;
    while(l<=r)
    {
      ll mid=(l+r)/2;
      if(fun(mid))
      {
        ans=mid;
        r=mid-1;
      }
      else
      {
        l=mid+1;
      }
      
    }
    cout<<ans;
} 

Measured memory_bytes: 4776
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <numeric>
#include <set>
#include <list>
#include <map>
#include<queue>

const int INF = 1 << 28;
const long long MOD = 1000000007;
using namespace std;
using Graph = vector<vector<int>>;

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

vector<int> seen(50,-1);
int counter_for_dfs = 0;
void dfs(Graph &G, int v) {
	seen[v] = counter_for_dfs;
	counter_for_dfs++;
	for (auto v_next : G[v]) {
		if (seen[v_next]>=0)continue;

		dfs(G, v_next);
	}
}

void bfs(Graph &G) {
	vector<int> dist(G.size(), -1);
	queue<int> que;
	
	dist[0] = 0;
	que.push(0);
	while (!que.empty()) {
		int v = que.front();
		que.pop();

		for (int g : G[v]) {
			if (dist[g] != -1)continue;
			dist[g] = dist[v] + 1;
			que.push(g);
		}
	}
	for (auto i : dist) {
		cout << i << " ";
	}
}

int counter[200005] = {};
void bfs2(Graph &G,int p,int x) {
	vector<int> dist(G.size() , -1);
	queue<int> que;
	
	dist[p] = 0;
	que.push(p);
	while (!que.empty()) {
		int v = que.front();
		que.pop();

		for (int g : G[v]) {
			if (dist[g] != -1)continue;
			dist[g] = dist[v] + 1;
			que.push(g);
			counter[g] += x;
		}
	}
}
long long int gcd(long long int a, long long int b) {
	long long int c = std::min(a, b);
	a = std::max(a, b);
	b = c;
	while (true) {
		c = a % b;
		a = b;
		b = c;
		if (c == 0)break;
	}
	return a;

}
int main()
{
	long long int a, b;
	std::cin >> a >> b;
	long long int c = gcd(a, b);

	long long int counter = 1;

	for (long long int i = 2; i * i < c; i++) {
		if (c%i == 0) {
			counter++;
			while (c%i == 0)c /= i;
		}
	}
	if (c != 1)counter++;

	std::cout << counter;

	return 0;
}

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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

constexpr int INF = 1e9;
constexpr ll INFLL = 1e18;
constexpr int MOD = 1e9 + 7;
const ld PI = acosl(-1);

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

int main(){
    ios::sync_with_stdio(false); cin.tie(nullptr);
    //cout << fixed << setprecision(6);
    string s, t;
    cin >> s >> t;

    int ans = 0;
    rep(i, s.length()-t.length() + 1) {
        int tmp = 0;
        rep(j, t.length()) {
            if (s[j+i] == t[j]) tmp++;
        }
        ans = max(ans, tmp);
    }

    cout << t.length() - ans << endl;
    return 0;
}

Measured memory_bytes: 3644
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
int main()
{
    ll n,m,x;
    cin >> n >> m >> x;
    ll c[n],a[n][m];
    for(ll i = 0;i < n;i++)
    {
        cin >> c[i];
        for(ll j = 0;j < m;j++)
        {
            cin >> a[i][j];
        }
    }
    ll ans = 1e12;
    for(ll bit = 0;bit < (1 << n);bit++)
    {
        ll und[m] = {},cost = 0;
        bool flag = true;
        for(ll i = 0;i < n;i++)
        {
            if(bit & (1 << i))
            {
                for(ll j = 0;j < m;j++)
                {
                    und[j] += a[i][j];
                }
                cost += c[i];
            }
        }
        for(ll j = 0;j < m;j++)
        {
            if(und[j] < x)
            {
                flag = false;
                break;
            }
        }
        if(flag)
        {
            ans = min(ans,cost);
        }
    }
    if(ans != 1e12)
    {
        cout << ans << "\n";
    }
    else
    {
        cout << "-1\n";
    }

    return 0;
}

Measured memory_bytes: 3616
import sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**10
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    n, k = LI()
    Q = [I() for _ in range(n)]

    def can_stack(p):
        s = 0
        truck_num = 1
        for i in Q:
            if s+i<=p:
                s += i
            else:
                truck_num += 1
                s = i
        return truck_num<=k

    ng = max(Q)-1
    ok = sum(Q)
    while abs(ok-ng)>1:
        m = (ng+ok)//2
        if can_stack(m):
            ok = m
        else:
            ng = m
    print(ok)

    # for i in range(20):
    #     print(i, can_stack(i))

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9532
N = int(input())
a = [0 for _ in range(N)]
for i in range(N):
    a[i] = int(input())
c = 0
x = 1
while(x != 2):
    nex = a[x - 1]
    if not nex:
        c = -1
        break
    else:
        a[x - 1] = False
        c += 1
        x = nex
print(c)


Measured memory_bytes: 7080
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int a[105];
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    int cnt=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=i+1;j<=n;j++)
        {
            for(int k=j+1;k<=n;k++)
            {
                set<int>q;
                q.clear();
                q.insert(a[i]);
                q.insert(a[j]);
                q.insert(a[k]);
                if(q.size()==3&&a[i]+a[j]>a[k]&&abs(a[i]-a[j])<a[k])
                    cnt++;
            }
        }
    }
    cout<<cnt;
    return 0;
}


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

using namespace std;

long long n,d;
int sum,prim;
bool mun;
void suma(){
    while(n!=0){
        sum++;
        prim=n%10;
        n/=10;
    }
    
}
int main() {
    cin >> n;
    d=n;
    if(n/10==0){
        cout<<n;
        return 0;
    }
    suma();
    for(int i=1;i<sum;i++){
        if(d%10!=9) mun=true;
        d/=10;
    }
    if(mun==false){
        cout<<(sum-1)*9+prim;
        return 0;
    }
  cout<<prim+9*(sum-1)-1;
}

Measured memory_bytes: 256
// Aizu 2424: Kakezan
// 2017.9.25 bal4u@uu

#include <stdio.h>
#include <stdlib.h>

int maxCut(int n)
{
	int max, a, b;

	max = 0, a = 1, b = 0;
	while (n > 0) {
		b += a * (n % 10);
		a *= 10;
		n /= 10;
		if (b * n > max) max = b * n;
	}
	return max;
}

int main()
{
	int q, n, ans;

	scanf("%d", &q);
	while (q-- > 0) {
		scanf("%d", &n);
		ans = 0;
		while (n > 9) ans++, n = maxCut(n);
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1844
n, l = gets.split.map(&:to_i)
h = Array.new
id = -199
s = 101
for i in 1..n
  if (l+i-1).abs < s
    s = (l+i-1).abs
    id = i - 1
  end
  h << l + i - 1
end
h.delete_at(id)
ans = 0
h.each do |x|
  ans += x
end
puts ans

Measured memory_bytes: 1916
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<iostream>
#define For(i, l, r) for(int i = (l); i <= (int)(r); ++i)
#define Fordown(i, r, l) for(int i = (r); i >= (int)(l); --i)
#define Set(a, v) memset(a, v, sizeof(a))
using namespace std;

inline int read_int(){
  int x = 0, fh = 1; char ch;
  for(; !isdigit(ch); ch = getchar()) if (ch == '-') fh = -1;
  for(; isdigit(ch); ch = getchar()) x = (x<<1) + (x<<3) + (ch^'0');
  return x * fh;
}

inline long long read_LL(){
  long long x = 0, fh = 1; char ch;
  for(; !isdigit(ch); ch = getchar()) if (ch == '-') fh = -1;
  for(; isdigit(ch); ch = getchar()) x = (x<<1) + (x<<3) + (ch^'0');
  return x * fh;
}

const int N = 2*1e5;
long long a[N];
long long sum = 0, x;


int main(){
    long long sum = 0;
    int n = read_int();  x = read_LL();
    For (i, 1, n) a[i] = read_LL();
    For (i, 1, n-1) {
       long long will = a[i] + a[i+1] - x;
       if (will <= 0) continue;
       sum += will;
       if (will <= a[i+1]) {
       	 a[i+1] -= will;
       } else {
         will -= a[i+1];
         a[i+1] = 0;
         a[i] -= will;
       }
    }
    printf ("%lld\n", sum);
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    int n;cin >>n;
    int ans=n%1000;
    ans=(ans)?1000-ans:ans;
    cout <<ans <<endl;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define lli long long int
#define rep(i,n) for(lli i=0; i<n; i++)
#define loop(i, j, n) for(lli i=j; i<n; i++)
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
//Function
lli combi(lli n, lli r)
{
	if(r==0 || r==n) return 1;
	else return combi(n-1,r) + combi(n-1,r-1);
}
lli sigma1(lli n){return n*(n+1)/2;}
lli sigma2(lli s, lli n){return sigma1(n) - sigma1(s -1);}
using namespace std;
// }}} End Header

lli body(lli a, lli b){
	return (a-b)*(a-b);
}
int main()
{
	ios::sync_with_stdio(false); cin.tie(nullptr);
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	while(1){
		c -= b;
		if(c < 1){
			cout << "Yes" << endl;
			return 0;
		}
		a -= d;
		if(a < 1){
			cout << "No" << endl;
			return 0;
		}
	}
	return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int[3]> h(n), dp(n + 1);
  rep(i, n) cin >> h[i][0] >> h[i][1] >> h[i][2];
  rep(i, n) {
    rep(j, 3) {
      rep(k, 3) {
        if (j != k) dp[i + 1][j] = max(dp[i + 1][j], dp[i][k] + h[i][j]);
      }
    }
  }
  cout << max({dp[n][0], dp[n][1], dp[n][2]}) << endl;
}

Measured memory_bytes: 2560
n=int(input())
a=[int(input()) for _ in range(n)]
m1=max(a)
m2=sorted(a)[-2]
l=[i for i, x in enumerate(a) if x == m1]

if len(l)==1:
  for i in range(n):
    if i ==l[0]:
      print(m2)
    else:
      print(m1)
else:
  for i in range(n):
    print(m1)

Measured memory_bytes: 20476
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val s = sc.next().toString()

    println(abc126b(s))
}

fun abc126b(s: String): String {
    var first = s.toInt() / 100
    var second = s.toInt() - first * 100

    var isYYMM = isYear(first) && isMonth(second)
    var isMMYY = isMonth(first) && isYear(second)
    if (isYYMM && isMMYY) {
        return "AMBIGUOUS"
    } else if (isYYMM && !isMMYY) {
        return "YYMM"
    } else if (!isYYMM && isMMYY) {
        return "MMYY"
    } else {
        return "NA"
    }
}

fun isYear(s: Int): Boolean {
    if (0 <= s && s <= 99) return true
    return false
}

fun isMonth(s: Int): Boolean {
    if (1 <= s && s <= 12) return true
    return false
}

Measured memory_bytes: 31392
#include <iostream>
#include <vector>
#include <set>

using namespace std;


void solve()
{
	int n;
	while (cin >> n, n)
	{
		vector<int> h(n + 1);
		for (int i = 0; i <= n; ++i)
		{
			cin >> h[i];
		}
		h.push_back(1e9);
		for (int i = 0; i <= n; ++i)
		{
			vector<int> use;
			for (int j = 0; j <= n; ++j)
			{
				if (j == i)
				{
					continue;
				}
				use.push_back(h[j]);
			}
			set<int> diff;
			for (int j = 1; j < use.size(); ++j)
			{
				diff.insert(use[j] - use[j - 1]);
			}
			if (diff.size() == 1)
			{
				cout << h[i] << endl;
				break;
			}
		}
	}
}

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

Measured memory_bytes: 1220
N, M = map(int, input().split())
a = []
for i in range(M):
	a.append(int(input()))
a.append(-1)

m = []
for i in range(N):
	if i == a[0] - 1:
		del a[0]
		m.append(0)
	elif i == 0:
		m.append(1)
	elif i == 1:
		m.append(m[0]+1)
	else:
		m.append(m[i-1]+m[i-2])

print(m[N-1] % 1000000007)


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

template <typename T>
T gcd(T x, T y)
{
    if (y == 0)
        return x;
    return gcd(y, x % y);
}

template <typename T>
T lcm(T x, T y)
{
    if (x == 0 || y == 0)
        return 0;
    return x / gcd(x, y) * y;
}

int main()
{
    char A, B, C, D;
    cin >> A >> B >> C >> D;
    int a = A - '0', b = B - '0', c = C - '0', d = D - '0';
    int op[3][2] = {{a - b, a + b}, {b - c, b + c}, {c - d, c + d}};
    string o = "-+";
    for (int i = 0; i < 2; i++)
    {
        for (int j = 0; j < 2; j++)
        {
            for (int k = 0; k < 2; k++)
            {
                if (op[0][i] + op[1][j] + op[2][k] - b - c == 7)
                {
                    cout << A << o[i] << B << o[j] << C << o[k] << D << "=7" << endl;
                    return 0;
                }
            }
        }
    }
}


Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = list(mapint())

from collections import deque
Q = deque()
for i, a in enumerate(As):
    if i%2==0:
        Q.append(a)
    else:
        Q.appendleft(a)

if N%2==0:
    print(*Q)
else:
    print(*list(Q)[::-1])

Measured memory_bytes: 101448
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
//min
int main(void){
  int s;
  int a[1000001];

  scanf("%d", &s);

  a[1] = s;
  int i = 2;
  while(s % 1 == 0){
    if(s % 2 == 0){
      s = s / 2;
    }else{
      s = 3 * s + 1;
    }
  a[i] = s;

    for(int j = i - 1; j > 0; j--){
      if(a[j] == a[i]){
	printf("%d\n", i);
	return 0;
      }
    }
   i++;
  }
  
  return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;

#define ll long long int
#define str string

ll MOD = 1000000007, INFL = 1ll << 60, INF = 1 << 30, mod = 1e9 + 7, Max = INF, Min = -1;
ll a = 0, b = 0, c = 0, n = 0, sum = 0;
pair<ll, ll> A[500000] = {}, B[500000] = {}, rui[500000] = {}, dp[100][10] = {};
int dy[] = { 0, 0, 1, -1 }, dx[] = { 1, -1, 0, 0 };
vector <ll> v;
str S, T;
bool check = false, check2 = false;

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

int main() {

	//Code Line
	cin >> S;
	if (S[0] == 'S')cout << "Cloudy" << endl;
	else if (S[0] == 'C')cout << "Rainy" << endl;
	else cout << "Sunny" << endl;

	return 0;
}




Measured memory_bytes: 23680
N,K=map(int,input().split())
a=list(map(int,input().split()))
b=[]
for i in range(N-K+1):
    b.append(min(abs(a[i])+abs(a[i+K-1]-a[i]),abs(a[i+K-1])+abs(a[i]-a[i+K-1])))
print(min(b))


Measured memory_bytes: 14252
#include<iostream>
#include<math.h>
#include<string.h>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<deque>
using namespace std;
 
int main(){
	long long h,cnt=0,ans=0;
	cin >> h;
	while(h){
		ans+=pow(2,cnt);
		h/=2;
		cnt++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>

using namespace std;
template<class T1, class T2> inline void chkmin(T1 &x, const T2 &y) {if (x > y) x = y;}
template<class T1, class T2> inline void chkmax(T1 &x, const T2 &y) {if (x < y) x = y;}
#define all(c) (c).begin(), (c).end()
#define sz(c) (int)(c).size()
#define mp make_pair
#define pb push_back
#define read(FILENAME) freopen((string(FILENAME) + ".in").c_str(), "r", stdin)
#define write(FILENAME) freopen((string(FILENAME) + ".out").c_str(), "w", stdout);
const int Mod = 1000003;
const int MAXN = 1000008;

int sum(const int &a, const int &b) {
	return (a + b >= Mod ? a + b - Mod: a + b);
}


int mul(const int &a, const int &b) {
	return (1LL * a * b) % Mod;
}


int powm(int a, int b) {
	int res = 1;
	while (b) {
		if (b & 1) {
			res = mul(res, a);
		}
		b >>= 1;
		a = mul(a, a);
	}
	return res;
}


int fact[MAXN], rfact[MAXN];



void solve() {
	int x, d, n;
	cin >> x >> d >> n;
	if (x == 0) {
		cout << 0 << '\n';
		return;
	}
	if (d == 0) {
		cout << powm(x, n) << '\n';
		return;
	}
	x = mul(x, powm(d, Mod - 2));
	if (x + n - 1 >= Mod || x == 0) {
		cout << 0 << '\n';
		return;
	}
	int g = fact[x + n - 1];
	g = mul(g, rfact[x - 1]);
	g = mul(g, powm(d, n));
	cout << g << '\n';
}


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//read("input");
	fact[0] = 1;
	for (int i = 1; i < MAXN; i++) {
		fact[i] = mul(fact[i - 1], i);
	}
	for (int i = 0; i < MAXN; i++) {
		rfact[i] = powm(fact[i], Mod - 2);
	}	
	int q;
	cin >> q;
	for (int it = 0; it < q; it++) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 8704
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define lop(i, n) for(i=0; i<n; i++)

long gcd(long int x, long int y){
	long int t;
	if(x<y){ t=x; x=y; y=t; }
	if(y<1)return -1;
	
	if(x%y ==0)return y;
	else return gcd(y, x%y);
}

int main(void)
{
	long int a, b;
	scanf("%ld %ld", &a, &b);
	
	printf("%ld", (a*b)/gcd(a, b));
	
	return 0;
}

Measured memory_bytes: 128
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
  }

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
  }

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
    // 3
    // 1 2
    // 1 3
    // 1 4
    // のようなタイプ
    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
  }
fn main() {
    input! {
        n:i64,
        s: String,
        t: String
    }

    let mut string = String::from("");
    let mut s_iter = s.as_str().chars();
    let mut t_iter = t.as_str().chars();
    for i in 0..n {
        string.push(s_iter.next().unwrap());
        string.push(t_iter.next().unwrap());
    }

    println!("{}", string);
}


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long A =Integer.parseInt(sc.next());
		long B =Integer.parseInt(sc.next());
		long C =Integer.parseInt(sc.next());

		if(A % 2 == 0 || B % 2 == 0 || C % 2 == 0) {
			System.out.println(0);
		}else {
			long min = Math.min(A * B, B * C);
			min = Math.min(min, C * A);
			System.out.println(min);
		}
	}

}


Measured memory_bytes: 9424
y500_max = int(input())
y100_max = int(input())
y50_max = int(input())
sum = int(input())
patterns = [[ y500, y100, y50 ] for y500 in range(y500_max + 1) 
                                              for y100 in range(y100_max + 1) 
                                              for y50 in range(y50_max + 1)
                                              if y500 * 500 + y100 * 100 + y50 * 50 == sum]
print(len(patterns))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,mx=0,a;
  map<int,int>mp;
  cin>>n;
  for(int i=0;i<n;i++)
  {
      cin>>a;

      mp[a]++;
      if(mp[a]>mx){mx=mp[a];}
      mp[a-1]++;
      if(mp[a-1]>mx){mx=mp[a-1];}
      mp[a+1]++;
      if(mp[a]>mx){mx=mp[a+1];}
  }
  cout<<mx<<endl;

}


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

int main(){
    string src;
    string word;
    cin >> src >> word;
    
    for(int i=0; i<src.size(); i++)
        if(src[i] == word[0]){
            int judge=1;
            for(int j=0; j<word.size(); j++){
                if(src[(i+j)%src.size()] != word[j]){
                    judge=0;
                    break;
                }
            }
            if(judge==1){
                cout << "Yes"<<endl;
                return 0;
            }
        }
        cout << "No"<<endl;;
        return 0;
}


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

int calc_digits(int n) {
    int res = 0;
    while (n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

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

    int res = 0;
    for (int i = 1; i <= N; i++) {
        if (calc_digits(i) % 2 == 1) res++;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
N = int(input())
for i in range(1,3501):
  for j in range(max(i-1,1),3501):
    if (4*i*j - N*i -N*j) != 0:
      w = (N*i*j)/(4*i*j - N*i -N*j)
      if w > 0 and w.is_integer():
        print(i,j,int(w))
        sys.exit()

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


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

struct edge {int to; ll cost; };

int dx[] = {-1, 1, 0,  0};
int dy[] = { 0, 0, 1, -1};
 
int main(){
  int n, k;
  cin >> n >> k;
  int ans = n*k;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};

int main(){
    int n;
    cin >> n;
    ll ans = 0;
    rep(i, n) {
        ans += (ll)(i+1)*(n-i);
    }
    rep(i, n-1) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        if (u>v) swap(u, v);
        ans -= (ll)(u+1)*(n-v);
    }
    
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3668
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
#include <tuple>
#include <random>

using namespace std;
typedef long long int ll;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()

#define const INF 10000000000

ll a, b, c, n, x, y, z, w, h, ans = 0, cnt = 0, max = 0;
string s;

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

    cin >> n;
    rep(i, n){
        cin >> a;
        while(!(a % 2)){
            a /= 2;
            cnt++;
        }
    }
    cout << cnt << endl;
}



Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<queue>
#include<algorithm>
using namespace std;
const int maxn=1000005;
long long dis[maxn];
int u[maxn],v[maxn],d[maxn],w[maxn];
int vis[maxn],head[maxn],ans[maxn];
int num,n,m;
struct chen
{
    int v,d,w,pre;
}e[maxn];
void init()
{
    memset(vis,0,sizeof(vis));
    memset(head,-1,sizeof(head));
    memset(ans,1,sizeof(ans));
    memset(dis,1,sizeof(dis));
    num=0;
}
void add(int aa,int bb,int d,int w)
{
    e[num].v=bb;
    e[num].d=d;
    e[num].w=w;
    e[num].pre=head[aa];
    head[aa]=num;
    num++;
}
void spfa(int x)
{
    queue<int> q;
    q.push(x);
    vis[x]=1;  // x in the queue;
    dis[x]=0;
    while(!q.empty())
    {
        int tmp=q.front();
        q.pop();
        vis[tmp]=0;
        for(int i=head[tmp];i!=-1;i=e[i].pre)
        {
            if(dis[e[i].v]==dis[tmp]+e[i].d && e[i].w<ans[e[i].v])
                ans[e[i].v]=e[i].w;
            if(dis[e[i].v]>dis[tmp]+e[i].d)
            {
                dis[e[i].v]=dis[tmp]+e[i].d;
                ans[e[i].v]=e[i].w;
                if(!vis[e[i].v])
                {
                    q.push(e[i].v);
                    vis[e[i].v]=1;
                }
            }
        }
    }
}
int main()
{
    //freopen("in.txt","r",stdin);
    while(scanf("%d%d",&n,&m)!=EOF)
    {
        if(n==0 && m==0) break;
        init();
        int sum=0;
        for(int i=0;i<m;i++)
        {
            scanf("%d%d%d%d",&u[i],&v[i],&d[i],&w[i]);
            add(u[i],v[i],d[i],w[i]);
            add(v[i],u[i],d[i],w[i]);
        }
        spfa(1);
        for(int i=2;i<=n;i++)
            sum+=ans[i];
        printf("%d\n",sum);
    }
}

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

/* 
 * g++ -std=c++17 main.cpp -o main
 */
int main() {
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  vector<int> alphabet(26, 0);
  for(char c: s) {
    alphabet[c - 'a']++;
  }
  for (int a : alphabet) {
    if (a&1) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes";
  cout<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <climits>

constexpr int SINT_MAX = std::numeric_limits<int>::max();
constexpr int SINT_MIN = std::numeric_limits<int>::min();

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

template<class T>
T choose(bool b, T t, T f)
{
    if (b) return t;
    else return f;    
}

const char *YesNo(bool b)
{
    return choose(b, "Yes", "No");
}

const char *YESNO(bool b)
{
    return choose(b, "YES", "NO");
}

template<class NumT>
NumT diffabs(NumT l, NumT r)
{
    if (l < r) return r-l;
    else return l-r;    
}

struct myinout_t {} io;

template<class T>
myinout_t &operator >>(myinout_t &my, T &i)
{
    cin >> i;
    return my;
}

myinout_t &operator >>(myinout_t &my, int &i)
{
    int r = scanf("%d", &i);
    if (r != 1) exit(EXIT_FAILURE);
    return my;
}

myinout_t &operator >>(myinout_t &my, ll &i)
{
    int r = scanf("%lld", &i);
    if (r != 1) exit(EXIT_FAILURE);
    return my;
}

template<class T>
myinout_t &operator <<(myinout_t &my, const T &i)
{
    cout << i;
    return my;
}

myinout_t &operator <<(myinout_t &my, int i)
{
    printf("%d", i);
    return my;
}

myinout_t &operator <<(myinout_t &my, ll i)
{
    printf("%lld", i);
    return my;
}

myinout_t &operator <<(myinout_t &my, double i)
{
    printf("%.20f", i);
    return my;
}

constexpr char BR = '\n';


///////////////////////////////////////////////////
constexpr int MOD = 1e9+7;


int main()
{
    size_t N, K;
    io >> N >> K;
    vi pA, mA;
    for (size_t i = 0; i < N; i++)
    {
        int a;
        io >> a;
        if (a >= 0)
            pA.push_back(a);
        else
            mA.push_back(a);
    }

    size_t mK = K - pA.size();
    if (K == N || (pA.size() == 0 && mK % 2 == 1))
    {
        sort(begin(mA), end(mA), greater<int>());
        ll ans = 1;
        for (int p : pA)
            ans = (ans * p) % MOD;
        for (size_t i = 0; i < mK; ++i)
            ans = (ans * -mA[i]) % MOD;
        
        if (mK % 2 == 1)
            ans = (MOD - ans) % MOD;
        
        io << ans << BR;
        return 0;
    }
    else
    {
        sort(begin(pA), end(pA), greater<int>());
        sort(begin(mA), end(mA), less<int>());

        size_t pK, mK;
        if (K <= pA.size())
        {
            pK = K;
            mK = 0;
        }
        else
        {
            pK = pA.size();
            mK = K - pA.size();
            if (mK % 2 == 1)
            {
                --pK;
                ++mK;
            }
        }
        
        size_t I = 0;
        for (I = 0; mK+I+1 < mA.size() && I+1 < pK; I += 2)
        {
            ll mmul = (ll)mA[mK+I] * mA[mK+I+1];
            ll pmul = (ll)pA[pK-I-1] * pA[pK-I-2];
            if (pmul > mmul) break;
        }
        ll ans = 1;
        for (size_t j = 0; j < pK - I ; j++)
            ans = (ans * pA[j]) % MOD;
        for (size_t j = 0; j < mK + I; j++)
            ans = (ans * -mA[j]) % MOD;
    
        io << ans << BR;
        return 0;
    }
}


Measured memory_bytes: 4336
#include "bits/stdc++.h"
using namespace std;
int main()
{
    int n, k;
    scanf("%d\n%d", &n, &k);
    vector<bool> a(101);
    a[1] = true;
    for (int i = 0; i < n; i++)
    {
        for (int j = 100; j >= 1; j--)
        {
            if (a[j])
            {
                if (j * 2 < 100)
                {
                    a[j * 2] = true;
                }
                if (j + k < 100)
                {
                    a[j + k] = true;
                }
                a[j] = false;
            }
        }
    }
    for (int i = 0; i < 101; i++)
    {
        if (a[i])
        {
            printf("%d\n", i);
            break;
        }
    }
}



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

typedef struct {
	int x, y;
} aamu_t;

int hikaku(const void* x, const void* y) {
	int a = ((const aamu_t*)x)->x;
	int b = ((const aamu_t*)y)->x;
	if (a > b) return 1;
	if (a < b) return -1;
	return 0;
}

int n, m;
aamu_t aamu[100000];

typedef struct {
	int ue, sita;
} hani_t;

hani_t hani[200000];

int main(void) {
	int i;
	if (scanf("%d%d", &n, &m) != 2) return 1;
	for (i = 0; i < m; i++) {
		if (scanf("%d%d", &aamu[i].x, &aamu[i].y) != 2) return 1;
	}
	qsort(aamu, m, sizeof(*aamu), hikaku);
	for (i = 0; i < n; i++) {
		hani[i].ue = hani[i].sita = i;
	}
	for (i = 0; i < m; i++) {
		int y = aamu[i].y;
		int ue = hani[y - 1].ue < hani[y].ue ? hani[y - 1].ue : hani[y].ue;
		int sita = hani[y].sita > hani[y - 1].sita ? hani[y].sita : hani[y - 1].sita;
		hani[y - 1].ue = hani[y].ue = ue;
		hani[y - 1].sita = hani[y].sita = sita;
	}
	for (i = 0; i < n; i++) {
		printf("%d", hani[i].sita - hani[i].ue + 1);
		putchar(i + 1 < n ? ' ' : '\n');
	}
	return 0;
}

Measured memory_bytes: 2992
from itertools import combinations
n , m ,x = map(int , input().split())
arr = [list(map(int , input().split())) for i in range(n)]
ans = 10**10
for i in range(1,n+1):
	for k in combinations(arr , i):
		#print(k,i,n)
		a = [0]*m
		#print(k)
		f = 1
		cost = 0
		for ele in k:
			#print(ele)
			cost += ele[0]
			for e in range(1,m+1):
				a[e-1] += ele[e]
		for _i in a:
			if _i < x:
				f = 0
				break
		if f : ans = min(ans , cost)
print(ans if ans < 10**10 else -1)


Measured memory_bytes: 9240
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
using namespace std;
const int IINF = 1 << 30;
vector<vector<int>> dist(1010, vector<int>(1010, IINF));
map<pair<int, int>, bool> visited;
vector<string> g;
int h, w;
bool is_valid(int y, int x)
{
    return 0 <= y && y < h && 0 <= x && x < w && g[y][x] != '#';
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> h >> w;
    g.resize(h);
    rep(i, h)
    {
        cin >> g[i];
    }
    deque<pair<int, int>> que;
    rep(i, h) rep(j, w)
    {
        if (g[i][j] == '#')
        {
            que.push_back({i, j});
            dist[i][j] = 0;
        }
    }
    int ans = 0;
    int dy[4] = {1,
                 -1,
                 0,
                 0};
    int dx[4] = {0,
                 0,
                 1,
                 -1};
    while (!que.empty())
    {
        deque<pair<int, int>> next;
        while (!que.empty())
        {
            auto cur = que.front();
            que.pop_front();

            int y = cur.first;
            int x = cur.second;
            rep(i, 4)
            {
                int ny = y + dy[i];
                int nx = x + dx[i];
                if (is_valid(ny, nx) && dist[ny][nx] == IINF)
                {

                    next.push_back({ny, nx});
                    dist[ny][nx] = dist[y][x] + 1;
                    ans = max(ans, dist[ny][nx]);
                }
            }
        }
        que = next;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 13696
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(ll (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define opf(i) cout<<fixed<<setprecision(10)<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define matC(name,fnum,snum); vector<vector<char>> name((fnum),vector<char>((snum),0));
#define debugP int debug_point; cin>>debug_point;
#define FI first
#define SE second
const ll MOD= 1e9 + 7;

//
double dis(ll x,ll y,ll X,ll Y){
    return(sqrt((x-X)*(x-X)+(y-Y)*(y-Y)));
}

void solve(long long N, std::vector<long long> x, std::vector<long long> y){
    double ans=0;
    rep(i,N){
        repf(j,i+1,N){
            ans+=dis(x[i],y[i],x[j],y[j]);
        }
    }
    opf(ans*2/N)
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> x(N);
    std::vector<long long> y(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&x[i]);
        scanf("%lld",&y[i]);
    }
    solve(N, std::move(x), std::move(y));
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <algorithm>

using namespace std;

struct Node {
  int start;
  string buf;
  Node(int index, string s): start(index), buf(s) {}
};

int dir[4] = {-1, 1, -4, 4};
unordered_map<string, int> dp;

void solve() {
  dp["01234567"] = 0;
  int step = 0;
  queue<Node> q;
  q.push(Node(0, "01234567"));
  while (!q.empty()) {
    int size = q.size();
    step++;
    while (size-- > 0) {
      Node cur = q.front();
      q.pop();
      for (int i = 0; i < 4; ++i) {
        int next_p = cur.start + dir[i];
        if (next_p >= 0 && next_p < 8
            && !(cur.start == 4 && i == 0)
            && !(cur.start == 3 && i == 1)) {
          string next = cur.buf;
          swap(next[cur.start], next[next_p]);
          if (dp.count(next) == 0) {
            dp[next] = step;
            q.push(Node(next_p, next));
          }
        }
      }
    }
  }
}

int main() {
  solve();
  string input;
  char c;
  while (cin >> c) {
    input.clear();
    input.append(1, c);
    for (int i = 0; i < 7; ++i) {
       cin >> c;
        input.append(1, c);
     }
     cout << dp[input] << endl;
  }
  return 0;
}

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

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

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define CHMIN(a, b) (a) = min((a), (b))
#define CHMAX(a, b) (a) = max((a), (b))

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(),x.end()


int main() {
    int N;
    cin >> N;
    vi H(N,0);
    vi m(N,0);
    
    REP(i,N){
        cin >> H[i];
    }

    m[0]=H[0];
    FOR(i,1,N){
        m[i] = max(m[i-1],H[i]);
    }

    int rep=0;
    REP(i,N){
        if(m[i]<=H[i]) rep++;
    }

    PRINT(rep);


}




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

using namespace std;

const string T = "AKIHABARA";
vector<int> index;


string bit_s(int bit) {
    vector<bool> flag(4, false);
    for (int i = 0; i < 4; ++i) {
        if (bit >> i & 1) flag[index[i]] = true;
    }

    string ret;
    for (int i = 0; i < (int) T.size(); ++i) {
        if (flag[i]) continue;
        ret.push_back(T[i]);
    }

    return ret;
}

int main() {
    for (int i = 0; i < (int) T.size(); ++i) {
        if (T[i] == 'A') index.emplace_back(i);
    }
    string s;
    cin >> s;
    for (int bit = 0; bit < 1 << 4; ++bit) {
        if (s == bit_s(bit)) {
            cout << "YES" << endl;
            return 0;
        }
    }

    cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
using namespace std;
#define N 100
int L,n,tot;
struct node{
	int x,y,w;node(){}
	node(int x_,int y_,int w_){x=x_,y=y_,w=w_;}
}q[N];
int main(){
	scanf("%d",&L);
	int t=log2(L);n=t+1;
	rep (i,1,n-1){
		q[++tot]=node(i,i+1,1<<i-1);
		q[++tot]=node(i,i+1,0);
	}
	rep (i,0,t-1) if (L>>i&1){
		L-=1<<i;
		q[++tot]=node(i+1,n,L);
	}
	printf("%d %d\n",n,tot);
	rep (i,1,tot) printf("%d %d %d\n",q[i].x,q[i].y,q[i].w);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
using namespace std;
vector <long long > calc(0, 0);
int main() {

	int a, b, c;
	cin >> a >> b >> c;
	if (b - a == c - b)cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }

int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;
    int ans = 1;
    for(int i = 0; i < N - 1; i++){
        ans += (S[i] != S[i + 1]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 512