akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  NodePointer a;
  for(a=nil->next;a!=nil;a=a->next){
if(a->key==key)return a;
}
  return NULL;
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  
  t->next->prev=t->prev;
t->prev->next=t->next;
  free(t);
}

void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast(){
 NodePointer t = nil->prev;
  if ( t == nil ) return;
  deleteNode(t);
}

void delete(int key){
NodePointer t = listSearch(key);
 if(t==NULL)return;
 deleteNode(t);
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;
  x->next=nil->next;
 
  nil->next->prev=x;
 nil->next=x;
  x->prev=nil;
}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	delete(key); nd++; 
      }
      size--;
    }
  }

  printList();
  return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, s, e) for (int i = (int)(s); i < (int)(e); i++)
#define _rep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define _REP(i, e, s) for (int i = (int)(e - 1); i >= (int)(s); i--)

#define yes cout << "yes" << endl;
#define Yes cout << "Yes" << endl;
#define YES cout << "YES" << endl;

#define no cout << "no" << endl;
#define No cout << "No" << endl;
#define NO cout << "NO" << endl;

#define AC cout << "AC" << endl;
#define WA cout << "WA" << endl;

#define out(s) cout << s << endl;

#define ll long long
#define ull unsigned long long
#define vi vector<int>

const double PI = 3.14159265358979323846;

int main() {
    int A, B;
    cin >> A >> B;
    cout << (A - 1) * (B - 1) << endl;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 1000000007LL
#define maxn 100005
#define IN freopen("C.in","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2

using namespace __gnu_pbds;
using namespace std ;

typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef pair<int, int> pi;

char s[maxn] ;

int main()
{
    int i , j , k , l , m , n ;

    scanf("%s",s) ;
    n= strlen(s) ;

    int res = n - ( s[0]==s[n-1] ) ;

    if( res%2==1 ) printf("First\n") ;
    else printf("Second\n") ;

    return 0 ;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		
		int len = s.length() - 2;
		
		System.out.println(s.substring(0, 1) + len + s.substring(s.length() - 1, s.length()));
	}

}


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

int main() {
    ll X,Y,A,B,C,s=0;
	cin >> X >> Y >> A >> B >> C;
	vector<ll> p(A),q(B),r(C),ap(X+Y+C);

	rep(i,A)
		cin >> p.at(i);
	rep(i,B)
		cin >> q.at(i);
	sort(p.begin(), p.end(), greater<ll>());
	sort(q.begin(), q.end(), greater<ll>());

	rep(i,X)
		ap.at(i) = p.at(i);
	rep(i,Y)
		ap.at(i+X) = q.at(i);
	rep(i,C)
		cin >> ap.at(i+X+Y);
	sort(ap.begin(), ap.end(), greater<ll>());

	rep(i,X+Y)
		s += ap.at(i);
	cout << s << endl;
}

Measured memory_bytes: 4736
line = readlines.map(&:chomp)

num_count = line[0].split(" ")
nums = line[1].split(" ")


nums_hash = Hash.new(0)

nums.each do |num|
  nums_hash[num] += 1
end

ans = "YES"

nums_hash.each_value do |v|
  if 1 < v
    ans = "NO"
  end
end

puts ans


Measured memory_bytes: 37252
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = 1LL<<60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;


struct UnionFind {
    vector<int> d; 

    UnionFind(int N=0) : d(N, -1){} 

    int find(int x) { 
        if (d[x] < 0) return x;
        return d[x] = find(d[x]);
    }

    bool unite(int x, int y) {
        x = find(x); 
        y = find(y); 
        if (x == y) return false;
        if (d[x] > d[y]) swap(x,y);
        d[x] += d[y];
        d[y] = x; 
        return true; 
    }

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

    int size(int x){
        return -d[find(x)];
    }
};


int main(){
    int N, M; cin >> N >> M;
    vector<pair<int, int>> edges;
    rep(i,M){
        int a, b; cin >> a >> b;
        a--;
        b--;
        edges.emplace_back(a, b);
    }
    UnionFind uf(N);
    vector<ll> ans(M+1);
    ans[M-1] = (ll)N*(N-1)/2;
    for (int i = M-1; i >= 1; i--){
        ans[i-1] = ans[i];
        int vertex1 = edges[i].first;
        int vertex2 = edges[i].second;
        if(!uf.same(vertex1, vertex2)){
            ans[i-1] -= uf.size(vertex1) * uf.size(vertex2);
            uf.unite(vertex1, vertex2);
        }
    }

    rep(i,M){
        cout << ans[i] << endl;
    }

}

Measured memory_bytes: 3316
import fractions
n, m = map(int,input().split())
s = input()
t = input()
g = fractions.gcd(n, m)
l =  n * m // g
flag = True

