akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ITP2_9_A
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int n = ReadInt();
            int[] a = ReadIntAr();
            int m = ReadInt();
            int[] b = ReadIntAr();
            a = a.Union(b).ToArray();
            Array.Sort(a);
            foreach (var item in a) Console.WriteLine(item);
        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }
        static string WriteAr(int[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(double[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(long[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }

    }

}



Measured memory_bytes: 59636
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

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

map<string, set<string>> ma, dp;

set<string> dfs(string s) {
	if(dp.find(s) != dp.end()) return dp[s];
	//cout << s << endl;
	set<string> ret;
	for(string i: ma[s]) {
		if(ma.find(i) != ma.end()) {
			set<string> tmp = dfs(i);
			for(string j: tmp) {
				ret.insert(j);
			}
		} else {
			ret.insert(i);
		}
	}
	
	return dp[s] = ret;
}

signed main(void)
{
	while(true) {
		int n;
		string a[105];
		cin >> n;
		if(!n) break;
		REP(i, n) cin >> a[i];
		
		//map????????????
		ma.erase(ALL(ma));
		dp.erase(ALL(dp));
		
		string s, key;
		REP(i, n) {
			string t = "";
			REP(j, a[i].size()) {
				if(a[i][j] == ':') {
					if(i == 0) s = t;
					key = t;
					t = "";
				} else if(a[i][j] == ',') {
					ma[key].insert(t);
					t = "";
				} else if(a[i][j] == '.') {
					ma[key].insert(t);
					t = "";
					break;
				} else {
					t += a[i][j];
				}
			}
		}
		
		/*for(auto itr = ma.begin(); itr != ma.end(); ++itr) {
			cout << itr->first << " ";
			for(string j: itr->second) {
				cout << j << " ";
			}
			cout << endl;
		}*/
		
		set<string> ans = dfs(s);
		cout << ans.size() << endl;
	}

	return 0;
}

Measured memory_bytes: 3532
# -*- coding: utf-8 -*-

import sys
from operator import add

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

class SegTree:
    """
    セグメント木
    1.update:  i番目の値をxに更新する
    2.query: 区間[l, r)の値を得る
    """

    def __init__(self, n, func, intv, A=[]):
        """
        :param n: 要素数(0-indexed)
        :param func: 値の操作に使う関数(min, max, add, gcdなど)
        :param intv: 要素の初期値(単位元)
        :param A: 初期化に使うリスト(オプション)
        """
        self.n = n
        self.func = func
        self.intv = intv
        # nより大きい2の冪数
        n2 = 1
        while n2 < n:
            n2 <<= 1
        self.n2 = n2
        self.tree = [self.intv] * (n2 << 1)
        # 初期化の値が決まっている場合
        if A:
            # 1段目(最下段)の初期化
            for i in range(n):
                self.tree[n2+i] = A[i]
            # 2段目以降の初期化
            for i in range(n2-1, -1, -1):
                self.tree[i] = self.func(self.tree[i*2], self.tree[i*2+1])

    def update(self, i, x):
        """
        i番目の値をxに更新
        :param i: index(0-indexed)
        :param x: update value
        """
        i += self.n2
        self.tree[i] = x
        while i > 0:
            i >>= 1
            self.tree[i] = self.func(self.tree[i*2], self.tree[i*2+1])

    def query(self, a, b):
        """
        [a, b)の値を得る
        :param a: index(0-indexed)
        :param b: index(0-indexed)
        """
        l = a + self.n2
        r = b + self.n2
        s = self.intv
        while l < r:
            if r & 1:
                r -= 1
                s = self.func(s, self.tree[r])
            if l & 1:
                s = self.func(s, self.tree[l])
                l += 1
            l >>= 1
            r >>= 1
        return s

    def get(self, i):
        """ 一点取得 """
        return self.tree[i+self.n2]

    def all(self):
        """ 全区間[0, n)の取得 """
        return self.tree[1]

N, M = MAP()
A = LIST()
B = LIST()

# 最初の座標を基準として0にすると累積和っぽくなる
A = [a-A[0] for a in A]
B = [b-B[0] for b in B]

# 縦横独立に、全区間総和を取る
st1 = SegTree(N, add, 0, A)
st2 = SegTree(M, add, 0, B)
h = w = 0
# 左端を固定して右端は区間取得する
for i in range(N-1):
    h += st1.query(i+1, N) - st1.get(i) * (N-i-1)
    h %= MOD
for i in range(M-1):
    w += st2.query(i+1, M) - st2.get(i) * (M-i-1)
    w %= MOD
ans = h * w % MOD
print(ans)


Measured memory_bytes: 82328
import java.io.PrintWriter
import java.util.*

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun <T> Iterable<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)
fun <T> Array<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val (N, M) = nextIntList()
    val G = Graph(N)
    repeat(M) {
        val (a, b) = nextIntList()
        G.addEdge(a, b)
        G.addEdge(b, a)
    }
    val ans = G.dfs(1)
    println(ans)
}

class Graph(private val v: Int) {
    private val vec = Array(v + 1) { mutableListOf<E>() }

    fun neighborsOf(v: Int) = vec[v].map(E::v).toTypedArray()

    fun addEdge(a: Int, b: Int, c: Long = 0L) {
        vec[a].add(E(b, c))
    }

    fun dfs(pos: Int, visited: BooleanArray = BooleanArray(v + 1) { false }): Int {
        visited[0] = true
        visited[pos] = true
        if (visited.all { it }) return 1
        return neighborsOf(pos).filter { !visited[it] }.map { dfs(it, visited.clone()) }.sum()
    }

    data class E(val v: Int, val c: Long)
}

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

/**
 ____ ____ ____ ____ ____
||a |||t |||o |||d |||o ||
||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|

**/

using namespace std;

typedef long long ll;

int x;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> x;
    cout << 10 - x / 200 << "\n";
    return 0;
}


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

