akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
#define ff first
#define endl "\n"
#define ss second
#define all(v) v.begin(), v.end()
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res % p;
}
void solve()
{
    int n, d;
    cin >> n >> d;
    d = d * d;
    int ans = 0;
    int a, b;
    for (int i = 0; i < n; i++)
    {
        cin >> a >> b;
        a = a * a + b * b;
        if (a <= d)
        {
            ans++;
        }
    }
    cout << ans << endl;
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int tc;
    tc = 1;
    //cin >> tc;
    while (tc--)
    {
        solve();
    }

    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n;
  ll sum, min = 1e9;
  cin >> n;
  vector<int> x(n);
  for(int i = 0; i < n; i++) cin >> x.at(i);
  for(int i = 0; i <= 100; i++) {
    sum = 0;
    for(int j = 0; j < x.size(); j++) {
      sum += pow(i-x.at(j),2);
    }
    if(sum < min) min = sum;
  }
  cout << min << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> a(n),b(n+1,0);
  for(int i=0;i<n;i++){
    cin>>a[i];
    b[i+1]=a[i];
  }
  int ans=0;
  for(int i=1;i<=n;i++){
    if(i==b[b[i]]){
      ans++;
      b[i]=0;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3996
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;

vector<string> vs;
int main(){
    string s,t;
    cin>>s>>t;
    int sz=t.size();
    rep(i,(int)s.size()-sz+1){
        bool flag=true;
        rep(j,sz){
            if(s[j+i]!='?'&&s[j+i]!=t[j]) flag=false;
        }
        if(flag){
            string ans=s;
            rep(j,s.size()){
                if(s[j]=='?') ans[j]='a';
            }
            ans.replace(i,sz,t);
            vs.pb(ans);
        }
    }
    sort(vs.begin(),vs.end());
    if(vs.empty()) cout<<"UNRESTORABLE"<<endl;
    else cout<<vs[0]<<endl;
    return 0;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    a = list(map(int, input().split()))

    a.sort()
    tf = [0] * (a[-1] + 1)
    for ea in a:
        tf[ea] = 1
    for i1 in range(n - 1):
        if a[i1] == a[i1 + 1]:
            tf[a[i1]] = 0

        for i2 in range(2, a[-1]//a[i1] + 1):
            tf[a[i1] * i2] = 0
    r = sum(tf)
    print(r)


if __name__ == '__main__':
    main()


Measured memory_bytes: 92844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(n);++i)
#define _repe3(i,a,b) for(ll i=(a);i<=(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(b)-1;i>=(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
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;}
template<class T>
using pq=priority_queue<T,vector<T>,greater<T>>;

ll N;

void solve();

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin >> N;
    solve();
}

// 1 ≤ N ≤ 9
// N は整数である。

// ll N
// 設定できるパスワードが何種類であるかを出力せよ。
void solve(){
    cout<<N*N*N<<endl;    
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int mmin(int &a, int b) {
	a = min(a, b);
	return a;
}
int mmax(int &a, int b) {
	a = max(a, b);
	return a;
}
int sq(vector<vector<int> > &ha,vector<vector<int> > & mo,int y,int x,int m, int n) {
	int ans = 0;
	if (0 <= x and x < n-1 and 0 <= y and y < m-1) {
		ans = 1;
		for (int i = 0; i < 2; i++) {
			for (int j = 0; j < 2; j++) {
				if (ha[y + i][x + j] != mo[i][j]) {
					ans = 0;
				}
			}
		}
	}
	return ans;
}
int ko(vector<vector<int> > &ha, vector<vector<int> > & mo, int y, int x, int m, int n) {
	int ans = 0;
	for (int dy = 0; dy >= -1; dy--) {
		for (int dx = 0; dx >= -1; dx--) {
			ans += sq(ha, mo, y + dy, x + dx, m, n);
		}
	}
	return ans;
}
int main() {
	int m, n;
	cin >> m >> n;
	vector<vector<int> > h(m, vector<int>(n));
	string he = "JOI";
	for (int i = 0; i < m; i++) {
		string s; cin >> s;
		for (int j = 0; j < n; j++) {
			for (int k = 0; k < 3; k++) {
				if (he[k] == s[j]) {
					h[i][j] = k;
				}
			}
		}
	}
	vector<vector<int> > mo(2, vector<int>(2));
	for (int i = 0; i < 2; i++) {
		string s; cin >> s;
		for (int j = 0; j < 2; j++) {
			for (int k = 0; k < 3; k++) {
				if (he[k] == s[j]) {
					mo[i][j] = k;
				}
			}
		}
	}
	int sy = 0;
	for (int i = 0; i < m - 1; i++) {
		for (int j = 0; j < n - 1; j++) {
			bool che = true;
			for (int k = 0; k < 2; k++) {
				for (int l = 0; l < 2; l++) {
					if (h[i + k][j + l] != mo[k][l]) {
						che = false;
					}
				}
			}
			if (che) {
				sy++;
			}
		}
	}
	int cha = 0;
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < n; j++) {
			int mot = ko(h, mo, i, j, m, n);
			for (int k = 0; k < 2; k++) {
				h[i][j] = (h[i][j] + 1) % 3;
				int x = ko(h, mo, i, j, m, n);
				mmax(cha, x - mot);
			}
			h[i][j] = (h[i][j] + 1) % 3;
		}
	}
	cout << sy+cha << endl;
}


Measured memory_bytes: 6848
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <limits>

using namespace std;

using lint = long long;

constexpr int INF = numeric_limits<int>::max() / 2;

string sed(string a, string b, string s) {
    string ret;
    for (int i = 0; i < s.length();) {
        bool judge = true;
        for (int j = 0; j < a.length(); ++j) {
            if (i + j >= s.length() || a[j] != s[i + j]) {
                judge = false;
                break;
            }
        }
        if (judge) {
            ret += b;
            i += a.length();
        } else {
            ret.push_back(s[i]);
            ++i;
        }
    }

    return ret;
}

bool solve() {
    int n;
    cin >> n;
    if (n == 0) return false;

    vector<pair<string, string>> ps(n);
    for (auto& p : ps) cin >> p.first >> p.second;
    string s, g;
    cin >> s >> g;

    function<int(string)> dfs =
        [&](string ss) {
            int ret = INF;
            if (ss == g) {
                ret = 0;
            } else if (ss.length() < g.length()) {
                for (auto p : ps) {
                    string gg = sed(p.first, p.second, ss);
                    if (ss != gg) ret = min(ret, dfs(gg) + 1);
                }
            }
            return ret;
        };

    int ans = dfs(s);
    cout << (ans == INF ? -1 : ans) << endl;
    return true;
}

int main() {
    while (solve()) {}
    return 0;
}



Measured memory_bytes: 3120
#include<bits/stdc++.h>
using namespace std;
const int N = 200003;
int n;
long long ans, d, a[N], f[N], g[N];
int main(){
	scanf("%d%lld", &n, &d);
	for(int i = 1;i <= n;i ++){
		scanf("%lld", a + i);
		ans += a[i];
	}
	f[1] = a[1];
	for(int i = 2;i <= n;i ++) f[i] = min(f[i - 1] + d, a[i]);
	g[n] = a[n];
	for(int i = n - 1;i;i --) g[i] = min(g[i + 1] + d, a[i]);
	for(int i = 2;i < n;i ++) ans += min(f[i], g[i]);
	printf("%lld\n", ans + (n - 1) * d);
}

Measured memory_bytes: 4992
# -*- coding: utf-8 -*-
S = input()
s1 = int(S[:2])
s2 = int(S[2:])
if 0<s1<=12 and 0<s2<=12:
  print('AMBIGUOUS')
elif 0<s2<=12:
  print('YYMM')
elif 0<s1<=12:
  print('MMYY')
else:
  print('NA')



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

int main() {
  string S , T ;
  cin >> S >> T ;
  int sum = 0 ;
  for(int i = 0 ; i < 3 ; i++){
    if(S[i]==T[i]){
      sum++ ;
    }
  }
cout << sum << endl;
  
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
//
// Created by karayuu on 2018-12-19.
//
int main() {
    int a, b;
    cin >> a >> b;

    int l, s;
    l = 2 * (a + b);
    s = a * b;

    cout << s << " " << l << endl;
}



Measured memory_bytes: 3120
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>
 
#define rep(i,n) for(ll i=0;i<(n);i++)
typedef long long ll;
using namespace std;

int main() {
  ll X;
  cin >> X;
  ll S = 100;
  ll cnt = 0;
  while( S < X ) {
    S += S / 100;
    cnt++;
  }
  cout << cnt << endl;
}

    
  

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int ceil(int x,int y){
	if(x/y*y!=x)return x/y+1;
	else return x/y;
}
int main(){
	int n,d;
	cin>>n>>d;
	d=d*2+1;
	cout<<ceil(n,d)<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	int k,a,b;
	cin>>k>>a>>b;
	for(;a<=b;a++){
		if(a%k==0){
			cout<<"OK"<<endl;
			return 0;
		}
		//cout<<a<<endl;
	}
	cout<<"NG"<<endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a7=1000000007;
ll inf=1000000000000000;
typedef pair<ll,ll> l_l;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back


ll min(ll a,ll b){
    if(a<b)return a;
    return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    return b;
}

vector<vector<ll>> g(1000000);
bool go[1000000];

int main(){
    ll n,m;cin>>n>>m;
    ll a[m],b[m];
    rep(i,0,m-1){
        cin>>a[i]>>b[i];
        g[a[i]].pb(b[i]);
        g[b[i]].pb(a[i]);
    }
    vector<ll> v[2];
    
    rep(i,0,g[1].size()-1){
        v[1].pb(g[1][i]);
        go[g[1][i]]=true;
    }
    ll l;
    rep(i,0,v[1].size()-1){
        l=v[1][i];
        rep(i,0,g[l].size()-1){
            go[g[l][i]]=true;
        }
    }
    if(go[n]){
        cout<<"POSSIBLE"<<endl;
    }else{
        cout<<"IMPOSSIBLE"<<endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 36328
def main():
    import numpy as np 
    N,D = map(int,input().split())
    X = []
    
    for i in range(N):
        X.append(list(map(int,input().split())))
    
    ans = 0

    for i in range(N):
        for j in range(i+1,N):
            tmp = 0
            for h in range(D):
                tmp += (X[i][h]-X[j][h])**2
            dist = np.sqrt(tmp)
            if dist%1 == 0:
                ans += 1
    
    print(ans)


if __name__=="__main__":
    main()

Measured memory_bytes: 12504
#include <bits/stdc++.h>
using namespace std;
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;
}

#ifdef DEBUG
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
#else
template <class T, class... Args>
void debug(const T &x, const Args &... args) {}
template <class T> void debugVector(const vector<T> &v) {}
#endif

using ll = long long;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int sum = accumulate(ALL(a), 0);
    cin >> m;
    for(int i = 0; i < m; i++) {
        int p, x;
        cin >> p >> x;
        cout << sum - a[p - 1] + x << endl;
    }
}

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

typedef long long int64;
#define REP(i,n) for(int64 i=0;i<(int64)(n);i++)
#define REPD(i,n) for(int64 i=(int64)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(int64 i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((int64)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define GSORT(x) sort(ALL(x), greater<int64>());
#define SUM(x) accumulate(ALL(A), 0);
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using namespace std;

void Main()
{
	int64 W,H,x,y,r;
	cin >> W>>H>>x>>y>>r;
	bool check=true;
	if(!(r<=x&&x<=W-r)) check=false;
	if(!(r<=y&&y<=H-r)) check=false;
	//REP(i,4){
	//	int a=W,b=H;
	//	if(i==0) {a=0;b=0;}
	//	if(i==1) {b=0;}
	//	if(i==2) {}
	//	if(i==3) {a=0;}
	//	int val=pow((x-a),2)+pow((y-b),2)-r*r;
	//	if(val<0){
	//		check=false;
	//	}
	//}
	string result="Yes";
	if(!check){
		result="No";
	}
	cout << result << endl;
	return;
}

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



Measured memory_bytes: 3248
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>

#define pb push_back
#define mp make_pair

using namespace std;

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

bool isPrime(int k) {
  if (k < 2) {
    return false;
  } else {
    for (int i = 2; i*i <= k; ++i) {
      if (k%i == 0) {
        return false;
      }
    }

    return true;
  }
}

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

  while (!isPrime(x)) {
    x++;
  }

  cout << x << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i)
typedef long long ll;
template<typename T>inline bool chkmin(T &x,T y){return (y<x)?(x=y,1):0;}
template<typename T>inline bool chkmax(T &x,T y){return (y>x)?(x=y,1):0;}
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
inline ll readll(){
	ll x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
	return x*f;
}
const int maxn=1e5+10;
int p[maxn],stk[maxn],top;
char s[10];
int query(int x,int y){
	printf("? %d %d\n",x-1,y-1);
	fflush(stdout);
	scanf("%s",s+1);
	return s[1]=='Y';
}
int main(){
	int A=read(),B=read();
	if(A<=B) return printf("Impossible\n"),0;
	int n=A+B;
	REP(i,1,n){
		if(!top) stk[++top]=i;
		else{
			if(query(i,stk[top])) stk[++top]=i;
			else --top;
		}
	}
	assert(top);
	REP(i,1,n) p[i]=(i!=stk[1]?query(stk[1],i):1);
	putchar('!');
	REP(i,1,n) putchar(p[i]+'0');
	putchar('\n');
	fflush(stdout);
	return 0;
}


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


int main(){
  int n,m,Q;cin>>n>>m>>Q;
  int a[n+2][n+2];
  memset(a,0,sizeof(a));
  
  for(int i=0;i<m;i++){
    int l,r;cin>>l>>r;
    ++a[r][l];
  }
  
  for(int i=1;i<=n;i++){
    for(int j=n;j>=1;j--){
      a[i][j]+=a[i][j+1];
    }
  }
  
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      a[j][i]+=a[j-1][i];
    }
  }

  for(int i=0;i<Q;i++){
    int p,q;cin>>p>>q;
    cout<<a[q][p]<<endl;
  }
    
  return 0;
}


