akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>

#include <stdlib.h>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
	string s[25565] = {""};
	int x[25565] = {0};
	int i = 0;
	int num;
	do{
		cin >> s[i];
		i++;
	}while(s[i-1] != "0");
	i = 0;
	do{
		for(int j = 0;j < s[i].size();j++){
			x[i] += (int)(s[i][j] - '0');
		}
		cout << x[i] << endl;
		i++;
	}while(s[i] != "0");
}

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

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::io::{stdout, stdin, BufWriter, Write};

fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }

    input!{
      n: usize,
      k: usize,
      aa: [i64; n],
    }

    let mut acm = vec![0; n+1];
    let mut acm2 = vec![0; n+1];

    for i in 0..n {
        acm[i+1] = acm[i] + aa[i];
        acm2[i+1] = acm2[i] + max(aa[i], 0);
    }
    let mut ans = 0;
    for l in 0..n {
        if l + k <= n {
            let r = l + k;
            let a1 = max(acm[r] - acm[l], 0);
            let a2 = acm2[l] + acm2[n] - acm2[r];
            ans = max(ans, a1+a2);
            // debug!(a1, a2, l, r, a1+a2);
        }
    }
    puts!("{}\n", ans);
}


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

public class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int n = sc.nextInt();
        long[] h = new long[n];
        for(int i=0; i<n; i++){
            h[i] = sc.nextLong();
        }

        int max = 0;
        int mlong = 0;
        for(int i=1; i<n; i++){
            if(h[i] <= h[i-1]){
                mlong++;
            }else{
                mlong = 0;
            }
            if(mlong > max) max = mlong;
        }

        System.out.println(max);
    }

    private static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            }else{
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }else if(b == -1 || !isPrintableChar(b)){
                    return minus ? -n : n;
                }else{
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
    }
}


Measured memory_bytes: 22088
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

long long a,b,c;

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

cin >> a >> b >> c;

long long d = a+b+c;

if (d >= 22)
	cout << "bust";
else
	cout << "win";





return 0;
}



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

int main() {
  
  int a, b;
  
  cin >> a >> b;
  
  if (a%2 == 0 || b%2 == 0) {
    cout << "Even" << endl;
  }
  
  else {
    cout << "Odd" << endl;
  }
}

Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#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;
typedef long long ll;
typedef pair<int, int> Pint;
typedef pair<ll, ll> Pll;
#define rep(begin, i, end) for (ll i = begin; i < (ll)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 998244353;

