akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
#include<cassert>
 
struct Meirei{
    std::string mei;
    std::string str;
};

struct Node{
	Node(){
		umu=false;
		a=NULL;
		c=NULL;
		g=NULL;
		t=NULL;
	}
	~Node(){
		if(a != NULL){
			delete a;
		}
		if(c != NULL){
			delete c;
		}
		if(g != NULL){
			delete g;
		}
		if(t != NULL){
			delete t;
		}
	}
	bool umu;
	Node* a;//?????°???????????°????????????????????????????????§?????????????????°????????????
	Node* c;
	Node* g;
	Node* t;
};

class Tree
{
public:
	Tree(){
		m_root=new Node();
	}
	~Tree(){
		delete m_root;
	}
	void insert(std::string moji);
	bool find(std::string moji);
	
private:
	Node* m_root;
};

void Tree::insert(std::string moji)
{
//	m_root=new Node();
	Node* node = m_root;
	for(int i =0; i < moji.size(); i++){
		if(moji[i]=='A'){
			if(node->a == NULL){
				node->a = new Node();
			}
			node = node->a;
		}else if(moji[i]=='C'){
			if(node->c == NULL){
				node->c =  new Node();
			}
			node = node->c;
		}else if(moji[i]=='G'){
			if(node->g == NULL){
				node->g = new Node();
				
			}
			node = node->g;
		}else if(moji[i]=='T'){
			if(node->t == NULL){
				node->t = new Node();
			}
			node = node->t;
		}else {
			assert(true);
		}
		
	}
	node->umu=true;
	
}
//---------------------------------
bool Tree::find(std::string moji)
{
	Node* node = m_root;
	for(int i =0; i < moji.size(); i++){
		if(moji[i]=='A'){
			if(node->a == NULL){
				return false;
			}
			node = node->a;
		}else if(moji[i]=='C'){
			if(node->c == NULL){
				return false;
			}
			node = node->c;
		}else if(moji[i]=='G'){
			if(node->g == NULL){
				return false;
			}
			node = node->g;
		}else if(moji[i]=='T'){
			if(node->t == NULL){
				return false;
			}
			node = node->t;
		}else {
			assert(true);
		}
	}
	if(node->umu){
		return true;
	}
	return false;
}



//typedef std::vector<MEIREI> VecMeirei;
//typedef std::vector<std::string> WORDS;
//typedef std::vector<bool> ARINASHI;
//void input();
//bool find(WORDS jisho, std::string str);
void output(bool result);
//-------------------------------------------------------------------
int main()
{
    long n;
    std::cin >> n;
//    Tree* tree = new Tree();???//??????????????§????????????????????????
    Tree tree;
	for(int i=0; i<n; i++){
		std::string meirei;
	    std::cin >> meirei;
		std::string moji;
		std::cin >> moji;
		if(meirei=="insert"){
		    tree.insert(moji);
	    }else if(meirei=="find"){
	     	output(tree.find(moji));
	    }
	}
//	delete tree;
    return 0;
}
//-------------------------------------------------------------------
void output(bool result)
{
    if(result){
        std::cout << "yes" << std::endl;
    }else{
        std::cout << "no" << std::endl;
    }
    return;
}
//-------------------------------------------------------------------

Measured memory_bytes: 19512
n, T = map(int,input().split())
c0 = 1000
p = False
for i in range(n):
    c, t = map(int, input().split())
    if t <= T and c0 >= c:
        p = True
        c0 = c
if p:
    print(c0)
else:
    print('TLE')

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

