akhauriyash/Code-Regression huggingface dataset:
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("Failed to read bytes") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:usize = read();
    let p:usize = read();
    let v:Vec<usize> = (0..n).map(|_| read()).collect();
    if v.iter().all(|&x| x % 2 == 0) {
        if p == 1 {
            println!("0");
        } else {
            println!("{}", 2usize.pow(n as u32));
        }
        return
    }
    println!("{}", 2usize.pow(n as u32 -1));
}


Measured memory_bytes: 2108
#include<bits/stdc++.h>
#define MAX 10000001
using namespace std;

int n;
char s[MAX];
int l[MAX]; // face w
int wtot;

int minn=INT_MAX;

int main(){
	scanf("%d\n%s",&n,s);
	for(int i=0;i<n;++i){
		if(s[i]=='W')
			l[i]=l[i-1]+1,wtot++;
		else
			l[i]=l[i-1];
	}
	for(int i=0;i<n;i++)
		minn=min(minn,l[i-1] + n-(i+1)-(wtot-l[i]));
	cout<<minn;
}

Measured memory_bytes: 3456
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define UNIQ(c) (c).erase(unique((c).begin(), (c).end()), (c).end());
#define Yn(b) puts(b?"Yes":"No")
#define YN(b) puts(b?"YES":"NO")
 
bool isprime(int p) {
  if (p==1) return false;
    FOR(i,2,p) {
      if (p%i==0) return false;
    }
  return true;
}
 
int main(){
  int a,b,c,t;
  cin >> a >> b >> c;
  t=0;
  if (b-a>=2) {
    t+=(b-a)/2;
    a+=((b-a)/2)*2;
  }
  if (c-a>=2) {
    t+=(c-a)/2;
    a+=((c-a)/2)*2;
  }
  if (a-b>=2) {
    t+=(a-b)/2;
    b+=((a-b)/2)*2;
  }
  if (c-b>=2) {
    t+=(c-b)/2;
    b+=((c-b)/2)*2;
  }
  if (b-c>=2) {
    t+=(b-c)/2;
    c+=((b-c)/2)*2;
  }
  if (a-c>=2) {
    t+=(a-c)/2;
    c+=((a-c)/2)*2;
  }
  int m = max({a,b,c});
  if (a==b&&b==c){
    cout << t;
  } else if ((m==a)+(m==b)+(m==c)==2) {
    cout << t+2;
  } else if ((m==a)+(m==b)+(m==c)==1) {
    cout << t+1;
  }
}

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

int main(){
    string T;
    cin >> T;
    rep(i, T.size()){
        if(T[i] == '?'){
            T[i] = 'D';
        }
    }
    cout << T << endl;
}

Measured memory_bytes: 3752
n = gets.to_i
p = gets.chomp.split(" ").map(&:to_i)

count = 0
p.each_cons(3) do |arr|
  if (arr[0] < arr[1] && arr[1] < arr[2]) || (arr[2] < arr[1] && arr[1] < arr[0])
    count += 1
  end
end

puts count

Measured memory_bytes: 1788
#!/usr/bin/env python3

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

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

for i in range(5):
    if X[i] == 0:
        print(i+1)



Measured memory_bytes: 9100
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using namespace std;

#define INF 100000000


int main() {
	int n, k;
	cin >> n >> k;
	if (k == 1) cout << 0 << endl;
	else cout << n - k << endl;
	return 0;
}

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

#define all(s) s.begin(), s.end()
#define vi vector<int>
#define pb push_back
#define ii pair<int, int>
#define x first
#define y second

vi v[100];

int main() {
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    for (int i = 1; i <= n / 2; i++) {
        v[i].pb(i);
        if (n % 2) v[i].pb(n - i);
        else v[i].pb(n + 1 - i);
    }
    if (n % 2) v[n / 2 + 1].pb(n);
    vector<ii> ans;
    for (int i = 1; i <= (n + 1) / 2; i++) {
        for (int j = i + 1; j <= (n + 1) / 2; j++) {
            for (int u : v[i]) for (int o : v[j]) {
                ans.pb({u, o});
            }
        }
    }
    cout << ans.size() << '\n';
    for (ii u : ans) cout << u.x << ' ' << u.y << '\n';
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string str;
    cin>>str;
    int n=str.length();
    vector<int> left(n+1,0);
    for(int i=1;i<=n;i++)
    {
        if(str[i-1]=='<')
            left[i]=left[i-1]+1;
        else
            left[i]=0;
    }
    vector<int> right(n+1,0);
    for(int i=n-1;i>=0;i--)
    {
        if(str[i]=='>')
        {
            right[i]=right[i+1]+1;
        }
        else
        {
            right[i]=0;
        }
    }
    long long sum=0;
    for(int i=0;i<=n;i++)
    {
        sum+=(1ll*max(left[i],right[i]));
    }
    cout<<sum<<"\n";
    return 0;
}

Measured memory_bytes: 7652
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

long long int comb[4001][4001] = {};