Measured memory_bytes: 1920
#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 if(a ==b){
        cout << "a == b" << endl;
    }
    return 0;
}


Measured memory_bytes: 3072
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		System.out.println((a - c) * (b - d));
	}
	
}


Measured memory_bytes: 22864
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops") 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<typename T> 
void remdup(vector<T>& v) {
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "C:\Users\navodit\Desktop\mycodes\pr.h"
#else
#define trace(...)
#endif

#define MOD 1000000007  




const int N =2e5+5;

void solve(){
	int n , k ;
	cin >> n >> k; 
	string s; 
	cin >> s ; 
	int ans = 0 ; 
	if(k==2){
		rep(i,0,n){
			if((s[i] - '0') % 2 == 0) ans+=(i+1);
		}
	}
	else if(k==5){
		rep(i,0,n){
			if((s[i] - '0') % 5 == 0) ans+=(i+1);
		}
	}
	else{
		map<int,int>mp;
		mp[0]=1;
		int num = 0 ;
		int p10 = 1;
		for(int i = n - 1; ~i ; --i){
			num = (num+(s[i] - '0')*p10)%k;
			//trace(num);
			//num%=k ;
			ans += mp[num];
			mp[num]++;
			p10=p10*10%k;
			//trace(p10);
		}
		trace(mp) ; 
	}
	cout << ans << endl; 
}
signed main() {
	unsyncIO();
	int tt =1 ;
	// cin >> tt;
	rep(i,0,tt) solve();













#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 4116
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;
int main(){
	int a,b;
	cin >> a >>  b;
	cout << a * b << endl;
}


Measured memory_bytes: 3596
using System;
    class Program
    {
        static void Main(string[] args)
        {
            string[] data = Console.ReadLine().Split(' ');
            if (int.Parse(data[0]) < int.Parse(data[1]) && int.Parse(data[1]) < int.Parse(data[2]))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }

Measured memory_bytes: 13468
#include<stdio.h>
 
int main(){
	int a, b, i, ans = 0;
	while(scanf("%d", &a) != 0){
		if(a == 0) break;
		a /= 4;
		for(i = 0; i < a; i++){
			scanf("%d", &b);
			ans += b;
		}
		printf("%d\n", ans);
		ans = 0;
	}
	return 0;
}

Measured memory_bytes: 1028
#include <iostream>
//#include <iomanip>
#include <cstdio>
using namespace std;

//0004
int main(){
	// ax + by = c
    // dx + ey = f
	// =>	x=(ce-bf)/(ae-bd)
	//      y=(cd-af)/(bd-ae)
	int a,b,c,d,e,f;
	while(cin >> a >> b >> c >> d >> e >> f){
		double x,y;
		int temp_x, temp_y;
		

		temp_x = c*e-b*f;
		temp_y = c*d-a*f;
		//x = (c*e-b*f)/(a*e-b*d);
		//y = (c*d-a*f)/(b*d-a*e);

		temp_x==0 ? x=0.0L : x = (double)(c*e-b*f)/(a*e-b*d);
		temp_y==0 ? y=0.0L : y = (double)(c*d-a*f)/(b*d-a*e);
		
		printf("%.3f %.3f\n", x, y);

		//cout.precision(3);
		//cout << x << " " << y << endl;
	}

	return 0;
}

Measured memory_bytes: 0
h, w = map(int,input().split())

if w % 3 == 0 or h % 3 == 0:
    print(0)

else:
    s = h * w
    l = [h,w]
    for i in range(0,2):
        if w == 2 and i == 0:
            continue
        a = (int(w/3) + i) * h
        b = (w - (int(w/3) + i)) * int(h/2)
        c = s - a - b
        #print([a,b,c])
        l.append(max([a,b,c])-min([a,b,c]))
    for j in range(0,2):
        if h == 2 and j == 0:
            continue
        a = (int(h/3) + j) * w
        b = (h - (int(h/3) + j)) * int(w/2)
        c = s - a - b
        #print([a,b,c])
        l.append(max([a,b,c])-min([a,b,c]))
    print(min(l))

Measured memory_bytes: 3064
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct BoolName : numpunct<char> {
  string t, f;
  BoolName (string t = "Yes", string f = "No") : t(t), f(f) {}
  string do_truename() const {return t;}
  string do_falsename() const {return f;}
};

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15) << boolalpha;
    cout.imbue(locale(cout.getloc(), new BoolName));
  }
} initializer;

