akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
using namespace std;

typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef long long ll;
typedef long double ld;

#define rep(i,x) for(int i = 0 ; i < x ; i ++)
#define rep1(i,x) for(int i = 1 ; i <= x ; i ++)
#define rrep(i,x) for(int i = x-1 ; i >= 0 ; i --)
#define rrep1(i,x) for(int i = x ; i > 0 ; i --)
#define fr first
#define sc second
#define pb push_back

string f(string s){
	string t = "";
	for(int i = 0 ; i+1 < s.size() ; ++i){
		t += s[i];
	}
	return t;
}

string ans = "";
int a = 0 , b = 0;
void dfs(int j,int y){
	if(a == j && b == y){
		cout << ans << endl;
		return;
	}
	if(a >= 5 && b <= 3)return;
	if(a <= 3 && b >= 5)return;
	if(a < j){
		ans += 'A';
		a ++;
		dfs(j,y);
		ans = f(ans);
		a --;
	}
	if(b < y){
		ans += 'B';
		b ++;
		dfs(j,y);
		ans = f(ans);
		b --;
	}
}

int main(){
	int j,y;
	scanf("%d%d",&j,&y);
	dfs(j,y);
}

Measured memory_bytes: 1224
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

const int MAX_COMB = 200010;
const LL mod = 1e9 + 7;
LL fct[MAX_COMB+1];
LL invfct[MAX_COMB+1];

void build(){
	fct[0] = fct[1] = 1;
	repp(i,2,MAX_COMB+1){
		fct[i] = fct[i-1] * i % mod;
	}
	LL x = fct[MAX_COMB];
	invfct[MAX_COMB] = 1;
	for(int i = mod - 2 ; i > 0 ; i >>= 1){
		if(i % 2 == 1) (invfct[MAX_COMB] *= x) %= mod;
		(x *= x) %= mod;
	}
	repm(i,MAX_COMB,0){
		invfct[i-1] = invfct[i] * i % mod;
	}
}

const int UF_MAX = 200010;

class UF{
	int x[UF_MAX];
	
public:
	
	UF(){
		fill(x,x+UF_MAX,-1);
	}
	
	int boss(int a){
		int s = a;
		while(x[s] > -1) s = x[s];
		if(s != a) x[a] = s;
		return s;
	}
	
	void uni(int a , int b){
		int s = boss(a);
		int t = boss(b);
		if(s != t){
			if(x[s] < x[t]){
				x[s] += x[t];
				x[t] = s;
			} else {
				x[t] += x[s];
				x[s] = t;
			}
		}
	}
	
	bool find(int a , int b){
		return boss(a) == boss(b);
	}
	
	int member(int a){
		return -x[boss(a)];
	}
} uf;

int N,X,Y;
vector<P2> W[200010];
vector<int> V[200010];
P2 ball[200010];
int s[200010];
int b[200010];

int main(){
	build();
	scanf("%d%d%d" , &N , &X , &Y);
	repp(i,0,N){
		int c,w;
		scanf("%d%d" , &c , &w);
		W[c].PB(MP(w,i));
		ball[i] = MP(c,w);
		s[i] = i;
	}
	repp(i,1,N+1){
		if(W[i].size() < 2) continue;
		sort(W[i].begin() , W[i].end());
		int d = 1;
		while(W[i].size() > d && W[i][0].first + W[i][d].first <= X) uf.uni(W[i][0].second,W[i][d++].second);
	}
	sort(s,s+N,[&](const int x , const int y){return ball[x].second < ball[y].second;});
	int r = -1;
	repp(i,1,N){
		if(ball[s[i]].second + ball[s[0]].second > Y) break;
		if(ball[s[i]].first == ball[s[0]].first) continue;
		uf.uni(s[i],s[0]);
		if(r < 0) r = s[i];
	}
	if(r >= 0){
		for(auto e : W[ball[s[0]].first]){
			if(ball[r].second + e.first > Y) break;
			uf.uni(r,e.second);
		}
	}
	LL ans = 1;
	repp(i,0,N){
		b[i] = uf.boss(i);
		if(b[i] == i) (ans *= fct[uf.member(i)]) %= mod;
		V[b[i]].PB(ball[i].first);
	}
	repp(i,0,N){
		if(V[i].size() == 0) continue;
		sort(V[i].begin(),V[i].end());
		int p = 0 , q = 1;
		repp(j,1,V[i].size()){
			if(V[i][j] == V[i][p]){
				++q;
			} else {
				(ans *= invfct[q]) %= mod;
				q = 1;
				p = j;
			}
		}
		(ans *= invfct[q]) %= mod;
	}
	printf("%lld\n" , ans);
	return 0;
}


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

struct Node{
	int id;
	int depth;
	int height;
	Node *parent;
	vector<Node*> childs;

    bool operator<( const Node& param ) const {
        return id < param.id;
    }
};
Node *nil;

list<int> ids;
map<int, list<int>> getChilds;
vector<Node> vectored;

void flat(Node* node){
	vectored.push_back(*node);
	for(Node* tmp : node->childs){
		flat(tmp);
	}
}

void conChilds(Node *node){
	for(int childId : getChilds[node->id]){
		Node *child = new Node();
		child->id = childId;
		child->depth = node->depth + 1;
		child->parent = node;
		(node->childs).push_back(child);
		conChilds(child);
	}

	int maxHeight = -1;
	for(Node *child : node->childs){
		maxHeight = max(maxHeight, child->height);
	}
	node->height = maxHeight+1;
}

