akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

void printString(vector<string>& ans){
    ll h = ans.size(), w = ans[0].size();
    cout << h << " " << w << endl;
    rep(i, h) cout << ans[i] << endl;
}

int main(){
    Init();
    ll a, b; cin >> a >> b;
    string wb = string(100, '.');
    string bw = string(100, '#');
    vector<string> ans;
    for(ll i=1; i<100; i+=2){
        wb[i] = '#';
        bw[i] = '.';
    }

    a--; b--;
    ll bh = ((ll)ceil(b/50.0));
    ll wh = ((ll)ceil(a/50.0));

    // □■□■□■...□■
    // □□□□□□...□□　で白1個に対して黒50個おける。（20行あれば500個おける。）
    rep(i, bh){
        if(i == bh-1){
            if(b%50 != 0) ans.emplace_back(wb.substr(0, (b%50)*2+1) + string(100-((b%50)*2+1), '.'));
            else ans.emplace_back(wb);
        }
        else{
            ans.emplace_back(wb);
            ans.emplace_back(string(100, '.'));
        }
    }
    // □□□□□□...□□
    // ■■■■■■...■■　を境界に置く。
    ans.emplace_back(string(100, '.'));
    ans.emplace_back(string(100, '#'));

    // ■□■□■□...■□
    // ■■■■■■...■■　で黒1個に対して白50個おける。（20行あれば500個おける。）
    rep(i, wh){
        if(i == wh-1){
            if(a%50 != 0) ans.emplace_back(bw.substr(0, (a%50)*2+1) + string(100-((a%50)*2+1), '#'));
            else ans.emplace_back(bw);
        }
        else{
            ans.emplace_back(bw);
            ans.emplace_back(string(100, '#'));
        }
    }

    printString(ans);
}

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

bool solve(ll N, vll arr) {
	ll total = 0;
	F0R(i, N) total += arr[i];
	if (total % (N * (N + 1) / 2)) {
		return false;
	}

	total /= N * (N + 1) / 2;
	vll coeff (N);
	F0R(i, N) coeff[i] = total - (arr[(i+1)%N] - arr[i]);
	F0R(i, N) {
		if (coeff[i] % N || coeff[i] < 0) return false;
		coeff[i] /= N;
	}
	vll calc (N);
	F0R(i, N) calc[0] += coeff[i] * (N - i);
	FOR(i, 1, N) calc[i] = calc[i-1] + total - N * coeff[i-1];
	F0R(i, N) if (calc[i] != arr[i]) return false;
	
	return true;
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N; cin >> N;
	vll arr (N);
	F0R(i, N) cin >> arr[i];
	if (solve(N, arr)) print("YES");
	else print("NO");	
}

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

#define f(a, b) for(auto i = a;i < b;i++)
typedef long long int ll;

void solve()
{
	return ;
}

int main()
{
	ll n, sum = 0;
	cin >> n;
	
	vector < ll > vect; 
	ll freq[n + 1] = {0};

	f(0, n){
		ll a;	
		cin >> a;
		vect.push_back(a);
		freq[a]++; 
	}

	f(0, n + 1)
		sum += freq[i]*(-1 + freq[i])/2;

	f(0, n)
	{
		ll x = freq[vect[i]];
		cout << sum - (x - 1) << "\n";
	}
}


Measured memory_bytes: 5872
#include<bits/stdc++.h>
using namespace std;
void factorize(long long n,vector<long long> &ans) 
{ 
    int count = 0; 
    while (!(n % 2)) { 
        n >>= 1;
        count++; 
    } 
    if (count) 
      ans.push_back(count); 
    for (long long i = 3; i <= sqrt(n); i += 2) { 
        count = 0; 
        while (n % i == 0) { 
            count++; 
            n = n / i; 
        } 
        if (count) 
            ans.push_back(count);
    } 
    if (n > 2) 
       ans.push_back(1);
} 
int main(){
 long long N;
 cin>>N;
 vector<long long >V;
 factorize(N,V);
 int ans=0;
 if(N!=1){
 for(int i=0;i<V.size();i++){
 	int cnt=1;
 	int j=1;
 	while(cnt<=V[i]){
 			j++;
 		cnt=cnt+j;
 		ans++;
	 }
 }}
 cout<<ans<<"\n";
}

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

