akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <utility>
#include <functional>

using namespace std;

int main() {
	int n, m, a, b;
	vector<int> to[51];

	cin >> n >> m;
	while (m--) {
		cin >> a >> b;
		to[a].push_back(b);
		to[b].push_back(a);
	}

	for (int i = 1; i <= n; ++i) {
		cout << to[i].size() << endl;
	}

	return 0;
}

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

using namespace std;
int main (){
    int n,k,r,s,p;
    string t;
    cin >> n >> k >> r >> s >> p >> t;

    int point=0;
    for(int i = 0; i < k; i++) {
        int idx=i;
        if     (t[idx]=='r') point+=p;
        else if(t[idx]=='p') point+=s;
        else                 point+=r;

        idx+=k;
        bool skip=false;
        while(idx<n) {
            if(t[idx]!=t[idx-k] || skip){
                if     (t[idx]=='r') point+=p;
                else if(t[idx]=='p') point+=s;
                else                 point+=r;
                skip=false;
            }
            else skip=true;
            idx+=k;
        }
    }
    cout << point << "\n";
    return 0;
}

Measured memory_bytes: 512
import java.util.*;
public class Main {
	public static void main(String[] args) {
		B();
	}
	
	public static void A() {
		Scanner sc = new Scanner(System.in);
		String s1 = sc.next();
		String s2 = sc.next();
		if(s1.compareTo(s2) < 0) System.out.println("<");
		else if(s1.compareTo(s2) == 0) System.out.println("=");
		else System.out.println(">");
	}
	
	public static void B() {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int Y = sc.nextInt();
		int Z = sc.nextInt();
		if(X<Y || X<Z) {
			System.out.println(0);
			return;
		}
		X -= Z;
		System.out.println(X/(Y+Z));
	}
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
#define NIL NULL

struct Node {
	int key;
	Node *parent, *left, *right;
	Node (int x) {
		key = x;
		parent = left = right = NIL;
	}
};

struct Tree {
	Node *root;
	Tree() {
		root = NIL;
	}
	void insert(int x) {
		Node *new_node = new  Node(x);
		Node *temp_parent = NIL;
		Node *now_node = root;
		while (now_node != NIL) {
			temp_parent = now_node;
			if (now_node->key > new_node->key)
				now_node = now_node->left;
			else
				now_node = now_node->right;
		}
		if (temp_parent == NIL) {
			root = new_node;
			return;
		}
		new_node->parent = temp_parent;
		if (temp_parent->key > new_node->key) {
			temp_parent->left = new_node;
		} else {
			temp_parent->right = new_node;
		}
	}
	bool find(int x) {
		Node *now_node = root;
		while (now_node != NIL) {
			if (now_node->key == x)
				return true;
			if (now_node->key > x)
				now_node = now_node->left;
			else
				now_node = now_node->right;
		}
		return false;
	}
	void printInorder() {
		inorder(root);
	}
	void inorder(Node *v) {
		if (v == NIL)
			return;
		inorder(v->left);
		cout << " " << v->key;
		inorder(v->right);
	}
	void printPreorder() {
		preorder(root);
	}
	void preorder(Node *v) {
		if (v == NIL)
			return;
		cout << " " << v->key;
		preorder(v->left);
		preorder(v->right);
	}
};

int main(void) {
	Tree T;
	int n, i, x;
	string com;
	cin >> n;
	while (n--) {
		cin >> com;
		if (com == "insert") {
			cin >> x;
			T.insert(x);
		} else if (com == "find") {
			cin >> x;
			if (T.find(x)) {
				cout << "yes" << endl;
			} else {
				cout << "no" << endl;
			}
		} else if (com == "print") {
			T.printInorder();
			cout << endl;
			T.printPreorder();
			cout << endl;
		}
	}
}


Measured memory_bytes: 21904
# -*- coding: utf-8 -*-
#ABC130C
import sys


tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))
w=hoge[0]
h=hoge[1]
x=hoge[2]
y=hoge[3]

if(2*x==w)and(2*y==h):
	ans=1
else:
	ans=0
print("{} {}".format((w*h/2),ans))

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int c[30];
int s[400][30];
int t[400];
int main() {
	int d;
	cin >> d;
	for (int i = 1; i <= 26; i++) {
		cin >> c[i];
	}
	for (int i = 1; i <= d; i++) {
		int m = 0, mi = 0;
		for (int j = 1; j <= 26; j++) {
			cin >> s[i][j];
			if (m < s[i][j]) {
				m = s[i][j];
				mi = j;
			}
		}
		
	}
	int a[400];
	int ans = 0, ans1 = 0;
	int co[30] = { 0 };
	for (int i = 1; i <= d; i++) {
		t[i] = (i - 1) % 26 + 1;
	}
	for (int i = 0; i < 26; i++) {
		for (int i = 1; i <= d; i++) {
			ans += s[i][t[i]];
			co[t[i]] = i;
			for (int j = 1; j <= 26; j++) {
				ans -= c[j] * (i - co[j]);
			}
		}
		if (ans > ans1) {
			ans1 = ans;
			for (int i = 1; i <= d; i++) {
				a[i] = t[i];
			}
		}
		int ti = t[1];
		for (int i = 1; i <= d - 1; i++) {
			t[i] = t[i + 1];
		}
		t[d] = ti;
	}
	for (int i = 1; i <= d; i++) {
		cout << a[i] << endl;
	}
	return 0;
}



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

