akhauriyash/Code-Regression huggingface dataset:
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let N = read!(i64);
    println!("{}", N * N * N)
}


Measured memory_bytes: 4352
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int x = scanner.nextInt();

		List<Integer> list = new ArrayList<>();
		for(int i = 0; i < N; i++) {
			list.add(scanner.nextInt());
		}

		Collections.sort(list);

		int count = 0;
		for (int i = 0; i < N; i++) {
			x -= list.get(i);
			if (x < 0)
				break;
			else
				count++;
		}

		if (x > 0) count--;

		System.out.println(count);
	}

}

Measured memory_bytes: 21844
A = int(input())
B = int(input())

if A == 1:
    if B == 2:
        print(3)
    else:
        print(2)
elif A == 2:
    if B == 1:
        print(3)
    else:
        print(1)
else:
    if B == 1:
        print(2)
    else:
        print(1)



Measured memory_bytes: 3060
#include<stdio.h>
int main(void)
{
    int a, b, i;
    scanf("%d %d", &a, &b);
    double ret = 0;
    for(i = 1; i <= a; i++)
    {
        double tmp = 1.0 / a;
        int now = i;
        while(now < b)
        {
            now *= 2;
            tmp /= 2;
        }
        ret += tmp;
    }
    printf("%0.12lf\n", ret);
    return 0;
}


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

#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

typedef long double ld; 
const ld INF = 1e+12;

