akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstring>
using namespace std;

int main(void){
	int map[10][10];
	int x,y,s;
	int n=0,m=0;
	memset(map,0,sizeof(map));
	while(~scanf("%d,%d,%d",&x,&y,&s)){
		if(s>=1){
			map[x][y]+=1;
			if(x-1>=0 && x-1<10)map[x-1][y]+=1;
			if(x+1>=0 && x+1<10)map[x+1][y]+=1;
			if(y-1>=0 && y-1<10)map[x][y-1]+=1;
			if(y+1>=0 && y+1<10)map[x][y+1]+=1;
		}
		if(s>=2){
			if(x-1>=0 && x-1<10 && y-1>=0 && y-1<10)map[x-1][y-1]+=1;
			if(x+1>=0 && x+1<10 && y-1>=0 && y-1<10)map[x+1][y-1]+=1;
			if(x-1>=0 && x-1<10 && y+1>=0 && y+1<10)map[x-1][y+1]+=1;
			if(x+1>=0 && x+1<10 && y+1>=0 && y+1<10)map[x+1][y+1]+=1;
		}
		if(s>=3){
			if(y-2>=0 && y-2<10)map[x][y-2]+=1;
			if(y+2>=0 && y+2<10)map[x][y+2]+=1;
			if(x-2>=0 && x-2<10)map[x-2][y]+=1;
			if(x+2>=0 && x+2<10)map[x+2][y]+=1;
		}
	}
	for(int i=0;i<10;i++){
		for(int j=0;j<10;j++){
			if(map[i][j]==0)n++;
			if(map[i][j]>m)m=map[i][j];
		}
	}
	printf("%d\n",n);
	printf("%d\n",m);
    return 0;
}

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