int main()
{
	int n, k;
	cin >> n >> k;
	comb[0][0] = 1;
	for(int i = 1; i <= 2000; i++){
		comb[i][0] = 1;
		for(int j = 1; j <= i; j++){
			comb[i][j] = (comb[i - 1][j] + comb[i - 1][j - 1]) % mod;
		}
	}
	for(int i = 1; i <= k; i++){
		if(n - k < i - 1){
			// i回回収するためには赤ボールはi - 1個以上必要
			cout << 0 << endl;
		} else {
			// n - k個の赤ボールの隙間(n - k + 1個ある)から青ボールを入れるi個の隙間を選ぶ
			// k個のボールをiグループに分ける方法 = (k - 1)C(i - 1)
			cout << (comb[n - k + 1][i] * comb[k - 1][i - 1]) % mod << endl;
		}
	}
}

Measured memory_bytes: 61952
#include<bits/stdc++.h>
#define all(x) x.begin() , x.end()
#define ll long long 
#define pb push_back
#define mp make_pair

using namespace std;

bool dist(vector<int>p , vector<int>q){
    int n = p.size();
    int D = 0;
    for(int i = 0 ; i < n; ++i){
        D += (p[i] - q[i]) * (p[i] - q[i]);
    }
    int root = sqrt(D);
    return D == root * root;
    //return D;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n , d; cin>>n>>d;
    vector<int>v[n];
    for(int i = 0 ; i < n; ++i){
        for(int j = 0 ; j < d; ++j){
            int x ; cin>>x;
            v[i].push_back(x);
        }
    }
    int c = 0;
    for(int i = 0 ; i < n; ++i){
        for(int j = i + 1 ; j < n; ++j){
            if(dist(v[i] , v[j]))c++;
        }
    }
    cout<<c<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      long long A, B, K;
      cin >> A >> B >> K;
      
      if (A >= K){
        cout << A - K << " " << B << endl;
      }
      else if (A < K && B > K - A){
        cout << 0 << " " << B - (K - A) << endl;
      }
      else{
        cout << 0 << " " << 0 << endl;
      }
      
    }

Measured memory_bytes: 256
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = ReadLine().Split(' ').Select(int.Parse).ToList();
            WriteLine(a[0] * a[1] >= a[2] ? a[2] : a[0] * a[1]);
        }
    }
}



Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define int long long int
#define IOS ios_base::sync_with_stdio(false), cin.tie(NULL);
#define fr(i,a,b)  for(int i=a;i<=b;i++)
#define rf(j,b,a)  for(int j=b;j>=a;j--)
#define frr(k,a,b) for(int k=a;k<=b;k++)
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define ss second
#define ff first

using namespace std;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
#define E 2000 
bool sortinrev(const pair<int,int> &a,  
               const pair<int,int> &b) 
{ 
     if(a.first==b.first)
     {
     return (a.second < b.second); 
     }
     else
     {
       return (a.first > b.first); 
     }
     
} 
bool sortin(const pair<int,int> &a,  
               const pair<int,int> &b) 
{ 
     return (a.second < b.second);   
} 
signed main()
{   
  IOS
 

int n;
cin>>n;
int h[n+1];
int dp[n+1];
dp[0]=dp[1]=0;
for(int i=1;i<=n;i++)
{
cin>>h[i];
}
dp[2]=abs(h[2]-h[1]);
for(int i=3;i<=n;i++)
{
  int h1 = abs(h[i]-h[i-1]);
  int h2 = abs(h[i]-h[i-2]);
 dp[i] = min(h1+dp[i-1],h2+dp[i-2]); 
}
cout<<dp[n]<<endl;

}




Measured memory_bytes: 5168
// A.

#include <iostream>
#include <sstream>
#include <algorithm>

using namespace std;

