akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int,  int>;
using pll = pair<ll, ll>;
using edge = pair<int, ll>;
using Graph = vector<vector<int>>; 
using WeightedGraph = vector<vector<edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

int main(){
  int n;cin >> n;
  vector<int> a(n), b(n), c(n-1);
  for(int i = 0; i < n; ++i){
    cin >> a[i]; --a[i];
  }
  for(int i = 0; i < n; ++i){
    cin >> b[i];
  }
  for(int i = 0; i < n-1; ++i){
    cin >> c[i];
  }
  int ans = 0, prev= -2;
  for(int i = 0; i < n; ++i){
    ans += b[a[i]];
    if(prev+1==a[i]){
      ans += c[prev];
    }
    prev=a[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <istream>
#include <map>
#include <set>
#include <queue>
#define rep0(i,n) for (int i = 0; i <= (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define REP(a,b) for (int ii = a; ii <= (b); ++ii) 
#define mREP(a,b) for (int i = a; i == (b); --i)
#define mod 1e9 + 7
typedef long long ll;
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	/*
	　　　　　 　 _... ..._
	　　　　　 , ´⌒ ⌒ヽ
	　　　 　 ﾉｨ（ノﾉ）ﾉ）ﾉ）
	　　　 　 （（q|.ﾟ ヮﾟﾉ|ﾊ
	　　　　　　△ﾑ,8ﾑﾌつ
	　　　　　/(ﾝ_/＿ヽ＼
	　　　　 ～～i_ﾌ_ﾌ～´
	*/
	int n;
	ll count = 0;
	cin >> n;
	vector<ll>a(n + 1);
	vector<ll>b(n);
	rep0(i, n) scanf("%lld", &a[i]);
	rep0(j, n - 1)scanf("%lld", &b[j]);
	rep0(k, n - 1) {
		if (a[k] >= b[k]) {
			count += b[k];
		}
		else {
			count += a[k];
			b[k] -= a[k];
			if (b[k] >= a[k + 1]) {
				count += a[k + 1];
				a[k + 1] = 0;
			}
			else {
				a[k + 1] -= b[k];
				count += b[k];
			}
		}
	}
	cout << count << endl;
	return 0;
}

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

using namespace std;
typedef long long ll;
#define int ll

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

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
const int MAX_N = 100010;

vector<int> ans;

// i 番目の数字を決めていて、現状は cur
int dfs(int i, int cur) {
    ans.push_back(cur);
    if(i >= 10) {
        return 0;
    }
    int digit = cur % 10;
    int next_cur = cur * 10;
    if(digit > 0) {
        dfs(i + 1, next_cur + digit - 1);
    }
    if(digit < 9) {
        dfs(i + 1, next_cur + digit + 1);
    }
    {
        dfs(i + 1, next_cur + digit);
    }
}

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

    int K;
    cin >> K;
    for(int i = 1; i <= 9; ++i) {
        dfs(0, i);
    }
    SORT(ans);
    printf("%lld\n", ans[K-1]);

    return 0;
}


Measured memory_bytes: 10604
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using vll = vector<ll>;
const ll inf = 1e18;

int main() {
    int n, k;
    cin >> n >> k;
    vint x(n);
    rep(i,n) cin >> x[i];
    vll tmp;
    int border = lower_bound(x.begin(),x.end(),0) - x.begin();
    for (int i = -k; i <= k-1; i++) {
        if (border+i >= 0 && border+i < n) tmp.push_back(x[border+i]);
    }
    ll ans = inf;
    for (int i = 0; i <= tmp.size()-k; i++) {
        if (tmp[i+k-1] < 0) ans = min(-tmp[i],ans);
        else if (tmp[i] >= 0) ans = min(tmp[i+k-1],ans);
        else ans = min(tmp[i+k-1]-tmp[i]+min(tmp[i+k-1],-tmp[i]),ans);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1784
#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int h[N];
int dp[N];
int n;

int main() {
    cin >> n;
    for(int i = 1; i <= n; i ++) {
        cin >> h[i];
    }
    dp[0] = 0x3f3f3f3f;
    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] << endl;
    return 0;
}

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

typedef long long int ll;
typedef long double ld;

#define Pb push_back
#define Mp make_pair

#define ff first
#define ss second

#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))

#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN

#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

#define db1(x) cout<<#x<<" : "<<x<<endl;
#define db2(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<endl;
#define db3(x,y,z) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\t"<<#z<<" : "<<z<<endl;

void solve()
{
   char ch;
   cin >> ch;
   if(ch>='A' && ch<='Z')
   {
      cout << "A";
   }
   if(ch>='a' && ch<='z')
   {
      cout << "a";
   }

}

signed main()
{
  IOS;
  //freopen("input.txt", "rt", stdin);
  //freopen("output.txt", "wt", stdout);
  int t=1;
  //cin >> t;
  while(t--)
  {
    solve();
  }
  return 0;
}
/*==============================================================================================================================================================*/


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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

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

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

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

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

   rep (i, s.size()-1) {
      if (s[i] == s[i+1]) {
         printf("%d %d\n", i+1, i+2);
         return 0;
      }
   }

   rep (i, s.size()-2) {
      if (s[i] == s[i+2]) {
         printf("%d %d\n", i+1, i+3);
         return 0;
      }
   }

   printf("%d %d\n", -1, -1);

   return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;
 
int main(){
    string s;
    while(cin>>s){
        if(s=="SUN"){
            cout<<'7'<<endl;
        }
        else if(s=="SAT"){
            cout<<'1'<<endl;
        }
        else if(s=="MON"){
            cout<<'6'<<endl;
        }
        else if(s=="TUE"){
            cout<<'5'<<endl;
        }
        else if(s=="WED"){
            cout<<'4'<<endl;
        }
        else if(s=="THU"){
            cout<<'3'<<endl;
        }
        else if(s=="FRI"){
            cout<<'2'<<endl;
        }
    }
}

Measured memory_bytes: 256
{-# LANGUAGE OverloadedStrings #-}
module Main where

import           Data.List
import           Control.Monad
import           Debug.Trace
import qualified Data.ByteString.Char8         as BC
import           Data.Maybe                     ( fromJust )
import qualified Data.Set                      as S
import qualified Data.IntMap.Strict            as IM
import qualified Data.Map.Strict               as M
import           Data.Char


readTuple2 :: IO (Int, Int)
readTuple2 = do
    [a, b] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b)

readTuple3 :: IO (Int, Int, Int)
readTuple3 = do
    [a, b, c] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b, c)

readInt :: IO Int
readInt = fst . fromJust . BC.readInt <$> BC.getLine

readInts :: IO [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

split :: (a -> Bool) -> [a] -> [[a]]
split f [] = []
split f as =
    let (fo, la) = span f as
        las      = case la of
            [] -> []
            xs -> split f $ tail xs
    in  case fo of
            [] -> las
            xs -> xs : las

solve :: Int -> [Int] -> String
solve m as =
    let total = sum as
        border = fromIntegral total / fromIntegral (4 * m)
        pred x = fromIntegral x >= border
        count = length $ filter pred as
    in if count >= m then "Yes" else "No"


main = do
    (n, m) <- readTuple2
    as <- readInts
    putStrLn $ solve m as





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

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define fr(i,k) for(i=0;i<k;i++)
#define ALL(c) (c).begin(),(c).end()
#define deb(x) cerr<<#x<<"  = "<<x<<endl;
#define SZ(x) (x).size();
#define ll long long
#define MOD 1000000007
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define em emplace_back
#define ulli unsigned long long int
#define INF 1e18
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> ii;
void solve();

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

int main() {
	fastio;
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/

	int t;
	t=1;

    //cin>>t;
	while (t--)
	{
		solve();
	}
	return 0;
}

void solve()
{
	double d,t,s,k;
	cin>>d>>t>>s;
	k=d/s;

	if(k<=t)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 3724
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int N;
    cin >> N;
    vector<int> H(N + 1);
    for (int i = 1; i <= N; i++) cin >> H.at(i);
    int DP[N+1] = {0};
    DP[2] = abs(H[1] - H[2]);
    for (int i = 3; i <= N; i++) {
        DP[i] = min(DP[i - 2] + abs(H[i - 2] - H[i]),
                    DP[i - 1] + abs(H[i - 1] - H[i]));
    }
    cout << DP[N] << endl;
}


Measured memory_bytes: 1024
import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

class Main{

static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
int n=Integer.parseInt(line.split(" ")[0]);
int wmax=Integer.parseInt(line.split(" ")[1]);
int[] v=new int[n];
int[] w=new int[n];
for(int i=0;i<n;i++){
line=br.readLine();
v[i]=Integer.parseInt(line.split(" ")[0]);
w[i]=Integer.parseInt(line.split(" ")[1]);
}
int[][] dp=new int[n+1][wmax+1];
for(int j=n-1;j>=0;j--){
for(int i=0;i<=wmax;i++){
if(i<w[j]) dp[j][i]=dp[j+1][i];
else dp[j][i]=Math.max(dp[j+1][i],dp[j+1][i-w[j]]+v[j]);
}
}
out.println(dp[0][wmax]);
}
out.flush();
}
}

