akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define INF 1LL<<50
#define fst first
#define snd second
#define pb push_back
#define int long long
#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(int itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(int itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define debug(x)  cout << #x << " = " << (x) << endl;
typedef long long ll;
typedef pair<ll,ll> P;

int gcd(int a,int b){
  int x = a * b;
  if(a<b){
    int tmp = a;
    a = b;
    b = tmp;
  }
  int r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return x/b;
}

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

  int n,k;
  cin >> n >> k;
  
  int a[n];
  int maxi = 0;
  REP(i,n){
    cin >> a[i];
    maxi = max(maxi,a[i]);
  }
  
  int g = 0;
  REP(i,n){
    g = __gcd(g,a[i]);
  }
  
  if(k % g == 0 && k <= maxi) cout << "POSSIBLE" << endl;
  else						  cout << "IMPOSSIBLE" << endl;

  return 0;
}

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

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

    int t = N;
    int s = 0;
    while (t > 0)
    {
        s += t % 10;
        t /= 10;
    }
    if (N % s == 0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ii pair<int, int>
#define pll pair<ll, ll>
#define N 200123
#define vi vector<int>
#define vii vector<ii>
#define vll vector<ll>
#define vpll vector<pll>
#define pb emplace_back
#define fs first
#define sc second
#define sz(x) ((int)((x).size()))
#define oo 1000000123
#define mod 1000000007LL
#define M 10000123

using namespace std;

int n, m;
int pai[N], dist[N];
vi adj[N];
queue<int> q;

int main(){
    ios_base::sync_with_stdio(0);
    scanf(" %d %d", &n, &m);
    int u, v;
    for(int i = 0; i < m; ++i){
        scanf(" %d %d", &u, &v);
        adj[u].pb(v);
        adj[v].pb(u);
    }
    
    for(int i = 1; i <= n; ++i){
        dist[i] = oo;
        pai[i] = i;
    }
    q.push(1);
    dist[1] = 0;
    while(!q.empty()){
        u = q.front();
        q.pop();

        for(int v : adj[u]){
            if(dist[v] == oo){
                dist[v] = dist[u] + 1;
                pai[v] = u;
                q.push(v);
            }
        }
    }
    for(int i = 1; i <= n; ++i){
        if(dist[i] == oo){
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    for(int i = 2; i <= n; ++i) printf("%d\n", pai[i]);
    return 0;
}


Measured memory_bytes: 13444
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int, int>
#define p3i pair<pii, int>
#define pll pair<ll, ll>
#define p3l pair<pll, ll>
#define lseg L, (L+R)/2, N*2+1
#define rseg (L+R)/2+1, R, N*2+2
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define MN 1000000007
#define fox(k, x) for (int k=0; k<x; ++k)
#define fox1(k, x) for (int k=1; k<=x; ++k)
#define foxr(k, x) for (int k=x-1; k>=0; --k)
#define fox1r(k, x) for (int k=x; k>0; --k)
#define ms multiset
#define flood(x) memset(x, 0x3f3f3f3f, sizeof x)
#define drain(x) memset(x, 0, sizeof x)
#define rng() ((rand() << 14)+rand())
#define scan(X) do{while((X=getchar())<'0'); for(X-='0'; '0'<=(_=getchar()); X=(X<<3)+(X<<1)+_-'0');}while(0)
char _;
#define pi 3.14159265358979323846

string s;
int n, p, dp[4][300005];
void add(int&A, int B){
    A=(A+B)%MN;
}
int main(){
    cin >> s;
    n=s.size();
    for(int l=0; l<s.size(); l+=2, ++p){
        if (l==0){
            if (s[l]!='1'){
                dp[0][0]=1;
            }
            if (s[l]!='0'){
                dp[2][0]=1;
            }
            continue;
        }
        if (s[l-1]!='1' && s[l]!='1'){ //case 00
            add(dp[3][p], dp[3][p-1]);
            add(dp[1][p], dp[2][p-1]);
            add(dp[1][p], dp[1][p-1]);
            add(dp[0][p], dp[0][p-1]);
        }
        if (s[l-1]!='1' && s[l]!='0'){ //case 01
            add(dp[3][p], dp[3][p-1]);
            add(dp[2][p], dp[2][p-1]);
            add(dp[2][p], dp[1][p-1]);
            add(dp[0][p], dp[0][p-1]);
        }
        if (s[l-1]!='0' && s[l]!='1'){ //case 10
            add(dp[3][p], dp[3][p-1]);
            add(dp[3][p], dp[2][p-1]);
            add(dp[1][p], dp[1][p-1]);
            add(dp[0][p], dp[0][p-1]);
        }
        if (s[l-1]!='0' && s[l]!='0'){ //case 11
            add(dp[3][p], dp[3][p-1]);
            add(dp[3][p], dp[2][p-1]);
            add(dp[2][p], dp[1][p-1]);
            add(dp[2][p], dp[0][p-1]);
        }
        //cout << dp[0][p] << ' ' << dp[1][p] << ' ' << dp[2][p] << ' '<< dp[3][p] << endl;
    }
    add(dp[2][p-1], dp[3][p-1]);
    printf("%i\n", dp[2][p-1]);
    return 0;
}



Measured memory_bytes: 3844
import sys
input = lambda: sys.stdin.readline().rstrip()

S = input()

f = int(S[:2])
s = int(S[2:])

if (f <= 0 and s > 12) or (f > 12 and s <= 0) or (f <= 0 and s <= 0) or (f > 12 and s > 12):
    print("NA")  
elif (f > 12 and 0 < s <= 12) or (f <= 0 and 0 < s <= 12):
    print("YYMM")
elif (0 < f <= 12 and s > 12) or (0 < f <= 12 and s <= 0):
    print("MMYY")
elif 0 < f <= 12 and 0 < s <= 12:
    print("AMBIGUOUS") 

Measured memory_bytes: 62008
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] words = br.readLine().split(" ");
        System.out.println(words[1]+words[0]);
    }
}