int main(int argc, char* argv[]) {
	int a[2], ans = 0;
	for (int i = 0; i < 2; ++i) {
		cin >> a[i];
		switch (a[i]) {
		case 1:
			ans += 300000;
			break;
		case 2:
			ans += 200000;
			break;
		case 3:
			ans += 100000;
			break;
		}
	}
	if (a[0] == 1 && a[1] == 1) {
		ans += 400000;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;
using ll = long long int;

string s,t;

int main()
{
    IOS;
    cin >> s >> t;
    ll n1 = s.length(),n2 = t.length();

    ll dp[n1+1][n2+1];

    for(ll i=0;i<=n1;i++) {
        for(ll j=0;j<=n2;j++) {

            if(i == 0 or j == 0)
                dp[i][j] = 0;
            else if(s[i-1] == t[j-1]) {
                dp[i][j] = dp[i-1][j-1] + 1;
            }
            else {
                dp[i][j] = max(dp[i-1][j] , dp[i][j-1]);
            }
        }
    }

    string ans;
    ll i = n1,j = n2;
    while(i >= 1 and j >= 1) {
        if(s[i-1] == t[j-1]) {
            ans.push_back(s[i-1]);
            i--,j--;
        }
        else if(dp[i-1][j] > dp[i][j-1])
            i--;
        else
            j--;
    }
    reverse(ans.begin(),ans.end());
    cout << ans;
    return 0;
}

Measured memory_bytes: 70656
////////////////////////////////////////////
///                                      ///
///         Template ver. 1 rapel        ///
/// Fear is Temporary, Regret is Forever ///
///          Must Try and Get AC         ///
///                                      ///
////////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>

#include <math.h>
#include <complex>

#include <assert.h>
#include <time.h>
//#include <chrono>
//#include <random>

#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>

#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define endl '\n'
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

void desperate_optimization(int precision){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

priority_queue<LL> pq;
queue<LL> container;
int tot[27];
string s;

void hora(int tc) {
	int n,k;
	cin>>n>>k;
	for(int i = 0;i < n;i++) {
		cin>>s;
		tot[s[0] - 'A']++;
	}
	for(int i = 0;i < 26;i++) if(tot[i] != 0) pq.push(tot[i]);
	int res = 0;
	while(!pq.empty()) {
		if(pq.size() < k) break;
		res++;
		for(int i = 0;i < k;i++) {
			LL x = pq.top();
			pq.pop();
			container.push(x - 1);
		}
		while(!container.empty()) {
			LL x = container.front();
			if(x != 0) pq.push(x);
			container.pop();
		}
	}
	cout<<res<<endl;
}

int main(){
	desperate_optimization(10);
	int ntc = 1;
	//cin>>ntc;
	for(int tc = 1;tc <= ntc;tc++) hora(tc);
	return 0;
}




Measured memory_bytes: 256
n, m, q = [int(v) for v in input().split()]
a = []
b = []
c = []
d = []
for i in range(q):
    line = [int(v) for v in input().split()]
    a.append(line[0])
    b.append(line[1])
    c.append(line[2])
    d.append(line[3])

ans = 0

def calc(nums):
    ret = 0
    for i in range(q):
        if nums[b[i]-1] - nums[a[i]-1] == c[i]:
            ret += d[i]
    return ret

def solve(n, m, buf):
    if n == 0:
        global ans
        ans = max(ans, calc(buf))
        return

    if buf:
        for i in range(buf[-1], m+1):
            new_buf = buf[:]
            new_buf.append(i)
            solve(n-1, m, new_buf)
    else:
        for i in range(1, m+1):
            new_buf = buf[:]
            new_buf.append(i)
            solve(n-1, m, new_buf)

solve(n, m, [])
print(ans)


Measured memory_bytes: 9208
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	io := NewIo()
	defer io.Flush()
	for {
		n, p := io.NextInt(), io.NextInt()
		if n == -1 {
			break
		}
		isPrime := SieveOpt(200000)
		prime := make([]int, p)
		cnt := 0
		if n < 2 {
			prime[0] = 2
			cnt++
		}
		for i := (n + 1) / 2; i < len(isPrime) && cnt < p; i++ {
			if isPrime[i] == true {
				prime[cnt] = 2*i + 1
				cnt++
			}
		}
		comb := make([]int, 0, p*p)
		for i := 0; i < p; i++ {
			for j := i; j < p; j++ {
				comb = append(comb, prime[i]+prime[j])
			}
		}
		sort.Ints(comb)
		io.Println(comb[p-1])
	}
}

func SieveOpt(x int) []bool {
	flags := make([]bool, x/2) // flags[i] := 2*j+1 is prime
	for i := 1; i < x/2; i++ {
		flags[i] = true
	}
	sqrtXi := int(math.Ceil(math.Sqrt(float64(x)))) / 2
	for i := 1; i < sqrtXi; i ++ {
		if !flags[i] {
			continue
		}
		for j := 2 * i * (i + 1); j < x/2; j += 2*i + 1 {
			flags[j] = false
		}
	}
	return flags
}

// I/O template
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buff []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buff = append(buff, line...)
		if !isPrefix {
			break
		}
	}
	return string(buff)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	s := io.tokens[io.nextToken]
	io.nextToken++
	return s
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntSlice(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func (io *Io) PrintStringSlice(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func Log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}

func ExampleIo() {
	io := NewIo()
	defer io.Flush()
	a := make([]int, 0, 3)
	a[0], a[1], a[2] = io.NextInt(), io.NextInt(), io.NextInt()
	io.Println(a)
	io.PrintIntSlice(a)
	Log("io", a)
}



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

using namespace std;

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

  // input 1
  int n, m;
  cin >> n >> m;
  // input 2
  vector<vector<int>> ms(m);
  for (int i = 0; i < m; ++i) {
    int x;
    cin >> x;
    for (int j = 0; j < x; ++j) {
      int y;
      cin >> y;
      ms[i].push_back(y - 1);
    }
  }
  // input 3
  vector<int> p(m);
  for (int i = 0; i < m; ++i) {
    cin >> p[i];
  }

  int ans = 0;
  for (int i = 0; i < (1 << n); ++i) {
    bool ok = true;
    for (int j = 0; j < m; ++j) {
      int x = 0;
      for (int k : ms[j]) {
        if ((i >> k) & 1) {
          x ^= 1;
        }
      }
      if (x != p[j]) {
        ok = false;
      }
    }
    if (ok) {
      ++ans;
    }
  }
  cout << ans << '\n';

  return 0;
}


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

using namespace std;

int main() {
  string S;
  cin >> S;
  bool pred = S[0] == 'A' && count(begin(S) + 2, end(S) - 1, 'C') == 1 &&
              all_of(begin(S) + 1, end(S),
                     [](char c) { return (c >= 'a' && c <= 'z') || c == 'C'; });
  cout << (pred ? "AC" : "WA") << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = Integer.parseInt(sc.next());
        int x = Integer.parseInt(sc.next());
        for(int i=x-k+1;i<=x+k-1;i++){
            System.out.print(i+" ");
        }
        sc.close();
    }
}

Measured memory_bytes: 22100
import java.util.*;
import java.io.*;

