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

using namespace std;

#define  CLR(a)  memset(a,0,sizeof(a))
#define  SET(a)  memset(a,-1,sizeof(a))
#define  nl "\n";
#define FIO ios_base::sync_with_stdio(false);cout.setf(ios::fixed);cout.precision(10);cout.tie(nullptr);cin.tie(nullptr);

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

template < class T> inline T biton(T n, T pos) { return n | ((T)1 << pos); }
template < class T> inline T bitoff(T n, T pos) { return n & ~((T)1 << pos); }
template < class T> inline T ison(T n, T pos) { return (bool)(n & ((T)1 << pos)); }
template < class T> inline T gcd(T a, T b) { while (b) { a %= b; swap(a, b); }return a; }

template <class T> inline T bigmod(T p, T e, T m) {
	T ret = 1;
	for (; e > 0; e >>= 1) {
		if (e & 1) ret = (ret * p) % m; p = (p * p) % m;
	} return (T)ret;
}

#define DEBUG

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



void solve()
{
	string s1,s2;
	cin>>s1>>s2;

    int cnt=0;

  	for(int i=0;i<(int)s1.size();i++){
          cnt+=s1[i]!=s2[i];
	}

	cout<<cnt<<nl;
}

int main()
{
	FIO;

	int t = 1;

	while (t--)
	{
		solve();
	}

	return 0;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) { a = b; return 1;} return 0;}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) { a = b; return 1;} return 0;}
#define dame {cout<< "0" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
#define PI (acos(-1))
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll N; cin>>N;
    string S; cin>>S;
    ll ct=0,ans=0;
    rep(i,N){
        if(S[i]=='A'){ct=1; continue;}
        if(ct==1 and S[i]=='B'){ct=2; continue;}
        if(ct==2 and S[i]=='C'){ct=0; ++ans; continue;}
        ct=0;
    }
    cout<< ans <<"\n";
}

//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 256
from typing import List
from math import sqrt

EPS = 1e-10


def float_equal(x: float, y: float) -> bool:
    return abs(x - y) < EPS


class Point:

    def __init__(self, x: float=0.0, y: float=0.0) -> None:
        self.x = x
        self.y = y

    def __repr__(self) -> str:
        return "Point({}, {})".format(self.x, self.y)

    def __eq__(self, other: object) -> bool:
        if not isinstance(other, Point):
            # print("NotImplemented in Point")
            return NotImplemented
        return float_equal(self.x, other.x) and \
            float_equal(self.y, other.y)

    def __add__(self, other: 'Point') -> 'Point':
        return Point(self.x + other.x, self.y + other.y)

    def __sub__(self, other: 'Point') -> 'Point':
        return Point(self.x - other.x, self.y - other.y)

    def __mul__(self, k: float) -> 'Point':
        return Point(self.x * k, self.y * k)

    def __rmul__(self, k: float) -> 'Point':
        return self * k

    def __truediv__(self, k: float) -> 'Point':
        return Point(self.x / k, self.y / k)

    def __lt__(self, other: 'Point') -> bool:
        return self.y < other.y \
            if abs(self.x - other.x) < EPS \
            else self.x < other.x

    def norm(self):
        return self.x * self.x + self.y * self.y

    def abs(self):
        return sqrt(self.norm())

    def dot(self, other: 'Point') -> float:
        return self.x * other.x + self.y * other.y

    def cross(self, other: 'Point') -> float:
        return self.x * other.y - self.y * other.x

    def is_orthogonal(self, other: 'Point') -> bool:
        return float_equal(self.dot(other), 0.0)

    def is_parallel(self, other: 'Point') -> bool:
        return float_equal(self.cross(other), 0.0)


Vector = Point


class Segment:

    def __init__(self, p1: Point = None, p2: Point = None) -> None:
        self.p1: Point = Point() if p1 is None else p1
        self.p2: Point = Point() if p2 is None else p2

    def __repr__(self) -> str:
        return "Segment({}, {})".format(self.p1, self.p2)

    def __eq__(self, other: object) -> bool:
        if not isinstance(other, Segment):
            # print("NotImplemented in Segment")
            return NotImplemented
        return self.p1 == other.p1 and self.p2 == other.p2

    def vector(self) -> Vector:
        return self.p2 - self.p1

    def is_orthogonal(self, other: 'Segment') -> bool:
        return self.vector().is_orthogonal(other.vector())

    def is_parallel(self, other: 'Segment') -> bool:
        return self.vector().is_parallel(other.vector())

    def projection(self, p: Point) -> Point:
        v = self.vector()
        vp = p - self.p1
        return v.dot(vp) / v.norm() * v + self.p1


Line = Segment


def main():
    x1, y1, x2, y2 = [int(x) for x in input().split()]
    p1 = Point(x1, y1)
    p2 = Point(x2, y2)
    l = Line(p1, p2)

    q = int(input())

    for _ in range(q):
        x, y = [int(x) for x in input().split()]
        p = Point(x, y)
        a = l.projection(p)
        print(a.x, a.y)


if __name__ == "__main__":
    main()



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

int main(){
  int N,M;
  cin >> N >> M;
  int ans;
  
  ans=100*(N-M)+M*1900;
  
  for(int i=0;i<M;i++){
    ans *= 2;
  }
  
  cout <<ans <<endl;
  
  return 0;
  
}

Measured memory_bytes: 3632
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