using namespace std;

int main()
{
    int n, tmp;
    vector<int> as;
    cin >> n;

    for (int i = 0; i < n; ++i)
    {
        cin >> tmp;
        as.push_back(tmp);
    }

    int pos = 1;
    for (int i = 1; i <= n; ++i)
    {
        pos = as[pos - 1];
        if (pos == 2)
        {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;

    return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  sort(a.begin(), a.end());
  vector<int> dp(a.back());
  rep(i, a.back()) dp[i] = -1;
  for (int ai : a) {
    if (dp[ai - 1] != -1) {
      dp[ai - 1] = 0;
      continue;
    }
    if (dp[ai - 1] == -1) dp[ai - 1] = 1;
    int t = ai;
    while ((t += ai) <= a.back()) dp[t - 1] = 0;
  }
  int count = 0;
  for (int ai : a)
    if (dp[ai - 1] == 1) {
      count++;
      //cout << ai << endl;
    }

  cout << count << endl;
  //rep(i, a.back()) cout << dp[i] << " ";
  //cout << endl;
  return 0;
}


Measured memory_bytes: 7956
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e9;

#define mod             1000000007
#define what_is(x)      cerr<<#x<<" is "<<x<<"\n";
#define read(x)         freopen("in.txt","r",stdin);
#define write(x)        freopen("out.txt","w",stdout);
#define Fast            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define sz              3000005



int main(){
    Fast;///using Fast I/O
    int a,b,c, i,j,k, t,n,m;

    cin>>n;

    if(n>=400 && n<=599)cout<<8<<endl;
    if(n>=600 && n<=799)cout<<7<<endl;
    if(n>=800 && n<=999)cout<<6<<endl;
    if(n>=1000 && n<=1199)cout<<5<<endl;
    if(n>=1200 && n<=1399)cout<<4<<endl;
    if(n>=1400 && n<=1599)cout<<3<<endl;
    if(n>=1600 && n<=1799)cout<<2<<endl;
    if(n>=1800 && n<=1999)cout<<1<<endl;


    return 0;
}



Measured memory_bytes: 3648
#include<stdio.h>
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a,long long b){return a*(b/gcd(a,b));}
int main(){
  long long n,g,l,i,a[20],b[20],c[20];
  while(scanf("%lld",&n),n){
    for(i=0;i<n;i++)scanf("%lld %lld",&a[i],&b[i]);
    g=a[0];
    for(i=0;i<n;i++)g=gcd(g,a[i]);
    l=1;
    for(i=0;i<n;i++)l=lcm(l,a[i]/g);
    //printf("%lld\n",l);
    for(i=0;i<n;i++)c[i]=l*b[i]/(a[i]/g);
    g=c[0];
    //printf("%lld\n",g);
    for(i=0;i<n;i++)g=gcd(g,c[i]);
    for(i=0;i<n;i++)printf("%lld\n",c[i]/g);
  }
  return 0;
}



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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;
//const int mod = 100000;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  int n; cin >> n;
  map<string, int> mp;
  rep(i, n) {
    string s; cin >> s;
    ++mp[s];
  }
  int max = 0;
  for(auto x : mp) chmax(max, x.second);
  for(auto x : mp) if(x.second == max) cout << x.first << endl;
}


Measured memory_bytes: 19188
#!/usr/bin/env python3
import sys


def solve(n: int, p: "List[int]"):
    return sum(1 if p1 <= p2 <= p3 or p3 <= p2 <= p1 else 0 for p1, p2, p3 in zip(p, p[1:], p[2:]))

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    p = [int(next(tokens)) for _ in range(n)]  # type: "List[int]"
    print(solve(n, p))

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  solve <$> getl read <*> getl (map read . words) >>= putStrLn

solve :: Int -> [Int] -> String
solve n as
  | odd . length . filter odd $ as = "NO"
  | otherwise = "YES"

getl :: (String -> a) -> IO a
getl f = f <$> getLine


Measured memory_bytes: 36220
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define sz 2000009
#define mod 998244353
ll n,q,i,j,k,t,arr[sz],brr[sz],crr[sz],a,b,c,d;
int main()
{
    scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
    j=0;
    while(a>0 && c>0)
    {
        j^=1;
        if(j)
            c-=b;
        else
            a-=d;
    }
    if(a>0)
        printf("Yes\n");
    else
        printf("No");
    return 0;
}



Measured memory_bytes: 3700
package main

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

func searchMax(ary []int) (max int, secMax int) {
	sort.Ints(ary)
	max = ary[len(ary)-1]
	secMax = ary[len(ary)-2]
	return
}

