akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream &operator<<(ostream &out, std::vector<T> const &cont) {
    for (auto &i : cont) {
        out << i << ' ';
    }
    return out;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &out, std::pair<T1, T2> const &p) {
    out << '{' << p.first << ", " << p.second << "}";
    return out;
}
#define imie(...) __debug_print(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __debug_print(const char *name, Arg1 &&arg1) {
#ifdef LOCAL
    cerr << "[" << name << ": " << arg1 << "]" << endl;
#endif
}
template <typename Arg1, typename... Args>
void __debug_print(const char *names, Arg1 &&arg1, Args &&... args) {
#ifdef LOCAL
    const char *comma = strchr(names + 1, ',');
    cerr << "[";
    cerr.write(names, comma - names) << ": " << arg1 << "],  ";
    __debug_print(comma + 2, args...);
#endif
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    int64_t arr[N];
    for(auto& i : arr) cin >> i;
    int64_t DP[N][N];
    for(int l = N-1; l >= 0; --l){
        for(int r = l; r < N; ++r){
            if(l == r){
                DP[l][r] = arr[l];
            }
            else{
                DP[l][r] = max(arr[l] - DP[l+1][r], arr[r] - DP[l][r-1]);
            }
        }
    }
    cout << DP[0][N-1] << endl;
}

Measured memory_bytes: 49824
package main

import "fmt"

func abs(a int) int {
  if a < 0 {
    return -a
  }
  return a
}

func main() {
  var N, K, count int
  fmt.Scan(&N, &K)
  Nmin := N
  N = N%K
  
  for {
    N = abs(N-K)
    if N < Nmin {
      Nmin = N
      count = 0
    }
    if Nmin == N{
      count++
      if count >1 {
        break
      }
    }
  }
  fmt.Println(Nmin) 
}

Measured memory_bytes: 512
import sys

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


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


def main():
    H, W = map(int, input().split())
    C = []
    for _ in range(10):
        c = list(map(int, input().split()))
        C.append(c)

    A = []
    for _ in range(H):
        a = list(map(int, input().split()))
        A.append(a)

    dp = [[INF] * 10 for _ in range(10)]
    for i in range(10):
        for j in range(10):
            dp[i][j] = C[i][j]

    for k in range(10):
        for i in range(10):
            for j in range(10):
                tmp = dp[i][k] + dp[k][j]
                if tmp < dp[i][j]:
                    dp[i][j] = tmp

    ans = 0
    for h in range(H):
        for w in range(W):
            if A[h][w] == -1:
                continue
            else:
                ans += dp[A[h][w]][1]

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3444
import sys, collections
readline=sys.stdin.buffer.readline

N=int(readline())
a=list(map(int,readline().split()))
#print(a)

if len(set(a))==1 and a[0]==0:
  print("Yes")
  exit()

if len(a)%3!=0:
  print("No")
else:
  if len(set(a))==2:
    aa=list(collections.Counter(a).items())
    aa.sort()
    if aa[0][0]==0 and aa[0][1]*2==aa[1][1]:
      print("Yes")
    else:
      print("No")
  elif len(set(a))==3:
    aa=list(collections.Counter(a).items())
    if aa[0][1]==aa[1][1]==aa[2][1] and aa[0][0]^aa[1][0]^aa[2][0]==0:
      print("Yes")
    else:
      print("No")
  else:
    print("No")

Measured memory_bytes: 12800
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
class Main{
  public static void main(String args[]) throws IOException{
   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
   String[] surface =  br.readLine().split(" ");//?????????????????¢
   String[] order = br.readLine().split("");//??????
 
   Dise dice1 = new Dise();
   dice1.setSurface(surface);//?????????????????¢???????????????
   dice1.SetDice(1, 2 , 3);//???????????????????????£??¢????????????????????????????????°?????¨???????????????????????????????????¢?????????
   dice1.RollDice(order);//????????????????????????????????????????????£????????¢?????????
   System.out.println( dice1.surface[dice1.Top]);
 
  }
}
 
 
class Dise{
 
    int[] surface = new int [6];//????????????????????¢
    int Top,Bottom,Right,Left,Front,Back;//?????¢????????¢????????¢????????¢????????¢????????¢????????????????????????0??????5??????????????????????????????
 
 
    void setSurface(String[] SurfaceString){
 
        for(int i = 0; i < 6; i++){
 
            surface[i] = Integer.parseInt( SurfaceString[i] );
 
        }
 
    }
 
    void SetDice(int top, int front, int right){//1??????6????????§1?????????0??????5??¨??????
       Top  = top - 1;
       Front = front - 1;
       Right = right - 1;
       Bottom = 5- (top - 1);//?????¢????±?????????°???????????????????????¢????±???????
       Back = 5- (front - 1);
       Left = 5- (right - 1);
    }//SetDice
 