fun main() {
    val (h, w) = nextIntList()
    val (cy, cx) = nextIntList()
    val (dy, dx) = nextIntList().map { it - 1 }
    val map = (0 until h).map {
        next().toList().map { it.toString() }
    }
    val arrivalMap = sized2DArray(h, w, Int.MAX_VALUE)
    val queue = LinkedList<Point>()
    queue.add(Point(cx - 1, cy - 1, 0))
    while (queue.isNotEmpty()) {
        val point = queue.pollFirst()
        val x = point.x
        val y = point.y
        val v = point.v
        if (arrivalMap[y][x] <= v) continue
        arrivalMap[y][x] = v
        (max(y - 2, 0)..min(y + 2, h - 1)).forEach {nextY ->
            (max(x - 2, 0)..min(x + 2, w - 1)).forEach { nextX ->
                if (abs(nextY - y) + abs(nextX - x) < 2) {
                    if (map[nextY][nextX] == "." && arrivalMap[nextY][nextX] > v) {
                        queue.addFirst(Point(nextX, nextY, v))
                    }
                } else {
                    val nextV = v + 1
                    if (map[nextY][nextX] == "." && arrivalMap[nextY][nextX] > nextV) {
                        queue.add(Point(nextX, nextY, nextV))
                    }
                }
            }
        }
    }
    if (arrivalMap[dy][dx] > 1_000_000_000) {
        println(-1)
    } else {
        println(arrivalMap[dy][dx])
    }
}

data class Point(val x: Int, val y: Int, val v: Int)

// # Utils
// ## Input
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = next().split(" ").map(String::toInt)
fun nextLongList() = next().split(" ").map(String::toLong)
fun nextDoubleList() = next().split(" ").map(String::toDouble)

// ## Array
inline fun <reified T> sizedArray(size: Int, default: T) = Array(size) { default }
inline fun <reified T> sized2DArray(row: Int, column: Int, default: T) = Array(row) { Array(column) { default } }

// ## mod^-1
//    [NOTE] CANNOT use this for 0, mod, 2mod, 3mod ...(return wrong value)
fun modinv(num: Long, mod: Long): Long {
    var a = num
    var b = mod
    var u = 1L
    var v = 0L
    while (b > 0) {
        val t = a.div(b)
        a -= t * b
        a = b.also { b = a } // swap a and b
        u -= t * v
        u = v.also { v = u } // swap u and v
    }
    u %= mod
    if (u < 0) u += mod
    return u
}

