akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    n = II()
    ans = 0
    for i in range(1, n + 1):
        x = n // i
        ans += i * (1 + x) * x // 2
    print(ans)

    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 9840
#include <vector>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,n,s) for(int i=s;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a) (a).begin(),(a).end()

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

  int a,p;
  cin >> a >> p;
  cout << (a*3+p)/2 << endl;
  return 0;
}


Measured memory_bytes: 256
//In the name of God
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;

const ll maxn = 3e3 + 100;
const ll mod = 1e9 + 7;
const ll nim = (mod + 1) >> 1;
const ll inf = 1e18;

#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io freopen("input.txt", "r+", stdin);freopen("output.txt", "w+", stdout);
#define pb push_back
#define Mp make_pair
#define F first
#define S second

ll n, q, a[maxn], dp[maxn][maxn];

int main(){
    fast_io;

    cin >> n >> q;
    for(ll i = 1; i <= n; i++){
        cin >> a[i];
    }
    for(ll i = 1; i <= n; i++){
        for(ll j = 1; j <= n; j++){
            dp[i][j] = ll(a[i] > a[j]);
        }
    }
    for(ll i = 0; i < q; i++){
        ll v, u;
        cin >> v >> u;
        for(ll j = 1; j <= n; j++){
            if(v == j || u == j) continue;
            dp[v][j] = dp[u][j] = ((dp[v][j] + dp[u][j]) * nim) % mod;
            dp[j][v] = dp[j][u] = ((dp[j][v] + dp[j][u]) * nim) % mod;
        }
        dp[v][u] = dp[u][v] = ((dp[v][u] + dp[u][v]) * nim) % mod;
    }
    ll ans = 0;
    for(ll i = 1; i <= n; i++){
        for(ll j = 1; j < i; j++){
            ans += dp[j][i];
            if(ans >= mod) ans -= mod;
        }
    }
    for(ll i = 0; i < q; i++){
        ans <<= 1;
        if(ans >= mod) ans -= mod;
    }
    cout << ans;

    return 0;
}


Measured memory_bytes: 76344
class Solution(object):
    def combinationSum(self, target):
        candidates = []
        for i in range(10):
            candidates.append(i)
        stack = [(0, 0, [])]
        result = []
        while stack:
            total, start, res = stack.pop()
            if total == target and len(res) == 4:
                result.append(res)
            elif len(res) > 4:
            	continue
            if total == 0 and len(res) == 4:
            	continue
            for i in range(start, len(candidates)):
                t = total + candidates[i]
                if t > target:
                    break
                stack.append((t, i, res + [candidates[i]]))
        return result
    def duplicated(self, nums, i, j):
        for t in range(i, j):
            if nums[t] == nums[j]:
                return False
        return True
    def recursion(self, nums, i, n, result):
        if i == n - 1:
            temp = []
            for k in range(0, n):
                temp.append(nums[k])
            result.append(temp)
        else:
            for k in range(i, n):
                if self.duplicated(nums, i ,k):
                    temp = nums[k] #swap
                    nums[k] = nums[i]
                    nums[i] = temp
                    self.recursion(nums, i + 1, n, result)
                    temp = nums[k] #swap
                    nums[k] = nums[i]
                    nums[i] = temp
    def permuteUnique(self, nums):
        result = []
        self.recursion(nums, 0, len(nums), result)
        return result
# s = Solution()
# combination = s.combinationSum(35)
# m = 0
# for i in range(len(combination)):
#     m += len(s.permuteUnique(combination[i]))
# print m

while True:
    try:
        n = int(raw_input())
        s = Solution()
        combination = s.combinationSum(n)
        m = 0
        for i in range(len(combination)):
            m += len(s.permuteUnique(combination[i]))
        print m
    except (EOFError):
        break
# b = map(int, s2.split())

Measured memory_bytes: 6472
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void selectionSort(String A[], int N) {
		for (int i = 0; i < N; i++) {
			int minj = i;
			String oki;
			for (int j = i; j < N; j++) {
				if (A[j].charAt(1) < A[minj].charAt(1)) {
					minj = j;
				}
			}
			if (i != minj) {
				oki = A[minj];
				A[minj] = A[i];
				A[i] = oki;
			}
		}
	}

	public static void bubbleSort(String A[], int N) {
		String b;
		for (int i = 0; i < N - 1; i++) {
			for (int j = N - 1; j > i; j--) {
				if (A[j - 1].charAt(1) > A[j].charAt(1)) {
					b = A[j - 1];
					A[j - 1] = A[j];
					A[j] = b;
				}
			}
		}
	}

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		String[] cards1 = new String[N];
		String[] cards2 = new String[N];
		for (int i = 0; i < N; i++) {
			cards1[i] = scanner.next();
			cards2[i] = cards1[i];
		}
		bubbleSort(cards1, N);
		for (int i = 0; i < N; i++) {
			if (i != N - 1) {
				System.out.print(cards1[i] + " ");
			} else {
				System.out.println(cards1[i]);
			}
		}
		System.out.println("Stable");
		selectionSort(cards2, N);
		for (int i = 0; i < N; i++) {
			if (i != N - 1) {
				System.out.print(cards2[i] + " ");
			} else {
				System.out.println(cards2[i]);
			}
		}
		if (Arrays.equals(cards1, cards2)) {
			System.out.println("Stable");
		} else {
			System.out.println("Not stable");
		}
		scanner.close();

	}
}


Measured memory_bytes: 26348
#include<iostream>
#include<stdio.h>//printf("%.*f\n",*********);
#include<vector>//s.erase(n),vector
#include<algorithm>//next_permutation
#include<set>
#include<string>//char('a'=32+'A')
//to_string,string,substr
#include<sstream>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>//min,max
#include<math.h>
#include<queue>
#include<time.h>
#include<map>//map
#include<iomanip>
#include<locale>
#include<utility>//swap