    void RollDice(String[] RollString){
        for(int i = 0; i < RollString.length ; i++){
 
            if( RollString[i].equals("W") ){
 
                Bottom = Left;
                Left = Top;
                Top = 5 - Bottom;
                Right = 5 - Left;
 
            }else if( RollString[i].equals("S")){
 
                Bottom = Front;
                Front = Top;
                Top = 5 - Bottom;
                Back = 5 - Front;
 
            }else if( RollString[i].equals("E")){
 
                Bottom = Right;
                Right = Top;
                Top = 5 - Bottom;
                Left = 5 - Right;
 
            }else if( RollString[i].equals("N")){
 
                Bottom = Back;
                Back = Top;
                Top = 5 - Bottom;
                Front = 5 - Back;
 
            }
        }
 
        
    }//RollDice
 
}

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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int[] parent = new int[N];
		int[] depth = new int[N];
		parent[0] = -1;
		depth[0] = 0;
		var Q = new Queue<int>();
		Q.Enqueue(0);
		while(Q.Count > 0){
			var now = Q.Dequeue();
			foreach(var nxt in E[now]){
				if(nxt == parent[now]) continue;
				parent[nxt] = now;
				depth[nxt] = depth[now] + 1;
				Q.Enqueue(nxt);
			}
		}
		
		int len = depth[N-1];
		int tt = (len+1) / 2;
//Console.WriteLine(len + " " + tt);
		var nn = N-1;
		for(int i=0;i<tt-1;i++){
			nn = parent[nn];
		}
		
		bool[] visit = new bool[N];
		visit[nn] = true;
		Q.Enqueue(nn);
		while(Q.Count>0){
			var now = Q.Dequeue();
			foreach(var nxt in E[now]){
				if(nxt == parent[now]) continue;
				visit[nxt] = true;
				Q.Enqueue(nxt);
			}
		}
		
		int snuke = visit.Count(e => e);
		int fennec = N - snuke;
