akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> v(N);
  for(int i; i<N; i++){
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  double ans = v[0];
  for (int i=1; i<N; i++) ans = (ans+v[i])/2;
  printf("%.10f\n", ans);
  return 0;
}

Measured memory_bytes: 256
MOD=998244353
N,K=[int(s) for s in input().split()]
ls=[0 for _ in range(N)]
lssum=[0 for _ in range(N)]
ls[0]=1
lssum[0]=1

sections=[[int(s) for s in input().split()] for _ in range(K)]

for i in range(1,N):
  for sec in sections:
    if sec[0]>i:
      continue
    else:
      l=sec[0]
      r=min([i,sec[1]])
      ls[i]=(ls[i]+lssum[i-l]-lssum[i-r-1])%MOD
  lssum[i]=(lssum[i-1]+ls[i])%MOD
print(ls[N-1])
      

Measured memory_bytes: 24628
import scala.annotation.tailrec

object Main extends App {

  import scala.io.StdIn._

  solve
  @tailrec
  def solve: Unit = {
    val d = readLine.trim.split(' ').map(_.toInt)
    if (d(0) == 0) return
    println(
      d.map{
        case 1 ⇒ List(1, 11)
        case l if l > 10 ⇒ List(10)
        case l ⇒ List(l)
      }.foldLeft(List(0): List[Int]){
        case (l, r) ⇒ l.flatMap(i ⇒ r.map(_ + i)).filterNot(_ > 21).distinct
      }.let{
        case Nil ⇒ 0
        case l ⇒ l.max
      }
    )
    solve
  }

  implicit class Extention[T](value :T){
    @inline
    def let[A](@inline func: T ⇒ A): A = func(value)
    @inline
    def also(@inline func: T ⇒ Unit): T = {func(value); value}
  }
}


Measured memory_bytes: 44760
#include <iostream>

using namespace std;
typedef long long ll;
static const ll Z = 1 << 21;

#define rep(i,s,n)for(ll i = s;i<n;i++)
char s[Z];

ll ln;

ll strlength(const char* s) {
	ll n = 0;
	while (*s++)n++;
	return n;
}

ll dfs(ll i, ll sum, ll num) {
	if (i == ln) {
		return num ? 0 : sum;
	}
	num = num * 10 + (s[i] - '0');

	return dfs(i + 1, sum + num, 0) + dfs(i + 1, sum, num);
}

int main() {
	cin >> s;
	ln = strlength(s);
	cout << dfs(0, 0, 0) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(){
    int N, K, S; cin >> N >> K >> S;
    int temp = 1;
    if(S == 1000000000) temp = -1;


    for(int i = 0; i < N; i++){
        if(i < K) cout << S << " ";
        else cout << S + temp << " ";
    }
  cout << endl;
}

Measured memory_bytes: 1280
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t,class ...A> inline void read(t &x,A &...a){
	read(x);read(a...);
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}

#define int long long

const int N=25;
int a[N],n;

int dp(int l,int r,int p,int q){
	if(l+1>=r) return 0;
	int ans=1e15;
	for(int i=l+1;i<r;i++) ans=min(ans,dp(l,i,p,p+q)+dp(i,r,p+q,q)+a[i]*(p+q));
	return ans;
}

signed main(){
	read(n);
	for(int i=1;i<=n;i++) read(a[i]);
	write(dp(1,n,1,1)+a[1]+a[n]);
}

Measured memory_bytes: 3548
def main():
    from collections import deque

    h, w = map(int, input().split())
    grid = [input() for _ in range(h)]
    f_inf = float('inf')
    maze = [[f_inf] * w for _ in range(h)]
    maze[0][0] = 0
    que = deque([[0, 0]])
    while que:
        y, x = que.popleft()
        for i, j in ((1, 0), (-1, 0), (0, 1), (0, -1)):
            next_y, next_x = y + i, x + j
            if -1 < next_y < h and -1 < next_x < w:
                if grid[next_y][next_x] != "#":
                    if maze[next_y][next_x] > maze[y][x] + 1:
                        maze[next_y][next_x] = maze[y][x] + 1
                        que.append([next_y, next_x])

    if maze[h - 1][w - 1] != f_inf:
        res = h * w - (maze[h - 1][w - 1] + 1)
        for i in range(h):
            for j in range(w):
                if grid[i][j] == "#":
                    res -= 1
        print(res)
    else:
        print(-1)


if __name__ == '__main__':
    main()


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a/gcd(a, b) * b;
}

