akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define endl        '\n'
#define mii         map<ll int,ll int>
#define msi         map<string,ll int>
#define mis         map<ll int, string>
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define repp(i,a,b)    for(ll int i=b-1;i>=a;i--)
#define tr(container,it) for(__typeof__(container.begin()) it = container.begin(); it != container.end(); it++)
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define mpi         map<pair<ll int,ll int>,ll int>
#define vii         vector<pair<ll,pair<ll,ll> > >
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        998244353
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
using namespace std;
#define N  300005
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";

vi ad[N];
ll an[N];
bool vis[N];
void init(){
	rep(i,0,N){
		vis[i]=false;
		an[i]=-1;
	}
}
void bfs(ll n){
	vis[n]=true;
	queue<ll> q;
	q.push(n);
	while(!q.empty()){
		ll x=q.front();
		q.pop();
		for(auto i:ad[x]){
			if(!vis[i]){
				vis[i]=true;
				q.push(i);
				an[i]=x;
			}
		}
	}
}

// class MemoryGame{
// public:
// // vs construct(int n){
void solve(){
	ll n,m;
	cin>>n>>m;
	rep(i,0,m){
		ll a,b;
		cin>>a>>b;
		ad[a].pb(b);
		ad[b].pb(a);
	}
	bfs(1);
	rep(i,2,n){
		if(an[i]==-1){
			cout<<"No";
			return;
		}
	}
	cout<<"Yes\n";
	rep(i,2,n+1) cout<<an[i]<<endl;
}
// };
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll TESTS=1,an=1;
    // cin>>TESTS;
    while(TESTS--){
        // cout<<"Case #"<<an<<": ";
        an++;
        solve();

    }
    return 0;
}           

Measured memory_bytes: 17784
#include <stdio.h>

int main(){
	long N, max = 0, ans = 0;
	long A[200000];

	scanf("%ld", &N);
	for(int i=0; i<N; i++)
		scanf("%ld", &A[i]);

	for(int i=1; i<N; i++){
		if(max < A[i-1])
			max = A[i-1];
		if(max > A[i]){
			ans += max - A[i];
			A[i] += max - A[i];
		}
	}
	printf("%ld", ans);
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << ": " << x << '\n'

typedef long long int ll;
typedef pair<int, int> P;

const long long INF = 3e18 + 12;
const int inf = 1e9;

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

  int a, b, c;
  cin >> a >> b >> c;

  if (a % (b + c) >= c) {
    cout << a / (b + c) << endl;
  } else {
    cout << a / (b + c) - 1 << endl;
  }

  return 0;
}

Measured memory_bytes: 256
A, B = map(int, input().split())

# A の約数
div1 = set()
for i in range(1, int(A ** 0.5) + 1):
    if A % i == 0:
        div1.add(i)
        if i != A // i:
            div1.add(A // i)
# B の約数
div2 = set()
for i in range(1, int(B ** 0.5) + 1):
    if B % i == 0:
        div2.add(i)
        if i != B // i:
            div2.add(B // i)

div = div1 & div2

cnt = 1
for d in list(div):
    if d == 1:
        continue
    flg = True
    for i in range(2, int(d ** 0.5) + 1):
        if d % i == 0:
            if i in (div-{d}):
                flg = False
                break
    if flg:
        cnt += 1

print(cnt)

Measured memory_bytes: 5268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
#define pb push_back
int main(void){
    ll n,q;
    cin>>n;
    vector<ll>ac(2e5);
    rep(0,i,(ll)2e5)ac[i]=0;
    ll sum=0;
    rep(0,i,n){
        ll na;
        cin>>na;
        ++ac[na];
        sum+=na;
    }
    cin>>q;
    rep(0,i,q){
        ll b,c;
        cin>>b>>c;
        sum+=(c-b)*ac[b];
        ac[c]+=ac[b];
        ac[b]=0;
        cout<<sum<<endl;
    }
}

Measured memory_bytes: 4792
#include<bits/stdc++.h>
using namespace std;
int main()
{
   long long x;
   cin>>x;
   long long bj=100;
   long long total=0;
   while(bj<x)
   {
   bj=bj*1.01*1.0;
   total++;
   }
   cout<<total;
}


Measured memory_bytes: 3636
A, B, K = map(int, input().split())

def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table

print(sorted(list(set(divisor(A)) & set(divisor(B))), reverse=True)[K-1])


Measured memory_bytes: 3060
def solve() -> '操作回数':
    m = int(input())

    digits = 0
    sum_ = 0
    for _ in range(m):
        d, c = map(int, input().split())
        digits += c
        sum_ += d * c

    return (digits - 1) + (sum_ - 1) // 9
    # 一回の操作で、
    # 繰り上がりが起こらないとき一桁減る
    # 繰り上がりが起こるとき合計値が9減る
    # 最終的に一桁の数値1～9が残るので、
    # 一桁になるまでの桁減らし回数と、9で割ったときにsum_が1以上残るような割り算の回数を返せばよい


print(solve())


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

int main() 
{
	long long n,k,q; cin>>n>>k>>q;
	long long a[q];
	vector<int>fr(100001,0);
for(int i=0;i<q;i++)
{
		cin>>a[i];
		fr[a[i]-1]++;
}
int dec=0;
	for(int i=0;i<fr.size();i++)
	{
		dec+=fr[i];
	}
	int res;
	vector<string>r;
	for(int i=0;i<n;i++)
	{
		res=k-dec+fr[i];
		if(res>0){r.push_back("Yes");}
		else{r.push_back("No");}
	}
	for(auto x: r)
	{
		cout<<x<<endl;
	}
}

Measured memory_bytes: 7284
#include<iostream>
#include<stdlib.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int ar[n+2];
    long long sum=0;
    ar[0]=0;
    ar[n+1]=0;
    for(int i=1;i<=n;i++)
    {
        cin>>ar[i];
        sum+=abs(ar[i]-ar[i-1]);
    }
    sum+=abs(0-ar[n]);
    //cout<<sum<<endl;
    long long res=0;
    long long res1=0;
    long long tem=sum;
    for(int j=1;j<=n;j++)
    {
        sum=tem;
        res+=abs(ar[j]-ar[j-1])+abs(ar[j+1]-ar[j]);
        //cout<<"abs(ar[j]-ar[j-1])="<<abs(ar[j]-ar[j-1])<<"   abs(ar[j+1]-ar[j])="<<abs(ar[j+1]-ar[j])<<endl;
        res1+=abs(ar[j+1]-ar[j-1]);
        //cout<<"res="<<res<<" res1="<<res1<<endl;
        sum-=res;
        sum+=res1;

        cout<<sum<<endl;
        sum=0;
        res=0;
        res1=0;
    }



    return 0;
}


Measured memory_bytes: 1664
S = gets.chomp.split('')
def split_sum ary, sum=0
    return sum if ary.empty?
    ret = 0
    1.upto(ary.size) do |i|
        ret += split_sum(ary[i..-1], ary[0..i-1].join.to_i + sum)
    end
    return ret
end
puts split_sum S

Measured memory_bytes: 1916
#include<bits/stdc++.h>
#include <iomanip>
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll INF = 1LL << 30;

int main(void){
    int N; cin >> N;
    vector<int> B(N); for(int i = 0; i < N-1; i++) cin >> B[i];
    
    ll ans = 0;
    vector<ll> A(N,0);
    A[0] = B[0];
    B[N-1] = B[N-2];
    ans = A[0];
    for(int i = 1; i < N; i++){
        // cout << B[i] << " " << B[i-1]  << endl;
        A[i] = min(B[i-1], B[i]);
        // cout << A[i] << endl;
        ans += A[i];
    }
    cout << ans << endl;
}


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

constexpr ll MOD = 1e9 + 7;

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

	vector<ll> p(n + 1, 0);
	for (int i = 0; i < n; ++i) {
		ll a;
		cin >> a;

		p[i + 1] = a + p[i];
	}

	ll s = 0;
	for (int i = 1; i < n; ++i) {
		ll a = (p[i] - p[i - 1]) % MOD;
		ll b = (p[n] - p[i]) % MOD;
		ll c = (a * b) % MOD;
		s = (s + c) % MOD;
	}

	cout << s;
	
	return 0;
}