int main(){
	int n, id, k, t, maxId = 25;
	cin >> n;

	r(i, n){
		cin >> id;
		ids.push_back(id);
		list<int> childs;
		maxId = max(maxId, id);

		cin >> t;
		if(t != -1) childs.push_back(t);
		cin >> t;
		if(t != -1) childs.push_back(t);

		getChilds[id] = childs;
	}

	//search root
	bool isRoot[maxId+1]{};
	for(int id : ids){
		isRoot[id] = true;
	}
	for(int id : ids){
		for(int childId : getChilds[id]){
			isRoot[childId] = false;
		}
	}
	int rootId = -1;
	r(i, maxId+1){
		if(isRoot[i]){
			rootId = i;
			break;
		}
	}
	if(rootId == -1)
		printf("root couldn't be found");

	Node *root = new Node();
	root->id = rootId;
	root->depth = 0;
	root->parent = nil;

	conChilds(root);

	flat(root);
	sort(vectored.begin(), vectored.end());

	for(Node node : vectored){
		//node 0: parent = -1, sibling = -1, degree = 2, depth = 0, height = 3, root
		cout << "node " << node.id << ": ";
		cout << "parent = " << (node.parent == nil ? -1 : node.parent->id) << ", ";
		int siblingId = -1;
		if(node.parent != nil){
			for(Node *tmp : node.parent->childs){
				if(tmp->id != node.id){
					siblingId = tmp->id;
					break;
				}
			}
		}
		cout << "sibling = " << siblingId << ", ";
		cout << "degree = " << node.childs.size() << ", ";
		cout << "depth = " << node.depth << ", ";
		cout << "height = " << node.height << ", ";
		k = node.childs.size();
		if(node.parent == nil){
			cout << "root\n";
		}else if(k == 0){
			cout << "leaf\n";
		}else{
			cout << "internal node\n";
		}
	}

	return 0;
}


Measured memory_bytes: 3148
#include <stdio.h>

int main(void){
	for(;;){
		int h, w, i, j;

		scanf("%d %d", &h, &w);
		if(h == 0 && w == 0)
			break;

		for(i = 0; i < h; i++){
			for(j = 0; j < w; j++)
				putchar(i%(h-1) && j%(w-1) ? '.' : '#');
			putchar('\n');
		}
		putchar('\n');
	}
}



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

int gcd(int a, int b) { if (!b)return a; return gcd(b, a%b); }
int main() {
	int p, q; cin >> p >> q;
	q /= gcd(p, q);
	map<int, int>m;
	for (int i = 2; i*i <= q; i++) {
		while (q%i == 0) {
			m[i]++; q /= i;
		}
	}
	if (q != 1)m[q] = 1;
	int c = 1;
	for (auto i : m) {
		c *= i.first;
	}
	cout << c << endl;
}

Measured memory_bytes: 3100
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Calc calc = new Calc();
		calc.abc121B();
	}
}

class Calc {
	void abc121B() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int c = sc.nextInt();
		int sum = 0,count = 0;
		int[] b = new int[m];
		for(int i=0 ; i < m ; i++) {
			b[i] = sc.nextInt();
		}
		int[][] code = new int[n][m];
		for(int i=0 ; i<n ; i++) {
			for(int j=0 ; j<m ; j++) {
				code[i][j] = sc.nextInt();
			}
		}
		
		for(int i=0 ; i<n ; i++) {
			for(int j=0 ; j<m ; j++) {
				sum += b[j] * code[i][j];
			}
			if(sum+c >0) {
				count ++;
			}
          sum = 0;
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 25300
#include <iostream>
#define ll long long
using namespace std;
ll k[200];
int main()
{
    ll n;
    cin >> n;
    for (ll i = 0; i < 200; i++) {
        k[i] = i * i * i * i * i;
        for (ll j = 0; j < i; j++) {
            if (k[i] - k[j] == n) {
                cout << i << " " << j;
            }
            else if (k[i] + k[j] == n) {
                cout << i << " " << -j;
            }
        }
    }
}

Measured memory_bytes: 3588
program c
implicit none

integer :: i, n, k, q, aa
integer,allocatable,dimension(:) :: A

read(*,*) n, k, q

allocate(A(N))
A = k-q

do i = 1, q
read(*,*) aa
A(aa) = A(aa) + 1
end do

do i = 1, n
 if (A(i)<=0) then
 write(*,'(a2)') "No"
 else
 write(*,'(a3)') "Yes"
 end if
end do

end program


Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define rep0(i,n) for (int i=0; i<=(int)(n); ++i)
#define rep1(i,n) for (int i=1; i<=(int)(n); ++i)
#define rrep(i,n) for (int i=(int)(n)-1; i>=0; --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
template<typename T> using Graph = vector<vector<T>>;
template<typename T> using Spacial = vector<vector<vector<T>>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int MOD = 1e9+7;
const int MOD2 = 998244353;
const double EPS = 1e-9;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

template<typename T> struct is_pair : false_type{};
template<typename T1, typename T2> struct is_pair<pair<T1, T2>> : true_type{};
template<typename T> struct is_vector : false_type{};
template<typename T> struct is_vector<vector<T>> : true_type{};

template<typename T1, typename T2>
istream &operator >> (istream &istr, pair<T1, T2> &p) {
  istr >> p.first >> p.second;
  return istr;
} 
template<typename T1, typename T2>
ostream &operator << (ostream &ostr, const pair<T1, T2> &p) {
  ostr << p.first << " " << p.second;
  return ostr;
}
template<typename T>
ostream &operator << (ostream &ostr, const vector<T> &vec) {
  if (vec.empty()) return ostr;
  bool vp = is_vector<T>() || is_pair<T>();
  ostr << vec.front();
  for (auto itr = ++vec.begin(); itr != vec.end(); ++itr) {
    ostr << (vp ? "\n" : " ") << *itr;
  }
  return ostr;
}

template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

int modpow(int a, long long n, int mod = MOD) {
  int ret = 1;
  do {
    if (n & 1) ret = 1LL * ret * a % mod;
    a = 1LL * a * a % mod;
  } while (n >>= 1);
  return ret;
}

template<typename T>
T GCD(T a, T b) { return b ? GCD(b, a%b) : a; }
template<typename T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

template<typename T1, typename T2>
bool CompareBySecond(pair<T1, T2> a, pair<T1, T2> b) {
  return a.second != b.second ? a.second < b.second : a.first < b.first;
}
template<typename T>
bool CompareBySlope(pair<T, T> a, pair<T, T> b) {
// counterclockwise from 12 o'clock direction
  if (a.first * b.first < 0) return a.first < b.first;
  if (a.first == 0) return a.second >= 0 || b.first > 0;
  if (b.first == 0) return b.second < 0 && a.first < 0;
  return a.second * b.first < a.first * b.second;
}


/* -------- <templates end> -------- */


void solve() {
  string s; cin >> s;
  if (s[0] == s[1] && s[1] == s[2]) cout << "No\n";
  else cout << "Yes\n";
}


/* -------- <programs end> -------- */


signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);
  solve();
  return 0;
}


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

