akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <deque>
#include <bits/stdc++.h>
//#include "testlib.h"
using namespace std;
#define ll long long
#define pii pair<int,int>
#define qi ios::sync_with_stdio(0)

bool debug=true;

/*    *************************************
	  * Written in New Computer           *
	  * The following code belongs to     *
	  * XiaoGeNintendo of HellHoleStudios *
	  *************************************
*/
template<typename T1,typename T2>ostream& operator<<(ostream& os,pair<T1,T2> ptt){
	os<<ptt.first<<","<<ptt.second;
	return os;
}
template<typename T>ostream& operator<<(ostream& os,vector<T> vt){
	os<<"{";
	for(int i=0;i<vt.size();i++){
		os<<vt[i]<<" ";
	}
	os<<"}";
	return os;
}

int n,m;
int main(int argc,char* argv[]){
	cin>>n>>m;
	int x=0;
	for(int i=1;i<=n;i++){
		for(int j=10;j<=m;j++){
			if((j/10)*(j%10)==i && j/10>=2 && j%10>=2){
				x++;
			}
		}
	}
	
	cout<<x<<endl;
	return 0;
}



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

ll mod=1000000007;

int main(){
    ll n,c,k;
    cin>>n>>c>>k;
    vector<ll> t(n);
    for(ll i=0;i<n;++i){
        cin>>t[i];
    }
    sort(t.begin(),t.end());
    
    ll ans=0,cnt=0,mi=0;
    for(ll i=0;i<n;++i){
        cnt++;
        if(cnt>c||t[mi]+k<t[i]){
            cnt=1;
            ans++;
            mi=i;
        }
    }
    if(cnt>0){
        ans++;
    }
    cout<<ans;
    return 0;
}

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