int main() {
  int N, W;
  cin >> N;
  vector<int> weights(N);
  
  for (int i = 0; i < N; i++){
    cin >> W;
    weights.at(i) = W;
  }
  
  int d = 0;
  for (int t = 0; t < N; t++){
    int left = 0;
    int right = 0;
    for (int j = 0; j < t; j++){
      left += weights.at(j); 
    }
    for (int j = t; j < N; j++){
      right += weights.at(j); 
    }
    
    if (right - left < 0) {
      if (d <= left - right)
        break;
      else
        d = left - right;
        break;
    }

    d = right - left;
  }
  
  cout << d << endl;

}

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

int main() {
int n,w;
cin>>n>>w;
long long int arr[n][2]={0};
vector< pair <int,int> > vect;
long long int dp[n][w]={0},i,j;

for(i=0;i<n;i++)
for(j=0;j<w;j++)
dp[i][j]=0;

for(i=0;i<n;i++)
{
    cin>>arr[i][0]>>arr[i][1];
     vect.push_back( make_pair(arr[i][0],arr[i][1]) );
}
sort(vect.begin(), vect.end());

for(i=0;i<n;i++)
{
    arr[i][0]=vect[i].first;
    arr[i][1]=vect[i].second;
     //  cout << vect[i].first << " "
       //      << vect[i].second << endl;
}
for(i=0;i<w;i++)
if(i>=arr[0][0]-1)
dp[0][i]=arr[0][1];

for(i=1;i<n;i++)
{
    for(j=0;j<w;j++)
    {
        if(j<=arr[i][0]-1)
        {
            dp[i][j]=dp[i-1][j];
        }
        else
        {
            dp[i][j]=max(dp[i-1][j-arr[i][0]]+arr[i][1],dp[i-1][j]);
        }
    }
}


cout<<dp[n-1][w-1];
    
return 0;
}

Measured memory_bytes: 78336
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

using Graph = vector<vector<int> >;

int main() {
    // 頂点数と辺数
    int N, M; cin >> N >> M;

    // グラフ入力受取 (ここでは無向グラフを想定)
    Graph G(N);
    for (int i = 0; i < N - 1; ++i) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    vector<int> value(N);
    for (int i = 0; i < M; i++){
      int p, x;
      cin >> p >> x;
      p--;
      value[p] += x;
    }
    // BFS のためのデータ構造
    vector<int> dist(N, -1); // 全頂点を「未訪問」に初期化
    queue<int> que;

    // 初期条件 (頂点 0 を初期ノードとする)
    dist[0] = value[0];
    que.push(0); // 0 を橙色頂点にする

    // BFS 開始 (キューが空になるまで探索を行う)
    while (!que.empty()) {
        int v = que.front(); // キューから先頭頂点を取り出す
        que.pop();

        // v から辿れる頂点をすべて調べる
        for (int nv : G[v]) {
            if (dist[nv] != -1) continue; // すでに発見済みの頂点は探索しない

            // 新たな白色頂点 nv について距離情報を更新してキューに追加する
            dist[nv] = dist[v] + value[nv];
            que.push(nv);
        }
    }

    // 結果出力 (各頂点の頂点 0 からの距離を見る)
    for (int v = 0; v < N; ++v){
      cout<<dist[v]<<" ";
    }
    cout<<endl;
}


Measured memory_bytes: 16372
import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		int t = Integer.parseInt(bf.readLine());
 		for(int j = 360;;j+=360){
 			if (j%t == 0){
 				out.println(j/t);
 				break;
 			}
 			
 		}
 		out.println();
 		out.close();
	 		
 		
 		
 		
 		
 	}
}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

 		
 		
 		
 		
	




Measured memory_bytes: 25428
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<random>
#include<set>
#include<map>
#include<functional>
using namespace std;
#define int long long
#define inf 1145141919
#define mod 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int, int>P;
typedef pair<int, P> PP;
struct edge { int to, cost; };
int a[114514];
map<int, int>M;
signed main() {
	int n; cin >> n;
	rep(i, n) {
		cin >> a[i];
	}
	int sum = 0;
	rep(i, n)sum += a[i];
	if (sum % (n*(n + 1) / 2)) {
		puts("NO");
		return 0;
	}
	int ib = sum / (n*(n + 1) / 2);
	int res = 0;
	rep(i, n) {
		int df = a[(i + 1) % n] - a[i];
		int x = (ib - df) / n;
		if (x*n != ib - df || x < 0) {
			puts("NO");
			return 0;
		}
		else res+=x;
	}
	if (res == ib)cout << "YES" << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define EPS 1e-9
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    int n;
    cin >> n;
    cout << 3*n*n << endl;
}


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