func main() {
	s := bufio.NewScanner(os.Stdin)
	s.Scan()
	a, _ := strconv.Atoi(s.Text())

	var nums = make([]int, a)
	var cp = make([]int, a)

	for i := 0; i < a; i++ {
		s.Scan()
		n, _ := strconv.Atoi(s.Text())
		nums[i] = n
	}
	copy(cp, nums)
	max, secMax := searchMax(cp)
	for i := 0; i < a; i++ {
		if nums[i] != max {
			fmt.Println(max)
		} else {
			fmt.Println(secMax)
		}
	}
}


Measured memory_bytes: 7680
/**/
/*
 * 	Meet me on the battlefield
*/
#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#ifndef rd
#define endl '\n'
#endif
#define deb cout<<"Line: "<<__LINE__<<" plz "
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
#define pii pair<int,int>
#define sz(x) ((int)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define all(con) con.begin(),con.end()
const int inf=1e9;
const int mod=1e9+7;
#define dpr(x) cout<<#x<<": "<<x<<endl
typedef vector<int> vi;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int a[5];
void solve()
{
	int te;
	for(int i=0; i<6; i++)
		cin>>te,a[te]++;
	int odd=0;
	for(int i=1; i<=4; i++)
		if(a[i]&1)
			odd++;
	if(odd>2)
		cout<<"NO"<<endl;
	else
		cout<<"YES"<<endl;
}
signed main() {
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	srand(chrono::steady_clock::now().time_since_epoch().count());
	auto clk=clock();
	int t=1;
//	cin>>t;
	while(t--)
		solve();
#ifdef rd
	cout<<endl<<endl<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
#endif
	return 0;
}
/**/


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int n;
    cin >> n;
    int A[n];
    for(int i=0;i<n;i++) cin >> A[i];
     
    int count = 0;
    int min;
    for(int i=0;i<n;i++){
        min = i;
        for(int j=i;j<n;j++){
            if(A[j] < A[min]) min = j;
        }
        if(i!=min){
            count++;
            int tmp;
            tmp = A[i];
            A[i] = A[min];
            A[min] = tmp;
        }
    }

    for(int i=0;i<n;i++){
        cout << A[i];
        if(i==n-1){
            cout << endl;
        }else{
            cout << " ";
        }
    }    
    cout << count << endl;
 
    return 0;
}


Measured memory_bytes: 3092
s=list(input())
a=[]
b=[]

for i in range(len(s)):
  s[i]=int(s[i])
  if i%2 == 0:
    a.append(1)
    b.append(0)
  else:
    a.append(0)
    b.append(1)
    
ansa=0
ansb=0

for i in range(len(s)):
  if a[i]!=s[i]:
    ansa=ansa+1
  if b[i]!=s[i]:
    ansb=ansb+1
    
print(min(ansa,ansb))

Measured memory_bytes: 5540
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]

m = sum(a)

for i in range(n):
    k = min(a[i], b[i])
    a[i] -= k
    b[i] -= k
    a[i + 1] -= min(a[i + 1], b[i])

print(m - sum(a))


Measured memory_bytes: 18624
/*input

*/


