akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (1) {
    char S[1000000];
    cin.getline(S, sizeof(S));
    if (S[0] == '.' && strlen(S) == 1) break;
    stack<int> s;
    s.push(-1);
    int flag = 0;
    for (int i = 0; i < strlen(S); i++) {
      if (S[i] == '(' || S[i] == '[') {
        s.push(S[i]);
      }
      if (S[i] == ')') {
        
        if (s.top() == '(') {
          s.pop();
        }
        else {
          flag = 1;
          break;
        }
      }
      if (S[i] == ']') {
        if (s.top() == '[') {
          s.pop();
        }
        else {
          flag = 1;
          break;
        }
      }
    }
    if (flag == 0 && s.top() == -1) cout << "yes" << endl;
    else cout << "no" << endl;
  }
  return 0;
}



Measured memory_bytes: 3112
#include <stdio.h>
//#include <stdlib.h>
#define N 10000
/*
int C[N],n;

int CountingSort(int A[],int B[],int k){
  int i;
  for(i=0; i<=N; i++){
    C[i]=0;
  }

  for(i=1; i<=n; i++){
    C[A[i]]++;
  }

  for(i=1; i<=N; i++){
    C[i]+=C[i-1];
  }

  for(i=1; i<=n; i++){
    B[C[A[i]]] = A[i];
    C[A[i]]--;
  }
  return 0;
}
*/

int main(){
  int i,n,C[N];

  for(i=0; i<=N; i++){
    C[i]=0;
  }

  scanf("%d",&n);
  int A[n+1],B[n+1];
  for(i=0; i<n; i++){
    scanf("%d",&A[i+1]);
    C[A[i+1]]++;
  }

  /*for(i=0; i<n; i++){
    B[i]=CountingSort(A,0,n);
  }
  */

  for(i=1; i<=N; i++){
    C[i]+=C[i-1];
  }

  for(i=1; i<=n; i++){
    B[C[A[i]]] = A[i];
    C[A[i]]--;
  }

  for(i=1; i<=n; i++){
  printf("%d",B[i]);
  if(i!=n) printf(" ");
  }
  printf("\n");

  return 0;

}



Measured memory_bytes: 17392
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define WHITE 0
#define BRACK 1

typedef struct{
  int k;
  int *v,*c;
}E;

E e[101];

int notend();
int w[101],d[101],co[101],n,dest;

int main(){
  int u,i,j,wsum=0,min,minj;

  scanf("%d",&n);

  for(i = 0; i < n; i++){
    w[i] = INFINITY;
    co[i] = WHITE;
    d[i] = INFINITY;
    scanf("%d",&u);
    scanf("%d",&e[u].k);
    e[u].v = malloc(sizeof(int) * e[u].k);
    e[u].c = malloc(sizeof(int) * e[u].k);
    for(j = 0; j < e[u].k; j++){
      scanf("%d%d",&e[u].v[j],&e[u].c[j]);
    }
  }
  
  d[0] = 0;
  while(notend()){
    
    min = INFINITY;
    for(i = 0; i < n; i++){
      if(d[i] < min && co[i] != BRACK){
	min = d[i];
	u = i;
      }
    }

    for(i = 0; i < e[u].k; i++){
      dest = d[u] + e[u].c[i];
      if(d[e[u].v[i]] > dest){
	d[e[u].v[i]] = dest;
      }
    }
    co[u] = BRACK;

  }

  for(i = 0; i < n; i++)
    printf("%d %d\n",i,d[i]);
  
  return 0;
}
      
int notend(){
  int i;
  for(i = 0; i < n; i++){
    if(co[i] == WHITE)
      return 1;
  }
  return 0;
}



Measured memory_bytes: 2088
#coding:utf-8
A,B=map(int,raw_input().split())

def getBin(b):
    return bin(b)[2:]
def xorTo(d):
    # 0^1^2^3^....^d
    num=[[0,0] for _ in range(100)]
    d+=1
    for k in range(len(getBin(d))):
        period=2**(k+1)
        num[k][0]=(d/period)*(period/2)
        num[k][1]=(d/period)*(period/2)
        last=(d%period)
        if last < period/2:
            num[k][0]+=last
        else:
            num[k][0]+=period/2
            num[k][1]+=last-(period/2)
    ans=""
    for n0,n1 in num:
        if n1%2==0:ans+="0"
        else:ans+="1"
    ans=ans[::-1]
    ans=eval("0b"+ans)
    return ans    
print(xorTo(A-1) ^ xorTo(B))
    







Measured memory_bytes: 28524
import java.util.Scanner;
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Boolean f1=false,f2=false,f3=false,f4=false;


		for(int i=0;i<4;i++) {
			int n = sc.nextInt();
			if(n==1)f1=true;
			else if (n==9)f2=true;
			else if(n==7)f3=true;
			else if(n==4)f4=true;

		}
		if(f1&&f2&&f3&&f4)System.out.print("YES");
		else System.out.print("NO");

	}
}

Measured memory_bytes: 23124
N,K=map(int,input().split())

sweet=[0 for i in range(N+1)]

d=[]
A=[]
for i in range(K):
    d.append(int(input()))
    A.append(list(map(int,input().split())))

for i in range(len(d)):
    for j in range(d[i]):
        sweet[A[i][j]]+=1

num=0
for i in range(1,len(sweet)):
    if sweet[i]==0:
        num+=1
print(num)

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