Measured memory_bytes: 25068
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<iomanip>
#include<sstream>
#include<map>
#include<set>
#include<cmath>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
	std::fill((T*)array, (T*)(array + N), val);
}
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1;i <=n;i++)
#define rrep(i,n) for(int i = n -1;i >= 0;i--)
#define ALL(a) a.begin(),a.end()
typedef long long ll;
typedef long double ld;
const ll INF =  1LL << 60;
const int inf = 1 << 20;
int n, m, x, y, q, d,z, w = 0, sum, ans = 0;
vector<int>a;
const int MAX = 510000;
const int MOD = 1000000007;
int main(void) {
	ld a, b, c; cin >> a >> b >> c;
	if (2 * sqrt(a * b) < c - a - b) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3760
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>

using namespace std;

#define NMAX 200001

int a[NMAX];
int imos[NMAX];

void reset(int n) {
    for(int i = 0; i < n; i++) imos[i] = 0;
}

int max(int a, int b) {
    if(a > b) return a;
    else return b;
}

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

int get_int() {
    int res = 0;
    char c = getchar();
    while(c != EOF && c != ' ' && c != '\n') {
        res *= 10;
        res += c - '0';
        c = getchar();
    }
    return res;
}

void put_int(int n) {
    char c[30];
    int sz = 0;
    c[sz++] = (n % 10) + '0';
    n /= 10;
    while(n > 0) {
        c[sz++] = (n % 10) + '0';
        n /= 10;
    }
    for(int i = sz-1; i >= 0; i--) {
        putchar(c[i]);
    }
    putchar('\n');
}

int main(){

    int n, k;
    n = get_int();
    k = get_int();
    for(int i = 0; i < n; i++) a[i] = get_int();

    for(int itr = 0; itr < k; itr++) {
        int f = 0;
        reset(n+1);
        for(int i = 0; i < n; i++){
            imos[max(0, i - a[i])]++;
            imos[min(n, i + a[i] + 1)]--;
        }
        int acc = 0;
        for(int i = 0; i < n; i++){
            acc += imos[i];
            a[i] = acc;
        }
        int sum = 0;
        for(int i = 0; i < n; i++) sum += a[i];
        if(sum == n * n) break;
    }

    for(int i = 0; i < n; i++) put_int(a[i]);
    return 0;
}


Measured memory_bytes: 4556
from sys import stdin, setrecursionlimit
from collections import defaultdict


def main():
    input = stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    dic = defaultdict(int)
    max_1 = 0
    max_2 = 0
    for ai in a:
        dic[ai] += 1
        if dic[ai] >= 2 and ai > max_1:
            max_2 = max_1
            max_1 = ai
        if dic[ai] >= 2 and max_1 > ai > max_2:
            max_2 = ai
    if dic[max_1] >= 4:
        print(max_1 ** 2)
    else:
        print(max_1 * max_2)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


Measured memory_bytes: 56944
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printv(x) for(int i = 0; i < x.size(); i++){ cout << (x[i]) << " "; } cout << endl; 
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printaa(x) for(int i = 0; i < (sizeof(x)/sizeof(x[0])); i++){ for(int j = 0; j < (sizeof(x[0])/sizeof(x[0][0])); j++){ cout << x[i][j] << " ";} cout << endl;}
#define INF (1e9)
typedef long long ll;
typedef struct{
    int x;
    int y;
} P;

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    int w;
    cin >> S;
    cin >> w;
    int len = S.size();
    rep(i,0,len){
        if(i % w == 0){
            cout << S[i];
        }
    }
    print("");
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <set>
#include <map>
#include<iostream>
#include<vector>
#define MAXN 1000100
using namespace std;
typedef long long ll;
///设一个怪物炸y次,总共炸x次则
/// a[i]<=A*y+(x-y)*B 即 x*B+(A-B)y
/// 所以 y>=(a[i]-x*B)/(A-B) (向上取整) 66666
ll a[MAXN];
ll n,A,B;
bool judge(ll x)
{
    ll sub=x*B;
    ll div=A-B;
    ll sum=0;
    for(ll i=n-1;i>=0;i--)
    {
        if(a[i]>sub)
        {
            ll temp=(a[i]-sub)/div;
        if((a[i]-sub)%div>0)
            sum+=temp+1;
        else sum+=temp;
        }
        
    }
   // cout<<x<<"     "<<sum<<endl;
    if(sum<=x)return true;
    return false;
}
int main()
{
    cin>>n>>A>>B;
    ll cnt=0;
    for(ll i=0;i<n;i++)
    {
        cin>>a[i];
        cnt+=a[i]/B+1;
    }
    sort(a,a+n);
    ll l=1,r=cnt;
    while(l<=r)
    {
       // cout<<l<<endl;
        ll mid=(l+r)>>1;
        if(judge(mid))
            r=mid-1;
        else l=mid+1;
    }
    cout<<l<<endl;
}







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

int main(){
	char ch,ch2;

	while(1){
		scanf("%c", &ch);
		
		if(islower(ch)){
			ch2 = toupper(ch);
			cout << ch2;
		}else{
			ch2 = tolower(ch);
			cout << ch2;
		}
		
		if(ch == '\n'){
			break;
		}
	}
			

	return 0;	
}

Measured memory_bytes: 3140
pub fn read<T: std::str::FromStr>() -> T {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).ok();
        s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
        read::<String>()
                .split_whitespace()
                .map(|e| e.parse().ok().unwrap())
                .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
        (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: u32) -> Vec<T> {
        (0..n).map(|_| read()).collect()
}

use std::cmp::{max, min};
use std::collections::HashMap;

fn main() {
        let _n: usize = read();
        let av: Vec<u32> = read_vec();
        let mut map: HashMap<u32, u32> = HashMap::new();

        for a in av {
                let count = map.entry(a).or_insert(0);
                *count += 1;
        }

        if map.len() > 3 {
                println!("No");
        } else if map.len() == 1 {
                let mut keys = map.keys();
                if *keys.next().expect("hoge") == 0 {
                        println!("Yes");
                } else {
                        println!("No");
                }
        } else if map.len() == 2 {
                let mut keys = map.keys();
                let tmp1 = keys.next().expect("hoge");
                let tmp2 = keys.next().expect("hoge");
                let key0 = min(tmp1, tmp2);
                let key1 = max(tmp1, tmp2);
                if *key0 != 0 {
                        println!("No");
                } else if map[key0] * 2 != map[key1] {
                        println!("No");
                } else {
                        println!("Yes");
                }
        } else if map.len() == 3 {
                let mut vals = map.values();
                let val1 = vals.next().expect("hoge");
                let val2 = vals.next().expect("hoge");
                let val3 = vals.next().expect("hoge");

                let mut keys = map.keys();
                let key1 = keys.next().expect("hoge");
                let key2 = keys.next().expect("hoge");
                let key3 = keys.next().expect("hoge");
                if val1 != val2 || val2 != val3 {
                        println!("No");
                } else if *key1 ^ *key2 == *key3 {
                        println!("Yes");
                } else {
                        println!("No");
                }
        } else {
                println!("No");
        }
}


Measured memory_bytes: 9464
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p = sorted(p, reverse=True)[:X]
q = sorted(q, reverse=True)[:Y]
t = sorted(p+q+r, reverse=True)[:X+Y]
print (sum(t))

Measured memory_bytes: 23328
program exchange
  implicit none
  integer :: a, b, k, i
  read(*,*) a, b, k
  do i = 1, k
    a = a/2
    b = b+a
    call swap(a,b)
  end do
  if (mod(k,2) == 1) call swap(a,b)
  write(*,'(i0,x,i0)') a, b
contains
  subroutine swap(a,b)
    integer, intent(inout) :: a, b
    a = xor(a,b)
    b = xor(a,b)
    a = xor(a,b)
  end
end program exchange

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

int buildings[4][3][10];

int main() {
  int n, b, f, r, v;
  cin >> n;
  for (int i{}; i < n; ++i) {
    cin >> b >> f >> r >> v;
    --b, --f, --r;
    buildings[b][f][r] += v;
  }
  for (int i{}; i < 4; ++i) {
    for (int j{}; j < 3; ++j) {
      for (int k{}; k < 10; ++k) {
        cout << ' ' << buildings[i][j][k];
      }
      cout << endl;
    }
    if (i < 3) cout << "####################" << endl;
  }
  return 0;
}



Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;
 
 
int main(){
  int N;
  cin >> N;
  vector<ll> v;
  rep(i,N){
    ll a;
    cin >> a;
    v.push_back(a);
  }
  sort(ALLOF(v));
 
  double dret = 1;
  ll ret = 1;
  rep(i,N){
    ret *= v[i];
    dret *= v[i];
  }
 
  if(dret < 1e19 && ret <= 1000000000000000000LL){
    cout << ret << endl;
  }else{
    cout << -1 << endl;
  }
  
  return 0;
}



Measured memory_bytes: 4320
#include <iostream>

using namespace std;

int main(void)
{
    int N, H[21], i, j, count;

    cin >> N;

    count = N;

    for(i=1; i<=N; i++){
	cin >> H[i];
    }

    for(i=2; i<=N; i++){
	for(j=1; j<=i-1; j++){
	    if(H[j] > H[i]){
		count--;
		break;
	    }
	}
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
/*
        _            _                  _            _       _     _         _   _          _          _             _        
       / /\         / /\               / /\         / /\    / /\  /\ \      /\_\/\_\ _     /\ \       /\ \     _    /\ \      
      / /  \       / /  \             / /  \       / / /   / / /  \ \ \    / / / / //\_\   \ \ \     /  \ \   /\_\ /  \ \     
     / / /\ \__   / / /\ \           / / /\ \__   / /_/   / / /   /\ \_\  /\ \/ \ \/ / /   /\ \_\   / /\ \ \_/ / // /\ \_\    
    / / /\ \___\ / / /\ \ \         / / /\ \___\ / /\ \__/ / /   / /\/_/ /  \____\__/ /   / /\/_/  / / /\ \___/ // / /\/_/    
    \ \ \ \/___// / /  \ \ \        \ \ \ \/___// /\ \___\/ /   / / /   / /\/________/   / / /    / / /  \/____// / / ______  
     \ \ \     / / /___/ /\ \        \ \ \     / / /\/___/ /   / / /   / / /\/_// / /   / / /    / / /    / / // / / /\_____\ 
 _    \ \ \   / / /_____/ /\ \   _    \ \ \   / / /   / / /   / / /   / / /    / / /   / / /    / / /    / / // / /  \/____ / 
/_/\__/ / /  / /_________/\ \ \ /_/\__/ / /  / / /   / / /___/ / /__ / / /    / / /___/ / /__  / / /    / / // / /_____/ / /  
\ \/___/ /  / / /_       __\ \_\\ \/___/ /  / / /   / / //\__\/_/___\\/_/    / / //\__\/_/___\/ / /    / / // / /______\/ /   
 \_____\/   \_\___\     /____/_/ \_____\/   \/_/    \/_/ \/_________/        \/_/ \/_________/\/_/     \/_/ \/___________/    
                                                                                                                              
*/
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)

#define endl '\n'
#define pb emplace_back
#define mkp make_pair
#define p_q priority_queue
#define INF 1000000000
#define PI 3.1415926
#define coutdb cout << fixed << setprecision(10)

const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};
const long long MOD = 1e9+7;

// typedef long long ll;
#define int long long

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

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

  string g; int y, m, d;
  while(1){
    cin >> g;
    if(g == "#") break;
    cin >> y >> m >> d;
    if(y>31 or (y==31 and m >= 5)){
      cout << "? " << y-30 << ' ' << m << ' ' << d << endl;
    } else {
      cout << g << ' ' << y << ' ' << m << ' ' << d << endl;
    }
  }
}