using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector<ll> as(n);
  ll ans = 0;
  cin >> as[0];
  for (int i = 1; i < n; i++) {
    cin >> as[i];
    ll d = as[i] - as[i - 1];
    if (d < 0) {
      as[i] -= d;
      ans -= d;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4816
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn vec<T, F: FnMut(usize) -> T>(n: usize, mut f: F) -> Vec<T> {
    (0..n).map(|i| f(i)).collect()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let a: String = scan(tokens);
    let b: String = scan(tokens);
    let c: String = scan(tokens);
    let (a, b, c) = (a.as_bytes(), b.as_bytes(), c.as_bytes());
    let ab = &fit_array(a, b);
    let ac = &fit_array(a, c);
    let ba = &fit_array(b, a);
    let bc = &fit_array(b, c);
    let ca = &fit_array(c, a);
    let cb = &fit_array(c, b);
    let mut min = a.len() + b.len() + c.len();
    min = std::cmp::min(min, align(a, b, c, ab, ac, bc));
    min = std::cmp::min(min, align(a, c, b, ac, ab, cb));
    min = std::cmp::min(min, align(b, a, c, ba, bc, ac));
    min = std::cmp::min(min, align(b, c, a, bc, ba, ca));
    min = std::cmp::min(min, align(c, a, b, ca, cb, ab));
    min = std::cmp::min(min, align(c, b, a, cb, ca, ba));
    println!("{}", min);
}

fn align(a: &[u8], b: &[u8], c: &[u8], ab: &[bool], ac: &[bool], bc: &[bool]) -> usize {
    let la = a.len();
    let lb = b.len();
    let lc = c.len();
    let mut min = la + lb + lc;
    for i in 0..la + 1 {
        if i == la || ab[i] {
            for j in i..std::cmp::max(la, i + lb) + 1 {
                if (j >= la || ac[j]) && (j - i >= lb || bc[j - i]) {
                    min = std::cmp::min(min, std::cmp::max(la, std::cmp::max(i + lb, j + lc)));
                }
            }
        }
    }
    min
}

fn fit_array(a: &[u8], b: &[u8]) -> Vec<bool> {
    vec(a.len(), |i| {
        let l = std::cmp::min(a.len() - i, b.len());
        fit(&a[i..i + l], &b[..l])
    })
}

fn fit(a: &[u8], b: &[u8]) -> bool {
    for i in 0..a.len() {
        if a[i] != b'?' && b[i] != b'?' && a[i] != b[i] {
            return false;
        }
    }
    return true;
}


Measured memory_bytes: 4476
import numpy as np

N,M=map(int, input().split())
X_lst=[]
for i in range(N):
    X_lst.append(list(map(int, input().split())))

X=np.array(X_lst)
X=X[np.argsort(X[:, 0])]

price,num=0,0
for i in range(N):
  if num+X[i,1]< M:
    price=price+X[i,0]*X[i,1]
    num=num+X[i,1]
  else:
    price=price+X[i,0]*(M-num)
    num=num+X[i,1]
    break
print(price)

Measured memory_bytes: 40244
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

H,W=get_i
a=array(H)
H.times do|i|
    a[i]=get_i
end
odd=Array.new(H){[]}
H.times do|i|
  W.times do|j|
      odd[i].push(j) if a[i][j].odd?
  end
end
r=[]
ans=[]
H.times do|i|
    n=odd[i].size
    if n.odd?
      r.push([odd[i].pop,i])
      n-=1
    end
    0.step(n-1,2) do|j|
      v1=odd[i][j]
      v2=odd[i][j+1]
      (v1+1).upto(v2) do|k|
          ans.push("#{i+1} #{k} #{i+1} #{k+1}")
      end
    end
end
r.pop if r.size.odd?
m=r.size
0.step(m-1,2) do|i|
  v1=r[i]
  v2=r[i+1]
  if v1[0]+1!=W
    (v1[0]+1).upto(W-1) do|j|
        ans.push("#{v1[1]+1} #{j} #{v1[1]+1} #{j+1}")
    end
  end
  (v1[1]+1).upto(v2[1]) do|j|
      ans.push("#{j} #{W} #{j+1} #{W}")
  end
  if v2[0]+1!=W
    (W).downto(v2[0]+2) do|j|
        ans.push("#{v2[1]+1} #{j} #{v2[1]+1} #{j-1}")
    end
  end
end
puts ans.size
ans.each do|s|
    puts s
end

Measured memory_bytes: 28700
#include <cstdio>
#include <cstdlib>

void chmax(long long *a, long long b) {
	if (*a < b) {
		*a = b;
	}
}

int main(void) {
	int N, W;
	int w[100], v[100];
	long long dp[101][100001];
	
	scanf("%d%d", &N, &W);
	for (int i = 0; i < N; i++) {
		scanf("%d%d", &w[i], &v[i]);
	}

	for (int j = 0; j <= W; j++) {
		dp[0][j] = 0;
	}
	
	for (int i = 0; i < N; i++) {
		for (int sum_w = 0; sum_w <= W; sum_w++) {
			if (sum_w - w[i] >= 0) {
				chmax(&dp[i + 1][sum_w], dp[i][sum_w - w[i]] + v[i]);
			}
			
			chmax(&dp[i + 1][sum_w],dp[i][sum_w]);
			
		}
	}

	printf("%lld\n", dp[N][W]);

	return 0;
}

Measured memory_bytes: 79104
#include "bits/stdc++.h"
#define int long long
#define endl '\n'
using namespace std;
 
typedef long long ll;
#define db(x) cerr << #x << ": " << x << '\n';
#define read(a) int a; cin >> a;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define readarr(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}

#define print(a) cout << a << endl;
#define printarr(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;} cout << endl;
#define all(v) v.begin(), v.end()
#define sz(v) (int)(v.size())
#define rz(v, n) v.resize((n) + 1);
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define vvi vector <vi>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll N = 2e5 + 1;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	readb(n, m);
	readarr(a, m);
	int sum = 0;
	FOR (i, 1, m) sum += a[i];
	if (sum > n) cout << -1;
	else cout << n - sum;
}













Measured memory_bytes: 3740
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    string ch;
    cin>>ch;
    int cnt=1;
    int x=ch[0];
    for(int i=1;i<n;i++)
    {
        if(x!=ch[i])
        {
            x=ch[i];
            cnt++;
        }
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define Endl endl
typedef long long ll;
const int MAXN = (int)1e5 + 5;
ll n, h[MAXN];
int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	while (cin >> n)
	{
		for (int i = 1; i <= n&&cin >> h[i]; ++i);
		for (int i = 2; i <= n; ++i)
			if (h[i] > h[i - 1])
				h[i]--;
		bool flag = true;
		for (int i = 1; i < n&&flag; ++i)
			if (h[i] > h[i + 1])
				flag = false;
		cout << (flag ? "Yes" : "No") << endl;
	}
}
/*
5
1 2 1 1 3
4
1 3 2 1
5
1 2 3 4 5
1
1000000000
*/


Measured memory_bytes: 1024
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] L = new int[N];
    for (int i = 0; i < N; i++) L[i] = sc.nextInt();
    int ans = 0;
    for (int i = 0; i < N; i++) {
      for (int j = i; j < N; j++) {
        if (L[i] == L[j]) continue;
        for (int k = j; k < N; k++) {
          if (L[i] == L[k] || L[j] == L[k]) continue;
          if (isTriangle(L[i], L[j], L[k])) {
            ans++;
            //System.out.printf("%d %d %d\n",L[i],L[j],L[k]);
          }
        }
      }
    }
    System.out.println(ans);
  }
  
  static boolean isTriangle(int a, int b, int c) {
    //System.out.printf("tri %d %d %d\n", a, b, c);
    if (a<(b+c) && b<(a+c) && c<(a+b)) return true;
    return false;
  }
}

Measured memory_bytes: 35912
N = int(input())
I = list(map(int, input().split()))

cnt = 0
for i in range(1, N):
    flag = True
    while flag:
        flag = False
        for j in range(N-1, 0, -1):
            if I[j] < I[j-1]:
                tmp = I[j]
                I[j] = I[j-1]
                I[j-1] = tmp
                flag = True
                cnt += 1
print(str(I).replace(',','').replace('[','').replace(']',''))
print(cnt)




