akhauriyash/Code-Regression huggingface dataset:
fn main() {
    let s: String = read();

    for _ in 0..s.len() {
        print!("x");
    }
}

use std::io::stdin;
use std::io::Read;
use std::str::FromStr;

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


Measured memory_bytes: 4352
s = list(input())
a,b = 0,0
bc = 0
ans = 0
for i in s:
    if i == "A":
        if b == 1:
            a, b = 1, 0
        else:
            a += 1
            a_now = 1
    elif i == "B":
        if b == 1 or a == 0:
            a, b = 0, 0
        else:
            b = 1
    else:
        if b == 1:
            ans += a
            b = 0
        else:
            a, b = 0, 0
print(ans)




Measured memory_bytes: 4840
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include<queue>
using namespace std;
//conversion
//------------------------------------------
inline long long toint(string s) {long long v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef long long ll;
typedef long long LL;
typedef vector<int > vi;
typedef vector<long long > VLL;
typedef vector<long long > vll;
typedef vector<string > ves;
typedef vector<char > vech;

typedef pair<long long , long long> pll;
typedef pair<long long , long long> PLL;
typedef map<ll , ll >mll;
typedef map<int , int >mii;
typedef map<char , int >mci;
typedef map<char , ll >mcl;


//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define VECMAX(x) *max_element(ALL(x))
#define VECMIN(x) *min_element(ALL(x))
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//#define MULTIPLE(i,n,k) for(int i = (k) ; i<(n) ; i+=k+1)//倍数ループ
//constant
//------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define SIZEOF(x) sizeof(x)/sizeof(x[0])

const long long INF = 100000000000000;
const long long NINF = -100000000000000;




//-------------------------------------------------------------





//-----------MAIN------------//
//注意::::DPの配列、vectorはグローバル変数を使え！！そして引数として与えるな！！
//       Sqrは２乗 sqrtはルート
#define CIN(a) REP(i,a.size())cin >> a[i];

int main(){
    string s;
    cin >> s;
    string t = "";
    map <string , bool> p;
    p["esare"] = true;
    p["resare"] = true;
    p["maerd"] = true;
    p["remaerd"] = true;
    ll v = s.size();
    REP(i,v){
        int ind =   v- i - 1;
        t+= s[ind];
        if(p[t]){
            t = "";
        }
      if(t.size()>10){
        break;
      }
    }
    if(!t.size())cout << "YES" << endl;
    else cout << "NO" <<endl;
   
    return 0;
}







Measured memory_bytes: 512
#include<iostream>
#include<string>
using namespace std;
int main(){
	int m;
	int s=100000;
	cin>>m;
	for(int i=0;i<m;i++){
       s = s*1.05;
		if(s%1000!=0)
	 s = ((s/1000)+1)*1000;
	}
	cout<<s<<endl;
    return 0;
}

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

class Program
{
    static void Main()
    {
        int[] In = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int n = In[0];
        int m = In[1];
        var L = new List<int>[n];
        int[] P = new int[m];
        int[] Y = new int[m];
        for (int i=0; i < n; i++)
        {
            L[i] = new List<int>();
        }
        for (int i = 0; i < m; i++)
        {
            int[] In2 = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int p = In2[0];
            int y = In2[1];
            p--;
            P[i] = p;
            Y[i] = y;
            L[p].Add(y);
        }
        //ここオロチポイント
        //key=year, value=rank
        var Dic = new Dictionary<int, int>();
        for(int i = 0; i < n; i++)
        {
            var SL = L[i].OrderBy(x => x).ToList();
            for(int j = 0; j < SL.Count; j++)
            {
                Dic[SL[j]] = j+1;
            }
        }
        for(int i=0; i < m; i++)
        {
            Console.WriteLine((P[i]+1).ToString("000000") + Dic[Y[i]].ToString("000000"));
        }
    }
}


//TLE
//namespace C
//{
//    class Program
//    {
//        static void Main(string[] args)
//        {
//            int[] In = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
//            int n = In[0];
//            int m = In[1];
//            var PY = new Pair[m];
//            for(int i = 0; i < m; i++)
//            {
//                int[] In2 = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
//                int p = In2[0];
//                int y = In2[1];
//                PY[i] = new Pair(p, y);
//            }
//            var z = PY.OrderBy(_ => _.x).ThenBy(_ => _.y).ToArray();
//            for(int i=0; i < m; i++)
//            {
//                string text = "";
//                text = PY[i].x.ToString("000000");
//                var zz = z.Where(_ => _.x == PY[i].x).ToArray();
//                for(int j = 0; j < zz.Length; j++)
//                {
//                    if (PY[i].y == zz[j].y)
//                    {
//                        j++;
//                        text += j.ToString("000000");
//                        break;
//                    }
//                }
//                Console.WriteLine(text);
//            }
//        }
//    }
//    public struct Pair
//    {
//        public int x, y;
//        public Pair(int x, int y)
//        {
//            this.x = x;
//            this.y = y;
//        }
//    }
//}


Measured memory_bytes: 61080
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}

macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let mut dp = vec![0; n];
    let mut ans = 0;
    for _ in 0..n {
        let p = sc.cin::<usize>() - 1;
        if p == 0 {
            dp[0] = 1;
        } else {
            dp[p] = dp[p-1] + 1;
        }
        ans = max!(ans, dp[p]);
    }
    // trace!(&dp);
    put!(n - ans);
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
}


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


public class Main {
	private	static	BufferedReader	stdin = null;
	private	static	int[][]			piece = {
		{ 2, 2, 0x03, 0x03 },
		{ 4, 1, 0x01, 0x01, 0x01, 0x01 },
		{ 1, 4, 0x0F },
		{ 3, 2, 0x02, 0x03, 0x01 },
		{ 2, 3, 0x03, 0x06 },
		{ 3, 2, 0x01, 0x03, 0x02 },
		{ 2, 3, 0x06, 0x03 },
	};

	static {
		stdin = new BufferedReader(new InputStreamReader(System.in));
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int[]	board     = null;
		int		nMatchNum = 0;

		while ((board = parseBoard()) != null) {
			nMatchNum = -1;

			for (int y = 0; y < 8 && nMatchNum == -1; y++) {
				for (int x = 0; x < 8 && nMatchNum == -1; x++) {
					nMatchNum = isMatchPieceNum(x, y, board);
				}
			}

			if (nMatchNum != -1) {
				System.out.println((char)('A' + nMatchNum));
			}
		}
	}
	
	private static int isMatchPieceNum(int cx, int cy, int[] board) {
		boolean	bEnable   = false;
		int		nMatchNum = -1;

		if (board != null) {
			for(int i = 0; i < piece.length; i++) {
				int nH = piece[i][0];
				int nW = piece[i][1];

				if (0 <= cy && cy + nH <= 8) {
					if (0 <= cx && cx + nW <= 8) {
						bEnable = true;
						for (int y = 0; y < nH && bEnable; y++) {
							int	nPBit = piece[i][2 + y] << cx;
							int	nBBit = board[cy + y] & 0xFF;

							if ((nBBit & nPBit) != nPBit) {
								bEnable = false;
							}
						}
					}
				}

				if (bEnable) {
					nMatchNum = i;
					break;
				}
			}
		}
	
		return nMatchNum;
	}

	private static int[] parseBoard() {
		int[]	board = null;
		String	line  = null;
		int		n1    = 0;

		for (; ; n1++) {
			line = parseStdin();
			if (line == null) {
				break;
			}

			if (n1 == 0) {
				board = new int[8];
			}

			if (n1 < 8){
				int nBit = 0;
	
				for (int n2 = 7; n2 >= 0; n2--) {
					nBit <<= 1;
					nBit |= (line.charAt(n2) == '1') ? 0x01 : 0x00;
				}
	
				board[n1] = nBit;
			}
		}

		return board;
	}

	private static String parseStdin() {
		String	strNum = null;

		try {
			String line = stdin.readLine();
			if (line != null) {
				if (!line.isEmpty()) {
					strNum = line;
				}
			}
		}
		catch (IOException e) {}

		return strNum;
	}
}

Measured memory_bytes: 17820
n = STDIN.gets.chomp.to_i
a = STDIN.gets.chomp.split(' ').map(&:to_i)

b = []

n.times do |i|
  if i % 2 == 0
    b.push(a[i])
  else
    b.unshift(a[i])
  end
end

b.reverse! unless n % 2 == 0

puts b.join(' ')


Measured memory_bytes: 27360
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
 
#define endl '\n'
#define loop(i, m, n) for (lli i = m; i < n; i++)
#define loope(i, m, n) for (lli i = m; i <= n; i++)
#define epool(i, m, n) for (lli i = m; i >= n; i--)
#define maxe *max_element
#define mine *min_element
#define mod 1000000007
#define mod2 998244353
#define vt vector<lli>
#define fi first
#define se second
#define pb push_back
#define umap unordered_map
#define mmap multimap
#define MP make_pair
#define empf emplace_front
#define empb emplace_back
#define ret(x) return cout << x << endl, 0;
#define all(v) v.begin(),v.end()

#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
using namespace std;
 
