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

#define REP(i,n) for(int i=0;i<n;++i)
#define RREP(i,n) for(int i=n-1;i>=0;--i)
#define FOR(i,m,n) for(int i=m;i<n;++i)
#define RFOR(i,m,n) for(int i=n-1;i>=m;--i)
#define ALL(v) v.begin(),v.end()
#define PB(a) push_back(a)
#define INF 1000000001
#define MOD 1000000007

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

using namespace std;


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	while (1) {
		int e, ans=INF;
		cin >> e;
		if (!e) break;
		for (int i = 0;i*i*i <= e;++i) {
			int y = sqrt(e - i*i*i);
			int x = e - i*i*i - y*y;
			ans = min(ans, x + y + i);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3112
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T&v)
{fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0; return gcd(a, b, x, y);}
ll modpow(lll a,lll n,ll m){if(a==0)return a;lll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;

ll n, m, d[3][1000];
vl v;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> m;
  FOR(i, 0, n)FOR(j, 0, 3) cin >> d[j][i];
  ll ans = -linf;
  FOR(i, 0, 8){
    v.resize(0);
    FOR(j, 0, n){
      ll s = 0;
      FOR(k, 0, 3) s += ((i & (1<<k)) ? 1 : -1) * d[k][j];
      v.pb(s);
    }
    sort(rng(v));
    reverse(rng(v));
    ll s = 0;
    FOR(j, 0, m) s += v[j];
    maxs(ans, s);
  }
  cout << ans << endl;
  return 0;
}

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

typedef long long int ll;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")
#pragma GCC optimize ("-fno-defer-pop")


int main()
{

    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll a,b,c;

    cin>>a>>b>>c;

    cout<<min(a+min(b,c),min(c+min(b,a),b+min(a,c)))<<endl;




}










Measured memory_bytes: 256
s = int(input())
a = []
i = 0
while 1:

    if i == 0:
        a.append(s)
    elif i > 0:
        if a[i - 1] % 2 == 0:
            a.append(a[i - 1] / 2)
        elif a[i - 1] % 2 == 1:
            a.append(3 * a[i - 1] + 1)
        if a[i] in a[:i]:
            print(i + 1)
            exit()
    i += 1


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


int main()
{
  int n;
  cin>>n;
  int t[n+1];
  t[0] = 0;
  unsigned long long int sum = 0;
  for(int i = 1; i<=n; i++)
  {
  cin>>t[i];
  sum += t[i];
  }

  int m ;
  cin>>m;
  int id , new_time;
  int temp;
  for(int i  = 1; i<=m ;i++)
  {
    temp = sum;
    cin>>id;
    cin>>new_time;
    temp = temp - t[id] + new_time;
    cout<<temp<<endl;
  }


  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <ctime>
#include <cstring>
#define ll long long
#define INF 1000000000
#define For(i,a,b) for(int i=a;i<=b;++i)
#define Rev(i,a,b) for(int i=a;i>=b;--i)
#define pb push_back
#define pq priority_queue
#define PI acos(-1)

namespace IO
{
#define p(x) ('0'<=x&&x<='9')
	char cc; int C;
	template <class T>
	void read( T &x )
	{
		x=0; cc=getchar(); C=1;
		while(!p(cc)) { if(cc=='-') C=-1; cc=getchar(); }
		while(p(cc)) { x=x*10+cc-48; cc=getchar(); }
		x*=C;
	}
#undef p
}

using namespace IO;
using namespace std;

int a[5];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	srand(time(0));
#ifdef LOCAL
	freopen("./tmp/input.txt", "r", stdin);
#endif

	cin >> a[1] >> a[2] >> a[3];
	sort(a+1,a+4);
	if(a[1]==5&&a[2]==5&&a[3]==7) cout << "YES";
	else cout << "NO";


	return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int latte[111111];


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

    vint T(N);rep(i,N)cin>>T[i];

    int m=*max_element(all(T));

    fill_n(latte,111111,INT_MAX);
    for(int i=1;i<=m;i++){
        if(m%i==0)latte[i]=0;
    }
    for(int i=100000;i>0;i--)chmin(latte[i],latte[i+1]+1);

    int ans=0;
    rep(i,N)ans+=latte[T[i]];
    cout<<ans<<endl;
    return 0;
}

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

const int N = 3e5 + 10;

int w[N], e[N];
char a[N];
int main() {
    int n;
    cin >> n;
    scanf("%s", a + 1);
    for(int i = 1; i <= n; i++) {
        w[i] = w[i - 1] + (a[i] == 'W');
        e[i] = e[i - 1] + (a[i] == 'E');
    }
    int ans = N;
    for(int i = 1; i <= n; i++) {
        ans = min(ans, w[i - 1] + e[n] - e[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2944
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  /* your code */
	NodePointer cur=nil->next;
	while(cur!=nil && cur->key!=key){
		cur=cur->next;
	}
	return cur;
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  /* your code */
	if(t==nil){
		return ;
	}
	t->prev->next=t->next;
	t->next->prev=t->prev;
	free(t);
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast(){
  /* your code */
	NodePointer t = nil->prev;
  if ( t == nil ) return;
  deleteNode(t);
}

void delete(int key){
  /* your code */
	deleteNode(listSearch(key));
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;
  /* 
   your code 
  */
  x->next=nil->next;
	nil->next->prev=x;
	nil->next=x;
	x->prev=nil;
}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	delete(key); nd++; 
      }
      size--;
    }
  }

  printList();
  return 0;
}


Measured memory_bytes: 33004
using System;
using System.Linq;

namespace AtCoder.abc117
{
  class b
  {
    static void Main(string[] args)
    {
      byte N = byte.Parse(Console.ReadLine());
      string[] Lstr = Console.ReadLine().Split(' ');
      byte[] Lby = new byte[Lstr.Length];
      short sum = 0;
      for (byte i = 0; i < Lby.Length; i++) { Lby[i] = byte.Parse(Lstr[i]); sum += Lby[i]; }
      //if () Console.Write("Yes"); else Console.Write("No");
      Console.Write(0 < sum - 2 * Lby.Max() ? "Yes" : "No");
    }
  }
}


Measured memory_bytes: 13268
#!/usr/bin/env python3

import sys
# import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    L = lmi()
    L.sort(reverse=True)
    print(L[0] * 10 + L[1] + L[2])



if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <limits>
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define pint_INF 2000000000
#define ll_INF 	9223372036854775807
#define MOD 1000000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvll vector<vector<long long>>
#define vvc vector<vector<char>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define sysp system("PAUSE")
#define pno cout << "no" << endl
#define pyes cout << "yes" << endl
#define pYes cout << "Yes" << endl
#define pNo cout << "No" << endl
#define pNO cout << "NO" << endl
#define pYES cout << "YES" << endl
#define endl "\n"
#define pi 3.14159265358979
using namespace std;
using ll = long long;

int main() {
	string s; cin >> s;
	int N = s.size();
	int score = 0;
	for (int i = 0; i < N; i++) {
		if (i % 2 == 0) {
			// me is g
			if (s[i] == 'p') {
				score--;
			}
		}
		else if (i % 2 == 1) {
			//me is p
			if (s[i] == 'g') {
				score++;
			}
		}
	}
	cout << score << endl;
}

Measured memory_bytes: 3728
#! /usr/bin/env python3

# from math import gcd
from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

N = int(input())
c = input()

def check(LW, RR):
    
    ct = min(LW, RR)

    if LW >= RR:
        ct += LW - RR
    elif LW < RR:
        ct += RR - LW

    return ct

a = Counter(c)
if not (a["W"] and a["R"]):
    print(0)
    exit()

L = Counter(c[:1])
R = Counter(c[1:])

LW = L["W"]
RR = R["R"]
mi = N
for i in range(1, N):
    mi = min(mi, check(LW, RR))
    
    if c[i] == "W":
        LW += 1
    else:
        RR -= 1
    
print(mi)


Measured memory_bytes: 10768
n, x, y = list(map(int, input().split()))
ans = [0] *(n - 1)
for i in range(1, n):
    for j in range(i + 1, n + 1):
        d = j - i - 1
        if (i < x and j < x) or (i > y and j > y):
            pass
        else:
            sc = abs(i - x) + abs(j - y)
            d = min(d, sc)
        ans[d] += 1
for k in ans:
    print(k)

Measured memory_bytes: 3444
#include<bits/stdc++.h>
#define rg register
using namespace std;
const int mod=1e9+7;
#define _ 2001
int n, k, f[_][_], sum[_*_], inv[_*_];
int qp(int x, int y){
	int ans=1;
	while(y){
		if(y&1)ans=1ll*ans*x%mod;
		x=1ll*x*x%mod, y>>=1;
	}return ans;
}
int C(int m, int r){return 1ll*sum[m]*inv[r]%mod*inv[m-r]%mod;}
int main(){
	inv[0]=inv[1]=sum[0]=sum[1]=1;
	for(rg int i=2; i<=2000*2000; ++i)
		sum[i]=1ll*sum[i-1]*i%mod, inv[i]=qp(sum[i], mod-2);
	scanf("%d%d", &n, &k);
	if(k==1){puts("1"); return 0;}
	f[0][0]=1;
	for(int i=1; i<=n; ++i)
		for(int j=0; j<=i; ++j){
			f[i][j]=f[i-1][j];
			if(j)(f[i][j]+=1ll*C((n-j+1)*(k-1)+n-i-1, k-2)*f[i][j-1]%mod)%=mod;
		}
	for(int i=2; i<=n; ++i)
		f[n][n]=1ll*f[n][n]*i%mod;
	printf("%d", f[n][n]);
}


Measured memory_bytes: 47104
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <map>
#include <queue>
#define rep(i,n) for (int i=0;i<(n);i++)

using namespace std;


int main() {
	double l;
	cin >> l;

	long double ans = pow(l / 3, 3);

	printf("%.7llf", ans);

	return 0;
}

//BBBBBBBBBBBBBB
//int main() {
//	string s;
//	cin >> s;
//	int n = s.length();
//	string s1 = s.substr(0, (n - 1) / 2);
//	string _s = s;
//	string _s1 = s1;
//
//	reverse(_s.begin(), _s.end());
//	reverse(_s1.begin(), _s1.end());
//
//	if (s == _s && s1 == _s1) {
//		cout << "Yes" << endl;
//	}
//	else {
//		cout << "No" << endl;
//	}
//
//	return 0;
//}


//AAAAAAAAAAAAAAA
//int main() {
//	int n, m;
//	cin >> n >> m;
//	int ans = 0;
//	if (n >= 2)ans += n * (n - 1) / 2;
//	if (m >= 2)ans += m * (m - 1) / 2;
//	cout << ans << endl;
//
//	return 0;
//}

Measured memory_bytes: 4132
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  n=3*n;
  int a[n];
  for(int i=0;i<n;i++)cin >> a[i];
  sort(a,a+n);
  long long ans=0;
  for(int i=n-2;i>n/3-1;i=i-2){
    ans+=a[i];
  }
  cout << ans;
}