class Main {
    public static void main(String args[]) throws IOException {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt(), arr[] = new int[n], count = 1;
        for (int i = 0; i < n; i++) arr[i] = in.nextInt();
        Arrays.sort(arr);
        for (int i = 1; i < n; i++) if (arr[i] > arr[i - 1]) count++;
        System.out.println(count);
    }
}

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

int main(){
    int N;
    cin >> N;
    vector<ll> a(N);
    int pos=0,neg=0,p,n;
    rep (i,N){
        cin >> a[i];
        if (pos<a[i]){
            pos=a[i];
            p=i;
        }
        else if (a[i]<neg){
            neg=a[i];
            n=i;
        }
    }
    vector<Pii> ans;
    if (-neg<pos){
        rep(i,N){
            if (a[i]<0){
                ans.push_back(Pii(p+1,i+1));
            }
        }
        rep(i,N-1){
            ans.push_back(Pii(i+1,i+2));
        }
    }
    else {
        rep(i,N){
            if (a[i]>0){
                ans.push_back(Pii(n+1,i+1));
            }
        }
        rep(i,N-1){
            ans.push_back(Pii(N-i,N-i-1));
        }
    }
    cout << ans.size() << endl;
    rep(i,ans.size()){
        cout << ans[i].first << ' ' << ans[i].second << endl;
    }
}

Measured memory_bytes: 256
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
using namespace std;

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

    ll a,b,c,d,n,maxi=0,f=0,mini=INF,sum=0;
    string str;
    cin>>n>>a;
    vector<ll> v(n);
    set<ll> s;
    map<ll,ll> m;
    rep(i,n) cin>>v[i];
    rep(i,n){
      if(mini>v[i]) mini=v[i];
      else{
        s.insert(v[i]-mini);
        m[v[i]-mini]++;
      }
    }
    for(auto itr=s.begin();itr!=s.end();++itr) maxi=max(maxi,*itr);
   // cout<<maxi<<" "<<m[maxi]<<endl;
   // if(m[maxi]>a/2){
    //  cout<<a/2<<endl;
    //}else{
      cout<<m[maxi]<<endl;
    //}
}


Measured memory_bytes: 15072
#include<bits/stdc++.h>
#define pi acos(0.0)
#define ll long long
using namespace std;
int main()
{
    double a,b,c,i,j;
    string s;
    cin>>a;
    cout<<fixed<<setprecision(20)<<3.1415926535*a*2<<endl;
    return 0;
}


Measured memory_bytes: 3828
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <sys/timeb.h>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define FOR(NAME, START, NUM) for (ll NAME = START; NAME < (NUM); NAME++)
#define REP(NAME, NUM) for (ll NAME = 0; NAME < (NUM); NAME++)
#define BREP(NAME, NUM) for (ll NAME = (NUM)-1; NAME >= 0; NAME--)
#define ALL(NAME) (NAME).begin(), (NAME).end()
const ll LINF = 1e18;
const int INF = 1e9;
const int mod = 1e9+7;

int main(){
  vector<char> s(4);
  REP(i,4) cin >> s[i];
  sort(ALL(s));
  if(s[0] == s[1] && s[2] == s[3] && s[1] != s[2])
	cout << "Yes" << endl;
  else
	cout << "No" << endl;

}


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

int main() {
    int a,b;
    cin>>a>>b;
    if((a==1 && b==2)|| (a==2 &&b==1))
        cout<<"3";
    else if((a==1 && b==3)|| (a==3 &&b==1))
        cout<<"2";
    else
        cout<<"1";
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mp make_pair
#define mm(a) memset(a,-1,sizeof(a))
#define rep(i,a,b) for(ll i = a; i < b; i++)
#define repn(i,a,b) for(ll i = a; i >= b; i--)
#define pb push_back
#define ff first
#define ss second
#define fto(k,m) for(auto k:m)
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define sz(a) ll((a).size())
#define pii 3.1415926535897
#define endl "\n"
#define ld long double
#define mod 1000000007
#define BRAHAMASTRA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int main()
{
    BRAHAMASTRA
    ll t; t=1;
    // cin >>t;
    while(t--)
    {
        ld n,d; cin >>n>>d;
        ld cnt = 0;
        rep(i,0,n)
        {
            ld x,y; cin >>x>>y;
            if(sqrt(pow(x,2)+pow(y,2))<=d)cnt++;
        }
        cout<<cnt<<endl;
    }
}

Measured memory_bytes: 3868
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i= (a); i < (b); ++i)
typedef long long ll;
typedef pair<int,int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main() { int a[] = {0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};
  int x, y;
  cin >> x >> y;
  if(a[x]==a[y]){
    puts("Yes");
  }else{
    puts("No");
  }
}

Measured memory_bytes: 256
/*
 ID: bradyawn
 PROG: contest
 LANG: C++11
 */

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <fstream>
#include <vector>
#include <deque>
#include <string>
#include <cmath>
#include <map>
#include <unordered_map>
#include <utility>
#include <set>
#include <unordered_set>
#include <ctime>
#include <queue>
#include <stack>
#include <bitset>
#include <random>
#include <cstring>
#include <functional>

using namespace std;

typedef long long ll;
typedef pair<int,int> i2;
typedef pair<ll,ll> ll2;

int main()
{
    //ifstream inf("");
    //ofstream outf("");
    //cout << setprecision(10);
    ios_base::sync_with_stdio(0); cin.tie(0);
    
    int a, b;
    cin >> a >> b;
    
    int ret = a;
    
    if (b < a) ret--;
    
    cout << ret << '\n';
    
    return 0;
    
}




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