int main(){
  int n,k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i,n){
   cin >> a[i]; 
  }
  if(n>k){
  sort(a.begin(),a.end());
  //reverse(a.begin(),a.end());
  rep(i,k){
   a.pop_back(); 
  }
  ll sum = 0;
  rep(i,a.size()){
   sum += a[i]; 
   // cout << a[i] << endl;
  }
  cout << sum << endl;
  }
  else cout << 0 << endl;
}


Measured memory_bytes: 4836
#include <iostream>
#include <algorithm>
#define flush fflush(stdout)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;
const int mod = (int)998244353, INF = (int)1e9;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };


#define N 200003
ll fac[N], inv[N], finv[N];

void cominit(int n) {
    int i;
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (i = 2; i < n + 2; i++) {
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
    return;
}

ll com(int n, int r) {
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return (fac[n] * finv[r]) % mod * finv[n - r] % mod;
}

int main(void) {
    int n, m, k, i;
    ll fr[200003], ans;

	scanf("%d%d%d", &n, &m, &k);

    cominit(n);

    fr[0] = 1;
    for (i = 0; i <= n; i++) {
        fr[i + 1] = fr[i] * (ll)(m - 1) % mod;
    }

    ans = 0;
    for (i = 0; i <= k; i++) {
        ans = (ans + com(n - 1, i) * m % mod * fr[n - i - 1] % mod) % mod;
    }

    printf("%lld\n", ans);

	return 0;
}

Measured memory_bytes: 10004
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>

using namespace std;
typedef long long Int;
#define REP(i , x) for(int i = 0 ; i < x ; ++i)
Int Ap, Bp;

int main()
{
	int n;
	int a, b;
	
	while (cin >> n, n){
		Ap = Bp = 0;
		REP(i, n){
			cin >> a >> b;
			if (a > b){
				Ap += a;
				Ap += b;
			}
			else if (a < b){
				Bp += a;
				Bp += b;
			}
			else{
				Ap += a;
				Bp += b;
			}
		}

		cout << Ap << " " << Bp << endl;
	}
	return 0;

}

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

int main(){
    int N;
    string si;
    map<string,int> S;

    cin >> N;
    REP(int,i,0,N){
        cin >> si;
        S[si]++;
    }
    
    int max=0;
    for(auto j:S){
        if(max<j.second) max=j.second;
    }

    for(auto j:S){
        if(j.second==max) cout << j.first << endl;
    }
}

Measured memory_bytes: 25216
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define len(x) (int)(x.size())
#define all(vs) vs.begin(), vs.end()
using ii = pair<int, int>;
using ll = long long;
#define MAXN 200000100
#define int long long
int lcm(int a, int b){
	return a*b/__gcd(a, b);
}
int32_t main(){
	ios::sync_with_stdio(0);
	int a, b;
	cin >> a >> b;
	cout << lcm(a, b) << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

using namespace std;

typedef long long ll;
// constexpr ll MOD = 998244353;
constexpr ll MOD = 1000000007;

// struct UnionFind {
//     vector<int> par;
    
//     UnionFind(int N): par(N) {
//         for (int i=0;i<N;i++) par[i] = i;
//     }

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

//     void unite(int x, int y) {
//         int rx = root(x);
//         int ry = root(y);
//         if (rx == ry) return;
//         par[rx] = ry;
//     }

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

int main(void) {
    int N;
    ll C, K;
    vector<ll> T(100010);
    cin >> N >> C >> K;
    for (int i=0;i<N;i++) cin >> T[i];

    sort(T.begin(), T.begin()+N);
    ll M = T[0]; int P = 1, B = 0;
    for (int i=1;i<N;i++) {
        if (T[i]-M > K || P >= C) {
            B++;
            M = T[i];
            P = 1;
        } else {
            P++;
        }
    }
    B++;
    cout << B << endl;

    return 0;
}


Measured memory_bytes: 1024
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let v = read_vec::<i128>();
    if v.contains(&0) {
        println!("{}", 0);
        return;
    }
    let mut ans = 1;
    for i in 0..n {
        if ans * v[i] > 100000_00000_00000_000 {
            println!("-1");
            return;
        }
        ans *= v[i];
    }
    println!("{}", ans);
}

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

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


Measured memory_bytes: 6420
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
//#include <unistd.h>
//#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ll mod = 1000000007;
const ld pi = 3.14159265358;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}

ll fac[510000], finv[510000], inv[510000];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < 510000; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);