//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define pb          push_back
#define pii         pair<ll int,ll int>
#define vpii        vector< pii >
#define vi          vector<ll int>
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			(ll)1e18
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int solve()
{
	ll n;cin>>n;
	string s;cin>>s;
	vi pos1,pos2;
	set<ll> pos3;
	rep(i,0,n) if(s[i]=='R') pos1.pb(i); else if(s[i]=='G') pos2.pb(i); else pos3.insert(i);

	n = sz(pos3);
	ll ans=0;
	rep(i,0,sz(pos1))
	{
		rep(j,0,sz(pos2))
		{
			ll i1 = pos1[i];
			ll i2 = pos2[j];

			if(i2>i1) ans+=n-(pos3.find(i2+(i2-i1))!=pos3.end()) - (pos3.find(i1-(i2-i1))!=pos3.end()) - ((i2-i1)%2==0?(pos3.find(i1+(i2-i1)/2)!=pos3.end()):0);
			else
			{
				swap(i2,i1);
				ans+=n-(pos3.find(i2+(i2-i1))!=pos3.end()) - (pos3.find(i1-(i2-i1))!=pos3.end()) - ((i2-i1)%2==0?(pos3.find(i1+(i2-i1)/2)!=pos3.end()):0);
			} 

		}
	}
	cout<<ans<<"\n";
	return 0;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll test_cases=1;
	//cin>>test_cases;
	while(test_cases--)
		solve();

	auto stop = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start);
	// cout<<"\nduration: "<<(double)duration.count()<<" milliseconds";
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
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;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
int main(){
    int n,k;cin >> n >> k;
    ll ans=0;
    for(int b=k+1;b<=n;b++){
        int sum=0;
        int basic=b-k;
        int cnt=n/b;
        //cout << cnt << "nandeyanen " << basic << endl;
        sum+=cnt*basic;
        int rem=n%b;
        if(rem!=0){
            if(k!=0) sum+=(rem>=k?rem-k+1:0);
            else sum+=rem;
        }
        ans+=sum;
        //cout << b << " " << sum << endl;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
A,B = map(int,input().split())
import math
#n = math.ceil(B/A)
n=0
if B==1:
    print(0)
elif B<=A :
    print(1)
else:
    n=A
    counter =1
    while n <B:
        n+=(A-1)
        counter += 1
    print(counter)

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

int main(){
    int a, b, d, r;
    double f;

    cin >> a >> b;

    d = a / b;
    r = a % b;
    f = 1.0 * a / b;

    cout << d << " " << r << " " ;
    printf("%.8lf\n", f);

    return 0;
}


Measured memory_bytes: 3232
/*

         o###########oo
      o##"          ""##o
    o#"                "##
  o#"                    "#o
 #"  ##              ##   "##
#"                          ##
#  ###################       #
#                            #
#                            #
#                            #
#                            #
#                            #
#o                           #
"#o                         ##
 "#o                       ##
  "#o                    o#"
   "#o                  ##
     "#o              o#"
       "#ooo      ooo#######oo
        ###############   "######o
     o###""        "###o      # ###
   o###o     oooo    ###    oo####"
 o###**#     #**#   ############"
 ""##""""""""""###########    #
    # oooooooo#"#**     ##    #
    # #       # # **    ##    #
    #o#       #o#  *****###ooo#
                        ##
                        ##   o###o
                        ## o##***##
               o########## #***#**##o
             o##"   ""###  #***##***#
 o#######o  ###   oo####   ##**####*#
o##"  ""#############""     ##****###
##"         ##              ##*##*###
##          ###              ##### ##
##           ###              # ##  #
##            ##                 #
##             ##
##             ###
##              ###oo
###              ""###
 ###
  ###
*/
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
/*
void setmin(int &x, int y){
    x = min(x, y);
}

void setmax(int &x, int y){
    x = max(x, y);
}

void setmin(ll &x, ll y){
    x = min(x, y);
}

void setmax(ll &x, ll y){
    x = max(x, y);
}
*/
const int maxn = 1e5 + 100, inf = 1e9 + 100;

int n;

vector<int> e[maxn];

bool vis[maxn];

int st, fin;

vector<int> p[2];

void dfs(int v, int t){
    p[t].push_back(v);
    vis[v] = 1;
    for (int i = 0; i < e[v].size(); i++)
    if (!vis[e[v][i]]){
        dfs(e[v][i], t);
        return;
    }
}

int main(){
    /*#ifdef ONPC
    ifstream cin("a.in");
    ofstream cout("a.out");
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    #else
    //ifstream cin("anti.in");
    //ofstream cout("anti.out");
    freopen("internship.in", "r", stdin);
    freopen("internship.out", "w", stdout);
    #endif // ONPC
    */
    ios::sync_with_stdio(0);
    int ed;
    cin >> n >> ed;
    for (int i = 0; i < ed; i++){
        int v, u;
        cin >> v >> u;
        v--;
        u--;
        e[v].push_back(u);
        e[u].push_back(v);
    }
    st = 0, fin = 0;
    dfs(fin, 1);
    dfs(st, 0);
    reverse(p[0].begin(), p[0].end());
    p[0].pop_back();
    cout << p[0].size() + p[1].size() << '\n';
    for (int i = 0; i < p[0].size(); i++)
        cout << p[0][i] + 1 << ' ';
    for (int i = 0; i < p[1].size(); i++)
        cout << p[1][i] + 1 << ' ';
}


Measured memory_bytes: 9720
sx,sy,tx,ty = map(int,input().split())
x = tx-sx
y = ty-sy
print("U"*y+"R"*x+"D"*y+"L"*(x+1)+"U"*(y+1)+"R"*(x+1)+"D"+"R"+"D"*(y+1)+"L"*(x+1)+"U")

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

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	while(true){
		int x, y, s;
		cin >> x >> y >> s;
		if(x == 0 && y == 0 && s == 0){ break; }
		int answer = 0;
		for(int i = 1; i <= s; ++i){
			const int a = (i * (100 + x)) / 100;
			for(int j = 1; j <= s; ++j){
				const int b = (j * (100 + x)) / 100;
				if(a + b != s){ continue; }
				answer = max(
					answer, (i * (100 + y)) / 100 + (j * (100 + y)) / 100);
			}
		}
		cout << answer << endl;
	}
	return 0;
}

Measured memory_bytes: 1192
#include<bits/stdc++.h>
//#define Mx 1000000000005 
#define ll long long  
#define pi 3.141592653
#define vi vector<ll>
#define Mo 1000000007
#define mp make_pair
#define M map<ll,ll>
#define fr(i,a,b) for(ll i=a;i<b;i++)
#define vii vector<pair<ll,ll> > 
#define fi first
#define se second
#define pb push_back
#define ld long double
#define fill(a,x) memset(a,x,sizeof(a))
using namespace std;
bool comp(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
  return a.second<b.second;
}
/*vi b=v;
   sort(b.begin(), b.end());
  b.resize(unique(b.begin(), b.end()) - b.begin());
  ll t; cin>>t; fr(f,0,t){ 
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
 */

const long long Mx = 1e15 + 7;

int main()
{
  ll n; cin>>n;
  ll a[n];
  fr(i,0,n)
    cin>>a[i];

  ll dp[n][n],p[n+1]={0};
  fill(dp,0);

  fr(i,1,n+1)
    p[i]=a[i-1]+p[i-1];

  fr(l,2,n+1)
  {
    fr(i,0,n-l+1)
    {
      ll j=i+l-1,ans=Mx;

      if(l==2)  { dp[i][j]=a[i]+a[j]; continue; }

      fr(k,i,j)
        ans=min(ans,dp[i][k]+dp[k+1][j]+p[j+1]-p[i]);
      dp[i][j]=ans;

    }
  }

  cout<<dp[0][n-1];


}


Measured memory_bytes: 4900
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int mod = 1000000007;
/* struct for mod Calculation*/
struct mint {
    ll x;
    mint(ll x = 0):x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const {
        return pow(mod - 2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};
/* global variables */
/* function */
struct Fact {
    // vector size : n + 1
    vector<mint> fact, ifact;
    // precaliculation O(n)
    Fact (int n):fact(n+1), ifact(n+1) {
        assert(n < mod);
        // 0! = 1;
        fact[0] = 1;
        // 1! = 0! * 1 ... n! = (n-1)! * n
        for (int i = 1; i <= n; i++) fact[i] = fact[i-1] * i;
        // 1/n! = n!^(-1)
        ifact[n] = fact[n].inv();
        // (n-1)!^(-1) = n!^(-1) * n ... 0!^(-1) = 1!^(-1) * 1
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i] * i;
    }
    mint operator()(int n, int k) {
        return fact[n + k] * ifact[n] * ifact[k];
    }
};
/* global variables */
/* function */
/* main */
int main(){
    int H, W, A, B;
    cin >> H >> W >> A >> B;
    Fact f = Fact(200005);
    mint ans = 0;
    for (int i = B; i <= W - 1; i++) {
        ans += f(H - A - 1, i) * f(A - 1, W - i - 1);
    }
    cout << ans.x << '\n';
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
#include<map>
using namespace std;
typedef long long ll;
int main()
{
    ll A,B,C; cin >> A >> B >> C;
    if(A % 2 == 0 || B % 2 == 0 || C % 2 == 0)
    {
        cout << 0 << endl;
    }
    else
    {
        if(A*B <= B*C && A*B <= C*A)
        {
            cout << A*B << endl;
        }
        else if(B*C <= C*A && B*C <= A*B)
        {
            cout << B*C << endl;
        }
        else
        {
            cout << C*A << endl;
        }
    }
}

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

using namespace std;

char str[12];

void E(){
	puts("Yes");
	exit(0);
}

int main()
{
	scanf("%s",str);
	if(str[0]=='Y')
	if(str[1]=='A')
	if(str[2]=='K')
	if(str[3]=='I') E();
	puts("No");
}

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



int main() {
    double n, k;
    cin >> n >> k;
    
    double cnt = 1 / n, half = 1, ans = 0;
    while(n > 0) {
        if(n >= k) {
            //cout << cnt * half << endl;
            ans += cnt * half;
            n--;
        }
        else {
            k /= 2;
            half *= 0.5;
        }
    }
    
    cout << fixed << setprecision(10) << ans << endl;
    
    
    
    return 0;
}


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

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 10007
#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;

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;
    string s;
    cin >> s;
    string t = "JOI";
    vi a(n);
    rep(i,n)rep(j,3)if(s[i] == t[j])a[i] = j;
    vector<vi> dp(n+1,vi(1<<3,0));
    dp[0][1] = 1;
    rep(i,n)rep(j,1<<3)if(dp[i][j]){
        rep(bit,1<<3)if((bit & j) && (bit & 1 << a[i])){
            (dp[i+1][bit] += dp[i][j]) %= MOD;
        }
    }
    int ans = 0;
    rep(i,1<<3)ans += dp[n][i];
    cout << ans % MOD << endl;
}



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

int k[10000];

int main()
{
	int n;
	while (cin >> n, n){
	
	for (int i = 0; i < n; i++){
		cin >> k[i];
	}
	
	int nt = 0, maxi = 0;
	for (int i = 0; i < n; i++){
		nt += !!k[i];
		maxi = max(maxi, k[i]);
	}
	
	if (maxi <= 1) puts("NA");
	else printf("%d\n", nt + 1);
	
	}
	
	return 0;
}

Measured memory_bytes: 1188
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 1)return 1;
	return kai(x - 1)*x%mod;
}

