akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := NewScanner()
	N, A, B := sc.NextInt(), sc.NextInt(), sc.NextInt()

	fmt.Println(min(N*A, B))
}

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

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
using namespace std;
signed main(){
  string s;
  cin>>s;
  int a,b;
  rep(i,s.size()){
    if(s.at(i)=='A'){
      a=i;
  break;
  }
}
       for(int i=s.size()-1;-300000<i;i--){
         if(s.at(i)=='Z'){
           b=i;
         break;
         }
  }
  cout<<b-a+1;
}

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

int main() {
	ll n, k;
	cin >> n >> k;
	ll odd = 0;
	ll even = 0;
	if (k % 2 == 0) {
		for (ll i = 1;i <= n;++i) {
			ll K = k / 2;
			if (i % k == K)even += 1;
		}
	}
	for (ll i = 1;i <= n;++i) {
		if (i % k == 0)odd += 1;
	}
	if (k % 2 == 0)cout << even * even * even + odd * odd * odd << endl;
	else cout << odd * odd * odd << endl;
}

Measured memory_bytes: 256
line = input().rstrip().split(' ')
k = int(line[0])
n = int(line[1])

line = input().rstrip().split(' ')
a = [0] * n
for i in range(n):
    a[i] = int(line[i])

ans = 1000000
for i in range(n):
    if i - 1 > -1:
        tmp1 = k - a[i] + a[i - 1]
    else:
        tmp1 = a[n - 1] - a[i]

    if i < n - 1:
        tmp2 = k - a[i + 1] + a[i]
    else:
        tmp2 = a[i] - a[0] 

    ans = min(ans, tmp1, tmp2)

print(ans)

Measured memory_bytes: 26292
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <complex>
#include <bitset>
#include <chrono>
#include <random>
using namespace std;

#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define eb emplace_back
#define el '\n'
typedef  long long  ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<bool> vb;


//const int mod=1000000007;
const int mod=998244353;

vvi adj;
vb mark;
vi ans;


void recur(int u,int p){
    mark[u]=true;
    for(auto it: adj[u]){
        if(!mark[it]){
            recur(it,u);
        }
    }
    for(auto it: adj[u]){
        if(it!=p){
            ans[u]=max(ans[u],ans[it]+1);
        }
    }
}

int main()
{   ios_base::sync_with_stdio(false);cin.tie(NULL);
    ll t,n,m,k,q,x,a,b,c,d,y,l,r;
    cin >> n >> m;
    vi in(n+1);
    adj.resize(n+1);
    ans.resize(n+1);
    mark.resize(n+1);
    for(int i=0; i<m; i++){
        cin >> a >> b;
        adj[b].pb((int)a);
        in[a]++;
    }
    for(int i=1 ; i<=n; i++){
        if(in[i]==0){
            recur(i,i);
        }
    }
    cout << *max_element(all(ans)) << el;
    return 0;
}


Measured memory_bytes: 14336
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;

#define io ios_base::sync_with_stdio(false)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vll vector<long long>
#define pb push_back
#define mod  998244353
#define pii pair<int, int>
#define PI 2*acos(0.0)
#define forn(i, n) for(int i = 0; i < n; i++)

int main()
{
    io;
    int n;
    cin>>n;
    vi pos(n);
    for(auto& x: pos)
        cin>>x;
    int dp[n];
    dp[0] = 0; dp[1] = abs(pos[1] - pos[0]);
    for(int i = 2; i < n;i++)
        dp[i] = min(abs(pos[i] - pos[i-1]) + dp[i-1], abs(pos[i] - pos[i-2]) + dp[i-2]);
    cout<<dp[n-1];
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using lli = long long;
#define rep(i,n) for(int i=0;i<n;i++)
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; }

lli n;
const lli m = 3500;