ll H,W;
const ll dx[] = {1,1,1,0,0,-1,-1,-1};
const ll dy[] = {1,0,-1,1,-1,0,1,-1};
char shima[55][55];
void dfs(ll x,ll y){
    shima[x][y] = '0';
    rep(i,8){
        ll hx = x + dx[i],hy = y + dy[i];
        if(hx < H && hy < W && hx >= 0 && hy >= 0 && shima[hx][hy] == '1'){
            dfs(hx,hy);
        }
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    while(true){
        cin >> W >> H;
        if(H == 0 && W == 0)break;/*
        rep(i,55){
            rep(j,55){
                shima[i][j] = '0';
            }
        }*/
        rep(i,H){
            rep(j,W){
                cin >> shima[i][j];
            }
        }
        ll ans = 0;
        rep(i,H){
            rep(j,W){
                if(shima[i][j] == '1'){
                    dfs(i,j);
                    ans++;/*
                    rep(i,H){
                        rep(j,W){
                            cout << shima[i][j] << " ";
                        }
                        cout << "\n";
                    }*/
                }
            }
        }
        cout << ans << "\n";
    }
}


Measured memory_bytes: 3148
/**
*
* Author: Mouhanad
* Lang: GNU C++14
*
**/
#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define ii pair < int , int >
#define LS pair < ll , string >
typedef long long ll;
const int inf = 1<<30;
const int N =200100;
ll n , c[N] , f[N] , k ;
bool ok ( ll x ) {
ll kk = k ;
for  (int i = 1; i <= n; i++ ){
    ll d = c[i]*f[i];
    if ( d > x ) {
        ll to = x/f[i];
        if ( c[i]-to > kk ) return 0;
        kk -= (c[i]-to);
    }
}
return 1;
}
int main ( ){
  scanf("%lld %lld",&n,&k);
  for  (int i = 1; i <= n; i++ ) scanf("%lld",c+i);
  for  (int i = 1; i <= n; i++ ) scanf("%lld",f+i);
  sort(c+1,c+1+n);
  sort(f+1,f+1+n,greater<ll>() );
  ll lo = 0 , hi = 1e12 ;
  while ( lo < hi ) {
    ll mid = (lo+hi) >>1LL ;
    if ( ok (mid ) )  hi = mid ;
    else lo = mid+1 ;
  }
  printf("%lld\n",lo);
return 0 ;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define mem(a,b) memset(a,b,sizeof a)
using namespace std;
typedef long long ll;
int main()
{
    ios::sync_with_stdio(false);
    int n,con=0;
    ll sum=1,a[200005]= {0};
    cin>>n;
    for(int i=0; i<n; i++)
    {
        cin>>a[i];
        if(!a[i])
            con=-1;
    }
    if(con==-1)
    {
        cout<<'0';
        return 0;
    }
    for(int i=0; i<n; i++)
    {
        sum*=a[i];
        if(1000000000000000000/sum<a[i+1])
        {
            con=1;
            cout<<"-1";
            break;
        }
    }
    if(!con)
        cout<<sum;
    return 0;
}


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

#define __INIT_CC__ ios::sync_with_stdio(false); \
	cin.tie(0);

#ifdef __WIN32__
	char getchar_unlocked() {return getchar();}
#endif

#define FOR(_i,_n,_m) for(int (_i)=(_n),_t=(_m);_i<(_t);++(_i))
#define FORN(_i,_n,_m) for(int (_i)=(_n),_t=(_m);_i<=(_t);++(_i))
#define FORD(_i,_n,_m) for(int (_i)=(_n),_t=(_m);_i>=(_t);--(_i))
#define RESET(_a,_value) memset(_a,_value,sizeof(_a))
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define ff first
#define ss second
#define mp make_pair
#define SIZE(_a) (int)_a.size()
#define VSORT(_a) sort(_a.begin(),_a.end())
#define SSORT(_a,_val) sort(_a,_a+(_val))
#define ALL(_a) _a.begin(),_a.end()
#define mt make_tuple
#define _get(_tuple,_i) get<_i>(_tuple)
#define eb emplace_back
 
using namespace std;

using vi = vector<int>;
using ii = pair<int,int>;
using vii = vector<ii>;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll,ll>;
using vpll = vector<pll>;
using vll = vector<ll>;
using pdd = pair<double,double>;
using vpdd = vector<pdd>;
template <typename T> using uset = unordered_set<T>;
template <typename T> using umultiset = unordered_multiset<T>;
template <typename K, typename V> using umap = unordered_map<K, V>;
template <typename K, typename V> using umultimap = unordered_multimap<K, V>;

const int dr[] = { 1, 0,-1, 0, 1, 1,-1,-1};
const int dc[] = { 0, 1, 0,-1, 1,-1,-1, 1};
const double eps = 1e-9;
const int INF = 0x7FFFFFFF;
const ll INFLL = 0x7FFFFFFFFFFFFFFFLL;
const double pi = acos(-1);

template <typename T> T take(queue<T> &O) {T tmp=O.front();O.pop();return tmp;}
template <typename T> T take(stack<T> &O) {T tmp=O.top();O.pop();return tmp;}
template <typename T> T take(priority_queue<T> &O) {T tmp=O.top();O.pop();return tmp;}
template <typename T>
inline bool inRange(const T& z, const T& a, const T& b){return a <= z && z <= b;}

void OPEN(const string& in = "input.txt", const string& out = "output.txt")
{
	freopen(in.c_str(), "r", stdin);
	freopen(out.c_str(), "w", stdout);
	return ;
}

//using sokokaleb's template v4.0

int arr[2];
vi len[2];
string s;
bitset<32105> dp[2];
const int OFFSET = 16010;

bool bisa(int tgt, const vi& len) {
	dp[0].reset();
	dp[1].reset();
	dp[0].set(OFFSET, 1);
	int o = 0;
	for (int x : len) {
		int p = o;
		o ^= 1;
		dp[o].reset();
		FOR (i, 0, 32005) {
			if (dp[o].test(i));
			else {
				dp[o].set(i, (i - x >= 0 && dp[p].test(i - x)) || (i + x < 32005 && dp[p].test(i + x)));
			}
		}
	}

	return dp[o].test(tgt + OFFSET);
}

int main(int argc, char** argv) {
	__INIT_CC__
	cin >> s;
	FOR (i, 0, 2) {
		cin >> arr[i];
	}
	int st = 0;
	while (st < SIZE(s) && s[st] == 'F') {
		--arr[0];
		++st;
	}
	int o = 0, cnt = 0;
	FOR (i, st, SIZE(s)) {
		if (s[i] == 'T') {
			if (cnt > 0) {
				len[o].pb(cnt);
				cnt = 0;
			}
			o ^= 1;
		} else {
			++cnt;
		}
	}
	if (cnt > 0) {
		len[o].pb(cnt);
	}

	if (bisa(arr[0], len[0]) && bisa(arr[1], len[1])) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
 
using namespace std;
using S = set<long long>;
using D = deque<long long>;
using L = vector<long long>;
using M = map<int,long long>;
using A = vector<vector<long long>>;
using Q = priority_queue<long long>;
using U = unordered_map<int,long long>; //mapとの違いはkeyの順番を保持していない

#define sorted(vector) sort(vector.begin(),vector.end()) //O(nlongn)
#define vmin(vector) *min_element(vector.begin(),vector.end()) //O(N)
#define vmax(vector) *max_element(vector.begin(),vector.end()) //O(N)
#define vsum(vector) accumulate(vector.begin(),vector.end(),0) //O(N)
#define vcount(vector,a) count(vector.begin(), vector.end(),a) //O(N)
#define bisect_left(vector,a) (lower_bound(vector.begin(),vector.end(),a)-vector.begin())
#define bisect_right(vector,a) (upper_bound(vector.begin(),vector.end(),a)-vector.begin())
#define vfind(vector,a) find(vector.begin(), vector.end(), a) != vector.end() //遅いからあんまり使うな
//存在確認はmap!!!!!!!!!!!!!
//__gcd(a,b)はコンパイラがGCC時のみ

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    long long n,k,q,pre;
    
    cin>>n>>k>>q;
    L l(n,0);
    for(int i=0  ;i<q  ;i++){
        cin>>pre;
        l[pre-1]+=1;
    }
    
    for(int i=0  ;i<n  ;i++){
        if ((-q+l[i]+k)>0){
            cout<<"Yes"<<endl;
        }else{
            cout<<"No"<<endl;
        }
    }
}

Measured memory_bytes: 1408
process.stdin.resume();
process.stdin.setEncoding("utf8");

const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});

