akhauriyash/Code-Regression huggingface dataset:
//#include<iostream>
//#include<algorithm>
//#include<string>
//#include <cmath>
//#include <vector>
#include <bits/stdc++.h>

#define ll long long
#define REP(x,n) for(int x=0;x<n;x++)

// vector 操作  vector<int> data(10,5) 10が5個　data(10) 要素数10
// v.size(), v.empty(), v.insert(itr,値), v.erase(itr) (first,last),
// sort(itr), find(all(x),値),reverse(itr),accumulate(itr,0) 積算,
//v.swap
// stringも同じ itrがただの数字になる
// s.substr(n,m)n番目以降m文字取り出す　erase(n,m)も  s.find
#define vei vector<int> 
#define velli vector<long long int> 
#define pb(x) push_back(x) // 末尾にxを加える
#define pb2 pop_back() // 末尾削除
#define all(x) (x).begin(),(x).end() //イテレーター
#define be(x) (x).begin()

using namespace std;

int main (){
    ll int n;
    cin >> n;
    velli p(n);
    ll int sum = 0;
    REP(i,n){
        cin >> p[i];
    }
    
    //ll int a = max_element(all(p));
    //velli p2 = p;
    //sort(all(p2));
    //ll int a = p2[0];
    ll int min = p[0];
    REP(i,n){
       // if(p[i] == a) {
        //    sum+=1;
        //    goto last;
        //}
        if(p[i]<=min){min = p[i];}
        //REP(j,i+1){
        //    v[j] = p[j];
        //}
          //  sort(all(v));
           // if(v[0]==p[i]){
            //    sum+=1;
            //
            if(p[i]==min){sum+=1;}
            }
        //last: ;
    cout << sum << endl;
}

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

using ll = long long;

ll op(ll a, ll b) { return a + b; }
ll e() { return 0; }

int main() {
    ll N, Q;  cin >> N >> Q;
    vector<ll> A(N);
    for (ll i = 0; i < N; ++i) cin >> A[i];
    segtree<ll, op, e> seg(A);

    for (ll _ = 0; _ < Q; ++_) {
        ll q;  cin >> q;
        if (q == 0) {
            ll p, x;  cin >> p >> x;
            seg.set(p, seg.get(p) + x);
        }
        else if (q == 1) {
            ll l, r;  cin >> l >> r;
            cout << seg.prod(l, r) << endl;
        }
    }
}


Measured memory_bytes: 16400
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		String S =scan.next();
		boolean ans1=false;
		boolean ans2=false;

		if(S.contains("W")){
			//Wが含まれている
			if(S.contains("E")){
				ans1 = true;
			}
		}else{
			//Wが含まれていない
			if(!S.contains("E")){
				ans1 = true;
			}
		}

		if(S.contains("N")){
			//Wが含まれている
			if(S.contains("S")){
				ans2 = true;
			}
		}else{
			//Wが含まれていない
			if(!S.contains("S")){
				ans2 = true;
			}
		}

		if(ans1&&ans2){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}

	}

}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5;

int father[N],sum[N],ans[N];
int n,m,k,x,y;

int Findfather(int x){
    return father[x]==x?x:father[x]=Findfather(father[x]);
}

void Union(int a,int b){
    a=Findfather(a),b=Findfather(b);
    if(a!=b) father[b]=a,sum[a]+=sum[b];
}

void init(){
    for(int i=0;i<=n;i++)
        father[i]=i,sum[i]=1;
}

int main(){
    scanf("%d%d%d",&n,&m,&k);
    init();
    while(m--){
        scanf("%d%d",&x,&y);
        ans[x]++,ans[y]++;
        Union(x,y);
    }
    while(k--){
        scanf("%d%d",&x,&y);
        if(Findfather(x)==Findfather(y)) ans[x]++,ans[y]++;
    }
    for(int i=1;i<=n;i++){
        printf("%d ",sum[Findfather(i)]-ans[i]-1);
    }
    return 0;
}


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

int main() {
  int64_t a, b, c, d;
  cin >> a >> b >> c >> d;
  int64_t A=a*c;
  int64_t B=a*d;
  int64_t C=b*c;
  int64_t D=b*d;
  cout << max({A, B, C, D}) << endl;
}


Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  int x=1;
  for(int i=0;i<a;i++)
    x*=100;
  if(b!=100)
    cout<<b*x<<endl; 
  else
    cout<<(b+1)*x<<endl;
  return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	n := readi()
	a := atoi(readSlice())
	as := make(map[int]int)
	var sum int
	for i := 0; i < n; i++ {
		sum += as[a[i]]
		as[a[i]]++
	}

	for i := 0; i < n; i++ {
		fmt.Println(sum - as[a[i]] + 1)
	}
}

// IO---------------------------------------------------

func readi() (n int) {
	fmt.Scan(&n)
	return
}

func readf() (n float64) {
	fmt.Scan(&n)
	return
}

func reads() (n string) {
	fmt.Scan(&n)
	return
}

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func readSlice() []string {
	return strings.Split(readLine(), " ")
}

func atoi(a []string) (b []int) {
	b = make([]int, len(a))
	for i := range a {
		b[i], _ = strconv.Atoi(a[i])
	}
	return
}

func atof(a []string) (b []float64) {
	b = make([]float64, len(a))
	for i := range a {
		b[i], _ = strconv.ParseFloat(a[i], 64)
	}
	return
}

func readSlice2(n int) (a []int, b []int) {
	a = make([]int, n)
	b = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i], &b[i])
	}
	return
}

func readFloatSlice2(n int) (a []float64, b []float64) {
	a = make([]float64, n)
	b = make([]float64, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i], &b[i])
	}
	return
}