int main()
{
    ll N;
    cin >> N;
    map<ll, ll> mp;

    ll a;
    rep(0, i, N)
    {
        cin >> a;
        mp[a]++;
    }

    ll ans = 0;
    for (auto m : mp)
    {
        if (m.first <= m.second)
        {
            ans += m.second - m.first;
        }
        else
        {
            ans += m.second;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 9536
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define endl "\n"
ll n, w;
ll dp[110][100000 + 5];
vector<pair<ll, ll>> Data;
ll knapsack(ll W, ll n)
{

    ll i, w;
    ll K[n + 1][W + 1];

    // Build table K[][] in bottom up manner
    for (i = 0; i <= n; i++)
    {
        for (w = 0; w <= W; w++)
        {
            if (i == 0 || w == 0)
                K[i][w] = 0;
            else if (Data[i - 1].first <= w)
                K[i][w] = max(Data[i - 1].second + K[i - 1][w - Data[i - 1].first], K[i - 1][w]);
            else
                K[i][w] = K[i - 1][w];
        }
    }

    return K[n][W];
}
void solve()
{
    ll t1, t2;
    cin >> n >> w;
    for (ll i = 0; i < n; i++)
    {
        cin >> t1 >> t2;
        Data.push_back({t1, t2});
    }
    cout << knapsack(w, n) << endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll T = 1;
    while (T--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 82344
N, K = map(int, input().split())
A = list(map(int, input().split()))

P = "POSSIBLE"
IP = "IMPOSSIBLE"

M = max(A)

def gcd(a, b):
    if a == 0:
        return b
    else:
        return gcd(b%a, a)

t = gcd(A[0], A[0])
if N > 1:
    for a in A[1:]:
        t = gcd(t, a)

if K%t == 0 and K <= M:
    print(P)
else:
    print(IP)

Measured memory_bytes: 19800
import numpy as np
# in your code
def p(*args, **kargs):
    if DBG:print(*args, **kargs)
read = input 
rn = lambda :list(map(int, read().split()))
debug = False
def sol(A):
    A = np.array(A, np.int64)
    A = np.sort(A)
    _A = np.sort(-A)

    pos = A[A>0]
    neg = A[A<0]
    zero = A[A==0]
    def searchsorted(*args, **kargs):
        ret = np.searchsorted(*args, **kargs)

#         print(args, kargs)
#         print(ret)
        return ret

    # python 保证余数>0，即，整除，向无穷小round。
    # <= x，pairs that <= x
    def  f(x):
        ret = 0
        if x >= 0:
            ret += len(zero) * len(A)
            ret += searchsorted(A, x//pos, side="right").sum()
            ret += searchsorted(_A, x//(-neg), side="right").sum()
        else :
            ret += searchsorted(A, x//pos,  side="right").sum()
            ret += searchsorted(_A, x//(-neg),  side="right").sum()

        ret -= np.count_nonzero(A*A<=x)
        assert ret % 2 == 0
        return ret // 2
        if debug: print(pos, neg, zero)
    return f

f = sol([-4, -2, 3, 3 ])
assert f(-12) == 2
assert f(-6) == 4 # or 3
# 二分搜索
def bs(A, index):
    A = np.array(A, np.int64)
    f = sol(A)
    max_ele = max(abs(A))

    right = max_ele * max_ele + 1
    left  = - right
    while left + 1 < right:
        middle = (left + right)//2
        m_index = f(middle)
        if debug : print(middle, m_index, left, right, sep="\t")
        if index <= m_index:
            right = middle
        else :
            left = middle
    return right

n,index = rn()
A = np.array(read().split(), np.int64)
print(bs(A, index))


Measured memory_bytes: 34560
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 6)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

n = k()
x = l()
a = sum(x)//n
b = sum(x)//n + 1

for i in x:
  ans += pow(i-a,2)
  cnt += pow(i-b, 2)

print(min(ans,cnt))

Measured memory_bytes: 10516
program main;
var 
	n : longint;
begin
	readln(n);
	writeln(((1 + n) * n div 2) - (((3 * (n div 3)) + 3) * (n div 3) div 2) -(((5 * (n div 5)) + 5) * (n div 5) div 2) + (((15 * (n div 15)) + 15) * (n div 15) div 2));
end.

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

int main(void){
    string s, t;
    cin >> s >> t;
    s = s+s;
    
    string ans = "No";
    int lens = s.length();
    int lent = t.length();
    bool flag = false;
    rep(i, lens/2){
        rep(j, lent){
            if(t.at(j) != s.at(i+j)){
                flag = true;
            }
        }
        if(!flag){
            ans = "Yes";
            break;
        }
        flag = false;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

/* 2とNで割り切れる数 */
int main(){
	int n;
	scanf("%d",&n);

	/* nが2で割り切れない */
	if(n%2 !=0)
		printf("%d\n",2*n);
	else
		printf("%d\n",n);

	return 0;
}


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

using namespace std;

int main()
{
    //freopen("i.txt","r",stdin);
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;

    vector<int> adj[n];
    for(int i = 0;i < n-1;i++){
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }

    int vis[n];
    queue<int> bfs;
    fill(vis,vis+n,-1);
    vis[0] = 0;
    bfs.push(0);
    while(!bfs.empty()){
        int u = bfs.front();

        bfs.pop();
        for(int j = 0;j < adj[u].size();j++){
            int v = adj[u][j];
            if(vis[v] == -1){
                vis[v] = vis[u] + 1;
                bfs.push(v);
            }
        }
    }
    //return 0;
    int maxV = 0;
    int nxtU = 0;
    for(int i = 0;i < n;i++){
        if(maxV < vis[i]){
            nxtU = i;
            maxV = vis[i];
        }
    }



    fill(vis,vis+n,-1);
    vis[nxtU] = 0;
    bfs.push(nxtU);
    while(!bfs.empty()){
        int u = bfs.front();
        bfs.pop();
        for(int j = 0;j < adj[u].size();j++){
            int v = adj[u][j];
            if(vis[v] == -1){
                vis[v] = vis[u] + 1;
                bfs.push(v);
            }
        }
    }

    maxV = 0;
    nxtU = 0;
    for(int i = 0;i < n;i++){
        if(maxV < vis[i]){
            maxV = vis[i];
        }
    }

    if(maxV % 3 == 1) cout << "Second\n";
    else cout << "First\n";


    return 0;
}


Measured memory_bytes: 13556
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define cs ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using namespace std;
int main(){
    cs;
    int x,t=0,k=10;
    rep(i,5){
        cin>>x;t+=x;
        x%=10;
        if(x) t+=10-x;
        if(x<k&&x) k=x;
    }
    if(k<10) t-=(10-k);
    cout<<t;
}

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

#define ll     long long
#define fr     first
#define sec    second
#define rep(i,n)  for(i=0;i<n;i++)
#define vi     vector <int>
#define vc     vector <char>
#define vl     vector <ll>
#define vb     vector <bool>
#define pb     push_back
#define M      1000000007
#define ios    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define open   freopen("input.txt","r",stdin);
#define close  freopen("output.txt","w",stdout);
#define M_PI   3.14159265358979323846
#define pp     pair<int,int>
#define nn 100003

int main()
{
    ios;
    ll n,i;
    string res="";
    cin>>n;
    map <int,char> mp;
    for(i=1;i<=26;i++)  
        mp[i]='a'+i-1;
    while(n>0)
    {
        n-=1;
        ll r=n%26;
        res=(char)('a'+r)+res;
        n/=26;
    }
    cout<<res;
    return 0;
}


Measured memory_bytes: 3640
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int n,i,b,mc = 0;long long minus = 0;cin >> n;
  int a[n];
  for(i=0;i<n;i++) cin >> a[i];
  vector<int> plus;
  for(i=0;i<n;i++){
    cin >> b;
    if(a[i]-b>0) plus.push_back(a[i]-b);
    else if(a[i]-b<0){
      minus += a[i]-b;mc++;
    }
  }
  sort(plus.begin(),plus.end(),greater<int>());
  if(mc==0) cout << 0 << endl;
  else{
    for(i=0;i<plus.size();i++){
      minus += plus[i];
      if(minus>=0){
        cout << i+mc+1 << endl;break;
      }
    }
  }
  if(minus<0) cout << -1 << endl;
}
  


Measured memory_bytes: 1024
int main(int argc ,const char *argv[])
{
    int n,a,min,max;
    long long int sum;
    scanf("%d",&n);
    if(0<n&&n<=10000){
        scanf("%d",&a);
        max=a,min=a,sum=a;
        for(int i=1;i<n;i++){
            scanf("%d",&a);
            if(-1000000<=a&&a<=1000000){
                sum+=a;
                if(a>max){
                    max=a;
                }
                if(a<min){
                    min=a;
                }
            }
        }
        printf("%d %d %ld\n",min,max,sum);
    }
}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
#define mp make_pair
using namespace std;
using ll=long long;
using P=pair<int,int>;
const ll INF=1LL<<30;
const ll LINF=1LL<<61;
const double eps=1e-5;
const ll MOD=1e9+7;
ll dp[100010][3];
ll a[100010][3];
int main(){
    int n;cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i][0]>>a[i][1]>>a[i][2];
    for(int i=0;i<=n;i++)for(int j=0;j<3;j++)dp[i][j]=-LINF;
    dp[0][0]=0,dp[0][1]=0,dp[0][2]=0;
    for(int i=1;i<=n;i++){
        for(int j=0;j<3;j++){
            for(int k=0;k<3;k++){
                if(j==k)continue;
                dp[i][j]=max(dp[i][j],dp[i-1][k]+a[i][j]);
            }
        }
    }
    cout<<max(dp[n][0],max(dp[n][1],dp[n][2]))<<endl;
}   


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

int n, s, ans, dp[1<<8][15];

void rec(int base, int sum, int used) {
    if(sum == s) {
        if(used == n) ans += 1;
    }
    if(sum > s || used > n) return;
    for(int i = base; i < 10; i++) {
        rec(i + 1, sum + i, used + 1);
    }
}

int main(void) {
    while(scanf("%d%d", &n, &s) == 2 && !(n + s == 0)) {
        ans = 0;
        memset(dp, 0, sizeof(dp));
        rec(0, 0, 0);
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 1048
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ss second
#define ff first
#define pb push_back

int main(){
    ios_base::sync_with_stdio(0);
    int n;
    int x[1000];
    cin>>n;
    for(int i=0;i<n;i++)cin>>x[i];
    ll ans=1e9;
    for(int i=1;i<=100;i++){
        ll sum=0;
        for(int j=0;j<n;j++){
            sum+=pow(x[j]-i,2);
        }
        ans=min(ans,sum);
    }cout<<ans;
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int,ll>pa;

const int N=2e5+100;
const int mod=1e9+7;
vector<pa>ve[N];
int n;
ll vis[N];
queue<pa>q;
void bfs(int k)
{
    memset(vis,-1,sizeof vis);
    vis[k]=0;
    q.push(make_pair(k,0));
    while(q.size()){
        pa kk=q.front();q.pop();
        for(auto v:ve[kk.first]){
            if(vis[v.first]==-1){
                q.push(v);
                vis[v.first]=vis[kk.first]+v.second;
            }
        }
    }
}
int main()
{
   ios::sync_with_stdio(0);cin.tie(0);
   cin>>n;
   for(int i=1;i<n;i++){
    int a,b,c;
    cin>>a>>b>>c;
    ve[a].push_back(make_pair(b,c));
    ve[b].push_back(make_pair(a,c));
   }
   int qq,k;
   cin>>qq>>k;
   bfs(k);
   while(qq--){
     int x,y;
     cin>>x>>y;
     cout<<vis[x]+vis[y]<<endl;
   }
   return 0;
}



Measured memory_bytes: 15840
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

Asum = [0]
Bsum = [0]
atemp = 0
btemp = 0
for i in range(N):
    atemp += A[i]
    Asum.append(atemp)
for i in range(M):
    btemp += B[i]
    Bsum.append(btemp)

ans = 0
j = M
for i in range(N+1):
    if Asum[i] > K:
        break
    while Asum[i] + Bsum[j] > K:
        j -= 1
    ans = max(ans, i+j)

print(ans)

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

int main() {
	// your code goes here
	int n,m;
	cin>>n>>m;
	if(m==0)
	{
	    if(n==1)
	    {
	        cout<<"0";
	        return 0;
	    }
	}
	int a[m][2];
	for(int i=0;i<m;i++)
	{
	    cin>>a[i][0]>>a[i][1];
	    if(n>1 && a[i][0]==1 && a[i][1]==0)
	    {
	        cout<<"-1";
	        return 0;
	    }
	    for(int j=0;j<i;j++)
	    {
	        if(a[i][0]==a[j][0] && a[i][1]!=a[j][1])
	        {
	            cout<<"-1";
	            return 0;
	        }
	    }
	}
	for(int i=0;i<n;i++)
	{
	    int j;
	    for(j=0;j<m;j++)
	    {
	        if(a[j][0]==i+1)
	        {
	            cout<<a[j][1];
	            break;
	        }
	    }
	    if(j==m)
	    {
	        if(i==0)
	        cout<<"1";
	        else
	        cout<<"0";
	    }
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
// #define endl "\n"
#define TARO true
#define LIRO false

ll recurse(bool who, ll i, ll j, vector<ll>& arr, vector<vector<vector<ll>>>& dp) {
    if (i == j) {
        return (who ? arr[i]: -arr[i]);
    }

    if (dp[who][i][j] != LLONG_MIN) {
        return dp[who][i][j];
    }

    if (who) {
        ll one = arr[i] + recurse(!who, i+1, j, arr, dp);
        ll two = arr[j] + recurse(!who, i, j-1, arr, dp);

        return dp[who][i][j] = max(one, two);
    } else {
        ll one = - arr[i] + recurse(!who, i + 1, j, arr, dp);
        ll two = - arr[j] + recurse(!who, i, j - 1, arr, dp);
        return dp[who][i][j] = min(one, two);
    }
}

int main(void) {
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    // cout.tie(NULL);
    ll n;
    cin >> n;
    vector<ll> arr (n);
    for (ll i = 0; i < n; i++) {
        cin >> arr[i];
    }
    vector<vector<vector<ll>>> dp (2, vector<vector<ll>> (n+1, vector<ll> (n+1, LLONG_MIN)));
    cout << recurse(TARO, 0, n-1, arr, dp) << endl;



    
    return 0;
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  cout << (a + b + c >= 22 ? "bust" : "win") << endl;
  return 0;
}

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

int main(){
	static int a[1000][1000];
	int y[1000],x[1000];
	int h,w;
	cin>>h>>w;
	memset(y,0,sizeof(y));
	memset(x,0,sizeof(x));
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>a[i][j];
			if(a[i][j]==0){
				y[i]++;
				x[j]++;
			}
			a[i][j]-=1;
		}
	}
	for(int i=0;i<h;i++){
		cout<<(a[i][0]+y[i]+x[0])%2;
		for(int j=1;j<w;j++){
			cout<<' '<<(a[i][j]+y[i]+x[j])%2;
		}
		cout<<endl;
	}
}

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

typedef long long ll;

int main () {
	ll n, a, b;
  	cin >> n >> a >> b;
  	ll rem = n % (a + b);
  	ll amari = min(rem, a);
  	cout << a * (n / (a + b)) + amari << endl;
}


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

int main(){
    int r;
    cin >> r;
    if (r < 1200){
        printf("ABC");
    }else if(1200 <= r and r <2800){
        printf("ARC");
    }else if(2800 <= r ){
        printf("AGC");
    }
return 0;
}

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

char A[51][51];
char B[51][51];
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N, M;
    cin >> N >> M;

    for(int i = 0; i < N; ++i){   
        for(int j = 0; j < N; ++j){
            cin >> A[i][j];
        }
    }
    for(int i = 0; i < M; ++i){   
        for(int j = 0; j < M; ++j){
            cin >> B[i][j];
        }
    }

    bool ans = false;
    for(int i = 0; i < N - M + 1; ++i){   
        for(int j = 0; j < N - M + 1; ++j){
            bool check = true;
            for(int k = 0; k < M; ++k){
                for(int l = 0; l < M; ++l){
                    if(B[k][l] != A[i + k][j + l]){
                        check = false;
                        break;
                    }
                }
                if(!check) break;
            }
            if(check) ans = true;
        }
    }
    cout << (ans ? "Yes" : "No") << endl;

    return 0;
};

Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))

answer = -1
m = 0
for i in range(n - 1):
    if h[i] >= h[i + 1]:
        m += 1
    else:
        answer = max(answer, m)
        m = 0
answer = max(answer, m)
print(answer)


Measured memory_bytes: 14252
#include <stdio.h>
#include <string.h>
int main(void)
{
  int n,i,x,A[6];
  char s[7];
  
  scanf("%d",&n);
  
  for(i=1;i<=n;i++){
    snprintf(s,7,"%d",i);
   if(strlen(s)%2==1) x++;
  }
  printf("%d",x);
  return 0;
}

Measured memory_bytes: 128
/*
  author: ruruvuvu
  GitHub account: colon-ku

  created at: 2020-01-03 18:12:18
*/

#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

ostringstream oss_global;
string s_global = oss_global.str();

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

    int ans = pow(k/2, 2);
    if (k % 2) ans += k/2;

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


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

ll N, A[200000];

bool check() {
  REP(i, 0, N - 1) if (A[i] >= A[i + 1]) return false;
  return true;
}

bool ok(ll x) {
  map<ll, ll> mp;
  ll k = A[0];

  REP(i, 1, N) {
    if (A[i] <= k) {
      mp.erase(mp.lower_bound(A[i]), mp.end());
      for (ll j = A[i] - 1;; j--) {
        mp[j]++;
        if (mp[j] < x) break;
        mp[j] = 0;
        if (j == 0) return false;
      }
    }
    k = A[i];
  }

  return true;
}

int main(void) {
  cin >> N;
  REP(i, 0, N) cin >> A[i];

  if (check()) {
    cout << 1 << endl;
    return 0;
  }

  ll l = 1, h = N;
  while (h - l > 1) {
    ll m = (l + h) / 2;
    if (ok(m)) h = m;
    else l = m;
  }
  cout << h << endl;
}

Measured memory_bytes: 1792
fun main(args: Array<String>) {
    val sc = java.util.Scanner(System.`in`)
    val a = sc.nextLong()
    val b = sc.nextLong()

    if ((a + b) % 2L == 0L) {
        println((a + b) / 2L)
    } else {
        println("IMPOSSIBLE")
    }
}


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

int main() {
  int N, D, X;
  cin >> N >> D >> X;
  int sum = 0; 
  for (int i = 0; i <= N-1; i++) {
   int Ai; 
   cin >> Ai; 
   int n = (D + Ai-1) / Ai;
   sum += n; 
  }
  cout << X + sum << endl;
}

Measured memory_bytes: 256
A,B = gets.split("\s").map {|s|s.to_i}
S = gets.chomp
s_list = S.split("-")
if s_list.size != 2 then
  puts "No"
else
  #p s_list
  if s_list[0].size==A && s_list[1].size==B then
    puts "Yes"
  else
    puts "No"
  end
end


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

using namespace std;
using namespace __gnu_pbds;

#define u(x, a, b) for(ll x = a; x < b; x++)
#define d(x, a, b) for(ll x = a; x > b; x--)

typedef long long ll;
typedef long double ld;

#define MAXI 100010
#define MOD 1000000007

vector<ll> primes;

int main(){
	ll a, b;
	cin >> a >> b;
	
	primes.push_back(2);
	u(one, 3, 1000020){
		bool div = false;
		u(two, 0, primes.size()){
			if(primes[two]*primes[two] > one){two = primes.size();}
			else if(one%primes[two]==0){div = true; two = primes.size();}
		}
		
		if(!div){primes.push_back(one);}
	}
	
	if(a<b){swap(a,b);}
	while(b>0){
		ll c = b;
		b = a%b;
		a = c;
	}
	
	ll ans = 1;
	
	u(one, 0, primes.size()){
		if(a%primes[one]==0){ans++;}
		while(a%primes[one]==0){a/=primes[one];}
	}
	
	if(a!=1){ans++;}
	
	cout << ans;
	
}


Measured memory_bytes: 4292
# Ordinary Number

# libraries
import numpy as np

# input
n = int(input())
p = list(map(int, input().split()))

# solve
res = 0
for i in range(1, n-1):
    s = [p[i-1], p[i], p[i+1]]
    if min(s) < s[1] and s[1] < max(s):
        res += 1

# output
print(res)

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

int main(){

  int A,B;
  char S[10];

  cin >> A >> B;
  cin >> S;

  for(int i = 0; i < A; i++){
    if(S[i] == '-'){
      cout << "No" << endl;
      return 0;
    }
  }
  if(S[A] != '-'){
    cout << "No" << endl;
    return 0;
  }
  for(int j = A+1; j < A+B; j++){
    if(S[j] == '-'){
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = 0
for i in range(n):
    ans += min(a[i],b[i]) + min(a[i+1],max(b[i]-a[i],0))
    a[i+1] = max(a[i+1]-max(b[i]-a[i],0),0)
print(ans)

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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int l, r, d;
  cin >> l >> r >> d;
  int cnt = 0;
  for (int i = l; i <= r; i++) {
    cnt += i % d == 0;
  }
  cout << cnt << '\n';
}


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

int main()
{
    int h, w;
    cin >> h >> w;
    string s[h];
    for (int i = 0; i < h; i++) cin >> s[i];

    string ans[h][w] = {};
    int sum = 0;
    
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (s[i][j] == '#') {
                ans[i][j] = "#";
                continue;
            }
            for (int k = i - 1; k <= i+1; k++) {
                for (int l = j - 1; l <= j+1; l++) {
                    if (k >= 0 && k <= h-1 && l >= 0 && l <= w-1) {
                        if (s[k][l] == '#') {
                            sum++;
                        }
                    }
                }
            }
            ans[i][j] = to_string(sum);
            sum = 0;
        }
    }

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cout << ans[i][j];
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll MOD = 1e9 + 7;
int main() {
	int N, P;
	cin >> N >> P;
	int a[N + 1];
	int n = 0, m = 0;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		if (a[i] % 2 == 1) m++;
		else n++;
	}
	ll x=pow(2,m-1);
  	ll y=pow(2,n);
  	ll ans=x*y;
  	if(m==0&&P==0){ans=y;}
  	cout<<ans<<endl;
}

Measured memory_bytes: 256
from collections import Counter

N = int(input())
c = Counter()
l = 0
for i in range(N):
    k = input()
    v = c.setdefault(k, 0)
    c[k] = v + 1
    if l < c[k]:
        l = c[k]
ans = sorted([k for k, n in c.items() if n==l])
[print(k) for k in ans]


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

int main(){
    ll x,k,d;
    cin >> x >> k >> d;
    if (x<0) x *= -1;
    ll pmin = x%d, nmin = pmin-d;
    ll step = (x-pmin)/d;
    ll ans;
    if(k<step) ans = x-k*d;
    else if((k-step)%2==0) ans = pmin;
    else ans = -nmin;
    cout << ans << endl;
}

Measured memory_bytes: 3596
import numpy as np
N,D=list(map(int,input().split()))
plot=np.array([list(map(int,input().split())) for _ in range(N)])
total=0
for i in range(N):
    for j in range(i+1,N):
        tmp=(plot[i]-plot[j])**2
        ans=np.sqrt(tmp.sum())
        if ans==int(ans):
            total+=1   
print(total)

Measured memory_bytes: 21676
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

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

const ll INF = 1LL<<60; //10進数だと1152921504606846976

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

  ll h[100010];
  rep(i, N){cin >> h[i];}
  ll cost[100010];
  rep(i, N){cost[i] = INF;}
  cost[0] = 0;


  for(int i = 1; i < N; i++){
    chmin(cost[i], cost[i-1] + abs(h[i]-h[i-1]));
    if(i > 1) chmin(cost[i], cost[i-2] + abs(h[i]-h[i-2]));
  }

  cout << cost[N-1] << endl;


  return 0;
}


Measured memory_bytes: 1792
#include <iostream> 
#include <vector> 
#include <algorithm> 
using namespace std; 
const long long mod=1e9+7;


int main() 
{ 
	int N,M;
	cin >> N >> M;
	
	vector<int> L(N+1, true);
    for(int i=0;i<M;i++){
    	int a;
        cin>>a;
        L[a]=false;
    }
    
   vector< long long int>dp(N+1);
   dp[0]=1;
   for(int now = 0; now<N; ++now){
   	for(int next = now+1; next<=min(N, now+2); ++next){
   		if(L[next]){
   			dp[next]+=dp[now];
   			dp[next]%=mod;
   		}
   	}
   }
   
  cout<<dp[N]<<endl;
}

Measured memory_bytes: 1408
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int x, y ,z;
bool check(int a, int b, int c) {
    if (max(a,b)!=x)return false;
    if (max(a,c)!=y)return false;
    if (max(b,c)!=z)return false;
    return true;
}
string s;
int main() {
    int t,n,a,b,c;

    while (cin>>s) {
        int num = 0;
        for (int i=0;i<s.size();i++)
        {
            num += s[i]-'0';
        }
        printf("%s\n",num%9?"No":"Yes");
    }
    return 0;
}


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


#define ll long long
#define ull unsigned ll
#define vi vector <int>
#define ii pair <int, int>
#define vii vector <ii>
#define vll vector <ll>
#define vull vector <ull>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define INF (int)1e9
#define EPS 1e-9
#define pb emplace_back
#define PI acos(-1.0)
#define endl "\n"
#define mp make_pair
#define DEBUG 0

int main ()

{
    fast;
    
    int n;
    cin >> n;
    
    int flag = 0;
    while (n > 0)
    {
        int digit = n%10;
        if (digit == 7)
        {
            flag = 1;
            break;
        }
        n /= 10;
    }
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;


    return 0;
}

Measured memory_bytes: 3652
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<vector>
#include<queue>
#include<cmath>
using namespace std;
int n,m,i,j,uu,o;
double ans;
bool b[10005];
struct zb
{
	int x,y;
}d[10005];
struct edge
{
	int u;
	double c;
	edge(int uu,double cc)
	{
		u=uu,c=cc;
	}
	bool operator<(const edge &a)const
	{
		return c < a.c;
	}
};
double jl(int a,int b)
{
	return sqrt((d[a].x-d[b].x)*(d[a].x-d[b].x)+(d[a].y-d[b].y)*(d[a].y-d[b].y));
}
vector<edge> e[10005];
priority_queue<edge> q;
int main()
{
	int x,y,a,b1;
	scanf("%d %d",&n,&m);
	for(i=1;i<=n;i++)
	{
		scanf("%d %d",&x,&y);
		d[i].x=x,d[i].y=y;
	}
	for(i=1;i<=m;i++)
	{
		scanf("%d %d",&a,&b1);
		ans=ans+jl(a,b1);
		e[a].push_back(edge(b1,jl(a,b1)));
		e[b1].push_back(edge(a,jl(a,b1)));
	}
	while(uu<n)
	{
		o=1;
		while(b[o]!=0)
			o++;
		b[o]=1;
		for(i=0;i<int(e[o].size());i++)
		q.push(e[o][i]);
		uu++;
		while(!q.empty())
		{
			edge k=q.top();
			q.pop();
			if(b[k.u]==1)continue;
			uu++;
			b[k.u]=1;
			ans=ans-k.c;
			for(i=0;i<int(e[k.u].size());i++)
			{
				q.push(e[k.u][i]);
			}
		}
	}
	printf("%.3f",ans);
}

Measured memory_bytes: 4812
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
//using namespace __gnu_pbds;
//typedef tree<
//        pair<long long, int>, // change type
//        null_type,
//        less<pair<long long, int> >, // change type
//        rb_tree_tag,
//        tree_order_statistics_node_update>
//        ordered_set;

//template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

typedef long long ll;
#define rep(i, start, end) for(int i = start; i < end; ++i)
#define sz(x) (int)(x).size()
#define pb push_back
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define clr(d, v) memset(d, v, sizeof(d))
#define pii pair<int, int>
#define debug(x) cerr << #x << " : " << (x) << endl
const double PI = 3.14159265358979323846;
const double eps = (1e-5);
int isGreater(long double x, long double y)
{
    if (abs(x - y) < eps)
        return 0;
    if (x > y)
        return 1;
    return -1;
}

const int MAX_N = 1e5 + 5;
int d[MAX_N], cnt[MAX_N];
const int MOD = 998244353;

long long mult(long long x, long long y){
    return (x * y)%MOD;
}

long long power(long long base, int exp){
    if (base == 0 && exp == 0)
        return 1;

    long long ret = 1;
    for (; exp; exp >>= 1){
        if (exp&1)
            ret = mult(ret, base);
        base = mult(base, base);
    }
    return ret;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  
    int n;
    cin >> n;
    rep(i,0,n)
    {
        cin >> d[i];
        cnt[d[i]]++;
    }

    long long ans = (cnt[0] == 1);
    if (ans)
    {
        for (int i = 1; i < n; ++i)
            ans = mult(ans, cnt[d[i] - 1]);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 1024
using System;

class Atcoder54
{
    public static void Main()
    {
        string[] input = Console.ReadLine().Split(' ');
        int a = int.Parse(input[0]);
        int b = int.Parse(input[1]);
        int c = int.Parse(input[2]);

        int ab = a + b;
        int bc = b + c;
        int ca = c + a;

        if (ab <= bc && ab <= ca)
            Console.WriteLine(ab);
        else if (bc <= ab && bc <= ca)
            Console.WriteLine(bc);
        else
            Console.WriteLine(ca);
    }
}

Measured memory_bytes: 13140
n = int(input())
ans = [0] * 4

for i in range(n):
    judge = input()
    if judge == "AC":
        ans[0] += 1
    elif judge == "WA":
        ans[1] += 1
    elif judge == "TLE":
        ans[2] += 1
    else:
        ans[3] += 1

print("AC x " + str(ans[0]))
print("WA x " + str(ans[1]))
print("TLE x " + str(ans[2]))
print("RE x " + str(ans[3]))

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

int n,m,x,y,tmp,mx = -0x3f3f3f3f,mn = 0x3f3f3f3f;
int main(){
	cin>>n>>m>>x>>y;

	for(int i=0;i<n;i++){
		cin>>tmp;
		mx = max(mx,tmp);
	}

	for(int i=0;i<m;i++){
		cin>>tmp;
		mn = min(mn,tmp);
	}

	if(mx<mn&&mx<y&&mn>x){
		cout<<"No War"<<endl;
	} else {
		cout<<"War"<<endl;
	}
}

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

int main() {
    ll A, B, K;
    cin >> A >> B >> K;
    if(A > K){
        cout << A - K << " ";
        cout << B << "\n";
        return 0;
    }
    cout << 0 << " ";
    K -= A;
    if(B > K){
        cout << B - K << " ";
        return 0;
    }
    cout << 0 << "\n";
    return 0;
}

Measured memory_bytes: 256
#pragma region template
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define all(a) (a).begin(),(a).end()
#define rep(i,n) for(ll i=0,i##_len=(n);i<i##_len;i++)
#define rep2(i,a,b) for(ll i=(a),i##_len=(b);i<=i##_len;i++)
#define rrep(i,n) ll i=(n);ll now=-1;while(i--&&(now++||1))
#define Yes(n) cout<<((n)?Yes:No)
#define pb push_back
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vbl = vector<bool>;
using vint = vector<int>;
using vstr = vector<string>;
static inline void ignore_ret(int x) {x++;}
template<class T> inline bool chmax(T&a,const T&b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T&a,const T&b){if(a>b){a=b;return true;}return false;}
template<class T> inline T gcd_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=gcd(r,v.at(i));return r;}
template<class T> inline T lcm_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=lcm(r,v.at(i));return r;}
template<class T> inline T factorial(T n){if(n==0)return 1;T r=1;for(T i=2;i<=n;i++)r*=i;return r;}
template<class T> inline T nCr(T n,T k){if(n<k||n<0||k<0)return 0;T r=1;k=min(k,n-k);for(T i=n-k+1;i<=n;i++)r*=i;return r/factorial(k);}
template<class T> inline T dot_product(vector<T>u,vector<T>v){T r=0;for(T i=0;i<u.size();i++)r+=u.at(i)*v.at(i);return r;}
template<class T> inline T sum(vector<T>v){return reduce(all(v),0LL);}
#pragma endregion template

map<string, int> mp;

void solve(ll N, vector<string> S) {
  for (auto x: S) {
    mp[x]++;
  }
  cout << mp.size() << endl;
}

int main() {
  ll N;
  ignore_ret(scanf("%lld",&N));
  vector<string> S(N);
  for(int i = 0 ; i < N ; i++){
    cin >> S[i];
  }
  solve(N, move(S));
  return 0;
}


Measured memory_bytes: 25112
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a, b, c;
    cin >> a >> b >> c;
    int x=max(a, b);
    x=max(x,c);
    int k;
    cin >> k;
    int n=x;
    for(int i=1;i<=k;i++){
        x*=2;
    }
    if(n==a) cout << x+b+c << endl;
    else if(n==b) cout << a+x+c << endl;
    else cout << a+b+x<<endl;
    return 0;

}

Measured memory_bytes: 256
b = input()
_l = ["A", "T", "C", "G"]
max_l = 0
cur_l = 0
for s in b:
    if s in _l:
        cur_l += 1
    else:
        max_l = max(max_l, cur_l)
        cur_l = 0
        
max_l = max(max_l, cur_l)
print(max_l)

Measured memory_bytes: 3060
<?php
$input = STDIN;

$n = (int)trim(fgets($input));

$d = [];

for ($i = 0; $i < $n; $i++) {
    $line = trim(fgets($input));
    if ($line[0] == "i") {
        $d[substr($line, 7)] = true;
    } else {
        if (array_key_exists(substr($line, 5), $d)) {
            print "yes\n";
        } else {
            print "no\n";
        }
    }
}


Measured memory_bytes: 54652
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int A = sc.nextInt();
		
		int B = sc.nextInt();
		
		int AW = A - 1;
		int BW = B - 1;
		
		System.out.println(AW * BW);
		
	}
}


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

int main() {
    int N, M;
    cin >> N >> M;
    vector<bool> broken(N + 1);
    for (int i = 0; i < M; i++) {
        int a;
        cin >> a;
        broken[a] = true;
    }

    vector<int> dp(N + 1);
    dp[0] = 1;
    if (!broken[1]) dp[1] = 1;
    for (int i = 2; i <= N; i++) {
        if (!broken[i]) {
            dp[i] = dp[i - 1] + dp[i - 2];
            dp[i] %= 1000000007;
        }
    }
    cout << dp[N] << endl;
    return 0;
}

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

int main(){
  int n;
  double ave = 0,a = 0;


  cout << fixed << setprecision(12);
  
  while(true){
    cin >> n;

    if(n == 0) break;
    
    int *s = new int[n];

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

    ave = ave/n;

    double work;
    for(int i = 0; i<n; ++i){
      work = s[i]-ave;
      a += work * work;
    }

    a /= n;
    cout << sqrt(a) << endl;

    a = 0;
    ave = 0;
    delete[] s;
  }
    

  return 0;
}



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

int main() {
    string n; cin >> n;
    int count0 = 0;
    for (int i = 0; i < n.size(); i++) {
        if ((i % 2 == 0 && n[i] == '0') || (i % 2 == 1 && n[i] == '1')) {
            continue;
        } else {
            count0++;
        }
    }
    int count1= 0;
    for (int i = 0; i < n.size(); i++) {
        if ((i % 2 == 0 && n[i] == '1') || (i % 2 == 1 && n[i] == '0')) {
            continue;
        } else {
            count1++;
        }
    }
    cout << min(count0, count1) << endl;
    return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>
#include<bitset>
#include<cassert>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

string s, t;

int main() {
	cin >> s >> t;
	rep(i, sz(s)) {
		if (s[i] != t[i]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 3624
#include<iostream>

using namespace std;

int main(void){
  int d;
  cin >> d;
  if(d == 22) cout << "Christmas Eve Eve Eve" << endl;
  if(d == 23) cout << "Christmas Eve Eve" << endl;
  if(d == 24) cout << "Christmas Eve" << endl;
  if(d == 25) cout << "Christmas" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#define ll long long

using namespace std;

vector<vector<int>> adj;
vector<bool> vis;

void dfs(int u){
    vis[u]=true;
    for(auto v: adj[u])
        if(!vis[v])
            dfs(v);
}

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

    int n,m,u,v;
    cin>>n>>m;
    adj.resize(n);
    vis.resize(n);vis.assign(n,false);

    while(m--){
        cin>>u>>v;u--;v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    int cnt=0;

    for(int i=0;i<n;i++){
        if(!vis[i]){
            dfs(i);
            cnt++;
        }
    }
    cout<<cnt-1<<endl;

}


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

int main(int argc, const char * argv[]) {
    int N, M;
    cin >> N;
    cin >> M;
    
    int ans = 0;
    if (N == 0 && M < 2) {
        std::cout << ans;
        return 0;
    }
    if (N == 1 && M == 1) {
        std::cout << ans;
        return 0;
    }
    
    if (N >= 2) {
        ans += N * (N - 1) / 2;
    }
    if (M >= 2) {
        ans += M * (M - 1) / 2;
    }
        
    std::cout << ans;
    return 0;
}


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

int main()
{
    int p, q;

    while (~scanf("%d %d", &p, &q)){
        vector<int> r;
        int loop = -1;

        p %= q;
        r.push_back(p);
        while (loop == -1 && p){
            p *= 10;
            putchar('0' + p / q);
            p %= q;
            for (int i = 0; i < r.size(); i++){
                if (r[i] == p){
                    loop = i;
                    break;
                }
            }
            r.push_back(p);
        }
        puts("");

        if (!p) continue;
        for (int i = 0; i < r.size() - 1; i++){
            putchar(i < loop ? ' ' : '^');
        }
        puts("");
    }

    return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    int i, j, k;
    for(i = 0; i < n; i++){
        cin >> a.at(i);
    }
    sort(a.begin(), a.end());
    int ans = 0;
    cout << a.at(n/2) - a.at(n/2-1) << endl;
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define fo(i,l,r) for(int i=l;i<=r;i++)
#define of(i,l,r) for(int i=l;i>=r;i--)
#define fe(i,u) for(int i=head[u];i;i=e[i].next)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
inline void open(const char *s)
{
	#ifndef ONLINE_JUDGE
	char str[20];
	sprintf(str,"%s.in",s);
	freopen(str,"r",stdin);
//	sprintf(str,"%s.out",s);
//	freopen(str,"w",stdout);
	#endif
}
inline int rd()
{
	static int x,f;
	x=0;f=1;
	char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=-1;
	for(;ch>='0'&&ch<='9';ch=getchar())x=x*10+ch-'0';
	return f>0?x:-x;
}
const int N=410,mod=998244353;
int n,a[N],b[N],SA,SB;
int f[2][N][N],rfac[N];
int pw[N][N];

inline int pls(int a,int b){return a+b>=mod?a+b-mod:a+b;}
inline int upd(int&a,int b){return a=pls(a,b);}
inline int mns(int a,int b){return a<b?a-b+mod:a-b;}
inline int mul(int a,int b){return(ll)a*b%mod;}
inline int pwr(int x,int k){int res=1;for(;k;k>>=1,x=mul(x,x))if(k&1)res=mul(res,x);return res;}

int main()
{
	n=rd();
	fo(i,1,n){
		a[i]=rd(),b[i]=rd();
		SA+=a[i];SB+=b[i];
	}
	rfac[0]=rfac[1]=1;
	fo(i,2,400)rfac[i]=mns(0,mul(mod/i,rfac[mod%i]));
	fo(i,2,400)rfac[i]=mul(rfac[i-1],rfac[i]);
	fo(i,0,400)fo(j,0,401)pw[i][j]=pwr(i,j);
	int u=0,v=1;
	f[0][0][0]=mod-1;
	fo(i,1,n){
		fo(j,0,SA)fo(k,0,SB)if(f[u][j][k]){
			int tmp=f[u][j][k];
			upd(f[v][j][k],tmp);
			tmp=mns(0,tmp);
			fo(l,0,b[i]-1){
				int hh=mul(tmp,mul(pw[a[i]][l],rfac[l]));
				upd(f[v][j+a[i]][k+l],hh);
			}
		}
		swap(u,v);memset(f[v],0,sizeof f[v]);
	}
	int ans=0;
	fo(i,1,SA)fo(j,0,SB){
		int tmp=f[u][i][j];
//		if(tmp)cout<<i<<' '<<j<<' '<<tmp<<'\n';
		tmp=mul(tmp,pwr(i,mod-2));
		tmp=mul(tmp,SA);
		tmp=mul(tmp,pwr(rfac[j],mod-2));
		tmp=mul(tmp,pwr(pw[i][j],mod-2));
		upd(ans,tmp);
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 2304