int main(void){
    cin >> n;
    for(lli i = 1; i <= m; i++){
        for(lli j = 1; j <= m; j++){
            if(4*m*i*j <= n*(i*j+j*m+m*i)) continue;
            lli l, r, mid;
            l = 1; r = 1e9;
            while(r-l > 1){
                mid = (l+r)/2;
                if(4*mid*i*j >= n*(i*j+j*mid+mid*i)){
                    r = mid;
                }else{
                    l = mid;
                }
            }
            if(4*r*i*j == n*(i*j+j*r+r*i)){
                cout << i << " " << j << " " << r << endl;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
const int N=1e5+5;

int n,x,a[N],ans;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	for (int i=1;i<=n;i++){
		cin >> x;
		a[x-1]++;
		a[x]++;
		a[x+1]++;
	}
	for (int i=0;i<100000;i++){
		ans=max(ans,a[i]);
	}
	cout << ans << "\n";
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  map<string,int> k;
  int n;
  cin >> n;
  rep(i,n){
    string s;
    cin >> s;
    k[s]+=1;
  }
  int Max=0;
  for(auto p : k){
    Max=max(Max,p.second);
  }
  for(auto p : k){
    if(p.second==Max){
      cout << p.first << endl;
    }
  }
}

Measured memory_bytes: 25216
#include <cstdio>
#include <vector>
#include <stack>
#include <iostream>
#include <string>
#include <tuple>
#include <random>
#include <map>
#include <queue>
#include <set>
#include <complex>
#include <algorithm>
#include <cassert>
#include <tuple> 

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

int main(){
	ll N;
	cin >> N;
	vector<ll> d(N);
	for(int i=0;i<N;i++)
		cin >> d[i];
	ll M;
	cin >> M;
	vector<ll> t(M);
	for(int i=0;i<M;i++)
		cin >> t[i];
	sort(d.begin(), d.end());
	sort(t.begin(), t.end());
	bool ok=true;
	ll now = 0;
	for(int i=0; i<M;i++){
		while(now<d.size() && d[now]!=t[i])
			now++;
		if(now>=d.size())
			ok=false;
		now++;
	}
	if(ok)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 3328
#include <stdio.h>

int main(){
	int n;
	scanf("%d", &n);
	char s[n + 1];
	scanf("%s", s);
	int l = 0, r = n;
	int cnt_W = 0, cnt_R = 0, turn = 0;
	while(l < r){
		if(s[l] == 'W' && !turn){
			cnt_W++;
			turn = 1;
		}
		else if(s[r] == 'R' && turn){
			cnt_R++;
			turn = 0;
		}
		if(!turn){
			l++;
		}
		if(turn){
			r--;
		}
		//printf("%d %d %d %d %d\n", l, r, turn, cnt_W, cnt_R);
		
	}
	printf("%d", cnt_W <= cnt_R ? cnt_W : cnt_R);
	return 0;
	
}

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

using namespace std;

double ans[3000][3000];

int n;

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

    cin>>n;
    for(int i=1;i<=n;i++){
        double p;
        cin>>p;
        if(i==1){
            ans[1][1] = p;
            ans[1][0] = 1-p;
        }else{
            for(int j=0;j<=i;j++){
                ans[i][j] = ans[i-1][j] * (1-p) + ans[i-1][j-1] * p;
            }
        }
    }
    double res = 0;
    for(int i=(n+1)/2;i<=n;i++){
        res += ans[n][i];
    }

    cout<<setprecision(10)<<res;
    return 0;
}

Measured memory_bytes: 68864
#include <stdio.h>
#include <string.h>
int main(void)
{
     int sum;
     char str[1100];
     int i;
     for(i=0;i<1100;i++){
         str[i]=0;
     }
     
     
     while(1){
     scanf(" %\s ",str);
     if(strcmp(str,"0")==0){
           break;
        }
        sum=0;
        for(i=0;str[i]!='\0';i++){
           sum+=str[i]-'0';
        	
           }
           
           printf("%d\n",sum);
     	
     	}
	
       return 0;
}

Measured memory_bytes: 540
#import sys

#input = sys.stdin.readline

#import heapq
import math
import fractions

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True

def main():
#    h,w,a,b = map(int, input().split())
    a,b=map(int,input().split())
    m=4
    k=1

    count=1
    if a>b:
        a,b=b,a
    sosu=set()
    a = fractions.gcd(a,b)
    if a%2==0:
        sosu.add(2)
        while a%2==0:
            a//=2
    if a%3==0:
        sosu.add(3)
        while a%3==0:
            a//=3
#    print(d)
    c=math.sqrt(a)+1
 #   print(c)
    while m<=c and m!=1:
        if a%m==0:
            sosu.add(m)
            while a%m==0:
                a//=m

        m+=1
#    print(sosu)
    if sosu==set() and a!=1:
        sosu.add(a)
    if sosuhante(a) and a!=1:
        sosu.add(a)
#    print(sosu)
    count+=len(sosu)
    print(count)
#    for i in range(h):
#            print(aaa)

if __name__ == "__main__":
    main()

Measured memory_bytes: 5172
use std::collections::HashSet;
use std::io::stdin;
use proconio::input;

fn main() {

    input! {n: usize, m: i32};

    let mut set = HashSet::new();

    for _i in 0..m {
        input! {t: i32};
        for _j in 0..t {
            input! {add: i32};
            set.insert(add);
        }
    }

    let ans = n - set.len();

    println!("{}", ans);
}



Measured memory_bytes: 2144
#include <bits/stdc++.h>
using namespace std;
int main(){
	string a ;
  	int b = 0 ;
     cin >> a ;
  		if(a == "SSS"){
        b = 0 ;
        }else if (a == "SSR"){
        b = 1 ;
        }else if (a == "SRS"){
        b = 1 ;
        }else if (a == "SRR"){
        b = 2 ;
        }else if (a == "RSS"){
        b = 1 ;
        }else if (a == "RSR"){
        b = 1 ;
        }else if (a == "RRS"){
        b = 2 ;
        }else if (a == "RRR"){
        b = 3 ;
        }
    cout << b <<endl;
}

Measured memory_bytes: 3548
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		String design;
		int num;
		String[] mark = {"S", "H", "C", "D"};
		
		boolean[] tramp = new boolean[52];		// spade,heart,clover,diamond??????
		
		for (int i = 0; i < n; i++) {
			
			design = scan.next();
			num = scan.nextInt();
			if (design.equals("S")) {
				tramp[num - 1] = true;
			} else if (design.equals("H")) {
				tramp[num + 13 - 1] = true;
			} else if (design.equals("C")) {
				tramp[num + 26 - 1] = true;
			} else if (design.equals("D")) {
				tramp[num + 39 - 1] = true;
			}
			
		}
		
		for (int i = 0; i < 52; i++) {
			if (tramp[i] == false) {
				System.out.println(mark[i/13] + " " + (i % 13 + 1));
			}
		}
	}

}

Measured memory_bytes: 26000
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
#define cinf(n,x) for(int UNCH=0;UNCH<(n);UNCH++) cin >> x[UNCH];
#define fcin(n,x) for(int UNCH=1;UNCH<=(n);UNCH++) cin>> x[UNCH];
#define memmin(x) memset((x),-1,sizeof((x)))
#define memzer(x) memset((x), 0,sizeof((x)))
#define meminf(x) memset((x),0x3f,sizeof((x)))
#define int long long
typedef long long ll;
typedef pair < int , int >  pii;
typedef vector < int > vit;
typedef map < string , int > mstit;
typedef vector < pii > vpi ;
typedef greater < pii > gpi;
typedef priority_queue < pii , vpi , gpi > dijk ;
static const signed int INF = 0x3f3f3f3f;
static const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static const signed int SMOD = 1000000007;
static const signed int NMOD = 1000000009;
static const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static const signed int dy[]={0,-1,0,1,-1,1,-1,1};

bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>T abs(T &x){return x<0 ? -x : x;}
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; }
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int n,m,h,w,a,b,c,d,x,y;
string str;