Measured memory_bytes: 1408
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<string>
#include<ctype.h>
#include<math.h>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<bitset>
#include<algorithm>
#include<time.h>
using namespace std;
void fre() { freopen("c://test//input.in", "r", stdin); freopen("c://test//output.out", "w", stdout); }
#define MS(x, y) memset(x, y, sizeof(x))
#define ls o<<1
#define rs o<<1|1
typedef long long LL;
typedef unsigned long long UL;
typedef unsigned int UI;
template <class T1, class T2>inline void gmax(T1 &a, T2 b) { if (b > a)a = b; }
template <class T1, class T2>inline void gmin(T1 &a, T2 b) { if (b < a)a = b; }
const int N = 0, M = 0, Z = 1e9 + 7, inf = 0x3f3f3f3f;
template <class T1, class T2>inline void gadd(T1 &a, T2 b) { a = (a + b) % Z; }
int casenum, casei;
int n;
map<int, int>mop;
int A, B;
int main()
{
	while (~scanf("%d", &n))
	{
		mop.clear();
		for (int i = 1; i <= n; ++i)
		{
			int x;
			scanf("%d", &x);
			++mop[x];
		}
		A = B = 0;
		for (auto it : mop)
		{
			if (it.second >= 4)
			{
				if (it.first > B)
				{
					B = it.first;
					if (B > A)swap(A, B);
				}
				if (it.first > B)
				{
					B = it.first;
					if (B > A)swap(A, B);
				}
			}
			else if (it.second >= 2)
			{
				if (it.first > B)
				{
					B = it.first;
					if (B > A)swap(A, B);
				}
			}
		}
		LL ans = (LL)A * B;
		printf("%lld\n", ans);
	}
	return 0;
}
/*
【trick&&吐槽】


【题意】


【分析】


【时间复杂度&&优化】


*/