int mod_pow(int x, int y, int moder) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%moder;
		x = x * x%moder;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	if (x == y)return 1;
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}

int n, x, a[2000];
int ta[2010][2010];
int ans = INF;
int cnt;

signed main() {
	cin >> n >> x;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		ta[0][i] = a[i];
	}
	for (int i = 1; i < n; i++) {
		for (int j = 0; j < n; j++) {
			ta[i][j] = min(ta[i - 1][j], a[(j - i + n) % n]);
		}
	}
	for (int i = 0; i < n; i++) {
		cnt = i * x;
		for (int j = 0; j < n; j++) {
			cnt += ta[i][j];
		}
		ans = min(ans, cnt);
	}
	cout << ans << endl;
}

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

#define range(i, n) for (int i = 0; i < n; ++i)
#define sz(v) int(v.size())
#define back_range(i, n) for (int i = n - 1; i >= 0; --i)
#define all(v) v.begin(), v.end()
#define mp make_pair
#define eb emplace_back

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair <int, int>;

void fastIO() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
}

template <class T1, class T2>
istream& operator >> (istream &in, pair <T1, T2> &a) {
    in >> a.first >> a.second;
    return in;
}

template <class T1, class T2>
ostream& operator << (ostream& out, pair <T1, T2> &a) {
    out << a.first << ' ' << a.second;
    return out;
}

