akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;

namespace ITP1_11_A
{
	class Dice
	{
		public static int[] label = new int[6];
		public static void Roll(string s)
		{
			foreach (char c in s)
				switch (c)
				{
					case 'E': { East(); break; }
					case 'N': { North(); break; }
					case 'S': { South(); break; }
					case 'W': { West(); break; }
				}
		}
		static void East()
		{
			int x = label[0];
			label[0] = label[3]; label[3] = label[5];
			label[5] = label[2]; label[2] = x;
		}
		static void North()
		{
			int x = label[0];
			label[0] = label[1]; label[1] = label[5];
			label[5] = label[4]; label[4] = x;
		}
		static void South()
		{
			int x = label[0];
			label[0] = label[4]; label[4] = label[5];
			label[5] = label[1]; label[1] = x;
		}
		static void West()
		{
			int x = label[0];
			label[0] = label[2]; label[2] = label[5];
			label[5] = label[3]; label[3] = x;
		}
	}
	class Program
	{
		static void Main(string[] args)
		{
			Dice.label = Console.ReadLine().Split().Select(int.Parse).ToArray();
			Dice.Roll(Console.ReadLine());
			Console.WriteLine(Dice.label[0]);
		}
	}
}


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

int main() {
  ll n, k;
  cin >> n >> k;
  vl a(n);
  rep(i,n) cin >> a[i];
  rep(i,n-k) {
    if (a[i+k] > a[i])
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}

Measured memory_bytes: 4840
#include <stdio.h>
#include <string.h>

  int i,j,k,l,m;
  int n,e,s,w,un,up;
  int a[7];
int t;


void input() {
 for(i=0;i<6;i++){
  
    scanf("%d",&a[i+1]);
  
  }
}

 void N() {
   t = a[1];
   a[1] = a[2];
   a[2] = a[6];
   a[6] = a[5];
   a[5] = t;
 }

 void S() {
   t = a[1];
   a[1] = a[5];
   a[5] = a[6];
   a[6] = a[2];
   a[2] = t;
}

 void E() {
   t = a[1];
   a[1] = a[4];
   a[4] = a[6];
   a[6] = a[3];
   a[3] = t;
 }

 void W() {
   t = a[1];
   a[1] = a[3];
   a[3] = a[6];
   a[6] = a[4];
   a[4] = t;
 }

int main() {

  input();
  //  strlen(?) 文字の長さ(数)を表示
 char str[110];  
 scanf("%s",str);

 for(i=0;i<strlen(str);i++) {

   if(str[i] == 'N') {
     N();
   } else if(str[i] == 'S') {
     S();
   } else if(str[i] == 'W') {
     W();
   } else if(str[i] == 'E') {
     E();
   }
 }

 printf("%d\n",a[1]);

 return 0;
}



Measured memory_bytes: 2060
def resolve_c():
    n, k = map(int, input().split())
    num_list = list(map(int, input().split()))
    if len(num_list) <= k:
        print(0)
    else:
        num_list.sort(reverse=True)
        attack_list = num_list[k:]
        print(sum(attack_list))
resolve_c()

Measured memory_bytes: 26764
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define f first
#define s second
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
/*bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
} */
int main()
{
     ll s,w;
     cin>>s>>w;
     if(w>=s)
        cout<<"unsafe"<<endl;
     else
        cout<<"safe"<<endl;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
int main() {
    int n,x;cin >> n >> x;
    vector<int> l(n);
    rep(i,n)cin >> l[i];
    vector<int> p(n);
    int d = 0;
    int ans = 1;
    rep(i,n){
        d = d + l[i];
        if(d<=x){
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
if(a==b&&a!=c)
cout<<"Yes"<<endl;
else if(a==c&&a!=b)
cout<<"Yes"<<endl;
else if(b==c&&b!=a)
cout<<"Yes"<<endl;
else if(c==a&&c!=b)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
   int c1, c5, c10, c50, c100, c500;
   scanf("%d %d %d %d %d %d", &c1, &c5, &c10, &c50, &c100, &c500);
   if ( c1 + c5 * 5 + c10 * 10 + c50  * 50 + c100 * 100 + c500 * 500 >= 1000 ) printf("1\n");
   else printf("0\n");
   return 0;
}

Measured memory_bytes: 1856
#include<cmath>
#include<cstdio>
#include<algorithm>
 
#define rep(i,n) for(int i=0;i<(n);i++)
 
using namespace std;
 
const double INF=1e77;
const double EPS=1e-8;
const double PI=acos(-1);
 
template<class T>
struct point{
    T x,y;
    point operator+(const point &a)const{ point t = {x+a.x,y+a.y}; return t; }
    point operator-(const point &a)const{ point t = {x-a.x,y-a.y}; return t; }
};
 
template<class T>
point<T> operator*(T c,const point<T> &a){
	point<T> p = {c*a.x,c*a.y};
    return p;
}
 
point<double> rot(const point<double> &a,double theta){
	point<double> p = {a.x*cos(theta)-a.y*sin(theta),a.x*sin(theta)+a.y*cos(theta)};
	return p;
}
 
template<class T>
struct segment{
    point<T> a,b;
};
 
struct star{
    point<double> c;
    double a,r;
    point<double> p[5];
};
 
template<class T>
T dot(const point<T> &a,const point<T> &b){ return a.x*b.x+a.y*b.y; }
 
template<class T>
T cross(const point<T> &a,const point<T> &b){ return a.x*b.y-a.y*b.x; }
 
enum{CCW=1,CW=-1,ON=0};
int ccw(const point<double> &a,const point<double> &b,const point<double> &c){
    double rdir=cross(b-a,c-a);
    if(rdir> EPS) return CCW;
    if(rdir<-EPS) return CW;
    return ON;
}
 
bool intersect(const segment<double> &S1,const segment<double> &S2){
    if(max(S1.a.x,S1.b.x)+EPS<min(S2.a.x,S2.b.x)
    || max(S1.a.y,S1.b.y)+EPS<min(S2.a.y,S2.b.y)
    || max(S2.a.x,S2.b.x)+EPS<min(S1.a.x,S1.b.x)
    || max(S2.a.y,S2.b.y)+EPS<min(S1.a.y,S1.b.y)) return false;
    return ccw(S1.a,S1.b,S2.a)*ccw(S1.a,S1.b,S2.b)<=0
        && ccw(S2.a,S2.b,S1.a)*ccw(S2.a,S2.b,S1.b)<=0;
}
 
template<class T>
T dist2(const point<T> &a,const point<T> &b){
    return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
 
template<class T>
double dist2(const segment<T> &S,const point<T> &p){
    if(dot(S.b-S.a,p-S.a)<=0) return dist2(p,S.a);
    if(dot(S.a-S.b,p-S.b)<=0) return dist2(p,S.b);
    return (double)cross(S.b-S.a,p-S.a)*cross(S.b-S.a,p-S.a)/dist2(S.a,S.b);
}
 
template<class T>
double dist(const segment<T> &S1,const segment<T> &S2){
    if(intersect(S1,S2)) return 0;
    return sqrt(min(min(dist2(S1,S2.a),dist2(S1,S2.b)),
                    min(dist2(S2,S1.a),dist2(S2,S1.b))));
}
 
int main(){
    for(int n,m,l;scanf("%d%d%d",&n,&m,&l),n||m||l;){
        m--;
        l--;
 
        star S[100];
        rep(i,n){
            scanf("%lf%lf%lf%lf",&S[i].c.x,&S[i].c.y,&S[i].a,&S[i].r);
        }
 
        rep(i,n){
            S[i].p[0].x = 0, S[i].p[0].y = S[i].r;
            S[i].p[0]=rot(S[i].p[0],S[i].a/180*PI);
            for(int j=1;j<5;j++){
                S[i].p[j]=rot(S[i].p[j-1],2*PI/5);
            }
            rep(j,5) S[i].p[j]=S[i].p[j]+S[i].c;
        }
 
        int f1[5]={0,2,4,1,3};
        int f2[5]={2,4,1,3,0};
 
        double d[100][100];
        rep(i,n){
			rep(j,n) {
            d[i][j]=INF;
            rep(a,5) rep(b,5){
				segment<double> s = {S[i].p[f1[a]],S[i].p[f2[a]]};
				segment<double> t = {S[j].p[f1[b]],S[j].p[f2[b]]};
				d[i][j]=min(d[i][j],dist(s,t));
			}
			}
        }
 
        rep(k,n) rep(i,n) rep(j,n) d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
 
        printf("%.15f\n",d[m][l]);
    }
 
    return 0;
}

Measured memory_bytes: 912
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace D_ABC153
{
    class MainClass
    {

        static long[] s;

        public static void Main(string[] args)
        {
            s = Array.ConvertAll(ReadLine().Split().ToArray(), long.Parse);
            long tmp = s[0];
            long ans = 0;
            int idx = 0;
            while (tmp > 0)
            {
                tmp = tmp / 2;
                ans += (long)Pow(2,idx);
                idx++;

            }
            WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13268
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto A = RDR.ARR;
	auto index = A.MAKE_IDX();
	auto x = A[index[0]];
	auto y = A[index[$-1]];
	long[2][] ans;
	foreach (i; index[1..$-1])
	{
		if (A[i] < 0)
		{
			ans ~= [y, A[i]];
			y   -= A[i];
		}
		else
		{
			ans ~= [x, A[i]];
			x   -= A[i];
		}
	}
	ans ~= [y, x];
	writeln(y - x);
	foreach (e; ans)
	{
		writeln(e[0], " ", e[1]);
	}

	stdout.flush();
	debug readln();
}

Measured memory_bytes: 6192
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

typedef long long ll;

int main(){
  ll N;
  std::cin >> N;
  std::map<ll, ll> A;
  for(ll i = 0 ; i < N ; i++){
    ll temp;
    std::cin >> temp;
    A[temp]++;
  }
  ll Q;
  std::cin >> Q;
  std::vector<ll> B(Q);
  std::vector<ll> C(Q);
  for(ll i = 0 ; i < Q ; i++){
    std::cin >> B[i] >> C[i];
  }
  ll sum = 0;
  for(auto it = A.begin() ; it != A.end(); it++){
    sum += (it -> second) * (it -> first);
  }
  for(int i = 0 ; i < Q ; i++){
    if(A[B[i]] != 0){
      A[C[i]] += A[B[i]];
      sum += (C[i] - B[i]) * A[B[i]];
      A[B[i]] = 0;
      // for(auto it = A.begin(); it != A.end() ; it++){
      // 	std::cout << "f : " << it -> first << " s : " << it -> second << std::endl;
      // }
    }
    std::cout << sum << std::endl;
  }
  return 0;
}



Measured memory_bytes: 10424
#include <bits/stdc++.h>
#define MAXN 1000006
#define LL long long
using namespace std;
 
int n, k, top1, top2;
LL ans, a[MAXN], q1[MAXN], q2[MAXN];
 
int main()
{
	scanf("%d%d", &n, &k);
	for(int i=1; i<=n; i++)
	{
		scanf("%lld", &a[i]);
		a[i]+=a[i-1];
		for(int j=1; j<=i; j++) q1[++top1]=a[i]-a[j-1];
	}
	for(LL i=50; i>=0; i--)
	{
		top2=0;
		for(int j=1; j<=top1; j++)
			if((q1[j]>>i)&1) q2[++top2]=q1[j];
		if(top2>=k)
		{
			ans|=(1LL<<i);
			top1=top2;
			for(int j=1; j<=top1; j++) q1[j]=q2[j];
		}
	}
	printf("%lld\n", ans);
	return 0; 
}

Measured memory_bytes: 9344
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 7;
typedef long long ll;
string s, t;
int main() {
    cin >> s >> t;
    int ans = 1e7;
    for (int i = 0; i + t.size() <= s.size(); i++) {
        int cnt = 0;
        for (int j = 0, k = i; k < s.size() && j < t.size(); j++, k++) {
            if(s[k] != t[j]) cnt++;
        }
        ans = min(ans, cnt);
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define per(i, n, s) for (int i = (n-1); i >= (int)(s); i--)
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<x<<endl
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll LINF = LLONG_MAX;
const int INF = INT_MAX;
const double PI=acos(-1);
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; }

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main(){
	ll n; cin>>n;
	vector<pair<ll,ll>> a = prime_factorize(n);
	ll ans=0;
	rep(i,0,a.size()){
		ll s=a[i].second;
		ans+=((-1+sqrt(1+8*s))/2.0);
	}
	cout<<ans<<endl;
}

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

bool flag[2000*20 +1];

int main(){
	int n;	cin>>n;
	vector<int> a(n);	for(int i=0;i<n;i++)cin>>a[i];

	for(int i=0; i<(1<<n); i++){
		int num=0;
		for(int j=0;j<n;j++){
			if( (i>>j)&1 ){
				num+=a[j];
			}
		}
		flag[num]=true;
	}

	int q;	cin>>q;
	for(int i=0;i<q;i++){
		int tgt;	cin>>tgt;
		if(flag[tgt])cout<<"yes"<<endl;
		else cout<<"no"<<endl;
	}

	return 0;
}



Measured memory_bytes: 3116
#include <stdio.h>

int main(void)
{
  int n;
  int a, b;
  int x, y;
  int ans = 999999;

  scanf("%d", &n);

  for (int i=1; i < n; i++) {
    a = i;
    b = n - a;
    x=0;
    y=0;
    for (;;) {
      x += a%10;
      y += b%10;

      a /= 10;
      b /= 10;

      if (a == 0 && b == 0) { break;}

    }
    if (x+y < ans) { ans = x+y;}
  }


  printf("%d\n", ans);
  return 0;
}


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

#define li long long int
#define rep(i, to) for (li i = 0; i < ((li)(to)); i++)
typedef pair<li, li> PI;


map<li, li> cnt;
li a[100100];

int main(void)
{
	li n;
	cin >> n;
	rep(i, n) {
		cin >> a[i];
		cnt[a[i]]++;
	}
	li res = 0;
	for (const auto& item : cnt) {
		if (item.second % 2 > 0) {
			++res;
		}
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 8832
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstring>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
using namespace std;
#define INT(x) int x; scanf("%d",&x)
#define INPUT(x) scanf("%d",&x)
#define REP1(x,n) for(int x = 0; x < n; x++)
#define REP2(x,s,e) for(int x = s; x <= e; x++)
#define RREP1(x,n) for(int x = n-1; x >= 0; x--)
#define RREP2(x,s,e) for(int x = s; x >= e; x--)
#define BR printf("\n")
#define INF 2000000000

typedef long long ll;

int main(){
    char s[17];
    cin >> s;
    char ss[] = "CODEFESTIVAL2016";
    int counter = 0;
    REP1(i,16){
        if (ss[i] != s[i]) {
            counter++;
        }
    }
    cout << counter << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

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

  ll n, k;
  cin >> n >> k;
  vl p(n);
  rep(i, n) {
    cin >> p[i];
  }

  double ans = 0;
  double sum = 0;
  rep(i, n) {
    if (i-k >= 0) sum -= ((double)p[i-k]+1)/2;
    sum += ((double)p[i]+1)/2;
    if (i >= k-1) cmax(ans, sum);
    //printf("%.10lf\n", sum);
  }
  printf("%.10lf\n", ans);
}


Measured memory_bytes: 1792
#include <iostream>

using namespace std;
int main() {
    int a,b,k;
    cin >> a >> b >> k;
    int count = 0, divisor;
    if(a > b) divisor = b + 1;
    else divisor = a + 1;
    while(count < k){
        divisor--;
    if(a % divisor + b % divisor == 0)count++;
    }
    cout << divisor << endl;
    return 0;
}


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

int main(){
    int N, X, Y; cin >> N >> X >> Y;
    int dist[2001] = {0};
    for (int i = 1; i <= N; i++)
    {
        for (int j = i+1; j <= N; j++)
        {
            dist[min(j-i,min(abs(X-i)+1+abs(j-Y), abs(Y-i)+1+abs(j-X)))]++;
        }
    }
    for (int i = 1; i < N; i++){
        cout << dist[i] << endl;
    }
}

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

int main()
{
	ll X,K,D;
	cin >> X >> K >> D;
	if (abs(X) / D >= K)
	{
		if (X < 0)
		{
			cout << abs(X + D*K) << endl;
		}
		else
		{
			cout << abs(X - D*K) << endl;
		}
		return 0;
	}
	else
	{
		ll rest = K - abs(X) / D;
		ll move = abs(X) / D * D;
		if (rest % 2 == 0)
		{
			if (X < 0)
			{
				cout << abs(X + move) << endl;
			}
			else
			{
				cout << abs(X - move) << endl;
			}
			return 0;
		}
		else
		{
			if (X < 0)
			{
				cout << abs(X + move + D) << endl;
			}
			else
			{
				cout << abs(X - move - D) << endl;
			}
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size()) 
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 17;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

int main() {
	int H, W, D, i, j;
	scanf("%d %d %d", &H, &W, &D);
	for (i = 0; i < H; i++) {
		for (j = 0; j < W; j++) {
			int t1 = (i + j) % (2*D);
			int t2 = (i - j + 100000 * D) % (2 * D);
			t1 /= D, t2 /= D;
			printf("%c", "RGYB"[2*t1 + t2]);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI 3.14159265358979

double length(lli x1,lli y1,lli x2,lli y2){
	lli x = x1-x2;
	lli y = y1-y2;
	return sqrt(x*x+y*y);
}

signed main(){

	lli n;
	cin>>n;
	vector<lli> x(n),y(n),z(n);

	REP(i,0,n){
		cin>>x[i]>>y[i];
		z[i] = i;
	}
	double ans=0;
	lli cnt=0;

	do{
		double sum=0;
		lli startIndex = z[0];
		lli sx = x[startIndex];
		lli sy = y[startIndex];

		REP(i,1,n){
			lli nextIndex = z[i];
			sum += length(sx,sy,x[nextIndex],y[nextIndex]);
			sx = x[nextIndex];
			sy = y[nextIndex];
		}
		cnt++;
		ans += sum;

	}while(next_permutation(z.begin(),z.end()));

	cout<<setprecision(15);
	cout<<ans/(double)cnt<<endl; 
 
	return 0;
}

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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define XX              first
#define YY              second
#define PB              push_back
#define MP              make_pair

#define NEWLINE         cerr << "\n";
#define HOISE           cerr << "hoise " << __LINE__ << "\n"
#define PAUSE           system("pause")
#define DEBUG(x)        cerr << #x << " = " << x << "\n"
#define FASTIO          ios_base::sync_with_stdio(false);cin.tie(NULL)

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

const int INF = 1e9 + 23;
const ll INFL = 2e18 + 23;

const int MAX = 2e6 + 5;
const int MOD = 1e9 + 7;

ll F[MAX];
ll inv[MAX];
ll invF[MAX];

inline ll mult(ll x, ll y)  { return ((x%MOD)*(y%MOD))%MOD;                }
inline ll ncr(int n, int r) { return mult(mult(F[n], invF[r]), invF[n-r]); }

int modexp(int a, int p)
{
    if(p == 0) return 1;
    int ret = modexp(a, p/2);
    ret = mult(ret, ret);
    if(p%2 == 1) ret = mult(ret, a);
    return ret;
}

int32_t main()
{
    FASTIO;

    inv[0] = inv[1] = 1;
    for (ll i = 2; i < MAX; i++)
        inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;

    F[0] = 1;
    for(ll i = 1; i < MAX; i++)
        F[i] = (i*F[i-1])%MOD;

    invF[0] = invF[1] = 1;
    for(int i = 2; i < MAX; i++)
        invF[i] = (inv[i]*invF[i-1]) % MOD;


    string s;
    int k, n;
    cin >> k;
    cin >> s;
    n = s.size();
    int L = k+n;

    int ans = 0;
    for(int x = 0; x <= L-n; x++){
        int t = 1;
        t = mult(t, ncr(L-x-1, n-1));
        t = mult(t, modexp(25, L-x-n));
        t = mult(t, modexp(26, x));
        ans = (ans + t) % MOD;
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 51152
#include <bits/stdc++.h>
#define  X first
#define  Y second

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

const ll INF = 2e18;
const int inf = 1e9+10;
const int maxN = 1e5+10;
const int maxD = 15;
const int maxH = 100; 
const int MOD = 998244353;

int T;
pii a[maxN];
pii b[maxN];
int main()
{
	
	string s;
	cin>>s;
	string t = s.substr(0,3);
	cout<<t<<endl;
	return 0;
}

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

int main() {
    int a, b;
    cin >> a >> b;
    if (a > b) {
        cout << "a > b" << endl;
    } else if (a == b) {
        cout << "a == b" << endl;
    } else if (a < b) {
        cout << "a < b" << endl;
    }
    return 0;
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
void yes(bool expr) {
  cout << (expr ? "Yes" : "No") << "\n";
}
struct Node;
vector<Node> V;
struct Node {
  lint A[60];
};
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    lint N, K;
    cin >> N >> K;
    REP(i, N) {
        V.emplace_back();
        lint A;
        cin >> A;
        A--;
        V[i].A[0] = A;
    }
    FOR(i, 1, 60) {
        REP(j, N) {
            V[j].A[i] = V[V[j].A[i-1]].A[i-1];
        }
    }
    lint ans = 0;
    REP(i, 60) {
        if(((K >> i) & 1) == 1) {
            ans = V[ans].A[i];
        }
    }
    cout << ans+1 << endl;
}

Measured memory_bytes: 126348
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


l,r,d = list(map(int, input().split()))
ans = 0
for i in range(l,r+1):
    if i%d==0:
        ans += 1
print(ans)

Measured memory_bytes: 9080
import java.util.Scanner;
class Main{
    public static void main(String []args){
    Scanner input=new Scanner(System.in);
      long result=0;
      int N=input.nextInt();
      int sum[]=new int[100001];
    for(int i=0;i<N;++i){
      int temp=input.nextInt();
      ++sum[temp];
      result+=temp;
    }int operation=input.nextInt();
      for(int j=0;j<operation;j++){
        int B=input.nextInt();
        int C=input.nextInt();
        if(sum[B]!=0){
          int temp=sum[B];
          sum[B]=0;
          sum[C]+=temp;
          result+=((C-B)*temp);
        }
        System.out.println(result);
      }
    }
}

Measured memory_bytes: 60288
N, M, Q = map(int, input().split())
LR = list([tuple(map(int, input().split())) for _ in range(M)])


def to_cumsum(arr):
    """
    1次元配列を累積和の1次元配列に変換する
    """
    cumsum = 0
    new = list()
    for e in arr:
        cumsum += e
        new.append(cumsum)
    return new


def to_cumsum2d(mat):
    """
    2次元配列を累積和の2次元配列に変換する
    """
    new = [[None for _ in range(len(mat[0]))] for _ in range(len(mat))]
    for i, row in enumerate(mat):
        new[i][0] = row[0]
    new[0] = to_cumsum(mat[0])
    for i in range(1, len(mat)):
        for j in range(1, len(mat[0])):
            new[i][j] = new[i][j - 1] + new[i - 1][j] - new[i - 1][j - 1] + mat[i][j]
    return new


# train[L][R] := LからRに向かう電車の数
train = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
for L, R in LR:
    train[L][R] += 1

# 2次元累積和に変換
train = to_cumsum2d(train)

PQ = [tuple(map(int, input().split())) for _ in range(Q)]
for p, q in PQ:
    print(train[q][q] - train[p - 1][q] - train[q][p - 1] + train[p - 1][p - 1])


Measured memory_bytes: 45496
#include <iostream>
using namespace std;
struct str1
{
    int box1, box2;
};
str1 arr[100000];
struct str2
{
    bool red;
    int total;
};
str2 box[100000];
int main()
{
    int N, M;
    cin>>N>>M;
    for(int i=0; i<M; i++) cin>>arr[i].box1>>arr[i].box2;
    for(int i=0; i<N; i++)
    {
        if(i==0) box[i].red=true;
        box[i].total=1;
    }
    for(int i=0; i<M; i++)
    {
        if(box[arr[i].box1-1].red==true && box[arr[i].box1-1].total==1)
        {
            box[arr[i].box1-1].red=false;
            box[arr[i].box2-1].red=true;
        }
        if(box[arr[i].box1-1].red==true && box[arr[i].box1-1].total>1)
        {
            box[arr[i].box1-1].red=true;
            box[arr[i].box2-1].red=true;
        }
        box[arr[i].box1-1].total--;
        box[arr[i].box2-1].total++;
    }
    int ans=0;
    for(int i=0; i<N; i++)
    {
        if(box[i].red==true) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1792
module Main where
import qualified Data.ByteString.Char8         as BS
import qualified Data.ByteString.Lazy.Char8    as BSL
import qualified Data.ByteString.Builder       as BSB
import           Data.Char                      ( isSpace )
import           Data.List                      ( unfoldr )

main :: IO ()
main = do
  [n, x, t] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  print $ let (d, m) = n `divMod` x in if m == 0 then d * t else (d + 1) * t


Measured memory_bytes: 3776
#include<algorithm>
#include<climits>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<utility>
#include<vector>

#define lint long long
#define REP(i, x, n) for(int i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX

using namespace std;

int main(){
    priority_queue<int> s;
    while(true){
        string d;
        cin >> d;
        if(d == "end"){
            break;
        }
        if(d == "insert"){
            int k;
            cin >> k;
            s.push(k);
        }else if(d == "extract"){
            int a = s.top();
            cout << a << endl;
            s.pop();
        }
    }
    return 0;
}


Measured memory_bytes: 7024
#include<stdio.h>

int A[1000000],n;

int binarySearch(int);

int main()
{
  int i,q,k,sum=0;

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

  scanf("%d",&q);
  for(i=0;i<q;i++)
    {
      scanf("%d",&k);
      if(binarySearch(k))sum++;
    }
  printf("%d\n",sum);

  return 0;
}


int binarySearch(int key)
{
  int left=0;
  int right=n;
  int mid;
  while(left<right)
    {
      mid=(left+right)/2;
      if(key==A[mid]) return 1;
      if(key>A[mid]) left=mid+1;
      else if(key<A[mid]) right=mid;
    }

  return 0;
}



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

typedef long long ll;
#define pb push_back

// int gcd(int a, int b) {   if (b == 0) return a; return gcd(b, a % b);  }
// int lcm(int a,int b){return a/gcd(a,b)*b;}
void solve(){
    double d,t,s;
    cin>>d>>t>>s;
    if((d/s)<=t) cout<<"Yes";
    else cout<<"No";
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    // int t;
    // cin>>t;
    // while(t--){
    //     cout<<solve()<<"\n";
    // }
    solve();
    return 0;
}


Measured memory_bytes: 3736
X,K,D = map(int,input().split())

X = abs(X)

ans = 0

if X-(D*K) >= 0:
  ans = X-(D*K)
else:
  count = X//D
  if (K-count)%2 == 0:
    ans = X-(count*D)
  else:
    ans = min(X-(count*D)-D,X-(count*D)+D)
print(abs(ans))

Measured memory_bytes: 9156
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
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;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n, m; cin >> n >> m;
    vector<string> a(n), b(m);
    rep(i,n) cin >> a[i];
    rep(i,m) cin >> b[i];
    for (int h = 0; h+m <= n; h++) {
        for (int w = 0; w+m <= n; w++) {
            bool ok = true;
            rep(i,m)rep(j,m) {
                if (a[h+i][w+j] != b[i][j]) ok = false;
            }
            if (ok) {cout << "Yes" << endl; return 0;}
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
n,k = map(int,input().split())
A = list(map(int,input().split()))
cnt = [0]*50
L = format(k, 'b').zfill(50)
S = [[0,0] for _ in range(50)]
for a in A:
    a_ = format(a, 'b').zfill(50)
    for i in range(50):
        if a_[i]=='1':
            S[i][0] += 1
        else:
            S[i][1] += 1
for i in range(len(S)):
    S[i][0] *= pow(2, 50-i-1)
    S[i][1] *= pow(2, 50-i-1)

dp = [[-1,-1] for _ in range(55)]
dp[0][0] = 0

for i in range(50):
    
    if L[i] == '1':
        if dp[i][1] != -1:
            dp[i+1][1] = dp[i][1] + max(S[i][0], S[i][1])
        if dp[i][0] != -1:
            dp[i+1][1] = max(dp[i+1][1], dp[i][0]+S[i][0])
            dp[i+1][0] = dp[i][0] + S[i][1]
        
            
    else:
        if dp[i][1] != -1:
            dp[i+1][1] = dp[i][1] + max(S[i][1], S[i][0])
        if dp[i][0] != -1:
            dp[i+1][0] = dp[i][0] + S[i][0]

print(max(dp[50]))

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

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s; cin >> s;
	int ans = 0;
	bool f = true;
	for (int i = 0; i < s.length(); i++) {
		if (f || (i > 0 && s[i] != s[i - 1])) {
			ans++; f = false;
		}
		else {
			if (i + 1 == s.length()) break;
			ans++; f = true;
			i++;
		}
	}
	cout << ans << '\n';
	return 0;
}


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

#define EPS (1e-7)
#define X second
#define Y first

int main(){

  while(true){
    int N, ans = 1, n = 0;
    long double x, y;
    vector<long double> line;
    vector<pair<long double,int> > ip;
    vector<pair<long double, long double> > points;
    
    cin>>N;

    if(!N) break;

    
    for(int i = 0; i < N; i++){
      cin>>x>>y;
      
      points.push_back(make_pair(y,x));
      line.push_back(y+1.0);
      line.push_back(y-1.0);
    }

    for(int i = 0; i < N; i++){
      for(int j = i+1; j < N; j++){
       	if((points[i].X-points[j].X)*(points[i].X-points[j].X) + (points[i].Y-points[j].Y)*(points[i].Y-points[j].Y) > 4.0) continue;
       	long double X = points[i].X - points[j].X, Y = points[i].Y - points[j].X, a, x1, x2, y1, y2;
			
       	a = (X*X + Y*Y)/2.0;
       	y1 = (a*Y - X*sqrt(X*X+Y*Y - a*a))/(X*X+Y*Y) + points[j].Y;	
       	y2 = (a*Y + X*sqrt(X*X+Y*Y - a*a))/(X*X+Y*Y) + points[j].Y;	
       	line.push_back(y1);
       	line.push_back(y2);
       		
      }
    }

    sort(line.begin(), line.end());

    for(int i = 0; i < line.size()-1; i++){
      line[i] = (line[i+1]+line[i])/2.0;
    }
    line.pop_back();
    sort(points.begin(),points.end());

    for(int i = 0; i < line.size(); i++){
      
      for(int j = n; j < N; j++){
	long double a = fabs(line[i] - points[j].Y), b;
	if(a < 1.0){
	  b = sqrt(1.0 - a*a);
	  ip.push_back(make_pair(points[j].X-b,0));
	  ip.push_back(make_pair(points[j].X+b,1));
	}
      }

      sort(ip.begin(), ip.end());
      
      for(int j = 0, num = 0; j < ip.size(); j++,ans = max(ans,num) ) num += ip[j].second?-1:1;
      
      ip.clear();
    }

    cout<<ans<<endl;
  }

  return 0;
}



Measured memory_bytes: 4144
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvl vector<vector<ll>>
#define print(n) cout<<n<<endl
const int M=100010;
const int inf=1000000007;
const long long INF=1000000000000000007;
using ll=long long;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
vl v;



int main(){
	int n,p,a,b,c,d,e,f,s,m;
	string l;
	pair<double,string> seed[50];
	while(1){
		cin>>n;
		if(n==0)break;
		rep(i,n){
			cin>>l>>p>>a>>b>>c>>d>>e>>f>>s>>m;
			double time=a+b+c+(d+e)*m,price=f*s*m-p;
			double cospa=-1*price/time;
			seed[i].first=cospa;
			seed[i].second=l;
		}
		sort(seed,seed+n);
		rep(i,n)cout<<seed[i].second<<endl;
		cout<<"#"<<endl;
	}

}


Measured memory_bytes: 3176
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
const int ddx[4] = {1,1,-1, -1};
const int ddy[4] = {1,-1,-1,1};
//////////////////////////////////

int main(){
  vector<int> a(10);
  int x;
  for(int i=0; i<3; i++) {
    cin >> x;
    a[x]++;
  }
  for(int i=0; i<10; i++) {
    if (a[i] == 2) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;

  return 0;
}

// EOF



Measured memory_bytes: 256
import sys
import math
def input(): return sys.stdin.readline().rstrip()
from decimal import Decimal

M = 10 ** 6 + 5
N = int(input())
A = list(map(int, input().split()))

count = [0] * M
for a in A:
    if count[a] != 0:
        count[a] = 2
        continue
    for i in range(1, M):
        if i * a >= M:
            break
        count[a*i] += 1

ans = 0
for a in A:
    if count[a] == 1:
        ans += 1
    
print(ans)

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

int main() {
  int a, b, c, d, f = 0;
  scanf("%d %d %d %d", &a, &b, &c, &d);
  while(a > 0 && c > 0) {
    if(f)
      a -= d;
    else
      c -= b;
    f = (f + 1) % 2;
  }
  if(a > 0)
    printf("Yes\n");
  else
    printf("No\n");
}

Measured memory_bytes: 3764
import qualified Data.ByteString.Char8 as B
import Data.Maybe (fromJust)

main :: IO ()
main = do
    [x, y] <- map (fst . fromJust . B.readInt) . B.words <$> B.getLine
    let t = [[1, 3, 5 ,7, 8, 10, 12], [4, 6, 9, 11], [2]]
        s g = elem x g && elem y g
    putStrLn $ if foldl (\r g -> s g || r) False t then "Yes" else "No"



Measured memory_bytes: 380
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
/*
string S_str[H];
cins(S_str, S_str + H);
S_str[i][j];
*/
inline int at(ll x, int k){ return (x >> k) & 1; }
#define rep(i, n) for(ll i = 0; i < n; i++)


int main(){
  ll a,b,c,d;
  int flag ;

  cin >> a >>b>>c>>d;
  while(1){
    c = c-b;
    if(c<=0){
      flag = 0;
      break;}
    a = a-d;
    if(a<=0){
      flag = 1;
      break;
    }
  }
  if(flag==0){
    cout << "Yes" << endl;
  }
  else{
cout << "No" << endl;
  }

}


Measured memory_bytes: 3632
import java.util.*;
public class Main {
		
	public static void main(String[] args) {
		Scanner in=new Scanner (System.in);
		int N = in.nextInt();
		int K = in.nextInt();
		int X = in.nextInt();
		int Y = in.nextInt();
		int r=N-K;
		int sum=0;
		if(N>K) {
			sum=(K*X)+(r*Y);
		}
		else {
			sum=(N*X);
		}
		System.out.println(sum);
	}
}

Measured memory_bytes: 27084
#include <bits/stdc++.h>
#define TRAV(i, n) for(auto &i : n)
#define SZ(x) (int)(x).size()
#define PR std::pair
#define MP std::make_pair
#define X first
#define Y second
typedef long long ll;

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    vector<int> d(n);
    for (int i = 0; i < n; i++){
        cin >> d[i];
    }
    long long ans = 0;
    for (int i = 0; i < n; i++){
        for (int j = i + 1; j < n; j++){
            ans += d[i] * d[j];
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
fn main() {
    let mut n: usize = 0;
    let mut v: Vec<i64> = vec![];
    let mut c: Vec<i64> = vec![];

    {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut words = line.split_whitespace();
        n = words.next().unwrap().parse::<usize>().unwrap();
    }

    {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let words = line.split_whitespace();
        for word in words {
            v.push(word.parse::<i64>().unwrap());
        }
    }

    {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let words = line.split_whitespace();
        for word in words {
            c.push(word.parse::<i64>().unwrap());
        }
    }


    let mut x_y: i64 = 0;
    for i in 0..n {
        let d = v[i] - c[i];
        if d > 0 {
            x_y += d;
        }
    }
    println!("{}", x_y);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(a) (a).begin(),(a).end()
#define upper_index(v,a) (int)distance(v.begin(), upper_bound((v).begin(),(v).end(),a))
#define lower_index(v,a) (int)distance(v.begin(), lower_bound((v).begin(),(v).end(),a))

using namespace std;
typedef long long ll;

int main() {
  int N;
  cin >> N;
  vector<int> ls(N);
  rep(i,N) cin>>ls[i];
  sort(ALL(ls));
  int cnt=0;
  rep(i,N)rep(j,i) cnt+=max(0,j-upper_index(ls,ls[i]-ls[j]));
  cout << cnt << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int l = Integer.parseInt(br.readLine());
		int[] a = new int[l];
		for (int i = 0; i < l; i++) {
			a[i] = Integer.parseInt(br.readLine());
		}
		br.close();
		long[] b = new long[l + 1];
		for (int i = 0; i < l; i++) {
			b[i + 1] = b[i] + a[i];
		}

		long ans = b[l];
		long[] dplr = new long[l + 1];
		long[] dpll = new long[l + 1];
		long[] dprr = new long[l + 1];
		long[] dpll0 = new long[l + 1];
		long[] dprr0 = new long[l + 1];
		for (int i = 0; i < l; i++) {
			dplr[i + 1] = Math.min(Math.min(dplr[i], dprr[i]), b[i]) + (a[i] % 2 ^ 1);
			dpll0[i + 1] = Math.min(Math.min(Math.min(dplr[i], dpll[i]), dprr[i]), b[i]) + a[i] % 2;
			dprr0[i + 1] = Math.min(dprr[i], b[i]) + a[i] % 2;
			dpll[i + 1] = dpll0[i + 1];
			dprr[i + 1] = dprr0[i + 1];
			if (a[i] == 0) {
				dpll[i + 1] += 2;
				dprr[i + 1] += 2;
			}
			long val = Math.min(Math.min(dplr[i + 1], dpll0[i + 1]), dprr0[i + 1]) + b[l] - b[i + 1];
			ans = Math.min(ans, val);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 45144
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;

static const ll MAX = 501;
ll lis[MAX][MAX] = {};
ll color[MAX][MAX] = {};

ll calc(ll l, ll r){
    if(l == r){
        color[l][r] = 1;
        return lis[l][r];
    }
    if(color[l][r] == 0){
        lis[l][r] += calc(l+1, r);
        color[l][r] = 1;
    }
    return lis[l][r];
}
ll calc2(ll l, ll r) {
    if(l == r){
        color[l][r] = 2;
        return lis[l][r];
    }
    if(color[l][r] != 2){
        lis[l][r] += calc2(l, r-1);
        color[l][r] = 2;
    }
    return lis[l][r];
}

int main() {
    

    ll n,m,q;
    cin >> n >> m >> q;
    for (ll i=0;i<m;i++){
        ll l,r;
        cin >> l >> r;
        lis[l][r]++;
    }
    for (ll i=1;i<=n;i++){
        calc(1,i);
    }
    for(ll i=1;i<=n;i++){
        calc2(i,n);
    }
//    for (ll i=0;i<=n;i++){
//        if(i){
//            cout << endl;
//        }
//        for (ll j=0;j<=n;j++){
//            cout << lis[i][j] << " ";
//        }
//    }
//    cout << endl;
    for (ll i=0;i<q;i++){
        ll l,r;
        cin >> l >> r;
        cout << lis[l][r] << endl;
    }
}




Measured memory_bytes: 4864
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int64_t H,x=0,count=0;
  vector<pair<int,int64_t>> A(41);
  for(int i=0;i<41;i++){x+=pow(2,i);A.at(i)=make_pair(i,x);}
  cin>>H;
  while(H>=2){H/=2;count++;}
  cout<<A.at(count).second<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define rusha scanf("%d",&n);rep(i,1,n)scanf("%d",&a[i]);
#define rushb scanf("%d",&t);while(t--)
#define debug(x) cout<<" L-B-W-- "<<x<<" --N-B\n"
#define pb push_back
//#define pii pair<int,int>
#define vii vector<int>
#define fi first
#define se second
#define mem(a,b) memset(a,b,sizeof a)
#define all(x) (x.begin(),x.end())
#define judgef printf("%s\n",f?"Yes":"No")
#define Judgef printf("%s\n",f?"YES":"NO")
#define sz(x) ((int)(x).size())
#define sf(x) (sizeof(x))
using namespace std;
typedef long long ll;
typedef double db;
const double pai = acos(-1.0);
const double eps = 1e-8;
const int mod=998244353;
//const int mod=1e9+7;
const int inf=1e9+7;
//const ll inf=0x7f7f7f7f1234abcd;
const int maxn=2e5+10;
inline ll ksm(ll x,ll y){ ll res=1; while(y){if(y&1) res=res*x%mod;x=x*x%mod; y>>=1;} return res; }
inline ll inv(ll a,ll p){if(a==1)return 1;return (p-p/a)*inv(p%a,p)%p;}
ll lcm(ll a, ll b) { return a * b / __gcd(a, b); }

int t,n,m,k;
int a[maxn],b[maxn];
map<int,int> ma;
int main(){
    scanf("%d",&n);
    rep(i,1,n) {scanf("%d",&a[i]);b[i]=a[i]-i+1;}
    rep(i,1,n) ma[b[i]]++;
    ll s=0;
    rep(i,1,n){
        ma[b[i]]--;
        s+=ma[-(a[i]+i-1)];
    }
    printf("%lld\n",s);
    return 0;
}


Measured memory_bytes: 22168
#include<bits/stdc++.h>
#define ls p<<1
#define rs p<<1|1 
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define mm make_pair
#define pi 2*acos(0.0)
#define lcm(a,b) (a*b)/__gcd(a,b)
#define cp(i,ans) printf("%.if",ans);
#define cpp(i,ans) cout.precision(i);cout<<fixed<<ans<<endl;
#define lowbit(x) (x)&(-x)
#define out(x) {cout<<x<<endl;return 0;} 
#define all(v) v.begin(),v.end() 
#define mem(x,i) memset(x,i,sizeof(x)) 
#define mec(x,y) memcpy(x,y,sizeof(y))
#define eps 1e-8 
#define ull unsigned long long
#define cps CLOCKS_PER_SEC
using namespace std;
typedef long long ll;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
ll gcd(ll x,ll y){if(y==0) return x;else return gcd(y,x%y);} 
ll ksm(ll a,ll b){ll r=1;while(b){if(b&1) r=(r*a)%mod;a=a*a%mod;b>>=1;}return r;} 
void exgcd(ll a, ll b, ll &x, ll &y, ll &d){if(!b) d=a,x=1,y=0;else exgcd(b,a%b,y,x,d),y-=a/b*x;}
ll inv(ll a, ll p){ll x,y,d;exgcd(a,p,x,y,d);x=(x%p+p)%p;return x;}
inline int read()
{
    char c=getchar();int x=0,f=1;
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    return x*f;
}
const int maxn=1e5+100;
int n,m,k,t;
string s;
int main()
{
	cin>>s;
	if(s=="ABC") cout<<"ARC\n";
	else cout<<"ABC\n";
}

Measured memory_bytes: 3632
#include<stdio.h>
  int main(){
    int k,a,b;
    scanf("%d",&k);
    scanf("%d%d",&a,&b);
    
    int max = (b/k)*k;
    
    if (max>=a){
      printf("OK");
    }
    else {
      printf("NG");
    }
    return 0;
  }

    


Measured memory_bytes: 1712
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	int N, X, Y;
	int[] xDists, yDists, dists;

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

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		N = Integer.parseInt(tokens[0]);
		X = Integer.parseInt(tokens[1]) - 1;
		Y = Integer.parseInt(tokens[2]) - 1;
	}

	void calc() {
		this.xDists = new int[N];
		this.yDists = new int[N];

		// x起点の距離
		for (int i = 0; i < N; ++i) {
			xDists[i] = i - X;
		}
		for (int i = Y; i < N; ++i) {
			xDists[i] = 1 + i - Y;
		}
		// y起点の距離
		for (int i = 0; i < N; ++i) {
			yDists[i] = i - Y;
		}
		for (int i = 0; i <= X; ++i) {
			yDists[i] = -1 - (X - i);
		}
		// 距離としては，直接いくか，xを経由するか，yを経由するかの3卓
		this.dists = new int[N];
		Arrays.fill(dists, 0);
		for (int i = 0; i < N; ++i) {
			for (int j = i + 1; j < N; ++j) {
				int dist = j - i;
				dist = Math.min(dist, Math.abs(xDists[i]) + Math.abs(xDists[j]));
				dist = Math.min(dist, Math.abs(yDists[i]) + Math.abs(yDists[j]));
				dist = Math.min(dist,  Math.abs(xDists[i]) + 1 + Math.abs(yDists[j]));
				dist = Math.min(dist,  Math.abs(xDists[j]) + 1 + Math.abs(yDists[i]));
				dists[dist]++;
			}
		}

	}

	void showResult() {
		for (int i = 1; i < N; ++i) {
			System.out.println(dists[i]);
		}
	}
}


Measured memory_bytes: 22484
#include<stdio.h>
int main(){
  int n;
  int ans=0;
  scanf("%d",&n);
  if(n<10){
    ans=n;
  }
  else if(n<100){
    ans=9;
  }
  else if(n<1000){
    ans=n-99+9;
  }
  else if(n<10000){
    ans=909;
  }
  else if(n<100000){
    ans=n-9999+909;
  }
  else ans=90909;
    
  printf("%d",ans);
  return 0;
}

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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = ll(1e9) + 7;
const int INF = int(1e9);

const int MAX_V=202;

// 行先,容量,逆辺
struct edge {
	int to, cap, rev;
	edge(int to, int cap, int rev) :to(to), cap(cap), rev(rev) {};
};

vector<edge>G[MAX_V];
int level[MAX_V];	//sからの距離
int iter[MAX_V];	//どこまで調べ終わったか

//fromからtoへ向かう容量capの辺をグラフに追加する
void add_edge(int from, int to, int cap) {
	G[from].push_back(edge( to, cap, G[to].size()));
	G[to].push_back(edge(from, 0, G[from].size() - 1 ));
}

// sからの最短距離をBFSで計算
void bfs(int s) {
	memset(level, -1, sizeof(level));
	queue<int>que;
	level[s] = 0;
	que.push(s);
	while (!que.empty()) {
		int v = que.front(); que.pop();
		for (int i = 0; i < G[v].size(); i++) {
			edge &e = G[v][i];
			if (e.cap > 0 && level[e.to] < 0) {
				level[e.to] = level[v] + 1;
				que.push(e.to);
			}
		}
	}
}

//増加パスをDFSで探す
int dfs(int v, int t, int f) {
	if (v == t)return f;
	for (int &i = iter[v]; i < G[v].size(); i++){
		edge &e = G[v][i];
		if (e.cap > 0 && level[v] < level[e.to]) {
			int d = dfs(e.to, t, min(f, e.cap));
			if (d > 0) {
				e.cap -= d;
				G[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
		return 0;
}

int Max_flow(int s, int t) {
	int flow = 0;
	while (1) {
		bfs(s);
		if (level[t] < 0)return flow;
		memset(iter, 0, sizeof(iter));
		int f;
		while (f = dfs(s, t, INF) > 0) {
			flow += f;
		}
	}
}



int main() {
	cin.sync_with_stdio(false);
	int N;
	cin >> N;
	vector<pair<int, int>>R(N), B(N);
	rep(i, N)cin >> R[i].first >> R[i].second;
	rep(i, N)cin >> B[i].first >> B[i].second;

	int s = 2*N, t = 2*N + 1;
	rep(i, N)add_edge(s, i, 1);
	rep(i, N)add_edge(N + i, t, 1);

	rep(i, N) {
		rep(j, N) {
			if (B[i].first > R[j].first&&B[i].second > R[j].second) {
				add_edge(i, N + j, 1);
			}
		}
	}
	
	cout << Max_flow(s, t) << endl;

	return 0;
}


Measured memory_bytes: 384