Measured memory_bytes: 4992
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <set>
#include <stack>

//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater<int>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#include <time.h>
typedef std::pair<int,int> pii;
using namespace std;
using ll = long long;
#define PI 3.14159265358979323846264338327950L
const int mod =  998244353;



void solve(){
    
    char a;
    cin >> a;
    int i = a - 'a';
    
    
    if (i >= 0 && i < 26){
        cout << "a";
    }
    else cout << "A";
}



int main(){
    solve();
}




Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const int INF = 1001001001;

int main(){
  int n; cin >> n;
  vector<pair<int,int>> xy(n);
  for(int i=0;i<n;i++) cin >> xy.at(i).first >> xy.at(i).second;
  map<pair<int,int>,int> mp;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(i==j)continue;
      int dx = xy.at(j).first-xy.at(i).first;
      int dy = xy.at(j).second-xy.at(i).second;
      if(!mp.count(make_pair(dx,dy))){
        mp[make_pair(dx,dy)] = 1;
      }else{
        mp.at(make_pair(dx,dy))++;
      }
    }
  }
  int m = 0;
  for(auto a:mp){
    m = max(m,a.second);
  }
  cout << n-m;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <math.h>
int main(void){
    double q; 
    while(scanf("%lf", &q)!= EOF && q != -1) { 
        double x, a;       
        x=q/2;       
            while(1){
                if(fabs(x*x*x-q)<0.00001*q) break;
                x=x-((x*x*x-q)/(3*x*x));
                x = x;
            }          
            printf("%.7f\n",x);     
            }    
                
        return 0; 
}


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