//Console.WriteLine(fennec + " " + snuke);
		Console.WriteLine(fennec > snuke ? "Fennec" : "Snuke");
		
		
		
	}
	int N;
	List<int>[] E;
	public Sol(){
		N = ri();
		E = new List<int>[N];
		for(int i=0;i<N;i++) E[i] = new List<int>();
		for(int i=0;i<N-1;i++){
			var d = ria();
			E[d[0]-1].Add(d[1]-1);
			E[d[1]-1].Add(d[0]-1);
		}
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 28124
#include <stdio.h>
#include <stdlib.h>

int main()
{  int n; scanf("%d",&n); char s[n]; int i=0;
    scanf("%s",s);
    if(n%2!=0)
        printf("No");
   else{
        for(i=0;i<(n/2);i++){
        if(s[i]!=s[i+(n/2)])
        {
            printf("No"); break;
    }}
    if(i==(n/2))
        printf("Yes"); }
    return 0;
}

Measured memory_bytes: 504
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define N 200100
#define N2 1000010
#define MOD 1000000007
#define int long long int
#define INF 1000000000000000
#define fn(i,n) for(int i=0;i<n;i+=1)
#define rep(i,l,r) for(int i=l;i<=r;i+=1)
int prime[N2]={0};
vector <int> pr;
void sieve(){
    prime[0]=1;prime[1]=1;
    for(int i=2;i<=sqrt(N2);i++){
        if(prime[i]==0)
            {
                for(int j=i*i;j<N2;j+=i){
                    prime[j]=1;
                }
            }
    }
    for(int i=2;i<N2;i++){
        if(!prime[i])
            pr.pb(i);
    }
    return ;
}
double pi=3.141592653589;
int a[N];
signed main() {  
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    //sieve();
    int r;cin>>r;
    cout<<setprecision(10)<<fixed<<2.0*pi*r<<endl;
    
            
    
    return 0; 
}




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

bool prime(int n)
{
    for(int i=2;i*i<=n;i++)
        if(n%i==0)
            return false;
    return true;
}
int main(void)
{
    int x,i;
    cin >> x;
    for(i=x;!prime(i);i++);
    cout << i;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

/////////////////////////////////////////////////////////////////////////
ll INF = 1LL << 50;
class GraphD{
    typedef pair<ll, int> P;
    struct edge{
        int to;
        ll cost;
    };
public:
    int N;
    vector<ll> d;
    vector<int> pred;
    vector<vector<edge>> G;

    GraphD(int n){
        N = n;
        d.resize(N, INF);
        pred.resize(N, -1);
        G.resize(N, vector<edge>(0));
    }

    void makeEdge(int s, int t, ll c){
        G[s].push_back(edge{t, c});
    }

    void dijkstra(int s){
        fill(d.begin(), d.end(), INF);
        fill(pred.begin(), pred.end(), -1);
        priority_queue<P, vector<P>, greater<P>> que;
        d[s] = 0;
        que.push(P(0, s));

        while(!que.empty()){
            P p = que.top();
            que.pop();
            int v = p.second;
            if(d[v] < p.first) continue;

            for(int i = 0; i < (int)G[v].size(); i++){
                edge e = G[v][i];
                if(d[e.to] > d[v] + e.cost){
                    d[e.to] = d[v] + e.cost;
                    pred[e.to] = v;
                    que.push(P(d[e.to], e.to));
                }
            }
        }
    }

    ll get_cost(int t){
        return d[t];
    }

    vector<int> shortest_path(int t){
        vector<int> ret;
        while(true){
            ret.push_back(t);
            if(pred[t] != -1) t = pred[t];
            else break;
        }

        reverse(ret.begin(), ret.end());
        return ret;
    }
};

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

    GraphD gr = GraphD(N * 2501);

    vector<vector<int>> a(N, vector<int>(N, -1));
    vector<vector<ll>> b(N, vector<ll>(N, -1));
    for(int i = 0; i < M; i++) {
        int u, v, x, y;
        cin >> u >> v >> x >> y;
        a[u - 1][v - 1] = x;
        b[u - 1][v - 1] = y;
    }

    ll c[N], d[N];
    for(int i = 0; i < N; i++) cin >> c[i] >> d[i];

    //同じ都市内で辺を張る
    for(int i = 0; i < N; i++) {
        for(int j = 0; j < 2500; j++) {
            ll tar = j + c[i];
            tar = min(tar, 2500LL);
            gr.makeEdge(i * 2501 + j, i * 2501 + tar, d[i]);
        }
    }

    //都市間で辺を張る
    for(int i = 0; i < N; i++) {
        for(int j = i + 1; j < N; j++) {
            if(a[i][j] != -1) {
                for(int k = 0; k <= 2500; k++) {
                    int t = k - a[i][j];
                    if(t >= 0) {
                        gr.makeEdge(i * 2501 + k, j * 2501 + t, b[i][j]);
                        gr.makeEdge(j * 2501 + k, i * 2501 + t, b[i][j]);
                    }
                }
            }
        }
    }

    gr.dijkstra(min(S, 2500));

    for(int i = 1; i < N; i++) {
        ll ans = 1LL << 60;
        for(int j = 0; j <= 2500; j++) {
            ans = min(ans, gr.get_cost(i * 2501 + j));
        }

        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 24996
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
string S;

int main() {
  cin >> S;
  if (S[0] != 'A') {
    cout << "WA";
    return 0;
  }
  int n = 0;
  for (int i = 2; i <= S.size() - 2; i++) {
    if (S[i] == 'C') {
      n++;
    }
  }
  if (n != 1) {
    cout << "WA";
    return 0;
  }
  int nn = 0;
  for (int i = 0; i < S.size(); i++) {
    if ('a' <= S[i] && S[i] <= 'z') {
      nn++;
    }
  }
  if (nn != S.size() - 2) {
    cout << "WA";
    return 0;
  }
  cout << "AC";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int,int> ii;

int fact[2000005];
int mod = 1000000007;
long long qexp(long long b, long long p){
    long long res = 1;
    while(p){
        if(p&1) res = (res * b) % mod;
        b = (b * b) % mod;
        p >>= 1;
    }
    return res;
}
int inv(long long b){ return qexp(b, mod-2); }
int choose(int N, int C){
	if(N < C) return 0;
	int res = fact[N];
	res *= inv(fact[C]);
	res %= mod;
	res *= inv(fact[N-C]);
	res %= mod;
	return res;
}

signed main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	
	fact[0] = 1;
	for(int i = 1;i <= 2000002;i++) fact[i] = (fact[i-1] * i) % mod;
	
	int N; cin >> N;
	
	string S; cin >> S;
	
	int M = S.size();
	
	int ans = 0;
	for(int e = 0;e <= N;e++){
		int other = N - e;
		
		int res = qexp(26, e) * qexp(25, other);
		res %= mod;
		
		res *= choose(M+other-1, other);
		res %= mod;
		
		ans += res;
		ans %= mod;
		
		//cout << qexp(26, e) << " " << qexp(25, other) << " " << choose(M+other-1, other) << " " << M << " " << other << "\n";
		
		//cout << ans << "\n";
	}
	
	cout << ans;
}



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

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

    bool flag = false;

    if (s[0] == s[1] && s[2] == s[3] && s[0] != s[2]) cout << "Yes" << endl;
    else if (s[0] == s[2] && s[1] == s[3] && s[0] != s[1]) cout << "Yes" << endl;
    else if (s[0] == s[3] && s[1] == s[2] && s[0] != s[1]) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> PI;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair
#define PB push_back

string str;
char type;

void pr(int pos){
  if(str[pos]=='_')return;
  if(pos==0 || str[pos-1]=='_' || isupper(str[pos])){
    switch(type){
    case 'U':
      cout<<(char)toupper(str[pos]);
      break;
    case 'L':
      if(pos==0)cout<<(char)tolower(str[pos]);
      else cout<<(char)toupper(str[pos]);
      break;
    case 'D':
      if(pos==0)cout<<(char)tolower(str[pos]);
      else cout<<"_"<<(char)tolower(str[pos]);
      break;
    }
  }else{
    cout<<str[pos];
  }
}

main(){
  while(cin>>str){
    cin>>type;
    if(type=='X')break;
    rep(i,str.size()){
      pr(i);
    }
    cout<<endl;
  }
}

Measured memory_bytes: 0
N = int(input())
ans = 0
i = 2
N
l=2
flag=True
if N ==1:
    ans = 0
else:
    while(N**0.5>i):
        tmpi = i
        while(N%i==0):
            if N%tmpi==0:
                N/=tmpi
                tmpi*=i
                ans += 1
            else:
                N/=i
        i+=1
while(N**0.5>l):
    if N%l==0:
        flag=False
        break
    l+=1
if flag and N!=1:
    ans+=1
print(ans)

Measured memory_bytes: 9472
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef pair<int,int> pii;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
template<class Type> void line(const Type &a){int cnt=0;for(auto &elem:a){if(cnt++)cout<<' ';cout<<elem;}cout<<endl;}

int main(){
	int a,b;
	cin>>a>>b;
	
	if(a<b){
		REP(i,b) cout<<a;
		cout<<endl;
	}else{
		REP(i,a) cout<<b;
		cout<<endl;
	}
}


Measured memory_bytes: 256
/**
*    author:  yuya1234
*    created: 17.07.2020 14:32:58
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
long double eps = 1.0E-14;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define FORV(i,v) for(auto i=v.begin(); i!=v.end();i++)

#define SORT(s) sort((s).begin(),(s).end())
#define SORTD(s) sort((s).rbegin(),(s).rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define SZ(x) ((int)(x).size())
#define MEMSET(v, h) memset((v), h, sizeof(v))

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

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

  int n,q;
  cin>>n>>q;

  string s;
  cin>>s;
  int l[q],r[q];
  REP(i,q)cin>>l[i]>>r[i];

  int ss[SZ(s)];
  MEMSET(ss,0);
  int sum=0;
  FOR(i,1,SZ(s)-1)
  {
    if(s[i-1]=='A' && s[i]=='C')sum++;
    ss[i]=sum;
  }

  //REP(i,SZ(s))cout<<ss[i]<<endl;

  REP(i,q)
  {
    cout<<ss[r[i]-1]-ss[l[i]-1]<<endl;
  }

  return 0;
}

Measured memory_bytes: 4900
#include <bits/stdc++.h>
#define N 55
#define int long long
using namespace std;
const int s = ('a'-1);
const int mod = (1e9)+7;
int n;
string str[N];

int calc(int y,int x,int ch){
  if(x>=(int)str[y].size() || ch>=27) return 0;
  int k = 0;
  if(str[y][x] != '?') k = 1;
  if(str[y][x] == '?') k = 27 - ch;
  if(k == 0) return 0;
  static int mem[N][22]={},used[N][22]={};
  if(used[y][x]) return (k*mem[y][x])%mod;
  used[y][x] = 1;
  int &res = mem[y][x] = 1;
  for(++x;x<(int)str[y].size();x++) if(str[y][x]=='?') res = (res*26)%mod;
  return (res*k)%mod;
}


bool check(int u,int d,int x,char ch){
  static bool memc[N][N][22][30],usedc[N][N][22][30];
  if(usedc[u][d][x][ch-s]) return memc[u][d][x][ch-s];
  usedc[u][d][x][ch-s] = 1;
  for(int y=u;y<=d;y++) if(str[y][x] != '?' && str[y][x] != ch) return memc[u][d][x][ch-s]=0;
  return  memc[u][d][x][ch-s]=1;
}

int mem[N][N][22][30],used[N][N][22][30];
int dfs(int u,int d,int x,int c){
  if(u > d) return 1;
  if(u == d) return calc(u,x,c);
  if(x >= 21) return 0;
  if(str[u][x] == s) return mem[u][d][x][c] = (c == 1 && str[u+1][x] != s ? dfs(u+1,d,x,c):0);
  if(used[u][d][x][c]++) return mem[u][d][x][c];
  
  vector<int> mnc(N,30);
  for(int y=d;y>=u;y--)mnc[y] = min(mnc[y+1],str[y][x]=='?'? 30:str[y][x] - s);

  int res = 0; 
  //[u,y]?????????????????????????????????????????????
  for(int ch=c;ch<=26;ch++){
    for(int y=u;y<=d;y++){
      if(mnc[y+1] <= ch || !check(u,y,x,ch+s)) continue;
      res = (res+(dfs(u,y,x+1,1)*dfs(y+1,d,x,ch+1))%mod)%mod;
    }
  }
  return mem[u][d][x][c] = res;
}


signed main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>str[i];
    while(str[i].size()<21) str[i]+=s;
  }
  cout<<dfs(0,n-1,0,1)<<endl;
  return 0;
}

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

int main(){
    int N;
    double ans;
    cin >> N;
    vector<int>vec(N);
    for(int i = 0; i < N; i++){
        cin >> vec.at(i);
    }
    for(int i = 0; i < N; i++){
        ans = 1.000 / vec.at(i) + ans;
    }
  	ans = 1.000 / ans;
    cout << ans <<endl;
}


Measured memory_bytes: 256
using System;
class c
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var v = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        Array.Sort(v, StringComparer.Ordinal);
        double ans = v[0];
        for (int i = 1; i < n; i++) ans = (ans + v[i]) / 2;
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 11220
#include <stdio.h>

int main(void)
{
	int a[10];
	int b[3]={0,0,0};
	int s,m,n;
	for (s=0;s<10;s++){
		scanf("%d",&a[s]);
	}
	for (s=0;s<3;s++){
		for (m=0;m<10;m++){
			if(b[s]<a[m]){
				b[s]=a[m];
				n=m;
			}
		}
		a[n]=0;
	}
	for (s=0;s<3;s++){
		printf("%d\n",b[s]);
	}
	return 0;
}

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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

int main()
{
	int k;
	cin>>k;
	queue<ll> que;

	rep(i,9)que.push(i+1);

	rep(i,k-1){
		ll cur = que.front();que.pop();
		ll tmp = cur%10;
		repi(i,tmp-1,tmp+2){
			if(i<0 || i>=10)continue;
			que.push(cur*10+(ll)i);
		}
	}
	cout<<que.front()<<endl;
	return 0;
}

Measured memory_bytes: 5140
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var num = ToInt32(ReadLine());
        var csf = new int[num-1][];
        for (var i = 0; i < num-1; i++)
            csf[i] = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        for(var i = 0; i < num; i++)
        {
            var time = 0;
            for(var j = i; j < num-1; j++)
            {
                if (time < csf[j][1]) time = csf[j][1];
                else if (time % csf[j][2] != 0) time += csf[j][2] - time % csf[j][2];
                time += csf[j][0];
            }
            WriteLine(time);
        }
    }
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}


Measured memory_bytes: 13396
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class F
{
	public static void Main() => (new Solver()).Solve();
}

public class Solver
{
	public void Solve()
	{
		long N = GetLong();
		var A = GetLongs(N);

		long NUM_STATE = (N % 2 == 0) ? 2 : 3;
		var dp = new long[N + 1, NUM_STATE];
		for(long i = 0; i <= N; i++)
		{
			for(long j = 0; j < NUM_STATE; j++)
				dp[i, j] = long.MinValue / 2;
		}
		dp[0, 0] = 0;
		
		for(long i = 0; i < N; i++)
		{
			for(long j = 0; j < NUM_STATE; j++)
			{
				if((i + j) % 2 == 0)
					chmax(ref dp[i + 1, j], dp[i, j] + A[i]);
				else
					chmax(ref dp[i + 1, j], dp[i, j]);

				if(j < NUM_STATE - 1)
					chmax(ref dp[i + 1, j + 1], dp[i, j]);
			}
		}

		WriteLine(dp[N, NUM_STATE - 1]);
	}
}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => Enumerable.Range(0, (int)N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(long N) => Enumerable.Range(0, (int)N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDouble()).ToArray();
	public static decimal[] GetDecimals(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDecimal()).ToArray();
	public static string[] GetStrings(long N) => Enumerable.Range(0, (int)N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

Measured memory_bytes: 52484
#include <iostream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <limits>
#include <algorithm>
#include <array>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <unordered_map>
#include <random>
#include <cmath>
#include <complex>
// #include "utiltime.hpp"

using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

const int INFL = (int)1e9;
const ll INFLL = (ll)1e18;
const double INFD = numeric_limits<double>::infinity();
const double PI = 3.14159265358979323846;
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loopll(i, n) for(ll i = 0; i < (ll)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopll1(i, n) for(ll i = 1; i <= (ll)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Looprll(i, n) for(ll i = (ll)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
#define Looprll1(i, n) for(ll i = (ll)n; i >= 1; i--)
#define Loopitr(itr, container) for(auto itr = container.begin(); itr != container.end(); itr++)
#define printv(vector) Loop(i, vector.size()) { cout << vector[i] << " "; } cout << endl;
#define printmx(matrix) Loop(i, matrix.size()) { Loop(j, matrix[i].size()) { cout << matrix[i][j] << " "; } cout << endl; }
#define quickio() ios::sync_with_stdio(false); cin.tie(0);
#define bitmanip(m,val) static_cast<bitset<(int)m>>(val)
ll rndf(double x) { return (ll)(x + (x >= 0 ? 0.5 : -0.5)); }
ll floorsqrt(double x) { ll m = (ll)sqrt(x); return m + (m * m <= (ll)(x) ? 0 : -1); }
ll ceilsqrt(double x) { ll m = (ll)sqrt(x); return m + ((ll)x <= m * m ? 0 : 1); }
ll rnddiv(ll a, ll b) { return (a / b + (a % b * 2 >= b ? 1 : 0)); }
ll ceildiv(ll a, ll b) { return (a / b + (a % b == 0 ? 0 : 1)); }

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

int main() {
	ll h, w; cin >> h >> w;
	ll k; cin >> k;
	Loop(a, h + 1) {
		Loop(b, w + 1) {
			ll c = (h - a) * (w - b) + a * b;
			if (c == k) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256
// E - Divisible Substring
#include <bits/stdc++.h>
using namespace std;
#define c2d(c) ((c)-'0') // char to digit

int main(){
	int N,P; string S; cin>>N>>P>>S;
	long long total = 0;
	if(10%P == 0){ // P={2,5}
		for(int i=0; i<N; ++i) if(c2d(S[i]) % P == 0) total += i+1;
	}
	else{
		vector<int> cnt(P, 0);
		int r = 0, ten = 1;
		cnt[r]++; // for half-open section
		for(int i=N-1; i>=0; --i){
			// n=count(r), nC2 = {n-1}C2 + {n-1}
			// {n-1} = count(r): previous of count up
			// ∴ total = total + {count of previous of count up}
			r = (r + c2d(S[i])*ten) % P;
			// r = (r + c2d(si)*ten) % P;
			total += cnt[r];
			cnt[r]++;
			ten = ten * 10 % P;
		}
	}
	cout << total << endl;
}

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

int main(){
  int n, m, Q;
  int i, j, k;
  int c;
  scanf( "%d%d%d", &n, &m, &Q );
  //int l[ 200000 ], r[ 200000 ], lr[ 200000 ];
  int **map = NULL;
  //int p[ 100000 ], q[ 100000 ];
  map = ( int ** )calloc( ( n + 1 ), sizeof( int * ) );
  for ( i = 0; i <= n; i++ ){
    map[ i ] = ( int * )calloc( ( n + 1 ), sizeof( int ) );
  }
  for ( i = 0; i < m; i++ ){
    int l, r;
    scanf( "%d%d", &l, &r );
    map[ l ][ r ]++;
  }

  for ( i = 1; i <= n; i++ ){
    for ( j = 1; j <= n; j++ ){
      //printf( "%d,%d, %d\n", i, j, map[ i ][ j ] );
      map[ i ][ j ] += map[ i ][ j - 1 ];
    }
  }
  for ( i = 0; i < Q; i++ ){
    c = 0;
    int p, q;
    scanf( "%d%d", &p, &q );
    //puts("");
    if ( q - p == n - 1 ){
      printf( "%d\n", m );
      continue;
    }

    for ( j = p; j <= q; j++ ){
      //for ( k = 0; k < q; k ++ ){ 
        c += ( map[ j ][ q ] - map[ j ][ p - 1 ] );
        //c++;
      //}
    }
    printf( "%d\n", c );
  }


  return 0;
}

Measured memory_bytes: 1792
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
ll mod = 1000000007;

signed main(){
    ll n,m;
    cin>>n>>m;
    ll p[100009];
    string s[100009];
    bool f[100009];
    ll t[100009];
    rep(i,100009){
        f[i]=false;
        t[i]=0;
    }
    rep(i,m) {
        cin>>p[i]>>s[i];
        if(s[i]=="AC") f[p[i]]=true;
        else if(f[p[i]]==false) t[p[i]]++;
    }
    ll ct=0,pn=0;
    rep(i,n+1){
        if(f[i]==true) {
            ct++;
            pn += (t[i]);
        }
    }
    cout<<ct<<" "<<pn<<endl;
}


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

const short N = 107;

short dp[N][N][N][N];
short pref[N][N];

short getSum(short x1, short y1, short x2, short y2) {
    if (x1 > x2) return (short)0;
    if (y1 > y2) return (short)0;
    return pref[x2 + 1][y2 + 1] - pref[x2 + 1][y1] - pref[x1][y2 + 1] + pref[x1][y1];
}

short mmax(short a, short b) {
    return (a > b ? a : b);
}

short mmin(short a, short b) {
    return (a > b ? b : a);
}

 
signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.setf(ios::fixed); cout.precision(20);
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    short n, m;
    cin >> n >> m;
    vector <vector <char>> a(n, vector <char> (m));
    short ex, ey;
    for (short i = 0; i < n; ++i) {
        for (short j = 0; j < m; ++j) {
            cin >> a[i][j];
            if (a[i][j] == 'E') {
                ex = i;
                ey = j;
            }
        }
    }
    for (short i = 0; i < n; ++i) {
        for (short j = 0; j < m; ++j) {
            pref[i + 1][j + 1] = pref[i + 1][j] + pref[i][j + 1] - pref[i][j] + (short)(a[i][j] == 'o');
        }
    }
    for (short i = 0; i <= n; ++i) {
        for (short j = 0; j <= n; ++j) {
            for (short k = 0; k <= m; ++k) {
                for (short t = 0; t <= m; ++t) {
                    if (ex - i < 0 || ex + j >= n || ey - k < 0 || ey + t >= m) continue;
                    {
                        short nx = ex - i - 1;
                        if (nx >= j) {
                            dp[i + 1][j][k][t] = mmax(dp[i + 1][j][k][t], dp[i][j][k][t] + getSum(nx, mmax(t, ey - k), nx, mmin(m - k - 1, ey + t)));
                        }
                    }
                    {
                        short nx = ex + j + 1;
                        if (nx < n - i) {
                            dp[i][j + 1][k][t] = mmax(dp[i][j + 1][k][t], dp[i][j][k][t] + getSum(nx, mmax(t, ey - k), nx, mmin(m - k - 1, ey + t)));
                        }
                    }
                    {
                        short ny = ey - k - 1;
                        if (ny >= t) {
                            dp[i][j][k + 1][t] = mmax(dp[i][j][k + 1][t], dp[i][j][k][t] + getSum(mmax(j, ex - i), ny, mmin(n - i - 1, ex + j), ny));
                        }
                    }
                    {
                        short ny = ey + t + 1;
                        if (ny < m - k) {
                            dp[i][j][k][t + 1] = mmax(dp[i][j][k][t + 1], dp[i][j][k][t] + getSum(mmax(j, ex - i), ny, mmin(n - i - 1, ex + j), ny));
                        }
                    }
                }
            }
        }
    }
    short ans = 0;
    for (short i = 0; i <= n; ++i) {
        for (short j = 0; j <= n; ++j) {
            for (short k = 0; k <= m; ++k) {
                for (short t = 0; t <= m; ++t) {
                    ans = mmax(ans, dp[i][j][k][t]);
                }
            }
        }
    }
    cout << ans << '\n';
}

Measured memory_bytes: 205312
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <set>
#include <numeric>
#include <bitset>
#include <map>
#include <limits.h>
using namespace std;
typedef unsigned long ul;
typedef pair<ul, ul> P;
const int INF = 1e9;
 
long long gcd(long long x, long long y){
			if(x<y){
				long long temp = x;
			x = y;
				y = temp;
			}
			long long r = x % y;
				while(r!=0){
					x = y;
					y = r;
				r = x % y;
	    		}
			return y;
	    }

   
int main(){
long long N;
cin >> N;
vector<long long> A(N);
for(int i =0 ; i< N; i++){
  cin >> A[i];
}

int cnt = 0;
for(int i = 0; i<N;i++){
  if(A[i]<0){
   A[i]=abs(A[i]);
    cnt++;
  }
}
sort(A.begin(),A.end());

if(cnt%2==0){
  cout << (long long)accumulate(A.begin(),A.end(),0LL) << endl;
}
else cout << (long long)accumulate(A.begin(),A.end(),0LL) - 2*A[0]<< endl;
}

Measured memory_bytes: 1024
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

ll l[300010], r[300010];
struct AddLazySegmentTree {
private:
    ll n;
    vector<ll> node, lazy;

public:
    AddLazySegmentTree(vector<ll> v) {
        ll sz = (ll)v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1);
        lazy.resize(2*n-1, 0);

        for(ll i=0; i<sz; i++) node[i+n-1] = v[i];
        for(ll i=n-2; i>=0; i--) node[i] = node[i*2+1] + node[i*2+2];
    }

    void eval(ll k, ll l, ll r) {
        if(lazy[k] != 0) {
            node[k] += lazy[k];
            if(r - l > 1) {
                lazy[2*k+1] += lazy[k] / 2;
                lazy[2*k+2] += lazy[k] / 2;
            }
            lazy[k] = 0;
        }
    }

    void add(ll a, ll b, ll x, ll k=0, ll l=0, ll r=-1) {
        if(r < 0) r = n;
        eval(k, l, r);
        if(b <= l || r <= a) return;
        if(a <= l && r <= b) {
            lazy[k] += (r - l) * x;
            eval(k, l, r);
        }
        else {
            add(a, b, x, 2*k+1, l, (l+r)/2);
            add(a, b, x, 2*k+2, (l+r)/2, r);
            node[k] = node[2*k+1] + node[2*k+2];
        }
    }

    ll getsum(ll a, ll b, ll k=0, ll l=0, ll r=-1) {
        if(r < 0) r = n;
        eval(k, l, r);
        if(b <= l || r <= a) return 0;
        if(a <= l && r <= b) return node[k];
        ll vl = getsum(a, b, 2*k+1, l, (l+r)/2);
        ll vr = getsum(a, b, 2*k+2, (l+r)/2, r);
        return vl + vr;
    }
};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,M;
    cin >> N >> M;
    rep(i,0,N) cin >> l[i] >> r[i];
    ll cnt = 0;
    vector<lpair> lp;
    rep(i,0,N) lp.push_back({l[i], r[i]});
    sort(lp.begin(), lp.end(), [](lpair l1, lpair l2){
        return l1.second - l1.first < l2.second - l2.first;
    });
    rep(i,0,N){
        l[i] = lp[i].first;
        r[i] = lp[i].second;
    }
    vector<ll> v(M+1, 0);
    AddLazySegmentTree sg(v);

    ll ans[300010] = {};
    ans[1] = N;
    ll idx = 0;
    rep(i,2,M+1){
        while(idx < N){
            if(r[idx] - l[idx] + 1 < i){
                sg.add(l[idx], r[idx]+1, 1);
                idx++;
            }else{
                break;
            }
        }
        ans[i] = N - idx;
        for(ll j = i; j <= M; j += i){
            ans[i] += sg.getsum(j, j+1);
        }
    }
    rep(i,1,M+1) print(ans[i]);
    

}

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

int
main(void)
{
        int N;
        int K;

        scanf("%d %d", &N, &K);

        double probability = 0;
        for (int i = 1; i <= N; i++) {
                int cnt = i;
                double tmp = 1.0 / N;
                while (cnt < K) {
                        tmp *= 0.5;
                        cnt *= 2;
                }

                probability += tmp;
        }

        printf("%1.10lf", probability);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define llu long long unsigned
int main()
{
    llu t,a,b,x=100,y,z,n,mx,mn,tmp,cnt=0;
    scanf("%llu",&t);
    while(1){
        x=x+(x/100);
        cnt++;
        //printf("cnt=%llu, x=%llu\n",cnt,x);
        if(t<=x) break;
    }
    printf("%llu\n",cnt);

    return 0;
}






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

const int MOD = 1e9 + 7;
const int N = 2e5 + 7;
char s[N];
int t[N];

int main() {
	int n;
	scanf("%d", &n);
	scanf("%s", s);
	for (int i = 0; i < 2 * n; i++) {
		t[i] = s[i] == 'B' ? 1 : 0;
		if (i % 2 == 0) t[i] ^= 1;
	}
	int cnt = 0;
	for (int i = 0; i < 2 * n; i++)
		cnt += t[i];
	if (cnt != n) {
		puts("0");
		return 0;
	}
	int ans = 1, temp = 0;
	for (int i = 0; i < 2 * n; i++) {
		if (t[i] == 0) {
			temp++;
		} else {
			ans = 1LL * ans * temp % MOD;
			temp--;
		}
		if (i < n) ans = 1LL * (i + 1) * ans % MOD;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int maxV = 90010;
const int maxN = 2e5+10;
const int MOD = 1e9+7;
const ll INF = 1000000000000000010LL;
const int inf = 1e9+10;
#define X first;
#define Y second;

ll c[maxN];

int main() {
	ll n;
	scanf("%lld",&n);
	ll m = sqrt(n);
	ll ans = INF;
	for(ll i=1;i<=m;i++)
	{
		if(n%i == 0)
		{
			ll y = n/i;
			ans = min(i-1+y-1,ans);
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <cstdlib>

using namespace std;

int main()
{
    string str_a, str_b, str_connected;

    cin >> str_a >> str_b;
    str_connected = str_a + str_b;
    int num = atoi(str_connected.c_str());

    int x = (int)sqrt(num);
    if (x*x == num){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }

    return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split(" "))
ans = [-1 for i in range(N)]
is_conflict = False

for i in range(M):
    s, c = map(int, input().split(" "))
    if ans[s - 1] == -1:
        ans[s - 1] = c
    else:
        is_conflict |= (ans[s - 1] != c)

for i in range(N):
    if i == 0 and ans[i] == -1 and N > 1:
        ans[i] = 1
    elif ans[i] == -1:
        ans[i] = 0

if len(str(int(''.join([str(a) for a in ans])))) != N or is_conflict:
    print(-1)
else:
    print(''.join([str(a) for a in ans]))


Measured memory_bytes: 38256
#include<cstdio>
#include<cstring>
int main() {
	char in[100];
	scanf("%s", in);
	int n = strlen(in);
	int m = 0, s = 0;
	for (int i = 0; i < n; i++) m += in[i] - '0';
	s = 0;
	for (int i = 0; i < n; i++) {
		if (in[i] != '0') {
			int t = s + in[i] - '0' - 1 + (n - i - 1) * 9;
			if (t > m) m = t;
		}
		s += in[i] - '0';
	}
	printf("%d\n", m);
	return 0;
}


Measured memory_bytes: 128
import numpy as np
import math 
A, B, H, M = map(int, input().split())
 
pai = math.pi
 
#HとMを正規化する事で、針間の角度を算出している
angle = 2*pai*((H+M/60)/12 - M/60)
 
#余弦定理
distance = np.sqrt(A**2+B**2-2*A*B*np.cos(angle))
print(distance)

Measured memory_bytes: 27128
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int ans=0;
    ans+=(a<=b)?a:b;
    ans+=(c<=d)?c:d;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;


const int INF = 10000000;
const long long INFL = (1LL<<40);
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}

template< typename T >
struct edge{
    int src, to;T cost;
    edge(int to,T cost) :src(-1),to(to),cost(cost){}
    edge(int src, int to, T cost) :src(src),to(to),cost(cost){}edge
    &operator=(const int &x){
        to =x;
        return *this;
    }
    operator int() const{ return to;}
};



int main() {
    int a,b;cin>>a>>b;
    
    vector<ll> cumsum;
    cumsum.push_back(0);
    repsg(i,1,1000){
        cumsum.push_back(cumsum.back()+i);
    }
    int diff = b-a;
    
    cout<<cumsum[diff]-b<<endl;
    
    
    

    return 0;
}







Measured memory_bytes: 256
function main()
    N = parse(Int,readline())
    a = map(x -> parse(Int,x), split(readline()))
    sort!(a,rev = true)
    Alice = 0
    Bob = 0
    for i in 1:N
        if isodd(i)
            Alice += a[i]
        else
            Bob += a[i]
        end
    end
    
    println("$(Alice - Bob)")
end

main()

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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
  string t;cin>>t;
  int i;
  rep(i,t.size())
  {
    if(t[i]=='?')cout<<'D';
    else cout<<t[i];
  }
  cout<<endl;
}


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

int main(){
    int N, L;
    cin >> N >> L;
    vector<string> S(N);
        
    for(int i=0; i<N; i++){
	cin >>S[i];
    }

    sort(S.begin(), S.end());
    for(int i=0; i<N; i++){
	cout <<S[i];
    }
    cout <<endl;

    
}


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

using namespace std;

#define V_MAX 100010

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

	int odd[V_MAX] = { };
	int even[V_MAX] = { };

	for (int i = 0; i < n; i++) {
		if (i % 2 == 0) {
			even[v[i]]++;
		} else {
			odd[v[i]]++;
		}
	}

	int oddMaxIndex, evenMaxIndex;
	oddMaxIndex = evenMaxIndex = 0;
	int oddSecondMaxIndex, evenSecondMaxIndex;
	oddSecondMaxIndex = evenSecondMaxIndex = 0;

	for (int i = 1; i < V_MAX; i++) {
		if (even[evenMaxIndex] < even[i]) {
			evenSecondMaxIndex = evenMaxIndex;
			evenMaxIndex = i;
		} else if (even[evenSecondMaxIndex] < even[i]) {
			evenSecondMaxIndex = i;
		}
		if (odd[oddMaxIndex] < odd[i]) {
			oddSecondMaxIndex = oddMaxIndex;
			oddMaxIndex = i;
		} else if (odd[oddSecondMaxIndex] < odd[i]) {
			oddSecondMaxIndex = i;
		}
	}

	if (oddMaxIndex == evenMaxIndex) {
		int second = max(odd[oddMaxIndex] + even[evenSecondMaxIndex],
				 odd[oddSecondMaxIndex] + even[evenMaxIndex]);
		cout << n - second << endl;
	} else {
		cout << n - odd[oddMaxIndex] - even[evenMaxIndex] << endl;
	}

	return 0;
}


Measured memory_bytes: 1536
import java.util.*;

public class Main {
    private static final Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        if (calc()) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
    
    private static boolean calc() {
        // ???????????¶?¨????
        int w = sc.nextInt();
        int h = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int r = sc.nextInt();
        // ??´??????????????¢????????????????????????????????????
        if (r*2 > w || r*2 > h) return false;
        // x???????????§???????????????????????????????????§??????
        if (x < r || w - r < x) return false;
        // y???????????§???????????????????????????????????§??????
        if (y < r || h - r < y) return false;
        // ??????????????????????????£????????§OK
        return true;
    }
}

Measured memory_bytes: 26268
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws IOException {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    int readInt = Integer.parseInt(reader.readLine());
    System.out.println((int) Math.pow(readInt, 3));
  }
  
}

Measured memory_bytes: 17012