int main(){
  int n;cin>>n;
  vector<int> H(n);
  for(int i = 0; i < n; i++) cin >> H[i];
  int ans = 1;
  int h = 1;
  for(int i = 1; i < n; i++){
    for(int j = 0; j < i; j++){
      if(H[i]<H[j]) h = 0;
    }
    if(h) ans++;
    h = 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
input = sys.stdin.readline

# bisect_left(lists, 3)
# bisect_right(lists, 3)

def main():
	A, B = map(int, input().split(" "))

	ans = 0
	if A <= B:
		ans += B
		B -= 1
	else:
		ans += A
		A-= 1
	if A <= B:
		ans += B
		B -= 1
	else:
		ans += A
		A-= 1

	print(ans)

	
	
if __name__ == "__main__":
	main()
	

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

int main(){
	int n;
	cin >> n;
	string s;
	cin >> s;
	vector<vector<int>> dp1(n,vector<int>(10, 0));
	vector<vector<int>> dp2(n,vector<int>(10, 0));
	for(int i(1);i<n;++i){
		rep(j,10){
			dp1[i][j] = dp1[i-1][j];
		}
		dp1[i][int(s[i-1] - '0')]++;
	}
	for(int i(n-2);i>=0;--i){
		rep(j,10){
			dp2[i][j] = dp2[i+1][j];
		}
		dp2[i][int(s[i+1] - '0')]++;
	}
	vector<int> memo(1000);
	for(int i(1);i<n-1;++i){
		vector<int> k1(10),k2(10), m1,m2;
		rep(j,10){
			if(dp1[i][j] != 0 && k1[j] == 0){
				k1[j]++;
				m1.push_back(j);
			}
			if(dp2[i][j] != 0 && k2[j] == 0){
				k2[j]++;
				m2.push_back(j);
			}
		}
		rep(p,m1.size()){
			rep(q, m2.size()){
				int num = 100*m1[p] + 10 * int(s[i]-'0') + m2[q];
				memo[num]++;
			}
		}
	}
	int ans(0);
	rep(i,1000){
		if(memo[i] != 0)ans++;
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4480
#include<iostream>
using namespace std;
#define ll long long
int main(){
  ll k,n;
  cin>>k>>n;
  ll a[n];
  ll ans=0;
  ll sum=0;
  for(ll i=0;i<n;i++)
    cin>>a[i];
  if(a[0]==0){
    for(ll i=1;i<n;i++)
      ans=max(ans,a[i]-a[i-1]);
    ans=max(ans,k-a[n-1]);
    cout<<k-ans;
  }
  else{
    for(ll i=1;i<n;i++){
      ans=max(ans,a[i]-a[i-1]);
    }
    ans=max(ans,k-a[n-1]+a[0]);
    cout<<k-ans;
  }
  
  return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		int n;
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		boolean flag = true;
		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			if (a % 2 == 0 && !(a % 3 == 0 || a % 5 == 0)) {
				flag = false;
				break;
			}
		}
		if (flag){
			System.out.println("APPROVED");
		}else {
			System.out.println("DENIED");
		}
	}
}

Measured memory_bytes: 35908
from collections import deque
n=int(input())
balls=[[int(i) for i in input().split()] for _ in range(n)]
diff=deque()
if n<=2:
    print(1)
else:
    for i in balls:
        for j in balls:
            if i!=j:
                diff.append((j[0]-i[0],j[1]-i[1]))
    ans=100000000000
    for p,q in set(diff):
        cnt=n
        for i in balls:
            for j in balls:
                if i!=j and j[0]-i[0]==p and j[1]-i[1]==q:
                    cnt-=1
        if cnt<ans:
            ans=cnt
    print(ans)

Measured memory_bytes: 3828
H,W = gets.split.map(&:to_i)
coins = []
points = []
(1..H).each{ |i|
  cs = gets.split.map(&:to_i)
  ps = (1..W).map{ |j| [i,j] }
  coins  += i&1==1 ? cs : cs.reverse
  points += i&1==1 ? ps : ps.reverse
}

ops = []
c = 0
(0...H*W-1).each{ |k|
  next if coins[k]&1 == 0
  coins[k]   -= 1
  coins[k+1] += 1
  ops << points[k]+points[k+1]
}

puts ops.size
ops.each{ |a| puts a.join(" ") }

Measured memory_bytes: 135596
#include<iostream> 
#include<algorithm>
#include<cmath>

using namespace std;

long long A,B;
long long c,d;

/*bool check(long long m,int n)
{
	bool ret = 0;
	if(m%n==0)
		ret = 1;
	else
		ret = 0;
	return ret;
}*/

int gcd(int m,int n)
{
	if(n == 0)
		return m;
	gcd(n,m%n);
}
	
long long cc,cd,peppa,add,rc;

int main()
{
	cin >> A >> B;
	cin >> c >> d;
	//long long maxab = max(A,B);
	//long long minab = min(A,B);
	/*long long fc,fd;
	long long tc,td;
	if(check(minab,c))
		fc = minab/c;
	else
		fc = minab/c+1;
	if(check(maxab,c))
		tc = maxab/c;
	else
		tc = maxab/c+1;
	if(check(minab,d))
		fd = minab/d;
	else
		fd = minab/d+1;
	if(check(maxab,d))
		td = maxab/d;
	else
		td = maxab/d+1;*/
	cc = B/c-(A-1)/c;
	cd = B/d-(A-1)/d;
	add = c*d/gcd(c,d);//jishi c youshi d debeishu
	rc = B/add-(A-1)/add;
	peppa = B-A+1-cd-cc+rc;
	cout <<	peppa << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int kaijo(int n) {
  int i;
  int k = 1;
  for(i = 2; i <= n; i++) {
    k = k * i;
  }
  return k;
}

int p_dict(int r[], int n) {
  int i, j, p = 1;
  for(i = 0; i < n; i++) {
    p += (r[i] - 1) * kaijo(n - i - 1);
    for(j = i + 1; j < n; j++) {
      if(r[j] > r[i]) r[j]--;
    }
  }
  return p;
}
  
int main(void) {

  int n;
  int p[9], q[9];
  int pn, qn;
  int rslt;
  int i;

  scanf("%d", &n);
  for(i = 0; i < n; i++) {
    scanf("%d", p + i);
  }
  for(i = 0; i < n; i++) {
    scanf("%d", q + i);
  }
  pn = p_dict(p, n);
  qn = p_dict(q, n);
  rslt = pn - qn;
  if(rslt < 0) rslt = -rslt;

  printf("%d\n", rslt);
  
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;++i)

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 3002;
const int MAX_S = 3002;

int dp[MAX_N][MAX_S];
int d[MAX_N];
vector<P> a;
int n,t,s;

int main()
{
	int x,y;
	scanf("%d%d%d",&n,&t,&s);
	rep(i,n){
		scanf("%d%d",&x,&y);
		a.push_back(P(x,y));
	}
	rep(j,s+1){
		dp[0][j] = 0;
	}
	rep(i,n){
		rep(j,s+1){
			if(j<a[i].second){
				dp[i+1][j] = dp[i][j];
			}else{
				dp[i+1][j] = max(dp[i][j],dp[i][j-a[i].second]+a[i].first);
			}
		}
	}
	rep(i,n){
		d[i] = dp[i][s];
	}
	rep(i,s+1){
		rep(j,t){
			dp[i][j] = 0;
		}
	}
	rep(j,t-s){
		dp[n+1][j] = 0;
	}
	for(int i=n;i>=1;i--){
		rep(j,t-s+1){
			if(j<a[i-1].second){
				dp[i][j] = dp[i+1][j];
			}else{
				dp[i][j] = max(dp[i+1][j],dp[i+1][j-a[i-1].second]+a[i-1].first);
			}
		}
	}
	int ans = 0;
	rep(i,n){
		ans = max(ans,d[i] + dp[i+1][t-s]);
	}
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;

int main() {

	int n;
	cin >> n;

	vector<string> w(n, "");
	for (int i = 0; i < n; i++) {
		cin >> w[i];
		if (i != 0 && w[i][0] != w[i - 1][w[i-1].size()-1]) {
			cout << "No" << endl;
			return 0;
		}
		for (int j = 0; j < i; j++) {
			if (i != j && w[i] == w[j]) {
				cout << "No" << endl;
				return 0;
			}
		}
	}

	cout << "Yes" << endl;

}

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

using namespace std;
using ll = long long;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

int main() {
  string s;
  cin >> s;
  string L = s.substr(0, 2);
  string R = s.substr(2, 2);
  int l = 10 * (L[0] - '0') + (L[1] - '0');
  int r = 10 * (R[0] - '0') + (R[1] - '0');
  if (1 <= l && l <= 12 && 1 <= r && r <= 12) {
    cout << "AMBIGUOUS" << endl;
    return 0;
  }
  if (1 <= l && l <= 12 && 0 <= r && r <= 99) {
    cout << "MMYY" << endl;
    return 0;
  }
  if (0 <= l && l <= 99 && 1 <= r && r <= 12) {
    cout << "YYMM" << endl;
    return 0;
  }
  cout << "NA" << endl;
  return 0;
}


Measured memory_bytes: 3592
;; D - Xor Sum 4
 
(declaim (optimize (speed 3) (safety 0)))

(defparameter *modulus* (+ (expt 10 9) 7))
(defparameter *max-bits* 60)

(defun add-bits-to-vector (n vec index)
  "配列vecに整数nの2進各桁を加える"
  (unless (zerop n)
    (multiple-value-bind (m b) (floor n 2)
      (unless (zerop b) (incf (aref vec index)))
      (add-bits-to-vector m vec (1+ index)))))

(defun solve (N)
  (let ((vec (make-array *max-bits* :initial-element 0)))
    ; 各数を2進数に変換したときの各桁の1の個数を求める
    (loop repeat N do (add-bits-to-vector (read) vec 0))
    ; 各桁を集約
    (reduce #'(lambda (l h) (mod (+ l (ash h 1)) *modulus*))
      ; 2進各桁のXORの総和 (= 1の個数 * 0の個数)
      (map 'vector #'(lambda (m) (* m (- N m))) vec)
      :from-end t)))
 
(defun main ()
  (print (solve (read)))
  (fresh-line))
 
(main)


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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  int n, k;
  cin >> n >> k;

  vector<int> back(n);

  rep(i, k){
    int d;
    cin >> d;
    rep(j, d){
      int a;
      cin >> a;
      a--;
      back[a] = 1;
    }
  }

  int cnt = 0;
  rep(i, n){
    cnt += back[i];
  }

  cout << n - cnt << endl;

  
  return 0;
}


Measured memory_bytes: 3664
n, a, b = map(int, input().split())

ans = []
if abs(a-b) % 2 == 0:
    ans.append(abs(a-b) // 2)
x = abs(1 - max(a,b))
y = abs(n - min(a,b))
ans.append(min(x, y))

x = abs(1 - min(a,b)) + 1
y = abs(max(a,b) - x)
if abs(1-y) % 2 == 0:
    ans.append(abs(1-y) // 2 + x)

x = abs(n - max(a,b)) + 1
y = abs(min(a,b) + x)
if abs(n-y) % 2 == 0:
    ans.append(abs(n-y) // 2 + x)

print(min(ans))


Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
/*
早めに混ぜる=>混ぜる回数が増える=>一回混ぜると半減する
大きいのは後から混ぜよう！
大きいのの混ぜる回数は少ないほうが良い
=>小さいのから順に混ぜていく、混ぜたものに混ぜる
*/
int main(){
  int n;
  cin >> n;
  vector<double>h(n);
  for(int i=0;i<n;i++)
    cin >> h.at(i);
  sort(h.begin(),h.end());
  double ans=h.at(0);
  for(int i=1;i<n;i++)
    ans=(ans+h.at(i))/2;
  cout << ans << endl;
  return 0;
}
  

Measured memory_bytes: 3692
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n, m;
ll a[100100];
ll s[300100];
ll t[300100];

void sum(ll l, ll r) {
    s[1] += r - l;
    t[l+1] += -1;
    t[r] += 1;
    s[r+1] += r-l-1;
    l += m;
    r += m;
    t[l+1] += -1;
    t[r] += 1;
    s[r+1] += r-l-1;
}

ll solve() {
    for (int i = 0; i < n-1; i++) {
        ll l, r;
        if (a[i] < a[i+1]) {
            l = a[i];
            r = a[i+1];
            sum(l, r);
        } else {
            l = a[i];
            r = a[i+1] + m;
            sum(l, r);
        }
    }
    ll res = s[1];
    for (int i = 2; i <= 3*m+1; i++) {
        s[i] += s[i-1] + t[i-1];
        t[i] += t[i-1];
        res = min(res, s[i]);
    }
    return res;
}

void input() {
    cin >> n >> m;
    for (int i = 0; i < n; i++) cin >> a[i];
}

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

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
    #define ll long long int
    using namespace std;
    int div(int n){
        int c=1,temp=7;
        while(temp%n!=0){
            temp=(temp%n)*10+7;
            c++;
        }
        return c;
    }
    int main()
    {
        int n;
        cin>>n;
        if(n%2==0 || n%5==0){
            cout<<-1;
            return 0;
        }
        cout<<div(n);
        return 0;
    }

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e18;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, a, b) for (int i = b - 1; i >= a; i--)
#define int ll
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

signed main() {
    int n;
    cin >> n;
    int d[n][2];
    rep(i, 0, n) cin >> d[i][0] >> d[i][1];
    rep(i, 0, n - 2) {
        if (d[i][0] == d[i][1] && d[i + 1][0] == d[i + 1][1] && d[i + 2][0] == d[i + 2][1]) {
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = int(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = int(n) - 1; (i) >= (int)(m); -- (i))
#define ALL(x) begin(x), end(x)
#define dump(x) cerr << #x " = " << x << endl
using ll = long long;
using namespace std;
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
template <class T, class U> inline void chmax(T & a, U const & b) { a = max<T>(a, b); }
template <class T, class U> inline void chmin(T & a, U const & b) { a = min<T>(a, b); }
template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }
template <typename T> ostream & operator << (ostream & out, vector<T> const & xs) { REP (i, int(xs.size()) - 1) out << xs[i] << ' '; if (not xs.empty()) out << xs.back(); return out; }

int main() {
    // input
    int n; cin >> n;

    // solve
    vector<vector<int> > parts;  // make a ceil(n/2)-partite graph
    if (n % 2 == 0) {
        REP (i, n / 2) {
            parts.push_back({ i + 1, n - i });
        }
    } else {
        REP (i, n / 2) {
            parts.push_back({ i + 1, n - 1 - i });
        }
        parts.push_back({ n });
    }
    vector<pair<int, int> > edges;
    REP (i, parts.size()) {
        REP (j, i) {
            for (int a : parts[i]) {
                for (int b : parts[j]) {
                    edges.emplace_back(a, b);
                }
            }
        }
    }

    // output
    cout << edges.size() << endl;
    for (auto edge : edges) {
        cout << edge.first << ' ' << edge.second << endl;
    }
    return 0;
}


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

int main()
{
    int P, Q, R, min;
    cin >> P >> Q >> R;
    min = P + Q;
    if (P + R < min)
        min = P + R;
    if (R + Q < min)
        min = R + Q;
    cout << min;
}

Measured memory_bytes: 256
import numpy as np
n=int(input())
a=list(map(int,input().split()))
a=np.array(a)
a=a//400
a1=[i for i in a if i<8]
a2=[i for i in a if i>=8]
k=len(set(a1))
m=k+len(a2)
#>8:m=8 else:m=k+len(a2)
if len(set(a1))!=0:s=len(set(a1))
else:s=1
print(s,m)

Measured memory_bytes: 12512
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))

class UnionFind:
    def __init__(self, n):
        self.d = [-1]*n
    
    def find(self, x):
        if self.d[x] < 0:
            return x
        else:
            self.d[x] = self.find(self.d[x])
            return self.find(self.d[x])
    
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x==y:
            return False
        if self.d[x] > self.d[y]:
            x, y = y, x
        self.d[x] += self.d[y]
        self.d[y] = x
        return True
    
    def same(self, x, y):
        if self.find(x)==self.find(y):
            return True
        return False
    
    def size(self, x):
        return (-1) * self.d[self.find(x)]

N, M = mi()
ab = li2(M)
cnt = M

for i in range(M):
    T = UnionFind(N)
    for j in range(M):
        if i != j:
            a, b = ab[j][0]-1, ab[j][1]-1
            if not T.same(a, b):
                T.unite(a, b)
    for k in range(N):
        if T.size(k) != N:
            break
    else:
        cnt -= 1

print(cnt)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb pushback
#define fr(i,n) for(int i=0;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)


int main() {
    string x;
	cin >> x;
      cout << x.substr(0, 5) <<" "<<x.substr(6, 7)<<" "<<x.substr(14, 5) <<endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#include<algorithm>
#include<cmath>
#include<map>
#define int long long int
#define mod 1000000007
int answer=0;
int power(int a,int b)
{
	if(b==0)
	    return 1;
	if(b==1)
	    return a;
	else 
	{
		if(b%2==0)
		{
			int r=power(a,b/2);
			r=r*r;
			return r;
		}
		else
		{
			int r=power(a,b/2);
			r=r*r;
			r=r*a;
			return r;
		}
	}
}
int stooi(string str)
{
	int l=str.size();
	int val=0;
	int j;
	for(j=0;j<l;j++)
	{
		val+=(str[j]-48)*power(10,l-1-j);
	}
	return val;
}
void function(string str,int initial)
{
	if(initial>=str.size()-1)
	{
		str.insert(str.size(),1,'+');
		int l=str.size();
		int j;
		for(j=0;j<l;j++)
	    {
			if(str[j]!='+')
			{
				string str2="";
				int k;
				for(k=j;k<l&&str[k]!='+';k++)
				    str2=str2+str[k];
				answer+=stooi(str2);
				j=k-1;
			}
		}
	}
	else
	{
		str.insert(initial+1,1,'+');
		function(str,initial+2);
		str.erase(initial+1,1);
		function(str,initial+1);
	}
}
int32_t main()
{
    string str;
    cin>>str;
    function(str,0);
    cout<<answer<<endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>

#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
using namespace std;

int N;
int X[102];
int Y[102];

signed main()
{
	cin >> N;
	REP(i, N) cin >> X[i] >> Y[i];

	if (N == 2)
	{
		cout << 0.5 << endl;
		cout << 0.5 << endl;
		return 0;
	}

	bool flg[100] = {};
	vector<int> pick;
	
	int min_i = -1;
	int min_x = INT_MAX;
	int min_y = INT_MAX;
	REP(i, N)
	{
		if (min_y == Y[i])
		{
			if (min_x > X[i])
			{
				min_x = X[i];
				min_i = i;
			}
		}
		if (min_y > Y[i])
		{
			min_y = Y[i];
			min_i = i;
			min_x = X[i];
		}
	}

	int A = min_i;
	while (true)
	{
		pick.push_back(A);
		flg[A] = true;
		int B = 0;

		int ab_x0 = X[B] - X[A];
		int ab_y0 = Y[B] - Y[A];


		double max_len = sqrt(ab_x0 * ab_x0 + ab_y0 * ab_y0);;

		for (int i = 1; i < N; i++)
		{
			int C = i;

			int ab_x = X[B] - X[A];
			int ab_y = Y[B] - Y[A];
			int ac_x = X[C] - X[A];
			int ac_y = Y[C] - Y[A];

			double cross = ab_x * ac_y - ac_x * ab_y;

			int dx = ac_x - ab_x;
			int dy = ac_y - ab_y;

			double len = sqrt(ac_x * ac_x + ac_y * ac_y);
			if (cross > 0 || (cross == 0 && len > max_len))
			{
				max_len = len;
				B = C;
			}
		}

		A = B;
		if (A == min_i) break;
	}

	cout << fixed << setprecision(10);

	if (pick.size() == 2)
	{
		REP(i, N)
		{
			if (flg[i]) cout << "0.5" << endl;
			else cout << "0.0" << endl;
		}
		return 0.0;
	}

	double ans_list[100] = {};
	double center_x;
	double center_y;

	for (int i = 0; i < pick.size(); i++)
	{
		int p1 = pick[(i - 1 + pick.size()) % pick.size()];
		int p2 = pick[(i + 0) % pick.size()];
		int p3 = pick[(i + 1) % pick.size()];

		double vx1 = X[p2] - X[p1];
		double vy1 = Y[p2] - Y[p1];
		double vx2 = X[p3] - X[p2];
		double vy2 = Y[p3] - Y[p2];

		double dot = vx1 * vx2 + vy1 * vy2;
		double len1 = sqrt(vx1 * vx1 + vy1 * vy1);
		double len2 = sqrt(vx2 * vx2 + vy2 * vy2);
		double temp = dot / (len1 * len2);
		double angle = acos(temp);
		double ans = angle / (2 * M_PI);

		ans_list[pick[i]] = ans;
	}

	REP(i, N)
	{
		cout << ans_list[i] << endl;
	}
}








Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using ll = long long;
using namespace std;

ll S(ll n) {
    ll res = 0;
    while (n > 0) {
        res += n % 10;
        n /= 10;
    }
    return res;
}

int main() {
    ll K;
    cin >> K;
    vector<ll> ans; 
    for (ll i = 0; i <= 15; i++) {
        for (ll j = 1; j <= 1000; j++) {
            if (i == 0 && j == 1) continue;
            ll tmp = j * pow(10ll, i) - 1;
            ans.push_back(tmp);
        }
    }
    sort(ans.begin(), ans.end());
    ans.erase(unique(ans.begin(), ans.end()), ans.end());
    
    for (ll i = 0; i < ans.size(); i++) {
        for (int j = i + 1; j < ans.size(); j++) {
            if ((long double) ans[i] / S(ans[i]) > (long double)ans[j] / S(ans[j])) {
                ans.erase(ans.begin() + i);
                i--;
                break;
            }
        }
    }
    for (int i = 0; i < K; i++) {
        cout << ans[i] << endl;
    }
}


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

int main() {
    int a, b, k; cin >> a >> b >> k;
    for (int i = min(a, b); i > 0; i--) {
        if (a % i == 0 && b % i == 0) k--;
        if (k == 0) {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

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



int main(void){
    int n, m;
    cin >> n >> m;
    signed long int a[n], b[n], c[n];
    for(int i = 0; i < n; i ++){
        cin >> a[i] >> b[i] >> c[i];
    }
    signed long int d[n], e[n], f[n], g[n], h[n], t[n], v[n], u[n];
    for(int i = 0; i < n; i++){
        d[i] = 0;
        e[i] = 0;
        f[i] = 0;
        g[i] = 0;
        h[i] = 0;
        t[i] = 0;
        v[i] = 0;
        u[i] = 0;
    }
    for(int i = 0; i < n; i++){
        d[i] = a[i] + b[i] + c[i];
    }
    for(int i = 0; i < n; i++){
        e[i] = a[i] + b[i] - c[i];
        
    }
    for(int i = 0; i < n; i++){
        f[i] = a[i] - b[i] + c[i];
        
    }
    for(int i = 0; i < n; i++){
        g[i] = a[i] - b[i] - c[i];
        
    }
    for(int i = 0; i < n; i++){
        h[i] = -a[i] + b[i] + c[i];
        
    }
    for(int i = 0; i < n; i++){
        t[i] = -a[i] + b[i] - c[i];
        
    }
    for(int i = 0; i < n; i++){
        v[i] = -a[i] - b[i] + c[i];
        
    }
    for(int i = 0; i < n; i++){
        u[i] = -a[i] - b[i] - c[i];
        
    }
    priority_queue<signed long int> Q;
    priority_queue<signed long int> R;
    priority_queue<signed long int> A;
    priority_queue<signed long int> B;
    priority_queue<signed long int> C;
    priority_queue<signed long int> D;
    priority_queue<signed long int> E;
    priority_queue<signed long int> F;
    for(int i = 0; i < n; i ++){
        Q.push(d[i]);
        R.push(e[i]);
        A.push(f[i]);
        B.push(g[i]);
        C.push(h[i]);
        D.push(t[i]);
        E.push(v[i]);
        F.push(u[i]);
        
    }
    signed long int aka = 0;
    signed long int aka_1 = 0;
    signed long int aka_2 = 0;
    signed long int aka_3 = 0;
    signed long int aka_4 = 0;
    signed long int aka_5 = 0;
    signed long int aka_6 = 0;
    signed long int aka_7 = 0;
    for(int i = 0; i < m; i++){
        aka += Q.top();
        Q.pop();
        aka_1 += R.top();
        R.pop();
        aka_2 += A.top();
        A.pop();
        aka_3 += B.top();
        B.pop();
        aka_4 += C.top();
        C.pop();
        aka_5 += D.top();
        D.pop();
        aka_6 += E.top();
        E.pop();
        aka_7 += F.top();
        F.pop();
    }
    signed long int max = aka;
    if(max < aka_1){
        max = aka_1;
        
    }
    if(max < aka_2){
        max = aka_2;
    }
    if(max < aka_3){
        max = aka_3;
    }
    if(max < aka_4){
        max = aka_4;
    }
    if(max < aka_5){
        max = aka_5;
    }
    if(max < aka_6){
        max = aka_6;
    }
    if(max < aka_7){
        max = aka_7;
    }
    
    cout << max << endl;
    
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <bitset>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
#define FOR(i,a,b)   for(ll i = (a); i < (b); i++ )
#define REP(i, n)    FOR(i,0,n)
typedef pair< ll, ll >   cp2;
typedef pair< string, cp2 >   cp3;
#define fi first
#define se second
#define sec  se.fi
#define thr  se.se
const ll mod = 1000000007;
//              123456789


///////////////////////////////////////////////
//
//
///////////////////////////////////////////////

////////////////////////////////////////////////
////////////////////////////////////////////////

int N;
int A[212345];
cp2 min1, min2;


int main(){
    
    cin>>N;
    REP( i, N ) cin>>A[i];
    
    min1 = cp2( 0, -1 );
    min2 = cp2( 0, -1 );
    
    REP( i, N ){
        if( min1.fi <= A[i] ){
            min2 = min1;
            min1.fi = A[i];
            min1.se = i;
        }
        else if( min2.fi <= A[i] ){
            min2.fi = A[i];
            min2.se = i;
        }
    }
    
    REP( i, N ){
        if( i != min1.se ) cout<<min1.fi<<endl;
        else{
            cout<<min2.fi<<endl;
        }
    }
    
    return 0;
}



Measured memory_bytes: 2432
// AOJ 2351 Closest Segment Pair
// 2018.3.17 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define INF     1e7
#define EPS     1e-5
#define RANGE	100
#define SIN     0.70710678118654752440084436210485    // Sin(45)
#define COS     0.70710678118654752440084436210485    // Cos(45)
#define SINCOS  SIN

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0, c = getchar_unlocked();
	do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
	return n;
}

typedef struct { double x1, y1, x2, y2; } S;
S seg[5105];

typedef struct { double x, y; } PP;
PP vsub(PP p1, PP p2) { PP r; r.x = p1.x - p2.x, r.y = p1.y - p2.y; return r; }
double dot(PP a, PP b) { return a.x * b.x + a.y * b.y; }
double cross(PP a, PP b) { return a.x * b.y - a.y * b.x; }
double norm(PP a) { return a.x * a.x + a.y * a.y; }
double vabs(PP a) { return hypot(a.x, a.y); }
int ccw(PP p0, PP p1, PP p2) { PP a, b;	double t;
	a = vsub(p1, p0), b = vsub(p2, p0), t = cross(a, b);
	if (t >  EPS) return 1;	if (t < -EPS) return -1;
	if (dot(a, b) < -EPS) return 2;	if (norm(a) < norm(b)) return -2;
	return 0;
}
int is_intersectSS(PP s1s, PP s1e, PP s2s, PP s2e)
{
	return ccw(s1s, s1e, s2s) * ccw(s1s, s1e, s2e) <= 0 &&
		   ccw(s2s, s2e, s1s) * ccw(s2s, s2e, s1e) <= 0;
}
double distanceLP(PP ss, PP se, PP p) {
	return fabs(cross(vsub(se, ss), vsub(p, ss)) / vabs(vsub(se, ss))); }
double distanceSP(PP ss, PP se, PP p)
{
	if (dot(vsub(se, ss), vsub(p, ss)) < 0) return vabs(vsub(p, ss));
	if (dot(vsub(ss, se), vsub(p, se)) < 0) return vabs(vsub(p, se));
	return distanceLP(ss, se, p);
}
double distanceSS(PP s1s, PP s1e, PP s2s, PP s2e)
{
	double res, x;
	if (is_intersectSS(s1s, s1e, s2s, s2e)) return 0;
	res = distanceSP(s1s, s1e, s2s);
	x = distanceSP(s1s, s1e, s2e); if (x < res) res = x;
	x = distanceSP(s2s, s2e, s1s); if (x < res) res = x;
	x = distanceSP(s2s, s2e, s1e); if (x < res) res = x;
	return res;
}

int cmp(S *a, S *b)
{
	if (fabs(a->x1 - b->x1) < EPS) {
		if (fabs(a->y1 - b->y1) < EPS) return 0;
		if (a->y1 < b->y1) return -1; return 1;
	}
	if (a->x1 < b->x1) return -1; return 1;
}

int main()
{
	int N, i, j, lim;
	int x1, y1, x2, y2;
	double x, ans;
	PP s1s, s1e, s2s, s2e;

	N = in();
	if (N > 5100) { puts("0"); return 0; }
	for (i = 0; i < N; i++) {
		x1 = in(), y1 = in(), x2 = in(), y2 = in();
		seg[i].x1 = (x1 - y1) * SINCOS, seg[i].y1 = (x1 + y1) * SINCOS;
		seg[i].x2 = (x2 - y2) * SINCOS, seg[i].y2 = (x2 + y2) * SINCOS;
	}
	qsort(seg, N, sizeof(S), cmp);

	ans = INF;
	for (i = 0; i < N; i++) {
		s1s.x = seg[i].x1, s1s.y = seg[i].y1, s1e.x = seg[i].x2, s1e.y = seg[i].y2;
		lim = i+RANGE; if (lim > N) lim = N; 
		for (j = i+1; j < lim; j++) {
			s2s.x = seg[j].x1, s2s.y = seg[j].y1, s2e.x = seg[j].x2, s2e.y = seg[j].y2;
			x = distanceSS(s1s, s1e, s2s, s2e);
			if (x == 0) { ans = 0; goto done; }
			if (x < ans) ans = x;
		}
	}
done:
	printf("%.8lf\n", ans);
	return 0;
}


Measured memory_bytes: 2092
#include<bits/stdc++.h>
#include<string>
#include <iostream>
using namespace std;
int main()
{
	string s;
	string t;
	cin>>s>>t;
	int flag=0;
	int i=0;
	while(i<s.size())
	{
		if(s[i]!=t[i])
		{
			cout<<"No"<<endl;
			flag=1;
			break;
		}
		else
		{
			i++;
		}		
	}
	if(!flag){cout<<"Yes"<<endl;}
	
	return 0;

}

Measured memory_bytes: 3620
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long lng;
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define ALL(a) (a).begin(), (a).end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) //ATTENTION: <a> must be sorted in advance

lng power(lng b, lng n) {lng sol=1; while(n>0) {if(n&1) {sol=sol*b;} n>>=1; b*= b;} return sol;} //calculate b^n

const int MOD = 1000000007; //10^9+7


/*********** variables ************/

/**********************************/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    int x=0;
    REP(i, s.size()) {
        if(s[i]=='I')x++;
        else x--;
        ans = max(ans, x);
    }
    cout << ans << endl;
}


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

using namespace std;

#define INF 210000000
#define int long long

int gcd(int a, int b) {
  int amari = a % b;
  int c = b;
  if (amari == 0) {
    return b;
  } else {
    return gcd(b, amari);
  }
}

int lcm(int a, int b) { return a * b / gcd(a, b); }

bool cmp(int a,int b){
		return a > b;
}

signed main() {
		int n;
		cin >> n;
		if(n == 1){
				cout << "Hello World" << endl;
		}else{
				int a,b;
				cin >> a >> b;
				cout << a + b << endl;
		}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int gcd(int a,int b)
{
	if(b==0)
	return a;
	
	return gcd(b,a%b);
}
int power(int x,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;
}
int modInverse(int n,int p)
{
	return power(n,p-2,p);
}
int main() {
	// your code goes here
	 ios_base::sync_with_stdio(0);
	 cin.tie(0);
	 int a;cin>>a;
	 cout<<a+a*a+a*a*a<<'\n';
	 return 0;
}


Measured memory_bytes: 3648
main = do
 [w,h,_] <- map read . words <$> getLine
 xyas <- map (map read . words) . lines <$> getContents
 let (xs,ys) = foldr paint ([1..w],[1..h]) xyas
 print (length xs * length ys)

paint [x,_,1] (xs,ys) = (dropWhile (<=x) xs, ys)
paint [x,_,2] (xs,ys) = (takeWhile (<=x) xs, ys)
paint [_,y,3] (xs,ys) = (xs, dropWhile (<=y) ys)
paint [_,y,4] (xs,ys) = (xs, takeWhile (<=y) ys)

Measured memory_bytes: 1020
#include<iostream>
#include<vector>
#include<sstream>
#include<string>
#include<numeric>
#include <algorithm>
#include<math.h>
#include<cstdio>
#include<string.h>
#include<unistd.h>
#include <array>
#include <map> 




using namespace std;
typedef long long ll;
struct point{
  int x;
  int y;

};
int gcd(int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd
int lcm( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm
int input(){
  int x;
  cin>>x;
  return x;
}

int moji(char in)
{
    int ans = (int)in-(int)'a';
    if((ans < 0) || (ans > 25)){
        ans = 26;
    }
    return ans;
}
const int VV=10;//場合に応じてVVの値のみ変更する必要あり
//dijkstra(s)sがスタート地点でそこからの最短距離を配列dで表す。正の重みのみ使用可能
int cost[VV][VV];
int d[VV];
bool used[VV];
void dijkstra(int s){
  fill(d,d+VV,100000);
  fill(used,used+VV,false);
  d[s]=0;
  while(true){
    int v=-1;
    for(int u=0;u<VV;u++){
      if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
    }
    if(v==-1)break;
    used[v]=true;
    for(int u=0;u<VV;u++){
      d[u]=min(d[u],d[v]+cost[v][u]);
    }
  }

}

int compare_int(const void *a, const void *b)//qsort(quick sort利用時に使用)
{
    return *(int*)a - *(int*)b;
}

int binary_searchh(long long x,long long k[],int n){
  int l=0;
  int r=n;
  while(r-l>=1){
    int i=(l+r)/2;
    if(k[i]==x)return i;
    else if(k[i]<x)l=i+1;
    else r=i;
  }
  return -1;
}

struct File {
    int aa;
    int bb;

    File(const int& aa, const int& bb)
        : aa(aa), bb(bb) {}
};

bool operator<(const File& a, const File& b)
{
    // ファイル種別、ファイル名の順番で優先順位を付けて比較
    return std::tie(a.aa, a.bb) < std::tie(b.aa, b.bb);
}




int main(){
  int N;
  cin>>N;
  int A[N];
  int B[N];
  for(int i=0;i<N;i++){
    cin>>A[i]>>B[i];
  }
  int c[N];
  for(int i=0;i<N;i++){
    c[i]=A[i]+B[i];
  }
  long long sum=0;
  for(int i=0;i<N;i++){
    sum-=B[i];
  }
  sort(c,c+N);
  reverse(c,c+N);
    for(int i=0;i<N;i+=2){
      sum+=c[i];
    }
  
  cout<<sum<<endl;
  



  /*std::array<int,2>c[N];
  multimap<int,int>m;

  for(int i=0;i<N;i++){
    c[i][1]=i;
    c[i][0]=A[i]-B[i];
    m.insert(make_pair(c[i][0],i));
  }
  std::sort(&c[0], &c[N-1], [](auto& x, auto& y){return x[0] < y[0];});
  long long sum=0;
  for(int i=0;i<N/2+i++){
    int l=c[N-1-i][0];
    int x=0;
    int max=0;
    auto p = m.equal_range(l);

  for (auto it = p.first; it != p.second; ++it) {
    if(max<A[c[it->second]]){
      max=A[it->second];
      x=it->second;
    }
  }
  m.erase(l,x);
  sum+=min;
    l=c[i][0];
    x=0;
    int min=1000000009;
    auto p = m.equal_range(l);

  for (auto it = p.first; it != p.second; ++it) {
    if(min<B[c[it->second]]){
      min=B[it->second];
      x=it->second;
    }
  }
  sum-=min;
  m.erase(l,x);





  }
  cout<<sum<<endl;*/





  


}


  
  

Measured memory_bytes: 1408
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> d(n);
  REP(i,n) cin >> d[i];
  int out = 0;
  REP(i,n-1){
    FOR(j,i+1,n){
      out += d[i] * d[j];
    }
  }
  cout << out << endl;
  return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <queue>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int gcd(int a, int b){
   int tmp;
   while(a%b==0){
      tmp=a%b;
      a=b;
      b=tmp;
   }
}

int lcm(int a,int b){
   return a*b/gcd(a,b);
}

bool prime_number(int n){
   if(n < 2){
      return false;
   }
   else if(n == 2){
      return true;
   }
   if(n % 2 == 0){
      return false;
   }
   for(int i=3;i<=n/i;i+=2){
      if(n % i == 0) return false;
      return true;
   }
}

int main(){
   VI a;
   int x;
   REP(i,5){
      cin >> x;
      a.PB(x);
   }
   SORT(a);
   REP(i,5){
      cout << a[4-i];
      if(i!=4) cout << " ";
   }
   cout << endl;
   return 0;
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
   ll n,m;
   cin>>n>>m;
   if(n<m) cout<<min(n,abs(m-n))<<"\n";
   else if(n%m==0) cout<<0<<"\n";
   else cout<<m-(n%m)<<"\n" ;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for (ll i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)

void solve() 
{
    long double a,b;cin>>a>>b;
    cout<<setprecision(20)<<floor(a*b)<<endl;
}

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

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

public class Main{

	static class FastReader{
		BufferedReader br;
		StringTokenizer st;
		public FastReader(){
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		public String next(){
			try{
				while(st==null||!st.hasMoreElements()){
					st = new StringTokenizer(br.readLine());
				}
			}catch(Exception e){
				e.printStackTrace();
			}
			return st.nextToken();

		}
		public int nextInt(){
			return Integer.parseInt(next());
		}
		public long nextLong(){
			return Long.parseLong(next());
		}
		public double nextDouble(){
			return Double.parseDouble(next());
		}
		public String nextLine(){
			String s = "";
			try{
				s = br.readLine();
			}catch(Exception e){
				e.printStackTrace();
			}	
			return s;		
		}
	} 
	public static void go(int a,int b,int c,PrintWriter out){

		for(int i=1;i<=1000;i++){
			if((b*i+c)%a==0){
				out.println("YES");
				return;
			}
		}		
		out.println("NO");
		return;

	}	
	public static void main(String[] args){
		FastReader in = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		int a = in.nextInt();
		int b = in.nextInt();
		int c = in.nextInt();
		go(a,b,c,out);
		out.flush();
		out.close();  
	}

}





Measured memory_bytes: 22740
HMK = list(map(int, input().split()))
H1 = HMK[0]
M1 = HMK[1]
H2 = HMK[2]
M2 = HMK[3]
K = HMK[4]
if H2 < H1:
	H2 += 24
ans = ((H2 - H1) * 60 + (M2 - M1)) - K
print(ans)


Measured memory_bytes: 9180
#include<iostream>
using namespace std;
int main()
{
  int n;
  int m;
  string s;
  for(;cin>>n,n;)
    {
      cin>>m;
      string check="I";
      for(int i=0;i<n;i++)
	  check+="OI";
      cin>>s;
      int ans=0;
      for(int i=0;i<s.size()-check.size();i++)
	{
	  if(check==s.substr(i,check.size()))
	    ans++;
	}
      cout<<ans<<endl;
    }

}

Measured memory_bytes: 2160
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

using ll = long long;
using ull = uint64_t;
using P = pair<int, int>;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

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

    int n;
    cin >> n;
    vector<ll> a(n);
    ll XorSum = 0;
    for(int i = 0; i < n; ++i){
        cin >> a[i];
        XorSum ^= a[i];
    }
    if(XorSum == 0){
        cout << 0 << endl;
        return 0;
    }
    XorSum ^= a[0];
    XorSum ^= a[1];
    ll X = a[0] + a[1] - XorSum;
    if(X % 2 != 0){
        cout << -1 << endl;
        return 0;
    }
    X >>= 1;
    if(X & XorSum){
        cout << -1 << endl;
        return 0;
    }
    
    ll A = X, B = X;
    for(int d = 50; d >= 0; --d){
        if(A >> d & 1)  continue;
        if(XorSum >> d & 1){
            if(A + (1LL << d) <= a[0]){
                A += 1LL << d;
            }
            else{
                B += 1LL << d;
            }
        }
    }
    if(A <= 0 || B < a[1]){
        cout << -1 << endl;
        return 0;
    }
    ll ans = a[0] - A;
    if(ans < 0) cout << -1 << endl;
    else    cout << ans << endl;
}

Measured memory_bytes: 3664
//Date and time of submission: 
 
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll N=1e5+5;
ll a,b,c;
int main() {
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	cin>>a>>b>>c;
	if(a+b==c||a+c==b||b+c==a)
	cout<<"Yes";
	else
	cout<<"No";
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int k,n,i;
  cin>>k>>n;
  int a[n];
  
  for(i=0;i<n;i++)
    cin>>a[i];
  
 int min=a[n-1]-a[0];
  
  int l=a[0]+k-a[1];
  if(min>l)
    min=l;
  
  for(i=1;i<n-1;i++){
   int sm=k-a[i]+a[i-1];
 int s=a[i]+k-a[i+1];
  if(s<sm && min>s)
    min=s;
  else if(s>sm && min>sm)
    min=sm;
}
    int p=k-a[n-1]+a[n-2];
  
    if(min>p)
      cout<<p;
  else
    cout<<min;
}
  


Measured memory_bytes: 1024