const lines = [];

reader.on("line", (line) => {
  lines.push(line);
});

reader.on("close", () => {
  let n = lines[0] - 0;
  let ns = lines[1].split(" ").map(Number);
  let count = 0;
  let minj;
  for (let i = 0; i < n; i++) {
    minj = i;
    for (j = i; j < n; j++) {
      if (ns[j] < ns[minj]) {
        minj = j;
      }
    }
    if (minj !== i) {
      const t = ns[i];
      ns[i] = ns[minj];
      ns[minj] = t;
      count++;
    }
  }
  console.log(ns.join(" "));
  console.log(count);
});



Measured memory_bytes: 16292
fn answer() {
    fn read<T: std::str::FromStr>() -> T {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).ok();
        s.trim().parse().ok().unwrap()
    }
    fn read_vec<T: std::str::FromStr>() -> Vec<T> {
        read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
    }

    fn primes(max:i64) -> Vec<i64>{
        let mut k = vec![2,3];
        for c in 1..(max/6)+1 {
            let a = c*6-1;
            let b = c*6+1;
            let mut af = true;
            let mut bf = true;
            for d in 0..k.len() {
                if af && (a % k[d]) == 0 {
                    af = false;
                }
                if bf && (b % k[d]) == 0 {
                    bf = false;
                }
            }
            if af {
                k.append(&mut vec![a])
            }
            if bf {
                k.append(&mut vec![b])
            }
        }
        return k
    }
    fn invmod(p:i64, g:i64) -> i64 {
        fn euclidean(px:i64, py:i64, pgcd:i64, x:i64, y:i64, gcd:i64) -> i64 {
            match  pgcd % gcd {
                0 => x,
                _ => {
                    let d = pgcd /gcd;
                    let m = pgcd % gcd;
                    return euclidean(x, y, gcd, px-(d*x), py-(d*y), m)
                }
            }
        }
        return (euclidean(1,0,p,0,1,g)+g)%g;
    }
    fn multiper(n:i64, m:i64, c:i64) -> (i64, i64) {
        match m % n {
            0 => multiper(n, m/n, c+1),
            _ => (m,c)
        }
    }

    fn comb(n:i64, k:i64, p:i64)-> i64 {
        let mut ans = 1;
        for c in 1..k+1 {
            ans = remain(multi(ans , (n-c+1)), p);
            ans = remain(multi(ans, invmod(c, p)), p);
//            ans = remain(divide(ans , c), p);
        }
        return ans
    }

    fn fac(l:Vec<i64>, m:i64) -> Vec<i64> {
        match l.len() {
            0 => vec![1],
            _ => {
                let mut ll = l;
                let a = match multiper(ll.pop().unwrap(), m, 0) {
                    (1, 0) => vec![],
                    (1, y) => vec![y],
                    (x, 0) => {
                        return fac(ll, m)
                    }
                    (x, y) => {
                        let mut k = vec![y];
                        k.append(&mut fac(ll,x));
                        return k
                    }
                };
                return a;
            }
        }
    }

    fn multi(a:i64, b:i64) -> i64 {a*b}
    fn remain(a:i64, b:i64) -> i64 {a%b}
    fn main() {
        let max = 1000000007;
        let nk = read_vec::<i64>();
        let n:i64 = nk[0];
        let m:i64 = nk[1];
        let primes = primes((m as f64).sqrt() as i64);

        let f = fac(primes, m);
        let mut a = 1;
        for c in f {
            a = remain(multi(a,comb(n+c-1, c, max)),max)
        }
        println!("{}", a);
    }
    main()
}