for i in range(g):
    if s[i * n // g] != t[i * m // g]:
        flag = False

if flag:
    print(l)
else:
    print(-1)

Measured memory_bytes: 5432
<?php

class Scanner
{
    private $arr = [];
    private $count = 0;
    private $pointer = 0;

    public function next()
    {
        if ($this->pointer >= $this->count) {
            $str = trim(fgets(STDIN));
            $this->arr = explode(' ', $str);
            $this->count = count($this->arr);
            $this->pointer = 0;
        }
        $result = $this->arr[$this->pointer];
        ++$this->pointer;

        return $result;
    }

    public function hasNext()
    {
        return $this->pointer < $this->count;
    }

    public function nextInt()
    {
        return (int) $this->next();
    }

    public function nextDouble()
    {
        return (float) $this->next();
    }
}

$sc = new Scanner();
$n = $sc->nextInt();
$array = [];

for($i=0;$i<$n;$i++){
    $array[$i] = $sc->nextInt();
}

rsort($array);

$answer = $array[0] / 2;

for($i=1;$i<$n;$i++){
    $answer = $answer + $array[$i];
}

echo $answer.PHP_EOL;

Measured memory_bytes: 16044
# ABC 080
def getInt(): return int(input())
def db(x): 
    global debug
    if debug: print(x)
debug = False

def getDigitList(n):
    list = []
    while n>0:
        list.append(n%10)
        n //= 10
    if list==[]: list = [0]
    return list
N = getInt()
dsum = sum(getDigitList(N))
db(dsum)
if N%dsum==0: print('Yes')
else: print('No')


  

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 1000000000
#define MOD 1000000007

typedef  long long ll;

using namespace std;

double euclid_distance(double a,double b){
    return sqrt(a*a+b*b);
}

int gcd(long long int a,long long int b){
    long long int r;
    if(a < b){
        a = a^b;
        b = a^b;
        a = a^b;
    }
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

void Integer_factorization(long long int b,long long int n){
    long long int a = 2;
    long long int count = 0;
    long long int ans = 1;
    long long int ndash = n;
    if(b == 1) cout << n << endl;
    else{
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }
    cout<<  ans << endl;
    }
}

void ys(){
    cout << "Yes" << endl;
}

void yb(){
    cout << "YES" << endl;
}

void ns(){
    cout << "No" << endl;
}

void nb(){
    cout << "NO" << endl;
}


void solve(void){
    int n;
    cin >> n;
    int p[n];
    rep(i,0,n) cin >> p[i];
    int m = 0;
    int ans = 0;
    rep(i,0,n){
        m = max(m,p[i]);
        ans += p[i];
    }
    cout << ans-m+m/2 <<endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
}

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


int main() {
	int N, T, A;
	cin >> N >> T >> A;
	vector<int> H(N);
	for(int i = 0; i < N; i++){
		cin >> H.at(i);
	}
	int min_index = 0;
	for(int i = 1; i < N; i++){
		if(abs(T - H.at(i) * 0.006 - A) < abs(T - H.at(min_index) * 0.006 - A)){
			min_index = i;
		}
	}
	cout << min_index + 1 << endl;
	return 0;
}

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

using namespace std;
#define int long long
#define rep(i, n) for(int i=0;i<(n);++i)
#define INF (1ll<<60)
typedef pair<int, int> pii;
typedef pair<pii, int> ppi;
typedef pair<int, pii> pip;

int N;
ppi px[100100];
ppi py[100100];
vector<pip> edge;

struct UF {
    int N;
    const static int size = 100100;
    int par[size];

    UF(int n) {
        N = n;
        rep(i, n) {
            par[i] = i;
        }
    }

    int root(int x) {
        if (par[x] == x)return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        if (root(x) != root(y)) {
            par[root(x)] = root(y);
        }
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }
};

signed main() {
    cin >> N;
    rep(i, N) {
        int x, y;
        cin >> x >> y;
        px[i] = ppi(pii(x, y), i);
        py[i] = ppi(pii(y, x), i);
    }
    sort(px, px + N);
    sort(py, py + N);
    rep(i, N - 1) {
        int x0 = px[i].first.first;
        int x1 = px[i + 1].first.first;
        int cost = x1 - x0;
        int i0 = px[i].second;
        int i1 = px[i + 1].second;
        edge.push_back(pip(cost, pii(i0, i1)));
    }
    rep(i, N - 1) {
        int y0 = py[i].first.first;
        int y1 = py[i + 1].first.first;
        int cost = y1 - y0;
        int i0 = py[i].second;
        int i1 = py[i + 1].second;
        edge.push_back(pip(cost, pii(i0, i1)));
    }
    sort(edge.begin(), edge.end());

    UF uf(N + 10);
    int ans = 0;
    rep(i, edge.size()) {
        pii p = edge[i].second;
        if (!uf.same(p.first, p.second)) {
            ans += edge[i].first;
            uf.unite(p.first, p.second);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 13168
import std.stdio, std.string, std.conv, std.algorithm;

void main() {
    int n = readln.chomp.to!int;
    int[] p = new int[n+1];
    foreach(i; 1 .. n+1) {
        int[] tmp = readln.chomp.split.to!(int[]);
        p[i-1] = tmp[0], p[i] = tmp[1];
    }
    int[][] m = new int[][](n+1, n+1);
    foreach (l; 2 .. n+1) {
        foreach (i; 1 .. n-l+2) {
            int j = i + l - 1;
            m[i][j] = 1 << 21;
            foreach (k; i .. j) {
                m[i][j] = min(m[i][j], m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]);
            }
        }
    }
    m[1][n].writeln;
}


Measured memory_bytes: 2500
Imports System

Module Program
    Sub Main(args As String())
        Dim S As String = Console.ReadLine()
        Dim T As String = Console.ReadLine()

        Dim ans As String = ""
        If S = Left(T, Len(S)) Then
            ans = "Yes"
        Else
            ans = "No"
        End If

        Console.WriteLine(ans)

    End Sub
End Module


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define int ll

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

  int H,W,N;
  cin>>H>>W>>N;
  vector<int>a(N),b(N);
  for(int i=0;i<N;i++)cin>>a[i]>>b[i];
  map<pii,int>m;
  for(int i=0;i<N;i++){
    for(int dx=0;dx>=-2;dx--){
      for(int dy=0;dy>=-2;dy--){
        int y=a[i]-1+dy;
        int x=b[i]-1+dx;
        if(0<=y&&y<H&&0<=x&&x<W)m[{y,x}]++;
      }
    }
  }
  vector<int>ans(10);
  for(auto it:m){
    if(it.first.second>=W-2||it.first.first>=H-2)continue;
    ans[it.second]++;
  }
  ll all=(H-2)*(W-2);
  ll sum=0;
  for(auto it:ans)sum+=it;
  ans[0]=all-sum;
  for(auto it:ans)cout<<it<<endl;
  return 0;
}


Measured memory_bytes: 58112
import java.util.*;
import java.lang.*;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int l = sc.nextInt();
		int r = sc.nextInt();
		if (r - l >= 2019) {
			System.out.println(0);
		} else {
			int min = 2019;
			for (int i = l % 2019; i <= l % 2019 + (r - l); i++) {
				for (int j = i + 1; j <= l % 2019 + (r - l); j++) {
					min = Math.min(min, i * j % 2019);
				}
			}
			System.out.println(min);
		}
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for(int i=m; i<n; i++)
typedef long long ll;

int main() {
  ll a[3];
  rep(i,0,3) cin>>a[i];
  sort(a,a+3);
  if(a[0]%2==0||a[1]%2==0||a[2]%2==0) cout<<0<<endl;
  else{
    cout<<a[0]*a[1]<<endl;
  }
}

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

//#include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
// using cint = cpp_int;
//#pragma GCC optimize("", on)
//#pragma GCC optimization_level 3

// Define
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ull MAX = ULONG_MAX;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define x first
#define y second
#define endl '\n'
#define space ' '
#define def inline auto
#define func inline constexpr ll
#define run __attribute__((constructor)) def _
#define all(v) begin(v), end(v)
#define input(a) scanf("%lld", &(a))
#define print(a) printf("%lld\n", (a))

// Debug
#define debug(...)                                                             \
    {                                                                          \
        cerr << __LINE__ << ": " << #__VA_ARGS__ << " = ";                     \
        for (auto &&X : {__VA_ARGS__}) cerr << "[" << X << "] ";               \
        cerr << endl;                                                          \
    }

#define dump(a, h, w)                                                          \
    {                                                                          \
        cerr << __LINE__ << ": " << #a << " = [" << endl;                      \
        rep(i, h) {                                                            \
            rep(j, w) cerr << a[i][j] << space;                                \
            cerr << endl;                                                      \
        }                                                                      \
        cerr << "]" << endl;                                                   \
    }

#define lldump(a, n) dump(vector<vector<ll>>{a}, 1, n)

// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i <= _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i >= _##i; --i)
#define each(i, a) for (auto &&i : a)
#define rep(i, n) inc(i, 0, n - 1)
#define loop() for (;;)

// Stream
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)

// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("O3")
#pragma GCC target("avx")

// Math
func gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
func lcm(ll a, ll b) { return a * b / gcd(a, b); }
func sign(ll a) { return a ? abs(a) / a : 0; }

def in() {
    ll A;
    cin >> A;
    return A;
}

string S;
signed main() {
    cin >> S;
    ll status = 0;
    rep(i, S.size()) {
        if(S[i] == 'C' && status == 0) status = 1;
        if(S[i] == 'F' && status == 1) status = 2;
    }
    if(status == 2) return puts("Yes") & 0;
    return puts("No") & 0;
}

// for compilation: g++ -Ofast -march=native -o _ _.cpp -std=c++17

Measured memory_bytes: 256
#include <iostream>
#include <vector>


using namespace std;


void atcoder_beginner_contest999()
{
  string n;
  cin >> n;

  for (int i = 0; i < n.size(); ++i)
  {
    if (n[i] == '1') n[i] = '9';
    else if (n[i] == '9') n[i] = '1';
  }
  cout << n << "\n";
}


void programming_education()
{
  int n;
  cin >> n;
  
  if (n == 1)
  {
    cout << "Hello World\n";
    return;
  }
  else
  {
    int a, b;
    cin >> a >> b;
    cout << a + b << "\n";
  }
}

void discount_fare()
{
  int x, y;
  cin >> x >> y;

  cout << x + y / 2 << "\n";
}


void A_114()
{
  int x;
  cin >> x;

  if (x == 3 || x == 5 || x == 7) cout << "YES\n";
  else cout << "NO\n";
}


void christmas_eve_eve_eve()
{
  int d;
  cin >> d;

  if (d == 25) cout << "Christmas\n";
  else if (d == 24) cout << "Christmas Eve\n";
  if (d == 23) cout << "Christmas Eve Eve\n";
  if (d == 22) cout << "Christmas Eve Eve Eve\n";
}


void right_triangle()
{
  int a, b, c;
  cin >> a >> b >> c;

  cout << a * b / 2 << "\n";
}


int main()
{
  //atcoder_beginner_contest999();
  //programming_education();
  //discount_fare();
  //A_114();
  //christmas_eve_eve_eve();
  right_triangle();
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (a, b, c, d) = readLine()!!.split(" ").map { it.toInt() }
    println(Line(a, b).overlapLength(Line(c, d)))
}

class Line(private val start: Int, private val end: Int) {
    fun overlapLength(other: Line): Int {
        return max(0, min(this.end, other.end) - max(this.start, other.start))
    }
}

fun max(a: Int, b: Int): Int = if (a > b) a else b
fun min(a: Int, b: Int): Int = if (a < b) a else b

Measured memory_bytes: 35948
S = input()

list1 = list(S)

flag = False
for i in range(len(list1)):
    if i %2 == 0:
        if list1[i] == "L":
            flag = True
            break
    else:
        if list1[i] == "R":
            flag = True
            break

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


Measured memory_bytes: 2940
#include <stdio.h>
int main(void){
int  n,a,min=1000000,max=-1000000,i;
long long sum=0;

scanf("%d\n",&n);

for(i=0;i<n;i++){
    scanf("%d",&a);
    sum=sum+a;
    if(min>a) min=a;
    if(max<a) max=a;
}
printf("%d %d %lld\n",min,max,sum);
return 0;
}



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

int main(){
  string s,t,u;
  int a,b;
  cin>>s>>t>>a>>b>>u;
  if(s==u) a--;
  else b--;
  cout<<a<<' '<<b<<endl;
  return 0;
}

Measured memory_bytes: 256
(n, m) = [int(i) for i in input().split()]
A = []
b = []
for i in range(n):
    A.append([int(j) for j in input().split()])

for i in range(m):
    b.append(int(input()))

for i in range(n):
    s = 0
    for j in range(m):
        s += A[i][j] * b[j]
    print(s)

Measured memory_bytes: 7008
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

const int H = 60;
const int LLB = 11 * H, LUB = 14 * H + 59, DLB = 18 * H, DUB = 20 * H + 59,
      MLB = 21 * H, MUB = 25 * H + 59;
const int LB[] = {11*H, 18 * H, 21 * H};
const int UB[] = {14 * H + 59, 20 * H + 59, 25 * H + 59};


string s[] = {"lunch", "dinner", "midnight"};

int main()
{
    int n;
    while(cin >> n && n)
    {
        int g[3] = {}, ok[3] = {}, hh, mm, hand, card;
        char t;
        REP(n)
        {
            cin >> hh >> t >> mm >> hand;
            if(hh <= 2) hh += 24;
            card = hh * H + mm;

            rep(j,3)
                if(card >= LB[j] &&card <= UB[j])
                {
                    g[j]++;
                    if((H + hand - mm)%H <= 8)ok[j]++;
                }
        }
        REP(3)
            if(g[i] > 0){cout << s[i] << " " << ok[i] * 100 / g[i] << endl;}
            else cout << s[i] << " no guest" << endl;
    }

    return 0;
}

Measured memory_bytes: 0
/*
 * Contents   : AOJ DPL 1 D 
 * Author     : KitauraHiromi
 * LastUpdate : 20180613
 * Since      : 20180613
 */
#include <iostream>
#include <cmath>
#include <cstring>
using namespace std;
int N;
int INF = 1e9 + 1;
int dp[100001]; // dp[i]: i番目までの文字を見たときのLIS
int a[100001];
int main(void){
    cin >> N;
    for(int i=0; i<N; ++i) cin >> a[i];
    fill(dp, dp+N, INF);
    for(int i=0; i<N; ++i){
        *lower_bound(dp, dp+N, a[i]) = a[i];
    }
    cout << lower_bound(dp, dp+N, INF) - dp << endl;
    return 0;
}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

const int MOD = 1000000007;

struct Edge {
    int to, id;
};

int main() {
    int N;
    cin >> N;
    vector<vector<Edge>> g(N);
    vector<int> ans(N - 1);
    rep(i, N - 1) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        g[a].push_back((Edge) {b, i});
        g[b].push_back((Edge) {a, i});
    }

    queue<int> q;
    vector<bool> used(N);
    q.push(0);
    used[0] = true;
    while (!q.empty()) {
        int v = q.front();
        q.pop();

        int c = -1; // 親で塗った色
        rep(i, g[v].size()) {
            int u = g[v][i].to, ei = g[v][i].id;
            if (used[u]) c = ans[ei];
        }

        int k = 1;
        rep(i, g[v].size()) {
            int u = g[v][i].to, ei = g[v][i].id;
            if (used[u]) continue; // 親との辺はスキップする
            if (k == c) ++k; // 親で使用した色は使わない
            ans[ei] = k;
            k++;
            q.push(u);
            used[u] = true;
        }
    }

    int mx = 0;
    rep(i, N) mx = max(mx, int(g[i].size()));

    cout << mx << endl;
    rep(i, N - 1) {
        cout << ans[i] << endl;
    }
}