Measured memory_bytes: 5592
#include <bits/stdc++.h>
#define re return
#define ll long long
#define ld long double
#define f first
#define s second
#define pi acos(-1)
#define oo (int)1e9
#define OO (ll)1e18
#define EPS 1e-7
#define FX(n) fixed<<setprecision(n)
#define mm(o,k) memset(o,k,sizeof o)
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int maxn=105;

int main()
{
    IO;
    int n;
    cin >> n;
    set<int> st;
    while(n--){
        char x;
        cin >> x;
        st.insert(x);
    }
    if(st.size()==3)cout<<"Three\n";
    else cout<<"Four\n";
    re 0;
}

Measured memory_bytes: 256
n, max_weight = map(int, input().split())
WV = [list(map(int, input().split())) for _ in range(n)]
W, V = zip(*WV)
M = sum(V) + 1
#M = 100100
INF = 1 << 60
dp = list([INF] * M for _ in range(n + 1))
dp[0][0] = 0
for i in range(n):
    for v in range(M):
        if v >= V[i]:
            dp[i + 1][v] = min(dp[i][v], dp[i][v - V[i]] + W[i])
        else:
            dp[i + 1][v] = dp[i][v]
for v in range(M):
    if dp[n][v] <= max_weight:
        ans = v
print(ans)


Measured memory_bytes: 119788
# coding:UTF-8
import sys

def pow_r(x, n):
    if n == 0:
        return 1
    if n % 2 == 0:
        return pow_r(x ** 2, n //2)
    else:
        return x * pow_r(x ** 2, (n - 1) // 2)

if __name__ == '__main__':
    # ------ 入力 ------#
    # 1行入力
    n = int(input())    # 数字
    # a = input()     # 文字列
    # a = list(map(int, input().split()))     # スペース区切り連続数字
    # a = input().split()     # スペース区切り連続文字列
    # a = [int(c) for c in input()]   # 数字→単数字リスト変換

    # 定数行入力
    # x = 5
    # a = [int(input()) for _ in range(x)] # 数字
    # a = [input() for _ in range(x)] # 文字
    # a = [list(map(int, input().split())) for _ in range(x)]     # スペース区切り連続数字(行列)
    # a = [input().split() for _ in range(x)]     # スペース区切り連続文字
    # a = [[int(c) for c in input()] for _ in range(x)]  # 数字→単数字リスト変換(行列)

    # スペース区切り連続 数字、文字列複合
    # a = []
    # for _ in range(x):
    #     aa, bb = input().split()
    #     a.append((int(aa), bb))

    # ------ 処理 ------#
    S = pow(10, n)

    M = pow(9, n)
    M2 = pow(8, n)

    out = (S - (M + M - M2)) % (1000000000 + 7)

    # ------ 出力 ------#
    print("{}".format(out))


Measured memory_bytes: 11160
#include <bits/stdc++.h>
using namespace std;
#define rep2(i,m,n) for (int i = (m); i < (n); ++i)
#define rep(i,n) rep2(i,0,n)
typedef long long int ll;
typedef long double ld;
typedef pair<int, int> P;
template<typename T> struct V : vector<T> { using vector<T>::vector; };
V() -> V<int>;
V(size_t) -> V<int>;
template<typename T> V(size_t, T) -> V<T>;
template<typename T> vector<T> make_vec(size_t n, T a) { return vector<T>(n, a); }
template<typename... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec(ts...))>(n, make_vec(ts...)); }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
const int INF = 1<<30;
const ll LINF = 1LL<<61;

int main()
{
    string s;
    cin >> s;
    if(s == "RSR") cout << 1 << endl;
    else cout << count(s.begin(), s.end(), 'R') << endl;
    //cout << s << endl;
    return 0;
}

Measured memory_bytes: 3544
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<queue>
#include<bitset>
#include<map>
using namespace std;
template<typename __T>
inline void read(__T &x)
{
    x=0;
    int f=1;char c=getchar();
    while(!isdigit(c)){if(c=='-')	f=-1;c=getchar();}
    while(isdigit(c))	{x=x*10+c-'0';c=getchar();}
    x*=f;
}
int box[100005],las[1000005],edv[1000005],edw[1000005],cnt=0;
void adde(int u,int v,int w)
{
	las[++cnt]=box[u];
	box[u]=cnt;
	edv[cnt]=v;
	edw[cnt]=w;
}
int n;
queue<int>q;
bool vis[100005];
int dis[100005];
int main()
{
	read(n);
	while(n%2==0)	n/=2;
	while(n%5==0)	n/=5;
	for(int i=0;i<n;i++)
		for(int j=0;j<10;j++)
			adde(i,(i*10+j)%n,j);
	for(int j=1;j<10;j++)
		adde(n,j%n,j);
	memset(dis,23,sizeof(dis));
	dis[n]=0;
	q.push(n);
	while(!q.empty())
	{
		int now=q.front();
		q.pop();
		vis[now]=0;
		for(int i=box[now];i;i=las[i])
			if(dis[edv[i]]>dis[now]+edw[i])
			{
				dis[edv[i]]=dis[now]+edw[i];
				if(!vis[edv[i]])
				{
					vis[edv[i]]=1;
					q.push(edv[i]);
				}
			}
	}
	printf("%d\n",dis[0]);
	return 0;
}