Measured memory_bytes: 25256
#include <bits/stdc++.h>
using namespace std;
constexpr int gcd(int a,int b){return b?gcd(b,a%b):a;}

bool isdivisor(int m, int n, int p, int q){
    int check = m*m+n*n;
    int x,y;
    x=m*p+n*q;
    y=m*q-n*p;
    if(gcd(x,y)%check==0){
        return true;
    }else{
        return false;
    }
}

int main(void){
    int i,num;
    cin>>num;
    for(i=0;i<num;i++){
        int m,n,c=0,p,q;
        cin>>m>>n;
        for(p=-141;p<142;p++){
            for(q=-141;q<142;q++){
                if(1<=p*p+q*q && p*p+q*q<20000 && isdivisor(p,q,m,n)){
                    c++;
                }
            }
        }
        if(c==8){
            cout<<'P'<<endl;
        }else{
            cout<<'C'<<endl;
        }
    }
}










Measured memory_bytes: 3032
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int prev = Integer.MAX_VALUE;
        int count = 0;
        for (int i = 0; i < n; i++) {
            int x = sc.nextInt();
            if (x <= prev) {
                count++;
            }
            prev = x;
        }
        System.out.println(count);
        System.out.println(n);
    }
}



Measured memory_bytes: 68792
N = int(input()) 
S = [int(input()) for i in range(N)]
S.sort()
result = sum(S)
if result % 10 != 0:
    ans = result
elif result % 10 == 0:
    for e in S:
        if e % 10 != 0:
            sub = e
            ans = result - sub
            break
        elif e == S[-1]:
            ans = 0
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define maxs(x,y) x = max(x, y)
#define mins(x,y) x = min(x, y)
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    int N;
    cin >> N;
    vector<int> A(N);
    ll sum = 0;
    REP(i, N) {
         cin >> A[i];
        sum += A[i];
    }

    sort(RALL(A));

    int ans = 1;
    sum -= A[0];
    for(int i = 1; i < N; i++) {
        if (A[i-1] <= sum*2) ans++;
        else break;
        sum -= A[i];
    }

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

Measured memory_bytes: 640
# coding:utf-8

INF = float('inf')


def inpl(): return list(map(int, input().split()))


N, K = inpl()
X = inpl()

A = [0]
B = []
for i in range(N):
    if X[i] >= 0:
        A.append(X[i])
    else:
        B.append(-X[i])
B.append(0)
B = B[::-1]

ans = INF
for i in range(K + 1):
    cost = INF
    j = K - i
    if i > len(A) - 1 or j > len(B) - 1: continue

    cost = A[i] + B[j] + min(A[i], B[j])
    ans = min(ans, cost)

print(ans)

Measured memory_bytes: 14484
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static double[] x, y, z, r;

	public static void main(String[] args) {
		while (true) {
			int N = sc.nextInt();
			if (N == 0) break;
			x = new double[N];
			y = new double[N];
			z = new double[N];
			r = new double[N];
			for (int i = 0; i < N; ++i) {
				x[i] = sc.nextDouble();
				y[i] = sc.nextDouble();
				z[i] = sc.nextDouble();
				r[i] = sc.nextDouble();
			}
			ArrayList<Edge> edges = new ArrayList<Edge>();
			for (int i = 0; i < N; ++i) {
				for (int j = 0; j < i; ++j) {
					 edges.add(new Edge(i, j, dist(i, j)));
				}
			}
			Collections.sort(edges);
			UnionFind uf = new UnionFind(N);
			double ans = 0;
			for (Edge e : edges) {
				if(uf.find(e.f, e.t)) continue;
				ans += e.v;
				uf.union(e.f, e.t);
			}
			System.out.printf("%.3f\n", ans);
		}
	}

	static class UnionFind {
		int[] set;

		UnionFind(int n) {
			set = new int[n];
			Arrays.fill(set, -1);
		}

		void union(int a, int b) {
			int rtA = root(a);
			int rtb = root(b);
			if (rtA == rtb) {
				return;
			}
			set[rtA] += set[rtb];
			set[rtb] = rtA;
		}

		boolean find(int a, int b) {
			return root(a) == root(b);
		}

		int root(int a) {
			if (set[a] < 0) {
				return a;
			} else {
				set[a] = root(set[a]);
				return set[a];
			}
		}

		int size(int a) {
			return -set[root(a)];
		}
	}

	static class Edge implements Comparable<Edge> {
		int f, t;
		double v;

		Edge(int f, int t, double v) {
			this.f = f;
			this.t = t;
			this.v = v;
		}

		public int compareTo(Edge o) {
			return Double.compare(this.v, o.v);
		}
	}

	static double dist(int i, int j) {
		double d = Math.sqrt(sq(x[i] - x[j]) + sq(y[i] - y[j]) + sq(z[i] - z[j]));
		return Math.max(0, d - r[i] - r[j]);
	}

	static double sq(double v) {
		return v * v;
	}

}

Measured memory_bytes: 69048
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    char S[] = sc.next().toCharArray();
    Arrays.sort(S);
    System.out.println((S[0] == S[1] && S[1] != S[2] && S[2] == S[3]) ? "Yes" : "No");
  }
}

Measured memory_bytes: 22356
#include<stdio.h>
#include<stdlib.h>