int main () {
    int a,b,c;
    cin >> a >> b >> c;
    if (a+b <= b+c and a+b <= c+a){
        cout << a+b;
    } else if (b+c <= a+b and b+c <= c+a) {
        cout << b+c;
    } else if (c+a <= b+c and c+a <= a+b){
        cout << c+a;
    } 
    return 0;
}

Measured memory_bytes: 256
s=input()
n=len(s)
if n==2:
    if s[0]==s[1]:
        print(1,2)
        exit()
    else:
        print(-1,-1)
        exit()
for i in range(n-2):
    if s[i]==s[i+1]:
        print(i+1,i+2)
        exit()
    if s[i]==s[i+2]:
        print(i+1,i+3)
        exit()
print(-1,-1)

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

long long N, ans;

void dfs(long long n, bool seven, bool five, bool three) {
  if (n <= N) {
    if (seven && five && three) ++ans;
  }
  else return;

  dfs(n * 10 + 7, true, five, three);
  dfs(n * 10 + 5, seven, true, three);
  dfs(n * 10 + 3, seven, five, true);
}

int main() {
  scanf("%d", &N);
  dfs(0, false, false, false);

  printf("%d\n", ans);
  return 0;
}


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

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(z) = it.next() {
            Some(it.fold(z, |x, y| min!(x, y)))
        } else {
            None
        }
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(z) = it.next() {
            Some(it.fold(z, |x, y| max!(x, y)))
        } else {
            None
        }
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}


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

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let m: usize = sc.cin();
    let mut ps: Vec<_> = (0..n).map(|_| {
        let a: usize = sc.cin();
        let x: usize = sc.cin();
        (a, x)
    }).collect();
    ps.sort();
    use std::collections::BinaryHeap;
    let mut q = BinaryHeap::new();
    let mut i = 0;
    let mut ans = 0;
    for r in 0..m+1 {
        while i < ps.len() && ps[i].0 <= r {
            q.push(ps[i].1);
            i += 1;
        }
        if let Some(x) = q.pop() {
            ans += x;
        }
    }
    put!(ans);
}

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

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


Measured memory_bytes: 8444
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;a++)
#define rl(a,b,c) for(int a=b;a>=c;a--)
#define niv vector<int>
#define LL long long
#define IT iterator
#define PB(a) push_back(a)
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
using namespace std;
const int INF=0x3f3f3f3f;
const int MOD=1e9+7;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
LL dp[100001][2][2][2];
int l[100001];
string tmp;
int main(){
	ios::sync_with_stdio(false);
//	dp[0][1][0][1]=dp[0][0][1][0]=1;
//	dp[]
	cin>>tmp;
	int len=tmp.length();
	rb(i,1,len){
		l[i]=tmp[i-1]^48;
//		cout<<l[i]<<endl;
	}
	if(l[1]==1){
		dp[1][1][0][1]=1;
		dp[1][0][1][1]=1;
		dp[1][0][0][0]=1;
	}
	else{
		dp[1][0][0][1]=1;
	}
	rb(i,2,len){
		if(l[i]==1){
			dp[i][0][1][1]=dp[i-1][0][1][1]+dp[i-1][0][0][1]+dp[i-1][1][0][1];
			dp[i][1][0][1]=dp[i-1][0][1][1]+dp[i-1][0][0][1]+dp[i-1][1][0][1];
			dp[i][0][1][0]=dp[i-1][0][1][0]+dp[i-1][0][0][0]+dp[i-1][1][0][0];
			dp[i][1][0][0]=dp[i-1][0][1][0]+dp[i-1][0][0][0]+dp[i-1][1][0][0];
			dp[i][0][0][0]=dp[i-1][0][1][0]+dp[i-1][0][0][0]+dp[i-1][1][0][0]+dp[i-1][0][1][1]+dp[i-1][0][0][1]+dp[i-1][1][0][1];
		}
		else{
			dp[i][0][1][0]=dp[i-1][0][1][0]+dp[i-1][0][0][0]+dp[i-1][1][0][0];
			dp[i][1][0][0]=dp[i-1][0][1][0]+dp[i-1][0][0][0]+dp[i-1][1][0][0];
			dp[i][0][0][1]=dp[i-1][0][1][1]+dp[i-1][0][0][1]+dp[i-1][1][0][1];
			dp[i][0][0][0]=dp[i-1][0][1][0]+dp[i-1][0][0][0]+dp[i-1][1][0][0];
		}
		dp[i][1][0][1]%=MOD;
		dp[i][0][0][1]%=MOD;
		dp[i][0][1][1]%=MOD;
		dp[i][1][0][0]%=MOD;
		dp[i][0][0][0]%=MOD;
		dp[i][0][1][0]%=MOD;
//		int n=i;
//		cout<<dp[n][1][0][1]<<dp[n][0][1][1]<<dp[n][0][0][1]<<dp[n][1][0][0]<<dp[n][0][1][0]<<dp[n][0][0][0]<<endl;
	}
	int n=len;
	cout<<(dp[n][1][0][1]+dp[n][0][1][1]+dp[n][0][0][1]+dp[n][1][0][0]+dp[n][0][1][0]+dp[n][0][0][0])%MOD;
	return 0;
}