Measured memory_bytes: 139084
#include <bits/stdc++.h>
using namespace std;
int main() {
	double n, x[8], y[8], bd[8][8], cnt=0;
  	cin >> n;
	for (int i=0; i<n; i++)
		cin >> x[i] >> y[i];
	for (int i=0; i<n; i++)
		for (int j=0; j<n; j++) {
			bd[i][j] = sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
			cnt += bd[i][j];
		}
	cout.precision(17);
	cout << cnt/n << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define X 1000000007
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
typedef pair<int,int> P;
typedef pair<P,P> PP;
int main(void)
{
	int n,m,s,g,v,p;
	int pp,kou,min;
	int i,j,k;
	int ri[21][21],leng[21],flg[21];
	
	PP d[100];
	
	scanf("%d %d",&n,&m);
	for(i=0;i<m;i++) scanf("%d,%d,%d,%d",&d[i].ff,&d[i].fs,&d[i].sf,&d[i].ss);
	scanf("%d,%d,%d,%d",&s,&g,&v,&p);
	
	for(i=0;i<=n;i++) fill(ri[i]+1,ri[i]+n+1,X);
	for(i=0;i<m;i++) ri[d[i].ff][d[i].fs]=d[i].sf,
					 ri[d[i].fs][d[i].ff]=d[i].ss;
					 
	for(i=1;i<=n;i++) leng[i]=X,flg[i]=0;
	leng[s]=0;
	
	kou=0;
	for(i=1;i<=n;i++){
		min=X;
		
		for(j=1;j<=n;j++) if(flg[j]==0&&leng[j]<min) pp=j,min=leng[j];
		flg[pp]=1;
		
		for(k=1;k<=n;k++){
			if(leng[pp]+ri[pp][k]<leng[k]) leng[k]=leng[pp]+ri[pp][k];
		}	
	}
	kou+=leng[g];
	
	for(i=1;i<=n;i++) leng[i]=X,flg[i]=0;
	leng[g]=0;
	
	for(i=1;i<=n;i++){
		min=X;
		
		for(j=1;j<=n;j++) if(flg[j]==0&&leng[j]<min) pp=j,min=leng[j];
		flg[pp]=1;
		
		for(k=1;k<=n;k++){
			if(leng[pp]+ri[pp][k]<leng[k]) leng[k]=leng[pp]+ri[pp][k];
		}	
	}
	kou+=leng[s];

	printf("%d\n",v-p-kou);
	return 0;
}	
	


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

int main() {
  long int a,b,c;
  scanf("%ld %ld %ld\n", &a,&b,&c);
  if ((c-a-b)*(c-a-b)>4*a*b&&c-a-b>0) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}


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

#define MAX 200005

vector<int> adjacents[MAX];
int color[MAX];
int treeSize[MAX] = {0};

// acumColorTrees[i] : 色iのノードを根にもつ部分木のサイズ総計
// ただし部分木に部分木が含まれる場合は大きいほうのみ計上
int acumColorTrees[MAX] = {0};

// 色iを含まない部分木の各々についてそのサイズを保存しておく
ll notColorUsePathCount[MAX];

ll getPathCount(int n)
{
    return (ll)n * (n+1) / 2;
}

void dfs(int node, int parent)
{
    int col = color[node];
    int bef1 = acumColorTrees[col];

    for (int adj : adjacents[node]) {
        if (adj == parent) continue;
        int bef2 = acumColorTrees[col];
        dfs(adj, node);
        int cut = acumColorTrees[col] - bef2;
        notColorUsePathCount[col] += getPathCount(treeSize[adj] - cut);
        treeSize[node] += treeSize[adj];
    }
    treeSize[node]++;
    acumColorTrees[col] = bef1 + treeSize[node];
}

int main(int, char**)
{
    int n;
    cin >> n;

    int tmp;
    for (int i = 0; i < n; i++) {
        cin >> tmp;
        color[i] = tmp-1;
    }
    int a, b;
    for (int i = 0; i < n-1; i++) {
        cin >> a >> b;
        a--; b--;
        adjacents[a].push_back(b);
        adjacents[b].push_back(a);
    }

    dfs(0, -1);
    for (int i = 0; i < n; i++) {
        notColorUsePathCount[i] += getPathCount(n - acumColorTrees[i]);
    }
    for (int i = 0; i < n; i++) {
        cout << getPathCount(n) - notColorUsePathCount[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 36980
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int K;
    string S;
    cin >> K; cin >> S;

    REP(i, min(K, int(S.size()))) {
        cout << S[i];
    }

    if (K < S.size()) cout << "...";
    cout << endl;
    
}


Measured memory_bytes: 3620
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<queue>
using namespace std;

const int N=100005;
const int inf=1000000000;

struct E{
	int to,next,w;
}mem[N<<1];
struct node{
	int x,d;
	node(){}
	node(int x,int d):x(x),d(d){}
	friend bool operator<(node a,node b){
		return a.d>b.d;
	}
};
int n,num;
int dis[N],head[N];
bool vis[N];
priority_queue<node> q;

void add(int x,int y,int w){
	num++;
	mem[num].to=y; mem[num].next=head[x]; mem[num].w=w;
	head[x]=num;
}

int main(){
	int i,j,u; node k;
	scanf("%d",&n);
	for (i=0;i<n;i++){
		add(i,(i+1)%n,1);
		add(i,i*10%n,0);
	}
	for (i=0;i<n;i++) dis[i]=inf;
	dis[1]=1; q.push(node(1,1));
	while (!q.empty()){
		k=q.top(); q.pop();
		if (vis[k.x]) continue;
		vis[k.x]=1;
		for (j=head[k.x];j;j=mem[j].next){
			u=mem[j].to;
			if (dis[k.x]+mem[j].w<dis[u]){
				dis[u]=dis[k.x]+mem[j].w;
				q.push(node(u,dis[u]));
			}
		}
	}
	printf("%d\n",dis[0]);
	return 0;
}

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

int x[200010];

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

    int n;cin>>n;
    vector<int> y(n);
    for(int i=0;i<n;i++)
    {
        cin>>x[i];
        y[i]=x[i];
    }

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

    for(int i=0;i<n;i++)
    {
        if(x[i]>=y[n/2])cout<<y[n/2-1]<<"\n";
        else cout<<y[n/2]<<"\n";
    }

    return 0;
}


Measured memory_bytes: 4740
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
using namespace std;
long long int res_map[2005][2005] = {};

int main() {
	const long long int mod = 1000000007;
	map<long long int, long long int>mp;
	//cout << fixed << setprecision(10);
	long double big, small, wa;
	long long int n, m,k,x, res = 0, cou = 1, mi = 999999999, ma = -9999999999,tmp[2005];
	long long int max_id, min_id, L[200000], w, h, y, a[200001], sum[200001] = {};
	long long int s[2005], t[2005];
	cin >>n>>m ;
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	for (int i = 0; i < m; i++) {
		cin >> t[i];
	}
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < n; j++) {
			if (s[j] == t[i]) {
				res_map[i][j] = 1 + sum[j];
				res_map[i][j] %= mod;
			}
		}
		tmp[0] = 0;
		for (int j = 1; j <= n; j++) {
			
			tmp[j] = res_map[i][j-1]+tmp[j-1];

			
		}
		for (int j = 1; j <= n; j++) {
			
			sum[j] = sum[j] + tmp[j];
			sum[i] %= mod;

		}
	}
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < n; j++) {
			res += res_map[i][j];
		}
		cout << endl;
	}
	cout << (res+1)%mod;
}


