akhauriyash/Code-Regression huggingface dataset:
// #pragma GCC optimize("unroll-loops", "omit-frame-pointer", "inline")
// #pragma GCC option("arch=native", "tune=native", "no-zero-upper")
// #pragma GCC
// target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("tree-vectorize","openmp","predictive-commoning")
// #pragma GCC option("D_GLIBCXX_PARALLEL","openmp")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"

void solve() {
  int K;
  cin >> K;
  ll ans = 0ll;
  for (int i = 1; i <= K; i++) {
    for (int j = 1; j <= K; j++) {
      for (int k = 1; k <= K; k++) { ans += __gcd(i, __gcd(j, k)); }
    }
  }
  cout << ans << endl;
  return;
}

signed main() {
  fastio();
  solve();
  // int t; cin >> t; while(t--)solve();

  // int t; cin >> t;
  // for(int i=1;i<=t;i++){
  //   cout << "Case #" << i << ": ";
  //   solve();
  // }
  return 0;
}


Measured memory_bytes: 3652
#include<stdio.h>
 
int main()
{
  int x=0,y=0,t,c,sum=0;
  for(c=0;c<=3;c++){
    scanf("%d",&t);
    sum+=t;
  }
  x=sum/60;
  y=sum%60;
  printf("%d\n",x);
  printf("%d\n",y);
 
  return 0;
}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
#define reps(i,n) for(ll i=1;i<=(n);++i)
using ll = long long;
using str = string;
constexpr long long INF = (1LL<<60);
constexpr long long MOD = (1e9+7);
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
inline void dump(){cout<<endl;}
template<class Head,class... Tail>inline void dump(Head&& head, Tail&&... tail){cout<<head<<", ";dump(forward<Tail>(tail)...);}
template<typename T>inline istream &operator>>(istream&input,vector<T>&v){for(auto &elemnt:v)input>>elemnt;return input;}

main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout<<fixed<<setprecision(10);
  
  ll n,m;
  cin>>n>>m;
  vector<vector<pair<ll,ll>>> adj[3];
  adj[0].resize(n);
  adj[1].resize(n);
  adj[2].resize(n);
  rep(i,m){
    ll u,v;
    cin>>u>>v;
    u--;v--;
    adj[0][u].emplace_back(v,1);
    adj[1][u].emplace_back(v,2);
    adj[2][u].emplace_back(v,0);
  }
  ll s,t;
  cin>>s>>t;
  s--;t--;

  vector<vector<ll>> dist (n,vector<ll>(3,INF));
  queue<tuple<ll,ll,ll>> que;
  que.emplace(s,0,0);
  while(!que.empty()){
    ll v,x,c;
    tie(v,x,c)=que.front();
    que.pop();
    if( chmin(dist[v][x],c) ){
      for(const auto& nv:adj[x][v]){
        que.emplace(nv.first,nv.second,c+1);
      }
    }
  }

  if(dist[t][0]!=INF)cout<<(dist[t][0]/3)<<endl;
  else cout<<(-1)<<endl;

}


Measured memory_bytes: 22144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX = 1e5 + 10;
const int INF=0x3f3f3f3f;
const int mod=1e9+7;

#define N 1001
struct Node{int x,y;};
deque<Node>q;

int sx,sy,tx,ty,n,m,dis[N][N],dx[4]={1,-1,0,0},dy[4]={0,0,1,-1};
char str[N][N],vis[N][N];

void solve() {
    int i,dir,j;Node x,y;memset(dis,0x3f,sizeof dis);
    cin>>n>>m>>sx>>sy>>tx>>ty;
    //scanf("%d%d%d%d%d%d",&n,&m,&sx,&sy,&tx,&ty);
    for(i=1;i<=n;++i)scanf("%s",str[i]+1);
    q.push_back({sx,sy}),dis[sx][sy]=0;
    while(!q.empty()){
        x=q.front(),q.pop_front();
        if(vis[x.x][x.y])continue;vis[x.x][x.y]=1;
        for(dir=0;dir<4;++dir){
            y={x.x+dx[dir],x.y+dy[dir]};
            if(y.x&&y.x<=n&&y.y&&y.y<=m&&str[y.x][y.y]^'#'&&dis[y.x][y.y]>dis[x.x][x.y])dis[y.x][y.y]=dis[x.x][x.y],q.push_front(y);
        }
        for(i=-2;i<=2;++i){
            for(j=-2;j<=2;++j){
                y={x.x+i,x.y+j};
                if(y.x>=1&&y.x<=n&&y.y>=1&&y.y<=m&&str[y.x][y.y]^'#'&&dis[y.x][y.y]>dis[x.x][x.y]+1)dis[y.x][y.y]=dis[x.x][x.y]+1,q.push_back(y);
            }
        }
    }
    printf("%d\n",dis[tx][ty]^0x3f3f3f3f?dis[tx][ty]:-1);
}