Measured memory_bytes: 3172
#include <iostream>
#include <cstdio>
#include <iomanip>

using namespace std;

const int N = 3e3 + 3;

int n;
double p[N];
double dp[N][2 * N];

int main()
{
//    freopen("input.inp", "r", stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    for (int i = 1; i <= n; ++i)
        cin >> p[i];
    dp[1][1 + N] = p[1];
    dp[1][-1 + N] = 1 - p[1];
    for (int i = 1; i < n; ++i)
        for (int j = -n; j <= n; ++j)
            if (dp[i][j + N] != 0)
            {
                if (j + 1 <= n)
                    dp[i + 1][j + 1 + N] += dp[i][j + N] * p[i + 1];
                if (j - 1 >= -n)
                    dp[i + 1][j - 1 + N] += dp[i][j + N] * (1 - p[i + 1]);
            }
    double ans = 0;
    for (int i = 1; i <= n; ++i)
        ans += dp[n][i + N];
    cout << fixed << setprecision(10) << ans;
    return 0;
}


Measured memory_bytes: 138880
import sys
from collections import defaultdict
def input(): return sys.stdin.readline().strip()

class UnionFind():
    """
    https://note.nkmk.me/python-union-find/
    DFSの上位互換と考えて良い
    ２要素x, yがpath-connectedかどうかをlogオーダーで判定する（螺旋本の14.1節参照）
    さらに連結成分の要素数がO(1)で取得可能なように改造してある
    """
    def __init__(self, n):
        """
        要素数をnとして、各ノードを0,1,...,(n-1)の番号で管理する
        parentsは各ノードの属する木の根を表す
        ただし根ノードのparentには(その木のノード数)*(-1)を格納する
        """
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        """
        xの属する木の根を返す
        このとき同時に経路圧縮して、探索途中のノードを全て根に繋ぎ直す
        """
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        """
        x, yのそれぞれ属する木Tx, Tyの根同士を繋ぐ
        このとき木の要素数が小さい方を大きい方に繋ぐ（rankではなくsizeを用いる）
        """
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        """
        xの属する木の要素数を返す
        根の親を要素数の(-1)倍で定めておいたおかげでO(1)で取得可能
        """
        return -self.parents[self.find(x)]

    def same(self, x, y):
        """
        xとyがpath-connectedかを判定する
        """
        return self.find(x) == self.find(y)

    def members(self, x):
        """
        xの属する木の要素を列挙する
        """
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        """
        連結成分の代表元のリストを返す
        """
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        """
        連結成分の個数を返す
        """
        return len(self.roots())

    def all_group_members(self):
         """
         連結成分およびそれぞれの代表元をまとめた辞書を返す
         代表元がキーになってる
         """
         return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        """
        連結成分およびその代表元を出力
        """
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def main():
    N, K, L = map(int, input().split())
    road = UnionFind(N)
    for _ in range(K):
        p, q = map(int, input().split())
        road.union(p - 1, q - 1)
    train = UnionFind(N)
    for _ in range(L):
        r, s = map(int, input().split())
        train.union(r - 1, s - 1)

    road_component = [road.find(i) for i in range(N)]
    train_component = [train.find(i) for i in range(N)]
    d = defaultdict(int)
    for r1, r2 in zip(road_component, train_component):
        d[(r1, r2)] += 1
    ans = [d[(r1, r2)] for r1, r2 in zip(road_component, train_component)]
    print(" ".join(map(str, ans)))