int main() {
  while(1){
    int n;
    cin>>n;
    if(!n)break;
    vector<ld> p(n),p2;
    REP(i,n) cin>>p[i];
    int l = 0;
    vector<int> len;
    p2.push_back(1);
    REP(i,n) {
      if (p[i] != 1) {
        len.push_back(l);
        p2.push_back(p[i]);
        l = 0;
      }
      ++l;
    }
    len.push_back(l);
    n = p2.size();
    vector<ld> dp(n+1,INF);
    dp[0] = 0;
    REP(i,n) {
      ld e = 0.0;
      REP(j,100) {
        if(i+j>=n)break;
        e = e + len[i+j] + (e+1) * (1-p2[i+j]) / p2[i+j];
        dp[i+j+1] = min(dp[i+j+1], dp[i] + e + 1);
      }
    }
    cout << setprecision(10) << fixed;
    cout << dp[n] - 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 7956
#include <stdio.h>

int main(void)
{
    int num[4][3][10] = {0};
    int n, b, f, r, v;
    int i, j, k;

    scanf("%d", &n);
    for (i = 0; i < n; i++ ) {
        scanf("%d %d %d %d", &b, &f, &r, &v);
        num[b-1][f-1][r-1] += v;
    }

    for (i = 0; i < 4; i++) {
        for (j = 0; j < 3; j++) {
            for (k = 0; k < 10; k++) {
                printf(" %d", num[i][j][k]);
            }
            printf("\n");
        }
        if (i < 3) {
             printf("####################\n");
        }
    }
    return 0;
}

Measured memory_bytes: 612
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n,w;
    cin>>n>>w;
    long long int dp[n+1][w+1];
    int v[n+1],weight[n+1];
    for(int i=1;i<=n;i++){
        cin>>weight[i]>>v[i];
    }
    memset(dp,0,sizeof(dp));
    for(int i=1;i<=n;i++){
        for(int j=0;j<=w;j++){
            if(j>=weight[i]){
                dp[i][j]=dp[i-1][j-weight[i]]+v[i];
            } 
            dp[i][j]=max(dp[i][j],dp[i-1][j]);
            //cout<<dp[i][j]<<" ";
        }
        //cout<<endl;
    }
    cout<<dp[n][w]<<endl;
    
}

Measured memory_bytes: 79232
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <math.h>
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const int INF=1e9;
const ll MX = 1e18;
const int MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
 
int main() {
  int n;
  cin>>n;
  cout<<(n+1)/2<<endl;
}

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

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

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

    vector<long long> a(n);

    for(long long i = 0; i < n; i++) cin >> a[i];

    vector<long long> left(n+1, 0), right(n+1, 0);
    for(long long i = 0; i < n; i++) left[i+1] = gcd(left[i], a[i]);
    for(long long i = n-1; i >= 0; i--) right[i] = gcd(right[i+1], a[i]);

    long long ans = 0;
    for(long long i = 0; i < n; i++){
        long long l = left[i];
        long long r = right[i+1];

        if(ans < gcd(l, r)) ans = gcd(l, r);
    }

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

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

using namespace std;
typedef long long ll;
typedef long double ld;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define endl '\n'
#define MOD 1000000007
#define mm(arr) memset(arr, 0, sizeof(arr))
#define int ll

int32_t main(){
    FAST
    int n; cin >> n;
    int arr[n];
    map<int, int> has;
    for(int i = 0; i < n; i++){
        cin >> arr[i];
        has[arr[i]]++;
    }
    int ans = 0;
    bool done[n + 1];
    mm(done);
    for(int i = 0; i < n; i++){
        if(done[arr[i]])continue;
        ans += has[arr[i]] * (has[arr[i]] - 1)/2;
        done[arr[i]] = 1;
    }
    for(int i = 0; i < n; i++){
        ans -= has[arr[i]] * (has[arr[i]] - 1)/2;
        has[arr[i]]--;
        ans += has[arr[i]] * (has[arr[i]] - 1)/2;
        cout << ans << endl;
        ans -= has[arr[i]] * (has[arr[i]] - 1)/2;
        has[arr[i]]++;
        ans += has[arr[i]] * (has[arr[i]] - 1)/2;;
    }
    return 0;
}


Measured memory_bytes: 13252
#include <iostream>
#include <cstdio>
#include <cmath>
#include <complex>

using namespace std;
typedef complex<double> P;

double cross(P a,P b){return (conj(a)*b).imag();}

int main(){
  int n;
  scanf("%d",&n);
  while(n--){
    P a,b,c;
    cin >> a.real() >> a.imag() >> b.real() >> b.imag() >> c.real() >> c.imag();
    P m = (a+b)/P(2,0);
    P n = (a+c)/P(2,0);
    P s = (a-b)*P(0,1);
    P t = (a-c)*P(0,1);
    double e = cross(n-m,t)/cross(s,t);
    P o = m+s*P(e,0);
    double r = abs(a-o);
    printf("%.3f %.3f %.3f\n",o.real(),o.imag(),r);
  }
}

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

#define ll long long int

#define pb push_back
#define mp make_pair
#define F first
#define S second

#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define all(v) (v).begin(),(v).end()

using namespace std;
///////////////////////////////////////////////////////

int n;
int score[110];

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

	int sum = 0;
	cin>>n;
	FOR(i,1,n) cin>>score[i],sum+=score[i];

	sort(score+1,score+n+1);

	if(sum%10 != 0){
		cout<<sum<<endl;
		return 0;
	}

	FOR(i,1,n){
		if(score[i]%10 !=0){
			sum-=score[i];

			cout<<sum<<endl;
			return 0;
		}
	}

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


Measured memory_bytes: 384
/*
	Name:
	Author: xiaruize
	Date:
*/
#pragma GCC optimize(2)
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cerrno>
#include<clocale>
#include<cmath>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<utility>
#include<vector>
#include<cwchar>
#include<cwctype>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define ll long long
#define form(i,j,n) for(int i=int(j);i<=int(n);i++)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pis pair<int,string>
#define sec second
#define sz(a) int((a).size())

inline int read()
{
    char ch=getchar();
    int x=0,f=1;
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=getchar();
    return x*f;
}

int main()
{
 	ios::sync_with_stdio(false);
	cin.tie(0);
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
		cin>>a[i];
	map<int,int> map;
	ll ans=0;
	for(int i=0;i<n;i++)
	{
		ans+=map[a[i]-(i+1)];
		map[-a[i]-(i+1)]++;
	 } 
	 cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 21464
#include<iostream>
#include<string>
#include<cstring>
/*
i : 0 ~ m, j: 0 ~ K, k: 0 or 1
dp[i][j][k] := 上からi桁目まで決めてj個の非ゼロを使って
k = 0 : そこまでの桁はNと全て一致しているとき
k = 1 : そこまでの桁はNと全て一致しているわけではないとき
の場合の数
*/

int main(){
  std::string N;
  int K;
  std::cin >> N;
  std::cin >> K;
  int keta = N.length();

  int dp[105][4][2];
  memset(dp, 0, sizeof dp);
  dp[0][0][0] = 1; // 最初は1ずつ足すので初期値は1
  for(int i = 0; i < keta; i++){
    for(int j = 0; j < 4; j++){
      for(int k = 0; k < 2; k++){
        int now_digit_val = N[i] - '0'; // Nの上からi桁目を取り出す

        // 次の桁を0 ~ 9のどれにするか？
        for(int d = 0; d < 10; d++){
          int next_i = i + 1;
          int next_j = j;
          int next_k = k;
          if(d != 0) next_j++;
          if(next_j > K) continue; // 非ゼロが多すぎる
          if(k == 0){
            if(d > now_digit_val) continue; // 数値がオーバー
            if(d < now_digit_val) next_k = 1;
          }
          dp[next_i][next_j][next_k] += dp[i][j][k];
        }
      }
    }
  }

  int ans = dp[keta][K][0] + dp[keta][K][1];
  std::cout << ans << std::endl;

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){

int a,b,c,x,y,z;
scanf("%d %d %d",&a,&b,&c);

if(a>b){
x=a;
a=b;
b=x;
}

if(b>c){
y=b;
b=c;
c=y;
}

if(a>b){
z=a;
a=b;
b=z;
}

printf("%d %d %d\n",a,b,c);

return 0;

}

Measured memory_bytes: 596
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define FOR(x, b, e) for(int x=(b); x<=(e); ++x)
#define FORD(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define REP(x, n) for(int x=0; x<(n); ++x)
#define ALL(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it) {
	*this << ((it != d.b) ? ", " : "") << *it;
  }
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

int main() {
	ios_base::sync_with_stdio(false);

	char c;
	cin >> c;
	c++;
	cout << c << endl;
	
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
ll MOD = 1e9+7;
void chmin(long long &a, long long b) { if (a > b) a = b; }

int main(){
  ll i, j;
  ll a, b, c;
  cin >> a >> b >> c;
  if(a == b && b == c)
   cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<cmath>
#include<map>
#include<unordered_map>
#include<functional>
#include<queue>
#include<set>
#include<stack>
#include<iomanip>
#include<algorithm>
#include<numeric>
#include<memory>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a)   a.begin(),a.end()
template<typename T =ll> using v = vector<T>;
template<typename T =ll> using vv = v<v<T>>;
template<typename T =ll,typename U =ll> using p = pair<T,U>;
template<typename T> T chmin(T &a,T b) {return a=min(a,b);}
template<typename T> T chmax(T &a,T b) {return a=max(a,b);}
const ll INF = (ll)1e9;
template <int MOD>
struct ModInt {
    using lint = long long;
    int val;

    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };

    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }

    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(lint n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }

    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }
    //
    ModInt operator++(int) {
        auto t = *this;
        *this += 1;
        return t;
    }

    ModInt operator--(int) {
        auto t = *this;
        *this -= 1;
        return t;
    }
    ModInt operator<<(const int n){
        return ModInt(*this)*ModInt(2).pow(n);
    }
    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }

    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};