template<typename T> istream& operator>>(istream &s, vector<T> &v) {
  for (T &t : v) s >> t;
  return s;
}

template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
  for (const T &t : v) s << t << endl;
  return s;
}

void set_bool_name(string t, string f) {
  cout.imbue(locale(cout.getloc(), new BoolName(t, f)));
}

int main() {
  set_bool_name("first", "second");
  int n;
  cin >> n;
  vector<int> a(n);
  cin >> a;
  for (int i : a) {
    if (i % 2) {
      cout << true << endl;
      return 0;
    }
  }
  cout << false << endl;
}



Measured memory_bytes: 640
package main

import "fmt"

var (
	x1,x2,y1,y2,x3,x4,y3,y4 int
)

func main() {
	fmt.Scanln(&x1,&y1,&x2,&y2)
	x3 = x2+y1-y2
	y3 = y2+x2-x1
	x4 = x1+y1-y2
	y4 = y1+x2-x1
	fmt.Println(x3,y3,x4,y4)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF LLONG_MAX - 100
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define lower_bound lowb
#define upper_bound upb
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



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

	int N;
	cin >> N;
	int a[N + 10] = {};
	vector<int> cnts(N + 10, 0);

	rep(i, N) cin >> a[i + 1];
	for(int i = N; i > 0; i--) {
		int times = 2;
		int cnt = 0;
		while(i * times <= N) {
			cnt += cnts[i * times];
			times++;
		}
		cnts[i] = (cnt % 2 == a[i] ? 0 : 1);
	}

	cout << accumulate(all(cnts), 0) << endl;
	rep(i, N) {
		if(cnts[i + 1]) cout << i + 1 << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3968
import sys
sys.setrecursionlimit(10000)
input = sys.stdin.readline

def chk(a):
	a_name = ''
	for k, v in globals().items():
		if id(v) == id(a):
			a_name = k
			break
	print(a_name+' = '+str(a), file=sys.stderr)

def mt(f):
	import time
	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		print(e - s, 'sec', file=sys.stderr)
		return ret
	return wrap

@mt
def slv(T, X):
	chk(T)
	chk(X)
	return T/X

T, X = [int(i) for i in input().split()]
print(slv(T, X))

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

int pjg,n,i,total,ada[100003],l,r;
string s;

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

    cin>>pjg>>n;
    cin>>s;

    total=0; ada[0]=0;
    for(i=1;i<s.length();i++){
        if(s[i-1]=='A' && s[i]=='C')total++;
        ada[i]=total;
    }

    for(i=0;i<n;i++){
        cin>>l>>r;
        l--; r--;
        cout<<ada[r]-ada[l]<<"\n";
    }
}


Measured memory_bytes: 1488
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
 
int main(){ 
  int n;
  cin >> n;
  vector<vector<P>> key(n);
  rep(i,n) {
    int a;
    cin >> a;
    int pos = 0;
    rep(j,a) {
      int x, y;
      cin >> x >> y;
      x--;
      key[i].push_back({x,y});
    }
  } 
 
  int res = 0;
 
  for (int bit = 0; bit < (1 << n); bit++) {
    bool ok = true;
    for (int j = 0; j < n; j++) {
      if (bit & (1 << j)) {
        for (auto e : key[j]) {
          if (e.second) {
            if (!(bit & (1 << e.first))) ok = false;
          } else {
            if (bit & (1 << e.first)) ok = false;
          }
        }
      }
    }
    if (ok) res = max(res, __builtin_popcount(bit));
  }
  cout << res << endl;
  return 0;
} 

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

// 整数の累乗x^n O(log2n)
ll power(ll x, ll n) {
	ll ret = 1LL;
	while(0 < n){
		if((n % 2) == 0){
			x *= x;
			n >>= 1;
		}else{
			ret *= x;
			--n;
		}
	}
	return ret;
}

int main() {
	ll n;
	cin >> n;
	ll now = 0;
	ll cnt = 0;
	while(now < n) {
		cnt++;
		now += power(26, cnt);
		// cout << cnt << " : "<< now << endl;
	}
	vector<int> ans(cnt);
	rep(i, cnt) {
		ans[i] = n%26;
		// cout << ans[i] << " ";
		if(ans[i]==0) {
			ans[i] = 26;
			n--;
		}
		n /= 26;
		
	}
	rep(i, cnt) printf("%c", (char) ('a' + ans[cnt-1-i]-1));
	cout << endl;
	// rep(i, cnt) printf("%d ",ans[cnt-1-i]);
	// cout << endl;
	return 0;
}

Measured memory_bytes: 3604
n, m, x = map(int, input().split())
al = list(map(int, input().split()))

right_route = 0
for i in range(x, n+1):
    if i in al:
        right_route += 1

left_route = 0
for i in reversed(range(1, x+1)):
    if i in al:
        left_route += 1

print(min(right_route, left_route))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(a); i++)
typedef long long ll;
template<typename T>
struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