fn main() {
	answer()
}


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

using namespace std;

int main()
{

    int N;
    vector<int> B(100 - 1);
    vector<int> A(100, 0);

    cin >> N;
    for (int i = 0; i < N - 1; i++)
    {
        cin >> B[i];
    }

    for (int i = 0; i < N - 1; i++)
    {
        if (i == 0)
        {
            A[i] = B[i];
            A[i + 1] = B[i];
        }
        else
        {
            if (A[i] > B[i])
                A[i] = B[i];
            A[i + 1] = B[i];
        }
        //cout << A[i] << " " << A[i + 1] << " " << B[i] << endl;
    }

    cout << accumulate(A.begin(), A.end(), 0) << endl;

    return 0;
}

Measured memory_bytes: 256
function main (input) {
  var inputs = input.split("\n");
  var th = inputs[0].split(" ").map(elm => {return Number(elm)});
  var h = inputs[1].split(" ").slice(0,th[0]).map(elm => {return Number(elm)});
  //console.log(h,th);
  
  var a = h.filter(elm => {return elm >= th[1]}).length;     
  console.log(a);

}

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

Measured memory_bytes: 28620
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<long,long>
#define INF 1000000000000000000
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; }
const long long MOD = 1000000007;
using namespace std;
typedef long long ll;
map<int, int> mp;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
class Union_Find {
private:
	vector<int> par;
	vector<int> rank;
public:
	Union_Find(int n) {
		rep(i, n) {
			par.push_back(i);
			rank.push_back(0);
		}
	}
	int find(int x) {
		if (par.at(x) == x) return x;
		else return par.at(x) = find(par.at(x));
	}
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) return;
		if (rank.at(x) < rank.at(y)) {
			par.at(x) = y;
		}
		else {
			par.at(y) = x;
			if (rank.at(x) == rank.at(y)) rank.at(x)++;
		}
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
};

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	int ans = 0;
	vector<int>a(n); rep(i, n) { cin >> a[i];  ans += a[i]; }
	cout << ans - n << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}
main(){
    ll n,a,b,ans=1,MOD=mod-1;
    cin>>n;
    map<pair<ll,ll>,pair<ll,ll>>m;
    for(ll i=0;i<n;i++){
        cin>>a>>b;
        if(!a&&!b) MOD++;
        else{
            ll g=__gcd(a,b);
            a/=g,b/=g;
            if(b<0) a=-a,b=-b;
            if(a<=0) m[{b,-a}].second++;
            else m[{a,b}].first++;
        }
    }
    for(auto u:m) ans=ans*(power(2,u.second.first)+power(2,u.second.second)-1+mod)%mod;
    cout<<(ans+MOD)%mod;
}


Measured memory_bytes: 19176
n = input()
a = n[:2]
b = n[2:]
#print(int(a),int(b))
if 1 <= int(a) <= 12:
    if 1 <= int(b) <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= int(b) <= 12:
        print("YYMM")
    else:
        print("NA")

Measured memory_bytes: 38512
// Problem : D - Road to Millionaire
// Contest : AtCoder - M-SOLUTIONS Programming Contest 2020
// URL : https://atcoder.jp/contests/m-solutions2020/tasks/m_solutions2020_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*

WINNERS NEVER QUIT AND QUITTERS NEVER WIN!!

*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<long,long> pl;
typedef pair<ll,ll> pll;
typedef vector<long> vl;
typedef vector<bool> vb;
typedef vector<ll> vll;
typedef vector<vl> vvl;
typedef vector<vb> vvb;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef unordered_map<ll,ll> umll;

#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define REV(i,a,b) for(long long i=a;i>=b;i--)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define tc ll tests;cin>>tests;while(tests--)
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define coutv(v) for(auto it: (v))cout<<it<<" ";newl;
#define cout2d(v) for(auto it: (v)) {for(auto j:it) cout<<j<<" ";newl;}
#define cinv(v,n) vll (v)(n);FOR(i,0,(n)){cin>>v[i];}
#define cinvg(v,n) (v).resize(n);FOR(i,0,(n)){cin>>v[i];}
#define cin2d(v,n,m) vvll (v)(n,vll(m,0));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define cin2dg(v,n,m) (v).resize(n,vll(m));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define newl cout<<"\n"
#define mod 1000000007
#define INF LLONG_MAX/2

int main()
{
    io;
    ll n,cash=1000,stock=0,f_min=0,l_max=n-1;
    cin>>n;
    cinv(a,n)
    
    /*FOR(i,0,n-1)
    {
    	if(a[i]<a[i+1])
    	{
    		f_min=i;break;
    	}
    }
    REV(i,n-1,1)
    {
    	if(a[i]>a[i-1]){l_max=i;break;}
    }
    //cout<<f_min<<" "<<l_max;newl;
    cash=cash%a[f_min];
    stock+=1000/a[f_min];
    for(ll i=f_min+1;i<l_max;i++)
    {
    	if(a[i]>a[i-1] && a[i]>=a[i+1])
    	{
    		cash+=stock*a[i];
    		stock=0;
    	}
    	else if(a[i]<a[i-1] && a[i]<=a[i+1])
    	{
    		cash=cash%a[i];
    		stock+=cash/a[i];
    	}
    }
    cash+=stock*a[l_max];*/
    
    FOR(i,0,n-1)
    {
    	if(a[i]<a[i+1])
    	{
    		stock=cash/a[i];
    		cash=cash%a[i];
    		cash+=stock*a[i+1];
    		stock=0;
    	}
    }
    
    cout<<cash;
    
    return 0;
}



