akhauriyash/Code-Regression huggingface dataset:
#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 INF 2e9
    #define ALL(v) v.begin(), v.end()
    using namespace std;
    typedef long long ll;
    int main()
    {
      int N;
      cin>>N;
      vector<double> v(N);
     REP(i,N) cin>>v.at(i);
     sort(v.begin(), v.end());
      for(int i=0;i<N-1;i++){
        v[i+1]=(v[i]+v[i+1])/2;
      }
      cout<<v[N-1]<<endl  ;
    }

Measured memory_bytes: 256
N,M=map(int,input().split())
start =[0]*(N+1)
end =[0]*(N+1)
count =0
ans =0

for i in range(M):
    L,R=map(int,input().split())
    start[L-1] += 1
    end[R] += 1

for i in range(N):
    count = count + start[i] - end[i]
    if count == M:
        ans += 1

print(ans)

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

int main() {

char arr[5] = {'i','a','o','u','e'};
char c;
cin>> c;

for (int i=0; i<5; i++){
  if (arr[i] == c){
    cout<< "vowel";
  return 0;} 
}
cout<< "consonant";

return 0;
}

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

int main(void)
{
    int i,dice[10],x,t=0,s=1,e=2,w=3,n=4,b=5;
    char dir[110];
    
    for(i=0;i<6;i++){
        scanf("%d",&dice[i]);
    }
    
    scanf("%s",dir);
    
    for(i=0;i<strlen(dir);i++){
        switch(dir[i]){
            case 'N': x=t; t=s; s=b; b=n; n=x; break;
            case 'S': x=t; t=n; n=b; b=s; s=x; break;
            case 'E': x=t; t=w; w=b; b=e; e=x; break;
            case 'W': x=t; t=e; e=b; b=w; w=x; break;
            }
    }
    printf("%d\n",dice[t]);
    return 0;
}


Measured memory_bytes: 1976
#include <iostream>
#include <iomanip>
#define fin cin
#define fout cout
using namespace std;

int n;
double  p[3005], dp[3005][3005];

int main()
{
    fin>>n;
    for(int i=1;i<=n;++i) fin>>p[i];
    dp[0][0]=1.0;
    for(int i=1;i<=n;++i) dp[0][i]=dp[0][i-1]*(1-p[i]);
    for(int i=1;i<=n;++i)
        for(int j=1;j<=n;++j) dp[i][j]=dp[i][j-1]*(1-p[j])+dp[i-1][j-1]*p[j];
    double sol=0.0;
    for(int i=(n+1)/2;i<=n;++i) sol+=dp[i][n];
    fout<<setprecision(10)<<sol<<"\n";
    return 0;
}


Measured memory_bytes: 70656
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s; cin >> s;
	vector<string> v;
	for(int i=1; i<=5; ++i){
		string t;
		for(int j=0; j<i; ++j)
			t += "hi";
		v.push_back(t);
	}
	for(auto i:v)
		if(i == s){
			cout << "Yes\n";
			return 0;
		}
	cout << "No\n";
}

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

int n;
int p[200000];
int pos[200001];

int main() {
	int i;
	cin >> n;
	for (i = 0; i < n; i++) { cin >> p[i]; pos[p[i] - 1] = i; }
	pos[n] = -1;
	
	int cnt = 1, mCnt = 0;
	for (i = 1; i <= n; i++) {
		if (pos[i - 1] < pos[i]) {
			cnt++;
		}
		else {
			mCnt = max(mCnt, cnt);
			cnt = 1;
		}
	}
	cout << n - mCnt << endl;
	return 0;
}

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

int c[10][10];

void warshall_floyd(){
    for(int k=0;k<10;k++){
        for(int i=0;i<10;i++)
            for(int j=0;j<10;j++) c[i][j] = min(c[i][j], c[i][k]+c[k][j]);
    }
}

int main(){
    int h, w; cin >> h >> w;
    for(int i=0;i<10;i++) for(int j=0;j<10;j++) cin >> c[i][j];

    warshall_floyd();

    int ans = 0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            int a; cin >> a;
            if(a != -1) ans += c[a][1];
        }
    }

    cout << ans << endl;
    return 0;
}


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

namespace Atcoder_0404
{
    class Program
    {

        static void Main(string[] args)
        {

            int _r = GetInput_int()[0];
            float result = _r * 2 * (float)Math.PI;
            Console.WriteLine(result);
        }
        #region input
        

        static string[] GetInput_string()
        {
            var input = Console.ReadLine().Split(' ');
            return input;
        }

        static int[] GetInput_int()
        {
            var input = GetInput_string();
            var result = new int[input.Length];
            for (int i = 0; i < result.Length; i++)
            {
                result[i] = int.Parse(input[i]);
            }
            return result;
        }
        static long[] GetInput_long()
        {
            var input = GetInput_string();
            var result = new long[input.Length];
            for (int i = 0; i < result.Length; i++)
            {
                result[i] = long.Parse(input[i]);
            }
            return result;
        }
        #endregion
        #region sonota
        static void Swap_array<T>(T[] target, int a, int b)
        {
            T temp = target[a];
            target[a] = target[b];
            target[b] = temp;
        }
        static void Swap_list<T>(List<T> target, int a, int b)
        {
            T temp = target[a];
            target[a] = target[b];
            target[b] = temp;
        }
        /// <summary>
        /// 最大公約数
        /// </summary>
        public static int GCD(int a, int b)
        {

            /* 自然数 a > b を確認・入替 */
            if (a < b)
            {
                int tmp = a;
                a = b;
                b = tmp;
            }

            /* ユークリッドの互除法 */
            int r = a % b;
            while (r != 0)
            {
                a = b;
                b = r;
                r = a % b;
            }
            return b;
        }