#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)//start==1
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)//end==1
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define Yay(ans) if(ans)cout<<"Yay!"<<rt;else cout<<":("<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(a,n) rep(i,n)cin>>a[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//昇順
#define reve(s) reverse(s.begin(),s.end())//反転
#define please return
#define AC 0
#define Inf 2147483647//int最大
#define llInf 9223372036854775807//llint最大
#define rapid cin.tie(0);ios::sync_with_stdio(false)
#define pi 3.1415926535897932384626//pi
#define nine 1000000000//10^9
#define print(a) printf("%.15f\n",a)

using namespace std;
typedef vector<int> vint;
typedef long double ldouble;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef vector<double> vdouble;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int KETA(int n) { //Sum of Each Digit
	int sum = 0;
	while (n > 0) {
		sum += n % 10; n /= 10;
	}
	return sum;
}

unsigned ND(unsigned num) {//Number of Digits
	return std::to_string(num).length();//outmax=10
}

bool KIBN(string s) {
	rep(i, s.size() / 2) {
		if (s[i] != s[s.size() - 1 - i])return false;
	}
	return true;
}

bool inte(double n) {//整数かどうかの判定
	if (ceil(n) == floor(n)) {//切り上げ関数,切り下げ関数
		return true;
	}
	else return false;
}

// (char)toupper(a[n])=文字列のn文字目を大文字で出力

// pow(a,b)=aのb乗

//グローバル関数
int a = 0, n = 0, x = 0, y = 0, ans = 0, cnt = 0, sum = 0;
string s = "";

int main(void) {
	rapid;

	llint n, k;
	cin >> n >> k;
	llint ans = k;
	rep(i, n - 1) {
		ans *= k - 1;
	}
	cout << ans << rt;

	please AC;
}


//参考：---;


Measured memory_bytes: 256
S = input()
ans = "AC"
if S[0] != 'A':
    ans = "WA"
cnt = 0
N = len(S)
for i in range(1, N):
    if S[i].isupper():
        if i == 1 or i == N - 1 or S[i] != "C":
            ans = "WA"
        cnt += 1
if cnt != 1:
    ans = "WA"
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
//repマクロ定義
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
//allマクロ定義
#define all(v) v.begin(),v.end()
using namespace std;

int main(){

  bool ans=true;

  string s,y,m,d;
  cin >> s;
  y=s.substr(0,4);
  m=s.substr(5,2);
  d=s.substr(8,2);

  int year,month,day;
  year=atoi(y.c_str());
  month=atoi(m.c_str());
  day=atoi(d.c_str());

  if(year>2019){
    ans=false;
  }else if(year==2019){
    if(month>4){
      ans=false;
    }
  }




  if(ans){
    puts("Heisei");
  }else{
    puts("TBD");
  }

}

Measured memory_bytes: 256
import java.awt.List;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Scanner;

public class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		while (sc.hasNext())
		{
			String a = sc.next();
			char x = a.charAt(a.length() - 1);
			if (x == '2' | x == '4' | x == '5' | x == '7' | x == '9')
			{
				System.out.println("hon");
			} else if (x == '1' || x == '6' || x == '8'|x=='0')
			{
				System.out.println("pon");
			} else
			{
				System.out.println("bon");
			}
		}

	}

}

Measured memory_bytes: 35688
import sys

class Queue():
    def __init__(self):
        self.Q = []

    def isEmpty(self):
        return len(self.Q) == 0

    def enqueue(self,x):
        self.Q.append(x)

    def dequeue(self):
        if self.isEmpty():
            sys.exit("Empty")
        else:
            return self.Q.pop(0)

N,q = map(int,input().split(" "))

process_list = []
for n in range(N):
    p,time = input().split(" ")
    process_list.append([p,int(time)])

Q = Queue()
for p in process_list:
    Q.enqueue(p)

elapsed_time = 0
while not Q.isEmpty():
    process = Q.dequeue()
    if process[1] > q:
        elapsed_time += q
        Q.enqueue([process[0],process[1]-q])
    else:
        elapsed_time += process[1]
        print(process[0]+" "+str(elapsed_time))


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