Measured memory_bytes: 13184
#include<iostream>
#include<string>
#include<cstring>
#include<cstdio>
#include<cmath>
#include <utility>
#include<cstdlib>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<functional>
#include<algorithm>
#define ms0(a) memset(a,0,sizeof(a))
#define ms1(a) memset(a,-1,sizeof(a))
#define pb(a) push_back(a)
using namespace std;
typedef long long  ll;
//typedef __int64  ll;
const double Eps = (double)0.5;
const int M = 1e9 + 7;
const int N = 2e5 + 5;
const double PI = acos(-1.0);

int main()
{
    char a[15];
    cin>>a;
    for(int i=0; i< 4; i++)
        cout<<a[i];
    cout<<' ';
    for(int i = 4; i< 12; i++)
        cout<<a[i];
    cout<<endl;
}


Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < n; i++)

ll f(ll n) {
	if (n == 1) return 1;
	else {
		return 2 * f(n / 2) + 1;
	}
}

int main() {
	ll h;
	cin >> h;
	cout << f(h) << endl;
	return 0;
}

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

int main(){
    int a;
    cin >> a;
    int l = a/100;
    int r = a%100;

    if(1<=l && l<=12){
        if(1<= r && r<=12){
            printf("AMBIGUOUS\n");
        }else{
            printf("MMYY\n");
        }
    }else{
        if(1<= r && r<=12){
            printf("YYMM\n");
        }else{
            printf("NA\n");
        }
    }
    return 0;
}

Measured memory_bytes: 256
n, y = map(int, input().split())
 
a = -1
b = -1
c = -1
 
find = False
for i in reversed(range(int(y/10000)+1)) :
    for j in range(int((y-10000*i)/5000)+1) :
        if (i+j+int((y-10000*i-5000*j) / 1000)) == n :
            a = i
            b = j
            c = n-i-j
            find = True
            break
    if find :
        break
print("{} {} {}".format(a, b, c))

Measured memory_bytes: 3188
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .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")
}
fn main(){
    let _a: u32 = read();
    let _b: String = read();

    if _a >= 3200 {
        println!("{}", _b);
    }else{
        println!("red");
    };
}


Measured memory_bytes: 4352
#include <bits/stdc++.h> 
using namespace std; 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    string s;
    cin>>s;

    if(s[2] == s[3] && s[4] == s[5])
    cout<<"Yes\n";

    else 
    cout<<"No\n";

    
	return 0; 
} 

Measured memory_bytes: 256
package main

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

var (
	readString func() string
	readBytes  func() []byte
	stdout     *bufio.Writer
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), math.MaxInt32)
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		return []byte(f1())
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

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

func abs64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

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

func gcd64(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return gcd64(b, a%b)
}

// readString() string
// readInt() int
// readInt64() int64
// readFloat64() float64

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

func main() {
	defer stdout.Flush()
	N:=readInt()
	A:=readInt()
	B:=readInt()

	println(min(N*A, B))
}

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


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long INF = 1LL << 60;

int main(){
  int n; cin >> n;
  
  set<char> s;
  rep(i, n){
    char c; cin >> c;
    s.insert(c);
  }

  cout << (s.count('Y') ? "Four" : "Three") << endl;

  return 0;
}


Measured memory_bytes: 256
def gcd(a, b):
    if a % b == 0:
        return b
    return gcd(b, a % b)

def lcm(a, b):
    return a * b // gcd(a, b)

n = int(input())
ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(ans, t)

print(int(ans))

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

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var a=cin.ReadInt;
          	var b=cin.ReadInt;
          	WriteLine(a*b%2==0? "Even":"Odd");
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

Measured memory_bytes: 11220
#include <iostream>