        /// <summary>
        /// 最小公倍数
        /// </summary>
        public static int LCM(int a, int b)
        {
            int x = a * b;
            b = GCD(a, b);
            return x / b;

        }
        #endregion
    }
}

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


void solve(long long N, long long K, std::vector<long long> h){
  int counter = 0;
  for (int i = 0;i < N; ++i) {
    if (h[i] >= K) { ++counter; };
  }
cout << counter << endl;
}

// Generated by 1.1.5 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);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> h(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&h[i]);
    }
    solve(N, K, std::move(h));
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;

ll solve(int n, int k) {
    ll a[n+1];
    a[0] = 0LL;
    for(int i=1;i<=n;++i){
        cin >> a[i];
        a[i] += a[i-1];
    }

    ll ans = -(1LL << 60);
    for(int i=1;i<=n-k;++i) {
        ans = max(ans, a[i+k-1]-a[i-1]);
    }
    return ans;
}

int main() {
    int n, k;

    while(cin >> n >> k && n) {
        cout << solve(n, k) << endl;
    }
}


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

int main()
{
    int n, alice, bob;
    cin >> n;

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

    sort(v.begin(), v.end(), greater<int>());

    for (int i = 0; i < v.size(); i++)
    {
        if (i % 2 == 0)
        {
            alice += v[i];
        }
        else
        {
            bob += v[i];
        }
    }

    cout << alice - bob << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
//#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch PickingGoods | diff PickingGoods.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address PickingGoods.cpp && ./a.out

/*

 8/15/2020

 6:17-

 */

const int MAX_N=3000+1;
LL V[MAX_N][MAX_N];
int N,M,K;

const LL Inf=1e18;
LL dp[MAX_N][MAX_N][4];
void solve() {
  REP(i,N)REP(j,M)REPE(k,3) dp[i][j][k]=-Inf;
  dp[0][0][0]=0;
  REP(i,N)REPE(k,3)REP(j,M) {
    if(dp[i][j][k]>0) dump(i,j,k,dp[i][j][k]);
    // right
    SMAX(dp[i][j+1][k],dp[i][j][k]);
    if(k<3) SMAX(dp[i][j+1][k+1],dp[i][j][k]+V[i][j]);

    // down
    SMAX(dp[i+1][j][0],dp[i][j][k]);
    if(k<3) SMAX(dp[i+1][j][0],dp[i][j][k]+V[i][j]);
  }
  LL res=0;
  REPE(k,3) {
    LL a=dp[N-1][M-1][k];
    dump(k,a);
    if(k<3) a+=V[N-1][M-1];
    SMAX(res,a);
  }
  cout<<res<<endl;
}

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

  cin>>N>>M>>K;
  REP(i,K) {
    int r,c; LL v; cin>>r>>c>>v;
    --r,--c;
    V[r][c]=v;
  }
  solve();

  return 0;
}


Measured memory_bytes: 355256
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		
		// 計算
		String result = "No";
		if(abs(a-c) <= d) result = "Yes";
		if(abs(a-b) <= d && abs(c-b) <= d) result = "Yes";
		
		
		// 出力
		System.out.println(result);
	}
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

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

    ll N,K; cin >> N >> K;
    vector<P> lis;

    for (int i = 0;i < N;i++){
        ll a,b; cin >> a >> b;
        lis.push_back(P(a,b));
    }

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

    ll cnt = 0;
    ll idx = 0;

    while(1){
        cnt += lis[idx].second;
        if(cnt >= K){
             cout << lis[idx].first << endl;
             break;
        }
        idx++;
    }

    return 0;

}

Measured memory_bytes: 2420
n,m = (int(i) for i in input().split())
s = input()
t = input()
def gcd(a,b):
	if a%b: return gcd(b,a%b)
	else: return b
g = gcd(n,m)
ng,mg = n//g,m//g
if all(s[i*ng]==t[i*mg] for i in range(g)): print(n*m//g)
else: print(-1)

Measured memory_bytes: 3316
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int dp[100001];
int h[100001];
int n;
int ABS(int x)
{
	return max(x,-x);
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&h[i]);
	}
	memset(dp,0x3f3f3f3f,sizeof(dp));
	dp[1]=0;
	for(int i=1;i<=n;i++)
	{
		if(i+2<=n)
		{
			dp[i+2]=min(dp[i+2],dp[i]+ABS(h[i+2]-h[i]));
		}
		if(i+1<=n)
		{
			dp[i+1]=min(dp[i+1],dp[i]+ABS(h[i+1]-h[i]));
		}
	} 
	cout<<dp[n]<<endl;
	return 0;
}


Measured memory_bytes: 1024
n = int(input())
dat = []
for _ in range(n):
    a,b,c = map(int,input().split())
    dat.append( [a,b,c] )
can = True

for x in range(101):
    for y in range(101):
        for i in range(n):
            h = None
            can = True
            xx, yy, hh = dat[i]
            h = hh + abs(xx - x) + abs(yy - y)
            for j in range(n):
                xx, yy, hh = dat[j]
                canh = h - abs(xx - x) - abs(yy - y)
                canh = max(canh, 0)
                if canh != hh:
                    can = False
            if can:
                break
        if can:
            break
    if can:
        break
print(x, y, h)

