akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <iostream>
#include <limits>
#include <queue>

using namespace std;

struct edge {
    int v;
    int weight;

    edge(int v, int w) : v(v), weight(w) {}
};

bool operator < (const edge &a, const edge &b) {
  return a.weight > b.weight;
}

int main() {
    auto const INF = numeric_limits<int>::max();

    int V, E, r;
    cin >> V >> E >> r;

    vector<vector<edge>> G(V);
    for (int i = 0; i < E; ++i) {
        int s, t, d;
        cin >> s >> t >> d;
        G[s].emplace_back(t, d);
    }

    // Dijkstra's algorithm
    vector<int> d(V, INF);
    vector<bool> visited(V, false);
    priority_queue<edge> Q;

    Q.emplace(r, 0);
    d[r] = 0;
    while (!Q.empty()) {
        auto e = Q.top(); Q.pop();
        if (visited[e.v])
            continue;
        visited[e.v] = true;

        for (auto& u : G[e.v]) {
            int w = u.weight + d[e.v];
            if (!visited[u.v] && w < d[u.v]) {
                d[u.v] = w;
                Q.emplace(u.v, w);
            }
        }
    }

    for (auto x : d) {
        if (x != INF) {
            cout << x << endl;
        } else {
            cout << "INF" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 12968
def main():
    n = int(input())
    s = input()
    r = []
    wCount = 0
    eCount = s.count("E")
    for v in s:
        if v == "W":
            wCount += 1
        r.append(wCount)
        r[-1] += eCount
        if v == "E":
            eCount -= 1
    #print(r)
    print(min(r)-1)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 15520
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
	int a, b, c, n;
	string s;
	cin >> n;
	if(n / 100 == n % 10) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;
#define EPS (1e-15)
#define equals(a,b) (fabs((a)-(b))<EPS)

class Point {
public:
	double x, y;
	Point() {}
	Point(double xx, double yy) {
		x = xx;
		y = yy;
	}
	Point operator + (Point& p) { return Point(x + p.x, y + p.y); }
	Point operator - (Point& p) { return Point(x - p.x, y - p.y); }
	Point operator * (double k) { return Point(x * k, y * k); }
	Point operator / (double k) { return Point(x / k, y / k); }

	double norm() { return x * x + y * y; }
	double abs() { return sqrt(norm()); }

	bool operator == (const Point& p) const {
		return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
	}
};
struct Segment {
	Point p1, p2;
};
typedef Point Vector;
typedef Segment Line;
class Circle {
public:
	Point c;
	double r;
	Circle(Point cc, double rr) {
		c = cc;
		r = rr;
	}
};

double dot(Vector a, Vector b) {
	return a.x * b.x + a.y * b.y;
}
double cross(Vector a, Vector b) {
	return a.x * b.y - a.y * b.x;
}
Point project(Segment s, Point p) {
	Vector hepo = p - s.p1;
	Vector base = s.p2 - s.p1;
	Vector t = base * (dot(p - s.p1, base) / base.norm());
	Point x = s.p1 + t;
	return x;
}
int main() {
	Point p1, p2,p,x,t;
	cin >> p1.x >> p1.y >> p2.x >> p2.y;
	Segment s;
	s.p1 = p1;
	s.p2 = p2;
	int q;
	cin >> q;
	while (q--) {
		cin >> p.x >> p.y;
		x = project(s, p);
		printf("%.9lf %.9lf\n", x.x, x.y);
	}
}


Measured memory_bytes: 3272
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int k = Integer.parseInt(stdIn.next());
        int x = Integer.parseInt(stdIn.next());
        if (500 * k >= x) System.out.println("Yes");
        else System.out.println("No");
    }
}

Measured memory_bytes: 21716
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<time.h>
#define FOR(i,n) for(int i=0;i<n;i++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define INI(n) scanf("%d",&n)
#define INL(n) scanf("%lld",&n)
#define INF 10000000000
#define mod 1000000007
#define X 100000
#define N 20
#define M 46
typedef long long int ll;
ll finv[X];
ll fac[X];
ll inv[X];
ll usort(const void *a, const void *b){return *(ll*)a-*(ll*)b;}
ll dsort(const void *a, const void *b){return *(ll*)b-*(ll*)a;}
ll ssort(const void *a, const void *b){return strcmp((char*)a,(char*)b);}
void Iswap(int *a,int *b){
  int t=*a;
  *a=*b;
  *b=t;
}
void Fswap(double *a,double *b){
  double t=*a;
  *a=*b;
  *b=t;
}
void Lswap(ll *a,ll *b){
  ll t=*a;
  *a=*b;
  *b=t;
}
ll min(ll a,ll b){
  if(a>b)return b;
  return a;
}
ll max(ll a,ll b){
  if(a>b)return a;
  return b;
}
ll z(ll a){return max(a,-a);}
ll gcd(ll a,ll b){if(!b){return a;}else{return gcd(b,a%b);}}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
ll kt(ll a){
  ll sum=0;
  while(a){
    a/=10;
    sum++;
  }
  return sum;
}
ll ks(ll a){
  ll sum=0;
  while(a){
    sum+=a%10;
    a/=10;
  }
  return sum;
}
void nCrReady(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for (ll i=2;i<X;i++){
    fac[i]=fac[i-1]*i%mod;
    inv[i]=mod-inv[mod%i]*(mod/i)%mod;
    finv[i]=finv[i-1]*inv[i]%mod;
  }
}
ll nCr(ll n,ll k){return fac[n]*(finv[k]*finv[n-k]%mod)%mod;}

int main(void){
  int n;
  scanf("%d",&n);
  char s[n+1];
  int a[n];
  scanf("%s",s);
  ll r=0,b=0,g=0;
  FOR(i,n){
    if(s[i]=='R'){
      r++;
      a[i]=2;
    }else if(s[i]=='B'){
      b++;
      a[i]=3;
    }else{
      g++;
      a[i]=5;
    }
  }
  ll ans=r*b*g;
  FOR(i,n-2){
    for(int j=1;j<n;j++){
      if(i+j*2<n){
        if(a[i]*a[i+j]*a[i+2*j]==30)ans--;
      }else{
        break;
      }
    }
  }
  PRL(ans);
  return 0;
}

Measured memory_bytes: 1736
#include<bits/stdc++.h>
#define re register
using namespace std;

inline int read(){
	re int ans = 0;re bool f = 1;re char ch = getchar();
	while(ch<'0'||ch>'9'){if (ch=='-')f = 0;ch = getchar();}
	while(ch>='0'&&ch<='9'){
		ans = (ans<<3)+(ans<<1)+(ch^48);
		ch = getchar();
	}
	return f?ans:~(ans-1);
}

signed main(void){
	string a;
	cin>>a;
	for(re int i=0;i<3;++i){
		if(a[i]=='7'){
			printf("Yes");
			return 0;
		}
	}
	printf("No");
	return 0;
}

Measured memory_bytes: 3720
#include <stdio.h>
int main(void){
    int a[3][3],n,x,i,j,k;
    for(i=0;i<3;i++){
        for(j=0;j<3;j++) scanf("%d",&a[i][j]);
    }
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&x);
        int f=0;
        for(j=0;j<3;j++){
            for(k=0;k<3;k++){
                if(a[j][k]==x){
                    a[j][k]=-1;
                    f=1;
                    break;
                }
            }
            if(f) break;
        }
    }
    for(i=0;i<3;i++){
        if(a[i][0]==-1 && a[i][1]==-1 && a[i][2]==-1){
            printf("Yes");
            return 0;
        }
        if(a[0][i]==-1 && a[1][i]==-1 && a[2][i]==-1){
            printf("Yes");
            return 0;
        }
    }
    if(a[0][0]==-1 && a[1][1]==-1 && a[2][2]==-1){
        printf("Yes");
        return 0;
    }
    if(a[0][2]==-1 && a[1][1]==-1 && a[2][0]==-1){
        printf("Yes");
        return 0;
    }
    printf("No");
    return 0;
}