int main()
{
    cout << fixed << setprecision(15);
    ll K, S;
    cin >> K >> S;

    ll ans = 0;
    for(ll i=0; i<=K; i++){
        for(ll j=0; j<=K; j++){
            ll t = S-i-j;
            if(t>=0 && t<=K){
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3556
n,h = (int(i) for i in input().split())
A,B = [],[]
for _ in range(n):
    a,b = [int(i) for i in input().split()]
    A.append(a)
    B.append(b)
a_max = max(A)
B.sort(reverse=True)
power,ans = 0,0
for b in B:
    if a_max <= b:
        power += b
        ans += 1
        if power>=h: break
if power>=h:
    print(ans)
else:
    h -= power
    ans += h//a_max
    if h%a_max == 0: print(ans)
    else: print(ans+1)


Measured memory_bytes: 11300
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL (1LL<<62) // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

struct Edge{
    long long src, dst, weight, capacity;
    Edge(): src(0), dst(0), weight(0), capacity(0) {}
    Edge(long long s, long long d, long long w): src(s), dst(d), weight(w) {}
    Edge(long long s, long long d, long long w, long long c): src(s), dst(d), weight(w), capacity(c) {}
};

class Graph{
public:
    long long size;
    vector<vector<Edge>> node;
    Graph(long long n): size(n), node(n) {}
    void addEdge(long long s, long long d, long long w = 1){
        node[s].emplace_back(s, d, w);
        node[d].emplace_back(d, s, w);
    }
};

ll bfs(Graph &g, ll sn, ll n){
    vi num(n, 0);
    queue<ll> que;
    que.push(sn);
    num[sn] = 1;
    ll maxVertex = -1;

    // その時点での頂点から直接到達可能な頂点に+1の番号を振る
    // 矛盾が生じた時点で-1を返す
    while(que.size()){
        auto node = que.front();
        que.pop();
        for(auto &edge: g.node[node]){
            // 未訪問なら
            if(num[edge.dst] == 0){
                num[edge.dst] = num[node] + 1;
                que.push(edge.dst);
                chmax(maxVertex, num[edge.dst]);
            }
            // 既に追加済みなら
            else{
                // 隣接部分と集合番号が一致したら矛盾
                if(num[edge.dst] == num[node]) return -1;
            }
        }
    }

    return maxVertex;
}

bool isBipartiteGraph(Graph &g){
    long long n = g.size;
    vector<long long> num(n, 0LL);
    queue<long long> que;
    que.push(0);
    num[0] = 1LL;
    while(que.size()){
        long long node = que.front();
        que.pop();
        for(auto &edge: g.node[node]){
            if(num[edge.dst] == 0){
                num[edge.dst] = -num[node];
                que.push(edge.dst);
            }
            else if(num[edge.dst] == num[node]) return false;
        }
    }
    return true;
}

int main(){
    Init();
    ll n;
    cin >> n;
    Graph g(n);
    vector<string> s(n);
    rep(i, n){
        // 隣接リストの入力
        cin >> s[i];
        // 次数のカウントと辺の追加
        ll cnt = 0;
        rep(j, n){
            if(s[i][j] == '0') continue;
            cnt++;
            if(j <= i) continue;
            g.addEdge(i, j, 1);
        }
    }
    if(!isBipartiteGraph(g)){
        cout << -1 << endl;
        return 0;
    }

    ll ans = -2;
    for(ll i=0; i<n; i++) chmax(ans, bfs(g, i, n));
    cout << ans << endl;
}

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

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

    if( S == "SUN" ){
        cout << "7" << 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;
    }
    else if( S == "SAT" ){
        cout << "1" << endl;
    }
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb push_back
#define ld long double
#define f first
#define s second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e18 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
const long double pi = 3.1415926535897932384626433832795;
void solve(){
    int x, y, a, b, c;
    cin>>x>>y>>a>>b>>c;
    vi v1(a), v2(b), v3(c);
    map<int, int>u1, u2, u3;
    for(int i = 0; i < a; i++)cin>>v1[i];
    for(int i = 0; i < b; i++)cin>>v2[i];
    for(int i = 0; i < c; i++)cin>>v3[i];
    sort(all(v1)), sort(all(v2)), sort(all(v3));
    reverse(all(v1));
    reverse(all(v2));
    reverse(all(v3));
    vi p(x+y);
    for(int i = 0; i < x; i++)p[i]=v1[i];
    for(int i = x; i < x+y; i++)p[i]=v2[i-x];
    sort(all(p));
    int s = 0;
    for(auto i:p)s+=i;
    int i = 0;
    while(i<c&&i<x+y){
        if(p[i]<v3[i]){
            s-=p[i];
            s+=v3[i];
        }
        i++;
    }
    cout<<s;
}   
signed main(){
    speed;
    int t=1;
    // cin>>t;
    while(t--)solve();
}

Measured memory_bytes: 6836
///                                                     ببِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم
#include <bits/stdc++.h>
#define off  exit( 0 )
#define cn   continue
#define rt   return
#define sc   scanf
#define pr   printf
#define pb   push_back
#define pf   push_front
#define p_f  pop_front
#define p_b  pop_back
#define ff   first
#define ss   second
#define vec  vector
#define gcd  __gcd
#define pi   acos( -1 )
#define ll   long long
#define ld   long double
#define N    300256
#define M    1000000007
#define I    1000000000000000000
#define pdd  pair < ld, ld >
#define pll  pair < ll, ll >
#define pii  pair < int, int >
#define rep( a, b, c, d )  for( int a = b; a <= c; a += d )
#define rvv( a, b, c, d )  for( int a = b; a >= c; a -= d )
#define en                 printf( "\n" )
#define sqr( a )           a * a
#define all( c )           c.begin(), c.end()
#define srt( c )           sort( all( c ) )
#define rev( c )           reverse( all( c ) )
#define srtr( c )          sort( c.rbegin(), c.rend() )
#define numcounts          __builtin_popcount
#define mxn( x, y, z )     max( x, min( y, z ) )
#define mnx( x, y, z )     min( x, max( y, z ) )
const int dx[ ] = { 1, -1, 0, 0 };
const int dy[ ] = { 0, 0, -1, 1 };
using namespace std;
ll ttt = 1;
ll n, m;
string s, t, ans;
ll dp[3005][3005];

void solve()
{
    cin >> s >> t;
    n = s.size();
    m = t.size();
    s = "*" + s;
    t = "*" + t;
    for( int i = 1; i <= n; i ++ )
        for( int j = 1; j <= m; j ++ )
            dp[i][j] = max( max( dp[i-1][j], dp[i][j-1] ), dp[i-1][j-1] + ( s[i] == t[j] ) );
    while( n > 0 && m > 0 )
    {
        if( dp[n][m] == dp[n-1][m] )n --;
        else if( dp[n][m] == dp[n][m-1] )m --;
        else
        {
            ans = s[n] + ans;
            n --;
            m --;
        }
    }
    cout << ans;
}
int main()
{
    //sc( "%I64d", &ttt );
    for( int i = 0; i < ttt; i ++ )
        solve();
}














Measured memory_bytes: 70656
import java.util.*;

class Main {
	Scanner sc;
	int K, N;
	void calc() {
		sc = new Scanner(System.in);
		K = sc.nextInt();
		N = sc.nextInt();
		int max = Integer.MIN_VALUE;
		int a0 = sc.nextInt();
		int last = a0;
		for (int i = 1; i < N; i++) {
			int a = sc.nextInt();
			max = Math.max(max, a-last);
			last = a;
		}
		max = Math.max(max, K-last+a0);
		System.out.println( K-max );
	}
	
	public static void main(String[] args) {
		new Main().calc();
	}
}


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

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> a(M), b(M);
    rep(i, M) {
        cin >> a.at(i);
        cin >> b.at(i);
    }

    vector<int> roads(N, 0); // 都市から都市への道路の本数
    rep(i, M) {
        roads[a.at(i) - 1]++;
        roads[b.at(i) - 1]++;
    }

    rep(i, N) {
        cout << roads.at(i) << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import Control.Monad
import Control.Monad.ST
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [n,m] <- getIntList
    xys <- replicateM m $ do
        [x,y] <- getIntList
        return (x-1,y-1)
    let edges = V.create $ do
            vec <- VM.replicate n []
            forM_ xys $ \(x,y) -> VM.modify vec (y:) x
            return vec
    let ans :: Int
        ans = runST $ do
            vec <- VUM.replicate n (-1)
            let len x = do
                l <- VUM.read vec x
                if l >= 0 then
                    return l
                else do
                    ls <- mapM len (edges V.! x)
                    let a = if null ls then 0
                            else maximum ls + 1
                    VUM.write vec x a
                    return a
            maximum <$> mapM len [0..n-1]
    print ans

Measured memory_bytes: 51452
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	li := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&li[i])
	}
	sort.Ints(li)
	ans := 1000000001
	for i := 0; i <= n-k; i++ {
		if li[i+k-1]-li[i] == 0 {
			fmt.Println(0)
			return
		}
		if li[i+k-1]-li[i] < ans {
			ans = li[i+k-1] - li[i]
		}
	}
	fmt.Println(ans)
}

Measured memory_bytes: 5504
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#define rep(a,b,c) for(ll a=b;a<=c;a++)
#define per(a,b,c) for(ll a=b;a>=c;a--)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
typedef double db;
const int inf = 0x3f3f3f3f;
const int N = 4e5+5;
int n, m;
int k, x;

int main(){
    cin >> k >> x;
    cout << x - k + 1;
    rep(i,x-k+2,x+k-1) cout << " " << i;
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
n, a, b = gets.split.map(&:to_i)

if (b - a).even?
  puts (b - a) / 2
else
  c = a - 1 + 1 + (b - a - 1) / 2
  d = n - b + 1 + (b - a - 1) / 2
  puts [b - 1, n - a, c, d].min
end


Measured memory_bytes: 1788
let (N, K) = readLine()!.split(separator: " ").map { Int($0)! }.mapToTuple()
let As = readLine()!.split(separator: " ").map { Int($0)! }

var map = Array(repeating: [Int](), count: N)
var current = 1
var count = 0
// O(n^2)
while true {
    let hoge = As[current - 1]
    map[current - 1].append(count)
    if map[current - 1].count == 2 { break }
    current = hoge
    count += 1
}

let index = map.firstIndex(where: { $0.count == 2 })!
let (first, next) = map[index].mapToTuple()
if first <= K {
    let offset = (K - first) % (next - first)

    var result = index + 1
    // O(n)
    for _ in 0..<offset {
        result = As[result - 1]
    }
    print(result)
} else {
    print(map.firstIndex { $0.contains(K) }! + 1)
}

// MARK: -----------------------------------------------------------------------


extension Collection {
    func mapToTuple() -> (Element, Element) {
        var i = makeIterator()
        return (i.next()!, i.next()!)
    }
    func mapToTuple() -> (Element, Element, Element) {
        var i = makeIterator()
        return (i.next()!, i.next()!, i.next()!)
    }
    func mapToTuple() -> (Element, Element, Element, Element) {
        var i = makeIterator()
        return (i.next()!, i.next()!, i.next()!, i.next()!)
    }
}

struct DP<Argument: Hashable, Element> {
    var dictionary = [Argument: Element]()
    
    var expression: (Argument, (Argument) -> Element) -> Element
    
    init(expression: @escaping (_ argument: Argument, _ note: (Argument) -> Element) -> Element) {
        self.expression = expression
    }
    
    subscript(_ argument: Argument) -> Element {
        mutating get {
            if let note = dictionary[argument] {
                return note
            } else {
                let result = expression(argument) { self[$0] }
                dictionary[argument] = result
                return result
            }
        }
    }
}


Measured memory_bytes: 20540
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

typedef long long ll;

const int MAX_N=1e5;

int N;
ll A[MAX_N],diff[MAX_N];

void solve(){
	ll ans=0;
	ll sum=0;
	REP(i,N){
		sum+=A[i];
	}
	if (sum%((ll)N*(N+1)/2)!=0){
		cout<<"NO"<<endl;
		return;
	}
	ll a=sum/((ll)N*(N+1)/2);
	REP(i,N){
		if ((a-diff[i])%(ll)N!=0){
			cout<<"NO"<<endl;
			return;
		}
		if (0>(a-diff[i])/(ll)N || (a-diff[i])/(ll)N>a){
			cout<<"NO"<<endl;
			return;
		}
		ans+=(a-diff[i])/(ll)N;
	}
	if (ans==a){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
}

int main(){
	cin>>N;
	REP(i,N){
		cin>>A[i];
	}
	REP(i,N){
		diff[i]=A[(i+1)%N]-A[i];
	}
	solve();
	return 0;
}


Measured memory_bytes: 1792
def main():
    """
    はじめ、好きな単語を発言する
    以降、次の条件を満たす単語を発言することを繰り返す
        その単語はまだ発言していない単語である
        その単語の先頭の文字は直前に発言した単語の末尾の文字と一致する
    """
    N = int(input())
    W = [input() for _ in range(N)]

    ans = AC(N, W)
    print(ans)


def AC(N, W):
    for i, w in enumerate(W[1:]):
        if W.count(w) >= 2:
            return "No"

        if W[i][-1] != w[0]:
            return "No"

    return "Yes"


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <stdio.h>
#include<vector>
#include<climits>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<functional>
#include <numeric>
#include <map>
#define FORi(N) for(int i=0;i<N;++i)
#define FORj(N) for(int j=0;j<N;++j)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
ll gcd(ll m,ll n){
  if(n==0)return abs(m);
  return(gcd(n,m%n));
}
void putYN(bool b){
  if(b){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}
int main(){
  ll N;
  string s;
  cin>>N>>s;
  ll r=0;
  FORi(s.size()){
    if(s[i]=='R')r++;
  }
  
  putYN(s.size()/2<r);
  return 0;
}


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

using namespace std;

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

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

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

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

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {

	int x, y, z; cin >> x >> y >> z;

	int cure = x + y;

	cout << y + min(cure + 1, z) << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,count=1;
	cin>>n;
	string s[200000];
	long long i,j;
	for(i=0;i<n;i++)
	{
		cin>>s[i];
	}
	sort(s,s+n);
	for(i=1;i<n;i++)
	if(s[i]!=s[i-1])
	count++;
	cout<<count<<endl;
	return 0;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define pii pair<int,int>
#define all(x) begin(x), end(x)
#define loop(i,n) for(int i=0; i<n; i++)
#define rep(i,a,b,c) for(int i=a; i<b; i+=c)
#define brep(i,a,b,c) for(int i=a; i>b; i-=c)
#define tc(t) int t; cin>>t; while(t--)
#define sz(v) int((v).size())
#define pb push_back

const int maxm = 1000000000 + 7;


using namespace std;


int main()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int n, d;
	cin >> n >> d;

	cout << ceil((double)n / (2 * d + 1));



}

Measured memory_bytes: 3764
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Iterator;
import java.util.Queue;

class Graph01 {
	private int totalVertex;
	private LinkedList<LinkedList<Integer>> adjList;
	public Graph01() { totalVertex = 0; }
	public void loadAdjList() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		int totalH = in.nextInt();
		adjList = new LinkedList<LinkedList<Integer>>();
		for(int i = 0; i < totalVertex; i ++) {
			LinkedList<Integer> tmp = new LinkedList<Integer>();
			adjList.add(tmp);
		}
		for(int i = 0; i < totalH; i++) {
			int input1 = in.nextInt();
			int input2 = in.nextInt();
			adjList.get(input1).add(input2);
		}
		in.close();
	}
	public void tp() {
		int[] C = new int[totalVertex];
		Queue<Integer> Q = new LinkedList<Integer>();
		
		for(int i = 0; i < totalVertex; i++) {
			LinkedList<Integer> q = adjList.get(i);
			for(Integer neighbor:q) {
				C[neighbor] = C[neighbor] + 1;
			}
		}
		for(int i = 0; i <totalVertex; i++) {
			if(C[i] == 0) {
				Q.add(i);
			}
		}
		while(!Q.isEmpty()) {
			int answer = Q.poll();
			System.out.println(answer);
			LinkedList<Integer> w = adjList.get(answer);
			for(Integer neig:w) {
				C[neig] = C[neig] - 1;
				if(C[neig] == 0) {
					Q.add(neig);
				}
			}
		}
		
		
		
	}
}

//change class name GraphRepresentation to Main() for submission to AIZU
public class Main {
	public static void main(String argv[]) {
		Graph01 g = new Graph01();
		g.loadAdjList();
		g.tp();
	}
}



Measured memory_bytes: 72960
/**
 * author: moririn_cocoa       
**/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
using namespace std;

int main(void) {
  
  int K;
  int X;
  
  cin >> K;
  cin >> X;
  
  if ( X <= 500 * K ) {
    
    cout << "Yes" << endl;
  }
  
  else if ( X > 500 * K ) {
    
    cout << "No" << endl;
  }
  
  return 0;
}


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

using namespace std;

typedef  pair<int,int> P;
typedef long long LL;
typedef vector<LL> VEC;

const LL INF=1<<30;
const LL MOD=1000000007;


int main(){
    int n,a;
    cin>>n>>a;
    cout<<n*n-a<<endl;

}



Measured memory_bytes: 764
from collections import Counter
n=int(input())
a=sorted(map(int,input().split()))
ans={}
for i in range(n):
    ans[a[i]]=ans.get(a[i],0)+1
    ans[a[i]+1]=ans.get(a[i]+1,0)+1
    ans[a[i]-1]=ans.get(a[i]-1,0)+1
print(max(ans.values()))

Measured memory_bytes: 20284
<?php
/*
    Problem URL : http://abc060.contest.atcoder.jp/tasks/abc060_c

    Score  :
    Result :
    Time   : ms
    Memory : KB
 */

list($N, $T) = explode(" ", trim(fgets(STDIN)));
$t = explode(" ", trim(fgets(STDIN)));
$ans = 0;

for ($i = $N-2; $i >= 0; $i--) {
    if ($t[$i+1] - $t[$i] < $T) {
        $ans -= $T - ($t[$i+1] - $t[$i]);
    }
}

$ans += $N * $T;

echo $ans . PHP_EOL;


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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

#define L 0
#define R 1
//iが折り返す先 dp[i]
lli dp[100100];
string s;
lli func(lli now,lli dir)
{
	if(dp[now]!=INF)return dp[now];
	if(DEBUG)cout<<"now="<<now<<" dir="<<dir<<endl;
	char d[2]={'R','L'};
	if(s.at(now)==d[dir])return now;
	else return dp[now] = func(now+((dir==L)?-1:1),dir);
}

signed main(){

	REP(i,0,100100)dp[i]=INF;
	cin>>s;
	lli n = s.size();

	REP(i,0,s.size()){
		if(dp[i]==INF){
			if(s.at(i)=='R')func(i,R);
			else func(i,L);
		}
	}

	vector<lli> cnt(n,0);
	REP(i,0,s.size()){
		lli next = dp[i];
		lli diff = abs(dp[i]-i);
		if(diff%2){
			if(s.at(next)=='R')next++;
			else next--;
		}
		cnt[next]++;
	}
	REP(i,0,n)cout<<cnt[i]<<" ";
	cout<<endl;

  return 0;
}

Measured memory_bytes: 6912
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n - 1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define mrep(i,from,n) for(int i = from; i < n; i++)
#define mreps(i,from,n) for(int i = from; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
typedef long long ll;
typedef pair<ll, ll> P;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll MOD = 1000000007;

void solve()
{	
	ll a, b, c; cin >> a >> b >> c;
	if(a%2==0 || b%2==0 || c%2==0)
	{
		cout << 0 << endl;
	}
	else
	{
		cout << min(a*b,min(b*c,c*a)) << endl;
	}
	return;
}

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


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#define SF scanf
#define PF printf
#define MAXN 100010
#define INF 0x3FFFFFFF
using namespace std;
int n;
int a[MAXN],b[MAXN],cnta,cntb,val,k;
int main(){
	SF("%d%d",&n,&k);
	for(int i=1;i<=n;i++){
		SF("%d",&val);
		if(val>0)
			a[++cnta]=val;
		else
			b[++cntb]=-val;
	}
	sort(b+1,b+1+cntb);
	int ans=INF;
	for(int i=0;i<=k;i++){
		int k1=k-i;
		if(k1<=cntb&&i<=cnta)
			ans=min(ans,min(b[k1],a[i])+a[i]+b[k1]);
	}
	PF("%d",ans);
}

Measured memory_bytes: 512
arr = $stdin.gets.chomp.split(" ")
arr.map! do |a_j|
a_j.to_i
end

if arr[0] % 3 == 0 or arr[1] % 3 == 0 or (arr[0] + arr[1]) % 3 == 0
	puts "Possible"
else
	puts "Impossible"    
end

Measured memory_bytes: 1788
using System;
struct Vector
{
    public decimal x;
    public decimal y;
    public Vector(decimal x, decimal y)
    {
        this.x = x;
        this.y = y;
    }
    public static bool JudgePara(Vector v1, Vector v2)
    {
        return v1.x * v2.y - v1.y * v2.x == 0;
    }
}
class P
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        for (int i = 0; i < n; i++)
        {
            string[] s = Console.ReadLine().Split();
            decimal x1, x2, x3, x4, y1, y2, y3, y4;
            x1 = decimal.Parse(s[0]);
            y1 = decimal.Parse(s[1]);
            x2 = decimal.Parse(s[2]);
            y2 = decimal.Parse(s[3]);
            x3 = decimal.Parse(s[4]);
            y3 = decimal.Parse(s[5]);
            x4 = decimal.Parse(s[6]);
            y4 = decimal.Parse(s[7]);
            Vector ab = new Vector(x1 - x2, y1 - y2);
            Vector cd = new Vector(x3 - x4, y3 - y4);
            Console.WriteLine(Vector.JudgePara(ab, cd) ? "YES" : "NO");
        }
    }
}


Measured memory_bytes: 9400
/*************************************************************************
    > File Name: test.cpp
    > Author: Akira 
    > Mail: qaq.febr2.qaq@gmail.com 
 ************************************************************************/

#include<bits/stdc++.h>
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
#define MST(a,b) memset(a,b,sizeof(a))
#define CLR(a) MST(a,0)
#define Sqr(a) ((a)*(a))
using namespace std;

#define MaxN 100001
#define MaxM MaxN*10
#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626
const int mod = 1E9+7;
const double eps = 1e-6;
#define bug cout<<88888888<<endl;
#define debug(x) cout << #x" = " << x << endl;
LL N,M;
int main()
{
    //std::ios::sync_with_stdio(false);
    scanf("%lld%lld", &N, &M);
    LL need = N*2;
    LL ans = 0;
    if(need>M) ans = M/2;
    else
    {
        ans = (M-need)/4+N;
    }
    printf("%lld\n", ans);
    //system("pause");
}


Measured memory_bytes: 256
n, m = map(int, input().split())
a = list(map(int, input().split()))
w = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

dp = [-1] * (n+1)
dp[0] = 0

for i in range(n+1):
    for x in a:
        if i + w[x] < n+1:
            dp[i+w[x]] = max(dp[i+w[x]], dp[i]*10+x)


print(dp[n])


Measured memory_bytes: 50908
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
using namespace std;

int main() {
	unsigned long long int s=0;
	int d;
	while (cin >> d) {
		s = 0;
		for (int i = d; i <= 600 - d; i += d) {
			s += i*i*d;
		}
		cout << s << endl;
	}
	return 0;
}


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

using namespace std;

int main(){
    long long N;
    long long ans;

    while (cin >> N){
        for (int i = floor(sqrt(N)); i >= 1; i--){
            if(N % i == 0){
                long long j = N / i;
                ans = i + j -2;
                break;
            }
        }
        break;
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int i,j,ans[10]={0},n,tmp,sum;
	while(scanf("%d",&n),n){
		for(i=0;i<n;i++){
			for(j=0;j<n;j++){
				scanf("%d",&tmp);
				if(i==0)ans[j]=tmp;
				else ans[j]+=tmp;
				if(j==0)sum=tmp;
				else sum+=tmp;
				printf("%5d",tmp);
			}
			printf("%5d\n",sum);
		}
		for(i=0,sum=0;i<n;i++){
			printf("%5d",ans[i]);
			sum+=ans[i];
		}
		printf("%5d\n",sum);
	}
	return 0;
}

Measured memory_bytes: 612
n, m=map(int, input().split())
a=list(map(int, input().split()))
a.sort()
change=[]

for i in range(m):
    b, c=map(int, input().split())
    change.append((c, b))

change.sort(reverse=True)
elem=0

for c, b in change:
    while elem<n and b>0:
        if a[elem]<c:
            a[elem]=c
            b-=1
        elem+=1

print(sum(a))

Measured memory_bytes: 88936
// #include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

int main(){
  int N; scanf("%d",&N);
  vector<int> vec(N);
  int temp;
  for(int i = 0; i<N;i++){
    scanf("%d",&temp);
    vec.at(i) = -temp;
  }
  // int a = 0;
  // int b = 0;
  // if(N%2 == 0) a = N/2;
  // else a = N/2+1;
  // b = N-a;
  // vector<int> alice(a);
  // vector<int> bob(b);
  int ans = 0;
  sort(vec.begin(), vec.end());
  for(int i = 0;i < N; i++){
    // if(i%2==0) alice.at(i/2) = vec.at(i);
    // else bob.at(i/2) = vec.at(i);
    if(i%2==0) ans -= vec.at(i);
    else ans += vec.at(i);
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

bool AC[100000];
int cnt[100000];

int main()
{
	int N, M;
	int ans1 = 0, ans2 = 0;

	cin >> N >> M;
	rep(i, M) {
		int p;
		string S;
		cin >> p >> S;

		if (S == "AC") AC[p - 1] = true;
		else if (!AC[p - 1]) cnt[p - 1]++;
	}

	rep(i, N) {
		if (AC[i]) {
			ans1++;
			ans2 += cnt[i];
		}
	}

	cout << ans1 << ' ' << ans2 << endl;

	return 0;
}


Measured memory_bytes: 768
#include<stdio.h>
#include<string.h>

#define M 1046527
#define NIT (-1)
#define L 14

char H[M][L];

int getChar(char ch){
  if( ch == 'A' ) return 1;
  else if( ch == 'C' ) return 2;
  else if( ch == 'G' ) return 3;
  else if( ch == 'T' ) return 4;
  else return 0;
}

long long getKey(char str[]){
  long long sum=0,p=1,i;
  for(i=0;i<strlen(str);i++){
    sum+=p*(getChar(str[i]));
    p*=5;
  }
  return sum;
}

int h1(int Key){
  return Key%M;
}

int h2(int Key){
  return 1+(Key%(M-1));
}

int find(char str[]){
  long long Key,i,h;
  Key=getKey(str);
  for(i=0;;i++){
    h=(h1(Key)+i*h2(Key))%M;
    if(strcmp(H[h],str)==0){
      return 1;
    }
    else if(strlen(H[h])==0){
      return 0;
    }
  }
    return 0;
}

int insert(char str[]){
  long long Key,i,h;
  Key=getKey(str);
  for(i=0;;i++){
    h=(h1(Key)+i*h2(Key))%M;
    if(strcmp(H[h],str)==0){
      return 1;
    }
    else if(strlen(H[h])==0){
      strcpy(H[h],str);
      return 0;
    }
  }
  return 0;
}

int main(){
  int i,n,h;
  char str[L],com[9];

  for(i=0;i<M;i++){
    H[i][0]='\0';
  }

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s %s",com,str);

    if(com[0]=='i'){
      insert(str);
    }
    else{
      if(find(str)){
	printf("yes\n");
      }
      else{
	printf("no\n");
      }
    }
  }
  return 0;
}



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

int main() {
        string s, t;
        cin >> s >> t;
        int sl = s.size();
        int tl = t.size();
        bool ok1 = false;
        for(int i = sl-1; i >= 0; i--) {
                bool ok = true;
                for(int j = i, k = tl-1; k >= 0; j--,k--) {
                        if(j < 0) {
                                ok = false;
                                break;
                        }
                        if(s[j] != t[k] && s[j] != '?') {
                                ok = false;
                                break;
                        }
                }
                if(ok) {
                        for(int j = i, k = tl-1; k >= 0; j--, k--) {
                                s[j] = t[k];
                        }
                        ok1 = true;
                        break;
                }
        }
        if(ok1) {
                for(int i = 0; i < sl; i++) {
                        if(s[i] == '?') {
                                s[i] = 'a';
                        }
                }
                cout << s << endl;
         } else {
                 cout << "UNRESTORABLE" << endl;
         }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ThxDem=b;i<ThxDem;++i)
using namespace std;
typedef long long ll;

int n,m;
vector<int> g[100005];
bool vis[100005];
vector<int> p0,p1;

void dfs(int x, vector<int>& p){
	vis[x]=true;p.pb(x);
	for(int y:g[x])if(!vis[y]){dfs(y,p);return;}
}

int main(){
	scanf("%d%d",&n,&m);
	fore(i,0,m){
		int x,y;
		scanf("%d%d",&x,&y);x--;y--;
		g[x].pb(y);
		g[y].pb(x);
	}
	dfs(0,p0);
	dfs(0,p1);
	reverse(p0.begin(),p0.end());
	for(int x:p1)if(x)p0.pb(x);
	printf("%d\n",(int)p0.size());
	fore(i,0,p0.size()){
		if(i)putchar(' ');
		printf("%d",p0[i]+1);
	}
	puts("");
	return 0;
}

Measured memory_bytes: 9720
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int H = sc.nextInt();
			int W = sc.nextInt();
			if (H == 0 && W == 0) {
				break;
			}
			int i, j;
			for (i = 0; i < H; i++) {
				for (j = 0; j < W; j++) {
					if ((i + j) % 2 == 0) {
						System.out.printf("#");
					} else {
						System.out.printf(".");
					}
				}
				System.out.printf("\n");
			}
			System.out.printf("\n");
		}
		sc.close();
	}
}


Measured memory_bytes: 62720
import sys
import os
from operator import itemgetter


N,M= map(int, input().split())
A= list(map(int,input().split()))
B=[0]*M
C=[0]*M
for i in range(M):
    B[i], C[i] = map(int, input().split())
A.sort()
#print(A)

D=[list(x) for x in zip(*sorted(zip(C, B), key=itemgetter(0),reverse=True))]
B=D[1]
C=D[0]
k=0
#print(B)
#print(C)
for i in range(M):#C(i) i=1..M
    for j in range(B[i]):#B(i)の個数分C(i)を入れる j=0...Bi
        if k>N-1:
            break
        if A[k]>=C[i]:
            break
        else:
            A[k]=C[i]
            k=k+1
            continue
        break


Asum=sum(A)
#print(A)
print(Asum)

Measured memory_bytes: 31992
from itertools import combinations
n=int(input())
d=dict({'M':0,'A':0,'R':0,'C':0,'H':0})
for _ in range(n):
    s=input()[0]
    if s in d:
        d[s]+=1
ans=0
for a,b,c in list(combinations(d.keys(),3)):
    ans+=(d[a]*d[b]*d[c])
print(ans)


Measured memory_bytes: 9196
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigDecimal;
 

 class Main{
             
     public static void main(String args[]){
         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
         
         try{
             String line;
             while((line=br.readLine())!= null){if(line.isEmpty())break;
                String[] spli=line.split(",");
                
                 int num=Integer.parseInt(spli[0]);
                 double wei=Double.parseDouble(spli[1]);
                 double hig=Double.parseDouble(spli[2]);
                 if(wei/((hig)*(hig))>=25)System.out.println(num);
             }
             
         }catch(Exception e){}         
     }
     
     
    
 }

Measured memory_bytes: 16904
import sys
import math
from collections import defaultdict,deque
from itertools import permutations
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:list(input())
ips=lambda:input().split()
sys.setrecursionlimit(10**6)
"""========main code==============="""

t=1
for _ in range(t):
    a,b,c=ml()
    d=(c+1)//b
    d*=b
    if(d!=0):
        d-=1
    else: d=c    
    print((a*d)//b-a*(d//b))

Measured memory_bytes: 65336
#pragma once
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#define rep(i,n) for(auto i=0;i<(n);i++)
#define all(vs) (vs).begin(),(vs).end()
#define roundup(A,B) (A)/(B)+((A)%(B)==0?0:1)
using namespace std;


/*
  予想と答えをすべて比較するのが最速。O(n)
*/
void A() {
	string s, t;
	cin >> s >> t;
	int answer = 0;
	rep(i, s.length()) {
		if (s[i] == t[i])answer++;
	}
	cout << answer << endl;
}

/*
  タップを使うごとにA-1ずつ増える。Bと1の距離をA-1で割った（切り上げ）のが答え。
  A,Bの値によらないのでO(1)の解法である。
*/
void B() {
	int A, B; cin >> A >> B;
	cout << roundup(B-1, A-1) << endl;
}

int main(){B();}

Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		double r = scan.nextDouble();
		
		double men = r * r * Math.PI;
		double en = 2 * r * Math.PI;
		
		System.out.println(String.format("%f %f", men, en));
	}
}