func yesOrNo(b bool) {
	if b {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}

func yesorNO(b bool) {
	if b {
		fmt.Println("YES")
		return
	}
	fmt.Println("NO")
}

func yesorno(b bool) {
	if b {
		fmt.Println("yes")
		return
	}
	fmt.Println("no")
}

// calc---------------------------------------------------

func abs(a int) int {
	if a > 0 {
		return a
	}
	return -a
}

func ave(a []int) (ave int) {
	for i := 0; i < len(a); i++ {
		ave += a[i]
	}
	ave /= len(a)
	return
}

func eq(a []string, b []string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] != b[i] {
			return false
		}
	}
	return true
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func max(a ...int) int {
	max := a[0]
	for i := 1; i < len(a); i++ {
		if max < a[i] {
			max = a[i]
		}
	}
	return max
}

func min(a ...int) int {
	min := a[0]
	for i := 1; i < len(a); i++ {
		if min > a[i] {
			min = a[i]
		}
	}
	return min
}

func mid(a []int) int {
	sort.Ints(a)
	return a[len(a)/2]
}

func sum(a []int) (ans int) {
	for i := range a {
		ans += a[i]
	}
	return
}


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

int main(){
	int n;
	int ans=0;
	vector <int> p;
	cin>>n;
	for(int i=0;i<n;i++){
		int t;
		cin>>t;
		p.push_back(t);
	}
	for(int i=1;i<n-1;i++){
		if(p[i+1]>p[i]){
			if(p[i-1]<p[i]){
				ans++;
			}
		}else{
			if(p[i-1]>p[i]){
				ans++;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

using namespace std;

using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    ll sum = 0;
    ll ans = 0;
    for (int i = 0, j = 0; i < n; i++) {
        while (j < i) {
            if ((sum & a[i]) == 0) {
                break;
            }
            sum ^= a[j];
            j++;
        }
        sum ^= a[i];
        ans += i - j + 1;
    }
    cout << ans << endl;
    return 0;
}

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

#define debug(x) cerr << #x << ": " << x << endl

int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  string s, t;
  cin >> s >> t;
  map<char, char> mp;
  int n = s.length();
  for (int i = 0; i < n; i++) {
    if (mp.count(s[i]) && mp[s[i]] != t[i]) {
      cout << "No\n";
      return 0;
    }
    mp[s[i]] = t[i];
  }
  for (char c = 'a'; c <= 'z'; c++) {
    for (char d = c + 1; d <= 'z'; d++) {
      if (mp.count(c) && mp.count(d) && mp[c] == mp[d]) {
        cout << "No\n";
        return 0;
      }
    }
  }
  cout << "Yes\n";
  return 0;
}

Measured memory_bytes: 916
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<vector>
 
using namespace std;
 

int main() {
  int x1,y1,x2,y2,x,y;
  cin >> x1 >> y1 >> x2 >> y2;
  x=x2-x1; y=y2-y1;
  cout << x2-y << ' ' << y2+x << ' ' << x1-y << ' ' << y1+x << endl;

}

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

using namespace std;

#define IOS ios::sync_with_stdio(0);cin.tie(0);
#define F first
#define S second
typedef long long ll;

const ll inf = 1e10;

signed main(){
	IOS;
	ll a,b;
	cin>>a>>b;
	cout<<a-b+1<<endl;
	return 0;
}

Measured memory_bytes: 256
def main():
    A, B, C = map(int, input().split())
    K = int(input())
    while B <= A:
        B *= 2
        K -= 1
    while C <= B:
        C *= 2
        K -= 1
    if K >= 0:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()


Measured memory_bytes: 61208
n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

most = 0
cur = 0
tot = 0
for i in range(n):
	if tot + a[i] <= k:
		cur += 1
		tot += a[i]
		if cur > most:
			most = cur
	else:
		i -= 1
		break
j = 0
while j < m:
	if tot + b[j] <= k:
		cur += 1
		tot += b[j]
		if cur > most:
			most = cur
		j += 1
	else:
		if i >= 0:
			cur -= 1
			tot -= a[i]
			i -= 1
		else:
			break
print(most)

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

int n, m;
bool ans[10000000];//1を1日目とする

int main() {
	while (true) {
		cin >> m >> n;
		if (!m && !n)break;

		int num = m;
		for (int i = 0; i < n; i++) {
			if (!ans[num]) {
				for (int j = 1; j*num < 10000000; j++) {
					ans[j*num] = true;
				}
				//numを次のfalseに移動させる必要がある
				for (num; ans[num]; num++);
			}
		}

		for (int i = m; i < 10000000; i++) {
			if (!ans[i]) {
				cout << i << endl;
				break;
			}
		}

		/*for (int i = 1; i < 20; i++) {
			cout << ans[i] << " ";
		}
		cout << endl;*/

		for (int i = 0; i < 10000000; i++) {
			ans[i] = false;
		}
	}
}


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

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

    if (s[0] == s.back())
    {
        if (s.length() % 2 == 0)
            cout << "First";
        else cout << "Second";
    }
    else
    {
        if (s.length() % 2 == 1)
            cout << "First";
        else cout << "Second";
    }

    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <cmath>



using namespace std;



int main(){

  int A[5];
  cin >> A[0] >> A[1] >> A[2] >> A[3] >> A[4];
  int one[5];
  for(int i = 0; i < 5; i++){
    one[i] = A[i] % 10;
  }
  int min = -1, min_val = 10;
  for(int i = 0; i < 5; i++){
    if(min_val > one[i] && one[i] != 0){
      min = i;
      min_val = one[i];
    }
  }
  int total = 0;
  for(int i = 0; i < 5; i++){
    if(i == min){
      total += A[i];
    }else{
      if(one[i] == 0){
        total += A[i];
      }else{
        total += A[i] - one[i] + 10;
      }
    }
  }
  cout << total << endl;


  return 0;
}


Measured memory_bytes: 256
def getN():
    return int(input())

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b

n,m,x,y = getlist()
xs = getlist()
ys = getlist()

maxx = max(xs)
miny = min(ys)

ans = "No War"
#print(maxx,miny)
if maxx >= miny:

    ans = "War"

if maxx>= y:
    ans = "War"

if miny<= x:
    ans = "War"

print(ans)

Measured memory_bytes: 3064
//JSD
#include<iostream>
#include<vector>
#include<set>
#define ll long long 
#include<algorithm>
using namespace std;
int main(){
	string s; set<char > st;
	int n;
	cin>>n;
	ll a[n];
	for(ll i=0;i<n;i++) cin>>a[i];
	ll count=0;
	for(int i=1;i<n-1;i++){
		vector<int > v;
		v.push_back(a[i-1]),v.push_back(a[i]),v.push_back(a[i+1]);;
		sort(v.begin(),v.end());
		if(v[1]==a[i] ) count++;
	}
	cout<<count<<"\n";
	return 0;
}

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



int main(){
  int n, k;
  cin >> n >> k;
  int p[n];
  rep(i, n) cin >> p[i];
  sort(p, p+n);
  int sum = 0;
  rep(i, k) sum += p[i];
  cout << sum << endl;
}

Measured memory_bytes: 3636
n = int(input())
a= [int(input()) for _ in range(n)]

i = 1
ans = 0
while True:
    if a[i-1] == -1:
        print(-1)
        break
    ni = a[i-1]
    a[i-1] = -1
    i = ni
    ans +=1
    if i==2:
        print(ans)
        break

Measured memory_bytes: 7084
def main():
    data = []
    while 1:
        n = input().split()
        ans = int(n[0])

        if ans == 0:
            break

        data.append(ans)


    length = len(data)
    what_large = length > 10000

    if what_large:
        print("Too Large")
    else:
        for i in range(len(data)):
            d_val = data[i]

            if d_val != 0:
                print("Case {0}: {1}".format(i+1,d_val))
            else:
                break

if __name__ == '__main__':
    main()

Measured memory_bytes: 5904
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    string s;
    cin >> s;
    int num = 0;
    for(int i = 0; i < s.length(); i++) {
        if(s[i] == '+') num++;
        else num--;
    }
    
    cout << num << endl;

}

Measured memory_bytes: 256
fun main() {
    val n = readString()
    if (n.contains('7')) println("Yes")
    else println("No")
}

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

Measured memory_bytes: 35692
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
#define ceil(a, b) a / b + !!(a % b)

int main() {
    int n; cin >> n;
    int mmax = 0;
    int sum = 0;
    rep(i, n) {
        int a; cin >> a;
        sum += a;
        mmax = max(mmax, a);
    }
    if (sum - mmax > mmax) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

def solve():
    W, H, x, y = list(map(int, input().split()))
    ans_area = W*H/2
    if x == W/2 and y == H/2:
        can_separate = 1
    else:
        can_separate = 0
    print("{} {}".format(ans_area, can_separate))


if __name__ == "__main__":
    solve()


Measured memory_bytes: 2940
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 11 05:38:56 2019

@author: shinjisu
"""


# ABC 200点問題
import math


def getInt(): return int(input())


def getIntList(): return [int(x) for x in input().split()]


def zeros(n): return [0]*n


def dmp(x):
    global debug
    if debug:
        print(x)


debug = True


def getIntLines(n): return [int(input()) for i in range(n)]


def getIntMat(n):
    mat = []
    for i in range(n):
        mat.append(getIntList())
    return mat


def zeros2(n, m): return [zeros(m)]*n


def prob096():  # Maximum Sum
    X = getIntList()
    K = getInt()
    dmp((X, K))
    total = sum(X) - max(X) + max(X)*2**K
    return total


def prob097():  # Exponential
    X = getInt()
    dmp(X)
    if X == 1:
        return 1
    for n in range(X, 0, -1):
        dmp(n)
        for b in range(2, int(math.sqrt(X))+1):
            a = n
            exp = True
            while a > 1:
                if a % b != 0:
                    exp = False
                    break
                a //= b
            if exp:
                break
        if exp:
            break
    return n


def prob098():  # Cut and Count
    N = getInt()
    S = input()
    dmp((N, S))
    maxChCount = 0
    for i in range(1, N):
        before = S[:i]
        after = S[i:]
        dmp((before, after))
        chCount = 0
        for j in range(26):
            ch = chr(ord('a')+j)
            if ch in before and ch in after:
                chCount += 1
        maxChCount = max(maxChCount, chCount)
    return maxChCount


def prob099():  # Stone Momument
    a, b = getIntList()
    height = 0
    for i in range(b-a+1):
        height += i
    height -= b
    return height


def prob103():  # String Rotation
    S = input()
    T = input()
    for i in range(len(S)):
        S = S[1:] + S[0]
        dmp(S)
        if S == T:
            return 'Yes'
    else:
        return 'No'


def prob110():  # 1 Dimensional World's Tale
    N, M, X, Y = getIntList()
    cX = getIntList()
    cY = getIntList()
    dmp((N, M, X, Y))
    dmp(cX)
    dmp(cY)
    NW = 'No War'
    WA = 'War'
    if Y <= X:
        return WA
    cX.sort()
    cY.sort()
    dmp(cX)
    dmp(cY)
    if cX[-1] < cY[0] and \
            X < cY[0] and \
            cX[-1] < Y:
        return NW
    else:
        return WA


def prob100():  # 
    return 0


debug = False  # True False
print(prob110())


Measured memory_bytes: 3192
#!/usr/bin/python3

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    a, b = map(int, input().split())
    print(ceil(a + b, 2))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3956
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#define N 300020
#define MOD 1000000007
using namespace std;

char a[N];
int f[N][3][3];

inline int Mod(int x)
{
    return x + ((x >> 31) & MOD);
}

inline void Modadd(int &x, int y)
{
    x = Mod(x + y - MOD);

    return;
}

int main(void)
{
    int n;
    int i, j, k;

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

    f[0][0][0] = 1;
    for(i = 0; i < n; i ++)
        for(j = 0; j < 3; j ++)
            for(k = 0; k < 3; k ++)
                if(f[i][j][k])
                {
                    if(a[i] != '1')
                    {
                        if(j == 2)
                            Modadd(f[i + 1][1][k], f[i][j][k]);
                        else
                            Modadd(f[i + 1][j + 1][k], f[i][j][k]);
                    }
                    if(a[i] != '0')
                    {
                        if(j)
                            Modadd(f[i + 1][j - 1][k], f[i][j][k]);
                        else
                            Modadd(f[i + 1][0][min(k + 1, 2)], f[i][j][k]);
                    }
                }
    k = 0;
    // Modadd(k, f[n][0][0]);
    Modadd(k, f[n][0][1]);
    Modadd(k, f[n][0][2]);
    Modadd(k, f[n][1][1]);
    Modadd(k, f[n][1][2]);
    Modadd(k, f[n][2][2]);
    printf("%d\n", k);

    return 0;
}


Measured memory_bytes: 11136
import sys
input=sys.stdin.readline
x,y,a,b,c=map(int,input().split())
arr1=list(map(int,input().split()))
arr2=list(map(int,input().split()))
arr3=list(map(int,input().split()))
arr1.sort(reverse=True)
arr2.sort(reverse=True)
sum=0
for i in range(x):
    arr3.append(arr1[i])
for j in range(y):
    arr3.append(arr2[j])
arr3.sort(reverse=True)
for k in range(x+y):
    sum+=arr3[k]
print(sum)

Measured memory_bytes: 23312
#include<iostream>  
#include<algorithm> 
#include<cstdio>  
#include<cstring>    
using namespace std;  
int n,m,a,b,c,d;
long long sum,ans; 
struct node  
{  
    int w,v;  
}g[110];  
  
bool cmp(node a,node b)  
{  
    return a.v>b.v;  
}  
node A[110],B[110],C[110],D[110];  
  
long long swa[110],swb[110],swc[110],swd[110];  
long long sva[110],svb[110],svc[110],svd[110]; 
  
int main()  
{  
        cin>>n>>m; 
        for(int i=1;i<=n;i++)  
        {  
            cin>>g[i].w>>g[i].v;  
            if(g[i].w==g[1].w) A[++a]=g[i];  
            if(g[i].w==g[1].w+1) B[++b]=g[i];  
            if(g[i].w==g[1].w+2) C[++c]=g[i];  
            if(g[i].w==g[1].w+3) D[++d]=g[i];  
        }  
        sort(A+1,A+a+1,cmp);  
        sort(B+1,B+b+1,cmp);  
        sort(C+1,C+c+1,cmp);  
        sort(D+1,D+d+1,cmp);  
        
        for(int i=1;i<=a;i++)  
        {  
            swa[i]=swa[i-1]+A[i].w;  
            sva[i]=sva[i-1]+A[i].v;  
        }  
        for(int i=1;i<=b;i++)  
        {  
            swb[i]=swb[i-1]+B[i].w;  
            svb[i]=svb[i-1]+B[i].v;  
        }  
        for(int i=1;i<=c;i++)  
        {  
            swc[i]=swc[i-1]+C[i].w;  
            svc[i]=svc[i-1]+C[i].v;  
        }  
        for(int i=1;i<=d;i++)  
        {  
            swd[i]=swd[i-1]+D[i].w;  
            svd[i]=svd[i-1]+D[i].v;  
        }  
    
        for(int i=0;i<=a;i++)  
        for(int j=0;j<=b;j++)  
        for(int k=0;k<=c;k++)  
        for(int l=0;l<=d;l++)  
        {  
        sum=swa[i]+swb[j]+swc[k]+swd[l];  
        if(sum<=m)  
        ans=max(ans,sva[i]+svb[j]+svc[k]+svd[l]);  
              
        }  
        cout<<ans<<endl;  
    
  
    return 0;  
}  

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

int main (){
    int A;
    cin>>A;
    bool T=true;
    if(A<100){
        T=false;
    }
    else if(A<2000){
        T=false;
        for(int i=1; i<21; i++){
            for(int j=i*100; j<i*100+5*i +1; j++){
                if(j==A){
                    T=true;
                    break;
                }
            }
        }

    }
    cout<<(T?1:0)<<endl;
}

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

using namespace std;

int main() {
	int a,b;
	cin >> a >> b;

	if ((a*b) % 2 != 0|| (a*b*2) % 2 != 0|| (a*b*3) % 2 != 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
// Allocation.cs

using System;

class Allocation {
    public static void Main() {

        string[] num = Console.ReadLine().Split(' ');
        int num1 = int.Parse(num[0]);
        int[] list = new int[num1];
        
        for(int i = 0; i < num1; i++) {
            int input = int.Parse(Console.ReadLine());
            list[i] = input;
        }

        int max = 100000 * 10000;
        int min = 1;

        while(max > min) {

            int mid = (min + max) / 2;

            int count = 1;
            int current = 0;
            int m = int.Parse(num[1]);

            for(int i = 0; i < num1; i++) {
                if(list[i] > mid) {
                    count = m + 1;
                    break;
                }

                if(current + list[i] > mid) {
                    count++;
                    current = list[i];
                } else {
                    current += list[i];
                }
            }
            
            if(count <= m) max = mid;
            else min = mid + 1;
        }

        Console.WriteLine(max);

    }
}

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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<lli> point;

template<typename P, typename Q>
ostream& operator << (ostream& os, pair<P, Q> p)
{
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n, k;
  while (cin >> n >> k) {
    vector<point> v;
    for (int i = 0; i < n; ++i) {
      int x, y;
      cin >> x >> y;
      v.push_back(point(x, y));
    }

    sort(v.begin(), v.end(), [] (point a, point b) { return a.imag() < b.imag(); });
    // cout << endl; each (i, v) cout << i << endl; 

    // +--d---+
    // |      |
    // a      b
    // |      |
    // +----c-+
    ull mn = 1ULL << 63;
    for (int a = 0; a < n; ++a) {
      for (int b = 0; b < n; ++b) {
        if (a == b) continue;
        for (int c = 0; c < n; ++c) {
          unless (v[a].real() <= v[c].real() && v[c].real() <= v[b].real()) continue;
          unless (min(v[a].imag(), v[b].imag()) >= v[c].imag()) continue;
          int cnt = 0;
          for (int d = c; d < n; ++d) {
            unless (v[a].real() <= v[d].real() && v[d].real() <= v[b].real()) continue;
            ++cnt;
            if (k <= cnt) {
              ull s = labs(v[a].real() - v[b].real());
              ull t = labs(v[c].imag() - v[d].imag());
              // cout << v[a] << " - " << v[b] << endl;
              // cout << v[c] << " - " << v[d] << endl;
              // cout << s * t << endl;
              mn = min(mn, s * t);
            }
          }
        }
      }
    }
    cout << mn << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n=int(input())
XY=[]
for i in range(n):
  x,y=map(int,input().split())
  XY.append((x,y))
ans=0

def dist(a,b):
  ax,ay=a
  bx,by=b
  return ((ax-bx)**2+(ay-by)**2)**0.5

import itertools
for c in itertools.combinations(range(n),2):
  ans+=dist(XY[c[0]],XY[c[1]])
ans=ans*2/n
print(ans)


Measured memory_bytes: 3064
#include<cctype>
#include<cstdio>
#include<cstring>
#include<iostream>

char ch[15];

int getint(){
	int x=0,f=0;char ch=getchar();
	while(!isdigit(ch)) f|=ch=='-',ch=getchar();
	while(isdigit(ch)) x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}

signed main(){
	scanf("%s",ch+1);
	int len=strlen(ch+1);
	if(ch[1]!='A'){
		printf("WA");
		return 0;
	}
	int flag=0;
	for(int i=3;i<len;i++){
		if(ch[i]>='A' and ch[i]<='Z' and ch[i]!='C'){
			printf("WA");
			return 0;
		}
		if(ch[i]=='C'){
			if(!flag) flag=1;
			else{
				printf("WA");
				return 0;
			}
		}
	}
	if(!flag) printf("WA");
	else if(ch[2]>='A' and ch[2]<='Z' or ch[len]>='A' and ch[len]<='Z') printf("WA");
	else printf("AC");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<ll,ll> > vpll;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
typedef map<int, int> mii;
typedef set<int> si;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
// #define endl '\n';
#define fi first
#define se second
#define NONVOID [[nodiscard]]
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
template <class T> inline void dump(T &v){irep(i, v){cout<<*i<<((i==--v.end())?'\n':' ');}}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;



int main() {

    int m;
    cin>>m;
    ll ans=0;
    ll t=0;
    ll num=0;
    rep(i,m){
        ll d,c;
        cin>>d>>c;
        ans+=(d*c+t);
        num+=c;
    }
    fin(((ans%9==0)?ans/9-1:ans/9)+(num-1));
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>

struct edge_t {
	int32_t to;
	int64_t cost;
};

void addEdge(int32_t* pEdgeCount, struct edge_t** pEdges, int32_t to, int64_t cost) {
	struct edge_t* asumikana = realloc(*pEdges, sizeof(**pEdges) * (*pEdgeCount + 1));
	if (asumikana == NULL) exit(2);
	asumikana[*pEdgeCount].to = to;
	asumikana[*pEdgeCount].cost = cost;
	(*pEdgeCount)++;
	*pEdges = asumikana;
}

int32_t N;
int32_t edgeCount[114514];
struct edge_t* edges[114514];
int32_t Q, K;
int32_t x[114514], y[114514];

struct edge_t parents[114514][20];
int32_t depth[114514];

void dfs(int32_t node, int32_t parent, int32_t currentDepth) {
	int32_t i;
	depth[node] = currentDepth;
	for (i = 0; i < edgeCount[node]; i++) {
		int32_t next = edges[node][i].to;
		if (next != parent) {
			parents[next][0].to = node;
			parents[next][0].cost = edges[node][i].cost;
			dfs(next, node, currentDepth + 1);
		}
	}
}

void koutiku(void) {
	int i;
	for (i = 1; i < 20; i++) {
		int32_t j;
		for (j = 1; j <= N; j++) {
			parents[j][i].to = parents[parents[j][i - 1].to][i - 1].to;
			parents[j][i].cost = parents[j][i - 1].cost + parents[parents[j][i - 1].to][i - 1].cost;
		}
	}
}

int32_t go_n(int64_t* cost, int32_t node, int32_t count) {
	int64_t c = 0;
	int i;
	for (i = 0; i < 20 && count > 0; i++, count >>= 1) {
		if (count & 1) {
			c += parents[node][i].cost;
			node = parents[node][i].to;
		}
	}
	if (cost != NULL) *cost = c;
	return node;
}

int32_t lca(int64_t* cost, int32_t a, int32_t b) {
	int64_t gap_cost = 0;
	if (depth[a] > depth[b]) {
		a = go_n(&gap_cost, a, depth[a] - depth[b]);
	} else if (depth[a] < depth[b]) {
		b = go_n(&gap_cost, b, depth[b] - depth[a]);
	}
	if (a == b) {
		if (cost != NULL) *cost = gap_cost;
		return a;
	} else {
		int32_t ng = 0, ok = N;
		int64_t a_cost, b_cost;
		int32_t answer;
		while (ng + 1 < ok) {
			int32_t mid = ng + (ok - ng) / 2;
			if (go_n(NULL, a, mid) == go_n(NULL, b, mid)) ok = mid; else ng = mid;
		}
		answer = go_n(&a_cost, a, ok);
		go_n(&b_cost, b, ok);
		if (cost != NULL) *cost = gap_cost + a_cost + b_cost;
		return answer;
	}
}

int main(void) {
	int32_t i;
	if (scanf("%" SCNd32, &N) != 1) return 1;
	for (i = 1; i < N; i++) {
		int32_t a, b;
		int64_t c;
		if (scanf("%" SCNd32 "%" SCNd32 "%" SCNd64, &a, &b, &c) != 3) return 1;
		addEdge(&edgeCount[a], &edges[a], b, c);
		addEdge(&edgeCount[b], &edges[b], a, c);
	}
	if (scanf("%" SCNd32 "%" SCNd32, &Q, &K) != 2) return 1;
	for (i = 0; i < Q; i++) {
		if (scanf("%" SCNd32 "%" SCNd32, &x[i], &y[i]) != 2) return 1;
	}
	parents[1][0].to = 1;
	parents[1][0].cost = 0;
	dfs(1, 0, 0);
	koutiku();
	for (i = 0; i < Q; i++) {
		int32_t node_xy, node_xk, node_ky;
		int64_t cost_xy, cost_xk, cost_ky;
		node_xy = lca(&cost_xy, x[i], y[i]);
		node_xk = lca(&cost_xk, x[i], K);
		node_ky = lca(&cost_ky, K, y[i]);
		if ((node_xy == node_xk && node_ky == K) || (node_xy == node_ky && node_xk == K)) {
			/* Kはx→yの最短経路の途中にある */
			printf("%" PRId64 "\n", cost_xy);
		} else {
			/* そうではない */
			printf("%" PRId64 "\n", cost_xk + cost_ky);
		}
	}
	return 0;
}


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

using namespace std;

int a[1005];

int main (){
    int n , k;
    cin >> n >> k;
    for(int i = 0; i < n; ++i) cin >> a[i];
    sort(a , a + n);
    int sum = 0;
    for(int i = 0; i < k; ++i) sum+=a[i];
    cout << sum << endl;
}


Measured memory_bytes: 3600
#include<cstdio>
#define mod 1000000007
using namespace std;
int a[1005][1005],n,m;
int main()
{
	scanf("%d%d",&n,&m);
	a[1][0]=1;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			char temp;
			scanf(" %c",&temp);
			if(temp=='.') a[i][j]=(a[i-1][j]+a[i][j-1])%mod;
		}
	}
	printf("%d",a[n][m]);
}

Measured memory_bytes: 4096
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

ll S;
pll a[3];

bool cmp(const pll &v, const pll &u) {
	return v.first - v.second < u.first - u.second;
}

ll solve3() {
	for (int i = 0; i < 3; i++) {
		if (a[i].first > a[i].second)
			swap(a[i].first, a[i].second);
	}
	ll ans = 0;
	for (ll x = 0; a[0].first * x <= S; x++)
		for (ll y = 0; a[0].first * x + a[1].first * y <= S; y++) {
			ll z = (S - a[0].first * x - a[1].first * y) / a[2].first;
			ans = max(ans, S + x * (a[0].second - a[0].first) + y * (a[1].second - a[1].first) + z * (a[2].second - a[2].first));
		}
	return ans;
}

ll solve2(ll M, pll v, pll u) {
//	cerr << M << endl;
	if (v.first > v.second) swap(v.first, v.second);
	if (u.first > u.second) swap(u.first, u.second);
	ll ans = 0;
	for (ll x = 0; x * v.first <= M; x++) {
		ll y = (M - x * v.first) / u.first;
		ans = max(ans, M + x * (v.second - v.first) + y * (u.second - u.first));
	}
	return ans;
}

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%lld", &S);
	for (int i = 0; i < 3; i++)
		scanf("%lld", &a[i].first);
	for (int i = 0; i < 3; i++)
		scanf("%lld", &a[i].second);
	sort(a, a + 3, cmp);

	ll ans = 0;
	if (a[0].first > a[0].second) {
		ans = solve3();
	} else if (a[1].first > a[1].second) {
		ans = solve2((S / a[0].first) * a[0].second + (S % a[0].first), a[1], a[2]);
	} else if (a[2].first > a[2].second) {
		ll cur = solve2(S, a[0], a[1]);
		ans = (cur / a[2].second) * a[2].first + (cur % a[2].second);
	} else {
		ans = solve3();
	}
	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 256
//arc081 q2
#include <cstdio>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <tuple>
#include <deque>
#define pb push_back
#define pf push_front
#define mkt make_tuple
#define pqueue priority_queue
#define rep(i, n) for(long long int i = 0; i < n; i++)
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
const int INF =  2147483647;
const ll INFLL = 9223372036854775807;
const ll MOD = 1e9+7;


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

  ll ans = 1, i = 0;
  int n;
  bool prev;
  string s1, s2;

  cin >> n >> s1 >> s2;

  if (s1[i] == s2[i]) {
    ans = 3;
    prev = true;
    i++;
  } else {
    ans = 6;
    prev = false;
    i += 2;
  }

  for (; i < n; i) {
    ll ptn;
    if (s1[i] == s2[i]) {
      ptn = prev ? 2:1;
    } else {
      ptn = prev ? 2:3;
    }
    prev = s1[i] == s2[i];
    ans = (ans * ptn) % MOD;
    i += prev ? 1:2;
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int get2( int x ){
	int ans = 0;
	while( x % 2 == 0 ){
		x /= 2;
		ans++;
	}
	return ans;
}
int main(){
	int n , ans = 0 , anss;
	cin >> n;
	for( int i = 1 ; i <= n ; i++ ){
		if( get2(i) >= ans ){
			anss = i;
			ans = get2(i);
		}
	}
	cout << anss << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>

using namespace std;
typedef long long LL;

int main() {
    int n;
    cin >> n;
    int digit = n % 10;
    if (digit == 2 || digit == 4 || digit == 5 || digit == 7 || digit == 9) {
        cout << "hon" << endl;
    } else if (digit == 0 || digit == 1 || digit == 6 || digit == 8) {
        cout << "pon" << endl;
    } else {
        cout << "bon" << endl;
    }
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<ll> vi;
const int MW = 1e5+1;
const int MN = (1<<18) + 1;

vi dp[513];
int V[MN], W[MN];

int f(int v, int L) {
	if(v <= 512) return dp[v][L];
	int ans = f(v/2, L);
	if(W[v] <= L) ans = max(ans, V[v]+f(v/2, L-W[v]));
	return ans;
}

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

	int N;
	cin >> N;
	for(int i = 1; i <= N; ++i) cin >> V[i] >> W[i];

	dp[0] = vi(MW, 0);
	for(int i = 1; i <= min(N, 512); ++i) {
		dp[i] = vi(MW);
		int j = i/2;
		for(int w = 0; w < MW; ++w) dp[i][w] = dp[j][w];
		for(int w = W[i]; w < MW; ++w) dp[i][w] = max(dp[i][w], V[i]+dp[j][w-W[i]]);
	}

	int Q;
	cin >> Q;
	while(Q--) {
		int v, L;
		cin >> v >> L;
		cout << f(v, L) << "\n";
	}

	return 0;
}

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

class BIT{
public:
  ll n,bit[555555];
  BIT(){fill(bit,bit+555555,0);}
  void add(ll i,ll x){
    while(i<=n){
      bit[i]+=x;
      i+=i&-i;
    }
  }
  ll sum(ll i){
    ll s=0;
    while(i>0){
      s+=bit[i];
      i-=i&-i;
    }
    return s;
  }
};

ll ans,c[26];
int main() {
  string s;
  cin >> s;
  BIT b=BIT();
  b.n=1<<19;
  vector<ll> v[26];
  for(int i=0; i<s.size(); i++) v[s[i]-'a'].push_back(i);
  for(int t=0; t<s.size()/2; t++) {
    ll M=1LL<<60,k,n=s.size();
    for(int i=0; i<26; i++) {
      if(c[i]>=v[i].size()/2) continue;
      ll x=v[i][c[i]]-b.sum(v[i][c[i]]+1);
      ll y=(n-1-v[i][v[i].size()-1-c[i]])-b.sum(n+1)+b.sum(v[i][v[i].size()-1-c[i]]+1);
      if(M>x+y) {
        M=x+y;
        k=i;
      }
    }
    if(M==1LL<<60) {
      cout << -1 << endl;
      return 0;
    }
    ans+=M;
    b.add(v[k][c[k]]+1,1);
    b.add(v[k][v[k].size()-1-c[k]]+1,1);
    c[k]++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 12052
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(_,v.size())cout<<" "<<v[_];cout<<endl;
#define show2d(v) rep(_,v.size()){rep(__,v[_].size())cout<<" "<<v[_][__];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int> tp;
// typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,1,-1,1,-1};//RDLU
int main(){
	int a;
	cin>>a;
	if(a-1){
		int b;
		cin>>a>>b;
		cout<<a+b<<endl;
	}else cout<<"Hello World"<<endl;
	
	/*
	int n;
	cin>>n;
	vvi in(n,vi(3));
	rep(i,n)rep(j,3)cin>>in[i][j];
	rep(i,101)rep(j,101){
		vi t(n);
		rep(k,n)if(in[k][2]){
			int w=abs(i-in[k][0])+abs(j-in[k][1])+in[k][2];
			t[k]=w;
		}
		sort(all(t));
		if(t[0]!=t[n-1])continue;
		cout<<i<<" "<<j<<" "<<t[0]<<endl;
		
	}
	
	*/
}

/*
int n,m;
vvi nex[2],dp(2);
vi in;
void f(int a){
	int N=-1,t=m;
	while(t){
		vi dp(n,-1);
		int w=0;
		rep(i,n)if(dp[i]==-1){
			int l=i,r=i+1;
			while(r<n&&in[r]-in[r-1]<=t)r++;
			loop(j,l,r)dp[j]=r;
		}
		nex[a].pb(dp);
		t/=2;
		N++;
	}
	dp[a]=vi(1<<N,-1);
	dp[a][0]=0;
	rep(i,1<<N)if(dp[a][i]-n)rep(j,N)if((i&1<<j)==0)cmax(dp[a][i|1<<j],nex[a][j+1][dp[a][i]]);
}
int main(){
	cin>>n>>m;
	in=vi(n);
	rep(i,n)cin>>in[i];
	
	f(0);
	rep(i,n)in[i]*=-1;
	sort(all(in));
	f(1);
	
	rep(i,n){
		int l=n-nex[1][0][i]-1,r=nex[0][0][i];
		bool h=false;
		
	}
	
}
*/








Measured memory_bytes: 256
a,b = input().split()
#浮動小数点には誤差が含まれているため文字列で扱って、bを100倍にして乗算してから100で割った商を求める。
#ex b=9.99 "{:.20f}".format(b)→'9.99000000000000021316'
p = int(a)
q = int(b[0]+b[2]+b[3])
print(p*q//100)

Measured memory_bytes: 9060
#include<iostream>
#include<cstdio>
using namespace std;
int n,B,W;
const int N=300010;
int a[N],sum[N];
int check(int mid)
{
	int mn=0;
	for(int i=2;i<n;++i)
		if(mn<=sum[i-1]-mid)mn=min(mn,sum[i]);
	return mn<=sum[n]-mid;
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;++i)
	{
		scanf("%d",&a[i]);sum[i]=sum[i-1];
		if(i&1)B+=a[i],sum[i]+=a[i];
		else W+=a[i],sum[i]-=a[i];
	}
	if(!(n&1))return printf("%d %d",max(B,W),min(B,W))==2333;
	int L=-3e8,R=3e8,pos=0,ans;
	while(L<=R)
	{
		int mid=(L+R)/2;
		if(check(mid))pos=mid,L=mid+1;
		else R=mid-1;
	}
	ans=max(W+pos,B);
	cout<<ans<<" "<<W+B-ans;
	return 0;
}

Measured memory_bytes: 2560
#define FOR(i, min, max) for(int (i) = (min); (i) < (max); (i)++)

#include <utility>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;

int main()
{
	int n, ans, v[200000], pre = 0, pro = 0;
	cin >> n;
	FOR(i, 0, n)
	{
		cin >> v[i];
	}
	ans = v[1] - v[0];

	FOR(i, 0, n)
	{
		if (v[i] <= v[pre])
			if (pro <= i)
			{
				FOR(j, i + 1, n)
				{
					if (v[j] - v[i] > ans)
					{
						ans = v[j] - v[i];
						pre = i;
						pro = j;
					}
				}
			}
			else
			{
				ans = v[pro] - v[i];
				pre = i;
			}
	}
	cout << ans << endl;
	return 0;
}

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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

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

  string s;
  cin >> s;

  ll c = 0;
  ll a = 0;
  for (ll i = 0; i < n; ++i) {
    if (s[i] == ')') {
      if (c == 0) ++a;
      else c--;
    }
    if (s[i] == '(') c++;
  }

  c = 0;
  ll b = 0;
  for (ll i = n-1; i >= 0; --i) {
    if (s[i] == '(') {
      if (c == 0) ++b;
      else c--;
    }
    if (s[i] == ')') c++;
  }

  for (ll i = 0; i < a; ++i) cout << '(';
  cout << s;
  for (ll i = 0; i < b; ++i) cout << ')';
  
  return 0;
}


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

int main()
{
	string n;
	cin>>n;
	
	if((n[0]==n[1]&&n[1]==n[2])||(n[1]==n[2]&&n[2]==n[3])) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
	return 0;
}


Measured memory_bytes: 256
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10 ** 5 + 1)

N,M = map(int,readline().split())

G = [[] for i in range(N)]

for i in range(M):
  x,y = map(int,readline().split())
  G[x - 1].append(y - 1)

dp = [-1] * N

def rec(v):
  if dp[v] != -1:
    return dp[v] # 更新済み
  
  res = 0
  for child in G[v]:
    res = max(res, rec(child) + 1)
    
  dp[v] = res
  return res

res = 0
for v in range(N):
  res = max(res, rec(v))
  
print(res)

Measured memory_bytes: 61128
fun ceilDiv(t : Int, d : Int) : Int{
    return if(t % d > 0) t / d + 1 else t / d
}

fun battle(attacker : Int, lThrow : MutableList<Int>, h : Int, n : Int) : Int{
    var cnt = 0
    var hp = h
    for(i in 0..(n - 1)){
        if(attacker > lThrow[i]) break
        hp -= lThrow[i]
        cnt++
        if(hp <= 0) break
    }
    if(hp <= 0) return cnt

    return cnt + ceilDiv(hp, attacker)
}

fun main(args: Array<String>){
    val (n, h) = readLine()!!.split(" ").map(String::toInt)

    val lAttack = mutableListOf<Int>()
    val lThrow = mutableListOf<Int>()
    for(i in 0..(n-1)){
        val (at, th) = readLine()!!.split(" ").map(String::toInt)
        lAttack.add(at)
        lThrow.add(th)
    }

    lAttack.sortDescending()
    val attacker = lAttack[0]

    lThrow.sortDescending()
    println(battle(attacker, lThrow, h, n))
}

Measured memory_bytes: 60432
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    int m, d;
    cin >> m >> d;
    int ret = 0;
    for (int i = 4; i <= m; ++i) {
        for (int j = 22; j <= d; ++j) {
            int dig1 = j % 10;
            int dig10 = j / 10;
            if (dig1 >= 2 && dig10 >= 2 && i == dig1 * dig10)
                ret++;
        }
    }
    cout << ret << "\n";
    return 0;
}

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

int main() {
	int A,B,C,D;
	cin >> A >> B >> C >> D;
	if (A*B >= C*D) { cout << A*B << endl;}
	if (A*B < C*D) { cout << C*D << endl; }
	return 0;
}


Measured memory_bytes: 256