int main() {
    int _ = 1;
    //cin >> _;
    while (_--) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 9616
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define all(cont) cont.begin(), cont.end()
#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define fore(i,a,b) for(int i=a,almo5t=b;i<almo5t;++i)
#define SZ(x) ((int)x.size())
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define FIN std::ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

const int N = 0;

typedef long long int ll;

using namespace std;

int main(){
    string s;cin>>s;
    int ans = 0;
    fore(i,1,SZ(s)/2){
        bool posible = true;
        fore(j,0,i){
            if(s[j] != s[j+i]){
                posible = false;
            }
        }
        if(posible){
            ans = i*2;
        }
    } 
    cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
int main() {
string n;
cin>>n;
int a=0;
int b=0;
int s=n.size();
for(int i=0; i<s; i++){
a+=n.at(i)-'0';}
if(a==9*(s-1)+n.at(0)-'0'){
cout<<a<<endl;}
else{
cout<<9*(s-1)+n.at(0)-'0'-1<<endl;}
}


Measured memory_bytes: 3624
import numpy as np
from functools import lru_cache

N,K = map(int,input().split())
A = np.array(input().split(),dtype=np.int64)

bit_cnt = [((A>>k)&1).sum() for k in range(40)]

@lru_cache(maxsize = 10**6)
def F(K,k = 39):
  # K以下、k-bit目まで見た(inclusive)の和、最大値
  if k == -1:
    return 0
  bit = 1<<k
  # k-bitを使う
  x = 0
  if K >= bit:
    x = ((N-bit_cnt[k])<<k) + F(K-bit,k-1)
  # k-bitを使わない
  y = (bit_cnt[k]<<k) + F(min(K,bit-1),k-1)
  return max(x,y)

answer = F(K)
print(answer)


Measured memory_bytes: 25976
#17:38
k = int(input())
n = 50
print(n)
p = k // n
q = k % n
a = [49+p for _ in range(50)]
for i in range(q):
  for j in range(50):
    if i == j:
      a[j] += n
    else:
      a[j] -= 1
print(' '.join(list(map(str,a))))

Measured memory_bytes: 3064
<?php
$str = trim(fgets(STDIN));
$longest = -1;
for($i = 0; $i < strlen($str); $i++){
  $cArray[$i] = $str[$i];
}
if(strlen($str)==1){
  echo "0\n";exit;
}
for($a = 'a'; $a !='aa'; $a++){
  $s = $cArray;
  for($n = strlen($str) - 1; $n >= 1; $n--){
    if(count(array_unique($s))==1){
      $longest = max($longest, count($s));
      break;
    }
    $s2 = [];
    for($i = 0; $i < $n; $i++){
      if($s[$i] == $a){
        $s2[$i] = $s[$i];
      }else{
        $s2[$i] = $s[$i + 1];
      }
    }
    $s = $s2;
  }
}
printf("%d\n", strlen($str) - $longest);


Measured memory_bytes: 4732
n, k = map(int, input().split())
list_D = set(map(str, input().split()))
num = n
ans = -1

while True:
    S = set(list(str(num)))
    cnt = 0
    for s in S:
        if s  in list_D:
           cnt += 1
    if cnt == 0:
        ans = num
        break
    num += 1

print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <ctime>
#include <vector>
#include <stack>

#define rep(i,x) for(int i=0;i<x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rep_to(a,i,x) for(int i=a;i<x;i++)

using namespace std;

int main()
{
	int N,M;

	while(cin>>N>>M && M && N)
	{
		int h[10000]={};
		int w[10000]={};
		unsigned long long sum_h[10000]={};
		unsigned long long sum_w[10000]={};
		long long h_c[510000]={};
		long long w_c[500000]={};

		rep(i,N)
		{
			cin>>h[i];
			sum_h[i+1]=sum_h[i]+h[i];
		}
		rep(i,M)
		{
			cin>>w[i];
			sum_w[i+1]=sum_w[i]+w[i];
		}

		rep(i,N)
			rep(j,N-i)
				h_c[sum_h[j+i+1]-sum_h[j]]++;
		rep(i,M)
			rep(j,M-i)
				w_c[sum_w[j+i+1]-sum_w[j]]++;

		long long  count=0;
		rep(i,min(sum_h[N],sum_w[M])+1)count+=h_c[i]*w_c[i];
		cout<<count<<endl;
	}
	return 0;
}

Measured memory_bytes: 9284
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const N = Number(input[0][0]);

  return (N * (N + 1)) / 2;
};

console.log(main(read()));


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

int main(){
    int N;
    cin >> N;
    int s[N];

    int ans,min,imin,ncount;
    ans=0;

    for(int i=0; i<N; i++){
        cin >> s[i];
        ans+=s[i];
    }

    if( ans%10!=0 ){
        cout << ans << endl;
    }else{
        ncount=N;
        while( ans%10==0 && ncount>0 ){
            for(int i=0; i<ncount; i++){
                if(i==0){
                    min=s[i];
                    imin=i;
                }else if(min > s[i]){
                    min=s[i];
                    imin=i;                  
                }
            }
            if(min%10!=0){
                ans=ans-min;
            }
            swap(s[ncount-1],s[imin]);
            ncount--;
            //cout << ncount << endl;
        }
        if(ans%10==0) ans=0;
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int a, b,t,s;
	string lexico="";
	cin >> a >> b;
	if (a > b) { t = a; s = b; }
	else if (b > a) { t = b; s = a; }
	else { t = a; s = b; }
	if ((a >= 1 && a <= 9) && (b >= 1 && b <= 9))
	{
		for (int i = 0; i < t; i++)
		{
			lexico += (s+48);
		}
		cout << lexico << endl;
	}
	else
		cout << "Wrong inputs" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int[] num = new int[1001];

        for(int i =1;i<1000;i++){
            num[i+1] +=(i+num[i]);
        }
        System.out.println(num[b-a]-a);

        
    }
}


Measured memory_bytes: 21712
from collections import deque


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append(cnt)

    if temp != 1:
        arr.append(1)

    if arr == []:
        arr.append(1)

    return arr


n = int(input())
if n == 1:
    print(0)
    exit()
d = factorization(n)
d = deque(d)
count = 0
while d:
    m = 1
    a = d.popleft()
    while a >= m:
        a = a - m
        m += 1
        count += 1

print(count)


Measured memory_bytes: 9660
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) throws IOException {
		new Main().solve();
	}

	private void solve() throws IOException {
		try {
			solveA();
			//			 solveB();
			//			 solveC();
			//			 solveD();
			//			 solveE();
			//			 solveF();
		} finally {
			if (in != null) {
				in.close();
			}
			if (out != null) {
				out.flush();
				out.close();
			}
		}

	}

	private void solveA() {
		StringBuilder wk1 = new StringBuilder(next());
		StringBuilder wk2 = new StringBuilder(next());

		if (wk1.toString().equals(wk2.reverse().toString())) {
			out.println("YES");
		} else {
			out.println("NO");
		}

	}

	private void solveB() {
		int numN = nextInt();

		out.println("");
	}

	private void solveC() {
		int numN = nextInt();

		out.println("");
	}

	private void solveD() {
		int numN = nextInt();

		out.println("");
	}

	private void solveE() {
		int numN = nextInt();

		out.println("");
	}

	private void solveF() {
		int numN = nextInt();

		out.println("");
	}

	private final PrintWriter out = new PrintWriter(System.out);
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

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

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
}

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