int main(void){
    int Tarou = 0;
    int Hanako = 0;
    int cards;
    string card1,card2;
    cin >> cards;
    for (int i = 0;i < cards;i++){
        cin >> card1 >> card2;
        if (card1.compare(card2) == 0) {
            Tarou += 1;
            Hanako += 1;
        }
        else if(card1.compare(card2) > 0) {
            Tarou += 3;
        }
        else {
            Hanako += 3;
        }
    }
            cout << Tarou << " " << Hanako << endl;
}


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#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++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  const int MOD = 1e9+7;
  int x;
  cin >> x;
  ll ans = 1;
  FOR(i,2,x+1) ans = ans * i % MOD;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
let (+@) a b = (a + b) mod 1000000007
let f = max_int
let () =
  Scanf.scanf "%d" @@ fun n ->
  let rec g i arr =
    if i >= n then Array.fold_left (+@) 0 arr else
    let arr' = Array.make 10 0 in
    [(0, [1; 0; 2; 0]);
     (1, [1; 3; 4; 5]);
     (2, [6; 0; 2; 0]);
     (3, [1; 0; f; 0]);
     (4, [6; f; 7; 8]);
     (5, [1; 0; 9; 0]);
     (6, [1; f; 4; 5]);
     (7, [6; f; 2; 0]);
     (8, [1; f; 2; 0]);
     (9, [6; f; 2; 0]);]
    |> List.iter (fun (s, ts) ->
        List.iter (fun t ->
          if t < f then arr'.(t) <- arr'.(t) +@ arr.(s)) ts);
    g (i+1) arr'
  in
  g 0 [|1;0;0;0;0;0;0;0;0;0;|] |> Printf.printf "%d\n"




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


int main()
{
    int n ;
    cin>>n;
    int* a = new int[n+1];
    for(int i=1;i<n+1;i++)
    {
        cin>>a[i];
    }
    int ans =0;
    for(int i=1;i<=n;i++)
    {
        if( a[ a[i] ]== i)
            ans++;
    }
    cout<<ans/2;
}

Measured memory_bytes: 3992
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 19;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

bool dchk[405][405];
bool tdchk[405][405];
vector <pii> Vu;
void update(int a, int b, int N) {
	if (dchk[a][b] || tdchk[a][b]) return;
	Vu.emplace_back(a, b);
	tdchk[a][b] = tdchk[b][a] = true;
	if (a == b) for (int i = 1; i <= N; i++) update(a, i, N);
}

int main() {
	int N, M, i, j, k;
	scanf("%d %d", &N, &M);
	while (M--) {
		int t1, t2;
		scanf("%d %d", &t1, &t2);
		//dchk[t1][t2] = dchk[t2][t1] = true;
		for (i = 1; i <= N; i++) {
			if (dchk[t1][i]) update(t2, i, N);
			if (dchk[t2][i]) update(t1, i, N);
		}
		update(t1, t2, N);
		for (auto it : Vu) dchk[it.first][it.second] = dchk[it.second][it.first] = true;
		Vu.clear();
	}

	int ans = 0;
	for (i = 1; i <= N; i++) for (j = i + 1; j <= N; j++) if (!dchk[i][j]) ans++;
	return !printf("%d\n", ans);
}

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

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>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }
template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	os << v[0];
	for (int i = 1; i < v.size(); i++) os << " " << v[i];
	return (os);
}

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

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	string S; cin >> S;
	int N = S.size();
	vvint dp(N+1, vint(2, -INF));
	dp[0][0] = dp[0][1] = 0;
	for (int i = 0; i < N; i++) {
		chmax(dp[i+1][0], dp[i][1] + 1);
		if (i == 0 || S[i] != S[i-1]) chmax(dp[i+1][0], dp[i][0] + 1);
		if (i < N-1) {
			chmax(dp[i+2][1], dp[i][0] + 1);
			if(i < 2 || S[i] != S[i-2] || S[i+1] != S[i-1]) chmax(dp[i+2][1], dp[i][1] + 1);
		}
	}
	cout << max(dp[N][0], dp[N][1]) << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


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

int main(){
	string s,t;
	static int dp[4001][4001] = {};
	while(cin >> s >> t){
		for(int i = 0;i <= s.length();i++){
			for(int j = 0;j <= t.length();j++) dp[i][j] = 0;
		}
		int ma = 0;
		for(int i = 0;i < s.length();i++){
			for(int j = 0;j < t.length();j++){
				if(s[i] == t[j]) dp[i + 1][j + 1] = dp[i][j] + 1;
				ma = max(ma,dp[i + 1][j + 1]);
			}
		}
		cout << ma << endl;
	}
	return 0;
}

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

int main() {
    string s,t;
    cin>>s>>t;

    int ls = s.size();
    int lt = t.size();
    int ans = lt;
    rep(i,ls -lt + 1){
        int res = 0;
        rep(j, lt){
            if (t[j] != s[i + j])
                res++;
        }
        ans = min(ans, res);
    }
    cout << ans<< endl;
}

Measured memory_bytes: 3600
#include <iostream>
#include <cstdio>
#include <vector>
#include <deque>
#include <algorithm>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
 
int main(){
    string S;
    cin >> S;
    int N = S.length();
    char last = S[0];
    int T = N;
    for(int i = 1; i < N; i++){
        if(S[i] != last){
            T = min(T, max(i, N-i));
        }
        last = S[i];
    }

    cout << T << endl;
    return 0;
}