//#define int int64_t

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)

#define all(c) begin(c), end(c)
#define maxup(ans, x) (ans = (ans < x ? x : ans))
#define minup(ans, x) (ans = (ans > x ? x : ans))

#define breakif(cond) if(cond) break; else

template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }

using VV = vector<vector<int>>;
using V = vector<int>;
using P = pair<int, int>;
using IP = pair<int, P>;

signed main() {
	int n; 
	while (cin >> n && n) {
		V v(n); input(v);
		cout << (accumulate(all(v), 0) - *max_element(all(v)) - *min_element(all(v))) / (n - 2) << endl;
	}
}

Measured memory_bytes: 3072
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;


static class P
{
    static void Main()
    {
        var nm = Console.ReadLine().Split().Select(int.Parse).ToList();

        var hoge =  Enumerable.Repeat(0, nm[0]).Select(_ => Console.ReadLine().Split().Select(long.Parse).ToList()).OrderBy(x => x[0]).ToList();
        long count = nm[1];
        long res = 0;
        foreach (var item in hoge)
        {
            res += Min(count, item[1]) * item[0];
            count -= Min(count, item[1]);
        }
        Console.WriteLine(res);
    }
}


Measured memory_bytes: 30712
#include<iostream>
#include<stdio.h>
#include<cctype>
#include<string>

using namespace std;

int main()
{
  string str;
  while(1){
    cin>>str;
    int sum=0;
    if(str[0]-'0'==0)return 0;
    for(int i=0;i<str.length();i++){
      sum+=str[i]-'0';
    }
    cout<<sum<<endl;
  }
}



Measured memory_bytes: 3164
#include <cstdio>
#include <algorithm>