using ll = long long;
using P = pair<ll, ll>;

const ll MOD = 1e9+7;
const ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(ll)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

ll cnt[15][1005];
char grid[15][1005];
ll H, W, K;

int main(int argc, char **argv)
{
	cin >> H >> W >> K;
	REP(h, H)REP(w, W)
		cin >> grid[h][w];

	ll res{INF};
	for (ll bits = 0; bits < (1ll<<(H-1)); ++bits)
	{
		ll cntb = __builtin_popcount(bits);
		vector<ll> cntw(cntb+1, 0);

		ll cnt{cntb};
		REP(w, W)
		{
			vector<ll> cntw_copy;
			vector<ll> cntw_h_only(cntb+1, 0);
			cntw_copy = cntw;
			ll i{0};
			REP(h, H)
			{
				ll t = grid[h][w] - '0';
				cntw_copy[i] += (t == 1);
				cntw_h_only[i] += (t == 1);
				if (bits & (1ll << h))
				{
					++i;
				}
			}

			for (auto &e : cntw_h_only)
			{
				if (e > K)
				{
					cnt = INF; // no ans.
					break;
				}
			}

			bool is{false};
			for (auto &e : cntw_copy)
			{
				if (e > K)
					is = true;
			}

			if (is)
			{
				++cnt;
				assert(cntw_copy.size() == cntw.size());
				for(ll i = 0; i < (ll)cntw_copy.size(); ++i)
					cntw[i] = cntw_copy[i] - cntw[i];
				
			}
			else
			{
				cntw = cntw_copy;
			}
		}

		// if (res > cnt)
		// {
		// 	// std::cout << "cnt : " << cnt << std::endl;
		// 	for (ll i = 0; i < (ll)cntw.size(); ++i)
		// 	{
		// 	// 	std::cout << cntw[i]<< std::endl;
		// 	}
		// 	// std::cout << std::endl;
		// }
		res = min(res, cnt);
	}

	std::cout << res << std::endl;
}


Measured memory_bytes: 256
S=input()
K=int(input())
flg=False
for s in S:
    if S[0] != s:
        flg=True
        break