constexpr int MOD = 1e9 + 7;
using mint = ModInt<MOD>;

void b(){
  string S; cin >> S;
  v<> OK(3,0);
  v<> CHK(3,0);
  
  
  rep(i,S.size()){
      OK[i%3]++;
      CHK[S[i]-'a']++;
  }
  sort(all(OK));
  sort(all(CHK));

  if(OK==CHK){
      cout << "YES"<<endl;   
  }else{
      cout << "NO"<<endl;
  }



}


int main(){
    b();
}


Measured memory_bytes: 3752
import numpy as np
D = int(input())
c = np.array(list(map(int,input().split())))
s = np.array([list(map(int,input().split())) for _ in range(D)])
t = np.array([int(input())-1 for _ in range(D)])

last = np.full(26,-1)

S = 0
score = 0;
for d in range(D):
    S += s[d][t[d]]
    last[t[d]] = d
    for i in range(26):
        S-=c[i]*(d - last[i])
    score +=max(10**6+S,0)
    print(S)


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

int main(){
  int x;
  cin >> x;
  if(x<=599){
    cout << 8 << endl;
    return 0;
  }
  if(x<=799){
    cout << 7 << endl;
    return 0;
  }
  if(x<=999){
    cout << 6 << endl;
    return 0;
  }
    if(x<=1199){
    cout << 5 << endl;
    return 0;
  }
    if(x<=1399){
    cout << 4 << endl;
    return 0;
  }
    if(x<=1599){
    cout << 3 << endl;
    return 0;
  }
    if(x<=1799){
    cout << 2 << endl;
    return 0;
  }
  cout << 1 << endl;
  return 0;
}


Measured memory_bytes: 3620
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int INF = 1000000007;

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

	if(S.size() == 2) cout<<S<<endl;
	else{
		reverse(S.begin(), S.end());
		cout<<S<<endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }



double a, b;

int main() {
    while (cin >> a >> b) {
        cout << fixed << setprecision(9) << a * b / 3.305785 << endl;
    }
    return 0;
}


Measured memory_bytes: 1276
#include <cstdio>
using namespace std;
char ch[10];
int maxx,cnt;
int main(){
	scanf("%s",ch);
	for(int i=0;i<3;++i){
		if(ch[i]=='R'){
			++cnt;
		}else{
			if(maxx<cnt)maxx=cnt;
			cnt=0;
		}
	}
	if(maxx<cnt)maxx=cnt;
	printf("%d\n",maxx);
	return 0;
}