Measured memory_bytes: 3616
import java.util.Scanner;

public class Main {
	public static void main(String[]args){
			Scanner scan = new Scanner(System.in);
			//System.out.println("??\???");
			String str=scan.next();
			StringBuffer sb = new StringBuffer(str);
			String hantai = sb.reverse().toString();
			System.out.println(hantai);
			
		
		}
}

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rp(i,n){
        cin >> a.at(i);
    }
    vector<int> b(n);
    rp(i,n){
        int cnt=0;
        while(a.at(i)%2==0){
            a.at(i) /= 2;
            cnt++;
        }
        b.at(i) = cnt;
    }
    sort(b.begin(),b.end());
    
    cout << b.at(0) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <unordered_map>
#include <utility>
#define FR first
#define SE second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ull,ull> pr;

inline ll mul(ll x,ll y,ll MOD) {
  ll t=(x*y-(ll)((long double)x/MOD*y+1e-8)*MOD);
  return (t<0)?t+MOD:t;
}
 
ll gcd(ll x,ll y) {
  return (x%y==0)?y:gcd(y,x%y);
}
 
ll pow_mod(ll x,ll k,ll MOD) {
  ll ans=1;
  while (k) {
    if (k&1) ans=mul(ans,x,MOD);
    x=mul(x,x,MOD);
    k>>=1;
  }
  return ans;
}
 
bool is_prime(int c,ll n) {
  ll d=n-1;
  while (!(d&1)) d>>=1;
  ll t=pow_mod(c,d,n);
  while (d!=n-1&&t!=n-1&&t!=1) {
    t=mul(t,t,n);
    d<<=1;
  }
  return (t==n-1)||(d&1);
}
 
const int pri[3]={2,7,61};
 
bool miller_rabin(ll n) {
  if (n==4759123141LL) return 0;
  for(int i=0;i<2;i++) 
    if (!is_prime(pri[i],n)) return 0; 
  return 1;
}

int prime[3005],tot;
bool check[3005];

void pre() {
  int N=pow(1e10,1.0/3);
  for(int i=2;i<=N;i++) {
  	if (!check[i]) prime[++tot]=i;
  	for(int j=1;j<=tot&&i*prime[j]<=N;j++) {
  		check[i*prime[j]]=1;
  		if (i%prime[j]==0) break;
	  }
  }
}

unordered_map <ll,ull> mp;

ull rd() {
  return (ull)rand()*rand()*1063094364578754ull+rand();
}

ull getrd(ll x) {
  if (!mp.count(x)) mp[x]=rd();
  return mp[x];
}

pr now[15];

pr calc(int n) {
  ull s1=0,s2=0;
  for(int i=1;i<=n;i++)
    if (now[i].SE%3) {
    	now[i].SE%=3;
    	s1^=getrd(now[i].FR*now[i].SE);
    	s2^=getrd(now[i].FR*(3-now[i].SE));
	}
  return pr(s1,s2);
}

pr a[100005];
ull num[100005];
int sum[100005];
bool vis[100005];

int main() {
  srand(19260817);
  pre();
  int n;
  scanf("%d",&n);
  int m=0,s1=0,s2=0;
  for(int i=1;i<=n;i++) {
  	ll x;
  	scanf("%lld",&x);
  	int cnt=0;
  	for(int j=1;j<=tot&&prime[j]<=x;j++)
  	  if (x%prime[j]==0) {
  	  	  now[++cnt]=pr(prime[j],0);
  	  	  while (x%prime[j]==0) {
  	  	  	    now[cnt].SE++;
  	  	  	    x/=prime[j];
			  }
		}
	if (x>1) {
		ll t=sqrt(x);
		while (t*t>x) t--;
		while (t*t<x) t++;
		if (t*t==x) now[++cnt]=pr(t,2);
		else if (miller_rabin(x)) now[++cnt]=pr(x,1);
		else {
			s1++;
			continue;
		}
	}
	pr t=calc(cnt);
	if (t.FR) {
		a[++m]=t;
		num[m]=t.FR;
	}
	else s2=1;
  }
  sort(num+1,num+m+1);
  for(int i=1;i<=m;i++) {
  	a[i].FR=lower_bound(num+1,num+m+1,a[i].FR)-num;
  	sum[a[i].FR]++;
  	ull t=a[i].SE;
  	a[i].SE=lower_bound(num+1,num+m+1,a[i].SE)-num;
  	if (num[a[i].SE]!=t) a[i].SE=0;
  }
  int ans=0;
  for(int i=1;i<=m;i++)
    if (!vis[a[i].FR]) {
    	ans+=max(sum[a[i].FR],sum[a[i].SE]);
    	vis[a[i].FR]=vis[a[i].SE]=1;
	}
  printf("%d\n",ans+s1+s2);
  return 0;
}