Measured memory_bytes: 33024
#include <bits/stdc++.h>
using namespace std;
int main() {
	long long n1,n2,cnt=1; cin>>n1>>n2;
	long long n=__gcd(n1,n2); 
	for(long long i=2;i*i<=n;i++) {
		if(n%i==0) {
			cnt++;
			while(n%i==0) n/=i;
		}
	}
	
	if(n>1) cnt++;
	cout<<cnt<<endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
//#include <istream>
//#include <sstream>
using namespace std;

int main()
{
	string S;
	int N;
	int K;
	char ss;
	cin >> N;
	cin >> S;
	cin >> K;
	ss = S[K-1];

	for (int i = 0; i < N; i++)
	{
		if (S[i] != ss) {
			S[i] = '*';
		}
	}
	cout << S << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

vector<long long> divisor(long long n){
    vector<long long> ret;
    for(long long i = 1; i * i <= n; i++){
        if(n % i == 0){
            ret.push_back(i);
            if(i * i != n) ret.push_back(n / i);
        }
    }
    sort(begin(ret), end(ret));
    return (ret);
}

signed main(){
    int n;
    cin >> n;
    int a[n + 1];
    for(int i = 1; i <= n; i++) cin >> a[i];
    int b[n + 1],cnt[n + 1] = {};
    for(int i = n / 2 + 1; i <= n; i++){
        b[i] = a[i];
        if(b[i] == 1){
            vector<ll> vec = divisor(i);
            REP(j,vec.size()){
                cnt[vec[j]]++;
            }
        }
    }
    for(int i = n / 2; i > 0; i--){
        if(cnt[i] % 2 == a[i]) b[i] = 0;
        else{
            b[i] = 1;
            vector<ll> vec = divisor(i);
            REP(j,vec.size()){
                cnt[vec[j]]++;
            }
        }
    }
    int m = 0;
    for(int i = 1; i <= n; i++){
        if(b[i] == 1) m++;
    }
    cout << m << endl;
    if(m > 0){
        for(int i = 1; i <= n; i++){
            if(b[i] == 1) cout << i << " ";
        }
        cout << endl;
    }
}

Measured memory_bytes: 3200
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 1000000000
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

int main(){
  ll N, M;
  cin >> N >> M;
  vector<ll> a(M), b(M);
  rep(i, M){
    cin >> a.at(i) >> b.at(i);
    a.at(i)--;
    b.at(i)--;
  }
  vector<pair<ll, ll>> req(M);
  rep(i, M){
    req.at(i).first = b.at(i);
    req.at(i).second = a.at(i);
  }
  sort(all(req));
  ll cnt = 0;
  ll last = -1;
  rep(i, M){
    if(req.at(i).second >= last){
      cnt++;
      last = req.at(i).first;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3456
#include <iostream>
#include <vector>

int main()
{
	int r, c;
	std::cin >> r >> c;
	std::vector< std::vector<int> > table;
	table.resize(r + 1);
	for (int i = 0; i <= r; i++)
	{
		table[i].resize(c + 1);
	}
	for (int i = 0; i < r; i++)
	{
		for (int j = 0; j < c; j++)
		{
			int data;
			std::cin >> data;
			table[i][j] = data;
			table[i][c] += data;
			table[r][j] += data;
			table[r][c] += data;
		}
	}
	for (int i = 0; i <= r; i++)
	{
		for (int j = 0; j <= c; j++)
		{
			if (j > 0)
			{
				std::cout << " ";
			}
			std::cout << table[i][j];
		}
		std::cout << '\n';
	}
	return 0;
}

Measured memory_bytes: 3124
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N,K;
ll p[200010];
int main(){
    cin>>N>>K;
    for(ll i=0;i<N;i++){
        cin>>p[i];
    }
    double ma=0;
    for(ll i=0;i<K;i++){
        ma+=(p[i]+1)/2.0;
    }
    double now=ma;
    for(ll i=0;i<N-K;i++){
        now-=(p[i]+1)/2.0;
        now+=(p[i+K]+1)/2.0;
        ma=max(ma,now);
    }
    cout<<setprecision(10)<<ma<<endl;

    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
    ll A,B;cin>>A>>B;
    if(A>B*2){
                cout<<A-(2*B)<<endl;
              }
    else if(A<=B*2){
                    cout<<0<<endl;
                    }
  

}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define maxn 100005
#define ll long long
const int mod1 = 1e9+7;
const int mod2 = 998244353;

int n,m;

int main()
{
	cin>>n>>m;
	if(n<m)printf("0");
	else printf("10");
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		
		


		    

		      Scanner scanner = new Scanner(System.in);
		      int x = scanner.nextInt();
		      
		      if ( (x>=1)&&(x<=100) ) {
		        double result = Math.pow(x,3);
		        System.out.println(Math.round(result));
		      } 

		    

		  
		
		

	}

}

Measured memory_bytes: 26084
// Something_ABC.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
using namespace std;

int main()
{
	string S;
	cin >> S;
	string ans;
	for (int i = 0;i < S.size();i++) {
		if (i % 2 == 0) {
			ans = ans + S.at(i);
		}
	}
	cout << ans << endl;
}


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

int main(){
    int x;
    cin >> x;
    if(x < 1200) cout << "ABC" << endl;
    else cout << "ARC" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
int main()
{
	int a[300];
	int b[300];
	int c[300]={0};
	int j = 0;
	for ( int i = 0; i < 300; i++ )
	{
		std::cin >> a[i] >> b[i];
		if ( a[i] == 0 && b[i] == 0 )
		{
			break;
		}
				else
			{
				j++;
		    }
	}
	for ( int i = 0; i < j; i++ )
	{
		int count = 0;
		for ( int m = 1; m <= a[i]; m++ )
		{
			for ( int n = m+1; n <= b[i]-m-3; n++ )
			{
				int k=b[i]-m-n;
				if ( n<k && k<=a[i] )
				{
					count++;
				}
			}
		}
		c[i]=count;
	}
	for ( int i = 0; i < j; i++ )
	{
		std::cout << c[i] << std::endl;
	}
	return 0;
}


Measured memory_bytes: 3108
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<cctype>
#define ld long double
#define ll long long int
#define ull unsigned long long int
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long INF=1LL<<60;


int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	int a[101]={0},aa,b,c,d,i,ans=0;
	cin>>aa>>b>>c>>d;
	for(i=aa;i<=b;i++)a[i]++;
	for(i=c;i<=d;i++)a[i]++;
	for(i=0;i<=100;i++)if(a[i]==2)ans++;;
	
	if(ans==0)cout<<ans<<endl;
	else cout<<ans-1<<endl;
	
	
	
	
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
ll n, a[210000], p, res;
int main(void){
    // Your code here!
    cin >> n;
    for (ll i = 1; i <= n; i++) {
        cin >> p;
        if (i == p) a[i]++;
    }
    for (ll i = 1; i <= n; i++) {
        if (a[i]) {
            res++;
            a[i + 1] = 0;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 1024
fun main(args: Array<String>) {
    Program().solve()
}

class Program {
    fun solve() {
        val sc = MyScanner()
        val (sx, sy, tx, ty) = sc.intList()
        val dx = tx - sx
        val dy = ty - sy
        val sb = StringBuilder()
        sb.append("U".repeat(dy))
        sb.append("R".repeat(dx))
        sb.append("D".repeat(dy))
        sb.append("L".repeat(dx))

        sb.append("L")
        sb.append("U".repeat(dy + 1))
        sb.append("R".repeat(dx + 1))
        sb.append("D")
        sb.append("R")
        sb.append("D".repeat(dy + 1))
        sb.append("L".repeat(dx + 1))
        sb.append("U")

        println(sb)

    }
}

class MyScanner {
    private var ptr = 0
    private var l = listOf<String>()

    fun next(): String {
        while (l.size <= ptr) {
            l = readLine()!!.split(' ')
            ptr = 0
        }
        return l[ptr++]
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextDouble() = next().toDouble()
    fun nextCharArray() = next().toCharArray()
    fun nextChar() = next()[0]

    fun list(): List<String> {
        ptr = l.size
        return readLine()!!.split(' ')
    }

    fun intList() = list().map { s -> s.toInt() }
    fun longList() = list().map { s -> s.toLong() }
    fun doubleList() = list().map { s -> s.toDouble() }

    fun array() = list().toTypedArray()
    fun intArray() = intList().toIntArray()
    fun longArray() = longList().toLongArray()
    fun doubleArray() = doubleList().toDoubleArray()
}


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

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

	int n,k;
	cin>>n>>k;
	vector<int> prices(n);
	for(int i=0; i<n; ++i){
		cin>>prices[i];
	}
	sort(prices.begin(), prices.end());
	int ans = 0;
	for(int i=0; i<k; ++i){
		ans += prices[i];
	}
	cout<<ans<<'\n';


	return 0;
}


Measured memory_bytes: 3660
L = input()

mod = 10 ** 9 + 7
n = len(L)
dp1 = 1
dp2 = 0

for i in range(n):
    if L[i] == "0":
        dp2 = (dp2 * 3) % mod
    else:
        dp2 = (dp1 + dp2 * 3) % mod
        dp1 = (dp1 * 2) % mod

print((dp1 + dp2) % mod)


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

vector<bool>Sieve(long long n){
  vector<bool>table(n+1);
  for(long long i = 0;i < n+1;i++){
    table.at(i) = true;
  }
  for(long long i = 2;i <= n;i++){
    if(table.at(i) == true){
      long long j = i;
      while(j <= n){
        if(j != i) table.at(j) = false;
        j += i;
      }
    }
  }
  return table;
}

int main() {
  long long n;
  cin >> n;
  vector<bool>table;
  table = Sieve(1000000);
  for(long long i = n;i <= 1000000;i++){
    if(table.at(i) == true){
      cout << i << endl;
      return 0;
    }
  }
}



Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <numeric>
#include <utility>
#include <iomanip>

using namespace std;
using int64 = long long;

struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;

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

    if (s=="RRR") {
        cout << 3 << endl;
        return 0;
    }
    else if (s=="RRS" || s=="SRR") {
        cout << 2 << endl;
        return 0;
    }

    for (int i=0; i<3; i++) {
        if (s[i] != 'R')
            continue;
        cout << 1 << endl;
        return 0;
    }
    cout << 0 << endl;
}


Measured memory_bytes: 3248
#include <iostream>

 

using namespace std;

 

int main()
{
   int i, h, m, s;
   cin >> i;
   h = i /3600 ;
   m = i /60 - h * 60;
   s = i % 60;
   
   cout << h << ":" << m << ":"<< s <<  endl; 
   
   return 0;
}


Measured memory_bytes: 3088
N = int(input())
*bricks, = map(int, input().split())

current = 0
order = 1
destroy = 0
while current < N:
    if bricks[current] == order:
        order += 1
    else:
        destroy += 1
    current += 1
else:
    print(destroy) if destroy < N else print(-1)




    





Measured memory_bytes: 26140
#include<bits/stdc++.h>
using namespace std;
int MOD = 1000000007;
int main(){
    int w, n;
    int ct = 1;
    while(cin >> w >> n, w){
    int va[n], we[n];
    for(int i = 0; i < n; i++)  scanf("%d, %d",&va[i], &we[i]);
    int dp[1010][1010];
    for(int i = 0; i < 1010; i++)
        for(int j = 0; j < 1010; j++)
            dp[i][j] = 0;
    for(int i = 0; i < n; i++)
        for(int j = 0; j <= w; j++){
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
            if(j + we[i] <= w)
                dp[i + 1][j + we[i]] = max(dp[i + 1][j + we[i]], dp[i][j] + va[i]);
        }
    int macs = 0, sumwe = 1010;
    for(int i = 0; i <= n; i++)
        for(int j = 0; j <= w; j++)
            if(dp[i][j] == dp[n][w])
                sumwe = min(j, sumwe);
    cout << "Case " << ct << ":" << endl << dp[n][w] << endl << sumwe << endl;
    ct++;
    }
    return 0;
}

Measured memory_bytes: 7132
import java.util.*;

public class Main{

	public static void main(String[] arg){
    	Scanner sc=new Scanner(System.in);
      
      	int r=sc.nextInt();
      	int g=sc.nextInt();
      	int b=sc.nextInt();
      
      	int multi=10*g+b;
      
      	if(multi%4==0){
          	System.out.println("YES");
        }else{
        	System.out.println("NO");	
        }
      
    }
}

Measured memory_bytes: 20948
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define MP make_pair
#define PB push_back
#define ll long long
#define int long long
#define f(i,x,n) for(int i=x;i<n;i++)
#define ld long double
const int mod=1000000007;
const int INF=1e18;
int a[1000005];
// 0 if prime, else shortest factor of number
int prime[1000006];
void sieve(int n) {
    prime[0]=prime[1]=1; //To be taken care of
    for(int i=2;i*i<=n;i++)
        if(prime[i]==0)
            for(int j=i*i;j<=n;j+=i)
                if(prime[j]==0)
                    prime[j]=i;
}
int b[1000006];
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    sieve(1000004);
    int n;
    cin>>n;
    f(i,0,n)
        cin>>a[i];
    int gc=0;
    f(i,0,n)
        gc=__gcd(gc,a[i]);   
    if(gc!=1) {
        cout<<"not coprime\n";
    }
    else {
        int flag=0;
        f(i,0,n) {
            while(a[i]>1) {
                if(prime[a[i]]==0) {
                    b[a[i]]++;
                    if(b[a[i]]>1)
                        flag=1;
                    a[i]=1;
                }
                else {
                    b[prime[a[i]]]++;
                    if(b[prime[a[i]]]>1)
                        flag=1;
                    int val=prime[a[i]];
                    while(a[i]%val==0)
                        a[i]/=val;
                }
            }
        }
        if(flag==1) {
            cout<<"setwise coprime\n";
        }
        else {
            cout<<"pairwise coprime\n";
        }
    }
    return 0;
}

Measured memory_bytes: 26980
import java.util.Scanner;
import java.util.LinkedList;

public class Main {
    public static Scanner sc;
    public static LinkedList<Integer> list;
    public static void main(String[] args) throws Exception {
        sc = new Scanner(System.in);
        int n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            list = new LinkedList<>();
            list.add(0);
            list.add(0);
            list.add(0);
            
            int out = 0;
            int score = 0;
            
            while (out != 3) {
                String s = sc.next();
                
                switch(s) {
                    case "HIT":
                        list.add(1);
                        if (list.poll() == 1) score++;
                        break;
                    case "HOMERUN":
                        list.add(0);
                        list.add(0);
                        list.add(0);
                        if (list.poll() == 1) score++;
                        if (list.poll() == 1) score++;
                        if (list.poll() == 1) score++;
                        score++;
                        break;
                    case "OUT":
                        out++;
                }
            }
            
            System.out.println(score);
        }
    }
}

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

int main() {
  ll a,b,c,k;
  cin >> a >> b >> c >>k;
  ll sum=0;

  while(a>0){
    if(k<=0)break;
    sum++;
    a--;
    k--;
  }
  while(b>0){
    if(k<=0)break;
    b--;
    k--;
  }
  while(c>0){
    if(k<=0)break;
    sum--;
    c--;
    k--;
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 3600
// Problem : D - Teleporter
// Contest : AtCoder - AtCoder Beginner Contest 167
// URL : https://atcoder.jp/contests/abc167/tasks/abc167_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
#define ll long long
#define db double
#define mod 1000000007
#define pb push_back
#define pp pair<ll,ll>
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repe(i,a,b) for(ll i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=b;i>=a;i--)
#define maxn 1005
#define ss second
#define ff first
#define all(a) a.begin(),a.end()
#define lb lower_bound
using namespace std;
void solve()
{
	ll n,k;
	cin >> n >> k;
	ll arr[n];
	rep(i,0,n)
	cin >> arr[i];
	map<ll,ll> mp;
	vector<ll> vect;
	ll i = 1;
	ll j=0,start=-1;
	while(1)
	{
		vect.pb(i);
		mp[i]=j;
		i=arr[i-1];
		j++;
		if(mp.count(i))
		{
			start=mp[i];
			break;
		}
	}
	if(k<=start)
	{
		cout << vect[k];
		return;
	}
	k++;
	k-=start;
	ll x=k%(vect.size()-start);
	n=vect.size()-start;
	cout << vect[start+((x-1)+n)%n];
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t=1;
    //cin >> t;
    while(t--)
    solve();
    return 0;
}

Measured memory_bytes: 18536
#include <iostream>
#include <algorithm>
#include <list>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> nums;
  for(int i = 0; i < n; ++i) {
    int num;
    cin >> num;
    nums.push_back(num);
  }
  int count = 0;
  for(int i = 0; i < nums.size(); ++i) {
    auto max = min_element(nums.begin() + i, nums.end());
    if(nums[i] != *max) {
      swap(nums[i], *max);
      ++count;
    }
  }
  for(auto j = nums.begin(); j != nums.end() - 1; ++j) cout << *j << " ";
  cout << *(nums.end() - 1) << endl;
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 1216
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<ctime>
#include<vector>
#include<set>
#include<map>
#include<stack>
using namespace std;
long long a[100010];
int main()
{     int n,i,j,k=0;
      long long x=0,y=0;
      scanf("%d",&n);
      for(i=1;i<=n;i++){
      	scanf("%lld",&a[i]);
      }
      sort(a+1,a+n+1);
      for(i=n;i>1;i--){
         if(a[i]==a[i-1]){
		   x=a[i];
		   j=i-2;
		   break;
	     }
      }
	  for(i=j;i>1;i--){
         if(a[i]==a[i-1]){
		   y=a[i];
		   break;
	     }
	  }
	  printf("%lld",x*y);
	  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#include<map>
using std::cin;using std::cerr;
using std::max;using std::min;
#define N 201005
#define ll long long
#define db double
#define lb(x) std::lower_bound(so+1,so+1+tot,x)-so;
#define dbg1(x) cerr<<#x<<"="<<(x)<<" "
#define dbg2(x) cerr<<#x<<"="<<(x)<<"\n"
int n,A[N],so[N],cnt,tot,l,r,mid;
class SegmentTree
{
#define lc x<<1
#define rc x<<1|1
#define mid (l+r>>1)
	struct node{int f,v;}t[N<<2];
	void pushdown(int x) {if(t[x].f) t[lc].f=t[rc].f=1,t[lc].v=t[rc].v=t[x].f=0;}
public:
	void build(int x,int l,int r)
	{
		t[x].f=t[x].v=0;
		if(l==r) return;
		build(lc,l,mid),build(rc,mid+1,r);
	}
	void add(int x,int l,int r,int p,int v)
	{
		if(l==r) return void(t[x].v+=v);
		pushdown(x);
		p<=mid?add(lc,l,mid,p,v):add(rc,mid+1,r,p,v);
	}
	void change(int x,int l,int r,int _l,int _r)
	{
		if(_l>_r) return;
		if(_l<=l&&r<=_r) {t[x].v=0,t[x].f=1;return;}
		pushdown(x);
		if(_l<=mid) change(lc,l,mid,_l,_r);
		if(_r>mid) change(rc,mid+1,r,_l,_r);
	}
	int ask(int x,int l,int r,int p)
	{
		if(l==r) return t[x].v;
		pushdown(x);
		return p<=mid?ask(lc,l,mid,p):ask(rc,mid+1,r,p);
	}
#undef mid
}T;
bool Judge(int x)
{
	T.build(1,1,tot);
	int now=A[1],res;
	for(int i=2;i<=n;i++)
	{
		if(A[i]>now) {now=A[i];continue;}
		T.add(1,1,tot,A[i],1);
		for(int j=A[i];j;j--)
		{
			res=T.ask(1,1,tot,j);
			if(res>=x)
			{
				T.change(1,1,tot,j,j);
				if(j>1) T.add(1,1,tot,j-1,1);else return 0;
			}
			else break;
		}
		T.change(1,1,tot,A[i]+1,now),now=A[i];
	}
	return 1;
}
int main()
{
	scanf("%d",&n),cnt=n;
	for(int i=1;i<=n;i++) scanf("%d",&A[i]),so[i]=A[i];
	for(int i=1;i<=20;i++) so[++cnt]=i;
	std::sort(so+1,so+1+cnt),tot=std::unique(so+1,so+1+cnt)-so-1;
	for(int i=1;i<=n;i++) A[i]=lb(A[i]);
	for(l=1,r=n;l<r;) mid=l+r>>1,Judge(mid)?r=mid:l=mid+1;
	printf("%d\n",l);
	return 0;
}

Measured memory_bytes: 7936
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
int main(){
    int n,A[200000],z=0,ans=1;
    cin>>n;
    rep(i,n) cin>>A[i];
    rep(i,n-1){
        if(z==0){if(A[i]<A[i+1]) z=1;if(A[i]>A[i+1]) z=2;}
        if(z==1&&A[i]>A[i+1]) z=0,ans++;
        if(z==2&&A[i]<A[i+1]) z=0,ans++;
    }
    cout<<ans;
}

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

const ll x = 1000100010001;

int main(){
    ll n;
    cin >> n;
    ll min = x;
    rep(i, n){
        if(i * i > n){
            i = n;
        }
        ll a;        
        if(n % i == 0){
            a = n / i;
            ll ans = (a - 1) + (i - 1);
            if(ans < min){
                min = ans;
            }else if(ans > min){
                break;
            }
        }
    }    
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int X = Integer.parseInt(sc.next(), 16);
		int Y = Integer.parseInt(sc.next(), 16);
		if(X < Y) {
			System.out.println("<");
		} else if(X > Y) {
			System.out.println(">");
		} else {
			System.out.println("=");
		}
	}
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){
  int n;
  cin>>n;
  int len[n];

  int maxLen = 0;
  int sumLen = 0;
  REP(i,n){
    cin>>len[i];
    maxLen = max(maxLen,len[i]);
    sumLen += len[i];
  }

  if(sumLen > maxLen*2){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }


  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


int h, w;
int a[80][80];
int b[80][80];

const int c = 80 * 160;
bitset<c * 2 + 1> dp[80][80];


void f(bitset<c * 2 + 1> &a, const bitset<c * 2 + 1>  &b, int d) {
	if (d >= 0) a |= b << d;
	else a |= b >> -d;
}

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

	cin >> h >> w;
	rep(i, h)rep(j, w)cin >> a[i][j];
	rep(i, h)rep(j, w)cin >> b[i][j];

	
	dp[0][0].set(c + a[0][0] - b[0][0]);
	dp[0][0].set(c - a[0][0] + b[0][0]);

	rep(y,h) {
		rep(x, w) {
			if (y + 1 < h) {
				int d = a[y + 1][x] - b[y + 1][x];
				f(dp[y + 1][x], dp[y][x], d);
				f(dp[y + 1][x], dp[y][x], -d);
			}
			if (x + 1 < w) {
				int d = a[y][x + 1] - b[y][x + 1];
				f(dp[y][x + 1], dp[y][x], d);
				f(dp[y][x + 1], dp[y][x], -d);
			}
		}
	}

	int ans = INF;
	rep(i, 2*c+1) {
		if (dp[h-1][w-1][i]) {
			ans = min(ans, abs(i - c));
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 20352
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;

struct Graph {
    struct Edge { int from; int to; lint cost; };
    struct Node {
        Node() : par(-1), done(false), dist(INF) {}
        int index;
        int par;
        bool done;
        lint dist;
        vector<Edge> edge;
    };

    int n;
    vector<Node> nodes;
    vector<Edge> edges;
    const static lint INF = 1e18;

    Graph(int n) : n(n) {
        nodes.resize(n);
        for(int i=0; i<n; i++)  nodes[i].index = i;
    }

    void add_edge(int from, int to, lint cost) {
        nodes[from].edge.push_back(Edge{from, to, cost});
        edges.push_back(Edge{from, to, cost});
    }
};

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

    int N = S.length();
    bool c1 = (S[N-1] == '0');
    bool c2 = (S[0] == S[N-2] && S[N-2] == '1');
    bool c3 = true;
    for(int i=0; i<=N-2; i++) c3 &= (S[i] == S[N-i-2]);

    if(not(c1 && c2 && c3)) {
        cout << -1 << endl;
        return 0;
    }

    vector<char> T(S.begin(), S.begin()+N/2);

    Graph g(N);
    int p = 0;
    for(int i=0; i<T.size(); i++) {
        if(T[i] == '1') {
            g.add_edge(p, i+1, 1);
            p = i+1;
        } else {
            g.add_edge(p, i+1, 1);
        }
    }

    for(int i=T.size(); i<S.size()-1; i++) {
        g.add_edge(p, i+1, 1);
    }

    for(auto e : g.edges) {
        cout << e.from+1 << " " << e.to+1 << endl;
    }
}

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

int main(){

  vector<int> data(3);
  cin>>data.at(0);
  cin>>data.at(1);
  cin>>data.at(2);
  
  sort(data.begin(),data.end());
  
  cout<<10*data.at(2)+data.at(0)+data.at(1)<<endl;
  
  
  
}
  













Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;
#define MOD 1000000007
#define endl "\n" 
#define rep(i,n) for(int i = 0; i < (n); ++i)
typedef long long ll;

int R[200000];

int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
  
    int n; cin >> n;
    rep(i,n) {
        cin >> R[i];
    }
    int maxv = -2000000000;
    int minv = R[0];
    for(int i = 1; i < n; ++i) {
        maxv = max(maxv, R[i]-minv);
        minv = min(minv, R[i]);
    }

    cout << maxv << endl;

    return 0;
}



Measured memory_bytes: 3964
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        fozubaoyou    pass System Test!
        quoted from "https://codeforces.com/contest/472/submission/7996840"
*/
 
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);};};
const int MOD = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;


int main(void){

	int n;
	cin>>n;
	cout<<n*n*n<<endl;

}


Measured memory_bytes: 256
tem=input()
a=len(tem)
sa=list(tem)
tem=input()
b=len(tem)
sb=list(tem)
tem=input()
c=len(tem)
sc=list(tem)
ia=0
ib=0
ic=0
t='a'
while True:
  if t=='a':
    if ia==a:
      print('A')
      break
    t=sa[ia]
    ia+=1
  elif t=='b':
    if ib==b:
      print('B')
      break
    t=sb[ib]
    ib+=1
  else:
    if ic==c:
      print('C')
      break
    t=sc[ic]
    ic+=1


Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<climits>
using namespace std;

int main()
{
  int n,m;
  int x1,y1,x2,y2;
  vector<int> x,y;
  vector<int> ix,iy;
  vector< vector<int> > dp;

  cin>>n>>m;
  x.resize(n);
  y.resize(n);
  for(int i=0; i<n; i++){
    cin>>x[i]>>y[i];
    ix.push_back(x[i]);
    iy.push_back(y[i]);
  }
  ix.push_back(INT_MIN);
  iy.push_back(INT_MIN);
  sort(ix.begin(), ix.end());
  sort(iy.begin(), iy.end());
  ix.erase(unique(ix.begin(), ix.end()), ix.end());
  iy.erase(unique(iy.begin(), iy.end()), iy.end());

  dp.resize(iy.size(), vector<int>(ix.size(), 0));
  for(int i=0; i<n; i++){
    int ty = lower_bound(iy.begin(), iy.end(), y[i]) - iy.begin();
    int tx = lower_bound(ix.begin(), ix.end(), x[i]) - ix.begin();
    dp[ty][tx]++;
  }
  for(int i=1; i<iy.size(); i++){
    for(int j=1; j<ix.size(); j++){
      dp[i][j] += dp[i-1][j] + dp[i][j-1] - dp[i-1][j-1];
    }
  }

  for(int i=0; i<m; i++){
    cin>>x1>>y1>>x2>>y2;
    int ix1,iy1,ix2,iy2;
    iy1 = lower_bound(iy.begin(), iy.end(), y1) - iy.begin();
    ix1 = lower_bound(ix.begin(), ix.end(), x1) - ix.begin();
    iy2 = upper_bound(iy.begin(), iy.end(), y2) - iy.begin()-1;
    ix2 = upper_bound(ix.begin(), ix.end(), x2) - ix.begin()-1;
    cout<<dp[iy2][ix2]+dp[iy1-1][ix1-1]-dp[iy1-1][ix2]-dp[iy2][ix1-1]<<endl;
  }
}

Measured memory_bytes: 98948
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

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

    int N;
    cin >> N;
    vector<ll> H(N);

    ll prev = -1;
    ll ans = 0, cnt = 0;
    rep(i, N) {
        cin >> H[i];
        if (prev >= H[i])
            cnt++;
        else
            ans = max(cnt, ans), cnt = 0;
        prev = H[i];
    }

    ans = max(ans, cnt);

    cout << ans << endl;
}

Measured memory_bytes: 1024
program ABC164_B
  integer::A,B,C,D
  read(*,*)A,B,C,D
  do i=1,100
     C=C-B
     if(C<=0) then
        k=1
        exit
     end if
     A=A-D
     if(A<=0) then
        k=0
        exit
     end if
  end do
  if(k==1) then
     write(*,*)'Yes'
  else
     write(*,*)'No'
  end if
end program ABC164_B

Measured memory_bytes: 2792