if not flg:
    print(len(S)*K//2)
    exit()
ans = 0
i=0
while i<len(S)-1:
    renzoku=1
    x=i
    while S[x] == S[i+1]:
        renzoku+=1
        if i+2 < len(S):
            i=i+1
        else:
            break

    if renzoku >1:
        ans+=renzoku//2
    i+=1

if S[0] == S[-1]:
    s=S[0]
    top=0
    bottom=0
    i=0
    while S[i] == s:
        top+=1
        i+=1
    i=-1
    while S[i] == s:
        bottom+=1
        i-=1
    if (top%2) + (bottom%2) == 2:
        print((ans+1)*K-1)
        exit()
    
print(ans*K)





Measured memory_bytes: 3064
#include <stdio.h>

int main(void){
	double max, min;
	double h;
	max = 0;
	min = 100000000;

	while(scanf("%lf", &h) != EOF){
		if(max < h) max = h;
		if(min > h) min = h;
	}

	printf("%f\n", max - min);

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define int long long
using namespace std;
int mod = 1000000007;
int inf = INT_MAX;
int m_inf = INT_MIN;
int dp[100001][2];


int32_t main() 
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	std::cout.unsetf ( std::ios::floatfield );
	std::cout.precision(6);
	int n,a,b;
	cin>>n>>a>>b;
	int ans = 0;
	ans = n/(a+b)*a;
	int k = n/(a+b)*(a+b);
	while(k<=n)
	{
		if((k+a)<=n)
		{
			ans+=a;
			k+=(a+b);
		}
		else
		{
			ans+=(n-k);
			k+=a;
			break;
		}
	}
	cout<<ans<<'\n';
	
}

Measured memory_bytes: 256
#include<cstdio>

using namespace std;

int main() {
    long long A, B, C, K;
    scanf("%lld%lld%lld%lld", &A, &B, &C, &K);
    if(K % 2) printf("%lld\n", B - A);
    else printf("%lld\n", A - B);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<set>

using namespace std;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    set<int> s;
    s.insert(a);
    s.insert(b);
    s.insert(c);
    if (s.size() != 2) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import math
A,B,H,M = map(int, input().split())
H = 60*H + M
pi = (math.pi/180)
HP = [A*math.cos(0.5*H*pi), A*math.sin(0.5*H*pi)]
MP = [B*math.cos(6*M*pi), B*math.sin(6*M*pi)]

print(math.sqrt((HP[0]-MP[0])**2 + (HP[1]-MP[1])**2))




Measured memory_bytes: 62524
use proconio::{input, fastout};
use proconio::marker::Chars;

#[fastout]
fn main() {
    input! {
        nn: Chars
    }
    let mut x: u64  = 0;
    for n in nn {
        x += n as u64 - 48;
    }
    if x % 9 == 0 {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 3040
[<EntryPoint>]
let main argv =
    let xab = stdin.ReadLine().Split() |> Array.map int
    let x = xab.[0]
    let a = xab.[1]
    let b = xab.[2]
    if abs(x - a) < abs(x - b) then "A" else "B"
    |> stdout.WriteLine
    0

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

int main() {
  int count=0;
  int a,b;
  vector<int>x(2);
  vector<int>y(2);
  rep(i,2){
  cin>>x[i]>>y[i];
  }
  a=x[1]-x[0];
  b=y[1]-y[0];
  cout<<x[1]-b<<" "<<y[1]+a<<" ";
  cout<<x[0]-b<<" "<<y[0]+a<<" ";
}


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

int main()
{   
    long A; cin >> A;
    string S; cin >> S;
    long a, b, c;
    a = (long)(S[0] - '0');
    b = (long)(S[2] - '0');
    c = (long)(S[3] - '0');
    long temp = ((10l*b+c)*A)/100l;
    cout << A*a+temp << endl;

    return 0;
}






Measured memory_bytes: 3624
IDENTIFICATION                   DIVISION.
PROGRAM-ID.                      ABC_100_B.
ENVIRONMENT                      DIVISION.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 INP    PIC X(10).
    01 maxlen PIC 9(1)  VALUE 2.
    01 cur    PIC 9(2)  VALUE 1.
    01 i      PIC 9(18) VALUE 1.
    01 j      PIC 9(18).
    01 len    PIC 9(2).
    01 ans    PIC Z(6)9.
    01 DN1.
        03 DN11 OCCURS 2.
            05 DN PIC 9(7).
    01 tmp    PIC 9(7).
PROCEDURE                        DIVISION.
MAIN.
    ACCEPT INP.

    PERFORM maxlen TIMES

        PERFORM VARYING j FROM cur BY 1
            UNTIL INP(j:1) = SPACE
        END-PERFORM

        COMPUTE len = j - cur

        MOVE INP(cur:len) TO DN(i)

        COMPUTE cur = j + 1

        ADD 1 TO i

    END-PERFORM.

    IF DN(2) = 100 THEN
        ADD 1 TO DN(2)
    END-IF.

    COMPUTE tmp = 100 ** DN(1) * DN(2);
    MOVE tmp TO ans.

    DISPLAY ans.
    STOP RUN.


Measured memory_bytes: 384
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const ceil=(a)=>{return Math.ceil(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))};const gcd=(x,y)=>{while(y){[x,y]=[y,x%y]}return x};const sum=(arr)=>{return arr.reduce((a,b)=>a+b);};
const main=()=>{
  let D=tn(),G=tn(),qNum=[],qPoint=[],kaisuu=0,goukei=0,ans=Infinity
  for(let i=0;i<D;i++){
    qNum.push(tn())
    qPoint.push(tn())
  }
  for(let i=0;i<(1<<D);i++){
    goukei=0
    kaisuu=0
    for(let j=0;j<D;j++){
      if(i&(1<<j)){
        goukei+=(j+1)*100*qNum[j]+qPoint[j]
        kaisuu+=qNum[j]
      }
    }
    for(let j=D-1;j>=0;j--){
      if(!(i&(1<<j))){
        if(goukei>=G){
          ans=min(ans,kaisuu)
          break
        }else if(goukei+(j+1)*100*qNum[j]>=G){
          kaisuu+=ceil((G-goukei)/((j+1)*100))
          ans=min(ans,kaisuu)
          break
        }else{
          goukei+=(j+1)*100*qNum[j]
          kaisuu+=qNum[j]
        }
      }
    }
    if(goukei>=G){
      ans=min(ans,kaisuu)
    }
  }
  to(ans)
}
main()


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

int main() {
  int N;
  string S;
  cin >> N >> S;

  ll numR = 0;
  ll numG = 0;
  ll numB = 0;
  rep(i, N) {
    if (S[i] == 'R') numR++;
    else if (S[i] == 'G') numG++;
    else numB++;
  }
  ll ans = numR * numG * numB;

  for (int i = 0; i < N - 2; i++) {
    for (int j = i + 1; j < N - 1; j++) {
      if (2 * j - i >= N) continue;
      if (S[i] == S[j]) continue;
      if (S[i] != S[2 * j - i] && S[j] != S[2 * j - i]) ans--;
    }
  }

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

Measured memory_bytes: 3608
import math
from decimal import *
import random
mod = int(1e9)+7

s = str(input())
n =len(s)
if(n%2==0):
    s1, s2 = s[:n//2], s[n//2:][::-1]
    ans =0
    for i in range(len(s1)):
        if(s1[i]!= s2[i]):
            ans+=1
    print(ans)
else:
    s1, s2 = s[:(n-1)//2], s[(n-1)//2:][::-1]
    ans = 0
    for i in range(len(s1)):
        if(s1[i]!= s2[i]):
            ans+=1
    print(ans)


Measured memory_bytes: 77068
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}
const int M = 2001;
int L[M][M]={0},R[M][M]={0}, U[M][M]={0}, D[M][M]={0}; 

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w; cin>>h>>w;
    vector<string> S(h);
    rep(i, h) cin>>S[i];

    for(int y=0; y<h; y++){
        int cur=0;
        for(int x=0; x<w; x++){
            if(S[y][x]=='#') cur = 0;
            else cur++;
            L[y][x] = cur;
        }
    }
    for(int y=0; y<h; y++){
        int cur = 0;
        for(int x=w-1; x>=0; x--){
            if(S[y][x]=='#') cur = 0;
            else cur++;
            R[y][x] = cur;
        }
    }
    for(int x=0; x<w; x++){
        int cur = 0;
        for(int y=0; y<h; y++){
            if(S[y][x]=='#') cur = 0;
            else cur++;
            U[y][x] = cur;
        }
    }
    for(int x=0; x<w; x++){
        int cur = 0;
        for(int y=h-1; y>=0; y--){
            if(S[y][x]=='#') cur = 0;
            else cur++;
            D[y][x] = cur;
        }
    }

 
    int ans = 0;
    rep(i, h){
        rep(j, w){
            if(S[i][j]=='#') continue;
            int t = L[i][j]+R[i][j]+U[i][j]+D[i][j] - 3;
            ans = max(ans, t);
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 67072
#include <bits/stdc++.h>
using namespace std;
string S;
int main() {
    cin >> S;
    int len = S.length();
    int count = 0;
    int max = 0;
    for(int i = 0; i < len; ++i) {
        if(S.at(i) == 'A' || S.at(i) == 'C' || S.at(i) == 'G' || S.at(i) == 'T') {
            count++;
            if(max < count) max = count;
        }else {
            count = 0;
        }
    }
    cout << max << endl;
}

Measured memory_bytes: 256
using System;
class AOJ{
public static void Main(){
String[] st=Console.ReadLine().Split(' ');
int a=int.Parse(st[0]);
int b=int.Parse(st[1]);
int c=int.Parse(st[2]);
int oki;
if(b>c){
oki=c;
c=b;
b=oki;
}

if(a>b){
oki=a;
a=b;
b=oki;
}
if(b>c){
oki=c;
c=b;
b=oki;
}

Console.WriteLine(a+" "+b+" "+c);



}
}

Measured memory_bytes: 9192
#include<stdio.h>
#include<algorithm>
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	int x,r,k;
	scanf("%d%d",&k,&r);
	if(k<=10)
	x=r+100*(10-k);
	else x=r;
	printf("%d",x);
	
 } 

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  long a, b, k;
  scanf("%ld %ld %ld", &a, &b, &k);
  
  if(k > a){
    k = k - a;
  }else{
    a = a - k;
    printf("%ld %ld", a, b);
    return 0;
  }
  if(k > b){
    k = k - b;
    printf("%d %d", 0, 0);
  }else{
    b = b - k;
    printf("%d %ld", 0, b);
  }

  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.h>
#include<math.h>
#include<assert.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384
int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int nHr(int a,int b){return nCr(a+b-1,b);}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}
int sankaku(int x){return ((1+x)*x)/2;}
void swap(int *a,int *b){int c;c=(*a);(*a)=(*b);(*b)=c;}


 
int main(void){
    int N;
    scanf("%d",&N);
    if(N%2==0){
        printf("%lf",1/2.0);
        return 0;
    }else{
        printf("%lf",(double)((N+1)/2)/N);
    }
}


Measured memory_bytes: 128
n,k = map(int,input().split())
mx  = (n-1)*(n-2)//2
li  = []

if k>mx:
  print('-1')
else:
  e = mx-k
  M = (n-1)+e
  print(M)

  for i in range(n-1,0,-1):
    for j in range(1,i):
      li.append([i,j])

  for i in range(1,n):
    print(n,i)
  
  for i in range(e):
    print(*li[i])


Measured memory_bytes: 4112
N = int(input())
C = N/1.08
if C%1 == 1:
    print(int(C))
else:
    C -= (C%1)
    D = C+1
    if C*1.08-((C*1.08)%1) != N and D*1.08-((D*1.08)%1) != N:
        print(":(")
    elif C*1.08-((C*1.08)%1) == N:
        print(int(C))
    else:
        print(int(D))


Measured memory_bytes: 3060
import sys
 
def print_arr(arr):
    for i in range(len(arr)):
        sys.stdout.write(str(arr[i]))
        if i != len(arr) - 1:
            sys.stdout.write(' ')
    print()
 
def insertion_sort(arr, n, g):
    cnt = 0
    for i in range(g, n):
        v = arr[i]
        j = i - g
        while j >= 0 and arr[j] > v:
            arr[j + g] = arr[j]
            j = j - g
            cnt += 1
        arr[j + g] = v
    return cnt
 
def shell_sort(arr, g):
    cnt = 0
    for i in range(len(g)):
        cnt += insertion_sort(arr, len(arr), g[i])
    return cnt
 
def get_gap(n):
    lst = []
    v = 1
    cnt = 1
    while v <= n:
        lst.append(v)
        v += 3**cnt
        cnt += 1
    if len(lst) == 0: lst.append(1)
    return list(reversed(lst))
 
n = int(input())
arr = [0] * n
for i in range(n):
    arr[i] = int(input())
 
g = get_gap(n)
m = len(g)
cnt = shell_sort(arr, g)
 
print(m)
print_arr(g)
print(cnt)
for i in range(n):
    print(arr[i])


Measured memory_bytes: 45504
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		int c=scan.nextInt();
		int d=0;
		if(a>b) {
			d=a;
			a=b;
			b=d;
	}
		if(b>c) {
			d=b;
			b=c;
			c=d;
		}
		if(a>b) {
			d=a;
			a=b;
			b=d;
		}
		System.out.println(a+" "+b+" "+c);
		scan.close();
}
}


Measured memory_bytes: 26136
#include<stdio.h>

int n,a[50];

int sol(int i,int m){
	if(m==0)return 1;
	if(i>=n)return 0;
	int res=sol(i+1,m)||sol(i+1,m-a[i]);
	return res;
}

int main(void){
	int q,m,i;
	
	scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%d",&a[i]);
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d",&m);
		if(sol(0,m))printf("yes\n");
		else printf("no\n");
	}
	return 0;
}


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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

ll dp[2][102];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	string s;
  cin>>s;
  ll n=s.size();
  bool flag=false;
  REP1(i,n){
    if(s[i-1]=='A' && s[i]=='C')
      flag=true;
  }
  
  if(flag)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
    


}




Measured memory_bytes: 256
# -*- coding: utf-8 -*-
#AGC005A
import sys

#n= int(input())
#tmp = input().split()
#n,k = list(map(lambda a: int(a), tmp))
x = input()

x_len=len(x)

#print(x_len)
ans=0
store=0
for i in range(0,x_len):
	if(x[i]=="S"):
		store+=1
	else:
		if(store>0):
			store-=1
		else:
			ans+=1
print(ans*2)



Measured memory_bytes: 3500
# coding: utf-8

nums = input().split(" ")
a = int(nums[0])
b = int(nums[1])
c = int(nums[2])
num_list = [a, b, c]

max_num = max(num_list)
min_num = min(num_list)

if max_num == a:
	max_index = 0
elif max_num == b:
	max_index = 1
else:
	max_index = 2

if min_num == a and max_index != 0:
	min_index = 0
elif min_num == b and max_index != 1:
	min_index = 1
else:
	min_index = 2

index_list = [0, 1, 2]
index_list[max_index] = "abc"
index_list[min_index] = "abc"
if index_list[0] == 0:
	middle_index = 0
elif index_list[1] == 1:
	middle_index = 1
else:
	middle_index = 2

answer = int( str(num_list[max_index]) + str(num_list[middle_index]) ) + num_list[min_index]

print(answer)


Measured memory_bytes: 3064
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main()
{
	int i,len,count=0;
	char str[21],s[1000];
	for (;;)
	{
		scanf("%s", &s);
		len = strlen(s);
		if (0 <= len && len <= 20){
			strcpy(str, s);
			break;
		}
	}
	for (i = 0; str[i] != '\0';i++){ count++; }
	for (i=count-1; i >= 0; i--){
		printf("%c", str[i]);
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 524
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

long long chmax(long long a, long long b){
    if(a < b) return b;
    return a;
}

int main() {
    int i, j;
    int n;
    long long a[100010] = {0};
    long long b[100010] = {0};
    long long c[100010] = {0};
    long long dp[100010][3] = {0};
    long long ans;
    
    scanf("%d", &n);
    for(i = 0; i < n; i++){
        scanf("%lld%lld%lld", &a[i], &b[i], &c[i]);
    }
    for(i = 0; i < n; i++){
        dp[i+1][0] = chmax(dp[i+1][0], dp[i][1] + a[i]);
        dp[i+1][0] = chmax(dp[i+1][0], dp[i][2] + a[i]);
        dp[i+1][1] = chmax(dp[i+1][1], dp[i][2] + b[i]);
        dp[i+1][1] = chmax(dp[i+1][1], dp[i][0] + b[i]);
        dp[i+1][2] = chmax(dp[i+1][2], dp[i][0] + c[i]);
        dp[i+1][2] = chmax(dp[i+1][2], dp[i][1] + c[i]);
        //printf("[%lld %lld %lld]\n", dp[i+1][0],dp[i+1][1], dp[i+1][2]);
    }
    ans = 0;
    ans = chmax(dp[n][0], dp[n][1]);
    ans = chmax(ans, dp[n][2]);
    
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
#define lli long long int
#define MOD 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<int>
#define vvi vector<vector<int>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    lli n, k;
    cin >> n >> k;
    vector<lli> a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));

    // Binary search
    lli left = -INFLL/2;
    lli right = INFLL/2;
    while(right - left > 1){
        lli x = (left + right) / 2;
        lli cnt = 0;        
        lli selfcnt = 0;

        rep(i, n){
            if(a[i] > 0){
                // a[i] is Positive value
                int cur_l = -1;
                int cur_r = n;
                while(cur_r - cur_l > 1){
                    int m = (cur_l + cur_r) / 2;
                    if(a[i] * a[m] <= x) cur_l = m;
                    else cur_r = m;
                }
                cnt += cur_r;
            }
            else if(a[i] < 0){
                // a[i] is Negative value
                int cur_l = -1;
                int cur_r = n;
                while(cur_r - cur_l > 1){
                    int m = (cur_l + cur_r) / 2;
                    if(a[i] * a[m] <= x) cur_r = m;
                    else cur_l = m;
                }
                cnt += (n - cur_r);
            }
            else{
                // a[i] is Zero
                if(x >= 0) cnt += n;
            }
            if(a[i]*a[i] <= x) selfcnt++;
        }
        lli num = (cnt - selfcnt) / 2;
        if(num >= k) right = x;
        else left = x;
    }
    cout << right << endl;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  vector<long double> P(N);
  REP(i, N) cin >> P[i];
  vector<vector<long double>> DP =
      vector<vector<long double>>(N + 1, vector<long double>(N + 1, 0));
  DP[0][0] = 1.0;
  FOR(i, 1, N + 1) {
    FOR(j, 0, N + 1) {
      if (j == 0)
        DP[i][j] = DP[i - 1][j] * ((long double)1.0 - P[i - 1]);
      else
        DP[i][j] = (DP[i - 1][j - 1] * P[i - 1]) +
                   (DP[i - 1][j] * ((long double)1.0 - P[i - 1]));
    }
  }
  long double ans = 0;
  FOR(i, (N / 2) + 1, N + 1) { ans += DP[N][i]; }
  cout << SP(20) << ans << endl;

  return 0;
}


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

#define INPUTSIZE 10

int main() {
    int inputs[INPUTSIZE];
    for (int i = 0; i < INPUTSIZE; i++) cin >> inputs[i];

    sort(inputs, inputs + INPUTSIZE);

    for (int i = 1; i <= 3; i++) cout << inputs[INPUTSIZE - i] << endl;

    return 0;
}

Measured memory_bytes: 3128
import itertools
import math
import fractions
import functools
import copy
s = input()

front = int(s[0]+s[1])
back = int(s[2]+s[3])

if (1 <= front and front <= 12) and (1 <= back and back <= 12):
    print("AMBIGUOUS")
    quit()
if (1 <= front and front <= 12):
    print("MMYY")
    quit()
if (1 <= back and back <= 12):
    print("YYMM")
    quit()

print("NA")

Measured memory_bytes: 65772
#include <algorithm>
#include <iostream>
#include <queue>
#include <utility>

using namespace std;

typedef pair<int, int> P;

int n, m;
P p[110000];
//priority_queue<P, vector<P>, greater<P> > pq;
priority_queue<int> pq2;
long long ans;

int main()
{
  cin >> n >> m;
  
  for (int i = 0; i < n; i++) {
    //int a, b;
    //cin >> a >> b;
    //pq.push(P(a, b));
    cin >> p[i].first >> p[i].second;
  }
  
  sort(p, p+n);
  
  int id = 0;
  for (int i = 1; i <= m; i++) {
    /*while (pq.top().first == i) {
      pq2.push(pq.top().second);
      pq.pop();
    }
    if (pq2.empty()) continue;
    ans += pq2.top();
    pq2.pop();*/
    while (id < n and p[id].first == i) {
      pq2.push(p[id].second);
      id++;
    }
    if (pq2.empty()) continue;
    ans += pq2.top();
    pq2.pop();
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1660
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        n: usize,
        m: usize,
    }
    let inf = 10_0000_0000 + 7;
    let mut ans = 1;
    if n==m || n==m+1 || n+1==m {
        for i in (1..n+1).rev() {
            ans *= i;
            ans %= inf;
        }
        for i in (1..m+1).rev() {
            ans *= i;
            ans %= inf;
        }
        if n==m {
            ans *= 2;
            ans %= inf;
        }
        println!("{}", ans);
    } else {
        println!("0");
    }
}


Measured memory_bytes: 2168
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>

long long int A, B;

int main() {
  std::cin >> A >> B;

  std::cout << (A * B) << std::endl;

  return 0;
}

Measured memory_bytes: 3636
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();
    int ans = 0;
    if(a <= c && c <= b) {
      if(d <= b) {
        ans = d - c;
      } else {
        ans = b - c;
      }
    } else if(c < a && d >= a) {
      if(d > b) {
        ans = b - a;
      } else {
        ans = d - a;
      }
    }
    System.out.println(ans);
  }
}

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