Measured memory_bytes: 1736
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string t;
	cin >> t;
	bool n = false, w = false, s = false, e = false;
	rep(i,t.size()){
		if(t[i] == 'N') n = true;
		if(t[i] == 'W') w = true;
		if(t[i] == 'S') s = true;
		if(t[i] == 'E') e = true;
	}
	if(n^s || w^e) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    static int ans=0;
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int n=Integer.parseInt(sc.next());
        int m=Integer.parseInt(sc.next());
        ArrayList<ArrayList<Integer>> connect=new ArrayList<ArrayList<Integer>>();
        for(int i=0;i<=n;i++){
            connect.add(new ArrayList<Integer>());
        }
        for(int k=0;k<m;k++){
            int a_k=Integer.parseInt(sc.next());
            int b_k=Integer.parseInt(sc.next());
            connect.get(a_k).add(b_k);
            connect.get(b_k).add(a_k);
        }
        sc.close();

        HashSet<Integer> to_visit=new HashSet<Integer>();
        for(int i=2;i<=n;i++){
            to_visit.add(i);
        }            
        int st=1;
        System.out.println(goal_count(connect, to_visit, st));
    }

    public static int goal_count(ArrayList<ArrayList<Integer>> connect, HashSet<Integer> to_visit, int st){
        if(to_visit.size()==0){
            return 1;
        }
        int pathes=0;
        for(int v:connect.get(st)){
            if(to_visit.contains(v)){
                to_visit.remove(v);
                pathes+=goal_count(connect, to_visit, v);
                to_visit.add(v);
            }
        }
        return pathes;
    }
}

Measured memory_bytes: 23764
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    return [w[0],w[1]]

def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m

x, y = map(int, input().split())
if (x+y)%3 or y>2*x or x>2*y: print(0)
else:
    a, b = (2*x-y)//3, (2*y-x)//3
    m = 10**9+7
    res = 1
    for i in range(1,a+b+1):
        res = res*i%m
    for i in range(1,a+1):
        res = res*mod_inv(i,m)%m
    for i in range(1,b+1):
        res = res*mod_inv(i,m)%m
    print(res%m)

Measured memory_bytes: 41800
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(10);

}

bool used[51];
ll b[51];
ll p[51];

pair<ll, ll> solve1(ll n) {
	if (n == 0) {
		return make_pair(1, 1);
	}
	if (used[n]) {
		return make_pair(b[n], p[n]);
	}
	pair<ll, ll> pa = solve1(n - 1);
	b[n] = 2 * pa.first + 3;
	p[n] = 2 * pa.second + 1;
	used[n] = true;
	return make_pair(b[n], p[n]);
}

ll solve2(ll n, ll x) {
	if (n == 0) {
		return 1;
	}
	if (x == 1) {
		return 0;
	}
	else if (x < b[n - 1] + 2) {
		return solve2(n - 1, x - 1);
	}
	else if (x == b[n - 1] + 2) {
		return p[n - 1] + 1;
	}
	else if (x < 2 * b[n - 1] + 3) {
		return p[n - 1] + 1 + solve2(n - 1, x - b[n - 1] - 2);
	}
	else {
		return 2 * p[n - 1] + 1;
	}
}

signed main() {
	ll n, x;

	cin >> n >> x;

	REP(i, 51) {
		used[i] = false;
		b[i] = 0;
		p[i] = 0;
	}

	used[0] = true;
	b[0] = 1;
	p[0] = 1;
	solve1(n - 1);

	cout << solve2(n, x) << endl;
}

Measured memory_bytes: 256
#include <string.h>
#include <iostream>
#include <algorithm>

using namespace std;
// Sol 1A
// backward dp
// enumerating items from beginning (z = 0..N-1)
// inner loop is looping items
long long solve(int N, int W, int *v, int *w) {
  // items are 0 indexed, 0..N-1'th items
  // dp[a][b] = solution for a knapsack of weight a,
  // only can use items until and including b'th item
  long long dp[W + 1][N];
  for (int z = 0; z < N; ++z) {
    dp[0][z] = 0;
  }
  for (int q = 0; q < W + 1; ++q) {
    dp[q][0] = 0;
  }
  for (int q = 1; q < W + 1; ++q) {
    for (int z = 0; z < N; ++z) {
      dp[q][z] = max(               //
          z > 0 ? dp[q][z - 1] : 0, //
          q - w[z] >= 0 ?           //
              (v[z] + (z > 0 ? dp[q - w[z]][z - 1] : 0))
                        : 0);
    }
  }

  return dp[W][N - 1];
}



int main() {
  int N, W;
  cin >> N >> W;
  int v[N], w[N];
  for (int q = 0; q < N; ++q)
    cin >> w[q] >> v[q];

  long long ans = solve(N, W, v, w);
  cout << ans << '\n';
}


Measured memory_bytes: 78336
// #include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;

#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0; i<n; i++)

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

    int cnt = 0;

    rep(i, s.size()) {
        if (s[i]!=t[i]) cnt++;
    }

    cout << cnt << endl;

    return 0;
}

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

