akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)

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

int main()
{
	while (1)
	{
		int N, M; cin >> N >> M;
		if (N == 0) return 0;
		vector<pii> PD;
		rep(i, 0, N)
		{
			int d, p; cin >> d >> p;
			PD.push_back(pii(p, d));
		}
		sort(PD.begin(), PD.end(), greater<pii>());

		ll ans = 0;
		rep(i, 0, N)
		{
			if (M == 0)
			{
				ans += PD[i].first * PD[i].second;
				continue;
			}

			if (PD[i].second <= M)
			{
				M -= PD[i].second;
				continue;
			}

			ans += (PD[i].second - M) * PD[i].first;
			M = 0;
		}

		cout << ans << endl;
	}
}

Measured memory_bytes: 3208
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    let input: Vec<i32> = buf.trim().split_whitespace().map(|c| c.parse().unwrap()).collect();
    let n = input[0];
    let a = input[1];
    let b = input[2];

    println!("{}", std::cmp::min(n * a, b));
}


Measured memory_bytes: 4352
long m,r=1e9,l=-1,c,s,i,N,a[1<<17];
main(){
	for(;~scanf("%d",a+i++););
	for(;r-l>1;c>*a*(*a+1)/4?r=m:(l=m)){
		int b[2<<17]={};
		m=l+r>>1;b[s=*a]=1;
		for(N=c=i=0;i<*a;b[s]++)c+=N+=a[++i]>m?-b[++s]:b[s--];
	}
	printf("%d",r);
}

Measured memory_bytes: 1920
#include <cstdio>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;

char buf[200000+10];
int cs[200000+10];

int main(void) {
  int n;
  scanf("%d%s", &n, buf);
  REP(i, n) {
    cs[i+1] = cs[i] + (buf[i] == '.');
  }
  int res = n - cs[n];
  REP(i, n) {
    int cur = 0;
    cur += cs[n] - cs[i]; // i以上を黒に
    cur += i - cs[i]; // i未満を白に
    res = min(res, cur);
  }
  cout << res << endl;
  return 0;
}



Measured memory_bytes: 1280
// organize and work - Abhinav IIITA
#include <bits/stdc++.h>
using namespace std;
#define int long long 
void q1(){
	string s;	cin>>s;
	if(s[0]=='S'){cout<<"Cloudy\n";
				} else if(s[0]=='C'){cout<<"Rainy\n";
			} else{
				cout<<"Sunny\n";}
}
void q2(){
	string s;
	cin>>s;
	for(int i=0;i<(int)s.size();++i){
		if(i%2==0 && s[i]=='L'){
			cout<<"No\n";
			return ;
		} else if(i%2==1 && s[i]=='R'){
			cout<<"No\n";
			return ;
		}
	}
	cout<<"Yes\n";
}
void q3(){
	int n,k,q;
	cin>>n>>k>>q;
	int fre[n]={0};
	int cpy=q;
	while(cpy--){
		int t;	cin>>t;
		t--; 	fre[t]++;
	}
	for(int i=0;i<n;++i){
		int score=k-(q-fre[i]);
		score > 0 ? cout<<"Yes\n" : cout<<"No\n";
	}
}
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;//cin>>t;
	t=1;
	while(t--)
	q3();
	return 0;
}


Measured memory_bytes: 1408
N = int(input())
S = [input() for _ in range(N)]
M = int(input())
T = [input() for _ in range(M)]

cnt = 0

for s in set(S):
    score = S.count(s) - T.count(s)
    if score > cnt:
        cnt = score
        
print(cnt)
        
        
    

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