Measured memory_bytes: 4840
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <math.h>

using namespace std;

typedef long long int ll;
typedef long double ld;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define vsort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())

const int MOD = 1000000007;
const int INF = INT_MAX;



int main(){

    
    string s;
    cin >> s;

    int l = s.size();

    int tmp;
    int mn = 1000;
    for (int i=0; i < l-2; i++){
        tmp = 100*(s[i]-'0') + 10*(s[i+1]-'0') + s[i+2]-'0';
        tmp = max(tmp-753, 753-tmp);
        mn = min(mn, tmp);
    }


    cout << mn << endl;

}





//              g++ -std=c++1z


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int m,f,r,a=0;
	
	while(1){
		scanf("%d %d %d",&m,&f,&r);
		if(m==-1&&f==-1&&r==-1){
			break;
		}
		a=m+f;
		if(m==-1||f==-1){
			printf("F\n");
		}else if(a>=80){
			printf("A\n");
		}else if(a<80&&a>=65){
			printf("B\n");
		}else if((a<65&&a>=50)||a<50&&a>=30&&r>=50){
			printf("C\n");
		}else if(a<50&&a>=30){
			printf("D\n");
		}else if(a<30){
			printf("F\n");
		}
	}
	
	return 0;
}

Measured memory_bytes: 1752
#include <iostream>
#include <cstdio>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
#include <sstream>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;

template <class T>
void initvv(vector<vector<T> > &v,int a,int b, const T  &t = T()){
	v.assign(a,vector<T>(b,t));
}

//v.erase(unique(v.begin(),v.end()),v.end());
int a[1000][1000];
// int vis[1000][1000];
int dx[]={0,-1,-1,0,1,1};
int dy[]={1,0,-1,-1,0,1};
int main(){
	int t,n;
	while(cin>>t>>n,t||n){
		rep(i,1000){
			rep(j,1000){
				a[i][j]=0;
			}
		}
		rep(i,n){
			int x,y;
			cin>>x>>y;
			a[x+500][y+500]=1;
		}
		int sx,sy;
		cin>>sx>>sy;
		int ans=0;
		sx+=500;
		sy+=500;
		queue<pii> q;
		q.push(mkp(sx,sy));
		a[sx][sy]=1;
		ans++;
		rep(i,t){
			int qs=q.size();
			rep(j,qs){
				pii top=q.front();
				q.pop();
				rep(l,6){
					int xx=top.F+dx[l];
					int yy=top.S+dy[l];
					if(a[xx][yy]==0){
						q.push(mkp(xx,yy));
						a[xx][yy]=1;
						ans++;
					}
				}
			}
		}
		cout<<ans<<endl;
	}
}

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