Measured memory_bytes: 7040
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string x,y;
	cin>>x>>y;
	int x_size=x.size();
	int y_size=y.size();
	int res=x_size;
	 int p;
	for(int i=0;i<=(x_size-y_size);i++){
	    p=0;
        for(int j=0;j<y_size;j++){
        if(y[j]!=x[i+j]){
            p++;
        }
	  }
	res=min(res,p);
	}
	cout<<res;

	return 0;
}


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

using namespace std;

int main()
{
    string s;
    cin >> s;
    bool ok=1;
    if(s.size()%2) ok=0;
    for(int i=0;i<(int)s.size();i+=2) if(!(s[i]=='h'&&s[i+1]=='i')) ok=0;
    if(ok) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}


Measured memory_bytes: 256
n, k = map(int,input().split())
a = list(map(int,input().split()))
idx = -1
for i in range(n-1):
    if a[i]+a[i+1]>=k:
        idx = i
        break
if idx == -1:
    print('Impossible')
    exit()
else:
    print('Possible')
    for i in range(1, idx+1):
        print(i)
    for i in range(n-1, idx, -1):
        print(i)

Measured memory_bytes: 20092
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using pii = pair<int, int>;

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

  string S, T; cin >> S; cin >> T;
  char s, t;
  unordered_map<char, char> dic, dic2;
  int ok=1;
  rep(i, S.size()) {
    s = S[i]; t = T[i];
    if (dic.count(s) == 0) {
      dic[s] = t;
    }
    else {
      if (dic[s] != t) {
        ok = 0;
      }
    }
    if (dic2.count(t) == 0) {
      dic2[t] = s;
    }
    else {
      if (dic2[t] != s) {
        ok = 0;
      }
    }
  }
  string ans = ok ? "Yes" : "No";
  cout << ans << endl;
}