int main(void){
  int N;
  int *p,*q;
  scanf("%d",&N);
  p=calloc(N+1,sizeof(int));
  int i;
  q=calloc(N+1,sizeof(int));
  for(i=2; i<=N; i++)
    scanf("%d",&p[i]);
  
  for(i=2; i<=N; i++){
    q[p[i]]++;
  }
  for(i=1; i<=N; i++)
    printf("%d\n",q[i]);
  free(q);
  free(p);
  return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<vector<int>> a(n, vector<int>(n - 1));
    for (int i = 0; i < n; i++){
        for (int j = 0; j < n - 1; j++) {
            cin >> a[i][j];
            a[i][j]--;
        }
    }
    vector<vector<int>> edge(n * n);
    vector<int> check(n * n, 0);
    for (int i = 0; i < n; i++){
        for (int j = 0; j <= i; j++) check[i * n + j] = 1;
    }
    for (int i = 0; i < n; i++){
        for (int j = 0; j < n - 2; j++){
            int x1 = i;
            int y = a[i][j];
            if (x1 > y) swap(x1, y);
            int x2 = i;
            int z = a[i][j + 1];
            if (x2 > z) swap(x2, z);
            int p = x1 * n + y;
            int q = x2 * n + z;
            edge[p].push_back(q);
            check[q]++;
        }
    }
    vector<int> distance(n * n, 0);
    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
    bool flag = false;
    for (int i = 0; i < n * n; i++){
        if (check[i] == 0) {
            pq.push({0, i});
            flag = true;
        }
    }
    if (!flag){
        cout << - 1 << endl;
        exit(0);
    }
    vector<bool> used(n * n, false);
    while (pq.size()){
        int x = pq.top().first;
        int y = pq.top().second;
        pq.pop();
        if (x != 0 && !used[y]){
            cout << - 1 << endl;
            exit(0);
        }
        if (used[y]) break;
        used[y] = true;
        for (int i = 0; i < edge[y].size(); i++){
            check[edge[y][i]]--;
            distance[edge[y][i]] = max(distance[edge[y][i]], distance[y] + 1);
            pq.push({check[edge[y][i]], edge[y][i]});
        }
    }
    for (int i = 0; i < n; i++){
        for (int j = 0; j <= i; j++) check[i * n + j] = 0;
    }
    for (int i = 0; i < n * n; i++){
        if (check[i] != 0){
            cout << - 1 << endl;
            exit(0);
        }
    }
    int ans = 0;
    for (int i = 0; i < n * n; i++) ans = max(ans, distance[i]);
    cout << ans + 1 << endl;
}

Measured memory_bytes: 57456
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
typedef long long    ll;
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define clr(a,h)          memset(a, (h), sizeof(a))
#define mem(a,h)          memset(a, (h), sizeof(a))
#define F first
#define S second
#define f first
#define s second
#define fore(i, b, e)    for (ll i = (ll)b; i < (ll)e; i++)
#define forr(i, b, e)    for (ll i = (ll)b; i < (ll)e; i++)
ll faster_in(){ll r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -faster_in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
//using namespace __gnu_pbds;
typedef double lldb;
typedef pair<ll, ll>  ii;
typedef vector<ll>     vi;
typedef vector<vi>     vvi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll INF = ll(1e9 + 7);
const lldb PI = acos(-1);
#define tam 320000
const ll MOD=1e9+7;
int ans[tam];
int minval[tam];
int main()
{    
    memset(minval,-1,sizeof minval);
    int n,k,d;
    cin>>n>>k>>d;
    string txt;
    cin>>txt;
    deque<int> cola;
    int maxans=0,lastpos=0;
    map<int,int> cant;
    forr(i,0,txt.size())
    {
        if (txt[i]=='x')continue;
        if (cola.size()==0)
            ans[i]=1,cola.push_back(i);
        else
        {
            while(cola.size()>1)
            {
                int num1=cola[0];
                int num2=cola[1];
                if (i-num1>d && i-num2>d)
                    cola.pop_front();
                else
                    break;
            }
            int num1=cola[0];
            if (i-num1>d)
                ans[i]=ans[num1]+1;
            else
                ans[i]=1;
            cola.push_back(i);
        }
        if (minval[ans[i]]==-1)
            minval[ans[i]]=i;
        maxans=max(maxans,ans[i]);
        if (maxans==ans[i])
            lastpos=i;
    }
    
    if (maxans>k)
    {
        return 0;
    }
    vector<int> respuesta;
    while(1)
    {
        int actval=ans[lastpos];
        if (lastpos==minval[actval])
                respuesta.push_back(lastpos+1);
        if (actval==1)
        {
            break;
        }
        lastpos-=d;
        do
        {   
            lastpos--;
        }while(lastpos>=0 && actval!=ans[lastpos]+1);
    }
    for(int i=respuesta.size()-1;i>=0;i--)
        cout<<respuesta[i]<<endl;
}
// PLUS ULTRA!

Measured memory_bytes: 4600
def main():
    s = str(input())
    n = len(s)
    len1 = int((n-1)/2)
    s1 = s[:len1]
    len2 = int((n+1)/2)
    s2 = s[len2:]
    if (s == s[::-1]) & (s1 == s1[::-1]) & (s2 == s2[::-1]):
            print('Yes')
    else:
        print('No')
        
main()

Measured memory_bytes: 9068
#include<stdio.h>
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(a==b)
	{
		printf("%d\n",c);
		
	}
	else if(a==c)
	{
		printf("%d\n",b);
	}
	else if(b==c)
	{
		printf("%d\n",a);
	}
	
	return 0;
}

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

using ll = long long;

#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)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

struct UnionFind {
  vi parent, rank, count;
  UnionFind(const int nodeSize)
    : parent(nodeSize), rank(nodeSize, 1), count(nodeSize) {
    rep(i, nodeSize) parent[i] = i, count[i] = 1;
  }
  int find(int x) {
    if (parent[x] == x) return x;
    return parent[x] = find(parent[x]);
  }
  void unite(int x, int y) {
    int rx = find(x);
    int ry = find(y);
    if (rx == ry) return;
    if (rank[rx] < rank[ry]) swap(rx, ry);
    parent[ry] = rx;
    count[rx] += count[ry];
    if (rank[rx] == rank[ry]) ++rank[rx];
  }
  bool same(int x, int y) {
    return find(x) == find(y);
  }
  int num(int x) {
    return count[find(x)];
  }
};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  int n, m; std::cin >> n >> m;
  vi p(n); rep(i, n) std::cin >> p[i], p[i]--;
  UnionFind uf(n);
  rep(i, m) {
    int x, y; std::cin >> x >> y; x--, y--;
    uf.unite(x, y);
  }
  int ans = 0;
  rep(i, n) {
    if (p[i] == i || uf.same(p[i], i)) {
      ans++;
      continue;
    }
  }
  std::cout << ans << "\n";
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define x first
#define y second
#define dilemma return puts("-1"), 0