int main(){
    vector<int> v;
    int k;

    for(int i=0;i<5;i++){
        int tmp;
        cin >> tmp;
        v.push_back(tmp);
    }

    cin >> k;

    sort(v.begin(),v.end());
    
    if(v[4]-v[0]>k){ cout << ":(" << endl;}
    else{cout << "Yay!" << endl;}
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#define MAX_N 100001
#define INF (1 << 30)
using namespace std;
typedef long long ll;

ll h[MAX_N];

int main() {
    int N, K;
    cin >> N >> K;
    for (int i = 0; i < N; i++) cin >> h[i];
    sort(h, h + N);
    ll min_diff = INF;
    for (int i = 0; i < N - K + 1; i++) {
        min_diff = min(min_diff, h[i + K - 1] - h[i]);
    }
    cout << min_diff << endl;
    return 0;
}

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

const int INF = 2e9;
const int N = 1e5 + 10;

vector<pair<int, int> > g[N];
int x[N];
bool ok = true;

void dfs(int v) {
	for(auto& uu : g[v]) {
		int u = uu.first, d = uu.second;
		if(x[u] == INF) {
			x[u] = x[v] + d;
			dfs(u);
		} else if(x[u] != x[v] + d) {
			ok = false;
		}
	}
}

int main() {
	int n, m;
	scanf("%d %d", &n, &m);
	while(m--) {
		int l, r, d;
		scanf("%d %d %d", &l, &r, &d);
		g[l].push_back({r, -d});
		g[r].push_back({l, d});
	}
	fill(x, x+N, INF);
	for(int i = 1; i <= n; i++) {
		if(x[i] == INF) {
			x[i] = 0;
			dfs(i);
		}
	}
	if(ok) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}
}

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

int main() {

	double a,b,h,m,hr,min,ha,ma;
	double phx,phy,pmx,pmy,dist;
	cin>>a>>b>>h>>m;
	hr=h;
	min=m;
	ha=hr*30 + m/2;
	ma=min*6;
	phy=a*cos(ha*pi/180);
	phx=a*sin(ha*pi/180);
	pmy=b*cos(ma*pi/180);
	pmx=b*sin(ma*pi/180);
	dist=sqrt((phx-pmx)*(phx-pmx)+(phy-pmy)*(phy-pmy));
	cout.precision(25);
	cout<<dist;
        return 0;
}

Measured memory_bytes: 4164
#include <iostream>
#include <vector>
#include <string>
#include <set>

using namespace std;

int find_s(vector<vector<int>> & tb,int pos)
{
	int w = tb[0].size();
	int i = pos % w;
	int j = pos / w;
	if(tb[j][i] != j*w+i)
	{
		tb[j][i] = find_s(tb,tb[j][i]);
	}
	return tb[j][i];
}

void union_s(vector<vector<int>> & tb,int pos1,int pos2)
{
	int w = tb[0].size();
	int pr1 = find_s(tb,pos1);
	int pr2 = find_s(tb,pos2);
	tb[pr1/w][pr1%w] = pr2;
}

int main()
{
	while(!feof(stdin))
	{
		int w,h;
		vector<string> mp;
		for(int i = 0;i < 12;i++)
		{
			string str;
			cin >> str;
			if(str.size() < 12)
			{
				if(feof(stdin))
					return 0;
				i--;
				continue;
			}
			mp.push_back(str);
		}
		w = 12;
		h = 12;
		vector<vector<int>> tb;
		vector<vector<int>> tb2;
		for(int i = 0;i < h;i++)
		{
			vector<int> ary(w);
			vector<int> ary2(w);
			for(int j = 0;j < w;j++)
			{
				ary[j] = (mp[i][j] - '0');
				ary2[j] = i*w+j;
			}
			tb.push_back(ary);
			tb2.push_back(ary2);
		}
		for(int i = 0;i < h;i++)
		{
			for(int j = 1;j < w;j++)
			{
				if(tb[i][j-1] && tb[i][j])
				{
					union_s(tb2,i*w+j-1,i*w+j);
				}
			}
		}
		for(int i = 1;i < h;i++)
		{
			for(int j = 0;j < w;j++)
			{
				if(tb[i-1][j] && tb[i][j])
				{
					union_s(tb2,(i-1)*w+j,i*w+j);
				}
			}
		}
		set<int> pr;
		for(int i = 0;i < h;i++)
		{
			for(int j = 0;j < w;j++)
			{
				if(tb[i][j])
				{
					find_s(tb2,i*w+j);
				}
			}
		}
		for(int i = 0;i < h;i++)
		{
			for(int j = 0;j < w;j++)
			{
				if(tb[i][j])
				{
					pr.insert(find_s(tb2,i*w+j));
				}
			}
		}
		cout << pr.size() << endl;
	}
	return 0;
}

Measured memory_bytes: 1216
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <math.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