int main(){
  string s; 
  cin >> s;
  int n=s.size();
  int ag=0,zg=0;
  for(int i=0;i<n;i++){
    if(s[i]=='A'){ag=i;break;}
  }
  rep(i,n){
    if(s[n-i-1]=='Z'){zg=n-i-1;break;}
  }
  cout << zg-ag+1 << endl;
}

Measured memory_bytes: 640
using System;
using System.Linq;
using System.Text;

namespace ALDS1_11_B {
    class Problem {
        Node[] _nodes;
        private int _vol, _time;

        public void Run() {
            SetNodes();
            StringBuilder sb = new StringBuilder();
            for (int i = 1; i <= _vol; i++) {
                if (_nodes[i].First == 0) {
                    DFS(i);
                }
                sb.Append(i + " ");
                sb.AppendLine(_nodes[i].ToString());
            }
            Console.Write(sb);
        }

        private void SetNodes() {
            _vol = int.Parse(Console.ReadLine());
            _nodes = new Node[_vol + 1];
            for (int i = 0; i < _vol; i++) {
                string[] input = Console.ReadLine().Split(' ');
                int u = int.Parse(input[0]);
                int[] c = input.Skip(2).Select(int.Parse).ToArray();
                _nodes[u] = new Node(c);
            }
        }

        private void DFS(int id) {
            _nodes[id].First = ++_time;
            foreach (int next in _nodes[id].Children) {
                if (_nodes[next].First == 0) {
                    DFS(next);
                }
            }
            _nodes[id].last = ++_time;
        }
    }

    class Node {
        public int[] Children { get; set; }
        public int First { get; set; }
        public int last { get; set; }

        public Node(int[] children) {
            Children = children;
        }

        public override string ToString() {
            return First + " " + last;
        }
    }

    class Program {
        static void Main(string[] args) {
            Problem p = new Problem();
            p.Run();
        }
    }
}

Measured memory_bytes: 9604
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define ve vector
#define chmin(x,y) x = min(x,y)