typedef long long LL;

const int MAXN = 1e5 + 10;

int n, sum;
int sz[MAXN], dep[MAXN], head[MAXN];
LL d[MAXN];
struct Edge { int link, to; } e[MAXN << 1];
inline void add(int u, int v) { e[++sum] = (Edge) { v, head[u] }, head[u] = sum; }
std::map <LL, int> mmp;

void dfs(int u, int fa) {
    for (int i = head[u]; i; i = e[i].to) {
        int v = e[i].link;
        if (v == fa) continue;
        dep[v] = dep[u] + 1, dfs(v, u);
    }
}

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) scanf("%lld", d + i), mmp[d[i]] = i, sz[i] = 1;
    int cnt = 0;
    for (auto it = mmp.rbegin(); it != mmp.rend(); ++it) {
        int u = it->y, fa = mmp[it->x + 2 * sz[u] - n];
        if (!fa || u == fa) dilemma;
        add(u, fa), add(fa, u), sz[fa] += sz[u];
        if ((++cnt) == n - 1) break;
    }
    int rt = mmp.begin()->y; dfs(rt, 0);
    LL tot = 0;
    for (int i = 1; i <= n; ++i) tot += dep[i];
    if (tot != d[rt]) dilemma;
    for (int i = 1; i <= sum; i += 2) printf("%d %d\n", e[i].link, e[i + 1].link);
    return 0;
}

Measured memory_bytes: 13440
#include<bits/stdc++.h>
#define int long long
#define fi first
#define sc second
#define pii pair<int,int>
#define vi vector<int>
#define msi map<string,int>
#define si set<int>
#define all(v) v.begin(),v.end()
#define sz(v)  int((v).size())
#define rep(i,a,b)	for(int i=a;i<b;i++)
#define dep(i,a,b)	for(int i=a;i>=b;i--)
#define isinarr(i,n) ((i>=0)?((i<n)?1:0):0)
#define fastio  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define ppb pop_back
#define present(container, element) (container.find(element) != container.end())      //set,map etc.
#define cpresent(container, element) (find(all(container),element) != container.end())    //vector
#define hell 1000000007
#define PI 3.14159265
#define mp make_pair
#define	endl '\n'

using namespace std;
void solve()
{
	int n,m;
	cin>>n>>m;
	int ans=0;
	ans+=n*(n-1);
	ans+=m*(m-1);
	ans/=2;
	cout<<ans;
} 



signed main()
{
    fastio
    int t=1;
    //cin>>t;
    while(t--)
    	solve();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
int N;
double T;

int main(void){
	//IO("test.in", "test.out");
	cin >> N;
	for(int i = 0; i < N; i++){
		double v;
		string t;
		cin >> v >> t;
		if(t == "JPY") T += v;
		else T += v * 380000;
	}	
	printf("%lf\n", T);
}

Measured memory_bytes: 256
#include <stdio.h>
  
int main(void)
{
	int a, b, c;

	scanf("%d%d%d", &a, &b, &c);
	if (a < b && b < c){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 2056
#include <bits/stdc++.h>
#define int long long
#define moder (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)*mod_pow(kai(x - y), moder - 2, moder) % moder*mod_pow(kai(y), moder - 2, moder) % moder;
}
/*--------Library Zone!--------*/

int h, w, x, y;
signed main() {
	cin >> h >> w >> x >> y;
	if (h%x == 0 && w%y == 0)cout << "No" << endl;
	else {
		cout << "Yes" << endl;
		REP(i, h + 1) {
			REP(j, w + 1) {
				if (i%x == 0 && j%y == 0) {
					cout << -1000000000 << " ";
				}
				else {
					cout << 1000000000 / (x*y - 1) - 1 << " ";
				}
			}
			cout << endl;
		}
	}
}


Measured memory_bytes: 2944
#include <stdio.h>
#include <stdlib.h>
#define MAX 100001

int list[MAX][2];

int compare(void *a, void *b){
  if(((int*)a)[0] == ((int*)b)[0]){
    return ((int*)b)[1] - ((int*)a)[1];
  }else{
    return ((int*)a)[0] - ((int*)b)[0];
  }
}

int main(){
  int n,m,lead[MAX],
      index,*ago,start,p,
      i,j,sum=0;
  
  scanf("%d%d", &n, &m);
  for(i=0;i<n;i++){
    scanf("%d%d", &list[i][0], &list[i][1]);
  }
  
  qsort(list, n, sizeof(int) * 2, compare);
  
  if(list[0][0] > m){
    printf("0");
    return 0;
  }
  p = 0;
  
  i=1;
  j=0;
  while(1){
    start = j;
    i = list[j][0];
    while(i == list[j][0]){
      j++;
      if(j==n)break;
    }
    if(j==n)break;
    if(list[j][0] > m)break;
    lead[start] = j;
  }
  lead[start] = -1;
  
  for(i=1;i<=m;i++){
    if(list[p][0] > i)continue;
    ago = &p;
    index = p;
    j = p;
    while(lead[j] != -1){
      if(list[lead[j]][0] > i)break;
      if(list[lead[j]][1] > list[index][1]){
        index = lead[j];
        ago = &lead[j];
      }
      j = lead[j];
    }
    sum += list[index][1];
    if(index+1 == n){
      *ago = -1;
    }else if(list[index+1][0] == list[index][0]){
      *ago += 1;
      lead[index+1] = lead[index];
    }else{
      *ago = lead[index];
    }
    if(p == -1)break;
  }
      
  printf("%d", sum);
  
  return 0;
}

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int siz=2e5+1;
const long inf=1e9;
int main(){
	int N; string s; cin>>N>>s;
	int r = 0, w = 0;
	rep(i,0,N){
		if(s[i] == 'R') r++;
		else w++;
	}
	int cnt = 0;
	rep(i,0,r)if(s[i] == 'W') cnt++;
	rep(i,r,N)if(s[i] == 'R') cnt++;
	cout<<cnt / 2<<endl;
}

Measured memory_bytes: 3716
#![allow(unused)]

use std::io::{Read, Stdin, StdinLock};
use std::iter::{FromIterator, Iterator};
use std::str::{FromStr};
use std::string::String;

macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

struct TokenReader<'a> {
    lock: StdinLock<'a>,
}

impl<'a> TokenReader<'a> {
    fn new(s: &'a Stdin) -> TokenReader<'a> {
        TokenReader { lock: s.lock() }
    }

    fn read_chars<T: FromIterator<char>>(&mut self) -> T {
        self.lock
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<T>()
    }

    fn read_str(&mut self) -> String {
        self.read_chars::<String>()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read_str().parse().ok().unwrap()
    }
}

//==============================================================================
//
// Problem specific code
//
//==============================================================================

fn main() {
    let sin = std::io::stdin();
    let mut tr = TokenReader::new(&sin);

    let n: i64 = tr.read();
    let m: usize = tr.read();
    let avec: Vec<i64> = (0..m).map(|_| tr.read()).collect();

    let mut sum = 0;
    for x in avec {
        sum += x;
    }

    println!("{}", std::cmp::max(-1, n - sum));
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;


  if(A + B == C + D) {
    cout << "Balanced" << endl;
  }else if(A+B > C+D){
    cout << "Left" << endl;
  }else{
    cout << "Right" << endl;
  }
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int a = sc.nextInt();

        // 出力
        if (x < a) {
          System.out.println("0");
        } else {
          System.out.println("10");
        }
	}
}

Measured memory_bytes: 21584
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
  int n;
  cin >> n;
  if(n == 1){
    cout << 1 << endl;
    return 0;
  }
  priority_queue<int> q;
  q.push(1);
  for(int i = 2; i*i <= n; i++){
    int j= i;
    while(j*i <= n){
      q.push(j*i);
      j *= i;
    }
  }
  cout << q.top() << endl;
  system("pause");
}


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

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

    if (a < b) {
        cout << "a < b" << endl;
    } else if (a > b) {
        cout << "a > b" << endl;
    } else {
        cout << "a == b" << endl;
    }

    return 0;
}