template <class T>
istream& operator >> (istream &in, vector <T> &a) {
    for (T &i: a) in >> i;

    return in;
}

template <class T>
ostream& operator << (ostream& out, vector <T> &a) {
    for (T i: a) out << i << ' ';
    return out;
}

void solve();

int main() {
    fastIO();

    string s, t;
    cin >> s >> t;

    if (sz(s) + 1 == sz(t) &&
        s == t.substr(0, sz(t) - 1)) {
            cout << "Yes";
    }

    else {
        cout << "No";
    }

    return 0;
}

/// ЗАПУСКАЕМ ГУСЯ
/*
     ▄▀▀▀▄
▄███▀░◐░░░▌
    ▌░░░░░▐
    ▐░░░░░▐
    ▌░░░░░▐▄▄
    ▌░░░░▄▀▒▒▀▀▀▀▄
   ▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
   ▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
    ▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
      ▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
           ▌▌░▌▌
           ▌▌░▌▌
         ▄▄▌▌▄▌▌        */


Measured memory_bytes: 3644
H, W = map(int, input().split())
if H*W%2 == 0 and H!=1 and W!=1:
    print(int(H*W/2))
elif H == 1 or W == 1:
    print(1)    
else:
    if H > W:
        print(int((H-1)*W/2-(-W//2)))
    elif H == W:
        print(int((W-1)*H/2-(-H//2)))
    else:
        print(int((W-1)*H/2-(-H//2)))

Measured memory_bytes: 3064
#include<iostream>
#include<string>
using namespace std;
int main(){
  int d[]={31,29,31,30,31,30,31,31,30,31,30,31};
  string s[]={"Thursday",
	      "Friday","Saturday","Sunday","Monday","Tuesday","Wednesday",};
  int i,j;
  int a,b;
  cin>>a>>b;
  while(a!=0){
    int o=0;
    for(i=1;i<a;i++) o+=d[i-1];
    o+=b-1;
    //cout << o << endl;
    cout << s[o%7] << endl;
    cin>>a>>b;
  }
  return 0;
}

Measured memory_bytes: 1192
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int main() {
    int N, K;
    cin >> N >> K;
    int A[N];
    rep(i, N) {
        cin >> A[i];
    }
    
    sort(A, A+N);

    int t = A[0];
    int k = 0;
    int c[N];   //Aの小さい数から順にそれぞれ何個ずつ含まれているかをc[N]に入れる
    for(int i = 0; i < N; i++) {
        c[i] = 0;
    }   

    for(int i = 0; i < N; i++) {
        if(t < A[i]) {
            t = A[i];
            k++;
            c[k]++;
        } 
        else {
            c[k]++;
        }
    }

    sort(c, c+N);

    int u = 0;
    for(int i = N-K; i < N; i++) {
        u += c[i];
    }

    int ans = N - u;

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

Measured memory_bytes: 1792
#include <iostream>
#include <stdio.h>
#include <stdlib.h> //rand() 0~RAND_MAX2147483647
#include <math.h>
#include <time.h>   //srand((unsigned int)time(NULL));
#include <unistd.h> //sleep
#include <algorithm>
#include <cmath>
#include <vector>
#include <regex> //正規表現
#include <map>
#include <unordered_map>
#include <set>
#include <cassert> //assart
#include <numeric>
#include <iterator>
#include <list>

using namespace std;
#define ll long long int
#define FOR(i,min,max) for(int i=(min);i<(max);i++)
#define FOReq(i,min,max) for(int i=(min);i<=(max);i++)
#define FORREV(i,max,min) for(int i=(max)-1;i>=(min);i--)
#define FORREVeq(i,max,min) for(int i=(max);i>=(min);i--)
const int MOD=1e9+7;
const int MOD2=998244353;
const int not0=1;
const int INF=2000000001;
const ll INFll=2e18;
//const int MAX_V=10000;
const double  Micro=1e-5;

int UnUsedVariable(){
    if(INF || Micro || MOD || INFll || MOD2 || not0){;}
    return 0;
}

#define pf printf
#define sf scanf
#define inarray(array,min,max) FOR(i,min,max){cin>>array[i];}
#define inarrayW(arrayA,arrayB,min,max) FOR(i,min,max){cin>>arrayA[i]>>arrayB[i];}
#define br printf("\n");
#define OutputAndReturn0(x) {cout<<(x)<<endl;return 0;}
#define elif else if

#define issame(a,b,c,d) ((a)==(b) and (b)==(c) and (c)==(d))
#define isdiff3(a,b,c) ((a)!=(b) and (b)!=(c) and (c)!=(a))
#define isdiff4(a,b,c,d) ((a)!=(b) and (b)!=(c) and (c)!=(a) and (d)!=(a) and (d)!=(b) and (d)!=(c))
#define Func3(f,a,b,c) (f)((f)((a),(b)),(c))
#define Func4(f,a,b,c,d) (f)((f)((f)((a),(b)),(c)),(d))

inline int isEven(int x){return x%2==0;}
inline int isOdd (int x){return x%2==1;}
inline ll  gcd(ll a,ll b){ if(b==0)return a;else return gcd(b,a%b);}//最大公約数 なお一方が0なら答えは他方になるので番兵は０で良い また、負の数もOK -4%3=-1となるため
inline ll  lcm(ll a,ll b){return a*b/gcd(a,b);}//MODやオーバーフローには注意！
//inline ll  ceil(double a){return (ll)a+1;}
//ans = accumulate(A, A+N, 0, [](int a, int b) {return gcd(a,b);});

//Eと名のつくのはデバッグ用！
int EintN(ll array[],const ll num){
    for(int i=0;i<num;i++){cerr<<array[i]<<" ";}
    br;
    return 0;
}
int EintNN(const int heighth,const int width,int array[heighth][width]){
    FOR(i, 0, heighth){
        FOR(k, 0, width){
            {cerr<<array[i][k]<<" ";}
        }
        br;
    }
    br;
    return 0;
}
int Eint(string str,const ll num){
    cerr<<str<<" is "<<num<<" now."<<endl;
    return 0;
}













int prob(){
    ll ans;ans=0;
    ll N,K;
    cin>>N>>K;
    ll h[N];
    inarray(h, 0, N);
    
    sort(h,h+N);
    
    ll minimam=INF;
    FOR(i, 0, N-K+1){
        minimam=min(minimam,h[i+K-1]-h[i]);
    }
    
    
    OutputAndReturn0(minimam);
    return 0;
}


signed main(){
    prob();
    return 0;
}


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

int main()
{
    int n;
    int t=0,h=0;
    string taro,hanako;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> taro >> hanako;
        if(taro>hanako) t+=3;
        else if(taro<hanako) h+=3;
        else{
            t++;h++;
        }
    }
    cout << t << " " << h << endl;
    return 0;
}



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

int main(){
    int n,m;
    cin >> n;
    vector<ll> t(n);
    rep(i,n) cin >> t[i];
    cin >> m;
    vector<ll> p(m),x(m);
    rep(i,m) cin >> p[i] >> x[i];
    vector<ll> b;
    rep(i,m){
        int sum = 0;
        b = t;
        b[p[i]-1] = x[i]; 
        rep(j,n){
            sum += b[j];
        }
        cout << sum << endl;
    }
}

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

    private static void solver(InputReader sc, PrintWriter out) throws Exception {
       String s = sc.next();
       String t = sc.next();
       int count=0;
       for(int i=0; i<s.length(); i++){
           if(s.charAt(i)!=t.charAt(i)) count++;
       }
       out.print(count);
    }
    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solver(in, out);
        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}
class Pair implements Comparable<Pair> {
    int x, y;

    Pair(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public int compareTo(Pair p) {
        return (this.y - p.y);
    }
}
class Tuple {
    String s;
    int x, y;

    public Tuple(String s, int x, int y) {
        this.s = s;
        this.x = x;
        this.y = y;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Tuple tuple = (Tuple) o;
        return x == tuple.x &&
                y == tuple.y &&
                s.equals(tuple.s);
    }

    @Override
    public int hashCode() {
        return Objects.hash(s, x, y);
    }
}

Measured memory_bytes: 37888
//problem_a.go

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	//"strings"
)

const (
	mod = int(1e9) + 7
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

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

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getIntSlice(n int) []int {
	ns := []int{}
	for i := 0; i < n; i++ {
		ns = append(ns, getInt())
	}
	return ns
}

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

func getStringSlice(n int) []string {
	ss := []string{}
	for i := 0; i < n; i++ {
		ss = append(ss, getString())
	}
	return ss
}

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

// Sort Fanction

func sortIntSlice(ns []int) []int {
	sort.Sort(sort.IntSlice(ns))
	return ns
}

func rsortIntSlice(ns []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(ns)))
	return ns
}

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

// Num Fanction

//numModPow(a, n, m) == a^n % m
func numModPow(a int, n int, m int) int {
	result := 1

	for n > 0 {
		if n%2 == 1 {
			result = (result * a) % m
		}

		a = (a * a) % m
		n >>= 1
	}

	return result
}

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

	return numGcd(b, a%b)
}

// numLcm(a, b) == lcm(a, b)
func numLcm(a int, b int) int {
	return a * b / numGcd(a, b)
}

// numModInv(a, p) == a^(-1) % p
func numModInv(a int, p int) int {
	if a == 1 {
		return 1
	} else {
		return p - numModInv(p%a, p)*(p/a)%p
	}
}

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

func solve() {

	n := getInt()
	m := getInt()

	fmt.Fprintln(wr, (n*(n-1)+m*(m-1))/2)
}

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

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}


Measured memory_bytes: 640
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

import heapq


class PriorityQueue:
    class Reverse:
        def __init__(self, val):
            self.val = val

        def __lt__(self, other):
            return self.val > other.val

        def __repr__(self):
            return repr(self.val)

    def __init__(self, x=None, desc=False):
        if not x:
            x = []
        if desc:
            for i in range(len(x)):
                x[i] = self.Reverse(x[i])
        self._desc = desc
        self._container = x
        heapq.heapify(self._container)

    @property
    def is_empty(self):
        return not self._container

    def pop(self):
        if self._desc:
            return heapq.heappop(self._container).val
        else:
            return heapq.heappop(self._container)

    def push(self, item):
        if self._desc:
            heapq.heappush(self._container, self.Reverse(item))
        else:
            heapq.heappush(self._container, item)

    def top(self):
        if self._desc:
            return self._container[0].val
        else:
            return self._container[0]

    def sum(self):
        return sum(self._container)

    def __len__(self):
        return len(self._container)


def main():
    n = int(readline())
    a = list(map(int, readline().split()))

    first = a[:n]
    second = a[n:2 * n]
    third = a[2 * n:3 * n]

    first_max = [0] * (n + 1)
    third_min = [0] * (n + 1)

    first_max[0] = sum(first)
    third_min[0] = sum(third)

    pq_first = PriorityQueue(first)
    cur = first_max[0]
    for i, x in enumerate(second, 1):
        if pq_first.top() < x:
            cur -= pq_first.pop()
            cur += x
            pq_first.push(x)
        first_max[i] = cur

    pq_third = PriorityQueue(third, desc=True)
    cur = third_min[0]
    for i, x in enumerate(second[::-1], 1):
        if pq_third.top() > x:
            cur -= pq_third.pop()
            cur += x
            pq_third.push(x)
        third_min[i] = cur

    ans = -INF
    for i in range(n + 1):
        fi_idx = i
        th_idx = n - i
        ans = max(ans, first_max[fi_idx] - third_min[th_idx])

    print(ans)


if __name__ == '__main__':
    main()


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

#define what_is(x) cerr << #x << " is " << x << endl;
#define what_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << e << ' '; cerr << '\n'; //vector, set
#define what_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << x[i] << ' '; cerr <<  '\n'; //n first element of array
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define cerr_pair(x) '{' << x.st << ", " << x.nd << '}'
#define pwhat_is(x) cerr << #x << " is " << cerr_pair(x) << endl;
#define pwhat_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << cerr_pair(e) << ' '; cerr << '\n'; //vector, set
#define pwhat_is_a(x, n) cerr << #x << " is "; for(int i=0;i<n;i++) cerr << cerr_pair(x[i]) << ' '; cerr <<  '\n'; //n first element of array
#define endl '\n'
#define int long long

typedef pair<int,int> pii;
const int N = 1e5+5;
const int INF = 1e9;
const int MOD = 1e9+7;

int l, r;

int32_t main()
{
	IOS
	//freopen("input.txt", "r", stdin);
	cin >> l >> r;
	if (r-l+1 >= 2019) return 0*puts("0");
	int ans = 2019;
	for(int i=l; i<r; i++){
		for(int j=i+1; j<=r; j++){
			ans = min(ans, (i*j) % 2019);
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<queue>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int> >;
using pii = pair<int, int>;
using ppi = pair<pii, int>;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  string s, t; cin >> s >> t;
  int ans = 0;
  for(int i = 0; i < s.length(); i++){
    if(s[i] != t[i]) ans++;
  }
  cout << ans << endl;

  // end-----------------------------------------------
  // cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}


Measured memory_bytes: 3856
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <unordered_map>
#include <stack>
#include <queue>

using namespace std;

long long MOD = 1e9 + 7;

void dfs(int thisNode, int parent, vector<vector<int>>& graph, vector<int>& c) {
    for (auto nextNode : graph[thisNode]) {
        if (nextNode == parent) {
            continue;
        }
        c[nextNode] += c[thisNode];
        dfs(nextNode, thisNode, graph, c);
    }
}

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

    int h, w, a, b;
    cin >> h >> w >> a >> b;
    
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            if ((i < b && j < a) 
                || (b <= i && a <= j)) 
            {
                cout << 0;
            }
            else {
                cout << 1;
            }
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 1280
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
 
using namespace std;

int main()
{
	int n;
	cin>>n;
	int colorScore[9] = {400,800,1200,1600,2000,2400,2800,3200,5000};
	int scorePeople[9] = {0};
	for(int i = 0; i < n;i++){
		int a;
		cin>>a;
		for(int j = 0; j < 9; j++){
			if(a < colorScore[j]){
				scorePeople[j]++;
				break;
			}
		}
	}
	int emptyClassCount = 0;
	for(int i = 0; i < 8; i++){
		if(scorePeople[i] == 0) emptyClassCount++;
	}
	int minNum = max(1,8-emptyClassCount);
	int maxNum = 8 - emptyClassCount + scorePeople[8];
	cout<< minNum<<" "<<maxNum<<endl;
	return 0;
}

Measured memory_bytes: 256