template<typename T>
void read(T &n){
    n = 0;
    T f = 1;
    char c = getchar();
    while(!isdigit(c) && c != '-') c = getchar();
    if(c == '-') f = -1, c = getchar();
    while(isdigit(c)) n = n*10+c-'0', c = getchar();
    n *= f;
}
template<typename T>
void write(T n){
    if(n < 0) putchar('-'), n = -n;
    if(n > 9) write(n/10);
    putchar(n%10+'0');
}

int n, m;
int a[MAX];
ll c[MAX];

int main()
{
    cin >> n;
    for(int i = 1; i <= n; i++){
        read(a[i]);
        c[a[i]]++;
    }
    ll ans = 0;
    for(int i = 1; i <= n; i++){
        ans += (ll)c[i]*(c[i]-1)/2;
    }
    for(int i = 1; i <= n; i++){
        ll x = ans-(c[a[i]]*(c[a[i]]-1))/2;
        x += (c[a[i]]-1)*(c[a[i]]-2)/2;
        write(x), putchar('\n');
    }

    return 0;
}


Measured memory_bytes: 5760
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;
 
signed main() {
    IOS;
    int h, n;
    cin >> h >> n;
    for(int i = 1; i <= n; i++){
        int p;  cin >> p;
        h -= p;
    }  
    if(h <= 0)
        cout << "Yes";
    else
        cout << "No";
    return 0;
}

Measured memory_bytes: 256
a, b, c, d = map(int, list(input()))
op = ['-', '', '+']
for i in range(0, 3, 2):
  for j in range(0, 3, 2):
    for k in range(0, 3, 2):
      if a + b*(i-1) + c*(j-1) + d*(k-1) == 7:
        print(f'''{a}{op[i]}{b}{op[j]}{c}{op[k]}{d}=7''')
        exit()

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