/////////////////////////////////////////////////////////////////////
const ll inf = 1LL<<60;

int main()
{
  ll n, x; cin>>n>>x;
  vector<ll> l(n+1);
  rep(i, n) cin>>l[i+1];

  rep(i, n) l[i+1] += l[i];
  ll ans = upper_bound(l.begin(), l.end(), x) - l.begin();
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3548
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include <numeric>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 998244353
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}
int main(){
  ll A,B,C,D;cin>>A>>B>>C>>D;
  ll x=C*D/gcd(C,D);
  ll a=(A-1)/C,b=(A-1)/D;
  ll c=B/C,d=B/D;
  ll ans=0;
  ans=c+d-a-b;
  //cout<<ans<<endl;
  ll tmp=(A-1)/x,tmp1=B/x;
  ans-=tmp1-tmp;
  //cout<<ans<<endl;
  ans-=B-A+1;
  ans=abs(ans);
  cout<<ans<<endl;

}


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

int main(){
  int N;
  cin >> N;
  pair<pair<string, int>, int>p[N];
  rep(i, N){
    string S;
    int a;
    cin >> S >> a;
    p[i] = make_pair(make_pair(S, 100-a), i);
  }
  sort(p, p+N);
  for(auto k: p){
    cout << k.second+1 << endl;
  }
    
 
}