Measured memory_bytes: 28232
#include <iostream>
#include <algorithm>
   
using namespace std;
   
bool isPrime ( int n )
{
  if (n == 2) { return true; }
  if ((n & 1) == 0) { return false; }
   
  for (int i = 3; (i*i) <= n; i += 2)
  {
    if ((n % i) == 0) { return false; }
  }
   
  return (n != 1);
}
   
int main ( void )
{
  int n, count = 0;
   
  cin >> n;
   
  for (int i = 0; i < n; ++i)
  {
    int p;
   
    cin >> p;
   
    if (isPrime(p)) { ++count; }
  }
   
  cout << count << endl;
   
  return 0;
}

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

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

	string t = "CODEFESTIVAL2016";
	int ans = 0;
	for( int i = 0; i < t.size(); i++ ) {
		if( s[i] != t[i] ) ans++;
	}

	cout << ans << endl;
}


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

int main(){
    int N;
    cin >> N;
    
    vector<int> S(pow(2, N));
    for (int i = 0; i < pow(2, N); i++){
        cin >> S.at(i);
    }
    sort(S.begin(), S.end());

    vector<int> bornSlimes;
    bornSlimes.reserve(pow(2, N));
    bornSlimes.emplace_back(S.back());
    S.pop_back();

    bool flag = true;
    vector<int> newSlimes;
    newSlimes.reserve(pow(2, N - 1));
    vector<int>::iterator itr;
    for (int i = 1; i < N + 1; i++){
        for (int j : bornSlimes){
            itr = lower_bound(S.begin(), S.end(), j);
            if (itr == S.begin()){
                flag = false;
                break;
            }
            itr--;
            newSlimes.emplace_back(*itr);
            S.erase(itr);
        }
        if (!flag) break;
        bornSlimes.insert(bornSlimes.end(), newSlimes.begin(), newSlimes.end());
        newSlimes.clear();
    }

    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 2816
#include<stdio.h>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<math.h>
#include<algorithm>
using namespace std;

#define INF 987654321
#define ll long long

int N;
int a[10101], b[10101];

int main()
{
	scanf("%d", &N);
	for (int i = 0; i < N; i++)
		scanf("%d", &a[i]);
	for (int i = 0; i < N; i++)
		scanf("%d", &b[i]);

	ll aa = 0, bb = 0;
	for (int i = 0; i < N; i++)
	{
		if (a[i] - b[i] < 0)
			aa += (b[i] - a[i]) / 2;
		else
			bb += a[i] - b[i];
	}
	if (aa >= bb) printf("Yes");
	else printf("No");

	return 0;
}

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

int main() {
	int		a,b,c,i,j,k,n,m,x,y,ans = 0;
	string	str,str1;

	
	cin >> str;
	cin >> str1;
	
	str1 = str1 + str;

	cout << str1 << endl;
	

}


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

#define _CRT_SECURE_NO_WARNINGS

#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define REP2(i, x, n) for(decltype(x) i = (x); i < (n); i++)
#define REP3(i, x, n) for(decltype(x) i = (x); i <= (n); i++)
#define RREP(i, n) for (decltype(n) i = (n) - 1; i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

// N, E, S, W
const int dx[4] = { 1, 0, -1, 0};
const int dy[4] = { 0, 1, 0, -1};

using LL = long long int;
using LD = long double;

const int INF = (1 << 30) - 1;
const LL INF64 = ((LL)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vs = vector<string>;
using vb = vector<bool>;

//==============================================
LL ans = 0;

void solve(string s) {
	REP3(i, 1, s.size()) {
		string s1 = s.substr(0, i);

		if (i != s.size()) {
			ans += atoll(s1.data()) * (int)pow(2, s.size() - i - 1);
		} else {
			ans += atoll(s1.data());
		}

		if (i != s.size()) {
			string s2 = s.substr(i);
			solve(s2);
		}
	}
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	string s;
	cin >> s;
	solve(s);

	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
typedef long long int lli;
using namespace std;
#pragma region DEBUG
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#pragma endregion DEBUG
#define MOD 1000000007
#define MAX 5000005
#define endl "\n"
lli arr[MAX];
bool p[1000005];
lli SPF[1000005];
long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
int DFS(int s, vector <bool> &visited, vector <vector<lli> > &adj){
    int ctr = 1;
    visited[s] = true;
   // cout<<s<<endl;
    for(auto i : adj[s]){
        if(!visited[i])
            ctr += DFS(i,visited,adj);
    }
    return ctr;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);    
   // freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    lli t;
    for(lli i = 2; i<=1000000; i++){
        if(!p[i]){
            SPF[i] = i;
            for(lli j = i*i; j<=1000000; j+=i){
                p[j] = true;
                SPF[j] = i;
            }
        }
    }
    t =1 ;
    while(t--){
        lli n,m;
        cin>>n;
        set <lli> pri;
        lli gcd = 0;
        bool a = true;
        for(int i  = 0; i<n; i++)
            cin>>arr[i];
        for(int i = 0; i<n; i++){
            gcd = __gcd(gcd,arr[i]);
            while(arr[i] > 1){
                if(pri.count(SPF[arr[i]]))
                    a = false;
                else
                    pri.insert(SPF[arr[i]]);
                int q = SPF[arr[i]];
                while(arr[i] > 1 && arr[i]%q == 0)
                    arr[i] /= q;
            }
        }
        if(a)
            cout<<"pairwise coprime"<<endl;
        else if(gcd == 1)
            cout<<"setwise coprime"<<endl;
        else 
            cout<<"not coprime"<<endl;
    }
}


Measured memory_bytes: 23792