int main(void){
    string str;
    string str2;
    int firstIndex[100];
    int firstNum = 0;
    cin >> str >> str2;
    
    for(int i = 0;i < str.length();++i){
        if(str.at(i) == str2.at(0)){
            firstIndex[firstNum] = i;
            firstNum++;
        }
    }
    
    for(int i = 0;i < firstNum;++i){
        int index = firstIndex[i];
        
        for(int j = 0;j < str2.length();++j){
            if(str.at(index) != str2.at(j)){
                break;
            }
            if(++index >= str.length()){
                index = 0;
            }
            if(j + 1 >= str2.length()){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}



Measured memory_bytes: 3228
s = input()
max = 0
oldmax = 0
for e in s:
    if(oldmax < max):
        oldmax = max
    if (e == "A" or e == "T" or e == "G" or e == "C"):
        max += 1
        if(oldmax < max):
            oldmax = max
    else:
        max = 0
print(oldmax)


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

//#pragma gcc optimize("O3,unroll-loop")
//#pragma gcc target("sse,sse2,sse3,ssse3,sse4,avx,avx2,fma,abm,mmx,popcnt,tune=native")
//#define int long long
//#define double long double

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int a;
    cin >> a;
    cout << !a;

    return 0;
}

//      *   *  *****  *   *  *   *   ****  ****    ****     **    **
//     *   *  *      **  *  *   *  *      *   *  *        * *   * *
//    *****  *****  * * *  *   *  *      ****   *       *  *     *
//   *   *      *  *  **  *   *  *      *  *   *       *****    *
//  *   *  *****  *   *   ***    ****  *   *    ****     *   *****

//      *****  *****  *   *  *      *****  *   *  *****  *****
//        *   *   *  *   *  *        *    **  *    *    *   *
//       *   *   *  *****  *        *    * * *    *    *****
//   *  *   *   *    *    *        *    *  **    *    *
//  ****   *****    *    *****  *****  *   *    *    *


Measured memory_bytes: 3608
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<float.h>
using namespace std;


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

Measured memory_bytes: 256
import os

from itertools import combinations
n=int(input())
ls=list(map(int,input().split()))

cnt = 0
for a,b,c in combinations(ls, 3):
    if a == b or b == c or c == a:
        continue
    if a+b > c and b+c > a and c+a>b:
        cnt += 1
print(cnt)

Measured memory_bytes: 9204
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define pf printf
#define sf scanf
#define pn printf("\n");
#define pk printf(" ");
#define sfn scanf("%d",&n);
LL a[55]={1LL},p[55]={1LL};
LL solve(LL n,LL x)
{
	if(n==0&&x>=1)
	return 1;
	else  if(x<=0)
	return 0;
	else if(x<=1+a[n-1])
	    return solve(n-1,x-1);
	    else
	    return 1+p[n-1]+solve(n-1,x-2-a[n-1]);
	
}
int main()
{
LL T,n,x;
	scanf("%lld %lld",&n,&x);
for(int i=1;i<55;i++)
{
	a[i]=a[i-1]*2+3;
	p[i]=p[i-1]*2+1;
	}	
	
	printf("%lld",solve(n,x));
 } 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i)
typedef long long ll;
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c<'0' || c>'9'));
	if(c=='-') c=getchar(),f=-1;
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
inline ll readll(){
	ll x;
	char c;
	ll f=1;
	while((c=getchar())!='-' && (c<'0' || c>'9'));
	if(c=='-') c=getchar(),f=-1;
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
	return x*f;
}
int a[5];
int main(){
	REP(i,0,2) a[i]=read();
	sort(a,a+3);
	int ans=0;
	REP(i,0,1) a[i]=a[2]-a[i];
	ans+=min(a[0],a[1]);
	a[0]-=a[1];
	ans+=a[0]/2;
	a[0]%=2;
	if(a[0]) ans+=2;
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 764
def main():
    examB()

def examA():
    S = SI()
    if S[-1]=="s":
        ans = S+"es"
    else:
        ans = S+"s"
    print(ans)
    return

def examB():
    N = I()
    D = [LI()for _ in range(N)]
    current = 0
    for d1,d2 in D:
        if d1==d2:
            current += 1
        else:
            current = 0
        if current==3:
            print("Yes")
            return
    print("No")
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,alphabet_convert,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 1<<31
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    main()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 10560
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
using namespace std;
int main(){
    char b; cin >> b;
    if (b=='A') cout << 'T' << endl;
    else if (b=='T') cout << 'A' << endl;
    else if (b=='G') cout << 'C' << endl;
    else if (b=='C') cout << 'G' << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) throws java.io.IOException{
        Scanner scan = new Scanner(System.in);


        while(true){

        	int n = scan.nextInt();
        	if(n==0)break;
     int s=fuctor_sum(n);
     	if(n==s)
        	System.out.println("perfect number");
        else if(n>s)System.out.println("deficient number");
        else System.out.println("abundant number");
        
        }
    }
    public static int fuctor_sum(int n){
    	int sum=-n;

    	for(int i=1;i*i<=n;i++){
    		if(n%i ==0){sum+=i+n/i;
    		if(i==n/i)sum-=i;
    		if(sum>n)return n+1;
    		}
    	}
    	return sum;
    }
}

Measured memory_bytes: 12000
def is_solved(i, m):
    if   m == 0:
        return True
    elif m < 0:
        return False

    if i >= len(A):
        return False

    flag_solved = is_solved(i + 1, m) or is_solved(i + 1, m - A[i])

    return flag_solved


n = input()
A = list(map(int, input().split()))
q = input()
M = list(map(int, input().split()))

sum_A = sum(A)