Measured memory_bytes: 256
import math
n = int(input())
freq = [[0] * 10 for _ in range(10)]

for i in range(1, n+1):
  a = int(str(i)[0])
  b = int(str(i)[-1])
  freq[a][b] += 1

ans = 0
for j in range(1, n+1):
  a = int(str(j)[0])
  b = int(str(j)[-1])
  ans += freq[b][a]

print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
int main() {
    int n;
    string s;
    cin >> n >> s;
    rep(i, s.size()) {
        char c = s[i];
        c += n;
        if (c - 'A' >= 26) c -= 26;
        cout << c;
    }
    cout << endl;
}


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

int main()
{
    int n, k;
    cin >> n >> k;

    int count = 0;

    for (int i = 0; i < n; i++)
    {
        int input;
        cin >> input;
        if (input >= k)
        {
            count++;
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
const int MAXN=90;
char s[MAXN][MAXN];
int k,a[MAXN],b[MAXN],c[MAXN];
void print(){
	int an=0;
		for(int i=0;i<8;i++){
		for(int j=0;j<8;j++){
			if(j==c[i]) s[i][j]='Q';
			else s[i][j]='.';
		}
	}
	for(int i=1;i<=k;i++){
		if(s[a[i]][b[i]]=='Q'){
			an++;
		}
	}
	if(an==k) {
		for(int i=0;i<8;i++){
		for(int j=0;j<8;j++){
			cout<<s[i][j];
		}
		cout<<endl;
	}
	}
	else {
		for(int i=0;i<8;i++){
		for(int j=0;j<8;j++){
			s[i][j]='.';
		}
	}
	an=0;
	}
}
void search(int r){
    if(r==8){
    	print();
        return;
    }
    for(int i=0; i<8; ++i){
        c[r] = i;
        int ok = 1;
        for(int j=0; j<r; ++j)
            if(c[r]==c[j] || r-j==c[r]-c[j] || r-j==c[j]-c[r]){
                ok = 0;
                break;
            }
        if(ok) search(r+1);
    }
}
int main(){
	cin>>k;
	for(int i=0;i<8;i++){
		for(int j=0;j<8;j++){
			s[i][j]='.';
		}
	}
	for(int i=1;i<=k;i++){
		cin>>a[i]>>b[i];
		s[a[i]][b[i]]='Q'; 
	}
	search(0);
	return 0;
}

Measured memory_bytes: 3100
/*******************************
 * written by Koki Riho
 * Rih0z https://github.com/Rih0z
 *******************************/

#include<iostream>
#include<map>
#include<vector>
#include<string>
#include<numeric>
#include<algorithm>

#define DEBUG false

#define FOR(i , a, b) for(size_t i = a ; i < b ; i++ )
#define REP(i,b) FOR(i , 0 , b)
#define RFOR(i,a,b) for(size_t i = a-1 ; i >= b ; i--)
#define RREP(i,a) RFOR(i,a,0)



typedef long long ll;
using namespace std;

int scanInt(void);
string scanString(void);

void scanLlArr(ll *a , int n);
void scanCharArr(char *string);

void printInt(int p);
void printLlArr(ll *a);
void printCharArr(char *string);


void perSum(ll *a , ll *sum ,int n);

/*************Global variable  **************/
int N ;
char str[26];
std::map<char,int> M ;
/*******************************/

int main(){
  if (DEBUG){
    std::printf("******debug mode********\n");
  }
  int count = 0 ;
  cin >> N ;
  int ans = 0;
  REP(i,N+1){
    for(int j = 1 ; j < i+1 ; j++ ){
      if(i%j==0 && i%2 != 0){
        count++;
      }    
    }
    if(count == 8){
      ans++;
    }
    count = 0;
  }
  cout << ans << endl;

  if (DEBUG){
    std::printf("******debug********\n");

    std::printf("******debug********\n");
  }
  return 0 ;
}

//各地点までの部分和を計算する
void perSum(ll *a , ll *sum ,int n){
  int i ;
  sum[0] = a[0];
  for(i = 1 ; i < n ; i++){
    sum[i] = a[i] + sum[i-1];
  }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> P;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 29;
static const LL LL_INF = 1ll << 60;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

#ifdef WIN32
#define dump(x) cout << #x << " = " << (x) << "\n"
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n"
#else
#define dump(x)
#define debug(x)
#endif

int gcd( int x, int y ) {
	if ( y == 0 ) {
		return x;
	}
	return gcd( y, x % y );
}

int main() {
#ifdef WIN32
	printf( "Debug Mode\n" );
#endif
	int n, ans;
	
	scanf( "%d", &n );
	scanf( "%d", &ans );
	VI a( n - 1 );
	for ( int i = 0; i < n - 1; i++ ) {
		scanf( "%d", &a[ i ] );
	}
	for ( int i = 0; i < n - 1; i++ ) {
		ans = ans * a[ i ] / gcd( ans, a[ i ] );
	}
	printf( "%d\n", ans );
	return 0;
}

Measured memory_bytes: 1188
n = int(input())
d = {}
for _ in range(n):
  s = input()
  if s in d:
    d[s] += 1
  else:
    d[s] = 1
m = int(input())
for _ in range(m):
  t = input()
  if t in d and d[s] > 0:
    d[t] -= 1
print(max(d[s] for s in d))

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

using namespace std;

//#define _FILES
#define PB push_back
#define MP make_pair

typedef long long ll;
typedef pair<int,int> pii;

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

    #ifdef _FILES
        freopen("","r",stdin);
        freopen("","w",stdout);
    #endif // _FILES
    ll ans[50];
    ll k;
    cin >> k;
    memset(ans, 0, sizeof(ans));
    for (int i=0;i<k%50;++i)
    {
        ans[i] = 50;
    }

    for (int i=k%50;i<50;++i)
    {
        ans[i] = 49 - k % 50 ;
        if (ans[i] < 0) ans[i] = 0;
    }
    for (int i=0;i<50;++i)
    {
        ans[i] += k/50;
    }

    cout << 50 << endl;
    for (int i=0;i<50;++i)
    {
        if (i) cout << " ";
        cout << ans[i];
    }
    cout << endl;
    return 0;
}


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

public class Main {

  public static void main(String[] args) throws IOException {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    String readStr;

    while ((readStr = reader.readLine()) != null) {
      int[] a = new int[4];
      int[] b = new int[4];
      String[] astrs = readStr.split(" ");
      String[] bstrs = reader.readLine().split(" ");
      for (int i = 0; i < a.length; i++)
        a[i] = Integer.parseInt(astrs[i]);
      for (int i = 0; i < b.length; i++)
        b[i] = Integer.parseInt(bstrs[i]);

      int hit = 0;
      int blow = 0;
      for (int i = 0; i < b.length; i++) {
        if (isBlow(a, b[i], i)) {
          blow++;
          continue;
        }
        if (isHit(a, b[i], i))
          hit++;
      }

      System.out.println(hit + " " + blow);

    }
  }

  public static boolean isHit(int[] array, int num, int index) {
    return array[index] == num;
  }

  public static boolean isBlow(int[] array, int num, int index) {
    if (isHit(array, num, index))
      return false;

    for (int n : array)
      if (n == num)
        return true;

    return false;
  }

}

Measured memory_bytes: 16928
#include<iostream>
#include<string>
#include<cstdio> 
#include<cstring>
#include<algorithm>
#include<cmath>

using namespace std;

int main(void) {
	int k, s, ans;
	while(scanf("%d %d", &k, &s) != EOF) {
		ans = 0;
		for(int i = 0; i <= k; i++) {
			for(int j = 0; j <= k; j++) {
				if(s-i-j <= k && s-i-j >= 0) {
					ans++;
				}
				
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#define N 120
using namespace std;

int l[N];

int main(void)
{
    int n;
    int o;
    int i;

    scanf("%d", &n);
    for(i = 0; i < (n << 1); i ++)
        scanf("%d", &l[i]);
    sort(l, l + (n << 1));
    for(i = o = 0; i < n; i ++)
        o += l[i <<1];
    printf("%d\n", o);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	ll count=0;
	ll n,m;
	cin>>n>>m;
	
	cout << n*(n-1)/2 + m*(m-1)/2 <<endl;
}

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

#define FOR(i, j, k) for(int i = j; i < k; i++)
#define REP(i, j) FOR(i, 0, j)
#define fst first
#define snd second
#define pb push_back
#define eb emplace_back
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;

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

template <typename T> istream &operator>>(istream &is, vector<T> &vec) {
    for(T &x : vec)
        is >> x;
    return is;
}

#define MOD 1000000007LL
ll n, k;
vector<int> es[100001];
bool used[100001];

ll solve(int u, int d, int pp) {
    ll result = k - min(d, 2) - pp;

    used[u] = true;
    // cout << u << " " << p << endl;

    int cnt = 0;
    for(auto v : es[u])
        if(!used[v]) {
            result = result * solve(v, d + 1, cnt++) % MOD;
        }

    // cout << u << " " << result << endl;
    return result;
}

int main() {

    cin >> n >> k;

    for(int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        es[a].push_back(b);
        es[b].push_back(a);
    }

    cout << solve(0, 0, 0) << endl;
    return 0;
}


Measured memory_bytes: 10496
#include <stdio.h>
#define MAX 100
int main(){
  int num[MAX],a,i,j,k,m,n;
    scanf("%d",&a);
    for(i=0;i<a;i++){
        scanf("%d",&num[i]);
        printf("%d",num[i]);
        if(i !=a-1){
           printf(" ");
       }
    }
    printf("\n");
    for(j=1;j<a;j++){
        n=j;
        for(k=j-1;k>=0;k--){
            if(num[k]>num[n]){
                m=num[k];
                num[k]=num[n];
                num[n]=m;
                n--;
            }
   }
        for(i=0;i<a;i++){
       printf("%d",num[i]);
       if(i !=a-1){
           printf(" ");
       }
       }
        printf("\n");
    }
    return 0;
}



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

#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << ends << H; debug_out(T...); }
#define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
 
////////////////////////////////////////////////////////////////////

const int N = 5e3 + 5;

int S[N], F[N], DP[2][N][N], PD[2][N];
vector<int> G[N];

void DFS(int v, int p = 0) {
	S[v] = 1;
	DP[0][v][1] = 1;
	memset(PD, 0, sizeof PD);
	for (int u : G[v]) if (u != p) {
		DFS(u, v);
		for (int i = 0; i <= S[v]; i++) for (int j = 0; j <= S[u]; j++)
			for (int k = 0; k < 2; k++) for (int t = 0; t < 2; t++) 
				PD[(k + t) % 2][i + j] = (PD[(k + t) % 2][i + j] + 1LL * DP[k][v][i] * DP[t][u][j] % MOD) % MOD,
				PD[(k + t + 1) % 2][i] = (PD[(k + t + 1) % 2][i] + 1LL * DP[k][v][i] * (1LL * F[j] * DP[t][u][j] % MOD) % MOD) % MOD;  
		S[v] += S[u];
		for (int i = 0; i < 2; i++) for (int j = 0; j <= S[v]; j++) DP[i][v][j] = PD[i][j], PD[i][j] = 0;
	}
}

int main() {

	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	mt19937 Rnd(time(0));

	F[0] = 1;
	for (int i = 2; i < N; i += 2) F[i] = 1LL * F[i - 2] * (i - 1) % MOD;

	int n; cin >> n;
	for (int i = 1; i < n; i++) {
		int v, u; cin >> v >> u;
		G[v].push_back(u), G[u].push_back(v);
	}
	DFS(1);
	int ans = 0;
	for (int i = 1; i <= n; i++) ans = (ans + 1LL * F[i] * (DP[0][1][i] + MOD - DP[1][1][i]) % MOD) % MOD;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 112812
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using ll = long long;
using vec = vector<int>;
using P = pair<int,int>;
const ll INF = 1e18;

int main() {
  int n; cin >> n;
  vec x(n), y(n), p(n);
  rep(i,n) cin >> x[i] >> y[i] >> p[i];

  vector<ll> ans(n+1, INF);
  vector<vector<ll>> dx(1<<n, vector<ll>(n+1, INF));
  vector<vector<ll>> dy(1<<n, vector<ll>(n+1, INF));

  rep(i,1<<n) {
    rep(j,n) {
      dx[i][j] = abs(x[j]);
      dy[i][j] = abs(y[j]);
      rep(k,n) {
        if (i>>k&1) {
          dx[i][j] = min(dx[i][j], (ll)abs(x[j]-x[k]));
          dy[i][j] = min(dy[i][j], (ll)abs(y[j]-y[k]));
        }
      }
      dx[i][j] *= p[j];
      dy[i][j] *= p[j];
    }
  }

  rep(i,1<<n) {
    for (int j = i; j >= 0; j--) {
      j &= i;
      ll cost = 0;
      rep(k,n) {
        if (!(i>>k&1)) {
          cost += min(dx[j][k], dy[i-j][k]);
        }
      }

      int cnt = __builtin_popcount(i);
      ans[cnt] = min(ans[cnt], cost);
    }
  }

  rep(i,n+1) {
    cout << ans[i] << endl;
  }
}


Measured memory_bytes: 14088
#include<iostream>
#include<string>
using namespace std;
int main(){
  string a;
  while(cin>>a){
    char ans = 'd';
    for(int i=0;i<3;i++){
      if(a[i]!='s'){
	if(a[i]==a[i+3]&&a[i]==a[i+6]){
	  ans = a[i];
	  goto END;
	}
      }
    }
    for(int i=0;i<9;i+=3){
      if(a[i]!='s'){
	if(a[i]==a[i+1]&&a[i]==a[i+2]){
	  ans = a[i];
	  goto END;
	}
      }
    }
    if(a[0]!='s'){
      if(a[0]==a[4]&&a[0]==a[8]){
	ans = a[0];
	goto END;
      }
    }
    if(a[2]!='s'){
      if(a[2]==a[4]&&a[2]==a[6]) ans = a[2];
    }
  END:
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1176
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>

using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = ((ll)(x) - 1); i >= 0; i--)

#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))

//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};

const ll mod = 1e9 + 7;
const ll IMF = 1LL<<29;
const double PI = 3.14159265358979323846;



vector<int> A,B;
int n,sum;
int main(){
        int i,a;
        cin >> n;
        for(i = 1; i <= n; i++){
                cin >> a;
                sum += abs(a);
                if(a > 0){
                        A.push_back(a);
                }
                else{
                        B.push_back(a);
                }
        }

        sort(all(A));
        sort(all(B));

        //マイナスがない時
        if(B.empty()){
                cout << sum - A[0]*2 << endl;;

                for(i = 1; i+1 < A.size(); i++){
                        cout << A[0] << " " << A[i] << endl;
                        A[0] -= A[i];
                }
                cout << A.back() << " " << A[0] << endl;
                return 0;
        }
        //プラスがない時
        if(A.empty()){
                cout << sum-abs(B.back() * 2) << endl;
                int sz = B.size();
                for(int i = 0; i+1 < sz; i++){
                        cout << B[sz-1] << " " << B[i] << endl;
                        B[sz-1] -= B[i];
                }
                return 0;
        }

        //マイナスとプラスが入り混じっている時
        cout << sum << endl;
        for(i = 1; i < A.size(); i++){
                cout << B[0] << " " << A[i] << endl;;
                B[0] -= A[i];
        }
        cout << A[0] << " " << B[0] << endl;
        A[0] -= B[0];
        for(int i = 1; i < B.size(); i++){
                cout << A[0] << " " << B[i] << endl;
                A[0] -= B[i];
        }
}




Measured memory_bytes: 2424
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

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

__attribute__((constructor))
void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

ll sumResult[200002] = {0};

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

    // 最初にそこまでの足した数を全部作っておく
    for (int i = 1; i <= 200002; i++) {
        sumResult[i] = sumResult[i] + sumResult[i - 1] + i;
    }

    ll result = 0;
    int i;
    for (i = K; i <= (N + 1); i++) { // i: 何個選択するか
        ll sumMin = sumResult[i - 1]; // 最小の選択
        ll sumMax = sumResult[N] - sumResult[N - i]; // 最大の選択結果
        result = (result + ((sumMax - sumMin) + 1)) % MOD;
    }
    cout << (result) << endl;
}


Measured memory_bytes: 5188