int main()
{
	int n, m;
	long long k;
	long long a[200001], b[200001];
	scanf("%d%d%lld", &n, &m, &k);
	a[0] = 0;
	b[0] = 0;
	for (int i = 0; i < n; ++i)
	{
		scanf("%lld", a + i + 1);
		a[i + 1] += a[i];
	}
	for (int i = 0; i < m; ++i)
	{
		scanf("%lld", b + i + 1);
		b[i + 1] += b[i];
	}
	int ans = 0;
	for (int i = 0; i <= n; ++i)
	{
		long long t = a[i];
		if (t > k)
		{
			break;
		}
		long long j = std::upper_bound(b, b + m + 1, k - t) - b;
		if (ans < i + j - 1)
		{
			ans = i + j - 1;
		}
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 4852
#include<iostream>

#define INF 12345678
using namespace std;


int main() {
	int n, m, x;
	int c[12];
	int a[12][12];
	int i, j, k, l;
	
	int knowledge[12] = { 0 };

	int buy_bool[12];

	int expo_n, i_tmp, price_sum, price_min;

	bool archive_flg = true;

	price_min = INF;

	cin >> n >> m >> x;

	for (i = 0; i < n; i++) {
		cin >> c[i];
		for (j = 0; j < m; j++) cin >> a[i][j];
	}
	expo_n = 1;
		for (i = 0; i < n; i++) expo_n *= 2;
	
	for (i = 1; i < expo_n; i++) {
		i_tmp = i;
		for (j = 0; j < n; j++) {
			buy_bool[j] = 0;
			buy_bool[j] = i_tmp % 2;
			i_tmp /= 2;
		}

		for(j = 0; j < m; j++) knowledge[j] = 0;

		price_sum = 0;
		for (j = 0; j < n; j++) {
			if (buy_bool[j] != 0) {
				price_sum += c[j];
				for (k = 0; k < m; k++) knowledge[k] += a[j][k];	
			}
		}

		
		archive_flg = true;
		for (j = 0; j < m; j++) {
			if (knowledge[j] < x) {
				archive_flg = false;
			}
		}
		
		if (archive_flg && price_min > price_sum) {
			price_min = price_sum;
		}
	}

	if(price_min == INF) cout << -1 << endl;
	else cout << price_min << endl;
	return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>
#include <tuple>
#include <array>

// BEGIN CUT HERE
#ifdef _MSC_VER
#include <agents.h>
#endif
// END CUT HERE 

#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) begin(v), end(v)
#define REV(v) rbegin(v), rend(v)
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define MP make_pair
#define MT make_tuple
#define X first
#define Y second

using namespace std;

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

int d[20];
string s, t;

int n;
int dfs(int i){
	if (i == n) return 0;
	int tmp = i > 0 ? d[i-1] : 0;
	d[i] += tmp;
	int x = (t[i] - d[i] - s[i] + 1000)%10;
	int res = 1000;
	if(!x) res = dfs(i + 1);
	else for (int j = i; j < n; ++j){
		d[i] += x, d[j+1] -= x;
		res = min(res, dfs(i + 1)+1);
		d[i] -= x, d[j+1] += x;
	}
	d[i] -= tmp;

	return res;
}

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

	while (cin >> n, n){
		cin >> s >> t;
		rep(i, n) s[i] -= '0', t[i] -= '0';
		cout << dfs(0) << '\n';
	}

	return 0;
}

Measured memory_bytes: 1200
#include<bits/stdc++.h>
#define reg register
typedef long long ll;
using namespace std;
const int MN=2e5+5;
int n,a[MN],s[MN],d[MN];
int main(){
	scanf("%d",&n);
	for(reg int i=1;i<=n;i++)scanf("%d",a+i);
	s[1]=d[1]=a[1];
	for(reg int i=2;i<=n;i++)s[i]=s[i-1]+a[i],d[i]=d[i-1]^a[i];
	ll ans=0;
	for(reg int p1=1,p2=1;p2<=n;p2++){
		while((s[p2]-s[p1-1])^d[p2]^d[p1-1])p1++;
		ans+=(p2-p1+1);
	}
	cout<<ans<<endl;
	return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;
using Pl = pair<ll, int>;

void Main() {
	int n;
	cin >> n;
    vll a(n), b(n);
    rep(i, n){
        cin >> a[i] >> b[i];
    }
    
    ll ans = 0;
    rep3rev(i, n-1, 0){
        if((a[i] + ans) % b[i] != 0) ans += b[i] - ((a[i] + ans) % b[i]);
    }
    cout << ans << endl;
    return;
}

int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
//#define int long long

string get_id(int p, int x){
    string id = "", sp = to_string(p), sx = to_string(x);
    rep(i,6-sp.size()) id += "0";
    id += sp;
    rep(i,6-sx.size()) id += "0";
    id += sx;
    return id;
}

signed main(){
    int n, m;
    cin >> n >> m;
    map<int, set<pair<int, int>>> cities;
    
    reps(i,1,m){
        int p, y;
        cin >> p >> y;
        cities[p].insert({y,i});
    }
    
    vector<string> ans(m);
    for(auto p : cities){
        int pi = p.first;
        int x = 0;
        for(auto q : p.second){
            x++;
            ans[q.second-1] = get_id(pi, x);
        }
    }
    
    rep(i,m) cout << ans[i] << endl;
}

Measured memory_bytes: 20992
#include <bits/stdc++.h>
#define reg register
#define ll long long
#define vi vector<int>
#define pb push_back
#define SZ(x) (int) x.size()
using namespace std;
const int MAXN = 100;
int n, d[MAXN];
void work() {
  scanf("%d", &n);
  for(reg int i = 1; i <= n; ++i) scanf("%d", &d[i]);
  int ans = 0;
  for(reg int i = 1; i <= n; ++i) for(reg int j = i + 1; j <= n; ++j) ans += d[i] * d[j];
  printf("%d\n", ans);
}
int main() {
  int _ = 1;
  // scanf("%d", &_);
  while(_--) work();
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int a,b,c,n;
  scanf("%d",&n);
  a=n/100;
  b=n%100/10;
  c=n%10;
  printf("%d",a-1?1:9);
  printf("%d",b-1?1:9);
  printf("%d",c-1?1:9);
  return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
    string S,T;
    cin >> S >> T;
    if(S.length() < T.length()){
        cout << "UNRESTORABLE" << endl;
        return 0;
    }

    vector<string> candidates(0);
    for(int i=0;i<=S.length()-T.length();i++){
        bool flag = true;
        rep(j,T.length()){
            if(S[i+j] != '?' && S[i+j] != T[j]){
                flag = false;
                break;
            }
        }
        if(flag){
            string str = S.substr(0,i) + T + S.substr(i+T.length());
            rep(j,str.length()){
                if(str[j]=='?')str[j]='a';
            }
            candidates.emplace_back(str);
        }
    }

    if(candidates.size() == 0){
        cout << "UNRESTORABLE" << endl;
    }else{
        partial_sort(candidates.begin(),candidates.begin()+1,candidates.end());
        cout << candidates[0] << endl;
    }

    /*
    rep(i,candidates.size()){
        cout << candidates[i] << endl;
    }
    */

    return 0;
} 

Measured memory_bytes: 256
let rec count list p =
  match list with
  | [] -> 0
  | first :: rest ->
      if p first then 1 + count rest p else count rest p

let () = Scanf.scanf "%d %d\n" @@ fun n m -> 
  let alist = List.init n (fun _ -> Scanf.scanf " %d" Fun.id) in
  let sum = List.fold_left (+) 0 alist in
  let cnt = count alist (fun elm -> 4*m*elm >= sum) in
  print_endline @@
  if cnt >= m then "Yes" else "No"

Measured memory_bytes: 3704
import numpy as np
from collections import defaultdict
from heapq import heappush, heappop


def djkstra_adj_list(adj_list, src):
    dist = defaultdict(lambda: np.inf)
    dist[src] = 0

    prev = defaultdict(lambda: None)

    queue = []
    heappush(queue, (dist[src], src))

    while len(queue) > 0:
        dist_u, u = heappop(queue)
        vs = adj_list[u]
        for v, weight in vs:
            alt = dist_u + weight
            if alt < dist[v]:
                dist[v] = alt
                prev[v] = u
                heappush(queue, (alt, v))

    return dist, prev


def djkstra_adj_mat(adj_mat, src):
    dist = defaultdict(lambda: np.inf)
    dist[src] = 0

    prev = defaultdict(lambda: None)

    queue = []
    heappush(queue, (dist[src], src))

    while len(queue) > 0:
        dist_u, u = heappop(queue)
        vs = np.argwhere(adj_mat[u] > 0).flatten()
        for v in vs:
            weight = adj_mat[u, v]
            alt = dist_u + weight
            if alt < dist[v]:
                dist[v] = alt
                prev[v] = u
                heappush(queue, (alt, v))

    return dist, prev


def main():
    N = int(input())

    adj_list = [[] for _ in range(N)]

    for _ in range(N-1):
        a, b, c = map(int, input().split())
        a -= 1
        b -= 1
        adj_list[a].append((b, c))
        adj_list[b].append((a, c))

    Q, K = map(int, input().split())
    K -= 1

    dist, prev = djkstra_adj_list(adj_list, K)

    ans = []
    for _ in range(Q):
        x, y = map(int, input().split())
        x -= 1
        y -= 1
        ans.append(dist[x] + dist[y])

    for a in ans:
        print(a)


if __name__ == '__main__':
    main()


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

void count_sort(vector<int>& a,vector<int>& b, int n, int k) {
	vector<int> c(k, 0);
	for (int i = 0; i < n; i++) {
		c[a[i]]++;
	}
	for (int i = 1; i < k; i++) {
		c[i] = c[i] + c[i - 1];
	}
	for (int i = 0; i < n; i++) {
		b[c[a[i]]-1] = a[i];
		c[a[i]]--;
	}
}

int main() {
	int n;
	cin >> n;
	vector<int> a(n), b(n);
	int k = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] > k)
			k = a[i];
	}
	k++;
	count_sort(a, b, n, k);
	for (int i = 0; i < n; i++) {
		if (i) cout << " ";
		cout << b[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 18400
n = int(input())
d,x = map(int, input().split())
a=[]
for i in range(n):
    a.append(int(input()))

ans = 0
for i in a:
    cnt = 0
    days=1
    while days<=d:
        cnt+=1
        days+=i
    ans+=cnt
print(ans+x, flush=True)



Measured memory_bytes: 9044
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int N,X,m,min=10000,count;
  scanf("%d%d",&N,&X);
  for(count=0;count<N;count++){
    scanf("%d",&m);
    X-=m;
    if(min>m){
      min=m;
    }
  }
  if(X>min){
    count=count+X/min;
  }
  printf("%d",count);

}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    while(true)
    {
        val list = readLine()!!.split(" ").map(String::toInt)
        if ((list[0]==0) or (list[1]==0))
        {
            return
        }
        for (j in 1..list[0])
        {
            for (i in 1..list[1])
            {
                if ((i == 1) or (i == list[1]) or (j==1) or (j == list[0]))
                {
                    print('#')
                }
                else
                {
                    print('.')
                }

            }
            println("")
        }
        println("")
    }
}


Measured memory_bytes: 36668
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, x, y) for (int i = x; i < y; i++)
#define FORN(i, x, y) for (int i = x; i <= y; i++)
#define DEC(i, x, y) for (int i = x; i >= y; i--)
#define scan1(X) scanf("%d", &X)
#define scan2(X, Y) scanf("%d%d", &X, &Y)
#define scan3(X, Y, Z) scanf("%d%d%d", &X, &Y, &Z)
#define scan4(X, Y, Z, W) scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define scanl1(X) scanf("%lld", &X);
#define scanl2(X, Y) scanf("%lld%lld", &X, &Y)
#define scanl3(X, Y, Z) scanf("%lld%lld%lld", &X, &Y, &Z)
#define scanl4(X, Y, Z, W) scanf("%lld%lld%lld%lld", &X, &Y, &Z, &W)
#define print1(X) printf("%d\n", X);
#define print2(X, Y) printf("%d %d\n", X, Y);
#define print3(X, Y, Z) printf("%d %d %d\n", X, Y, Z);
#define print4(X, Y, Z, W) printf("%d %d %d %d\n", X, Y, Z, W);
#define printl1(X) printf("%lld\n", X);
#define printl2(X, Y) printf("%lld %lld\n", X, Y);
#define printl3(X, Y, Z) printf("%lld %lld %lld\n", X, Y, Z);
#define printl4(X, Y, Z, W) printf("%lld %lld %lld %lld\n", X, Y, Z, W);
#define max3(X, Y, Z) max(X, max(Y, Z))
#define max4(X, Y, Z, W) max(max(X, Y), max(Z, W))
#define min3(X, Y, Z) min(X, min(Y, Z))
#define min4(X, Y, Z, W) min(min(X, Y), min(Z, W))
#define popcount(X) __builtin_popcount(X)
#define all(x) x.begin(), x.end()
#define size(X) (int)X.size()
#define mp make_pair
#define pb push_back
#define fr first
#define sc second
#define lc(x) 2 * x
#define rc(x) 2 * x + 1
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<ld, ld> pldld;
const long long l_inf = numeric_limits<long long>::max();
const long long l_ninf = numeric_limits<long long>::min();
const int inf = numeric_limits<int>::max();
const int ninf = numeric_limits<int>::min();
const double pi = 1.00 * acos(-1.00);
const double eps = 1e-8;
void cio(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
ll gcd(ll a, ll b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return (a * (b / gcd(a, b))); }
int sq( int x ) {return x * x;}
////////////////////////////////////////////////////////////////////Header
pii getmax ( map<int, int> mp ) {
    pii ret = {0, 0};
    for ( auto it = mp.begin(); it != mp.end(); it++ ) {
        if ( it->sc > ret.sc ) {
            ret = *it;
        }
    }
    return ret;
}

int main () {
    map<int, int> h, w;
    set<pii> p;
    int H, W, M;
    scan3(H, W, M);
    int mxh = 0, mxw = 0;
    FORN(i, 1, M) {
        int a, b;
        scan2(a, b);
        mxh = max(mxh, ++h[a]);
        mxw = max(mxw, ++w[b]);
        p.insert({a, b});

    }
    vector<int> hi;
    for ( auto x : h ) {
        if ( x.sc == mxh ) hi.pb(x.fr);
    }
    vector<int> vi;
    for ( auto x : w ) {
        if ( x.sc == mxw ) vi.pb(x.fr);
    }
    int ans = 0;
    bool check = false;
    for ( auto hii : hi ) for ( auto vii: vi ) {
        if ( p.find({hii, vii}) == p.end() ) {
            ans = mxw + mxh;
            check = true;
            break;
        }
    }
    if ( !check ) ans = mxw + mxh - 1;
    print1(ans);
}

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


def solve(N: int):
    res = (1 + N) * (N / 2)
    print(int(res))


# Generated by 1.1.7.1 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
    solve(N)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, int> P3;
const ll MOD = ll(1e9)+7;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-10;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

ll n, a[MAX_N];

void rec(int i, ll mi, ll ma){ // i回さかのぼったときの最小と最大
    if(i==n){
        cout << mi << " " << ma << endl;
        return;
    }
    mi = ((mi+a[i]-1)/a[i])*a[i];
    ma = (ma/a[i]+1)*a[i]-1;
    if(mi>ma){
        cout << -1 << endl;
        return;
    }
    rec(i+1, mi, ma);
}

int main() {
    cin >> n;
    REP(i,n) cin >> a[i];
    reverse(a,a+n);
    rec(0,2,2);
    return 0;
}


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

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(n); i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a); i<(_loop_int)(b); i++)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1; i>=(_loop_int)(a); i--)

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