lli gcd(lli a, lli b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
 
lli lcm(lli a, lli b){
    return (a * b) / gcd(a, b);
}
 
lli modi( lli n, lli m=mod ){ 
    n%=m;
    n+=m;
    n%=m;
    return n;
}

lli mpow(lli base, lli exp){
    base %= mod;
    lli result = 1;
    while (exp > 0){
        if (exp & 1)
            result = ((lli)result * base) % mod;
        base = ((lli)base * base) % mod;
        exp >>= 1;
    }
    return result;
}

const lli MIN=-1*1e18;
const lli INF=1e18+999999999999999999;
const lli N=2e5+5;
const ldb pi=4*atan(1);

int32_t main(){
    fast_io
    lli i = 0,j = 0;
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    //cout << fixed << setprecision(22);
    string s;
    cin >> s;
    if(s=="ABC") cout << "ARC";
    else cout << "ABC";
    cout << endl;


}



Measured memory_bytes: 3652
# 整数の入力
length = int(input())
numbers = map(int, input().split())
#リストを使うと下記のように出力される。
#print(list(numbers))
#[5, 6, 8, 10]

#これをこのままmap関数で一つずつ処理をしてあげたい

#引数が配列、何回処理できるか返す関数を作る 
def how_many_times_divisible(n):
	#回数をまずは０で定義
	count = 0
    #一つずつ処理される入ってきた値が割り切れなくなるまで
	while n % 2 == 0:
		#2でわる
		n = n / 2
		#回数を一上げる
		count = count + 1
    #割れなくなったら返す
	return count
  
#最大で何回操作を行うことができるかなので、帰ってきた値の中で一番小さい数を出力する
ans = min(map(how_many_times_divisible,numbers))

#答え
print(ans)

Measured memory_bytes: 2940
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cmath>
#include<utility>
#include<stdio.h>
#include<cstdlib>
#include<iomanip> //cout<<setiosflags(ios::fixed)<<setprecision(2);
#include<ctime> //double a=(double)clock();   cout<<a<<endl;
#include<vector>
#include<queue>
using namespace std;
inline int read(){
    int x=0,ff=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')ff=-1;ch=getchar();}
    while(ch<='9'&&ch>='0'){x=x*10+ch-'0';ch=getchar();}
    return ff*x;
}
const int maxn=100010;
int N,a[maxn];
int main(){
	//freopen("in","r",stdin);
	N=read();
	for(int i=1;i<=N;i++)
		a[i]=read();
	a[1]--;
	for(int i=2;i<=N;i++){
		if(a[i]>a[i-1])
			a[i]--;
		if(a[i]<a[i-1])
			return printf("No\n"),0;
	}
	printf("Yes\n");
	return 0;
}
 


Measured memory_bytes: 640
fun main(args: Array<String>) {
    tenka12018beginner_c()
}

fun tenka12018beginner_c() {
    val n = readLine()!!.toInt()
    val aList = (1..n).map { readLine()!!.toLong() }
        .sorted().toLongArray()

    var beforeSmaller = aList.first()
    var beforeBigger = aList.last()
    var answer = beforeBigger - beforeSmaller
    for (i in 1 until aList.size / 2) {
        val currSmaller = aList[i]
        val currBigger = aList[aList.lastIndex - i]
        answer += (beforeBigger - currSmaller) + (currBigger - beforeSmaller)
        beforeSmaller = currSmaller
        beforeBigger = currBigger
    }

    if (n % 2 != 0) answer += Math.max(
        aList[aList.lastIndex / 2 + 1] - aList[aList.lastIndex / 2],
        aList[aList.lastIndex / 2] - aList[aList.lastIndex / 2 - 1]
    )

    println(answer)
}


Measured memory_bytes: 49012
/*
    written by Pankaj Kumar.
    country:-INDIA
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
typedef set<pair<int,int>> spi;
typedef set<pair<ll,ll>> spl;
typedef vector<pair<int,int>> vpi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<pair<ll,ll>> vpl;
typedef vector<string> vs;
typedef map<ll,ll> ml;
typedef set<string> ss;
typedef set<char>sc;
typedef set<int> si;
typedef set<ll> sl;
#define pan cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
// define values.
#define mod 1000000007
#define phi 1.618
/* Bit-Stuff */
#define get_set_bits(a) (__builtin_popcount(a))
#define get_set_bitsll(a) ( __builtin_popcountll(a))
#define get_trail_zero(a) (__builtin_ctz(a))
#define get_lead_zero(a) (__builtin_clz(a))
#define get_parity(a) (__builtin_parity(a))
/*  Abbrevations  */
#define ff first
#define ss second
#define mp make_pair
#define line cout<<endl;
#define pb push_back
#define Endl "\n"
// loops
#define loop(i,start,end) for(ll i=ll(start);i<ll(end);i++)
#define loop0(num) for(ll i=0;i<ll(num);i++)
#define forin(arr,n) for(ll i=0;i<n;i++) cin>>arr[i];
// Some print
#define no cout<<"NO"<<endl;
#define yes cout<<"YES"<<endl;
#define cc ll test;cin>>test;while(test--)
// sort
#define all(V) (V).begin(),(V).end()
#define srt(V) sort(all(V))
#define srtGreat(V) sort(all(V),greater<ll>())
// function

ll power(ll x,ll y)
{
    ll res=1;
    while(y>0)
    {
        if(y%2==1)res*=x;
        y/=2; x*=x;
    }
    return res;
}
/* ascii value 
A=65,Z=90,a=97,z=122
*/
/*  -----------------------------------------------------------------------------------*/
ll solve()
{
    string s,t;
    cin>>s>>t;
    ll maxo=1000001;
    ll count=1000001;
    for(ll i=0;i<s.length();i++)
    {
        if(ll(i+t.length())<=ll(s.length()))
        {
            // cout<<"hi "<<endl;
            count=0;
            ll pos=0;
            for(ll j=i;j<ll(i+t.length());j++)
            {
                if(s[j]!=t[pos])
                    count++;
                pos++;
            }
        }
        // cout<<count<<endl;
        maxo=min(maxo,count);
    }
    cout<<maxo<<endl;
    return 0;
}

int main()
{
    //freopen("input.txt"a, "r", stdin);
    // cc
    // {
        solve();
    // }
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, cnt = 0;
  cin >> n;
  vector<int> p(n+1);
  for (int i = 1; i <= n; i++) cin >> p[i];
  for (int i = 1; i <= n; i++) {
    if (p[i] != i) continue;
    cnt++;
    if (i < n && i+1 != p[i]) {
      swap(p[i+1], p[i]);
      continue;
    }
    if (i > 1 && i-1 != p[i]) {
      swap(p[i-1], p[i]);
      continue;
    }
    cnt++;
  }
  
  cout << cnt << endl;
}

Measured memory_bytes: 640
def solve():
  while True:
    m, n  = int(input()), int(input())
    if not m:
      break
    ices = [[0] + list(map(int,input().split())) + [0] for _ in range(n)]
    ices.insert(0, [0] * (m + 2),)
    ices.append([0] * (m + 2))
    score = [[0] * (m + 2) for _ in range(n + 2)]
    
    for x in range(1, n + 1):
      for y in range(1, m + 1):
        score[x][y] = ices[x - 1][y] + ices[x + 1][y] + ices[x][y - 1] + ices[x][y + 1] 
    def search(x, y, imap, acc):
      imap[x][y] = 0
      acc += 1
      a = b = c = d = 0
      if imap[x - 1][y]:
        a = search(x - 1, y, imap, acc)
      if imap[x + 1][y]:
        b = search(x + 1, y, imap, acc)
      if imap[x][y - 1]:
        c = search(x, y - 1, imap, acc)
      if imap[x][y + 1]:
        d = search(x, y + 1, imap, acc)
      imap[x][y] = 1
      return max(acc, a, b, c, d)
    
    ans = 0
    for x in range(1, n + 1):
      for y in range(1, m + 1):
        if score[x][y] in [1, 2] and ices[x][y]:
          a = search(x, y, ices, 0)
          if ans < a:
            ans = a
    
    print(ans)

solve()


Measured memory_bytes: 5816
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int N;
scanf("%d",&N);
int count =0;
if (N==1) {printf("Yes");return 0;}
for (int i=2;i<=9;i++){
float div = (float)N/i;
int di = (int)div;
    if (div*(float)i==(float)N && div<10 && (float)di==div){count++;
            printf("Yes");
                break;}
    else if (count==0 && i%9==0) {printf("No");}
}

return EXIT_SUCCESS;
}