Measured memory_bytes: 512
L, R = map(int, input().split())
mod = 2019
if (R-L+1) >= 2019:
    nums = [i for i in range(2019)]
else:
    nums = list(set([i % 2019for i in range(L, R+1)]))

res = []
for i in range(len(nums)):
    for j in range(i+1, len(nums)):
       res.append((nums[i]*nums[j])%mod)
print(min(res))



Measured memory_bytes: 75476
#include <cctype>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long int64;
inline int read(int f = 1, int x = 0, char ch = ' ')
{
    while(!isdigit(ch = getchar())) if(ch == '-') f = -1;
    while(isdigit(ch)) x = x*10+ch-'0', ch = getchar();
    return f*x; 
}
const int N = 131072+5;
int n, w[N], ch[2][N], c[N];
int64 d[N], l = 1e10, r = 0, mid, ans, pre[N], dfn[N];
vector<pair<int64, int64> > f[N];
inline bool cmpx(pair<int64, int64> a, pair<int64, int64> b) { return a.first < b.first; }
inline bool cmpy(pair<int64, int64> a, pair<int64, int64> b) { return a.second < b.second; }
void insert(vector<pair<int64, int64> > &ls, vector<pair<int64, int64> > &rs, vector<pair<int64, int64> > &s)
{
    int sy = ls.size(), sz = rs.size();
    if(sy > sz) swap(sy, sz), swap(ls, rs);
    sort(ls.begin(), ls.end(), cmpy);
    sort(rs.begin(), rs.end(), cmpx);
    pre[0] = rs[0].second;
    for(int i = 1; i < sz; ++i) pre[i] = min(pre[i-1], rs[i].second);
    for(int i = 0, j = sz-1; i < sy; ++i)
    {
        while(j >= 0&&ls[i].second+rs[j].first > mid) --j;
        if(j >= 0) s.push_back(make_pair(ls[i].first, pre[j]));
    }
    sort(ls.begin(), ls.end(), cmpx);
    sort(rs.begin(), rs.end(), cmpy);
    pre[0] = rs[0].first;
    for(int i = 1; i < sz; ++i) pre[i] = min(pre[i-1], rs[i].first);
    for(int i = 0, j = sz-1; i < sy; ++i)
    {
        while(j >= 0&&ls[i].first+rs[j].second > mid) --j;
        if(j >= 0) s.push_back(make_pair(pre[j], ls[i].second));
    }
}
bool valid()
{
    for(int i = n; i; --i)
    {
        int x = dfn[i]; if(f[x].size()) f[x].clear();
        if(!c[x]) f[x].push_back(make_pair(d[x], d[x]));
        else
        {
            int y = ch[0][x], z = ch[1][x];
            mid += d[x]<<1;
            insert(f[y], f[z], f[x]);
            mid -= d[x]<<1; f[y].clear(), f[z].clear();
        }       
        if(f[x].empty()) return false; 
    }
    return true;
}
void dfs(int x)
{
    d[x] += w[x], dfn[++n] = x;
    if(!c[x]) return l = min(l, d[x]), void(r = max(r, d[x]<<1));
    d[ch[0][x]] = d[ch[1][x]] = d[x];
    dfs(ch[0][x]), dfs(ch[1][x]);
}
int main()
{
    n = read(); 
    for(int i = 2; i <= n; ++i)
    {
        int x = read(); w[i] = read();
        ch[c[x]++][x] = i;
    }
    n = 0, dfs(1);
    while(l <= r)
    {
        mid = (l+r)>>1;
        if(valid()) ans = mid, r = mid-1;
        else l = mid+1;
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 30452
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int A = Integer.parseInt(scanner.next());
        int B = Integer.parseInt(scanner.next());

        scanner.close();

        if (B <= 1) {
            System.out.println(0);
            return;
        }

        int adapters = 1;
        int ports = adapters * A;

        while (B > ports) {
            // 増やす
            adapters++;
            ports += A - 1;
        }

        System.out.println(adapters);
    }
}


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

int main(){
  string a,b;
  cin >> a >> b;
  if(a=="H" && b=="D"){
    cout << "D" << endl;
  }
  if(a=="H" && b=="H"){
    cout << "H" << endl;
  }
  if(a=="D" && b=="D"){
    cout << "H" << endl;
  }
  if(a=="D" && b=="H"){
    cout << "D" << endl;
  }
}


Measured memory_bytes: 256
/* ex 4-3
    kas056 */
#include <stdio.h>

int height(int a, int b);//関数の宣言

int main(void){
    int length_1, length_2, snow;
    scanf("%d %d", &length_1, &length_2);//入力を読み取る

    snow = height(length_1,length_2);//関数（後述）を呼ぶ

    printf("%d", snow);

    return 0;
}

int height(int a,int b){//関数を作る
    int pole = 0;
    int difference = b - a;

    //雪の深さによっては二本の柱の差は変化しないことを利用する
    for (int i = 1; i < difference ; i ++){
        pole += i;//差がdifferenceとなる隣り合わせの柱のうち、低い方を求める
    }

    return (pole - a);//低い柱の本来の高さ-測定した低い方の柱の高さ=雪の深さ
}

Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
#include<complex>
using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

const int MAX = 1000 * 100 + 47;