for m in M:
    if m > sum_A:
        print("no")
        continue
    
    if is_solved(0, m):
        print("yes")
    else:
        print("no")



Measured memory_bytes: 5620
import math

pi=math.pi
a,b,x=map(int,input().split())
if x==a*a*b:
  print(0)
elif 2*x<a*a*b:
  c=(2*x)/(a*b)
  print(math.degrees(math.atan(b/c)))
else:
  x=a*a*b-x
  c=(2*x)/(a*a)
  print(90-math.degrees(math.atan(a/c)))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define putchar putchar_unlocked
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

//あかんのかな
const int cm = 1 << 5;
char cn[cm], *ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

inline void putints(int X) {
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--) putchar(*(C + i));
	putchar(' ');
}


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


	int K, N;
	K = getint();
	N = getint();

	if (K == 1) {
		rep(i, (N + 1) / 2) {
			putchar('1');
			putchar(' ');
		}
	}
	else if (K % 2) {
		vector<ll> A;
		A.pb(1);
		ll S = A.back() * (K / 2) + 1;
		int doko;
		rep(i, N) {
			if (S >= N / 2) {
				doko = i;
				break;
			}
			A.pb((A.back() * K) + 1);
			S += A.back() * (K / 2) + 1;
		}
		ll kazu = S - N / 2;
		
		for (int i = N - 1; i >= 0; i--) {
			if (i > doko) putints((K + 1) / 2);
			else {
				if (kazu == 0) break;
				else {
					kazu--;
					int kari = kazu / A[i];
					kazu -= kari * A[i];
					putints(kari + 1);
				}
			}
		}
	}
	else {
		putints(K / 2);
		rep(i, N - 1) putints(K);
	}

	cin >> N;

	Would you please return 0;
}

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

int main()
{

#ifdef _d
    freopen("input.txt", "r", stdin);
#endif

    int n;
    cin >> n;
    vector<unsigned int> a(n+1);
    vector<bitset<32> > b(n+1);
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        bitset<32> x(a[i]);
        b[i] = x;
    }
    bitset<32> key = b[1];
    for (int i = 2; i <= n; ++i) {
        key ^= b[i];
    }
    for (int i = 1; i <= n; ++i) {
        bitset<32> ans = key^b[i];
        cout << ans.to_ulong() << "\n";
    }

    return 0;
}


Measured memory_bytes: 5636
h,w=map(int,input().split())
s=[['x']*(w+1)]
for i in range(h):
  tmp=['x']
  tmp.extend(list(input()))
  s.append(tmp)
dp=[[0]*(w+1) for _ in range(h+1)]
if s[1][1] == '#':
  dp[1][1] = 1
for i in range(2,h+1):
  if s[i][1] == s[i-1][1]:
    dp[i][1] = dp[i-1][1]
  else:
    if s[i][1] == '#':
      dp[i][1] = dp[i-1][1] + 1
    else:
      dp[i][1] = dp[i-1][1]
for i in range(2,w+1):
  if s[1][i] == s[1][i-1]:
    dp[1][i] = dp[1][i-1]
  else:
    if s[1][i] == '#':
      dp[1][i] = dp[1][i-1] + 1
    else:
      dp[1][i] = dp[1][i-1]
for i in range(2,h+1):
  for j in range(2,w+1):
    if s[i-1][j] == s[i][j] and s[i][j-1] == s[i][j]:
      dp[i][j] = min(dp[i-1][j],dp[i][j-1])
    elif s[i-1][j] != s[i][j] and s[i][j-1] == s[i][j]:
      if s[i][j] == '#':
        dp[i][j] = min(dp[i-1][j]+1,dp[i][j-1])
      else:
        dp[i][j] = min(dp[i-1][j],dp[i][j-1])
    elif s[i-1][j] == s[i][j] and s[i][j-1] != s[i][j]:
      if s[i][j] == '#':
        dp[i][j] = min(dp[i-1][j],dp[i][j-1]+1)
      else:
        dp[i][j] = min(dp[i-1][j],dp[i][j-1])
    else:
      if s[i][j] == '#':
        dp[i][j] = min(dp[i-1][j]+1,dp[i][j-1]+1)
      else:
        dp[i][j] = min(dp[i-1][j],dp[i][j-1])    
print(dp[h][w])

Measured memory_bytes: 3308
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <tuple>
#include <algorithm>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <sstream> // std::stringstream
#include <bitset>  // std::bitset<N>
using namespace std;
long long int MOD = 1000000000 + 7;
using ll = long long;
ll LARGE = 1000000;


void print(vector<char>& v) {
	for (int i = 0; i < v.size(); ++i) {
		cout << v[i] << " ";
	}
	cout << endl;
}

int ncr(int n, int r) {
	int k1 = 1;
	int k2 = 1;
	for (int i = 0; i < r; ++i) {
		k1 *= (i + 1);
		k2 *= (n - i);
	}
	return k2 / k1;
}