Measured memory_bytes: 3084
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String s = new String(in.readLine());
		int a = Integer.parseInt(s);
		int a_3 = a*a*a;
		System.out.println(a_3);

	}

}

Measured memory_bytes: 16864
#include<cstdio>
int main(){
	int a,b,c;
	while(scanf("%d %d %d",&a,&b,&c)==3){
		if(b-a==c-b){
			printf("YES\n");
		}
		else{
			printf("NO\n");
		}
		
	}
	return 0;
}

Measured memory_bytes: 128
import java.io.*;

import java.util.*;

import java.math.*;
import java.util.regex.Pattern;

import java.util.regex.Matcher;



class Main{

	public static int calc_plastic(int l1,int l2,int d){
		int l1a,l2a,da;
		l1a = (int)Math.pow(l1,2);
		l2a = (int)Math.pow(l2,2);
		da = (int)Math.pow(d,2);

		if(l1 == l2) return 2;
		else if(l1a+l2a == da) return 1;
		return 0;
	}

	


	public static void plastic(ArrayList<Integer> list){
		int oblong=0,diamond=0;
		int len1,len2,diag,res;

		for(int i=0;i<list.size()/3;i++){
			len1 = list.get(i*3);
			len2 = list.get(i*3+1);
			diag = list.get(i*3+2);
			res = calc_plastic(len1,len2,diag);
			if(res == 1) oblong++;
			else if(res == 2)diamond++;
		}
		System.out.println(oblong);
		System.out.println(diamond);
	}

		

	public static void main(String args[]) throws IOException{

		String str;

		ArrayList <Integer> inp = new ArrayList<Integer>();



		Scanner scan = new Scanner(System.in);



		while(scan.hasNext()){
			str = scan.next();

			String [] strAry = new String[str.length()];

			strAry = str.split(",");

			for(int j=0;j<strAry.length;j++){

				Pattern p = Pattern.compile("[0-9]*");

				Matcher m = p.matcher(strAry[j]);

				if(m.find()){

					int x = Integer.valueOf(m.group(0)).intValue();

					inp.add(x);

				}

			}

		}

		plastic(inp);

	}

}

Measured memory_bytes: 12000
#include <cstdint>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
using namespace std;