#define INF 2e9

int N,i;


int main(){

    scanf("%d",&N);

    double A[N];

    REP(i,N) scanf("%lf",&A[i]);

    double sum = 0.0;
    REP(i,N){
        sum += 1.0 / A[i];
    }

    printf("%lf",1.0 / sum);

    return 0;
}

Measured memory_bytes: 256
import sys
import itertools
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():
    D, G = in_nn()
    p = [0] * D
    c = [0] * D
    for i in range(D):
        a, b = in_nn()
        p[i] = a
        c[i] = b

    comb = itertools.product([0, 1], repeat=D)
    ans = 10**9 + 7

    for com in comb:
        score = 0
        prob = 0
        for i, x in enumerate(com):
            if x == 1:
                prob += p[i]
                score += c[i] + p[i] * 100 * (i + 1)

        for i in range(D - 1, -1, -1):
            if score >= G:
                break
            if com[i] == 0:
                pt = int((G - score) / (100 * (i + 1)) + 0.9999)
                pt = min(pt, p[i] - 1)
                score += pt * 100 * (i + 1)
                prob += pt

        if score >= G:
            ans = min(ans, prob)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9352
package main

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

func main() {
	parseProblem(os.Stdin)
}

func parseProblem(r io.Reader) {
	const (
		initialBufSize = 100000
		maxBufSize     = 1000000
	)
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	n, q := scanInt(sc), scanInt(sc)
	s := scanString(sc)
	culum := make([]int, n+2)
	sum := 0
	for i := 3; i <= n+1; i++ {
		if s[i-2] == 'C' && s[i-3] == 'A' {
			sum++
		}
		culum[i] = sum
	}
	res := []int{}
	for i := 0; i < q; i++ {
		l, r := scanInt(sc), scanInt(sc)
		res = append(res, culum[r+1]-culum[l+1])
	}
	for _, r := range res {
		fmt.Println(r)
	}
	return
}