using namespace std;

int main(){
    int n,k,q; cin >> n >> k >> q;
    vector<int> a(q);
    vector<int> p(n, 0);

    for(int i = 0; i < q; i++){
        cin >> a[i];
    }

    for(int i = 0; i < q; i++){
        p[a[i] - 1]++;
    }

    for(int i = 0; i < n; i++){
        if(k - (q - p[i]) <= 0) cout << "No" << endl;
        else cout << "Yes" << endl;
    }

    return 0;
}

Measured memory_bytes: 1408
import sys
N=input()
N=int(N)
a = N / 100
a = int(a)
b = (N - a * 100)/10
b = int(b)
c = (N- a*100 - b*10)
if a==7 or b ==7 or c==7:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 9188
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func dfs(i int, ans []uint64, visited map[int]bool, w map[int]uint64, g map[int][]int) []uint64 {
	stack := []int{}
	visited[i] = true
	stack = append(stack, i)
	for len(stack) != 0 {
		v := stack[len(stack)-1]
		stack = stack[:len(stack)-1]
		ans[v] += w[v]
		for _, c := range g[v] {
			if !visited[c] {
				visited[c] = true
				stack = append(stack, c)
				ans[c] += ans[v]
			}
		}
	}
	return ans
}

func main() {
	line := nextLine()
	l := strings.Split(line, " ")
	N, _ := strconv.Atoi(l[0])
	Q, _ := strconv.Atoi(l[1])
	g := map[int][]int{}
	for i := 0; i < N-1; i++ {
		line = nextLine()
		l = strings.Split(line, " ")
		a, _ := strconv.Atoi(l[0])
		b, _ := strconv.Atoi(l[1])
		g[a] = append(g[a], b)
		g[b] = append(g[b], a)
	}
	w := map[int]uint64{}
	for i := 0; i < Q; i++ {
		line = nextLine()
		l = strings.Split(line, " ")
		p, _ := strconv.Atoi(l[0])
		x, _ := strconv.ParseInt(l[1], 10, 64)
		w[p] += uint64(x)
	}

	visited := map[int]bool{}
	ans := make([]uint64, N+1)
	dfs(1, ans, visited, w, g)
	for i, v := range ans {
		if i == 0 {
			continue
		}
		fmt.Print(v)
		if i != N {
			fmt.Print(" ")
		}
	}
	fmt.Println()
}


Measured memory_bytes: 48404
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    s = input().rstrip()
    res = 0
    ss = s[::-1]
    for i in range(len(s)):
        if s[i] != ss[i]:
            res += 1
    print(res//2)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3444
a=list(input().rstrip())

for i in range(8):
    s = list("-".join(a))

    for j in range(0, 3):
        if i&(1<<j):
            s[1+j+j]="+"
    if eval(''.join(s))==7:
        print(''.join(s)+"=7")
        exit()


Measured memory_bytes: 3060
use std::cmp::min;
use std::io::*;
use std::str::FromStr;

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

fn main() {
    let n: usize = read();
    let mut p: Vec<u64> = vec![0; n + 1];
    let mut m: Vec<Vec<u64>> = vec![vec![u64::max_value(); n + 1]; n + 1];
    for index in 0..n {
        let r: u64 = read();
        let c: u64 = read();
        if index == 0 {
            p[index] = r;
            p[index + 1] = c;
        } else {
            p[index + 1] = c;
        }
    }
    for index in 1..(n + 1) {
        m[index][index] = 0;
    }
    for index_i in 2..(n + 1) {
        for index_j in 1..(n - index_i + 2) {
            let index_k = index_i + index_j - 1;
            for index_l in index_j..index_k {
                m[index_j][index_k] = min(
                    m[index_j][index_k],
                    m[index_j][index_l]
                        + m[index_l + 1][index_k]
                        + p[index_j - 1] * p[index_l] * p[index_k],
                );
            }
        }
    }
    println!("{}", m[1][n]);
}



Measured memory_bytes: 5040
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int sum = x + a;
        if( b > sum){
            System.out.println("dangerous");
        }else if(b > a){
            System.out.println("safe");
        }else{
            System.out.println("delicious");
        }
	}
}

Measured memory_bytes: 21844
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			String str = br.readLine();
			String[] s = str.split(" ",0);
			int x = Integer.parseInt(s[0]);
			int a = Integer.parseInt(s[1]);
			int b = Integer.parseInt(s[2]);
			if(b <= a) {
				System.out.println("delicious");
			}else if(b <= (x+a)) {
				System.out.println("safe");
			}else {
				System.out.println("dangerous");
			}

		}catch (Exception e) {
			System.exit(0);
		}
	}
}


Measured memory_bytes: 23252
package main

import (
  "fmt"
)

func main() {
  var n int
  fmt.Scanf("%d", &n)
  
  ans := 0
  for i := 0; i < 4; i++ {
    if n % 10 == 2 {
      ans++
    }
    n = n / 10
  }
  fmt.Printf("%d\n", ans)
}

Measured memory_bytes: 1836
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef string str;
const long long INF = INT64_MAX;

#define REP(i, n) for(ll i=0;i<n;i++)
#define ASC(v) sort((v).begin(), (v).end())
#define DESC(v) sort((v).rbegin(), (v).rend())
#define UNIQ(v) ASC(v);erase(unique(v.begin(), v.end()), v.end())
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);