int A[MAX];
int B[MAX];

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	ios::sync_with_stdio(false); cin.tie(0);
	int n;
	cin >> n;
	FOR(i, 0, n)
	{
		cin >> A[i];
		B[i] = A[i];
	}

	sort(B, B + n);
	int ans = 0;
	FOR(i, 0, n)
	{
		int ind = lower_bound(B, B + n, A[i]) - B;
		ans += i % 2 != ind % 2;
	}

	cout << ans/2 << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 9999999999;
const int INFI=2147483647;
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
  T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }


int main() {
  string s; cin >>s;
  if (s == "AAA" || s == "BBB") cout <<"No" <<endl;
  else cout <<"Yes" <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main() {
  ll N, K, S;
  cin >> N >> K >> S;
  if (S != 1e+9) {
    REP(i, K ) cout << S << " ";
    for (int i = K ; i < N; i++) {
      cout << S + 1<<" ";
    }
   
  } else {
    REP(i, K ) cout << S << " ";
    for (int i = K ; i < N; i++) {
      cout << 1<< " ";
    }
  }
  cout << endl;
}

Measured memory_bytes: 1280
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())

    N = NI()
    A = LI()

    if N == 0:
        if A[0] == 1:
            print(1)
        else:
            print(-1)
        return

    node = [0] * (N+1)
    node[0] = 1
    for i in range(N):
        node[i] -= A[i]
        node[i+1] = node[i] * 2

    node[N] = 0
    for i in range(N-1,-1,-1):
        if node[i+1]+A[i+1] > node[i] * 2:
            print(-1)
            return
        node[i] = min(node[i+1]+A[i+1],node[i])

    print(sum(node)+sum(A))


if __name__ == '__main__':
    main()

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

int main() {
  int s, w;
  cin >> s >> w;
  if (s <= w) cout << "unsafe" << endl;
  else cout << "safe" << endl;
  return 0;
}

Measured memory_bytes: 3596
#include<stdio.h>
int main(){
  int p[4][13]={0};
  char m;
  int a,i,j,n,cou=0;
  scanf("%d",&n);
  while(cou<n){
  scanf(" %c %d", &m,&a);
  if(m=='S')i=0;
  else if(m=='H')i=1;
  else if(m=='C')i=2;
  else if(m=='D')i=3;
  p[i][a-1]=1;
  cou++;
  }
  for(i=0;i<4;i++){
    for(j=0;j<13;j++){
      if(p[i][j]==0){
	if(i==0)printf("S %d\n",j+1);
	else if(i==1)printf("H %d\n",j+1);
	else if(i==2)printf("C %d\n",j+1);
	else if(i==3)printf("D %d\n",j+1);
      }
    }
  }
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  vector<int> vec(N);
  
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  
  sort(vec.begin(), vec.end()); // 昇順にソート
  reverse(vec.begin(), vec.end()); // 降順にソート
  
  int sum1, sum2;
  sum1 = sum2 = 0;
  
  for (int i = 0; i < N; i += 2) {
    sum1 += vec.at(i);
  }
  for (int i = 1; i < N; i += 2) {
    sum2 += vec.at(i);
  }
  
  cout << sum1 - sum2 << endl;
}


Measured memory_bytes: 256
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    s = SS()

    s_x = [i for i in s if i != 'x']
    l_s_x = len(s_x)
    for i in range(l_s_x):
        if s_x[i] != s_x[l_s_x-1-i]:
            print(-1)
            return

    x_num = []
    cnt = 0
    for i in s:
        if i == 'x':
            cnt += 1
        else:
            x_num.append(cnt)
            cnt = 0
    if s[-1] == 'x':
        x_num.append(cnt)
    else:
        x_num.append(0)

    ans = 0
    for i in range(len(x_num)):
        ans += max(x_num[len(x_num)-1-i] - x_num[i], 0)

    print(ans)

if __name__ == '__main__':
    resolve()


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

int main(){
	int n;
	cin>>n;
	vector<int> xd;
	int suma=0;
	for (int i=0; i<n; i++){
		int in;
		cin>>in;
		suma+=in;
		xd.push_back(in);
	}
	vector<int> resp;
	int m;
	cin>>m;
	for (int i=0; i<m; i++){
		int p, x;
		cin>>p; cin>>x;
		p--;
		int aux=suma-xd[p]+x;
		resp.push_back(aux);
	}
	for (auto a: resp){
		cout<<a<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}
const int INF = 1<<30;
const int MOD = 1000000007;
int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};

