akhauriyash/Code-Regression huggingface dataset:
def dfs(c, l, d):
    if c == r:
        if ans[0] > d: ans[0] = d
        return
    for i in range(r):
        if seen[i]: continue
        seen[i] = True
        if l == -1:
            dfs(c + 1, R[i], 0)
        else:
            dfs(c + 1, R[i], d + dp[l][R[i]])
        seen[i] = False

n, m, r = map(int, input().split())
R = [i - 1 for i in map(int, input().split())]
dp = [[float("Inf") if i != j else 0 for i in range(n)] for j in range(n)]
for i in range(m):
    x, y, z = map(int, input().split())
    dp[x - 1][y - 1] = z
    dp[y - 1][x - 1] = z
for k in range(n):
    for i in range(n):
        for j in range(n):
            if dp[i][j] > dp[i][k] + dp[k][j]:
                dp[i][j] = dp[i][k] + dp[k][j]
seen = [False] * r
ans = [float("Inf")]
dfs(0, -1, 0)
print(*ans)

Measured memory_bytes: 57048
N, K = map(int, input().split())
X = list(map(int, input().split()))

ans = 10**18
for i in range(N - K + 1):
    x1 = X[i]
    x2 = X[i + K - 1]
    if x1 * x2 >= 0:
        dist = max(abs(x1), abs(x2))
    else:
        dist = min(abs(x1), abs(x2)) + abs(x1 - x2)
    ans = min(ans, dist)
print(ans)


Measured memory_bytes: 14224
#define M 300001
a[M],i;main(n,q,x){
for(scanf("%d%d",&n,&q);i<n;i++)scanf("%d",&x),a[x]=x;
for(i=1;i<M;i++)if(!a[i])a[i]=a[i-1];
for(;q--;printf("%d\n",n))for(n=0,scanf("%d",&x),i=x;i<=M;i+=x)if(n<a[i-1]%x)n=a[i-1]%x;
exit(0);}

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

int main(){
	// sengen
	string t;
	// nyuryoku
	cin >> t;
	// keisan
	int iter = 0;
	int max = 0,kari = 0,kit;
	int n = t.size();
	for(int i=0;i<n;i++){
		if(t[i] == 'D' || t[i] == '?'){
			if(kari == 0){
				kari++;
				kit = i;
			}else{
				kari++;
			}
		}else{
			if(kari != 0){
				if(kari > max){
					max = kari;
					iter = kit;
					kari = 0;
				}
			}
		}
	}
	for(int i=iter;i<iter+max;i++){
		if(t[i] == '?'){
			t[i] = 'D';
		}
	}
	for(int i=0;i<n;i++){
		if(t[i] == '?'){
			if(i-1 > -1 && t[i-1] == 'P'){
				t[i] = 'D';
			}else if(i+1 < n && t[i+1] == 'D'){
				t[i] = 'D';
			}else{
				t[i] = 'D';
			}
		}
	}
	// syutsuryoku
	cout << t;
}

Measured memory_bytes: 3752
#include <stdio.h>

int main()
{
    long n, i, x;

    scanf("%ld",&n);
    long arr[n];

    for(i=0;i<n;i++)
    {
        arr[i]=0;
    }

    for(i=0;i<n-1;i++)
    {
        scanf("%ld",&x);
        arr[x-1]++;
    }

    for(i=0;i<n;i++)
    {
        printf("%ld\n",arr[i]);
    }
    return 0;

}


Measured memory_bytes: 3284
// ABC_054_A
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

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

	if(a == 1 && b != 1) cout << "Alice" << "\n";
	else if(a != 1 && b == 1) cout << "Bob" << "\n";
	else if(a > b) cout << "Alice" << "\n";
	else if(a < b) cout << "Bob" << "\n";
	else cout << "Draw" << "\n";

	return 0;
}

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