int main() {
  int N, D;
  cin >> N >> D;
  vector<vector<int>> X(N, vector<int>(D));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < D; j++) {
      cin >> X[i][j];
    }
  }
  int ans = 0;
  for (int i = 0; i-1 < N; i++) {
    for (int j = i+1; j < N; j++) {
      int d_2 = 0;
      for (int k = 0; k < D; k++) {
        d_2 += pow(X[i][k] - X[j][k], 2);
      }
      int d = sqrt(d_2);
      if (d_2 == d*d) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <numeric>
// #include <windows.h>
using namespace std;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = V<VV<T>>;
template<class T1, class T2> using P = pair<T1, T2>;
using I = int;
using D = double;
using B = bool;
using C = char;
using S = string;
using LL = long long;
using LD = long double;
using ULL = unsigned long long;
using PII = P<I, I>;
using VPII = V<PII>;
using PLL = P<LL, LL>;
using VPLL = V<PLL>;
using VI = V<I>;
using VVI = VV<I>;
using VLL = V<LL>;
using VVLL = VV<LL>;
using VC = V<C>;
using VVC = VV<C>;
using VS = V<S>;
using VVS = VV<S>;
using VB = V<B>;
using VVB = VV<B>;
#define REP(type, i, n) for (type i = 0; i < (type)(n); ++i)
#define REP2(type, i, m, n) for (type i = (m); i < (type)(n); ++i)
#define REPR(type, i, n) for (type i = (n)-1; i >= 0; --i)
#define REPR2(type, i, m, n) for (type i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a, type) sort(ALL(a), G<type>())
#define REVERSE(a) reverse(ALL(a))
#define SIZE(a, type) ((type)(a).size())
#define bit_search(bit, n) REP(LL, bit, 1LL<<(n))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REPx(&x, a) cin >> x;
#define INPUTP(a) REPx(&x, a) cin >> x.first >> x.second;
#define OUTPUT_PERMUTATION(n) do{VI v(n); iota(ALL(v), 1); do{REPx(x, v) cout << x << " "; ENDL} while(next_permutation(ALL(v)));} while(0);
#define MAKE_PERMUTATION(n, PER) do{VVI a(fact(n), VI(n)); int idx = 0; VI v(n); iota(ALL(v), 1); do{REP(roop, n) a[idx][roop] = v[roop]; idx++;} while(next_permutation(ALL(v))); PER = a;} while(0); // int fact(), VVI PERを宣言しておく、n=10が限界(500 ms)
#define ENDL cout << endl;

const int INF = 2e9;
const LL MOD = 1e9 + 7;

template<class T> using PRIORITY_QUEUE = priority_queue< T, V<T>, greater<T> >;
template<class T> inline bool chmin(T &a, T b){if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){if (a < b) {a = b; return true;} return false;}
template<class T> inline void debug1(V<T> A){REP(int, i, SIZE(A, int)){if (A[i] == INF) cout << "I ";else cout << A[i] << " ";}ENDL}
template<class T> inline void debug2(VV<T> A){REP(int, i, SIZE(A, int)){REP(int, j, SIZE(A[i], int)){if (A[i][j] == INF) cout << "I "; else cout << A[i][j] << " ";}ENDL}}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  if (n % 1000) cout << 1000 - (n % 1000) << endl;
  else cout << 0 << endl;

  return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define ll long long
#define N 100005
#define M 1000000007
#define pii pair<ll,ll>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
main()
{
    int n;
    cin>>n;
    double pi=acos(-1.0);
    cout<<setprecision(10)<< 2*pi*n;
 
}

Measured memory_bytes: 3776
import math
n, a, b = map(int, input().split())
h_list = [int(input()) for _ in range(n)]

lb = 0
ub = 10**9 # これだけ唱えれば確実に全滅する

def is_ok(m):
    # m回の攻撃でモンスターが全滅するか
    tmp_ans = 0
    for h in h_list:
        tmp_h = max(h-m*b, 0) # モンスターの残り体力
        tmp_ans += math.ceil(tmp_h/(a-b)) # 爆発の中心になる回数
    if tmp_ans <= m:
        return True
    else:
        return False


ng = lb
ok = ub + 1
while ok - ng > 1:
    m = (ok + ng) // 2
    if is_ok(m):
        ok = m
    else:
        ng = m

print(ok)


Measured memory_bytes: 12948
import java.util.*;

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

    int n = sc.nextInt();
    long x = sc.nextInt();
    int d = 0;
    int ans = 1;

    for(int i = 0; i < n; i++){
      int l = sc.nextInt();
      if(d + l <= x){
        d += l;
        ans += 1;
      } else {
        break;
      }
    }

    System.out.println(ans);
  }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N, K;
  string S;
  cin >> N >> K;
  cin >> S;
  if(S.at(K-1)=='A')
    S.at(K-1)='a';
  else if(S.at(K-1)=='B')
    S.at(K-1)='b';
  else
    S.at(K-1)='c';
  cout << S << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <unordered_map>
#include <map>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 1e9 + 7;
using namespace std;
using P = pair<long, long>;
using VI = vector<long>;

int main() {
    long a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max(a * b, c * d) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<int> a(N);
    for(int i=0; i<N; i++){
        cin >> a.at(i);
    }
    int judge=0;
    int start=0;
    for(int i=0; i<N; i++){
        if(a.at(i)==1){
            start=i;
            judge=1;
            break;
        }
    }
    int next=2;
    int block_count=1;
    for(int i=start+1; i<N; i++){
        if(a.at(i)==next){
            block_count++;
            next++;
        }
    }
    if(judge==0){
        cout << -1 << endl;
    }
    else if (judge==1){
        cout << N-block_count << endl;
    }
}

Measured memory_bytes: 1024
use proconio::{fastout, input};
use std::collections::HashSet;

#[fastout]
fn main() {
    input! {
        n: usize,
        x: usize,
        m: usize,
    }

    let mut set = HashSet::new();
    let mut seq = vec![];

    let mut prev = x;
    set.insert(prev);
    seq.push(prev);
    let mut last = None;
for _ in 1..n {
        let val = prev * prev % m;

        if set.contains(&val) {
            last = Some(val);
            break;
        }
        set.insert(val);
        seq.push(val);
        prev = val;
    }

    let cycle = if let Some(last) = last {
        let mut index = seq.len();
        for (i, &e) in seq.iter().enumerate() {
            if e == last {
                index = i;
                break;
            }
        };
        seq.split_off(index)
    } else {
        vec![]
    };

    let mut ans = seq.iter().sum::<usize>();
    if cycle.len() != 0 {
        let n = n - seq.len();
        let quo = n / cycle.len();
        let rem = n % cycle.len();
        ans += cycle.iter().take(rem).sum::<usize>();
        let sum_seq = cycle.iter().sum::<usize>();
        ans += sum_seq * quo;
    }

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


Measured memory_bytes: 3592
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>

using namespace std;

#define INF 1000000007
int n;
int a[100000];
vector<int> dp(100001);

int main(){
  cin >> n;
  for(int i = 0; i < n ; i++){
    cin >> a[i];
  }
  // memset(dp, 1000000007, sizeof(dp));
  for(int i = 0; i < dp.size() ; i++){
    dp[i] = INF;
  }
  dp[0] = -1;
  for(int i = 0; i < n; i++){
//    cout<< i << endl;
    auto it = lower_bound(dp.begin(), dp.end(), a[i]);
    dp[distance(dp.begin(), it)] = a[i];
    // cout << distance(dp.begin(), it) << endl;
  }
  int t = 0;
//  cout << "ended" << endl;
  for(int i = 0; i <= n ; i++){
    // cout << dp[i] << endl;
    if(dp[i] != INF) t = i;
  }
  cout << t << endl;
}



Measured memory_bytes: 3628
import java.util.*;
import java.math.BigDecimal;

class Main {
  public static void main (String[] args) {
    Scanner scanner = new Scanner(System.in);
    String out = "";
    while (scanner.hasNext()) {
      double a = scanner.nextDouble();
      double b = scanner.nextDouble();
      double c = scanner.nextDouble();
      double d = scanner.nextDouble();
      double e = scanner.nextDouble();
      double f = scanner.nextDouble();
      double x, y;
      x = (b * f - e * c) / (b * d - e * a);
      y = (c - a * x) / b;
      BigDecimal xbd = new BigDecimal(x);
      BigDecimal ybd = new BigDecimal(y);
      xbd = xbd.setScale(4, BigDecimal.ROUND_HALF_UP);
      ybd = ybd.setScale(4, BigDecimal.ROUND_HALF_UP);

      out += String.format("%.3f", xbd.doubleValue()) + " " + String.format("%.3f", ybd.doubleValue()) + "\n";
    }
    System.out.print(out);
  }
}

Measured memory_bytes: 20584
#include<bits/stdc++.h>
#define rep(i,a,b) for(register int i=a;i<=b;++i)
#define rpd(i,a,b) for(register int i=a;i>=b;--i)
#define rep1(i,x) for(register int i=head[x];i;i=nxt[i])
typedef long long ll;
const int N=1e4+5;
const int INF=1e9;
using namespace std;
inline int read(){
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
    while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int n,m;int c[N];
int main(){
	n=read();m=read();
	rep(i,0,(1<<n)-1)c[i]=INF;
	rep(i,1,m){
		int now=read(),x=0,k=read();
		rep(j,1,k)x+=1<<read()-1;
		c[x]=min(c[x],now);
	}
	rep(i,1,(1<<n)-1)rep(j,1,i)c[i|j]=min(c[i|j],c[i]+c[j]);
	if(c[(1<<n)-1]==INF)return puts("-1"),0;
	return printf("%d\n",c[(1<<n)-1]),0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int x;
	int y;
	int r;
	int W;
	int H;
	int right;
	int left;
	int up;
	int down;

	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

	right = W - x - r;
	left = x-r;
	up = H - y - r;
	down = y-r;

	if ((right < 0) || (left < 0) || (up < 0) || (down < 0)) {
		printf("No\n");
	}
	else {
		printf("Yes\n");
	}

	
	return 0;
	}

Measured memory_bytes: 584
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

namespace AtCoderABC122
{
    class Program
    {
        public static void Main(string[] args)
        {
            string S = Console.ReadLine();
            int res = 0;
            int temp = 0;
            for (int i = 0; i < S.Length; i++)
            {
                if (S[i] == 'A' || S[i] == 'T' || S[i] == 'G' || S[i] == 'C')
                {
                    temp++;
                }
                else
                {
                    res = (res < temp) ? temp: res;
                    temp = 0;
                }
            }
            res = (res < temp) ? temp: res;
            Console.WriteLine(res);
        }
    }
}

Measured memory_bytes: 11092
N,A,B = map(int,input().split())
S = input()

total = 0
b = 0
answer = []

for s in S:
  bl = False
  if s == 'a':
    if total < A+B:
      bl = True
      total += 1
  elif s == 'b':
    if total < A+B and b < B:
      bl = True
      total += 1
      b += 1
  answer.append('Yes' if bl else 'No')
  
print(*answer, sep='\n')

Measured memory_bytes: 6344
package main

import (
    "bufio"
    "fmt"
    "os"
    "strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
    sc.Scan()
    i, e := strconv.Atoi(sc.Text())
    if e != nil {
        panic(e)
    }
    return i
}

func main() {
    sc.Split(bufio.ScanWords)
    a := nextInt()
    b := nextInt()
    c := nextInt()
    if a < b && b < c {
      fmt.Println("Yes")
    } else {
      fmt.Println("No")
    }
}


Measured memory_bytes: 1092
#include <iostream>

class RDBCards {
public:
    bool printCards(int a, int b, int c) {
        int result = a * 100 + b * 10 + c * 1;
        if ((result % 4) == 0) {
            return true;
        } else {
            return false;
        }
    }
};

int main(int argc, char** argv) {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    RDBCards r0;
    if (r0.printCards(a, b, c)) {
        std::cout << "YES" << std::endl;
    } else {
        std::cout << "NO" << std::endl;
    }
}


Measured memory_bytes: 256
lines = $stdin.read.split("\n")
N,M,Q=lines.first.split(" ").map(&:to_i)
$rest = lines[1..].map{|line| line.split(" ").map(&:to_i)}

def score(line)
  s = 0
  $rest.each do |a,b,c,d|
    if line[b-1] - line[a-1] == c
      s += d
    end
  end
  s
end

result = 0
list = (1..M).to_a.repeated_combination(N)
list.each do |l|
  l = l.sort
  result = [result, score(l)].max
end

puts result

Measured memory_bytes: 14636
from sys import stdin

rInt       = lambda : int(stdin.readline().strip("\n"))
rIntArray  = lambda : [int(x) for x in stdin.readline().split()]

rString    = lambda : stdin.readline().strip("\n")
rStrArray  = lambda : [x for x in stdin.readline().split()]

# for _ in range(rInt()):

n = rInt()
arr = rIntArray()

flag = False

for i in arr:
	if i == 0:
		flag = True

prod = 1
for i in arr:
	prod *= i
	if prod > 10**18:
		print("0" if flag else "-1")
		quit()

print(prod)


Measured memory_bytes: 88080
#include <iostream>
#include <string>
#include <vector>
#include <bitset>
#include <math.h>

#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;

int main(void) {
	int ans[10050];
	for (int i = 0; i < 10050; i++) {
		ans[i] = 0;
	}
	int max = 101;
	for (int x = 1; x < max; x++) {
		for (int y = 1; y < max; y++) {
			for (int z = 1; z < max; z++) {
				int test = x * x + y * y + z * z + x * y + y * z + z * x;
				if (test < 10050) ans[test]++;
			}
		}
	}
	int N;
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 3120
n, m ,c = map(int, input().split())
b = list(map(int, input().split()))
a = []
for i in range(n):
    a_next = list(map(int, input().split()))
    a.append(a_next)

ans = 0
sum = 0

for i in range(n):
    sum = 0
    for x, y in zip(a[i], b):
        sum += x*y
    if sum + c > 0:
        ans +=1
print(ans)

Measured memory_bytes: 3064
import java.util.*;

class Main {
	public static void main(String args[]){
		
		Scanner sc = new Scanner(System.in);
		
		while(true){
		
		    //整数nとxを受け取る
		    String s1 = sc.next();
		    int n = Integer.parseInt(s1);
		    String s2 = sc.next();
	        int x = Integer.parseInt(s2);
	        if(n == 0 && x == 0){
	        	break;
	        }
		
	        int count = 0;
		
	        for(int i = 1; i <= n; i++){
		        for(int j = i+1; j <= n; j++){
			        for(int k = j+1; k <= n; k++){
				        if(i + j + k == x){
					        count++;
				        }
			        }
		        }
	        }
	        System.out.println(count);
		}
	}
}

Measured memory_bytes: 18796
/* Author - thiolhub */

#include <bits/stdc++.h>

using namespace std;

#define ll              long long int
#define ld              long double
#define db              double
#define pi              3.1415926535897932384626
#define PI              acos(-1.0)
#define endl            "\n"
#define mod             1000000007
#define mk              make_pair
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(t)            ll t; cin>>t; while(t--)
#define sc(a)	        scanf("%lld",&a);
#define pr(a)	        printf("%lld\n",a)
#define f(i,a,n)		for(ll i=a;i<n;i++)
#define m(a)		    memset(a,0,sizeof(a))
#define FastIO          ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)



int main(){ FastIO;

int n,i,j,k;cin>>n;
string s;cin>>s;
ll r=0,g=0,b=0,res=0;
for(i=0;i<n;i++)
{
	if(s[i]=='R') r++;
	else if(s[i]=='G') g++;
	else b++;
}
res=r*g*b;
for(i=0;i<n;i++)
{
	for(j=i+1;j<n;j++)
	{
		k=2*j-i;
		if(s[i]!=s[j] && k<n && s[i]!=s[k] && s[j]!=s[k]) res--;
	}
}
cout<<res;


return 0;
}

Measured memory_bytes: 3648
#include<cstdio>
#include<iostream>
#include<vector>
using namespace std;
const int N=1e5+10;
int n,A,B,f[N],dp[N],son[N],num[N],ex[N],mod;
vector<int>pre[N];vector<int>suf[N];vector<int>ed[N<<1];
inline void addedge(int x,int y){ed[x].push_back(y);ed[y].push_back(x);}
inline int MOD(int x,int y){x+=y;x-=x>=mod? mod:0;return x;}
inline void DFS1(int u,int fa){
	f[u]=1;son[u]=0;
	for(register int i=0;i<ed[u].size();i++){
		int v=ed[u][i];if(v==fa)continue;DFS1(v,u);
		num[v]=son[u];son[u]++;
		f[u]=1ll*f[u]*(f[v]+1)%mod;
		pre[u].push_back(f[u]);
	}
}
inline void DFS2(int u,int fa){
	f[u]=1;
	for(register int i=ed[u].size()-1;i>=0;i--){
		int v=ed[u][i];if(v==fa)continue;DFS2(v,u);
		f[u]=1ll*f[u]*(f[v]+1)%mod;
		suf[u].push_back(f[u]);
	}
}
inline void Solve(int u,int fa){
	for(register int i=0;i<ed[u].size();i++){
		int v=ed[u][i];if(v==fa)continue;
		int w1=num[v]-1>=0? pre[u][num[v]-1]:1;
		int w2=son[u]-num[v]-2>=0? suf[u][son[u]-num[v]-2]:1;
		int w=MOD(1ll*w1*w2%mod*ex[u]%mod,1);ex[v]=w;
		dp[v]=1ll*f[v]*ex[v]%mod;
		Solve(v,u);
	}
}
int main(){
	scanf("%d%d",&n,&mod);
	for(register int i=1;i<n;i++)
		scanf("%d%d",&A,&B),addedge(A,B);
	DFS1(1,0);DFS2(1,0);dp[1]=f[1];ex[1]=1;
	Solve(1,0);
	for(register int i=1;i<=n;i++)printf("%d\n",dp[i]);
	return 0;
}

Measured memory_bytes: 24448
#include<stdio.h>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<string>
using namespace std;
char str[16];
map<string,int> m;
vector<pair<int,int> >g[100000];
vector<pair<int,int> >ijk[50000];
pair<int,int> IJK[100000];
vector<int> num[50000];
vector<int> dist[50000];
vector<int> vis[50000];
int VIS[100000];
struct wolf{
	int cost;
	int chg;
	int L;
	int Y;
	wolf(){}
	wolf(int a,int b,int c,int d){
		cost=a;
		chg=b;
		L=c;
		Y=d;
	}
};
inline bool operator<(const wolf&a,const wolf&b){
	if(a.cost!=b.cost)return a.cost>b.cost;
	return a.chg>b.chg;
}
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	int v=0;
	scanf("%s",str);
	string S=str;
	scanf("%s",str);
	string T=str;
	m[S]=v++;
	m[T]=v++;
	for(int i=0;i<a;i++){
		int c;
		scanf("%d",&c);
		for(int j=0;j<c;j++){
			scanf("%s",str);
			string STR=str;
			if(m.count(STR)==0)m[STR]=v++;
			ijk[i].push_back(make_pair(999999999,999999999));
			num[i].push_back(m[STR]);
			vis[i].push_back(0);
			g[m[STR]].push_back(make_pair(i,j));
		}
		for(int j=0;j<c-1;j++){
			int d;
			scanf("%d",&d);
			dist[i].push_back(d);
		}
	}
	for(int i=0;i<v;i++)IJK[i]=make_pair(999999999,999999999);
	priority_queue<wolf> Q;
	Q.push(wolf(0,0,-1,m[S]));
	IJK[m[S]]=make_pair(0,0);
	while(Q.size()){
		wolf at=Q.top();
		Q.pop();
		if(at.L==-1){
			if(VIS[at.Y])continue;
			VIS[at.Y]=1;
		}else{
			if(vis[at.L][at.Y])continue;
			vis[at.L][at.Y]=1;
		}
		if(at.L==-1){
			for(int i=0;i<g[at.Y].size();i++){
				int I=g[at.Y][i].first;
				int J=g[at.Y][i].second;
				if(!vis[I][J]&&ijk[I][J]>IJK[at.Y]){
					ijk[I][J]=IJK[at.Y];
					Q.push(wolf(at.cost,at.chg,I,J));
				}
			}
		}else{
			int N=num[at.L][at.Y];
			if(!VIS[N]&&IJK[N]>make_pair(at.cost+b,at.chg+1)){
				IJK[N]=make_pair(at.cost+b,at.chg+1);
				Q.push(wolf(IJK[N].first,IJK[N].second,-1,N));
			}
			if(at.Y&&!vis[at.L][at.Y-1]&&ijk[at.L][at.Y-1]>make_pair(at.cost+dist[at.L][at.Y-1],at.chg)){
				ijk[at.L][at.Y-1]=make_pair(at.cost+dist[at.L][at.Y-1],at.chg);
				Q.push(wolf(at.cost+dist[at.L][at.Y-1],at.chg,at.L,at.Y-1));
			}
			if(at.Y<dist[at.L].size()&&!vis[at.L][at.Y+1]&&ijk[at.L][at.Y+1]>make_pair(at.cost+dist[at.L][at.Y],at.chg)){
				ijk[at.L][at.Y+1]=make_pair(at.cost+dist[at.L][at.Y],at.chg);
				Q.push(wolf(at.cost+dist[at.L][at.Y],at.chg,at.L,at.Y+1));
			}
		}
	}
	if(IJK[m[T]].first==999999999)printf("-1\n");
	else printf("%d %d\n",IJK[m[T]].first-b,IJK[m[T]].second-1);
}

Measured memory_bytes: 23396
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <map>
#include <string>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <algorithm> 

#define MaxN 55

using namespace std;

int N,M,fr[MaxN],X,Y;

int main()
{
	cin>>N>>M;
	for(int i=1;i<=M;i++)
		cin>>X>>Y,fr[X]++,fr[Y]++;
	for(int i=1;i<=N;i++)
		cout<<fr[i]<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main (void) {
        int a, b;
        int c;
        int digit;

        while (scanf ("%d %d", &a, &b)==2) {
                c = a + b;
                digit = 0;

                while (c>=1) {
                        c = c / 10;
                        digit++;
                }
                printf ("%d\n", digit);

        }
        return (0);
}

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

int main()
{
    int n, hi, h_max = 0, ans = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> hi;
        if(hi >= h_max){
            h_max = hi;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int dp[50];

int fib(int n){
  if(n==0||n==1)return dp[n]=1;
  if(dp[n]!=-1)return dp[n];
  return dp[n]=fib(n-1)+fib(n-2);
}

int main(){
  int n,i;
  for(i=0;i<50;i++)dp[i]=-1;
  
  scanf("%d",&n);
  printf("%d\n",fib(n));
  
  return 0;
}



Measured memory_bytes: 2104
#include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    typedef vector<ll> vi;
    #define MOD 1000000007
     
    #define fastio  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int main(){
        fastio;
        ll h, a;
        cin>>h>>a;
        ll sum=h, s=0;
        vi V(a); for(ll i=0;i<a;i++){ cin>>V[i]; s+=V[i];}
      	sum-=s;
        if(sum>0) 
          cout<<sum<<endl;
        else if(sum==0)cout<<0<<endl; 
      	else if(sum<0)cout<<-1<<endl;

    return 0;
    }

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

typedef long long ll;
const ll INF=2e18;
const int MAXN=55;

ll m[MAXN],p[MAXN],w[MAXN],n,x,d;
// m->v w->w p->fa
ll V[MAXN*100],W[MAXN*100],f[MAXN*MAXN*MAXN];

struct data{
	ll v,w,num;
}da[MAXN];

bool cmp(data a,data b){
	return (1.0*a.w/a.v)>(1.0*b.w/b.v);
}

int cnt=0;ll maxval=0;
void split(){
	int limit,zuoyi=0;
	for(int i=1;i<=n;i++){
		zuoyi=0;
		if(i==1){
			limit=n;
			da[i].v=m[i],da[i].w=w[i],da[i].num=INF;	
		}
		else {
			limit=min(1ll*n,d);
			da[i].v=m[i],da[i].w=w[i],da[i].num=d-limit;
		}
		while(limit){
			int p=1<<zuoyi;
			if(limit>=p){
				limit-=p;if(p*m[i]>x)break;
				V[++cnt]=p*m[i];W[cnt]=p*w[i];
				maxval+=W[cnt];
			}
			else {
				p=limit;limit=0;if(p*m[i]>x)break;
				V[++cnt]=p*m[i];W[cnt]=p*w[i];
				maxval+=W[cnt];
			}
			zuoyi++;
		}
	}
}

ll solve(ll price,ll volume){
	ll ReMain=x-volume,ans=price;
	for(int i=1;i<=n;i++){
		ll picked=min(da[i].num,ReMain/da[i].v);
		ans+=picked*da[i].w;
		ReMain-=picked*da[i].v;
	}	
	return ans;
}

int main(){
	scanf("%lld%lld%lld",&n,&x,&d);
	for(int i=1;i<=n;i++){
		ll tmp;
		scanf("%lld",&tmp);
		m[i]+=tmp; 
		if(i>1)scanf("%lld",&p[i]);
		w[i]=1;
	}
	for(int i=n;i>=1;i--)w[p[i]]+=w[i],m[p[i]]+=m[i];
	split();
//	for(int i=1;i<=n;i++)cout<<m[i]<<" "<<w[i]<<endl;
//	puts("");
	//for(int i=1;i<=cnt;i++)cout<<V[i]<<" "<<W[i]<<endl;
	for(int i=0;i<=n*n*n;i++)f[i]=INF;
	f[0]=0;
	for(int i=1;i<=cnt;i++){
		for(int j=n*n*n;j>=W[i];j--){
			f[j]=min(f[j],f[j-W[i]]+V[i]);
		}
	}
//	for(int i=0;i<=n*n*n;i++)cout<<i<<":"<<f[i]<<endl;
	ll ans=0;
	sort(da+1,da+1+n,cmp);
//	for(int i=1;i<=n;i++)cout<<da[i].v<<" ";puts("");
	for(int i=0;i<=n*n*n;i++){
		if(f[i]<=x){
			ans=max(ans,solve(i,f[i]));
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
int main() {
    int n;
    ll k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<int> s;
    vector<int> ord(n+1,-1);
    int c = 1, l = 0;
    {
        int v = 1;
        while (ord[v] == -1) {
            ord[v] = s.size();
            s.push_back(v);
            v = a[v-1];
        }
        c = s.size() - ord[v];
        l = ord[v];
    }
 
    if (k < l) cout << s[k] << endl;
    else {
        k -= l;
        k %= c;
        cout << s[l+k] << endl;
    }
    return 0;
}

Measured memory_bytes: 5880
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int, L: "List[int]"):
    L.sort()
    print(sum([L[i] for i in range(2*N) if i%2 == 0]))
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    L = [int(next(tokens)) for _ in range(2 * N)]  # type: "List[int]"
    solve(N, L)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto abc = readln.split.to!(long[]);
    auto a = abc[0];
    auto b = abc[1];
    auto c = abc[2];

    if (c-a-b > 0 && 4*a*b < (c-a-b)^^2L) {
        writeln("Yes");
    } else {
        writeln("No");
    }
}

Measured memory_bytes: 256
# Trick or Treat

N, K = map(int, input().split())
count = [0] * N
for _ in range(K):
    d = int(input())
    treat = list(map(int, input().split()))
    for val in treat:
        count[val-1] += 1

ans = 0
for i in range(N):
    if count[i] == 0:
        ans += 1

print(ans)



Measured memory_bytes: 9156
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;

const int maxn=500111;

#define ls (t<<1)
#define rs ((t<<1)|1)

int p[maxn],q[maxn];
namespace sgt
{
	int mx[1100111];
	void modify(int p,int v,int tl,int tr,int t)
	{
		if(tl==tr)
		{
			mx[t]=v;
			return;
		}
		int mid=(tl+tr)>>1;
		if(p<=mid)modify(p,v,tl,mid,ls);
		else modify(p,v,mid+1,tr,rs);
		mx[t]=max(mx[ls],mx[rs]);
	}
	int query(int l,int r,int tl,int tr,int t)
	{
		if(l<=tl&&tr<=r)return mx[t];
		int mid=(tl+tr)>>1,ret=0;
		if(l<=mid)ret=max(ret,query(l,r,tl,mid,ls));
		if(r>mid)ret=max(ret,query(l,r,mid+1,tr,rs));
		return ret;
	}
}

int n,k,ans[maxn];
bool inq[maxn];

int test(int v)
{
	int val=sgt::query(max(1,v-k+1),min(n,v+k-1),1,n,1);
	if(val==p[v])return true;
	else return false;
}

int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",p+i);
		q[p[i]]=i;
	}
	if(k==1)
	{
		for(int i=1;i<=n;i++)printf("%d\n",i);
		return 0;
	}
	
	priority_queue<int> pq;
	for(int i=1;i<=n;i++)sgt::modify(i,p[i],1,n,1);
	
	for(int i=1;i<=n;i++)if(test(i))
	{
		pq.push(i);
		inq[i]=1;
	}
	
	for(int i=n;i>=1;i--)
	{
		int v=pq.top();pq.pop();
		ans[v]=i;sgt::modify(v,0,1,n,1);
		int mx=q[sgt::query(max(1,v-k+1),v,1,n,1)];
		if(mx&&!inq[mx]&&test(mx))
		{
			inq[mx]=1;
			pq.push(mx);
		}
		mx=q[sgt::query(v,min(n,v+k-1),1,n,1)];
		if(mx&&!inq[mx]&&test(mx))
		{
			inq[mx]=1;
			pq.push(mx);
		}
	}
	
	for(int i=1;i<=n;i++)printf("%d\n",ans[i]);
	return 0;
}

Measured memory_bytes: 14964
#include <iostream>
#include <string>
#include <vector>
using namespace std;


int main() {
	string s;
	cin >> s;
	long long ans = 0;
	int mx = 1;
	for (int i = 1; i < s.size(); i++) {
		mx <<= 1;
	}
	for (int i = 0; i < mx; i++) {
		long long tmp = 0;
		for (int j = 0; j < s.size(); j++) {
			tmp = 10 * tmp + s[j] - '0';
			if ((i >> j) & 1) {
				ans += tmp;
				tmp = 0;
			}
		}
		ans += tmp;
	}
	cout << ans << endl;
	
	
}

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

int main()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	int q;
	cin >> q;
	int alphaNum = 'z' - 'a' + 1;
	vector<set<int>> vs(alphaNum);
	for(int i = 0; i < n; ++i){
		vs[s[i] - 'a'].insert(i);
	}

	vector<int> retv;
	for (int i = 0; i < q; ++i)
	{
		int type;
		cin >> type;
		if (type == 1)
		{
			int pos;
			char c;
			cin >> pos >> c;
			vs[s[pos - 1] - 'a'].erase(pos - 1);
			s[pos - 1] = c;
			vs[c - 'a'].insert(pos - 1);
		}
		else
		{
			int l, r;
			cin >> l >> r;
			l--;
			r--;
			int ret = 0;
			for (auto& j : vs) {
				auto itr = j.lower_bound(l);
				if (itr != j.end() && (*itr) <= r) {
					++ret;
				}
			}
			retv.push_back(ret);
		}
	}

	for (auto& r : retv) {
		cout << r << endl;
	}

	return 0;
}

Measured memory_bytes: 24452
/*
	Created by : imay_10
	" It won't be EASY, but I'll make it "
*/

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

typedef long long int ll;
const int mod = 1e9+7;
const ll inf = 1e18;
const double pi = 3.1415926535897932384626;

// Utility for fast exponentiation
ll mpow(ll a,ll b,ll m){
    ll res=1;
    //a%=m;
    while(b){
    	if(b%2) res=res*a%m;
		a=a*a%m;
		b/=2;
	}
	return res;
}

// Utility for GCD Calculation
ll gcd(ll a,ll b){
	if(b==0) return a;
	return gcd(b,a%b);
}

void solve(){
	//code
	int n,count=0;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
		cin>>a[i];
		
	for(int i=1;i<n-1;i++)
		if((a[i]>a[i-1] and a[i]<a[i+1]) or (a[i]<a[i-1] and a[i]>a[i+1]))
			count++;
			
	cout<<count;
}

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


Measured memory_bytes: 3660
N = int(input())
A, B = map(int, input().split())
P = [int(i) for i in input().split()]

cnt1 = 0
cnt2 = 0
cnt3 = 0

for p in P:
    if p <= A:
        cnt1 += 1
    elif p <= B:
        cnt2 += 1
    else:
        cnt3 += 1

print(min(cnt1, cnt2, cnt3))


Measured memory_bytes: 3060
def Judge(i,A):
    if i<0.2:A[3]+=1
    elif i<0.6:A[2]+=1
    elif i<1.1:A[1]+=1
    else:A[0]+=1

L,R=[0]*4,[0]*4
while True:
    try:
        l,r=map(float,raw_input().split())
    except EOFError:
        break
    Judge(l,L)
    Judge(r,R)
for i in range(4):
    print L[i],R[i]

Measured memory_bytes: 4256
#include <bits/stdc++.h>
using namespace std;
#define __ <<" "<<
#define ___ <<" "
#define bash push_back
#define ALL(x) x.begin(),x.end()
//#define int long long

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

typedef long long ll;
typedef pair < int , int >  pii;
static constexpr const signed int INF = 0x3f3f3f3f;
static constexpr const signed long long LINF = 0x3f3f3f3f3f3f3f3fLL;
static constexpr const signed int SMOD = 1000000007;
static constexpr const signed int NMOD = 998244353;
static constexpr const signed int dx[]={1,0,-1,0,1,1,-1,-1};
static constexpr const signed int dy[]={0,-1,0,1,-1,1,-1,1};

inline bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>bool chmax(T &a, const T &b){return(a=max(a,b))==b;}
template<class T>bool chmin(T &a, const T &b){return(a=min(a,b))==b;}
inline int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}



signed main() {

    int a, b;
    cin >> a >> b ;
    if(a+b==3) cout << 3 << endl;
    else if(a+b == 4) cout << 2 << endl;
    else cout << 1 << endl;


  
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=a;i--)
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
#define de(x) cout << #x << "=" << x << endl
#define dd(x) cout << #x << "=" << x << " "
#define pw(x) (1ll<<(x))
#define pq priority_queue
#define endl "\n"
int main()
{
    ios::sync_with_stdio(false);
   	ll a,b;
	cin >>a >> b;
	cout << a*b <<endl; 
    return 0;
}


Measured memory_bytes: 3640
#include<iostream>
#include<vector>
#include<string>
#include<climits>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<queue>


int main(){
	int n, k;
	std::cin>>n>>k;

	if(k==1)
		std::cout<<0<<std::endl;
	else
		std::cout<<n-k<<std::endl;

	return 0;
	
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cstring>
#include <sstream>
#include <vector>
#include <string>
#include <iomanip>
#include <bitset>
using namespace std;
#define INF	100000000
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define lb lower_bound
#define ub upper_bound
#define SS stringstream
#define rep(i,n) for(int i = 0; i < n; i++)
#define sz(x) ((int)(x).size())
#define SORT(x) sort((x).begin(), (x).end())
#define RSORT(x) sort((x).begin(), (x).end(), greater<int>() )
#define clr(a,b) memset((a),(b),sizeof(a))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<P> Vp;
typedef priority_queue<P, vector<P>, greater<P> > PQ;

int h,w;
char cell[110][110];
bool used[110][110];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	while(cin >> h >> w){
		if(h == 0 && w == 0) break;
		rep(i,110) rep(j,110) used[i][j] = 0;
		rep(i,h) rep(j,w) cin >> cell[i][j];
		P p; p.fi = 0; p.sec = 0;
		while(true){
			if(used[p.fi][p.sec]){
				cout << "LOOP" << endl;
				break;
			}
			used[p.fi][p.sec] = 1;
			if(cell[p.fi][p.sec] == '.'){
				cout << p.sec << " " << p.fi << endl;
				break;
			}
			else if(cell[p.fi][p.sec] == '^') p.fi--;
			else if(cell[p.fi][p.sec] == '<') p.sec--;
			else if(cell[p.fi][p.sec] == '>') p.sec++;
			else if(cell[p.fi][p.sec] == 'v') p.fi++;
		}
	}
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    int Asum = 0;
    for (int i = 0; i < N; i++){
        cin >> A.at(i);
        Asum += A.at(i);
    }
    int count = 0;
    for (int i = 0; i < N; i++){
        if (A.at(i) * 4 * M >= Asum){
            count ++;
        }
    }
    if (count >= M){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
#include<cstdio>
long long x[100005];
long long y[100005];
const long long mod = 1e9+7;
int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=0;i<n;i++){
        scanf("%lld",&x[i]);
    }
    for(int i=0;i<m;i++){
        scanf("%lld",&y[i]);
    }
    long long sumx = 0;
    for(int i=0, j=n-1;j>i;i++,j--){
        sumx = (sumx + (x[j]-x[i])*(j-i))%mod;
    }
    long long sumy = 0;
    for(int i=0, j=m-1;j>i;i++,j--){
        sumy = (sumy + (y[j]-y[i])*(j-i))%mod;
    }
    printf("%lld\n",(sumx*sumy)%mod);
    return 0;
}


Measured memory_bytes: 1664
#include <stdio.h>
#include <string.h>
 
int main(void)
{
    char *table[] = {
        "1100000011",
        "1000000010000000100000001",
        "1111",
        "1000000110000001",
        "11000000011",
        "100000001100000001",
        "110000011"
    };
    char map[1024];
    int i;
    int flag;

    flag = 0;
    while (!flag || ~getchar()) {
        flag = 1;
        for (i = 0; i < 8; i++){
            fgets(&map[i * 8], 16, stdin);
        }
        for (i = 0; strstr(map, table[i]) == NULL; ++i);
        i += 'A';
        puts(&i);
    }
 
    return (0);
}

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

int main(void){
	int n, t;
	cin >> n >> t;
	int a[n];
	for(int i=0; i<n; i++) cin >> a[i];
	int m = 0;
	int am = 0;
	int mi = a[0];
	for(int i=0; i<n; i++){
		mi = min(mi, a[i]);
		if(a[i]-mi > m){
			m = a[i]-mi;
			am = 1;
		} else if(a[i]-mi==m) am++;
	}
	cout << am << endl;
}

Measured memory_bytes: 4016
#include<stdio.h>
char n, i;
int s;
int v[20], c;
int main(void){
	scanf("%d", &n);
	for(i=0; i<n; i++){
		scanf("%d", v+i);
	}
	for(i=0; i<n; i++){
		scanf("%d", &c);
		if(v[i]>c){s+=v[i]-c;}
	}
	printf("%d\n", s);
}


Measured memory_bytes: 128