Measured memory_bytes: 9124
N, L, T = map(int, input().split())
n = [list(map(int, input().split())) for _ in range(N)]
t = [X + (0, T, -T)[W] for X, W in n]
l = sorted(i % L for i in t)
s = sum(i // L for i in t) % N
for i in l[s:] + l[:s]: print(i)

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

int main() {
  string S;
  cin >> S;
  
  int ren = 0, ren_max = 0;
  for (char c: S) {
    if (c == 'R') {
      ren++;
      if (ren_max < ren) ren_max = ren;
    }
    else {
      ren = 0;
    }
  }
  cout << ren_max << endl;
}


Measured memory_bytes: 3624
import Control.Monad
import Data.List

hasNoDuplicates :: [String] -> Bool
hasNoDuplicates list = (length list) == (length $ nub list)

isShiritori :: [String] -> Bool
isShiritori [x1,x2] = (last x1) == (head x2)
isShiritori (x1:remains@(x2:xs))
  | (last x1) /= (head x2) = False
  | otherwise              = isShiritori remains

main :: IO ()
main = do
  count <- readLn
  words <- replicateM count getLine
  putStrLn $ if (isShiritori words) && (hasNoDuplicates words) then "Yes" else "No"

Measured memory_bytes: 636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll> > P3;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(2e5 + 5);
const double EPS = 1e-10;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

struct SegmentTree {
    int N;
    vector<int> node;
    const int INF = INT_MAX;

    SegmentTree(){}
    SegmentTree(int n_){
        init(n_);
    }

    void init(int siz){
        N = 1;
        while (N < siz) N *= 2;  // 最下段の要素数を2のべき乗にする
        node.resize(2*N-1, INF);
    }

    void build(vector<int> &dat){
        int siz = dat.size();
        for(int i=0; i<siz; i++){
            node[i+N-1] = dat[i];
        }
        for(int i=N-2; i>=0; i--){  // 最下段に値を入れたあと下から順に更新
            node[i] = min(node[2*i+1], node[2*i+2]);
        }
    }

    void update(int k, int a) {
        k += N - 1; //葉の節点の番号
        node[k] = a;
        while (k > 0) { //登りながら上の要素を更新
            k = (k-1)/2;
            node[k] = min(node[k*2+1], node[k*2+2]);
        }
    }
    /*
    [a,b)の最小値を求める
    外からはgetMin(a,b)で呼ぶ
    kは節点の番号、l,rはそのk番目の節点の区間を表す
    */
    int getMin(int a, int b) {return getMin(a, b, 0, 0, N);}
    int getMin(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l)
            return INF;  //[a,b)と[l,r)に共通区間がないならINF
        if (a <= l && r <= b)
            return node[k];  //[a,b)が[l,r)を完全に含むならその節点kの値
        else {
            int vl = getMin(a, b, k*2+1, l, (l+r)/2);
            int vr = getMin(a, b, k*2+2, (l+r)/2, r);
            return min(vl, vr);
        }
    }
};

int main() {
    int n, q;
    cin >> n >> q;
    SegmentTree rmq;
    rmq.init(n);
    REP(i,q){
        int a, b, c;
        cin >> a >> b >> c;
        if(a){
            cout << rmq.getMin(b, c+1) << endl;
        }
        else{
            rmq.update(b, c);
        }
    }
    return 0;
}


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

using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using f64 = double;
using f80 = long double;

#define FOR(v, a, b) for(i64 v = (a); v < (b); ++v)
#define FORE(v, a, b) for(i64 v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(i64 v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <Mylib/Debug/debug.cpp>
#else
#define dump(...) ((void)0)
#endif

using namespace std;

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T> void pout(const T &value){std::cout << value << "\n";}
template <typename T, typename ...Args> void pout(const T &value, const Args&... args){std::cout << value << " ";pout(args...);}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}
template <typename T> auto make_vector(int n, int m, const T &value){return vector<vector<T>>(n, vector<T>(m, value));}


struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(12);
  }
}init;



int main(){
  int R;
  while(cin >> R){
    double ans = M_PI * 2.0 * R;
    pout(ans);
  }

  return 0;
}