Measured memory_bytes: 128
# 解説AC
from itertools import accumulate

def main():
    N,X = map(int, input().split())
    T = [0] + [int(i) for i in input().split()]
    S = list(accumulate(T))

    ans = float("inf")
    for k in range(1, N + 1):
        cost = (N + k) * X
        for i, now in enumerate(range(N, 0, -k), start = 1):
            x = S[now] - S[max(0, now - k)]
            cost += 5 * x if (i == 1) else (2 * i + 1) * x

        ans = min(ans, cost)

    print(ans)

if __name__ == "__main__":
    main()

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

ll euclidean_gcd(ll a,ll b) {
  while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
  }
  return a;
}

int main(void){
    ll a,b; cin >> a >> b;
    set<ll>common,ans;
    for(int i=1;i<=pow(a,0.5);i++){
        if(a%i==0 && b%i==0) common.insert(i);
        ll rev = a/i;
        if(a%rev==0 && b%rev==0) common.insert(rev);
    }
    bool exist=false;
    for(auto iter=common.begin();iter!=common.end();iter++){
        exist=false;
        for(auto jter=ans.begin();jter!=ans.end();jter++){
            if(euclidean_gcd(*iter,*jter)!=1){
                exist=true;
                break;
            } 
        }
        if(exist==false) ans.insert(*iter);
    }
    cout << ans.size() << endl;
    return 0;
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.IO;

namespace SolutionCS
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int A = int.Parse(s[0]);
            int B = int.Parse(s[1]);
            int C = int.Parse(s[2]);
            int X = int.Parse(s[3]);
            int Y = int.Parse(s[4]);

            int ans = 0;

            if (A + B < C * 2)
            {
                ans = A * X + B * Y;
            }
            else
            {
                int c0 = C * Math.Max(X, Y) * 2;
                int c1 = C * Math.Min(X, Y) * 2 + A * (X - Math.Min(X, Y)) + B * (Y - Math.Min(X, Y));

                ans = Math.Min(c0, c1);
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

using namespace std;

int main()
{
    int a,i,max,s;
    scanf("%d",&a);
    int sz[1000]={0};
    if(a>2)
    for(i=2;i<=sqrt(a+0.5);i++)
    {
        sz[i]=1;
        s=a;
        while(s>=i)
        {
            sz[i]=sz[i]*i;
            s=s/i;
        }
    }
    if(a>2)
    {
        max=sz[i];
        for(i=2;i<=sqrt(a+0.5);i++)
        {
            if(sz[i]>max)
                max=sz[i];
        }
        printf("%d\n",max);
    }
    else
    {
        printf("%d\n",a);
    }
    return 0;
}


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

int N,n;
P p[300000],dat[1200000];
void init(int n){
	N=1;
	while(N<n)N<<=1;
	for(int i=0;i<2*N-1;i++)dat[i]={0,0};
}
void update(int k,int x){
	k+=N-1;
	dat[k]={x,k-N+1};
	while(k>0){
		k=(k-1)/2;
		dat[k]=max(dat[k*2+1],dat[k*2+2]);
	}
}
bool ok(int t){
	init(t);
	int s=0;
	ll sum=0;
	for(int i=n-1;i>=n-t+1;i--){
		update(s++,p[i].second);
		sum+=p[i].second;
	}
	if(p[n-t].first*(ll)t>=(ll)sum+p[n-t].second)return true;
	for(int i=n-t;i>0;i--){
		if(dat[0].first>p[i].second){
			sum-=dat[0].first-p[i].second;
			update(dat[0].second,p[i].second);
		}
		if(p[i-1].first*(ll)t>=(ll)sum+p[i-1].second)return true;
	}
	return false;
}
int main() {
	scanf("%d",&n);
	rep(i,n){
		int a,b;scanf("%d%d",&a,&b);
		p[i]={b,a};
	}
	sort(p,p+n);
	int a=0,b=n;
	while(a!=b){
		int t=(a+b)/2;
		if(b-a==1)t=b;
		if(ok(t))a=t;
		else b=t-1;
	}
	printf("%d\n",a);
}

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

namespace Atc_0028
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();

            for (int i = 0; i < str.Length - 1; i++)
            {
                if (str.Substring(i, 1) == str.Substring(i + 1, 1))
                {
                    Console.WriteLine("Bad");
                    return;
                }
            }
            
            Console.WriteLine("Good");
        }
    }
}