int main() {
	string w;
	cin >> w;
	vector<int> bufs(26, 0);
	for (int i = 0; i < w.length(); ++i) {
		char c = w[i];
		bufs[c - 'a']++;
	}
	bool check = true;
	for (int i = 0; i < 26; ++i) {
		if (bufs[i] % 2 == 1) check = false;
	}
	if (check) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


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

#define pb push_back
#define mp make_pair
#define fs first
#define se second
#define pi 2*acos(0)
#define PI 3.14159265358979323846264338

typedef long long ll;
typedef unsigned long long ull;
typedef pair < int , int > pii;
typedef pair < ll , ll > pll;
const int N = 100010;
const int MX = 123456;
const int mod = (int)1e9 + 7;
const int base = 1023456789;
const ull BS1 = 10000019ULL;
const int INF = (1 << 29);

template < class T > inline void fastScan(T &x){
    register char c = getchar();
    int neg = 0; x = 0;
    for(   ; (c < 48 || c > 57) && (c != '-'); c = getchar());
    if(c == '-') { neg = 1; c = getchar(); }
    for(   ; c > 47 && c < 58; c = getchar()){
        x = (x << 1) + (x << 3) + c - 48;
    }
    if(neg) x = -x;
}

int fx[]={1,-1,0,0};
int fy[]={0,0,-1,1};

int main(){
    ll n, a, b, c;
    fastScan(n);
    for(ll i = 1; i <= 3500; i++){
        for(ll j = 1; j <= 3500; j++){
            ll up = n * i * j;
            ll down = 4 * i * j - n * i - n * j;
            if(down < 1) continue;
            if(up % down == 0){
                printf("%lld %lld %lld\n", i, j, up / down);
                return 0;
            }
        }
    }
}


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


public class Main {
  public static void main(String[] args) {
    MyScanner sc = new MyScanner();
    out = new PrintWriter(new BufferedOutputStream(System.out));


    int numInput = sc.nextInt();

    int[] cost = new int[numInput];

    for (int i = 0; i < cost.length; i ++) {
      cost[i] = sc.nextInt();
    }

    int[] dp = new int[numInput];
    dp[0] = 0;
    dp[1] = Math.abs(cost[0] - cost[1]);

    for (int i = 2; i < numInput; i ++) {
      dp[i] = Math.min(
            Math.abs(cost[i] - cost[i - 1]) + dp[i - 1],
            Math.abs(cost[i] - cost[i - 2]) + dp[i - 2]);
    }

    out.println(dp[numInput - 1]);

    // Start writing your solution here. -------------------------------------

    /*
    int n      = sc.nextInt();        // read input as integer
    long k     = sc.nextLong();       // read input as long
    double d   = sc.nextDouble();     // read input as double
    String str = sc.next();           // read input as String
    String s   = sc.nextLine();       // read whole line as String

    int result = 3*n;
    out.println(result);                    // print via PrintWriter
    */

    // Stop writing your solution here. -------------------------------------
    out.close();
  }


  //-----------PrintWriter for faster output---------------------------------
  public static PrintWriter out;

  //-----------MyScanner class for faster input----------
  public static class MyScanner {
    BufferedReader br;
    StringTokenizer st;

    public MyScanner() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

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

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

    double nextDouble() {
      return Double.parseDouble(next());
    }

    String nextLine(){
      String str = "";
      try {
        str = br.readLine();
      } catch (IOException e) {
        e.printStackTrace();
      }
      return str;
    }

  }
  //--------------------------------------------------------
}

Measured memory_bytes: 31460
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
static int n = int.Parse(Console.ReadLine());
static List<int>[] nextVertexList = new List<int>[n];//隣接頂点リスト（リストの入った配列）
static List<long>[] nextDistanceList = new List<long>[n];//隣接頂点までの距離リスト
static int nex;
static long cost;
static long[] dis = new long[n];
static long[] answers = new long[n];

  static void Main()
  {
    for(int i = 0; i < n; i++)
    {
      nextVertexList[i] = new List<int>();
      nextDistanceList[i] = new List<long>();
    }
  
    for(int i = 0; i < n-1; i++)
    {
      string[] input = Console.ReadLine().Split(' ');
      int s = int.Parse(input[0]);
      int t = int.Parse(input[1]);
      long w = long.Parse(input[2]);
      nextVertexList[s].Add(t);
      nextDistanceList[s].Add(w);
      nextVertexList[t].Add(s);
      nextDistanceList[t].Add(w);
    }

    Dfs(0,-1);
    DfsSub(0,0,-1);
    for(int i = 0; i < n; i++) Console.WriteLine(answers[i]);
  }

  static void VertexSet(int vertexNum, int partnerNum)
  {
    nex = nextVertexList[vertexNum][partnerNum];
    cost = nextDistanceList[vertexNum][partnerNum];
  }

  static void Dfs(int x, int pre)
  {
    for(int i = 0; i < nextVertexList[x].Count(); i++)
    {
      VertexSet(x,i);
      if(nex == pre) continue;
      Dfs(nex,x);
      VertexSet(x,i);
      dis[x] = Math.Max(dis[x], dis[nex]+cost);
    }
  }

  static void DfsSub(int x, int dpre, int pre)
  {
    long[][] child = new long[nextVertexList[x].Count()+1][];
    for(int i = 0; i < nextVertexList[x].Count()+1; i++)
    {
      child[i] = new long[2];
    }
    child[0][0] = 0;
    child[0][1] = -1;

    for(int i = 0; i < nextVertexList[x].Count(); i++)
    {
      VertexSet(x,i);

      if(nex == pre) child[i+1][0] = dpre+cost;
      else child[i+1][0] = dis[nex]+cost;

      child[i+1][1] = nex;
    }
    var sorted = child.OrderByDescending(a => a[0]).ThenByDescending(a => a[1]).ToList();
    if(sorted.Count() > 1) answers[x] = Math.Max(sorted[0][0], sorted[1][0]);
    else answers[x] = sorted[0][0];

    for(int i = 0; i < nextVertexList[x].Count(); i++)
    {
      VertexSet(x,i);
      if(nex == pre) continue;
      DfsSub(nex, (int)sorted[(nex == sorted[0][1]?1:0)][0], x);
    }
    
  }
  
}