int main(){
    int n,m;
    cin >> n >> m;
    set<P> ab,ba;
    rep(i,m){
        ll a,b;
        cin >> a >> b;
        ab.insert(P(a,b));
        ba.insert(P(b,a));
    }
    int ans = 0;
    
    while(!ab.empty()){
        auto it = ab.end();
        it--;
        P x = *it;
        ab.erase(it);
        ans++;
        auto it2 = ba.end();
        while(!ba.empty()){
            it2--;
            P y = *it2;
            if(y.first <= x.first) break;
            it2 = ba.erase(it2);
            ab.erase(P(y.second,y.first));
        }
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 16112
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<map>
#include<queue>
#define inf1 1000000009
#define inf -1
using namespace std;
int main(){
 long long t,a[200006],i,sum;sum=0;
 cin>>t;
 for(int i=1;i<=t;i++)
    cin>>a[i];
 for( i=t;i>1;i--)
    if(a[i]>=i)break;
   else
        if(a[i]>a[i-1]+1)break;
 else if(a[i]==a[i-1]+1)sum+=1;
 else sum+=a[i];
 if(i>1||a[1])cout<<"-1\n";
 else cout<<sum<<endl;
}

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

int main(){
  int h, w;
  cin >> h >> w;
  ll MOD = 1000000007;
  vector<string> g(h+1);
  rep(i,h){
    string s;
    cin >> s;
    g[i+1] = " " + s;
  }
  vector<vector<ll>> dp(h+1, vector<ll>(w+1));
  dp[1][1] = 1;
  for(int i=1; i<=h; i++){
    for(int j=1; j<=w; j++){
      if(g[i][j] == '#') continue;
      if(i==1 && j==1) continue;
      dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % MOD;
    }
  }
  
  cout << dp[h][w] << endl;
}


Measured memory_bytes: 12240
#include <iostream>
using namespace std;
 
int main() {
 
	int N, l, i, x, j;
	cin >> N;
	x = 0;
 
	for (int j = 0; j < N; j++)
	{
		cin >> l >> i;
		x += i - l + 1;
	}
		cout << x <<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair<int, int>
#define vi vector<int>
#define pb emplace_back
#define sz(x) (int)x.size()
#define all(v) v.begin(), v.end()
#define x first
#define y second
#define rep(i, j, k) for(i=j; i<k; i++)
#define sep(i, j, k) for(i=j; i>k; i--)
const int N = 2e5+5, inf = 1e9+7;
int n, k, i, j;
int A[N];
bool cmp(ii&a, ii&b){
    return a.x+a.y<b.x+b.y;
}
int in[N], f[N], dp[N];
inline int expo(int n, int k, int p = inf) {int r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
inline int inv(int a, int p = inf) {return expo(a, p - 2, p);}
inline int cc(int a, int b){ if(a<b || b<0) return 0; return f[a]*in[b]%inf*in[a-b]%inf; }
void fac(){ int i; f[0] = 1; rep(i, 1, N) f[i] = f[i-1]*i%inf; in[N-1] = inv(f[N-1]); sep(i, N-1, 0) in[i-1] = i*in[i]%inf; }
signed main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    int i, j, a, b, ans = 0, h, w;
    cin>>h>>w>>n;
    fac();
    vector<ii>v(n+1);
    rep(i, 0, n) cin>>v[i].x>>v[i].y;
    v[n].x= h; v[n].y = w;
    sort(all(v), cmp);
    rep(i, 0, n+1){
        dp[i] = cc(v[i].x+v[i].y-2, v[i].x-1);
        rep(j, 0, i) if(v[j].x<=v[i].x && v[j].y<=v[i].y)
            dp[i] -= cc(v[i].x-v[j].x+v[i].y-v[j].y, v[i].x-v[j].x)*dp[j]%inf;
        dp[i] = (dp[i]%inf+inf)%inf;
    }
    cout<<dp[n];
}

Measured memory_bytes: 4864
import bisect
n=int(input())
a=[int(input()) for i in range(n)]
inf=10**9+1
tmp=[inf]*n
ans=0
for i in range(n-1,-1,-1):
  j= bisect.bisect_right(tmp,a[i])
  tmp[j]=a[i]
for i in range(n):
  if tmp[i]!=inf:
    ans+=1
print(ans)

Measured memory_bytes: 7840
/***"In the name of Allah(swt), the most gracious, most merciful. Allah(swt) blesses with knowledge whom he wants."***/
/*** "ALHAMDULILLAH for Everything..." ***/
#include<bits/stdc++.h>
using namespace std;
#define  fastt       ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define  ll         long long
#define  debug      printf("Come here!")
#define  inf        1000000000000000000
#define  pb         push_back
#define  mp         make_pair
#define  sz(a)      a.size()
#define  mem(a,b)   memset(a,b,sizeof(a))
#define  clr(x)     x.clear()
#define  ff         first
#define  ss         second
#define  case(x)    cout << "Case " << x <<": "

#define  md         1000000007
#define  pi         acos(-1.0)
#define  cos(a)     cos(a*pi/180)
#define  sin(a)     sin(a*pi/180)
#define  tan(a)     tan(a*pi/180)
#define  cosi(a)    acos(a)/(pi/180)
#define  sini(a)    asin(a)/(pi/180)
#define  tani(a)    atan(a)/(pi/180)

#define  vl         vector <ll>
#define  vs         vector <string>
#define  vc         vector <char>
#define  vpll       vector < pair <ll, ll> >
#define  vpsl       vector < pair <string, ll> >
#define  vpls       vector < pair <ll, string> >
#define  pql        priority_queue<ll>
#define  minpql     priority_queue<ll,vector<ll>,greater<ll> >

#define  setbits(x)     __builtin_popcountll(x)
#define  zerobits(x)    __builtin_ctzll(x)

#define toll(a) atoll(a.c_str())
string tostr(ll a) {stringstream rr;rr<<a;return rr.str();}
ll pow(ll c,ll d){return d==0?:c*pow(c,d-1);}
ll gcd(ll a,ll b) {return b==0? a:gcd(b,a%b);}
ll lcm(ll a,ll b) {return ((a*b)/gcd(a,b));}

/* mpp.max_load_factor(0.25); mpp.reserve(1024); */
/* cout << fixed << setprecision(12);*/

int main()
{
    fastt;

    ll n, m, k, i, j, x, y, p=1, s=0, h, f=0;
    cin>>n>>m;
    k=m;
    while(k>0){
        k/=10;
        p*=10;
    }
    n=n*p + m;
    x=sqrt(n+1);
    if(x*x == n)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}



Measured memory_bytes: 3640
#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 <queue>
#include <bitset>
using namespace std;

typedef long long ll;

const int MAX_M = 1000000;

int main() {
	int s[MAX_M];
	cin >> s[0];

	for (int i = 0; ; i++) {
		if (s[i] % 2 == 0) {
			s[i + 1] = s[i] / 2;
			for (int j = 0; j <= i ; j++) {
				if (s[i + 1] == s[j]) {
					cout << i + 2 << endl;
					return 0;
				}
			}
		} else {
			s[i + 1] = 3 * s[i] + 1;
			for (int j = 0; j <= i; j++) {
				if (s[i + 1] == s[j]) {
					cout << i + 2 << endl;
					return 0;
				}
			}
		}
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
main()
{
    int n,i,c,a;
    while(scanf("%d",&n)==1){
        c=0;
        for(i=0;i<n;i++){
            cin>>a;
            if(a%2==0){
                if(a%3!=0&&a%5!=0)
                    c++;
            }
        }
        if(c==0)
            cout<<"APPROVED\n";
        else
            cout<<"DENIED\n";
    }
}


Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, C = mapint()

Xs = []
Vs = []
for _ in range(N):
    x, v = mapint()
    Xs.append(x)
    Vs.append(v)
r_Xs = [C-x for x in Xs[::-1]]
r_Vs = Vs[::-1]

max_neg = []
tmp = 0
maxi = -10**18
for i in range(N):
    x, v = r_Xs[i], r_Vs[i]
    tmp += v
    max_neg.append(max(tmp-x, maxi))
    maxi = max(tmp-x, maxi)

max_pos = []
tmp = 0
maxi = -10**18
for i in range(N):
    x, v = Xs[i], Vs[i]
    tmp += v
    max_pos.append(max(tmp-x, maxi))
    maxi = max(tmp-x, maxi)
ans = 0
for i in range(N):
    x, v = Xs[i], Vs[i]
    if i!=N-1:
        ans = max(ans, max_pos[i], max_pos[i]-x+max_neg[N-i-2])
    else:
        ans = max(ans, max_pos[i])
for i in range(N):
    x, v = r_Xs[i], r_Vs[i]
    if i!=N-1:
        ans = max(ans, max_neg[i], max_neg[i]-x+max_pos[N-i-2])
    else:
        ans = max(ans, max_neg[i])
print(ans)

Measured memory_bytes: 96048
#include<bits/stdc++.h>
typedef long long int ll;
//#define PI 3.1415926535
using namespace std;
void solve()
{
    string s;
    cin >> s;
    int temp=s[s.length()-1];
    if(temp=='2' || temp=='4' || temp=='5' || temp=='7' || temp=='9')
    cout << "hon" << endl;
    else if(temp=='0' || temp=='1' || temp=='6' || temp=='8')
    cout << "pon" << endl;
    else if(temp=='3')
    cout << "bon" << endl;
    
}

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    /*int t;
    cin >> t;
    while(t--)
    {
         solve();  
    }
   */ solve();
    return 0;
}





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

int main() {
	int n = 5;
	int max = 0;
	int sum = 0;
	for (int i = 0, x; i < n; i++) {
		cin >> x;
		sum += (x + 9) / 10;
		if (9 - (x + 9) % 10 > max)
			max = 9 - (x + 9) % 10;
	}
	cout << sum * 10 - max << endl;
}



Measured memory_bytes: 256
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100005;

 main()

{
    fast
    int ses=0;
    string s;
    cin>>s;
    int sz=s.size();
    for(int i=0;i<sz;i++)
    {
        char ch=s[i];
        if(ch=='R')
        {
            int cnt=0,last;
            for(int j=i;j<sz;j++)
            {
                if(s[j]==ch)
                {
                    last=j;
                    cnt++;
                }
                else break;
            }
            i=last;
            ses=max(ses,cnt);
        }
    }
    cout<<ses<<endl;
    return 0;

}





































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

using namespace std;
int main()
{
    long long n,W;
    cin >> n >> W;
    long long w[n+1];
    long long v[n+1];
    for(long long i=1;i<=n;i++)
    {
        cin >> w[i] >> v[i];
    }
    long long f[n+1][100001];
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=1e5;j++)
        {
            f[i][j]=1e18;
        }
    }
    for(int i=0;i<=n;i++)
    {
        f[i][0]=0;
    }
    for(long long j=0;j<=1e5;j++)
    {
        for(long long i=1;i<=n;i++)
        {
            f[i][j]=min(f[i][j],f[i-1][j]);
            if(j-v[i]>=0)f[i][j]=min(f[i][j],f[i-1][j-v[i]]+w[i]);
        }
    }
    for(int i=1e5;i>=1;i--)
    {
        if(f[n][i]<=W)
        {
            cout << i;
            break;
        }
    }
    return 0;
}


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

int main(){
	int a, b, c,min;
	cin >> a >> b >> c;
	if (a <= b&&a <= c){
		if (b <= c)
			min = a + b;
		else
			min = a + c;
	}
	else if (b<=c){
		if (a <= c)
			min = b + a;
		else
			min = b + c;
	}
	else{
		if (a >= b)
			min = b + c;
		else
			min = a + c;
	}
	cout << min << endl;
	return 0;

}

Measured memory_bytes: 256
import itertools
n=int(input())
m,a,r,c,h=[],[],[],[],[]
for i in range(n):
    s=input()
    start=s[0]
    if start=="M":
        m.append(s)
    elif start=="A":
        a.append(s)
    elif start=="R":
        r.append(s)
    elif start=="C":
        c.append(s)
    elif start=="H":
        h.append(s)
s=[]
if len(m)!=0:
    s.append(len(list(itertools.combinations(m,1))))
if len(a)!=0:
    s.append(len(list(itertools.combinations(a,1))))
if len(r)!=0:
    s.append(len(list(itertools.combinations(r,1))))
if len(c)!=0:
    s.append(len(list(itertools.combinations(c,1))))
if len(h)!=0:
    s.append(len(list(itertools.combinations(h,1))))
hoge=list(itertools.combinations(s,3))
num=len(hoge)
ans=0
for i in range(num):
    ans+=hoge[i][0]*hoge[i][1]*hoge[i][2]
print(ans)

Measured memory_bytes: 16960
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://atcoder.jp/contests/abc141/tasks/abc141_d>
 問題文============================================================
 D - Powerful Discount Tickets
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll N,M; cin >> N >> M;
    vector<ll> A(N); for(auto& in:A) cin >> in;
    priority_queue<ll> pq(A.begin(),A.end());
    
    while(M--){
        ll X = pq.top(); pq.pop();
        pq.push(X/2);
    }
    while(pq.size()){
        res += pq.top(); pq.pop();
    }
    
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <iostream>
#include <map>
#include <cstdio>
#include <bits/stdc++.h>
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define REP(i,n) for(int i=0;i<n;i++)
#define FORq(i, m, n) for(int i = m;i <= n;i++)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define PRINTD(n) printf("%d\n",n)
using namespace std;
 
int main() {
	int n;
	SCD(n);
	
	int a[n+1] = {};
	REP(i,n){SCD(a[i]);}
	
	int s = 0;
	REP(i,n){s += a[i];}
	
	int b[n+1] = {};
	
	REP(i,n){
		int sc = s - a[i];
		if (sc % 10 == 0) {
			b[i] = 0;
		}else{
			b[i] = sc;
		}
	}
	
	int ans;
	if (s % 10 == 0) {
		ans = 0;
	}else{
		ans = s;
	}
	
	REP(i,n){
		ans = max(ans,b[i]);
	}
	
	PRINTD(ans);
	return 0;
}
 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    ll N,ans = 1;
    int cnt[1010] = {};
    cin >> N;
    rep(i,1,N+1){
        int num = i;
        rep(j,2,N+1){
            while(num % j == 0){
                cnt[j]++;;
                num /= j;
            }
        }
        
    }
    rep(i,2,1001){
        ans = (ans * (cnt[i] + 1)) % MOD;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string S = Console.ReadLine();
		long K = long.Parse(Console.ReadLine());
		long ans1 = 0;
		long ct = 0;
		for(var i=0;i<S.Length-1;i++){
			if(S.Substring(i,1)==S.Substring(i+1,1)){
				ct++;
			} else {
				ans1 += (ct+1)/2;
				ct = 0;
			}
		}
		ans1 += (ct+1)/2;
		long ans = 0;
		if(ct==S.Length-1){
			ans = (S.Length*K)/2;
		} else if(S.Substring(0,1)!=S.Substring(S.Length-1,1)){
			ans = ans1 * K;
        } else {
			long ct2 = 0;
			for(var i=0;i<S.Length-1;i++){
				if(S.Substring(i,1)==S.Substring(i+1,1)){
					ct2++;
				} else {
					break;
				}
			}
			long ct3 = 0;
			for(var i=S.Length-1;i>=1;i--){
				if(S.Substring(i,1)==S.Substring(i-1,1)){
					ct3++;
				} else {
					break;
				}
			}
			ans = ans1 * K - (ct2+1)/2 * (K-1) - (ct3+1)/2 * (K-1) + (ct2+ct3+2)/2 * (K-1);
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    mp::int1024_t x, k, d;
    cin >> x >> k >> d;

    mp::int1024_t a = abs(x);
    mp::int1024_t b = abs(k * d);

    if (a > b) {
        cout << a - b << endl;
        ret();
    }
    mp::int1024_t g = a / d;
    mp::int1024_t c = g * d;
    mp::int1024_t e = a - c;
    assert(e >= 0);
    mp::int1024_t f = e - d;
    assert(f <= 0);

    if ((k - g) % 2 == 0) {
        cout << abs(e) << endl;
    } else {
        cout << abs(f) << endl;
    }
}


Measured memory_bytes: 3712
a = str(input())
f = a.lower()
b = []
while True:
    n = input()
    e = n.lower()
    c = (e.split(' '))
    if n == "END_OF_TEXT":
        break
    b.append(c)

d = []
for l in b:
    for item in l:
        d.append(item)

print(d.count(f))


Measured memory_bytes: 5556
#include<iostream>
#include<stack>
using namespace std;
int main(){
  stack<int>a;
  stack<int>b;
  int n,m,s;
  cin>>n;
  for(int i=0;i<n;i++){
    s=0;
    a.push(0);
    b.push(0);
    for(int i=0;i<10;i++){
      cin>>m;
      if(m>a.top()){
	a.push(m);
      }
      else if(m>b.top()){
	b.push(m);
      }
      else s=1;
    }
    if(s==0)cout<<"YES"<<endl;
    else    cout<<"NO"<<endl;
  }
  return 0;
}

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

#define debug(s) cout << s << endl
#define debug1(s, t) cout << s << " " << t << endl
#define debug2(s, t, u) cout << s << " " << t << " " << u << endl
#define printvec(v)       \
    for (auto &&i : v)    \
        cout << i << " "; \
    cout << endl

using namespace std;
using i64 = long long;

int main()
{
    vector<int> arr{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int n;
    cin >> n;

    cout << arr[n-1] << endl;

    return 0;
}

Measured memory_bytes: 256
N=int(input())
P=list(map(int,input().split()))
L=[]
for i in range(N):
	if P[i]==i+1:
		L.append(i+1)
count=len(L)
i=0
while(1):
	if i>len(L)-2:
		break
	elif L[i+1]-L[i]==1:
		count-=1
		i+=2
	else:
		i+=1
print(count)

Measured memory_bytes: 14008
#!/usr/bin/env python3
# 整数の入力
n = int(input())
#配列の入力
data = list(map(int, input().split()))

def PrimeFactorization(n):
    ret = []
    for i in range(2, int((n**0.5)+1)):
        if n % 2 != 0:
            continue

        exp = 0
        while(n % i == 0):
            exp += 1
            n //= i
        ret.append([i, exp])
    if n!= 1:
        ret.append([n, 1])
    
    return ret

odd = 0
even1 = 0
even2 = 0

for i in range(n):
    if data[i] % 2 != 0:
        odd += 1
    else:
        exp = 0
        tmp = data[i]
        while(tmp % 2 == 0):
            exp += 1
            tmp //= 2
        if exp == 1:
            even1 += 1
        elif exp >= 2:
            even2 += 1

if even1 == 0:
    if odd > even2+1:
        print("No")
    else:
        print("Yes")
else:
    if odd > even2:
        print("No")
    else:
        print("Yes")



Measured memory_bytes: 20048