void solve() {
    str s;cin >> s;
    vector<str> valids = {
        "AKIHABARA",
        "KIHABARA",
        "AKIHBARA",
        "AKIHABRA",
        "AKIHABAR",
        "KIHBARA",
        "KIHABRA",
        "KIHABAR",
        "AKIHBRA",
        "AKIHBAR",
        "AKIHABR",
        "KIHBRA",
        "KIHBAR",
        "KIHABR",
        "AKIHBR",
        "KIHBR"
    };
    for(auto &t:valids) {
        if(s == t) {
            cout << "YES" << endl;
            return;
        }
    }
    cout << "NO" << endl;
}

int main() {
    FIO;
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool etmin(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//https://www.creativ.xyz/dump-cpp-652/
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
 
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}

#ifdef DEBUG_
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif

signed main(void) { cin.tie(0); ios::sync_with_stdio(false);
    int n; cin>>n;
    vector <int> a(n);
    rep(i,n) a[i] = i+1;
 
    vector <int> p(n), q(n);
    rep(i,n) cin>>p[i];
    rep(i,n) cin>>q[i];
    int cnt = 0, A = 0, B = 0;
    do {
        //cout<<a<<endl;
        if(a == p) {
            A = cnt;
        }
        if(a == q) B = cnt;
        cnt++;
    } while( next_permutation(a.begin(), a.end()) );
    cout<<abs(A-B)<<endl;
}

Measured memory_bytes: 256
import itertools

n, a, b, c = list(map(int, input().split()))

f = [a, b, c]
l = [int(input()) for _ in range(n)]

x = [0, 1, 2, 3]

mp_min = 10000

for sublist in itertools.product(x, repeat = n):
    flag = True
    mp = 0
    length = [0] * 3
    for j in range(n):
        d = sublist[j]
        if  d != 3:
            if length[d] == 0:
                length[d] = l[j]
            else:
                length[d] += l[j]
                mp += 10
    
    for k in range(3):
        if length[k] == 0:
            flag = False
            break
        else:
            mp += abs(length[k] - f[k])

    if flag:
        mp_min = min(mp_min, mp)

print(mp_min)

Measured memory_bytes: 74208
use proconio::input;

macro_rules! chmin {
    ($min_v: expr, $v: expr) => {
        if $v < $min_v {
            $min_v = $v;
            true
        } else {
            false
        }
    };
}

fn main() {
    input! {
        n: usize,
        k: usize,
        h: [i64; n],
    };
    let inf = 1_000_000_000_000_000_i64;
    let mut dp = vec![inf; n];
    dp[0] = 0;
    for i in 0..n {
        for j in i + 1..=i + k {
            if j < n {
                chmin!(dp[j], dp[i] + (h[j] - h[i]).abs());
            }
        }
    }
    let ans = dp[n - 1];
    println!("{}", ans);
}


Measured memory_bytes: 3968
from sys import stdin
from math import factorial
mod = 1000000007
def permutations_count(n, r):
    return factorial(n) // factorial(n - r)
n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()
t = stdin.readline().rstrip()
now = 0
pazzle = ""#横に2個か縦に2個かを確認
while now < n:
    if s[now] == t[now]:
        now += 1
        pazzle += "T"
    else:
        now += 2
        pazzle += "Y"
#初期の可能性
if pazzle[0] == "T":
    point = 3
else:
    point = 6
for i in range(1,len(pazzle)):
    if pazzle[i-1] == "T" and pazzle[i] == "T":
        point *= 2
        point %= mod
    elif pazzle[i-1] == "T" and pazzle[i] == "Y":
        point *= 2
        point %= mod
    elif pazzle[i-1] == "Y" and pazzle[i] == "Y":
        point *= 3
        point %= mod
print(point)

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

const int MOD = (int)1e9+7;

map<pair<int,int>,int> mp;

void dfs(vector<vector<int>> &graph,int now_v,int pre_v,int pre_num){
	int num=1;
	for(int i=0;i<graph.at(now_v).size();i++){
		int next_v=graph.at(now_v).at(i);
		if(next_v==pre_v)	continue;
		if(num==pre_num)	num++;
		mp[make_pair(now_v,next_v)]=num;
		mp[make_pair(next_v,now_v)]=num;
		dfs(graph,next_v,now_v,num);
		num++;
	}
}

int main(){
	int N;
	cin >> N;
	vector<pair<int,int>> ab(N-1);
	vector<vector<int>> graph(N);
	for(int i=0;i<N-1;i++){
		int a,b;
		cin >> a >> b;
		a--;
		b--;
		ab.at(i).first=a;
		ab.at(i).second=b;
		graph.at(a).push_back(b);
		graph.at(b).push_back(a);
	}

	dfs(graph,0,-1,0);
	int ans=0;
	for(int i=0;i<N-1;i++){
		ans=max(ans,mp.at(ab.at(i)));
	}
	cout << ans << endl;
	for(int i=0;i<N-1;i++){
		cout << mp.at(ab.at(i)) << endl;
	}

	return 0;
}


Measured memory_bytes: 21248
n = int(input())
w = list(map(int,input().split()))


s = []
for i in range(0,n-1):
    
    sum1 = 0
    sum2 = 0

    sum1 += sum(w[0:i+1])
    sum2 += sum(w[i+1:n])
    a= abs(sum1 - sum2)
    s.append(a)

print(min(s))

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

#ifdef LOCAL
#include "../lib/dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

void solve() {
  int N;
  cin >> N;
  vector<vector<int>> a(N);
  rep(i, N) rep(j, N - 1) {
    int k;
    cin >> k;
    k--;
    a[i].push_back(k);
  }
  rep(i, N) reverse(a[i].begin(), a[i].end());
  dumpv(a, N);
  set<P> q;
  function<void(int)> scan = [&](int i) {
    if (a[i].size() == 0) return;
    int j = a[i].back();
    if (a[j].size() == 0) return;
    if (a[j].back() == i) {
      if (j > i) swap(i, j);
      q.insert(P(i, j));
    }
  };
  rep(i, N) scan(i);
  int ans = N * (N - 1) / 2;
  for (int d = 0; d < N * (N - 1) / 2; d++) {
    if (!q.size()) {
      ans = d;
      break;
    }
    set<P> q2;
    swap(q2, q);
    for (P p : q2) {
      int i = p.first, j = p.second;
      a[i].pop_back();
      a[j].pop_back();
      scan(i);
      scan(j);
    }
  }
  rep(i, N) {
    if (a[i].size() != 0) {
      cout << -1 << endl;
      return;
    }
  }
  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

Measured memory_bytes: 4352
#include<iostream>
#include<sstream>
#include<fstream>
#include<vector>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<functional>
#include<climits>
#include<utility>
#include <iomanip>
#include<map>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define FOR(i,s,e) for (int i = int(s); i < int(e); i++)
#define REP(i,x) FOR(i,0,x)
#define CLR(a) memset((a), 0 ,sizeof(a))


const int MOD = 1e+9+7;
const double PI  = acos(-1.0);

int main(){
  int h,w;
  cin>>h>>w;
  int grid[h][w];
  CLR(grid);
  string str;
  REP(i,h){
    cin>>str;
    REP(j,w){
      if(str[j]=='#'){
        grid[i][j]=-1;
        for(int x=-1;x<=1;x++)for(int y=-1;y<=1;y++){
          int xx=i+x, yy=j+y;
          if(xx>=0 && xx<h && yy>=0 && yy<w){
            if(grid[xx][yy]>=0) grid[xx][yy]++;
          }
        }
      }
    }
  }
  REP(i,h){
    REP(j,w){
      if(grid[i][j]<0) cout<<"#";
      else cout<<grid[i][j];
    }
    cout<<"\n";
  }
}


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

long long N, Y;

int main(){
    cin >> N >> Y;
    bool flag = false;
    for(int i = 0; i<= N; i++){
        // printf("%d\n", i);
        if(flag){
            break;
        }
        if(i * 10000 <= Y){
            for(int j = 0; j<=N-i; j++){
                if(i * 10000 + j * 5000 > Y){
                    break;
                }
                int k = N- i - j;
                if(i * 10000 + j * 5000 + k * 1000 == Y){
                    cout << i << ' ' << j << ' ' << k << endl;
                    flag = true;
                    break;
                }

            }

        }

    }
    if(flag == false){

        cout << -1 << ' ' << -1 << ' ' << -1 << endl;

    }
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np
# from numpy import cumsum  # accumulate

def solve():
    N, M = MI()
    E = [[] for _ in range(N)]
    for i in range(M):
        a, b = MI1()
        E[a].append(b)
        E[b].append(a)
    q = deque([0])
    used = [0] * N
    used[0] = 1
    ans = [0] * N
    ans[0] = 'Yes'
    while q:
        v = q.popleft()
        for nv in E[v]:
            if used[nv]: continue
            used[nv] = 1
            ans[nv] = v+1
            q.append(nv)
    printlist(ans, '\n')


if __name__ == '__main__':
    solve()


Measured memory_bytes: 45288
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const int vx[]={1,0,-1,0}, vy[]={0,1,0,-1};
const int sqrtN = 512;
const ll LINF=1e18;
const ld PI=abs(acos(-1));

struct Node{
	int data;
	
	Node(int data) : data(data) {}
	
	Node operator*(const Node r) const{
		return Node(data + r.data);
	}
} e(0);

struct SqrtDecomposition{
	vector<Node> data;
	vector<Node> bucket;
	int K, N;
	
	SqrtDecomposition(int n) : N(n){
		K = (N + sqrtN - 1) / sqrtN;
		data.assign(K * sqrtN, e);
		bucket.assign(K, e);
	}
	
	void update(int k, int x){
		data[k] = Node(x) * data[k];
		k = k / sqrtN;
		
		Node ret = e;
		for(int i = k * sqrtN; i < (k + 1) * sqrtN; i++){
			ret = ret * data[i];
		}
		bucket[k] = ret;
	}
	
	int get(int a, int b){
		Node ret = e;
		for(int k = 0; k < K; k++){
			int l = k * sqrtN, r = (k + 1) * sqrtN;
			
			if(b<=l||r<=a) continue;
			if(a<=l&&r<=b) ret = ret * bucket[k];
			else{
				for(int i = max(a, l); i < min(b, r); i++){
					ret = ret * data[i];
				}
			}
		}
		
		return ret.data;
	}
};

int main(){
	int n,q; cin >> n >> q;
	SqrtDecomposition data(n);
	REP(i, 0, q){
		int a, b, c; cin >> a >> b >> c;
		
		if(a == 0) data.update(b, c);
		else if(a == 1) cout << data.get(b, c + 1) << endl;
	}
	
	return 0;
}



Measured memory_bytes: 3340
import sys
import collections as co
n = int(input())
d = list(map(int,input().split()))
mod = 998244353
ans = 1
if d[0] != 0:
    print(0)
    sys.exit()

else:

    tmp = co.Counter(d)
    #tmp = d.items()
    #print(tmp)
    if tmp[0] != 1:
        print(0)
        sys.exit()
    for i in range(1,len(tmp)):
        ans *= (tmp[i-1] ** tmp[i]) % mod

print(ans%mod)

Measured memory_bytes: 19936
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int N;cin>>N;
    vector<int> ma(N,0);
    REP(i,N)cin>>ma[i];
    sort(ma.begin(),ma.end(),greater<int>());
    int a=0,b=0;
    REP(i,N){
        if(i%2==0)a+=ma[i];
        else b+=ma[i];
    }
    cout<<a-b<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

#define MAX 50

signed main() {
    int n;
    cin >> n;
    ll a[n];
    rep(i, n) {
        cin >> a[i];
    }
    ll x = 0;
    for (int i = 2; i < n; i++) {
        x ^= a[i];
    }
    int d[MAX + 1];
    fill(d, d + MAX + 1, -1);
    ll sum = a[0] + a[1];
    for (int i = 0; i <= MAX; i++) {
        if (x & 1LL << i) {
            sum -= 1LL << i;
            d[i] = 0;
        }
    }
    ll c = 0;
    for (int i = MAX; i >= 0; i--) {
        if (!(x & 1LL << i) && sum >= 1LL << (i + 1)) {
            sum -= 1LL << (i + 1);
            c += 1LL << i;
            d[i] = 1;
        }
    }
    if (sum != 0) {
        cout << -1 << endl;
        return 0;
    }
    ll r = a[0] - c;
    for (int i = MAX; i >= 0; i--) {
        if (d[i] == 0 && r >= 1LL << i) {
            c += 1LL << i;
            r -= 1LL << i;
        }
    }
    ll ans = a[0] - c;
    cout << (0 <= ans && ans < a[0] ? ans : -1) << endl;
    return 0;
}

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

int main(){
	int a, b, n;
	while(std::cin >> a >> b){
		if(a == 0 && b == 0){ break; }
		
		std::vector<std::vector<int> > coord(a + 1, std::vector<int>(b + 1, 0)); //coord[a+1][b+1]
		coord[1][1] = 1;
		std::cin >> n;
		
		//工事中の点の入力
		for(int i = 0 ; i < n ; ++i){
			int xi, yi;
			std::cin >> xi >> yi;
			coord[xi][yi] = -1; //工事中の点は-1として表す
		}
		
		for(int y = 1 ; y <= b ; ++y){
			for(int x = 1 ; x <= a ; ++x){
				if(coord[x][y] != -1){
					if(x != 1 && coord[x - 1][y] != -1){
						coord[x][y] += coord[x - 1][y];
					}
					if(y != 1 && coord[x][y - 1] != -1){
						coord[x][y] += coord[x][y - 1];
					}
				}
			}
		}
		std::cout << coord[a][b] << std::endl;
	}
	
    return 0;
}

Measured memory_bytes: 1212
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>

auto& in = std::cin;
auto& out = std::cout;

int32_t N;std::bitset<32> K;
std::array<std::pair<int32_t, uint32_t>, 100000> BA;

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> N; {uint32_t k; in >> k; K = k; }
	for (int32_t i = 0; i < N; i++)
	{
		in >> BA[i].second >> BA[i].first;
	}
	std::sort(BA.begin(), BA.begin() + N);

	uint64_t res = 0;
	//上からuse_K桁目は0
	//=>上からuse_K-1桁はKを超えられない
	//=>上からuse_K+1桁以降は自由
	for (int32_t use_K = 1; use_K <= 31; use_K++)
	{
		if (use_K != 31) {
			if (K[30 - use_K] == 0) { continue; }
			K[30 - use_K] = 0;
		}
		uint32_t mask = 0;//30桁が最大
		{
			int32_t i = 0;
			for (; i < std::min(30,use_K); i++) {
				mask <<= 1; mask |= 1;
			}
			mask <<= (30 - i);
		}
		uint32_t K_masked = K.to_ulong()&mask;
		uint32_t cant = ((~K_masked)&mask);
		uint64_t tmp = 0;
		for (int32_t i = 0; i < N; i++)
		{
			uint32_t A_masked = (BA[i].second & mask);
			if (A_masked & cant) {
				continue;
			}
			else {
				tmp += BA[i].first;
			}
		}

		if (use_K != 31) {
			K[30 - use_K] = 1;
		}
		res = std::max(tmp, res);
	}
	out << res << endl;

	return 0;
}
#endif


Measured memory_bytes: 1656
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define fo(i,j,n) for (int i=(j); i < (n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){ 
    double W, H, x, y; cin >> W >> H >> x >> y;
    int fg = 0; if(W / 2 == x && H / 2 == y) fg = 1;

    cout << fixed << setprecision(12);
    cout << (double)W * (double)H / 2 << " " << fg << ln;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.setf(ios::fixed);
    int a, b;
    cin>>a>>b;
    cout<<a/b<<' '<<a%b<<' '<<(double)a/b<<'\n';
    return 0;
}

Measured memory_bytes: 1272
n = int(input())
h = list(map(int,input().split()))

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

for i in range(1,n):
  if i == 1:
    dp[i] = dp[i-1] + abs(h[i]-h[i-1])
  else:
    dp[i] = min(dp[i-1] + abs(h[i]-h[i-1]), dp[i-2] + abs(h[i]-h[i-2]))
    
print(dp[n-1])

Measured memory_bytes: 20424
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Globalization;

namespace 練習１
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = Console.ReadLine();
            var N = decimal.Parse(a);

            var x = new decimal[1000000];
            var j = 0;
            
            for(var i = 1; i <= N; i++)
            {
                if ((i % 3 != 0) && (i % 5 != 0))
                {
                    x[j] = i;
                    j++;
                }
            }

            Console.WriteLine("{0}", x.Sum());
        }
    }
}