using namespace std;

int main()
{
	int N, answer = 0;
	string S;
	cin >> N >> S;
	for (int count = 0; count < N; count++)
	{
		if (count < N - 2 && S.at(count) == 'A')
		{
			if (S.at(count + 1) == 'B')
			{
				if (S.at(count + 2) == 'C')
				{
					answer++;
				}
			}
		}
	}
	cout << answer << endl;
}

Measured memory_bytes: 256
#define lp(i,n) for(int i=0;i<n;i++)
#define pau system("pause")
#include<bits/stdc++.h>

using namespace std;
int main(){
   int a,b,c;
   cin>>a>>b>>c;
   if(a+b+c>=22)
    cout<<"bust"<<endl;
   else
    cout<<"win"<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	char ch;
	cin>>a>>ch>>b;
	switch(ch)
	{
		case '+':
			cout<<a+b;
			break;
		case '-':
			cout<<a-b;
			break;
		case '*':
			cout<<a*b;
			break;
		case '/':
			cout<<a/b;
			break;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
int cl(int a, int b) {
	return (a - (a%b)) / b;//b=0だと積む
}
int up(int a, int b) {
	return cl(a + b - 1, b);//b=0だと積む
}
int main() {
	int n, a, b, c, d, k, l;
	cin >> n >> a >> b >> c >> d;
	k = up(n,a);
	l = up(n,c);
	if (k*b >= l * d) {
		cout << l * d << endl;
	}
	else {
		cout << k * b<<endl;
	}
}


Measured memory_bytes: 3092
#include<iostream>
#include<cstdio>

using namespace std;

class Cube {
public:
	int f[6];
	Cube(){}
	void move(char ch) {
		if (ch == 'N') {
			int t = f[0];
			f[0] = f[1];
			f[1] = f[5];
			f[5] = f[4];
			f[4] = t;
		}
		if (ch == 'S') {
			int t = f[0];
			f[0] = f[4];
			f[4] = f[5];
			f[5] = f[1];
			f[1] = t;
		}
		if (ch == 'E'){
			int t = f[0];
			f[0] = f[3];
			f[3] = f[5];
			f[5] = f[2];
			f[2] = t;
		}
		if (ch == 'W') {
			int t = f[0];
			f[0] = f[2];
			f[2] = f[5];
			f[5] = f[3];
			f[3] = t;
		}
	}
};

int main() {
	Cube c;
	string com;

	for (int i = 0; i < 6; i++) {
		cin >> c.f[i];
	}
	cin >> com;

	for (int i = 0; i < com.size(); i++) {
		c.move(com[i]);
	}

	cout << c.f[0] << endl;

	return 0;
}


Measured memory_bytes: 3188
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INF = INT_MAX/10;

int main() {
	int w, d;
	while(cin >> w >> d, w) {
		vi front(w), side(d);
		REP(i, w) {
			cin >> front[i];
		}
		REP(i, d) {
			cin >> side[i];
		}
		sort(RALL(front));
		sort(RALL(side));

		int ans = 0;
		int fpos = 0, spos = 0;
		while(fpos < w || spos < d) {
			if(fpos >= w) {
				ans += side[spos];
				spos++;
			} else if(spos >= d) { 
				ans += front[fpos];
				fpos++;
			} else if(front[fpos] == side[spos]) {
				ans += front[fpos];
				fpos++;
				spos++;
			} else if(front[fpos] > side[spos]) {
				ans += front[fpos];
				fpos++;
			} else if(front[fpos] < side[spos]) {
				ans += side[spos];
				spos++;
			}
		}
		cout << ans << endl;
	}

	return 0;
}

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

using namespace std;

#define int long long
#define ld long double
#define sz(a) (int) (a).size()
#define all(a) (a).begin(), (a).end()
#define x first
#define y second

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int maxn = 1010;

int a[maxn][maxn];
int dp[maxn][maxn];

int n, m;

vector<int> dx = {0, 0, 1, -1};
vector<int> dy = {1, -1, 0, 0};


bool ok(int x, int y) {
    if (x < 0 || y < 0 || x >= n || y >= m || a[x][y] == 1) return false;
    return true;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    cin >> n >> m;
    int stx, sty;
    int edx, edy;
    cin >> stx >> sty;
    cin >> edx >> edy;
    stx--, sty--;
    edx--, edy--;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        for (int j = 0; j < m; j++) {
            a[i][j] = (s[j] == '#');
        }
    }
    assert(a[stx][sty] == 0);
    memset(dp, -1, sizeof dp);
    deque<pair<int, int>> q;
    q.push_back({stx, sty});
    dp[stx][sty] = 0;
    while (!q.empty()) {
        auto [x, y] = q.front();
        q.pop_front();
        for (int i = 0; i < 4; i++) {
            int nx = x + dx[i], ny = y + dy[i];
            if (!ok(nx, ny)) continue;
            if (dp[nx][ny] == -1 || dp[nx][ny] > dp[x][y]) {
                dp[nx][ny] = dp[x][y];
                q.push_front({nx, ny});
            }
        }
        for (int i = -2; i <= 2; i++) {
            for (int j = -2; j <= 2; j++) {
                int nx = x + i, ny = y + j;
                if (!ok(nx, ny)) continue;
                if (dp[nx][ny] == -1 || dp[nx][ny] > dp[x][y]) {
                    dp[nx][ny] = dp[x][y] + 1;
                    q.push_back({nx, ny});
                }
            }
        }
    }
    cout << dp[edx][edy] << '\n';

    return 0;
}


Measured memory_bytes: 21408