Measured memory_bytes: 128
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define INF 1000000007

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

int main()
{
    int N;
    cin >> N;
    for (int i = 1; i <= 9; i++)
    {
        int tmp = i + 10 * i + 100 * i;
        if (N <= tmp)
        {
            cout << tmp << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, start, n) for (int i = (int)(start); i < (int)(n); ++i)
int A, B;
void func()
{
    cin >> A >> B;
    int i;
    // int ans1 = A * 12 + A / 2, ans2 = B * 10, i;
    // cout << ans1 << ans2;
    for (i = B * 10; i < B * 10 + 10; ++i)
    {
        if (i * 2 / 25 == A)
            break;
    }
    if (i == B * 10 + 10)
        i = -1;

    cout << i << endl;
}
int main()
{
    func();
}

Measured memory_bytes: 256
function main(input: string) {
  const [[N,K], hs] = input.split("\n").map((v,i) => v.split(" ").map(vv=>parseInt(vv)));
  const arr = new Array(N);
  arr.fill(Infinity);
  arr[0] = 0 // 初期値
  for (let i = 1; i < N; i++) {
    for(let k = K; k > 0; k--) {
      if (i - k >= 0) {
        arr[i] = Math.min(arr[i], arr[i-k] + Math.abs(hs[i] - hs[i-k]));
      } 
    }
  }
  console.log(arr[N-1]);
}

main(
  require("fs")
    .readFileSync("/dev/stdin", "utf8")
    .trim()
);


Measured memory_bytes: 27732
n = int(input())
array = list(map(int, input().split()))
swaped = 0

for i in range(n):
    mini = array[i]
    mini_idx = i
    for j in range(i, n):
        if mini > array[j]:
            mini = array[j]
            mini_idx = j
    if i != mini_idx:
        array[i], array[mini_idx] = array[mini_idx], array[i]
        swaped += 1
print(' '.join([str(e) for e in array]))
print(swaped)


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

int main() {
    int N;
    cin >> N;
    vector<int> H(N + 1);
    for (int i = 1; i <= N; i++) {
        cin >> H[i];
    }

    int ans = 0;
    int m = H[0];
    for (int i = 1; i <= N; i++) {
        if (m <= H[i]) {
            ans++;
        }
        m = max(m, H[i]); 
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e16;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    ll N; cin >> N;
    
    FOR(h, 1, 3501) FOR(n, 1, 3501){
        ll k = 4*h*n - N*(n+h);
        ll r = N*h*n;
        if(k > 0 && r % k == 0){
            ll w = r / k;
            cout << h << " " << n << " " << w << endstr; return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif
#define LDcout(x,n) fixed<<setprecision(n)<<x

#define MOD 1000000007LL
#define EPS 1e-8
static const int INF=1<<24;
int dp[15][15][110];
void mainmain(){
    int n,s;
    dp[0][0][0]=1;
    rep(i,15){
        rep(j,15){
            rep(k,110){
                if(dp[i][j][k]){
                    reep(l,j,10){
                        dp[i+1][l+1][k+l]+=dp[i][j][k];
                    }
                }
            }
        }
    }
    while(cin>>n>>s,n){
        int tmp=0;
        rep(i,15){
            tmp+=dp[n][i][s];
        }
        cout<<tmp<<endl;
    }
}


signed main() {
    ios_base::sync_with_stdio(false);
      cout<<fixed<<setprecision(20);
    mainmain();
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef map<ll,ll>::iterator itll;
typedef long double ld;
typedef map<ll,ll> mapll;

#define con continue
#define pb push_back
#define fi first
#define se second
#define fr front()
#define INF 1000000000000000000
#define all(vl) vl.begin(),vl.end()
#define m_p make_pair 
#define sz(a) sizeof(a)
#define forn(mp,it) for(it = mp.begin();it!=mp.end();it++)
#define FOR(i,a,n) for(int i=a;i<n;i++) 
#define FORE(i,a,n) FOR(i,a,n+1)
#define Endl endl
#define eNdl endl
#define enDl endl
#define endL endl

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr); 
	ll n;
	cin>>n;
	vector<ll> vl(n);
	FOR(i,0,n)
		cin>>vl[i];
	map<ll,ll> mp;
	ll ma = -1e18;
	FOR(i,0,n)
		ma = max(ma,vl[i]);
	FOR(i,0,n)
	{
		ll bei = 1;
		ll tmp = vl[i];
		while(bei*tmp<=ma)
		{
			mp[bei*tmp] ++;
			bei++;
		}
	}
	ll ans = 0;
	FOR(i,0,n)
	{
		if(mp[vl[i]] == 1)
			ans++;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 66948
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
signed main(void){
    int n; cin>>n;
    vector <int> a(n);
    rep(i,n) cin>>a[i]; 
    int cnt = 0;
    rep(i,n){
        if(a[i]%2 == 1) cnt++;
    }   
    if(cnt&1) cout<<"NO"<<endl;
    else cout<<"YES"<<endl;
}


Measured memory_bytes: 1024
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.IO.Compression;
using System.Linq;
using System.Text;

namespace Atcoder
{
    class Program
    {
        private const long COMDIV = 1000000007;
        static void Main(string[] args)
        {
            var ABC = Console.ReadLine().Split().Select(int.Parse).ToArray();
            A = ABC[0];
            B = ABC[1];
            C = ABC[2];
            Calc();
        }

        private static int count = 0;
        private static int sum = 0;
        private static int A;
        private static int B;
        private static int C;

        private static void Calc()
        {
            if (count > 1000)
            {
                Console.WriteLine("NO");
                return;
            }

            count++;
            sum += A;
            if (sum % B == C)
            {
                Console.WriteLine("YES");
                return;
            }
            Calc();
        }
    }
}

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

bool isp(int n) {
  if (n < 2) return false;
  else if (n == 2) return true;
  else if (n % 2 == 0) return false;
  double d = sqrt(n);
  for (int i = 3; i <= d; i += 2) if (n % i == 0) return false;
  return true;
}

int main() {
  int X;
  cin >> X;
  while(!isp(X)) X++;
  cout << X << "\n";
}

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

int main() {
    using namespace std;

    cin.tie(0);
   	ios::sync_with_stdio(false);

    int n, x;

    cin >> n >> x;

    vector<int> l;
    for (int i = 0; i < n; i++) {
        int tmp;
        cin >> tmp;
        l.push_back(tmp);
    }

    int cnt = 0;
    vector<int> d;
    for (int i = 1; i <= n + 1; i++) {
        if (i == 1) {
            d.push_back(0);
            cnt++;
        }
        else {
            int dc = d[i - 2] + l[i - 2];
            d.push_back(dc);
            if (dc <= x) {
                cnt++;
            }
        }
    }

    cout << cnt << endl;
}

Measured memory_bytes: 256
// Example program
#include <iostream>
#include <string>
using namespace std;

const int N = 1010,inf  = 1e9 + 7;

char a[N][N];

long long dp[N][N];

int main()
{                                                                  
	int n,m;
	cin >> n >> m;  
	dp[1][1] = 1ll;
	
	for (int i = 1;i <= n;++i)
	{
		for (int j = 1;j <= m;++j)
		{
			cin >> a[i][j];
			if (a[i][j] == '.')
			{
				dp[i][j] += dp[i][j - 1] + dp[i - 1][j];
				dp[i][j] %= inf;
			}
		}	
	}

	cout << dp[n][m];
}


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


int solve(string s){
    
    int ans =0;
    for(int i =1 ;i<s.size();i++) {
        if(s[i]==s[i-1])
            ans++, i++;
    }
    return ans;
}
int main() {
	string s;
	cin >> s;
	long long k;
	cin >> k;
	int n = s.size();
	if (s == string(n, s[0])) {
    cout << n * k / 2 << '\n';
    return 0;
  }
	int a = solve(s);
	int b = solve(s+s);
	int c = solve(s + s +s);
	int conCost = b-2*a;
	int invCost = a;
	//cout<<invCost<<": "<<conCost<<"\n";
	cout<<a + (k-1)*(b-a)<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<vector>
#include<climits>
#include<algorithm>
#include<numeric>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<cstring>
#include<random>
#include<cassert>
#define ll long long
#define int long long
#define ld long double
#define INF (ll)1e18 
const ll Mod = (ll)1e9+7;
ll CaseN=1;
const ld PI = 22/7.0;
using namespace std;

ll tst()
{
ll ans=0;

return ans;
}


void solve()
{
	string s;
	cin>>s;
	
	ll sum=0;
	bool ans=true;
	
	for(ll i=0;i<(ll)s.size();i++)
	{
	ll no = (s[i]-'0');	
		sum = (sum+no)%9;
	}
	
	if(sum%9!=0)
	{
	ans = false;	
	}
	
	if(ans)
  {
  cout<<"Yes"<<endl; 
  }
  else
   {
  cout<<"No"<<endl;
  }
	//cout<<"Case #"<<CaseN<<": ";
		CaseN++;
		// print your ans below;
	
return ;

}


signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll t=1;
	//cin>>t;
	while(t--)
	{
	solve();
	}
	
}


Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

vector<vector<pair<int,int>>> v(20);
int n;

bool judge(int bit){
    rep(i,n){
        if(!(bit & (1<<i))) continue;
        rep(j,v[i].size()){
            int x=v[i][j].first;
            int y=v[i][j].second;

            if(y==0 && bit & (1<<x)) return false;
            if(y==1 && !(bit & (1<<x))) return false;
        }
    }
    return true;
}



int main() {
    cin>>n;
    
    rep(i,n){
        int a;
        cin>>a;
        rep(j,a){
            int x,y;
            cin>>x>>y;
            x--;
            v[i].push_back({x,y});
        }
    }

    int ans=0;
    for(int bit=0;bit<(1<<n);bit++){
        if(judge(bit)){
            int tmp=0;
            rep(i,n){
                if(bit & (1<<i)) tmp++;
            }
            ans=max(ans,tmp);
        }
    }

    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <stdio.h>
#define rep(i,n) for(int i=0;i<(n);++i)

using namespace std;

typedef long long ll;


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

    cout<<a+a*a+a*a*a<<endl;


}

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

#define INF (INT_MAX/2)

struct Edge {
    int u;
    int v;
    int w;
};

int graph[110][110];

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

    for (int i=0; i<110; i++) {
        for (int j=0; j<110; j++) {
            graph[i][j] = INF;
        }
    }
    for (int i=0; i<110; i++) graph[i][i] = 0;

    vector<Edge> edges;
    for (int i=0; i<M; i++) {
        int a,b,c;
        cin >> a >> b >> c;
        graph[a][b] = c;
        graph[b][a] = c;
        edges.push_back( Edge{a,b,c} );
    }

    for (int k=1; k<=N; k++) {
        for (int i=1; i<=N; i++) {
            for (int j=1; j<=N; j++) {
                graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j]);
            }
        }
    }

    int ans = 0;
    for (int i=0; i<edges.size(); i++) {
        Edge& e = edges[i];
        if (graph[e.u][e.v] < e.w) {
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	a := make([]int, 5)
	var k int
	fmt.Scan(&a[0], &a[1], &a[2], &a[3], &a[4], &k)

	for i := 0; i < 5; i++ {
		for j := 0; j < 5; j++ {
			if a[j]-a[i] > k {
				fmt.Println(":(")
				return
			}
		}
	}

	fmt.Println("Yay!")
}


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

using namespace std;
typedef long long ll;
const int N = 200010;
int _w;

int n, a[N], x[N];
ll ans;

int main() {
	_w = scanf( "%d", &n );
	for( int i = 1; i <= n; ++i )
		_w = scanf( "%d", a+i );
	for( int i = n; i >= 1; --i ) {
		x[i] = max(0, x[i+1] - 1);
		if( a[i] < x[i] )
			return puts("-1"), 0;
		else if( a[i] > x[i] ) {
			if( a[i] >= i )
				return puts("-1"), 0;
			else
				ans += a[i], x[i] = a[i];
		}
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
//  freopen("in.txt", "r", stdin);
//  freopen("out.txt", "w", stdout);
  int n;
  cin >> n;
  vector<int> arr(n);
  for(int i = 0;i < n;i++)
    cin >> arr[i];
  sort(arr.begin(), arr.end());
  int cnt = 1;
  int sides[2] = {0};
  int cur = 0;
  for(int i = n - 2;i >= 0;i--){
    if(arr[i + 1] == arr[i])
      cnt++;
    else
      cnt = 1;
    if(cnt == 2){
      sides[cur++] = arr[i];
      cnt = 0;
      if(cur == 2)break;
    }
  }
  cout << 1ll * sides[0] * sides[1];
}


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

/*
int calc_digit(long long N) {
    int res = 0;
    while (N) {
        ++res;
        N /= 10;
    }
    return res;
}
*/

int digit(long long n)
{
    int digit=0;
    while(n){
        digit++;
        n = n/10;
    }
    return digit;
}

long long keta(long long n)
{
    long long keta_min = 29;
    //int res = (1<<29); // 十分大きい値で初期化
    for (long long i = 1; i * i <= n; i++) //intは×
    {
        if (n % i == 0)
        {
            long long A = i; //to_string(i);
            long long B = n/i;//to_string(n/i);
            long long A_size = digit(A);//A.size();
            long long B_size = digit(B);//B.size();
            keta_min = min(keta_min,max(A_size,B_size));
        }
        
    }
    return keta_min;
}

void solve(long long N){
    const auto min = keta(N);
    cout << min << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String[] SSplit = S.split("");
		int res = Integer.MAX_VALUE;
		for (int i = 0; i < SSplit.length - 2; i++) {
			int num = Integer.parseInt(SSplit[i] + SSplit[i + 1] + SSplit[i + 2]);
			if (Math.abs(num - 753) < res) {
				res = Math.abs(num - 753);
			}
		}
		System.out.print(res);
	}
}

Measured memory_bytes: 21844
from functools import lru_cache

n, k = map(int, input().split())
h = [0] + list(map(int, input().split())) + [0]
INF = 10 ** 18


@lru_cache(maxsize=None)
def solve(i, nokori):
    if i == 0:
       return 0
    res = INF
    for j in range(nokori + 1):
        if i - 1 - j < 0:
            break
        diff = max(h[i] - h[i - 1 - j], 0)
        res = min(solve(i - 1 - j, nokori - j) + diff, res)
    return res


print(solve(n + 1, k))

Measured memory_bytes: 55132
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;

    cin>>n>>k;

    int arr[n];
    for(int i=0; i<n; i++)
    {
        cin>>arr[i];
    }
    sort(arr,arr+n);
    int sum=0;
    for(int i=0; i<k; i++)
    {
        sum=sum+arr[i];
    }
    cout<<sum<<endl;

}



Measured memory_bytes: 3672
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() (int, []int) {
	n := readInt()
	return n, readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()
	s := []byte(readString())
	t := []byte(readString())
	dp := make([][]int, len(s))
	for i := range dp {
		dp[i] = make([]int, len(t))
	}

	for i := range dp {
		for j := range dp[i] {
			if 0 < i {
				dp[i][j] = dp[i-1][j]
			}
			if 0 < j {
				dp[i][j] = max(dp[i][j], dp[i][j-1])
			}
			if s[i] == t[j] {
				p := 0
				if 0 < i && 0 < j {
					p = dp[i-1][j-1]
				}
				p++
				dp[i][j] = max(dp[i][j], p)
			}
		}
	}

	i := len(s) - 1
	j := len(t) - 1

	b := make([]byte, 0)
	for 0 <= i && 0 <= j && 0 < dp[i][j] {
		for 0 < i && dp[i][j] == dp[i-1][j] {
			i--
		}
		for 0 < j && dp[i][j] == dp[i][j-1] {
			j--
		}
		b = append(b, s[i])
		i--
		j--
	}

	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
		b[i], b[j] = b[j], b[i]
	}
	println(string(b))

}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

// -----------------------------------------------------------------------------


Measured memory_bytes: 75392
import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int L = sc.nextInt();
		int min = Integer.MAX_VALUE;
		int minTaste = 0;
		int sum = 0;
		for (int i = 0; i < N; i++) {
			int taste = L + i;
          	int x = Math.abs(taste);
			sum += taste;
			if (min > x) {
				min = x;
				minTaste = taste;
			}
		}
		System.out.println(sum - minTaste);
	}
}

Measured memory_bytes: 21716
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <climits>
#include <map>
#include <functional>
#include <cmath>
#include <cassert>
#include <set>

using namespace std;

template<typename T>inline T get(){T x;cin>>x;return x;}

int main()
{
    int a = get<int>(), b = get<int>(), c = get<int>();
    int d = min(c, a - b);
    cout << c - d << endl;
    return 0;
}


Measured memory_bytes: 256
// Starting with the name of Allah

#include <bits/stdc++.h>
#define ll long long
#define nl endl
#define Nayon ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define gcd(a,b)         __gcd(a,b)
#define lcm(a,b)         (a/gcd(a,b))*b
#define v_sum(a)         accumulate(a.begin(),a.end(),0)
#define v_max(a)         *max_element(a.begin(),a.end())
#define v_min(a)         *min_element(a.begin(),a.end())
#define v_uni(a)         a.erase(unique(a.begin(),a.end()),a.end())

using namespace std;



const ll mod=1000000007;

int main()
{
	Nayon;
	ll n,i,j,sum=0,x=0;
	cin>>n;
	ll a[n+1];
	for(i=0;i<n;i++){
		cin>>a[i];
		x+=a[i];
	}
	for(i=0;i<n;i++){
		x-=a[i];
		sum=(sum+((x%mod)*a[i])%mod);
		sum%=mod;
	}
	cout<<sum<<nl;
	return 0;
}

//Happy Coding.........

Measured memory_bytes: 5216
import math
a,b,h,m=map(float,input().split())

mdo=m*math.pi/30.0
min=[b*math.sin(mdo),b*math.cos(mdo)]
hdo=h*math.pi/6.0+m*math.pi/360.0
hour=[a*math.sin(hdo),a*math.cos(hdo)]

ans=math.sqrt(pow(abs(min[0]-hour[0]),2)+pow(abs(min[1]-hour[1]),2))

print(ans)


Measured memory_bytes: 9480
S=list(input())
index =-1
Odd =[]
Even =[]
for i in S:
	index +=1
	if index % 2 == 0 :
		Odd.append(i)
	else:
		Even.append(i)
print("No" if 'L' in Odd or "R" in Even else 'Yes' )


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

int main() {
  string s;
  cin >> s;
  int count = 0;
  for (int i = 0; i < 3; i++) {
    if (s[i] == '1')
      count += 1;
  }
  cout << count << endl;
}


Measured memory_bytes: 256
program main
	implicit none
	integer N, i
    integer(8) ans
	integer, allocatable :: a(:)
	read(*, *) N
	allocate(a(1:N))
	read(*, *) a(1:N)
	ans = 0
	do i = 1, N
		ans = ans + a(i) - 1
	end do
	write(*, *) ans
end program main

Measured memory_bytes: 256
import scala.io.StdIn
object Main extends App {
  def wordsCount(n: Int): Map[String, Int] = (0 until n).foldLeft(Map.empty[String, Int]){
    (acc, _)  =>
      val word = StdIn.readLine().trim
      acc + ( word -> (acc.getOrElse(word, 0) + 1))
    }
  val blueCount = StdIn.readLine().trim.toInt
  val blueWords = wordsCount(blueCount)
  val redCount = StdIn.readLine().trim.toInt
  val redWords = wordsCount(redCount)
  val res = blueWords.foldLeft(0){ (acc, blues) =>
    val newPoint = blues._2 + (-1 * redWords.getOrElse(blues._1, 0))
    if(acc < newPoint) newPoint else acc
  }
  println(res)
}


Measured memory_bytes: 25400
//
//  main.cpp
//  128_D_equeue
//
//  Created by tolemy on 2019/08/25.
//  Copyright © 2019 tolemy. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(int argc, const char * argv[]) {
    
    int n, k = 0;
    cin >> n >> k;
    
    int *v = new int[n];
    for(int i=0;i<n;i++)
    {
        cin >> v[i];
    }
    
    //操作A、Bはn, kの最小値までしか行えない
    int countMax = min(n, k);
    
    long sumMax = 0;
    
    vector<int> negatives;
    
    //操作Aの回数のループ
    for(int ia = countMax;ia>=0;ia--)
    {
        //操作Bの回数のループ
        for(int ib = countMax - ia;ib>=0;ib--)
        {
            negatives.clear();
            
            long tmp = 0;
            //正数だけ足して、負数は後から評価
            //操作A実行
            for(int i = 1;i<=ia;i++)
            {
                int a = v[i-1];
                if(a >= 0)
                {
                    tmp += a;
                }
                else
                {
                    negatives.push_back(a);
                }
            }
            
            //操作B実行
            for(int i = 1;i<=ib;i++)
            {
                int b = v[n-i];
                if(b >= 0)
                {
                    tmp += b;
                }
                else
                {
                    negatives.push_back(b);
                }
            }
            
            //操作C実行（操作CとDは最後に行うため等価）
            //負数をし「昇順にソート」
            sort(negatives.begin(), negatives.end());
            
            //操作Cの最大回数
            int ic = k - (ia + ib);
            
            //先頭のic個を無視して、残りを加算
            for(int i=ic;i<negatives.size();i++)
            {
                tmp += negatives[i];
            }
            
            if(tmp > sumMax) sumMax = tmp;
        }
    }
    
    cout << sumMax << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int A,N;
	
	scanf("%d", &A);
	if (A % 2 == 1)
		N = A / 2 * (A / 2 + 1);
	else
		N = A / 2 * A / 2;


	printf("%d", N);
	
	return 0;
}



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

int main() {
  int k, a, b;
  cin >> k >> a >> b;

  for (int i = a; i <= b; i++) {
    if (i % k == 0) {
      cout << "OK" << endl;
      return 0;
    }
  }

  cout << "NG" << endl;
  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
int main()
{
   ll n,m,k,z;
   cin >> n >> m >> k;
   vector<ll> a, b, prefa, prefb;
   for (int i = 0; i < n; i++)
   {
       cin >> z;
       a.push_back(z);
       if (i==0)
           prefa.push_back(z);
        else
        {
            prefa.push_back(z + prefa[i - 1]);
        }
        
   }
   for (int i = 0; i < m; i++)
   {
       cin >> z;
       a.push_back(z);
       if (i == 0)
           prefb.push_back(z);
       else
       {
           prefb.push_back(z + prefb[i - 1]);
       }
   }
   ll ans = 0;
   for (ll i = 0; i < n; i++)
   {
       z = prefa[i];
       if (z<=k) ans = max(ans, i+1);
       if (k-z>0)
       {
           ll bme = upper_bound(prefb.begin(), prefb.end(), k - z) - prefb.begin();
        //    if (bme==m)
        //        bme--;
        //     else
        //     {
        //         bme++;
        //     }
            
           ans = max(ans, i + 1 + bme);
          // cout << i << " " << bme << '\n';
       } 
   }
   ll bme = upper_bound(prefb.begin(), prefb.end(), k) - prefb.begin();
   ans = max(ans, bme);

   cout << ans << '\n';


}


Measured memory_bytes: 11600
#include <stdio.h>
int main(){

     int N,i,j;
     double sum,ave,x,y;
     double a[1000];

     sum = ave = 0.0;
     x = 200.0;
     scanf("%d", &N);

     for(i = 0; i < N; ++i){
          scanf("%lf", &a[i]); 
          sum += a[i];
     }

     ave = sum / N;

     for(i = 0; i < N; ++i){
          if(ave - a[i] > 0){
             y = ave - a[i];
          }
          else {
             y = a[i] - ave;
          }
          if(y < x){
             x = y;
             j = i;
          }
     }

     printf("%d\n", j);

     return 0;
}


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

int main(){
  string S;
  cin >> S;
  vector<char> vec(26);
  vec = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  
  string ans = "TRUE";
  
  for(int i=0; i<26; i++){
    if(ans == "FALSE"){
      break;
    }
    for(int j=0; j<S.size(); j++){
      if(vec.at(i) == S.at(j)){
        break;
      }
      if(j == S.size() - 1){
        cout << vec.at(i) << endl;
        ans = "FALSE";
        break;
      }
    }
  }
  
  if(ans == "TRUE"){
    cout << "None" << endl;
  }
  
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
 
int main() {
    ll X,K,D;
    cin >> X >> K >> D;
    X = abs(X);
    ll num = min(K,X/D);
    ll pos = X - num * D;
    
    if((num + K) % 2 == 0){
        pos = pos;
    }else{
        pos = D - pos;
    }

    cout << pos << endl;
}

Measured memory_bytes: 3624
#include<cstdio>
#include<cstring>
typedef long long LL;
const int N=2;
const int M=1e6+50;
const int mod=998244353;
struct mat{
    LL c[N][N];
    void clear(){memset(c,0,sizeof(c));}
}a,t;
mat operator * (mat a,mat b){
    mat c;c.clear();
    for(int k=0;k<N;++k)
    for(int i=0;i<N;++i)
    for(int j=0;j<N;++j)
    if(a.c[i][k]&&b.c[k][j])
    c.c[i][j]=(c.c[i][j]+1ll*a.c[i][k]*b.c[k][j]%mod)%mod;
    return c;
}
int get(long long v){
	a.c[0][0]=t.c[0][0]=t.c[0][1]=t.c[1][0]=1;
    while(v){
        if(v&1)a=a*t;
        t=t*t;v>>=1; 
    }
    return a.c[0][1];
}
int n,Ans,x,f[M],g[M],inv[M];
LL m;
int main(){
    scanf("%d%lld",&n,&m);
    Ans=get(m+2*(n-1));
	m%=mod;f[1]=g[1]=inv[1]=x=1;
	for(int i=2;i<=n;i++){
    	f[i]=(f[i-1]+f[i-2])%mod;
		g[i]=1ll*g[i-1]*m%mod;
		inv[i]=(mod-1ll*(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=n+1;i<=2*n;i++)
	f[i]=(f[i-1]+f[i-2])%mod;
	for(int i=2;i<=n;i++){
		Ans=(Ans-1ll*x*f[2*n+2-i*2]%mod+mod)%mod;
		x=1ll*x*m%mod*inv[i-1]%mod;
		m++;
	}
	printf("%d\n",Ans);
}

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

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m, sum = 0;
  cin >> n >> m;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] * 4 * m >= sum) {
      cnt++;
    }
  }
  cout << (cnt < m ? "No" : "Yes");
  return 0;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

typedef pair<int, int>pi;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
typedef pair<P, P> PPP;

const ll MOD = 1e9 + 7;
const ll INF = 9e18;
const double DINF = 5e14;
const double eps = 1e-10;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };

#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second

int n, x, y, z, a, ans;
map<int, pair<bool, pair<bool, bool>>>mp;


int main() {
	cin >> n >> x;
	for (int i = 0;i < x;i++) {
		cin >> a;
		mp[a].fr = 1;
	}
	cin >> y;
	for (int i = 0;i < y;i++) {
		cin >> a;
		mp[a].sc.fr = 1;
	}
	cin >> z;
	for (int i = 0;i < z;i++){
		cin >> a;
		mp[a].sc.sc = 1;
	}
	for (auto u : mp) {
		if ((!u.sc.fr&&u.sc.sc.sc) || (u.sc.sc.fr&&u.sc.sc.sc))ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3100
#include<iostream>
#include<utility>
#include<vector>
using namespace std;


int main(){

	int n, k;
	cin >> n >> k;

	int height;
	int ans = 0;
	for(int i = 0; i < n; i++){
		cin >> height;

		if(height >= k) ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <list>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include<iterator>
#include <cstdlib>
using namespace std;

int a,b,c;
int i=0;

int main (){
cin>>a>>b>>c;

int mi=min({a,b,c});
a=a-mi;
b=b-mi;
c=c-mi;
int ma=max({a,b,c});

int ans=3*ma-a-b-c;

if(ans%2==0){
  cout<<ans/2;
}else{
cout<<ans/2+2;
}

return 0 ;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {

        static void Main(string[] args)
        {
            var r = ReadStringArray();
            Console.WriteLine(r[0].Last() == r[1].First() && r[1].Last() == r[2].First() ? "YES" : "NO");

        }
        private static readonly Func<string> Read = () => Console.ReadLine();
        private static readonly Func<string[]> ReadStringArray = () => Console.ReadLine().Split();
        private static readonly Func<int> ReadInt = () => int.Parse(Console.ReadLine());
        private static readonly Func<long> ReadLong = () => long.Parse(Console.ReadLine());
        private static readonly Func<int[]> ReadIntArray = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
        private static readonly Func<long[]> ReadLongArray = () => Console.ReadLine().Split().Select(long.Parse).ToArray();
        private static readonly Action<string> Cw = str => Console.WriteLine(str);
    }
}

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

const int N = 200005;

long long n, a[N], b[N];

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {cin >> a[i]; b[i] = a[i] - i - 1;}
	sort(b,b+n);
	long long med = (n&1?b[n/2]:((b[n/2]+b[n/2-1])/2));
	long long ans = 0;
	for (int i = 0; i < n; i++) ans += abs(a[i]-(med+i+1));
	
	cout << ans;
	
	return 0;
}

Measured memory_bytes: 3328
def calc(S, P):
    ans = 0
    if P == 2 or P == 5:
        for i, s in enumerate(S):
            if int(s) % P == 0:
                ans += i + 1
        return ans
    else:
        C = [0] * P
        C[0] = 1
        a = 0
        for i, s in enumerate(S[::-1]):
            a = (a + int(s) * pow(10, i, P)) % P
            ans += C[a]
            C[a] += 1
        return ans

N, P = map(int, input().split())
S = input()
print(calc(S, P))

Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const string EMP = " ";
const ll INF = 1LL<<60;
const ll MOD = 1000000007;

int main(){
  ll n; cin >> n;
  string ans = "";
  while(n){
    n--;
    ans += 'a'+n%26;
    n /= 26;
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3588
# D - String Formation
from collections import deque
s = deque(input())
q = int(input())
odd = 0
for i in range(q):
    t,*fc = input().split()
    if t=='1': odd ^= 1 #t1
    else: #t2
        if odd ^ (int(fc[0])-1): s.append(fc[1])
        else: s.appendleft(fc[1])
if odd: deque.reverse(s)
print(''.join(s))

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var NAB = ReadSplitInt();
            var N = NAB[0];
            var A = NAB[1];
            var B = NAB[2];
            Println(Min(A * N, B));
        }


        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


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

int main () {
    int n; cin >> n;
    vector<int> as(n);
    bool flg = true;
    for (int i = 0; i < n; i++) {
        cin >> as[i];
        if (as[i] % 2 == 0) {
            if (as[i] % 3 != 0 && as[i] % 5 != 0) {
                flg = false;
            }
        }
    }
    if (flg) {
        cout << "APPROVED" << endl;
    } else {
        cout << "DENIED" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
r,c = map(int,input().split())

a = [[0 for i in range(c)] for i in range(r)]

for i in range(r):
    k = 0
    for j in map(int, input().split()):
        a[i][k] = j
        k+=1

b = [0] * c

for i in range(c):
    b[i] = int(input())
    
for i in range(r):
    t = 0
    for j in range(c):
        t+=(a[i][j] * b[j])
    print(t)



Measured memory_bytes: 6008
import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		
		for(;;){
			int n = scan.nextInt();
			if(n == 0)break;
			int[] kou = new int[n];
			for(int i = 0; i < n; i++){
				kou[i] = scan.nextInt();
			}
			int max = Integer.MIN_VALUE;
			int sum = 0;
			for(int i = 0; i < n; i++){
				sum = kou[i];
				max = Math.max(sum, max);
				for(int j = i + 1; j < n; j++){
					sum += kou[j];
					max = Math.max(sum, max);
				}
				sum = 0;
			}
			System.out.printf("%d\n", max);
		}
	}
}

Measured memory_bytes: 35948