Measured memory_bytes: 36128
# include "iostream"
# include "cstdio"

using namespace std;

int A,B,K;

int main(){
	register int i;
	scanf("%d%d%d",&A,&B,&K);
	for(i=min(A,B);i;i--){
		if(A%i==0 && B%i==0){
			K--;
		}
		if(!K){
			printf("%d",i);
			break;
		}
	}
	return 0;	
}

Measured memory_bytes: 256
import std.stdio;
import std.range;
import std.array;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.container;
import std.typecons;
import std.random;
import std.math;
import core.time;

int[][] ofs = [
	[0, 1],
	[1, 0],
	[-1, 0],
	[0, -1]
];

void fill(bool[][] field, bool[][] done, int x, int y, bool color)
{
	foreach (d; ofs) {
		int nx = d[0] + x;
		int ny = d[1] + y;
		if (nx < 0 || field[0].length <= nx
				|| ny < 0 || field.length <= ny) {
			continue;
		}
		if (field[ny][nx] != color) {
			continue;
		}
		if (done[ny][nx]) {
			continue;
		}
		done[ny][nx] = true;
		fill(field, done, nx, ny, color);
	}
}

alias Ret = Tuple!(int, "a", int, "b");
Ret cal(bool[][] field) {
	if (field.length == 0) {
		return Ret.init;
	}
	bool[][] done = new bool[][](field.length, field[0].length);
	Ret ret;
	foreach (int y, arr; field) {
		foreach (int x, color; arr) {
			if (done[y][x]) {
				continue;
			}
			done[y][x] = true;
			if (field[y][x]) {
				ret.b++;
			} else {
				ret.a++;
			}
			fill(field, done, x, y, color);
		}
	}
	return ret;
}