func resolve(n int) int {
	return n
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 6016
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

using ll = long long;
using ld = long double;
using ull = unsigned long long;

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/


const int N = 210000;

string s;
int dp[N];

ll ans;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cout.setf(ios::fixed), cout.precision(20);
	cin >> s;
	int n = s.size();
	for (int i = n - 1; i >= 0; --i) {
		if (s[i] == 'A') {
			int x = 0;
			int cur = i + 1;
			while (cur + 2 <= n && s[cur] == 'B' && s[cur + 1] == 'C')
				++x, cur += 2;
			if (cur < n && s[cur] == 'A')
				x += dp[cur];
			ans += x;
			dp[i] = x;
		}
	}
	cout << ans << "\n";
	return 0;
}




Measured memory_bytes: 1300
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;


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

    int N;
    cin >> N;
    int A[N];
    long long B[N+1];
    B[0]=0;
    rep(i,N) {
        cin >> A[i];
        B[i+1]=A[i]+B[i];
    }
    long long ans=INFL;
    rep(i,N){
        ans=min(ans,abs(2*B[i]-B[N]));
    }
    cout << ans << endl;


}


Measured memory_bytes: 2560
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#define MAX(X, Y) (((X) > (Y))? (X) : (Y))
#define MIN(X, Y) (((X) < (Y))? (X) : (Y))
int compare_int(const void *a, const void *b){
  return *(long int*)b - *(long int*)a; // 大きい順
}
int compare_int_small(const void *a, const void *b){
  return *(long int*)a - *(long int*)b; // 小さい順
}
// 公約数
long long int gcd(long long int a, long long int b){
  if(b == 0){
    return a;
  }else{
    return gcd(b, a % b);
  }
}
// 最小公倍数 = a * b / 最大公約数
// 公倍数
long long int lcm(long long int a, long long int b){
  return a * b / gcd(a, b);
}

#define TRUE 1
#define FALSE 0
#define LEN 100005

typedef struct q{
  int y;
  int x;
}QUEUE;

//int x = 0;
QUEUE *Q;
//P Q[LEN + 1];
int head = 0;
int tail = 0;
int n;