Measured memory_bytes: 74768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,dis[200005][3];
ll cnt_0,cnt_1;
ll f(ll x,ll cnt)
{     while(x!=0)
    {   ll m=x;
        ll q=0;
        while(m)
       {   if(m&1)q++;
            m=m/2;
       }
       x=x%q;
       cnt++;
    }
    return cnt;
}
int main()
{   string s;
    cin>>n>>s;
    ll cnt=0;
    for(ll i=0;i<n;i++)if(s[i]=='1')cnt++;
    for(ll i=n-1,sum=1;i>=0&&cnt!=1;i--)
    {    dis[i][0]=sum;
         if(s[i]=='1')cnt_0=cnt_0+sum;
         sum=(sum*2)%(cnt-1);
    }
    for(ll i=n-1,sum=1;i>=0;i--)
    {    dis[i][1]=sum;
         if(s[i]=='1')cnt_1=cnt_1+sum;
         sum=(sum*2)%(cnt+1);
    }
    for(ll i=0;i<n;i++)
    {   if(s[i]=='0')
       {   ll x=cnt_1+dis[i][1];
           x=x%(cnt+1);
           cout<<f(x,1)<<endl;
       }
       if(s[i]=='1')
       {   ll x=cnt_0-dis[i][0];
           if(cnt==1)cout<<0<<endl;
           else
           { x=x%(cnt-1);
             cout<<f(x,1)<<endl;
           }
       }
    }
}

Measured memory_bytes: 8408
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    int X,A,B;
    cin >> X >> A >> B;
    if (A >= B){
        cout << "delicious" << endl;
    }
    else if(A + X >= B){
        cout << "safe" << endl;
    }
    else{
        cout << "dangerous" << endl;
    }
}



Measured memory_bytes: 256
loop do
  n = gets.to_i
  break if n==0
  a,b,c,*dots = n.times.map{|i| gets.split(",").map(&:to_f)}
  d = [a,b,c]
  cnt = 0
  dots.each do |v|
    d << v
    d.permutation(4) do |w1,w2,w3,w4|
      v0 = [w2[0]-w1[0], w2[1]-w1[1]]
      v1 = [w3[0]-w1[0], w3[1]-w1[1]]
      v2 = [w4[0]-w1[0], w4[1]-w1[1]]
      t = (v0[0]*v2[1]-v2[0]*v0[1])/(v1[0]*v2[1]-v2[0]*v1[1])
      u = (v0[0]*v1[1]-v1[0]*v0[1])/(v2[0]*v1[1]-v1[0]*v2[1])
      if t>0 && u>0 && t+u<=1
        d.delete(w2)
        cnt += 1
        break
      end
    end
  end
  puts cnt
end

Measured memory_bytes: 6156
N = int(input())
Hs = [int(i) for i in input().split()]

ch = 1000000001
rch = 1000000001
cnt = 0
rcnt = 0
max_cnt = 0

for i in range(N):
    rh = Hs[N - i - 1]

    if rch <= rh:
        rcnt += 1
        max_cnt = max(rcnt, max_cnt)
    else:
        rcnt = 0
    rch = rh

print(max_cnt)

Measured memory_bytes: 14252
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+10;
int n;
int ans=0;

int main()
{

  cin>>n;
  int temp=n;
  int couts=0;
  while(temp)
  {
      couts++;
      temp/=10;
  }
 // cout<<couts<<endl;
  if(couts==1)
    ans=n;
  else if(couts==2)
  {
      ans=9;
  }
  else if(couts==3)
  {
      ans=9+n-100+1;
  }
  else if(couts==4)
  {
      ans=9+900;
  }
  else if(couts==5)
  {
      ans=9+900+n-10000+1;
  }
  else if(couts==6)
    ans=9+900+90000;
  cout<<ans<<endl;


return 0;
}


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

int main(){
    // 自分でやってみた番
    int n,minv,min_index,maxv;
    cin >> n;
    int R[n];
    for(int i=0;i<n;i++){
        cin >> R[i];
    }
    // // n-1番目を除いて最小値を探す
    // min = R[0];
    // min_index = 0;
    // for(int i=0;i<n-1;i++){
    //     if(min>R[i]){
    //         min = R[i];
    //         min_index = i;
    //     }
    // }
    // max = R[min_index+1];
    // // 最小値より先で最大値を探す
    // for(int i=min_index+1;i<n;i++){
    //     if(max<R[i]){
    //         max = R[i];
    //     }
    // }
    // ans = max-min;
    // cout << ans << "\n";

    // Rjの最小値を保持しておく
    maxv = R[1]-R[0];
    minv = R[0];
    for(int j=1;j<n;j++){
        maxv = max(maxv,R[j]-minv);
        minv = min(R[j],minv);
    }
    cout << maxv << endl;
    return 0;
}


Measured memory_bytes: 3896
#include <cstdio>
#include <algorithm>
#include <functional>

using namespace std;

int main(){
	
	int d[12];
	
	for(int i = 0;i < 10;i++){
		scanf("%d",&d[i]);
	}
	
	sort(d, d+10, greater<int>() );
	
	for(int i = 0;i < 3;i++){
		printf("%d\n",d[i]);
	}
	return 0;
	
	}


Measured memory_bytes: 1044
n,k = map(int,input().split())
A = list(map(int,input().split()))
p = []
B = sorted(A)
for i in range(n):
    cnt = 0
    for j in range(i+1, n):
        if A[i] > A[j]:
            cnt += 1
    p.append(cnt)