if __name__ == "__main__":
    main()


Measured memory_bytes: 154472
def merge(A, left, mid, right):
    global counter
    INFTY = 10 ** 10
    L = A[left:mid]
    R = A[mid:right]
    L.append(INFTY)
    R.append(INFTY)
    i, j = 0, 0
    for k in range(left, right):
        counter += 1
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1

def merge_sort(A, left, right):
    if left + 1 < right:
        mid = (left + right) // 2
        merge_sort(A, left, mid)
        merge_sort(A, mid, right)
        merge(A, left, mid, right)
        
n = int(input())
A = list(map(int, input().split()))

counter = 0
merge_sort(A, 0, n)
print(' '.join(str(a) for a in A))
print(counter)


Measured memory_bytes: 66580
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;
 
int main() {
    ll n;
    cin >> n;
    if (n == 1) {
        cout << "Hello World" << endl;
    } else {
        ll a, b;
        cin >> a >> b;
        cout << a + b << endl;
    }
}


Measured memory_bytes: 256
/**       In the name of Allah, the Gracious, the Merciful.
*               Praise be to Allah, Lord of the Worlds.
*               **************************************
*
*    I have not failed, I have just found 1000 WAYS that won't work.
*                 __________________________________
*                  Author  : Abd El-Twab  M. Fakhry
*                 __________________________________
*/