Measured memory_bytes: 33344
//#include<bits/stdc++.h>	// 全てのヘッダーファイルをinclude
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<set>
#include<map>
#include<utility>	// wrap,pair
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR (i,n) for(int i=n;i>0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
const int MOD{ int(1e9 + 7) };	// int 1000000007
const int inf{ int(1e9) };	// inf = 1000000000 // 1e9 はdouble型
using namespace std;
typedef long long ll;

// 最大公約数（ユークリッドの互除法）
int GCD(int x, int y) {
	if (x > y) {
		swap(x, y);
	}
	int r = y % x;
	while (r != 0) {
		y = x;
		x = r;
		r = y % x;
	}
	return x;
}

// 最小公倍数
int LCM(int x, int y) {
	ll gcd = GCD(x, y);
	return x * y / gcd;
}

// 素数判定(素数ならtrue,合成数ならfalse)
bool IsPrime(int num) {
	if (num < 2) return false; // 0,1
	else if (num == 2) return true;	// 2
	else if (num % 2 == 0) return false; // 偶数

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) return false; // 割り切れたら素数ではない
	}
	return true; // 全部通ったら素数
}

// pairをsecond基準で昇順sort
// sort(vector_name.begin(),vector_name.end(),compare_by_b);
bool compare_by_b(pair<int, int>a, pair<int, int>b) {
	if (a.second != b.second) return a.second < b.second;
	else return a.first < b.first;
}

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

int main(void) {

	int n;
	cin >> n;
	vector<int> a(n);
	REP(i, n) cin >> a[i];

	vector<int> b(n);
	b[0] = a[0];
	FOR(i, 1, n) {
		b[i] = GCD(b[i - 1], a[i]);
	}
	cout << b[n - 1] << endl;

	return 0;
}

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

int main ()
{
   ll n,W;cin>>n>>W;
   ll w[n],v[n];
   fr(i,n)cin>>w[i]>>v[i];
   ll dp[W+1][n+1];
   fr(i,W+1)
   {
       fr(j,n+1)
       {
           if(i==0 || j==0){dp[i][j]=0;continue;}
           dp[i][j] = dp[i][j-1];
           if(i>=w[j-1])
           dp[i][j] = max(dp[i][j],dp[i-w[j-1]][j-1] + v[j-1]);
       }
   }
   ll ans = 0LL;
   fr(i,W+1)ans=max(ans,dp[i][n]);
   cout<<ans<<endl;
}

Measured memory_bytes: 79104
//By Tushar Gautam
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define leadzero(a) __builtin_clz(a) // count leading zeroes
#define trailzero(a) __builtin_ctz(a) // count trailing zeroes
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
#define ln "\n"
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inputfile freopen("input.txt", "r", stdin)
#define outputfile freopen("output.txt", "w", stdout)
#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) { cerr<<endl; }
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << "\t"; err(++it, args...);
}
template<typename T1,typename T2>
ostream& operator <<(ostream& c,pair<T1,T2> &v){
	c<<"("<<v.fi<<","<<v.se<<")"; return c;
}
template <template <class...> class TT, class ...T>
ostream& operator<<(ostream& out,TT<T...>& c){
    out<<"{ ";
    forstl(x,c) out<<x<<" ";
    out<<"}"; return out;
}
typedef long long int  ll;
typedef long double  ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32; 
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM = 1e5+5, MOD = 1e9+7;
int t,n,m,k,x,y;
ll dp[101][LIM]; 
int main(){
	fastio;
	cin>>n>>k;
	dp[0][0]=1;
	dp[0][1]=MOD-1;
	forn(i,n){
		cin>>x;
		ll c=0;
		forn(j,k+1){
			c+=dp[i][j];
			c%=MOD;
			dp[i+1][j]+=c;
			if(j+x+1<LIM) dp[i+1][j+x+1]+=(MOD-c);
		}
	}
	ll ans=0;
	forn(i,k+1) ans=(ans+dp[n][i])%MOD;
	ans= (ans+MOD)%MOD;
	cout<<ans<<ln;
	return 0;
}

Measured memory_bytes: 78336
#include<cstdio>
#include<cmath>
using namespace std;
int a[10];
int main(){
	int n=3,ans=10000;
	for (int i=1;i<=n;i++)
	scanf("%d",&a[i]);
	if (abs(a[1]-a[2])+abs(a[2]-a[3])<ans) 
	   ans=abs(a[1]-a[2])+abs(a[2]-a[3]);
	if (abs(a[1]-a[3])+abs(a[1]-a[2])<ans)
	   ans=abs(a[1]-a[3])+abs(a[1]-a[2]);
	if (abs(a[3]-a[1])+abs(a[2]-a[3])<ans)
	   ans=abs(a[3]-a[1])+abs(a[2]-a[3]);
	printf("%d",ans);
	return 0;
} 

Measured memory_bytes: 128
#include<stdio.h>