ans = 0
mod = 10**9 + 7
for i,a in enumerate(A):
    ans = (ans + (k-1) * k * B.index(a) // 2 + p[i]*k) % mod
print(ans)


Measured memory_bytes: 3188
n = int(input())
a = [int(i) for i in input().split()]
m = sum(1 for i in a if i < 0)
z = any(i==0 for i in a)
if m%2 == 0 or z:
    print(sum(abs(i) for i in a))
else:
    # print(sum(abs(i) for i in a),min(abs(i) for i in a))
    print(sum(abs(i) for i in a)-2*abs(min(abs(i) for i in a)))


Measured memory_bytes: 14332
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for (ll i = 0LL; i<(ll)(n); i++)
#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;
TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM K, TNM V> using umap = unordered_map<K, V>;
TPL<TNM K, TNM V> using uset = unordered_set<K, V>;

TPL<class T> inline void OUT(const T &x) { cout << x << "\n"; }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;

TPL<TNM V, TNM H> void resize(vector<V>& v, const H h) { v.resize(h); }
TPL<TNM V, TNM H, TNM ... T> void resize(vector<V>& v, const H& h, const T ... t) { v.resize(h); for (auto& _v : v) resize(_v, t ...); }
TPL<TNM V, TNM T> void fill(V& x, const T& val) { x = val; }
TPL<TNM V, TNM T> void fill(vector<V>& vec, const T& val) { for (auto& v : vec) fill(v, val); }

ll gcd(ll a, ll b) {
	return b != 0 ? gcd(b, a % b) : a;
}

int main(void) {
	ll N, X;
	cin >> N >> X;
	vec<int> x(N);
	REP(i, N) {
		cin >> x[i];
	}
	vec<ll> distance(N);
	REP(i, N) {
		distance[i] = abs(X - x[i]);
	}

	ll g = distance[0];
	REP(i, N - 1) {
		g = gcd(g, distance[i + 1]);
	}
	OUT(g);
	return 0;
}

/*
for (int D = 1; D <= 100; ++D) {

	bool b = false;
	REP(j, N) {
		if (distance[j] % D != 0) {
			b = true;
		}
	}
	cout << D << " " << b << endl;
}
*/

Measured memory_bytes: 1408
#include <iostream>
#include <cmath>

using namespace std;

int main() {
	int w, h, n;
	cin >> w >> h >> n;
	int x, y;
	cin >> x >> y;
	long long int count = 0;
	for (int i = 1; i < n; i++) {
		int x2, y2;
		cin >> x2 >> y2;
		int dx, dy;
		dx = x2-x;
		dy = y2-y;
		if (dx*dy > 0) {
			count += (long long int)max(abs(dx), abs(dy));
		} else if (dx*dy == 0) {
			count += (long long int)abs(dx+dy);
		} else {
			count += (long long int)(abs(dx)+abs(dy));
		}
		x = x2;
		y = y2;
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 1156
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int N, K;
	cin >> N >> K;
	string S;
	cin >> S;

	vector<int> v;
	for (auto it = S.begin(); it != S.end(); ) {
		char t = (*it == 'L') ? 'R' : 'L';
		auto next = find(it + 1, S.end(), t);
		v.push_back(next - it);
		it = next;
	}

	int ans = 0;

	const int M = v.size();

	if (M < 2 * K + 1) {
		ans = N - 1;
	}
	else {
		for (int i = 0; i < 2 * K + 1; ++i) {
			ans += v[i];
		}
		ans -= 1;
		for (int i = 2 * K + 1; i < M; ++i) {
			ans += v[i] - 1;
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 1020
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;

void main() {
  int n, a, b;
  readf (" %d %d %d", &n, &a, &b);
  writeln (min (n * a, b));
}



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

int charToInt(char c){
    char zero_num = '0';
    return (int)c - (int)zero_num;
}

signed main(){
    int N, M;cin>>N>>M;
    vec_int a(N); rep(i,N)cin>>a.at(i);
    vec_int b(M); rep(i,M)cin>>b.at(i);

    vec_int result = convolution(a, b);

    rep(i,N+M-1){
        if(i<N+M-2){
        cout<<result.at(i)<<" ";
        }else{
        cout<<result.at(i)<<endl;
        }
    }

    


    return 0;
}

Measured memory_bytes: 27180
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std; 
#define ll long long
#define pb push_back
#define F first
#define S second
#define all(c)  c.begin(), c.end()
#define mp make_pair
#define endl "\n"
#define N (ll)2e5+10 




int main(){
    
    ios::sync_with_stdio(0);
    
    int a , b ;
    cin >> a >> b ;
    cout << max(0 , a-2*b) ;

    return 0 ;
 }

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

using namespace std;
typedef long long ll;

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

  int a, b, c;
  cin >> a >> b >> c;

  if (b - a == c - b) cout << "YES" << "\n";
  else cout << "NO" << "\n";
}


Measured memory_bytes: 3540
#
# File    : D.rb
# Author  : Kazune Takahashi
# Created : 12/22/2018, 9:07:35 PM
# Powered by Visual Studio Code
#

n = gets.to_i
a = []
n.times{
  a << gets.to_i
}
a.each{|num|
  if num % 2 == 1
    puts "first"
    exit
  end
}
puts "second"

Measured memory_bytes: 2996
import scala.annotation.tailrec

object Main extends App {
  override def main(args: Array[String]): Unit = {

    val in: java.util.Scanner = new java.util.Scanner(System.in)
    Iterator
      .continually((in.nextInt, in.nextInt, in.nextInt, in.nextInt, in.nextInt))
      .takeWhile(_ != (0, 0, 0, 0, 0))
      .map(n => {
        val seq = for (x <- 1 to n._1) yield in.nextInt
        (n, seq)
      }).map(x => solve(x._1._1, x._1._2, x._1._3, x._1._4, x._1._5, x._2)).foreach(println)
  }

  def solve(n: Int, a: Int, b: Int, c: Int, x: Int, input: Seq[Int]): Int = {

    def next(seed: Int): Int = (a * seed + b) % c

    val MAX = 10001

    @tailrec
    def rec(xx: Int, seq: Seq[Int], c: Int): Int = (xx, seq, c) match {
      case (_, Nil, _) => c
      case (_, _, MAX) => 0
      case (x, s, j) if (x == s.head) => rec(next(x), s.drop(1), j + 1)
      case (x, s, j) => rec(next(x), s, j + 1)
    }

    return rec(x, input, 0) - 1

  }
}

Measured memory_bytes: 117664
H, W, K = map(int, input().split())
mass = []
for i in range(H):
  c = input()
  mass_append = [0 for k in range(W)]
  for j in range(W):
    if c[j] == "#":
      mass_append[j] = 1
  mass.append(mass_append)
pattern = 0
for i in range(2**W):
  i_str = str(bin(i)[2:])
  i_2 = i_str.zfill(W)
  for j in range(2**H):
    j_str = str(bin(j)[2:])
    j_2 = j_str.zfill(H)
    massnew = []
    for k in range(H):
      massnew.append(list(mass[k]))
    for k in range(W):
      if i_2[k] == "1":
        for m in range(H):
          massnew[m][k] = 0
    for k in range(H):
      if j_2[k] == "1":
        for m in range(W):
          massnew[k][m] = 0
    black = 0
    for k in range(W):
      for m in range(H):
        if massnew[m][k] == 1:
          black += 1
    if black == K:
      pattern += 1

print(pattern)

Measured memory_bytes: 9296
import core.bitop;
import std.algorithm;
import std.array;
import std.ascii;
import std.container;
import std.conv;
import std.format;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
  string str = readln.chomp;
  writeln = str.indexOf("9") == -1 ? "No" : "Yes";
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    static int[] parents;
    static int[] sizes;
    static int n;
    static int m;
    
    private static long nC2(int x) {
        long numera = 1;
        for (int i = x; i > x - 2; i--) {
            numera *= i;
        }
        return numera / 2;
    }
    
    private static long union(int a, int b) {
        int ap = getParent(a);
        int bp = getParent(b);
        long ret = nC2(sizes[ap]) + nC2(sizes[bp]);
        if (ap == a && bp == b && sizes[ap] == 1 && sizes[bp] == 1) {
            parents[b] = a;
            sizes[a] += 1;
            return -1;
        }
        if (ap == bp) return 0;
        if (sizes[ap] >= sizes[bp]) {
            
            parents[bp] = ap;
            sizes[ap] += sizes[bp];
            ret -= nC2(sizes[ap]);
        } else {
            parents[ap] = bp;
            sizes[bp] += sizes[ap];
            ret -= nC2(sizes[bp]);
        }
        return ret;
    }

    private static int getParent(int x) {
        while (parents[x] != 0) {
            x = parents[x];
        }
        return x;
    }
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        m = sc.nextInt();
        parents = new int[n+1];
        sizes = new int[n+1];
        for (int i = 0; i < n+1; i++) sizes[i] = 1;
        long inconvenience = nC2(n);
        long[] inconveniences = new long[m];
        int[][] edges = new int[m][2];
        int a, b;
        for (int i = 0; i < m; i++) {
            a = sc.nextInt();
            b = sc.nextInt();
            edges[i][0] = a;
            edges[i][1] = b;
        }
        for (int i = m - 1; i >= 0; i--) {
            a = edges[i][0];
            b = edges[i][1];
            inconveniences[i] = inconvenience;
            inconvenience += union(a, b);
        }

        for (int i = 0; i < m; i++) {
            System.out.println(inconveniences[i]);
        }
    }
}

Measured memory_bytes: 102924
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
using ll = long long;
int main() {
    int a;
    cin >> a;
    cout << a + a*a + a*a*a << endl;
    return 0;
}

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

using namespace std;

typedef pair<int, int> P_ii;
typedef pair<string, int> P_si;
typedef long long int ll;

const int MOD = 1000000007;

int main() {
    ll N, M;
    cin >> N >> M;
    if (N == 1 && M == 1) {
        printf("%d\n", 1);
        return 0;
    }
    if (N == 1) {
        printf("%lld\n", M - 2);
        return 0;
    }
    if (M == 1) {
        printf("%lld\n", N - 2);
        return 0;
    }
    ll ans = abs(N - 2) * abs(M - 2);
    printf("%lld\n", ans);
    return 0;
}



Measured memory_bytes: 256
import math

N, D = map(int, input().split())

X = []
for _ in range(N):
    X.append(list(map(int, input().split())))

def distance(x, y, d):
    s = 0
    for i in range(d):
        s += abs(x[i] - y[i]) ** 2
    return math.sqrt(s)
    

count = 0
for i in range(N):
    for j in range(i+1, N):
        if i == j:
            continue
        
        d = distance(X[i], X[j], D)
        if d.is_integer():
            count += 1

print(count)
        


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

using namespace std;

int main(){
    int n;
    cin>>n;
    long long int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    
    a[0]-=1;
    for(int i=1;i<n;i++){
        if(a[i-1]<a[i]){
            a[i]-=1;
        }
    }
    for(int i=1;i<n;i++){
        if(a[i-1]>a[i]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 1024
// きさま！ 見ているなッ！

#include<iostream>
#include<queue>
#include<memory>
#include<map>
#include<set>
#include<unordered_map>
#include<array>
#include<vector>
#include<algorithm>
#include<list>
#include<limits>
#include<stdio.h>
#include<math.h>
#include<string>
#include<thread>

using namespace std;
using ll = long long;
using vec = vector<int>;
using mat = vector<vec>;
using lst = list<ll>;

const ll MOD = 1000000007;


int main()
{
	ll N, K;
	cin >> N >> K;
	ll ans = N - (N / K)*K;
	ans = min(ans, -ans + K);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

input = sys.stdin.readline
import collections,sys,threading
sys.setrecursionlimit(10**9)
threading.stack_size(10**8)


########################################
def solve():
	s = int(input())
	mod = 10**9 + 7
	from functools import lru_cache
	@lru_cache(None)
	def f(rem):
		#print(prev,rem)
		if rem < 0:
			return 0
		if rem == 0:
			return 1
		ans = 0
		for i in range(3, s+1):
			ans += f(rem-i)
			#if rem - i == 0: print("HI: ",rem,i)
			ans %= mod
		return ans
	print(f(s)%mod)

threading.Thread(target=solve).start()






'''
# Wrap solution for more recursion depth
#submit as python3

'''


Measured memory_bytes: 11120
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll a[200010];
map<ll,ll>b;
int main() {
	ll n;
	cin>>n;
	for(ll i=1;i<=n;i++){
		cin>>a[i];
		a[i]=a[i]+a[i-1];
	}
	for(ll i=0;i<=n;i++){
		b[a[i]]++;
	}
	ll ans=0;
	for(auto itr=b.begin();itr!=b.end();itr++){
		ll val=itr->second;
		ans+=val*(val-1)/2;
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 14336
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;



namespace Test1 {

    class ClassMain {

        public static void Main(String[] args) {

            String line;
                
            while ((line = Console.ReadLine())!=null) {
                int n = int.Parse(line);
                if (n == 0) { return;  }
                long amount = 0L;
                for (int i = 0; i < n; i++) {
                    int pay = int.Parse(Console.ReadLine());
                    amount += pay;
                
                }
                Console.WriteLine(amount / n);
                break;

            }
        }
    }
}

Measured memory_bytes: 5640
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>


typedef long double ld;
typedef long long ll;

using namespace std;

int main() {
	string s, t;
	cin >> s >> t;
	int ret = 0;
	for (int i = 0; i < s.length(); i++) {
		if (s[i] != t[i]) {
			ret++;
		}
	}
	cout << ret << endl;
	return 0;
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(long long &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const long long &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
int n, h[100000], dp[100000];
int calc(int i) {
	if(i == n - 1) return 0;
	if(dp[i] != -1) return dp[i];
	int res = calc(i + 1) + abs(h[i] - h[i + 1]);
	if(i + 2 <= n - 1) res = min(res, calc(i + 2) + abs(h[i] - h[i + 2]));
	return dp[i] = res;
}
int main() {
	R(n);
	for(int i = 0; i < n; i++) R(h[i]);
	memset(dp, -1, sizeof(dp));
	int ans = calc(0);
	W(ans);
	return 0;
}

Measured memory_bytes: 5760
S=chomp(readline())
if S[1]!='A'
	println("WA")
	exit()
end
c=0
for i=3:length(S)-1
	if S[i]=='C'
		c+=1
	end
end
if c!=1
	println("WA")
	exit()
end
c=0
for t=S
	if t<='Z'
		c+=1
	end
end
if c!=2
	println("WA")
else
	println("AC")
end


Measured memory_bytes: 108612
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

K=int(input())
ans=0
for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      ans += gcd(i,j,k)
#print(len(ans))
print(ans)

Measured memory_bytes: 69964
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b,c; cin>>a>>b>>c;
	if (b-a==c-b) cout<<"YES";
	else cout<<"NO"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int            int64_t
#define double         long double
#define nitro          ios_base::sync_with_stdio(false);cin.tie(0);
#define vi             vector<int64_t>
#define pub            push_back
#define puf            push_front
#define pob            pop_back
#define pof            pop_front
#define PI             3.1415926535897932384626433832795
#define read(a)        for(auto& x : a) cin>> x
#define endl           '\n'
#define gap            ' '
#define min3(a,b,c)    min(a, min(b, c))
#define max3(a,b,c)    max(a, max(b, c))
#define MOD            1000000007
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
int a[26];
int32_t main()
{
    nitro
    string s,s1;cin>>s;
    for(char c:s) a[c-'a']++;
    for(int i=0;i<26;i++){
    	if(a[i]==0) s1+=(char)(i+97);
    }
    if(s1.size()==0) cout<<"None";
    else cout<<s1.front();
   
}
    

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

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

typedef long long int lo;
#define pb push_back
#define st first
#define nd second
#define inf (int)1e9
#define N (int)1e5 * 5
#define mod (int)1e9 + 7
#define all(x) (x).begin(), (x).end()
int in(){ int a; cin >> a; return a; }

void solve(){
	char a;
	cin >> a;
	if(a >= 'a'){
		cout << "a\n";
	}
	else{
		cout << "A\n";
	}
}

int main(){
  	ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(0); cerr.tie(0);
	// freopen("gir.gir", "r", stdin);
	// freopen("cik.cik", "w", stdout);
	int t = 1;
	// cin >> t;
	while(t--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 3652
import java.util.*;
public class Main {
    public static void main(String[] args) throws java.io.IOException{
        Scanner scan = new Scanner(System.in);
      //  ArrayList <Double> mou =new ArrayList <Double>();
        int count=0;
        while (true){
        	
        	
        	int a=scan.nextInt();
        	int b=scan.nextInt();
        	if((a|b)==0)break;
        	if(count!=0)System.out.println();
        	
        	boolean flag =true;
        	for(int i=a;i<=b;i++){
        		if(i%400==0||i%4==0&&i%100!=0){
        			System.out.println(i);
        			flag=false;
        		}
        		}
        	if(flag)System.out.println("NA");
        	count++;
        	}
     
        }
      


}

Measured memory_bytes: 12000
import java.util.*;

public class Main {

    public static void topThreeHills() {
        // Get 10 inputs for mountain heights
        Scanner scanner = new Scanner(System.in);
        int[] heights = new int[10];
        for (int i = 0; i < heights.length; i++) {
            heights[i] = scanner.nextInt();
        }

        // Find top three heights
        /*
        int[] threeHighest = Arrays.copyOfRange(heights, 0, 3);
        for (int i = 3; i < 10; i++) {
            if (heights[i] > threeHighest[0])
                threeHighest[0] = heights[i];
            else if (heights[i] > threeHighest[1])
                threeHighest[1] = heights[i];
            else if (heights[i] > threeHighest[2])
                threeHighest[2] = heights[i];
        }

        System.out.println(" ");
        System.out.println(threeHighest[0]);
        System.out.println(threeHighest[1]);
        System.out.println(threeHighest[2]);
        */

        Arrays.sort(heights);
        System.out.println(heights[9]);
        System.out.println(heights[8]);
        System.out.println(heights[7]);
    }

    public static void main (String args[]) {
        topThreeHills();
    }
}

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

int main(){
/*
	#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output1.txt","w",stdout);
    #endif
*/
	int n,k;
	cin>>n>>k;
	vector<int> v(n+1,0);
	for (int i = 1; i <= n; ++i)
	{
		cin>>v[i];
	}
	int dp[n+1]={0};
	dp[1]=0;
	dp[2]=abs(v[2]-v[1]);
	int minn;
	for (int i = 3; i <= n; ++i)
	{
		minn=INT_MAX;
		for (int j = 1; j <=min(i-1,k); j++)
		{
			minn=min(minn,dp[i-j]+abs(v[i]-v[i-j]));
		}
		dp[i]=minn;
	}
	cout<<dp[n];
}

Measured memory_bytes: 1024
import sys

inp=input().split(" ")
thp=int(inp[0])
tat=int(inp[1])
ahp=int(inp[2])
aat=int(inp[3])

for i in range(100):
  ahp-=tat
  if ahp<=0:
    print("Yes")
    sys.exit()
  thp-=aat
  if thp<=0:
    print("No")
    sys.exit()


Measured memory_bytes: 9180
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  
  int i,j,n,m,dp[50001];

  cin >> n >> m;
  int coin[25];

  for(i = 1; i <= m; i++){
    cin >> coin[i];
  }

  for(i = 1; i<= n; i++)dp[i]=i;

  for(i = 1; i <= m; i++){
    for(j = 1; j <= n; j++){
      if(j-coin[i]>=0){

	//if(i==3&&j==n){
	//dp[j]=min(dp[j],dp[j-coin[i]]);
	//}else{
	  dp[j]=min(dp[j],dp[j-coin[i]]+1);
	}
      }
    //}


    /*  for(j=0;j<=n;j++)cout<<dp[j]<<' ';
	cout<<endl; */
    } 

  cout << dp[n] << endl;
  return 0;
}

Measured memory_bytes: 1356
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<iomanip>
#include<stack>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define sz(a) (int)a.size()
using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	int k = (1 << m);
	cout << k * (100 * (n - m) + 1900 * m) << endl;
}

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

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

typedef int i32;
typedef long long int i64;
typedef unsigned long long int ui64;
typedef float f32;
typedef double f64;
typedef long double f128;
typedef pair<int,int> Pi;

constexpr int INF = 1e9 + 7;
constexpr int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};

int main() {
   int N; cin>>N;
   i64 cnt[5]; REP(i,5) cnt[i]=0;
   string S;
   char march[5] = {'M','A','R','C','H'};
   REP(i,N) {
       cin>>S;
       REP(i,5) if (S[0]==march[i]) cnt[i]++;
   }
   i64 ans = 0;
   for (int bit=0; bit<1<<5; ++bit) {
       int youso=0;
       i64 tmp=1;
       REP(i,5) {
           if (bit&(1<<i)) {
               youso++;
               tmp *= cnt[i];
           }
       }
       if (youso==3) ans+=tmp;
   }
   cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<cmath>

using namespace std;


int main(){
    int X;
    cin >> X;
    for(int i=0;i<50000;i++){
        if((int)(i*1.08) == X){
            cout << i << endl;
            return 0;
        }
    }
    cout << ":(" << endl;
    return 0;
}


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

int main()
{
    double n, m, d;
    cin >> n >> m >> d;
    if (d == 0)
        printf("%.10f\n",(m-1)/n);
    else
        printf("%.10f\n",(m-1)*2*(n-d)/(n*n));

    return 0;
}






Measured memory_bytes: 256
"use strict";
// import bigInt from 'big-integer'

const Main = input => {
  input = input.trim().split(" ");
  const loop = input[0];
  const low = input[1];
  const high = input[2];

  let total = 0;
  for (let i = 0; i <= loop; i++) {
    const num = i
      .toString()
      .split("")
      .reduce((acc, cur) => acc + parseInt(cur, 10), 0);
    if (low <= num && num <= high) total += i;
  }

  console.log(total);
};

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


Measured memory_bytes: 9228
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int x=0;
  if(s=="SUN") {
    x=7;}
  else if(s=="MON") {
    x=6;}
  else if(s=="TUE") {
    x=5;}
  else if(s=="WED") {
    x=4;}
  else if(s=="THU") {
    x=3;}
  else if(s=="FRI") {
    x=2;}
  else if(s=="SAT") {
    x=1;}
  cout << x << endl;
  }

Measured memory_bytes: 256
#include <stdio.h>
typedef long long ll;

typedef struct {
	int v, w;
	char t;
	ll d;
	char s[24];
} tuple;

tuple a[200000];
tuple tmp[200000];

int comp(tuple* l, tuple* r) {
	int i = 0;
	if (l->v < r->v) return -1;
	if (l->v > r->v) return 1;
	if (l->w < r->w) return -1;
	if (l->w > r->w) return 1;
	if (l->t < r->t) return -1;
	if (l->t > r->t) return 1;
	if (l->d < r->d) return -1;
	if (l->d > r->d) return 1;
	while (l->s[i] != '\0' && r->s[i] != '\0' && l->s[i] == r->s[i]) ++i;
	if (l->s[i] == '\0' && r->s[i] == '\0') return 0;
	if (l->s[i] == '\0') return -1;
	if (r->s[i] == '\0') return 1;
	return l->s[i] < r->s[i] ? -1 : 1;
}

void sort(int lb, int ub) {
	int i, j, k;
	if (ub - lb <= 1) return;
	int m = (lb + ub) >> 1;
	sort(lb, m);
	sort(m, ub);
	for (i = lb; i < ub; i++) {
		tmp[i] = a[i];
	}
	for (i = lb, j = lb, k = m; i < ub; i++) {
		if (j == m) {
			a[i] = tmp[k];
			++k;
		}
		else if (k == ub) {
			a[i] = tmp[j];
			++j;
		}
		else if (comp(&tmp[j], &tmp[k]) < 0) {
			a[i] = tmp[j];
			++j;
		}
		else {
			a[i] = tmp[k];
			++k;
		}
	}
}

int main(void)
{
	int n, i;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d%d", &a[i].v, &a[i].w);
		getchar();
		a[i].t = getchar();;
		scanf("%lld", &a[i].d);
		getchar();
		scanf("%s", a[i].s);
	}
	sort(0, n);
	for (i = 0; i < n; i++) {
		printf("%d %d %c %lld %s\n", a[i].v, a[i].w, a[i].t, a[i].d, a[i].s);
	}
	return 0;
}



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

int main() {
  
  long x;
  cin >> x;
  
  long b = 100;
  
  for(int i = 0; i <= 376000; i++){
    b = b + (b / 100);
    if(b >= x){
      cout << i + 1 << endl;
      break;
    }
  }
  
  
}



Measured memory_bytes: 3576
#include <cassert>
//PXjUXeZStdX
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
// #include <boost/foreach.hpp>
// #include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
//#define INF 1e9
#define LINF (1LL<<40)
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define int long long
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
// int dx[]={0,1,0,-1};
// int dy[]={1,0,-1,0};
typedef pair<int,int> P;

const long long MOD=1000000007LL;
bool isupper(char c){if('A'<=c&&c<='Z')return 1;return 0;}
bool islower(char c){if('a'<=c&&c<='z')return 1;return 0;}
bool iskaibun(string s){for(int i=0;i<s.size()/2;i++)if(s[i]!=s[s.size()-i-1])return 0;return 1;}
bool isnumber(char c){return ('0'<=c&&c<='9');}
bool isalpha(char c){return (isupper(c)||islower(c));}
template<typename T> 
void print(vector<T> v){
    for(int i=0;i<v.size();i++){
        cout<<i<<": ";
        if(i)cout<<" ";
        cout<<v[i];
    }
    cout<<endl;
}
int INF=1e18;

template<typename T>
void printendl(vector<T> v){
    for(auto date:v)cout<<date<<endl;
}

template<typename T>
void printvv(vector<vector<T>> v){
    for(int i=0;i<v.size();i++){
        for(int j=0;j<v[i].size();j++){
            if(j)cout<<" ";
            cout<<v[i][j];
        }
        cout<<endl;
    }
}
int gcd(int a,int b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    else return gcd(b,a%b);
}

struct Edge{
    int to,cost;
};


signed main (){
    int a,b,c;
    cin>>a>>b>>c;
    cout<<max(0LL, c-(a-b))<<endl;
}
/*


*/



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

typedef long long int ll;


int main()
{
	ios::sync_with_stdio(0);
	ll n;
	cin >> n;
	ll arr[n],i,j,dp[n];
	for(i=0;i<n;i++)
		cin >> arr[i];
	for(i=0;i<n;i++)
		dp[i]=-1;
	dp[0]=0;
	dp[1]=abs(arr[1]-arr[0]);
	for(i=2;i<n;i++)
		dp[i] = min(dp[i-1]+abs(arr[i-1]-arr[i]),dp[i-2]+abs(arr[i-2]-arr[i]));
	cout << dp[n-1] << "\n";
	return 0;
}

Measured memory_bytes: 1792
using System;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        string input = Console.ReadLine();
        for (int i = 0; i < input.Length; i++)
        {
            if (char.IsUpper(input[i]))
            {
                Console.Write(char.ToLower(input[i]));
            }
            else if (char.IsLower(input[i]))
            {
                Console.Write(char.ToUpper(input[i]));
            }
            else
            {
                Console.Write(input[i]);
            }
        }
        Console.WriteLine();
    }
}



Measured memory_bytes: 13816