int main(){
  string w; cin >> w;
  map<char, int> alp;
  
  int n = w.size();
  for(int i = 0; i < n; i++){
    alp[w[i]]++;
  }
  
  bool clr = true;
  for(auto e: alp){
    if(e.second %2 == 1) clr = false;
  }
  cout << (clr?"Yes":"No") << endl;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()

#define cMOD 1000000007ULL
#define cINF ((1ull<<62)-1)
#define cINFINT ((1<<30)-1)


int main()
{
	ll n,k;cin>>n>>k;
	ll a=n-k;
	if(k==1) cout << 0 << endl;
	else cout << a << endl;
	return 0;
}

Measured memory_bytes: 256
using System;

class C
{
    public static void Main()
    {
        long s = long.Parse(Console.ReadLine()) -1;
        var C = new C();
        string i = C.GetColumnName(s).ToLower();
        Console.WriteLine(i);
    }
    public string GetColumnName(long index)
    {
        string str = "";
        do
        {
            str = Convert.ToChar(index % 26 + 0x41) + str;
        } while ((index = index / 26 - 1) != -1);

        return str;
    }
}



Measured memory_bytes: 17724
N,M = map(int,input().split())  #N個の展望台,M本の道

H_list = [int(x) for x in input().split()]

answer_list = [0 for _ in range(N)]

for i in range(M):
    B = [int(x) for x in input().split()]
    #print(B)
    
    if H_list[B[0]-1] < H_list[B[1]-1]:
        answer_list[B[0]-1] += 1
    elif H_list[B[0]-1] > H_list[B[1]-1]:
        answer_list[B[1]-1] += 1
    else:
        answer_list[B[0]-1] += 1
        answer_list[B[1]-1] += 1

    
cnt = 0
for j in range(N):
    if answer_list[j] == 0 :
        cnt += 1
    
print(cnt)

Measured memory_bytes: 20144
//marico el que lo lea
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <stdlib.h>
#include <assert.h>
using namespace std;

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

void fastIO() {
	std::ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
}

#define FOR(i,f,t) for(int i=f; i<(int)t; i++)
#define FORR(i,f,t) for(int i=f; i>(int)t; i--)
#define FORE(i,c) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define all(obj) obj.begin(), obj.end()
#define ms(obj, val) memset(obj, val, sizeof(obj))
#define ms2(obj, val, sz) memset(obj, val, sizeof(obj[0])*sz)

#define fst first
#define snd second

template<typename T, typename U> inline void mnze(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void mxze(T &x, U y) { if(x < y) x = y; }

void _scan( int &x ) { scanf("%d",&x); }
void _scan( long long &x ) { scanf("%lld",&x); }
void _scan( double &x ) { scanf("%lf",&x); }
void _scan( char &x ) { scanf(" %c",&x); }
void _scan( char *x ) { scanf("%s",x); }
void scan() {}
template<typename T, typename... U>
void scan( T& head, U&... tail ) { _scan(head); scan(tail...);}

template<typename T> void _dbg(const char* sdbg, T h) { cerr<<sdbg<<"="<<h<<"\n"; }
template<typename T, typename... U> void _dbg(const char* sdbg, T h, U... t) {
	while(*sdbg != ',')cerr<<*sdbg++; cerr<<"="<<h<<","; _dbg(sdbg+1, t...);
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr <<#x <<" = "; FORE(_i, (x)) cerr <<*_i <<", "; cerr <<"\n"; }}
#define debuga(x, sz) {{cerr <<#x <<" = "; FOR(_i, 0, sz) cerr << x[_i] <<", "; cerr <<"\n"; }}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define debuga(x, sz)
#define cerr if(0)cout
#endif

///////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////

const int MAXN = 1e5+5;

int N, a[MAXN];

int main(){
	scan(N);
	FOR(i,1,N+1) scan(a[i]);
	int ans = 0;
	FOR(i,1,N) if(a[i]==i) swap(a[i], a[i+1]), ans++;
	if(a[N] == N) ans++;
	printf("%d\n", ans);
}

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

#define rep(i,n) for (int i = 0; i< (n); ++i)
#define vvec(m,n) vector<vector<int>> (int(m), vector<int>(n))
#define ALL(a) (a).begin(), (a).end()

using ll = long long;

int main(){
    int h, n;
    cin >> h >> n;
    int sum = 0;
    int a;
    rep(i,n){
        cin >> a;
        sum += a;
    }
    cout << (sum >= h ? "Yes":"No") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int min(int a,int b){
    if(a < b)return a;
    else return b;
}

int main(void){
    long res = 1;
    int n,flag=1,sc,sp;
    vector<int> a;
    cin >> n;
    sc = n;
    for(int i=0;i<n;i++){
        int k;
        cin >> k;
        a.push_back(k);
    }
    sort(a.begin(),a.end());
    sp = !(n%2);
    for(int i=0;i<n;i++){
        if(a[i] != sp){
            flag = 0;
            break;
        }
        sc--;
        if(sc%2==0)sp+=2;
    }
    if(!flag)cout << 0 << endl;
    else{
        for(int i=0;i<n/2;i++){
            res = (res * 2) % 1000000007;
        }
        cout << res << endl;
    }
}

Measured memory_bytes: 892
#include<stdio.h>
int main(void)
{
    int a[3],sum1,sum2,max=0,i,b,j=1;
    for(i=0;i<3;i++) scanf("%d",&a[i]);
    while(j<=3)
    {
        sum1=a[0]+(a[1]*10)+a[2];
        if(sum1>max) max=sum1;
        sum2=a[0]+(a[2]*10)+a[1];
        if(sum2>max) max=sum2;
        b=a[0];
        a[0]=a[1];
        a[1]=a[2];
        a[2]=b;
        j++;
    }
    printf("%d",max);
    return 0;
}


Measured memory_bytes: 128
/*
	每次把最多的那个鸽了
	统计一遍答案
*/
#include <iostream>
#include <cstring>
#include <cstdio>
#define N 305

using namespace std;

int n, m;
int a[N][N];
int cnt[N], isAbo[N];

inline void read(int &x) {
	x = 0; char ch = getchar();
	while(!isdigit(ch)) ch = getchar();
	while(isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
}

int main() {
	read(n), read(m);
	for(int i = 1; i <= n; ++i)
		for(int j = 1; j <= m; ++j)
			read(a[i][j]);
	int ans = n, res, p;
	for(int o = 1; o < m; ++o) {
		memset(cnt, 0, sizeof cnt);
		for(int i = 1; i <= n; ++i) {
			for(int j = 1; j <= m; ++j) {
				if(!isAbo[a[i][j]]) {
					++cnt[a[i][j]];
					break;
				}
			}
		}
		res = p = 0;
		for(int i = 1; i <= m; ++i)
			if(cnt[i] > res) {
				res = cnt[i], p = i;
			}
		if(res < ans) ans = res;
		isAbo[p] = true;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 640
N = int(input())
w = list(map(int, input().split()))

w_acc = [0]

for i in range(N):
    w_acc.append(w_acc[i] + w[i])

ans = w_acc[N]
    
    
for j in w_acc:
    if abs(w_acc[N] - 2 * j) < ans:
        ans = abs(w_acc[N] - 2 * j)
print(ans)


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

int main(){
    long A, B, C, K;
    cin >> A >> B >> C >> K;
    if(K <= A) cout << K << endl;
    else if(K <= A + B) cout << A << endl;
    else cout << A - (K - A - B) << endl;
    return 0;
}


Measured memory_bytes: 3624
/*input
125
*/

#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <math.h>
#include <iomanip>
#include <utility>
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <algorithm>

using namespace std;
using ll = long long;
using ld = long double;

ll MOD = 1000000007;
const int SINF = 1000000009;
const ll INF =  1000000000000000018;

#define sp          cout << " "
#define nl          cout << "\n"
#define inv(a)      powr((a), (MOD - 2))
#define all(c)      (c).begin(),(c).end()
#define rep(i,a,b)  for(ll i = (a); i < (b); i ++)
#define prec(n)     cout << fixed << setprecision(n)
#define PI          3.14159265358979323846264338327951
#define ifalse      ios_base::sync_with_stdio(false), cin.tie(NULL)

template<typename T> void toInt(string s, T &a) { istringstream(s) >> a; }
ll gcd(ll a, ll b) { ll t; while(a) { t = a; a = b%a; b = t; } return b; }
ll sub(ll a, ll b) { a -= b; a = (a + MOD) % MOD; return a; }
ll mul(ll a, ll b) { return ((a % MOD) * (b % MOD)) % MOD; }
ll add(ll a, ll b) { a += b; a %= MOD; return a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }

ll powr(ll a, ll b) {
  ll x = 1LL;
  while(b) {
    if(b & 1) x = mul(x, a);
    a = mul(a, a), b >>= 1;
  }
  return x;
}

bool check(ll n)
{
  if(n == 1) return 0;
  if(n == 2 or n == 3) return 1;
  if(n%2 == 0 or n%3 == 0) return 0;
  for(ll i = 5; i*i <= n; i += 6) if(n%i == 0 or n % (i+2) == 0) return 0;
  return 1;
}

/*********************************START**********************************/
const int N = 100005;

int main()
{
  ifalse;
  ll n;
  cin >> n;
  ll ans = 0;
  for(ll i = 1; i * i <= n; i ++) {
    if(n % i == 0) {
      if(i > 1 and n / (i - 1)  == (n % (i - 1))) {
        ans += (i - 1);
      }
      if(n / i != i) {
        ll a = n / i;
        if(n / (a - 1)  == (n % (a - 1))) {
          ans += (a - 1);
        } 
      }
    }
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from copy import deepcopy
from math import factorial, ceil, floor, gamma, log
from operator import mul
from functools import reduce



sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


n, m = LI()
A = LI()

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd(a, b)

for i in range(n):
    A[i] //= 2
    if i == 0:
        ret = A[i]
        c0 = 0
        a0 = A[0]
        while a0 % 2 == 0:
            a0 //= 2
            c0 += 1
    else:
        ret = lcm(ret, A[i])
        if ret > m:
            print(0)
            exit()
        c = 0
        while A[i] % 2 == 0:
            A[i] //= 2
            c += 1
        if c != c0:
            print(0)
            exit()


print((m // ret + 1) // 2)

Measured memory_bytes: 13736
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include<cstdio>
#include <vector>
#include<queue>
#include<limits.h>
#include<string.h>
#include<functional>
#include<map>
#include<set>
#include<list>
using namespace std;

signed main() {
	int a; cin >> a;
	int sum = 0;
	for (int i = 0; i < a; i++) {
		int b; cin >> b;
		for (int c = 2; c*c <= b; c++) {
			if (b%c == 0) { sum--; break; }
		}
		sum++;
	}
	cout << sum << endl;
}

Measured memory_bytes: 3080
#include<stdio.h>

int main(void){

int W,H,x,y,r;
scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
if( (x+r) <= W && (x-r) >= 0 && (y+r) <= H && (y-r) >= 0 ){
printf("Yes\n");
} else {
printf("No\n");
}

return 0;
}

Measured memory_bytes: 584
//2020-04-12 17:29:15
//#pragma GCC optimize("-Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
//#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
//#pragma GCC target("avx2")  //Enable AVX
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//order_of_key(x) : number of items less than x
//find_by_order(x) : iterator to x

#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(ll i=a;i<b;i++)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define fastio              ios_base::sync_with_stdio(false);cin.tie(NULL)
#define F                   first
#define S                   second
#define all(v)              (v).begin(),(v).end()

const ld pi=3.14159265359;
ll INF=1e18+10;
ll MOD=998244353;
ll mod=1e9+7;

inline ll add(ll a,ll b,ll m){
    if((a+b)>=m)return (a+b)%m;
    return a+b;
}

inline ll mul(ll a,ll b,ll m){
    if((a*b)<m)return a*b;
    return (a*b)%m;
}

ll expo(ll a,ll b,ll m){
    if(b<0)return expo(expo(a,m-2,m),-b,m);
    ll res=1;
    while(b>0){
        if(b&1)res=mul(res,a,m);
        a=mul(a,a,m);
        b=b/2;
    }
    return res;
}

int main()
{
    ll n,k;cin>>n>>k;
    ll dp[k+1];mem(dp,0);
    for(int i=k;i>=1;i--){
        dp[i]=expo((k/i),n,mod);
        for(int j=2;i*j<=k;j++)
            dp[i]=(dp[i]-dp[i*j]+mod)%mod;
    }
    ll ans=0;
    rep(i,1,k+1)
    ans=(ans+mul(dp[i],i,mod))%mod;
    cout<<ans;
}

Measured memory_bytes: 4420
let num, patty = begin
  let num = Array.make 51 1 in
  let patty = Array.make 51 1 in
  for i = 1 to 50 do
    num.(i) <- 2 * num.(i-1) + 3;
    patty.(i) <- 2 * patty.(i-1) + 1
  done;
  num, patty
end

let rec eat n x =
  if x = 0 then 0 else if n = 0 then 1
  else if x >= num.(n) - 1 then patty.(n)
  else if x >= 2 + num.(n-1) then
    patty.(n-1) + 1 + eat (n-1) (x - 2 - num.(n-1)) 
  else
    eat (n-1) (x-1)

let () =
  Scanf.scanf "%d %d" eat |> Printf.printf "%d\n"




Measured memory_bytes: 2432
#include<stdio.h>
#include<string.h>
int main(void){
    int A,B,C,D,E,x,y,cou=0,v[3];
    char S[3],s[3],X,Y;
    scanf("%d %d",&A,&B);
    if(A+B<10){
        printf("%d",A+B);
    }else{
        printf("error");
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int p[n];
	for(int i=0;i<n;i++)
	{
		cin>>p[i];
	}
	int c=INT_MAX;
	int count = 0;
	for(int i=0;i<n;i++)
	{
		if(p[i]<=c)
		{
		c = p[i];
		count++;
	    }
	}
	cout<<count;
	return 0;
}

Measured memory_bytes: 1024
program main
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int64):: n,i,maxdiff=1_int64
    integer(int64), allocatable:: p(:),pre(:)
    logical,allocatable:: see(:)

    read*, n
    allocate(p(n))
    allocate(pre(n), source=[(i,i=1_int64,n)])
    allocate(see(0_int64:n), source=.false.)
    read*, (p(i), i=1_int64,n)
    
    do i=1_int64,n
        see(p(i)) = .true.
        if (.not. see(p(i)-1_int64)) cycle
        pre(p(i)) = pre(p(i)-1_int64)
        maxdiff = max(maxdiff,p(i)-pre(p(i))+1_int64)
    end do

    print'(i0)', n-maxdiff
end program main

Measured memory_bytes: 7324
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x*x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	int n; cin >> n;

	int cnt = 0;
	for (int i = 0; i < n; i++) {
		int buf; cin >> buf;

		if (buf % 2 == 1) {
			cnt++;
		}
	}

	if (cnt % 2 == 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	
	return 0;
}



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

/* using */
using namespace std;

/* main constructor */
struct Fast
{
    Fast()
    {
        std::cin.tie(0);
        ios::sync_with_stdio(0);
        //cout << fixed << setprecision(12);
    }
} fast;

/* template */
template <class T>
bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0; }
template <class T>
bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0; }

/* define */
#define REP(i, x, n) for (int i = x; i < (int)(n); ++i)
#define RREP(i, x, n) for (int i = x - 1; i >= (int)(n); --i)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) REP(i, 1, n + 1)
#define rrep(i, n) RREP(i, n, 0)
#define each(i, n) for (auto &i : n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define eunique(x) \
    sort(all(x));  \
    (x).erase(unique(all(x)), (x).end())
#define int long long
#define mp make_pair
#define r0 return 0

/* function */
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }

/* const */
const int inf = 1e9 + 7;
const int dxl[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dyl[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dxs[4] = {1, 0, -1, 0};
const int dys[4] = {0, 1, 0, -1};

/* main */
signed main(void)
{
    int n;
    string s;
    int cntr = 0;
    int cntb = 0;
    cin >> n >> s;
    rep(i, n)
    {
        if (s[i] == 'R')
        {
            cntr++;
        }
        else
        {
            cntb++;
        }
    }
    if (cntr > cntb)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


def MI(): return map(int, input().split())


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


def main():
    N = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
         1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

    K = I()
    print(N[K-1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 38640
import sys
import bisect
read = sys.stdin.read
readline = sys.stdin.readline

def main2():
    N,M,*PY = map(int, read().split())
    PY_input = []
    PY_dict = {}
    for p, y in zip(*[iter(PY)]*2):
        PY_input.append((p, y))
        PY_dict.setdefault(p, []).append(y)

    for i in PY_dict.values():
        i.sort()

    for p, y in PY_input:
        print("{:06}{:06}".format(p, bisect.bisect_right(PY_dict[p], y)))


if __name__ == "__main__":
    main2()

Measured memory_bytes: 36952
#include <iostream>
#include <algorithm>
using namespace std;
int k,x;
int main()
{
  cin >> k >> x;
  int l = x-k+1;
  int u = x+k-1;
  for(int i=l;i<=u;++i){
    cout << i << " ";
  }
  cout  << "\n";
  return 0;
}


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


int main() {
	
	int W, H, N;
	cin >> W >> H >> N;
	vector<int> x(N), y(N), a(N);
	vector<vector<int>> s(H, vector<int>(W,0));
	for (int i=0; i<N; i++) cin >> x.at(i) >> y.at(i) >> a.at(i);
	
	for (int i=0; i<N; i++){
		
		if (a.at(i) == 1){
			for (int j=0; j<H; j++){
				for (int k=0; k<x.at(i); k++){
					s.at(j).at(k) = 1;
				}
			}
		}
		
		else if (a.at(i) == 2){
			for (int j=0; j<H; j++){
				for (int k=x.at(i); k<W; k++){
					s.at(j).at(k) = 1;
				}
			}
		}
		
		else if (a.at(i) == 3){
			for (int j=0; j<y.at(i); j++){
				for (int k=0; k<W; k++){
					s.at(j).at(k) = 1;
				}
			}
		}
		
		else if (a.at(i) == 4){
			for (int j=y.at(i); j<H; j++){
				for (int k=0; k<W; k++){
					s.at(j).at(k) = 1;
					
				}
			}
		}
		
	}
	int sum = 0;
	for (int i=0; i<H; i++){
		sum += count(s.at(i).begin(), s.at(i).end(), 0);
	}
	cout << sum << endl;
	
	return 0;
}

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

using namespace std;

int main() {
	int n, l; 
	cin >> n >> l;
	vector<string> v(n);
	for(int i = 0; i < n; ++i)
		cin >> v[i];
	sort(v.begin(), v.end());
	for(int i = 0; i < n; ++i)
		cout << v[i];
		
	return 0;
}


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

using namespace std;

typedef long long LL;

int n;
LL a[100005],b[100005],c[100005],ans;

int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;++i) scanf("%lld",&a[i]);
	for (int i=2;i<=n;++i) b[i]=abs(a[i]-a[i-1]);
	c[1]=0;
	for (int i=2;i<=n;++i) c[i]=c[i-1]+b[i];
	ans=c[n]-c[2]+abs(a[2])+abs(a[n]);
	printf("%lld\n",ans);
	for (int i=2;i<n;++i)
	{
		ans=abs(a[1])+c[i-1]+abs(a[i-1]-a[i+1])+c[n]-c[i+1]+abs(a[n]);
		printf("%lld\n",ans);
	}
	ans=c[n-1]+abs(a[1])+abs(a[n-1]);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 3584
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
import math
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
from collections import deque
inf = 10 ** 18
mod = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
tmp = 1
for i in a:
    if i == 0:
        print(0)
        sys.exit()
for i in a:
    if i > inf:
        print(-1)
        sys.exit()
    tmp = tmp*i
    if tmp > inf:
        print(-1)
        sys.exit()
print(tmp)

Measured memory_bytes: 84384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

const ll mod = 1e9+7;

// void chmod(ll &M){
//     if(M >= mod) M %= mod;
//     else if(M < 0){
//         M += (abs(M)/mod + 1)*mod;
//         M %= mod;
//     }
// }

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

    set<string> se;

    for(int len=1; len<=min(K, (int)s.size()); ++len){
        for(int i=0; i<s.size()-len+1; ++i){
            se.insert(s.substr(i, len));
        }
    }

    int id = 1;
    for(auto itr=se.begin(); itr!=se.end(); ++itr){
        if(id == K){
            cout << *itr << endl;
            return 0;
        }
        ++id;
    }
}

Measured memory_bytes: 1664
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int g[650][650];
void initial(int n,int m){
    for(int i=0; i<n; i++)
        for(int j=0; j<m; j++)
            g[i][j] = 1;
    for(int i=n; i<650; i++)
        for(int j=0; j<650; j++)
            g[i][j] = 0;
    for(int i=0; i<n; i++)
        for(int j=m; j<650; j++)
            g[i][j] = 0;
}

void  pf(int w1,int wid,int w2,int hig){
    for(int i=w2+hig-1; i>=w2; i--){
        for(int j=w1; j<w1+wid; j++){
            printf("%d ",g[i][j]);
        }
        printf("\n");
    }
}

void opt(int d,int c,int& wid,int& hig,int& w1,int& w2){
    if(d==1){
        for(int j=0; j<c; j++){
            for(int i=w2; i<w2+hig; i++){
                int f = g[i][w1+j] + g[i][2*c-1-j+w1];
                g[i][w1+j] = f;
                g[i][2*c-1-j+w1] = f;
            }
        }
        w1+=c;
        wid = max(c,wid-c);
    }
    else if(d==2){
        for(int i=0; i<c; i++){
            for(int j=w1; j<w1+wid; j++){
                int f = g[w2+i][j] + g[2*c-1-i+w2][j];
                g[w2+i][j] = f;
                g[2*c-1-i+w2][j] = f;
            }
        }
        w2+=c;
        hig = max(c,hig-c);
    }
    // pf(w1,wid,w2,hig);
}

int main(){
    int n,m,t,p;
    while(scanf("%d%d%d%d",&m,&n,&t,&p)&&!(n==0&&m==0&&t==0&&p==0)){
        initial(n,m);
        int w1=0,w2=0,wid=m,hig=n;
        //pf(w1,wid,w2,hig);
        while(t--){
            int d,c;
            scanf("%d%d",&d,&c);
            opt(d,c,wid,hig,w1,w2);
        }
        while(p--){
            int x,y;
            scanf("%d%d",&x,&y);
            x+=w1,y+=w2;
            printf("%d\n",g[y][x]);
        }
    }
    return 0;
}



Measured memory_bytes: 4836
//QWsin
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=nxt[i])
#define repvc(i,vc) for(int i=0,Sz=vc.size();i<Sz;++i)
using namespace std;
inline int read()
{
	char ch=getchar();int ret=0,f=1;
	while(ch<'0' || ch>'9') {if(ch=='-')f=-1;ch=getchar();}
	for(;ch>='0' && ch<='9';ch=getchar()) ret=ret*10+ch-'0';
	return ret*f;
}

inline void print(string name,int *arr,int len){
	rep(i,1,len) printf("%s[%d]=%d\n",name.c_str(),i,arr[i]);puts("");
}
inline void print(string name,int a){
	printf("%s=%d\n",name.c_str(),a);puts("");
}

typedef long long ll;
const int INF=1<<30;

string s;

int main()
{
	int l;cin>>l;
	cin>>s;
	int ans=0;
	for(int i=0;i+2-1<l;++i)
		if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C') ++ans;
		
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>
#include <iomanip>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1ll << 60;

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

int gcd(int a, int b) {
	if(b == 0) return a;
	return gcd(b, a % b);
}

vector<int> divisor(int n) {
	vector<int> res;
	for(int i = 1; i * i <= n; i++) {
		if(n % i == 0) {
			res.push_back(i);
			if(i != n / i) res.push_back(n / i);
		}
	}
	return res;
}

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

    int a, b, k;
    cin >> a >> b >> k;
    int tmp = gcd(a, b);
    vector<int> v = divisor(tmp);
    vsort_r(v);
    int cnt = 1;
    for(auto it = v.begin(); it != v.end(); it++) {
        if (cnt == k) {
            cout << *it << endl;
            return 0;
        }
        cnt++;
    }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
signed main(void){
	long long a,b,c,d;
	scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
	cout<<max(max(max(a,b)*max(d,c),max(a,b)*min(d,c)),max(min(a,b)*max(c,d),min(a,b)*min(c,d)));
	return 0;
}

Measured memory_bytes: 3728
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    double money = 0;
    cin >> N;
    for(int i = 0;i < N;i++){
        double x;
        string u;
        cin >> x >> u;
        if(u == "JPY"){
          money += x;
        }
        else if(u == "BTC"){
          money += x*380000;
        }
        
    }
    cout << money << endl;
}

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

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

    string s, t;
    cin >> s >> t;

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

    string u;
    cin >> u;

    if(u == s) --a;
    else --b;

    cout << a << " " << b << endl;

    return 0;
}

Measured memory_bytes: 256
import math, bisect
N = int(input())
P = [1,N]
for k in range(2,math.floor(math.sqrt(N))+1):
    if N % k == 0:
        P.append(k)
        P.append(N//k)
P = sorted(P)
print(len(str(P[bisect.bisect_left(P,math.sqrt(N))])))

Measured memory_bytes: 3188
kk,nn = map(int, input().split(' '))
ll = list(map(int, input().split(' ')))
ll.append(kk)

aida = []
for j in range(len(ll)-1):
    #print(j)
    if j==0: aida.append(ll[-1]-ll[-2]+ll[0])
    else: aida.append(ll[j]-ll[j-1])
print(sum(aida)-max(aida))

Measured memory_bytes: 26444
mod = 1000000000 + 7

N = int(input())
ans = 1
no9 = 1
no0 = 1
no09 = 1
for i in range(N):
    ans = ans * 10 % mod
    #print(ans)
    no9 = no9 * 9 % mod
    #print(no9)
    no0 = no0 * 9 % mod
    #print(no0)
    no09 = no09 * 8 % mod
    #print(no09)
ans = (ans - no9 -no0 + no09) % mod

print(ans)

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

int main() {
  int n;
  cin >> n;
  int F[50];
  F[0] = F[1] = 1;
  for(int i = 2; i <= n; i++) F[i] = F[i - 1] + F[i - 2];
  cout<<F[n]<<endl;

  return 0;
}



Measured memory_bytes: 3104
N = int(input())
x = list(map(int, input().split()))
p = int(sum(x)/N)
hp1 = 0
hp2 = 0
for i in range(N):
  hp1 += (x[i]-p)**2
  hp2 += (x[i]-p-1)**2
print(min(hp1, hp2))

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <functional>
#include <numeric>
#include <limits>
#include <iomanip>
#include <queue>
#include <cmath>
#include <math.h>
#include <string>
#include <math.h>
#define PI 3.14159265359
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const long long INF = 1LL << 60;
using pll = pair<long long, long long>;

int main() {

	// 標準入力が早くなる。Cスタイルの入出力とC++スタイルの入出力を混合させてはならない。
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);


	long long N, K;
	cin >> N >> K;

	cout << min(N % K, K - N % K);

	return 0;
}


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

using namespace std;

const int maxn=1e5+10;
int n,x[maxn],y[maxn],d[maxn];
int dir[4][2]={{1,0},{-1,0},{0,1},{0,-1}};

double Min(double a,double b)
{
    return a-b>1e-9?b:a;
}
double Max(double a,double b)
{
    return a-b>1e-9?a:b;
}

double func(double s)
{
    double x1=1e9,x2=-1e9,y1=1e9,y2=-1e9,t1,t2;
    //cout<<setprecision(2)<<s<<' ';
    for(int i=0;i<n;i++)
    {
        t1=x[i]+s*dir[d[i]][0];
        t2=y[i]+s*dir[d[i]][1];
        x1=min(x1,t1);
        y1=min(y1,t2);
        x2=max(x2,t1);
        y2=max(y2,t2);
        //cout<<t[0]<<' '<<t[1]<<x[0]<<' '<<x[1]<<' '<<y[0]<<' '<<y[1]<<endl;
    }
    return (y2-y1)*(x2-x1);
}

int main()
{
    int i,j; char ch;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>x[i]>>y[i]>>ch;
        switch(ch)
        {
        case 'R':
            d[i]=0; break;
        case 'L':
            d[i]=1; break;
        case 'U':
            d[i]=2; break;
        case 'D':
            d[i]=3;
        }
    }
    double res = 1e18,l=0,r=1e9,lm,rm,are1,are2;
    for(i=0;i<200;i++)
    {
        lm=(l*2+r)/3,rm=(l+r*2)/3;
        are1=func(lm),are2=func(rm);
        //cout<<setprecision(4)<<are1<<' '<<are2<<' '<<res<<endl;
        res=min(res,are1);
        res=min(res,are2);
        if(are1<are2)
        {
            r=rm;
        }
        else
            l=lm;
        //cout<<res<<endl;
        //printf("%.15lf\n",res);
        //cout<<res<<endl;
        //fflush(stdin);
    }
    printf("%.15lf\n",res);
    return 0;
}


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

using namespace std;


int main() {
    string s, t;
    cin >> s >> t;
    int ans = 1000000;
    int ss = s.size(), st = t.size();
    for(int i = 0; i < ss - st + 1; i++) {
        string sub = s.substr(i, st);
        int counter = 0;
        for(int j = 0; j < st; j++) {
            if(sub[j] != t[j]) {
                counter++;
            }
        }
        ans = min(ans, counter);
    }
    cout << ans << "\n";
    return 0;
}

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

#define ipr pair<int, int>
#define pb push_back
#define ff first
#define ss second
#define fr(i, j, k) for (int i = j; i < k; i++)
#define rf(i, j, k) for (int i = j; i >= k; i--)
#define int long long
#define ll unsigned long long
#define ld long double
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define mp make_pair
#define inf 1000000000000000000
#define cnt_ones(x) __builtin_popcountll(x)

#define IOS                           \
	std::ios::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL);

const int Maxn = 100001;
const ld pi = acos(-1);
const int mod = 998244353;

template <class T>
ostream &operator<<(ostream &out, vector<T> &A)
{
	for (auto x : A)
		out << x << " ";
	return out;
}

int32_t main(){IOS
	int Q=1;	//cin>>Q;
	while(Q--){
		int n;	cin>>n;
		string s;	cin>>s;
		vector<vector<int> >A(n, vector<int> (3, 0));
		if(s[n-1] == 'R')	A[n-1][0]++;
		else if(s[n-1] == 'B') A[n-1][1]++;
		else    A[n-1][2]++;
		rf(i,n-2,0){
			fr(k, 0, 3)
				A[i][k] += A[i + 1][k];
			if(s[i] == 'R')	A[i][0]++;
			else if(s[i] == 'B') A[i][1]++;
			else    A[i][2]++;
		}
		int ans = 0;
		fr(i,0,n-2)	fr(j,i+1,n-1)
		if(s[i] != s[j]){
			if(j+j-i < n and s[j+j-i]!=s[j] and s[j+j-i]!=s[i])	ans--;
			bool red=false, blue=false, green=false;
			if(s[i] == 'R' or s[j] == 'R')	red=true;
			if(s[i] == 'B' or s[j] == 'B')	blue=true;
			if(s[i] == 'G' or s[j] == 'G')	green=true;
			if(!red)	ans += A[j+1][0];
			else if(!blue)	ans += A[j+1][1];
			else ans += A[j+1][2];
		}
		cout << ans << '\n';
	} 
	return 0;
}

Measured memory_bytes: 3860
a, b = map(int, input().split())
if 0 <= a <= 100 and 2 <= b <= 1000 and 0 == b % 2:
    if 13 <= a:
        print(b)
    elif 6 <= a < 13:
        print(int(b/2))
    else:
        print(0)
else:
    print('Invalid value')

Measured memory_bytes: 2940
using System;
using System.Text;
using static System.Console;
namespace a753
{
    class a753
    {
        static void Main(string[] args)
        {
            int x = int.Parse(ReadLine());
            string op = "";
            if (x == 3 || x == 5 || x == 7) 
            {
                op = "YES";
             } else {
                 op = "NO";
             }
             WriteLine(op);
        }
    }
}

Measured memory_bytes: 11092
#include <cstdio>

using namespace std;

const int N = 5005;

int cnt[N], n, k, ans[N], cur = 0;

int main(){
    scanf("%d%d", &n, &k);k++;
    for(int i = 0;i<n;i++){
        scanf("%d", cnt + i);
    }
    int lst = -1;
    for(int j = 0;j<k;j++){
        int mi = (lst == 0);
        for(int i = 0;i<n;i++)
            if(cnt[mi] > cnt[i] && i != lst) mi = i;
        if(!cnt[mi]){
            printf("-1\n");
            return 0;
        }
        for(int i = 0;i<n;i++){
            if(i == mi || i == lst) continue;
            ans[cur++] = i + 1;
            cnt[i]--;
        }
        ans[cur++] = mi + 1;
        cnt[mi]--;
        lst = mi;
    }
    printf("%d\n", cur);
    for(int i = 0;i<cur;i++)
        printf("%d ", ans[i]);
    printf("\n");
}


Measured memory_bytes: 128
#include<stdio.h>
int main(){
  int score[5];
  int i, sum = 0, average;
  for(i = 0; i < 5; i++){
    scanf("%d", &score[i]);
  }
  for(i = 0; i < 5; i++){
    if(score[i] < 40){
      score[i] = 40;
    }
    sum += score[i];
  }
  average = sum / 5;
  printf("%d\n", average);
  return 0;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            input_iter = LazyLoadAllLines();
            //------------------------------------------------//
            var n = Read<long>();
            //var m = Read<long>();
            //var a = Read<long>();
            //var b = Read<long>();
            //var c = Read<long>();
            //var x = Read<long>();
            var dls = Read<long>(n);
            //List<long> als = new List<long>(), bls = new List<long>();
            //List<List<long>> cls = new List<List<long>>();
            /*for (int i = 0; i < m; ++i)
            {
                als.Add(Read<long>());
                bls.Add(Read<long>());
                cls.Add(Read<long>(bls[i]));
            }*/

            //als.Sort((l, r) => (int)(r - l));

            long total = 0;
            for(int i = 0; i < n - 1; ++i)
            {
                for(int j = i + 1; j < n; ++j)
                {
                    total += dls[i] * dls[j];
                }
            }

            Console.WriteLine(total);

        }

        static IEnumerator<string> input_iter;

        static _T Read<_T>() where _T : struct
        {
            input_iter.MoveNext();
            return (_T)Convert.ChangeType(input_iter.Current, typeof(_T));
        }
        static string Read()
        {
            input_iter.MoveNext();
            return input_iter.Current;
        }
        static List<_T> Read<_T>(long num) where _T : struct { return new List<_T>(Enumerate<_T>(num)); }


        static IEnumerable<_T> Enumerate<_T>(long num)
        {
            for (long i = 0; i < num; ++i)
            {
                input_iter.MoveNext();
                yield return (_T)Convert.ChangeType(input_iter.Current, typeof(_T));
            }
        }
        static IEnumerator<string> LazyLoadAllLines()
        {
            string line;
            do
            {
                line = Console.ReadLine();
                foreach (var s in line.Split(' '))
                    yield return s;
            } while (line != null);
        }
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll long long int
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define INF 0x3f3f3f3f

using namespace std;
using namespace __gnu_pbds;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef tree<pair<int,int>,null_type, less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update>   ordered_set;
const int N=2e5+10, mod=1e9+7;
ll dp[N][2]; // taking flowers in consideration from 0 to i, 0->not taking this flower 1-> taking this flower
ll sgt[4*N],h[N],a[N];

void update(int l,int r,int pos,ll x,int i){
	if(l>pos||r<pos) return;
	if(l==r){
		sgt[i]=x;
		return;
	}
	int mid=(l+r)/2;
	update(l,mid,pos,x,2*i+1);
	update(mid+1,r,pos,x,2*i+2);
	sgt[i]=max(sgt[2*i+1],sgt[2*i+2]);
}

ll get(int l,int r,int a,int b,int i){
	if(l>b||r<a) return 0;
	if(l>=a&&r<=b) return sgt[i];
	int mid=(l+r)/2;
	return max( get(l,mid,a,b,2*i+1) , get(mid+1,r,a,b,2*i+2) );
}

int main(){
	ios_base::sync_with_stdio(0);	cin.tie(0);
	int n;
	cin>>n;
	for(int i=0;i<n;i++) cin>>h[i];
	for(int i=0;i<n;i++) cin>>a[i];
	
	ll res=-1;
	for(int i=0;i<n;i++){
		ll x= get(0,N,0,h[i]-1,0);
		update(0,N,h[i],a[i]+x,0 );
		res=max(res,a[i]+x);
	}
	cout<<res;
}

// check for any potential overflow before submitting


Measured memory_bytes: 8448
function myout(text){console.log(text);}//standard output
function Main(input) {
	input = parseInt(input);
	//input = input.trim().split(" ");
	//input = input.trim().split("\n");
	//input = input.trim().split(" ").map((a)=>Number(a));
	//input = input.trim().split("\n").map((a)=>Number(a));
  var odd = 0;
  for(var i = 1; i <= input; i++){
    if(i % 2 == 1){
       odd++;
       }
  }
  myout(odd / input);
}

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


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

const string YES = "Yes";
const string NO = "No";

void solve(long long N, std::vector<long long> H){
  H[0]--;
  for(int i=1;i<N;++i){
    if(H[i]-H[i-1]>0) H[i]--; // 可能な限り低くしておく
    else if(H[i]-H[i-1]==0) continue;
    else {
      cout<<NO<<endl;
      return;
    }
  }
  cout<<YES<<endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  std::vector<long long> H(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&H[i]);
  }
  solve(N, std::move(H));
  return 0;
}


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

int main(int argc, char* argv[]) {
	int a, b;
	cin >> a >> b;
	a -= 2 * b;
	if (a < 0)
		cout << 0 << '\n';
	else
		cout << a << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int b1,b2,b3;
    cin>>b1>>b2>>b3;
    if(b1==1&&b2==0&&b3==0) cout<<"Close";
    if(b1==0&&b2==1&&b3==0) cout<<"Close";
    if(b1==0&&b2==0&&b3==0)cout<<"Close";
    if(b1==1&&b2==1&&b3==0) cout<<"Open";
    if(b1==0&&b2==0&&b3==1) cout<<"Open";
    cout<<endl;
}


Measured memory_bytes: 3104
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>

using namespace std;

void solve(int N, int K);

void solve(int N, int K) {
  double ans = 0;
  for (int i = 1; i <= N; i++) {
    double tmp = 1.0 / N;
    int pt = i;
    for (;;) {
      if (pt >= K) {
        break;
      }
      pt *= 2;
      tmp /= 2;
    }
    ans += tmp;
  }
  printf("%.12f\n", ans);
}

int main() {
  int N, K;
  cin >> N >> K;
  solve(N, K);
  return 0;
}


Measured memory_bytes: 888
import sys
sys.setrecursionlimit(2147483647)
input=sys.stdin.readline

def main():
  n = int(input())
  a = list(map(int, input().split(' ')))
  a.sort()
  a_max = a[-1]
  b = 0
  db = [0] * a_max
  for i in range(1, n-1):
    if a[i] != a[i+1] and a[i] != a[i-1]:
      db[a[i]-1] = 1
  if n == 1 or a[0] != a[1]:
    db[a[0]-1] = 1
  if n > 1 and a[-1] != a[-2]:
    db[-1] = 1
  for i in a:
    t = 2
    while(i * t <= a_max):
      db[i*t-1] = 0
      t += 1
  print(sum(db))
  

if __name__=='__main__':
  main()

Measured memory_bytes: 31272
#include<bits/stdc++.h>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
const ll MOD = 1000000007;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a > b && a > c) cout << b * c / 2 << endl;
  else if (b > a && b > c) cout << a * c / 2 << endl;
  else  cout << a * b / 2 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  string s, t; cin >> s >> t;
  if (s == t) {
    cout << "EQUAL" << endl;
  } else if (s.size() > t.size()) {
    cout << "GREATER" << endl;
  } else if (s.size() < t.size()) {
    cout << "LESS" << endl;
  } else if (s > t) {
    cout << "GREATER" << endl;
  } else {
    cout << "LESS" << endl;
  }
}

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

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

template <typename T> T id(T b) {return b;};
template <class It> bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It> bool any(It f,It l){return std::any_of(f,l,id<bool>);}
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}

int a,b;

int main()
{
#ifdef FASTIO
  ios_base::sync_with_stdio(false); cin.tie(nullptr);
#endif

  cin >> a >> b;

  if (a <= 0 && 0 <= b) {
    cout << "Zero\n";
  } else if (a < 0) {
    cout << ((min(b,-1)-a)%2==1?"Positive":"Negative") << "\n";
  } else {
    cout << "Positive\n";
  }


  return 0;
}


Measured memory_bytes: 256
<?php
fscanf(STDIN, '%d %d %d', $a, $b, $x);

if ($x > $a * $a * $b / 2) {
    $_a = $a;
    $_b = -2 * ($x / $a / $a - $b);
} else {
    $_a = $x / $b / $a * 2;
    $_b = $b;
}
$ans = rad2deg(atan2($_b, $_a));
echo $ans.PHP_EOL;

Measured memory_bytes: 4856