Measured memory_bytes: 7120
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 300500), 300500)
}

func rs() string {
	sc.Scan()
	return sc.Text()
}

func cumSum(a string) []int {
	n := len(a)
	res := make([]int, n+1)
	sum := 0
	for i := 1; i <= n; i++ {
		if a[i-1] == 'E' {
			sum++
		}
		res[i] = sum
	}
	return res
}

func main() {
	_ = rs()
	s := rs()
	n := len(s)

	cse := cumSum(s)

	minCost := n
	for i := 1; i <= n; i++ {
		cost := 0
		cost = i - 1 - cse[i-1] + cse[n] - cse[i]
		if cost < minCost {
			minCost = cost
		}
	}
	fmt.Println(minCost)
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
typedef int64_t Int;
typedef pair<Int,Int> p;

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

    if(abs(a-b) <= d && abs(b-c) <= d){
        cout << "Yes" << endl;
    } else if (abs(a-c) <= d){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,a,b,c,d;
char s[1000001];
int main(){
  scanf("%d %s",&n,s);
  for(int i=0;i<n;i++){
    if(s[i]=='J')a++;
    else if(s[i]=='O'){
      if(a)a--,b++;
      else if(c)c--,b+=2,d+=2;
    }else{
      if(b)b--,d=min(d,b),c++;
      else a++;
    }
  }
  printf("%d\n",c+d/2);
  return 0;
}

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

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

fn main() {
    let a: usize = read();
    let b: usize = read();

    println!(
        "{}",
        match b >= a {
            true => a,
            false => a - 1,
        }
    )
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <string.h>
#define mod 1000000007
#define LL long long
#define maxn 1000010
char s[maxn];
LL fact[maxn<<1],inv[maxn<<1];
int m,n;
LL quick_pow(LL a,LL b){
	LL ret=1;
	while(b){
		if(b&1)ret=ret*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return ret%mod;
}
void init(){
	int i;
	fact[0]=1;
	for(i=1;i<=n+m;i++)fact[i]=fact[i-1]*i%mod;
	inv[n+m]=quick_pow(fact[n+m],mod-2);
	for(i=n+m-1;i>=0;i--)inv[i]=inv[i+1]*(i+1)%mod;
}
LL C(int n,int m){
	return fact[n]*inv[n-m]%mod*inv[m]%mod;
}
int main(){
	int i;
	LL ans=0;
	scanf("%d%s",&n,s);
	m=strlen(s);
	init();
	for(i=0;i<=n;i++)
		ans=(ans+quick_pow(26,i)*C(n+m-i-1,m-1)%mod*quick_pow(25,n-i)%mod)%mod;
	printf("%lld\n",ans);
	return 0;
}

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

int main(){
  int n, x, y;
  cin >> n >> x >> y;
  --x, --y;
  vector<int> ans(n);
  rep(i, n-1){
    for(int j = i+1; j < n; j++){
      int md = min({abs(i-j), abs(x-i)+abs(y-j)+1, abs(y-i)+abs(x-j)+1});
      ans.at(md-1)++;
    }
  }
  rep(i, n-1) cout << ans.at(i) << endl;
}

Measured memory_bytes: 256
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
#define D()
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 10000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

int j(int K, int A, int B){
  int n =K;
  while(K<=1000){
    if(A<=K&&B>=K){
      cout <<"OK" << endl;
      return 0;
    }
    K+=n;
  }
  cout <<"NG" << endl;
  return 0;
}
  

int main(){
 
  int K,A,B;
 
  cin >> K >> A >> B;
  j(K,A,B);
}


Measured memory_bytes: 3632
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>
#include<deque>

using namespace std;
typedef long long int ll;

#define C cout<<
#define E <<endl

ll n,m,a,b,c,x,y,z,aa[200010],ab[200010];
bool r,ra,rb,rc;
string s,sa,sb,sc;
char ca,cb,cc,cd[1000][1000];
vector<ll> va,vb,vc;


int main(){
    cin>>s;
    reverse(s.begin(),s.end());
    while(s.size()){
        sa=s.substr(0,7);
        sb=s.substr(0,5);
        sc=s.substr(0,6);
        
        if(sa=="remaerd"){
            s.erase(s.begin(),s.begin()+7);
        }
        else if(sc=="resare"){
            s.erase(s.begin(),s.begin()+6);
        }
        else if(sb=="maerd" or sb=="esare"){
            s.erase(s.begin(),s.begin()+5);
        }
        else{
            C "NO" E;
            return 0;
        }
        
    }
    C "YES" E;
    
}

Measured memory_bytes: 512
N, M ,C = map(int, input().split())
B = list(map(int,input().split()))
A = []
count = 0
for i in range(N):
    A.append(list(map(int, input().split())))

for i in range(N):
    T = 0
    for j in range(M):
        T += A[i][j] * B[j]
    if T + C > 0:
        count += 1

print(count)




Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <fstream>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {1,-1,0,0,1,-1,1,-1};
ll dx[8] = {0,0,1,-1,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
    ll x,n; cin >> x >> n;
    vl a(n); rep(i,n) cin >> a[i];
    sort(all(a));
    rep(i,200){
        if(!binary_search(all(a),x-i)){
            cout << x-i << endl;
            return 0;
        }
        if(!binary_search(all(a),x+i)){
            cout << x+i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3608
#include<stdio.h>
int main(void)
{
	int al[30] = { 0 };
	char b[2000] = { 0 };
	int i, j, n;

	i = 0;

	while (scanf("%c", &b[i]) != EOF) {
		if (b[i] >= 'A' && 'Z' >= b[i]) {
			n = b[i] - 'A';
			al[n] += 1;
		}

		else if (b[i] >= 'a' && b[i] <= 'z') {
			n = b[i] - 'a';
			al[n] += 1;
		}
		i = i + 1;
	}

	for (j = 97; j <= 122; j++) {
		n = j - 'a';
		printf("%c : %d\n", j, al[n]);
	}

	return(0);
}


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

int main(void) {
    int N, K;
    int b, c, d, j;
    scanf("%d %d", &N, &K);
    int count = 0;
    
    int e[N];
    for(int i = 0; i < N; i++) {
        e[i] = 0;
    }

    for(int i = 0; i < K; i++) {
        scanf("%d", &b);
        for(j = 1; j <= b; j++) {
            scanf("%d", &c);
            e[c - 1] = 1;
        }
    }

    for(int i = 0; i < N; i++) {
        if(e[i] == 0) {
            count++;
        }
    }
    printf("%d\n", count);
    return 0;
}

Measured memory_bytes: 2156
N,M=map(int,input().split())
num=[list(map(int,input().split())) for i in range(M)]
ans=[-1]*N
check=True
for i in range(M):
    if ans[num[i][0]-1]==-1:
        ans[num[i][0]-1]=num[i][1]
    elif ans[num[i][0]-1]!=num[i][1]:
        check=False
        break
if ans[0]==-1 and N>1:
    ans[0]=1
elif ans[0]==-1 and N==1:
    ans[0]=0
elif ans[0]==0 and N>1:
    check=False
for i in range(N):
    if ans[i]==-1:
        ans[i]=0

if check==False:
    print("-1")
else:
    answer=0
    for i in range(N):
        answer+=ans[i]*(10**(N-i-1))
    print(answer)


Measured memory_bytes: 3064
#include <cstdlib>
#include <iterator>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cctype>
#include <functional>
using namespace std;

int main() {
    string s;
    cin >> s;
    int ans = 700;
    for(int i = 0; s[i]; i++) {
        if(s[i] == 'o') ans += 100;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import qualified Data.ByteString as BS
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
--import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
import Data.Array
--import Data.Array.Unboxed
--import Data.Array.IArray
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
import GHC.ST
-- import System.IO.Unsafe

-- templete
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
getDoubles = map readDouble . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
tjoin :: (Show a, Show b) => (a, b) -> String
tjoin (x, y) = show x ++ (' ' : show y)
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
binMap :: (a -> a -> b) -> [a] -> [b]
binMap f (x:xs@(y:_)) = f x y : binMap f xs
binMap _ _ = []
splitRec :: Int -> [a] -> [[a]]
splitRec _ [] = []
splitRec n xs = let (y,ys) = splitAt n xs in y : splitRec n ys
infixl 7 `divCeil`
divCeil :: Integral a => a -> a -> a
x `divCeil` y = (x+y-1) `div` y
coverC :: Ord a => (a, a) -> a -> Bool
coverC (l,r) x = l<=x && x<=r
coverH :: Ord a => (a, a) -> a -> Bool
coverH (l,r) x = l<=x && x<r
ibsearch :: (Int -> Bool) -> (Int,Int) -> Int
ibsearch f (ok,ng) = if abs (ok-ng) <= 1 then ok else let mid = (ok + ng) `div` 2 in ibsearch f (if f mid then (mid,ng) else (ok,mid))
-- templete

data Quaternion = Quaternion Int Int Int Int deriving Eq
instance Show Quaternion where
  show (Quaternion x y z w) = sjoin [x, y, z, w]

Quaternion x y z w ~*~ Quaternion x' y' z' w' = Quaternion a b c d
  where
    a = x*x' - y*y' - z*z' - w*w'
    b = x*y' + y*x' + z*w' - w*z'
    c = x*z' + z*x' - y*w' + w*y'
    d = x*w' + w*x' + y*z' - z*y'


main = do
    n <- getInt
    unless (n==0) $ do
        map (apply2 (~*~) . map (apply4 Quaternion) . splitRec 4) <$> replicateM n getInts >>= mapM_ print >> main


Measured memory_bytes: 4080
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define sz 200009
#define mod 1000000007
#define pi acos(-1.0)
ll n,m,j,k,l,t,arr[sz],brr[sz],crr[sz],drr[sz];
int main()
{
   // ll tt1;
   // scanf("%lld",&tt1);
   // while(tt1--){
 scanf("%lld %lld",&n,&k);
 t=((n)*(n+1))/2;
 l=0;
 for(int i=k;i<=n+1;i++)
 {
    j=((n-i+1)*i)+1;
    j=j%mod;
     l+=j;
     l=l%mod;
 }
 printf("%lld\n",l);
  //  }
}


Measured memory_bytes: 3820
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;

void solve(long long N, vector<long long> W){
	long long s1 = 0, s2 = 0;
	for (int i=0; i<N; i++) {
		s2 += W[i];
	}
	long long res = 10000000000;
	for (int i=0; i<N-1; i++) {
		s1 += W[i];
		s2 -= W[i];
		res = min(res, abs(s1-s2));
	}
	cout << res << endl;
}

int main(){	
	long long N;
	scanf("%lld",&N);
	vector<long long> W(N-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&W[i]);
	}
	solve(N, W);
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}

template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=16,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f3f3f3f3f;

ll n;
ll d[MAXn][MAXn];
ll dp[(1<<MAXn)];
ll pre[(1<<MAXn)];
int main(){
    IOS();
	cin >> n;
	REP (i,n) REP (j,n) cin >> d[i][j];
	
	REP (I,(1<<n)) {
		vector<ll> tmp;
		REP (i,n) if ((1<<i) & I) tmp.eb(i);
		ll tt = 0;
		REP (i,SZ(tmp)) {
			REP (j,i) tt += d[tmp[i]][tmp[j]];
		}
		pre[I] = tt;
	}
	
	dp[0] = 0;
	REP1 (I,(1<<n)-1) {
		vector<ll> tmp;
		REP (i,n) if ((1<<i) & I) tmp.eb(i);
		
		ll sz = SZ(tmp);
		REP (J,(1<<sz)) {
			ll S = 0;
			REP (i,sz) if ((1<<i) & J) S += (1<<tmp[i]);
			dp[I] = max(dp[I],dp[I-S] + pre[S]);			
		}
	}
	
	cout << dp[(1<<n)-1] << endl;
}


Measured memory_bytes: 1408
#include <iostream>
#include <cmath>

using namespace std;

int main() {
    int n;
    cin >> n;
    int x[n];
    int sum = 0;
    for(int i = 0; i < n; i++) {
        cin >> x[i];
        sum += x[i];
    }
    double avg = sum*1.0 / n;
    float a = ceil(avg);
    float b = floor(avg);
    int score_a = 0;
    int score_b = 0;
    for(int i = 0; i < n; i++) {
        score_a += (x[i] - a) * (x[i] - a);
        score_b += (x[i] - b) * (x[i] - b);
    }

    if (score_a < score_b) {
        cout << score_a << endl;
    } else {
        cout << score_b << endl;
    }
}

Measured memory_bytes: 256
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;

int main() {
int N;
cin>>N;
vector<tuple<string,int,int>> P(N);
rep(i,N){
  string s;
  int p;
  cin>>s>>p;
  P[i]=make_tuple(s,-p,i+1);
}
sort(all(P));
rep(i,N){
  cout<<get<2>(P[i])<<endl;
}


return 0;
}

Measured memory_bytes: 3608
#include "bits/stdc++.h"
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
#define ll long long int
#define tc int t; cin>>t; while(t--)
#define fora(i,n) for(int i=0;i<n;i++)
#define forb(i,a,n) for(int i=a;i<n;i++)
#define dbg(x)    { cout<< #x << ": " << (x) << endl; }
#define dbg2(x,y)  { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) << endl; }
#define mod 1000000007
#define pb push_back
#define pii pair<int,int>
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
template<class T> T power(T N,T P){ return (P==0)?  1: N*power(N,P-1);}
int val[100100][3];
int dp[100100][4];
int n;
int rec(int day, int choice) {
    if(day>=n) return 0;
    if(~dp[day][choice]) return dp[day][choice];
    int x=INT_MIN;
    for(int i=1;i<=3;i++) {
        if(i!=choice) {
            x=max(x,val[day][i-1]+rec(day+1,i));
        }
    }
    return dp[day][choice]=x; 
}
void solve() {
 cin>>n;
 fora(i,n) {
    fora(j,3) cin>>val[i][j];
 }
 memset(dp,-1,sizeof(dp));
 cout<<rec(0,0);

}
int32_t main()
{
    fastio
    solve();  
    

    return 0;


}

Measured memory_bytes: 14180
// ABC159A - The Number of Even Pairs

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

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

	int tempN, tempM;
	if (N <= 1) {
		tempN = 0;
	} else {
		tempN = N * (N - 1) / 2;
	}

	if (M <= 1) {
		tempM = 0;
	} else {
		tempM = M * (M - 1) / 2;
	}

	cout << tempN + tempM << endl;

	return 0;
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    int A,B,C,D,N;
    bool ok = 1;
    cin >> N >> A >> B >> C >> D >> S;
    A--;B--;C--;D--;
    bool ss = 0;
    for(int i = A;i < C;i++){
        if(S.at(i)=='#'){
            if(ss == 1)ok = 0;
            ss = 1;
        }else{
            ss = 0;
        }
    }
    ss = 0;
    for(int i = B;i < D;i++){
        if(S.at(i)=='#'){
            if(ss == 1)ok = 0;
            ss = 1;
        }else{
            ss = 0;
        }
    }
    if(C>D){
        int ccc = 0;
        ok = 0;
        for(int i = B-1;i < D+2;i++){
            if(S.at(i) == '.'){
                ccc++;
            }else{
                ccc = 0;
            }
            if(ccc == 3)ok = 1;
        }
    }
    if(ok == 1){
        cout <<"Yes"<< "\n";
    }else{
        cout <<"No"<< "\n";
    }
}

Measured memory_bytes: 592
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,m = LI()
    e = [[] for _ in range(n)]
    if m > 0:
        for _ in range(m):
            l,r,d = LI()
            e[l-1].append((r-1,d))
            e[r-1].append((l-1,-d))

    b = [None] * n

    for i in range(n):
        if not b[i] is None:
            continue
        b[i] = 0
        q = [i]
        qi = 0
        nq = []
        while True:
            if len(q) == qi:
                if not nq:
                    break
                q = nq
                qi = 0
                nq = []
            j = q[qi]
            qi += 1
            c = b[j]
            for r,d in e[j]:
                if b[r] is None:
                    b[r] = c+d
                    nq.append(r)
                else:
                    if b[r] != c+d:
                        return 'No'

    return 'Yes'


print(main())




Measured memory_bytes: 68468
#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;

#define MAX 256

int main(void){
	int h[MAX], w[MAX];
	int i = 0, t = 1;
	while (t == 1){
		scanf("%d %d", &h[i], &w[i]);
		if (h[i] == 0 && w[i] == 0)t = 0;
		i++;
	}

	for (int j = 0; j < i-1; j++){
		for (int l = 0; l < w[j]; l++){
			printf("#");
		}
		printf("\n");
		for (int k = 1; k < h[j] - 1; k++){
			printf("#");
			for (int l = 1; l < w[j] - 1; l++){
				printf(".");
			}
			printf("#\n");
		}
		for (int l = 0; l < w[j]; l++){
			printf("#");
		}
		printf("\n");
		if (j != i - 1)printf("\n");
	}

	return 0;
}

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

using namespace std;

int main() {
	vector <int> v(2000);
	for (int i = 1; i < 1005; i++) {
		v[i] = i * (i + 1) / 2;
	}
	int a, b;
	scanf("%d %d", &a, &b);
	for (int i = 1; i < (int)v.size() - 1; i++) {
		if (v[i] > a) {
			int val = v[i] - a;
			if (v[i + 1] - b == val) {
				printf("%d\n",  val);
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (long long i = 0; i < n; i++)
#define RREP(i, n) for (long long i = n - 1; 0 <= i; i--)
#define FOR(i, start, end) for (long long i = start; i < end; i++)
#define RFOR(i, start, end) for (long long i = start - 1; 0 <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
using ll = long long;
using namespace std;
const int INF32       = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7        = 1'000'000'007;
const int MOD9        = 1'000'000'009;
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;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}

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

    ll N, M;
    cin >> N >> M;

    ll div = M / 2;
    ll ans = min(N, div);
    if (N < M) {
        ans += (M - ans * 2) / 4;
    }
    print(ans);

    return 0;
}

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

void A()
{
    string N;
    cin >> N;
    
    if( N.find("7") != string::npos )
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

int main()
{
    A();
    
    return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;
using ll = long long;

int main() {
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;
    int diff = 0;
    for (int i = 0; i < S.size() - 1; i++) {
        if (S[i] != S[i + 1]) diff++;
    }

    cout << min(N - 1, N - 1 - diff + 2 * K) << endl;

    return 0;
}

Measured memory_bytes: 512
n, m = gets.chomp.split.map(&:to_i)
list = []
m.times do |i|
  a, b = gets.chomp.split.map(&:to_i)
  list[i] = [a,b]
end

list.sort_by!{ |a,b| a*(n+1) + b }

count = 0
right = n
list.each do |a,b|
  if a < right
    right = b if b < right
  else
    count += 1
    right = b
  end
end
count += 1

puts(count)

Measured memory_bytes: 12664
#include<iostream>
#include<string>
using namespace std;
int main(){
	int a, b;
	string op;
	for (int i = 0;; i++){
		cin >> a >> op >> b;
		if (op == "?"){
			break;
		}
		if (op == "+"){
			cout << a + b << endl;
		}
		if (op == "-"){
			cout << a - b << endl;
		}
		if (op == "*"){
			cout << a * b << endl;
		}
		if (op == "/"){
			cout << a / b << endl;
		}
	}
}


Measured memory_bytes: 3156
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define pb push_back
#define pf push_front
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
int SIZE(string s){return (int)s.size();}
const long long INF = 1LL << 60;

ll gcd(ll x, ll y) { return y ? gcd(y,x%y) : x; }
ll lcm(ll x, ll y) { return x*y / gcd(x,y); }

int main(){
    cout << fixed << setprecision(20);
    int a,b,c; cin >> a >> b >> c;
    for(int i = a; i <= lcm(a,b); i += a){
        if(i % b == c){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main() {
    
    char a[101];
    int b;
    scanf("%d",&b);
    getchar();
    scanf("%[^\n]", &a);
    
    if (strlen(a) > b ) {
        for(int i = 0; i < b; i++) {
            printf("%c", a[i]);
        }
        printf("...\n");
    }
	else {
        for(int i = 0; i < strlen(a); i++){
            printf("%c", a[i]);
        }
    }

    return 0;
}

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

using namespace std;

#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define pb push_back
#define endl '\n'
#define snd second
#define fst first
#define fastio cin.tie(NULL),cout.sync_with_stdio(true)

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector <int> vi;
typedef pair <ll,int> ii;
typedef pair <ii,int> iii;

const int mod = 1e9 + 7;
const int N = 100005;

ll w[N], v[N], dp[105][N], n;

ll solve(int i, int p){
    if(i == n or p == 0)
        return 0;
    if(dp[i][p] != -1)
        return dp[i][p];
    ll ans = solve(i+1, p);
    if(w[i] <= p)
        ans = max(ans, solve(i+1, p-w[i])+v[i]);
    return dp[i][p] = ans;
}

int main(){
	fastio;
    memset(dp, -1, sizeof(dp));
    int p;
    cin >> n >> p;
    for(int i = 0; i < n; i++){
        cin >> w[i] >> v[i];
    }
    cout << solve(0,p) << endl;
}


Measured memory_bytes: 85660
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,L,a,b=0,c=0;
  cin >> N >> L;
  for(int i=1;i<=N;i++){
      a=L+i-1;
      if(i==1){
          c=a;
      }
      else if(a<b && b>=0 && a>=0){
          c=a;
      }
      else if(a>b && b<=0 && a<=0){
          c=a;
      }
      
      b=a;
  }
  cout << N*L-N+N*(N+1)/2-c << endl; 
}

Measured memory_bytes: 256