int main(int argc, char *argv[])
{
  int m, min, max;

  while(cin >> m >> min >> max, m) {
    vector<int> v;
    for (int i = 0; i < m; i++) {
      int P;
      cin >> P;
      v.push_back(P);
    }

    int maxgap = 0, answer = 0;
    for (int i = min; i < max+1; i++) {
      int gap = v[i-1] - v[i];
      //cout << gap << endl;
      if(maxgap<=gap) {
	maxgap = gap;
	answer = i;
      }
    }

    cout << answer << endl;

  }
  
  return 0;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
typedef long long ll;
typedef pair<ll,ll> prl;
typedef vector<ll> vcl;
typedef map<ll,ll> mapl;
typedef unordered_map<ll,ll> umap;
#define pb push_back
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repi(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)
#define reps(i,v) for(ll i=0;i<v.size();i++)
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
const ll mod = 1e9+7;

int main() {
    // your code goes here
    string s;
    cin >> s;
    if(s=="ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;
    return 0;
}

Measured memory_bytes: 3632
/**
 * ??\????????????????????????????°?????????????????????????????£??????????????????????

insert str: ????????? str ??????????????????
find str: ????????? str ?????????????????´??? 'yes'??¨????????????????????´??? 'no'??¨???????????????
??\???
??????????????????????????° n ?????????????????????????¶???? n ?????? n
??¶?????????????????????????????????????????????????????¢??????????¨??????¨????????§?????????

??????
??? find ?????????????????????yes ????????? no ???????????????????????????????????????

??¶?´?
??????????????????????????????'A', 'C', 'G', 'T' ???????¨????????????????????§????????????????
1????????????????????????12
n???1,000,000
??\?????? 1
6
insert AAA
insert AAC
find AAA
find CCC
insert CCC
find CCC
????????? 1
yes
no
yes
??\?????? 2
13
insert AAA
insert AAC
insert AGA
insert AGG
insert TTT
find AAA
find CCC
find CCC
insert CCC
find CCC
insert T
find TTT
find T
????????? 2
yes
no
no
yes
yes
yes
 */

#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <unordered_set>

int main(int argc, char const *argv[]) {
  unsigned int n = 0;
  std::string Param;
  std::istringstream iss;
  std::string Command;
  std::string Word;
  // std::vector<std::string> Dic;
  std::unordered_set<std::string> Dic;

  getline(std::cin, Param);
  iss.str(Param);
  iss >> n;
  iss.clear();
  for (size_t i = 0; i < n; i++) {
    getline(std::cin, Param);
    iss.str(Param);
    iss >> Command >> Word;
    iss.clear();
    if (Command == "insert") {
      Dic.insert(Word);
    } else if (Command == "find") {
      auto Result = Dic.find(Word);
      if (Result != Dic.end()) {
        std::cout << "yes" << std::endl;
      } else {
        std::cout << "no" << std::endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 29548
import java.awt.Point;
import java.util.Scanner;

public class Main{
	public static void main(String [] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int [][] ans = new int [n][m];
		int k = sc.nextInt();
		Point x = new Point(0,0);
		boolean flag = true ;
		for(int i = 1 ; i <= k ; i ++) {
			int temp = sc.nextInt();
			for(int j = 0 ; j < temp ; j ++) {
				if(flag) {
				ans[x.x][x.y] = i;
				x.x = x.x+1;
				if(x.x >= n && flag) {
					x.y = x.y+ 1 ;
					x.x = n-1 ;
					flag = false ;
				}
				}
				else {
					ans[x.x][x.y] = i;
					x.x = x.x-1;
					if(x.x < 0 && !flag) {
						x.y = x.y + 1 ;
						x.x = 0 ;
						flag = true ;
					}
				}
			}
		}
		for(int i = 0 ; i < n ; i ++) {
			for(int j = 0 ; j < m ; j ++) {
				System.out.print(ans[i][j] + " ");
			}
		System.out.println();
		}
	}	
}


Measured memory_bytes: 30480
lHand = [input() for i in range(3)]

nTurn = 'a'

while(1):
    trash = nTurn
    tInt = ord(trash) - ord('a')
    if (len(lHand[tInt]) == 0):
        print(trash.upper())
        break
    nTurn = lHand[tInt][0]
    lHand[tInt] = lHand[tInt][1:]

Measured memory_bytes: 3060
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
const int MAXN=200005;
int f[MAXN],n,a[MAXN];LL K;
int nxt[MAXN],pos[MAXN];
int main()
{
	n=read();K=read();
	for(int i=1;i<=n;i++)a[i]=read();
	for(int i=n;i>=1;i--)nxt[i]=pos[a[i]],pos[a[i]]=i;
	for(int i=n;i>=1;i--)if(!nxt[i])nxt[i]=pos[a[i]];
	memset(f,-1,sizeof(f));
	int ps,gg=0;
	LL total=0;
	for(int i=1,lst=0;i<=n;i=nxt[i]%n+1)
	{
		lst=total/n;gg=lst;
		if(f[i]!=-1){ps=i;break;}
		f[i]=lst;
		if(nxt[i]>i)total+=nxt[i]-i+1;
		else total+=nxt[i]+n-i+1;
	}
	int st=1;
	if(ps==1)f[ps]=gg;
	if(K>f[ps])
	{
		if((K%f[ps]))K%=f[ps],st=ps;
		else K=f[ps];
	}
	if(!K)return 0;
	total=0;
	for(int i=st,lst=0,nx;i<=n;i=nx)
	{
		lst=total/n;
		if(lst>K-1)break;
		if(nxt[i]>i)
		{
			nx=nxt[i]%n+1;
			total+=nxt[i]-i+1;
		}
		else
		{
			int nxlst=(total+nxt[i]+n-i+1)/n;
			if(nxlst<K)total+=nxt[i]+n-i+1,nx=nxt[i]%n+1;
			else
			{
				pr1(a[i]),nx=i%n+1;
				total++;
				if(total/n>=K)return 0;
			}
		}
	}
	return 0;
}




Measured memory_bytes: 4480
a,b,c,d,e = [int(input()) for i in range(5)]
x = [a,b,c,d,e]
y = [0]*5
for i in range(5):
    if x[i]%10==0:
        y[i]=0
    else:
        y[i]=10-x[i]%10
print(a+b+c+d+e+sum(y)-max(y))


Measured memory_bytes: 3060
n=int(input())

p=10**9+7

A=list(map(int,input().split()))

binA=[]
for i in range(n):
  binA.append(format(A[i],"060b"))


lis=[0 for i in range(60)]

for binAi in binA:
  for j in range(60):
    lis[j]+=int(binAi[j])

binary=[0 for i in range(60)]

for i in range(n):
  for j in range(60):
    if binA[i][j]=="0":
      binary[j]+=lis[j]
    else:
      binary[j]+=n-lis[j]


binary[58]+=binary[59]//2
binary[59]=0


explis=[1]

for i in range(60):
  explis.append((explis[i]*2)%p)

ans=0
for i in range(59):
  ans=(ans+binary[i]*explis[58-i])%p

print(ans)


  


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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    int a, b;
    cin >> a >> b;

    cout << (!(b%a)? a+b:b-a) <<"\n";

    return 0;
}

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

using namespace std;
typedef long long ll;

int N;
ll K;
ll a[200001];
ll sum[200001];
ll bit[200001];
vector<ll> num;

ll Sum (int i) {
  ll ans = 0;
  for(int s = i; s >= 0; s = (s & (s + 1)) -1)
    ans += bit[s];
  // cout << ans <<endl;
  return ans;
}

void Add(int i, ll x) {
  for(int s = i; s <= N; s |= (s + 1)) {
    bit[s] += x;
  }
}

int main() {
  cin >> N >> K;

  for(int i = 0; i < N; i++) {
    ll tmp;
    cin >> tmp;
    a[i] = tmp - K;
  }
  
  for(int i = 1; i <= N; i++) {
    sum[i] = sum[i-1] + a[i-1];
    num.push_back(sum[i]);
  }
  sort(num.begin(),num.end());

  num.resize(unique(num.begin(),num.end()) - num.begin());

  ll ans = 0;

  //for(int i = 0; i < num.size(); i++) cout <<num[i]<<endl;

  for(int i = 0; i <= N; i++) {
    int x = lower_bound(num.begin(),num.end(),sum[i]) - num.begin();
    ans += Sum(x);
    Add(x,1);
  }

  cout << ans <<endl;
}


Measured memory_bytes: 6640
import math
N,D=map(int,input().split())
a=[]
c=0
for i in range(1,N+1):
    g=list(map(int,input().split()))
    a.append(g)
for i in range(N):
    for k in range(1,N-i):
        dis=0
        for j in range(D):
            z=a[i][j]-a[i+k][j]
            dis=dis+z*z
        dis=math.sqrt(dis)
        b=int(dis)-dis
        if b==0:
            c=c+1
print(c)

Measured memory_bytes: 3064
#include <fstream>
#include <iostream>
#include <string>

using namespace std;

int N, M, solst, soldr;
string s;
struct spell {
    char c, d;
} a[200005];

bool Check(int poz, bool dir) {
    int i;
    for (i = 1; i <= M; i++) {
        if (a[i].c == s[poz]) {
            if (a[i].d == 'R')poz++;
            else poz--;
        }
        if (poz < 0 && dir == 0) return true;
        else if (poz >= N && dir == 0) return false;
        if (poz >= N && dir == 1)return true;
        else if (poz < 0 && dir == 1)return false;
    }
    return false;
}

void CautBin(int st, int dr, bool dir) {
    int mid = (st + dr) / 2;
    if (st == dr && dir == 0 && Check(mid, dir) == 1)solst = mid;
    else if (st == dr && dir == 0 && Check(mid, dir) == 0) solst = -1;
    else if (st == dr && dir == 1 && Check(mid, dir) == 1) soldr = mid;
    else if (st == dr && dir == 1 && Check(mid, dir) == 0) soldr = N;

    else {
        if (dir == 0 && Check(mid + 1, dir) == 0)CautBin(st, mid, dir);
        else if (dir == 0)CautBin(mid + 1, dr, dir);
        if (dir == 1 && Check(mid, dir) == 0)CautBin(mid+1, dr, dir);
        else if (dir == 1)CautBin(st, mid, dir);
    }
}


int main() {
    int i;
    cin >> N >> M;
    cin >> s;
    for (i = 1; i <= M; i++) {
        cin >> a[i].c >> a[i].d;
    }
    CautBin(0, N - 1, false);
    CautBin(0, N - 1, true);
    cout << soldr - solst - 1;
    return 0;
}

Measured memory_bytes: 900
/*
Author: Racer5x
 ***************************************   UNAUTHORISED COPYING OF CODE PROHIBITED   **********************************
*/
 
// #pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include<bits/stdc++.h>
#define int         long long
#define double      long double
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define hell        998244353 
#define PI          3.141592653589
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MAX         2000000000000000000
#define M           1000000007
using namespace std;
 
signed main()
{
    tezz
    
    int n, m;
    cin>>n>>m;

    cout<<(n-1) * (m-1);
} 

Measured memory_bytes: 256
import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
INF = float('inf')


class UnionFind:
    def __init__(self, N):
        self.tree = list(range(N))

    def root(self, N):
        if self.tree[N] == N:
            return N
        else:
            self.tree[N] = self.root(self.tree[N])
            return self.tree[N]

    def same(self, x, y):
        return self.root(self.tree[x]) == self.root(self.tree[y])

    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        else:
            self.tree[x] = y


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    uf = UnionFind(N)
    ret = 0
    cost = []
    for i in range(N):
        D = il()
        for j in range(N):
            if D[j] != -1:
                cost.append((D[j], i, j))
    else:
        cost.sort()
        for c, v1, v2 in cost:
            if not uf.same(v1, v2):
                ret += c
                uf.unite(v1, v2)
        print(ret)


if __name__ == '__main__':
    main()



Measured memory_bytes: 7924
#include <cstdio>
#include <cmath>
#include <limits>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;
using ll = long long;
const int inf = 1000000000; //10^9
const  double PI = 3.1415926535897932;

int main(){
    ll N,M,ans=0;
    cin >> N >> M;
    for(int i=0;i<M;i++){
        int a;
        cin >> a;
        ans += a;
    }

    if(ans>N) {
        cout << -1 << endl;
        return 0;
    }
    else{
        ans = N-ans;
        cout << ans << endl;
        return 0;
    }
}

Measured memory_bytes: 3636
n = gets.chomp.to_i
if n == 1
  puts 'a'
  exit
end
ans = []
alf = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
ans.push('a')
(n-1).times do
  next_ans = []
  ans.each do |a|
    ne = a.split('').sort.last.succ
    alf.each do |al|
      if ne >= al
        next_ans.push(a + al)
      end
    end
  end
  ans = next_ans
end
ans.sort!
ans.each do |an|
  puts an
end


Measured memory_bytes: 20528
use proconio::{fastout, input};
// use proconio::marker::*;

const MOD: u64 = 998244353;

#[fastout]
fn main() {
   input! {
      n: usize,
      s: usize,
      a: [usize; n]
   }
   let mut dp = vec![0; s + 1];
   dp[0] = 1;
   for &a in a.iter() {
      for i in (0..=s).rev() {
         dp[i] *= 2;
         if i >= a {
            dp[i] += dp[i - a];
         }
         dp[i] %= MOD;
      }
   }
   println!("{}", dp[s]);
}


Measured memory_bytes: 2224
#include <bits/stdc++.h>
#include <complex>
#include <queue>
#include <set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 998244353;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF LLONG_MAX

void solve(){
	string s;
	cin >> s;
	ll ans = 15;
	forn(i,(ll)s.size()) if(s[i]=='x') ans--;
	if(ans>7) cout << "YES" << ln;
	else cout << "NO" << ln;
}


int main()
{
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
    // cin >> t;
    forn(i,t) solve();
    return 0;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    k, n = map(int, rl().split())
    a = list(map(int, rl().split()))
    d = 0
    for i in range(1, n):
        d = max(d, a[i] - a[i - 1])
    d = max(d, k - a[n - 1] + a[0])
    print(k - d)

    
if __name__ == '__main__':
    solve()


Measured memory_bytes: 26060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
constexpr int INF = 2e9;
int main() {
  int n, q;
  string s;
  cin >> n >> s >> q;
  while (q--) {
    int k;
    cin >> k;
    ll a = 0, b = 0, c = 0;
    ll res = 0;
    for (int i = 0; i < n; i++) {
      if (i >= k) {
        if (s[i - k] == 'D') a--, c -= b;
        if (s[i - k] == 'M') b--;
      }
      if (s[i] == 'D') a++;
      if (s[i] == 'M') b++, c += a;
      if (s[i] == 'C') res += c;
    }
    cout << res << endl;
  }
  return 0; 
} 

Measured memory_bytes: 1412
#include <iostream>
#include <queue>
#include <vector>
#include <utility>
using namespace std;
typedef pair<int,int> Info;
int main(){
        int N;
        cin >> N;
        vector <vector<int> > adjancey(N,vector<int>(N));
        priority_queue<Info, vector<Info>,greater<Info> > descending;
        for(int i=0 ; i<N ; i++ )
                for(int j=0 ; j<N ; j++ )
                        cin >> adjancey[i][j];
        Info wn;
        int now=0,counter=0;
        vector <bool> past(N,false);
        while(true){
                past[now]=true;
                for(int i=0 ; i<N ; i++ ){
                        if(past[i])
                                continue;
                        if(adjancey[now][i]==-1)
                                continue;
                        wn.first=adjancey[now][i];
                        wn.second=i;
                        descending.push(wn);
                }
                int c=0;
                for(int i=0;i<N;i++)
                        c+=past[i];
                if(c==N)break;
                wn=descending.top();descending.pop();
                now=wn.second;
                if(past[now])continue;
                counter+=wn.first;
        }
        cout << counter << endl;
        return 0;
}



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

int main(){
  int N, max = 0, maxn = 1;
  cin >> N;
  
  for (int i = 1; i <= N; i++){
    int n = i, count = 0;
    while(n%2 == 0){
      count++;
      n /= 2;
    }
    if(max < count){
      max = count;
      maxn = i;
    }
  }
  
  cout << maxn << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
  string str1, str2;
  int i = 0;
  
  cin >> str1;
  if (str1 ==  "END_OF_TEXT")
    {
	  return 0;
    }
  transform(str1.begin(), str1.end(), str1.begin(), ::tolower);
  
  cin >> str2;
  
  while ( str2 != "END_OF_TEXT")
    {
      transform(str2.begin(), str2.end(), str2.begin(), ::tolower);

      if (str1 == str2)
	{
	  i++;
	}
      
      cin >> str2;
    }
  
  cout << i << endl;
   
  return 0;
  
}

Measured memory_bytes: 3112
#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Bytes, Chars, Isize1, Usize1},
};

#[allow(unused_macros)]
macro_rules! echo {
    ($($e:expr),+) => ( { $(println!("{}", $e))+ } );
}

fn main() {
    input! {
        k: usize,
        s: String,
    }

    if s.len() <= k {
        echo!(s);
    } else {
        let str = s[0..k].to_owned() + "...";
        echo!(str);
    }
}


Measured memory_bytes: 2124