void initialize(int a){
  head = 0;
  tail = 0;
  Q = (QUEUE *)calloc(a, sizeof(QUEUE));
  if(Q == NULL){
    printf("メモリが確保できません\n");
    exit(EXIT_FAILURE);
  }
}

void finalize(){
  if(Q != NULL){
    free(Q);
    Q = NULL;
  }
}

int isEmpty(){
  if(head == tail){
    return TRUE;
  }else{
    return FALSE;
  }
}

int isFull(){
  if(head == (tail + 1) % LEN){
    return TRUE;
  }else{
    return FALSE;
  }
}

void enqueue(QUEUE x){
  fprintf(stderr, "enqueue() point.y:%d point.x:%d\n", x.y, x.x);
  if(isFull() != FALSE){
      printf("Overfllow\n");
  }else{
    Q[tail] = x;
    if((tail + 1) == LEN){
      tail = 0;
    }else{
      tail++;
    }
  }
}

QUEUE dequeue(){
  QUEUE x;
  //  fprintf(stderr, "-> dequeue\n");
  if(isEmpty() != FALSE){
    printf("Undrtfllow\n");
  }else{
    x = Q[head];
    if((head + 1 == LEN)){
      head = 0;
    }else{
      head++;
    }
  }
  return x;
}


// min
int main(void){
  int n = 0;
  double x = 0;
  
  scanf("%d", &n);

  x = n / 1.08;
  //  printf("%d", (int)x);
  if(n <= (int)x * 1.08 && (int)x * 1.08 < n + 1){
    printf("%d", (int)x);
  }else if(n <= (int)(x + 1) * 1.08 && (int)(x + 1) * 1.08 < n + 1){
    printf("%d", (int)x + 1);
  }else{
    printf(":(");
  }
  printf("\n");
  return 0;

}


Measured memory_bytes: 128
#include <iostream>
#include<sstream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#define  mem memset(a,0,sizeof(a))

const int mo=1000000007;
const int inf=0x3f3f3f3f;

typedef long long ll;
using namespace std;

ll d[100005];
typedef pair<int,int>P;
vector<P>vec[100005];

void dfs(int x,int y)
{
    int n=vec[x].size();
    for(int i=0;i<n;i++)
    {
        if(vec[x][i].first!=y)
        {
            P s=vec[x][i];
            d[s.first]=d[x]+s.second;
            dfs(s.first,x);
        }
    }
}
int main()
{
    int n,m,k,q;
    int i;
    cin>>n;
    int a,b,c;
    for(i=0;i<n-1;i++)
    {
        cin>>a>>b>>c;
        vec[a].push_back(P(b,c));
        vec[b].push_back(P(a,c));
    }
    cin>>q>>k;
    d[k]=0;
    dfs(k,k);
    while(q--)
    {
        cin>>a>>b;

        cout<<d[a]+d[b]<<endl;
    }
    return 0;
}


Measured memory_bytes: 14336
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;




namespace contest
{

    class contest
    {


        static void Main(string[] args)
        {


            //int n = int.Parse(Console.ReadLine());
            //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();



            var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int n = num[0];
            int q = num[1];
            var input = new int[q][];
            for(int i =0; i< q; i++)
            {
                input[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();
            }

            var arr = new int[n+1];
            int len = (int)Math.Sqrt(n) + 1;
            var dicom = new int[len];

            for (int i = 0; i < q; i++)
            {
                int dir = input[i][0];
                int l = input[i][1];
                int r = input[i][2];

                int sum = 0;
                if(dir==0)
                {
                    arr[l] += r;
                    dicom[l / len] += r;
                }
                else
                {
                    
                    for(int j = l; j<= r; )
                    {
                        if(j%len==0 && j+len-1 <= r)
                        {
                            sum += dicom[j/len];
                            j += len;
                        }
                        else
                        {
                            sum += arr[j];
                            j++;
                        }
                    }
                    Console.WriteLine(sum);
                }

            }





        }


        


       


    }


}

Measured memory_bytes: 18464
#include <bits/stdc++.h>
#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using ll = long long;
const int INF = 0x3f3f3f3f;
using namespace std;

int n, m;
int main() {
    //freopen("jumping.in", "r", stdin);
    IOS
    cin >> n >> m;
    if ((n+m)&1) {
        cout << "IMPOSSIBLE" << endl;
    } else {
        cout << ((n+m)>>1) << endl;
    }
    return 0;


}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        long a = sc.nextInt();
        long b = sc.nextInt();
        
        System.out.println(lcm(a, b));
    }

    
    public static long lcm(long m, long n) {
        return m * (n / gcd(m, n));
    }
    
    public static long gcd(long a, long b) {
        if (b == 0) return a;
        
        return gcd(b, a % b);
    }
}


Measured memory_bytes: 23124
import java.util.*;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Collections;
import java.awt.Point;


public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] abc = br.readLine().split(" ");
        int a = Integer.parseInt(abc[0]);
        int b = Integer.parseInt(abc[1]);
        int c = Integer.parseInt(abc[2]);
        
        System.out.println(a*b/2);
    }
}



Measured memory_bytes: 22228
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

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

const long long MAX = 5100000;
const long long INF = 1LL << 60;
const long long mod = 1000000007LL;
//const long long mod = 998244353LL;

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

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

	while (1) {
		ll n, m; scanf("%lld %lld", &n, &m);
		if (n == 0 && m == 0) break;
		vector<ll> a(n); for (ll i = 0; i < n; i++) scanf("%lld", &a[i]);
		vector<ll> b(m); for (ll i = 0; i < m; i++) scanf("%lld", &b[i]);
		ll sum1 = 0;
		ll sum2 = 0;
		for (ll i = 0; i < n; i++) {
			sum1 += a[i];
		}
		for (ll i = 0; i < m; i++) {
			sum2 += b[i];
		}
		if ((sum1 + sum2) & 1) {
			puts("-1");
			continue;
		}
		ll sa = (sum1 - sum2) / 2;
		ll tmp = INF;
		ll res1 = -1, res2 = -1;
		for (ll i = 0; i < n; i++) {
			for (ll j = 0; j < m; j++) {
				if (a[i] - b[j] == sa) {
					if (chmin(tmp, a[i] + b[j])) {
						res1 = a[i];
						res2 = b[j];
					}
				}
			}
		}
		if (tmp == INF) {
			puts("-1");
		}
		else printf("%lld %lld\n", res1, res2);
	}
	return 0;
}



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