Measured memory_bytes: 3800
const int isDebugMode = 1;
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
struct edge{long long to,cost;};
const int inf = 1 << 27;
const long long INF = 1LL << 60;
const int COMBMAX = 1001001;
const long long MOD = 1000000007;
const long long dy[] = {-1, 0, 0, 1};
const long long dx[] = {0, -1, 1, 0};
string abc = "abcdefghijklmnopqrstuvwxyz";
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define eachdo(v, e) for (const auto &e : (v))
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (long long)distance((v).begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (long long)distance((v).begin(), upper_bound((v).begin(), (v).end(), e))
long long mpow(long long a, long long n, long long mod = MOD){long long res = 1; while(n > 0){if(n & 1)res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
void pt(){cout << endl; return;}
template<class Head> void pt(Head&& head){cout << head; pt(); return;}
template<class Head, class... Tail> void pt(Head&& head, Tail&&... tail){cout << head << " "; pt(forward<Tail>(tail)...);}
void dpt(){if(!isDebugMode) return; cout << endl; return;}
template<class Head> void dpt(Head&& head){if(!isDebugMode) return; cout << head; pt(); return;}
template<class Head, class... Tail> void dpt(Head&& head, Tail&&... tail){if(!isDebugMode) return; cout << head << " "; pt(forward<Tail>(tail)...);}
template<class T> void debug(T v){if(!isDebugMode) return; rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void debug2(T v){if(!isDebugMode) return; rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T1, class T2> inline bool chmin(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}
template<class T1, class T2> inline bool chmax(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}
template<class T1, class T2> long long gcd(T1 a, T2 b){return a % b ? gcd(b , a % b) : b;}
template<class T1, class T2> void reduce(T1 &a, T2 &b){ll g = gcd(a, b); a /= g; b /= g; return;}
bool valid(long long H, long long W, long long h, long long w) { return 0 <= h && h < H && 0 <= w && w < W; }

int main(){
    ll A, V; cin >> A >> V;
    ll B, W; cin >> B >> W;
    ll T; cin >> T;
    ll d = abs(A - B);
    pt(T * W + d - V * T <= 0 ? "YES" : "NO");

}

Measured memory_bytes: 3636
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int count = 0;
		int keihi = 0;

		Queue<Integer> queue = new PriorityQueue<Integer>(Comparator.reverseOrder());
		for(int i = 0; i < m; i++) {
			int a = sc.nextInt();
			int iranai = sc.nextInt();
			if(a >= n) count++;
			else queue.add(a);
		}

		if(count >= m - 1) System.out.println(0);
		else {
			for(int i = 0; i < m - 1 - count; i++) {
				keihi += n - queue.poll();
			}
			System.out.println(keihi);
		}
	}

}



Measured memory_bytes: 32056
#if 1

#include <bits/stdc++.h>
using namespace std;
int n,s1,s2,e1,e2;
char a[200005];
int b[2];

int main()
{
    scanf("%d %d %d %d %d", &n, &s1, &s2, &e1, &e2);
    //if(s1 > e1) swap(s1,e1);
    //if(s2 > e2) swap(s2,e2);
    if(s1 > e1||s2 > e2)
    {
        printf("No");
        return 0;
    }
    scanf("%s",a+1);
    int c = 0;
    for(int i = s1;i < e1;i++)
    {
        if(a[i] == '#'&&a[i+1] == '#')
        {
            printf("No");
            return 0;
        }
    }
    for(int i = s2;i < e2;i++)
    {
        if(a[i] == '#'&&a[i+1] == '#')
        {
            printf("No");
            return 0;
        }
    }
    for(int i = s2-1;i < e2;i++)
    {
        if(a[i] == '.'&&a[i+1] == '.'&&a[i+2] == '.')
        {
            c = 1;
        }
    }
    //cout << c;
    if((s1 < s2&&e1 > e2)&&!c)
    {
        printf("No");
        return 0;
    }
    printf("Yes");
    return 0;
}

#endif // 1++

Measured memory_bytes: 384
while True:
        N, M = map(int, input().split())  # 宿の数N, 予算M
        if N == 0 and M == 0:
            break

        dangers = {}  # Pをkeyとして頑張る
        for _ in range(N):
            distance, P = map(int, input().split())
            if P not in dangers:
                dangers[P] = distance
            else:
                dangers[P] += distance

        # 期待値の降順でソート
        dangers = sorted(dangers.items(), key=lambda x:x[0], reverse=True)
        ans = 0
        for i in range(len(dangers)):
            P, distance = dangers[i][0], dangers[i][1]
            if M >= distance:
                M -= distance
                distance = 0
            else:
                distance -= M
                M = 0
            ans += P*distance
        print(ans)


Measured memory_bytes: 5612
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
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; }
typedef long long ll;
typedef pair<int,int> P;

ll dp[2005][2005];

int main(){
    int n;
    cin >> n;
    vector<pair<ll,int>> a(n);
    rep(i,n){
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a.rbegin(),a.rend());
    rep(i,n+1){
        rep(j,n+1){
            if(i+j>n)continue;
            if(i!=0)chmax(dp[i][j],dp[i-1][j]+a[i+j-1].first*abs(a[i+j-1].second-(i-1)));
            if(j!=0)chmax(dp[i][j],dp[i][j-1]+a[i+j-1].first*abs(a[i+j-1].second-(n-j)));
        }
    }
    ll ans=0;
    rep(i,n+1)chmax(ans,dp[i][n-i]);
    cout << ans << endl;
}

Measured memory_bytes: 26308
n, m = map(int, input().split())

stair = [1]*(n+1)
for i in range(m):
    a = int(input())
    stair[a] = 0

for i in range(2, n+1):
    stair[i] *= (stair[i-1] + stair[i-2])

print(stair[n]%(10**9+7))


Measured memory_bytes: 462708
#include <stdio.h>

int main(void)
{
    int n=0,k=0,d=0,temp=0,count=0;
    int trick[101]={};

    scanf("%d %d",&n,&k);
    for(int i=0;i<k;i++){
        scanf("%d",&d);
        for(int j=0;j<d;j++){
            scanf("%d",&temp);
            trick[temp]=1;
        }
    }
    for(int i=1;i<=n;i++){
        if(trick[i]==0) count+=1;
    }

    printf("%d",count);
    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
	string N; cin >> N;
	ll judge = 0;
	for(int i = 0; i < N.size(); i++) {
		int  n = N[i] - '0';
		judge += n;
	}
	string ans;
	if(judge % 9 == 0) ans = "Yes";
	else ans = "No";
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3720
while 1:
    n, x = map(int, input().split())
    if n+x==0:break
    c = 0
    for i in range(1, n-1):
        for j in range(i+1, n):
            if i + j > x:break
            if j < x - i - j <= n:
                c += 1
            # for k in range(j+1, n+1):
                # if i + j + k == x:
                #     c += 1
                # elif i + j + k > x:break
    print(c)


Measured memory_bytes: 5588