void main()
{
	auto inp = readln.chomp.split.map!(to!int);
	int a = inp.front;
	int b = inp.back;
	bool[][] field = new bool[][](100, 100);
	foreach (ref arr; field[0..50]) {
		foreach (ref v; arr) {
			v = true;
		}
	}
	--a;
	--b;
	foreach (i; 0..a) {
		int x = (i * 2) % 100;
		int y = (i * 2) / 100 * 2;
		field[y][x] = false;
	}
	foreach (i; 0..b) {
		int x = (i * 2) % 100;
		int y = (i * 2) / 100 * 2;
		x = 99 - x;
		y = 99 - y;
		field[y][x] = true;
	}
	writeln(field.length, " ", field[0].length);
	foreach (arr; field) {
		foreach (v; arr) {
			write = v ? "#" : ".";
		}
		writeln;
	}
}


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

int main()
{
	int book, algo, goal;
	cin >> book >> algo >> goal;
	int money[book];
	int p[book][algo];
	rep(i, book)
	{
		cin >> money[i];
		rep(j,algo)
			cin >> p[i][j];
	}
	long ans = LONG_MAX;
	long cnt;
	long index = -1;
	long sum;
	for (int s = 0; s < (1<<book); s++)
	{
		sum = 0;
		vector<long> x(algo);
		for (int i = 0; i < book; i++)
		{
			cnt = 0;
			if (s>>i&1)
			{
				sum += money[i];
				rep(j, algo)
				{
					x[j] += p[i][j];
					if (x[j] >= goal)
						cnt++;
				}
			}
			if (cnt == algo)
				ans = min(ans, sum);
		}
	}
	if (ans == LONG_MAX)
		cout << -1 << endl;
	else
		cout << ans << endl;
	return (0);
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
typedef const void cv;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define per(i,n) for((i)=(n)-1;(i)>=0;(i)--)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
#define absl(v) labs((v))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;if(n<r) return 0;rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define nHr(n,r) nCr((int)((n)+(r)+1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1},dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(cv *a, cv *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(cv *a, cv *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(cv *left, cv *right) {return strcmp((char *)left,(char *)right);}
int downchar(cv *left, cv *right) {return strcmp((char *)right,(char *)left);}
void tmpInit(int *c,ll m) {ll i;rep(i,m) c[i]=i;}
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1){
      res *= a; if(mod>=1) res %= mod;
    }
    a *= a; if(mod>=1) a %= mod;
    n >>= 1;
  }
  return res;
}
void initialize(){
    
}
int main(void){
  initialize();
  ll n,m,i,j,k;
  ld result=0;
  ll a;
  ld b;
  char s[LIMIT1];
  
  scanf("%lld %llf",&a,&b);
  result = a*b;
  printf("%lld",(ll)result);
  
  return 0;
}