Measured memory_bytes: 916
#include <bits/stdc++.h>
#define f(i,j,k) for(int i=j;i<k;i++)
using namespace std;
int main(){
    long long a,b,c,x,ans=0;
    cin>>a;
    cin>>b;
    cin>>c;
    cin>>x;
    f(i,0,a+1){
        f(j,0,b+1){
            f(k,0,c+1){
                if(i*500+j*100+k*50==x){
                    ans++;
                }
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
using ll =long long;
#define SORT(i) sort((i).begin(),(i).end())
#define INF 2000000000
constexpr ll mod = 1000000007;

ll gcd(ll x, ll y) {
	return y != 0 ? gcd(y, x % y) : x;
}

int main() {
	int N;
	ll X;
	cin >> N >> X;
	vector<ll>A(N);
	for (int i = 0;i < N;++i) {
		cin >> A[i];
	}
	for (int i = 0;i < N;++i) {
		A[i] = abs(A[i] - X);
	}
	for (int i = 0;i < N - 1;++i) {
		A[i + 1] = gcd(A[i], A[i + 1]);
	}
	cout << A[N-1] << "\n";

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define vi vector<int>
#define vb vector<bool>
#define pii pair<int,int>
#define mod 1000000007
#define ss second
#define ff first
#define vpii vector<pii>
#define vvi vector<vi>
#define pb push_back
#define vs vector<string>
const int inf=0x3f3f3f3f3f3f3f3f;
int func(int i,vi &v,vi &dp){
    if(i<0)return inf;
    if(i==0)return 0;
    if(dp[i]!=-1)return dp[i];
    dp[i] = min(func(i-1,v,dp)+abs(v[i]-v[i-1]),func(i-2,v,dp)+abs(v[i]-v[i-2]));
    return dp[i];
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,i;
    cin>>n;
    vi v(n);
    for(i=0;i<n;i++)cin>>v[i];
    vi dp(n,-1);
    cout<<func(n-1,v,dp)<<endl;
    return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n=0;
    cin>>n;
    int h[n];
    memset(h,0,sizeof(h));
    for(int i=0;i<n;i++) cin>>h[i];
    int minCost[n];
    memset(minCost,0,sizeof(minCost));
    minCost[1]=abs(h[1]-h[0]);
    for(int i=2;i<n;i++){
        int temp1=minCost[i-1]+abs(h[i]-h[i-1]),temp2=minCost[i-2]+abs(h[i]-h[i-2]);
        minCost[i]=min(temp1,temp2);
    }
    cout<<minCost[n-1]<<endl;
}


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

using namespace std;

int main()
{
    int r, g, b;    cin >> r >> g >> b;
    int x = r * 100 + g * 10 + b;

    if (x % 4 == 0)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
  
  #define ll long long
  #define N 1100
  const ll MOD = (ll)1e9 + 7;
  int n, m, a[N], b[N];
  
  bool check()
 {
     for (int i = 1; i <= n; ++i) for (int j = i + 1; j <= n; ++j)
         if (a[i] == a[j]) return false;
     for (int i = 1; i <= m; ++i) for (int j = i + 1; j <= m; ++j)
         if (b[i] == b[j]) return false; 
    return true; 
 }
 
 int main()
 {
    if (scanf("%d%d", &n, &m) != EOF)
    {
         for (int i = 1; i <= n; ++i) scanf("%d", a + i);
         for (int i = 1; i <= m; ++i) scanf("%d", b + i);
         sort(a + 1, a + 1 + n);
         sort(b + 1, b + 1 + m);
         if (!check()) puts("0");  
         else
         {
             a[n + 1] = n + 1;
             b[m + 1] = m + 1;
             int l[2] = {0, 0};
             ll res = 1; 
             for (int i = 1; i <= n * m; ++i)
             {
                 while (l[0] <= n && a[l[0]] < i) ++l[0]; 
                 while (l[1] <= m && b[l[1]] < i) ++l[1];
                 ll d = 0;
                 if (a[l[0]] == i && b[l[1]] == i)
                     d = 1;
                 else if (a[l[0]] == i && b[l[1]] != i)
                     d = m - l[1] + 1;
                 else if (b[l[1]] == i && a[l[0]] != i)
                     d = n - l[0] + 1;
                 else
                     d = (m - l[1] + 1) * (n - l[0] + 1) - (n * m - i);
                 res = (res * d) % MOD; 
             } 
             printf("%lld\n", res);
         }
     }
     return 0;
 }

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
#define int long long
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000000000000;

int N,M;
int A[100010];
vector<int> V;
int ans=0;

signed main(){
	cin>>N>>M;
	REP(i,M){
		cin>>A[i];
	}
	sort(A,A+M);
	REP(i,M-1){
		V.push_back(A[i+1]-A[i]);
	}
	sort(V.begin(),V.end());
	REP(i,M-N){
		ans+=V[i];
	}
	cout<<ans<<endl;
	return 0;
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


int main() {
    vector<i64> A(3); REP(i, 3) cin >> A[i];
    i64 rem = 0;
    REP(i, 3) {
        rem += A[i] % 2;
    }
    auto f = [&]() {
        sort(A.begin(), A.end());
        return (A[2] - A[1]) + (A[1] - A[0]) / 2;
    };

    if (rem == 0 || rem == 3) {
        cout << f() << endl;
    } else if (rem == 1) {
        REP(i, 3) {
            if (A[i] % 2 == 0) A[i]++;
        }
        cout << 1 + f() << endl;
    } else {
        REP(i, 3) {
            if (A[i] % 2 == 1) A[i]++;
        }
        cout << 1 + f() << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
	    int n = sc.nextInt();
		
		String op="";
		char p;
		for(int i=0;i<s.length();i=i+n){
			p=s.charAt(i);
			op=op+p;
		}
		System.out.print(op);
	}
}

Measured memory_bytes: 22868
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

A,B,C,X,Y = LI()

only = A*X+B*Y
only_mix = C*max(X,Y)*2
comp = 0
if X > Y:
    comp = C*Y*2+A*(X-Y)
elif X < Y:
    comp = C*X*2+B*(Y-X)
else:
    comp = C*Y*2

print(min(only,only_mix,comp))

Measured memory_bytes: 38256
import math
import itertools
n = int(input())
x = [0]*n
y = [0]*n
dist = [[0 for _ in range(n)]for _ in range(n)]
comb = [[0 for _ in range(n)]for _ in range(n)]
ans = 0
count = 0
for i in range(n):
	x[i],y[i] = map(int,input().split())
#dist[i][j] = すべての町の距離の配列
for p in itertools.permutations(list(range(n))):
	#すべての組み合わせを一つずつ取り出すp
	for i,j in zip(p,p[1:]):
		ans += math.sqrt((x[i]-x[j])**2 + (y[i]-y[j])**2)
	count += 1
ans = ans/count

print(ans)


Measured memory_bytes: 3064
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		char[] s = sc.next().toCharArray();
		int r = 0, l = s.length - 1;
		int ans = 0;
		while (r < l) {
			while(r < s.length && s[r] == 'R') r++;
			while(l >= 0 && s[l] == 'W') l--;
			if (r < l) {
				ans++;
				s[r] = 'R';
				s[l] = 'W';
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 41116
#include <iostream>
#include <map>
#include <vector>
using namespace std;

map<int, vector<int>> mp;
int N;
bool con[55];
void dfs(int p){
    for(int i=0; i<mp[p].size(); ++i){
        if(con[mp[p][i]]){
            con[mp[p][i]]=false;
            dfs(mp[p][i]);
        }
    }
}
bool cantgo(int i, int j){
    for(int t=1; t<=N; ++t) con[t]=true;
    con[i]=false;
    for(int t=0; t<mp[i].size(); ++t){
        if(mp[i][t]!=j){
            if(con[mp[i][t]]){
                con[mp[i][t]]=false;
                dfs(mp[i][t]);
            }
        }
    }
    return con[j];
}
int main() {
	int M, a, b; cin >> N >> M;
	for(int i=0; i<M; ++i){
	    cin >> a >> b;
	    mp[a].push_back(b);
	    mp[b].push_back(a);
	}
	int ans=0;
	for(int i=1; i<=N; ++i){
	    for(int j=0; j<mp[i].size(); ++j){
	        if(cantgo(i, mp[i][j])) ++ans;
	    }
	}
	cout << ans/2 << endl;
	return 0;
}


Measured memory_bytes: 256
Sd = input()
T = input()
#Sdの?以外の文字のインデックスを取得
indexes = []
for i in range(len(Sd)):
    if Sd[i] != "?":
        indexes.append(i)

t0 = 0#tの先頭位置
S_list = []
while t0 <= (len(Sd)-len(T)):
    flg = 0
    tmp_S = Sd[:t0] + T + Sd[t0+len(T):]

    #条件1を満たすかどうかのチェック
    for index in indexes:
        if Sd[index] != tmp_S[index]:#Sdと一致していなかったら
            flg = 1
    if flg:#flgが立った文字列は条件を満たさないためスキップ
        t0 += 1
        continue

    #?にaを積めてリストに格納
    tmp_S = tmp_S.replace('?', 'a')
    S_list.append(tmp_S)
    t0 += 1

if not S_list:
    print("UNRESTORABLE")
    exit()

S_list.sort()#辞書式にソート
print(S_list[0])

Measured memory_bytes: 8996
N, M = map(int, input().split())
switches = [[int(i) for i in input().split()] for i in range(M)]
P = [int(i) for i in input().split()]

ans = 0
for pattern in range(1 << N):
    for i in range(M):
        k = switches[i][0]
        switch = switches[i][1:]
        count= 0
        for j in range(k):
            if 1 & (pattern >> switch[j]-1):
                count += 1
        
        if count % 2 != P[i]:
            break
    else: ans += 1

print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
#include<math.h>

#define N 100

int main(){
  int n,i,j,a[N],b[N][N],l,q,c[N],k;

  scanf("%d",&n);

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

  for(i=1;i<=n;i++){
    b[i][i]=0;
  }
  for(j=2;j<=n;j++){
    for(i=1;i<=n-j+1;i++){
      l=i+j-1;
      b[i][l]=2147483645;
      for(k=i;k<l;k++){
	q=b[i][k]+b[k+1][l]+a[i-1]*a[k]*a[l];
	if(q<b[i][l]) b[i][l]=q;
      }
    }
  }
  printf("%d\n",b[1][l]);

  return 0;
}



Measured memory_bytes: 2148
import java.util.Scanner;
import java.lang.Math;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int D = sc.nextInt();
        int T = sc.nextInt();
        int S = sc.nextInt();

        double meTime = (double)D / (double)S;

        if(meTime <= T){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }






    }
}

Measured memory_bytes: 35584
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
  
n = int(input())

fact = factorization(n)
cnt = 0
for f in fact:
  if f[0] == 1:
    continue
  i = 1
  while True:
    f[1] -= i
    i += 1
    if f[1] < 0:
      break
    cnt += 1
print(cnt)

Measured memory_bytes: 9384
//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 <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#include <stdexcept>

using namespace std;

// type alias
using ll = long long;
using ull = unsigned long long;

//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(); }

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl
#define DEBUG(x) cerr << #x << " = " << (x) << " (l" << __line__ << ")" << " " << __file__ << endl

inline ll floor(ll a, ull b)
{
	ll llb = b;
	if (a >= 0)
	{
		return a / llb;
	}
	else
	{
		return - ( (-a + llb - 1) / llb);
	}
}

inline ll ceil(ll a, ull b)
{
	ll llb = b;
	if (a >= 0)
	{
		return (a + llb - 1) / llb;
	}
	else
	{
		return - (-a / llb);
	}
}

inline ll getLowestOneBit(ll a)
{
	return a & (-a);
}

inline ll getHighestOneBit(ll a)
{
	while ((a & (a - 1)) != 0)
	{
		a = a & (a - 1);
	}
	return a;
}

inline bool isPower2(ull a)
{
	if (a == 0)
	{
		return false;
	}
	return !(a & (a - 1));
}

inline ll getSpecifiedBit(ll a, unsigned bit)
{
	return (a & (1LL << bit)) >> bit;
}

// computational complexity: o(log(max(a, b))) 
inline ull getGcd(ull a, ull b)
{
	if (b == 0)
	{
		return a;
	}
	return getGcd(b, a % b);
}

template<class Integer>
inline Integer getPower(Integer base, ull exponential)
{
	Integer result = 1;
	while (exponential >= 1)
	{
		if (exponential & 1)
		{
			result = result * base;
		}
		base = base * base;
		exponential >>= 1;
	}

	return result;
}

ll dfs(ll currNode, const vector<set<ll>>& edges, vector<ll>& lengths, vector<bool>& haveChecked)
{
	if (lengths[currNode] != -1)
	{
		return lengths[currNode];
	}

	haveChecked[currNode] = true;
	ll length = 0;
	for (auto& node : edges[currNode])
	{
		if (haveChecked[node])
		{
			continue;
		}
		length = max(length, dfs(node, edges, lengths, haveChecked) + 1);
	}
	lengths[currNode] = length;

	return length;
}

struct Edge {
	ll to, cap, rev;
};

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

	ll S;
	cin >> S;

	ll m = sqrt(double(S));
	if (S < m * m)
	{
		--m;
	}

	ll X1, Y1, X2, Y2, X3, Y3;

	if (S == m * m)
	{
		cout << 0 << " " << 0 << " " << m << " " << 0 << " " << 0 << " " << m << endl;
	}
	else if ( S <= m * m + m )
	{
		ll i = S - m * m;
		cout << 0 << " " << 1 << " " << m << " " << 0 << " " << i << " " << m + 1 << endl;
	}
	else
	{
		ll i = S - m * m;
		cout << 0 << " " << 0 << " " << 1 << " " << m + 1 << " " << m + 1 << " " << m * 2 + 1 - i << endl;

	}

	return 0;
}


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

int main(){

	int i,w,n,a[31],l,r,t;
	char c;

	for(i=1;i<31;i++)
		a[i]=i;

	cin >> w >> n;
	for(i=0;i<n;i++){
		cin >> l >> c >> r;
		t=a[l];
		a[l]=a[r];
		a[r]=t;
	}
	for(i=1;i<=w;i++){
		cout << a[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include<algorithm>
#include<iostream>
#include<cstring>
#include<iomanip>
#include<sstream>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<cmath>
#include<stack>
#include<set>
#include<map>
#define rep(i,x,n) for(int i=x;i<=n;i++)
#define per(i,n,x) for(int i=n;i>=x;i--)
#define sz(a) int(a.size())
#define rson mid+1,r,p<<1|1
#define pii pair<int,int>
#define lson l,mid,p<<1
#define ll long long
#define pb push_back
#define mp make_pair
#define se second
#define fi first
using namespace std;
const double eps=1e-8;
const int mod=1e9+7;
const int N=1e5+10;
const int inf=1e9;

int main(){
	//ios::sync_with_stdio(false);
	//freopen("in","r",stdin);
	double p;
	cin>>p;
	double x=p/3;
	printf("%.6f\n",x*x*x);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,1};
const int dy[6] = {0, 1, 0, -1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string S;
    cin >> S;
    for(int i=0; i<S.size(); i++){
        S[i] = (S[i] - 'A'- 3 + 26)%26 + 'A';
    }
    cout << S << enld;
    return 0;
}


Measured memory_bytes: 3220
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int mod_) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod_;
		}
		x = x * x % mod_;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}
/*--------Library Zone!--------*/

int n, m;
vector<int>ans;
bool used[114514];
vector<int>G[114514];
void dfs(int x) {
	used[x] = 1;
	ans.push_back(x);
	rep(i, G[x].size()) {
		if (!used[G[x][i]]) {
			dfs(G[x][i]);
			return;
		}
	}
}
signed main() {
	cin >> n >> m;
	rep(i, m) {
		int f, t; cin >> f >> t; f--, t--;
		G[f].push_back(t); G[t].push_back(f);
	}
	dfs(0); reverse(all(ans));
	rep(i, G[0].size()) {
		if (!used[G[0][i]]) {
			dfs(G[0][i]);
			break;
		}
	}
	cout << ans.size() << endl;
	for (int a : ans)cout << a + 1 << " ";
	cout << endl;
}


Measured memory_bytes: 10484
import java.util.Scanner;

public class Main {

    static Scanner sc = new Scanner(System.in);
    static final long MOD = 998244353;

    public static void main(String[] args) {
        int N = sc.nextInt();
        if (sc.nextInt() != 0) {
            System.out.println(0);
            return;
        }
        int max = 0;
        int[] count = new int[N];
        for (int i = 1; i < N; i++) {
            int d = sc.nextInt();
            count[d]++;
            max = Math.max(max, d);
        }
        if (count[0] != 0) {
            System.out.println(0);
            return;
        }
        long ans = 1;
        for (int i = 2; i <= max; i++) {
            for (int j = 0; j < count[i]; j++) {
                ans *= count[i - 1];
                ans %= MOD;
            }
        }
        System.out.println(ans);
    }

}


Measured memory_bytes: 51132
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int index = 0;
		int ans = 0;
		while(index < s.length()) {
			char c = s.charAt(index);
			if (c == 'O') {
				int jnum = consequtiveCharNum(s, 'J', index-1, -1);
				int onum = consequtiveCharNum(s, 'O', index, 1);
				index += onum;
				int inum = consequtiveCharNum(s, 'I', index, 1);
				index += inum;
				if(jnum >= onum && inum >= onum) {
					ans = Math.max(ans,Math.min(onum,Math.min(jnum, inum)));
				}
			}
			index++;
		}
		System.out.println(ans);
	}
	public static int consequtiveCharNum(String s,char c,int x,int v) {
		int ans = 0;
		while(0 <= x && x < s.length()) {
			if (s.charAt(x)==c) {
				ans++;
			}else{
				break;
			}
			x += v;
		}
		return ans;
	}
}

Measured memory_bytes: 30972
# -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)

# lis_of_lis = [[] for _ in range(N)]


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()[:-1]


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


D, T, S = zz()

if(T >= D/S):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 42388
n = int(input())
tst = [[] for i in range(n)]
for i in range(n):
  a = int(input())
  for j in range(a):
    x,y = map(int,input().split())
    tst[i].append([x,y])
ans = 0
for bit in range(1<<n):
  liars = [0]*n
  check = 1
  for i in range(n):
    if (bit>>i)&1:
      liars[-1-i] = 1
  for i in range(n):
    if liars[i]:
      for l in tst[i]:
        if l[1]!=liars[l[0]-1]:
          check = 0
          break
  temp = 0
  if check:
    temp = sum(liars)
  ans = max(ans,temp)
print(ans)

Measured memory_bytes: 9076
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
using namespace std;


typedef long long ll;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)

const int mod = 1000000007;

int main(){
  int n;
  cin >> n;

  vector<double> a(n);
  rep(i, n) cin >> a[i];
  double sum = 0;
  rep(i, n){
    sum += 1/a[i];
  }

  sum = 1 / sum;
  cout << setprecision(20) << sum << endl;

}


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

int main(){
    string s;
    cin >> s;
    int count=0;
    int counts=0;
    for(int i=0;i<s.size();i++){
        if(i%2==0&&s[i]!='1'){
            count++;
        }
        if(i%2==1&&s[i]!='0'){
            count++;
        }
    }
    for(int i=0;i<s.size();i++){
        if(i%2==0&&s.at(i)!='0'){
            counts++;
        }
        if(i%2==1&&s.at(i)!='1'){
            counts++;
        }
    }
    cout << min(count,counts) << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<climits>
#include<cmath>
#include<sstream>
#include<iomanip>
#include <map>
#include <stack>
 
const int64_t cc = pow( 10, 9 );
//std::cout<< std::fixed << std::setprecision(10) << ( double )( max ) / 2;
bool sort_pair( std::pair< char, int64_t > origin, std::pair< char, int64_t > another )
{
    return origin.first < another.first;
}
 
int main()
{
    std::string word = "aa";
    int64_t a,b,c,d,e;
 
    std::cin>> a;
    std::cin>> b;
    std::cin>> c;
 
 
    if( a == b && a == c && b== c )
    {
        std::cout<< "No";
    }
    else if( a != b && a != c && b != c )
    {
        std::cout<< "No";
    }
    else 
    {
        std::cout<< "Yes";
    }
}


Measured memory_bytes: 256