int main() {
	int i,j,a[10000];
	for(i=1;i<=10000;i++){
		scanf("%d",&a[i]);
		if(a[i]==0){
			break;
		}
	}	
	for(j=1;j<i;j++){
		printf("Case %d: %d\n",j,a[j]);
		if(a[j]==0){
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 2604
import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    int x, a; scan(x, a);
    writeln(x < a ? 0 : 10);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> A = vector<int>(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  int prev = 0;
  int64_t sum = 0;
  for(int i=0;i<N;i++){
    int d = prev - A.at(i);
    if(d > 0){
      sum+=d;
      A.at(i)+=d;
    }
    prev = A.at(i);
  }
  cout << sum;
}

Measured memory_bytes: 4056
open System

let n, m, x, a, c =
    let n, m, x =
        let l = Console.ReadLine().Split(' ') |> Array.map int
        l.[0], l.[1], l.[2]

    let a, c =
        let ls =
            [ for i in 0 .. n - 1 do
                yield Console.ReadLine().Split(' ') |> Array.map int ]

        let a = Array2D.init n m (fun i j -> ls.[i].[j + 1])
        let c = Array.init n (fun i -> ls.[i].[0])
        a, c

    n, m, x, a, c

let ans =
    let rec dfs is k =
        if k = n then
            let ok =
                [ for j in 0 .. m - 1 ->
                    [ for i in is -> a.[i, j] ] ]
                |> List.map (fun l -> l |> List.sum)
                |> List.forall (fun sum -> sum >= x)

            if ok then
                is
                |> List.map (fun i -> c.[i])
                |> List.sum
            else
                -1
        else
            let a, b = dfs is (k + 1), dfs (k :: is) (k + 1)
            match a, b with
            | a, -1 -> a
            | -1, b -> b
            | _ -> min a b
    dfs [] 0

ans |> Console.WriteLine


Measured memory_bytes: 42580
n, f = gets.chomp.split.map(&:to_i)
h = Hash.new{|h, k| h[k] = Hash.new{|h2, k2| h2[k2] = 0}}
n.times{
    items = (gets.chomp.split)[1..-1]
    items.combination(2){|x, y|
        x2, y2 = [x, y].sort
        h[x2][y2] += 1}
}
arr = []
h.each{|k, v| v.each{|k2, v2| arr << [k, k2] if v2 >= f}}
arr.sort!
puts arr.length
arr.each{|item| puts item.join(" ")}


Measured memory_bytes: 7476
#include <bits/stdc++.h>
#include <iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
/*vector<Type> v;
vector<Type> v();
vector<Type> v(n);
vector<Type> v(n, d);
vector<vector<Type>> vv;
vector<vector<Type>> vv();
vector<vector<Type>> vv(n);
vector<vector<Type>> vv(n, vector<Type>(m));
vector<vector<Type>> vv(n, vector<Type>(m, d));*/

int main() {
  int x, y;
  cin >> x >> y;
  for(int i=0;i<=x;i++){
    if(2*i+4*(x-i) == y){
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
  return 0;
}


Measured memory_bytes: 3628
/// wa ^3^

#pragma GCC optimize("O3")

#include<bits/stdc++.h>
                           
#define x first
#define y second
#define pb push_back
#define sz(x) (int) x.size()
 
using namespace std;
 
using ll = long long;
using pii = pair<int, int>;                                   

const int MOD = 1e9 + 7;
const int INF32 = 1e9 + 1e2;

template<typename T> istream 
&operator>>(istream &a, vector<T> &v) { 
for (auto& x : v) a >> x; return a; }

void stndrtn() {
#ifdef accepted
    freopen(".in", "r", stdin);
#endif        
}

const bool flag = 0;

void maincode() {
    string s;
    cin >> s;
    int cnt = 0;
    vector<ll> v;
    char pv = s[0];
    for (char c : s) {
        if (c == pv) {
            cnt++;
        } else {
            v.pb(cnt), cnt = 1;
        }
        pv = c;       
    }    
    v.pb(cnt);
    ll ans = 0;
    if (s[0] == '>') {
        ans = v[0]*(v[0]+1)/2;
        v.erase(v.begin());
    }
    for (int i = 0; i < sz(v); ++i) {
        ans += v[i]*(v[i]+1)/2;               
        if (i & 1) 
            ans -= min(v[i], v[i-1]);
    }
    cout << ans;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr), stndrtn();
    int ts = 1;
    if (flag) 
        cin >> ts;
    while (ts--)
        maincode(); 
    return 0;
}



Measured memory_bytes: 3352
"use strict";
function main(input) {
    const S = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
    console.log(7 - S.indexOf(input.replace("\n", "")));
    return;
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29500
h,w=map(int,input().split())
s=[list(input()) for _ in range(h)]
for i in range(1,h-1):
  for j in range(1,w-1):
    if s[i][j]=="#" and s[i-1][j]==s[i+1][j]==s[i][j-1]==s[i][j+1]==".":
      print("No") 
      exit()
print("Yes")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <numeric>
#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;


int main() {
  ll w,h,x,y;cin >> w >> h >> x >> y;
  double s=double(h)*double(w)/2;
  if(x*2==w && y*2==h) cout << s<<' '<< 1;
  else cout <<s<<' '<< 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#define MAX 1001
void solve(void);
int q,count[MAX][MAX]={},xlength,ylength;
char X[MAX],Y[MAX];

void solve(void){
  int i,j;

  xlength=strlen(X);
  ylength=strlen(Y);
  
  for(i=1;i<=xlength;i++){
    for(j=1;j<=ylength;j++){
      if(X[i-1]==Y[j-1]) count[i][j]=count[i-1][j-1]+1;
      else if(count[i-1][j]>=count[i][j-1]) count[i][j]=count[i-1][j];
      else count[i][j]=count[i][j-1];
    }
  }
}
    
int main()
{
  int i;
  
  scanf("%d",&q);

  for(i=1;i<=q;i++){
    scanf("%s",X);
    scanf("%s",Y);
    solve();
    printf("%d\n",count[xlength][ylength]);
  }

  /*for(i=0;i<q;i++){
    printf("%d\n",count[][]);
    }*/

  return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;

typedef int _loop_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 DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

int main() {
    string s,t;
    cin>>s>>t;
    int ans = 0;
    if(s[0]==t[0]) ans++;
    if(s[1]==t[1]) ans++;
    if(s[2]==t[2]) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
x = [[0,0,0]]+sorted([list(map(int, input().split())) for _ in range(n)])
ans = 'Yes'
for i in range(n):
    d = (x[i+1][0]-x[i][0]-abs(x[i+1][1]-x[i][1])-abs(x[i+1][2]-x[i][2]))
    if d<0 or d%2==1:
        ans = 'No'
print(ans)

Measured memory_bytes: 62552
#pragma GCC optimize("-O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void Main();
#ifdef ConanYu
#include "local.hpp"
#else
#define debug(...) do { } while(0)
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  Main();
}
#endif

const int N = 1e5 + 5;
int a[N], b[N];

void Main() {
  int n; cin >> n;
  for(int i = 1; i <= n; i++) {
    cin >> a[i];
    b[a[i]] = i;
  }
  for(int i = 1; i <= n; i++) {
    cout << b[i] << " \n"[i == n];
  }
}


Measured memory_bytes: 1664