int main(){
  int n; cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  
  int cnt = 1;
  rep(i,n){
    if(cnt==a[i]) cnt++;
  }
  if(cnt==1){
    puts("-1");
  }else{
    cout << n-cnt+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
main(){
  long N, A, B ;
  cin >> N >> A >> B ;
  long ans ;
  long count = N / (A + B) ;
  ans = count * A ;
  if(N - ((A + B) * count) >= A){
    ans += A ;
  }
  else{
    ans += N - ((A + B) * count) ;
  }
  cout << ans ;
  return 0 ;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.array, std.algorithm, std.range;

void main()
{
    auto ns = stdin.byLine().map!(to!int).array().until(0).array();
    immutable m = reduce!max(ns)+1;
    auto p = new bool[m];
    foreach(i;2..m) if(!p[i]) for(int j=2; i*j<m; ++j) p[i*j]=true;
    foreach(n;ns)
    {
        if(n<=4 || (n&1))
            writeln(n<4 || p[n-2]?0:1);
        else
            writeln(iota(3,n/2+1,2).count!(i=>!p[i]&&!p[n-i]));
    }
}

Measured memory_bytes: 1100
#include<vector>
#include<iostream>

using namespace std;

int main()
{
	static bool era[1000001]={true,true};
	for(int i=2;i<1000;i++){
		if(!era[i])
			for(int j=i*i;j<1000000;j+=i)	era[j]=true;
	}

	vector<int> p;
	for(int i=2;i<1000000;i++)	if(!era[i])	p.push_back(i);

	for(int n;cin>>n,n;){
		int cnt=0;
		for(int i=0;p[i]<=n/2;i++)	if(!era[n-p[i]])	cnt++;
		cout<<cnt<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>
#include <iterator>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<long long, long long>
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

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; }

using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;

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

  string s; cin >> s;
  int n = s.size();
  rep(i, n-8) {
    cout << s[i];
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const ll INF = 1e18;

void solve(void){
	int N;
	cin >> N;
	vector <ll> as(N+1, INF), bs(N+1, INF), cs(N+1, INF);
	rep(N, i) cin >> as[i];
	rep(N, i) cin >> bs[i];
	rep(N, i) cin >> cs[i];
	sort(all(as));
	sort(all(bs));
	sort(all(cs));
	ll ans = 0;
	ll ia = 0, ic = 0;
	rep(N, i) {
		while (as[ia] < bs[i]) {
			ia++;
		}
		while (bs[i] >= cs[ic]) {
			ic++;
		}
		ans += ia * (N - ic);
	}
	cout << ans << endl;
}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int a,b,c,d,e,f,g,h;
    int num[26],tmp[26];
    string s;
    while(cin>>b){
        for(int i=0;i<26;i++)num[i]=100;
        while(b--){
            memset(tmp,0,sizeof(tmp));
            cin>>s;
            for(int i=0;i<s.size();i++){
                tmp[s[i]-'a']++;
            }
            for(int i=0;i<26;i++){
                num[i]=min(num[i],tmp[i]);
            }
        }

        for(int i=0;i<26;i++){
            while(num[i]>0){
                cout<<char('a'+i);
                num[i]--;
            }
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<deque> 
#include<cassert>
#define ll long long
using namespace std;
inline int read(){
	int re=0,flag=1;char ch=getchar();
	while(ch>'9'||ch<'0'){
		if(ch=='-') flag=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9') re=(re<<1)+(re<<3)+ch-'0',ch=getchar();
	return re*flag;
}
int n;char s[1000010],t[1000010];
deque<int>q;
int main(){
	n=read();int i,ans=0,j=n,add=0,now,siz=1;
	scanf("%s",s);scanf("%s",t);
	q.push_back(n);
	for(i=n-1;i>=0;i--){
		now=j;
		while(~j&&((j>i)|(s[j]!=t[i]))) j--;
//		cout<<i<<' '<<j<<' '<<now<<'\n'; 
		if(j==-1){
			puts("-1");return 0;
		}
		if(now==j){
			while(siz&&q.back()-add>=i) siz--,q.pop_back();
			q.push_back(i+add);siz++;
		}
		else{
			add++;
			if(i!=j){
				ans=((ans<siz)?siz:ans);
				q.push_front(j+add);siz++;
			}
		}
	}
	printf("%d\n",ans);
} 

Measured memory_bytes: 6272
package main

import (
  "fmt"
)

func main() {
  var K, X int
  fmt.Scanf("%d %d", &K, &X)
  
  min := X - (K - 1)
  max := X + (K - 1)
  
  for i := min; i <= max  ; i++ {
    fmt.Printf("%d ", i)
  }
}

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

int main()
{
	int K,S;
	
	cin >> K >> S;
	
	int ans=0;
	for(int x=0;x<=K;x++)
	{
		for(int y=0;y<=K;y++)
		{
			int z=S-x-y;
			if(0<=z && z<=K)
				ans++;
		}
	}
	
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
s = list(input())

for i in range(int(input())):
    cmd, a, b, *c = input().split()
    a = int(a); b = int(b)
    if cmd == "print":
        print(*s[a:b+1], sep='')
    elif cmd == "reverse":
        s[a:b+1] = reversed(s[a:b+1])
    else:
        s[a:b+1] = c[0]



Measured memory_bytes: 5740
#include <cstdio>

constexpr int MAX_N = 300;
constexpr int MAX_NUM = 20;

int main(){
    int N, num[MAX_N], result;
    long dp[MAX_N][MAX_NUM + 1]{};
    scanf("%d", &N); --N;
    for(int i = 0; i < N; ++i){
        scanf("%d", &num[i]);
    }
    scanf("%d", &result);
    dp[0][num[0]] = 1;
    for(int i = 1; i < N; ++i){
        for(int j = 0; j <= MAX_NUM; ++j){
            if(j >= num[i]){
                dp[i][j] += dp[i - 1][j - num[i]];
            }
            if(j + num[i] <= MAX_NUM){
                dp[i][j] += dp[i - 1][j + num[i]];
            }
        }
    }
    printf("%ld\n", dp[N - 1][result]);
    /*
    for(int i = 0; i < N; ++i){
        for(int j = 0; j < 21; ++j){
            printf("dp[%d][%d]: %ld\n", i, j, dp[i][j]);
        }
    }
    */
    return 0;
}

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

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

	rep(i, 1100){
		if((floor(i * 0.08) == a) && (floor(i * 0.1) == b)){
			cout << i << endl;
			return 0;
		}
	}
	cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 3548
s = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(s[k-1])

Measured memory_bytes: 38384
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


n=int(input())
a=list(map(int,input().split()))

cnt=[0]*n
lst=[]

for i in range(n,0,-1):
    if cnt[i-1]%2==a[i-1]:
        continue
    
    else:
        lst.append(str(i))
        xxx=make_divisors(i)

        for j in xxx:
            cnt[j-1]+=1


print(len(lst))

if len(lst)>0:
    print(' '.join(lst))

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

int main(){

string S;
int cost = 700;

cin >> S;

if(S[0] == 'o'){
cost = cost + 100;
}

if(S[1] == 'o'){
cost = cost + 100;
}

if(S[2] == 'o'){
cost = cost + 100;
}


cout << cost << endl;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(void){
    // Your code here!
    int a,b;
    scanf("%d %d\n",&a,&b);
    if(abs(a)==abs(b))    printf("0\n");
    else if((a+b)%2==0)   printf("%d\n",(a+b)/2);
    else        printf("IMPOSSIBLE\n");
    
    return 0;
}


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

int main() {
  int64_t A, B, V, W, T;
  cin >> A >> V;
  cin >> B >> W;
  cin >> T;
  bool X = false;
  if (V<=W){
    X = false;
  }
  else if (abs(A-B) <= (V-W)*T){
    X = true;
  }
  if (X)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;

}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double lb;
typedef vector<int,vector<int>> vec;
typedef pair<int,int> P;
typedef long double ld;
#define REP(i,j,n) for (int i=j;i<(n);i++)
#define RREP(i,n,j) for (int i = n; j<i;i--)
#define print(out) cout<< out  << "\n";
#define all(vec) vec.begin(),vec.end()
#define mod 1000000007
const int INF = 1e9;

int main(){
  int N,a;cin>>N;
  map<int,int>mp;
  REP(i,0,N){
    cin>>a;
    mp[a]++;
  }
  int ans=0;
  for(auto m :mp){
    ans+=(m.first>m.second?m.second:m.second-m.first);
  }
  print(ans)
}


Measured memory_bytes: 4736
import itertools
import numpy as np

N,M,X = map(int, input().split())
C = []
A = []

for n in range(N):
  CA = list(map(int, input().split()))
  C.append(CA[0])
  A.append(CA[1:])

ans = []
for k in range(1,N+1):
  rows = list(itertools.combinations(list(range(N)),k))
  for row in rows:
    Crow = 0
    Arow = np.array([0]*M)
    for j in range(len(row)):
      Crow += C[row[j]]
      Arow += np.array(A[row[j]])
    if all(a >=X for a in Arow):
      ans.append(Crow)
if len(ans) == 0:
  print(-1)
else:
  print(min(ans))


Measured memory_bytes: 27508
#include <stdio.h>
#include <stdlib.h>
#define max(X, Y) ((X) > (Y) ? (X) : (Y))
typedef long long ll;

ll n;
ll a[100005];
ll ans;
ll sum;
int f;

int main()
{
	scanf("%lld", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%lld", a + i);

		sum += llabs(a[i]);

		if (a[i] < 0) {
			f++;
			f %= 2;
		}
	}

	if (f) {
		for (int i = 1; i <= n; i++) {
			ans = max(ans, sum - (2 * llabs(a[i])));
		}
	}
	else {
		ans = sum;
	}

	printf("%lld\n", ans);
}


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

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (c * a <= b) {
		cout << c << endl;
		return 0;
	}
	int count = 0;
	while (count * a <= b)
		count++;
	cout << count - 1 << endl;
	return 0;
}

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

int main(int, char**) {
        int64_t N, A, B;
        std::cin >> N >> A >> B;
        int64_t n_blue;
        n_blue = A * (N/(A + B)) + std::min(A, N%(A + B));
        std::cout << n_blue << std::endl;
        return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};
 
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; }
 
struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};
 



signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Timer TM;

    
    ll n,k,x,y;
    cin>>n>>k>>x>>y;
    if(n>k) cout<<k*x+(n-k)*y<<endl;
    else cout<<n*x<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>				//Written by ThiDaiLoc
using namespace std;				//Team Three Wolves
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> trp;
typedef vector<ll> vi;
typedef vector<pll> vp;

#define fu(i,a,b)   for(ll i=a;i<=b;i++)
#define f1(i,n)     for(ll i=1;i<=n;i++)
#define fs(i,s)     for(ll i=0;i+1<=s.length();i++)
#define fd(i,b,a)   for(ll i=b;i>=a;i--)
#define fuv(i,a)    for(ll i=0;i<a.size();i++)
#define fdv(i,a)    for(ll i=(ll)a.size()-1;i>=0;i--)
#define ms(a,x)     memset(a, x, sizeof a)
#define prec(n)     fixed<<setprecision(n)
#define uni(a)      (a).erase(unique(all(a)), (a).end())
#define pb(i)       push_back(i)
#define pob         pop_back()
#define sc(a)       cin>>a
#define sc2(a,b)    cin>>a>>b
#define sc3(a,b,c)  cin>>a>>b>>c
#define pr(a)       cout<<a<<endl
#define pr2(a,b)    cout<<a<<" "<<b<<endl
#define rpr(a)      return cout<<a<<endl,0
#define prY         cout<<"YES"<<endl
#define prN         cout<<"NO"<<endl
#define bit(n,i)    (((n)>>(i))&1)
#define lowb(a,n,x) lower_bound(a,a+n,x) -a
#define lowb2(a,x)  lower_bound(all(a),x) -a.begin()
#define all(x)      (x).begin(), (x).end()
#define sz(a)       (ll)a.size()
#define le(s)       (ll)s.length()		
#define re          return 	
#define	mp(a,b)     make_pair(a,b)
#define	mp3(a,b,c)  make_pair(a,make_pair(b,c))
#define se          second
#define fi          first 
#define sse         second.second
#define sfi         second.first
#define soA         sort(A+1,A+1+n)
#define so(A,n)     sort(A+1,A+1+n)
#define sov(v)      sort(all(v))
#define sovr(v)     sort(all(v),greater<ll>())
#define debug(x)    cerr << #x << " = " << x << endl
#define INPUT       freopen("locin.txt", "r", stdin)
#define OUTPUT      freopen("locout.txt", "w", stdout)
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline ll mnz(ll& a,ll b){return a=(a>b?b:a);}
inline ll mxz(ll& a,ll b){return a=(a<b?b:a);}
inline string toString(ll n) {stringstream ss; ss << n;return ss.str();}
double const eps = 1e-6;
ll const Base=1e9+7,oo=1e17,MAXN=1e6;


ll A[MAXN+5];

ll Solves(){
	
	ll n,m,k,cnt=0,ans=0,x,y,q,c,sum=0,v,t;
	// PROCESS IN HERE
	
	sc2(n,m);
	pr(n*(n-1)/2+m*(m-1)/2);
	
	
	
	
	
	re 0;
	// Hack it if you can :)
}

int main(){
	//INPUT;
	if(fopen("locin.txt", "r"))INPUT;
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll test=1;
//	sc(test);
	fu(T,1,test){
//		cout<<"Case #"<<T<<": ";
		Solves();
	} 		
}

Measured memory_bytes: 256
const lines=readlines(open("/dev/fd/0"))
let
    state=0
    global input
    input()=lines[state+=1]
end
int(s::String)=parse(Int32,s)
intSub(s::SubString{String})=parse(Int32,s)
intLine()=map(intSub,split(input()))
function main()
    a,b=intLine()
    println(a<9>b ? "Yay!" : ":(")
end
main()

Measured memory_bytes: 116432
#include <bits/stdc++.h>
using namespace std;
typedef long double LD;
typedef long long ll;
#define int ll
#define pb push_back
#define mp make_pair
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
#define forn(i, n) for (int i = 0; i < n; i++)
void solve()
{
    int n;
    cin >> n;
    vpii v(n);
    forn(i, n)
    {
        cin >> v[i].first >> v[i].second;
    }
    int c = 0;
    for (int i = 0; i + 2 < n; i++)
    {
        if (v[i].first == v[i].second && v[i + 1].first == v[i + 1].second && v[i + 2].first == v[i + 2].second)
            c++;
    }
    if (c)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
int32_t main()
{
    // int t;
    // cin >> t;
    // while(t--)
    solve();

    return 0;
}

Measured memory_bytes: 3636
use proconio::input;

fn main() {
    input!(n: usize, s: [String; n]);

    let (mut a, mut b, mut c, mut d) = (0, 0, 0, 0);
    for i in 0..n {
        if s[i] == "AC" {
            a = a + 1;
        }
        if s[i] == "WA" {
            b = b + 1;
        }
        if s[i] == "TLE" {
            c = c + 1;
        }
        if s[i] == "RE" {
            d = d + 1;
        }
    }

    println!("AC x {}\nWA x {}\nTLE x {}\nRE x {}", a, b, c, d);
}


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

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long long ll ;
typedef long double ld ;

const ll MOD = 1e9 + 7, N = 1e6 + 5 ;
const double PI = 2 * acos(0.0) ;
const long double EPS = 1.0E-14 ;

int main()
{
    ll n, gcd = 0, temp = 0, sum = 0 ;
    cin >> n ;

    for (ll i = 1; i <= n; i++) {
        for (ll j = 1; j <= n; j++) {
            gcd = __gcd(i, j) ;
            for (ll k = 1; k <= n; k++) {
                temp = __gcd(gcd, k) ;
                sum += temp ;
            }
        }
    }
    cout << sum ;

    return 0 ;
}


Measured memory_bytes: 3636
#include<cstdio>
#include<cctype>
#define SG getchar()
#define S return puts("No"),0
int n,m;
signed main(){scanf("%d%d",&n,&m),SG;while(n--){if(!isdigit(SG)){S;}}if(SG-45){S;}while(m--){if(!isdigit(SG)){S;}}return puts("Yes"),0;}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;



int main(){
    int n;
    cin >> n;
    if(n/100 == 7 || (n%100)/10 == 7 || n%10 == 7){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;


}

Measured memory_bytes: 3604
#include <iostream>
#include <list>

using namespace std;

int main(void)
{
	int n;
	
	while (1){
		list<int> lst_taro, lst_hana;
		char flag[201] = {0};
		cin >> n;
		if (n == 0){
			break;
		}
		
		for (int i = 0; i < n; i++){
			int c;
			cin >> c;
			lst_taro.push_back(c);
			flag[c] = 1;
		}
		lst_taro.sort();
		for (int i = 1; i <= 2 * n; i++){
			if (flag[i] == 0){
				lst_hana.push_back(i);
			}
		}
		
		
		int field = 0;
		int count = 0;
		while (lst_taro.size() > 0 && lst_hana.size() > 0){
			list<int>::iterator it = count % 2 == 0 ? lst_taro.begin() : lst_hana.begin();
			list<int>::iterator end = count % 2 == 0 ? lst_taro.end() : lst_hana.end();
			
			while (it != end){
				if (*it > field){
					break;
				}
				it++;
			}
			if (it == end){
				field = 0;
			}
			else {
				field = *it;
				(count % 2 == 0 ? lst_taro : lst_hana).erase(it);
			}
			count++;
		}
		
		cout << lst_hana.size() << endl << lst_taro.size() << endl;
	}
	
	return (0);
}

Measured memory_bytes: 0
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc  = new Scanner(System.in);
		double x=0,h=0;
		
		while(sc.hasNext()){
			x = sc.nextInt();
			h = sc.nextInt();
			if(x==0 && h==0) break;

			System.out.println(
					(x*x)+(((Math.sqrt(Math.pow(x/2,2)+Math.pow(h,2)))*x/2)*4));
			// x*X テ」ツ?古・ツコツ陛ゥツ敖「テァツゥツ?
			// テ、ツクツ嘉ィツァツ津・ツスツ「テ」ツ?ョテゥツォツ佚」ツ?陛」ツ?ッテ」ツ?』/2テ」ツ?ョテ、ツコツ古、ツケツ?hテ」ツ?ョテ、ツコツ古、ツケツ療」ツつ津」ツδォテ」ツδシテ」ツδ?
		}
	}

}

Measured memory_bytes: 17196
#ABC175 B
N = int(input())
L = list(map(int,input().split()))
ans = 0
frag = 0
if len(L) <= 2:
  ans = 0
else:
  for a in range(0,N-2):
    for b in range(a+1,N-1):
      for c in range(b+1,N):
        if L[a] == L[b] or L[a] == L[c] or L[b] == L[c]:
          continue
        if L[a]+L[b] > L[c] and L[b]+L[c] > L[a] and L[c]+L[a] > L[b]:
          ans += 1

print(ans)

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

int main() {
    int a, b, h, m;
    cin >> a >> b >> h >> m;
    double ath, bth, th, ans;
    ath = h / 12.0 + m / 720.0;
    bth = m / 60.0;
    th = min(fabs(ath-bth), fabs(bth-ath));
    //cout << "th: " << th << "  , cos: " << cos(2*M_PI*th) << endl;
    //cout << sqrt(a*a + b*b - 2*a*b*cos(2*M_PI*th)) << endl;
    ans =  sqrt(a*a + b*b - 2*a*b*cos(2*M_PI*th));
    printf("%.16f\n", ans);
    return 0;
}

Measured memory_bytes: 4188
X, Y, A, B, C = map(int, input().split())
p = sorted([int(i) for i in input().split()],reverse=True)
q = sorted([int(i) for i in input().split()],reverse=True)
r = sorted([int(i) for i in input().split()],reverse=True)

p_counter = 0
q_counter = 0
r_counter = 0
total = 0
p2 = p[ p_counter]
q2 = q[ q_counter]
r2 = r[ r_counter]
l = [ r2, p2, q2]
while p_counter +q_counter+r_counter < X+Y:
    m = max(l)
    total+=m
    index = l.index(m)


    if index == 0:
        r_counter+=1
        if r_counter >= len(r):
            r2 = 0
        else:
            r2 = r[r_counter]
    elif index == 1:
        p_counter +=1
        if p_counter >= X:
            p2 = 0
        else:
            p2 = p[p_counter]
    else:
        q_counter+=1
        if q_counter >= Y:
            q2 = 0
        else:
            q2 = q[q_counter]
    l = [r2, p2, q2]
print(total)

Measured memory_bytes: 23200
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
const int INF = 2e9;
const int MOD = 1e9 + 7;

int main() {
   int h,a;
   cin >> h >> a;
   cout << (h+a-1)/a << endl;
   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define print(x) cout << (x) << endl;
#define sz(x) int(x.size())
 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}
 
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(void){
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    ll n;
    cin >> n;
    vector<ll> h(n);
    rep(i, n) cin >> h[i];
    ll ans = 0;
    ll tmp = 0;
    rep(i,n-1){
      if(h[i] >= h[i+1]){
        tmp++;
      }else{
        chmax(ans,tmp);
        tmp = 0;
      }
      chmax(ans,tmp);
    }
    print(ans);
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstdio>
#include <climits>
#include <set>
using namespace std;

int a[100010];

int main()
{
    int h, w;
    cin >> h >> w;

    int dx[4] = {0, 1, 0, -1,};
    int dy[4] = {1, 0, -1, 0,};

    string str[h];
    for(int i = 0; i < h; i++)
    {
        cin >> str[i];
    }

    bool flag;

    for(int i = 0; i < h; i++)
    {
        for(int j = 0; j < w; j++)
        {
            if(str[i].at(j) == '#')
            {
                flag = false;
                for(int k = 0; k < 4; k++)
                {
                    int x = i + dx[k];
                    int y = j + dy[k];

                    if(x >= 0 and x < h and y >= 0 and y < w and str[x].at(y) == '#')
                    {
                        flag = true;
                    }
                }
                if(!flag)
                {
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }

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

Measured memory_bytes: 256