akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>


using namespace std;

int main() {

	int h,w;

	while (1) {
		cin >> h >> w;
		if (h == 0 && w == 0) { return 0; }
		else {
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					if (i == 0 || i == h - 1 || j==0 || j== w-1) {
						cout << "#";
					}
					else {
						cout << ".";
					}
				}
				cout << endl;
			}
			cout << endl;
		}
	}

}


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

namespace _20170409_AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            string line;
            List<int> outList = new List<int>();

            for(;(line=Console.ReadLine()) != "";)
            {
                string[] sArr = line.Split(' ');
                int a = int.Parse(sArr[0]);
                string op = sArr[1];
                int b = int.Parse(sArr[2]);

                if (op == "?")
                {
                    break;
                }

                int r = 0;
                switch(op)
                {
                    case "+":
                        r = a + b;
                        break;
                    case "-":
                        r = a - b;
                        break;
                    case "*":
                        r = a * b;
                        break;
                    case "/":
                        r = a / b;
                        break;
                }

                outList.Add(r);
            }

            foreach(var v in outList)
            {
                Console.WriteLine(v);
            }

            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 9208
import java.io.*;
import java.util.*;

class Main{
	public static void main(String[] args){
		solve();
	}
	public static void solve(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] x = new int[n];
		int[] y = new int[n];
		for(int i=0;i<n;i++){
			x[i] = sc.nextInt();
			y[i] = x[i];
		}
		Arrays.sort(y);
		int min = y[n/2-1];
		int max = y[n/2];
		for(int i=0;i<n;i++){
			if(x[i]<=min){
				System.out.println(max);
			}
			else{
				System.out.println(min);
			}
		}
	}
}



Measured memory_bytes: 105184
#include<iostream>
using namespace std;
int main(){
    int x,y;
    cin >> x >> y;
    if(x < y){
        const int a = x;
        x = y;
        y = a;
    }
    int b = 100000;
        while(b){
            b = x % y;
            x = y;
            y = b;
            if(b == 0) break;
        }
    cout << x << endl;
}


Measured memory_bytes: 3100
//
#include <vector>
#include <set>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>
//
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
inline void yes(bool cond) { cond ? puts("Yes") : puts("No"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Arr, typename Type> inline void fill(Arr& arr, Type v) { std::fill(arr.begin(), arr.end(), v); }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
constexpr double BIGP = 1000000007L;
constexpr double INF_I = std::numeric_limits<double>::max();
constexpr double INF_F = std::numeric_limits<float>::infinity();
constexpr double PI = 3.14159265358979323846L;
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    ll K, N;
    cin >> K >> N;
    vector<ll> A;
    rep(i, N)
    {
        ll a;
        cin >> a;
        A.push_back(a);
    }
    A.push_back(A[0] + K);
    //
    ll md = 0;
    rep(i, N)
    {
        chmax(md, A[i + 1] - A[i]);
    }
    ll ans = K - md;
    cout << ans;

    return 0;
}

Measured memory_bytes: 4932
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int candy = scan.nextInt() % 39;
			if(candy == 0){
				candy = 39;
			}
			System.out.printf("3C%02d\n",candy);
		}
	}
}