#include <ext/rope>
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

#define  read(arr, l, r)     for(int i = (l); i < (r); cin >> arr[i++])
#define  print(arr, l, r)    for(int i = (l); i < (r); cout << arr[i++] << " \n"[i == r])
#define  rep(i, l, r)        for (int i = l; i < r; i++)
#define  repr(i, r, l)       for (int i = r; i > l; i--)
#define  trav(a, x)          for (auto & a : x)
#define  PQ(T)               priority_queue < T, vector <T> , greater <T> >
#define  Unique(n)           (n).erase(unique(all(n)), (n).end())
#define  endl                '\n'
#define  all(a)              a.begin() , a.end()
#define  NumberOfDigits(n)   ((int)log10(n) + 1)
#define  sz(a)               (int)a.size()
#define  rall(a)             a.rbegin(), a.rend()
#define  rsz(sz)             resize(sz)
#define  ins(x)              insert(x)
#define  debug(x)            cout << #x << " = " << (x) << '\n'
#define  LINE_ON             cout << "line Number = " << __LINE__ << endl
#define  RT(n)               return cout << (n) << endl, 0;
#define  clr(arr, x)         memset(arr, x, sizeof(arr))
#define  F                   first
#define  S                   second
#define  PB                  push_back
#define  EB                  emplace_back
#define  get(n)              find_by_order(n)
#define  indexOf(n)          order_of_key(n)
#define  isPowerOfTwo(x)     (x && !(x & (x - 1)))
#define  Swap(n, k)           n ^= k, k ^= n, n ^= k;

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

template <class T>
using indexed_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update >;
typedef long long            ll;
typedef unsigned int         uint;
typedef unsigned long long   ull;

int Dx8[8] = { 1, -1, 0, 0, 1, 1, -1, -1 }, Dx4[4] = { 0, 0, 1,-1};
int Dy8[8] = { 0, 0, 1, -1, 1, -1, 1, -1 }, Dy4[4] = { 1,-1, 0, 0};