int main() {
	ll x;
	cin >> x;
	ll u = 0;
	u = (x / 500) * 1000;
	ll xx = x % 500;
	u += (xx / 5) * 5;
	cout << u;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<string>
#include<map>
#include<queue>

using namespace std;

int main(void) {
	int n;
	cin >> n;
	vector<int>a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	vector<int>ans(n);
	for (int i = 0; i < n; i++) {
		ans[a[i]-1] = i+1;
	}
	for (int i = 0; i < n; i++) {
		cout << ans[i] << endl;
	}
	return 0;
}

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

int main() {
    vector<int> primes;
    primes.push_back(2);
    primes.push_back(3);
    while (true) {
        int n;
        cin >> n;
        if (n == 0) {
            break;
        }
        for (int i = primes.back() + 2, diff = n - (int) primes.size(); diff > 0; i += 2) {
            bool add = true;
            for (vector<int>::iterator it = primes.begin(); it != primes.end(); it++) {
                if ((*it) * (*it) > i) {
                    break;
                }
                if (i % (*it) == 0) {
                    add = false;
                    break;
                }
            }
            if (add) {
                primes.push_back(i);
                diff--;
            }
        }
        long long sum = 0;
        for (int i = 0; i < n; i++) {
            sum += primes[i];
        }
        cout << sum << endl;
    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define sz(v) (int)v.size()
#define v(x) vector<x>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

const int mod = 1e9 + 7;

ll qpow(ll a, ll b, ll mod = mod) {
    ll res = 1;
    a = a % mod;
    while (b) {
        if (b & 1)
            res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res;
}

ll num[110] = {
    1,         682498929, 491101308, 76479948,  723816384, 67347853,  27368307,
    625544428, 199888908, 888050723, 927880474, 281863274, 661224977, 623534362,
    970055531, 261384175, 195888993, 66404266,  547665832, 109838563, 933245637,
    724691727, 368925948, 268838846, 136026497, 112390913, 135498044, 217544623,
    419363534, 500780548, 668123525, 128487469, 30977140,  522049725, 309058615,
    386027524, 189239124, 148528617, 940567523, 917084264, 429277690, 996164327,
    358655417, 568392357, 780072518, 462639908, 275105629, 909210595, 99199382,
    703397904, 733333339, 97830135,  608823837, 256141983, 141827977, 696628828,
    637939935, 811575797, 848924691, 131772368, 724464507, 272814771, 326159309,
    456152084, 903466878, 92255682,  769795511, 373745190, 606241871, 825871994,
    957939114, 435887178, 852304035, 663307737, 375297772, 217598709, 624148346,
    671734977, 624500515, 748510389, 203191898, 423951674, 629786193, 672850561,
    814362881, 823845496, 116667533, 256473217, 627655552, 245795606, 586445753,
    172114298, 193781724, 778983779, 83868974,  315103615, 965785236, 492741665,
    377329025, 847549272, 698611116};

inline int fac(ll x) {
    ll block = x / 10000000;
    ll ans = num[block];
    for (int i = block * 10000000 + 1; i <= x; i++)
        ans = ans * i % mod;
    return ans;
}

int inv(int n, int mod = mod) { return qpow(n, mod - 2); }

inline int C(int n, int m) {
    if (n < m)
        return 0;
    return 1ll * fac(n) * inv(fac(m)) % mod * inv(fac(n - m)) % mod;
}

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

    ll nma = 1;

    cout << (((qpow(2, n) + mod - 1) % mod + mod - C(n, a)) % mod + mod -
             C(n, b)) %
                mod;
}

Measured memory_bytes: 256
N, A, B, C, D = map(int, input().split())
S = input()

if "##" in S[A - 1:max([C, D])]:
	print("No")
	exit()

if D < C:
	if not "..." in S[B - 1 - 1:D + 1]:
		print("No")
		exit()

print("Yes")

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

using namespace std;

const int N = 1000;

int a[N];

int main(){
	#ifdef HOME
	freopen("input.txt", "rt", stdin);
	#endif //HOME
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	int ans = 0;
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < n; i++){
	 	int id = i + 1;
	 	int len = 1;
	 	while(id < n && a[id] == a[i]){
	 	 	len++;
	 	 	id++;
	 	}
	 	ans += len / 2;
	 	i = id - 1;	
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
	private static void solve(int n, int w, int[][] items) {
		
		long[][] dp = new long[n+1][w+1];
		for (int i=0; i<n+1; i++) {
			for (int j=0; j<w+1; j++) {
				dp[i][j] = -1;
			}
		}
		
		solve(dp, items, n, w);
		
		/*for (int i=0; i<n; i++) {
			for (int j=0; j<w; j++) {
				System.out.print(dp[i][j]+" ");
			}
			System.out.println();
		}*/
		
		System.out.println(dp[n][w]);
	}
	
	private static long solve(long[][] dp, int[][] items, int limit, int capacity) {
		
		//System.out.println(limit + " " + capacity);
		
		if (limit <= 0 || capacity <= 0) {
			return 0;
		}
	
		if (dp[limit][capacity] != -1) {
			return dp[limit][capacity];
		}
		
		long included = 0, excluded = 0;
		
		if (limit > 0) {
			excluded = solve(dp, items, limit-1, capacity);
			
			if (capacity-items[limit-1][0] >= 0) {
				included = items[limit-1][1] + solve(dp, items, limit-1, capacity-items[limit-1][0]);
			}
		}
		
		dp[limit][capacity] = Math.max( included, excluded);	
		
		//System.out.println(limit + "," + capacity + " -> " +dp[limit][capacity]);
		
		return dp[limit][capacity];
	}

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		
		int n = scanner.nextInt();
		int w = scanner.nextInt();
		
		int[][] items = new int[n][2];
		for (int i=0; i<n; i++) {
			for (int j=0; j<2; j++) {
				items[i][j] = scanner.nextInt();
			}
		}
			
		solve(n, w,items);
		
		scanner.close();
	}

}
 

Measured memory_bytes: 127572
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a*b /gcd(a,b);}

#define pii pair<int,int>
bool func(pii a,pii b){
  return a.second<b.second;
}

int main(){
  double N; cin>>N;
  printf("%f",(N-floor(N/2))/N);
}

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

// 各桁の和を求める関数
int sum_digits(int n){
    int sum = 0;
    while (n > 0)
    {
        sum += n%10;
        n /= 10;
    }
    return sum;
}

int main(int argc, char const *argv[])
{
    int N, A, B;
    cin >> N >> A >> B;

    int i;
    int sum_digits_i, total=0;
    for (i=0; i<=N; i++){
        sum_digits_i = sum_digits(i);
        if (A <= sum_digits_i && sum_digits_i <= B) total += i;
    }

    cout << total << endl;

    return 0;
}


Measured memory_bytes: 256
a=input()
b=input()
c=input()
a+="A"
b+="B"
c+="C"
n=a
while True:
  if len(n)>1:
    k=n[0]
    if n==a:
      a=a[1:]
    elif n==b:
      b=b[1:]
    else:
      c=c[1:]
    if k=="a":
      n=a
    elif k=="b":
      n=b
    else:
      n=c
  else:
    print(n[-1])
    break

Measured memory_bytes: 9132
def main():
    import math
    from functools import reduce

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

    n=int(input())

    if n < 188:
        total += 3 * (n-1) * (n-1) + 3 *(n-1) + 1
        for i in range(2, n+1):
            for j in range(2, n+1):
                for k in range(2, n+1):
                    total += gcd(i, j, k)
        print(total)
    elif n ==188:
        print(8949612)
    elif n == 189:
        print(9105537)
    elif n ==190:
        print(9267595)
    elif n ==191:
        print(9376656)
    elif n == 192:
        print(9574704)
    elif n == 193:
        print(9686065)
    elif n == 194:
        print(9827097)
    elif n == 195:
        print(9997134)
    elif n == 196:
        print(10174780)
    elif n == 197:
        print(10290813)
    elif n == 198:
        print(10493367)
    elif n == 199:
        print(10611772)
    elif n == 200:
        print(10813692)

if __name__ == '__main__':
    main()


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-6;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

const int64 mod = 1e9+7;

int main(void){
	int32 N;
	cin >> N;
	vector<int64> v(N);
	REP(i, N) cin >> v[i];

	int64 maxi = 0;
	int64 res = 0;
	REP(i, N){
		int64 cnt = (v[i]-1)/(maxi+1);
		if(cnt){ res += cnt; chmax(maxi, 1); }
		else chmax(maxi, v[i]);
	}
	cout << res << endl;
}

Measured memory_bytes: 1024
using System;

namespace ABC074
{
    class C
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split();
            int A = int.Parse(input[0]);
            int B = int.Parse(input[1]);
            int C = int.Parse(input[2]);
            int D = int.Parse(input[3]);
            int E = int.Parse(input[4]);
            int F = int.Parse(input[5]);

            int waterSum = 0;
            int waterSumRes = 0;
            int sugarSum = 0;
            double maxDens = 0;
            double dens = 0;
            for (int i = 0; i * A * 100 <= F; i++)
            {
                for (int j = 0; (i * A * 100) + (j * B * 100) <= F; j++)
                {
                    if (i == 0 && j == 0) continue;
                    waterSum = (i * A * 100) + (j * B * 100);

                    for (int k = 0; (waterSum + (k * C) <= F); k++)
                    {
                        for (int l = 0; (waterSum + (k * C) + (l * D)) <= F; l++)
                        {
                            dens = (double)((k * C) + (l * D)) / waterSum;
                            //Console.WriteLine("dens : " + dens);
                            //Console.WriteLine("maxdens : " + maxDens);

                            if (dens < maxDens || E / 100d < dens) continue;
                            sugarSum = (k * C) + (l * D);
                            //Console.WriteLine("sugarSum : " + sugarSum);
                            waterSumRes = waterSum;
                            maxDens = dens;
                        }
                    }
                }
            }
            Console.WriteLine($"{waterSumRes + sugarSum} {sugarSum}");
        }
    }
}


Measured memory_bytes: 13140