int main() {
  string forecast;
  cin >> forecast;
  string result;
  cin >> result;
  int sum = 0;
  for (int i = 0; i < forecast.size(); ++i) {
    if (forecast[i] == result[i]) {
      ++sum;
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
/*
  素数（n 個の整数を読み込み、
  それらに含まれる素数の数を出力するプログラム）
  2018/03/23
*/

#include<stdio.h>

int search_primenumbers(int num)
{
  int flag = 1;/*１：素数、０：素数ではない*/

  if(num <= 2 || num%2 == 0)
    {/*０、１、２の倍数とそれ以外の自然数を区別*/
    if(num != 2)
      flag = 0;
    }
  else
    {
      int i = 3;
      /*３から√numまで*/
      while(i*i <=num && flag ==1){
	if(num % i == 0)
	  flag =0;
	i += 2;
      }
    }
  return flag;
}

int main(void)
{
  int n;
  int num;/*整数*/
  int count=0;/*素数の数*/
  int i;
  fscanf(stdin,"%d",&n);
  for(i=1;i<=n;i++){
    fscanf(stdin,"%d",&num);
    count += search_primenumbers(num);
  }
  fprintf(stdout,"%d\n",count);
  return 0;
}


Measured memory_bytes: 2040
#[allow(unused_imports)]
use std::cmp::max;
#[allow(unused_imports)]
use std::fmt;
#[allow(unused_imports)]
use std::fmt::Debug;
#[allow(unused_imports)]
use std::io;
#[allow(unused_imports)]
use std::str::FromStr;

fn main() {
    loop {
        let input: Vec<String> = get_vec_input();
        let s = input[0].to_string();
        if s == "0" {
            break;
        } else {
            println!("{}", sum_digit2(s));
        }
    }
}

#[allow(dead_code)]
fn sum_digit2(value: String) -> u32 {
    return value.chars().fold(0u32, |a, b| a + b.to_digit(10).unwrap());
}

#[allow(dead_code)]
fn sum_digit(value: i64) -> i64 {
    if value < 10 {
        return value;
    }
    return sum_digit(value / 10) + value % 10;
}

#[allow(dead_code)]
fn update_max<T>(left: &mut T, right: T)
where
    T: std::cmp::Ord + std::clone::Clone,
{
    if *left < right {
        *left = right.clone();
    }
}

#[allow(dead_code)]
fn update_min<T>(left: &mut T, right: T)
where
    T: std::cmp::Ord + std::clone::Clone,
{
    if *left > right {
        *left = right.clone();
    }
}

#[allow(dead_code)]
fn get_vec_input<T>() -> Vec<T>
where
    T: FromStr,
    T::Err: Debug,
{
    let mut input = String::new();
    io::stdin()
        .read_line(&mut input)
        .expect("Failed to read line");
    let vec: Vec<T> = input
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();
    vec
}

#[allow(dead_code)]
fn get_tuple_input() -> (u64, f32) {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    let mut iter = s.trim().split_whitespace();
    let c: u64 = iter.next().unwrap().parse().unwrap();
    let n: f32 = iter.next().unwrap().parse().unwrap();
    (c, n)
}



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

int main() {

ll a,b,v,w,t;
cin >> a >> v >>b>> w>>t;
if(abs(a-b)<=t*(v-w))cout<<"YES"<<endl;//間の距離

else{cout<<"NO"<<endl;}


}
/*vector <int> a(3);
for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }*/

Measured memory_bytes: 3624
function main(input) {
  var args = input.split("\n");
  var a = parseInt(args[0], 10);
  var b = parseInt(args[1], 10);
  var c = parseInt(args[2], 10);
  var d = parseInt(args[3], 10);
  var e = parseInt(args[4], 10);
  var k = parseInt(args[5], 10);

  if(e-a<=k){
	if(e-b<=k){
      if(e-c<=k){
        if(e-d<=k){
          if(d-a<=k){
            if(d-b<=k){
              if(d-c<=k){
                if(c-a<=k){
                  if(c-b<=k){
                    if(b-a<=k){
                      console.log("Yay!");
		            }else{
		              console.log(":(");
		            }
                  }else{
		            console.log(":(");
		          }
                }else{
		         console.log(":(");
		        }
              }else{
		        console.log(":(");
		      }
            }else{
		      console.log(":(");
		    }
          }else{
		    console.log(":(");
		  }
        }else{
		  console.log(":(");
		}
      }else{
		console.log(":(");
      }
    }else{
	  console.log(":(");
	}
  }else{
	console.log(":(");
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    H, W, A, B = map(int, input().split())
        
    res = []
    L1 = ["1"] * A + ["0"] * (W - A)
    for _ in range(B):
        res.append("".join(L1))
    L2 = ["0"] * A + ["1"] * (W - A)
    for _ in range(H - B):
        res.append("".join(L2))
    print(*res, sep="\n")


if __name__ == '__main__':
    resolve()


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

using namespace std;

int N, M;
int pre[2005][2005], suf[2005][2005], up[2005][2005], down[2005][2005];

int main(){
    cin >> N >> M;
    for(int i = 1; i<=N; i++){
        string s;
        cin >> s;
        for(int j = 1; j<=M; j++){
            suf[i][j] = down[i][j] = N*M + 100;
            if(s[j-1] == '#'){
                pre[i][j] = suf[i][j] = j;
                up[i][j] = down[i][j] = i;
            }
        }
    }
    for(int i = 1; i<=N; i++){
        pre[i][M+1] = suf[i][M+1] = M+1;
    }
    for(int j = 1; j<=M; j++){
        up[N+1][j] = down[N+1][j] = N+1;
    }
    for(int i = 1; i<=N; i++){
        for(int j = 1; j<=M; j++){
            pre[i][j] = max(pre[i][j-1], pre[i][j]);
            up[i][j] = max(up[i-1][j], up[i][j]);
        }
    }
    for(int i = N; i>0; i--){
        for(int j = M; j>0; j--){
            down[i][j] = min(down[i+1][j], down[i][j]);
            suf[i][j] = min(suf[i][j+1], suf[i][j]);
        }
    }
    int ans = 0;
    for(int i = 1; i<=N; i++){
        for(int j= 1; j<=M; j++){
            ans = max(ans, suf[i][j] - pre[i][j] + down[i][j] - up[i][j] - 3);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 62976
/*Author SHUBH AGRAWAL  */

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pu push  //  adds the value to the last of the queue 
#define lld long long int
#define ins insert /// used in set to insert the values 
#define adv advance  /// used to increment the iterator
#define mp make_pair
#define fi first
#define se second
#define all(c) c.begin(),c.end()
#define PI 3.1415926
//a power n mod p

#define vl  vector<long long int >
#define vpl vector< pair<lld ,lld> >
#define vvl vector<vector<lld> > 

long long int modp(lld a,lld p,lld n)
{
    int d[100];
    int i,j,k,l;
    if(n==0) return 1;
    for(i=0;n>=1;i++)
    {
        d[i]=n%2;
        n/=2;
    }
    l=i;
    long long int e=1;
    if(d[0]==1) e*=(a%p);
    for(i=1;i<l;i++)
    {
        a*=a;
        a=a%p;
        if(d[i]==1) 
        {
            e*=a;
            e=e%p;
        }
    }
    return e%p;
}
lld modInverse(lld n, lld p) 
{ 
    return modp(n, p, p-2); 
}

long long int nCrModPFermat(lld n, lld r,lld p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
    
    // Fill factorial array so that we 
    // can find all factorial of r, n 
    // and n-r 
    lld fac[n+1]; 
    fac[0] = 1; 
    for (lld i=1 ; i<=n; i++) 
        fac[i] = fac[i-1]*i%p; 
  
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
}


long long int gcd(lld b,lld a)
{
    if(a<b) return gcd(a,b);
    if(a%b==0) return b;
    return gcd(a%b , b);
}


lld l,r,mid,ans;
lld n,m,i,j,k;
lld x,y,d;
vector< pair< pair< lld,lld> ,lld > > v;
void solve()
{
    cin>>m>>d;
    ans=0;
    for(i=1;i<=d;i++)
    {
        x=i/10;
        y=i%10;
        ans+=1;
        if(x<=1) ans-=1;
        else if(y<=1) ans-=1;
        else if(x*y > m)
        {
            ans-=1;
        }
    }    
    cout<<ans;

}

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

Measured memory_bytes: 256
// JavaScript source code
"use strict";

function main(input) {
    input = input.split(" ");
    for (let i = 0; i < 5; i++) {
        if (input[i] == 0) {
            console.log(i + 1);
            break;
        }
    }
};

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

Measured memory_bytes: 30624
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
   int a;
   cin>>a;
   vector<int> vec(a);
   rep(i,a){
      cin>>vec.at(i);
   }
   bool flag=true;
   int pre=-666;
   rep(i,a){
      if(pre<=vec.at(i)-1){
         pre=vec.at(i)-1;
      }
      else{
         if(pre<=vec.at(i)){
            pre=vec.at(i);
         }
         else{
            flag=false;
            break;
         }
      }
   }
   if(flag){
      cout<<"Yes"<<endl;
  }
   else{
      cout<<"No"<<endl;
   }   

}



Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define mp make_pair
#define PI pair<int,int>
#define poly vector<ll>
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
#define pb push_back
#define fi first
#define se second
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
     if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
const int N=19;
ll a[N];
map<pair<ll,ll>,ll> M[N][N];
ll solve(int l,int r,ll xl,ll xr){
	if(l+1==r)return 0;
	auto it=M[l][r].find(mp(xl,xr));
	if(it!=M[l][r].end())return it->second;
	ll ans=1e18;
	For(i,l+1,r-1)ans=min(ans,solve(l,i,xl,xl+xr)+solve(i,r,xl+xr,xr)+a[i]*(xl+xr));
	return ans;
}
int main(){
	int n=read();
	For(i,1,n)a[i]=read();
	cout<<solve(1,n,1,1)+a[1]+a[n]<<endl;
}

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

int main() 
{
    int i,n,x;
    cin >> n;
    S[0] = true;
    int sum = 0,rs=0;
    for(i=0;i<n;i++)
    {
        cin >> x;
        sum += x;
        S = S|(S<<x);
    }
    rs = (sum+1)/2;
    //cout << sum << " " << rs<< " ";
    for(i=1;i<=sum;i++)
    {
        if(S[i] and i>=rs)
            break;
    }
    //cout << S[2] << " ";
    cout << i << endl;
	return 0;
}


Measured memory_bytes: 2176
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <functional>
#include <initializer_list>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}

int main() {
  LL n;
  cin >> n;
  LL M = 1e9 + 7;
  LL ans = 1;
  REPC(i,1,n){
    ans = (ans*i)%M;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

    public String next() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    int n = sc.nextInt();
    System.out.println(n % 1000 == 0 ? 0 : 1000 - (n % 1000));
  }
}

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

int dp[100];

//最大公約数
int gcd(int x, int y){
  if(x % y == 0) return 1;
  return gcd(y, x % y);
}
//最小公倍数
int lcm(int x, int y){
  return x * y / gcd(x, y);
}
//フィボナッチ数列
//配列dpを-1で初期化する
int fib(int n){
  if(n == 0 || n == 1) return dp[n] = 1;
  if(dp[n] != -1) return dp[n];
  return dp[n] = fib(n - 1) + fib(n - 2);
}
//階乗計算(factorial)
int fact(int n){
  if(n = 1) return 1;
  return n * fact(n - 1);
}
//累乗計算(Exponentiation)
//x**y
ll expo(int x, int y){
  ll ans = 1;
  rep(i, y){
    ans *= x;
  }
  return ans;
}
//桁数
int keta(ll x){
  if(x == 0) return 1;
  int res = 0;
  while(x){
    x /= 10;
    res++;
  }
  return res;
}


int main(){
  char s[4];
  rep(i, 4) cin >> s[i];

  rep(i,3){
    if(s[i] == s[i+1]){
      cout << "Bad" << endl;
      return 0;
    }
  }
  cout << "Good" << endl;
}


/*





















*/


Measured memory_bytes: 256
import itertools
N, M = map(int, input().split())
E = set([tuple(sorted(map(int, input().split()))) for x in range(M)])
cnt = 0
for i in itertools.permutations(range(2,N+1), N-1):
    l = [1]+list(i)
    if sum(1 for x in range(N-1) if tuple(sorted(l[x:x+2])) in E) == N-1:
        cnt += 1
print(cnt)

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

int main(){
    int n,a,b;
    cin>>n>>a>>b;
    int ans=0;
    for(int i=1;i<=n;i++){
        int x=i;
        int num=0;
        while(x>0){
            num+=x%10;
            x/=10;
        }
        if(num>=a&&num<=b)ans+=i;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>

#define N 200000

long a[N+1];

int main(void){
    long n;
    scanf("%ld", &n);
    a[0] = -1;
    for(long i=1; i<=n; i++){
        scanf("%ld", a+i);
    }
    long count=-1;
    for(long i=n; i>=1; i--){
        long d = a[i]-a[i-1];
        if(d>=2){
            puts("-1");
            return 0;
        }else if(d==1){
            count++;
        }else{
            count += a[i];
        }
    }
    printf("%ld\n", count);
    return 0;
}



Measured memory_bytes: 1792
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353

a, b, x = map(int, input().split())

if x <= a**2*b/2.0:
    print(math.atan(a*b**2/(2.0*x))*180/math.pi)
else:
    z = a**2*b - x
    print(math.atan((2.0*z)/(a**3))*180/math.pi)



Measured memory_bytes: 77508
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007



int main() {
  
  string S;
  cin >> S;
 
  int N = S.size();
  vector<int> ans(N,0),point(0);



  for(int i = 0;i < N - 1;i++) {
      if(S.at(i) == 'R' && S.at(i + 1) == 'L') {
          point.push_back(i);
      }
  }

  for(int i = 0;i < N;i++) {
      vector<int>::iterator it;
      if(S.at(i) == 'L') {
          it = upper_bound(point.begin(),point.end(),i);
          int loop = *(--it);
          int dis = i - loop;
          if(dis % 2 == 0) {
              ans.at(loop)++;
          }else {
              ans.at(loop + 1)++;
          }
      }else {
          it = lower_bound(point.begin(),point.end(),i);
          int loop = *it;
          int dis = loop - i;
          if(dis % 2 == 0) {
              ans.at(loop)++;
          }else {
              ans.at(loop + 1)++;
          }
      }
  }

  for(int i = 0;i < N;i++) {
      cout << ans.at(i) << " ";
  }
// cout << endl;
//   for(int i = 0;i < point.size();i++) {
//       cout << point.at(i) << " ";
//   }
  

  cout << endl;
}



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

const int inf = 1 << 28;
const int limit = 15;

int n;
string w[1010];
int dist[limit + 1][1 << limit];

using edge = struct {int len, mask, cost;};
vector<edge> graph[limit + 1][1 << limit];

void init(int n){
	rep(i, limit + 1) rep(j, 1 << i){
		if(i == 0) continue;
		rep(k, n){
			const int a = w[k].size(); 
			int b = 0;
			rep(l, a) b |= ((w[k][l] - '0') << l);
			const int filter = (1 << min(i, a)) - 1;
			const int tmp = (j ^ b) & filter;
			if(tmp != 0) continue;
			if(a >= i) {
				const int nlen = a - i;
				const int nmask = b >> i;
				const int ncost = a - i;
				graph[i][j].push_back({nlen, nmask, ncost});
			} else {
				const int nlen = i - a;
				const int nmask = j >> a;
				const int ncost = 0;
				graph[i][j].push_back({nlen, nmask, ncost});
			}
		}
	}
}

void dijkstra(){
	using state = tuple<int, int, int>;
	priority_queue<state, vector<state>, greater<state>> pq;
	rep(i, limit + 1) rep(j, 1 << limit){
		if(dist[i][j] != inf){
			pq.push(state(dist[i][j], i, j));
		}
	}

	while(!pq.empty()){
		int cost, len, mask;
		tie(cost, len, mask) = pq.top();
		pq.pop();

		if(dist[len][mask] < cost) continue; 
		for(auto &e: graph[len][mask]){
			const int ncost = cost + e.cost;
			const int nlen = e.len;
			const int nmask = e.mask;
			if(dist[nlen][nmask] > ncost){
				dist[nlen][nmask] = ncost;
				pq.push(state(dist[nlen][nmask], nlen, nmask));
			}
		}
	}
}


int main(void){
	cin >> n;
	rep(i, n) cin >> w[i];
	sort(w, w + n);

	rep(i, n) rep(j, n - 1){
		if(w[j].size() > w[j + 1].size()){
			swap(w[j], w[j + 1]);
		}
	}
	
	rep(i, limit + 1) rep(j, 1 << limit){
		dist[i][j] = inf;
	}

	rep(j, n) rep(i, j){
		const int common = w[i].size();
		if(w[i].substr(0, common) != w[j].substr(0, common)){
			continue;
		}
		const int len = w[j].size() - common;
		int mask = 0;
		rep(k, len) mask |= ((w[j][common + k] - '0') << k);
		dist[len][mask] = min(dist[len][mask], int(w[j].size())); 
	}

	init(n);
	dijkstra();

	if(dist[0][0] != inf){
		cout << dist[0][0] << endl;
	} else {
		cout << 0 << endl;
	}
}


Measured memory_bytes: 19552
#include<bits/stdc++.h>
using namespace std;
const int mod = 200003;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define fr(s,n) for (int i=(int)(s);i<(int)(n);i++)
#define lc cout<<"\n"

int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int a,b;
    cin>>a>>b;
    cout<<(a*b);
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,n,m) for(int i=n;i<=(int)(m);i++)
#define RFOR(i,n,m) for(int i=(int)(n);i>=m;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(std::unique(all(x)), x.end());
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;
const double PI=acos(-1);
using namespace std;
vector<int> dx={1,0,-1,0};
vector<int> dy={0,1,0,-1};
template<class T>bool chmax(T &a, const T &b) { if (a<=b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<=a) { a=b; return 1; } return 0; }
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

vector<vector<int>> graph;
void dfs(int now,int parent,vector<int> &d) {
    if(parent!=-1) d[now]=d[parent]+1;
    for(int child:graph[now]) {
        if(child==parent) continue;
        dfs(child,now,d);
    }
}

int main() {
    int n;
    cin>>n;
    graph.resize(n);
    rep(i,n-1) {
        int a,b;
        cin>>a>>b;
        a--;b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    
    vector<int> d1(n);
    dfs(0,-1,d1);
    int MAX=-1,t;
    rep(i,n) {
        if(chmax(MAX,d1[i])) t=i;
    }
    
    vector<int> d2(n);
    dfs(t,-1,d2);
    int r=0;
    rep(i,n) chmax(r,d2[i]);
    r++;
    
    vector<bool> dp(r+10);
    dp[0]=false;
    dp[1]=true;
    dp[2]=false;
    FOR(i,3,r) {
        if(!dp[i-1] || !dp[i-2]) dp[i]=true;
    }
    cout<<(dp[r] ? "First" : "Second")<<endl;
    
}


Measured memory_bytes: 22144
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mk make_pair
#define f first
#define s second
#define vs (v.begin(),v.end())
#define MOD 1000000007

int main()
{  
  ll n,w;
  cin>>n>>w;
  vector<pair<ll,ll>>v;
  v.pb(mk(-1,-1));
  for(ll i=1;i<=n;i++)
  {
    ll x,y;
  cin>>x>>y;
  v.pb(mk(x,y));
  }
  sort vs;
  /*for(ll i=0;i<v.size();i++)
    cout<<v[i].f<<" "<<v[i].s<<endl;*/
  ll dp[n+1][w+1]={0};
  for(ll i=0;i<=n;i++)
    for(ll j=0;j<=w;j++)

      dp[i][j]=0;
  for(ll i=1;i<=n;i++)
      for(ll j=1;j<=w;j++)
        if(j<v[i].f)
          dp[i][j]=dp[i-1][j];
        else
          dp[i][j]=max(dp[i-1][j],v[i].s+dp[i-1][j-v[i].f]);
  
  cout<<dp[n][w]<<endl;
     
  }



  
   


  
              
              

  

  
  
          
      
    







  
 

Measured memory_bytes: 79104
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  int ans = 1;
  rep(i,n){
    ans = min(ans*2,ans+k);
  }
  cout << ans << endl;
  return 0;
}
    
    


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
const int MOD = 1e9+7;
using ll = long long;
using vi = vector<int>;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(x) x.begin(), x.end()
int main() {
  int a;
  cin >> a;
  vi ans(a);
  rep(i,a){
    cin >> ans.at(i);
  }
  sort(ALL(ans));
  cout << abs(ans.at(0) - ans.at(a-1));
}

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

#define mp              make_pair
#define pb              push_back

#define ff              first
#define ss              second

typedef long long ll;

const int maxL = 1e3+5;

int main()
{
    int n;
    cin >> n;
    
    int L[n];
    
    for(int i=0; i<n; ++i)
        cin >> L[i];
    
    int A[maxL];
    memset(A, 0, sizeof A);
    
    for(int i=0; i<n; ++i)
        A[L[i]]++;
    
    int P[maxL];
    P[0] = A[0];
    for(int i=1; i<maxL; ++i)
        P[i] = A[i] + P[i-1];
    
    ll total = 0;
    
    for(int i=0; i<n; ++i)
    {
        for(int j=0; j<i; ++j)
        {
            int b = L[i];
            int c = L[j];
            
            total += P[min(b+c-1, maxL-1)];
            total -= P[max(b-c, c-b)];
            
            if(2*b > c)
                total--;
            if(2*c > b)
                total--;
        }
    }
    
    cout << total/3 << "\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
typedef struct pair<int,int> P;
typedef long long ll;
bool k[100001]={};
int a[100001]={};
int main() {
	string o,e;

	cin>>o>>e;
	int l=o.length()+e.length();

	for(int i=0;i<l;i++){
		if(i%2==0){
			cout<<o[i/2];
		}else{
			cout<<e[i/2];
		}
	}
	return 0;
}


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

int main() {
  int a[3];
  cin >> a[0] >> a[1] >> a[2];
  sort(a, a+3);
  if(a[0] == a[1] && a[1] == a[2]) cout << 1 << "\n";
  else if(a[0] == a[1] || a[1] == a[2]) cout << 2 << "\n";
  else cout << 3 << "\n";
}


Measured memory_bytes: 3548
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := intScanner()
	m := intScanner()
	th := intScanner()
	cs := make([]int, n)
	as := make([][]int, n)
	for i := 0; i < n; i++ {
		cs[i] = intScanner()
		as[i] = make([]int, m)
		for j := 0; j < m; j++ {
			as[i][j] = intScanner()
		}
	}
	st := [][]int{[]int{1}, []int{0}}
	ans := mod
	for len(st) != 0 {
		x := st[len(st)-1]
		st = st[:len(st)-1]
		if len(x) == n {
			p := 0
			a := make([]int, m)
			f := true
			for i, v := range x {
				p += cs[i] * v
				for j := 0; j < m; j++ {
					a[j] += as[i][j] * v
				}
			}
			for _, v := range a {
				if v < th {
					f = false
				}
			}
			if f && p <= ans {
				ans = p
			}
		} else {
			y := make([]int, len(x))
			copy(y, x)
			st = append(st, append(y, 0))
			z := make([]int, len(x))
			copy(z, x)
			st = append(st, append(z, 1))
		}
	}
	if ans == mod {
		fmt.Println(-1)
	} else {
		fmt.Println(ans)
	}
}


Measured memory_bytes: 4252
#include <iostream>
#include<string>
#include<map>
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<limits.h>
#include<unordered_map>
using namespace std;
int n,m,x;
const int N = 20;
int a[N][N];
int c[N];
int main() {

    long long n,k; cin >> n >> k;
    long long arr[n + 1];
    for (int i = 1; i <= n; i ++) {
        cin >> arr[i];
    }
    vector<long long> ans;
    int v = arr[1];
    ans.push_back(1);
    map<int,int> m;
    m[1] = 1;
    while(m[v] != 1) {
        ans.push_back(v);
        m[v] = 1;
        v = arr[v];
    }
    ans.push_back(v);
    vector<int> new_array;
    for (int i = ans.size() - 1; i >= 0; i --) {
        if (ans[ans.size() - 1] == ans[i] && i != ans.size() - 1) break;
        new_array.push_back(ans[i]);

    }
    reverse(new_array.begin(), new_array.end());
    long long x = ans.size() - new_array.size();
    if (k < ans.size()) {
        cout << ans[k];
        return 0;
    }
    k -= x;
    long long res = k % new_array.size();
    cout << new_array[res] << endl;

}



Measured memory_bytes: 16428
#include<stdio.h>
int main(void){
    char s[10];
    scanf("%s",s);
    if(s[0]==s[1] || s[1]==s[2] || s[2] == s[3]){
        printf("Bad\n");
    }else{
        printf("Good\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
 
using namespace std;
 
int main(){
  int num,tmp;
 
  cin >> num;

  int a[num][3];


  for(int i=0; i<num; ++i)
    cin >> a[i][0] >> a[i][1] >> a[i][2];


  for(int i=0; i<num; ++i){
    
    for(int j=0; j<3; ++j){
      for(int k=j+1; k<3; ++k){
	if(a[i][j] < a[i][k]){
	  tmp = a[i][j];
	  a[i][j] = a[i][k];
	  a[i][k] = tmp;
	}
      }
    }
    
    if(a[i][0]*a[i][0] == a[i][1]*a[i][1] + a[i][2]*a[i][2]){
      cout << "YES\n";
    }else{
      cout << "NO\n";
    }
  }  

}

Measured memory_bytes: 1128
N,K = map(int,input().split())
P = list(map(int,input().split()))
C = list(map(int,input().split()))

LC = [-1] * N
# Pが順列なので，結局それぞれのマスはループのどれかにいる事がわかる．あとは，ループの長さとループ1回分のコスト(a->a)を計算しておく
# ループ1回分のコストが正の場合はループをなるべく回す．負の場合は1回もループしないほうがいい．ただし最初のa->aは考慮する.
# 1回は最低でも動かないといけないから
max_score = -float('inf')
for i in range(N):
    Loop_len = 0
    Loop_cost =[]
    Loop_cost_sum = 0
    now = i
    while True:
        now = P[now] - 1
        Loop_len += 1
        Loop_cost_sum += C[now]
        Loop_cost.append(Loop_cost_sum)
        if now == i:
            break
    # それぞれのマスへのループによるコストのゲインと,最短でそこへいくまでの移動コストを計算してコストを決定する
    for i,lc in enumerate(Loop_cost):
        if K-(i+1)<0: # 行けないので
            continue
        possible_loop_num = (K-(i+1))//Loop_len
        cost = lc + max(0,Loop_cost_sum) * possible_loop_num
        max_score = max(cost,max_score)

print(max_score)





Measured memory_bytes: 80976
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

int dp[100010];

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i, 0, n) cin >> h[i];
    rep(i, 0, n) dp[i] = INF;
    dp[0] = 0;
    rep(i, 0, n){
        rep(j, 1, k + 1){
            if(i + j >= n) break;
            dp[i + j] = min(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
        }
    }
    cout << dp[n - 1] << endl;
}

Measured memory_bytes: 1792
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest
import copy

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    #n,m,k=map(int, readline().rstrip().split())
    #arr=list(map(int, readline().rstrip().split()))
    d=int(readline())
    c=list(map(int, readline().rstrip().split()))
    s=[0]*d

    top10=[0]*26

    fff=[[0 for i in range(d)] for j in range(26)]

    for i in range(d):
        s[i]=list(map(int, readline().rstrip().split()))
        for j in range(26):
            fff[j][i]=s[i][j]

    for i in range(26):
        uuu=copy.copy(fff[i])
        uuu.sort(reverse=True)
        top10[i]=uuu[10]

    last=[-1]*26

    for i in range(d):
        maxx=-999999999999
        memo=0
        for j in range(26):
            ccc=(i-last[j])*c[j]
            if (s[i][j]+ccc) > maxx and s[i][j] > top10[j]:
                maxx=(s[i][j]-ccc)
                memo=j
        print(memo+1)
        last[memo]=i
    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

Measured memory_bytes: 16536
def main():
    N, L = map(int, input().split())
    P = 0
    for i in range(1, N+1):
        P += L + i - 1
    ans = float("inf")
    for i in range(1, N+1):
        tmp = L + i - 1
        x = P - tmp
        if abs(P - x) < abs(P - ans):
            ans = x
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 9136
a, b = map(int,input().split())
if (a == 1 and b == 2) or (a == 2 and b == 1) or (a == 2 and b == 2) or (a == 3 and b == 2) or (a == 2 and b == 3):
  print("No")
else:
  print("Yes")


Measured memory_bytes: 2940
MOD = int(10**9 + 7)

def pow_mod(x, n, mod):
    if n > 1:
        return pow_mod(pow(x,2) % mod, n//2, mod) * pow(x, n%2) % mod
    else:
        return x


N, K = map(int, input().split())
tot = [0]*(K+1)

for i in range(K,0,-1):
    tot[i] = pow_mod(K//i, N, MOD)
    s = 2
    while s*i <= K:
        tot[i] -= tot[s*i]
        s += 1
        
ans = 0
for i in range(K+1):
    ans += ((tot[i]%MOD)*i)%MOD

print(ans%MOD)

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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

//最小公倍数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}

//char->int
int ctoi(char c){
    return c-'0';
}

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}



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

    int a[n];
    int ans = 0;
    rep(i,n) cin >> a[i];

    for(int i=0;i<n;i++){
        if(i%2==0&&a[i]%2!=0){
            ans++;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 3592
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
 
#define _USE_MATH_DEFINES
#define mp       make_pair
#define pb       push_back
#define fst      first
#define snd      second
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const int MOD=1000000007;
const double EPS=1e-9;

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

class UnionFind
{
    private:
        vi tree;
    public:
        UnionFind(int N);
        int root(int n);
        void link(int n, int m);
        bool is_linking(int n, int m);
};

UnionFind::UnionFind(int N)
{
    tree = vi(N);
    rep(i,N)
        tree[i] = i;
}

int UnionFind::root(int n)
{
    if(tree[n] == n)
        return n;
    return tree[n] = root(tree[n]);
}

void UnionFind::link(int n, int m)
{
    tree[root(n)] = root(m);
}

bool UnionFind::is_linking(int n, int m)
{
    return root(n) == root(m);
}


int main()
{
    int N, K, L; cin >> N >> K >> L;
    UnionFind train(N), road(N);

    int p, q;
    rep(i,K) {
        cin >> p >> q;
        road.link(p-1,q-1);
    }

    int r, s;
    rep(i,L) {
        cin >> r >> s;
        train.link(r-1,s-1);
    }

    map<pii,int> cnt;
    rep(i,N) {
        cnt[mp(road.root(i),train.root(i))]++;
    }

    rep(i,N) {
        if(i) cout << " ";
        cout << cnt[mp(road.root(i),train.root(i))];
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 13568
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
string solve() {
    string S, T;
    cin >> S >> T;
    for (int i = S.size() - T.size(); i >= 0; i--) {
        auto s = S.substr(i, T.size());
        bool f = true;
        for (int i = 0; i < T.size(); i++) if (s[i] != '?' && s[i] != T[i]) f = false;
        if (!f) continue;
        S.replace(i, T.size(), T);
        replace(S.begin(), S.end(), '?', 'a');
        return S;
    }
    return "UNRESTORABLE";
}
int main() {
    cout << solve() << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define N 100005
int parent[N],R[N];
void init(int n)
{
    for(int i=1;i<=n;i++)
    {
       parent[i]=i;
       R[i]=1;
    }
}
int find(int a)
{
    if(parent[a]==a)
    return a;
    else
    {
        return parent[a]=find(parent[a]);
    }
}
void unite(int a,int b)
{
    if(R[a]>R[b])
    {
        parent[b]=a;
        R[a]+=R[b];
    }
    else
    {
        parent[a]=b;
        R[b]+=R[a];
    }
}
int32_t main()
{
  int n,m;
  cin>>n>>m;
  init(n);
  int a,b;
  for(int i=1;i<=m;i++)
  {
      cin>>a>>b;
      a=find(a);
      b=find(b);
      unite(a,b);
  }
  int ans=0;
  for(int i=1;i<=n;i++)
  {
      if(parent[i]==i)
      ans++;
  }
  cout<<(ans-1)<<endl;
}

Measured memory_bytes: 5184
from math import ceil

n, m = (int(x) for x in input().split())
if n % 2 == 1:
    for i in range(1, m + 1):
        print(i, n - i)
else:
    k = (n - 2) // 2
    l = ceil(k / 2)
    ANS = []
    for i in range(1, l+1):
        ANS.append((i, n - i + 1))
    for i in range(l+2, k+2):
        ANS.append((i, n - i + 2))
    for a, b in ANS[:m]:
        print(a, b)

Measured memory_bytes: 79980
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
constexpr bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
constexpr bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

void Pr(bool f){
  cout << (f ? "Yes" : "No") << "\n";
  exit(0);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll a, b, c;
  char x;
  cin >> a >> b >> x >> c;
  b = b*100+c;
  print(a*b/100);
}


Measured memory_bytes: 3680
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 10桁出力 cout << setprecision(10) << double;
#include <queue>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//for gcc (未test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// 入力をpush_back(d)やarray[d]に使う時に1行で書ける
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN() { T d; cin >> d; return d; }
// 最大公約数（Greatest Common Divisor）
LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; }
// 最小公倍数（Least Common Multiple）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
// Y年はうるう年か否か
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); }

// vector注意
// vec[i][j]の形に入力を入れるとき、vecは初期化してある必要がある.

// ------------------- include, typedef, define END. -------------------

int main() {
	FAST_IO;
	// for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;
	bool dbgF = true;

	//コードはここから書く.

	int w, h, n;
	cin >> w >> h >> n;

	int x1=0, y1=0;
	int x2 = w, y2 = h;
	int a = 0, b = 0, c = 0;
	FOR(i, 0, n) {
		cin >> a >> b >> c;
		if (c == 1) {
			x1 = max(x1, a);
		}else if(c==2){
			x2 = min(x2, a);
		}else if(c==3){
			y1 = max(y1, b);
		}else{
			y2 = min(y2, b);
		}
	}
	LL ans = 0;
	if(x2>x1&&y2>y1)
		ans = (x2-x1) * (y2-y1);
	if (ans < 0)ans = 0;
	cout << ans << endl;


	return 0;
}

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

int main() {
  int N;
  cin>>N;
  string s[N];
  for (int i=0; i<N; i++) {
    cin>>s[i];
  }
  int M;
  cin>>M;
  string t[M];
  for (int i=0; i<M; i++) {
    cin>>t[i];
  }
  int ans;
  int v=0;
  for (int i=0; i<N; i++) {
    ans=0;
    for (int j=0; j<N; j++) {
      if (s[i]==s[j]) {
        ans++;
      }
    }
    for (int k=0; k<M; k++) {
      if (s[i]==t[k]) {
        ans--;
      }
    }
    ans=max(ans,v);
    v=ans;
  }
  cout<<ans<<endl;
  return 0;
}


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

int main(void){
    int A,B,C,D;
    cin>>A>>B>>C>>D;

    if(D>=B&&C<=A)
        cout<<B-A<<endl;
    else if(D<=B&&C>=A)
        cout<<D-C<<endl;
    else if((A<=C&&A<=D&&B<=C&&B<=D)||(C<=A&&C<=B&&D<=A&&D<=B))
            cout<<0<<endl;
    else if(abs(C-B)<=abs(D-A))
        cout<<abs(C-B)<<endl;
    else cout<<abs(D-A)<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int dep[1010];
int n,m,p;

int main(){
    memset(dep,0,sizeof(dep));
    scanf("%d%d%d",&n,&m,&p);
    int x,y,ex;
    while(p--){
        scanf("%d%d",&x,&y);
        ex = n-x+1+abs(y-m);
        if (y<=m){
            ex++;
        }
        dep[ex]++;
    }
    int ans=0;
    for (int i=0;i<1010;++i){
        if (dep[i]>0){
            ans = i + dep[i]-1;
            if (i==1009){
                break;
            }
            if (dep[i]>1){
                dep[i+1]+=dep[i]-1;
            }
        }
    }
    cout<<ans<<"\n";
    return 0;
}



Measured memory_bytes: 3240
#include<stdio.h>

int main(){
 int i,n;
 double x1,y1,x2,y2,x3,y3,x4,y4,a1,a2;
 scanf("%d",&n);

 for(i=0;i<n;i++){
  scanf("%lf %lf %lf %lf %lf %lf %lf %lf",
          &x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4);
  if(x1!=x2){
   a1=(y1-y2)/(x1-x2);
   a2=(y3-y4)/(x3-x4);
   printf("%s\n",(a1==a2)?"YES":"NO");
  }else{
   printf("%s\n",x3==x4?"YES":"NO");
  }
 } 
 return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define REP(i,n) for (int i = 0; i < n; ++i)

const int MAX = 1e5+10;

int N, M;
ll K;
ll X[MAX];

vi mult(vi a, vi b) {
    int n = a.size();
    vi res(n);
    REP (i, n) res[i] = b[a[i]];
    return res;
}

vi swap(vi ord, ll k) {
    int n = ord.size();
    vi res(n);
    REP (i, n) res[i] = i;

    while (k) {
        if (k&1) res = mult(res, ord);
        ord = mult(ord, ord);
        k >>= 1;
    }
    return res;
}

int main() {
    cin >> N;
    REP (i, N) cin >> X[i];

    cin >> M >> K;
    vi ord(N-1);
    REP (i, N-1) ord[i] = i;
    REP (_, M) {
        int a;
        cin >> a;
        int k = ord[a-2];
        ord[a-2] = ord[a-1];
        ord[a-1] = k;
    }

    ord = swap(ord, K);
    ll x = X[0];
    REP (i, N-1) {
        cout << x << "\n";
        x += X[ord[i]+1] - X[ord[i]];
    }
    cout << x << endl;
}


Measured memory_bytes: 3424
#include<iostream>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  int ca[a],cb[b];
  for(int i=0;i<a;i++) cin >> ca[i];
  for(int i=0;i<b;i++) cin >> cb[i];
  int ai=0,bi=0,count=0,ans=0;
  for(int i=0;i<b;i++){
    bi = i;
    while(ai<a&&bi<b){
      if(ca[ai]!=cb[bi]) ai++;
      else{
	count++;
	bi++;
	ai++;
      }
    }
    //cout << count << endl;
    if(count>ans) ans = count;
    count = 0;
    ai = 0;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1200