using namespace std;
#define ll  long long
#define ld  long double

#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int MAXN=1e5 + 5;
bool comp(pair<int,int>p1,pair<int,int>p2)
{
    return p1.second<p2.second;
}
ll gcd (ll a,ll b)
{
    if(a==0)
        return b;
    return gcd(b%a,a);
}
ll lcm(ll a, ll b)
{
    return (a*b)/gcd(a, b);
}

int main()
{
    FAST
int a,b,c,d;
cin>>a>>b>>c>>d;
if(max(a,b)<min(c,d) || max(c,d)<min(a,b))
    return cout<<0,0;
int ans1=max(a,c);
int ans2=min(b,d);
cout<<abs(ans1-ans2)<<endl;

    return 0;

}


Measured memory_bytes: 256
#include<stdio.h>

int getnumber(num){
	int x, sum, MAX, MIN, i;
	scanf("%d",&x);
	MAX = x;
	MIN = x;
	sum = x;
	for(i=1; i<num; i++){
		scanf("%d",&x);
		if(MAX <= x)
			MAX = x;
		else if(x <= MIN)
			MIN = x;
		sum += x;
	}
	return (sum -MAX -MIN)/(num-2);
}

int main(){
	int n, s;
	while(1){
		scanf("%d", &n);
		if(n == 0)
			return 0;
		s = getnumber(n);
		printf("%d\n",s);
	}
	return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
char a[100][100];
bool zlm[100][100];
int length,width,cnt;
bool ok=false;
void dfs(int x,int y)
{
	if(x==width&&y==length)
	{
		ok=true;
	}
	if(a[x][y+1]=='#')
	{
		if(zlm[x][y+1]==0)
		{
			cnt++;
			zlm[x][y+1]=1;
			dfs(x,y+1);
			return;
		}
	}
	if(a[x+1][y]=='#')
	{
		if(zlm[x+1][y]==0)
		{
			cnt++;
			zlm[x+1][y]=1;
			dfs(x+1,y);
			return;
		}	
	}
}
int main()
{
	scanf("%d%d",&width,&length);
	for(int i=1;i<=width;i++)
	{
		scanf("%s",a[i]+1);
	}
	for(int i=1;i<=width;i++)
	{
		for(int j=1;j<=length;j++)
		{
			if(a[i][j]=='#')
			{
				cnt--;
			}
		}
	}
	cnt++;
	dfs(1,1);
	if(ok==true&&cnt==0)
	{
		printf("Possible");
	}
	else
	{
		printf("Impossible");
	}
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>

int n, l;
int st;
int a[111111];

int main() {
	scanf("%d%d", &n, &l);
	st=-1;
	for(int i=0;i<n;i++) {
		scanf("%d", &a[i]);
		if(i && a[i]+a[i-1]>=l) st=i-1;
	}
	if(st<0) printf("Impossible\n");
	else {
		printf("Possible\n");
		for(int i=0;i<st;i++) printf("%d\n", i+1);
		for(int i=n-2;i>st;i--) printf("%d\n", i+1);
		printf("%d\n", st+1);
	}
	
	return 0;
}

Measured memory_bytes: 1152
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::str::*;

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

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

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

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

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

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

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

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

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let cin = stdin();
    let cin = cin.lock();
    let s: String = cin
        .bytes() // Bytes
        .map(|c| c.expect("failed reading char") as char)
        .skip_while(|c| c.is_whitespace()) // c が whitespace である限り skip
        .take_while(|c| !c.is_whitespace()) // c が whitespace でない限り要素を返す
        .collect();
    s.parse().ok().expect("failed parsing")
}

fn main() {
    let x : usize = read();
    let y : usize = read();
    let z : usize = read();
    println!("{} {} {}", z, x, y);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;

#define fi first
#define se second
#define eb emplace_back
#define vec vector
#define all(x) x.begin(), x.end()
#define sign(x) max(-1, min(1, x))
#define die(x) { cout << (x); exit(0); }


int const N = 100 * 1000 + 16;
int const M = 1000 * 1000 * 1000 + 7;



int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);

  int n;
  cin >> n;

  vector<vector<ll>> g(n+1, vector<ll>(n+1));
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      cin >> g[i][j];

  auto dp = g;
  for (int k = 1; k <= n; ++k) {
    for (int i = 1; i <= n; ++i) {
      if(i == k) continue;
      for (int j = 1; j <= n; ++j) {
        if(j == i || j == k) continue;
        if(dp[i][k] && dp[k][j])
          dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
      }
    }
  }

  if(not (g == dp))
    return cout << -1, 0;

  ll cost = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = i+1; j <= n; ++j) {
      ll sum = 1;
      for (int k = 1; k <= n; ++k) {
        if(i == k || k == j)
          continue;
        if(g[i][k] + g[k][j] == g[i][j])
          sum = 0;
      }
      cost += sum*g[i][j];
    }
  }

  cout << cost;
}

Measured memory_bytes: 1664
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <map>
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    int c, d, e;
    c = a + b;
    d = a - b;
    e = a * b;
    cout << max(c, max(d, e)) << endl;
}


Measured memory_bytes: 256