Measured memory_bytes: 17196
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int main()
{
	int n, d;
	cin >> n >> d;
	int x[10][10];
	for(int i = 0; i < n; i++){
		for(int j = 0; j < d; j++){
			cin >> x[i][j];
		}
	}

	int ans = 0;
	for(int i = 0; i < n; i++){
		for(int j = i + 1; j < n; j++){
			int l = 0;
			for(int k = 0; k < d; k++){
				l += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
			}
			for(int i = 0; i < 1000; i++){
				if(l == i * i) ans++;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define EPS      (double)1e-9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
typedef pair<int,int> pii;
template<class Type> void line(const Type &a){int cnt=0;for(const auto &elem:a){if(cnt++)cout<<' ';cout<<elem;}cout<<endl;}

string s;
bool ans=true;

void jud(int l,int r){
	while(l<r){
		if(s[l++]==s[r--]){}
		else{
			ans=false;
			return;
		}
	}
}

int main(){
	cin>>s;
	
	int n=s.size();
	jud(0,n-1);
	jud(0,(n-1)/2-1);
	jud((n+3)/2-1,n-1);
	
	cout<<(ans?"Yes":"No")<<endl;
}

Measured memory_bytes: 256
open System.Collections.Generic

type Scanner() = class
    let mutable hold = [||]
    let mutable index = 0
    member public this.Next() =
        if hold.Length > index
        then 
            index <- index + 1
            hold.[index - 1]
        else
            let mutable st = stdin.ReadLine()
            while st = "" do st <- stdin.ReadLine()
            hold <- st.Split(' ')
            if hold.Length = 0
            then
                this.Next()
            else
                index <- 1
                hold.[index - 1]
            
    member public this.NextI32() =
        this.Next() |> int

    member public this.ArrayI32(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextI32()|]

    member public this.IArrayI32(n: int) =
        [|for i in 0 .. n - 1 -> this.NextI32(), i|]

    member public this.NextI64() =
        this.Next() |> int64
    
    member public this.ArrayI64(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextI64()|]

    member public this.IArrayI64(n: int) =
        [|for i in 0 .. n - 1 -> this.NextI64(), i|]

    member public this.NextF32() =
        this.Next() |> float32
    
    member public this.ArrayF32(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextF32()|]

    member public this.IArrayF32(n: int) =
        [|for i in 0 .. n - 1 -> this.NextF32(), i|]

    member public this.NextF64() =
        this.Next() |> double
    
    member public this.ArrayF64(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextF64()|]

    member public this.IArrayF64(n: int) =
        [|for i in 0 .. n - 1 -> this.NextF64(), i|]

    member public __.Tuple2Array n (f : int -> 'a list) =
        [|for _ in 0 .. n - 1 -> f 2 |> fun x -> x.[0], x.[1]|]
    
    member public __.Tuple3Array n (f : int -> 'a list) =
        [|for _ in 0 .. n - 1 -> f 3 |> fun x -> x.[0], x.[1], x.[2]|]

    member public __.CountDic n (f : unit -> 'a) =
        let seqs = seq {for _ in 0 .. n - 1 -> f()}
        let dic = new Dictionary<'a, int64>();
        for i in seqs do
            if dic.ContainsKey(i)
            then dic.[i] <- dic.[i] + 1L
            else dic.Add(i, 1L)
        dic

end

[<EntryPoint>]
let main _ =
#if DEBUG
    printfn "debuged"
#endif

    let scanner = Scanner()
    let m = 0.000001m
    let n = scanner.Next() |> decimal
    let p = n / 3.0m
    let f a b c = a * b * c
    match n % 3.0m with
    | 1.0m -> f p p (p + m)
    | 2.0m -> f p p (p - m)
    | _ -> f p p p
    |> printfn "%f"

    0


Measured memory_bytes: 14040
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int t;
int a, b;
int main(){
	cin >> t;
	cin >> a >> b;
	for(int i = a; i <= b; i++){
		if(i % t == 0){
			printf("OK\n");
			return 0;
		}
	}
	printf("NG\n");
}

Measured memory_bytes: 3596
#include <iostream>
#include <array>
#include <map>
#include <algorithm>
#include <cmath>
#include <vector>
#include <fstream>
#include <string>
#include <random>
#include <queue>
#include <iomanip>
#include <functional>
#include <climits>

using namespace std;

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vll = std::vector<ll>;
using vpll = std::vector<pll>;
using vpii = std::vector<pii>;
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using vvpii = std::vector<vpii>;

const ll mod197 = 1000000007LL;
const ll INF = 200LL * 200 * 100000 + 10;

const double PI11 = 3.14159265359;

int channel_table[31][100010] = {};

int main(void)
{
	int n, c;
	cin >> n >> c;

	vvpii channel(c);

	for (int i = 0; i < n; i++) {
		int s, t, c;
		cin >> s >> t >> c;
		channel[c-1].push_back(make_pair(s,t));
	}

	for (int i = 0; i < c; i++) {
		//sort(channel[i].begin(),channel[i].end());

		for (int j = 0; j < channel[i].size(); j++) {
			channel_table[i][channel[i][j].first] += 1;
			channel_table[i][channel[i][j].second] -= 1;
		}

		for (int j = 0; j < 100000; j++)
			channel_table[i][j + 1] += channel_table[i][j];

		for (int j = 1; j <= 100000; j++)
			channel_table[i][j] |= channel_table[i][j+1];

	}

	int result = 00;

	for (int j = 0; j < 100000; j++) {

		int now = 0;

		for (int i = 0; i < c; i++) {
			now += channel_table[i][j] & 1;
		}

		result = max(result,now);

	}

	cout << result << endl;

	return 0;
}

Measured memory_bytes: 13184
#include <iostream>
#include<string>
#include<cctype>
using namespace std;
int main() {
	string str, ab, order;
	char temp;
	int a,b,q;
	cin >> str >> q;
	while (q--){
		cin >> order;
		if (order == "replace"){
			cin >> a >> b >> ab;
			str.replace(a, b - a + 1, ab);
		}
		if (order == "reverse"){
			cin >> a >> b;
			for (int i = b, j = a; i >= (b + a + 1) / 2; i--, j++){
				swap(str[j], str[i]);
			}
		}
		if (order == "print"){
			cin >> a >> b;
			cout << str.substr(a, b - a + 1) << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3208
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

# 遅延評価で加えてあげるだけ

N,Q = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(N-1)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]

graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)

value = [0] * (N+1)
for p,x in PX:
    value[p] += x

def dfs(v,parent,add):
    value[v] += add
    for x in graph[v]:
        if x == parent:
            continue
        dfs(x,v,value[v])

dfs(1,0,0)

answer = ' '.join(map(str,value[1:]))
print(answer)


Measured memory_bytes: 283312
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: usize,
        a: usize,
        b: usize,
        mut v: [usize; n]
    }
    v.sort_by(|x, y| y.cmp(x));
    let mut asum = v.iter().take(a).cloned().sum();
    let mut ac = a;
    while ac < b && v[ac] * ac >= asum {
        asum += v[ac];
        ac += 1;
    }
    let mut ca = 0;
    let mut c1 = 0;
    let mut c2 = 0;
    for i in 0..a {
        if v[i] == v[ac - 1] {
            ca += 1;
            c1 += 1;
            c2 += 1;
        }
    }
    for i in a..ac {
        if v[i] == v[ac - 1] {
            ca += 1;
            c2 += 1;
        }
    }
    for i in ac..n {
        if v[i] == v[ac - 1] {
            ca += 1;
        }
    }
    println!("{}", asum as f64 / ac as f64);
    if ca == 1 {
        println!("1");
    } else {
        println!("{}", comb(ca, c1, c2));
    }
}

fn comb(n: usize, k1: usize, k2: usize) -> usize {
    let mut c = 1;
    let mut ret = 0;
    if k1 == 0 {
        ret += 1;
    }
    for i in 1..k1 {
        c = c * (n + 1 - i) / i;
    }
    for i in k1..k2 + 1 {
        c = c * (n + 1 - i) / i;
        ret += c;
    }
    ret
}


Measured memory_bytes: 4352
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <cassert>
#include <bitset>
#include <cmath>
#include <iomanip>

using namespace std;

using int64 = long long;

/////////////////////
// Code starts here//
/////////////////////
int N;
vector<vector<int>> pos;
vector<int> cache;

const int MOD = 1000000007;

void add (int & a, int b) {
    a += b;
    if (a >= MOD)
        a -= MOD;
}

int Rec(int i, int msk) {
    //cerr << " ? " << i << " : " << msk << "\n";
    if (i == -1) {
        assert(!msk);
        return 1;
    }
    int & res = cache[msk];
    if (res != -1)
        return res;
    
    res = 0;
    for (int j = 0; j < N; j++) {
        //cerr << pos[i][0] << " " << pos[i][1] << " " << pos[i][2] << "\n";
        if (pos[i][j] && ((msk >> j) & 1)) {
            add(res, Rec(i - 1, msk - (1<<j)));
        }
    }

    //cerr << i << " : " << msk << " = " << res << "\n";

    return res;
}

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

    cin >> N;

    pos.assign(N, vector<int>(N));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cin >> pos[i][j];
        }
    }
    cache.assign(1<<N, -1);
    cout << Rec(N - 1, (1<<N) - 1) << "\n";

    return 0;
}


Measured memory_bytes: 8448
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
#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;
  cin >> n;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  ll dai = 0;
  rep(i, n) {
    if (i == n - 1) continue;
    if (a[i + 1] < a[i]) {
      dai += a[i] - a[i + 1];
      a[i + 1] = a[i];
    }
  }

  cout << dai << endl;

  return 0;
}

Measured memory_bytes: 4776
#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;

#define ll long long
#define db long double
#define ii pair<int,int>
#define vi vector<int>
#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define FN(i, n) for (int i = 0; i < (int)(n); ++i)
#define FEN(i,n) for (int i = 1;i <= (int)(n); ++i)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(i,a,b) for(int i=b-1;i>=a;i--)
#define SET(A, val) memset(A, val, sizeof(A))
typedef tree<int ,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set ;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
const int N=100005;
int a[N],b[N];
vi v[N];
int main()
{
  std::ios::sync_with_stdio(false);
  cin.tie(NULL) ; cout.tie(NULL) ;
  int n,m;
  cin>>n>>m;
  multiset<int> s;
  rep(i,1,n+1)
    {
      cin>>a[i]>>b[i];
      if(m-a[i]>=0)
	v[m-a[i]].pb(b[i]);
    }
  rep(i,0,N) sort(all(v[i]));
  ll ans=0;
  int cnt=0;
  repv(i,0,m)
    {
      for(int x:v[i]) s.insert(x);
      if(!sz(s)) continue;
      auto it=*s.rbegin();
      ans+=it;
      s.erase(s.find(it));
    }
  cout<<ans<<endl;
  return 0 ;
}


Measured memory_bytes: 8576
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

N = I()
A = LI()

a = A[0]
b = A[1]
c = 0
if len(A) >= 3:
    for i in range(2,N):
        c ^= A[i]

from functools import lru_cache

@lru_cache(maxsize=None)
def f(s,t,u):
    '''
    (s-x) ^ (t+x) == u たる x の最小値を返す
    '''
    if s == 0:
        if t == u:
            return 0
        else:
            return float('inf')
    else:
        if (s & 1) ^ (t & 1) == u & 1:
            return min(2*f(s//2,t//2,u//2),2*f((s-1)//2,(t+1)//2,u//2)+1)  # 1の位が0か1か
        else:
            return float('inf')

ans = f(a,b,c)
if ans >= a:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 67456
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
int main(void) {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++)
    cin >> A[i];

  long long head = A[0], tail = A[N-1];
  int i = 1, j = N-2;
  while (i <= j) {
    if (head < tail)
      head += A[i++];
    else
      tail += A[j--];
  }

  cout << abs(head - tail) << endl;
}

Measured memory_bytes: 1024
using System;
using System.Text;
using System.Collections.Generic;

namespace AOJ2
{
    class Program
    {
        static void Main(string[] args)
        {
            List<string> resultList = new List<string>();

            string input;
            while (true)
            {
                input = Console.ReadLine();

                if (input == "-1 -1 -1")
                {
                    break;
                }

                string[] inputArray = input.Split(' ');
                int hour = int.Parse(inputArray[0]);
                int minute = int.Parse(inputArray[1]);
                int second = int.Parse(inputArray[2]);

                TimeSpan ts = new TimeSpan(hour, minute, second);
                TimeSpan twoHour = new TimeSpan(2, 0, 0);

                resultList.Add((twoHour - ts).ToString());

                resultList.Add((new TimeSpan(0, 0, int.Parse((twoHour - ts).TotalSeconds.ToString()) * 3)).ToString());
                
            }

            foreach (string s in resultList)
            {
                Console.WriteLine(s);
            }


        }


    }
}

Measured memory_bytes: 5740
use proconio::input;
use proconio::marker::Chars;
use std::vec::Vec;

fn main() {
    input! {
        k: u32,
        s: Chars,
    }
    if s.len() <= k as usize {
        for c in s {
            print!("{}", c)
        }
        println!();
        return;
    }
    for i in 0..k {
        print!("{}", s[i as usize]);
    }
    println!("...");
}


Measured memory_bytes: 2188
import math


def solve(h):
    depth = 0
    total = 0
    while h > 0:
        if h == 1:
            h = 0
        else:
            h = math.floor(h / 2)

        total += 2**depth
        depth += 1

    return total


H = int(input())
ans = solve(H)
print(ans)


Measured memory_bytes: 38384
import java.util.Scanner;
 
public class Main {
	private static final String SPLIT_STR = " ";

	private static final String ORDER_PRINT = "print";
	private static final String ORDER_REVERSE = "reverse";
	private static final String ORDER_REPLACE = "replace";

	public static void main (String[] args) throws java.lang.Exception{
		Scanner sc = new Scanner(System.in);
		String str = sc.next(); // 文字列 str
		int q = sc.nextInt(); // 命令の数 q
		sc.nextLine(); // 空白を一度スキャン

		String result = str;

		for (int i=0; i<q; i++) {
            String orderStr = sc.nextLine(); // 各命令
			String[] orderSplit = orderStr.split(SPLIT_STR);
			String order = orderSplit[0];
			int beginIndex = Integer.parseInt(orderSplit[1]);
			int endIndex = Integer.parseInt(orderSplit[2]);
			if (ORDER_PRINT.equals(order)) {
				System.out.println(result.substring(beginIndex, endIndex + 1));
			}
			if (ORDER_REVERSE.equals(order)) {
				result = reverse(result, beginIndex, endIndex);
			}
			if (ORDER_REPLACE.equals(order)) {
				String p = orderSplit[3];
				result = replace(result, beginIndex, endIndex, p);
			}
		}
		sc.close();
	}

	private static String reverse(String str, int beginIndex, int endIndex) {
		char[] charArray = str.toCharArray();
		int max = endIndex - beginIndex;
		for (int i = 0; i <= max; i++) {
			charArray[beginIndex + i] = str.charAt(endIndex - i);
		}
		return String.valueOf(charArray);
	}

	private static String replace(String str, int beginIndex, int endIndex, String replaceStr) {
		char[] charArray = str.toCharArray();
		int max = endIndex - beginIndex;
		for (int i = 0; i <= max; i++) {
			charArray[beginIndex + i] = replaceStr.charAt(i);
		}
		return String.valueOf(charArray);
	}
}



Measured memory_bytes: 28308
package main

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

var scanner = bufio.NewScanner(os.Stdin)

type Scanner struct {
	scanner *bufio.Scanner
}

func NewScanner() *Scanner {
	scanner := &Scanner{scanner: bufio.NewScanner(os.Stdin)}
	scanner.scanner.Split(bufio.ScanWords)
	return scanner
}

func (s *Scanner) Read() int {
	s.scanner.Scan()
	val, _ := strconv.Atoi(s.scanner.Text())
	return val
}

func main() {
	scanner := NewScanner()
	n := scanner.Read()
	m := scanner.Read()
	d := make([][]int, n)
	for i := 0; i < n; i++ {
		d[i] = make([]int, n)
		for j := 0; j < n; j++ {
			d[i][j] = 1000
		}
		d[i][i] = 0
	}

	edges := []struct{ from, to, len int }{}

	for i := 0; i < m; i++ {
		a := scanner.Read()
		b := scanner.Read()
		c := scanner.Read()
		a--
		b--
		d[a][b] = c
		d[b][a] = c
		edges = append(edges, struct{ from, to, len int }{a, b, c})
	}

	for k := 0; k < n; k++ {
		for i := 0; i < n; i++ {
			for j := i + 1; j < n; j++ {
				if d[i][j] > d[i][k]+d[j][k] {
					d[i][j] = d[i][k] + d[j][k]
					d[j][i] = d[i][k] + d[j][k]
				}
			}
		}
	}

	count := 0
	for _, edge := range edges {
		i, j, val := edge.from, edge.to, edge.len
		isIncluded := false
		for s := 0; s < n; s++ {
			if d[s][i]+val == d[s][j] || d[s][j]+val == d[s][i] {
				isIncluded = true
				break
			}
		}
		if !isIncluded {
			count++
		}
	}

	fmt.Println(count)
}


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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

ll dp[3001][3001];
ll dps[3001][3001];

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

  dp[0][0]=1;
  rep(i, n-1){

    dps[i][0]=dp[i][0];
    rep1(j, i+1){
      dps[i][j] += dps[i][j-1] + dp[i][j];
    }

    rep(j, i+2){

      if(s[i]=='<'){
        if(j)dp[i+1][j] += dps[i][j-1];
      }else{
//cout<<i<<' '<<j<<' '<<dps[i][i]<<' '<<dps[i][j-1]<<endl<<"="<<endl;

//cout<<"---"<<endl;
//rep(i, n+1){
//  rep(j, n+1)cout<<dps[i][j]<<' ';cout<<endl;
//}cout<<"---"<<endl;

        dp[i+1][j] += dps[i][i];
        if(j)dp[i+1][j] -= dps[i][j-1];
      }

      dp[i+1][j] %= MOD;
    }
  }

  ll result=0;
  rep(j, n)result += dp[n-1][j];

  cout<<result%MOD<<endl;

  return 0;

rep(i, n+1){
  rep(j, n+1)cout<<dp[i][j]<<' ';cout<<endl;
}cout<<"---"<<endl;

  return 0;
}


Measured memory_bytes: 95856
//abc067_a Sharing Cookies


#include <iostream>
using namespace std;

int main()
{
int A;
int B;

	cin >> A;
	cin >> B;
	if( A % 3 == 0 || B % 3 == 0 || ( A + B ) % 3 == 0 )
		cout << "Possible" << endl;
	else
		cout << "Impossible" << endl;

	return 0;
}






Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    int p,q,r=0;
    int resultA,resultB,resultC = 0;
    
    scanf("%d",&p);
    scanf("%d",&q);
    scanf("%d",&r);

    resultA = p+q;
    resultB = p+r;
    resultC = q+r;
    
    if (resultA<=resultB && resultA<=resultC) {
        printf("%d",resultA);
    }else if(resultB<=resultA && resultB<=resultC){
        printf("%d",resultB);
    }else{
        printf("%d",resultC);
    }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,d;
    int a=0;
    int i;
    set<int> s;
    cin >> n >> k;
    while(k--)
    {
        cin >> d;
        while(d--)
        {
            cin >> i;
            s.insert(i);
        }
    }
    int ans = n - s.size();
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>

using namespace std;

int main() {
	int n, m, x;
	cin >> n >> m >> x;
	int* c = new int[n];
	int** a = new int* [n];
	int* r = new int[m];
	for (int i = 0;i < n;i++) {
		a[i] = new int[m];
		cin >> c[i];
		for (int j = 0;j < m;j++) {
			cin >> a[i][j];
		}
	}
	int cost = -1;
	int ctmp;
	bool flag;
	for (int i = 0;i < 1 << n;i++) {
		flag = true;
		ctmp = 0;
		for (int j = 0;j < m;j++) {
			r[j] = 0;
		}
		for (int j = 0;j < n;j++) {
			if (i & 1 << j) {
				ctmp += c[j];
				for (int k = 0;k < m;k++) {
					r[k] += a[j][k];
				}
			}
		}
		for (int j = 0;j < m;j++) {
			if (r[j] < x) {
				flag = false;
			}
		}
		if (flag) {
			if (cost == -1) {
				cost = ctmp;
			}
			else {
				cost = min(cost, ctmp);
			}
		}
	}
	cout << cost << endl;
}

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

using namespace std;

using ll = long long;

// dp[i][j][k][l] := i: 上位 i 桁目まで決定，j: 数字を自由に選べるか,
//                   k: 数字を書き込んだか，l: {3,5,7} を選んだかのflag
//                   としたときの753数の数
int dp[11][2][2][8];

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

    string n;
    cin >> n;

    int len = n.size();
    dp[0][0][0][0] = 1;
    for (int i = 0; i < len; ++i) {
        for (int j = 0; j < 2; ++j) {
            for (int k = 0; k < 2; ++k) {
                for (int l = 0; l < 8; ++l) {
                    if (!dp[i][j][k][l]) continue;

                    if (j == 1) { // [0, 9] から数字を選べる
                        if (k == 0) // 数字をまだ書き込んでいない
                            dp[i + 1][1][0][0] += dp[i][j][k][l]; // nothing

                        dp[i + 1][1][1][l | 1] += dp[i][j][k][l]; // +3
                        dp[i + 1][1][1][l | 2] += dp[i][j][k][l]; // +5
                        dp[i + 1][1][1][l | 4] += dp[i][j][k][l]; // +7
                    }
                    else { // [0, d] から数字を選べる
                        int d = (int)(n[i] - '0');

                        if (k == 0) // 数字をまだ書き込んでいない
                            dp[i + 1][1][0][0] += dp[i][j][k][l]; // nothing

                        if (d == 3) dp[i + 1][0][1][l | 1] += dp[i][j][k][l]; // +3
                        if (3 < d) dp[i + 1][1][1][l | 1] += dp[i][j][k][l]; // +3
                        if (d == 5) dp[i + 1][0][1][l | 2] += dp[i][j][k][l]; // +5
                        if (5 < d) dp[i + 1][1][1][l | 2] += dp[i][j][k][l]; // +5
                        if (d == 7) dp[i + 1][0][1][l | 4] += dp[i][j][k][l]; // +7
                        if (7 < d) dp[i + 1][1][1][l | 4] += dp[i][j][k][l]; // +7
                    }
                }
            }
        }
    }

    int ans = dp[len][0][1][7] + dp[len][1][1][7];
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
def gcd(a, b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b


## 最大公約数 
def lcm(a, b):
    y = a*b / gcd(a, b)
    return int(y)
a, b = MAP()

ans = lcm(a, b)
print(ans)



Measured memory_bytes: 5200
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <cstring>

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))

#define INF (int)1e9+7

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

using namespace std;

map<int, int> mpp;

int main(){
    int n;

    cin >> n;

    rep(i, n){
        int a;
        cin >> a;
        mpp[a]++;
    }
    
    int over = 0;
    int less = 0;
    for(auto itr = mpp.begin(); itr != mpp.end(); itr++){
        if( itr->first < itr->second ) over += itr->second - itr->first;
        else if( itr->first > itr->second ) less += itr->second;
    }
    cout << over + less << endl;

    return 0;
}

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

using namespace std;

const long MOD = 1000000007;
typedef pair<int, int> P;
typedef long long ll;

int main(){
    int Q;
    cin >> Q;
    int l[Q], r[Q];
    for(int i=0; i<Q; i++){
        cin >> l[i] >> r[i];
    }

    const int MAX = 100005;
    vector<int> p;
    bool isP[MAX+1];
    fill(isP, isP+MAX+1, true);
    isP[0] = isP[1] = false;
    for(int i=2; i<MAX+1; i++){
        if(!isP[i]) continue;
        
        int t = 2*i;
        while(t < MAX){
            isP[t] = false;
            t += i;
        }
    }

    int sum[MAX+1];
    sum[0] = 0;
    for(int i=1; i<=MAX; i++){
        sum[i] = sum[i-1];
        int t = (i+1)/2;
        if(isP[i] && isP[t]){
            sum[i]++;
        }
    }

    for(int i=0; i<Q; i++){
        cout << sum[r[i]]-sum[l[i]-1] << endl;
    }

    return 0;
}


Measured memory_bytes: 1920
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
const long long mod = 1e9 + 7;
typedef long long ll;  // ll とdoubleは違う
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,vector<int>(m)) n * m
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U>  // chmax(max, a);
bool chmax(T &a, U b) {
  if (a <= b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>  // chmin(min,a)
bool chmin(T &a, U b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>  // operator << (cout,a);
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
  os << "}";
  return os;
}

// g++ -std=c++11 prac.cpp

int main() {
  ll z=0,k,n,m,h,w,ans=0,sum=0,Max=1,Min=1e9+1;
  bool ok = false;
  string s,t,r;
  cin >> s;
  if(s[2]==s[3] && s[4]==s[5])
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
 
  return 0;
}

Measured memory_bytes: 256
import numpy as np

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

a.sort()
na = np.zeros(2**18)
for i in a:
    na[i] += 1

fa = np.fft.fft(na)

c = np.round(np.fft.ifft(fa*fa)).astype(int)

ans = 0
cm = 0
for i in range(2**18 - 1, 1, -1):
    cm += c[i]
    ans += i*c[i]
    if cm > m:
        ans -= i * (cm - m)
    if cm >= m:
        break

print(ans)

Measured memory_bytes: 52808
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define br cout << "\n";
using namespace std;
const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>;
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;}

// 0 false, 1 true 
// string to int : -48
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp

int main() {
    std::cout << std::fixed << std::setprecision(15);
    string s;
    cin >> s;
    ll n = s.size();

    if(n == 3){
        if(s[0] == s[2]){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
        return 0;
    }

    string ans = "Yes";
    for(ll i = 0; i <= n/2; i++){
        if(s[i] == s[n-1-i]){
            continue;
        }else{
            ans = "No";
        }
    }

    //cout << "1 = " << ans << endl;

    ll tmp = (n-1)/2;
    tmp--;
    //cout << "tmp = " << tmp << endl;
    for(ll i = 0; i <= tmp / 2; i++){
        if(s[i] == s[tmp-i]){
            continue;
        }else{
            ans = "No";
        }
    }

    //cout << "2 = " << ans << endl;

    ll tmp2 = (n+3) / 2;
    tmp2--;
    ll j = 0;
    //cout << "tmp2 = " << tmp2 << endl;
    //for(ll i = tmp2-1; i <= (n+1-tmp2)/2; i++){
    for(ll i = tmp2; i < n; i++){
        //cout << i << " " << n-1-j << endl;
        if(s[i] == s[n-1-i+tmp2]){
            continue;
        }else{
            
            //cout << s[i] << " " << s[n-1-j] << endl;
            //cout << "i = " << i << endl;
            ans = "No";
        }
        j++;
    }


    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    long N;
    long W;
    long V = 1000;
    long w;
    long v;
    cin >> N >> W;
    vector<long> w_ls(N);
    vector<long> v_ls(N);
    vector<vector<long>> memo_ls(N+1);
    for(int i=0; i<N;i++){
        cin >> w >> v;
        w_ls[i] = w;
        v_ls[i] = v;
    }
    for(int i=0; i< N + 1; i++){
        for(int j=0; j<V * N + 1; j++) {
            memo_ls[i].push_back(1e10);
        }
    }
    memo_ls[0][0] = 0;
    for(int i=1; i<N+1; i++){
        for(long j=0; j< V * N + 1; j++){
            if(v_ls[i-1] <= j){
                memo_ls[i][j] = min({memo_ls[i-1][j], memo_ls[i-1][j-v_ls[i-1]] + w_ls[i-1]});
            }
            else{
                memo_ls[i][j] = memo_ls[i-1][j];
            }
        }
    }
    long res = 0;
    for(long i=0; i < N * V + 1; i++){
        if (memo_ls[N][i] <= W){
            res = i;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 80120
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"YES"<<"\n"
#define no cout<<"NO"<<"\n"

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

	int n,k;
	cin>>n>>k;
	vi dp(n,inf),in(n);
	dp[0]=0;
	rep(i,n){
		cin>>in[i];
		loop(j,1,k+1){
			if(i-j>=0)cmin(dp[i],dp[i-j]+abs(in[i]-in[i-j]));
		}
	}
	cout<<dp[n-1]<<endl;
}



Measured memory_bytes: 1792
#include <iostream>
#include <math.h>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>
#include <map>
#include <cmath>
#include <cstring>
#include <string>
#include <set>
#include <stack>
#include <climits>
#include <queue>
#include <functional>
#include <iostream>
#include <fstream>
#include <tuple>
#pragma warning (disable: 4996)
using namespace std;

int main() {
	int N,b=0,w=0, bL=0, wR=0;
	char S[200005];
	cin >> N;
	int x=0,ans=200005;

	for (int i = 0; i < N; i++) {
		cin >> S[i];
		if (S[i] == '.') w++;
		else b++;
	}

	wR = w;
	ans = min(bL + wR, ans);
	for (int i = 0; i < N; i++) {
		if (S[i] == '.') wR--;
		else bL++;
		ans = min(bL + wR, ans);
	}
	

	cout << ans;

} 


Measured memory_bytes: 384
N,K = map(int,input().split())
ps = list(map(int,input().split()))
su = sum(ps[0:K])
ksum = su
ind = 0
for i in range(1,N-K+1):
    ksum -= ps[i-1]
    ksum += ps[i+K-1]
    if ksum > su:
        ind = i
        su = ksum
ki = 0

for i in range(ind, ind+K):
    ki += (ps[i]*(ps[i]+1))/2/ps[i]
print(ki)


Measured memory_bytes: 91572
#include <iostream>
using namespace std;
int main(){
 long long int a,b,res;
  char c;
  cin>>a>>c>>b;

  if(c == '+'){
    res = a + b;
    cout<<res<<endl;
  }
  else{
    res = a-b;
    cout<<res<<endl;
  }
}

Measured memory_bytes: 3524
#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

int main() {
    int N, M;
    cin >> N;
    vector<int> T(N);
    for (int i = 1; i <= N; i++) {
        cin >> T[i - 1];
    }
    cin >> M;
    vector<int> P(M), X(M);
    for (int i = 1; i <= M; i++) {
        cin >> P[i - 1] >> X[i - 1];
    }

    for (int i = 1; i <= M; i++) {
        int temp         = T[P[i - 1] - 1];
        T[P[i - 1] - 1]  = X[i - 1];
        int sum          = accumulate(T.begin(), T.end(), 0);
        cout << sum << endl;
        T[P[i - 1] - 1]  = temp;
    }

    return 0;
}


Measured memory_bytes: 256
// 

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <ios>
#include <iomanip>
#include <string>
#include <numeric>

using namespace std;

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

    int memo[26];
    for (int i = 0; i < 26; i++) {
        memo[i] = 0;
    }

    memo[s[0] - 'A']++;
    memo[s[1] - 'A']++;
    memo[s[2] - 'A']++;
    memo[s[3] - 'A']++;

    int count = 0;
    for (int i = 0; i < 26; i++) {
        if (memo[i] > 0) {
            if (memo[i] != 2) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main (void){
  int N,M,C;
  int B[20];
  int A[20];
  int count=0,sum=0;
  char s[20];
  scanf("%d %d %d", &N,&M,&C);
  // printf("%d %d %d\n", N,M,C);

  for (int i=0;i<M;i++){
    scanf("%d",&B[i]);
    // printf("B=%d\n",B[i]);
  }

  for( int j=0;j<N;j++){
    // printf("\n");
    sum=0;
    for (int i=0;i<M;i++){
      scanf("%d",&A[i]);
      // printf("B=%d\n",A[i]);
      sum=sum+A[i]*B[i];
    }
    if (sum+C>0){
      count++;
    }
  }
  printf("%d",count);
  return 0;
}


Measured memory_bytes: 128
n = gets.to_i

for j in 1..n

if (j % 3) == 0 then
print " #{j}"

else

x = j


flag = false
while x>2

if (x % 10) == 3 then
flag = true
break
else
x = x/10
end

end

if flag == true then
print " #{j}"
end

end

end

puts ""


Measured memory_bytes: 6864
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static System.Array;

class Program
{
    public static void Main()
    {
        var n = ReadLine().Split().Select(decimal.Parse).ToArray();
        if(n[0] == 0 || n[1] == 0)
        {
            WriteLine("0");
            return;
        }
        decimal result = Floor(n[0] * n[1]);
        WriteLine(result);
    }
}

Measured memory_bytes: 19280
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=305;
int n,s,be[N],a[N][N],b[N][N];
char S[N*N];
long double pi=acos(-1);
int main()
{ 
    int n,m;
    cin>>n>>m;
    if(n<=m) puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 3600
from itertools import groupby

N=int(input())
D=list(map(int,input().split()))

def dfs(list,num):
    global ans
    if num==N:
        m=100
        for i in range(0,N):
            for j in range(i+1,N+1):
                s=abs(list[i]-list[j])
                test=min(s,24-s)
                m=min(test,m)
        ans=max(ans,m)
    else:
        dfs(list+[D[num]],num+1)
        dfs(list+[24-D[num]],num+1)

if N>=24:
    print(0)
elif N>=12:
    D.sort()
    D=groupby(D)
    for key,group in D:
        g=len(list(group))
        if key==0:
            print(0)
            exit()
        elif key==12:
            if g>1:
                print(0)
                exit()
        else:
            if g>2:
                print(0)
                exit()
    print(1)
else:
    ans=0
    dfs([0],0)
    print(ans)

Measured memory_bytes: 3188
#include<stdio.h>
#include<stdlib.h>

struct Node{
  int key;
  struct Node *right,*left,*parent;
};

struct Node *root,*NIL;

struct Node * find(struct Node *u,int k){
  while(u != NIL && k != u->key){
    if(k<u->key)u=u->left;
    else u = u->right;
  }
  return u;
}

void insert(int k){
  struct Node *y = NIL;
  struct Node *x = root;
  struct Node *z;

  z = (struct Node *)malloc(sizeof(struct Node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key){
      x = x->left;
    }else{
      x = x->right;
    }
  }
  z->parent = y;
  if(y == NIL){
    root = z;
  }else{
    if(z->key < y->key){
      y->left = z;
    }else{
      y->right = z;
    }
  }
}

void inorder(struct Node *u){
  if(u == NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(struct Node *u){
  if(u == NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n,i,x;
  char com[20];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s",com);
    if(com[0] == 'f'){
      scanf("%d",&x);
      struct Node *t = find(root,x);
      if(t != NIL)printf("yes\n");
      else printf("no\n");
    }
    else if(com[0] == 'i'){
      scanf("%d",&x);
      insert(x);
    }
    else if(com[0] == 'p'){
inorder(root);
printf("\n");
preorder(root);
      printf("\n");
    }
  }

  return 0;
}
   



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

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

	int n;
	cin >> n;
	double a, sum=0;
	for(int i=0; i<n; i++)
	{
		cin >> a;
		sum += 1/a;
	}
	sum = 1/sum;
	cout << sum;
	return 0;
}


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

int main() {
    string N;
    int count;
    cin >> N;
    for(int i=0;i<4;i++){
        if(N[i] == '2'){
            count++;
        }
    }

    printf("%d\n", count);

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        String s = sc.next();
        
        for (int i = 0; i < a; i++) {
            if (s.charAt(i) < '0' || s.charAt(i) > '9') {
                System.out.println("No");
                return;
            }
        }

        if (s.charAt(a) != '-') {
            System.out.println("No");
            return;
        }

        for (int i = a + 1; i < a + b + 1; i++) {
            if (s.charAt(i) < '0' || s.charAt(i) > '9') {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
    }
}


Measured memory_bytes: 23252
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <numeric>
#include <string>
#include <map>
#include <set>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define INF 1145141919
typedef long long int ll;
using namespace std;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
    for (T &x : vec)
        is >> x;
    return is;
}

int main(){
    int N,T;
    cin >> N >> T;
    int c[N], t[N];

    REP(i,N){
        cin >> c[i] >> t[i];
    }

    int ans=INF;
    bool flag=false;

    REP(i,N){
        if(t[i]<=T){
            if(c[i]<ans){
                ans = c[i];
                flag = true;
            }
        }
    }
    if(flag){
        cout << ans << endl;
    }else{
        cout << "TLE" << endl;
    }

    return 0;
}


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


int counter(int x){
  if(x == 0) return 0;
  return counter(x >> 1)+(x & 1);
}

void func147c(){
  int ans = 0;
  int N;
  int A[20];
  int x[20][20];
  int y[20][20];
  cin >> N;
  for(int i = 1; i <= N; i++){
    cin >> A[i];
    for(int j = 1; j <= A[i]; j++){
      cin >> x[i][j] >> y[i][j];
    }
  }
  //bitsのN桁目が1でない間
  for(int bits = 1; bits < (1 << N); bits++){
    bool ok = true;
    for(int i = 1; i <= N; i++){
      //bitsのi-1桁目が1でないなら
      if(!(bits & (1 << (i-1)))) continue;
      for(int j = 1; j <= A[i]; j++){
        if(((bits >> (x[i][j]-1)) & 1) ^ y[i][j]) ok = false;
      }
    }
    if(ok)ans = max(ans, counter(bits)); 
  }
  cout << ans << "\n";
}

int main() {
  //while (true) {
    func147c();
  //}
  return 0;
}

Measured memory_bytes: 256
while True:
    n, x = map(int, input().split())
    if [n, x] == [0] * 2:
        exit()
    ans = 0
    for i in range(1, n + 1):
        for j in range(i + 1, n + 1):
            k = x - i - j
            if j < k <= n and k != i and k != j:
                ans += 1
    print(ans)



Measured memory_bytes: 5596