Measured memory_bytes: 1752
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
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;}

int main(){
    string a,b;
    cin >> a >> b;
    string ans = "LESS";
    ll cnt = 0;
    if(a.length() == b.length()){
        rep(i, a.length()){
            if(a[i] == b[i]){
                cnt++;
                continue;
            }
            if(a[i]-'0' > b[i]-'0'){
                ans = "GREATER";
            }
            break;
        }
    }
    else if(a.length() > b.length()){
        ans = "GREATER";
    }
    if(cnt == a.length()) ans = "EQUAL";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
class UnionFind:
    def __init__(self, N):
        self.rank = [0] * N
        self.parent = [i for i in range(N)]
        self.n = N
        self.size = [1 for i in range(N)]
    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if (x == y):
            return
        if (self.rank[x] < self.rank[y]):
            self.parent[x] = y
            self.size[y] += self.size[x]
        else:
            self.parent[y] = x
            self.size[x] += self.size[y]
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
    def same(self, x, y):
        return self.find(x) == self.find(y)
    def get_parents(self):
        count = 0
        for i in range(self.n):
            if self.find(i) == i:
                count += 1
        return count
    def get_size(self, x):
        root = self.find(x)
        return self.size[root]
N,M,K = map(int,input().split())
U = UnionFind(N)
direct = [0 for i in range(N)]
for i in range(M):
    a,b = map(int,input().split())
    a,b = a-1,b-1
    U.unite(a,b)
    direct[a] += 1
    direct[b] += 1
neg = [0 for i in range(N)]
for i in range(K):
    c,d = map(int,input().split())
    c,d = c-1,d-1
    if U.same(c,d):
        neg[c] += 1
        neg[d] += 1
ans = []
for i in range(N):
    ans.append(U.get_size(i)-1-neg[i]-direct[i])
print(*ans)

Measured memory_bytes: 16540
import java.util.Scanner;

public class Main {

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

	    int n=gi();
        //int a=gi();

        System.out.println((n- n%3) / 3);
//        if ((n%500) <= a) {
//        	System.out.print("Yes");
//        }else {
//        	System.out.print("No");
//        }


	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}
	
	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 35224
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vb = vector<bool>;
using vll = vector<long long>;
using vpii = vector<pair<int,int>>;
using vivi = vector<vector<int>>;
using vbvb = vector<vector<bool>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int mod = 1000000007;
const int inf = 1001001001;



int main(void) {
  ll x,y;
  cin >> x >> y;
  int cnt = 0;
  ll a=x;
  while(y>=a){
    a*=2;
    cnt++;
    //cout << a << endl;
  }
  cout << cnt << endl;
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ff first
#define ss second
#define quick                    \
    ios::sync_with_stdio(false); \
    cin.tie(0);
#define time cerr << (0.1 * clock()) / CLOCKS_PER_SEC << endl;
#define mod 1000000007
typedef long long ll;
typedef pair<ll, ll> pl;
#define forn(n) for (ll i = 0; i < ll(n); i++)

void solve() {
    ll n;
    cin >> n;
    map<string, int> m;
    forn(n) {
        string s;
        cin >> s;
        m[s]++;
    }
    cout << "AC x " << m["AC"] << '\n';
    cout << "WA x " << m["WA"] << '\n';
    cout << "TLE x " << m["TLE"] << '\n';
    cout << "RE x " << m["RE"] << '\n';
}

int main() {
    quick;
    solve();
    // ll t;
    // cin >> t;
    // while (t--) {
    //     solve();
    // }
}

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

const ll MOD = 1000000007;
ll dp[10000000][13];

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

    ll mul = 1;
    dp[0][0] = 1;

    rep(i, 0, s.size())
    {
        int index = s.size() - i - 1;
        if (s[index] == '?')
        {
            rep(k, 0, 10)
            rep(j, 0, 13)
            {
                dp[i + 1][(k * mul + j) % 13] += dp[i][j];
                dp[i + 1][(k * mul + j) % 13] %= MOD;
            }
        }
        else
        {
            int k = s[index] - '0';
            rep(j, 0, 13)
            {
                dp[i + 1][(k * mul + j) % 13] += dp[i][j];
                dp[i + 1][(k * mul + j) % 13] %= MOD;
            }
        }
        mul = (mul * 10) % 13;
    }
    cout << dp[s.size()][5] << endl;
    return 0;
}

Measured memory_bytes: 10752
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#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>
const long long INF = 1e9 + 7;
using namespace std;
typedef long long ll;

map<ll, int> mp;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	ll ret = 0, sum = 0;
	mp[0]++;
	for (int i = 0; i < n; i++) {
		ll a;
		cin >> a;
		sum += a;
		ret += mp[sum];
		mp[sum]++;
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 12800
#include<cstdio>
#define ll long long
const int N=2005,M=4e6+5,mo=1e9+7;
int n,m,nm,i,j,f[N];
int fact[M],inv[M],fv[M];
void init(int n){
	fact[0]=fact[1]=inv[1]=fv[0]=fv[1]=1;
	for (i=2;i<=n;i++){
		fact[i]=(ll)fact[i-1]*i%mo;
		inv[i]=(ll)inv[mo%i]*(mo-mo/i)%mo;
		fv[i]=(ll)fv[i-1]*inv[i]%mo;
	}
}
int C(int n,int m){return (ll)fact[n]*fv[m]%mo*fv[n-m]%mo;}
int main(){
	scanf("%d%d",&n,&m);m--;
	if (!m){puts("1");return 0;}
	nm=n*m+n;init(nm);f[0]=1;
	for (i=1;i<=n;i++) for (j=1;j<=i;j++)
		f[j]=(f[j]+(ll)(n-j+1)*
			C(nm-i-(j-1)*m-1,m-1)%mo*f[j-1])%mo;
	printf("%d",f[n]);
}

Measured memory_bytes: 47104
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    String s = sc.next();
    String t = sc.next();
    int res = 0;
    for (int i = 0; i < 3; i++) {
      if (s.charAt(i) == t.charAt(i)) res++;
    }
    os.println(res);
  }
}

Measured memory_bytes: 21844