int main() {
    int D;
    std::string s;
    std::cin >> D;
    if (D == 25) {
        s = "Christmas";
    } else if (D == 24) {
        s = "Christmas Eve";
    } else if (D == 23) {
        s = "Christmas Eve Eve";
    } else {
        s = "Christmas Eve Eve Eve";
    }
    std::cout << s << std::endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
r = ['a']
for _ in range(n - 1):
  t = []
  for s in r:
    t.append(s + chr(ord(max(s)) + 1))
    for c in set(s):
      t.append(s + c)
  r = t
print(*sorted(r), sep='\n')


Measured memory_bytes: 14672
H,W=map(int,input().split())
A=[list(map(lambda x:False if x=='#' else True ,input())) for i in range(H)]

L=[[0]*W for i in range(H)]
R=[[0]*W for i in range(H)]
D=[[0]*W for i in range(H)]
U=[[0]*W for i in range(H)]


for i in range(H):
	for j in range(1,W):
		if A[i][j]:
			L[i][j]=int(A[i][j-1])+L[i][j-1]

for i in range(H):
	for j in range(W-1)[::-1]:
		if A[i][j]:
			R[i][j]=int(A[i][j+1])+R[i][j+1]

for i in range(1,H):
	for j in range(W):
		if A[i][j]:
			U[i][j]=int(A[i-1][j])+U[i-1][j]


for i in range(H-1)[::-1]:
	for j in range(W):
		if A[i][j]:
			D[i][j]=int(A[i+1][j])+D[i+1][j]

ans=0
for i in range(H):
	for j in range(W):
		ans=max(ans, L[i][j]+R[i][j]+U[i][j]+D[i][j]+1)

print(ans)


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

int main() {
	int n;cin>>n;
	vector<int> c(n),v(n);
	for(int i=0;i<n;i++){
		cin>>v[i];
	}
	int ans=0;
	for(int i=0;i<n;i++){
		cin>>c[i];
		ans+=max(0,v[i]-c[i]);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
 
int main()
{
  int glad = 0;
  int money;
  
  scanf("%d", &money);
  
  glad += (money / 500) * 1000;
  
  money = money % 500;
  
  glad += (money / 5) * 5;
  
  printf("%d", glad);
    
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>

using namespace std;

using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define Rep(i, n) for (long long i = 0; i< (long long)(n); i++)
#define RRep(i,n) for (long long i = ((long long)(n)-1); i>=0; i--)

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;

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;
}

template <class T>
T gcd(T a, T b){
    if( b==0 ) return a;
    return gcd(b, a%b);
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

int INF = 1e9+7;

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

int main(){
    int w,h,n;
    cin >> w >> h >> n;
    vector<int> a(4,0);
    a[1] = w;
    a[3] = h;
    rep(i,n){
        int x,y,z;
        cin >> x >> y >> z;
        z--;
        if(z==0){
            chmax(a[z],x);
        }
        else if(z==1){
            chmin(a[z],x);
        }
        else if(z==2){
            chmax(a[z],y);
        }
        else{
            chmin(a[z],y);
        }
    }
    int ans = 0;
    if(a[1]-a[0]>0 && a[3]-a[2]>0){
        ans = (a[1]-a[0])*(a[3]-a[2]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define tihs if(fopen("inp.txt","r"))freopen("inp.txt", "r", stdin),freopen("out.txt", "w", stdout);
using namespace std;
#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

#define M 100010


int main(){
	IOS;
	tihs;
	
	
	ll n;cin>>n;
	string s;cin>>s;
	ll cnt[n][3]={0};
	for(ll i=n-1;i>=0;--i){
		if(s[i]=='R')cnt[i][0]++;
		if(s[i]=='G')cnt[i][1]++;
		if(s[i]=='B')cnt[i][2]++;
		if(i!=n-1)rep(j,0,3)cnt[i][j]+=cnt[i+1][j];	
	}
	ll ans=0;
	rep(i,0,n)rep(j,i+1,n){
		if(j==n-1)continue;
		string x="RGB";
		char a,b;ll c;
		a=s[i],b=s[j];
		if(a==b)continue;
		rep(k,0,3)if(x[k]!=a and x[k]!=b)c=k;
		ans+=cnt[j+1][c];
		ll k=2*j-i;
		if(k<0 or k>=n)continue;
		if(s[k]==x[c])ans--;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3708
T=int(input())
for _ in range(T):
    N = int(input())
    A = list(map(int, input().split()))
    S = list(map(int, input()))

    for i in range(N-1, -1, -1):
        ai = A[i]
        if ai==0:
            continue
        top = ai.bit_length() - 1

        #assert ai & 1<<top
        for j in range(i-1, -1, -1):
            if A[j] >> top & 1:
                A[j] ^= ai
    #print(A,S)
    for a, c in zip(A[::-1], S[::-1]):
        if c==1 and a:
            break
    else:
        print("0")
        continue
    print("1")

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

using namespace std;
using ll = long long;

int main() {
  int n, m;
  cin >> n >> m;
  int ml = 1, mr = n;
  rep(i, m) {
    int l, r;
    cin >> l >> r;
    ml = max(ml, l);
    mr = min(mr, r);
  }
  if (mr < ml) {
    cout << 0 << endl;
  } else {
    cout << mr - ml + 1 << endl;
  }
}


Measured memory_bytes: 3608
fn solve(x: &str) -> i32 {
    (|(s,t)| s+t)(x.chars().fold((0,0),|(s,t),c| {
        if c=='S'   {(s+1,t)}
        else if s>0 {(s-1,t)}
        else        {(s,t+1)}
    }))
}
fn main() {
    loop {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let s = s.trim_right();
        if s=="" { break; }
        println!("{}",solve(&s));
    }
}

Measured memory_bytes: 508
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<set>
using namespace std;
string s;
main()
{
	while(cin>>s)
	{
		vector<int>a;
		map<string,int>M;int sz=1;
		M[s]=sz++;
		a.push_back(1);
		for(int i=1;i<8;i++)
		{
			cin>>s;
			if(M[s]==0)M[s]=sz++;
			a.push_back(M[s]);
		}
		sort(a.begin(),a.end());
		vector<int>ret;
		set<int>S;
		do{
			int now=0;
			for(int i=0;i<8;i++)now=now*10+a[i];
			if(S.find(now)==S.end())
			{
				ret.push_back(now);
				int b=now;
				for(int i=0;i<2;i++)
				{
					for(int j=0;j<4;j++)
					{
						for(int k=0;k<4;k++)
						{
							S.insert(b);
							b=b/10000%1000*10*10000+b/10000000*10000+b%1000*10+b/1000%10;
						}
						b=b/10000%10*10000000+b/100000%10*1000000+b/10%10*100000+b%10*10000+b/10000000*1000+b/1000000%10*100+b/100%10*10+b/1000%10;
					}
					b=b/10000%1000*10*10000+b/10000000*10000+b%1000*10+b/1000%10;
				}
			}
		}while(next_permutation(a.begin(),a.end()));
		cout<<ret.size()<<endl;
	}
}



Measured memory_bytes: 4968
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

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

  int n, m;
  ull k;
  cin >> n >> m >> k;

  vector<ull> A(n);
  rep(i, n) cin >> A[i];
  vector<ull> B(m);
  rep(i, m) cin >> B[i];

  vector<ull> A_souwa(n+1);
  A_souwa[0] = 0;
  srep(i, 1, n+1) A_souwa[i] = A_souwa[i-1] + A[i-1];
  vector<ull> B_souwa(m+1);
  B_souwa[0] = 0;
  srep(i, 1, m+1) B_souwa[i] = B_souwa[i-1] + B[i-1];

  int ans {};
  int index_B {m};
  rep (i, n+1) {
    if (A_souwa[i] > k) break;
    while (A_souwa[i] + B_souwa[index_B] > k) {
      --index_B;
    }
    maxs(ans, i+index_B);
  }
  cout << ans << '\n';
}


Measured memory_bytes: 9536
//in the name of allah
#include<iostream>
#include<algorithm>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<bitset>
#include<cstdio>
#include<cstdlib>
#include<cassert>
#include<string>
#include<cstring>
#include<vector>
using namespace std;
typedef pair<int , int> ii;
typedef long long ll;

const int maxn = 1e5+10;
int x[maxn] , d[maxn];
bool mark[maxn];
vector<int> g[maxn];

int main(){
	int n;
	scanf("%d" , &n);
	queue<int> q;
	for(int i=0 ; i<n-1 ; i++){
		int a , b;
		scanf("%d%d" , &a , &b);
		a --;
		b --;
		d[a] ++;
		d[b] ++;
		x[a] ^= b;
		x[b] ^= a;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	for(int i=0 ; i<n ; i++)
		if(d[i] == 1)
			q.push(i);
	while(q.size()){
		int v = q.front();
		q.pop();
		if(d[v] == 0){
			puts("First");
			return 0;
		}
		int par = x[v];
		for(auto u : g[par]){
			d[u] --;
			x[u] ^= par;
			if(u != v && d[u] <= 1)
				q.push(u);
		}
	}
	puts("Second");
}


Measured memory_bytes: 6784
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define sz(a) ((int)a.size())
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=yakusu[i];
  }
  return num;
}

int H,W;
vs s(50);
vi dv ={-1,0,1,0};vi du={0,-1,0,1};
int cnt=1;
int dfs(int u,int v){
  s[u][v]='.';
  
  rep(i,4){
   
      int nu =u +du[i],nv=v+dv[i];
      if(nu<0||nu>=H||nv<0||nv>=W)continue;
      if(s[nu][nv]=='.')continue;
      cnt ++;
      dfs(nu,nv);
    
  }
  return cnt;

}
int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}

//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vc Alp ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
//cout<<""<<endl;
int main(){
  string s;cin>>s;
  map<char,int> mp;
  rep(i,s.size()){
    mp[s[i]]++;
  }
  bool ok=true;
  for(auto x:mp){
    if(x.second%2!=0)ok=false;
  }
  if(ok)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}





Measured memory_bytes: 256
# include <iostream>
# include <cmath>
# include <algorithm>
# include <stdio.h>
# include <cstdint>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stack>
# include <set>
# include <list>
# include <random>
# include <deque>
# include <functional>
# include <iomanip>
# include <sstream>
# include <fstream>
# include <complex>
# include <numeric>
# include <immintrin.h>
# include <cassert>
# include <array>
# include <tuple>
# include <unordered_set>
# include <unordered_map>
using namespace std;
const long long md = 1e9 + 7;

int n, m;
string s;
int dp[5005][5005];


inline long long pw(long long x, long long y) {
    long long res = 1;
    while (y) {
        if (y & 1ll) res = (res * x) % md;
        x = (x * x) % md;
        y >>= 1;
    }
    return res;
}

int main(int argc, const char * argv[]) {
#ifdef __APPLE__
    freopen("/Users/danya.smelskiy/Documents/Danya/Resources/input.txt","r",stdin);
#endif
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n;
    cin >> s;
    m = (int)s.size();
    dp[0][0] = 1;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j <= n; ++j) {
            dp[i + 1][j + 1] += dp[i][j];
            if (dp[i + 1][j + 1] >= md) dp[i + 1][j + 1] -= md;
            dp[i + 1][j + 1] += dp[i][j];
            if (dp[i + 1][j + 1] >= md) dp[i + 1][j + 1] -= md;
            if (j) {
                dp[i + 1][j - 1] += dp[i][j];
                if (dp[i + 1][j - 1] >= md) dp[i + 1][j - 1] -= md;
            } else {
                dp[i + 1][j] += dp[i][j];
                if (dp[i + 1][j] >= md) dp[i + 1][j] -= md;
            }
        }
    }
    long long ans = dp[n][m];
    long long z = pw(pw(2, m), md - 2);
    ans *= z;
    ans %= md;
    cout << ans << '\n';
    return 0;
}



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

#define R register
#define ll long long
#define sum(a, b, mod) (((a) + (b)) % mod)

const int mod = 998244353;
const int MaxN = 1e6 + 10;

struct mod_t
{
    int x;
    mod_t() {}
    mod_t(ll v) : x(v) {}
    mod_t(int v) : x(v) {}
    static int Mod(int x) { return ((x < 0) ? (x + mod) : x); }
    mod_t operator+(const mod_t y) const { return Mod(x + y.x - mod); }
    mod_t operator-(const mod_t y) const { return Mod(x - y.x); }
    mod_t operator*(const mod_t y) const { return (ll)x * y.x % mod; }
};

int n, k;
mod_t ans, fac[MaxN], inv[MaxN];

mod_t fast_pow(mod_t a, int b)
{
    mod_t ret = 1;
    while (b)
    {
        if (b & 1)
            ret = ret * a;
        a = a * a, b >>= 1;
    }
    return ret;
}

void prework(int n)
{
    fac[0] = inv[0] = 1;
    for (int i = 1; i <= n; i++)
        fac[i] = fac[i - 1] * i;
    inv[n] = fast_pow(fac[n], mod - 2);
    for (int i = n - 1; ~i; i--)
        inv[i] = inv[i + 1] * (i + 1);
}

mod_t C(int n, int m)
{
    if (m > n || m < 0) return 0;
    return (fac[n] * inv[m] * inv[n - m]).x;
}

int main()
{
    prework(1000000);
    scanf("%d%d", &n, &k);
    if (k < n) return 0 * printf("0");
    for (int i = 0; i <= k; i++)
    {
        int r = i, b = k - r;
        if(r < b) continue; if(r == b) --b;
        ans = ans + C(r + b, r) - C(r + b, 2 * r - n + 1);
    }
    printf("%d\n", ans.x);
    return 0;
}


Measured memory_bytes: 8192
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int max = 0;
		for (int i = 1; i <= Math.sqrt(m); i++) {
		    if (m % i == 0) {
		        if (m / i >= n) {
		            max = Math.max(max, i);
		        }
		        if (i >= n) {
		            max = Math.max(max, m / i);
		        }
		    }
		}
		System.out.println(max);
    }
}



Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E18;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

ll nodenum;
vector<ll> node;

ll init_num=0;
ll func(ll x,ll y){
    return x+y;
}

//セグ木
void init(vector<ll> v){
    nodenum=1;
    while(v.size()>nodenum)nodenum*=2;
    node.resize(2*nodenum-1,init_num);
    rep(i,nodenum-1,nodenum*2-2){
        if(i-(nodenum-1)<v.size()){
            node[i]=node[i-(nodenum-1)];
        }else{
            node[i]=init_num;
        }
    }
    for(ll i=nodenum-2;i>=0;i--){
        node[i]=func(node[2*i+1],node[2*i+2]);
    }
}

void update(ll x,ll y){ //v[x]をyに変更する
    node[x+nodenum-1]=y;
    ll next=x+nodenum-1;
    while(next>0){
        next=(next-1)/2;
        node[next]=func(node[2*next+1],node[2*next+2]);
    }
}

ll find(ll i,ll j,ll x,ll y,ll z){     //v[[i,j)]でのfuncの結果を出力する //node[x]に着目しているnode[x]が担当する範囲は[y,z); //最初はx=-1で
    if(x==-1) return find(i,j,0,0,nodenum);
    if(j<=y || z<=i)return init_num;
    if(i<=y && z<=j)return node[x];
    return func(find(i,j,2*x+1,y,(y+z)/2),find(i,j,2*x+2,(y+z)/2,z));
}

int main(){fastio
    ll n,q;cin>>n>>q;
    vector<ll> v;rep(i,0,n-1)v.pb(0);
    init(v);
    rep(i,0,q-1){
        ll com;
        ll x,y;
        cin>>com;
        if(com==0){
            cin>>x>>y;
            update(x-1,node[(x-1)+nodenum-1]+y);
        }else{
            cin>>x>>y;
            cout<<find(x-1,y,-1,0,0)<<endl;
        }
    }
    
    return 0;
}








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

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

    double prob[n+1];
    prob[0] = 0.0;
    for (int i = 1; i <= n; i++) cin >> prob[i];

    double dp[n+1][n+1];
    memset(dp, 0.0, sizeof(dp));

    dp[0][0] = 1.0;

    for (int i = 1; i <= n; i++){
        for (int j = 0; j <= i; j++){
            if (j == 0) dp[i][j] = dp[i-1][j]*(1.0-prob[i]);
            else dp[i][j] = dp[i-1][j-1]*prob[i] + dp[i-1][j]*(1.0 - prob[i]);
        }
    }

    double ans = 0.0;

    for (int i = (n)/2 + 1; i <=n ; i++){
        ans += dp[n][i];
    }

    cout << setprecision(10) << ans << endl;
}

Measured memory_bytes: 70528
#include <bits/stdc++.h>
#define INF (1LL<<60)
#define MOD7 1000000007LL
#define PREP(i, s, x) for(ll (i) = (s); (i) < (x); (i) ++)
#define MREP(i, s, x) for(ll (i) = (s); (i) >= (x); (i) --)
#define REP(i, x) PREP(i, 0, x)
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

int main(){
    ll n;
    cin >> n;
    ll ans = 0;
    for (int i = 1; i <= n; i += 2){
        ll cnt = 0;
        PREP(j, 1, i+1){
            if(i % j == 0){
                cnt++;
            }
        }
        if(cnt == 8){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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



int main() {
    string s;
    cin>>s;
    int n=s.size();
    vi len(s.size(),INF);
    rep(i,n-1){
        if(s[i]=='R'&&s[i+1]=='L'){
            len[i]=0;
            len[i+1]=0;
            for(int j=i-1;j>=0&&j<n&&s[j]=='R';j--){
                if(len[j]<=i-j)break;
                len[j]=i-j;
            }
            i++;
            for(int j=i+1;j>=0&&j<n&&s[j]=='L';j++){
                if(len[j]<=j-i){
                    break;
                }
                len[j]=j-i;
            }
        } else continue;
    }
    vi ans(n,0);
    rep(i,n){
        if(s[i]=='R'){
            if(len[i]%2==1){
                ans[i+len[i]+1]++;
            } else {
                ans[i+len[i]]++;
            }
        } else {
            if(len[i]%2==1){
                ans[i-len[i]-1]++;
            } else {
                ans[i-len[i]]++;
            }
        }
    }
    rep(i,n){
        if(!i)cout<<ans[0];
        else cout<<" "<<ans[i];
    }
    cout<<endl;
    // rep(i,n){
    //     if(!i)cout<<len[0];
    //     else cout<<" "<<len[i];
    // }
    // cout<<endl;
}


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

using ll =  long long;
using pint =  pair<int,int>;

#define INF 99999999
#define rep(i,n) for(int (i)=0,temp=(int)(n);(i)<temp;++(i)) 
#define repi(i,start,end) for(int (i)=(start),temp=(int)(end);i<(end);++(i))
#define rfor(v,x) for(const auto& (x) : (v)) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort((v), (v)+(n))
#define vsort(v) sort((v).begin(), (v).end())
#define vfsort(v,lambda) sort(all((v)),(lambda))
#define vint vector<int>
#define vvint vector<vector<int>> //vvint v(n,vint(n))のように宣言できる
#define vin(v) rep(i,(v).size()) {cin >> (v)[i];}
//最終奥義
//#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//lambda式 -> [&](int x, int y){return x<y;}
//vector内の重複を削除-> v.erase(unique(all(v)),v.end());

signed main(void){
  int x,y;cin >> x >> y;
  int ans=0;
  if(x<4){
    ans+=100000*(4-x);
  }
  if(y<4)
    ans+=100000*(4-y);
  if(x==y&&x==1)
    ans+=400000;
  cout << ans << endl;

}


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

        if((a == b) && (a == c)){            
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 22996
def countCombinations(n, x, size=3):
    dp = [[0 for j in range(x + 1)] for i in range(size + 1)]
    dp[0][0] = 1
    for i in range(1, n + 1):
        for row in range(size - 1, -1, -1):
            for col in range(x + 1 - i):
                dp[1+row][i+col] += dp[row][col]
    return dp[-1][-1]



while True:
    m, n = (int(x) for x in input().split())
    if m==0 and n==0:
        quit()
    ans = countCombinations(m, n)
    print(ans)


Measured memory_bytes: 5608
#include <bits/stdc++.h>
#define ll long long 
#define rep(n,i) for (int (i)=0;(i)<(n);(i)++)
#define repi(n,k,i) for (int (i)=(k);(i)<(n);(i)++)
#define inrep(n,i) for (int (i)=(n)-1;(i)<0;(i)--)
#define pb push_back
#define vcs(x) x.begin(),x.end()
#define sz(x) x.size()
using namespace std;
double pt[15][15];
int ans=0;
int n,d;
void pythg(int x, int y){
	double sum=0;
	rep(d,i) sum+=(pt[x][i]-pt[y][i])*(pt[x][i]-pt[y][i]);
	sum=sqrt(sum);
	if (sum==(int)sum) {
		ans++; 
	}
}
main (){
	cin>>n>>d;
	rep(n,i) rep(d,j) cin>>pt[i][j];
	rep (n,i) repi(n,i+1,j) pythg(i,j);
	cout<<ans<<endl;

}

Measured memory_bytes: 256