const double inf  = 1.0 / 0.0,      pi  = 2 * acos(0.0),   error = 1e-9;
const int    MxsZ = (int)2e5 + 6,   mod = (1 << 30) + 7,      oo = 0x3f3f3f3f;

ll Gcd(ll a, ll b)     { return b ? Gcd(b, a % b) : a; }
ll Lcm(ll a, ll b)     { return a * b / Gcd(a, b); }

void Fast()
{
    cin.sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin.exceptions(cin.failbit);
}

void File()
{
    freopen("input.in", "r", stdin);
    freopen("output.out", "w", stdout);
}

/**----------------------->>  Template  <<-----------------------**/

int a, b, c;

/**------------------>>  Initialization gap  <<------------------**/

int main()
{
    Fast();

    cin >> a >> b >> c;
    if(a > b) swap(a, b);
    if(c >= a && c <= b) cout << "Yes";
    else cout << "No"; 
}


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

int main(){
    int n; cin>>n;
    bool ans = true;

    vector<int> a;

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

    sort(a.begin(), a.end());

    for(int i = 0; i < (n - 1); i++){
        if(a[i] == a[i+1]){
            ans = false;
            break;
        }
    }

    cout << ((ans) ? "YES":"NO");
}

Measured memory_bytes: 1400
//============================================================================
// Name        : abc143_c.cpp
// Author      : abb
// Version     :
// Copyright   : [My copyright notice]
// Description : test program
//============================================================================

/*
C - Slimes

実行時間制限: 2 sec / メモリ制限: 1024 MB

配点 : 300 点

問題文
N 匹のスライムが横一列に並んでいます。これらの色に関する情報が、長さ N の英小文字から成る文字列 S で与えられます。左から i 番目のスライムは、 S の i 文字目に対応する色を持っています。
同じ色を持ち隣接するスライムは融合し、色は変わらずに 1 匹のスライムとなります。このとき、融合した後のスライムは、融合する前の各スライムが隣接していた他のスライムと隣接した状態になります。
最終的に存在するスライムは何匹となるでしょうか。

制約

・1 ≤ N ≤ 10^5
・|S| = N
・S は英小文字から成る
 */

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

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

using ll = long long;
using ull = unsigned long long;

#define REP(i, m, n) for (ll i = (m); i < (ll)(n); ++(i))
#define REPM(i, m, n) for (ll i = (m); i <= (ll)(n); ++(i))
#define REPR(i, m, n) for (ll i = (m); i >= (ll)(n); --(i))
#define REPD(i, m, n, d) for (ll i = (m); i < (ll)(n); i += (d))
#define REPMD(i, m, n, d) for (ll i = (m); i <= (ll)(n); i += (d))
#define ALL(x) begin(x), end(x)