Measured memory_bytes: 25756
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int mod = 1e9 + 7;
const int inf = 2e9;
const ll linf = 9e18;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int r, g, b, n;
    cin >> r >> g >> b >> n;

    int ans = 0;
    rep(i, 0, n + 1) {
        rep(j, 0, n + 1) {
            int sum = r * i + g * j;
            if (sum == n) ans++;
            else if (sum < n) {
                if ((n - sum) % b == 0) ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define MSET(x,y) memset(x,y,sizeof(x))
#define M 
using namespace std;
int main()
{
    int d;
    while (~scanf("%d", &d)) {
        if (d==22) puts("Christmas Eve Eve Eve");
        else if (d==23) puts("Christmas Eve Eve");
        else if (d==24) puts("Christmas Eve");
        else puts("Christmas");
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define m0(x) memset(x, 0, sizeof(x))

int A[200][200];

int main() {
  int N, D;
  scanf("%d %d", &N, &D);
  rep(i, N) {
    rep(j, D) { scanf("%d", &A[i][j]); }
  }

  int num = 0;
  rep(i, N) {
    for (int j = i + 1; j < N; j++) {
      double val = 0;
      for (int k = 0; k < D; k++) {
        val += (A[i][k] - A[j][k]) * (A[i][k] - A[j][k]);
      }
      val = std::sqrt(val);
      if (std::ceil(val) == std::floor(val)) num++;
    }
  }
  printf("%d", num);
}


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


int main(){

  string s;
  cin>>s;
  int a=0,b=0;
  for(int i=0;i<s.size();i++){
    if(s[i]=='A')a++;
       else b++;
       }
       if(a>0&&b>0)cout<<"Yes"<<endl;
       else cout<<"No"<<endl;
     

	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace atcoder097_A
{
    class Program
    {
        static void Main(string[] args)
        {
            //入力を受け取る
            int[] t_input = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
            int a = t_input[0];
            int b = t_input[1];
            int c = t_input[2];
            int d = t_input[3];
            string result = "No";

            if ((Math.Abs(a - b) <= d) && (Math.Abs(b - c) <= d)) result = "Yes";
            if (Math.Abs(a - c) <= d) result = "Yes";

            Console.WriteLine(result);
            
        }
    }
}


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

int main(){
    int n;cin>>n;
    string s;cin>>s;
    stack<char> st;
    for(auto i : s){
        if(st.empty()) st.push(i);
        else{
            if(i==st.top()) continue;
            st.push(i);
        }
    }
    long long count=0;
    while(!st.empty()) count++,st.pop();
    cout<<count<<"\n";
    return 0;
}

Measured memory_bytes: 512
while true
    n = gets.to_i
    if n == 0
        break
    end
    a=[]
    for i in 1..n
        str=gets.split(" ")
        s=(str[0][0..1].to_i*60 + str[0][3..4].to_i)*60+str[0][6..7].to_i
        t=(str[1][0..1].to_i*60 + str[1][3..4].to_i)*60+str[1][6..7].to_i
        a<<[s,1]
        a<<[t,0]
    end
    a.sort!
    waiting=0
    ret=0
    a.each{|it|
        if it[1]==1
            if waiting==0
                ret+=1
            else
                waiting-=1
            end
        elsif it[1]==0
            waiting+=1
        end
    }
    puts ret
end

Measured memory_bytes: 9940
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int a = stdIn.nextInt();
		int b = stdIn.nextInt();
		int c = a - b;
		
		if (a < b) {
			System.out.println(0);
		} else {
			System.out.println(c);
		}
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int x, y, z;
  cin >> x >> y >> z;
  cout << z << ' ' << x << ' ' << y << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ull = unsigned long long;
using vl = vector<ll>;
using vi = vector<int>;
using vchar = vector<char>;
using vstr = vector<string>;
using pll =  pair<ll,ll>;

const ll mod = 1000000007;
const ll inf = 1000000000000000;

#define pi acos(-1)
#define pb push_back
#define test int TEST;cin>>TEST;while(TEST--)
#define vsort(xx) sort(xx.begin(),xx.end())
#define vrevsort(xx) sort(xx.rbegin(),xx.rend())


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
  int r;cin>>r;cout<<2*pi*r;
    
   
    return 0;
}




Measured memory_bytes: 3804
#include<bits/stdc++.h>
using namespace std;
// << left shift *2 and >>right shift /2
long long int mod97=1000000007;
double pi=3.1415926536;
bool comp(pair<long long int,long long int>a,pair<long long int,long long int>b)
{
    if(a.first==b.first)
    {
        if(a.second<=b.second)
        return true;
        else
        return false;
    }
    if(a.first>b.first)
    return true;
    else return false;
}
bool rev(long long int a,long long int b)
{
    if(a>b)return true;
    else return false;
}
bool compa(pair<string,pair<int,int>>a,pair<string,pair<int,int>>b)
{
    if(a.first==b.first)
    {
        if(a.second.first>b.second.first)
        return true;
        else
        return false;
    }
    if(a.first<b.first)
    return true;
    else 
    return false;
}
long long int gcd(long long int bdda,long long int chota)
{
    if(chota==0)
        return bdda;
    return gcd(chota,bdda%chota);
}

void solve()
{
    long long int n,c;cin>>n>>c;
    long long int w[n],v[n];
    long long int mac=0;
    for(long long int i=0;i<n;i++)cin>>w[i]>>v[i],mac+=v[i];
    
    long long int dp[n][mac+1];
    for(long long int i=0;i<n;i++)
    {
        for(long long int j=0;j<mac+1;j++)
        {
            dp[i][j]=INT_MAX;
        }
    }
    dp[0][0]=0;
    dp[0][v[0]]=w[0];
    for(long long int i=1;i<n;i++)
    {
        for(long long int j=0;j<mac+1;j++)
        {
            dp[i][j]=dp[i-1][j];
            if(j>=v[i])
            dp[i][j]=min(dp[i][j],dp[i-1][j-v[i]]+w[i]);
        }
    }
    long long int ans=INT_MIN;
    for(long long int i=0;i<mac+1;i++)if(dp[n-1][i]<=c)ans=max(ans,i);
    cout<<ans<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;    
    t=1;
    //cin>>t;long long int temp=t;
    while(t--)
    {
        //cout<<"Case "<<temp-t<<": ";
        solve();
    }
}


Measured memory_bytes: 81588
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element? {
        return self.maxElement()
    }
    func min() -> Element? {
        return self.minElement()
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    func enumerated() -> EnumerateSequence<[Element]> {
        return self.enumerate()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}
//func gcd(x: Int, _ y: Int) -> Int {
//    if y == 0 {
//        return x
//    } else {
//        return gcd(y, x%y)
//    }
//}
//func lcm(x: Int, _ y: Int) -> Int {
//    return x * y / gcd(x, y)
//}

/*************** テストスペース ***************/

//arr.sort{$0.0==$1.0 ? $0.1<$1.1 : $0.0<$1.0}  // 2つの条件に優先順位をつけてソート

/*************** メインプログラム ***************/

let N = readInt()!
let W = readIntSplit(by: " ")
var S1 = 0
var S2 = W.reduce(0){$0+$1}
var ans = abs(S1-S2)
for i in W {
    S1 += i
    S2 -= i
    ans = min(abs(S1-S2), ans)
}
print(ans)


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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//main code

int main(int argc, char const* argv[])
{
	LL N,W;
	cin >> N >> W;
	VVL v(4);
	LL w0,v0;
	cin >> w0 >> v0;
	v[0].push_back(v0);
	for (LL i = 1; i < N; i++) {
		LL a,b;
		cin >> a >> b;
		v[a - w0].push_back(b);
	}
	for (LL i = 0; i < 4; i++) {
		sort(RALL(v[i]));
	}
	VVL sum(4);
	for (LL i = 0; i < 4; i++) {
		sum[i].push_back(0);
	}
	LL ans = 0;
	for (LL i = 0; i < 4; i++) {
		for (LL j = 0; j < v[i].size(); j++) {
			sum[i].push_back(sum[i][j] + v[i][j]);
		}
	}
	for (LL i = 0; i <= v[0].size(); i++) {
		for (LL j = 0; j <= v[1].size(); j++) {
			for (LL k = 0; k <= v[2].size(); k++) {
				for (LL l = 0; l <= v[3].size(); l++) {
					LL tmp_w = i*w0 + j*(w0+1) + k*(w0+2) + l*(w0+3);
					if (tmp_w <= W) {
						ans = max(ans,sum[0][i] + sum[1][j] + sum[2][k] + sum[3][l]);
					}
				}
			}
		}
	}
	cout << ans << endl;
	return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll h1, m1, h2, m2, K;
    cin >> h1 >> m1 >> h2 >> m2 >> K;

    ll sum = 60 - m1;
    h1++;
    sum += (h2 - h1) * 60;
    sum += m2;
    cout << sum - K << endl;
}

Measured memory_bytes: 3648
#include<map>
#include<set>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<chrono>
#include<stack>
#include<fstream>
#include<list>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define SIZE(a) ll(a.size())
#define vll vector<ll> 
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end()) 
#define UNIQUE_ARRAY(a,n) n = unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
#define PER(i,y,x) for(ll i=y;i>=x;i--)
typedef long long ll;
using namespace std;

/*
struct point
{
long long dist; long long name;
bool operator<(const point& rhs) const {
return dist > rhs.dist;
}
};
*/

ll a[400];

int main() {
	ll n;
	cin >> n;	ll s = 0;

	REP(i, 0, n-1) {
		cin >> a[i];
		a[i] *= n;
		s += a[i];
	}
	s /= n;
	ll max_v = 1e18;
	ll max_i;
	REP(i, 0,n-1) {
		if (max_v > abs(a[i] - s) ){
			max_v = abs(a[i] - s);
			max_i = i;
		}
	}
	cout << max_i << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
int main(void){
    string s, t;
    cin>>s>>t;
    bool ok = true;
    rep(i, s.size()){
        if(s[i] != t[i]) ok = false;
    }
    if(ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3624
// https://atcoder.jp/contests/abc069/tasks/abc069_a

#include <iostream>
using namespace std;

int main()
{
  /* Magic word */
  cin.tie(0);
  ios::sync_with_stdio(false);
  /* ---------- */

  int n, m;

  cin >> n >> m;

  cout << (n - 1) * (m - 1) << '\n';

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
int main()
{
    int n; cin>>n;
    string str1,str2;
    cin>>str1>>str2;
    int i=0;
    ll ans=1;
    
    if(str1[0]==str2[0]) ans=3,i++;
    
    else ans=6,i+=2;
    
    for(i;i<n;i)
    {
    //	cout<<str1[i]<<" "<<str2[i]<<endl;
        if(str1[i]==str2[i])
        {
            if(str1[i-1]==str2[i-1])
            {
                ans=ans*2;
                ans%=mod;
            }
            else
            {
                ans=ans;
            }
            i++;
        }
        else
        {
            if(str1[i-1]==str2[i-1])
            {
                ans=ans*2;
                ans=ans%mod;
            }
            else
            {
                ans=ans*3;
                ans=ans%mod;
            }
            i+=2;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
 
int main(void){
  int i,n,x[100],y[100];
  double p_1=0,p_2=0,p_3=0,p_0=0;
 
  scanf("%d",&n);
     
  for(i=0;i<n;i++)
    scanf("%d",&x[i]);
  for(i=0;i<n;i++)
    scanf("%d",&y[i]);
     
  for(i=0;i<n;i++){
    p_1 += abs(x[i]-y[i]);
     
    p_2 += pow(fabs((double)x[i]-y[i]),2.0);
     
    p_3 += pow(fabs((double)x[i]-y[i]),3.0);
     
    if(p_0 < abs(x[i]-y[i])) p_0 = abs(x[i]-y[i]);
  }
     
  printf("%lf\n%lf\n%lf\n%lf\n", p_1, pow(p_2,1.0/2), pow(p_3,1.0/3), p_0);
     
  return 0;
}


Measured memory_bytes: 2044
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
import java.util.Comparator;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        E solver = new E();
        solver.solve(1, in, out);
        out.close();
    }

    static class E {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            long K = in.nextLong();
            Long[] A = new Long[N];
            Long[] F = new Long[N];
            for (int i = 0; i < N; i++) {
                A[i] = in.nextLong();
            }
            for (int i = 0; i < N; i++) {
                F[i] = in.nextLong();
            }
            Arrays.sort(A, Comparator.naturalOrder());
            Arrays.sort(F, Comparator.reverseOrder());

            long min = -1;
            long max = (long) 1e13;
            while (min + 1 < max) {
                long mid = (max + min) / 2;
                long cost = 0;
                for (int i = 0; i < N; i++) {
                    long temp = mid / F[i];
                    if (A[i] >= temp) {
                        cost += A[i] - temp;
                    }
                    if (K < cost) {
                        break;
                    }
                }
                if (cost <= K) {
                    max = mid;
                } else {
                    min = mid;
                }
            }
            out.println(max);
        }

    }
}



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

#define REP(i, start, count) for(int i=(start); i<(int)(count); ++i)
#define rep(i, count) REP(i, 0, count)
#define ALLOF(c) (c).begin(), (c).end()

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> veci;
typedef vector<long long> vecll;
typedef vector<unsigned long long> vecull;

int K, T;

int main(void) {
    cin >> K >> T;
    veci a(T);
    rep(i, T) {
        cin >> a[i];
    }

    sort(ALLOF(a), std::greater<int>());

    int rest = a[0];
    for(int i = 1; i < T; ++i) {
        rest -= a[i];
        if (rest <= 0) rest = abs(rest);
    }

    cout << max(rest - 1, 0) << endl;
    return 0;
}

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

int main(int argc, char const *argv[]) {
  int x, a, b;
  scanf("%d %d %d", &x, &a, &b);
  if(abs(x-a)>abs(x-b)){
    printf("B\n");
  }
  else{
    printf("A\n");
  }
  return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String[] ss = s.split(" ");
    int a = Integer.parseInt(ss[0]);
    int b = Integer.parseInt(ss[1]);
    System.out.println(a * b + " " + (a + b) * 2);
  }
}


Measured memory_bytes: 26092
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_4_B&lang=jp

#include<iostream>
 using namespace std;

int main(){

    double r ;
    cin >> r ;
    
    cout << fixed;
    cout <<  r * r * 3.1415926535897932387 << " " << 2 * r * 3.1415926535897932387 << endl ;  
    return 0;

}


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

#define debug(s) cout << s << endl
#define debug1(s, t) cout << s << " " << t << endl
#define debug2(s, t, u) cout << s << " " << t << " " << u << endl
#define printvec(v)       \
    for (auto &&i : v)    \
        cout << i << " "; \
    cout << endl
#define rep(n, i) for (int i = 0; i < n; i++)

using namespace std;
using i64 = long long;

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

    int n=t.size();
    for (int i = 0; i < n; i++)
    {
        if (t[i]=='?')
        {
            t[i] = 'D';
        }
    }
    
    cout << t << endl;

    return 0;
}

Measured memory_bytes: 3752
#include <iostream>
#include <math.h>
#include <vector>
using namespace std;

int main()
{
    int a, b, c, count;
    cin >> a >> b >> c;
    for (size_t i = a; i <= b; i++)
    {
        if (c % i == 0) {
            count ++;
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3104
#include <iostream>

using namespace std;

#define ARRAY_SIZE 10

void sort(int array[],int size){
    int tmp;
    for(int i=0;i<size;i++){
        for(int j=size-1;j>i;j--){
            if(array[j]>array[j-1]){
                tmp=array[j];
                array[j]=array[j-1];
                array[j-1]=tmp;
            }
        }
    }
}

int main() {
    int array[ARRAY_SIZE]={0};
    
    for(int i=0;i<10;i++) cin>>array[i];
    sort(array,(sizeof(array)/sizeof(array[0])));
    for(int i=0;i<3;i++){
        cout << array[i] << endl;
    }
    return 0;
}

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

typedef long long int LL;
#define REP(n) for(LL i = 0; i < (n); i++)
#define COUT(val) cout << (val) << endl
#define CIN(val) cin >> (val)
#define SORT(vec) sort(vec.begin(), vec.end())
#define SORT_GRE(vec) sort(vec.begin(), vec.end(), greater<LL>())

int main(){
    int n, a, b;
    cin >> n >> a >> b;
    vector<int> p(n);
    int ans = 0;
    for(int i = 0; i < n; i++){
        cin >> p[i];
        if(p[i] <= a) ans++;
    }
    SORT(p);
    if(p[0] > a){
        cout <<  0 << endl;
        return 0;
    }
    int cB = 0, cC = 0;
    for(int i = 0; i < n; i++){
        if(p[i] > a && p[i] <= b) cB++;
    }
    for(int i = 0; i < n; i++){
        if(p[i] > b) cC++;
    }
    ans = min(ans, cB);
    ans = min(ans, cC);
    cout << ans << endl;
    return 0;
}

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

int main(){
   int n,k;
   cin>>n>>k;
   vector<int> a(n);
   for(int i=0;i<n;i++) cin>>a[i];
   for(int i=0;i<n-k;i++){
      if(a[i]<a[k+i]) cout<<"Yes"<<endl;
      else cout<<"No"<<endl;
   }
   return 0;
}


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

#define rep(i,begin,end) for(int i=begin; i<end; i++)
#define revrep(i,begin,end) for(int i=begin; i>end; i--)
#define lld long long int

void initStrArray(char** p, int n, int len){
    for(int i=0; i<n; i++){
        *(p + i) = (char*)malloc(sizeof(char) * (len + 1));
    }
}

int main(){
    int n;
    scanf("%d", &n);
    char* s[n];
    initStrArray(s, n, 10);
    int ans = 0;
    int ae = 0, bs = 0, bs_ae = 0;
    rep(i, 0, n){
        scanf("%s", s[i]);
        int f_a = 0, f_b = 0;
        int len = strlen(s[i]);
        if(*(s[i]) == 'B'){
            f_b = 1;
        }
        if(*(s[i] + len - 1) == 'A'){
            f_a = 1;
        }
        if(f_a && f_b){
            bs_ae++;
        }else if(f_a){
            ae++;
        }else if(f_b){
            bs++;
        }
        rep(j, 0, len-1){
            if(*(s[i] + j) == 'A' && *(s[i] + j + 1) == 'B'){
                ans++;
            }
        }
    }
    if(bs_ae >= 1){
        ans += bs_ae - 1;
        if(ae > 0){
            ae--;
            ans++;
        }
        if(bs > 0){
            bs--;
            ans++;
        }
    }
    ans += ae<bs ? ae : bs;
    printf("%d", ans);

    return 0;
}

Measured memory_bytes: 512