int main(){
 int n;
  cin >> n;
  long long int ans=0;
  for(int i = 1;i <= n; i++){
   ans+=i;
   if(i%3==0||i%5==0){
    ans-=i; 
   }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3160
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int s = sc.nextInt();
		int ans = 0;
		
		for(int i=0; i<=k; i++) {
			for(int j=0; j<=k; j++) {
              if (s - (i + j) <= k && 0 <= s - (i + j)){
                  ans++;
               }
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

int main() {
    int n, k;
    cin >> n >> k;
    Int sm[n+2];
    sm[0] = 0;
    // su[0] = 0, su[1] = 0, su[2] = 1, ...
    rep(i,n+1) {
        sm[i+1] = (sm[i] + i) % MOD;
    }
    Int ans = 0;
    for (int i = k; i <= n+1; i++) {
        Int mn = sm[i];
        Int mx = sm[n+1] - sm[n-i+1];
        ans += mx - mn + 1;
        ans %= MOD;
    }
    if (ans < 0) ans += MOD;
    cout << ans << endl;
}

Measured memory_bytes: 5096
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>
#include <set>

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

const ll MOD = 1e9 + 7;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define fr first
#define sc second

bool bpr[100010];

void sieve(int n) {
	for (int i = 0;i <= n;i++)bpr[i] = true;
	bpr[0] = bpr[1] = false;
	for (int i = 2;i <= n;i++) {
		if (bpr[i]) for (int j = i * 2;j <= n;j += i)bpr[j] = false;
	}
}

int main() {
	int n, a[1000000];
	cin >> n;
	vector<int>v(20000);
	bool b[100010] = { 0 };
	sieve(70000);
	int cnt = 0;
	for (int i = 2;i <= 55555;i++) {
		if (bpr[i] && i % 10 == 1) {
			a[cnt] = i;
			cnt++;
		}
	}
	for (int i = 0;i < n;i++)cout << a[i] << endl;
}


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

int main()
{
    int N;
    cin >> N;
    vector<int> d(N);
    for (int i = 0; i < N; i++)
    {
        cin >> d.at(i);
    }
    
    int res = 0;
    for (int i = 0; i < N; i++)
    {
        for (int j = i + 1; j < N; j++)
        {
            res += d.at(i) * d.at(j);
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3592
#include "bits/stdc++.h"
using namespace std;

#define pb push_back
#define mp make_pair
#define F(i, a, n, b) for(int i=a;i<n;i+=b)
#define REVF(i, a, b, c) for(int i=a;i>=b;i-=c)
#define REP(i, n) F(i, 0, n, 1)
#define REP1(i, n) F(i, 1, n+1, 1)
#define REV(i, n) REVF(i, n, 0, 1)
#define PTR(it, x) for(auto it=x.begin();it!=x.end();++it)
#define MOD 1000000007

typedef long long ll;

const int MAX = 3e6 + 5;

int n;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin>>n;
	if(n <= 81){
		bool f = 0;
		for(int i=9;i>=1;i--){
			if(n % i == 0 && n / i <= 9){
				f = 1;
				break;
			}
		}
		if(f)
			cout<<"Yes";
		else
			cout<<"No";
	}
	else
		cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#powは繰り返し2乗法により指数計算を行う関数
mod=10**9+7
n,a,b=map(int,input().split())

ans=pow(2,n,mod)-1 #n種類の花を使って花束を作る総数は2^n-1通り

comb1=1 #nCaの計算
for i in range(n-a+1,n+1): #n*(n-1)*…*(n-a+1)を計算
    comb1*=i
    comb1%=mod
for i in range(1,a+1): #1/a!=1/(1*2*…*a)=1^(p-2)*2^(p-2)*…*a^(p-2) (p=10**9+7)を計算
    comb1*=pow(i,mod-2,mod) # iの逆元 →　1/iした際に かける(iの逆元)とすればあまりが求まる
    comb1%=mod

comb2=1
for i in range(n-b+1,n+1): #n*(n-1)*…*(n-b+1)を計算
    comb2*=i
    comb2%=mod
for i in range(1,b+1): #1/b!=1/(1*2*…*b)=1^(p-2)*2^(p-2)*…*b^(p-2) (p=10**9+7)を計算
    comb2*=pow(i,mod-2,mod)
    comb2%=mod

ans-=(comb1+comb2) #nCa、nCbを総数から引く
ans%=mod
print(ans)


Measured memory_bytes: 9144
#include <stdio.h>
#include <string.h>
#define MAXN 10010
double v,e,f,b;
int dis[MAXN];
double dp[MAXN],time[MAXN];
int r,n;
void calc()
{
    int i;
    memset(time,0,sizeof time);
    for (i = 0; i <= dis[n]+1; i++)
    {
        double tmp;
        if (i >= r) tmp = 1.0 / (v - e * (i - r));
        else tmp = 1.0 / (v - f * (r - i));
        time[i+1] = time[i] + tmp;
    }
}

int main() {
    while (scanf("%d", &n) && n)
    {
        memset(dp,0,sizeof dp);
        memset(dis,0,sizeof dis);
        for (int i = 1; i <= n; i++)
            scanf("%d", &dis[i]);
        scanf("%lf",&b);
        scanf("%d%lf%lf%lf",&r,&v,&e,&f);
        calc();
        double min;

        for(int i = 1; i <= n; i++)
        {
            double tmp;
            min = 10000000000;
            for(int j = 0; j < i; j++)
                if ((tmp = dp[j] + time[dis[i] - dis[j]]) < min)
                    min = tmp;
            dp[i] = min + b;
        }
        printf("%.4lf\n", dp[n] - b);
    }
}

Measured memory_bytes: 1288
#include<bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

template<class Ty>
using passive_queue = priority_queue<Ty, vector<Ty>, greater<Ty>>;

struct Problem {

	void Solve() {
		string S; cin >> S;
		UL N = S.size();
		string T = S;
		reverse(T.begin(), T.end());
		if (T != S) { cout << "No" << endl; return; }
		reverse(T.begin(), T.begin() + ((N - 1) / 2));
		reverse(T.begin() + ((N + 1) / 2), T.end());
		if (T != S) { cout << "No" << endl; return; }
		cout << "Yes" << endl;
	}

	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}


Measured memory_bytes: 256
# 問題：https://atcoder.jp/contests/abc176/tasks/abc176_c

n = int(input())
a = list(map(int, input().strip().split()))
res = 0
for i in range(n-1):
    if a[i] <= a[i+1]:
        continue
    res += a[i] - a[i+1]
    a[i+1] = a[i]
print(res)



Measured memory_bytes: 32260
//??????????????????
#include<queue>
#include<string>
#include<iostream>
using namespace std;

int main(){
    string cmd;
    int x;
    priority_queue<int> Q;
    while(cin>>cmd&&cmd!="end"){
        if(cmd=="insert"){
            cin>>x;
            Q.push(x);
        }
        else if(cmd=="extract"){
            cout<<Q.top()<<"\n";
            Q.pop();
        }
    }
}

Measured memory_bytes: 7024
#from pprint import pprint
#from collections import deque
#from collections import defaultdict
#from collections import Counter
#from copy import deepcopy
#from itertools
#from bisect import bisect_right #二分探索用のモジュール bisect_right(a_list,value)

#import sys 
#sys.setrecursionlimit(N) #N回まで再起を許可する。


# = int(input())

# = map(int,input().split())

# = list(map(int,input().split()))

# = [list(map(int,input().split())) for _ in range(XXXX)]

a,b = map(int,input().split())

print(a*b)


Measured memory_bytes: 61536
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#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;

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

int a, b, c;

int main() {
  cin >> a >> b >> c;
  if (a + b + c >= 22)
    cout << "bust";
  else
    cout << "win";
}


Measured memory_bytes: 3624
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  int A, B; cin >> A >> B;
  vector<string> C(100);
  for (int i = 0; i < 50; ++i) {
    C[i] = string(100, '.'); // White
  }
  for (int i = 50; i < 100; ++i) {
    C[i] = string(100, '#'); // Black
  }

  --A, --B;

  for (int i = 0; i < 50 && B > 0; i += 2) {
    for (int j = 0; j < 100 && B > 0; j += 2) {
      C[i][j] = '#'; --B;
    }
  }
  for (int i = 99; i > 50 && A > 0; i -= 2) {
    for (int j = 0; j < 100 && A > 0; j += 2) {
      C[i][j] = '.'; --A;
    }
  }

  cout << 100 << " " << 100 << endl;
  for (auto s : C) cout << s << endl;
}


Measured memory_bytes: 3636
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let h: usize = input();
    let w: usize = input();
    let mut c: Vec<Vec<i32>> = (0..10)
        .map(|_| (0..10).map(|_| input()).collect())
        .collect();
    let a: Vec<Vec<i32>> = (0..h).map(|_| (0..w).map(|_| input()).collect()).collect();

    for k in 0..10 {
        for i in 0..10 {
            for j in 0..10 {
                c[i][j] = std::cmp::min(c[i][j], c[i][k] + c[k][j]);
            }
        }
    }

    let mut ans = 0;
    for i in 0..h {
        for j in 0..w {
            if a[i][j] >= 0 {
                ans += c[a[i][j] as usize][1];
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Math;
using static System.Array;
using static AtCoder.Tool;

namespace AtCoder
{
    class AC
    {
        const int MOD = 1000000007;
        const int INF = int.MaxValue / 2;
        const long SINF = long.MaxValue / 2;
        const double EPS = 1e-8;
        static readonly int[] dx = { 0, 1, 0, -1 };
        static readonly int[] dy = { 1, 0, -1, 0 };

        

        static void Main(string[] args)
        {
            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);
            var cin = new Scanner();

            var s = Console.ReadLine();
            var t = Console.ReadLine();
            List<List<int>> c = new List<List<int>>();
            for (var i = 0; i < 26; i++) c.Add(new List<int>());

            int L = s.Length;
            for(var i = 0; i < L; i++)
            {
                c[s[i] - 'a'].Add(i);
            }

            long ans = 0;
            int cur = -1;
            for(var i = 0; i < t.Length; i++)
            {
                int ch = t[i] - 'a';
                if (c[ch].Count() == 0)
                {
                    Console.WriteLine(-1);
                    return;
                }
                int l = -1;
                int r = c[ch].Count();
                while (r - l > 1)
                {
                    int mid = (l + r) / 2;
                    if (c[ch][mid] > cur)
                    {
                        r = mid;
                    }
                    else
                    {
                        l = mid;
                    }
                }
                if (r != c[ch].Count())
                {
                    ans += c[ch][r] - cur;
                    cur = c[ch][r];
                }
                else
                {
                    ans += (L - cur - 1) + c[ch][0] + 1;
                    cur = c[ch][0];
                }
                
            }

            Console.WriteLine(ans);
            

            //Console.Out.Flush();

        }
    }


    public class Scanner
    {
        public int[] SplitRead()
        {
            int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return array;
        }
        public long[] SplitReadL()
        {
            long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return array;
        }
    }
    public static class Tool
    {
        static public void Initialize<T>(ref T[] array, T initialvalue)
        {
            for (var i = 0; i < array.Length; i++)
            {
                array[i] = initialvalue;
            }
        }
    }

}


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

using namespace std;
typedef long long int ll;

#define INF (1e9)

int main() {
    int N;
    cin >> N;
    vector<int> h(N), dp(N);

    for (int i = 0; i < N; i++) {
        cin >> h[i];
    }

    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    for (int i = 2; i < N; i++) {
        dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]),
                    dp[i - 1] + abs(h[i] - h[i - 1]));
    }

    cout << dp[N - 1] << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;

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

class UnionFindTree{
    public:
    ll size;
    // parent, if par[x] = x means root
    vector<ll> par;
    vector<ll> rank;
    vector<ll> num;

    UnionFindTree(ll n){
        size = n;
        par = vector<ll>(n);
        rank = vector<ll>(n);
        num = vector<ll>(n);

        for(ll i=0;i<size;i++){
            par[i] = i;
            rank[i] = 0;
            num[i] = 1;
        }
    }

    // get the root of the tree
    ll find(ll x){
        if(par[x] == x) return x;
        else return par[x] = find(par[x]);
    }

    void unite(ll x, ll y){
        x = find(x);
        y = find(y);
        if(x == y) return;

        if(rank[x] <= rank[y]){
            num[y] += num[x];
            par[x] = y;
        }else{
            num[x] += num[y];
            par[y] = x;
            if(rank[x] == rank[y]) rank[x]++;
        }
    }

    bool same(ll x, ll y){
        return find(x) == find(y);
    }

    ll getnum(ll x){
        ll p = find(x);
        return num[p];
    }
};

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ll n, m; cin >> n >> m;
    vector<pair<ll, ll> > edges;
    vector<ll> ans(m);
    UnionFindTree graph = UnionFindTree(n);
    for(int i=0;i<m;i++){
        ll a, b; cin >> a >> b;
        edges.push_back(make_pair(--a, --b));
    }
    ll total = n * (n - 1) / 2;
    ll connected = 0;
    ans[m-1] = total;
    for(int i=m-1;i>=1;i--){
        ll x = edges[i].first, y = edges[i].second;
        if(graph.same(x, y)){
            ans[i-1] = ans[i];
        }else{
            ll px = graph.getnum(x), py = graph.getnum(y);
            graph.unite(x, y);
            ll nxy = graph.getnum(y);
            ll numx = px * (px - 1) / 2;
            ll numy = py * (py - 1) / 2;
            ll numxy = nxy * (nxy - 1) / 2;
            connected = connected - numx - numy + numxy;
            ans[i-1] = total - connected;
        }
    }
    for(ll a: ans) cout << a << endl;
}

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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)


int main() {
	cin.sync_with_stdio(false);
	int N;
	cin >> N;
	cout << (N / 100 == N % 10 ? "Yes" : "No") << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef istringstream ISS;
typedef ostringstream OSS;
typedef vector<string> VS;
typedef int INT;
typedef vector<INT> VI;
typedef vector<VI> VVI;
typedef pair <INT, INT> II;
typedef vector <II> VII;

template<class T> ostream& operator << ( ostream& os, vector<T> v ) {
    for ( typename vector<T>::iterator it_i = v.begin(); it_i != v.end(); ++it_i ) {
        os << *it_i << ", ";
    }
    return os;
}


const int SIZE = 10000000;
VI P;
bool isPrime[SIZE];

int main() {
    fill( isPrime, isPrime, false );
    for ( int i = 3; i < SIZE; i += 2 ) {
        isPrime[i] = true;
    }
    P.push_back(2);
    for ( int i = 3; i < SIZE; i += 2 ) {
        if ( ! isPrime[i] ) continue;
        P.push_back(i);
        for ( int j = i+i; j < SIZE; j += i ) {
            isPrime[j] = false;
        }
    }
    
    int n;
    while ( cin >> n && n ) {
        while ( n ) {
            if ( isPrime[n-8] && isPrime[n-6] && isPrime[n-2] && isPrime[n] ) {
                cout << n << endl;
                break;
            }
            n --;
        }
    }
    return 0;
}

Measured memory_bytes: 13000
#include <stdio.h>

void up(double *a,int n) {
	int i,j,k;
	double x;
	for (i = 0; i < n; i++) {
		k = i;
		for (j = i + 1; j < n; j++) {
			if (a[k] > a[j]) {
				k = j;
			}
		}
		x = a[i];
		a[i] = a[k];
		a[k] = x;
	}
}

int main(void) {

	double a[50];
	int n, i, j;

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

	for (i = 0; i < n - 1; i++) {
		a[i + 1] =(a[i] + a[i + 1]) / 2.0;
		a[i] = 0;
		up(a, n);
		}
  
	printf("%lf", a[n - 1]);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include<queue>
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef pair<double,double> Pdouble;

const int INF = 2000000000;
const int MOD = 1000000007;

const int MAX_N = 2010;
const int MAX_M = 2010;
ll d[MAX_N][MAX_M + 1];

void warshall_floyd(int n) {
  for (int k = 1; k <= n; k++){       // 経由する頂点
    for (int i = 1; i <= n; i++) {    // 始点
      for (int j = 1; j <= n; j++) {  // 終点
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
      }
    }
  }
}

int main() {
  ll n,x,y;
  cin >> n >> x >> y;

  ll s = y-x;

  for(int i=1; i<=n; i++){
    for(int j=1; j<=n; j++){
      d[i][j] = 0;
    }
  }
  for(int i=1; i<=n-1; i++){
    for(int j=i+1; j<=n; j++){
      ll pi = abs(i-x);
      ll pj = abs(j-y);
      ll m,n;
      m = pi+pj+1;
      n = j-i;
      d[i][j] = min(m,n);
    }
  }

  vector<ll> kyori(n,0);
  for(int i=1; i<=n-1; i++){
    for(int j=i+1; j<=n; j++){
      kyori.at(d[i][j])++;
    }
  }
  
  /*for(int i=1; i<=n; i++){
    for(int j=1; j<=n; j++){
      cout << d[i][j] << " ";
    }
    cout << endl;
  }*/

  for(int i=1; i<=n-1; i++){
    cout << kyori.at(i) << endl;
  }

}

Measured memory_bytes: 31744
#include <iostream>
using namespace std;
int main(void){
    int a,b;
    cin>>a>>b;
    if(a%3==0||b%3==0||(a+b)%3==0){
        cout<<"Possible"<<endl;
    }else{
        cout<<"Impossible"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
def check(grid):
	bingo=False
	#row
	for i in range(3):
		count=0
		for j in range(3):
			if grid[i][j]==1:
				count+=1
		if count==3:
			bingo=True
	#col
	for i in range(3):
		count=0
		for j in range(3):
			if grid[j][i]==1:
				count+=1
		if count==3:
			bingo=True
	#left diag
	count=0
	for i in range(3):
		if grid[i][i]==1:
			count+=1
	if count==3:
		bingo=True
	#right diag
	count=0
	for i in range(3):
		if grid[i][2-i]==1:
			count+=1
	if count==3:
		bingo=True
		
	return bingo
		
pos={}
for i in range(3):
	temp=list(map(int,input().split(' ')))
	for j,t in enumerate(temp):
		pos[t]=[i,j]
grid=[[0 for i in range(3)] for j in range(3)]

n=int(input())
for i in range(n):
	t=int(input())
	if t in pos.keys():
		r,c=pos[t]
		grid[r][c]=1
bingo=check(grid)

if bingo:
	print("Yes")
else:
	print("No")

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

#define ll long long int
#define floop(i,a,b) for(ll i=a;i<b;i++)
#define all(v) v.begin(),v.end()
int solve(){
 
   unsigned long long int n; cin>>n;
   ll cnt=0;
   ll amt = 100;
   while(amt<n){
    cnt++;
    amt = amt + (amt * 1 * 1 )/100;

   }
   cout<<cnt<<endl;

return 0;
}

int main()
{ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); 

    ll t; t=1;
    //cin>>t;

    while(t--)
       solve();
    return 0;
}

Measured memory_bytes: 3664
n=int(input())
nx=0
ny=0
nt=0
for i in range(n):
  t,x,y=map(int,input().split())
  k=abs(x-nx)+abs(y-ny)
  if k>t-nt:
    print("No")
    exit()
  elif k%2 != (t-nt)%2:
    print("No")
    exit()
  nt,nx,ny=t,x,y
print("Yes")


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
//const int MAX=;

int main(){
	int N;
	cin>>N;
	int mx,mn;
	cin>>mx;
	mn=mx;
	rep(i,N-1){
		int k;
		cin>>k;
		mx=max(mx,k);
		mn=min(mn,k);
	}
	cout<<mx-mn;
}

Measured memory_bytes: 384
#include<stdio.h>
int main(){
	int i,j,a[4], b[4],blow=0,hit=0,tmp=11;
	for(;scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3])!=EOF&&scanf("%d %d %d %d",&b[0],&b[1],&b[2],&b[3]);blow=0,hit=0){
		for(i=0;i<4;i++){
			if(a[i]==b[i]){
				a[i]=tmp++;
				b[i]=tmp++;
				hit++;
			}
		}
		for(i=0;i<4;i++){
			for(j=0;j<4;j++){
				if(a[i]==b[j])blow++;
			}
		}
		printf("%d %d\n",hit,blow);
	}
	return 0;
}

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


template <typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
    if (v.size()) {
        os << v.front();
        for (auto vi = v.begin() + 1; vi != v.end(); vi++)
            os << " " << *vi;
    }
    return os;
}

struct Paper{

    vector<vector <int>> paper;

    Paper() {
        paper = vector<vector <int>>(10, vector<int>(10, 0));
    }

    void display() {
        for (auto line : paper)
            cout << line << endl;
    }

    void output() {
        int max_value = 0;
        int density_zero = 0;

        for (auto y : paper)
            for (auto x : y)
                if (x == 0)
                    density_zero++;
                else
                    max_value = max(max_value, x);
        cout << density_zero << endl;
        cout << max_value << endl;
    }

    void drop(int x, int y, int size)
    {
        switch (size) {
        case 3:
            put(x + 2, y);
            put(x, y + 2);
            put(x - 2, y);
            put(x, y - 2);
        case 2:
            put(x + 1, y + 1);
            put(x + 1, y - 1);
            put(x - 1, y + 1);
            put(x - 1, y - 1);
        case 1:
            put(x + 1, y);
            put(x, y + 1);
            put(x - 1, y);
            put(x, y - 1);
        }

        put(x, y);
    }

private:
    void put(int x, int y)
    {
        if (0 <= x && x < paper[0].size() &&
            0 <= y && y < paper.size())
            paper[y][x]++;
    }
};


int main()
{
    Paper paper;
    char comma;

    for (int x, y, size; cin >> x >> comma >> y >> comma >> size;)
        paper.drop(x, y, size);

    // paper.display();
    paper.output();

    return 0;
}

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

using namespace std;
static const int MAX = 1000;
static const int VMAX = 10000;
int n, A[MAX], s;
int B[MAX], T[VMAX + 1];

int solve();

int main()
{
  cin >> n;
  s = VMAX;
  for (int i = 0; i < n; i++)
  {
    cin >> A[i];
    s = min(s, A[i]);
  }
  cout << solve() << endl;
  return 0;
}

int solve()
{
  int ans = 0;
  bool V[MAX];
  for (int i = 0; i < n; i++)
  {
    B[i] = A[i];
    V[i] = false;
  }
  sort(B, B + n);
  for (int i = 0; i < n; i++)
  {
    T[B[i]] = i;
  }
  for (int i = 0; i < n; i++)
  {
    if (V[i])
    {
      continue;
    }
    int cur = i, S = 0, m = VMAX, an = 0;
    while (1)
    {
      V[cur] = true;
      an++;
      int v = A[cur];
      m = min(m, v);
      S += v;
      cur = T[v];
      if (V[cur])
      {
        break;
      }
    }
    ans += min(S + (an - 2) * m, m + S + (an + 1) * s);
  }
  return ans;
}



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

namespace ABC118
{
    public class D
    {
        int INF = 1000000000;
        public void Solve()
        {
            string[] s = Console.ReadLine().Split(' ');
            int N = int.Parse(s[0]);
            int M = int.Parse(s[1]);
            int[] A = new int[M];
            string[] As = Console.ReadLine().Split(' ');
            for (int i = 0; i < M; i++) { A[i] = int.Parse(As[i]); }
            A = A.OrderByDescending(x => x).ToArray();

            int[] dp = new int[N + 1];
            dp[0] = 0;
            int[] num = new int[9] {2, 5, 5, 4, 5, 6, 3, 7, 6};

            for (int i = 1; i < N + 1; i++)
            {
                int max = -INF;
                for (int j = 0; j < A.Length; j++)
                {
                    if (i - num[A[j] - 1] >= 0)
                    {
                        max = Max<int>(max, dp[i - num[A[j] - 1]] + 1);
                    }
                }
                dp[i] = max;
            }
            int Nc = N;
            for (int i = 0; i < dp[N]; i++)
            {
                for (int j = 0; j < A.Length; j++)
                {
                    if (Nc - num[A[j] - 1] >= 0 && dp[Nc - num[A[j] - 1]] == dp[Nc] - 1)
                    {
                        Console.Write("{0}", A[j]);
                        Nc -= num[A[j] - 1];
                        break;
                    }
                }
            }
            Console.Write("\n");
        }

        T Min<T>(params T[] nums) where T : IComparable
        {
            if (nums.Length == 0) { return default(T); }

            T min = nums[0];
            for (int i = 0; i < nums.Length; i++) { min = (min.CompareTo(nums[i]) < 0) ? min : nums[i]; }

            return min;
        }

        T Max<T>(params T[] nums) where T : IComparable
        {
            if (nums.Length == 0) { return default(T); }

            T max = nums[0];
            for (int i = 0; i < nums.Length; i++) { max = (max.CompareTo(nums[i]) > 0) ? max : nums[i]; }

            return max;
        }
    }
}

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new ABC118.D().Solve();
        }
    }
}

Measured memory_bytes: 17440
import numpy as np

N = int(input())


#@njit
def main(n):
    dp = []
    for i in range(10**5+1):
        dp.append(i)
    dp = np.array(dp)
    powers = [1]
    i = 1
    while True:
        if 6**i>10**5:
            break
        powers.append(6**i)
        if 9**i<=10**5:
            powers.append(9**i)
        i += 1
    powers.sort()
    for i in range(1,10**5+1):
        for j in range(len(powers)):
            if powers[j]>i:
                break
            dp[i] = min(dp[i],dp[i-powers[j]]+1)

    print(dp[n])            

if __name__=="__main__":
    main(N)

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

int main(){
  long double W,H,x,y,S;
  cin>>W>>H>>x>>y;
  S=W*H/2;
  std::cout<<std::fixed;
  if(2*x==W&&2*y==H)
    std::cout<<std::setprecision(9)<<S<<" "<<1<<endl;
  
  else
    std::cout<<std::setprecision(9)<<S<<" "<<0<<endl;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
 
/*************************** MACROS **************************/
#define itn int
#define ld long double
#define ll long long  
#define ull unsigned long long
#define vll vector<ll>
#define pb push_back
#define mp make_pair
#define S second
#define F first
#define loop(i,x,y) for(ll i=x;i<y;i++)
#define rloop(i,x,y) for(ll i=x;i>=y;i--)
#define W(x) while(x--)
#define pll pair< ll,ll >
#define vpll vector< pll >
#define pqll priority_queue<ll>
#define pqpll priority_queue<pll>
#define MOD 1000000007
#define MOD1 998244353
#define MIN_LL -1e18
#define MAX_LL 1e18
#define MAX_INT 1e9
#define MIN_INT -1e9
#define Line cout<<"\n**************************\n\n";
 
 
using namespace std;
 
/*************************** VARIABLES **************************/
 
bool br1,br2,br;

ll n,k,x,y,z,mini,maxi,l,ind,ini,sum,t,len,r,q,m,imini,w;

string s,s1,s2;


/**************************** FXNS ****************************/


void solve(){

	cin>>n;

	cout<<(n*n*n)<<endl;

}
 
/*************************** MAIN ****************************/
 
 int main(){


	/*#ifndef ONLINE_JUDGE
	        freopen("inputNaNtxt", "rt", stdin);
	        freopen("output.txt", "wt", stdout);
	#endif*/
 
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
 
    solve();

	return 0;
}

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

using namespace std;
/*
int find(int x, vector<int> &p) {
if (p[x] == x)return x;
return p[x] = find(p[x], p);
}

void uni(int x, int y, vector<int> &p) {
x = find(x, p);
y = find(y, p);
p[x] = y;
}

int same(int x, int y, vector<int> p) {
if (find(x, p) == find(y, p))return 1;
return 0;
}
*/

//long long a[1002];


int main()
{
	long long N, cnt = 0, tmp, ans = 0;

	cin >> N;

	for (int i = 1; i <= N; i += 2) {
		cnt = 1;
		tmp = 1;
		while (tmp <= N/2) {
			if (i%tmp == 0) cnt++;
			tmp += 2;
		}

		if (cnt == 8) ans++;
	}

	cout << ans;

	char qq;
	cin >> qq;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>    
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//using namespace __gnu_pbds; 
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cout<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endl "\n"
#define int long long 
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
const ll MOD     = 1000*1000*1000+7;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll MOD2    = 998244353;
const ll N       = 1000 * 100 + 10;
const ll N2      = 70;
const ld PI  = 3.141592653589793;
//template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);} 
ll power(ll x,ll y,ll p = LLONG_MAX ){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
ll lcm(ll a , ll b){return (a*b)/gcd(a,b);}

signed main()
{
    fastio();
    //cout<<fixed<<setprecision(20);
    //CHECK for LONG LONG and LONG DOUBLE
    //*comment for all except cc/cf    
    #ifndef ONLINE_JUDGE    
           freopen("input.txt","r",stdin);
           freopen("output.txt","w",stdout);
    #endif//*/
    int k;
    cin>>k;
    int cur = 7;
    int res =0;
    int ans= -1;
    for(int i = 1; i <=k ; i++)
    {
        res+=cur;
        res%=k;
        if(!res)
        {
            ans = i;
            break;
        }
        cur*=10;
        cur%=k;
    }
    cout<<ans;


    printclock;
    return 0;
}


Measured memory_bytes: 3796
using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
class ProgramD
    {
        static void Main(string[] args)
        {
            
            //入力
            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            int m = int.Parse(input[1]);
            int k = int.Parse(input[2]);
 
            int[] count = new int[n];
 
            UnionFind tree = new UnionFind();
 
            tree.par = new int[n];
            tree.temp = new int[n];
            tree.reset(n);
 
            for(int i = 0;i < m;i++)
            {
                string[] input2 = Console.ReadLine().Split(' ');
                int x = int.Parse(input2[0]);
                int y = int.Parse(input2[1]);
                tree.unite(x-1, y-1); // xの木とyの木を併合する
                count[x-1]--;
                count[y-1]--;
            }
        
            for(int i= 0;i< n;i++)
              count[i] += tree.size(i) - 1;
 
            for(int i = 0;i < k;i++)
            {
                string[] input3 = Console.ReadLine().Split(' ');
                int x = int.Parse(input3[0]);
                int y = int.Parse(input3[1]);
                if(tree.same(x-1,y-1) == true)
                {
                    count[x-1]--;
                    count[y-1]--;
                }
            }
 
            
 
            for(int i = 0;i < n;i++)
            {
                Console.Write(count[i]);
                Console.Write(" ");
            }
        }
    }
 
    class UnionFind
    {
 
        public int[] par;
        public int[] temp;
 
        public void reset(int n)
        {
            for(int i = 0;i < n;i++)
                par[i] = -1;
        }
        public int root(int x)
        {
            if(par[x] < 0)
                return x;
            else
                return root(par[x]);
        }
 
        public void unite(int x, int y)
        { // xとyの木を併合
            int rx = root(x); //xの根をrx
            int ry = root(y); //yの根をry
            if (rx == ry) 
                 return; //xとyの根が同じ(=同じ木にある)時はそのまま
            if(par[ry] > par[rx])
            {
                 int temp = ry;
                 ry = rx;
                 rx = temp;
            }
            par[ry] += par[rx];
            par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
        }
 
        public bool same(int x, int y) 
        { // 2つのデータx, yが属する木が同じならtrueを返す
            int rx = root(x);
            int ry = root(y);
            return rx == ry;
        }
        
        public int size(int x)
        {
            return -par[root(x)];
        }
      
        public int[] member(int n) 
        {
            for(int i = 0;i < n;i++)
            {
              int r = root(i);
              temp[r]++;
            }
            return temp;
        }
    }

Measured memory_bytes: 17436
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

#ifdef DEBUG
mt19937 mrand(300); 
#else
mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count()); 
#endif

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int n = (int) 2e5;
const int zero = n - 1;
const int maxb = 30;
int curc;
vector<pair<pair<char, int>, pair<int, int>>> ans;

void addOp(char op, int i, int j, int k) {
  ans.push_back(make_pair(make_pair(op, i), make_pair(j, k)));
}

int getAnd(int a, int b) {
  int sum = curc++;
  addOp('+', a, b, sum);
  int sum1 = curc++;
  addOp('<', zero, sum, sum1);
  int sum2 = curc++;
  addOp('<', sum1, sum, sum2);
  return sum2;
}

int getNot(int a, int b) {
  int res = curc++;
  addOp('<', a, b, res);
  return res;
}

void getPow(int a, int p) {
  for (int i = 0; i < p; ++i) {
    addOp('+', a, a, a);
  }
}

void getBit(int a, int c, int b, int bit) {
  int p = curc++;
  addOp('<', zero, a, p);
  getPow(p, bit);
  int nc = curc++;
  addOp('+', c, p, nc);
  int cmp = curc++;
  addOp('<', a, nc, cmp);
  int q = curc++;
  addOp('<', zero, a, q);
  int x = getNot(cmp, q);
  addOp('+', x, zero, b);
  getPow(x, bit);
  addOp('+', c, x, c);
}

void solve() {
  ans.clear();
  int a = 0, b = 1, res = 2;
  curc = 3;
  int ac = curc++;
  for (int i = maxb; i >= 0; --i) {
    int ba = curc++;
    getBit(a, ac, ba, i);
    int bc = curc++;
    for (int j = maxb; j >= 0; --j) {
      int bb = curc++;
      getBit(b, bc, bb, j);
      int x = getAnd(ba, bb);
      getPow(x, i + j);
      addOp('+', res, x, res);
    }
  }
  printf("%d\n", sz(ans));
  for (int i = 0; i < sz(ans); ++i) {
    printf("%c %d %d %d\n", ans[i].first.first, ans[i].first.second, ans[i].second.first, ans[i].second.second);
  }
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".out", "w", stdout));
#endif
  solve();
#ifdef DEBUG
  eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  return 0;
}


Measured memory_bytes: 5208
#include<bits/stdc++.h>
using namespace std;
bool xs(int x,int q,int p){
	int sum=0;
	for(int i=0;i<=5;i++){
		sum+=i;
		if(x==q){
			if(sum==p)
			return true;
		}
		else xs(x+1,q,p);
		sum-=i;
	}	
	return false;
} 
int main(){
	int x;
	cin>>x;
	if(x<100)
	cout<<0;
	else{
		int p=x%100; //每个数的余数之和 
		int q=x/100; //多少个数 
		if(p<=5*q)
		cout<<1;
		else
		cout<<0;                              //   0-5中选q个数（可重复）能否使和等于p 
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
const int maxn=1e6+10;
#define p 1000000007
int main(){
	fast;
	ll a,b,c,d; cin>>a>>b>>c>>d;
	cout<<max({a*c,a*d,b*c,b*d})<<'\n';
	return 0;
}
//period of a string(prefix-function) with KMP
//prime func
//subset production
//factorization
//modpow
//modinv ( a^(p-2)=a^(-1) (mod p) )
//sieve
//ncr
//euler totien func (co prime divisiors upto n)
//matrix exponentation(fast fibonacci)
//dsu
//Trees
//Graphs(dfs,bfs,shortes path etc.)
//DP-Recursion

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ll long long
#define lson l,mid,p<<1
#define rson mid+1,r,p<<1|1
#define pii pair<int,int>
using namespace std;
const int inf=1e9+10;
const int mod=1e9+7;
const int maxn=1e5+10;
int n,a[110];
int main(){
	//ios::sync_with_stdio(false);
	//freopen("in","r",stdin);
	cin>>n;
	int flag=1;
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
		if(a[i]&1) continue;
		if(a[i]%3==0||a[i]%5==0) continue;
		flag=0;
	}
	if(flag) puts("APPROVED");
	else puts("DENIED");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=100000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	int a,b,c;

	cin>>a;
	if(a==1){
		cout<<"Hello World"<<endl;
	}else{
		cin>>b;
		cin>>c;
		cout<<b+c<<endl;
	}




	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
using namespace std;

int INF = 1e9 + 7;

int main() {
    long S;
    int ans = 753;
    cin >> S;

    for (; S > 100; S /= 10) {
        int X = S % 1000;
        ans = min(ans, abs(753 - X));
    }

    cout << ans << endl;
    
}

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

int main(void) {
	double const pi = 3.141592653589;
	double r;

	cin >> r;

	cout << fixed << setprecision(6);
	cout << r * r * pi << " " << 2 * pi * r << endl;

	return 0;
}


Measured memory_bytes: 3260
n = int(input())
k = int((n*2)**(1/2))-1
for i in range(10):
    if (k+i)*(k+i-1)==n*2:
        k+=i
        break
if k*(k-1)!=n*2:
    print("No")
    exit()
print("Yes")
print(k)
tri = []

for i in range(1,k):
    tri.append([j for j in range(i*(i-1)//2+1,i*(i+1)//2+1)])
for i in range(k-1):
    print(k-1,end = " ")
    print(*tri[i],end=" ")
    for j in range(i+1,k-1):
        print(tri[j][i],end=" ")
    print()
print(k-1,end=" ")    
for i in range(k-1):
    print(tri[i][-1],end = " ")



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

//マクロ
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define REPS(i,n) for(int i=1; i<=(int)(n); ++i)
#define RREP(i,n) for(int i=(int)(n)-1; i>=0; --i)
#define RREPS(i,n) for(int i=(int)(n); i>0; --i)
#define FOR(i,s,e) for(int i=(int)(s); i<(int)(e); ++i)
#define RFOR(i,s,e) for(int i=(int)(e)-1; i>=(int)(s); --i)

#define All(a) (a).begin(),(a).end()

//定数
#define INF 1e9
#define MOD (int)(1e9+7)

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

//とりあえず書いておく変数
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

//今回の変数

//使用する関数
int gcd(int a, int b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}

int main()
{
	int n;
	int a[100];
	string s;

	cin >> n;
	cin >> a[0];
	int b = a[0];
	REPS(i, n - 1) {
		cin >> a[i];
		b = a[i]*b/gcd(b, a[i]);
	}
	//cout << b << endl;
	int sum = 0;
	REP(i, n) {
		sum += b / a[i];
	}
	double ans = (double)b / sum;
	printf("%.10f\n", ans);
}

Measured memory_bytes: 256
def I(): return int(input())
def LI(): return list(map(int,input().split()))
##################################################
N = I()
A = LI()
count = [0]*(N+1)
for x in A:
    count[x] += 1
nC2 = {}
sum = 0
for x in count:
    nC2[x] = x*(x-1)//2
    sum += nC2[x]
for x in count:
    if x-1 in nC2 or x==0:
        continue
    nC2[x-1] = (x-1)*(x-2)//2
for x in A:
    minus = nC2[count[x]]
    plus = nC2[count[x]-1]
    print(sum-minus+plus)

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

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

/*
 
 3/22/2020
 
 5:00-
 
 */

int N,M;

int f(int n) {
  return n*(n-1)/2;
}
void solve() {
  cout<<f(N)+f(M)<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>N>>M;
  solve();
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    int n,sum=0;
    cin>>n;
    int a[n+5]={0};
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    cout<<sum-n<<endl;
    return 0;
}



Measured memory_bytes: 3628