/**
 * エントリポイント．
 * @return 0.
 */
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    ll n;
    string s;
    cin >> n;
    cin >> s;

    char prev = '\0';
    ll count = 0;

    for (char c : s)
    {
        if (c != prev)
        {
            ++count;
        }
        prev = c;
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll l[100010],r[100010];
int main() {
	ll n,m;
	cin>>n>>m;
	for(ll i=0;i<m;i++){
		ll x,y;
		cin>>x>>y;
		x--,y--;
		l[i]=x;
		r[i]=y;
	}
	vector<ll>ans;
	vector<vector<ll>>g(100010);
	ll p[100010];
	for(ll i=0;i<n;i++){
		p[i]=i;
		g[i].push_back(i);
	}
	ans.push_back(n*(n-1)/2);
	ll con=0;
	for(ll i=m-1;i>0;i--){
		ll x=l[i],y=r[i];
		x=p[x];
		y=p[y];
		// from x to y;
		if(g[x].size()>g[y].size()){
			swap(x,y);
		}
		if(x!=y){
			con-=g[x].size()*(g[x].size()-1)/2+g[y].size()*(g[y].size()-1)/2;
			while(g[x].size()!=0){
				ll now=g[x].back();
				g[x].pop_back();
				p[now]=y;
				g[y].push_back(now);
			}
			con+=g[y].size()*(g[y].size()-1)/2;
		}
		ans.push_back(n*(n-1)/2-con);
	}
	for(ll i=m-1;i>=0;i--){
		cout << ans[i]<<endl;
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 18420
#include <bitset>
#include <iostream>
#include <queue>
#include <utility>
#include <vector>
using namespace std;
using ll = long long;
using Node = pair<int, ll>; // node no, cost

int main() {
  cin.tie(0);
  int N;
  cin >> N;
  vector<vector<Node>> nodes(N + 1);
  {
    int a, b;
    ll c;
    for(int i = 1; i <= N - 1; ++i) {
      cin >> a >> b >> c;
      nodes[a].push_back(Node(b, c));
      nodes[b].push_back(Node(a, c));
    }
  }
  vector<ll> cost(N + 1, -1);
  queue<Node> qs; //

  int Q, K;
  cin >> Q >> K;
  qs.push(Node(K, 0)); // Kを始点として全探索する
  while(!qs.empty()) {
    auto node = qs.front();
    qs.pop();
    if(cost[node.first] < 0) {
      cost[node.first] = node.second;      // コストを設定
      for(auto next : nodes[node.first]) { // 連結しているものをキューへ入れる
        qs.push(Node(next.first, next.second + node.second));
      }
    }
  }
  {
    vector<pair<int, int>> xys(Q);
    for(int i = 0; i < Q; ++i) {
      cin >> xys[i].first >> xys[i].second;
    }
    for(auto xy : xys) {
      // cout << "answer" << endl;
      cout << cost[xy.first] + cost[xy.second] << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 10864
import pdb

def bfs(graph, start, rooms):
    queue = []
    visited = [False]*rooms
    visited[start] = True
    marking = [0]*rooms
    queue.append(start)
    while queue:
        nodes = queue.pop(0)
        for node in graph[nodes]:
            if not visited[node]:
                visited[node] = True
                queue.append(node)
                marking[node] = nodes + 1
    return marking, visited

if __name__=="__main__":
    N, M = map(int, input().split())
    graph = [[] for i in range(N)]
    for i in range(M):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        graph[a].append(b)
        graph[b].append(a)

    marking, visited = bfs(graph, 0, N)

    if all(visited):
        print("Yes")
        for i in range(1, N):
            print(marking[i])
    else:
        print("No")

Measured memory_bytes: 39268
#include <stdio.h>

int main()
{
	char X[1000], Y[1000];
	int a[1001][1001] = {0};
	int c[150] = {0};
	int q, xlen, ylen, i, j, k;
	
	scanf("%d", &q);
	
	for (k = 0; k < q; k++) {
		scanf("%s", X);
		scanf("%s", Y);
		xlen = strlen(X);
		ylen = strlen(Y);
		
		//?????????????????´?????????
		for (i = 0; i < xlen; i++) {
			for (j = 0; j < ylen; j++) {
				//?????´
				if (X[i] == Y[j]) {
					a[i+1][j+1] = a[i][j] + 1;
				} else {
				//????????´
					if (a[i][j+1] < a[i+1][j]) {
						a[i+1][j+1] = a[i+1][j];
					} else {
						a[i+1][j+1] = a[i][j+1];
					}
				}
			}
		}
		
		//????????????????????????
		i = xlen;
		j = ylen;
		while (a[i][j] > 0) {
			while (a[i][j-1] == a[i][j])
				j--;
			while (a[i-1][j] == a[i][j])
				i--;
			i -= 1;
			j -= 1;
			c[k] += 1;
		}
		
		//?????????
		for (i = 0; i < xlen; i++)
			X[i] = '\0';
		for (j = 0; j < ylen; j++)
			Y[i] = '\0';
		for (i = 0; i <= xlen; i++) {
			for (j = 0; j <= ylen; j++) {
				a[i][j] = 0;
			}
		}
	}
	
	for (k = 0; k < q; k++)
		printf("%d\n", c[k]);
	
	return 0;
}

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

using namespace std;

#define int long long
#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll N=1e5+10,M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
const int INF=1e9+7;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}


int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}


int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    int ans=1;
    for(int i=2; i<n; i++){
        ans+=(n/i);
        if(n%i!=0) ans++;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3592
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cassert>
using namespace std;

#define REP(i,n) for (int i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long ll;

int main ()
{
    int c[3][3];
    REP(i,3)REP(j,3) cin >> c[i][j];

    for (int a1 = 0; a1 <= 100; a1++) {
        for (int a2 = 0; a2 <= 100; a2++) {
            for (int a3 = 0; a3 <= 100; a3++) {
                int a[3] = {a1, a2, a3};
                int b[3] = {c[0][0] - a1, c[1][1] - a2, c[2][2] - a3};
                bool flag = true;
                REP(i,3) if (b[i] < 0) flag = false;
                REP(x,3) REP(y,3) {
                    if (a[x] + b[y] != c[x][y]) {
                        flag = false;
                    }
                } 
                if (flag) {
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
    }

    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort((x).begin(),(x).end())
#define Sort2(x) sort((x).begin(),(x).end(), greater<int>())
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main()
{
    double n; cin >> n;
    cout << fixed << setprecision(5);
    cout << n * 2 * 3.14159 << endl;

}

/*
Ctrl+@ でコンソールを開け、以下で実行。
g++ a.cpp
./a.out

サンプルのダウンロードは oj d URL
テストは oj t
コード変えたらコンパイルする
不正解ならWAが出る
*/

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

const int MOD = 1e9 + 7;
const int iINF = 1000000000;
const long long int llINF = 1000000000000000000;
const double PI = acos(-1.0);
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, init, n) for(int i = init; i < (n); i++)

using namespace std;
using ll = long long int;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct
{
    int to;
    int cost;
};

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

int main()
{
    int N, M, X;
    cin >> N >> M >> X;
    vector<int> A(M);
    rep(i, M) cin >> A[i];

    int ans1 = 0, ans2 = 0;

    REP(i, X, N + 1)
    {
        rep(j, M) if(i == A[j]) ans1++;
    }

    for(int i = X; 0 < i; i--)
    {
        rep(j, M) if(i == A[j]) ans2++;
        
    }

    cout << min(ans1, ans2) << endl;


    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A___Christmas_Eve_Eve_Eve
{
    class Program
    {
        static void Main(string[] args)
        {
            int day = int.Parse(Console.ReadLine());

            Console.Write("Christmas");
            for (int i = day; i < 25; i++)
            {
                Console.Write(" " + "Eve");
            }
            Console.WriteLine();
        }
    }
}


Measured memory_bytes: 13140
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <cstdio>
#include <cmath>
#include <limits.h>
using namespace std;
typedef long long LL;
const int N=2e5;

int n,a[N];

int main() {
	scanf("%d",&n);
	for(int i=0;i<n;i++) {
		scanf("%d",&a[i]);
	}
	sort(a,a+n);
	LL ans=0;
	if(n&1) {
		LL sum=0;
		for(int i=0;i<n;i++) {
			if(i<n/2) sum-=a[i]*2;
			else sum+=a[i]*2;
		}
		sum-=a[n/2]+a[n/2+1];
		ans=max(ans,sum);

		sum=0;
		for(int i=0;i<n;i++) {
			if(i<n/2+1) sum-=a[i]*2;
			else sum+=a[i]*2;
		}
		sum+=a[n/2]+a[n/2-1];
		ans=max(ans,sum);
	}
	else {
		for(int i=0;i<n;i++) {
			if(i<n/2) ans-=a[i]*2;
			else ans+=a[i]*2;
		}
		ans+=a[n/2-1]-a[n/2];
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  int N;
  cin >> N;
  for(int n=0; n<N; n++)
  { int A;
    cin >> A;
    if(A%2==0)
    { if(!(A%3==0 || A%5==0))
	    {
		  cout << "DENIED" << endl;
	      return 0;
    	}
      
    }
  }
  cout << "APPROVED" << endl;    
}


Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        s: String,
    }

    solve(s);
}

fn solve(s: String) {
    let mut cnt = 0;

    let n = s.len();
    let t: Vec<char> = s.chars().collect();
    for i in 0..(n / 2) {
        if !(t[i] == t[(n - 1) - i]) {
            cnt += 1;
        }
    }

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


Measured memory_bytes: 2124
#include<bits/stdc++.h>
using namespace std;
const int maxn=55;
int n,m,a[maxn],b[maxn],ans=0;
int main()
{
    scanf("%d %d",&n,&m);
	for(int i=0;i<n;i++)
		scanf("%d",&a[i]);
	
	int k=min(n,m);
	for(int l=0;l<=k;l++)
	{
		for(int r=0;r<=k-l;r++)
		{
			for(int i=0;i<l;i++) b[i]=a[i];
			for(int j=0;j<r;j++) b[l+j]=a[n-j-1];
			sort(b,b+l+r);
			int k=0,temp=0;
			while(k+l+r<m&&b[k]<0)
				k++;
			while(k<l+r)
			{
				temp+=b[k];
				k++;
			}
			
		ans=max(ans,temp);
		}
	}
	printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 256
N, D = $stdin.gets.split.map {|i| i.to_i }
cnt = 0
dd = D ** 2
0.upto(N - 1) do |n|
  x, y = $stdin.gets.split.map {|i| i.to_i }
  if x ** 2 + y ** 2 <= dd
    cnt += 1
  end
end
puts cnt


Measured memory_bytes: 14376
'use strict'

function Main(input) {
  const S = input;
  const chars = new Set();
  for (let i = 0; i < S.length; i++) {
	chars.add(S[i]);
  }

  if (!chars.has('a')) {
    console.log('a');
  } else if (!chars.has('b')) {
    console.log('b');
  } else if (!chars.has('c')) {
    console.log('c');
  } else if (!chars.has('d')) {
    console.log('d');
  } else if (!chars.has('e')) {
    console.log('e');
  } else if (!chars.has('f')) {
    console.log('f');
  } else if (!chars.has('g')) {
    console.log('g');
  } else if (!chars.has('h')) {
    console.log('h');
  } else if (!chars.has('i')) {
    console.log('i');
  } else if (!chars.has('j')) {
    console.log('j');
  } else if (!chars.has('k')) {
    console.log('k');
  } else if (!chars.has('l')) {
    console.log('l');
  } else if (!chars.has('m')) {
    console.log('m');
  } else if (!chars.has('n')) {
    console.log('n');
  } else if (!chars.has('o')) {
    console.log('o');
  } else if (!chars.has('p')) {
    console.log('p');
  } else if (!chars.has('q')) {
    console.log('q');
  } else if (!chars.has('r')) {
    console.log('r');
  } else if (!chars.has('s')) {
    console.log('s');
  } else if (!chars.has('t')) {
    console.log('t');
  } else if (!chars.has('u')) {
    console.log('u');
  } else if (!chars.has('v')) {
    console.log('v');
  } else if (!chars.has('w')) {
    console.log('w');
  } else if (!chars.has('x')) {
    console.log('x');
  } else if (!chars.has('y')) {
    console.log('y');
  } else if (!chars.has('z')) {
    console.log('z');
  } else {
    console.log('None');
  }
}

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

Measured memory_bytes: 7624
S=list(input())

chara=list("abcdefghijklmnopqrstuvwxyz")
chara_dic={}
for i in range(len(chara)):
	chara_dic[chara[i]]=i
chara_dic_2={}
for i in range(len(chara)):
	chara_dic_2[i]=chara[i]

count={}
for s in S:
	count[s]=count.get(s,0)+1

flag=0
if len(count)==len(chara):
	cur_chara=len(S)-1
	for pt in range(len(S)-2,-1,-1):
		if chara_dic[S[cur_chara]]<chara_dic[S[pt]]:
			cur_chara-=1
		else:
			flag=1
			ans=''
			for i in range(0,pt):
				ans+=str(S[i])
			ls=[]
			for i in range(pt+1,len(S)):
				if chara_dic[S[pt]]<chara_dic[S[i]]:
						ls.append(chara_dic[S[i]])
			ans+=chara_dic_2[min(ls)]
			break
else:
	flag=1
	ans=''
	for i in range(len(S)):
		ans+=S[i]
	for i in range(len(chara)):
		if chara[i] not in S:
			end=chara[i]
			break
	ans+=end

print(ans if flag else "-1")

Measured memory_bytes: 3064