signed main(){

  cin >> n >> h >> w;
  cout <<(n-h+1) * (n-w+1) fin;
  
  return 0;
}



struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;



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

const int N = 1e5 + 7, INF = 0x3f3f3f3f;

int arr[N], dp[N];

int main() {
        int n; cin >> n;
        for(int i = 1; i <= n; i++) {
                cin >> arr[i];
        }
        arr[0] = -INF;
        for(int i = 2; i <= n; i++) {
                dp[i] = min(dp[i - 1] + abs(arr[i] - arr[i - 1]), dp[i - 2] + abs(arr[i] - arr[i - 2]));
        }
        cout << dp[n] << endl;
}


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

int main() {
  int n,i,answer;
  i= answer = 0;
  vector<int> number(3);
  cin >> n;
  
  while(n>0){
  	if(n%10 == 1) number.at(i) = 9;
    else if(n%10 == 9) number.at(i) = 1;
    else number.at(i) = n%10;
    n /= 10;
    i++;
  }
  cout << number.at(0) + number.at(1) * 10 + number.at(2) * 100 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#include <bitset>
#include <numeric>
#define ll long long
using namespace std;
using p = pair<ll, ll>;
ll dx[8]={ 0, 1, 0,-1, 1, 1,-1,-1}; // x軸方向への変位
ll dy[8]={ 1, 0,-1, 0, 1,-1, 1,-1}; // y軸方向への変位

int main(void) {
    ll n, m;
    cin >> n >> m;
    vector<ll> a;
    for(ll i = 1; i <= sqrt(m); i++){
        if(m%i==0) {
            a.push_back(i);
            a.push_back(m/i);
        }
    }
    sort(a.begin(), a.end());
    ll ans = 0;
    for(ll i = 0; i < a.size(); i++){
        if(m/a[i]>=n) ans = a[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n,t = gets.chomp.split.map(&:to_i)
routes = []
n.times do
  routes <<  gets.chomp.split.map(&:to_i)
end

able = routes.select {|r| r[1] <= t}
able.sort! {|r,n| r[0] <=> n[0]}

puts able.empty? ?  'TLE' : able[0][0]


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

using namespace std;

int main()
{
    int N;
    cin>>N;
    vector<long long> A(N);
    for (long long &a: A)
        cin>>a;
    auto f = [&](long long b)
    {
        long long s = 0;
        for (int i=0; i<N; i++)
            s += abs(A[i]-b-i);
        return s;
    };

    long long l = -2000000000LL;
    long long r = 2000000000LL;
    while (r-l>3)
    {
        long long m1 = (l*2+r)/3;
        long long m2 = (l+r*2)/3;
        long long s1 = f(m1);
        long long s2 = f(m2);
        if (s1<s2)
            r = m2;
        else
            l = m1;
    }

    long long ans = f(l);
    for (int i=-10; i<10; i++)
        ans = min(ans, f(l+i));
    cout<<ans<<endl;
}


Measured memory_bytes: 1792
import numpy as np

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

H = np.array(list(map(int, input().split())))

dp = np.zeros(N, dtype=int)

for i in range(1, N):
    start = max(0, i-K)
    dp[i] = min(dp[start:i]+np.abs(H[i]-H[start:i]))

print(dp[N-1])

Measured memory_bytes: 22836
#include<iostream>
using namespace std;
 
int main() {
	int n, k;
	cin >> n >> k;
	long long ans = 0, d = 0;
	for (int i = 1;i <= n;i++) {
		if (k % 2 == 0) {
			if (i % k == 0)ans++;
			else if (i % (k / 2) == 0)d++;
		}
		else {
			if (i%k == 0)ans++;
		}
	}
	cout << ans * ans * ans + d * d*d << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
typedef pair<long long int,int> P;
struct vertex{
    vector<P> E;//cost,to
};
#define INF 5000000001
vertex V[100000];
long long int minimum[100000];

int main(){
    int NV,NE,r;
    cin>>NV>>NE>>r;
    fill(minimum,minimum+100000,INF);
    minimum[r]=0;
    for(int i=0;i<NE;i++){
        int s,t,d;
        cin>>s>>t>>d;
        V[s].E.emplace_back(d,t);
    }
    bool update;
    for(int i=0;i<NV;i++){
        update=false;
        for(int j=0;j<NV;j++){
            if(minimum[j]==INF) continue;
            for(auto& e:V[j].E){
                int to=e.second, cost=e.first;
                if(minimum[j]+cost<minimum[to]){
                    minimum[to]=minimum[j]+cost;
                    update=true;
                }
            }
        }
    }
    if(update){
        cout<<"NEGATIVE CYCLE"<<endl;
        return 0;
    }
    for(int i=0;i<NV;i++){
        if(minimum[i]==INF){
            cout<<"INF"<<endl;
        }else{
            cout<<minimum[i]<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 6248
N, K = map(int, input().split())

array = input().split()
for i in range(len(array)):
    array[i] = int(array[i])

now = 1

history = []
sethistory = set()
start_number = -1

for i in range(K):
    history.append(now)
    sethistory.add(now)
    now = array[now - 1]
    if(now in sethistory):
        start_number = now
        break

if not(start_number == -1):
    start_ind = history.index(start_number)
    length = len(history) - start_ind
    mod = (K - start_ind) % length
    now = history[start_ind + mod]

print(now)


Measured memory_bytes: 36596
#include <iostream>
#include <math.h>
using namespace std;

int main() {
	double n;
	while (1)
	{
		cin >> n;
		double sum = 0;
		double n_va = 0;
		double m;
		if (n == 0)
			break;
		double s[1000] = { 0.0 };

		for(int i=0; i<n; i++)
		{
			cin >> s[i];
			sum += s[i];
		}
		m = sum / n;
		for (int i = 0; i<n; i++)
		{
			n_va += (s[i]-m)*(s[i] - m);
		}

		cout <<fixed<< sqrt(n_va / n )<< endl;
	}

	return 0;
}

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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.tie(0)
#define MAXX 1005

int a , b , c;

int main()
{
    _FastIO;
    cin >> a >> b >> c;
    cout << max(0 , (b + c) - a) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ul unsigned long long
#define ll long long
#define ld long double


int main() {
  ll k,n,a[200000],d[200000];
  cin>>k>>n;
  ll maxd=0;
  for (ll i = 0; i < n; i++)
  {
    cin>>a[i];
    if (i>0) d[i]=a[i]-a[i-1];
  }
  d[0]=a[0]+k-a[n-1];

  for (ll i = 0; i < n; i++)
  {
    maxd=max(maxd,d[i]);
  }

  cout<<(k-maxd)<<endl;
  
  return 0;  
}

Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

int main(){
    int N;
    cin >> N;
    for(int i=0; i<N; i++){
        int a;
        cin >> a;
        if(a%2==0){
            if(a%3==0 || a%5==0){
                continue;
            }
        }else{
            continue;
        }
        cout << "DENIED" << endl;
        return 0;
    }
    cout << "APPROVED" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long n,m,a[10000],i;
	long long sum=0;
	cin>>n>>m;
	for(i=0;i<m;i++)
	{
		cin>>a[i];
	}
	for(i=0;i<m;i++)
	{
		sum +=a[i];
	}
	if(sum>n)
	{
		cout<<"-1"<<endl;
	}
	else
	{
		cout<<n-sum<<endl;
	}
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]A - Strings
            var arr = Console.ReadLine().Split(' ');
            var S = arr[0];
            var T = arr[1];

            Console.WriteLine(T + S);
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 100010;

int main(){
    int n; lint K;
    scanf("%d%lld", &n, &K);
    lint ans = 0;
    rep(_, n-1){
        ans = ans/(K-1)*K + ans%(K-1) + 1;
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1e9+7;
double pi = acos(-1);
int a[100005];
int sum[100005];
void A() {
  for (int i = 2; i*i < 100001; i++) {
    if (a[i] == 0)
      for (int j = i*i; j < 100001; j += i)
        a[j] = 1;
  }
  for (int i = 2; i < 100001; i++) {
    sum[i] += sum[i-1];
    if (!a[i] && !a[(i+1)/2] && (i+1) % 2 == 0) sum[i]++; 
  }
}
int main() {
  A();
  int n;
  scanf("%d", &n);
  while (n--) {
    int l, r;
    scanf("%d%d", &l, &r);
    printf("%d\n", sum[r]-sum[l-1]);
  }
  return 0;
} 

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;

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 (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

int main() {
    int n, q;
    cin >> n >> q;
    vector<vector<int>> G(n);
    rep (i, n-1) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<int> ctr(n, 0);
    rep (i, q) {
        int p, x;
        cin >> p >> x;
        ctr[--p] += x;
    }
    vector<int> ans(n, 0);
    vector<bool> visited(n, false);
    queue<int> que;
    ans[0] = ctr[0];
    que.push(0);
    visited[0] = true;
    while(que.size()) {
        int top = que.front();
        que.pop();
        for (auto v: G[top]) {
            if (visited[v]) {
                continue;
            } else {
                ans[v] = ans[top] + ctr[v];
                que.push(v);
                visited[v] = true;
            }
        }
    }
    rep (i, n) {
        cout << ans[i] << endl;
    }
}


Measured memory_bytes: 16500
N = int(input())

i = 1
K = []
while(1):
    k = i * (i+1) // 2
    if k > 10**5:
        break
    K.append(k)
    i+=1
if not N in K:
    print ('No')
    exit()
print ('Yes')
S = [[],[]]
i = 0

for n in range(1,N+1):
    S[i].append(n)
    S[-1].append(n)
    i+=1
    if n in K:
        if n==N:
            break
        i = 0
        S.append([])
print(len(S))
for s in S:
    print(str(len(s)) + ' ' + ' '.join(map(str,s)))


Measured memory_bytes: 13560
#include <vector>
#include <stack>
#include <iostream>
#include <unordered_map>
#include <map>
#include <iomanip>
#include <set>
#include <functional>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <string>
#include <sstream>
#include <queue>
#include <bitset>

using namespace std;

constexpr int MOD = 1000000007;

using Long = long long;
template<typename T>
using V = vector<T>;
template<typename T>
using Vv = V<V<T>>;
using Vb = V<bool>;
using Vvb = V<Vb>;
using Vi = V<int>;
using Vvi = V<Vi>;
using Vl = V<Long>;
using Vvl = V<Vl>;
using Vd = V<double>;
using Vvd = V<Vd>;
using Vs = V<string>;

template<typename T>
T read() {
    T res;
    cin >> res;
    return res;
}

template<typename T>
V<T> readV(int n) {
    V<T> res((size_t) n);
    for (int i = 0; i < n; ++i) {
        res[i] = read<T>();
    }
    return res;
}

template<typename T>
Vv<T> readVv(int n, int m) {
    Vv<T> res((size_t) n, V<T>((size_t) m));
    for (int i = 0; i < n; ++i) {
        res[i] = readV<T>(m);
    }
    return res;
}

// *** SOLUTION BEGIN ***

void solve() {
    int n, k;
    cin >> n >> k;
    Long ans = (Long)n * k;
    for (int b = k + 1; b <= n; ++b) {
        ans += max(0LL, k * Long((n + 1) / b) + min((n + 1) % b, k) - 1);
    }
    ans = (Long)n * n - ans;
    cout << ans;
}

// *** SOLUTION END ***

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout.precision(10);
    cout << fixed;
    solve();
    return 0;
}


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

int main() {

	int n;
	cin >> n;

	set<string>st;
	string a;

	for (int i = 0; i < n; i++) {
		cin >> a;
		st.insert(a);
	}

	cout << st.size() << endl;

	return 0;


	
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N, P; cin >> N >> P;
    string S; cin >> S;
    ll ans = 0;

    // Pが10と互いに素かどうかで場合分け
    if (P == 2 || P == 5){ // 最下桁がPで割り切れればok
        rep(i, N){
            if ((S[i] - '0') % P == 0){
                ans += (i + 1);
            }
        }
    } else {
        // 10^{n} (modP)を事前に計算
        vector<ll> modp_table(N);
        modp_table.at(0) = 1;
        rep(i, N-1){
            modp_table.at(i + 1) = 10 * modp_table.at(i) % P;
        }

        // 右からn文字使った数のmodPの値で分類，modP = a が2つ以上あればその間を使って一つ作れる
        map<ll, ll> modp_cnt;
        rep(i, P){modp_cnt[i] = 0;}
        modp_cnt[0] = 1; // 累積和と同様，0文字使った時を初期化
        ll tmp = 0;
        rep(i, N){
            tmp += (S[N - 1 - i] - '0') * modp_table.at(i) % P;
            modp_cnt[tmp % P] += 1;
        }
        rep(i, P){
            ll n = modp_cnt[i];
            if (n >= 2){ans += n * (n - 1) / 2;}
        }
    }
    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 2580
unittest
{
	assert( [ "6 1", "LRLRRL" ].parse.expand.solve == 3 );
	assert( [ "13 3", "LRRLRLRRLRLLR" ].parse.expand.solve == 9 );
	assert( [ "10 1", "LLLLLRRRRR" ].parse.expand.solve == 9 );
	assert( [ "9 2", "RRRLRLRLL" ].parse.expand.solve == 7 );
	
	assert( [ "4 2", "RRRR" ].parse.expand.solve == 3 );		// 追加ケース
	assert( [ "9 3", "RRRLRLRLL" ].parse.expand.solve == 8 );		// 追加ケース
	assert( [ "9 4", "RRRLRLRLLR" ].parse.expand.solve == 9 );		// 追加ケース
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nk = input.front.split.to!( long[] );
	input.popFront;
	auto s = input.front.to!( dchar[] );
	return tuple( nk[ 1 ], s );
}

auto solve( long k, dchar[] s )
{
	auto gs = s.group.array;
	auto ans = 0L;
	if( gs.length == 1 )
	{
		ans = gs.front[ 1 ] - 1;
	}
	else
	{
		foreach( i, g; gs )
		{
			if( i % 2 == 1 && 0 < k )
			{
				if( i == gs.length - 1 ) ans += g[ 1 ];
				else                     ans += g[ 1 ] + 1;
				k--;
			}
			else
			{
				ans += g[ 1 ] - 1;
			}
		}
	}
	return ans;
}


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

/*
code credits : ਜ਼ੈਲਦਾਰ
dashan jot singh
*/
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL)
#define pb push_back
#define mp make_pair
#define inf LLONG_MAX
#define p pair<ll,ll>

ll dp[100010];
std::vector<ll> graph[100010];
ll n,m;
ll solve(ll i){
	if(graph[i].size()==0){
		return 0;
	}
	if(dp[i]!=-1){
		return dp[i];
	}
	ll ans=INT_MIN;
	for(auto x:graph[i]){
		ans=max(ans,1+solve(x));
	}
	dp[i]=ans;
	return dp[i];
}
int main(){
	fast;
	cin>>n>>m;
	for(ll i=0;i<m;i++){
		ll x,y;
		cin>>x>>y;
		graph[x].pb(y);
	}
	memset(dp,-1,sizeof(dp));
	ll xx=0;
	for(ll i=1;i<=n;i++){
		xx=max(xx,solve(i));
	}
	cout<<xx<<endl;
	return 0;
}

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

/*ソートの時に使う
int sort(const void *a, const void *b){
    return *(int*)a-*(int*)b ;
}
    qsort (data,sizeof(data),sizeof(int),sort); 
*/

int main(void){
    int n;
    scanf("%d",&n);
    int a1[n],a2[n],a1sum[n],a2sum[n];
    
    for (int i=0; i<n; i++){
        scanf("%d",&a1[i]);
    }
    
    for (int i=0; i<n; i++){
        a1sum[i]=0 ;
        for (int j=0; j<=i; j++){
            a1sum[i]+=a1[j];
        }
    } 
    for (int i=0; i<n; i++){
        scanf("%d",&a2[i]);
    }
    
    for (int i=n-1; i>=0; i--){
        a2sum[i]=0 ;
        for (int j=n-1; j>=i; j--){
            a2sum[i]+=a2[j];
        }
    }
    int tmp=0,ans=0 ;
    for (int i=0; i<n; i++){
        tmp=a1sum[i]+a2sum[i];
        if (tmp>ans){
            ans=tmp;
        }
    }
    printf ("%d\n",ans);
	return 0 ;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
int main(void)
{
  int i, j;
  char aa[99+2];
  char a,b;
  int len=0, cnt;
  scanf("%s", aa);
  len=strlen(aa);
//  printf("aa %d %d %d %s\n",len,(len-1)/2/2,(len+3)/2,aa);
  for (i = 0; i < len/2; i++){
    a = aa[i];
    b = aa[len-1 - i];
//    printf("a %c  b %c\n",a,b);
    if(a !=b ){
      printf("No\n");
      return 0;
    }
  }
  cnt=(len-1)/2-1;
  for (i = 0; i < cnt; i++){
    a = aa[i];
    b = aa[cnt - i];
//    printf("a %c  b %c\n",a,b);
    if(a !=b ){
      printf("No\n");
      return 0;
    }
  }
  char cnt2=(len+3)/2-1;
  for (i = 0; i < cnt; i++){
    a = aa[i+cnt2];
    b = aa[cnt - i + cnt2];
//    printf("a %c  b %c\n",a,b);
    if(a !=b ){
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
  return 0;
 
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int INF=2E9;
typedef pair<int,int> Pair;
typedef long long LL;
#define btc 380000.0
int A,B,C;
int pow(int a,int b){
    int ret=1;
    for(int i=0;i<b;i++){
        ret*=a;
    }
    return ret;
}

int main(){
    int N;
    int nagasa[3]={0,0,0};
    int ABC[3];
    cin >> N >> ABC[0] >> ABC[1] >> ABC[2];
    int L[9];
    for(int i=0;i<N;i++){
        cin >> L[i];
    }
    int ans=INF;
    for(int i=0;i<pow(4,N);i++){
        int cnt = -30;
        int nagasa[4]={0,0,0,0};
        for(int j=0;j<N;j++){
            int r=(i/pow(4,j))%4;
            nagasa[r]+=L[j];
            if(r<=2) cnt+=10;
        }
        if(nagasa[0] && nagasa[1] && nagasa[2]){
            for(int k=0;k<3;k++){
                cnt+=abs(ABC[k]-nagasa[k]);
            }
            ans=min(ans,cnt);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef unsigned long long int ull;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> o_set;

#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define     int                 ll
#define     xx                  first
#define     yy                  second    
#define     all(a)              a.begin(),a.end()
#define     vi                  vector<int>
#define     vpi                 vector<pii>
#define     pii                 pair<int, int>
#define     present(DT, val)    (DT.find(val) != DT.end()) //for set and map
#define     cpresent(DT, val)   (find(all(DT),val) != DT.end()) //vectors
#define     input               "/home/pollution/Desktop/WorkSpace/C++/Files/input.txt"
#define     output              "/home/pollution/Desktop/WorkSpace/C++/Files/output1.txt"
#define     error               "/home/pollution/Desktop/WorkSpace/C++/Files/error.txt"
#define     IO()                ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define     INF                 2e18
#define     MOD                 1000000007
#define     clr(x)              memset(x, 0, sizeof(x))
#define     out(a)              for (auto i: a) cout<<i<<' '; cout<<'\n'
#define     setd(val,n)         cout<<fixed<<setprecision(n)<<val<<'\n'

void solve(){
    int n, s = 0, e, ans = 0;
    cin >> n;
    string str;
    cin >> str;
    e = n-1;
    while(s < e){
    	while(s < n && str[s]=='R'){
    		s++;
    	}
    	if(s >= e){
    		break;
    	}
    	while(~e && str[e]=='W'){
    		e--;
    	}
    	if(e <= s){
    		break;
    	}
    	else{
    		ans++;
    		swap(str[e],str[s]);
    		e--;
    		s++;
    	}
    }
    cout << ans << '\n';
}

signed main() { 
    IO();
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0; 
}


Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
#ifdef _debug
#define dout(i) cout << #i << ' ' << i << ' '
#else 
#define dout(i) //
#endif
using ll = long long;
using ull = unsigned long long;
using ul = unsigned;
const int maxn = 200001;
const int tomod = 998244353;
#define getp(i) cin>>i.first>>i.second
ll mv[maxn];
ll form(ll v){return v < tomod ? (v + tomod) % tomod : v % tomod;};
pair<int,int> dot[maxn];
int n;
ll res;
struct bit{
	int v[maxn];
	int lowbit(int i){return i & -i;}
	void modify(int p, const int val){
		for(;p <= n;p += lowbit(p))v[p] += val;
	}
	int query(int p){
		int res = 0;
		for(;p;p ^= lowbit(p))res += v[p];
		return res;
	}
	int query(int l, int r){
		return query(r) - query(l-1);
	}
}tree;
ll a[maxn], b[maxn], c[maxn], d[maxn];
int main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> n;
	for(int i = 0;i < n;++i)getp(dot[i]);
	{
		auto cmp = [](const pair<int,int> &a, const pair<int,int> &b)->bool{return a.second < b.second;};
		sort(dot, dot+n, cmp);
		for(int i = 0;i < n;++i)dot[i].second = i + 1;
		sort(dot, dot+n);
	}
// init()
	// for(int i = 1;i <= n;++i)mv[i] = (mv[i-1]<<1) % tomod;
	for(int i = 1;i <= n;++i)mv[i] = form(((mv[i-1]+1)<<1) - 1);
// 
	for(int i = 0;i < n;++i){
		int &y = dot[i].second;
		b[i] = tree.query(y);
		a[i] = i - b[i];
		tree.modify(y, 1);
	}
	for(int i = 0;i < n;++i)tree.modify(dot[i].second, -1);
	for(int i = n - 1;i > -1;--i){
		int &y = dot[i].second;
		d[i] = tree.query(y);
		c[i] = (n-1) - i - d[i];
		tree.modify(y, 1);
	}
	for(int i = 0;i < n;++i)tree.modify(dot[i].second, -1);
// 	
	// for(int i = 0;i < n;++i)cout << a[i] << ' ' << b[i] << ' ' << c[i] << ' ' << d[i] << '\n';
	for(int i = 0;i < n;++i){
		int o = res;
		// cout << a[i] << ' ' << b[i] << ' ' << c[i] << ' ' << d[i] << '\n';
		res = form(res + form(
			form(form(mv[a[i]] * mv[d[i]]) * (mv[c[i]+b[i]]+1)) + 
			form(form(mv[b[i]] * mv[c[i]]) * (mv[a[i]+d[i]]+1)) -
			form(form(mv[a[i]] * mv[d[i]]) * form(mv[b[i]] * mv[c[i]])) + 
			mv[n-1]+1
		));
		// cout << res - o << '\n';
	}
	cout << res << '\n';
}

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

template<typename T1,typename T2> void chmin(T1 &a,T2 b){if(a>b)a=b;};
template<typename T1,typename T2> void chmax(T1 &a,T2 b){if(a<b)a=b;};

const Int MAX = 100;
Int dp[MAX][MAX];
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  const Int INF = 1LL<<61;
  memset(dp,0,sizeof(dp));
  dp[0][0]=1;
  for(Int i=1;i<MAX;i++){
    for(Int j=0;j<MAX;j++){
      dp[i][j]=dp[i-1][j];
      if(j) dp[i][j]+=dp[i-1][j-1];
      chmin(dp[i][j],INF);
    }
  }  
  
  Int n,m;
  while(cin>>n>>m,n){
    m--;
    Int k=0;
    while(dp[n][k]<=m) m-=dp[n][k++];
    string s;
    for(Int i=1;i<n;i++){
      if(k<=n-i&&dp[n-i][k]>m){
	s.push_back('0');
      }else{
	s.push_back('1');
	m-=dp[n-i][k];
	k--;
      }
    }
    s.push_back('0'+k);
    cout<<s<<endl;
  }
}



Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000

int main(){
	
	int N;
	cin>>N;
	
	cout<<(1000-N%1000)%1000<<endl;
		
	return 0;
}


Measured memory_bytes: 3632
import math
l=int(input())-1
n=int(math.log2(l+1)+1)
E=[]
for i in range(n-1):
    E.append([i+1,i+2,0])
    E.append([i+1,i+2,2**i])
i=n-2
while l>2**(n-1)-1:
    t=l-2**i+1
    if t>2**(n-1)-1:
        E.append([i+1,n,t])
        l=t-1
    i-=1
print(n,len(E))
for i in range(len(E)):
    print(*E[i])

Measured memory_bytes: 3064
#include <stdio.h>

int sankaku (int o,int p,int s)
{
	int max;
	if(o==p||p==s||s==o){
		return 0;
	}
	if(o>p&&o>s){
		max=o;
		if(max>=(p+s)){
			return 0;
		}
	}else if(p>o&&p>s){
		max=p;
		if(max>=(o+s)){
			return 0;
		}
	}else{
		max=s;
		if(max>=(p+o)){
			return 0;
		}
	}
	return 1;
}

	
 
int main (void)
{
	int n,i,k,q,count=0;
	int l[100];
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf("%d",&l[i]);
	}
	
	if(n<=2){
		printf("%d",count);
		return 0;
	}
	for(i=0;i<n;i++){
		for(k=0;k<n;k++){
			for(q=0;q<n;q++){
				if(i!=k&&k!=q&&q!=i){
					if(sankaku(l[i],l[k],l[q])==1){
						count++;
					}
					
				}
			}
		}
	}
	printf("%d\n",count/6);
	return 0;
}

	

Measured memory_bytes: 2112
#include<iostream>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<limits.h>
#include<utility>
#include<vector>
#include<tuple>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(A) A.begin(),A.end()

int main() {
	ll x;
	cin >> x;
	ll y = sqrt(x) + 2;
	vector<ll> yakusuu(0);
	for (ll i = 1; i <= y; i++) {
		if (x % i == 0)yakusuu.push_back(i);
	}
	for (ll p : yakusuu) {
		ll q = x / p;
		///cout << p << " " << q << endl;
		if ((q - p * p * p * p) % 5 == 0) {
			ll a = (q - p * p * p * p) / 5;
			ll b = sqrt(abs(a))+2;
			///cout << a << " " << b << endl;
			for (int i = 1; i <= b; i++) {
				if (a % i == 0) {
					if (i * (i * i * i + 2 * p * i * i + 2 * p * p * i + p * p * p) == a) {
						cout << i + p << " " << i << endl;
						return 0;
					}
					i *= -1;
					if (i * (i * i * i + 2 * p * i * i + 2 * p * p * i + p * p * p) == a) {
						cout << i + p << " " << i << endl;
						return 0;
					}
					i *= -1;
				}
			}
		}
	}
}


Measured memory_bytes: 3176
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#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++)
#define sz(c) ((int)(c).size())

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> P;
const int MAX=1e5+10;


int main(){
	int N,K;
	cin>>N>>K;
	vll su[MAX];
	rep(_,N){
		int t;
		ll d;
		cin>>t>>d;
		su[t-1].push_back(d);
	}
	vll sp, so;
	rep(i,N)if(sz(su[i])!=0){
		sort(su[i].begin(), su[i].end(), greater<ll>());
		rep(j,sz(su[i])){
			if(j==0)sp.push_back(su[i][j]);
			else so.push_back(su[i][j]);
		}
	}
	sort(sp.begin(), sp.end(), greater<ll>());
	sort(so.begin(), so.end(), greater<ll>());
	ll smp[MAX], smo[MAX];
	int lp=sz(sp);
	int lo=sz(so);
	smp[0]=0;
	rep(i,lp)smp[i+1]=smp[i]+sp[i];
	smo[0]=0;
	rep(i,lo)smo[i+1]=smo[i]+so[i];
	
	ll ans=0;
	rep(i,K+1)if(i<=lp && K-i<=lo){
		ans=max(ans, smp[i]+smo[K-i]+(ll)i*(ll)i);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 8184
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  int a,b,c;
  cin >> a >> b >> c;
  if(a+b+c>21) cout << "bust" << "\n";
  else cout << "win" << "\n";
  return 0;
}


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

using namespace std;

int main() {
  int N, K;
  int height; 
  int counter = 0;
  
  cin >> N >> K;

  for(int i=0;i<N;i++){
    cin >> height;
    if(height >= K) counter++;
  }

  cout << counter; 
  return 0;
}


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


#define f(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define char_f(i,a) for(int i=(int)(a);(char)s[i]!='\0';i++)
#define rf(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define llf(i,a,b) for(long long int i=(long long int)(a);i<=(long long int)(b);i++)
#define llrf(i,a,b) for(long long int i=(long long int)(a);i>=(long long int)(b);i--)



#define ll long long
#define fi first
#define se second
#define pb push_back
#define pop pop_back
#define mem(ara) memset((ara),0,sizeof(ara))
#define memn(ara) memset((ara),-1,sizeof(ara))
#define bb begin()
#define ee end()
#define em emplace
#define eb emplace_back





#define si set<int>
#define sd set<double>
#define sll set<long long int>
#define ss set<string>
#define sc set<char>

#define pii pair<int,int>
#define pli pair<long long int,int>
#define pil pair<int,long long int>
#define pll pair<long long int,long long int>
#define pci pair<char,int>
#define pic pair<int,char>
#define pcl pair<char,long long int>
#define plc pair<long long int,char>

#define pss pair<string,string>
#define pcc pair<char,char>

#define pis pair<int,string>
#define psi pair<string,int>
#define pls pair<long long int,string>
#define psl pair<string,long long int>
#define pdd pair<double,double>
#define pcs pair<char,string>
#define psc pair<string,char>



#define vi  vector<int>
#define vll vector<long long int>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vii vector<pii>



#define mod 1000000007
#define mx (1<<30)-1
#define llmx (1ll<<62)
#define n_size 100005
#define g_size 10000005
double PI=acos(-1);
#define eps 1e-9



///unsigned int uMAX=4294967295;
///unsigned ll int ullMAX=18446744073709551615;





int arr[g_size];



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

	int n,m,T,res;

	int maxi=-mx,mini=mx,count=0;

	int i,j,k,a,b,c,y;

	bool flag;

	string s1,s2;

	char s[100000];

	int ara[n_size],ara2[n_size];

	cin>>n>>y;

	if(y%n==0){
        if(y/n==10000 ) cout<<n<<" "<<0<<" "<<0<<endl,exit(0);
        if(y/n==5000) cout<<0<<" "<<n<<" "<<0<<endl,exit(0);
        if(y/n==1000) cout<<0<<" "<<0<<" "<<n<<endl,exit(0);

	}

	int sum;
	for(a=0;a<2001;a++)
    {
        for(b=0;b<2001;b++)
        {
            if(a+b>n) break;
            for(c=0;c<2001;c++){
                if(a+b+c>n) break;

                sum=(10000*a)+(5000*b)+(1000*c);

                if(sum==y) {
                    if(a+b+c==n){
                        cout<<a<<" "<<b<<" "<<c<<endl,exit(0);
                    }
                }

            }
        }
    }
	cout<<-1<<" "<<-1<<" "<<-1<<endl;

}


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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<ll, ll>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl

class mint {
    long long x;
public:
    mint(long long x=0) : x((x%MOD+MOD)%MOD) {}
    mint operator-() const {
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }

    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

/* -- template -- */

int main() {
    int X, Y; cin >> X >> Y;
    if((Y - 2 * X) % 2 == 0 && (4 * X - Y) % 2 == 0 && ((Y - 2 * X) / 2 >= 0) && ((4 * X - Y) / 2 >= 0)) {
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3632